@skyux/grids 4.0.3 → 4.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bundles/skyux-grids.umd.js +245 -52
  3. package/bundles/skyux-grids.umd.js.map +1 -1
  4. package/bundles/skyux-grids.umd.min.js +11 -11
  5. package/bundles/skyux-grids.umd.min.js.map +1 -1
  6. package/esm2015/modules/grid/grid-adapter.service.js +11 -2
  7. package/esm2015/modules/grid/grid-cell.component.js +4 -1
  8. package/esm2015/modules/grid/grid-column.component.js +30 -19
  9. package/esm2015/modules/grid/grid-column.model.js +4 -1
  10. package/esm2015/modules/grid/grid.component.js +151 -23
  11. package/esm2015/modules/grid/grid.module.js +4 -2
  12. package/esm2015/modules/grid/types/grid-column-description-model-change.js +1 -1
  13. package/esm2015/modules/grid/types/grid-column-heading-model-change.js +1 -1
  14. package/esm2015/modules/grid/types/grid-column-inline-help-popover-model-change.js +1 -1
  15. package/esm2015/modules/grid/types/grid-column-width-model-change.js +1 -1
  16. package/esm2015/modules/grid/types/grid-message-type.js +13 -1
  17. package/esm2015/modules/grid/types/grid-message.js +1 -1
  18. package/esm2015/modules/grid/types/grid-row-delete-cancel-args.js +1 -1
  19. package/esm2015/modules/grid/types/grid-row-delete-config.js +1 -1
  20. package/esm2015/modules/grid/types/grid-row-delete-confirm-args.js +1 -1
  21. package/esm2015/modules/grid/types/grid-row-delete-contents.js +1 -0
  22. package/esm2015/modules/grid/types/grid-selected-rows-model-change.js +1 -1
  23. package/esm2015/modules/grid/types/grid-selected-rows-source.js +4 -1
  24. package/esm2015/modules/grid/types/grid-ui-config.js +1 -1
  25. package/esm2015/polyfills.js +3 -3
  26. package/esm5/modules/grid/grid-adapter.service.js +23 -3
  27. package/esm5/modules/grid/grid-cell.component.js +4 -1
  28. package/esm5/modules/grid/grid-column.component.js +30 -19
  29. package/esm5/modules/grid/grid-column.model.js +4 -1
  30. package/esm5/modules/grid/grid.component.js +157 -23
  31. package/esm5/modules/grid/grid.module.js +4 -2
  32. package/esm5/modules/grid/types/grid-column-description-model-change.js +1 -1
  33. package/esm5/modules/grid/types/grid-column-heading-model-change.js +1 -1
  34. package/esm5/modules/grid/types/grid-column-inline-help-popover-model-change.js +1 -1
  35. package/esm5/modules/grid/types/grid-column-width-model-change.js +1 -1
  36. package/esm5/modules/grid/types/grid-message-type.js +13 -1
  37. package/esm5/modules/grid/types/grid-message.js +1 -1
  38. package/esm5/modules/grid/types/grid-row-delete-cancel-args.js +1 -1
  39. package/esm5/modules/grid/types/grid-row-delete-config.js +1 -1
  40. package/esm5/modules/grid/types/grid-row-delete-confirm-args.js +1 -1
  41. package/esm5/modules/grid/types/grid-row-delete-contents.js +1 -0
  42. package/esm5/modules/grid/types/grid-selected-rows-model-change.js +1 -1
  43. package/esm5/modules/grid/types/grid-selected-rows-source.js +4 -1
  44. package/esm5/modules/grid/types/grid-ui-config.js +1 -1
  45. package/esm5/polyfills.js +3 -3
  46. package/fesm2015/skyux-grids.js +213 -42
  47. package/fesm2015/skyux-grids.js.map +1 -1
  48. package/fesm5/skyux-grids.js +231 -43
  49. package/fesm5/skyux-grids.js.map +1 -1
  50. package/modules/grid/grid-adapter.service.d.ts +3 -0
  51. package/modules/grid/grid-cell.component.d.ts +3 -0
  52. package/modules/grid/grid-column.component.d.ts +68 -12
  53. package/modules/grid/grid-column.model.d.ts +3 -0
  54. package/modules/grid/grid.component.d.ts +105 -7
  55. package/modules/grid/types/grid-column-description-model-change.d.ts +3 -0
  56. package/modules/grid/types/grid-column-heading-model-change.d.ts +3 -0
  57. package/modules/grid/types/grid-column-inline-help-popover-model-change.d.ts +3 -0
  58. package/modules/grid/types/grid-column-width-model-change.d.ts +9 -0
  59. package/modules/grid/types/grid-message-type.d.ts +12 -0
  60. package/modules/grid/types/grid-message.d.ts +6 -0
  61. package/modules/grid/types/grid-row-delete-cancel-args.d.ts +3 -0
  62. package/modules/grid/types/grid-row-delete-config.d.ts +3 -0
  63. package/modules/grid/types/grid-row-delete-confirm-args.d.ts +3 -0
  64. package/modules/grid/types/grid-row-delete-contents.d.ts +9 -0
  65. package/modules/grid/types/grid-selected-rows-model-change.d.ts +3 -0
  66. package/modules/grid/types/grid-selected-rows-source.d.ts +3 -0
  67. package/modules/grid/types/grid-ui-config.d.ts +3 -0
  68. package/package.json +3 -3
  69. package/skyux-grids.metadata.json +1 -1
  70. package/src/assets/img/grid-annotated.png +0 -0
  71. package/src/assets/img/grid-dont-use-complex.png +0 -0
  72. package/src/assets/img/grid-fit-scroll.png +0 -0
  73. package/src/assets/img/grid-fit-width.png +0 -0
  74. package/src/assets/img/grid-option-context-menu.png +0 -0
  75. package/src/assets/img/grid-option-filter.png +0 -0
  76. package/src/assets/img/grid-option-multi-dont-tile.png +0 -0
  77. package/src/assets/img/grid-option-multi.png +0 -0
  78. package/src/assets/img/grid-option-sort.png +0 -0
  79. package/src/assets/img/grid-option-template-column.png +0 -0
  80. package/src/assets/img/grid-reorder.png +0 -0
  81. package/src/assets/img/grid-resize.png +0 -0
  82. package/src/assets/img/grid-use-when.png +0 -0
@@ -1,16 +1,16 @@
1
1
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ng2-dragula"),require("@skyux/core"),require("@skyux/forms"),require("@skyux/indicators"),require("@skyux/layout"),require("@skyux/popovers"),require("rxjs"),require("rxjs/operators"),require("@skyux/list-builder-common"),require("@skyux/i18n")):"function"==typeof define&&define.amd?define("@skyux/grids",["exports","@angular/core","@angular/common","@angular/forms","ng2-dragula","@skyux/core","@skyux/forms","@skyux/indicators","@skyux/layout","@skyux/popovers","rxjs","rxjs/operators","@skyux/list-builder-common","@skyux/i18n"],t):t(((e=e||self).skyux=e.skyux||{},e.skyux.grids={}),e.ng.core,e.ng.common,e.ng.forms,e.ng2Dragula,e.core$1,e.forms$1,e.indicators,e.layout,e.popovers,e.rxjs,e.rxjs.operators,e.listBuilderCommon,e.i18n)}(this,(function(e,t,i,n,o,r,s,l,d,a,c,h,u,p){"use strict";
2
2
  /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
- this file except in compliance with the License. You may obtain a copy of the
6
- License at http://www.apache.org/licenses/LICENSE-2.0
3
+ Copyright (c) Microsoft Corporation.
7
4
 
8
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
- MERCHANTABLITY OR NON-INFRINGEMENT.
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
12
7
 
