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