66 */
77'use strict' ;
88
9+ PopoverRegistry . $inject = [ "$animate" ] ;
10+ PopoverDirective . $inject = [ "$q" , "$timeout" , "$templateCache" , "$compile" , "PopoverRegistry" , "PositionHelper" , "$animate" ] ;
11+ DropdownDirective . $inject = [ "$document" , "$timeout" ] ;
12+ DropdownToggleDirective . $inject = [ "$timeout" ] ;
13+ DropdownMenuDirective . $inject = [ "$animate" ] ;
914Object . defineProperty ( exports , "__esModule" , {
1015 value : true
1116} ) ;
@@ -214,7 +219,7 @@ function SortableDirective($timeout) {
214219 if ( nextEl !== dragEl . nextSibling ) {
215220 $scope . onSortableSort ( {
216221 event : evt ,
217- columnId : _angular2 . default . element ( dragEl ) . attr ( 'data-id' )
222+ columnId : angular . element ( dragEl ) . attr ( 'data-id' )
218223 } ) ;
219224 }
220225 }
@@ -609,7 +614,7 @@ function AdjustColumnWidths(allColumns, expectedWidth) {
609614 */
610615function ScaleColumns ( colsByGroup , maxWidth , totalFlexGrow ) {
611616 // calculate total width and flexgrow points for coulumns that can be resized
612- _angular2 . default . forEach ( colsByGroup , function ( cols ) {
617+ angular . forEach ( colsByGroup , function ( cols ) {
613618 cols . forEach ( function ( column ) {
614619 if ( ! column . canAutoResize ) {
615620 maxWidth -= column . width ;
@@ -628,7 +633,7 @@ function ScaleColumns(colsByGroup, maxWidth, totalFlexGrow) {
628633 var _loop = function _loop ( ) {
629634 var widthPerFlexPoint = remainingWidth / totalFlexGrow ;
630635 remainingWidth = 0 ;
631- _angular2 . default . forEach ( colsByGroup , function ( cols ) {
636+ angular . forEach ( colsByGroup , function ( cols ) {
632637 cols . forEach ( function ( column , i ) {
633638 // if the column can be resize and it hasn't reached its minimum width yet
634639 if ( column . canAutoResize && ! hasMinWidth [ i ] ) {
@@ -730,7 +735,7 @@ var DataTableController = function () {
730735 } ) ;
731736
732737 // if preAssignBindingsEnabled === true and no $onInit
733- if ( _angular2 . default . version . major === 1 && _angular2 . default . version . minor < 5 ) {
738+ if ( angular . version . major === 1 && angular . version . minor < 5 ) {
734739 this . init ( ) ;
735740 }
736741 }
@@ -764,6 +769,7 @@ var DataTableController = function () {
764769 var watch = this . $scope . $watch ( 'dt.rows' , function ( newVal ) {
765770 if ( newVal ) {
766771 watch ( ) ;
772+
767773 _this . onSorted ( ) ;
768774 }
769775 } ) ;
@@ -780,9 +786,9 @@ var DataTableController = function () {
780786
781787 this . expanded = this . expanded || { } ;
782788
783- this . options = _angular2 . default . extend ( _angular2 . default . copy ( TableDefaults ) , this . options ) ;
789+ this . options = angular . extend ( angular . copy ( TableDefaults ) , this . options ) ;
784790
785- _angular2 . default . forEach ( TableDefaults . paging , function ( v , k ) {
791+ angular . forEach ( TableDefaults . paging , function ( v , k ) {
786792 if ( ! _this2 . options . paging [ k ] ) {
787793 _this2 . options . paging [ k ] = v ;
788794 }
@@ -792,8 +798,8 @@ var DataTableController = function () {
792798 this . selected = this . selected || [ ] ;
793799
794800 this . $scope . $watch ( 'dt.selected' , function ( newVal , oldVal ) {
795- _angular2 . default . forEach ( _this2 . options . columns , function ( column ) {
796- if ( column . headerCheckbox && _angular2 . default . isFunction ( column . headerCheckboxCallback ) ) {
801+ angular . forEach ( _this2 . options . columns , function ( column ) {
802+ if ( column . headerCheckbox && angular . isFunction ( column . headerCheckboxCallback ) ) {
797803 column . headerCheckboxCallback ( _this2 ) ;
798804 }
799805 } ) ;
@@ -814,7 +820,7 @@ var DataTableController = function () {
814820 var column = this . options . columns [ i ] ;
815821 column . $id = ObjectId ( ) ;
816822
817- _angular2 . default . forEach ( ColumnDefaults , function ( v , k ) {
823+ angular . forEach ( ColumnDefaults , function ( v , k ) {
818824 if ( ! column . hasOwnProperty ( k ) ) {
819825 column [ k ] = v ;
820826 }
@@ -1158,16 +1164,16 @@ var DataTableService = {
11581164 //FIXME: Too many nested for loops. O(n3)
11591165
11601166 // Iterate through each dTable
1161- _angular2 . default . forEach ( this . dTables , function ( columnElms , id ) {
1167+ angular . forEach ( this . dTables , function ( columnElms , id ) {
11621168 _this3 . columns [ id ] = [ ] ;
11631169
11641170 // Iterate through each column
1165- _angular2 . default . forEach ( columnElms , function ( c ) {
1171+ angular . forEach ( columnElms , function ( c ) {
11661172 var column = { } ;
11671173
11681174 var visible = true ;
11691175 // Iterate through each attribute
1170- _angular2 . default . forEach ( c . attributes , function ( attr ) {
1176+ angular . forEach ( c . attributes , function ( attr ) {
11711177 var attrName = CamelCase ( attr . name ) ;
11721178
11731179 // cuz putting className vs class on
@@ -1286,9 +1292,13 @@ function DataTableDirective($window, $timeout, $parse) {
12861292 ctrl . adjustColumns ( ) ;
12871293 }
12881294
1289- $window . addEventListener ( 'resize' , throttle ( function ( ) {
1290- $timeout ( resize ) ;
1291- } ) ) ;
1295+ function _calculateResize ( ) {
1296+ throttle ( function ( ) {
1297+ $timeout ( resize ) ;
1298+ } ) ;
1299+ }
1300+
1301+ $window . addEventListener ( 'resize' , _calculateResize ) ;
12921302
12931303 // When an item is hidden for example
12941304 // in a tab with display none, the height
@@ -1306,7 +1316,7 @@ function DataTableDirective($window, $timeout, $parse) {
13061316
13071317 // prevent memory leaks
13081318 $scope . $on ( '$destroy' , function ( ) {
1309- _angular2 . default . element ( $window ) . off ( 'resize' ) ;
1319+ angular . element ( $window ) . off ( 'resize' ) ;
13101320 } ) ;
13111321 }
13121322 } ;
@@ -1497,17 +1507,17 @@ function HeaderDirective($timeout) {
14971507
14981508 $scope . columnsResorted = function ( event , columnId ) {
14991509 var col = findColumnById ( columnId ) ,
1500- parent = _angular2 . default . element ( event . currentTarget ) ,
1510+ parent = angular . element ( event . currentTarget ) ,
15011511 newIdx = - 1 ;
15021512
1503- _angular2 . default . forEach ( parent . children ( ) , function ( c , i ) {
1504- if ( columnId === _angular2 . default . element ( c ) . attr ( 'data-id' ) ) {
1513+ angular . forEach ( parent . children ( ) , function ( c , i ) {
1514+ if ( columnId === angular . element ( c ) . attr ( 'data-id' ) ) {
15051515 newIdx = i ;
15061516 }
15071517 } ) ;
15081518
15091519 $timeout ( function ( ) {
1510- _angular2 . default . forEach ( ctrl . columns , function ( group ) {
1520+ angular . forEach ( ctrl . columns , function ( group ) {
15111521 var idx = group . indexOf ( col ) ;
15121522 if ( idx > - 1 ) {
15131523
@@ -1537,6 +1547,8 @@ function HeaderDirective($timeout) {
15371547}
15381548
15391549var HeaderCellController = function ( ) {
1550+ /* @ngInject */
1551+ HeaderCellController . $inject = [ "$scope" ] ;
15401552 function HeaderCellController ( $scope ) {
15411553 _classCallCheck ( this , HeaderCellController ) ;
15421554
@@ -1700,11 +1712,11 @@ function HeaderCellDirective($compile) {
17001712 }
17011713
17021714 if ( ctrl . column . headerTemplate ) {
1703- var elm = _angular2 . default . element ( '<span>' + ctrl . column . headerTemplate . trim ( ) + '</span>' ) ;
1704- _angular2 . default . element ( label ) . append ( $compile ( elm ) ( cellScope ) ) ;
1715+ var elm = angular . element ( '<span>' + ctrl . column . headerTemplate . trim ( ) + '</span>' ) ;
1716+ angular . element ( label ) . append ( $compile ( elm ) ( cellScope ) ) ;
17051717 } else if ( ctrl . column . headerRenderer ) {
1706- var _elm = _angular2 . default . element ( ctrl . column . headerRenderer ( $elm ) ) ;
1707- _angular2 . default . element ( label ) . append ( $compile ( _elm ) ( cellScope ) [ 0 ] ) ;
1718+ var _elm = angular . element ( ctrl . column . headerRenderer ( $elm ) ) ;
1719+ angular . element ( label ) . append ( $compile ( _elm ) ( cellScope ) [ 0 ] ) ;
17081720 } else {
17091721 var val = ctrl . column . name ;
17101722 if ( val === undefined || val === null ) val = '' ;
@@ -3001,7 +3013,7 @@ function CellDirective($rootScope, $compile, $log, $timeout) {
30013013 compile : function compile ( ) {
30023014 return {
30033015 pre : function pre ( $scope , $elm , $attrs , ctrl ) {
3004- var content = _angular2 . default . element ( $elm [ 0 ] . querySelector ( '.dt-cell-content' ) ) ,
3016+ var content = angular . element ( $elm [ 0 ] . querySelector ( '.dt-cell-content' ) ) ,
30053017 cellScope ;
30063018
30073019 // extend the outer scope onto our new cell scope
@@ -3023,11 +3035,11 @@ function CellDirective($rootScope, $compile, $log, $timeout) {
30233035
30243036 if ( ctrl . column . template ) {
30253037 content . empty ( ) ;
3026- var elm = _angular2 . default . element ( '<span>' + ctrl . column . template . trim ( ) + '</span>' ) ;
3038+ var elm = angular . element ( '<span>' + ctrl . column . template . trim ( ) + '</span>' ) ;
30273039 content . append ( $compile ( elm ) ( cellScope ) ) ;
30283040 } else if ( ctrl . column . cellRenderer ) {
30293041 content . empty ( ) ;
3030- var elm = _angular2 . default . element ( ctrl . column . cellRenderer ( cellScope , content ) ) ;
3042+ var elm = angular . element ( ctrl . column . cellRenderer ( cellScope , content ) ) ;
30313043 content . append ( $compile ( elm ) ( cellScope ) ) ;
30323044 } else {
30333045 content [ 0 ] . innerHTML = ctrl . getValue ( ) ;
@@ -3350,7 +3362,7 @@ function PopoverDirective($q, $timeout, $templateCache, $compile, PopoverRegistr
33503362 return '' ;
33513363 }
33523364
3353- if ( _angular2 . default . isString ( template ) && plain ) {
3365+ if ( angular . isString ( template ) && plain ) {
33543366 return template ;
33553367 }
33563368
@@ -3417,27 +3429,27 @@ function PopoverDirective($q, $timeout, $templateCache, $compile, PopoverRegistr
34173429 }
34183430
34193431 if ( $scope . options . text && ! $scope . options . template ) {
3420- $scope . popover = _angular2 . default . element ( '<div class="dt-popover popover-text\n popover' + $scope . options . placement + '" id="' + $scope . popoverId + '"></div>' ) ;
3432+ $scope . popover = angular . element ( '<div class="dt-popover popover-text\n popover' + $scope . options . placement + '" id="' + $scope . popoverId + '"></div>' ) ;
34213433
34223434 $scope . popover . html ( $scope . options . text ) ;
3423- _angular2 . default . element ( document . body ) . append ( $scope . popover ) ;
3435+ angular . element ( document . body ) . append ( $scope . popover ) ;
34243436 positionPopover ( $element , $scope . popover , $scope . options ) ;
34253437 PopoverRegistry . add ( $scope . popoverId , { element : $element , popover : $scope . popover , group : $scope . options . group } ) ;
34263438 } else {
34273439 $q . when ( loadTemplate ( $scope . options . template , $scope . options . plain ) ) . then ( function ( template ) {
3428- if ( ! _angular2 . default . isString ( template ) ) {
3429- if ( template . data && _angular2 . default . isString ( template . data ) ) {
3440+ if ( ! angular . isString ( template ) ) {
3441+ if ( template . data && angular . isString ( template . data ) ) {
34303442 template = template . data ;
34313443 } else {
34323444 template = '' ;
34333445 }
34343446 }
34353447
3436- $scope . popover = _angular2 . default . element ( '<div class="dt-popover\n popover-' + $scope . options . placement + '" id="' + $scope . popoverId + '"></div>' ) ;
3448+ $scope . popover = angular . element ( '<div class="dt-popover\n popover-' + $scope . options . placement + '" id="' + $scope . popoverId + '"></div>' ) ;
34373449
34383450 $scope . popover . html ( template ) ;
34393451 $compile ( $scope . popover ) ( $scope ) ;
3440- _angular2 . default . element ( document . body ) . append ( $scope . popover ) ;
3452+ angular . element ( document . body ) . append ( $scope . popover ) ;
34413453 positionPopover ( $element , $scope . popover , $scope . options ) ;
34423454
34433455 // attach exit and enter events to popover
@@ -3526,7 +3538,7 @@ function PopoverDirective($q, $timeout, $templateCache, $compile, PopoverRegistr
35263538 * @param {object } popoverDimensions
35273539 */
35283540 function addCaret ( popoverEl , elDimensions , popoverDimensions ) {
3529- var caret = _angular2 . default . element ( '<span class="popover-caret caret-' + $scope . options . placement + '"></span>' ) ;
3541+ var caret = angular . element ( '<span class="popover-caret caret-' + $scope . options . placement + '"></span>' ) ;
35303542 popoverEl . append ( caret ) ;
35313543 var caretDimensions = caret [ 0 ] . getBoundingClientRect ( ) ;
35323544
@@ -3655,7 +3667,7 @@ function PositionHelper() {
36553667 } ;
36563668}
36573669
3658- var popover = _angular2 . default . module ( 'dt.popover' , [ ] ) . service ( 'PopoverRegistry' , PopoverRegistry ) . factory ( 'PositionHelper' , PositionHelper ) . directive ( 'popover' , PopoverDirective ) ;
3670+ var popover = angular . module ( 'dt.popover' , [ ] ) . service ( 'PopoverRegistry' , PopoverRegistry ) . factory ( 'PositionHelper' , PositionHelper ) . directive ( 'popover' , PopoverDirective ) ;
36593671
36603672var MenuController = function ( ) {
36613673
@@ -3803,9 +3815,9 @@ function DropdownMenuDirective($animate) {
38033815 } ;
38043816}
38053817
3806- var dropdown = _angular2 . default . module ( 'dt.dropdown' , [ ] ) . controller ( 'DropdownController' , DropdownController ) . directive ( 'dropdown' , DropdownDirective ) . directive ( 'dropdownToggle' , DropdownToggleDirective ) . directive ( 'dropdownMenu' , DropdownMenuDirective ) ;
3818+ var dropdown = angular . module ( 'dt.dropdown' , [ ] ) . controller ( 'DropdownController' , DropdownController ) . directive ( 'dropdown' , DropdownDirective ) . directive ( 'dropdownToggle' , DropdownToggleDirective ) . directive ( 'dropdownMenu' , DropdownMenuDirective ) ;
38073819
3808- var menu = _angular2 . default . module ( 'dt.menu' , [ dropdown . name ] ) . controller ( 'MenuController' , MenuController ) . directive ( 'dtm' , MenuDirective ) ;
3820+ var menu = angular . module ( 'dt.menu' , [ dropdown . name ] ) . controller ( 'MenuController' , MenuController ) . directive ( 'dtm' , MenuDirective ) ;
38093821
38103822var dataTable = _angular2 . default . module ( 'data-table' , [ ] ) . directive ( 'dtable' , DataTableDirective ) . directive ( 'resizable' , ResizableDirective ) . directive ( 'sortable' , SortableDirective ) . directive ( 'dtHeader' , HeaderDirective ) . directive ( 'dtHeaderCell' , HeaderCellDirective ) . directive ( 'dtBody' , BodyDirective ) . directive ( 'dtScroller' , ScrollerDirective ) . directive ( 'dtSeletion' , SelectionDirective ) . directive ( 'dtRow' , RowDirective ) . directive ( 'dtGroupRow' , GroupRowDirective ) . directive ( 'dtCell' , CellDirective ) . directive ( 'dtFooter' , FooterDirective ) . directive ( 'dtPager' , PagerDirective ) ;
38113823
0 commit comments