mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-30 07:59:50 -08:00
7 lines
2 KiB
JavaScript
7 lines
2 KiB
JavaScript
|
/*
|
||
|
* bootstrap-table - v1.9.1 - 2015-10-25
|
||
|
* https://github.com/wenzhixin/bootstrap-table
|
||
|
* Copyright (c) 2015 zhixin wen
|
||
|
* Licensed MIT License
|
||
|
*/
|
||
|
!function(){"undefined"!=typeof angular&&angular.module("bsTable",[]).directive("bsTableControl",function(){function a(a){var b;return $.each(f,function(d,e){return e.$el.closest(c).has(a).length?(b=e,!0):void 0}),b}function b(){var a=this,b=a.$s.bsTableControl.state;a.$s.$applyAsync(function(){b.scroll=a.$el.bootstrapTable("getScrollPosition")})}var c=".bootstrap-table",d=".fixed-table-body",e=".search input",f={};return $(window).resize(function(){$.each(f,function(a,b){b.$el.bootstrapTable("resetView")})}),$(document).on("post-header.bs.table",c+" table",function(e){var f=a(e.target);f&&f.$el.closest(c).find(d).on("scroll",b.bind(f))}).on("sort.bs.table",c+" table",function(b,c,d){var e=a(b.target);if(e){var f=e.$s.bsTableControl.state;e.$s.$applyAsync(function(){f.sortName=c,f.sortOrder=d})}}).on("page-change.bs.table",c+" table",function(b,c,d){var e=a(b.target);if(e){var f=e.$s.bsTableControl.state;e.$s.$applyAsync(function(){f.pageNumber=c,f.pageSize=d})}}).on("search.bs.table",c+" table",function(b,c){var d=a(b.target);if(d){var e=d.$s.bsTableControl.state;d.$s.$applyAsync(function(){e.searchText=c})}}).on("focus blur",c+" "+e,function(b){var c=a(b.target);if(c){var d=c.$s.bsTableControl.state;c.$s.$applyAsync(function(){d.searchHasFocus=$(b.target).is(":focus")})}}),{restrict:"EA",scope:{bsTableControl:"="},link:function(a,b){f[a.$id]={$s:a,$el:b};a.instantiated=!1,a.$watch("bsTableControl.options",function(d){d||(d=a.bsTableControl.options={});var f=a.bsTableControl.state||{};a.instantiated&&b.bootstrapTable("destroy"),b.bootstrapTable(angular.extend(angular.copy(d),f)),a.instantiated=!0,"scroll"in f&&b.bootstrapTable("scrollTo",f.scroll),"searchHasFocus"in f&&b.closest(c).find(e).focus()},!0),a.$watch("bsTableControl.state",function(c){c||(c=a.bsTableControl.state={}),b.trigger("directive-updated.bs.table",[c])},!0),a.$on("$destroy",function(){delete f[a.$id]})}}})}();
|