@skyux/list-builder-view-grids 5.7.2 → 6.0.0-beta.2

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 (101) hide show
  1. package/documentation.json +2 -2
  2. package/esm2020/index.mjs +21 -0
  3. package/esm2020/lib/modules/column-selector/column-selector-context.mjs +9 -0
  4. package/esm2020/lib/modules/column-selector/column-selector-modal.component.mjs +38 -0
  5. package/esm2020/lib/modules/column-selector/column-selector-modal.module.mjs +40 -0
  6. package/esm2020/lib/modules/list-column-selector-action/list-column-selector-action.component.mjs +133 -0
  7. package/esm2020/lib/modules/list-column-selector-action/list-column-selector-action.module.mjs +47 -0
  8. package/esm2020/lib/modules/list-column-selector-action/list-column-selector-button.component.mjs +13 -0
  9. package/esm2020/lib/modules/list-view-grid/list-view-grid.component.mjs +460 -0
  10. package/esm2020/lib/modules/list-view-grid/list-view-grid.module.mjs +42 -0
  11. package/esm2020/lib/modules/list-view-grid/state/columns/columns.orchestrator.mjs +22 -0
  12. package/esm2020/lib/modules/list-view-grid/state/columns/load.action.mjs +10 -0
  13. package/esm2020/lib/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.mjs +22 -0
  14. package/esm2020/lib/modules/list-view-grid/state/displayed-columns/load.action.mjs +10 -0
  15. package/esm2020/lib/modules/list-view-grid/state/grid-state-action.type.mjs +2 -0
  16. package/esm2020/lib/modules/list-view-grid/state/grid-state.model.mjs +11 -0
  17. package/esm2020/lib/modules/list-view-grid/state/grid-state.rxstate.mjs +19 -0
  18. package/esm2020/lib/modules/list-view-grid/state/grid-state.state-node.mjs +27 -0
  19. package/esm2020/lib/modules/list-view-grid/types/list-view-grid-message-type.mjs +15 -0
  20. package/esm2020/lib/modules/list-view-grid/types/list-view-grid-message.mjs +2 -0
  21. package/esm2020/lib/modules/list-view-grid/types/list-view-grid-row-delete-cancel-args.mjs +2 -0
  22. package/esm2020/lib/modules/list-view-grid/types/list-view-grid-row-delete-confirm-args.mjs +2 -0
  23. package/esm2020/lib/modules/shared/sky-list-builder-view-grids-resources.module.mjs +56 -0
  24. package/esm2020/skyux-list-builder-view-grids.mjs +5 -0
  25. package/esm2020/testing/list-view-grid-fixture-cell.mjs +2 -0
  26. package/esm2020/testing/list-view-grid-fixture-header.mjs +2 -0
  27. package/esm2020/testing/list-view-grid-fixture-row.mjs +2 -0
  28. package/esm2020/testing/list-view-grid-fixture.mjs +66 -0
  29. package/esm2020/testing/public-api.mjs +5 -0
  30. package/esm2020/testing/skyux-list-builder-view-grids-testing.mjs +5 -0
  31. package/fesm2015/{skyux-list-builder-view-grids-testing.js → skyux-list-builder-view-grids-testing.mjs} +1 -1
  32. package/fesm2015/skyux-list-builder-view-grids-testing.mjs.map +1 -0
  33. package/fesm2015/skyux-list-builder-view-grids.mjs +905 -0
  34. package/fesm2015/skyux-list-builder-view-grids.mjs.map +1 -0
  35. package/{esm2015/testing/list-view-grid-fixture.js → fesm2020/skyux-list-builder-view-grids-testing.mjs} +9 -2
  36. package/fesm2020/skyux-list-builder-view-grids-testing.mjs.map +1 -0
  37. package/{fesm2015/skyux-list-builder-view-grids.js → fesm2020/skyux-list-builder-view-grids.mjs} +40 -57
  38. package/fesm2020/skyux-list-builder-view-grids.mjs.map +1 -0
  39. package/package.json +42 -18
  40. package/testing/package.json +5 -5
  41. package/bundles/skyux-list-builder-view-grids-testing.umd.js +0 -81
  42. package/bundles/skyux-list-builder-view-grids.umd.js +0 -1359
  43. package/esm2015/index.js +0 -21
  44. package/esm2015/index.js.map +0 -1
  45. package/esm2015/lib/modules/column-selector/column-selector-context.js +0 -9
  46. package/esm2015/lib/modules/column-selector/column-selector-context.js.map +0 -1
  47. package/esm2015/lib/modules/column-selector/column-selector-modal.component.js +0 -41
  48. package/esm2015/lib/modules/column-selector/column-selector-modal.component.js.map +0 -1
  49. package/esm2015/lib/modules/column-selector/column-selector-modal.module.js +0 -41
  50. package/esm2015/lib/modules/column-selector/column-selector-modal.module.js.map +0 -1
  51. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-action.component.js +0 -136
  52. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-action.component.js.map +0 -1
  53. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-action.module.js +0 -47
  54. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-action.module.js.map +0 -1
  55. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-button.component.js +0 -17
  56. package/esm2015/lib/modules/list-column-selector-action/list-column-selector-button.component.js.map +0 -1
  57. package/esm2015/lib/modules/list-view-grid/list-view-grid.component.js +0 -466
  58. package/esm2015/lib/modules/list-view-grid/list-view-grid.component.js.map +0 -1
  59. package/esm2015/lib/modules/list-view-grid/list-view-grid.module.js +0 -42
  60. package/esm2015/lib/modules/list-view-grid/list-view-grid.module.js.map +0 -1
  61. package/esm2015/lib/modules/list-view-grid/state/columns/columns.orchestrator.js +0 -22
  62. package/esm2015/lib/modules/list-view-grid/state/columns/columns.orchestrator.js.map +0 -1
  63. package/esm2015/lib/modules/list-view-grid/state/columns/load.action.js +0 -10
  64. package/esm2015/lib/modules/list-view-grid/state/columns/load.action.js.map +0 -1
  65. package/esm2015/lib/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.js +0 -22
  66. package/esm2015/lib/modules/list-view-grid/state/displayed-columns/displayed-columns.orchestrator.js.map +0 -1
  67. package/esm2015/lib/modules/list-view-grid/state/displayed-columns/load.action.js +0 -10
  68. package/esm2015/lib/modules/list-view-grid/state/displayed-columns/load.action.js.map +0 -1
  69. package/esm2015/lib/modules/list-view-grid/state/grid-state-action.type.js +0 -2
  70. package/esm2015/lib/modules/list-view-grid/state/grid-state-action.type.js.map +0 -1
  71. package/esm2015/lib/modules/list-view-grid/state/grid-state.model.js +0 -11
  72. package/esm2015/lib/modules/list-view-grid/state/grid-state.model.js.map +0 -1
  73. package/esm2015/lib/modules/list-view-grid/state/grid-state.rxstate.js +0 -19
  74. package/esm2015/lib/modules/list-view-grid/state/grid-state.rxstate.js.map +0 -1
  75. package/esm2015/lib/modules/list-view-grid/state/grid-state.state-node.js +0 -27
  76. package/esm2015/lib/modules/list-view-grid/state/grid-state.state-node.js.map +0 -1
  77. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-message-type.js +0 -15
  78. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-message-type.js.map +0 -1
  79. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-message.js +0 -2
  80. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-message.js.map +0 -1
  81. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-row-delete-cancel-args.js +0 -2
  82. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-row-delete-cancel-args.js.map +0 -1
  83. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-row-delete-confirm-args.js +0 -2
  84. package/esm2015/lib/modules/list-view-grid/types/list-view-grid-row-delete-confirm-args.js.map +0 -1
  85. package/esm2015/lib/modules/shared/sky-list-builder-view-grids-resources.module.js +0 -56
  86. package/esm2015/lib/modules/shared/sky-list-builder-view-grids-resources.module.js.map +0 -1
  87. package/esm2015/skyux-list-builder-view-grids.js +0 -5
  88. package/esm2015/skyux-list-builder-view-grids.js.map +0 -1
  89. package/esm2015/testing/list-view-grid-fixture-cell.js +0 -2
  90. package/esm2015/testing/list-view-grid-fixture-cell.js.map +0 -1
  91. package/esm2015/testing/list-view-grid-fixture-header.js +0 -2
  92. package/esm2015/testing/list-view-grid-fixture-header.js.map +0 -1
  93. package/esm2015/testing/list-view-grid-fixture-row.js +0 -2
  94. package/esm2015/testing/list-view-grid-fixture-row.js.map +0 -1
  95. package/esm2015/testing/list-view-grid-fixture.js.map +0 -1
  96. package/esm2015/testing/public-api.js +0 -5
  97. package/esm2015/testing/public-api.js.map +0 -1
  98. package/esm2015/testing/skyux-list-builder-view-grids-testing.js +0 -5
  99. package/esm2015/testing/skyux-list-builder-view-grids-testing.js.map +0 -1
  100. package/fesm2015/skyux-list-builder-view-grids-testing.js.map +0 -1
  101. package/fesm2015/skyux-list-builder-view-grids.js.map +0 -1
