From 41d223d81fe84416e78679ec781837609894e29f Mon Sep 17 00:00:00 2001 From: Jon Shaffer Date: Tue, 10 Jan 2017 16:13:53 -0500 Subject: [PATCH] importing angular without reassigning angular variable --- config.js | 1 - gulpfile.babel.js | 1 + gulpfile.js | 4 ++++ release/dataTable.cjs.js | 4 ++-- release/dataTable.es6.js | 8 ++++---- release/dataTable.js | 4 ++-- release/dataTable.min.js | 4 ++-- src/components/menu/menu.js | 2 -- src/components/popover/popover.js | 2 -- src/dataTable.js | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 gulpfile.js diff --git a/config.js b/config.js index 8153180..9b92f76 100644 --- a/config.js +++ b/config.js @@ -14,7 +14,6 @@ System.config({ 'github:*': 'jspm_packages/github/*', 'npm:*': 'jspm_packages/npm/*', }, - map: { angular: 'npm:angular@1.5.8', babel: 'npm:babel-core@5.8.38', diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 45b9722..e58f809 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -83,6 +83,7 @@ gulp.task('serve', ['compile'], (callback) => { gulp.task('watch', ['serve'], () => { const watcher = gulp.watch([path.source, path.less, '*.html'], ['compile']); + watcher.on('change', (event) => { gutils.log(`File ${event.path} was ${event.type}, running tasks...`); }); diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..f8eb03e --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,4 @@ +/* eslint-disable */ +require('babel-core/register'); + +require('./gulpfile.babel.js'); diff --git a/release/dataTable.cjs.js b/release/dataTable.cjs.js index 41e847a..827f043 100644 --- a/release/dataTable.cjs.js +++ b/release/dataTable.cjs.js @@ -4,5 +4,5 @@ * @link http://jonshaffer.github.io/angular-data-table/ * @license MIT */ -"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&s.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=s[0].clientWidth;e'),s=o.parent(),a=void 0;l.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(l)}}}function SortableDirective(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(l,t)?t.parentNode.insertBefore(l,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(l,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),l.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),s!==l.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(l).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,l=n.target,s=l.nextSibling,l.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",l.textContent),t.on("dragenter",o),t.on("dragend",i))}var l=void 0,s=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function ObjectId(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function ColumnsByPin(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,l=r/i.length,s=o>t;i.forEach(function(e){if(s)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+l;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function throttle(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),l=0;l\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,l){function s(){var e=i[0].getBoundingClientRect();if(l.options.internal.innerWidth=Math.floor(e.width),l.options.scrollbarV){var t=e.height;l.options.headerHeight&&(t-=l.options.headerHeight),l.options.footerHeight&&(t-=l.options.footerHeight),l.options.internal.bodyHeight=t,l.calculatePageSize()}l.adjustColumns()}function a(){throttle(function(){t(s)})}DataTableService.buildColumns(o,n);var c=i.attr("data-column-id"),u=DataTableService.columns[c];u&&(l.options.columns=u),l.transposeColumnDefaults(),l.options.internal.scrollBarWidth=ScrollbarWidth(),e.addEventListener("resize",a);var d=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?s():t(e,100)};d(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function GetVendorPrefixedName(e){var t=CamelCase(e);return cache[t]||(angular.isDefined(testStyle[prefix.css+e])?cache[t]=prefix.css+e:angular.isDefined(testStyle[e])&&(cache[t]=e)),cache[t]}function TranslateXY(e,t,n){hasCSSTransforms?!isSafari&&hasCSS3DTransforms?(e[transform]="translate3d("+t+"px, "+n+"px, 0)",e[backfaceVisibility]="hidden"):e[CamelCase(transform)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function HeaderDirective(e){return{restrict:"E",controller:HeaderController,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),l=angular.element(t.currentTarget),s=-1;angular.forEach(l.children(),function(e,t){n===angular.element(e).attr("data-id")&&(s=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[s],r=i.options.columns.indexOf(n),l=i.options.columns.indexOf(o);return i.options.columns.splice(l,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function HeaderCellDirective(e){return{restrict:"E",controller:HeaderCellController,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),l=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(l=i.options.$outer.$new(!1),l.$header=i.column.name,l.$index=t.$index),i.column.headerTemplate){var s=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(s)(l))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(l)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function BodyDirective(){return{restrict:"E",controller:BodyController,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function ScrollerDirective(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),s=!1}function r(){s||(requestAnimFrame(i),s=!0)}var l=t.parent(),s=!1,a=0,c=0;o.options.internal.styleTranslator=new StyleTranslator(o.options.rowHeight),o.options.internal.setYOffset=function(e){l[0].scrollTop=e},l.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){l.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function SelectionDirective(){return{controller:SelectionController,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function RowDirective(){return{restrict:"E",controller:RowController,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&TranslateXY(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function GroupRowDirective(){return{restrict:"E",controller:GroupRowController,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){TranslateXY(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function CellDirective(e,t){return{restrict:"E",controller:CellController,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){s=i.options.$outer.$new(!1),s.getValue=i.getValue}var l=angular.element(n[0].querySelector(".dt-cell-content")),s=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(s&&(s.$destroy(),r(),s.$cell=i.value,s.$row=i.row,s.$column=i.column,s.$$watchers=null),i.column.template){l.empty();var e=angular.element(""+i.column.template.trim()+"");l.append(t(e)(s))}else if(i.column.cellRenderer){l.empty();var n=angular.element(i.column.cellRenderer(s,l));l.append(t(n)(s))}else l[0].innerHTML=i.getValue()},!0)}}}}}function FooterDirective(){return{restrict:"E",controller:FooterController,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function PagerDirective(){return{restrict:"E",controller:PagerController,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function PopoverDirective(e,t,n,o,i,r,l,s,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=s[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(s[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(s.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function s(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===POSITION.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===POSITION.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===POSITION.TOP&&(u=a.top-c.height-i.spacing,d=s()),i.placement===POSITION.BOTTOM&&(u=a.top+a.height+i.spacing,d=s()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),l.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function l(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var s=angular.element('');e.append(s);var a=s[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===POSITION.RIGHT?(c=-6,u=i()):n.options.placement===POSITION.LEFT?(c=o.width-2,u=i()):n.options.placement===POSITION.TOP?(u=o.height-5,c=l()):n.options.placement===POSITION.BOTTOM&&(u=-8,c=l()),s.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function PopoverRegistry(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function PositionHelper(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case POSITION.LEFT:return t.left;case POSITION.RIGHT:return t.left+(t.width-n.width);case POSITION.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case POSITION.TOP:return t.top;case POSITION.BOTTOM:return t.top+(t.height-n.height);case POSITION.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case POSITION.TOP:return t([n.height/2,i.height/2,1]);case POSITION.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case POSITION.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case POSITION.LEFT:return t([n.width/2,i.height/2,1]);case POSITION.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case POSITION.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function MenuDirective(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function DropdownDirective(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,l()})}function r(e){27===e.which&&t(function(){n.open=!1,l()})}function l(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function DropdownToggleDirective(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function l(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",l)}}}function DropdownMenuDirective(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}PositionHelper.$inject=["$log"],DropdownDirective.$inject=["$document","$timeout"],DropdownToggleDirective.$inject=["$timeout"],DropdownMenuDirective.$inject=["$animate"],Object.defineProperty(exports,"__esModule",{value:!0}),exports.dtMenu=exports.dtPopover=void 0;var _extends=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),DataTableService={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},l=!0;angular.forEach(o.attributes,function(n){var o=CamelCase(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":l=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var s=o.getElementsByTagName("column-header");s.length&&(r.headerTemplate=s[0].innerHTML,o.removeChild(s[0])),""!==o.innerHTML&&(r.template=o.innerHTML),l&&n.columns[i].push(r)})}),this.dTables={}}},cache={},testStyle=document.createElement("div").style,prefix=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),ua=window.navigator.userAgent,transform=GetVendorPrefixedName("transform"),backfaceVisibility=GetVendorPrefixedName("backfaceVisibility"),hasCSSTransforms=!!GetVendorPrefixedName("transform"),hasCSS3DTransforms=!!GetVendorPrefixedName("perspective"),isSafari=/Safari\//.test(ua)&&!/Chrome\//.test(ua),HeaderController=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)TranslateXY(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;TranslateXY(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),HeaderCellController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),isOldAngular()&&this.$onInit()}return e.$inject=["$scope"],_createClass(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=NextSortDirection(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),TREE_TYPES={GROUP:"refreshGroups",TREE:"refreshTree"},BodyController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),isOldAngular()&&this.$onInit()}return e.$inject=["$scope"],_createClass(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,t){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var n=e&&t&&(e.length===t.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,l=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],l=t[n.treeColumn.prop],s=n.rowsByGroup[l],a=n.expanded[l];(i>0||!r)&&(o.push(t),s&&s.length>0&&a&&e(s,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,s=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&s||!t&&l){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),DropdownController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],_createClass(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),dropdown=angular.module("dt.dropdown",[]).controller("DropdownController",DropdownController).directive("dropdown",DropdownDirective).directive("dropdownToggle",DropdownToggleDirective).directive("dropdownMenu",DropdownMenuDirective),menu=_angular2.default.module("dt.menu",[dropdown.name]).controller("MenuController",MenuController).directive("dtm",MenuDirective),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);exports.dtPopover=popover,exports.dtMenu=menu,exports.default=dataTable; \ No newline at end of file +"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&s.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=s[0].clientWidth;e'),s=o.parent(),a=void 0;l.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(l)}}}function SortableDirective(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(l,t)?t.parentNode.insertBefore(l,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(l,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),l.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),s!==l.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(l).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,l=n.target,s=l.nextSibling,l.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",l.textContent),t.on("dragenter",o),t.on("dragend",i))}var l=void 0,s=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function ObjectId(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function ColumnsByPin(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,l=r/i.length,s=o>t;i.forEach(function(e){if(s)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+l;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function throttle(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),l=0;l\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,l){function s(){var e=i[0].getBoundingClientRect();if(l.options.internal.innerWidth=Math.floor(e.width),l.options.scrollbarV){var t=e.height;l.options.headerHeight&&(t-=l.options.headerHeight),l.options.footerHeight&&(t-=l.options.footerHeight),l.options.internal.bodyHeight=t,l.calculatePageSize()}l.adjustColumns()}function a(){throttle(function(){t(s)})}DataTableService.buildColumns(o,n);var c=i.attr("data-column-id"),u=DataTableService.columns[c];u&&(l.options.columns=u),l.transposeColumnDefaults(),l.options.internal.scrollBarWidth=ScrollbarWidth(),e.addEventListener("resize",a);var d=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?s():t(e,100)};d(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function GetVendorPrefixedName(e){var t=CamelCase(e);return cache[t]||(angular.isDefined(testStyle[prefix.css+e])?cache[t]=prefix.css+e:angular.isDefined(testStyle[e])&&(cache[t]=e)),cache[t]}function TranslateXY(e,t,n){hasCSSTransforms?!isSafari&&hasCSS3DTransforms?(e[transform]="translate3d("+t+"px, "+n+"px, 0)",e[backfaceVisibility]="hidden"):e[CamelCase(transform)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function HeaderDirective(e){return{restrict:"E",controller:HeaderController,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),l=angular.element(t.currentTarget),s=-1;angular.forEach(l.children(),function(e,t){n===angular.element(e).attr("data-id")&&(s=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[s],r=i.options.columns.indexOf(n),l=i.options.columns.indexOf(o);return i.options.columns.splice(l,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function HeaderCellDirective(e){return{restrict:"E",controller:HeaderCellController,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),l=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(l=i.options.$outer.$new(!1),l.$header=i.column.name,l.$index=t.$index),i.column.headerTemplate){var s=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(s)(l))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(l)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function BodyDirective(){return{restrict:"E",controller:BodyController,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function ScrollerDirective(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),s=!1}function r(){s||(requestAnimFrame(i),s=!0)}var l=t.parent(),s=!1,a=0,c=0;o.options.internal.styleTranslator=new StyleTranslator(o.options.rowHeight),o.options.internal.setYOffset=function(e){l[0].scrollTop=e},l.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){l.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function SelectionDirective(){return{controller:SelectionController,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function RowDirective(){return{restrict:"E",controller:RowController,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&TranslateXY(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function GroupRowDirective(){return{restrict:"E",controller:GroupRowController,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){TranslateXY(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function CellDirective(e,t){return{restrict:"E",controller:CellController,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){s=i.options.$outer.$new(!1),s.getValue=i.getValue}var l=angular.element(n[0].querySelector(".dt-cell-content")),s=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(s&&(s.$destroy(),r(),s.$cell=i.value,s.$row=i.row,s.$column=i.column,s.$$watchers=null),i.column.template){l.empty();var e=angular.element(""+i.column.template.trim()+"");l.append(t(e)(s))}else if(i.column.cellRenderer){l.empty();var n=angular.element(i.column.cellRenderer(s,l));l.append(t(n)(s))}else l[0].innerHTML=i.getValue()},!0)}}}}}function FooterDirective(){return{restrict:"E",controller:FooterController,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function PagerDirective(){return{restrict:"E",controller:PagerController,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function PopoverDirective(e,t,n,o,i,r,l,s,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=s[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(s[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(s.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function s(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===POSITION.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===POSITION.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===POSITION.TOP&&(u=a.top-c.height-i.spacing,d=s()),i.placement===POSITION.BOTTOM&&(u=a.top+a.height+i.spacing,d=s()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),l.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function l(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var s=angular.element('');e.append(s);var a=s[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===POSITION.RIGHT?(c=-6,u=i()):n.options.placement===POSITION.LEFT?(c=o.width-2,u=i()):n.options.placement===POSITION.TOP?(u=o.height-5,c=l()):n.options.placement===POSITION.BOTTOM&&(u=-8,c=l()),s.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function PopoverRegistry(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function PositionHelper(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case POSITION.LEFT:return t.left;case POSITION.RIGHT:return t.left+(t.width-n.width);case POSITION.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case POSITION.TOP:return t.top;case POSITION.BOTTOM:return t.top+(t.height-n.height);case POSITION.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case POSITION.TOP:return t([n.height/2,i.height/2,1]);case POSITION.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case POSITION.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case POSITION.LEFT:return t([n.width/2,i.height/2,1]);case POSITION.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case POSITION.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function MenuDirective(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function DropdownDirective(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,l()})}function r(e){27===e.which&&t(function(){n.open=!1,l()})}function l(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function DropdownToggleDirective(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function l(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",l)}}}function DropdownMenuDirective(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}PositionHelper.$inject=["$log"],PopoverRegistry.$inject=["$animate"],PopoverDirective.$inject=["$q","$timeout","$templateCache","$compile","PopoverRegistry","PositionHelper","$animate","$document","$http"],DropdownDirective.$inject=["$document","$timeout"],DropdownToggleDirective.$inject=["$timeout"],DropdownMenuDirective.$inject=["$animate"],DataTableDirective.$inject=["$window","$timeout","$parse"],ResizableDirective.$inject=["$document","$timeout"],HeaderDirective.$inject=["$timeout"],HeaderCellDirective.$inject=["$compile"],CellDirective.$inject=["$rootScope","$compile"],Object.defineProperty(exports,"__esModule",{value:!0}),exports.dtMenu=exports.dtPopover=void 0;var _extends=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),DataTableService={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},l=!0;angular.forEach(o.attributes,function(n){var o=CamelCase(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":l=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var s=o.getElementsByTagName("column-header");s.length&&(r.headerTemplate=s[0].innerHTML,o.removeChild(s[0])),""!==o.innerHTML&&(r.template=o.innerHTML),l&&n.columns[i].push(r)})}),this.dTables={}}},cache={},testStyle=document.createElement("div").style,prefix=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),ua=window.navigator.userAgent,transform=GetVendorPrefixedName("transform"),backfaceVisibility=GetVendorPrefixedName("backfaceVisibility"),hasCSSTransforms=!!GetVendorPrefixedName("transform"),hasCSS3DTransforms=!!GetVendorPrefixedName("perspective"),isSafari=/Safari\//.test(ua)&&!/Chrome\//.test(ua),HeaderController=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)TranslateXY(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;TranslateXY(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),HeaderCellController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),isOldAngular()&&this.$onInit()}return e.$inject=["$scope"],_createClass(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=NextSortDirection(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),TREE_TYPES={GROUP:"refreshGroups",TREE:"refreshTree"},BodyController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),isOldAngular()&&this.$onInit()}return e.$inject=["$scope"],_createClass(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,t){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var n=e&&t&&(e.length===t.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,l=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],l=t[n.treeColumn.prop],s=n.rowsByGroup[l],a=n.expanded[l];(i>0||!r)&&(o.push(t),s&&s.length>0&&a&&e(s,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,s=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&s||!t&&l){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),DropdownController=function(){function e(t){_classCallCheck(this,e),_extends(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],_createClass(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),dropdown=angular.module("dt.dropdown",[]).controller("DropdownController",DropdownController).directive("dropdown",DropdownDirective).directive("dropdownToggle",DropdownToggleDirective).directive("dropdownMenu",DropdownMenuDirective),menu=angular.module("dt.menu",[dropdown.name]).controller("MenuController",MenuController).directive("dtm",MenuDirective),dataTable=angular.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);exports.dtPopover=popover,exports.dtMenu=menu,exports.default=dataTable; \ No newline at end of file diff --git a/release/dataTable.es6.js b/release/dataTable.es6.js index 198fe37..7f6cec1 100644 --- a/release/dataTable.es6.js +++ b/release/dataTable.es6.js @@ -1,4 +1,4 @@ -import angular$1 from 'angular'; +import 'angular'; /* eslint-disable no-extend-native, no-bitwise */ @@ -3698,7 +3698,7 @@ function PositionHelper($log) { }; } -var popover = angular$1 +var popover = angular .module('dt.popover', []) .factory('PopoverRegistry', PopoverRegistry) .factory('PositionHelper', PositionHelper) @@ -3864,12 +3864,12 @@ var dropdown = angular .directive('dropdownToggle', DropdownToggleDirective) .directive('dropdownMenu', DropdownMenuDirective); -var menu = angular$1 +var menu = angular .module('dt.menu', [dropdown.name]) .controller('MenuController', MenuController) .directive('dtm', MenuDirective); -var dataTable = angular$1 +var dataTable = angular .module('data-table', []) .directive('dtable', DataTableDirective) .directive('resizable', ResizableDirective) diff --git a/release/dataTable.js b/release/dataTable.js index 29dd48d..011e936 100644 --- a/release/dataTable.js +++ b/release/dataTable.js @@ -4,5 +4,5 @@ * @link http://jonshaffer.github.io/angular-data-table/ * @license MIT */ -!function(e,t){if("function"==typeof define&&define.amd)define("DataTable",["exports","angular"],t);else if("undefined"!=typeof exports)t(exports,require("angular"));else{var n={exports:{}};t(n.exports,e.angular),e.DataTable=n.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&l.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=l[0].clientWidth;e'),l=o.parent(),a=void 0;s.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(s)}}}function s(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(s,t)?t.parentNode.insertBefore(s,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(s,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),s.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),l!==s.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(s).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,s=n.target,l=s.nextSibling,s.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",s.textContent),t.on("dragenter",o),t.on("dragend",i))}var s=void 0,l=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function l(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function a(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,s=r/i.length,l=o>t;i.forEach(function(e){if(l)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+s;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function b(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),s=0;s\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,s){function l(){var e=i[0].getBoundingClientRect();if(s.options.internal.innerWidth=Math.floor(e.width),s.options.scrollbarV){var t=e.height;s.options.headerHeight&&(t-=s.options.headerHeight),s.options.footerHeight&&(t-=s.options.footerHeight),s.options.internal.bodyHeight=t,s.calculatePageSize()}s.adjustColumns()}function a(){b(function(){t(l)})}Y.buildColumns(o,n);var c=i.attr("data-column-id"),u=Y.columns[c];u&&(s.options.columns=u),s.transposeColumnDefaults(),s.options.internal.scrollBarWidth=h(),e.addEventListener("resize",a);var d=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?l():t(e,100)};d(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function x(e){var t=d(e);return _[t]||(angular.isDefined(Z[K.css+e])?_[t]=K.css+e:angular.isDefined(Z[e])&&(_[t]=e)),_[t]}function k(e,t,n){te?!oe&&ne?(e[Q]="translate3d("+t+"px, "+n+"px, 0)",e[ee]="hidden"):e[d(Q)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function $(e){return{restrict:"E",controller:ie,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),s=angular.element(t.currentTarget),l=-1;angular.forEach(s.children(),function(e,t){n===angular.element(e).attr("data-id")&&(l=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[l],r=i.options.columns.indexOf(n),s=i.options.columns.indexOf(o);return i.options.columns.splice(s,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function T(e){return{restrict:"E",controller:re,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),s=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(s=i.options.$outer.$new(!1),s.$header=i.column.name,s.$index=t.$index),i.column.headerTemplate){var l=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(l)(s))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(s)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function R(){return{restrict:"E",controller:le,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function P(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),l=!1}function r(){l||(q(i),l=!0)}var s=t.parent(),l=!1,a=0,c=0;o.options.internal.styleTranslator=new ae(o.options.rowHeight),o.options.internal.setYOffset=function(e){s[0].scrollTop=e},s.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){s.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function S(){return{controller:ue,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function z(){return{restrict:"E",controller:de,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&k(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function E(){return{restrict:"E",controller:he,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){k(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function A(e,t){return{restrict:"E",controller:pe,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){l=i.options.$outer.$new(!1),l.getValue=i.getValue}var s=angular.element(n[0].querySelector(".dt-cell-content")),l=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(l&&(l.$destroy(),r(),l.$cell=i.value,l.$row=i.row,l.$column=i.column,l.$$watchers=null),i.column.template){s.empty();var e=angular.element(""+i.column.template.trim()+"");s.append(t(e)(l))}else if(i.column.cellRenderer){s.empty();var n=angular.element(i.column.cellRenderer(l,s));s.append(t(n)(l))}else s[0].innerHTML=i.getValue()},!0)}}}}}function W(){return{restrict:"E",controller:ge,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function G(){return{restrict:"E",controller:fe,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function B(e,t,n,o,i,r,s,l,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=l[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(l[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(l.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function l(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===me.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===me.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===me.TOP&&(u=a.top-c.height-i.spacing,d=l()),i.placement===me.BOTTOM&&(u=a.top+a.height+i.spacing,d=l()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),s.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function s(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var l=angular.element('');e.append(l);var a=l[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===me.RIGHT?(c=-6,u=i()):n.options.placement===me.LEFT?(c=o.width-2,u=i()):n.options.placement===me.TOP?(u=o.height-5,c=s()):n.options.placement===me.BOTTOM&&(u=-8,c=s()),l.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function I(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function O(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case me.LEFT:return t.left;case me.RIGHT:return t.left+(t.width-n.width);case me.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case me.TOP:return t.top;case me.BOTTOM:return t.top+(t.height-n.height);case me.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case me.TOP:return t([n.height/2,i.height/2,1]);case me.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case me.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case me.LEFT:return t([n.width/2,i.height/2,1]);case me.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case me.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function D(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function M(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,s()})}function r(e){27===e.which&&t(function(){n.open=!1,s()})}function s(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function H(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function s(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",s)}}}function L(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}O.$inject=["$log"],M.$inject=["$document","$timeout"],H.$inject=["$timeout"],L.$inject=["$animate"],Object.defineProperty(e,"__esModule",{value:!0}),e.dtMenu=e.dtPopover=void 0;var N=n(t),V=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),Y={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},s=!0;angular.forEach(o.attributes,function(n){var o=d(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":s=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var l=o.getElementsByTagName("column-header");l.length&&(r.headerTemplate=l[0].innerHTML,o.removeChild(l[0])),""!==o.innerHTML&&(r.template=o.innerHTML),s&&n.columns[i].push(r)})}),this.dTables={}}},_={},Z=document.createElement("div").style,K=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),J=window.navigator.userAgent,Q=x("transform"),ee=x("backfaceVisibility"),te=!!x("transform"),ne=!!x("perspective"),oe=/Safari\//.test(J)&&!/Chrome\//.test(J),ie=function(){function e(){i(this,e)}return j(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)k(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;k(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),re=function(){function e(t){i(this,e),V(this,{$scope:t}),g()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=p(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),se={GROUP:"refreshGroups",TREE:"refreshTree"},le=function(){function e(t){i(this,e),V(this,{$scope:t}),g()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,t){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var n=e&&t&&(e.length===t.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,s=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],s=t[n.treeColumn.prop],l=n.rowsByGroup[s],a=n.expanded[s];(i>0||!r)&&(o.push(t),l&&l.length>0&&a&&e(l,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,l=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&l||!t&&s){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),ye=function(){function e(t){i(this,e),V(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],j(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),be=angular.module("dt.dropdown",[]).controller("DropdownController",ye).directive("dropdown",M).directive("dropdownToggle",H).directive("dropdownMenu",L),Ce=N.default.module("dt.menu",[be.name]).controller("MenuController",we).directive("dtm",D),xe=N.default.module("data-table",[]).directive("dtable",C).directive("resizable",r).directive("sortable",s).directive("dtHeader",$).directive("dtHeaderCell",T).directive("dtBody",R).directive("dtScroller",P).directive("dtSeletion",S).directive("dtRow",z).directive("dtGroupRow",E).directive("dtCell",A).directive("dtFooter",W).directive("dtPager",G);e.dtPopover=ve,e.dtMenu=Ce,e.default=xe}); \ No newline at end of file +!function(e,t){if("function"==typeof define&&define.amd)define("DataTable",["exports","angular"],t);else if("undefined"!=typeof exports)t(exports,require("angular"));else{var n={exports:{}};t(n.exports,e.angular),e.DataTable=n.exports}}(this,function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&l.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=l[0].clientWidth;e'),l=o.parent(),a=void 0;s.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(s)}}}function i(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(s,t)?t.parentNode.insertBefore(s,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(s,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),s.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),l!==s.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(s).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,s=n.target,l=s.nextSibling,s.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",s.textContent),t.on("dragenter",o),t.on("dragend",i))}var s=void 0,l=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function r(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function s(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,s=r/i.length,l=o>t;i.forEach(function(e){if(l)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+s;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function w(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),s=0;s\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,s){function l(){var e=i[0].getBoundingClientRect();if(s.options.internal.innerWidth=Math.floor(e.width),s.options.scrollbarV){var t=e.height;s.options.headerHeight&&(t-=s.options.headerHeight),s.options.footerHeight&&(t-=s.options.footerHeight),s.options.internal.bodyHeight=t,s.calculatePageSize()}s.adjustColumns()}function a(){w(function(){t(l)})}U.buildColumns(o,n);var c=i.attr("data-column-id"),d=U.columns[c];d&&(s.options.columns=d),s.transposeColumnDefaults(),s.options.internal.scrollBarWidth=u(),e.addEventListener("resize",a);var h=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?l():t(e,100)};h(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function b(e){var t=c(e);return q[t]||(angular.isDefined(X[Y.css+e])?q[t]=Y.css+e:angular.isDefined(X[e])&&(q[t]=e)),q[t]}function C(e,t,n){J?!ee&&Q?(e[_]="translate3d("+t+"px, "+n+"px, 0)",e[K]="hidden"):e[c(_)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function x(e){return{restrict:"E",controller:te,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),s=angular.element(t.currentTarget),l=-1;angular.forEach(s.children(),function(e,t){n===angular.element(e).attr("data-id")&&(l=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[l],r=i.options.columns.indexOf(n),s=i.options.columns.indexOf(o);return i.options.columns.splice(s,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function k(e){return{restrict:"E",controller:ne,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),s=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(s=i.options.$outer.$new(!1),s.$header=i.column.name,s.$index=t.$index),i.column.headerTemplate){var l=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(l)(s))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(s)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function $(){return{restrict:"E",controller:ie,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function T(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),l=!1}function r(){l||(V(i),l=!0)}var s=t.parent(),l=!1,a=0,c=0;o.options.internal.styleTranslator=new re(o.options.rowHeight),o.options.internal.setYOffset=function(e){s[0].scrollTop=e},s.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){s.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function R(){return{controller:le,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function P(){return{restrict:"E",controller:ae,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&C(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function S(){return{restrict:"E",controller:ce,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){C(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function z(e,t){return{restrict:"E",controller:ue,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){l=i.options.$outer.$new(!1),l.getValue=i.getValue}var s=angular.element(n[0].querySelector(".dt-cell-content")),l=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(l&&(l.$destroy(),r(),l.$cell=i.value,l.$row=i.row,l.$column=i.column,l.$$watchers=null),i.column.template){s.empty();var e=angular.element(""+i.column.template.trim()+"");s.append(t(e)(l))}else if(i.column.cellRenderer){s.empty();var n=angular.element(i.column.cellRenderer(l,s));s.append(t(n)(l))}else s[0].innerHTML=i.getValue()},!0)}}}}}function E(){return{restrict:"E",controller:de,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function A(){return{restrict:"E",controller:he,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function W(e,t,n,o,i,r,s,l,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=l[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(l[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(l.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function l(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===pe.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===pe.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===pe.TOP&&(u=a.top-c.height-i.spacing,d=l()),i.placement===pe.BOTTOM&&(u=a.top+a.height+i.spacing,d=l()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),s.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function s(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var l=angular.element('');e.append(l);var a=l[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===pe.RIGHT?(c=-6,u=i()):n.options.placement===pe.LEFT?(c=o.width-2,u=i()):n.options.placement===pe.TOP?(u=o.height-5,c=s()):n.options.placement===pe.BOTTOM&&(u=-8,c=s()),l.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function G(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function B(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case pe.LEFT:return t.left;case pe.RIGHT:return t.left+(t.width-n.width);case pe.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case pe.TOP:return t.top;case pe.BOTTOM:return t.top+(t.height-n.height);case pe.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case pe.TOP:return t([n.height/2,i.height/2,1]);case pe.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case pe.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case pe.LEFT:return t([n.width/2,i.height/2,1]);case pe.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case pe.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function I(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function O(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,s()})}function r(e){27===e.which&&t(function(){n.open=!1,s()})}function s(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function D(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function s(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",s)}}}function H(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}B.$inject=["$log"],G.$inject=["$animate"],W.$inject=["$q","$timeout","$templateCache","$compile","PopoverRegistry","PositionHelper","$animate","$document","$http"],O.$inject=["$document","$timeout"],D.$inject=["$timeout"],H.$inject=["$animate"],y.$inject=["$window","$timeout","$parse"],o.$inject=["$document","$timeout"],x.$inject=["$timeout"],k.$inject=["$compile"],z.$inject=["$rootScope","$compile"],Object.defineProperty(e,"__esModule",{value:!0}),e.dtMenu=e.dtPopover=void 0;var M=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),U={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},s=!0;angular.forEach(o.attributes,function(n){var o=c(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":s=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var l=o.getElementsByTagName("column-header");l.length&&(r.headerTemplate=l[0].innerHTML,o.removeChild(l[0])),""!==o.innerHTML&&(r.template=o.innerHTML),s&&n.columns[i].push(r)})}),this.dTables={}}},q={},X=document.createElement("div").style,Y=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),Z=window.navigator.userAgent,_=b("transform"),K=b("backfaceVisibility"),J=!!b("transform"),Q=!!b("perspective"),ee=/Safari\//.test(Z)&&!/Chrome\//.test(Z),te=function(){function e(){n(this,e)}return j(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)C(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;C(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),ne=function(){function e(t){n(this,e),M(this,{$scope:t}),h()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=d(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),oe={GROUP:"refreshGroups",TREE:"refreshTree"},ie=function(){function e(t){n(this,e),M(this,{$scope:t}),h()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,n){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var o=e&&n&&(e.length===n.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,s=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],s=t[n.treeColumn.prop],l=n.rowsByGroup[s],a=n.expanded[s];(i>0||!r)&&(o.push(t),l&&l.length>0&&a&&e(l,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,l=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&l||!t&&s){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),me=function(){function e(t){n(this,e),M(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],j(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),ve=angular.module("dt.dropdown",[]).controller("DropdownController",me).directive("dropdown",O).directive("dropdownToggle",D).directive("dropdownMenu",H),we=angular.module("dt.menu",[ve.name]).controller("MenuController",fe).directive("dtm",I),ye=angular.module("data-table",[]).directive("dtable",y).directive("resizable",o).directive("sortable",i).directive("dtHeader",x).directive("dtHeaderCell",k).directive("dtBody",$).directive("dtScroller",T).directive("dtSeletion",R).directive("dtRow",P).directive("dtGroupRow",S).directive("dtCell",z).directive("dtFooter",E).directive("dtPager",A);e.dtPopover=ge,e.dtMenu=we,e.default=ye}); \ No newline at end of file diff --git a/release/dataTable.min.js b/release/dataTable.min.js index 29dd48d..011e936 100644 --- a/release/dataTable.min.js +++ b/release/dataTable.min.js @@ -4,5 +4,5 @@ * @link http://jonshaffer.github.io/angular-data-table/ * @license MIT */ -!function(e,t){if("function"==typeof define&&define.amd)define("DataTable",["exports","angular"],t);else if("undefined"!=typeof exports)t(exports,require("angular"));else{var n={exports:{}};t(n.exports,e.angular),e.DataTable=n.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&l.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=l[0].clientWidth;e'),l=o.parent(),a=void 0;s.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(s)}}}function s(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(s,t)?t.parentNode.insertBefore(s,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(s,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),s.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),l!==s.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(s).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,s=n.target,l=s.nextSibling,s.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",s.textContent),t.on("dragenter",o),t.on("dragend",i))}var s=void 0,l=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function l(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function a(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,s=r/i.length,l=o>t;i.forEach(function(e){if(l)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+s;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function b(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),s=0;s\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,s){function l(){var e=i[0].getBoundingClientRect();if(s.options.internal.innerWidth=Math.floor(e.width),s.options.scrollbarV){var t=e.height;s.options.headerHeight&&(t-=s.options.headerHeight),s.options.footerHeight&&(t-=s.options.footerHeight),s.options.internal.bodyHeight=t,s.calculatePageSize()}s.adjustColumns()}function a(){b(function(){t(l)})}Y.buildColumns(o,n);var c=i.attr("data-column-id"),u=Y.columns[c];u&&(s.options.columns=u),s.transposeColumnDefaults(),s.options.internal.scrollBarWidth=h(),e.addEventListener("resize",a);var d=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?l():t(e,100)};d(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function x(e){var t=d(e);return _[t]||(angular.isDefined(Z[K.css+e])?_[t]=K.css+e:angular.isDefined(Z[e])&&(_[t]=e)),_[t]}function k(e,t,n){te?!oe&&ne?(e[Q]="translate3d("+t+"px, "+n+"px, 0)",e[ee]="hidden"):e[d(Q)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function $(e){return{restrict:"E",controller:ie,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),s=angular.element(t.currentTarget),l=-1;angular.forEach(s.children(),function(e,t){n===angular.element(e).attr("data-id")&&(l=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[l],r=i.options.columns.indexOf(n),s=i.options.columns.indexOf(o);return i.options.columns.splice(s,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function T(e){return{restrict:"E",controller:re,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),s=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(s=i.options.$outer.$new(!1),s.$header=i.column.name,s.$index=t.$index),i.column.headerTemplate){var l=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(l)(s))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(s)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function R(){return{restrict:"E",controller:le,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function P(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),l=!1}function r(){l||(q(i),l=!0)}var s=t.parent(),l=!1,a=0,c=0;o.options.internal.styleTranslator=new ae(o.options.rowHeight),o.options.internal.setYOffset=function(e){s[0].scrollTop=e},s.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){s.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function S(){return{controller:ue,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function z(){return{restrict:"E",controller:de,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&k(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function E(){return{restrict:"E",controller:he,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){k(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function A(e,t){return{restrict:"E",controller:pe,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){l=i.options.$outer.$new(!1),l.getValue=i.getValue}var s=angular.element(n[0].querySelector(".dt-cell-content")),l=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(l&&(l.$destroy(),r(),l.$cell=i.value,l.$row=i.row,l.$column=i.column,l.$$watchers=null),i.column.template){s.empty();var e=angular.element(""+i.column.template.trim()+"");s.append(t(e)(l))}else if(i.column.cellRenderer){s.empty();var n=angular.element(i.column.cellRenderer(l,s));s.append(t(n)(l))}else s[0].innerHTML=i.getValue()},!0)}}}}}function W(){return{restrict:"E",controller:ge,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function G(){return{restrict:"E",controller:fe,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function B(e,t,n,o,i,r,s,l,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=l[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(l[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(l.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function l(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===me.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===me.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===me.TOP&&(u=a.top-c.height-i.spacing,d=l()),i.placement===me.BOTTOM&&(u=a.top+a.height+i.spacing,d=l()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),s.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function s(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var l=angular.element('');e.append(l);var a=l[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===me.RIGHT?(c=-6,u=i()):n.options.placement===me.LEFT?(c=o.width-2,u=i()):n.options.placement===me.TOP?(u=o.height-5,c=s()):n.options.placement===me.BOTTOM&&(u=-8,c=s()),l.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function I(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function O(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case me.LEFT:return t.left;case me.RIGHT:return t.left+(t.width-n.width);case me.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case me.TOP:return t.top;case me.BOTTOM:return t.top+(t.height-n.height);case me.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case me.TOP:return t([n.height/2,i.height/2,1]);case me.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case me.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case me.LEFT:return t([n.width/2,i.height/2,1]);case me.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case me.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function D(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function M(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,s()})}function r(e){27===e.which&&t(function(){n.open=!1,s()})}function s(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function H(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function s(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",s)}}}function L(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}O.$inject=["$log"],M.$inject=["$document","$timeout"],H.$inject=["$timeout"],L.$inject=["$animate"],Object.defineProperty(e,"__esModule",{value:!0}),e.dtMenu=e.dtPopover=void 0;var N=n(t),V=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),Y={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},s=!0;angular.forEach(o.attributes,function(n){var o=d(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":s=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var l=o.getElementsByTagName("column-header");l.length&&(r.headerTemplate=l[0].innerHTML,o.removeChild(l[0])),""!==o.innerHTML&&(r.template=o.innerHTML),s&&n.columns[i].push(r)})}),this.dTables={}}},_={},Z=document.createElement("div").style,K=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),J=window.navigator.userAgent,Q=x("transform"),ee=x("backfaceVisibility"),te=!!x("transform"),ne=!!x("perspective"),oe=/Safari\//.test(J)&&!/Chrome\//.test(J),ie=function(){function e(){i(this,e)}return j(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)k(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;k(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),re=function(){function e(t){i(this,e),V(this,{$scope:t}),g()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=p(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),se={GROUP:"refreshGroups",TREE:"refreshTree"},le=function(){function e(t){i(this,e),V(this,{$scope:t}),g()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,t){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var n=e&&t&&(e.length===t.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,s=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],s=t[n.treeColumn.prop],l=n.rowsByGroup[s],a=n.expanded[s];(i>0||!r)&&(o.push(t),l&&l.length>0&&a&&e(l,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,l=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&l||!t&&s){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),ye=function(){function e(t){i(this,e),V(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],j(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),be=angular.module("dt.dropdown",[]).controller("DropdownController",ye).directive("dropdown",M).directive("dropdownToggle",H).directive("dropdownMenu",L),Ce=N.default.module("dt.menu",[be.name]).controller("MenuController",we).directive("dtm",D),xe=N.default.module("data-table",[]).directive("dtable",C).directive("resizable",r).directive("sortable",s).directive("dtHeader",$).directive("dtHeaderCell",T).directive("dtBody",R).directive("dtScroller",P).directive("dtSeletion",S).directive("dtRow",z).directive("dtGroupRow",E).directive("dtCell",A).directive("dtFooter",W).directive("dtPager",G);e.dtPopover=ve,e.dtMenu=Ce,e.default=xe}); \ No newline at end of file +!function(e,t){if("function"==typeof define&&define.amd)define("DataTable",["exports","angular"],t);else if("undefined"!=typeof exports)t(exports,require("angular"));else{var n={exports:{}};t(n.exports,e.angular),e.DataTable=n.exports}}(this,function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=n.minWidth)&&(!n.maxWidth||i<=n.maxWidth)&&l.css({width:i+"px"})}function r(){n.onResize&&t(function(){var e=l[0].clientWidth;e'),l=o.parent(),a=void 0;s.on("mousedown",function(t){o[0].classList.contains("resizable")&&(t.stopPropagation(),t.preventDefault(),e.on("mousemove",i),e.on("mouseup",r))}),o.append(s)}}}function i(){return{restrict:"A",scope:{isSortable:"=sortable",onSortableSort:"&"},link:function(e,t){function n(e,t){if(e.parentNode===t.parentNode)for(var n=e;n;n=n.previousSibling)if(n===t)return!0;return!1}function o(e){var t=e.target;n(s,t)?t.parentNode.insertBefore(s,t):t.nextSibling&&t.hasAttribute("draggable")&&t.parentNode.insertBefore(s,t.nextSibling.nextSibling)}function i(n){n.preventDefault(),s.classList.remove("dt-clone"),t.off("dragend",i),t.off("dragenter",o),l!==s.nextSibling&&e.onSortableSort({event:n,columnId:angular.element(s).attr("data-id")})}function r(n){e.isSortable&&(n=n.originalEvent||n,s=n.target,l=s.nextSibling,s.classList.add("dt-clone"),n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("Text",s.textContent),t.on("dragenter",o),t.on("dragend",i))}var s=void 0,l=void 0;t.on("dragstart",r),e.$on("$destroy",function(){t.off("dragstart",r)})}}}function r(){var e=Math.floor((new Date).getTime()/1e3).toString(16);return e+"xxxxxxxxxxxxxxxx".replace(/[x]/g,function(){return Math.floor(16*Math.random()).toString(16)}).toLowerCase()}function s(e){for(var t={left:[],center:[],right:[]},n=0,o=e.length;n-1?e.slice(n,e.length).filter(function(e){return e.canAutoResize}):e.filter(function(e){return e.canAutoResize});e.forEach(function(e){o+=e.canAutoResize?e.$$oldWidth||e.width:e.width});var r=t-o,s=r/i.length,l=o>t;i.forEach(function(e){if(l)e.width=e.$$oldWidth||e.width;else{e.$$oldWidth||(e.$$oldWidth=e.width);var t=e.$$oldWidth+s;e.minWith&&te.maxWidth?e.width=e.maxWidth:e.width=t}})}function w(e,t,n){var o=this;return function(){for(var i=arguments.length,r=Array(i),s=0;s\n \n \n \n \n \n \n '},compile:function(){return{pre:function(o,i,r,s){function l(){var e=i[0].getBoundingClientRect();if(s.options.internal.innerWidth=Math.floor(e.width),s.options.scrollbarV){var t=e.height;s.options.headerHeight&&(t-=s.options.headerHeight),s.options.footerHeight&&(t-=s.options.footerHeight),s.options.internal.bodyHeight=t,s.calculatePageSize()}s.adjustColumns()}function a(){w(function(){t(l)})}U.buildColumns(o,n);var c=i.attr("data-column-id"),d=U.columns[c];d&&(s.options.columns=d),s.transposeColumnDefaults(),s.options.internal.scrollBarWidth=u(),e.addEventListener("resize",a);var h=function e(){var n=i[0].getBoundingClientRect(),o=n.width&&n.height;o?l():t(e,100)};h(),i.addClass("dt-loaded"),o.$on("$destroy",function(){angular.element(e).off("resize")})}}}}}function b(e){var t=c(e);return q[t]||(angular.isDefined(X[Y.css+e])?q[t]=Y.css+e:angular.isDefined(X[e])&&(q[t]=e)),q[t]}function C(e,t,n){J?!ee&&Q?(e[_]="translate3d("+t+"px, "+n+"px, 0)",e[K]="hidden"):e[c(_)]="translate("+t+"px, "+n+"px)":(e.top=n+"px",e.left=t+"px")}function x(e){return{restrict:"E",controller:te,controllerAs:"header",scope:!0,bindToController:{options:"=",columns:"=",columnWidths:"=",selectedRows:"=?",allRows:"=",onSort:"&",onResize:"&"},template:'\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n
',replace:!0,link:function(t,n,o,i){t.columnsResorted=function(t,n){var o=r(n),s=angular.element(t.currentTarget),l=-1;angular.forEach(s.children(),function(e,t){n===angular.element(e).attr("data-id")&&(l=t)}),e(function(){angular.forEach(i.columns,function(e){var t=e.indexOf(o);if(t>-1){var n=e[l],r=i.options.columns.indexOf(n),s=i.options.columns.indexOf(o);return i.options.columns.splice(s,1),i.options.columns.splice(r,0,o),!1}})})};var r=function(e){var t=i.columns.left.concat(i.columns.center).concat(i.columns.right);return t.find(function(t){return t.$id===e})}}}}function k(e){return{restrict:"E",controller:ne,controllerAs:"hcell",scope:!0,bindToController:{options:"=",column:"=",onSort:"&",sortType:"=",onResize:"&",selected:"="},replace:!0,template:'
\n
\n \n \n \n \n
\n
',compile:function(){return{pre:function(t,n,o,i){var r=n[0].querySelector(".dt-header-cell-label"),s=void 0;if((i.column.headerTemplate||i.column.headerRenderer)&&(s=i.options.$outer.$new(!1),s.$header=i.column.name,s.$index=t.$index),i.column.headerTemplate){var l=angular.element(""+i.column.headerTemplate.trim()+"");angular.element(r).append(e(l)(s))}else if(i.column.headerRenderer){var a=angular.element(i.column.headerRenderer(n));angular.element(r).append(e(a)(s)[0])}else{var c=i.column.name;(angular.isUndefined(c)||null===c)&&(c=""),r.textContent=c}}}}}}function $(){return{restrict:"E",controller:ie,controllerAs:"body",bindToController:{columns:"=",columnWidths:"=",rows:"=",options:"=",selected:"=?",expanded:"=?",onPage:"&",onTreeToggle:"&",onSelect:"&",onRowClick:"&",onRowDblClick:"&"},scope:!0,template:'\n \n
\n
\n
\n \n
\n \n \n \n \n \n \n
\n
\n
\n
\n
'}}function T(){return{restrict:"E",require:"^dtBody",transclude:!0,replace:!0,template:'
',link:function(e,t,n,o){function i(){o.options.internal.offsetY=a,o.options.internal.offsetX=c,o.updatePage(),o.options.scrollbarV&&o.getRows(!0),o.options.$outer.$digest(),l=!1}function r(){l||(V(i),l=!0)}var s=t.parent(),l=!1,a=0,c=0;o.options.internal.styleTranslator=new re(o.options.rowHeight),o.options.internal.setYOffset=function(e){s[0].scrollTop=e},s.on("scroll",function(){a=this.scrollTop,c=this.scrollLeft,r()}),e.$on("$destroy",function(){s.off("scroll")}),e.scrollerStyles=function(){if(o.options.scrollbarV)return{height:o.count*o.options.rowHeight+"px"}}}}}function R(){return{controller:le,restrict:"A",require:"^dtBody",controllerAs:"selCtrl"}}function P(){return{restrict:"E",controller:ae,controllerAs:"rowCtrl",scope:!0,bindToController:{row:"=",columns:"=",columnWidths:"=",expanded:"=",selected:"=",hasChildren:"=",options:"=",onCheckboxChange:"&",onTreeToggle:"&"},link:function(e,t,n,o){o.row&&C(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)},template:'\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
',replace:!0}}function S(){return{restrict:"E",controller:ce,controllerAs:"group",bindToController:{row:"=",onGroupToggle:"&",expanded:"=",options:"="},scope:!0,replace:!0,template:'\n
\n \n \n \n \n
',link:function(e,t,n,o){C(t[0].style,0,o.row.$$index*o.options.rowHeight),o.options.internal.styleTranslator.register(e.$index,t)}}}function z(e,t){return{restrict:"E",controller:ue,scope:!0,controllerAs:"cell",bindToController:{options:"=",value:"=",selected:"=",column:"=",row:"=",expanded:"=",hasChildren:"=",onTreeToggle:"&",onCheckboxChange:"&"},template:'
\n \n \n \n
',replace:!0,compile:function(){return{pre:function(e,n,o,i){function r(){l=i.options.$outer.$new(!1),l.getValue=i.getValue}var s=angular.element(n[0].querySelector(".dt-cell-content")),l=void 0;(i.column.template||i.column.cellRenderer)&&r(),e.$watch("cell.row",function(){if(l&&(l.$destroy(),r(),l.$cell=i.value,l.$row=i.row,l.$column=i.column,l.$$watchers=null),i.column.template){s.empty();var e=angular.element(""+i.column.template.trim()+"");s.append(t(e)(l))}else if(i.column.cellRenderer){s.empty();var n=angular.element(i.column.cellRenderer(l,s));s.append(t(n)(l))}else s[0].innerHTML=i.getValue()},!0)}}}}}function E(){return{restrict:"E",controller:de,controllerAs:"footer",scope:!0,bindToController:{paging:"=",onPage:"&"},template:'',replace:!0}}function A(){return{restrict:"E",controller:he,controllerAs:"pager",scope:!0,bindToController:{page:"=",size:"=",count:"=",onPage:"&"},template:'
\n
    \n
  • \n \n
  • \n
  • \n \n
  • \n
  • \n {{pg.text}}\n
  • \n
  • \n \n
  • \n
  • \n \n
  • \n
\n
',replace:!0}}function W(e,t,n,o,i,r,s,l,a){function c(e,t){return e?angular.isString(e)&&t?e:n.get(e)||a.get(e,{cache:!0}):""}function u(e){if(e&&0!==e.length){var t=e.toString().toLowerCase();e="true"===t}else e=!1;return e}return{restrict:"A",scope:!0,replace:!1,link:function(n,a,d){function h(){n.exitTimeout=t(g,500)}function p(){t.cancel(n.exitTimeout);var r=l[0].getElementById("#"+n.popoverId);n.popover&&r||(n.options.group&&i.removeGroup(n.options.group,n.popoverId),n.options.text&&!n.options.template?(n.popover=angular.element('
'),n.popover.html(n.options.text),angular.element(l[0].body).append(n.popover),f(a,n.popover,n.options),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})):e.when(c(n.options.template,n.options.plain)).then(function(e){angular.isString(e)||(e=e.data&&angular.isString(e.data)?e.data:""),n.popover=angular.element('
'),n.popover.html(e),o(n.popover)(n),angular.element(l.body).append(n.popover),f(a,n.popover,n.options),n.popover.off("mouseleave",h),n.popover.on("mouseleave",h),n.popover.on("mouseenter",function(){t.cancel(n.exitTimeout)}),i.add(n.popoverId,{element:a,popover:n.popover,group:n.options.group})}))}function g(){n.popover&&n.popover.remove(),n.popover=void 0,i.remove(n.popoverId)}function f(e,o,i){t(function(){function t(){return r.calculateVerticalAlignment(a,c,i.alignment)}function l(){return r.calculateHorizontalAlignment(a,c,i.alignment)}var a=e[0].getBoundingClientRect(),c=o[0].getBoundingClientRect(),u=void 0,d=void 0;i.placement===pe.RIGHT&&(d=a.left+a.width+i.spacing,u=t()),i.placement===pe.LEFT&&(d=a.left-c.width-i.spacing,u=t()),i.placement===pe.TOP&&(u=a.top-c.height-i.spacing,d=l()),i.placement===pe.BOTTOM&&(u=a.top+a.height+i.spacing,d=l()),o.css({top:u+"px",left:d+"px"}),n.options.showCaret&&m(n.popover,a,c),s.addClass(n.popover,"popover-animation")},50)}function m(e,t,o){function i(){return r.calculateVerticalCaret(t,o,a,n.options.alignment)}function s(){return r.calculateHorizontalCaret(t,o,a,n.options.alignment)}var l=angular.element('');e.append(l);var a=l[0].getBoundingClientRect(),c=void 0,u=void 0;n.options.placement===pe.RIGHT?(c=-6,u=i()):n.options.placement===pe.LEFT?(c=o.width-2,u=i()):n.options.placement===pe.TOP?(u=o.height-5,c=s()):n.options.placement===pe.BOTTOM&&(u=-8,c=s()),l.css({top:u+"px",left:c+"px"})}n.popover=null,n.popoverId=Date.now(),n.options={text:d.popoverText,template:d.popoverTemplate,plain:u(d.popoverPlain||!1),placement:d.popoverPlacement||"right",alignment:d.popoverAlignment||"center",group:d.popoverGroup,spacing:parseInt(d.popoverSpacing,10)||0,showCaret:u(d.popoverPlain||!1)},a.off("mouseenter",p),a.on("mouseenter",p),a.off("mouseleave",h),a.on("mouseleave",h)}}}function G(e){var t={};return{add:function(e,n){t[e]=n},find:function(e){return t[e]},remove:function(e){delete t[e]},removeGroup:function(n,o){return angular.forEach(t,function(i,r){r!==o&&i.group&&i.group===n&&e.removeClass(i.popover,"sw-popover-animate").then(function(){i.popover.remove(),delete t[r]})})}}}function B(e){function t(e){var t=0;e.forEach(function(e,n){t=0===n?t+=e:t-=e})}return{calculateHorizontalAlignment:function(t,n,o){switch(o){case pe.LEFT:return t.left;case pe.RIGHT:return t.left+(t.width-n.width);case pe.CENTER:return t.left+(t.width/2-n.width/2);default:return e.warn("calculateHorizontalAlignment issue",this)}},calculateVerticalAlignment:function(t,n,o){switch(o){case pe.TOP:return t.top;case pe.BOTTOM:return t.top+(t.height-n.height);case pe.CENTER:return t.top+(t.height/2-n.height/2);default:return e.warn("calculateVerticalAlignment issue",this)}},calculateVerticalCaret:function(n,o,i,r){switch(r){case pe.TOP:return t([n.height/2,i.height/2,1]);case pe.BOTTOM:return t([o.height,n.height/2,i.height/2,1]);case pe.CENTER:return t([o.height/2,i.height/2,1]);default:return e.warn("calculateVerticalCaret issue",this)}},calculateHorizontalCaret:function(n,o,i,r){switch(r){case pe.LEFT:return t([n.width/2,i.height/2,1]);case pe.RIGHT:return t([o.width,n.width/2,i.height/2,1]);case pe.CENTER:return t([o.width/2,i.height/2,1]);default:return e.warn("calculateHorizontalCaret issue",this)}}}}function I(){return{restrict:"E",controller:"MenuController",controllerAs:"dtm",scope:{current:"=",available:"="},template:''}}function O(e,t){return{restrict:"C",controller:"DropdownController",link:function(n,o){function i(e){o[0].contains(e.target)||t(function(){n.open=!1,s()})}function r(e){27===e.which&&t(function(){n.open=!1,s()})}function s(){e.unbind("click",i),e.unbind("keydown",r)}n.$watch("open",function(t){t&&(e.bind("click",i),e.bind("keydown",r))})}}}function D(e){return{restrict:"C",controller:"DropdownController",require:"?^dropdown",link:function(t,n,o,i){function r(t){t.preventDefault(),e(function(){i.toggle()})}function s(){n.unbind("click",r)}n.bind("click",r),t.$on("$destroy",s)}}}function H(e){return{restrict:"C",require:"?^dropdown",link:function(t,n){t.$watch("open",function(){e[t.open?"addClass":"removeClass"](n,"ddm-open")})}}}B.$inject=["$log"],G.$inject=["$animate"],W.$inject=["$q","$timeout","$templateCache","$compile","PopoverRegistry","PositionHelper","$animate","$document","$http"],O.$inject=["$document","$timeout"],D.$inject=["$timeout"],H.$inject=["$animate"],y.$inject=["$window","$timeout","$parse"],o.$inject=["$document","$timeout"],x.$inject=["$timeout"],k.$inject=["$compile"],z.$inject=["$rootScope","$compile"],Object.defineProperty(e,"__esModule",{value:!0}),e.dtMenu=e.dtPopover=void 0;var M=Object.assign||function(e){for(var t=1;t>>0,e=void 0,r=0;r>>0,e=void 0,r=0;rt.sortPriority)return 1;if(e.sortPriority-1&&(o=this.options.columns[n],e.width=t,e.canAutoResize=!1,this.adjustColumns(n),this.calculateColumns()),this.onColumnResize&&this.onColumnResize({column:o,width:t})}},{key:"onSelected",value:function(e){this.onSelect({rows:e})}},{key:"onRowClicked",value:function(e){this.onRowClick({row:e})}},{key:"onRowDblClicked",value:function(e){this.onRowDblClick({row:e})}}]),e}(),U={columns:{},dTables:{},saveColumns:function(e,t){if(t&&t.length){var n=[].slice.call(t);this.dTables[e]=n}},buildColumns:function(e,t){var n=this;angular.forEach(this.dTables,function(o,i){n.columns[i]=[],angular.forEach(o,function(o){var r={},s=!0;angular.forEach(o.attributes,function(n){var o=c(n.name);switch(o){case"class":r.className=n.value;break;case"name":case"prop":r[o]=n.value;break;case"headerRenderer":case"cellRenderer":case"cellDataGetter":r[o]=t(n.value);break;case"visible":s=t(n.value)(e);break;default:r[o]=t(n.value)(e)}});var l=o.getElementsByTagName("column-header");l.length&&(r.headerTemplate=l[0].innerHTML,o.removeChild(l[0])),""!==o.innerHTML&&(r.template=o.innerHTML),s&&n.columns[i].push(r)})}),this.dTables={}}},q={},X=document.createElement("div").style,Y=function(){var e=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1],n="WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1];return{dom:n,lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}}(),Z=window.navigator.userAgent,_=b("transform"),K=b("backfaceVisibility"),J=!!b("transform"),Q=!!b("perspective"),ee=/Safari\//.test(Z)&&!/Chrome\//.test(Z),te=function(){function e(){n(this,e)}return j(e,[{key:"styles",value:function(){return{width:this.options.internal.innerWidth+"px",height:this.options.headerHeight+"px"}}},{key:"innerStyles",value:function(){return{width:this.columnWidths.total+"px"}}},{key:"onSorted",value:function(e){function t(t){t!==e&&(t.sort=void 0)}"single"===this.options.sortType&&(this.columns.left.forEach(t),this.columns.center.forEach(t),this.columns.right.forEach(t)),this.onSort({column:e})}},{key:"stylesByGroup",value:function(e){var t={width:this.columnWidths[e]+"px"};if("center"===e)C(t,this.options.internal.offsetX*-1,0);else if("right"===e){var n=(this.columnWidths.total-this.options.internal.innerWidth)*-1;C(t,n,0)}return t}},{key:"onResized",value:function(e,t){this.onResize({column:e,width:t})}}]),e}(),ne=function(){function e(t){n(this,e),M(this,{$scope:t}),h()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){this.column.headerCheckbox&&(this.column.headerCheckboxCallback=this.rowSelected),this.$scope.$parent.$parent.$parent.$parent.dt&&(this.dt=this.$scope.$parent.$parent.$parent.$parent.dt)}},{key:"styles",value:function(){return{width:this.column.width+"px",minWidth:this.column.minWidth+"px",maxWidth:this.column.maxWidth+"px",height:this.column.height+"px"}}},{key:"cellClass",value:function(){var e={sortable:this.column.sortable,resizable:this.column.resizable};return this.column.headerClassName&&(e[this.column.headerClassName]=!0),e}},{key:"onSorted",value:function(){this.column.sortable&&(this.column.sort=d(this.sortType,this.column.sort),angular.isUndefined(this.column.sort)&&(this.column.sortPriority=void 0),this.onSort({column:this.column}))}},{key:"sortClass",value:function(){return{"sort-btn":!0,"sort-asc icon-down":"asc"===this.column.sort,"sort-desc icon-up":"desc"===this.column.sort}}},{key:"onResized",value:function(e,t){this.onResize({column:t,width:e})}},{key:"rowSelected",value:function(e){this.allRowsSelected=e.selected&&e.rows.length===e.selected.length}},{key:"checkboxChangeCallback",value:function(){return this.isAllRowsSelected=this.column.allRowsSelected,this.isAllRowsSelected?this.dt.selectAllRows():this.dt.deselectAllRows()}}]),e}(),oe={GROUP:"refreshGroups",TREE:"refreshTree"},ie=function(){function e(t){n(this,e),M(this,{$scope:t}),h()&&this.$onInit()}return e.$inject=["$scope"],j(e,[{key:"$onInit",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.tempRows=[],this.watchListeners=[],this.setTreeAndGroupColumns(),this.setConditionalWatches(),this.$scope.$watch("body.options.columns",function(t){if(t){var n=e.treeColumn,o=e.groupColumn;e.setTreeAndGroupColumns(),e.setConditionalWatches(),(e.treeColumn&&n!==e.treeColumn||e.groupColumn&&o!==e.groupColumn)&&(e.rowsUpdated(e.rows),e.treeColumn?e.refreshTree():e.groupColumn&&e.refreshGroups())}},!0),this.$scope.$watchCollection("body.rows",this.rowsUpdated.bind(this))}},{key:"setTreeAndGroupColumns",value:function(){this.options&&this.options.columns&&(this.treeColumn=this.options.columns.find(function(e){return e.isTreeColumn}),this.treeColumn?this.groupColumn=void 0:this.groupColumn=this.options.columns.find(function(e){return e.group}))}},{key:"buildInternalPage",value:function(){var e=void 0;for(this.tempRows.splice(0,this.tempRows.length),e=0;e=0;t-=1)this.watchListeners[t](),this.watchListeners.splice(t,1);this.options&&(this.options.scrollbarV||!this.options.scrollbarV&&this.options.paging&&this.options.paging.size)&&!function(){var t=!1;e.watchListeners.push(e.$scope.$watch("body.options.paging.size",function(n,o){(!t||n>o)&&(e.getRows(),t=!0)})),e.watchListeners.push(e.$scope.$watch("body.options.paging.count",function(t){e.count=t,e.updatePage()})),e.watchListeners.push(e.$scope.$watch("body.options.paging.offset",function(t){e.options.paging.size&&(e.options.paging.externalPaging||e.buildInternalPage(),e.onPage&&e.onPage({offset:t,size:e.options.paging.size}))}))}()}},{key:"rowsUpdated",value:function(e,n){if(e)if(this.options.paging.externalPaging||(this.options.paging.count=e.length),this.count=this.options.paging.count,(this.treeColumn||this.groupColumn)&&this.buildRowsByGroup(),this.options.scrollbarV){var o=e&&n&&(e.length===n.length||e.lengthn?Math.ceil(o):e,isNaN(o)||(this.options.paging.offset=o)}},{key:"calculateDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.treeColumn?this.treeColumn.relationProp:this.groupColumn.prop,o=this.treeColumn.prop;if(!e[n])return t;if(e.$$depth)return e.$$depth+t;var i=this.index[e[n]];if(i)return t+=1,this.calculateDepth(i,t);for(var r=0,s=this.rows.length;r-1:this.selected===e),t}},{key:"buildTree",value:function(){function e(t,o,i){t.forEach(function(t){var r=t[n.treeColumn.relationProp],s=t[n.treeColumn.prop],l=n.rowsByGroup[s],a=n.expanded[s];(i>0||!r)&&(o.push(t),l&&l.length>0&&a&&e(l,o,i+1))})}var t=[],n=this;return e(this.rows,t,0),t}},{key:"getRows",value:function(e){if((this.treeColumn||this.groupColumn)&&!this.rowsByGroup)return!1;var t=void 0;this.treeColumn?(t=this.treeTemp||[],!e&&this.treeTemp||(this.treeTemp=t=this.buildTree(),this.count=t.length,this.tempRows.splice(0,this.tempRows.length))):this.groupColumn?(t=this.groupsTemp||[],!e&&this.groupsTemp||(this.groupsTemp=t=this.buildGroups(),this.count=t.length)):(t=this.rows,e===!0&&this.tempRows.splice(0,this.tempRows.length));var n=0,o=this.getFirstLastIndexes(),i=o.first;for(this.tempRows.splice(0,o.last-o.first);i-1?this.selected.splice(i,1):(this.options.multiSelectOnShift&&1===this.selected.length&&this.selected.splice(0,1),this.selected.push(n),this.body.onSelect({rows:[n]}))}this.prevIndex=t}else this.selected=n,this.body.onSelect({rows:[n]})}},{key:"selectRowsBetween",value:function(e){for(var t=e=this.prevIndex&&o<=e,l=o<=this.prevIndex&&o>=e,a={};if(a=t?{start:e,end:this.prevIndex-e}:{start:this.prevIndex,end:e+1},t&&l||!t&&s){var c=this.selected.indexOf(r);t&&c>-1?this.selected.splice(c,1):o>=a.start&&o0&&e<=this.totalPages&&(this.page=e,this.onPage({page:e}))}},{key:"prevPage",value:function(){this.canPrevious()&&this.selectPage(this.page-=1)}},{key:"nextPage",value:function(){this.canNext()&&this.selectPage(this.page+=1)}},{key:"canPrevious",value:function(){return this.page>1}},{key:"canNext",value:function(){return this.page-1}},{key:"onCheck",value:function(e){var t=this.getColumnIndex(e);t===-1?this.$scope.current.push(e):this.$scope.current.splice(t,1)}}]),e}(),me=function(){function e(t){n(this,e),M(this,{$scope:t}),t.open=!1}return e.$inject=["$scope"],j(e,[{key:"toggle",value:function(){this.$scope.open=!this.$scope.open}}]),e}(),ve=angular.module("dt.dropdown",[]).controller("DropdownController",me).directive("dropdown",O).directive("dropdownToggle",D).directive("dropdownMenu",H),we=angular.module("dt.menu",[ve.name]).controller("MenuController",fe).directive("dtm",I),ye=angular.module("data-table",[]).directive("dtable",y).directive("resizable",o).directive("sortable",i).directive("dtHeader",x).directive("dtHeaderCell",k).directive("dtBody",$).directive("dtScroller",T).directive("dtSeletion",R).directive("dtRow",P).directive("dtGroupRow",S).directive("dtCell",z).directive("dtFooter",E).directive("dtPager",A);e.dtPopover=ge,e.dtMenu=we,e.default=ye}); \ No newline at end of file diff --git a/src/components/menu/menu.js b/src/components/menu/menu.js index 40681f9..406ebdf 100644 --- a/src/components/menu/menu.js +++ b/src/components/menu/menu.js @@ -1,5 +1,3 @@ -import angular from 'angular'; - import MenuController from './MenuController'; import MenuDirective from './MenuDirective'; diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index 247c495..d42530d 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -1,5 +1,3 @@ -import angular from 'angular'; - import PopoverDirective from './PopoverDirective'; import PopoverRegistry from './PopoverRegistry'; import PositionHelper from './PositionHelper'; diff --git a/src/dataTable.js b/src/dataTable.js index 743d7d2..40716b1 100644 --- a/src/dataTable.js +++ b/src/dataTable.js @@ -1,4 +1,4 @@ -import angular from 'angular'; +import 'angular'; import './utils/polyfill';