13
- See the Apache Version 2.0 License for specific language governing permissions
14
- and limitations under the License.
15
- ***************************************************************************** */var g,m;function y(e,t,i,n){var o,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function f(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,o,r=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return s}(g=e.SkyGridMessageType||(e.SkyGridMessageType={}))[g.SelectAll=0]="SelectAll",g[g.ClearAll=1]="ClearAll",g[g.PromptDeleteRow=2]="PromptDeleteRow",g[g.AbortDeleteRow=3]="AbortDeleteRow",(m=e.SkyGridSelectedRowsSource||(e.SkyGridSelectedRowsSource={}))[m.CheckboxChange=0]="CheckboxChange",m[m.ClearAll=1]="ClearAll",m[m.RowClick=2]="RowClick",m[m.SelectAll=3]="SelectAll",m[m.SelectedRowIdsChange=4]="SelectedRowIdsChange";var k=function(){function e(){this.isSortable=!0,this.alignment="left",this.searchFunction=this.search,this.descriptionChanges=new t.EventEmitter,this.descriptionModelChanges=new t.EventEmitter,this.headingChanges=new t.EventEmitter,this.headingModelChanges=new t.EventEmitter,this.inlineHelpPopoverModelChanges=new t.EventEmitter}return e.prototype.ngOnChanges=function(e){e.heading&&!1===e.heading.firstChange&&(this.headingChanges.emit(this.heading),this.headingModelChanges.emit({value:this.heading,id:this.id,field:this.field})),e.description&&!1===e.description.firstChange&&(this.descriptionChanges.emit(this.description),this.descriptionModelChanges.emit({value:this.description,id:this.id,field:this.field})),e.inlineHelpPopover&&!1===e.inlineHelpPopover.firstChange&&this.inlineHelpPopoverModelChanges.emit({value:this.inlineHelpPopover,id:this.id,field:this.field})},Object.defineProperty(e.prototype,"template",{get:function(){return this.templates.length>0?this.templates.first:this.templateInput},enumerable:!0,configurable:!0}),e.prototype.search=function(e,t){return null!=e&&-1!==e.toString().toLowerCase().indexOf(t)},y([t.Input()],e.prototype,"id",void 0),y([t.Input()],e.prototype,"heading",void 0),y([t.Input()],e.prototype,"inlineHelpPopover",void 0),y([t.Input()],e.prototype,"width",void 0),y([t.Input()],e.prototype,"hidden",void 0),y([t.Input()],e.prototype,"locked",void 0),y([t.Input()],e.prototype,"field",void 0),y([t.Input()],e.prototype,"type",void 0),y([t.Input()],e.prototype,"description",void 0),y([t.Input()],e.prototype,"isSortable",void 0),y([t.Input()],e.prototype,"excludeFromHighlighting",void 0),y([t.Input()],e.prototype,"alignment",void 0),y([t.Input("search")],e.prototype,"searchFunction",void 0),y([t.Input("template")],e.prototype,"templateInput",void 0),y([t.ContentChildren(t.TemplateRef)],e.prototype,"templates",void 0),e=y([t.Component({selector:"sky-grid-column",template:"<ng-content></ng-content>",changeDetection:t.ChangeDetectionStrategy.OnPush})],e)}(),C=function(e,t){this.isSortable=!0,this.template=e,t&&(this.id=t.id||t.field,this.type=t.type,this.field=t.field,this.heading=t.heading,this.inlineHelpPopover=t.inlineHelpPopover,this.width=t.width?Number(t.width):void 0,this.hidden=t.hidden,this.locked=t.locked,this.description=t.description,this.searchFunction=t.searchFunction,this.isSortable=t.isSortable,this.excludeFromHighlighting=t.excludeFromHighlighting,this.alignment=t.alignment)},v=function(){function e(e){this.rendererFactory=e,this.renderer=this.rendererFactory.createRenderer(void 0,void 0)}return e.prototype.initializeDragAndDrop=function(e,t){var i=this;e.drag.subscribe((function(e){return f(e,2)[1].classList.add("sky-grid-header-dragging")})),e.dragend.subscribe((function(e){return f(e,2)[1].classList.remove("sky-grid-header-dragging")})),e.drop.subscribe((function(e){for(var i=[],n=f(e,3)[2].querySelectorAll("th:not(.sky-grid-multiselect-cell):not(.sky-grid-row-delete-heading)"),o=0;o<n.length;o++){var r=n[o].getAttribute("sky-cmp-id");i.push(r)}t(i)})),e.setOptions("sky-grid-heading",{moves:function(e,t,n){var o=t.querySelectorAll("th div"),r=i.isLeftOfLocked(n,o);return!(e.querySelector(".sky-grid-header-locked")||void 0===n||n.matches(".sky-grid-resize-handle")||n.matches(".sky-grid-multiselect-cell")||n.matches(".sky-grid-row-delete-heading")||r)},accepts:function(e,t,n,o){if(void 0===o||!o)return!0;var r=n.querySelectorAll("th div"),s=o.querySelector("div"),l=i.isLeftOfLocked(s,r);return!o.matches(".sky-grid-header-locked")&&!o.matches(".sky-grid-resize-handle")&&!l}})},e.prototype.getRowHeight=function(e,t){return e.nativeElement.querySelectorAll("tbody tr")[t].scrollHeight+"px"},e.prototype.setStyle=function(e,t,i){e&&this.renderer.setStyle(e.nativeElement,t,i)},e.prototype.isLeftOfLocked=function(e,t){for(var i=t.length-1;i>=0;i--){if(t[i].classList.contains("sky-grid-header-locked"))return!0;if(t[i]===e)break}return!1},e.ctorParameters=function(){return[{type:t.RendererFactory2}]},e=y([t.Injectable()],e)}();Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var w=0,b=function(){function i(e,i,n,o,r){this.dragulaService=e,this.gridAdapter=i,this.skyWindow=n,this.uiConfigService=o,this.changeDetector=r,this.enableMultiselect=!1,this.fit="width",this.hasToolbar=!1,this.messageStream=new c.Subject,this.columnWidthChange=new t.EventEmitter,this.multiselectSelectionChange=new t.EventEmitter,this.rowDeleteCancel=new t.EventEmitter,this.rowDeleteConfirm=new t.EventEmitter,this.selectedColumnIdsChange=new t.EventEmitter,this.sortFieldChange=new t.EventEmitter,this.columnResizeStep=10,this.gridId=++w,this.rowDeleteConfigs=[],this.maxColWidth=9999,this.minColWidth=50,this.showResizeBar=!1,this.showTopScroll=!1,this.isDraggingResizeHandle=!1,this.isResized=!1,this.ngUnsubscribe=new c.Subject,this.subscriptions=[],this.scrollTriggered=!1,this.selectedColumnIdsSet=!1,this.displayedColumns=new Array,this.items=new Array,this.currentSortField=new c.BehaviorSubject({fieldSelector:"",descending:!1})}return Object.defineProperty(i.prototype,"selectedColumnIds",{get:function(){return this._selectedColumnIds},set:function(e){var t=this._selectedColumnIds;this._selectedColumnIds=e,this.columns&&this.setDisplayedColumns(),t&&e&&this.arraysEqual(e,t)||this.selectedColumnIdsSet&&(this.setUserConfig({selectedColumnIds:e}),this.selectedColumnIdsChange.emit(this._selectedColumnIds),this.isResized&&this.resetTableWidth()),this.selectedColumnIdsSet=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedRowIds",{get:function(){return this._selectedRowIds},set:function(t){t&&(this._selectedRowIds=t,this.applySelectedRows(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.SelectedRowIdsChange))},enumerable:!0,configurable:!0}),i.prototype.ngOnInit=function(){var e=this;this.messageStream.pipe(h.takeUntil(this.ngUnsubscribe)).subscribe((function(t){e.handleIncomingMessages(t)}))},i.prototype.ngAfterContentInit=function(){var e=this;this.settingsKey?this.applyUserConfig().then((function(){e.initColumns()})):this.initColumns(),this.gridAdapter.initializeDragAndDrop(this.dragulaService,(function(t){e.onHeaderDrop(t)})),this.applySelectedRows()},i.prototype.ngAfterViewInit=function(){this.checkUserColumnWidthsForScroll()},i.prototype.ngOnChanges=function(e){var t=this;e.columns&&this.columns&&this.setDisplayedColumns(!0),e.data&&this.data&&(this.transformData(),setTimeout((function(){t.checkUserColumnWidthsForScroll()}))),e.sortField&&this.setSortHeaders()},i.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(e){e.unsubscribe()})),this.multiselectSelectionChange.complete(),this.ngUnsubscribe.next(),this.ngUnsubscribe.complete()},i.prototype.onWindowResize=function(){this.checkUserColumnWidthsForScroll()},i.prototype.getTopScrollWidth=function(){return this.tableElementRef.nativeElement.scrollWidth},i.prototype.getTableClassNames=function(){var e=[];return"scroll"!==this.fit&&e.push("sky-grid-fit"),this.hasToolbar&&e.push("sky-grid-has-toolbar"),this.addDelimeter(e," ")},i.prototype.getTableHeaderClassNames=function(e){var t=[];return e&&e.locked&&t.push("sky-grid-header-locked"),this.addDelimeter(t," ")},i.prototype.getCaretIconNames=function(e){var t=[];return this.getSortDirection(e.field).subscribe((function(e){"asc"===e&&t.push("caret-up"),"desc"===e&&t.push("caret-down")})),this.addDelimeter(t," ")},i.prototype.onKeydown=function(e,t){var i=e.key.toLowerCase();"enter"!==i&&" "!==i||this.sortByColumn(t)},i.prototype.sortByColumn=function(e){var t=this;!this.isDraggingResizeHandle&&e.isSortable&&this.currentSortField.pipe(h.take(1),h.map((function(i){var n={fieldSelector:e.field,descending:!0};i&&i.fieldSelector===e.field&&i.descending&&(n={fieldSelector:e.field,descending:!1}),t.sortFieldChange.emit(n),t.currentSortField.next(n)}))).subscribe()},i.prototype.getSortDirection=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e?t.descending?"desc":"asc":void 0})))},i.prototype.getAriaSortDirection=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e.field?t.descending?"descending":"ascending":e.isSortable?"none":void 0})))},i.prototype.getCaretVisibility=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e?"visible":"hidden"})))},i.prototype.getHelpInlineClass=function(e){return this.getCaretVisibility(e).pipe(h.map((function(e){return"hidden"===e})))},i.prototype.onMultiselectCheckboxChange=function(){this.emitSelectedRows(e.SkyGridSelectedRowsSource.CheckboxChange)},i.prototype.updateColumnHeading=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.heading=e.value,this.changeDetector.markForCheck())},i.prototype.updateInlineHelpPopover=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.inlineHelpPopover=e.value,this.changeDetector.markForCheck())},i.prototype.updateColumnDescription=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.description=e.value,this.changeDetector.markForCheck())},i.prototype.onResizeColumnStart=function(e){var t=this;this.isResized||(this.initColumnWidths(),this.isResized=!0),this.initializeResizeColumn(e),this.isDraggingResizeHandle=!0,this.xPosStart=e.pageX,this.showResizeBar=!0,this.changeDetector.detectChanges(),this.setResizeBarPosition(e.pageX),e.preventDefault(),e.stopPropagation();var i=c.fromEvent(document,"mousemove"),n=c.fromEvent(document,"touchmove");c.merge(i,n).pipe(h.takeWhile((function(){return t.isDraggingResizeHandle}))).subscribe((function(e){t.onResizeHandleMove(e)}));var o=c.fromEvent(document,"mouseup"),r=c.fromEvent(document,"touchend");c.merge(o,r).pipe(h.takeWhile((function(){return t.isDraggingResizeHandle}))).subscribe((function(e){t.onResizeHandleRelease(e)}))},i.prototype.onKeydownResizeCol=function(e){this.isResized||(this.initColumnWidths(),this.isResized=!0),this.initializeResizeColumn(e)},i.prototype.onInputChangeResizeCol=function(e){var t=e.target,i=Number(t.value),n=i-this.startColumnWidth;this.resizeColumnByIndex(this.activeResizeColumnIndex,i,n);var o=t.getBoundingClientRect().left;this.setResizeBarPosition(o)},i.prototype.onResizeHandleMove=function(e){var t=e.pageX-this.xPosStart,i=this.startColumnWidth+t;if(i<=this.minColWidth)e.stopPropagation();else{var n=this.getMaxRangeByIndex(this.activeResizeColumnIndex);"width"===this.fit&&i>n?e.stopPropagation():this.setResizeBarPosition(e.pageX)}},i.prototype.onResizeHandleBlur=function(e){this.showResizeBar=!1},i.prototype.onResizeHandleFocus=function(e){this.showResizeBar=!0,this.changeDetector.detectChanges();var t=e.target.getBoundingClientRect().left;this.setResizeBarPosition(t)},i.prototype.onResizeHandleRelease=function(e){this.showResizeBar=!1;var t=e.pageX-this.xPosStart,i=this.startColumnWidth+t;this.resizeColumnByIndex(this.activeResizeColumnIndex,i,t),this.isDraggingResizeHandle=!1,this.activeResizeColumnIndex=void 0,e.stopPropagation(),this.changeDetector.markForCheck()},i.prototype.onRowClick=function(t,i){this.enableMultiselect&&(t.target!==t.currentTarget&&this.isInteractiveElement(t)||(i.isSelected=!i.isSelected,this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.RowClick)))},i.prototype.isRowHighlighted=function(e){return!!this.rowHighlightedId&&e===this.rowHighlightedId},i.prototype.getRowHeight=function(e){return this.gridAdapter.getRowHeight(this.tableElementRef,e)},i.prototype.cancelRowDelete=function(e){this.rowDeleteConfigs=this.rowDeleteConfigs.filter((function(t){return t.id!==e})),this.rowDeleteCancel.emit({id:e})},i.prototype.confirmRowDelete=function(e){this.rowDeleteConfigs.find((function(t){return t.id===e})).pending=!0,this.rowDeleteConfirm.emit({id:e})},i.prototype.getRowDeleteItem=function(e){return this.rowDeleteConfigs.find((function(t){return t.id===e}))},i.prototype.onTouchMove=function(e){e.preventDefault()},i.prototype.onTopScroll=function(e){this.tableContainerElementRef&&(this.scrollTriggered?(this.scrollTriggered=!1,this.tableContainerElementRef.nativeElement.scrollLeft=this.topScrollContainerElementRef.nativeElement.scrollLeft):this.scrollTriggered=!0)},i.prototype.onGridScroll=function(e){this.topScrollContainerElementRef&&(this.scrollTriggered?(this.scrollTriggered=!1,this.topScrollContainerElementRef.nativeElement.scrollLeft=this.tableContainerElementRef.nativeElement.scrollLeft):this.scrollTriggered=!0)},i.prototype.checkUserColumnWidthsForScroll=function(){var e=this;if(!this.showTopScroll&&this.columnElementRefs&&this.columnElementRefs.length>0){var t=0,i=this.skyWindow.nativeWindow.innerWidth;this.columnElementRefs.forEach((function(n){if(!e.showTopScroll){var o=parseFloat(window.getComputedStyle(n.nativeElement).width),r=n.nativeElement.offsetWidth,s=Math.max(o||r,e.minColWidth);(t+=s)>i&&(e.showTopScroll=!0,setTimeout((function(){e.changeDetector.markForCheck()})))}}))}},i.prototype.multiselectSelectAll=function(){for(var t=0;t<this.items.length;t++)this.items[t].isSelected=!0;this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.SelectAll)},i.prototype.multiselectClearAll=function(){for(var t=0;t<this.items.length;t++)this.items[t].isSelected=!1;this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.ClearAll)},i.prototype.handleIncomingMessages=function(t){switch(t.type){case e.SkyGridMessageType.SelectAll:this.multiselectSelectAll();break;case e.SkyGridMessageType.ClearAll:this.multiselectClearAll();break;case e.SkyGridMessageType.PromptDeleteRow:if(t.data&&t.data.promptDeleteRow){var i=this.rowDeleteConfigs.find((function(e){return e.id===t.data.promptDeleteRow.id}));i?i.pending=!1:this.rowDeleteConfigs.push({id:t.data.promptDeleteRow.id,pending:!1})}break;case e.SkyGridMessageType.AbortDeleteRow:t.data&&t.data.abortDeleteRow&&(this.rowDeleteConfigs=this.rowDeleteConfigs.filter((function(e){return e.id!==t.data.abortDeleteRow.id})))}this.changeDetector.markForCheck()},i.prototype.onHeaderDrop=function(e){this.selectedColumnIdsSet=!0,this.selectedColumnIds=e,this.changeDetector.markForCheck()},i.prototype.setDisplayedColumns=function(e){var t=this;void 0===e&&(e=!1),void 0!==this.selectedColumnIds?this.displayedColumns=this.selectedColumnIds.map((function(e){return t.columns.filter((function(t){return t.id===e}))[0]})):this.displayedColumns=e?this.columns.filter((function(e){return!e.hidden})):this.columns},i.prototype.transformData=function(){this.data&&this.data.length>0&&this.data[0].id&&!this.data[0].data?this.multiselectRowId?this.items=this.getGridDataWithSelectedRows():this.items=this.data.map((function(e){return new u.ListItemModel(e.id,e)})):this.items=this.data},i.prototype.getGridDataWithSelectedRows=function(){var e=this,t=this.getSelectedRows();return this.data.map((function(i){var n;return n=i.hasOwnProperty(e.multiselectRowId)?t.indexOf(i[e.multiselectRowId])>-1:t.indexOf(i.id)>-1,new u.ListItemModel(i.id,i,n)}))},i.prototype.applySelectedRows=function(){if(this.items&&this.items.length>0&&this.selectedRowIds){for(var e=0;e<this.items.length;e++)this.items[e].isSelected=this.selectedRowIds.indexOf(this.items[e].id)>-1;this.changeDetector.markForCheck()}},i.prototype.setSortHeaders=function(){this.currentSortField.next(this.sortField||{fieldSelector:"",descending:!1})},i.prototype.getColumnsFromComponent=function(){this.columns=this.columnComponents.map((function(e){return new C(e.template,e)}))},i.prototype.updateColumns=function(){var e=this;this.getColumnsFromComponent(),this.setDisplayedColumns(!0),this.changeDetector.markForCheck(),setTimeout((function(){e.checkUserColumnWidthsForScroll()}))},i.prototype.resizeColumnByIndex=function(e,t,i){var n=this.getColumnModelByIndex(e);if(t<=this.minColWidth&&(i=i+this.minColWidth-t,t=this.minColWidth),"width"===this.fit){var o=this.getLastDisplayedColumn(),r=this.getMaxRangeByIndex(e);t>r&&(t=r,i=r-this.startColumnWidth),n.width=t,o.width=o.width-i,this.updateMaxRange()}else this.gridAdapter.setStyle(this.tableElementRef,"width",this.tableWidth+i+"px"),n.width=t;this.changeDetector.detectChanges(),this.columnWidthChange.emit(this.getColumnWidthModelChange()),"scroll"===this.fit&&(this.tableWidth=this.tableElementRef.nativeElement.offsetWidth)},i.prototype.initColumnWidths=function(){var e=this;this.tableWidth=this.tableElementRef.nativeElement.offsetWidth,this.showTopScroll=!0,this.columnElementRefs.forEach((function(t,i){var n=parseFloat(window.getComputedStyle(t.nativeElement).width),o=t.nativeElement.offsetWidth,r=Math.max(n||o,e.minColWidth);e.getColumnModelByIndex(i).width=r})),"scroll"===this.fit&&this.gridAdapter.setStyle(this.tableElementRef,"min-width","auto"),"width"===this.fit&&this.updateMaxRange(),this.changeDetector.detectChanges()},i.prototype.getColumnWidthModelChange=function(){var e=new Array;return this.columns.forEach((function(t){e.push({id:t.id,field:t.field,width:t.width})})),e},i.prototype.updateMaxRange=function(){var e=this,t=this.getLastDisplayedColumn().width-this.minColWidth;this.displayedColumns.forEach((function(i,n){var o=i.width+t,r=e.getRangeInputByIndex(n);r.nativeElement.max=o,r.nativeElement.setAttribute("aria-valuemax",o)}))},i.prototype.initializeResizeColumn=function(e){var t=e.target;this.activeResizeColumnIndex=t.getAttribute("sky-cmp-index");var i=this.getColumnModelByIndex(this.activeResizeColumnIndex);this.startColumnWidth=i.width},i.prototype.resetTableWidth=function(){var e=this;this.skyWindow.nativeWindow.setTimeout((function(){e.gridAdapter.setStyle(e.tableElementRef,"width","auto"),e.changeDetector.detectChanges(),e.tableWidth=e.tableElementRef.nativeElement.offsetWidth,e.gridAdapter.setStyle(e.tableElementRef,"width",e.tableWidth+"px"),e.changeDetector.detectChanges()}))},i.prototype.getRangeInputByIndex=function(e){return this.columnRangeInputElementRefs.find((function(t){return t.nativeElement.getAttribute("sky-cmp-index")===e.toString()}))},i.prototype.getColumnModelByIndex=function(e){return this.displayedColumns[Number(e)]},i.prototype.getMaxRangeByIndex=function(e){var t=this.columnElementRefs.find((function(t){return t.nativeElement.getAttribute("sky-cmp-index")===e})).nativeElement.querySelector(".sky-grid-column-input-aria-only");return Number(t.max)},i.prototype.getLastDisplayedColumn=function(){return this.getColumnModelByIndex(this.displayedColumns.length-1)},i.prototype.addDelimeter=function(e,t){return e.filter((function(e){return e})).join(t)},i.prototype.emitSelectedRows=function(e){var t={selectedRowIds:this.getSelectedRows(),source:e};this.multiselectSelectionChange.emit(t)},i.prototype.getSelectedRows=function(){var e=this;return this.items.filter((function(e){return e.isSelected})).map((function(t){return t.data.hasOwnProperty(e.multiselectRowId)?t.data[e.multiselectRowId]:t.id}))},i.prototype.isInteractiveElement=function(e){return e.target.closest("\n a,\n button,\n input,\n label,\n option,\n select,\n textarea,\n details,\n dialog,\n menu,\n menuitem,\n summary")},i.prototype.setResizeBarPosition=function(e){var t=this.tableContainerElementRef.nativeElement.scrollLeft,i=e-this.tableElementRef.nativeElement.getBoundingClientRect().left-t;this.gridAdapter.setStyle(this.resizeBar,"left",i+"px")},i.prototype.applyUserConfig=function(){var e=this;return new Promise((function(t){e.uiConfigService.getConfig(e.settingsKey).pipe(h.take(1)).subscribe((function(i){if(i&&i.selectedColumnIds){var n=i.selectedColumnIds.filter((function(t){return e.columns.find((function(e){return e.id===t}))}));e.selectedColumnIds=n,e.changeDetector.markForCheck()}t()}),(function(){t()}))}))},i.prototype.setUserConfig=function(e){this.settingsKey&&this.uiConfigService.setConfig(this.settingsKey,e).pipe(h.takeUntil(this.ngUnsubscribe)).subscribe((function(){}),(function(e){console.warn("Could not save grid settings."),console.warn(e)}))},i.prototype.initColumns=function(){var e=this;0===this.columnComponents.length&&void 0===this.columns||(this.columnComponents.length>0&&this.getColumnsFromComponent(),this.transformData(),this.setDisplayedColumns(!0),this.changeDetector.markForCheck()),this.subscriptions.push(this.columnComponents.changes.subscribe((function(){return e.updateColumns()}))),this.columnComponents.forEach((function(t){e.subscriptions.push(t.headingModelChanges.subscribe((function(t){e.updateColumnHeading(t)}))),e.subscriptions.push(t.descriptionModelChanges.subscribe((function(t){e.updateColumnDescription(t)}))),e.subscriptions.push(t.inlineHelpPopoverModelChanges.subscribe((function(t){e.updateInlineHelpPopover(t)})))}))},i.prototype.arraysEqual=function(e,t){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))},i.ctorParameters=function(){return[{type:o.DragulaService},{type:v},{type:r.SkyAppWindowRef},{type:r.SkyUIConfigService},{type:t.ChangeDetectorRef}]},y([t.Input()],i.prototype,"columns",void 0),y([t.Input()],i.prototype,"data",void 0),y([t.Input()],i.prototype,"enableMultiselect",void 0),y([t.Input()],i.prototype,"fit",void 0),y([t.Input()],i.prototype,"hasToolbar",void 0),y([t.Input()],i.prototype,"height",void 0),y([t.Input()],i.prototype,"highlightText",void 0),y([t.Input()],i.prototype,"messageStream",void 0),y([t.Input()],i.prototype,"multiselectRowId",void 0),y([t.Input()],i.prototype,"rowHighlightedId",void 0),y([t.Input()],i.prototype,"settingsKey",void 0),y([t.Input()],i.prototype,"sortField",void 0),y([t.Input()],i.prototype,"width",void 0),y([t.Input()],i.prototype,"selectedColumnIds",null),y([t.Input()],i.prototype,"selectedRowIds",null),y([t.Output()],i.prototype,"columnWidthChange",void 0),y([t.Output()],i.prototype,"multiselectSelectionChange",void 0),y([t.Output()],i.prototype,"rowDeleteCancel",void 0),y([t.Output()],i.prototype,"rowDeleteConfirm",void 0),y([t.Output()],i.prototype,"selectedColumnIdsChange",void 0),y([t.Output()],i.prototype,"sortFieldChange",void 0),y([t.ContentChildren(k,{descendants:!0})],i.prototype,"columnComponents",void 0),y([t.ViewChildren("gridCol")],i.prototype,"columnElementRefs",void 0),y([t.ViewChildren("colSizeRange")],i.prototype,"columnRangeInputElementRefs",void 0),y([t.ViewChild("gridContainer")],i.prototype,"tableContainerElementRef",void 0),y([t.ViewChild("gridTable")],i.prototype,"tableElementRef",void 0),y([t.ViewChild("topScrollContainer")],i.prototype,"topScrollContainerElementRef",void 0),y([t.ViewChild("resizeBar")],i.prototype,"resizeBar",void 0),y([t.HostListener("window:resize")],i.prototype,"onWindowResize",null),i=y([t.Component({selector:"sky-grid",template:'<div class="sky-grid">\n <div *ngIf="showTopScroll"\n class="sky-grid-top-scroll-container"\n (scroll)="onTopScroll($event)"\n #topScrollContainer\n >\n <div\n class="sky-grid-top-scroll"\n [style.width.px]="getTopScrollWidth()"\n ></div>\n </div>\n <div\n class="sky-grid-table-container"\n [style.height.px]="height"\n [style.width.px]="width"\n (scroll)="onGridScroll($event)"\n #gridContainer\n >\n <table\n class="sky-grid-table"\n [ngClass]="getTableClassNames()"\n #gridTable>\n <thead>\n <tr dragula="sky-grid-heading">\n <th *ngIf="rowDeleteConfigs && rowDeleteConfigs.length > 0"\n class="sky-grid-row-delete-heading"\n ></th>\n <th *ngIf="enableMultiselect"\n class="sky-grid-heading sky-grid-multiselect-cell sky-grid-header-locked"\n scope="col"\n [style.max-width.px]="minColWidth"\n [style.width.px]="minColWidth"\n >\n <span class="screen-reader-only">\n {{ \'skyux_grid_multiselect_select_row\' | skyLibResources }}\n </span>\n </th>\n <th *ngFor="let column of displayedColumns; let last = last, let i = index"\n class="sky-grid-heading sky-field-label"\n scope="col"\n [attr.sky-cmp-index]="i"\n [attr.sky-cmp-id]="column.id || column.field"\n [attr.aria-sort]="getAriaSortDirection(column) | async"\n [id]="\'sky-grid-\' + gridId + \'-column-\' + i"\n [ngClass]="\'sky-grid-column-alignment-\' + column.alignment"\n [style.max-width.px]="column.width"\n [style.width.px]="column.width"\n [tabIndex]="column.isSortable ? 0 : -1"\n (mouseup)="sortByColumn(column)"\n (keydown)="onKeydown($event, column)"\n (touchmove)="onTouchMove($event)"\n #gridCol\n >\n <div\n class="overflow"\n [ngClass]="getTableHeaderClassNames(column)"\n [style.max-width.px]="column.width - 1"\n [style.width.px]="column.width - 1"\n >\n <span *ngIf="(getCaretVisibility(column.field) | async) === \'hidden\'"\n class="sky-grid-header-caret-hidden-spacing"\n ></span>\n \x3c!-- The no spacing here is intentional to avoid extra spaces due to these being inline elements --\x3e\n <span\n class="sky-grid-header-text"\n >{{column.heading?.trim()}}</span>\n <sky-icon\n class="sky-grid-heading-sort"\n [ngClass]="\'sky-grid-heading-sort-\' + (getCaretVisibility(column.field) | async)"\n [icon]="getCaretIconNames(column)"\n >\n </sky-icon>\n <sky-help-inline *ngIf="column.inlineHelpPopover"\n [ngClass]="{\n \'sky-grid-help-inline-sort-hidden\' : getHelpInlineClass(column.field) | async\n }"\n [skyPopover]="column.inlineHelpPopover"\n (keydown.enter)="$event.stopPropagation()"\n (keydown.space)="$event.stopPropagation()"\n (mousedown)="$event.stopPropagation()"\n (mouseup)="$event.stopPropagation()"\n >\n </sky-help-inline>\n </div>\n <span\n *ngIf="(fit===\'width\' && !last) || (fit===\'scroll\')"\n aria-hidden="true"\n class="sky-grid-resize-handle"\n tabindex="-1"\n [attr.sky-cmp-index]="i"\n (mousedown)="onResizeColumnStart($event)"\n (touchstart)="onResizeColumnStart($event)"\n >\n </span>\n <input\n aria-label="Width of column"\n class="sky-grid-column-input-aria-only"\n type="range"\n [attr.aria-controls]="\'sky-grid-\' + gridId + \'-column-\' + i"\n [attr.aria-valuemin]="minColWidth"\n [attr.aria-valuemax]="maxColWidth"\n [attr.aria-valuenow]="column.width"\n [attr.sky-cmp-index]="i"\n [min]="minColWidth"\n [max]="maxColWidth"\n [step]="columnResizeStep"\n [(ngModel)]="column.width"\n (blur)="onResizeHandleBlur($event)"\n (focus)="onResizeHandleFocus($event)"\n (keydown)="onKeydownResizeCol($event)"\n (change)="onInputChangeResizeCol($event)"\n #colSizeRange />\n </th>\n </tr>\n </thead>\n <tbody class="sky-grid-tbody">\n <tr\n class="sky-grid-row"\n *ngFor="let item of items; let i = index"\n [attr.aria-current]="isRowHighlighted(item.id) ? true : null"\n [attr.aria-selected]="item.isSelected"\n [attr.sky-cmp-id]="item.id"\n [ngClass]="{\n \'sky-grid-multiselect-selected-row\' : item.isSelected,\n \'sky-grid-multiselect-row\' : enableMultiselect,\n \'sky-grid-row-highlight\' : isRowHighlighted(item.id)\n }"\n (click)="onRowClick($event, item)"\n >\n <td *ngIf="rowDeleteConfigs && rowDeleteConfigs.length > 0"\n class="sky-grid-cell sky-grid-row-delete-cell"\n [ngStyle]=\'{ "height": getRowDeleteItem(item.data.id) ? getRowHeight(i) : undefined }\'\n >\n <sky-inline-delete *ngIf="getRowDeleteItem(item.data.id)"\n [pending]="getRowDeleteItem(item.data.id).pending"\n (cancelTriggered)="cancelRowDelete(item.data.id)"\n (deleteTriggered)="confirmRowDelete(item.data.id)"\n ></sky-inline-delete>\n </td>\n <td *ngIf="enableMultiselect"\n class="sky-grid-multiselect-cell sky-grid-header-locked"\n >\n <div\n [style.max-width.px]="minColWidth"\n [style.width.px]="minColWidth"\n >\n <sky-checkbox\n [label]="\'skyux_grid_multiselect_select_row\' | skyLibResources"\n (change)="onMultiselectCheckboxChange()"\n [(ngModel)]="item.isSelected"\n >\n </sky-checkbox>\n </div>\n </td>\n <td *ngFor="let column of displayedColumns; let last = last; let i = index"\n class="sky-grid-cell"\n [ngClass]="\'sky-grid-column-alignment-\' + column.alignment"\n [style.max-width.px]="column.width"\n [style.width.px]="column.width"\n >\n <sky-grid-cell\n [skyHighlight]="!column.excludeFromHighlighting ? highlightText : undefined"\n [template]="column.template || defaultCellTemplate"\n [fieldSelector]="column.field"\n [item]="item"\n [columnId]="column.id"\n [attr.sky-cmp-id]="column.id || column.field">\n </sky-grid-cell>\n </td>\n </tr>\n </tbody>\n </table>\n <div *ngIf="showResizeBar"\n aria-hidden="true"\n id="sky-grid-resize-bar"\n tabindex="-1"\n #resizeBar\n >\n </div>\n </div>\n</div>\n\n<ng-template #defaultCellTemplate let-row="row" let-value="value">{{value}}</ng-template>\n',viewProviders:[o.DragulaService],providers:[v],changeDetection:t.ChangeDetectionStrategy.OnPush,styles:['.sky-grid{position:relative;display:block}.sky-grid-table-container{overflow:auto}.sky-grid-table{position:relative;table-layout:fixed;border-collapse:collapse;margin:0;font-size:15px;min-width:100%}.sky-grid-table.sky-grid-fit{max-width:100%;width:100%}.sky-grid-tbody{background-color:#fff}.sky-grid-row{border-bottom:1px dotted #cdcfd2}.sky-grid-row:nth-child(odd){background-color:#fbfbfb}.sky-grid-row.sky-grid-row-highlight{border-top:1px solid #0974a1;box-shadow:0 0 0 3px inset #0974a1}.sky-grid-row .sky-grid-cell{padding:0;min-width:10px}.sky-grid-heading{position:relative;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:0 solid #cdcfd2;padding:0;cursor:pointer;background-color:#fff;overflow:visible;background-clip:padding-box;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;-moz-user-select:none;-ms-user-select:none;user-select:none}.sky-grid-heading:first-child{border-left:1px solid transparent}.sky-grid-heading.sky-grid-header-dragging{background-color:#eeeeef}.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-heading-sort,.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-heading-sort{width:14px}.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-help-inline-sort-hidden,.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-help-inline-sort-hidden{margin-left:-14px;margin-right:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-header-caret-hidden-spacing{padding-left:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-heading-sort-visible{width:14px}.sky-grid-heading div{padding:8px}.sky-grid-heading .overflow{text-overflow:ellipsis;white-space:nowrap;position:relative;z-index:1;overflow:hidden;min-width:100%}.sky-grid-heading .sky-grid-column-input-aria-only{-webkit-appearance:none;-moz-appearance:none;height:100%;width:5px;position:absolute;display:block;top:0;bottom:0;right:0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-track{background:0 0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-ms-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only:focus{background-color:#00b4f1}.sky-grid-column-alignment-left{text-align:left}.sky-grid-column-alignment-center{text-align:center}.sky-grid-column-alignment-right{text-align:right}.sky-grid-row-delete-heading{padding:0;width:0}.sky-grid-multiselect-cell{padding:0;text-align:center}.sky-grid-multiselect-cell ::ng-deep.sky-switch-control{margin:0 auto}th.sky-grid-multiselect-cell{cursor:default}th.sky-grid-multiselect-cell .screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:0;white-space:nowrap}@-moz-document url-prefix(){.sky-grid-multiselect-row td{border-left:0 solid transparent;border-right:0 solid transparent}}.sky-grid-multiselect-row:hover{background-color:#e9e4f1}.sky-grid-multiselect-row:hover:nth-child(odd){background:#e9e4f1}.sky-grid-multiselect-selected-row{background:#f1eef6;border-top:1px solid #dadbf6;border-bottom:1px solid #dadbf6}.sky-grid-multiselect-selected-row:nth-child(odd){background:#f1eef6}.sky-grid-has-toolbar .sky-grid-heading{border-top-width:0}.sky-grid-heading-sort.sky-grid-heading-sort-hidden{visibility:hidden}.sky-grid-heading-sort.sky-grid-heading-sort-visible{visibility:visible;padding-left:5px}.sky-grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:30px;z-index:2;min-height:20px;height:100%!important;vertical-align:middle;cursor:col-resize}.sky-grid-resize-handle:hover::after{background-color:#00b4f1}.sky-grid-resize-handle:after{position:absolute;right:0;top:0;bottom:0;width:5px;height:100%;content:""}#sky-grid-resize-bar{position:absolute;top:0;left:0;z-index:99;height:100%;width:5px;background:#00b4f1;opacity:.6}tr{position:relative}.sky-grid-row-delete-cell{padding:0;position:absolute;display:block;width:100%}.sky-grid-top-scroll-container{overflow:auto}.sky-grid-top-scroll{height:1px}']})],i)}(),S=function(){function e(){}return e.prototype.ngOnInit=function(){this.container.createEmbeddedView(this.template,this)},Object.defineProperty(e.prototype,"row",{get:function(){return this.item.data},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){if(this.item.data&&(this.fieldSelector||this.columnId))return u.getData(this.item.data,this.fieldSelector||this.columnId)},enumerable:!0,configurable:!0}),y([t.Input()],e.prototype,"item",void 0),y([t.Input()],e.prototype,"columnId",void 0),y([t.Input()],e.prototype,"template",void 0),y([t.Input()],e.prototype,"fieldSelector",void 0),y([t.ViewChild("cell",{read:t.ViewContainerRef,static:!0})],e.prototype,"container",void 0),e=y([t.Component({selector:"sky-grid-cell",template:"<ng-template #cell></ng-template>",changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;min-height:35px}"]})],e)}(),R=function(){function e(){this.resources={"EN-US":{skyux_grid_multiselect_select_row:"Select row"}}}return e.prototype.getString=function(e,t){return p.getStringForLocale(this.resources,e.locale,t)},e=y([t.Injectable()],e)}(),x=function(){function e(){}return e=y([t.NgModule({exports:[p.SkyI18nModule],providers:[{provide:p.SKY_LIB_RESOURCES_PROVIDERS,useClass:R,multi:!0}]})],e)}(),I=function(){function e(){}return e=y([t.NgModule({declarations:[b,k,S],imports:[i.CommonModule,o.DragulaModule,n.FormsModule,s.SkyCheckboxModule,x,l.SkyHelpInlineModule,l.SkyIconModule,d.SkyInlineDeleteModule,a.SkyPopoverModule,l.SkyTextHighlightModule],exports:[b,k,S],providers:[r.SkyAppWindowRef,r.SkyUIConfigService]})],e)}();e.SkyGridColumnComponent=k,e.SkyGridColumnModel=C,e.SkyGridComponent=b,e.SkyGridModule=I,e.ɵa=v,e.ɵb=S,e.ɵc=x,e.ɵd=R,Object.defineProperty(e,"__esModule",{value:!0})}));
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */var g,m;function y(e,t,i,n){var o,r=arguments.length,s=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(r<3?o(s):r>3?o(t,i,s):o(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,o,r=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return s}(g=e.SkyGridMessageType||(e.SkyGridMessageType={}))[g.SelectAll=0]="SelectAll",g[g.ClearAll=1]="ClearAll",g[g.PromptDeleteRow=2]="PromptDeleteRow",g[g.AbortDeleteRow=3]="AbortDeleteRow",(m=e.SkyGridSelectedRowsSource||(e.SkyGridSelectedRowsSource={}))[m.CheckboxChange=0]="CheckboxChange",m[m.ClearAll=1]="ClearAll",m[m.RowClick=2]="RowClick",m[m.SelectAll=3]="SelectAll",m[m.SelectedRowIdsChange=4]="SelectedRowIdsChange";var C=function(){function e(){this.alignment="left",this.isSortable=!0,this.searchFunction=this.search,this.descriptionChanges=new t.EventEmitter,this.descriptionModelChanges=new t.EventEmitter,this.headingChanges=new t.EventEmitter,this.headingModelChanges=new t.EventEmitter,this.inlineHelpPopoverModelChanges=new t.EventEmitter}return e.prototype.ngOnChanges=function(e){e.heading&&!1===e.heading.firstChange&&(this.headingChanges.emit(this.heading),this.headingModelChanges.emit({value:this.heading,id:this.id,field:this.field})),e.description&&!1===e.description.firstChange&&(this.descriptionChanges.emit(this.description),this.descriptionModelChanges.emit({value:this.description,id:this.id,field:this.field})),e.inlineHelpPopover&&!1===e.inlineHelpPopover.firstChange&&this.inlineHelpPopoverModelChanges.emit({value:this.inlineHelpPopover,id:this.id,field:this.field})},Object.defineProperty(e.prototype,"template",{get:function(){return this.templates.length>0?this.templates.first:this.templateInput},enumerable:!0,configurable:!0}),e.prototype.search=function(e,t){return null!=e&&-1!==e.toString().toLowerCase().indexOf(t)},y([t.Input()],e.prototype,"alignment",void 0),y([t.Input()],e.prototype,"description",void 0),y([t.Input()],e.prototype,"excludeFromHighlighting",void 0),y([t.Input()],e.prototype,"field",void 0),y([t.Input()],e.prototype,"heading",void 0),y([t.Input()],e.prototype,"hidden",void 0),y([t.Input()],e.prototype,"id",void 0),y([t.Input()],e.prototype,"inlineHelpPopover",void 0),y([t.Input()],e.prototype,"isSortable",void 0),y([t.Input()],e.prototype,"locked",void 0),y([t.Input("search")],e.prototype,"searchFunction",void 0),y([t.Input()],e.prototype,"type",void 0),y([t.Input("template")],e.prototype,"templateInput",void 0),y([t.Input()],e.prototype,"width",void 0),y([t.ContentChildren(t.TemplateRef)],e.prototype,"templates",void 0),e=y([t.Component({selector:"sky-grid-column",template:"<ng-content></ng-content>",changeDetection:t.ChangeDetectionStrategy.OnPush})],e)}(),k=function(e,t){this.isSortable=!0,this.template=e,t&&(this.id=t.id||t.field,this.type=t.type,this.field=t.field,this.heading=t.heading,this.inlineHelpPopover=t.inlineHelpPopover,this.width=t.width?Number(t.width):void 0,this.hidden=t.hidden,this.locked=t.locked,this.description=t.description,this.searchFunction=t.searchFunction,this.isSortable=t.isSortable,this.excludeFromHighlighting=t.excludeFromHighlighting,this.alignment=t.alignment)},w=function(){function e(e){this.rendererFactory=e,this.renderer=this.rendererFactory.createRenderer(void 0,void 0)}return e.prototype.initializeDragAndDrop=function(e,t){var i=this;e.drag.subscribe((function(e){return v(e,2)[1].classList.add("sky-grid-header-dragging")})),e.dragend.subscribe((function(e){return v(e,2)[1].classList.remove("sky-grid-header-dragging")})),e.drop.subscribe((function(e){for(var i=[],n=v(e,3)[2].querySelectorAll("th:not(.sky-grid-multiselect-cell):not(.sky-grid-row-delete-heading)"),o=0;o<n.length;o++){var r=n[o].getAttribute("sky-cmp-id");i.push(r)}t(i)})),e.setOptions("sky-grid-heading",{moves:function(e,t,n){var o=t.querySelectorAll("th div"),r=i.isLeftOfLocked(n,o);return!(e.querySelector(".sky-grid-header-locked")||void 0===n||n.matches(".sky-grid-resize-handle")||n.matches(".sky-grid-multiselect-cell")||n.matches(".sky-grid-row-delete-heading")||r)},accepts:function(e,t,n,o){if(void 0===o||!o)return!0;var r=n.querySelectorAll("th div"),s=o.querySelector("div"),l=i.isLeftOfLocked(s,r);return!o.matches(".sky-grid-header-locked")&&!o.matches(".sky-grid-resize-handle")&&!l}})},e.prototype.getRowHeight=function(e,t){return e.nativeElement.querySelectorAll("tbody tr")[t].scrollHeight+"px"},e.prototype.setStyle=function(e,t,i){e&&this.renderer.setStyle(e.nativeElement,t,i)},e.prototype.isLeftOfLocked=function(e,t){var i,n,o=e;try{for(var r=f(Array.from(t)),s=r.next();!s.done;s=r.next()){var l=s.value;l.contains(e)&&(o=l)}}catch(e){i={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}for(var d=t.length-1;d>=0;d--){if(t[d].classList.contains("sky-grid-header-locked"))return!0;if(t[d]===o)break}return!1},e.ctorParameters=function(){return[{type:t.RendererFactory2}]},e=y([t.Injectable()],e)}();Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var b=0,S=function(){function i(e,i,n,o,r,s,l){this.affixService=e,this.changeDetector=i,this.dragulaService=n,this.gridAdapter=o,this.overlayService=r,this.skyWindow=s,this.uiConfigService=l,this.enableMultiselect=!1,this.fit="width",this.hasToolbar=!1,this.messageStream=new c.Subject,this.columnWidthChange=new t.EventEmitter,this.multiselectSelectionChange=new t.EventEmitter,this.rowDeleteCancel=new t.EventEmitter,this.rowDeleteConfirm=new t.EventEmitter,this.selectedColumnIdsChange=new t.EventEmitter,this.sortFieldChange=new t.EventEmitter,this.columnResizeStep=10,this.gridId=++b,this.rowDeleteConfigs=[],this.maxColWidth=9999,this.minColWidth=50,this.showResizeBar=!1,this.showTopScroll=!1,this.isDraggingResizeHandle=!1,this.isResized=!1,this.ngUnsubscribe=new c.Subject,this.rowDeleteContents={},this.subscriptions=[],this.scrollTriggered=!1,this.selectedColumnIdsSet=!1,this.displayedColumns=new Array,this.items=new Array,this.currentSortField=new c.BehaviorSubject({fieldSelector:"",descending:!1})}return Object.defineProperty(i.prototype,"selectedColumnIds",{get:function(){return this._selectedColumnIds},set:function(e){var t=this._selectedColumnIds;this._selectedColumnIds=e,this.columns&&this.setDisplayedColumns(),t&&e&&this.arraysEqual(e,t)||this.selectedColumnIdsSet&&(this.setUserConfig({selectedColumnIds:e}),this.selectedColumnIdsChange.emit(this._selectedColumnIds),this.isResized&&this.resetTableWidth()),this.selectedColumnIdsSet=!0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedRowIds",{get:function(){return this._selectedRowIds},set:function(t){t&&(this._selectedRowIds=t,this.applySelectedRows(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.SelectedRowIdsChange))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"tableWidth",{get:function(){return this.tableElementRef.nativeElement.offsetWidth},enumerable:!0,configurable:!0}),i.prototype.ngOnInit=function(){var e=this;this.messageStream.pipe(h.takeUntil(this.ngUnsubscribe)).subscribe((function(t){e.handleIncomingMessages(t)}))},i.prototype.ngAfterContentInit=function(){var e=this;this.settingsKey?this.applyUserConfig().then((function(){e.initColumns()})):this.initColumns(),this.gridAdapter.initializeDragAndDrop(this.dragulaService,(function(t){e.onHeaderDrop(t)})),this.applySelectedRows()},i.prototype.ngAfterViewInit=function(){this.checkUserColumnWidthsForScroll()},i.prototype.ngOnChanges=function(e){var t=this;e.columns&&this.columns&&(this.selectedColumnIds&&(this.selectedColumnIds=this.selectedColumnIds.filter((function(e){return t.columns.find((function(t){return t.id===e}))}))),this.setDisplayedColumns(!0)),e.data&&this.data&&(this.transformData(),setTimeout((function(){Object.keys(t.rowDeleteContents).forEach((function(e){if(t.data.find((function(t){return t.id===e}))){var i=t.tableElementRef.nativeElement.querySelector('[sky-cmp-id="'+e+'"]');t.rowDeleteContents[e].affixer.affixTo(i,{autoFitContext:r.SkyAffixAutoFitContext.Viewport,isSticky:!0,placement:"above",verticalAlignment:"top",horizontalAlignment:"left",enableAutoFit:!1})}else t.destroyRowDelete(e)})),t.checkUserColumnWidthsForScroll()}))),e.sortField&&this.setSortHeaders()},i.prototype.ngOnDestroy=function(){var e=this;this.subscriptions.forEach((function(e){e.unsubscribe()})),this.multiselectSelectionChange.complete(),this.ngUnsubscribe.next(),this.ngUnsubscribe.complete(),Object.keys(this.rowDeleteContents).forEach((function(t){e.destroyRowDelete(t)}))},i.prototype.onWindowResize=function(){this.checkUserColumnWidthsForScroll()},i.prototype.getTopScrollWidth=function(){return this.tableElementRef.nativeElement.scrollWidth},i.prototype.getTableClassNames=function(){var e=[];return"scroll"!==this.fit&&e.push("sky-grid-fit"),this.hasToolbar&&e.push("sky-grid-has-toolbar"),this.addDelimeter(e," ")},i.prototype.getTableHeaderClassNames=function(e){var t=[];return e&&e.locked&&t.push("sky-grid-header-locked"),this.addDelimeter(t," ")},i.prototype.getCaretIconNames=function(e){var t=[];return this.getSortDirection(e.field).subscribe((function(e){"asc"===e&&t.push("caret-up"),"desc"===e&&t.push("caret-down")})),this.addDelimeter(t," ")},i.prototype.onKeydown=function(e,t){var i=e.key.toLowerCase();"enter"!==i&&" "!==i||this.sortByColumn(t)},i.prototype.sortByColumn=function(e){var t=this;!this.isDraggingResizeHandle&&e.isSortable&&this.currentSortField.pipe(h.take(1),h.map((function(i){var n={fieldSelector:e.field,descending:!0};i&&i.fieldSelector===e.field&&i.descending&&(n={fieldSelector:e.field,descending:!1}),t.sortFieldChange.emit(n),t.currentSortField.next(n)}))).subscribe()},i.prototype.getSortDirection=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e?t.descending?"desc":"asc":void 0})))},i.prototype.getAriaSortDirection=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e.field?t.descending?"descending":"ascending":e.isSortable?"none":void 0})))},i.prototype.getCaretVisibility=function(e){return this.currentSortField.pipe(h.distinctUntilChanged(),h.map((function(t){return t.fieldSelector===e?"visible":"hidden"})))},i.prototype.getHelpInlineClass=function(e){return this.getCaretVisibility(e).pipe(h.map((function(e){return"hidden"===e})))},i.prototype.onMultiselectCheckboxChange=function(){this.emitSelectedRows(e.SkyGridSelectedRowsSource.CheckboxChange)},i.prototype.updateColumnHeading=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.heading=e.value,this.changeDetector.markForCheck())},i.prototype.updateInlineHelpPopover=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.inlineHelpPopover=e.value,this.changeDetector.markForCheck())},i.prototype.updateColumnDescription=function(e){var t=this.columns.find((function(t){return void 0!==e.id&&e.id===t.id||void 0!==e.field&&e.field===t.field}));t&&(t.description=e.value,this.changeDetector.markForCheck())},i.prototype.onResizeColumnStart=function(e){var t=this;this.isResized||(this.initColumnWidths(),this.isResized=!0),this.initializeResizeColumn(e),this.isDraggingResizeHandle=!0,this.xPosStart=e.pageX,this.showResizeBar=!0,this.changeDetector.detectChanges(),this.setResizeBarPosition(e.pageX),e.preventDefault(),e.stopPropagation();var i=c.fromEvent(document,"mousemove"),n=c.fromEvent(document,"touchmove");c.merge(i,n).pipe(h.takeWhile((function(){return t.isDraggingResizeHandle}))).subscribe((function(e){t.onResizeHandleMove(e)}));var o=c.fromEvent(document,"mouseup"),r=c.fromEvent(document,"touchend");c.merge(o,r).pipe(h.takeWhile((function(){return t.isDraggingResizeHandle}))).subscribe((function(e){t.onResizeHandleRelease(e)}))},i.prototype.onKeydownResizeCol=function(e){this.isResized||(this.initColumnWidths(),this.isResized=!0),this.initializeResizeColumn(e)},i.prototype.onInputChangeResizeCol=function(e){var t=e.target,i=Number(t.value),n=i-this.startColumnWidth;this.resizeColumnByIndex(this.activeResizeColumnIndex,i,n);var o=t.getBoundingClientRect().left;this.setResizeBarPosition(o)},i.prototype.onResizeHandleMove=function(e){var t=e.pageX-this.xPosStart,i=this.startColumnWidth+t;if(i<=this.minColWidth)e.stopPropagation();else{var n=this.getMaxRangeByIndex(this.activeResizeColumnIndex);"width"===this.fit&&i>n?e.stopPropagation():this.setResizeBarPosition(e.pageX)}},i.prototype.onResizeHandleBlur=function(e){this.showResizeBar=!1},i.prototype.onResizeHandleFocus=function(e){this.showResizeBar=!0,this.changeDetector.detectChanges();var t=e.target.getBoundingClientRect().left;this.setResizeBarPosition(t)},i.prototype.onResizeHandleRelease=function(e){this.showResizeBar=!1;var t=e.pageX-this.xPosStart,i=this.startColumnWidth+t;this.resizeColumnByIndex(this.activeResizeColumnIndex,i,t),this.isDraggingResizeHandle=!1,this.activeResizeColumnIndex=void 0,e.stopPropagation(),this.changeDetector.markForCheck()},i.prototype.onRowClick=function(t,i){this.enableMultiselect&&(t.target!==t.currentTarget&&this.isInteractiveElement(t)||(i.isSelected=!i.isSelected,this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.RowClick)))},i.prototype.isRowHighlighted=function(e){return!!this.rowHighlightedId&&e===this.rowHighlightedId},i.prototype.getRowHeight=function(e){return this.gridAdapter.getRowHeight(this.tableElementRef,e)},i.prototype.cancelRowDelete=function(e){this.rowDeleteConfigs=this.rowDeleteConfigs.filter((function(t){return t.id!==e})),this.rowDeleteCancel.emit({id:e}),this.destroyRowDelete(e)},i.prototype.confirmRowDelete=function(e){this.rowDeleteConfigs.find((function(t){return t.id===e})).pending=!0,this.rowDeleteConfirm.emit({id:e})},i.prototype.getRowDeleteItem=function(e){return this.rowDeleteConfigs.find((function(t){return t.id===e}))},i.prototype.onTouchMove=function(e){e.preventDefault()},i.prototype.onTopScroll=function(e){this.tableContainerElementRef&&(this.scrollTriggered?(this.scrollTriggered=!1,this.tableContainerElementRef.nativeElement.scrollLeft=this.topScrollContainerElementRef.nativeElement.scrollLeft):this.scrollTriggered=!0)},i.prototype.onGridScroll=function(e){this.topScrollContainerElementRef&&(this.scrollTriggered?(this.scrollTriggered=!1,this.topScrollContainerElementRef.nativeElement.scrollLeft=this.tableContainerElementRef.nativeElement.scrollLeft):this.scrollTriggered=!0)},i.prototype.checkUserColumnWidthsForScroll=function(){var e=this;if(!this.showTopScroll&&this.columnElementRefs&&this.columnElementRefs.length>0){var t=0,i=this.skyWindow.nativeWindow.innerWidth;this.columnElementRefs.forEach((function(n){if(!e.showTopScroll){var o=parseFloat(window.getComputedStyle(n.nativeElement).width),r=n.nativeElement.offsetWidth,s=Math.max(o||r,e.minColWidth);(t+=s)>i&&(e.showTopScroll=!0,setTimeout((function(){e.changeDetector.markForCheck()})))}}))}},i.prototype.multiselectSelectAll=function(){for(var t=0;t<this.items.length;t++)this.items[t].isSelected=!0;this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.SelectAll)},i.prototype.multiselectClearAll=function(){for(var t=0;t<this.items.length;t++)this.items[t].isSelected=!1;this.changeDetector.markForCheck(),this.emitSelectedRows(e.SkyGridSelectedRowsSource.ClearAll)},i.prototype.handleIncomingMessages=function(t){var i=this;switch(t.type){case e.SkyGridMessageType.SelectAll:this.multiselectSelectAll();break;case e.SkyGridMessageType.ClearAll:this.multiselectClearAll();break;case e.SkyGridMessageType.PromptDeleteRow:if(t.data&&t.data.promptDeleteRow){var n=this.rowDeleteConfigs.find((function(e){return e.id===t.data.promptDeleteRow.id}));if(n)n.pending=!1;else{this.rowDeleteConfigs.push({id:t.data.promptDeleteRow.id,pending:!1});var o=this.overlayService.create({enableScroll:!0,showBackdrop:!1,closeOnNavigation:!0,enableClose:!1,enablePointerEvents:!0});o.attachTemplate(this.inlineDeleteTemplateRef,{$implicit:this.data.find((function(e){return e.id===t.data.promptDeleteRow.id}))}),o.componentRef.instance.zIndex="999",setTimeout((function(){var e=i.inlineDeleteRefs.toArray().find((function(e){return e.nativeElement.id==="row-delete-ref-"+t.data.promptDeleteRow.id})),n=i.affixService.createAffixer(e),s=i.tableElementRef.nativeElement.querySelector('[sky-cmp-id="'+t.data.promptDeleteRow.id+'"]');n.affixTo(s,{autoFitContext:r.SkyAffixAutoFitContext.Viewport,isSticky:!0,placement:"above",verticalAlignment:"top",horizontalAlignment:"left",enableAutoFit:!1}),i.rowDeleteContents[t.data.promptDeleteRow.id]={affixer:n,overlay:o}}))}}break;case e.SkyGridMessageType.AbortDeleteRow:t.data&&t.data.abortDeleteRow&&(this.rowDeleteConfigs=this.rowDeleteConfigs.filter((function(e){return e.id!==t.data.abortDeleteRow.id})),this.destroyRowDelete(t.data.abortDeleteRow.id))}this.changeDetector.markForCheck()},i.prototype.onHeaderDrop=function(e){this.selectedColumnIdsSet=!0,this.selectedColumnIds=e,this.changeDetector.markForCheck()},i.prototype.setDisplayedColumns=function(e){var t=this;void 0===e&&(e=!1),void 0!==this.selectedColumnIds?this.displayedColumns=this.selectedColumnIds.filter((function(e){return t.columns.find((function(t){return t.id===e}))})).map((function(e){return t.columns.filter((function(t){return t.id===e}))[0]})):this.displayedColumns=e?this.columns.filter((function(e){return!e.hidden})):this.columns},i.prototype.transformData=function(){this.data&&this.data.length>0&&this.data[0].id&&!this.data[0].data?this.multiselectRowId?this.items=this.getGridDataWithSelectedRows():this.items=this.data.map((function(e){return new u.ListItemModel(e.id,e)})):this.items=this.data},i.prototype.getGridDataWithSelectedRows=function(){var e=this,t=this.getSelectedRows();return this.data.map((function(i){var n;return n=i.hasOwnProperty(e.multiselectRowId)?t.indexOf(i[e.multiselectRowId])>-1:t.indexOf(i.id)>-1,new u.ListItemModel(i.id,i,n)}))},i.prototype.applySelectedRows=function(){if(this.items&&this.items.length>0&&this.selectedRowIds){for(var e=0;e<this.items.length;e++)this.items[e].isSelected=this.selectedRowIds.indexOf(this.items[e].id)>-1;this.changeDetector.markForCheck()}},i.prototype.setSortHeaders=function(){this.currentSortField.next(this.sortField||{fieldSelector:"",descending:!1})},i.prototype.getColumnsFromComponent=function(){this.columns=this.columnComponents.map((function(e){return new k(e.template,e)}))},i.prototype.updateColumns=function(){var e=this;this.getColumnsFromComponent(),this.setDisplayedColumns(!0),this.changeDetector.markForCheck(),setTimeout((function(){e.checkUserColumnWidthsForScroll()}))},i.prototype.resizeColumnByIndex=function(e,t,i){var n=this.getColumnModelByIndex(e);if(t<=this.minColWidth&&(i=i+this.minColWidth-t,t=this.minColWidth),"width"===this.fit){var o=this.getLastDisplayedColumn(),r=this.getMaxRangeByIndex(e);t>r&&(t=r,i=r-this.startColumnWidth),n.width=t,o.width=o.width-i,this.updateMaxRange()}else this.gridAdapter.setStyle(this.tableElementRef,"width",this.tableWidth+i+"px"),n.width=t;this.changeDetector.detectChanges(),this.columnWidthChange.emit(this.getColumnWidthModelChange())},i.prototype.initColumnWidths=function(){var e=this;this.showTopScroll=!0,this.columnElementRefs.forEach((function(t,i){var n=parseFloat(window.getComputedStyle(t.nativeElement).width),o=t.nativeElement.offsetWidth,r=Math.max(n||o,e.minColWidth);e.getColumnModelByIndex(i).width=r})),"scroll"===this.fit&&this.gridAdapter.setStyle(this.tableElementRef,"min-width","auto"),"width"===this.fit&&this.updateMaxRange(),this.changeDetector.detectChanges()},i.prototype.getColumnWidthModelChange=function(){var e=new Array;return this.columns.forEach((function(t){e.push({id:t.id,field:t.field,width:t.width})})),e},i.prototype.updateMaxRange=function(){var e=this,t=this.getLastDisplayedColumn().width-this.minColWidth;this.displayedColumns.forEach((function(i,n){var o=i.width+t,r=e.getRangeInputByIndex(n);r.nativeElement.max=o,r.nativeElement.setAttribute("aria-valuemax",o)}))},i.prototype.initializeResizeColumn=function(e){var t=e.target;this.activeResizeColumnIndex=t.getAttribute("sky-cmp-index");var i=this.getColumnModelByIndex(this.activeResizeColumnIndex);this.startColumnWidth=i.width},i.prototype.resetTableWidth=function(){var e=this;this.skyWindow.nativeWindow.setTimeout((function(){e.gridAdapter.setStyle(e.tableElementRef,"width","auto"),e.changeDetector.detectChanges(),e.gridAdapter.setStyle(e.tableElementRef,"width",e.tableWidth+"px"),e.changeDetector.detectChanges()}))},i.prototype.getRangeInputByIndex=function(e){return this.columnRangeInputElementRefs.find((function(t){return t.nativeElement.getAttribute("sky-cmp-index")===e.toString()}))},i.prototype.getColumnModelByIndex=function(e){return this.displayedColumns[Number(e)]},i.prototype.getMaxRangeByIndex=function(e){var t=this.columnElementRefs.find((function(t){return t.nativeElement.getAttribute("sky-cmp-index")===e})).nativeElement.querySelector(".sky-grid-column-input-aria-only");return Number(t.max)},i.prototype.getLastDisplayedColumn=function(){return this.getColumnModelByIndex(this.displayedColumns.length-1)},i.prototype.addDelimeter=function(e,t){return e.filter((function(e){return e})).join(t)},i.prototype.destroyRowDelete=function(e){var t=this.rowDeleteContents[e];t&&(t.affixer.destroy(),this.overlayService.close(t.overlay),delete this.rowDeleteContents[e])},i.prototype.emitSelectedRows=function(e){var t={selectedRowIds:this.getSelectedRows(),source:e};this.multiselectSelectionChange.emit(t)},i.prototype.getSelectedRows=function(){var e=this;return this.items.filter((function(e){return e.isSelected})).map((function(t){return t.data.hasOwnProperty(e.multiselectRowId)?t.data[e.multiselectRowId]:t.id}))},i.prototype.isInteractiveElement=function(e){return e.target.closest("\n a,\n button,\n input,\n label,\n option,\n select,\n textarea,\n details,\n dialog,\n menu,\n menuitem,\n summary")},i.prototype.setResizeBarPosition=function(e){var t=this.tableContainerElementRef.nativeElement.scrollLeft,i=e-this.tableElementRef.nativeElement.getBoundingClientRect().left-t;this.gridAdapter.setStyle(this.resizeBar,"left",i+"px")},i.prototype.applyUserConfig=function(){var e=this;return new Promise((function(t){e.uiConfigService.getConfig(e.settingsKey).pipe(h.take(1)).subscribe((function(i){if(i&&i.selectedColumnIds){var n=i.selectedColumnIds.filter((function(t){return e.columns.find((function(e){return e.id===t}))}));e.selectedColumnIds=n,e.changeDetector.markForCheck()}t()}),(function(){t()}))}))},i.prototype.setUserConfig=function(e){this.settingsKey&&this.uiConfigService.setConfig(this.settingsKey,e).pipe(h.takeUntil(this.ngUnsubscribe)).subscribe((function(){}),(function(e){console.warn("Could not save grid settings."),console.warn(e)}))},i.prototype.initColumns=function(){var e=this;0===this.columnComponents.length&&void 0===this.columns||(this.columnComponents.length>0&&this.getColumnsFromComponent(),this.transformData(),this.setDisplayedColumns(!0),this.changeDetector.markForCheck()),this.subscriptions.push(this.columnComponents.changes.subscribe((function(){return e.updateColumns()}))),this.columnComponents.forEach((function(t){e.subscriptions.push(t.headingModelChanges.subscribe((function(t){e.updateColumnHeading(t)}))),e.subscriptions.push(t.descriptionModelChanges.subscribe((function(t){e.updateColumnDescription(t)}))),e.subscriptions.push(t.inlineHelpPopoverModelChanges.subscribe((function(t){e.updateInlineHelpPopover(t)})))}))},i.prototype.arraysEqual=function(e,t){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))},i.ctorParameters=function(){return[{type:r.SkyAffixService},{type:t.ChangeDetectorRef},{type:o.DragulaService},{type:w},{type:r.SkyOverlayService},{type:r.SkyAppWindowRef},{type:r.SkyUIConfigService}]},y([t.Input()],i.prototype,"columns",void 0),y([t.Input()],i.prototype,"data",void 0),y([t.Input()],i.prototype,"enableMultiselect",void 0),y([t.Input()],i.prototype,"fit",void 0),y([t.Input()],i.prototype,"hasToolbar",void 0),y([t.Input()],i.prototype,"height",void 0),y([t.Input()],i.prototype,"highlightText",void 0),y([t.Input()],i.prototype,"messageStream",void 0),y([t.Input()],i.prototype,"multiselectRowId",void 0),y([t.Input()],i.prototype,"rowHighlightedId",void 0),y([t.Input()],i.prototype,"selectedColumnIds",null),y([t.Input()],i.prototype,"selectedRowIds",null),y([t.Input()],i.prototype,"settingsKey",void 0),y([t.Input()],i.prototype,"sortField",void 0),y([t.Input()],i.prototype,"width",void 0),y([t.Output()],i.prototype,"columnWidthChange",void 0),y([t.Output()],i.prototype,"multiselectSelectionChange",void 0),y([t.Output()],i.prototype,"rowDeleteCancel",void 0),y([t.Output()],i.prototype,"rowDeleteConfirm",void 0),y([t.Output()],i.prototype,"selectedColumnIdsChange",void 0),y([t.Output()],i.prototype,"sortFieldChange",void 0),y([t.ContentChildren(C)],i.prototype,"columnComponents",void 0),y([t.ViewChildren("gridCol")],i.prototype,"columnElementRefs",void 0),y([t.ViewChildren("colSizeRange")],i.prototype,"columnRangeInputElementRefs",void 0),y([t.ViewChildren("inlineDeleteRef")],i.prototype,"inlineDeleteRefs",void 0),y([t.ViewChild("inlineDeleteTemplateRef",{read:t.TemplateRef})],i.prototype,"inlineDeleteTemplateRef",void 0),y([t.ViewChild("gridContainer")],i.prototype,"tableContainerElementRef",void 0),y([t.ViewChild("gridTable")],i.prototype,"tableElementRef",void 0),y([t.ViewChild("topScrollContainer")],i.prototype,"topScrollContainerElementRef",void 0),y([t.ViewChild("resizeBar")],i.prototype,"resizeBar",void 0),y([t.HostListener("window:resize")],i.prototype,"onWindowResize",null),i=y([t.Component({selector:"sky-grid",template:'<div class="sky-grid">\n <div *ngIf="showTopScroll"\n class="sky-grid-top-scroll-container"\n (scroll)="onTopScroll($event)"\n #topScrollContainer\n >\n <div\n class="sky-grid-top-scroll"\n [style.width.px]="getTopScrollWidth()"\n ></div>\n </div>\n <div\n class="sky-grid-table-container"\n [style.height.px]="height"\n [style.width.px]="width"\n (scroll)="onGridScroll($event)"\n #gridContainer\n >\n <table\n class="sky-grid-table"\n [ngClass]="getTableClassNames()"\n #gridTable>\n <thead>\n <tr dragula="sky-grid-heading">\n <th *ngIf="enableMultiselect"\n class="sky-grid-heading sky-grid-multiselect-cell sky-grid-header-locked"\n scope="col"\n [style.max-width.px]="minColWidth"\n [style.width.px]="minColWidth"\n >\n <span class="screen-reader-only">\n {{ \'skyux_grid_multiselect_select_row\' | skyLibResources }}\n </span>\n </th>\n <th *ngFor="let column of displayedColumns; let last = last, let i = index"\n class="sky-grid-heading sky-field-label"\n scope="col"\n [attr.sky-cmp-index]="i"\n [attr.sky-cmp-id]="column.id || column.field"\n [attr.aria-sort]="getAriaSortDirection(column) | async"\n [id]="\'sky-grid-\' + gridId + \'-column-\' + i"\n [ngClass]="\'sky-grid-column-alignment-\' + column.alignment"\n [style.max-width.px]="column.width"\n [style.width.px]="column.width"\n [tabIndex]="column.isSortable ? 0 : -1"\n (mouseup)="sortByColumn(column)"\n (keydown)="onKeydown($event, column)"\n (touchmove)="onTouchMove($event)"\n #gridCol\n >\n <div\n class="overflow"\n [ngClass]="getTableHeaderClassNames(column)"\n [style.max-width.px]="column.width - 1"\n [style.width.px]="column.width - 1"\n >\n <span *ngIf="(getCaretVisibility(column.field) | async) === \'hidden\'"\n class="sky-grid-header-caret-hidden-spacing"\n ></span>\n \x3c!-- The no spacing here is intentional to avoid extra spaces due to these being inline elements --\x3e\n <span\n class="sky-grid-header-text"\n >{{column.heading?.trim()}}</span>\n <sky-icon\n class="sky-grid-heading-sort"\n [ngClass]="\'sky-grid-heading-sort-\' + (getCaretVisibility(column.field) | async)"\n [icon]="getCaretIconNames(column)"\n >\n </sky-icon>\n <sky-help-inline *ngIf="column.inlineHelpPopover"\n [ngClass]="{\n \'sky-grid-help-inline-sort-hidden\' : getHelpInlineClass(column.field) | async\n }"\n [skyPopover]="column.inlineHelpPopover"\n (keydown.enter)="$event.stopPropagation()"\n (keydown.space)="$event.stopPropagation()"\n (mousedown)="$event.stopPropagation()"\n (mouseup)="$event.stopPropagation()"\n >\n </sky-help-inline>\n </div>\n <span\n *ngIf="(fit===\'width\' && !last) || (fit===\'scroll\')"\n aria-hidden="true"\n class="sky-grid-resize-handle"\n tabindex="-1"\n [attr.sky-cmp-index]="i"\n (mousedown)="onResizeColumnStart($event)"\n (touchstart)="onResizeColumnStart($event)"\n >\n </span>\n <input\n aria-label="Width of column"\n class="sky-grid-column-input-aria-only"\n role="slider"\n type="range"\n [attr.aria-controls]="\'sky-grid-\' + gridId + \'-column-\' + i"\n [attr.aria-valuemin]="minColWidth"\n [attr.aria-valuemax]="maxColWidth"\n [attr.aria-valuenow]="column.width"\n [attr.sky-cmp-index]="i"\n [min]="minColWidth"\n [max]="maxColWidth"\n [step]="columnResizeStep"\n [(ngModel)]="column.width"\n (blur)="onResizeHandleBlur($event)"\n (focus)="onResizeHandleFocus($event)"\n (keydown)="onKeydownResizeCol($event)"\n (change)="onInputChangeResizeCol($event)"\n #colSizeRange />\n </th>\n </tr>\n </thead>\n <tbody class="sky-grid-tbody">\n <tr\n class="sky-grid-row"\n *ngFor="let item of items; let i = index"\n [attr.aria-current]="isRowHighlighted(item.id) ? true : null"\n [attr.aria-selected]="item.isSelected"\n [attr.sky-cmp-id]="item.id"\n [ngClass]="{\n \'sky-grid-multiselect-selected-row\' : item.isSelected,\n \'sky-grid-multiselect-row\' : enableMultiselect,\n \'sky-grid-row-highlight\' : isRowHighlighted(item.id)\n }"\n (click)="onRowClick($event, item)"\n >\n <td *ngIf="enableMultiselect"\n class="sky-grid-multiselect-cell sky-grid-header-locked"\n >\n <div\n [style.max-width.px]="minColWidth"\n [style.width.px]="minColWidth"\n >\n <sky-checkbox\n [label]="\'skyux_grid_multiselect_select_row\' | skyLibResources"\n (change)="onMultiselectCheckboxChange()"\n [(ngModel)]="item.isSelected"\n >\n </sky-checkbox>\n </div>\n </td>\n <td *ngFor="let column of displayedColumns; let last = last; let i = index"\n class="sky-grid-cell"\n [ngClass]="\'sky-grid-column-alignment-\' + column.alignment"\n [style.max-width.px]="column.width"\n [style.width.px]="column.width"\n >\n <sky-grid-cell\n [skyHighlight]="!column.excludeFromHighlighting ? highlightText : undefined"\n [template]="column.template || defaultCellTemplate"\n [fieldSelector]="column.field"\n [item]="item"\n [columnId]="column.id"\n [attr.sky-cmp-id]="column.id || column.field">\n </sky-grid-cell>\n </td>\n </tr>\n </tbody>\n </table>\n <div *ngIf="showResizeBar"\n aria-hidden="true"\n id="sky-grid-resize-bar"\n tabindex="-1"\n #resizeBar\n >\n </div>\n </div>\n</div>\n\n<ng-template #defaultCellTemplate let-row="row" let-value="value">{{value}}</ng-template>\n\n<ng-template\n let-item\n #inlineDeleteTemplateRef\n>\n <div\n [id]="\'row-delete-ref-\' + item.id"\n [ngStyle]=\'{\n "height": getRowHeight(0),\n "position": "fixed",\n "width": tableWidth + "px"\n }\'\n #inlineDeleteRef\n >\n <sky-inline-delete\n [pending]="getRowDeleteItem(item.id).pending"\n (cancelTriggered)="cancelRowDelete(item.id)"\n (deleteTriggered)="confirmRowDelete(item.id)"\n ></sky-inline-delete>\n </div>\n</ng-template>\n',viewProviders:[o.DragulaService],providers:[w],changeDetection:t.ChangeDetectionStrategy.OnPush,styles:['.sky-grid{position:relative;display:block}.sky-grid-table-container{overflow:auto}.sky-grid-table{position:relative;table-layout:fixed;border-collapse:collapse;margin:0;font-size:15px;min-width:100%}.sky-grid-table.sky-grid-fit{max-width:100%;width:100%}.sky-grid-tbody{background-color:#fff}.sky-grid-row{border-bottom:1px dotted #cdcfd2}.sky-grid-row:nth-child(odd){background-color:#fbfbfb}.sky-grid-row.sky-grid-row-highlight{border-top:1px solid #0974a1;box-shadow:0 0 0 3px inset #0974a1}.sky-grid-row .sky-grid-cell{padding:0;min-width:10px}.sky-grid-heading{position:relative;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:0 solid #cdcfd2;padding:0;cursor:pointer;background-color:#fff;overflow:visible;background-clip:padding-box;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;-moz-user-select:none;-ms-user-select:none;user-select:none}.sky-grid-heading:first-child{border-left:1px solid transparent}.sky-grid-heading.sky-grid-header-dragging{background-color:#eeeeef}.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-heading-sort,.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-heading-sort{width:14px}.sky-grid-heading.sky-grid-column-alignment-center .sky-grid-help-inline-sort-hidden,.sky-grid-heading.sky-grid-column-alignment-left .sky-grid-help-inline-sort-hidden{margin-left:-14px;margin-right:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-header-caret-hidden-spacing{padding-left:14px}.sky-grid-heading.sky-grid-column-alignment-right .sky-grid-heading-sort-visible{width:14px}.sky-grid-heading div{padding:8px}.sky-grid-heading .overflow{text-overflow:ellipsis;white-space:nowrap;position:relative;z-index:1;overflow:hidden;min-width:100%}.sky-grid-heading .sky-grid-column-input-aria-only{-webkit-appearance:none;-moz-appearance:none;height:100%;width:5px;position:absolute;display:block;top:0;bottom:0;right:0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-track{background:0 0}.sky-grid-heading .sky-grid-column-input-aria-only::-moz-range-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-ms-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;width:0;height:0;border-radius:0;border:0;background:0 0;display:none}.sky-grid-heading .sky-grid-column-input-aria-only:focus{background-color:#00b4f1}.sky-grid-column-alignment-left{text-align:left}.sky-grid-column-alignment-center{text-align:center}.sky-grid-column-alignment-right{text-align:right}.sky-grid-multiselect-cell{padding:0;text-align:center}.sky-grid-multiselect-cell ::ng-deep.sky-switch-control{margin:0 auto}th.sky-grid-multiselect-cell{cursor:default}th.sky-grid-multiselect-cell .screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:0;white-space:nowrap}@-moz-document url-prefix(){.sky-grid-multiselect-row td{border-left:0 solid transparent;border-right:0 solid transparent}}.sky-grid-multiselect-row:hover{background-color:#e9e4f1}.sky-grid-multiselect-row:hover:nth-child(odd){background:#e9e4f1}.sky-grid-multiselect-selected-row{background:#f1eef6;border-top:1px solid #dadbf6;border-bottom:1px solid #dadbf6}.sky-grid-multiselect-selected-row:nth-child(odd){background:#f1eef6}.sky-grid-has-toolbar .sky-grid-heading{border-top-width:0}.sky-grid-heading-sort.sky-grid-heading-sort-hidden{visibility:hidden}.sky-grid-heading-sort.sky-grid-heading-sort-visible{visibility:visible;padding-left:5px}.sky-grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:30px;z-index:2;min-height:20px;height:100%!important;vertical-align:middle;cursor:col-resize}.sky-grid-resize-handle:hover::after{background-color:#00b4f1}.sky-grid-resize-handle:after{position:absolute;right:0;top:0;bottom:0;width:5px;height:100%;content:""}#sky-grid-resize-bar{position:absolute;top:0;left:0;z-index:99;height:100%;width:5px;background:#00b4f1;opacity:.6}tr{position:relative}.sky-grid-top-scroll-container{overflow:auto}.sky-grid-top-scroll{height:1px}']})],i)}(),R=function(){function e(){}return e.prototype.ngOnInit=function(){this.container.createEmbeddedView(this.template,this)},Object.defineProperty(e.prototype,"row",{get:function(){return this.item.data},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){if(this.item.data&&(this.fieldSelector||this.columnId))return u.getData(this.item.data,this.fieldSelector||this.columnId)},enumerable:!0,configurable:!0}),y([t.Input()],e.prototype,"item",void 0),y([t.Input()],e.prototype,"columnId",void 0),y([t.Input()],e.prototype,"template",void 0),y([t.Input()],e.prototype,"fieldSelector",void 0),y([t.ViewChild("cell",{read:t.ViewContainerRef,static:!0})],e.prototype,"container",void 0),e=y([t.Component({selector:"sky-grid-cell",template:"<ng-template #cell></ng-template>",changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[":host{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;min-height:35px}"]})],e)}(),x=function(){function e(){this.resources={"EN-US":{skyux_grid_multiselect_select_row:"Select row"}}}return e.prototype.getString=function(e,t){return p.getStringForLocale(this.resources,e.locale,t)},e=y([t.Injectable()],e)}(),I=function(){function e(){}return e=y([t.NgModule({exports:[p.SkyI18nModule],providers:[{provide:p.SKY_LIB_RESOURCES_PROVIDERS,useClass:x,multi:!0}]})],e)}(),D=function(){function e(){}return e=y([t.NgModule({declarations:[S,C,R],imports:[i.CommonModule,o.DragulaModule,n.FormsModule,r.SkyAffixModule,s.SkyCheckboxModule,I,l.SkyHelpInlineModule,l.SkyIconModule,d.SkyInlineDeleteModule,r.SkyOverlayModule,a.SkyPopoverModule,l.SkyTextHighlightModule],exports:[S,C,R],providers:[r.SkyAppWindowRef,r.SkyUIConfigService]})],e)}();e.SkyGridColumnComponent=C,e.SkyGridColumnModel=k,e.SkyGridComponent=S,e.SkyGridModule=D,e.ɵa=w,e.ɵb=R,e.ɵc=I,e.ɵd=x,Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=skyux-grids.umd.min.js.map