@@ -0,0 +1,905 @@
1
+ import * as i4$1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { Component, NgModule, EventEmitter, Optional, Input, Output, ViewChild, Injectable, forwardRef, ChangeDetectionStrategy, ContentChildren } from '@angular/core';
5
+ import * as i5 from '@skyux/i18n';
6
+ import { SkyI18nModule, getLibStringForLocale, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
7
+ import * as i1 from '@skyux/list-builder';
8
+ import { SkyListModule, SkyListToolbarModule, ListToolbarItemModel, SkyListSecondaryActionsModule, ListViewComponent, ListSearchModel } from '@skyux/list-builder';
9
+ import * as i4 from '@skyux/list-builder-view-checklist';
10
+ import { SkyListViewChecklistModule } from '@skyux/list-builder-view-checklist';
11
+ import * as i2 from '@skyux/modals';
12
+ import { SkyModalModule } from '@skyux/modals';
13
+ import * as i1$1 from '@skyux/indicators';
14
+ import { SkyIconModule, SkyWaitModule } from '@skyux/indicators';
15
+ import { map, distinctUntilChanged, take, takeUntil, scan } from 'rxjs/operators';
16
+ import * as i4$2 from '@skyux/grids';
17
+ import { SkyGridColumnModel, SkyGridSelectedRowsSource, SkyGridMessageType, SkyGridColumnComponent, SkyGridComponent, SkyGridModule } from '@skyux/grids';
18
+ import { AsyncList, StateDispatcher, StateOrchestrator, StateNode, isObservable, getValue, getData } from '@skyux/list-builder-common';
19
+ import { Subject, of } from 'rxjs';
20
+
21
+ /* istanbul ignore next */
22
+ /* Code coverage having problems with no statements in classes */
23
+ class SkyColumnSelectorContext {
24
+ }
25
+ /* istanbul ignore next */
26
+ /* Code coverage having problems with no statements in classes */
27
+ class SkyColumnSelectorModel {
28
+ }
29
+
30
+ class SkyColumnSelectorComponent {
31
+ constructor(context, instance) {
32
+ this.context = context;
33
+ this.instance = instance;
34
+ this.newSelectedColumnIds = [];
35
+ this.newSelectedColumnIds = context.selectedColumnIds;
36
+ }
37
+ selectedColumnsChange(selectedMap) {
38
+ this.newSelectedColumnIds = [];
39
+ selectedMap.forEach((value, key) => {
40
+ if (value) {
41
+ this.newSelectedColumnIds.push(key);
42
+ }
43
+ });
44
+ }
45
+ cancelChanges() {
46
+ this.instance.cancel();
47
+ }
48
+ applyChanges() {
49
+ this.instance.save(this.newSelectedColumnIds);
50
+ }
51
+ }
52
+ SkyColumnSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorComponent, deps: [{ token: SkyColumnSelectorContext }, { token: i2.SkyModalInstance }], target: i0.ɵɵFactoryTarget.Component });
53
+ SkyColumnSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyColumnSelectorComponent, selector: "sky-column-selector", ngImport: i0, template: "<sky-modal>\n <sky-modal-header>\n {{ 'skyux_grid_column_picker_header' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-list\n #list\n [data]=\"context.columns\"\n [selectedIds]=\"context.selectedColumnIds\"\n (selectedIdsChange)=\"selectedColumnsChange($event)\"\n >\n <sky-list-toolbar\n [placeholder]=\"\n 'skyux_grid_column_picker_search_placeholder' | skyLibResources\n \"\n >\n </sky-list-toolbar>\n\n <sky-list-view-checklist label=\"heading\" description=\"description\">\n </sky-list-view-checklist>\n </sky-list>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n sky-cmp-id=\"apply-changes\"\n class=\"sky-btn sky-btn-primary\"\n (click)=\"applyChanges()\"\n >\n {{ 'skyux_grid_column_picker_submit' | skyLibResources }}\n </button>\n <button\n sky-cmp-id=\"cancel\"\n class=\"sky-btn sky-btn-link\"\n (click)=\"cancelChanges()\"\n >\n {{ 'skyux_grid_column_picker_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n", components: [{ type: i2.λ5, selector: "sky-modal", inputs: ["ariaRole", "tiledBody"] }, { type: i2.λ4, selector: "sky-modal-header" }, { type: i2.λ2, selector: "sky-modal-content" }, { type: i1.SkyListComponent, selector: "sky-list", inputs: ["data", "dataProvider", "defaultView", "initialTotal", "selectedIds", "sortFields", "appliedFilters", "search"], outputs: ["selectedIdsChange", "appliedFiltersChange"] }, { type: i1.SkyListToolbarComponent, selector: "sky-list-toolbar", inputs: ["inMemorySearchEnabled", "placeholder", "searchEnabled", "sortSelectorEnabled", "toolbarType", "searchText"] }, { type: i4.SkyListViewChecklistComponent, selector: "sky-list-view-checklist", inputs: ["name", "search", "label", "description", "selectMode", "showOnlySelected"] }, { type: i2.λ3, selector: "sky-modal-footer" }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe } });
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorComponent, decorators: [{
55
+ type: Component,
56
+ args: [{ selector: 'sky-column-selector', template: "<sky-modal>\n <sky-modal-header>\n {{ 'skyux_grid_column_picker_header' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-list\n #list\n [data]=\"context.columns\"\n [selectedIds]=\"context.selectedColumnIds\"\n (selectedIdsChange)=\"selectedColumnsChange($event)\"\n >\n <sky-list-toolbar\n [placeholder]=\"\n 'skyux_grid_column_picker_search_placeholder' | skyLibResources\n \"\n >\n </sky-list-toolbar>\n\n <sky-list-view-checklist label=\"heading\" description=\"description\">\n </sky-list-view-checklist>\n </sky-list>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n sky-cmp-id=\"apply-changes\"\n class=\"sky-btn sky-btn-primary\"\n (click)=\"applyChanges()\"\n >\n {{ 'skyux_grid_column_picker_submit' | skyLibResources }}\n </button>\n <button\n sky-cmp-id=\"cancel\"\n class=\"sky-btn sky-btn-link\"\n (click)=\"cancelChanges()\"\n >\n {{ 'skyux_grid_column_picker_cancel' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n" }]
57
+ }], ctorParameters: function () { return [{ type: SkyColumnSelectorContext }, { type: i2.SkyModalInstance }]; } });
58
+
59
+ class SkyColumnSelectorModule {
60
+ }
61
+ SkyColumnSelectorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
62
+ SkyColumnSelectorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorModule, declarations: [SkyColumnSelectorComponent], imports: [CommonModule,
63
+ SkyI18nModule,
64
+ SkyModalModule,
65
+ SkyListModule,
66
+ SkyListToolbarModule,
67
+ SkyListViewChecklistModule] });
68
+ SkyColumnSelectorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorModule, imports: [[
69
+ CommonModule,
70
+ SkyI18nModule,
71
+ SkyModalModule,
72
+ SkyListModule,
73
+ SkyListToolbarModule,
74
+ SkyListViewChecklistModule,
75
+ ]] });
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyColumnSelectorModule, decorators: [{
77
+ type: NgModule,
78
+ args: [{
79
+ declarations: [SkyColumnSelectorComponent],
80
+ imports: [
81
+ CommonModule,
82
+ SkyI18nModule,
83
+ SkyModalModule,
84
+ SkyListModule,
85
+ SkyListToolbarModule,
86
+ SkyListViewChecklistModule,
87
+ ],
88
+ }]
89
+ }] });
90
+
91
+ /**
92
+ * @internal
93
+ */
94
+ class ListViewDisplayedGridColumnsLoadAction {
95
+ constructor(columns, refresh = false) {
96
+ this.columns = columns;
97
+ this.refresh = refresh;
98
+ }
99
+ }
100
+
101
+ class SkyListColumnSelectorButtonComponent {
102
+ }
103
+ SkyListColumnSelectorButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
104
+ SkyListColumnSelectorButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyListColumnSelectorButtonComponent, selector: "sky-list-column-selector-button", ngImport: i0, template: "<button\n class=\"sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_grid_columns_button' | skyLibResources\"\n [title]=\"'skyux_grid_columns_button' | skyLibResources\"\n>\n <sky-icon icon=\"columns\"></sky-icon>\n <span class=\"sky-column-selector-action-btn-text\">\n {{ 'skyux_grid_columns_toolbar_button' | skyLibResources }}\n </span>\n</button>\n", styles: [":host .sky-column-selector-action-btn-text{display:none}:host-context(.sky-responsive-container-xs) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-sm) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-md) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-lg) .sky-column-selector-action-btn-text{display:none}@media (min-width: 768px){:host .sky-column-selector-action-btn-text{display:inline}}:host-context(.sky-responsive-container-sm) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-md) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-lg) .sky-column-selector-action-btn-text{display:inline}\n"], components: [{ type: i1$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe } });
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorButtonComponent, decorators: [{
106
+ type: Component,
107
+ args: [{ selector: 'sky-list-column-selector-button', template: "<button\n class=\"sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_grid_columns_button' | skyLibResources\"\n [title]=\"'skyux_grid_columns_button' | skyLibResources\"\n>\n <sky-icon icon=\"columns\"></sky-icon>\n <span class=\"sky-column-selector-action-btn-text\">\n {{ 'skyux_grid_columns_toolbar_button' | skyLibResources }}\n </span>\n</button>\n", styles: [":host .sky-column-selector-action-btn-text{display:none}:host-context(.sky-responsive-container-xs) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-sm) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-md) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-lg) .sky-column-selector-action-btn-text{display:none}@media (min-width: 768px){:host .sky-column-selector-action-btn-text{display:inline}}:host-context(.sky-responsive-container-sm) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-md) .sky-column-selector-action-btn-text,:host-context(.sky-responsive-container-lg) .sky-column-selector-action-btn-text{display:inline}\n"] }]
108
+ }] });
109
+
110
+ /**
111
+ * Provides a column selector modal for a list grid view when placed in a
112
+ * [list toolbar](https://developer.blackbaud.com/skyux/components/list/toolbar).
113
+ */
114
+ class SkyListColumnSelectorActionComponent {
115
+ constructor(listState, modalService, dispatcher, secondaryActions) {
116
+ this.listState = listState;
117
+ this.modalService = modalService;
118
+ this.dispatcher = dispatcher;
119
+ this.secondaryActions = secondaryActions;
120
+ /**
121
+ * Fires when users click the help button and broadcasts the `helpKey`.
122
+ */
123
+ this.helpOpened = new EventEmitter();
124
+ this.columnSelectorActionItemToolbarIndex = 7000;
125
+ }
126
+ ngAfterContentInit() {
127
+ if (!this.secondaryActions) {
128
+ const columnChooserItem = new ListToolbarItemModel({
129
+ id: 'column-chooser',
130
+ template: this.columnChooserTemplate,
131
+ location: 'left',
132
+ });
133
+ this.dispatcher.toolbarAddItems([columnChooserItem], this.columnSelectorActionItemToolbarIndex);
134
+ }
135
+ }
136
+ get isInGridView() {
137
+ return this.listState.pipe(map((s) => s.views.active), map((activeView) => {
138
+ return this.gridView && activeView === this.gridView.id;
139
+ }), distinctUntilChanged());
140
+ }
141
+ get isInGridViewAndSecondary() {
142
+ return this.listState.pipe(map((s) => s.views.active), map((activeView) => {
143
+ return (this.secondaryActions &&
144
+ this.gridView &&
145
+ activeView === this.gridView.id);
146
+ }), distinctUntilChanged());
147
+ }
148
+ openColumnSelector() {
149
+ /* istanbul ignore else */
150
+ /* sanity check */
151
+ if (this.gridView) {
152
+ let columns = [];
153
+ let selectedColumnIds = [];
154
+ this.gridView.gridState
155
+ .pipe(take(1))
156
+ .subscribe((state) => {
157
+ columns = state.columns.items
158
+ .filter((item) => {
159
+ return !item.locked;
160
+ })
161
+ .map((item) => {
162
+ return {
163
+ id: item.id,
164
+ heading: item.heading,
165
+ description: item.description,
166
+ };
167
+ });
168
+ selectedColumnIds = state.displayedColumns.items
169
+ .filter((item) => {
170
+ return !item.locked;
171
+ })
172
+ .map((item) => {
173
+ return item.id;
174
+ });
175
+ });
176
+ const modalInstance = this.modalService.open(SkyColumnSelectorComponent, {
177
+ providers: [
178
+ {
179
+ provide: SkyColumnSelectorContext,
180
+ useValue: {
181
+ columns,
182
+ selectedColumnIds,
183
+ },
184
+ },
185
+ ],
186
+ helpKey: this.helpKey,
187
+ });
188
+ modalInstance.helpOpened.subscribe((helpKey) => {
189
+ this.helpOpened.emit(helpKey);
190
+ this.helpOpened.complete();
191
+ });
192
+ modalInstance.closed.subscribe((result) => {
193
+ if (result.reason === 'save' && result.data) {
194
+ const newSelectedIds = result.data;
195
+ let newDisplayedColumns = [];
196
+ this.gridView.gridState
197
+ .pipe(take(1))
198
+ .subscribe((state) => {
199
+ newDisplayedColumns = state.columns.items.filter((item) => {
200
+ return newSelectedIds.indexOf(item.id) > -1 || item.locked;
201
+ });
202
+ });
203
+ this.gridView.gridDispatcher.next(new ListViewDisplayedGridColumnsLoadAction(newDisplayedColumns, true));
204
+ }
205
+ });
206
+ }
207
+ }
208
+ }
209
+ SkyListColumnSelectorActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionComponent, deps: [{ token: i1.ListState }, { token: i2.SkyModalService }, { token: i1.ListStateDispatcher }, { token: i1.SkyListSecondaryActionsComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component });
210
+ SkyListColumnSelectorActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyListColumnSelectorActionComponent, selector: "sky-list-column-selector-action", inputs: { gridView: "gridView", helpKey: "helpKey" }, outputs: { helpOpened: "helpOpened" }, viewQueries: [{ propertyName: "columnChooserTemplate", first: true, predicate: ["columnChooser"], descendants: true, static: true }], ngImport: i0, template: "<ng-container *ngIf=\"isInGridViewAndSecondary | async\">\n <sky-list-secondary-action>\n <button type=\"button\" (click)=\"openColumnSelector()\">\n {{ 'skyux_grid_columns_button' | skyLibResources }}\n </button>\n </sky-list-secondary-action>\n</ng-container>\n\n<ng-template #columnChooser>\n <sky-list-column-selector-button\n *ngIf=\"isInGridView | async\"\n (click)=\"openColumnSelector()\"\n >\n </sky-list-column-selector-button>\n</ng-template>\n", components: [{ type: i1.λ6, selector: "sky-list-secondary-action" }, { type: SkyListColumnSelectorButtonComponent, selector: "sky-list-column-selector-button" }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i4$1.AsyncPipe, "skyLibResources": i5.SkyLibResourcesPipe } });
211
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionComponent, decorators: [{
212
+ type: Component,
213
+ args: [{ selector: 'sky-list-column-selector-action', template: "<ng-container *ngIf=\"isInGridViewAndSecondary | async\">\n <sky-list-secondary-action>\n <button type=\"button\" (click)=\"openColumnSelector()\">\n {{ 'skyux_grid_columns_button' | skyLibResources }}\n </button>\n </sky-list-secondary-action>\n</ng-container>\n\n<ng-template #columnChooser>\n <sky-list-column-selector-button\n *ngIf=\"isInGridView | async\"\n (click)=\"openColumnSelector()\"\n >\n </sky-list-column-selector-button>\n</ng-template>\n" }]
214
+ }], ctorParameters: function () {
215
+ return [{ type: i1.ListState }, { type: i2.SkyModalService }, { type: i1.ListStateDispatcher }, { type: i1.SkyListSecondaryActionsComponent, decorators: [{
216
+ type: Optional
217
+ }] }];
218
+ }, propDecorators: { gridView: [{
219
+ type: Input
220
+ }], helpKey: [{
221
+ type: Input
222
+ }], helpOpened: [{
223
+ type: Output
224
+ }], columnChooserTemplate: [{
225
+ type: ViewChild,
226
+ args: ['columnChooser', {
227
+ static: true,
228
+ }]
229
+ }] } });
230
+
231
+ class SkyListColumnSelectorActionModule {
232
+ }
233
+ SkyListColumnSelectorActionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
234
+ SkyListColumnSelectorActionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionModule, declarations: [SkyListColumnSelectorActionComponent,
235
+ SkyListColumnSelectorButtonComponent], imports: [CommonModule,
236
+ SkyI18nModule,
237
+ SkyModalModule,
238
+ SkyListSecondaryActionsModule,
239
+ SkyListToolbarModule,
240
+ SkyIconModule], exports: [SkyListColumnSelectorActionComponent, SkyColumnSelectorModule] });
241
+ SkyListColumnSelectorActionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionModule, imports: [[
242
+ CommonModule,
243
+ SkyI18nModule,
244
+ SkyModalModule,
245
+ SkyListSecondaryActionsModule,
246
+ SkyListToolbarModule,
247
+ SkyIconModule,
248
+ ], SkyColumnSelectorModule] });
249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListColumnSelectorActionModule, decorators: [{
250
+ type: NgModule,
251
+ args: [{
252
+ declarations: [
253
+ SkyListColumnSelectorActionComponent,
254
+ SkyListColumnSelectorButtonComponent,
255
+ ],
256
+ imports: [
257
+ CommonModule,
258
+ SkyI18nModule,
259
+ SkyModalModule,
260
+ SkyListSecondaryActionsModule,
261
+ SkyListToolbarModule,
262
+ SkyIconModule,
263
+ ],
264
+ exports: [SkyListColumnSelectorActionComponent, SkyColumnSelectorModule],
265
+ }]
266
+ }] });
267
+
268
+ /**
269
+ * @internal
270
+ */
271
+ class ListViewGridColumnsLoadAction {
272
+ constructor(columns, refresh = false) {
273
+ this.columns = columns;
274
+ this.refresh = refresh;
275
+ }
276
+ }
277
+
278
+ /**
279
+ * @internal
280
+ */
281
+ class GridStateModel {
282
+ constructor() {
283
+ this.columns = new AsyncList();
284
+ this.displayedColumns = new AsyncList();
285
+ }
286
+ }
287
+
288
+ /**
289
+ * @internal
290
+ */
291
+ class GridStateDispatcher extends StateDispatcher {
292
+ }
293
+ GridStateDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridStateDispatcher, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
294
+ GridStateDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridStateDispatcher });
295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridStateDispatcher, decorators: [{
296
+ type: Injectable
297
+ }] });
298
+ /**
299
+ * @internal
300
+ */
301
+ class GridStateOrchestrator extends StateOrchestrator {
302
+ }
303
+
304
+ /**
305
+ * @internal
306
+ */
307
+ class ListViewGridColumnsOrchestrator extends GridStateOrchestrator {
308
+ /* istanbul ignore next */
309
+ constructor() {
310
+ super();
311
+ this.register(ListViewGridColumnsLoadAction, this.load);
312
+ }
313
+ load(state, action) {
314
+ const newColumns = action.columns.map((g) => new SkyGridColumnModel(g.template, g));
315
+ if (action.refresh) {
316
+ return new AsyncList([...newColumns], new Date());
317
+ }
318
+ return new AsyncList([...state.items, ...newColumns], new Date());
319
+ }
320
+ }
321
+
322
+ /**
323
+ * @internal
324
+ */
325
+ class ListViewDisplayedGridColumnsOrchestrator extends GridStateOrchestrator {
326
+ /* istanbul ignore next */
327
+ constructor() {
328
+ super();
329
+ this.register(ListViewDisplayedGridColumnsLoadAction, this.load);
330
+ }
331
+ load(state, action) {
332
+ const newColumns = action.columns.map((g) => new SkyGridColumnModel(g.template, g));
333
+ if (action.refresh) {
334
+ return new AsyncList([...newColumns], new Date());
335
+ }
336
+ return new AsyncList([...state.items, ...newColumns], new Date());
337
+ }
338
+ }
339
+
340
+ /**
341
+ * @internal
342
+ */
343
+ class GridState extends StateNode {
344
+ /* istanbul ignore next */
345
+ constructor(initialState, dispatcher) {
346
+ super(initialState, dispatcher);
347
+ this.register('columns', ListViewGridColumnsOrchestrator)
348
+ .register('displayedColumns', ListViewDisplayedGridColumnsOrchestrator)
349
+ .begin();
350
+ }
351
+ }
352
+ GridState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridState, deps: [{ token: GridStateModel }, { token: GridStateDispatcher }], target: i0.ɵɵFactoryTarget.Injectable });
353
+ GridState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridState });
354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: GridState, decorators: [{
355
+ type: Injectable
356
+ }], ctorParameters: function () { return [{ type: GridStateModel }, { type: GridStateDispatcher }]; } });
357
+
358
+ /**
359
+ * The command for the list view grid to respond to.
360
+ */
361
+ var SkyListViewGridMessageType;
362
+ (function (SkyListViewGridMessageType) {
363
+ /**
364
+ * Deletes of a row in the list view grid.
365
+ */
366
+ SkyListViewGridMessageType[SkyListViewGridMessageType["PromptDeleteRow"] = 0] = "PromptDeleteRow";
367
+ /**
368
+ * Cancels the deletion of a row in the list view grid.
369
+ */
370
+ SkyListViewGridMessageType[SkyListViewGridMessageType["AbortDeleteRow"] = 1] = "AbortDeleteRow";
371
+ })(SkyListViewGridMessageType || (SkyListViewGridMessageType = {}));
372
+
373
+ /**
374
+ * Displays a grid for a
375
+ * [SKY UX-themed list of data](https://developer.blackbaud.com/skyux/components/list/overview)
376
+ * using the [grid component](https://developer.blackbaud.com/skyux/components/grid).
377
+ * You must install `SkyListModule` as a dependency.
378
+ */
379
+ class SkyListViewGridComponent extends ListViewComponent {
380
+ constructor(state, dispatcher, gridState, gridDispatcher) {
381
+ super(state, 'Grid View');
382
+ this.dispatcher = dispatcher;
383
+ this.gridState = gridState;
384
+ this.gridDispatcher = gridDispatcher;
385
+ /**
386
+ * Specifies how the grid fits to its parent. `"width"` fits the grid to the parent's full
387
+ * width, and `"scroll"` allows the grid to exceed the parent's width. If the grid does not have
388
+ * enough columns to fill the parent's width, it always stretches to the parent's full width.
389
+ * @default "width"
390
+ */
391
+ this.fit = 'width';
392
+ /**
393
+ * Indicates whether to highlight search text within the grid.
394
+ * @default true
395
+ */
396
+ this.highlightSearchText = true;
397
+ /**
398
+ * Indicates whether to enable the multiselect feature to display a column of checkboxes
399
+ * on the left side of the grid. Multiselect also displays an action bar with buttons to
400
+ * select and clear all checkboxes. Multiselect defaults to the `id` property on the list's
401
+ * `data` object.
402
+ * @default false
403
+ */
404
+ this.enableMultiselect = false;
405
+ /**
406
+ * Fires when users cancel the deletion of a row.
407
+ */
408
+ this.rowDeleteCancel = new EventEmitter();
409
+ /**
410
+ * Fires when users confirm the deletion of a row.
411
+ */
412
+ this.rowDeleteConfirm = new EventEmitter();
413
+ /**
414
+ * Fires when columns change. This includes changes to the displayed columns and changes
415
+ * to the order of columns. The event emits an array of IDs for the displayed columns that
416
+ * reflects the column order.
417
+ */
418
+ this.selectedColumnIdsChange = new EventEmitter();
419
+ /**
420
+ * Message stream for communicating with the internal grid instance
421
+ * @interal
422
+ */
423
+ this.gridMessageStream = new Subject();
424
+ this.multiselectSelectedIds = [];
425
+ this.ngUnsubscribe = new Subject();
426
+ this._messageStream = new Subject();
427
+ }
428
+ /**
429
+ * Specifies the name of the view.
430
+ * @required
431
+ */
432
+ set name(value) {
433
+ this.viewName = value;
434
+ }
435
+ /**
436
+ * Provides an observable to send commands to the grid.
437
+ * The commands should respect the `SkyListViewGridMessage` type.
438
+ */
439
+ set messageStream(stream) {
440
+ /* istanbul ignore else */
441
+ if (this._messageStream) {
442
+ this._messageStream.unsubscribe();
443
+ }
444
+ this._messageStream = stream;
445
+ this.initInlineDeleteMessages();
446
+ }
447
+ get messageStream() {
448
+ return this._messageStream;
449
+ }
450
+ get gridHeight() {
451
+ /* istanbul ignore next */
452
+ return typeof this.height === 'number'
453
+ ? of(this.height)
454
+ : this.height;
455
+ }
456
+ get gridWidth() {
457
+ /* istanbul ignore next */
458
+ return typeof this.width === 'number'
459
+ ? of(this.width)
460
+ : this.width;
461
+ }
462
+ ngAfterContentInit() {
463
+ // Watch for selection changes and update multiselectSelectedIds for local comparison.
464
+ this.state
465
+ .pipe(map((s) => s.selected.item), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.selectedMapEqual))
466
+ .subscribe((items) => {
467
+ const selectedIds = [];
468
+ items.selectedIdMap.forEach((isSelected, id) => {
469
+ if (items.selectedIdMap.get(id) === true) {
470
+ selectedIds.push(id);
471
+ }
472
+ });
473
+ this.multiselectSelectedIds = selectedIds;
474
+ });
475
+ /* istanbul ignore next */
476
+ if (this.columnComponents.length === 0) {
477
+ throw new Error('Grid view requires at least one sky-grid-column to render.');
478
+ }
479
+ const columnModels = this.columnComponents.map((columnComponent) => {
480
+ return new SkyGridColumnModel(columnComponent.template, columnComponent);
481
+ });
482
+ if (this.width && !isObservable(this.width)) {
483
+ this.width = of(this.width);
484
+ }
485
+ if (this.height && !isObservable(this.height)) {
486
+ this.height = of(this.height);
487
+ }
488
+ // Setup Observables for template
489
+ this.columns = this.gridState.pipe(map((s) => s.columns.items), distinctUntilChanged(this.arraysEqual), takeUntil(this.ngUnsubscribe));
490
+ this.selectedColumnIds = this.getSelectedIds();
491
+ this.items = this.getGridItems();
492
+ this.loading = this.state.pipe(map((s) => {
493
+ return s.items.loading;
494
+ }), distinctUntilChanged(), takeUntil(this.ngUnsubscribe));
495
+ this.sortField = this.state.pipe(map((s) => {
496
+ /* istanbul ignore else */
497
+ /* sanity check */
498
+ if (s.sort && s.sort.fieldSelectors) {
499
+ return s.sort.fieldSelectors[0];
500
+ }
501
+ /* istanbul ignore next */
502
+ /* sanity check */
503
+ return undefined;
504
+ }), distinctUntilChanged(), takeUntil(this.ngUnsubscribe));
505
+ this.gridState
506
+ .pipe(map((s) => s.columns.items), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.arraysEqual))
507
+ .subscribe((columns) => {
508
+ /* istanbul ignore else */
509
+ if (this.hiddenColumns) {
510
+ getValue(this.hiddenColumns, (hiddenColumns) => {
511
+ this.gridDispatcher.next(new ListViewDisplayedGridColumnsLoadAction(columns.filter((x) => {
512
+ /* istanbul ignore next */
513
+ /* sanity check */
514
+ const id = x.id || x.field;
515
+ return hiddenColumns.indexOf(id) === -1;
516
+ }), true));
517
+ });
518
+ }
519
+ else if (this.displayedColumns) {
520
+ /* istanbul ignore next */
521
+ getValue(this.displayedColumns, (displayedColumns) => {
522
+ this.gridDispatcher.next(new ListViewDisplayedGridColumnsLoadAction(columns.filter((x) => displayedColumns.indexOf(x.id || x.field) !== -1), true));
523
+ });
524
+ }
525
+ else {
526
+ this.gridDispatcher.next(new ListViewDisplayedGridColumnsLoadAction(columns.filter((x) => !x.hidden), true));
527
+ }
528
+ });
529
+ this.currentSearchText = this.state.pipe(map((s) => s.search.searchText), distinctUntilChanged(), takeUntil(this.ngUnsubscribe));
530
+ this.gridDispatcher.next(new ListViewGridColumnsLoadAction(columnModels, true));
531
+ this.handleColumnChange();
532
+ if (this.enableMultiselect) {
533
+ this.dispatcher.toolbarShowMultiselectToolbar(true);
534
+ }
535
+ this.initInlineDeleteMessages();
536
+ }
537
+ ngOnDestroy() {
538
+ this.ngUnsubscribe.next();
539
+ this.ngUnsubscribe.complete();
540
+ }
541
+ /**
542
+ * If user makes selection, tell list-builder to update the list state.
543
+ * This logic should only run on user interaction - NOT programmatic updates.
544
+ */
545
+ onMultiselectSelectionChange(event) {
546
+ if (event.source === SkyGridSelectedRowsSource.CheckboxChange ||
547
+ event.source === SkyGridSelectedRowsSource.RowClick) {
548
+ this.state
549
+ .pipe(map((s) => s.items.items), take(1))
550
+ .subscribe((items) => {
551
+ const newItemIds = this.arrayIntersection(items.map((i) => i.id), this.multiselectSelectedIds);
552
+ const newIds = items.filter((i) => i.isSelected).map((i) => i.id);
553
+ // Check for deselected ids & send message to dispatcher.
554
+ const deselectedIds = this.arrayDiff(newItemIds, newIds);
555
+ if (deselectedIds.length > 0) {
556
+ this.dispatcher.setSelected(deselectedIds, false);
557
+ }
558
+ // Check for selected ids & send message to dispatcher.
559
+ const selectedIds = this.arrayDiff(newIds, newItemIds);
560
+ if (selectedIds.length > 0) {
561
+ this.dispatcher.setSelected(selectedIds, true);
562
+ }
563
+ });
564
+ }
565
+ }
566
+ columnIdsChanged(selectedColumnIds) {
567
+ this.selectedColumnIds.pipe(take(1)).subscribe((currentIds) => {
568
+ if (!this.arraysEqual(selectedColumnIds, currentIds)) {
569
+ this.gridState
570
+ .pipe(map((s) => s.columns.items), take(1))
571
+ .subscribe((columns) => {
572
+ const displayedColumns = selectedColumnIds.map((columnId) => columns.filter((c) => c.id === columnId)[0]);
573
+ this.gridDispatcher.next(new ListViewDisplayedGridColumnsLoadAction(displayedColumns, true));
574
+ });
575
+ }
576
+ });
577
+ }
578
+ cancelRowDelete(args) {
579
+ this.rowDeleteCancel.emit(args);
580
+ }
581
+ confirmRowDelete(args) {
582
+ this.rowDeleteConfirm.emit(args);
583
+ }
584
+ sortFieldChanged(sortField) {
585
+ this.dispatcher.sortSetFieldSelectors([sortField]);
586
+ }
587
+ onViewActive() {
588
+ /*
589
+ Ran into problem where state updates were consumed out of order. For example, on search text
590
+ update, the searchText update was consumed after the resulting list item update. Scanning the
591
+ previous value of items lastUpdate ensures that we only receive the latest items.
592
+ */
593
+ this.gridState
594
+ .pipe(takeUntil(this.ngUnsubscribe), scan((previousValue, newValue) => {
595
+ if (previousValue.displayedColumns.lastUpdate >
596
+ newValue.displayedColumns.lastUpdate) {
597
+ return previousValue;
598
+ }
599
+ else {
600
+ return newValue;
601
+ }
602
+ }), map((s) => s.displayedColumns.items), distinctUntilChanged(this.arraysEqual))
603
+ .subscribe((displayedColumns) => {
604
+ const setFunctions = this.searchFunction !== undefined
605
+ ? [this.searchFunction]
606
+ : displayedColumns
607
+ .map((column) => (data, searchText) => column.searchFunction(getData(data, column.field), searchText))
608
+ .filter((c) => c !== undefined);
609
+ this.state.pipe(take(1)).subscribe((s) => {
610
+ this.dispatcher.searchSetOptions(new ListSearchModel({
611
+ searchText: s.search.searchText,
612
+ functions: setFunctions,
613
+ fieldSelectors: displayedColumns.map((d) => d.field),
614
+ }));
615
+ });
616
+ });
617
+ }
618
+ initInlineDeleteMessages() {
619
+ /* istanbul ignore next */
620
+ if (this.messageStream) {
621
+ this.messageStream.subscribe((message) => {
622
+ if (message.type === SkyListViewGridMessageType.AbortDeleteRow) {
623
+ this.gridMessageStream.next({
624
+ type: SkyGridMessageType.AbortDeleteRow,
625
+ data: {
626
+ abortDeleteRow: message.data.abortDeleteRow,
627
+ },
628
+ });
629
+ }
630
+ else if (message.type === SkyListViewGridMessageType.PromptDeleteRow) {
631
+ this.gridMessageStream.next({
632
+ type: SkyGridMessageType.PromptDeleteRow,
633
+ data: {
634
+ promptDeleteRow: message.data.promptDeleteRow,
635
+ },
636
+ });
637
+ }
638
+ });
639
+ }
640
+ }
641
+ handleColumnChange() {
642
+ // watch for changes in column components
643
+ this.columnComponents.changes
644
+ .pipe(takeUntil(this.ngUnsubscribe))
645
+ .subscribe((columnComponents) => {
646
+ const columnModels = this.columnComponents.map((column) => {
647
+ return new SkyGridColumnModel(column.template, column);
648
+ });
649
+ this.gridDispatcher.next(new ListViewGridColumnsLoadAction(columnModels, true));
650
+ });
651
+ // Watch for column heading changes:
652
+ this.columnComponents.forEach((comp) => {
653
+ comp.headingModelChanges
654
+ .pipe(takeUntil(this.ngUnsubscribe))
655
+ .subscribe((change) => {
656
+ this.gridComponent.updateColumnHeading(change);
657
+ });
658
+ comp.descriptionModelChanges
659
+ .pipe(takeUntil(this.ngUnsubscribe))
660
+ .subscribe((change) => {
661
+ this.gridComponent.updateColumnDescription(change);
662
+ });
663
+ });
664
+ }
665
+ getGridItems() {
666
+ /*
667
+ Same problem as above. We should move from having a state object observable with a bunch of
668
+ static properties to a static state object with observable properties that you can subscribe
669
+ to.
670
+ */
671
+ return this.state.pipe(map((s) => {
672
+ return s.items;
673
+ }), scan((previousValue, newValue) => {
674
+ if (previousValue.lastUpdate > newValue.lastUpdate) {
675
+ return previousValue;
676
+ }
677
+ else {
678
+ return newValue;
679
+ }
680
+ }), map((result) => {
681
+ return result.items;
682
+ }), distinctUntilChanged());
683
+ }
684
+ getSelectedIds() {
685
+ /*
686
+ Same problem as above. We should move from having a state object observable with a bunch of
687
+ static properties to a static state object with observable properties that you can subscribe
688
+ to.
689
+ */
690
+ return this.gridState.pipe(map((s) => s.displayedColumns), scan((previousValue, newValue) => {
691
+ if (previousValue.lastUpdate > newValue.lastUpdate) {
692
+ return previousValue;
693
+ }
694
+ else {
695
+ return newValue;
696
+ }
697
+ }), map((result) => {
698
+ /* istanbul ignore next */
699
+ /* sanity check */
700
+ return result.items.map((column) => {
701
+ return column.id || column.field;
702
+ });
703
+ }), distinctUntilChanged((previousValue, newValue) => {
704
+ return this.haveColumnIdsChanged(previousValue, newValue);
705
+ }));
706
+ }
707
+ haveColumnIdsChanged(previousValue, newValue) {
708
+ if (previousValue.length !== newValue.length) {
709
+ this.selectedColumnIdsChange.emit(newValue);
710
+ return false;
711
+ }
712
+ for (let i = 0; i < previousValue.length; i++) {
713
+ /* istanbul ignore if */
714
+ if (previousValue[i] !== newValue[i]) {
715
+ this.selectedColumnIdsChange.emit(newValue);
716
+ return false;
717
+ }
718
+ }
719
+ return true;
720
+ }
721
+ selectedMapEqual(prev, next) {
722
+ if (prev.selectedIdMap.size !== next.selectedIdMap.size) {
723
+ return false;
724
+ }
725
+ const keys = [];
726
+ next.selectedIdMap.forEach((value, key) => {
727
+ keys.push(key);
728
+ });
729
+ for (let i = 0; i < keys.length; i++) {
730
+ const key = keys[i];
731
+ const value = next.selectedIdMap.get(key);
732
+ if (value !== prev.selectedIdMap.get(key)) {
733
+ return false;
734
+ }
735
+ }
736
+ return true;
737
+ }
738
+ arrayDiff(arrA, arrB) {
739
+ return arrA.filter((i) => arrB.indexOf(i) < 0);
740
+ }
741
+ arrayIntersection(arrA, arrB) {
742
+ return arrA.filter((value) => -1 !== arrB.indexOf(value));
743
+ }
744
+ arraysEqual(arrayA, arrayB) {
745
+ return (arrayA.length === arrayB.length &&
746
+ arrayA.every((value, index) => value === arrayB[index]));
747
+ }
748
+ }
749
+ SkyListViewGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridComponent, deps: [{ token: i1.ListState }, { token: i1.ListStateDispatcher }, { token: GridState }, { token: GridStateDispatcher }], target: i0.ɵɵFactoryTarget.Component });
750
+ SkyListViewGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyListViewGridComponent, selector: "sky-list-view-grid", inputs: { name: "name", displayedColumns: "displayedColumns", hiddenColumns: "hiddenColumns", fit: "fit", width: "width", height: "height", highlightSearchText: "highlightSearchText", messageStream: "messageStream", rowHighlightedId: "rowHighlightedId", enableMultiselect: "enableMultiselect", settingsKey: "settingsKey", searchFunction: ["search", "searchFunction"] }, outputs: { rowDeleteCancel: "rowDeleteCancel", rowDeleteConfirm: "rowDeleteConfirm", selectedColumnIdsChange: "selectedColumnIdsChange" }, providers: [
751
+ /* tslint:disable */
752
+ {
753
+ provide: ListViewComponent,
754
+ useExisting: forwardRef(() => SkyListViewGridComponent),
755
+ },
756
+ /* tslint:enable */
757
+ GridState,
758
+ GridStateDispatcher,
759
+ GridStateModel,
760
+ ], queries: [{ propertyName: "columnComponents", predicate: SkyGridColumnComponent }], viewQueries: [{ propertyName: "gridComponent", first: true, predicate: SkyGridComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"active | async\">\n <sky-grid\n [columns]=\"columns | async\"\n [data]=\"items | async\"\n [enableMultiselect]=\"enableMultiselect\"\n [fit]=\"fit\"\n [height]=\"gridHeight | async\"\n [highlightText]=\"\n highlightSearchText ? (currentSearchText | async) : undefined\n \"\n [rowHighlightedId]=\"rowHighlightedId\"\n [messageStream]=\"gridMessageStream\"\n [selectedColumnIds]=\"selectedColumnIds | async\"\n [selectedRowIds]=\"multiselectSelectedIds\"\n [settingsKey]=\"settingsKey\"\n [sortField]=\"sortField | async\"\n [width]=\"gridWidth | async\"\n (multiselectSelectionChange)=\"onMultiselectSelectionChange($event)\"\n (rowDeleteCancel)=\"cancelRowDelete($event)\"\n (rowDeleteConfirm)=\"confirmRowDelete($event)\"\n (selectedColumnIdsChange)=\"columnIdsChanged($event)\"\n (sortFieldChange)=\"sortFieldChanged($event)\"\n #skyGrid\n >\n </sky-grid>\n <sky-wait [isWaiting]=\"loading | async\"> </sky-wait>\n</div>\n", styles: [":host ::ng-deep .sky-grid-heading{border-top:0!important}\n"], components: [{ type: i4$2.SkyGridComponent, selector: "sky-grid", inputs: ["columns", "data", "enableMultiselect", "fit", "hasToolbar", "height", "highlightText", "messageStream", "multiselectRowId", "rowHighlightedId", "selectedColumnIds", "selectedRowIds", "settingsKey", "sortField", "width"], outputs: ["columnWidthChange", "multiselectSelectionChange", "rowDeleteCancel", "rowDeleteConfirm", "selectedColumnIdsChange", "sortFieldChange"] }, { type: i1$1.λ14, selector: "sky-wait", inputs: ["ariaLabel", "isWaiting", "isFullPage", "isNonBlocking"] }], directives: [{ type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i4$1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridComponent, decorators: [{
762
+ type: Component,
763
+ args: [{ selector: 'sky-list-view-grid', providers: [
764
+ /* tslint:disable */
765
+ {
766
+ provide: ListViewComponent,
767
+ useExisting: forwardRef(() => SkyListViewGridComponent),
768
+ },
769
+ /* tslint:enable */
770
+ GridState,
771
+ GridStateDispatcher,
772
+ GridStateModel,
773
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"active | async\">\n <sky-grid\n [columns]=\"columns | async\"\n [data]=\"items | async\"\n [enableMultiselect]=\"enableMultiselect\"\n [fit]=\"fit\"\n [height]=\"gridHeight | async\"\n [highlightText]=\"\n highlightSearchText ? (currentSearchText | async) : undefined\n \"\n [rowHighlightedId]=\"rowHighlightedId\"\n [messageStream]=\"gridMessageStream\"\n [selectedColumnIds]=\"selectedColumnIds | async\"\n [selectedRowIds]=\"multiselectSelectedIds\"\n [settingsKey]=\"settingsKey\"\n [sortField]=\"sortField | async\"\n [width]=\"gridWidth | async\"\n (multiselectSelectionChange)=\"onMultiselectSelectionChange($event)\"\n (rowDeleteCancel)=\"cancelRowDelete($event)\"\n (rowDeleteConfirm)=\"confirmRowDelete($event)\"\n (selectedColumnIdsChange)=\"columnIdsChanged($event)\"\n (sortFieldChange)=\"sortFieldChanged($event)\"\n #skyGrid\n >\n </sky-grid>\n <sky-wait [isWaiting]=\"loading | async\"> </sky-wait>\n</div>\n", styles: [":host ::ng-deep .sky-grid-heading{border-top:0!important}\n"] }]
774
+ }], ctorParameters: function () { return [{ type: i1.ListState }, { type: i1.ListStateDispatcher }, { type: GridState }, { type: GridStateDispatcher }]; }, propDecorators: { name: [{
775
+ type: Input
776
+ }], displayedColumns: [{
777
+ type: Input
778
+ }], hiddenColumns: [{
779
+ type: Input
780
+ }], fit: [{
781
+ type: Input
782
+ }], width: [{
783
+ type: Input
784
+ }], height: [{
785
+ type: Input
786
+ }], highlightSearchText: [{
787
+ type: Input
788
+ }], messageStream: [{
789
+ type: Input
790
+ }], rowHighlightedId: [{
791
+ type: Input
792
+ }], enableMultiselect: [{
793
+ type: Input
794
+ }], settingsKey: [{
795
+ type: Input
796
+ }], rowDeleteCancel: [{
797
+ type: Output
798
+ }], rowDeleteConfirm: [{
799
+ type: Output
800
+ }], selectedColumnIdsChange: [{
801
+ type: Output
802
+ }], gridComponent: [{
803
+ type: ViewChild,
804
+ args: [SkyGridComponent]
805
+ }], searchFunction: [{
806
+ type: Input,
807
+ args: ['search']
808
+ }], columnComponents: [{
809
+ type: ContentChildren,
810
+ args: [SkyGridColumnComponent]
811
+ }] } });
812
+
813
+ /**
814
+ * NOTICE: DO NOT MODIFY THIS FILE!
815
+ * The contents of this file were automatically generated by
816
+ * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-list-builder-view-grids' schematic.
817
+ * To update this file, simply rerun the command.
818
+ */
819
+ const RESOURCES = {
820
+ 'EN-US': {
821
+ skyux_grid_column_picker_cancel: { message: 'Cancel' },
822
+ skyux_grid_column_picker_header: {
823
+ message: 'Choose columns to show in the list',
824
+ },
825
+ skyux_grid_column_picker_search_placeholder: {
826
+ message: 'Search for columns',
827
+ },
828
+ skyux_grid_column_picker_submit: { message: 'Apply changes' },
829
+ skyux_grid_columns_button: { message: 'Choose columns' },
830
+ skyux_grid_columns_toolbar_button: { message: 'Columns' },
831
+ },
832
+ };
833
+ class SkyListBuilderViewGridsResourcesProvider {
834
+ getString(localeInfo, name) {
835
+ return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
836
+ }
837
+ }
838
+ /**
839
+ * Import into any component library module that needs to use resource strings.
840
+ */
841
+ class SkyListBuilderViewGridsResourcesModule {
842
+ }
843
+ SkyListBuilderViewGridsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListBuilderViewGridsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
844
+ SkyListBuilderViewGridsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListBuilderViewGridsResourcesModule, exports: [SkyI18nModule] });
845
+ SkyListBuilderViewGridsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListBuilderViewGridsResourcesModule, providers: [
846
+ {
847
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
848
+ useClass: SkyListBuilderViewGridsResourcesProvider,
849
+ multi: true,
850
+ },
851
+ ], imports: [SkyI18nModule] });
852
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListBuilderViewGridsResourcesModule, decorators: [{
853
+ type: NgModule,
854
+ args: [{
855
+ exports: [SkyI18nModule],
856
+ providers: [
857
+ {
858
+ provide: SKY_LIB_RESOURCES_PROVIDERS,
859
+ useClass: SkyListBuilderViewGridsResourcesProvider,
860
+ multi: true,
861
+ },
862
+ ],
863
+ }]
864
+ }] });
865
+
866
+ class SkyListViewGridModule {
867
+ }
868
+ SkyListViewGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
869
+ SkyListViewGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridModule, declarations: [SkyListViewGridComponent], imports: [CommonModule,
870
+ SkyWaitModule,
871
+ SkyGridModule,
872
+ SkyListBuilderViewGridsResourcesModule], exports: [SkyListViewGridComponent,
873
+ SkyListColumnSelectorActionModule,
874
+ SkyGridModule] });
875
+ SkyListViewGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridModule, imports: [[
876
+ CommonModule,
877
+ SkyWaitModule,
878
+ SkyGridModule,
879
+ SkyListBuilderViewGridsResourcesModule,
880
+ ], SkyListColumnSelectorActionModule,
881
+ SkyGridModule] });
882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyListViewGridModule, decorators: [{
883
+ type: NgModule,
884
+ args: [{
885
+ declarations: [SkyListViewGridComponent],
886
+ imports: [
887
+ CommonModule,
888
+ SkyWaitModule,
889
+ SkyGridModule,
890
+ SkyListBuilderViewGridsResourcesModule,
891
+ ],
892
+ exports: [
893
+ SkyListViewGridComponent,
894
+ SkyListColumnSelectorActionModule,
895
+ SkyGridModule,
896
+ ],
897
+ }]
898
+ }] });
899
+
900
+ /**
901
+ * Generated bundle index. Do not edit.
902
+ */
903
+
904
+ export { GridState, GridStateDispatcher, GridStateModel, GridStateOrchestrator, ListViewDisplayedGridColumnsLoadAction, ListViewDisplayedGridColumnsOrchestrator, ListViewGridColumnsLoadAction, ListViewGridColumnsOrchestrator, SkyColumnSelectorContext, SkyColumnSelectorModel, SkyColumnSelectorModule, SkyListColumnSelectorActionModule, SkyListViewGridComponent, SkyListViewGridMessageType, SkyListViewGridModule, SkyListColumnSelectorActionComponent as λ1 };
905
+ //# sourceMappingURL=skyux-list-builder-view-grids.mjs.map