@skyux/list-builder 5.5.0 → 5.6.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.
- package/bundles/skyux-list-builder.umd.js +702 -701
- package/documentation.json +552 -789
- package/esm2015/lib/modules/list/list-data-request.model.js.map +1 -1
- package/esm2015/lib/modules/list/list-data.provider.js +3 -1
- package/esm2015/lib/modules/list/list-data.provider.js.map +1 -1
- package/esm2015/lib/modules/list/list-paging.component.js.map +1 -1
- package/esm2015/lib/modules/list/list-view.component.js +2 -1
- package/esm2015/lib/modules/list/list-view.component.js.map +1 -1
- package/esm2015/lib/modules/list/list.component.js +17 -17
- package/esm2015/lib/modules/list/list.component.js.map +1 -1
- package/esm2015/lib/modules/list/list.module.js +1 -1
- package/esm2015/lib/modules/list/list.module.js.map +1 -1
- package/esm2015/lib/modules/list/state/filters/filters.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/items/items.orchestrator.js +5 -5
- package/esm2015/lib/modules/list/state/items/items.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/list-state-action.type.js.map +1 -1
- package/esm2015/lib/modules/list/state/list-state.model.js +1 -1
- package/esm2015/lib/modules/list/state/list-state.model.js.map +1 -1
- package/esm2015/lib/modules/list/state/list-state.rxstate.js +2 -2
- package/esm2015/lib/modules/list/state/list-state.rxstate.js.map +1 -1
- package/esm2015/lib/modules/list/state/list-state.state-node.js +4 -4
- package/esm2015/lib/modules/list/state/list-state.state-node.js.map +1 -1
- package/esm2015/lib/modules/list/state/paging/paging.orchestrator.js +1 -1
- package/esm2015/lib/modules/list/state/paging/paging.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/search/search.model.js.map +1 -1
- package/esm2015/lib/modules/list/state/search/search.orchestrator.js +2 -2
- package/esm2015/lib/modules/list/state/search/search.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/search/set-options.action.js.map +1 -1
- package/esm2015/lib/modules/list/state/selected/selected.orchestrator.js +3 -3
- package/esm2015/lib/modules/list/state/selected/selected.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/sort/label.model.js.map +1 -1
- package/esm2015/lib/modules/list/state/sort/sort.orchestrator.js +2 -2
- package/esm2015/lib/modules/list/state/sort/sort.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/toolbar/toolbar-item.model.js.map +1 -1
- package/esm2015/lib/modules/list/state/toolbar/toolbar.orchestrator.js +3 -3
- package/esm2015/lib/modules/list/state/toolbar/toolbar.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list/state/views/views.orchestrator.js +1 -1
- package/esm2015/lib/modules/list/state/views/views.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list-data-provider-in-memory/list-data-in-memory.provider.js +12 -12
- package/esm2015/lib/modules/list-data-provider-in-memory/list-data-in-memory.provider.js.map +1 -1
- package/esm2015/lib/modules/list-filters/filter.model.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-button.component.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline-item-renderer.component.js +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline-item-renderer.component.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline-item.component.js +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline-item.component.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline.component.js +3 -3
- package/esm2015/lib/modules/list-filters/list-filter-inline.component.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-inline.model.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-summary.component.js +1 -1
- package/esm2015/lib/modules/list-filters/list-filter-summary.component.js.map +1 -1
- package/esm2015/lib/modules/list-filters/list-filters.module.js +3 -3
- package/esm2015/lib/modules/list-filters/list-filters.module.js.map +1 -1
- package/esm2015/lib/modules/list-paging/list-paging.component.js +3 -3
- package/esm2015/lib/modules/list-paging/list-paging.component.js.map +1 -1
- package/esm2015/lib/modules/list-paging/list-paging.module.js +2 -2
- package/esm2015/lib/modules/list-paging/list-paging.module.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-multiselect-toolbar.component.js +3 -4
- package/esm2015/lib/modules/list-toolbar/list-multiselect-toolbar.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions-host.component.js +1 -1
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions-host.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions.component.js +1 -1
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions.module.js +2 -2
- package/esm2015/lib/modules/list-toolbar/list-secondary-actions/list-secondary-actions.module.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar-item-renderer.component.js +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar-item-renderer.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar-item.component.js +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar-item.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar.component.js +14 -14
- package/esm2015/lib/modules/list-toolbar/list-toolbar.component.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/list-toolbar.module.js +10 -10
- package/esm2015/lib/modules/list-toolbar/list-toolbar.module.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/state/config/config.model.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/state/config/config.orchestrator.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/state/toolbar-state-action.type.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/state/toolbar-state.rxstate.js.map +1 -1
- package/esm2015/lib/modules/list-toolbar/state/toolbar-state.state-node.js +1 -1
- package/esm2015/lib/modules/list-toolbar/state/toolbar-state.state-node.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-list-builder-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-list-builder-resources.module.js.map +1 -1
- package/fesm2015/skyux-list-builder.js +645 -643
- package/fesm2015/skyux-list-builder.js.map +1 -1
- package/lib/modules/list/list-data.provider.d.ts +2 -1
- package/lib/modules/list/list-paging.component.d.ts +1 -1
- package/lib/modules/list/list-view.component.d.ts +1 -1
- package/lib/modules/list/list.component.d.ts +4 -4
- package/lib/modules/list/state/filters/filters.orchestrator.d.ts +1 -1
- package/lib/modules/list/state/list-state-action.type.d.ts +13 -13
- package/lib/modules/list/state/list-state.model.d.ts +1 -1
- package/lib/modules/list/state/search/set-options.action.d.ts +1 -1
- package/lib/modules/list-data-provider-in-memory/list-data-in-memory.provider.d.ts +2 -2
- package/lib/modules/list-filters/list-filter-inline-item-renderer.component.d.ts +1 -1
- package/lib/modules/list-filters/list-filter-inline-item.component.d.ts +1 -1
- package/lib/modules/list-filters/list-filter-inline.component.d.ts +1 -1
- package/lib/modules/list-filters/list-filter-inline.model.d.ts +1 -1
- package/lib/modules/list-filters/list-filter-summary.component.d.ts +1 -1
- package/lib/modules/list-paging/list-paging.component.d.ts +1 -1
- package/lib/modules/list-toolbar/list-multiselect-toolbar.component.d.ts +2 -2
- package/lib/modules/list-toolbar/list-toolbar-item-renderer.component.d.ts +1 -1
- package/lib/modules/list-toolbar/list-toolbar.component.d.ts +5 -5
- package/package.json +16 -18
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChildren, NgModule, TemplateRef, ViewChild, ViewContainerRef, forwardRef } from '@angular/core';
|
|
3
1
|
import * as i4 from '@angular/common';
|
|
4
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChildren, NgModule, TemplateRef, ViewChild, ViewContainerRef, forwardRef } from '@angular/core';
|
|
5
|
+
import { ListItemModel, getData, compare, StateOrchestrator, StateDispatcher, AsyncList, AsyncItem, StateNode, getValue, isObservable } from '@skyux/list-builder-common';
|
|
5
6
|
import { BehaviorSubject, Observable, Subject, of, combineLatest } from 'rxjs';
|
|
6
|
-
import { map,
|
|
7
|
-
import { ListItemModel, getData, compare, AsyncList, AsyncItem, StateOrchestrator, StateDispatcher, StateNode, getValue, isObservable } from '@skyux/list-builder-common';
|
|
7
|
+
import { map, distinctUntilChanged, take, takeUntil, skip, flatMap, scan } from 'rxjs/operators';
|
|
8
8
|
import * as i3 from '@skyux/lists';
|
|
9
9
|
import { SkyFilterModule, SkyPagingModule, SkySortModule } from '@skyux/lists';
|
|
10
10
|
import * as i5 from '@skyux/i18n';
|
|
@@ -13,12 +13,12 @@ import * as i3$1 from '@skyux/indicators';
|
|
|
13
13
|
import { SkyIconModule } from '@skyux/indicators';
|
|
14
14
|
import * as i2 from '@skyux/popovers';
|
|
15
15
|
import { SkyDropdownModule } from '@skyux/popovers';
|
|
16
|
+
import * as i5$1 from '@skyux/forms';
|
|
17
|
+
import { SkyCheckboxModule } from '@skyux/forms';
|
|
16
18
|
import * as i3$2 from '@skyux/layout';
|
|
17
19
|
import { SkyToolbarModule } from '@skyux/layout';
|
|
18
20
|
import * as i8 from '@skyux/lookup';
|
|
19
21
|
import { SkySearchComponent, SkySearchModule } from '@skyux/lookup';
|
|
20
|
-
import * as i5$1 from '@skyux/forms';
|
|
21
|
-
import { SkyCheckboxModule } from '@skyux/forms';
|
|
22
22
|
|
|
23
23
|
class ListDataRequestModel {
|
|
24
24
|
constructor(data) {
|
|
@@ -51,81 +51,8 @@ class ListDataResponseModel {
|
|
|
51
51
|
* @internal
|
|
52
52
|
*/
|
|
53
53
|
class ListDataProvider {
|
|
54
|
-
constructor(data) { }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
class ListItemsLoadAction {
|
|
61
|
-
constructor(items, refresh = false, dataChanged = true, count) {
|
|
62
|
-
this.items = items;
|
|
63
|
-
this.refresh = refresh;
|
|
64
|
-
this.dataChanged = dataChanged;
|
|
65
|
-
this.count = count;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
class ListItemsSetLoadingAction {
|
|
73
|
-
constructor(loading = true) {
|
|
74
|
-
this.loading = loading;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
81
|
-
class ListSelectedLoadAction {
|
|
82
|
-
constructor(items) {
|
|
83
|
-
this.items = items;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
class ListSelectedSetLoadingAction {
|
|
91
|
-
constructor(loading = true) {
|
|
92
|
-
this.loading = loading;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Specifies a set of fields to sort by.
|
|
98
|
-
*/
|
|
99
|
-
class ListSortModel {
|
|
100
54
|
constructor(data) {
|
|
101
|
-
|
|
102
|
-
* Specifies the list of available views to sort.
|
|
103
|
-
*/
|
|
104
|
-
this.available = [];
|
|
105
|
-
/**
|
|
106
|
-
* Specifies whether the sort applies to all list views.
|
|
107
|
-
*/
|
|
108
|
-
this.global = [];
|
|
109
|
-
/**
|
|
110
|
-
* Specifies the fields to sort.
|
|
111
|
-
* For information about `ListSortFieldSelectorModel`, see the
|
|
112
|
-
* [shared classes for lists](https://developer.blackbaud.com/skyux-list-builder-common/docs/list-builder-common).
|
|
113
|
-
*/
|
|
114
|
-
this.fieldSelectors = [];
|
|
115
|
-
if (data) {
|
|
116
|
-
this.available = data.available;
|
|
117
|
-
this.global = data.global;
|
|
118
|
-
this.fieldSelectors = data.fieldSelectors;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
class ListSortSetFieldSelectorsAction {
|
|
127
|
-
constructor(fieldSelectors) {
|
|
128
|
-
this.fieldSelectors = fieldSelectors;
|
|
55
|
+
this.data = data;
|
|
129
56
|
}
|
|
130
57
|
}
|
|
131
58
|
|
|
@@ -179,8 +106,8 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
179
106
|
get(request) {
|
|
180
107
|
return this.filteredItems(request).pipe(map((result) => {
|
|
181
108
|
if (request.pageNumber && request.pageSize) {
|
|
182
|
-
|
|
183
|
-
|
|
109
|
+
const itemStart = (request.pageNumber - 1) * request.pageSize;
|
|
110
|
+
const pagedResult = result.slice(itemStart, itemStart + request.pageSize);
|
|
184
111
|
return new ListDataResponseModel({
|
|
185
112
|
count: result.length,
|
|
186
113
|
items: pagedResult,
|
|
@@ -199,7 +126,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
199
126
|
return this.items.pipe(map((items) => {
|
|
200
127
|
let dataChanged = false;
|
|
201
128
|
let search = request.search;
|
|
202
|
-
|
|
129
|
+
const sort = request.sort;
|
|
203
130
|
let filters = request.filters;
|
|
204
131
|
if (this.lastItems === undefined || this.lastItems !== items) {
|
|
205
132
|
dataChanged = true;
|
|
@@ -233,7 +160,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
233
160
|
else if (filters && filters.length > 0) {
|
|
234
161
|
result = result.filter((item) => {
|
|
235
162
|
for (let i = 0; i < filters.length; i++) {
|
|
236
|
-
|
|
163
|
+
const filter = filters[i];
|
|
237
164
|
if (filter.value === undefined ||
|
|
238
165
|
filter.value === '' ||
|
|
239
166
|
filter.value === false ||
|
|
@@ -262,7 +189,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
262
189
|
else if (search &&
|
|
263
190
|
search.searchText !== undefined &&
|
|
264
191
|
search.searchText.length > 0) {
|
|
265
|
-
|
|
192
|
+
const searchText = search.searchText.toLowerCase();
|
|
266
193
|
let searchFunctions;
|
|
267
194
|
if (this.searchFunction !== undefined) {
|
|
268
195
|
searchFunctions = [this.searchFunction];
|
|
@@ -273,8 +200,8 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
273
200
|
result = result.filter((item) => {
|
|
274
201
|
let isMatch = false;
|
|
275
202
|
for (let i = 0; i < searchFunctions.length; i++) {
|
|
276
|
-
|
|
277
|
-
|
|
203
|
+
const searchFunction = searchFunctions[i];
|
|
204
|
+
const searchResult = searchFunction(item.data, searchText);
|
|
278
205
|
if ((typeof searchResult === 'string' &&
|
|
279
206
|
searchResult.indexOf(searchText) !== -1) ||
|
|
280
207
|
searchResult === true) {
|
|
@@ -296,9 +223,9 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
296
223
|
.sort((item1, item2) => {
|
|
297
224
|
let compareResult = 0;
|
|
298
225
|
for (let i = 0; i < sort.fieldSelectors.length; i++) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
226
|
+
const selector = sort.fieldSelectors[i];
|
|
227
|
+
const value1 = getData(item1.data, selector.fieldSelector);
|
|
228
|
+
const value2 = getData(item2.data, selector.fieldSelector);
|
|
302
229
|
compareResult = compare(value1, value2);
|
|
303
230
|
if (selector.descending && compareResult !== 0) {
|
|
304
231
|
compareResult *= -1;
|
|
@@ -315,73 +242,52 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
315
242
|
}
|
|
316
243
|
}
|
|
317
244
|
|
|
245
|
+
let idIndex$2 = 0;
|
|
318
246
|
/**
|
|
319
247
|
* @internal
|
|
320
248
|
*/
|
|
321
|
-
class
|
|
322
|
-
constructor(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
249
|
+
class ListViewComponent {
|
|
250
|
+
constructor(state, defaultName) {
|
|
251
|
+
this.viewId = `sky-list-view-cmp-${++idIndex$2}`;
|
|
252
|
+
this.state = state;
|
|
253
|
+
this.viewName = defaultName;
|
|
254
|
+
/* istanbul ignore next */
|
|
255
|
+
this.hasToolbar = this.state.pipe(map((s) => s.toolbar.exists));
|
|
256
|
+
this.active = this.state.pipe(map((s) => s.views.active === this.viewId));
|
|
257
|
+
this.active
|
|
258
|
+
.pipe(distinctUntilChanged())
|
|
259
|
+
.subscribe((isActive) => isActive ? this.onViewActive() : this.onViewInactive());
|
|
329
260
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Contains data about the selected items in the list.
|
|
334
|
-
*/
|
|
335
|
-
class ListSelectedModel {
|
|
336
|
-
constructor() {
|
|
337
|
-
this.selectedIdMap = new Map();
|
|
261
|
+
get id() {
|
|
262
|
+
return this.viewId;
|
|
338
263
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @internal
|
|
343
|
-
*/
|
|
344
|
-
class ListToolbarModel {
|
|
345
|
-
constructor(data) {
|
|
346
|
-
this.items = [];
|
|
347
|
-
this.showMultiselectToolbar = false;
|
|
348
|
-
if (data) {
|
|
349
|
-
this.exists = data.exists;
|
|
350
|
-
this.disabled = data.disabled;
|
|
351
|
-
this.items = data.items;
|
|
352
|
-
this.type = data.type;
|
|
353
|
-
this.showMultiselectToolbar = data.showMultiselectToolbar;
|
|
354
|
-
}
|
|
264
|
+
get label() {
|
|
265
|
+
return this.viewName;
|
|
355
266
|
}
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
268
|
+
onViewActive() { }
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
270
|
+
onViewInactive() { }
|
|
356
271
|
}
|
|
357
272
|
|
|
358
273
|
/**
|
|
359
274
|
* @internal
|
|
360
275
|
*/
|
|
361
|
-
class
|
|
362
|
-
constructor(
|
|
363
|
-
this.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
276
|
+
class ListItemsLoadAction {
|
|
277
|
+
constructor(items, refresh = false, dataChanged = true, count) {
|
|
278
|
+
this.items = items;
|
|
279
|
+
this.refresh = refresh;
|
|
280
|
+
this.dataChanged = dataChanged;
|
|
281
|
+
this.count = count;
|
|
368
282
|
}
|
|
369
283
|
}
|
|
370
284
|
|
|
371
285
|
/**
|
|
372
286
|
* @internal
|
|
373
287
|
*/
|
|
374
|
-
class
|
|
375
|
-
constructor() {
|
|
376
|
-
this.
|
|
377
|
-
this.items = new AsyncList();
|
|
378
|
-
this.paging = new ListPagingModel();
|
|
379
|
-
this.search = new ListSearchModel();
|
|
380
|
-
this.selected = new AsyncItem();
|
|
381
|
-
this.sort = new ListSortModel();
|
|
382
|
-
this.toolbar = new ListToolbarModel();
|
|
383
|
-
this.views = new ListViewsModel();
|
|
384
|
-
this.selected.item = new ListSelectedModel();
|
|
288
|
+
class ListItemsSetLoadingAction {
|
|
289
|
+
constructor(loading = true) {
|
|
290
|
+
this.loading = loading;
|
|
385
291
|
}
|
|
386
292
|
}
|
|
387
293
|
|
|
@@ -397,38 +303,38 @@ class ListFiltersUpdateAction {
|
|
|
397
303
|
/**
|
|
398
304
|
* @internal
|
|
399
305
|
*/
|
|
400
|
-
class
|
|
401
|
-
constructor(
|
|
402
|
-
this.
|
|
306
|
+
class ListSearchSetFieldSelectorsAction {
|
|
307
|
+
constructor(fieldSelectors = []) {
|
|
308
|
+
this.fieldSelectors = fieldSelectors;
|
|
403
309
|
}
|
|
404
310
|
}
|
|
405
311
|
|
|
406
312
|
/**
|
|
407
313
|
* @internal
|
|
408
314
|
*/
|
|
409
|
-
class
|
|
410
|
-
constructor(
|
|
411
|
-
this.
|
|
315
|
+
class ListSearchSetFunctionsAction {
|
|
316
|
+
constructor(functions = []) {
|
|
317
|
+
this.functions = functions;
|
|
412
318
|
}
|
|
413
319
|
}
|
|
414
320
|
|
|
415
321
|
/**
|
|
416
322
|
* @internal
|
|
417
323
|
*/
|
|
418
|
-
class
|
|
419
|
-
constructor(
|
|
420
|
-
this.
|
|
324
|
+
class ListSearchSetOptionsAction {
|
|
325
|
+
constructor(searchTextAction, setFieldSelectorsAction, setFunctionsAction) {
|
|
326
|
+
this.searchTextAction = searchTextAction;
|
|
327
|
+
this.setFieldSelectorsAction = setFieldSelectorsAction;
|
|
328
|
+
this.setFunctionsAction = setFunctionsAction;
|
|
421
329
|
}
|
|
422
330
|
}
|
|
423
331
|
|
|
424
332
|
/**
|
|
425
333
|
* @internal
|
|
426
334
|
*/
|
|
427
|
-
class
|
|
428
|
-
constructor(
|
|
429
|
-
this.
|
|
430
|
-
this.setFieldSelectorsAction = setFieldSelectorsAction;
|
|
431
|
-
this.setFunctionsAction = setFunctionsAction;
|
|
335
|
+
class ListSearchSetSearchTextAction {
|
|
336
|
+
constructor(searchText) {
|
|
337
|
+
this.searchText = searchText;
|
|
432
338
|
}
|
|
433
339
|
}
|
|
434
340
|
|
|
@@ -452,6 +358,15 @@ class ListSortSetAvailableAction {
|
|
|
452
358
|
}
|
|
453
359
|
}
|
|
454
360
|
|
|
361
|
+
/**
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
class ListSortSetFieldSelectorsAction {
|
|
365
|
+
constructor(fieldSelectors) {
|
|
366
|
+
this.fieldSelectors = fieldSelectors;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
455
370
|
/**
|
|
456
371
|
* @internal
|
|
457
372
|
*/
|
|
@@ -624,18 +539,18 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
624
539
|
const resultItems = action.refresh
|
|
625
540
|
? [...newListItems]
|
|
626
541
|
: [...state.items, ...newListItems];
|
|
627
|
-
|
|
542
|
+
const count = action.count === undefined ? resultItems.length : action.count;
|
|
628
543
|
return new AsyncList(resultItems, action.dataChanged ? Date.now() : state.lastUpdate, false, count);
|
|
629
544
|
}
|
|
630
545
|
setItemsSelected(state, action) {
|
|
631
546
|
/* istanbul ignore next */
|
|
632
547
|
const newSelectedIds = action.items || [];
|
|
633
|
-
|
|
548
|
+
const newListItemModels = this.cloneListItemModelArray(state.items);
|
|
634
549
|
if (action.refresh) {
|
|
635
550
|
newListItemModels.forEach((item) => (item.isSelected = undefined));
|
|
636
551
|
}
|
|
637
552
|
newSelectedIds.map((s) => {
|
|
638
|
-
|
|
553
|
+
const newItem = newListItemModels.find((i) => i.id === s);
|
|
639
554
|
/* istanbul ignore next */
|
|
640
555
|
if (newItem) {
|
|
641
556
|
newItem.isSelected = action.selected;
|
|
@@ -644,7 +559,7 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
644
559
|
return new AsyncList(newListItemModels, Date.now(), state.loading, state.count);
|
|
645
560
|
}
|
|
646
561
|
cloneListItemModelArray(source) {
|
|
647
|
-
|
|
562
|
+
const newListItems = [];
|
|
648
563
|
source.forEach((item) => {
|
|
649
564
|
newListItems.push(new ListItemModel(item.id, Object.assign({}, item.data), item.isSelected));
|
|
650
565
|
});
|
|
@@ -655,171 +570,146 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
655
570
|
/**
|
|
656
571
|
* @internal
|
|
657
572
|
*/
|
|
658
|
-
class
|
|
659
|
-
constructor(
|
|
660
|
-
|
|
573
|
+
class ListPagingModel {
|
|
574
|
+
constructor(data) {
|
|
575
|
+
if (data !== undefined) {
|
|
576
|
+
this.itemsPerPage = data.itemsPerPage || 10;
|
|
577
|
+
this.maxDisplayedPages = data.maxDisplayedPages || 5;
|
|
578
|
+
this.pageCount = data.pageCount || 0;
|
|
579
|
+
this.pageNumber = data.pageNumber || 1;
|
|
580
|
+
}
|
|
661
581
|
}
|
|
662
582
|
}
|
|
663
583
|
|
|
664
584
|
/**
|
|
665
|
-
*
|
|
585
|
+
* Contains data about the selected items in the list.
|
|
666
586
|
*/
|
|
667
|
-
class
|
|
668
|
-
constructor(
|
|
669
|
-
this.
|
|
587
|
+
class ListSelectedModel {
|
|
588
|
+
constructor() {
|
|
589
|
+
this.selectedIdMap = new Map();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Specifies a set of fields to sort by.
|
|
595
|
+
*/
|
|
596
|
+
class ListSortModel {
|
|
597
|
+
constructor(data) {
|
|
598
|
+
/**
|
|
599
|
+
* Specifies the list of available views to sort.
|
|
600
|
+
*/
|
|
601
|
+
this.available = [];
|
|
602
|
+
/**
|
|
603
|
+
* Specifies whether the sort applies to all list views.
|
|
604
|
+
*/
|
|
605
|
+
this.global = [];
|
|
606
|
+
/**
|
|
607
|
+
* Specifies the fields to sort.
|
|
608
|
+
* For information about `ListSortFieldSelectorModel`, see the
|
|
609
|
+
* [shared classes for lists](https://developer.blackbaud.com/skyux-list-builder-common/docs/list-builder-common).
|
|
610
|
+
*/
|
|
611
|
+
this.fieldSelectors = [];
|
|
612
|
+
if (data) {
|
|
613
|
+
this.available = data.available;
|
|
614
|
+
this.global = data.global;
|
|
615
|
+
this.fieldSelectors = data.fieldSelectors;
|
|
616
|
+
}
|
|
670
617
|
}
|
|
671
618
|
}
|
|
672
619
|
|
|
673
620
|
/**
|
|
674
621
|
* @internal
|
|
675
622
|
*/
|
|
676
|
-
class
|
|
677
|
-
constructor(
|
|
678
|
-
this.
|
|
623
|
+
class ListToolbarModel {
|
|
624
|
+
constructor(data) {
|
|
625
|
+
this.items = [];
|
|
626
|
+
this.showMultiselectToolbar = false;
|
|
627
|
+
if (data) {
|
|
628
|
+
this.exists = data.exists;
|
|
629
|
+
this.disabled = data.disabled;
|
|
630
|
+
this.items = data.items;
|
|
631
|
+
this.type = data.type;
|
|
632
|
+
this.showMultiselectToolbar = data.showMultiselectToolbar;
|
|
633
|
+
}
|
|
679
634
|
}
|
|
680
635
|
}
|
|
681
636
|
|
|
682
637
|
/**
|
|
683
638
|
* @internal
|
|
684
639
|
*/
|
|
685
|
-
class
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
.
|
|
691
|
-
|
|
692
|
-
}
|
|
693
|
-
setMaxPages(state, action) {
|
|
694
|
-
return new ListPagingModel(Object.assign({}, state, { maxDisplayedPages: Number(action.maxPages) }));
|
|
695
|
-
}
|
|
696
|
-
setItemsPerPage(state, action) {
|
|
697
|
-
return new ListPagingModel(Object.assign({}, state, { itemsPerPage: Number(action.itemsPerPage) }));
|
|
698
|
-
}
|
|
699
|
-
setPageNumber(state, action) {
|
|
700
|
-
return new ListPagingModel(Object.assign({}, state, { pageNumber: Number(action.pageNumber) }));
|
|
640
|
+
class ListViewsModel {
|
|
641
|
+
constructor(data) {
|
|
642
|
+
this.views = [];
|
|
643
|
+
if (data) {
|
|
644
|
+
this.active = data.active;
|
|
645
|
+
this.views = data.views;
|
|
646
|
+
}
|
|
701
647
|
}
|
|
702
648
|
}
|
|
703
649
|
|
|
704
650
|
/**
|
|
705
651
|
* @internal
|
|
706
652
|
*/
|
|
707
|
-
class
|
|
708
|
-
constructor(
|
|
709
|
-
this.
|
|
653
|
+
class ListStateModel {
|
|
654
|
+
constructor() {
|
|
655
|
+
this.filters = [];
|
|
656
|
+
this.items = new AsyncList();
|
|
657
|
+
this.paging = new ListPagingModel();
|
|
658
|
+
this.search = new ListSearchModel();
|
|
659
|
+
this.selected = new AsyncItem();
|
|
660
|
+
this.sort = new ListSortModel();
|
|
661
|
+
this.toolbar = new ListToolbarModel();
|
|
662
|
+
this.views = new ListViewsModel();
|
|
663
|
+
this.selected.item = new ListSelectedModel();
|
|
710
664
|
}
|
|
711
665
|
}
|
|
712
666
|
|
|
713
667
|
/**
|
|
714
668
|
* @internal
|
|
715
669
|
*/
|
|
716
|
-
class
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
super();
|
|
720
|
-
this.register(ListViewsSetActiveAction, this.setActive).register(ListViewsLoadAction, this.load);
|
|
721
|
-
}
|
|
722
|
-
setActive(state, action) {
|
|
723
|
-
return new ListViewsModel(Object.assign({}, state, { active: action.view }));
|
|
724
|
-
}
|
|
725
|
-
load(state, action) {
|
|
726
|
-
return new ListViewsModel(Object.assign({}, state, { views: action.views }));
|
|
670
|
+
class ListPagingSetItemsPerPageAction {
|
|
671
|
+
constructor(itemsPerPage) {
|
|
672
|
+
this.itemsPerPage = itemsPerPage;
|
|
727
673
|
}
|
|
728
674
|
}
|
|
729
675
|
|
|
730
676
|
/**
|
|
731
677
|
* @internal
|
|
732
678
|
*/
|
|
733
|
-
class
|
|
734
|
-
constructor(
|
|
735
|
-
this.
|
|
736
|
-
if (data) {
|
|
737
|
-
this.index = data.index;
|
|
738
|
-
this.template = data.template;
|
|
739
|
-
this.location = data.location;
|
|
740
|
-
this.view = data.view;
|
|
741
|
-
this.id = data.id;
|
|
742
|
-
}
|
|
679
|
+
class ListPagingSetMaxPagesAction {
|
|
680
|
+
constructor(maxPages) {
|
|
681
|
+
this.maxPages = maxPages;
|
|
743
682
|
}
|
|
744
683
|
}
|
|
745
684
|
|
|
746
685
|
/**
|
|
747
686
|
* @internal
|
|
748
687
|
*/
|
|
749
|
-
class
|
|
750
|
-
constructor(
|
|
751
|
-
this.
|
|
688
|
+
class ListPagingSetPageNumberAction {
|
|
689
|
+
constructor(pageNumber) {
|
|
690
|
+
this.pageNumber = pageNumber;
|
|
752
691
|
}
|
|
753
692
|
}
|
|
754
693
|
|
|
755
694
|
/**
|
|
756
695
|
* @internal
|
|
757
696
|
*/
|
|
758
|
-
class
|
|
697
|
+
class ListPagingOrchestrator extends ListStateOrchestrator {
|
|
759
698
|
/* istanbul ignore next */
|
|
760
699
|
constructor() {
|
|
761
700
|
super();
|
|
762
|
-
this.register(
|
|
763
|
-
.register(
|
|
764
|
-
.register(
|
|
765
|
-
.register(ListToolbarSetTypeAction, this.setType)
|
|
766
|
-
.register(ListToolbarItemsRemoveAction, this.remove)
|
|
767
|
-
.register(ListToolbarShowMultiselectToolbarAction, this.showMultiselectToolbar);
|
|
768
|
-
}
|
|
769
|
-
setExists(state, action) {
|
|
770
|
-
const newModel = new ListToolbarModel(state);
|
|
771
|
-
newModel.exists = action.exists;
|
|
772
|
-
return newModel;
|
|
773
|
-
}
|
|
774
|
-
setDisabled(state, action) {
|
|
775
|
-
const newModel = new ListToolbarModel(state);
|
|
776
|
-
newModel.disabled = action.disable;
|
|
777
|
-
return newModel;
|
|
778
|
-
}
|
|
779
|
-
setType(state, action) {
|
|
780
|
-
const newModel = new ListToolbarModel(state);
|
|
781
|
-
newModel.type = action.type;
|
|
782
|
-
return newModel;
|
|
701
|
+
this.register(ListPagingSetMaxPagesAction, this.setMaxPages)
|
|
702
|
+
.register(ListPagingSetItemsPerPageAction, this.setItemsPerPage)
|
|
703
|
+
.register(ListPagingSetPageNumberAction, this.setPageNumber);
|
|
783
704
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
const newListItems = action.items.map((item) => {
|
|
787
|
-
/**
|
|
788
|
-
* NOTE: Originally this function went off the action index and item models did not include
|
|
789
|
-
* the index. We changed this but must leave functionality to convert the action index for
|
|
790
|
-
* backwards compatibility.
|
|
791
|
-
*/
|
|
792
|
-
if (!item.index) {
|
|
793
|
-
item.index = action.index;
|
|
794
|
-
}
|
|
795
|
-
return new ListToolbarItemModel(item);
|
|
796
|
-
});
|
|
797
|
-
let items = [...state.items, ...newListItems];
|
|
798
|
-
items = items.sort((a, b) => {
|
|
799
|
-
if (a.index < b.index) {
|
|
800
|
-
return -1;
|
|
801
|
-
}
|
|
802
|
-
else if (a.index > b.index) {
|
|
803
|
-
return 1;
|
|
804
|
-
}
|
|
805
|
-
else {
|
|
806
|
-
return 0;
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
newModel.items = items;
|
|
810
|
-
return newModel;
|
|
705
|
+
setMaxPages(state, action) {
|
|
706
|
+
return new ListPagingModel(Object.assign({}, state, { maxDisplayedPages: Number(action.maxPages) }));
|
|
811
707
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
newModel.items = newModel.items.filter((item) => {
|
|
815
|
-
return action.ids.indexOf(item.id) === -1;
|
|
816
|
-
});
|
|
817
|
-
return newModel;
|
|
708
|
+
setItemsPerPage(state, action) {
|
|
709
|
+
return new ListPagingModel(Object.assign({}, state, { itemsPerPage: Number(action.itemsPerPage) }));
|
|
818
710
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
newModel.showMultiselectToolbar = action.exists;
|
|
822
|
-
return newModel;
|
|
711
|
+
setPageNumber(state, action) {
|
|
712
|
+
return new ListPagingModel(Object.assign({}, state, { pageNumber: Number(action.pageNumber) }));
|
|
823
713
|
}
|
|
824
714
|
}
|
|
825
715
|
|
|
@@ -864,6 +754,15 @@ class ListSearchOrchestrator extends ListStateOrchestrator {
|
|
|
864
754
|
}
|
|
865
755
|
}
|
|
866
756
|
|
|
757
|
+
/**
|
|
758
|
+
* @internal
|
|
759
|
+
*/
|
|
760
|
+
class ListSelectedLoadAction {
|
|
761
|
+
constructor(items) {
|
|
762
|
+
this.items = items;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
867
766
|
/**
|
|
868
767
|
* @internal
|
|
869
768
|
*/
|
|
@@ -874,6 +773,15 @@ class ListSelectedSetItemSelectedAction {
|
|
|
874
773
|
}
|
|
875
774
|
}
|
|
876
775
|
|
|
776
|
+
/**
|
|
777
|
+
* @internal
|
|
778
|
+
*/
|
|
779
|
+
class ListSelectedSetLoadingAction {
|
|
780
|
+
constructor(loading = true) {
|
|
781
|
+
this.loading = loading;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
877
785
|
/**
|
|
878
786
|
* @internal
|
|
879
787
|
*/
|
|
@@ -915,7 +823,7 @@ class ListSelectedOrchestrator extends ListStateOrchestrator {
|
|
|
915
823
|
return new AsyncItem(newListSelectedModel, state.lastUpdate, state.loading);
|
|
916
824
|
}
|
|
917
825
|
cloneListSelectedModel(source) {
|
|
918
|
-
|
|
826
|
+
const newListItems = new ListSelectedModel();
|
|
919
827
|
newListItems.selectedIdMap = new Map(source.selectedIdMap);
|
|
920
828
|
return newListItems;
|
|
921
829
|
}
|
|
@@ -970,6 +878,128 @@ class ListSortOrchestrator extends ListStateOrchestrator {
|
|
|
970
878
|
}
|
|
971
879
|
}
|
|
972
880
|
|
|
881
|
+
/**
|
|
882
|
+
* @internal
|
|
883
|
+
*/
|
|
884
|
+
class ListToolbarSetTypeAction {
|
|
885
|
+
constructor(type) {
|
|
886
|
+
this.type = type;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* @internal
|
|
892
|
+
*/
|
|
893
|
+
class ListToolbarItemModel {
|
|
894
|
+
constructor(data) {
|
|
895
|
+
this.index = -1;
|
|
896
|
+
if (data) {
|
|
897
|
+
this.index = data.index;
|
|
898
|
+
this.template = data.template;
|
|
899
|
+
this.location = data.location;
|
|
900
|
+
this.view = data.view;
|
|
901
|
+
this.id = data.id;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* @internal
|
|
908
|
+
*/
|
|
909
|
+
class ListToolbarOrchestrator extends ListStateOrchestrator {
|
|
910
|
+
/* istanbul ignore next */
|
|
911
|
+
constructor() {
|
|
912
|
+
super();
|
|
913
|
+
this.register(ListToolbarSetExistsAction, this.setExists)
|
|
914
|
+
.register(ListToolbarItemsDisableAction, this.setDisabled)
|
|
915
|
+
.register(ListToolbarItemsLoadAction, this.load)
|
|
916
|
+
.register(ListToolbarSetTypeAction, this.setType)
|
|
917
|
+
.register(ListToolbarItemsRemoveAction, this.remove)
|
|
918
|
+
.register(ListToolbarShowMultiselectToolbarAction, this.showMultiselectToolbar);
|
|
919
|
+
}
|
|
920
|
+
setExists(state, action) {
|
|
921
|
+
const newModel = new ListToolbarModel(state);
|
|
922
|
+
newModel.exists = action.exists;
|
|
923
|
+
return newModel;
|
|
924
|
+
}
|
|
925
|
+
setDisabled(state, action) {
|
|
926
|
+
const newModel = new ListToolbarModel(state);
|
|
927
|
+
newModel.disabled = action.disable;
|
|
928
|
+
return newModel;
|
|
929
|
+
}
|
|
930
|
+
setType(state, action) {
|
|
931
|
+
const newModel = new ListToolbarModel(state);
|
|
932
|
+
newModel.type = action.type;
|
|
933
|
+
return newModel;
|
|
934
|
+
}
|
|
935
|
+
load(state, action) {
|
|
936
|
+
const newModel = new ListToolbarModel(state);
|
|
937
|
+
const newListItems = action.items.map((item) => {
|
|
938
|
+
/**
|
|
939
|
+
* NOTE: Originally this function went off the action index and item models did not include
|
|
940
|
+
* the index. We changed this but must leave functionality to convert the action index for
|
|
941
|
+
* backwards compatibility.
|
|
942
|
+
*/
|
|
943
|
+
if (!item.index) {
|
|
944
|
+
item.index = action.index;
|
|
945
|
+
}
|
|
946
|
+
return new ListToolbarItemModel(item);
|
|
947
|
+
});
|
|
948
|
+
let items = [...state.items, ...newListItems];
|
|
949
|
+
items = items.sort((a, b) => {
|
|
950
|
+
if (a.index < b.index) {
|
|
951
|
+
return -1;
|
|
952
|
+
}
|
|
953
|
+
else if (a.index > b.index) {
|
|
954
|
+
return 1;
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
return 0;
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
newModel.items = items;
|
|
961
|
+
return newModel;
|
|
962
|
+
}
|
|
963
|
+
remove(state, action) {
|
|
964
|
+
const newModel = new ListToolbarModel(state);
|
|
965
|
+
newModel.items = newModel.items.filter((item) => {
|
|
966
|
+
return action.ids.indexOf(item.id) === -1;
|
|
967
|
+
});
|
|
968
|
+
return newModel;
|
|
969
|
+
}
|
|
970
|
+
showMultiselectToolbar(state, action) {
|
|
971
|
+
const newModel = new ListToolbarModel(state);
|
|
972
|
+
newModel.showMultiselectToolbar = action.exists;
|
|
973
|
+
return newModel;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* @internal
|
|
979
|
+
*/
|
|
980
|
+
class ListViewsLoadAction {
|
|
981
|
+
constructor(views) {
|
|
982
|
+
this.views = views;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* @internal
|
|
988
|
+
*/
|
|
989
|
+
class ListViewsOrchestrator extends ListStateOrchestrator {
|
|
990
|
+
/* istanbul ignore next */
|
|
991
|
+
constructor() {
|
|
992
|
+
super();
|
|
993
|
+
this.register(ListViewsSetActiveAction, this.setActive).register(ListViewsLoadAction, this.load);
|
|
994
|
+
}
|
|
995
|
+
setActive(state, action) {
|
|
996
|
+
return new ListViewsModel(Object.assign({}, state, { active: action.view }));
|
|
997
|
+
}
|
|
998
|
+
load(state, action) {
|
|
999
|
+
return new ListViewsModel(Object.assign({}, state, { views: action.views }));
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
973
1003
|
/**
|
|
974
1004
|
* @internal
|
|
975
1005
|
*/
|
|
@@ -993,33 +1023,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
993
1023
|
type: Injectable
|
|
994
1024
|
}], ctorParameters: function () { return [{ type: ListStateDispatcher }]; } });
|
|
995
1025
|
|
|
996
|
-
let idIndex$2 = 0;
|
|
997
|
-
/**
|
|
998
|
-
* @internal
|
|
999
|
-
*/
|
|
1000
|
-
class ListViewComponent {
|
|
1001
|
-
constructor(state, defaultName) {
|
|
1002
|
-
this.viewId = `sky-list-view-cmp-${++idIndex$2}`;
|
|
1003
|
-
this.state = state;
|
|
1004
|
-
this.viewName = defaultName;
|
|
1005
|
-
/* istanbul ignore next */
|
|
1006
|
-
this.hasToolbar = this.state.pipe(map((s) => s.toolbar.exists));
|
|
1007
|
-
this.active = this.state.pipe(map((s) => s.views.active === this.viewId));
|
|
1008
|
-
this.active
|
|
1009
|
-
.pipe(distinctUntilChanged())
|
|
1010
|
-
.subscribe((isActive) => isActive ? this.onViewActive() : this.onViewInactive());
|
|
1011
|
-
}
|
|
1012
|
-
get id() {
|
|
1013
|
-
return this.viewId;
|
|
1014
|
-
}
|
|
1015
|
-
get label() {
|
|
1016
|
-
return this.viewName;
|
|
1017
|
-
}
|
|
1018
|
-
/* istanbul ignore next */
|
|
1019
|
-
onViewActive() { }
|
|
1020
|
-
onViewInactive() { }
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
1026
|
/**
|
|
1024
1027
|
* @internal
|
|
1025
1028
|
*/
|
|
@@ -1070,7 +1073,7 @@ class SkyListComponent {
|
|
|
1070
1073
|
this.dataFirstLoad = true;
|
|
1071
1074
|
}
|
|
1072
1075
|
if (this.listViews.length > 0) {
|
|
1073
|
-
|
|
1076
|
+
const defaultView = this.defaultView === undefined
|
|
1074
1077
|
? this.listViews.first
|
|
1075
1078
|
: this.defaultView;
|
|
1076
1079
|
this.dispatcher.next(new ListViewsLoadAction(this.listViews.map((v) => new ListViewModel(v.id, v.label))));
|
|
@@ -1100,7 +1103,7 @@ class SkyListComponent {
|
|
|
1100
1103
|
.pipe(map((current) => current.selected), takeUntil(this.ngUnsubscribe), distinctUntilChanged())
|
|
1101
1104
|
.subscribe((selected) => {
|
|
1102
1105
|
// Update lastSelectedIds to help us retain user selections.
|
|
1103
|
-
|
|
1106
|
+
const selectedIdsList = [];
|
|
1104
1107
|
selected.item.selectedIdMap.forEach((value, key) => {
|
|
1105
1108
|
if (value === true) {
|
|
1106
1109
|
selectedIdsList.push(key);
|
|
@@ -1178,7 +1181,7 @@ class SkyListComponent {
|
|
|
1178
1181
|
// This subject is used to cancel previous request to the list's data provider when a new change
|
|
1179
1182
|
// to the list's state occurs. In a future breaking change this should be replaced or coupled
|
|
1180
1183
|
// with adding a debounce time to the Observable which watches for state changes.
|
|
1181
|
-
|
|
1184
|
+
const cancelLastRequest = new Subject();
|
|
1182
1185
|
return combineLatest([
|
|
1183
1186
|
this.state.pipe(map((s) => s.filters), distinctUntilChanged()),
|
|
1184
1187
|
this.state.pipe(map((s) => s.search), distinctUntilChanged()),
|
|
@@ -1203,7 +1206,7 @@ class SkyListComponent {
|
|
|
1203
1206
|
let response;
|
|
1204
1207
|
if (this.dataFirstLoad) {
|
|
1205
1208
|
this.dataFirstLoad = false;
|
|
1206
|
-
|
|
1209
|
+
const initialItems = itemsData.map((d) => new ListItemModel(d.id || `sky-list-item-model-${++idIndex$1}`, d));
|
|
1207
1210
|
response = of(new ListDataResponseModel({
|
|
1208
1211
|
count: this.initialTotal,
|
|
1209
1212
|
items: initialItems,
|
|
@@ -1249,7 +1252,7 @@ class SkyListComponent {
|
|
|
1249
1252
|
return this.dataProvider.count();
|
|
1250
1253
|
}
|
|
1251
1254
|
getItemsAndRetainSelections(newList, selectedIds) {
|
|
1252
|
-
|
|
1255
|
+
const updatedListModel = newList.slice();
|
|
1253
1256
|
updatedListModel.forEach((item) => {
|
|
1254
1257
|
item.isSelected = selectedIds.indexOf(item.id) > -1 ? true : false;
|
|
1255
1258
|
});
|
|
@@ -1402,54 +1405,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1402
1405
|
}] } });
|
|
1403
1406
|
|
|
1404
1407
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
* [list component's](https://developer.blackbaud.com/skyux/components/list/overview#list-properties)
|
|
1407
|
-
* `appliedFilters` property. Place this component within the
|
|
1408
|
-
* [`sky-list-toolbar`](https://developer.blackbaud.com/skyux/components/list/toolbar) component.
|
|
1408
|
+
* @internal
|
|
1409
1409
|
*/
|
|
1410
|
-
class
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
*/
|
|
1418
|
-
this.summaryItemClick = new EventEmitter();
|
|
1419
|
-
}
|
|
1420
|
-
ngAfterContentInit() {
|
|
1421
|
-
// The setTimeout here is to ensure we avoid any ExpressionChangedAfterItHasBeenCheckedError issues.
|
|
1422
|
-
setTimeout(() => {
|
|
1423
|
-
this.appliedFilters = this.state.pipe(map((state) => {
|
|
1424
|
-
return state.filters.filter((filter) => {
|
|
1425
|
-
return (filter.value !== '' &&
|
|
1426
|
-
filter.value !== undefined &&
|
|
1427
|
-
filter.value !== false &&
|
|
1428
|
-
filter.value !== filter.defaultValue);
|
|
1429
|
-
});
|
|
1430
|
-
}));
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
1433
|
-
filterSummaryItemDismiss(index) {
|
|
1434
|
-
this.appliedFilters.pipe(take(1)).subscribe((filters) => {
|
|
1435
|
-
filters.splice(index, 1);
|
|
1436
|
-
this.dispatcher.filtersUpdate(filters.slice());
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
filterSummaryItemClick(item) {
|
|
1440
|
-
this.summaryItemClick.emit(item);
|
|
1410
|
+
class SkyListFilterInlineItemRendererComponent {
|
|
1411
|
+
ngOnInit() {
|
|
1412
|
+
/* istanbul ignore else */
|
|
1413
|
+
/* sanity check */
|
|
1414
|
+
if (this.template !== undefined) {
|
|
1415
|
+
this.container.createEmbeddedView(this.template, this);
|
|
1416
|
+
}
|
|
1441
1417
|
}
|
|
1442
1418
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1419
|
+
SkyListFilterInlineItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1420
|
+
SkyListFilterInlineItemRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListFilterInlineItemRendererComponent, selector: "sky-list-filter-inline-item-renderer", inputs: { template: "template", filter: "filter" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #container></ng-template>', isInline: true });
|
|
1421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, decorators: [{
|
|
1446
1422
|
type: Component,
|
|
1447
1423
|
args: [{
|
|
1448
|
-
selector: 'sky-list-filter-
|
|
1449
|
-
|
|
1424
|
+
selector: 'sky-list-filter-inline-item-renderer',
|
|
1425
|
+
template: '<ng-template #container></ng-template>',
|
|
1450
1426
|
}]
|
|
1451
|
-
}],
|
|
1452
|
-
type:
|
|
1427
|
+
}], propDecorators: { template: [{
|
|
1428
|
+
type: Input
|
|
1429
|
+
}], filter: [{
|
|
1430
|
+
type: Input
|
|
1431
|
+
}], container: [{
|
|
1432
|
+
type: ViewChild,
|
|
1433
|
+
args: ['container', {
|
|
1434
|
+
read: ViewContainerRef,
|
|
1435
|
+
static: true,
|
|
1436
|
+
}]
|
|
1453
1437
|
}] } });
|
|
1454
1438
|
|
|
1455
1439
|
/**
|
|
@@ -1495,38 +1479,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1495
1479
|
args: [TemplateRef]
|
|
1496
1480
|
}] } });
|
|
1497
1481
|
|
|
1498
|
-
/**
|
|
1499
|
-
* @internal
|
|
1500
|
-
*/
|
|
1501
|
-
class SkyListFilterInlineItemRendererComponent {
|
|
1502
|
-
ngOnInit() {
|
|
1503
|
-
/* istanbul ignore else */
|
|
1504
|
-
/* sanity check */
|
|
1505
|
-
if (this.template !== undefined) {
|
|
1506
|
-
this.container.createEmbeddedView(this.template, this);
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
SkyListFilterInlineItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1511
|
-
SkyListFilterInlineItemRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListFilterInlineItemRendererComponent, selector: "sky-list-filter-inline-item-renderer", inputs: { template: "template", filter: "filter" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #container></ng-template>', isInline: true });
|
|
1512
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, decorators: [{
|
|
1513
|
-
type: Component,
|
|
1514
|
-
args: [{
|
|
1515
|
-
selector: 'sky-list-filter-inline-item-renderer',
|
|
1516
|
-
template: '<ng-template #container></ng-template>',
|
|
1517
|
-
}]
|
|
1518
|
-
}], propDecorators: { template: [{
|
|
1519
|
-
type: Input
|
|
1520
|
-
}], filter: [{
|
|
1521
|
-
type: Input
|
|
1522
|
-
}], container: [{
|
|
1523
|
-
type: ViewChild,
|
|
1524
|
-
args: ['container', {
|
|
1525
|
-
read: ViewContainerRef,
|
|
1526
|
-
static: true,
|
|
1527
|
-
}]
|
|
1528
|
-
}] } });
|
|
1529
|
-
|
|
1530
1482
|
/**
|
|
1531
1483
|
* Creates an inline filter area for the list. Place each filter
|
|
1532
1484
|
* in a `sky-list-filter-inline-item` component.
|
|
@@ -1552,39 +1504,90 @@ class SkyListFilterInlineComponent {
|
|
|
1552
1504
|
this.applyFilters();
|
|
1553
1505
|
});
|
|
1554
1506
|
});
|
|
1555
|
-
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1507
|
+
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1508
|
+
}
|
|
1509
|
+
applyFilters() {
|
|
1510
|
+
this.state.pipe(take(1)).subscribe((currentState) => {
|
|
1511
|
+
if (currentState.paging.pageNumber &&
|
|
1512
|
+
currentState.paging.pageNumber !== 1) {
|
|
1513
|
+
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
1514
|
+
}
|
|
1515
|
+
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
getFilterModelFromInline(inlineFilters) {
|
|
1519
|
+
return inlineFilters.map((filter) => {
|
|
1520
|
+
return new ListFilterModel({
|
|
1521
|
+
name: filter.name,
|
|
1522
|
+
value: filter.value,
|
|
1523
|
+
filterFunction: filter.filterFunction,
|
|
1524
|
+
defaultValue: filter.defaultValue,
|
|
1525
|
+
});
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
SkyListFilterInlineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineComponent, deps: [{ token: ListStateDispatcher }, { token: ListState }], target: i0.ɵɵFactoryTarget.Component });
|
|
1530
|
+
SkyListFilterInlineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListFilterInlineComponent, selector: "sky-list-filter-inline", queries: [{ propertyName: "filters", predicate: SkyListFilterInlineItemComponent }], ngImport: i0, template: "<ng-content></ng-content>\n\n<sky-filter-inline>\n <sky-filter-inline-item *ngFor=\"let filter of inlineFilters\">\n <sky-list-filter-inline-item-renderer\n [template]=\"filter.template\"\n [filter]=\"filter\"\n >\n </sky-list-filter-inline-item-renderer>\n </sky-filter-inline-item>\n</sky-filter-inline>\n", components: [{ type: i3.λ2, selector: "sky-filter-inline" }, { type: i3.λ3, selector: "sky-filter-inline-item" }, { type: SkyListFilterInlineItemRendererComponent, selector: "sky-list-filter-inline-item-renderer", inputs: ["template", "filter"] }], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
1531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineComponent, decorators: [{
|
|
1532
|
+
type: Component,
|
|
1533
|
+
args: [{
|
|
1534
|
+
selector: 'sky-list-filter-inline',
|
|
1535
|
+
templateUrl: './list-filter-inline.component.html',
|
|
1536
|
+
}]
|
|
1537
|
+
}], ctorParameters: function () { return [{ type: ListStateDispatcher }, { type: ListState }]; }, propDecorators: { filters: [{
|
|
1538
|
+
type: ContentChildren,
|
|
1539
|
+
args: [SkyListFilterInlineItemComponent]
|
|
1540
|
+
}] } });
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Creates a filter summary based on the
|
|
1544
|
+
* [list component's](https://developer.blackbaud.com/skyux/components/list/overview#list-properties)
|
|
1545
|
+
* `appliedFilters` property. Place this component within the
|
|
1546
|
+
* [`sky-list-toolbar`](https://developer.blackbaud.com/skyux/components/list/toolbar) component.
|
|
1547
|
+
*/
|
|
1548
|
+
class SkyListFilterSummaryComponent {
|
|
1549
|
+
constructor(state, dispatcher) {
|
|
1550
|
+
this.state = state;
|
|
1551
|
+
this.dispatcher = dispatcher;
|
|
1552
|
+
/**
|
|
1553
|
+
* Emits a `ListFilterModel` when users select a summary item. A common use case is
|
|
1554
|
+
* to open a filter modal when this event is received.
|
|
1555
|
+
*/
|
|
1556
|
+
this.summaryItemClick = new EventEmitter();
|
|
1557
|
+
}
|
|
1558
|
+
ngAfterContentInit() {
|
|
1559
|
+
// The setTimeout here is to ensure we avoid any ExpressionChangedAfterItHasBeenCheckedError issues.
|
|
1560
|
+
setTimeout(() => {
|
|
1561
|
+
this.appliedFilters = this.state.pipe(map((state) => {
|
|
1562
|
+
return state.filters.filter((filter) => {
|
|
1563
|
+
return (filter.value !== '' &&
|
|
1564
|
+
filter.value !== undefined &&
|
|
1565
|
+
filter.value !== false &&
|
|
1566
|
+
filter.value !== filter.defaultValue);
|
|
1567
|
+
});
|
|
1568
|
+
}));
|
|
1569
|
+
});
|
|
1556
1570
|
}
|
|
1557
|
-
|
|
1558
|
-
this.
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
1562
|
-
}
|
|
1563
|
-
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1571
|
+
filterSummaryItemDismiss(index) {
|
|
1572
|
+
this.appliedFilters.pipe(take(1)).subscribe((filters) => {
|
|
1573
|
+
filters.splice(index, 1);
|
|
1574
|
+
this.dispatcher.filtersUpdate(filters.slice());
|
|
1564
1575
|
});
|
|
1565
1576
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
return new ListFilterModel({
|
|
1569
|
-
name: filter.name,
|
|
1570
|
-
value: filter.value,
|
|
1571
|
-
filterFunction: filter.filterFunction,
|
|
1572
|
-
defaultValue: filter.defaultValue,
|
|
1573
|
-
});
|
|
1574
|
-
});
|
|
1577
|
+
filterSummaryItemClick(item) {
|
|
1578
|
+
this.summaryItemClick.emit(item);
|
|
1575
1579
|
}
|
|
1576
1580
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1581
|
+
SkyListFilterSummaryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterSummaryComponent, deps: [{ token: ListState }, { token: ListStateDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
1582
|
+
SkyListFilterSummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListFilterSummaryComponent, selector: "sky-list-filter-summary", outputs: { summaryItemClick: "summaryItemClick" }, ngImport: i0, template: "<sky-filter-summary>\n <sky-filter-summary-item\n *ngFor=\"let item of appliedFilters | async; let i = index\"\n (dismiss)=\"filterSummaryItemDismiss(i)\"\n (itemClick)=\"filterSummaryItemClick(item)\"\n [dismissible]=\"item.dismissible\"\n >\n {{ item.label || item.value }}\n </sky-filter-summary-item>\n</sky-filter-summary>\n", components: [{ type: i3.λ5, selector: "sky-filter-summary" }, { type: i3.λ4, selector: "sky-filter-summary-item", inputs: ["dismissible"], outputs: ["dismiss", "itemClick"] }], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i4.AsyncPipe } });
|
|
1583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterSummaryComponent, decorators: [{
|
|
1580
1584
|
type: Component,
|
|
1581
1585
|
args: [{
|
|
1582
|
-
selector: 'sky-list-filter-
|
|
1583
|
-
templateUrl: './list-filter-
|
|
1586
|
+
selector: 'sky-list-filter-summary',
|
|
1587
|
+
templateUrl: './list-filter-summary.component.html',
|
|
1584
1588
|
}]
|
|
1585
|
-
}], ctorParameters: function () { return [{ type:
|
|
1586
|
-
type:
|
|
1587
|
-
args: [SkyListFilterInlineItemComponent]
|
|
1589
|
+
}], ctorParameters: function () { return [{ type: ListState }, { type: ListStateDispatcher }]; }, propDecorators: { summaryItemClick: [{
|
|
1590
|
+
type: Output
|
|
1588
1591
|
}] } });
|
|
1589
1592
|
|
|
1590
1593
|
class SkyListFiltersModule {
|
|
@@ -1803,6 +1806,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1803
1806
|
type: Injectable
|
|
1804
1807
|
}] });
|
|
1805
1808
|
|
|
1809
|
+
/**
|
|
1810
|
+
* Adds actions to the secondary actions dropdown in the list toolbar.
|
|
1811
|
+
*/
|
|
1812
|
+
class SkyListSecondaryActionComponent {
|
|
1813
|
+
constructor(actionService) {
|
|
1814
|
+
this.actionService = actionService;
|
|
1815
|
+
}
|
|
1816
|
+
ngAfterContentInit() {
|
|
1817
|
+
this.actionService.addSecondaryAction({
|
|
1818
|
+
template: this.templateRef,
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
SkyListSecondaryActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionComponent, deps: [{ token: SkyListSecondaryActionsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1823
|
+
SkyListSecondaryActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListSecondaryActionComponent, selector: "sky-list-secondary-action", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["listSecondaryAction"], descendants: true, read: TemplateRef, static: true }], ngImport: i0, template: "<ng-template #listSecondaryAction>\n <ng-content></ng-content>\n</ng-template>\n" });
|
|
1824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionComponent, decorators: [{
|
|
1825
|
+
type: Component,
|
|
1826
|
+
args: [{
|
|
1827
|
+
selector: 'sky-list-secondary-action',
|
|
1828
|
+
templateUrl: './list-secondary-action.component.html',
|
|
1829
|
+
}]
|
|
1830
|
+
}], ctorParameters: function () { return [{ type: SkyListSecondaryActionsService }]; }, propDecorators: { templateRef: [{
|
|
1831
|
+
type: ViewChild,
|
|
1832
|
+
args: ['listSecondaryAction', {
|
|
1833
|
+
read: TemplateRef,
|
|
1834
|
+
static: true,
|
|
1835
|
+
}]
|
|
1836
|
+
}] } });
|
|
1837
|
+
|
|
1806
1838
|
// Note: this component is needed to ensure any reactive styles placed in the element have
|
|
1807
1839
|
// their host to be based off of. Without this component the host is not written via the dispatcher.
|
|
1808
1840
|
/**
|
|
@@ -1881,71 +1913,207 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1881
1913
|
}]
|
|
1882
1914
|
}] } });
|
|
1883
1915
|
|
|
1916
|
+
class SkyListSecondaryActionsModule {
|
|
1917
|
+
}
|
|
1918
|
+
SkyListSecondaryActionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1919
|
+
SkyListSecondaryActionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, declarations: [SkyListSecondaryActionsComponent,
|
|
1920
|
+
SkyListSecondaryActionsHostComponent,
|
|
1921
|
+
SkyListSecondaryActionComponent], imports: [CommonModule,
|
|
1922
|
+
SkyDropdownModule,
|
|
1923
|
+
SkyI18nModule,
|
|
1924
|
+
SkyIconModule,
|
|
1925
|
+
SkyListBuilderResourcesModule], exports: [SkyListSecondaryActionsComponent, SkyListSecondaryActionComponent] });
|
|
1926
|
+
SkyListSecondaryActionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, imports: [[
|
|
1927
|
+
CommonModule,
|
|
1928
|
+
SkyDropdownModule,
|
|
1929
|
+
SkyI18nModule,
|
|
1930
|
+
SkyIconModule,
|
|
1931
|
+
SkyListBuilderResourcesModule,
|
|
1932
|
+
]] });
|
|
1933
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, decorators: [{
|
|
1934
|
+
type: NgModule,
|
|
1935
|
+
args: [{
|
|
1936
|
+
declarations: [
|
|
1937
|
+
SkyListSecondaryActionsComponent,
|
|
1938
|
+
SkyListSecondaryActionsHostComponent,
|
|
1939
|
+
SkyListSecondaryActionComponent,
|
|
1940
|
+
],
|
|
1941
|
+
imports: [
|
|
1942
|
+
CommonModule,
|
|
1943
|
+
SkyDropdownModule,
|
|
1944
|
+
SkyI18nModule,
|
|
1945
|
+
SkyIconModule,
|
|
1946
|
+
SkyListBuilderResourcesModule,
|
|
1947
|
+
],
|
|
1948
|
+
exports: [SkyListSecondaryActionsComponent, SkyListSecondaryActionComponent],
|
|
1949
|
+
}]
|
|
1950
|
+
}] });
|
|
1951
|
+
|
|
1884
1952
|
/**
|
|
1885
|
-
*
|
|
1953
|
+
* @internal
|
|
1886
1954
|
*/
|
|
1887
|
-
class
|
|
1888
|
-
|
|
1889
|
-
this.
|
|
1955
|
+
class SkyListToolbarItemRendererComponent {
|
|
1956
|
+
ngOnInit() {
|
|
1957
|
+
if (this.template !== undefined) {
|
|
1958
|
+
this.container.createEmbeddedView(this.template, this);
|
|
1959
|
+
}
|
|
1890
1960
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1961
|
+
}
|
|
1962
|
+
SkyListToolbarItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1963
|
+
SkyListToolbarItemRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListToolbarItemRendererComponent, selector: "sky-list-toolbar-item-renderer", inputs: { template: "template" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #container></ng-template>', isInline: true });
|
|
1964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, decorators: [{
|
|
1965
|
+
type: Component,
|
|
1966
|
+
args: [{
|
|
1967
|
+
selector: 'sky-list-toolbar-item-renderer',
|
|
1968
|
+
template: '<ng-template #container></ng-template>',
|
|
1969
|
+
}]
|
|
1970
|
+
}], propDecorators: { template: [{
|
|
1971
|
+
type: Input
|
|
1972
|
+
}], container: [{
|
|
1973
|
+
type: ViewChild,
|
|
1974
|
+
args: ['container', {
|
|
1975
|
+
read: ViewContainerRef,
|
|
1976
|
+
static: true,
|
|
1977
|
+
}]
|
|
1978
|
+
}] } });
|
|
1979
|
+
|
|
1980
|
+
let uniqueId = 0;
|
|
1981
|
+
/**
|
|
1982
|
+
* @internal
|
|
1983
|
+
*/
|
|
1984
|
+
class SkyListMultiselectToolbarComponent {
|
|
1985
|
+
constructor(state, dispatcher) {
|
|
1986
|
+
this.state = state;
|
|
1987
|
+
this.dispatcher = dispatcher;
|
|
1988
|
+
this.showOnlySelected = false;
|
|
1989
|
+
this.multiselectToolbarId = `sky-list-multiselect-toolbar-${uniqueId++}`;
|
|
1990
|
+
this.selectedIdMap = new Map();
|
|
1991
|
+
this.ngUnsubscribe = new Subject();
|
|
1992
|
+
}
|
|
1993
|
+
ngOnInit() {
|
|
1994
|
+
this.state
|
|
1995
|
+
.pipe(map((t) => t.selected.item), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.selectedMapEqual))
|
|
1996
|
+
.subscribe((model) => {
|
|
1997
|
+
this.selectedIdMap = model.selectedIdMap;
|
|
1998
|
+
if (this.showOnlySelected) {
|
|
1999
|
+
this.reapplyFilter(true);
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
2002
|
+
// If 'show-selected' filter is programatically set from a child component (e.g. checkilst),
|
|
2003
|
+
// make sure the checked state of the 'show-selected' checkbox stays in sync.
|
|
2004
|
+
this.state
|
|
2005
|
+
.pipe(map((t) => t.filters), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.showSelectedValuesEqual))
|
|
2006
|
+
.subscribe((filters) => {
|
|
2007
|
+
const showSelectedFilter = filters.find((filter) => filter.name === 'show-selected');
|
|
2008
|
+
if (showSelectedFilter) {
|
|
2009
|
+
this.showOnlySelected = showSelectedFilter.value === 'true';
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
ngOnDestroy() {
|
|
2014
|
+
this.ngUnsubscribe.next();
|
|
2015
|
+
this.ngUnsubscribe.complete();
|
|
2016
|
+
}
|
|
2017
|
+
selectAll() {
|
|
2018
|
+
this.state
|
|
2019
|
+
.pipe(map((state) => state.items.items), take(1))
|
|
2020
|
+
.subscribe((items) => {
|
|
2021
|
+
this.dispatcher.setSelected(items.map((item) => item.id), true);
|
|
2022
|
+
if (this.showOnlySelected) {
|
|
2023
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
clearSelections() {
|
|
2028
|
+
this.state
|
|
2029
|
+
.pipe(map((state) => state.items.items), take(1))
|
|
2030
|
+
.subscribe((items) => {
|
|
2031
|
+
this.dispatcher.setSelected(items.map((item) => item.id), false);
|
|
2032
|
+
if (this.showOnlySelected) {
|
|
2033
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
changeVisibleItems(change) {
|
|
2038
|
+
this.showOnlySelected = change.checked;
|
|
2039
|
+
this.reapplyFilter(change.checked);
|
|
2040
|
+
}
|
|
2041
|
+
reapplyFilter(isSelected) {
|
|
2042
|
+
this.state
|
|
2043
|
+
.pipe(map((state) => state.filters), take(1))
|
|
2044
|
+
.subscribe((filters) => {
|
|
2045
|
+
filters = filters.filter((filter) => filter.name !== 'show-selected');
|
|
2046
|
+
filters.push(this.getShowSelectedFilter(isSelected));
|
|
2047
|
+
this.dispatcher.filtersUpdate(filters);
|
|
2048
|
+
});
|
|
2049
|
+
// If "show selected" is checked and paging is enabled, go to page one.
|
|
2050
|
+
/* istanbul ignore else */
|
|
2051
|
+
if (isSelected) {
|
|
2052
|
+
this.state.pipe(take(1)).subscribe((currentState) => {
|
|
2053
|
+
if (currentState.paging.pageNumber &&
|
|
2054
|
+
currentState.paging.pageNumber !== 1) {
|
|
2055
|
+
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
2056
|
+
}
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
this.dispatcher.toolbarSetDisabled(isSelected);
|
|
2060
|
+
}
|
|
2061
|
+
getShowSelectedFilter(isSelected) {
|
|
2062
|
+
return new ListFilterModel({
|
|
2063
|
+
name: 'show-selected',
|
|
2064
|
+
value: isSelected.toString(),
|
|
2065
|
+
filterFunction: (model, showOnlySelected) => {
|
|
2066
|
+
/* istanbul ignore else */
|
|
2067
|
+
if (showOnlySelected.toString() !== false.toString()) {
|
|
2068
|
+
return this.selectedIdMap.get(model.id);
|
|
2069
|
+
}
|
|
2070
|
+
},
|
|
2071
|
+
defaultValue: false.toString(),
|
|
1894
2072
|
});
|
|
1895
2073
|
}
|
|
2074
|
+
showSelectedValuesEqual(prev, next) {
|
|
2075
|
+
const prevShowSelectedFilter = prev.find((filter) => filter.name === 'show-selected');
|
|
2076
|
+
const nextShowSelectedFilter = next.find((filter) => filter.name === 'show-selected');
|
|
2077
|
+
// Both undefined.
|
|
2078
|
+
if (!prevShowSelectedFilter && !nextShowSelectedFilter) {
|
|
2079
|
+
return true;
|
|
2080
|
+
}
|
|
2081
|
+
// Only one undefined.
|
|
2082
|
+
if ((prevShowSelectedFilter && !nextShowSelectedFilter) ||
|
|
2083
|
+
(!prevShowSelectedFilter && nextShowSelectedFilter)) {
|
|
2084
|
+
return false;
|
|
2085
|
+
}
|
|
2086
|
+
// Defined, but with different "value".
|
|
2087
|
+
return prevShowSelectedFilter.value === nextShowSelectedFilter.value;
|
|
2088
|
+
}
|
|
2089
|
+
selectedMapEqual(prev, next) {
|
|
2090
|
+
if (prev.selectedIdMap.size !== next.selectedIdMap.size) {
|
|
2091
|
+
return false;
|
|
2092
|
+
}
|
|
2093
|
+
for (let i = 0; i < next.selectedIdMap.size; i++) {
|
|
2094
|
+
const key = Array.from(next.selectedIdMap.keys())[i];
|
|
2095
|
+
const value = next.selectedIdMap.get(key);
|
|
2096
|
+
/* istanbul ignore next */
|
|
2097
|
+
if (value !== prev.selectedIdMap.get(key)) {
|
|
2098
|
+
return false;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
return true;
|
|
2102
|
+
}
|
|
1896
2103
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
2104
|
+
SkyListMultiselectToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListMultiselectToolbarComponent, deps: [{ token: ListState }, { token: ListStateDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
2105
|
+
SkyListMultiselectToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListMultiselectToolbarComponent, selector: "sky-list-multiselect-toolbar", inputs: { showOnlySelected: "showOnlySelected" }, ngImport: i0, template: "<sky-toolbar class=\"sky-list-multiselect-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer [template]=\"selectAllTemplate\">\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer [template]=\"clearSelectionsTemplate\">\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <ng-container *ngTemplateOutlet=\"showSelectedTemplate\"></ng-container>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n</sky-toolbar>\n\n<ng-template #selectAllTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-select-all'\"\n (click)=\"selectAll(); $event.preventDefault()\"\n >\n {{ 'skyux_list_mutliselect_select_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #clearSelectionsTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-clear-all'\"\n (click)=\"clearSelections(); $event.preventDefault()\"\n >\n {{ 'skyux_list_multiselect_clear_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #showSelectedTemplate>\n <sky-checkbox\n [attr.id]=\"multiselectToolbarId + '-show-selected'\"\n [checked]=\"showOnlySelected\"\n (change)=\"changeVisibleItems($event)\"\n >\n <sky-checkbox-label>\n {{ 'skyux_list_mutliselect_show_selected' | skyLibResources }}\n </sky-checkbox-label>\n </sky-checkbox>\n</ng-template>\n", styles: [":host-context(sky-toolbar +) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container,:host-context(.sky-list-toolbar-search +) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container{border-top:none}\n"], components: [{ type: i3$2.λ37, selector: "sky-toolbar" }, { type: i3$2.λ38, selector: "sky-toolbar-section" }, { type: i3$2.λ39, selector: "sky-toolbar-item" }, { type: SkyListToolbarItemRendererComponent, selector: "sky-list-toolbar-item-renderer", inputs: ["template"] }, { type: i3$2.λ40, selector: "sky-toolbar-view-actions" }, { type: i5$1.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i5$1.λ4, selector: "sky-checkbox-label" }], directives: [{ type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe } });
|
|
2106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListMultiselectToolbarComponent, decorators: [{
|
|
1900
2107
|
type: Component,
|
|
1901
2108
|
args: [{
|
|
1902
|
-
selector: 'sky-list-
|
|
1903
|
-
templateUrl: './list-
|
|
2109
|
+
selector: 'sky-list-multiselect-toolbar',
|
|
2110
|
+
templateUrl: './list-multiselect-toolbar.component.html',
|
|
2111
|
+
styleUrls: ['./list-multiselect-toolbar.component.scss'],
|
|
1904
2112
|
}]
|
|
1905
|
-
}], ctorParameters: function () { return [{ type:
|
|
1906
|
-
type:
|
|
1907
|
-
args: ['listSecondaryAction', {
|
|
1908
|
-
read: TemplateRef,
|
|
1909
|
-
static: true,
|
|
1910
|
-
}]
|
|
2113
|
+
}], ctorParameters: function () { return [{ type: ListState }, { type: ListStateDispatcher }]; }, propDecorators: { showOnlySelected: [{
|
|
2114
|
+
type: Input
|
|
1911
2115
|
}] } });
|
|
1912
2116
|
|
|
1913
|
-
class SkyListSecondaryActionsModule {
|
|
1914
|
-
}
|
|
1915
|
-
SkyListSecondaryActionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1916
|
-
SkyListSecondaryActionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, declarations: [SkyListSecondaryActionsComponent,
|
|
1917
|
-
SkyListSecondaryActionsHostComponent,
|
|
1918
|
-
SkyListSecondaryActionComponent], imports: [CommonModule,
|
|
1919
|
-
SkyDropdownModule,
|
|
1920
|
-
SkyI18nModule,
|
|
1921
|
-
SkyIconModule,
|
|
1922
|
-
SkyListBuilderResourcesModule], exports: [SkyListSecondaryActionsComponent, SkyListSecondaryActionComponent] });
|
|
1923
|
-
SkyListSecondaryActionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, imports: [[
|
|
1924
|
-
CommonModule,
|
|
1925
|
-
SkyDropdownModule,
|
|
1926
|
-
SkyI18nModule,
|
|
1927
|
-
SkyIconModule,
|
|
1928
|
-
SkyListBuilderResourcesModule,
|
|
1929
|
-
]] });
|
|
1930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionsModule, decorators: [{
|
|
1931
|
-
type: NgModule,
|
|
1932
|
-
args: [{
|
|
1933
|
-
declarations: [
|
|
1934
|
-
SkyListSecondaryActionsComponent,
|
|
1935
|
-
SkyListSecondaryActionsHostComponent,
|
|
1936
|
-
SkyListSecondaryActionComponent,
|
|
1937
|
-
],
|
|
1938
|
-
imports: [
|
|
1939
|
-
CommonModule,
|
|
1940
|
-
SkyDropdownModule,
|
|
1941
|
-
SkyI18nModule,
|
|
1942
|
-
SkyIconModule,
|
|
1943
|
-
SkyListBuilderResourcesModule,
|
|
1944
|
-
],
|
|
1945
|
-
exports: [SkyListSecondaryActionsComponent, SkyListSecondaryActionComponent],
|
|
1946
|
-
}]
|
|
1947
|
-
}] });
|
|
1948
|
-
|
|
1949
2117
|
let idIndex = 0;
|
|
1950
2118
|
/**
|
|
1951
2119
|
* Defines a toolbar item for the list toolbar.
|
|
@@ -1991,6 +2159,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1991
2159
|
args: [TemplateRef]
|
|
1992
2160
|
}] } });
|
|
1993
2161
|
|
|
2162
|
+
/**
|
|
2163
|
+
* Displays custom actions in the toolbar beside to the search bar.
|
|
2164
|
+
*/
|
|
2165
|
+
class SkyListToolbarSearchActionsComponent {
|
|
2166
|
+
}
|
|
2167
|
+
SkyListToolbarSearchActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2168
|
+
SkyListToolbarSearchActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListToolbarSearchActionsComponent, selector: "sky-list-toolbar-search-actions", ngImport: i0, template: "<div class=\"sky-list-toolbar-search-actions\">\n <ng-content></ng-content>\n</div>\n", styles: [".sky-list-toolbar-search-actions{margin-left:10px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, decorators: [{
|
|
2170
|
+
type: Component,
|
|
2171
|
+
args: [{
|
|
2172
|
+
selector: 'sky-list-toolbar-search-actions',
|
|
2173
|
+
templateUrl: './list-toolbar-search-actions.component.html',
|
|
2174
|
+
styleUrls: ['./list-toolbar-search-actions.component.scss'],
|
|
2175
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2176
|
+
}]
|
|
2177
|
+
}] });
|
|
2178
|
+
|
|
1994
2179
|
/**
|
|
1995
2180
|
* Adds a sort dropdown to the list toolbar.
|
|
1996
2181
|
*/
|
|
@@ -2123,172 +2308,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2123
2308
|
type: Injectable
|
|
2124
2309
|
}], ctorParameters: function () { return [{ type: ListToolbarStateModel }, { type: ListToolbarStateDispatcher }]; } });
|
|
2125
2310
|
|
|
2126
|
-
/**
|
|
2127
|
-
* @internal
|
|
2128
|
-
*/
|
|
2129
|
-
class SkyListToolbarItemRendererComponent {
|
|
2130
|
-
ngOnInit() {
|
|
2131
|
-
if (this.template !== undefined) {
|
|
2132
|
-
this.container.createEmbeddedView(this.template, this);
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
SkyListToolbarItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2137
|
-
SkyListToolbarItemRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListToolbarItemRendererComponent, selector: "sky-list-toolbar-item-renderer", inputs: { template: "template" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: '<ng-template #container></ng-template>', isInline: true });
|
|
2138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, decorators: [{
|
|
2139
|
-
type: Component,
|
|
2140
|
-
args: [{
|
|
2141
|
-
selector: 'sky-list-toolbar-item-renderer',
|
|
2142
|
-
template: '<ng-template #container></ng-template>',
|
|
2143
|
-
}]
|
|
2144
|
-
}], propDecorators: { template: [{
|
|
2145
|
-
type: Input
|
|
2146
|
-
}], container: [{
|
|
2147
|
-
type: ViewChild,
|
|
2148
|
-
args: ['container', {
|
|
2149
|
-
read: ViewContainerRef,
|
|
2150
|
-
static: true,
|
|
2151
|
-
}]
|
|
2152
|
-
}] } });
|
|
2153
|
-
|
|
2154
|
-
let uniqueId = 0;
|
|
2155
|
-
/**
|
|
2156
|
-
* @internal
|
|
2157
|
-
*/
|
|
2158
|
-
class SkyListMultiselectToolbarComponent {
|
|
2159
|
-
constructor(state, dispatcher) {
|
|
2160
|
-
this.state = state;
|
|
2161
|
-
this.dispatcher = dispatcher;
|
|
2162
|
-
this.showOnlySelected = false;
|
|
2163
|
-
this.multiselectToolbarId = `sky-list-multiselect-toolbar-${uniqueId++}`;
|
|
2164
|
-
this.selectedIdMap = new Map();
|
|
2165
|
-
this.ngUnsubscribe = new Subject();
|
|
2166
|
-
}
|
|
2167
|
-
ngOnInit() {
|
|
2168
|
-
this.state
|
|
2169
|
-
.pipe(map((t) => t.selected.item), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.selectedMapEqual))
|
|
2170
|
-
.subscribe((model) => {
|
|
2171
|
-
this.selectedIdMap = model.selectedIdMap;
|
|
2172
|
-
if (this.showOnlySelected) {
|
|
2173
|
-
this.reapplyFilter(true);
|
|
2174
|
-
}
|
|
2175
|
-
});
|
|
2176
|
-
// If 'show-selected' filter is programatically set from a child component (e.g. checkilst),
|
|
2177
|
-
// make sure the checked state of the 'show-selected' checkbox stays in sync.
|
|
2178
|
-
this.state
|
|
2179
|
-
.pipe(map((t) => t.filters), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.showSelectedValuesEqual))
|
|
2180
|
-
.subscribe((filters) => {
|
|
2181
|
-
const showSelectedFilter = filters.find((filter) => filter.name === 'show-selected');
|
|
2182
|
-
if (showSelectedFilter) {
|
|
2183
|
-
this.showOnlySelected = showSelectedFilter.value === 'true';
|
|
2184
|
-
}
|
|
2185
|
-
});
|
|
2186
|
-
}
|
|
2187
|
-
ngOnDestroy() {
|
|
2188
|
-
this.ngUnsubscribe.next();
|
|
2189
|
-
this.ngUnsubscribe.complete();
|
|
2190
|
-
}
|
|
2191
|
-
selectAll() {
|
|
2192
|
-
this.state
|
|
2193
|
-
.pipe(map((state) => state.items.items), take(1))
|
|
2194
|
-
.subscribe((items) => {
|
|
2195
|
-
this.dispatcher.setSelected(items.map((item) => item.id), true);
|
|
2196
|
-
if (this.showOnlySelected) {
|
|
2197
|
-
this.reapplyFilter(this.showOnlySelected);
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
clearSelections() {
|
|
2202
|
-
this.state
|
|
2203
|
-
.pipe(map((state) => state.items.items), take(1))
|
|
2204
|
-
.subscribe((items) => {
|
|
2205
|
-
this.dispatcher.setSelected(items.map((item) => item.id), false);
|
|
2206
|
-
if (this.showOnlySelected) {
|
|
2207
|
-
this.reapplyFilter(this.showOnlySelected);
|
|
2208
|
-
}
|
|
2209
|
-
});
|
|
2210
|
-
}
|
|
2211
|
-
changeVisibleItems(change) {
|
|
2212
|
-
this.showOnlySelected = change.checked;
|
|
2213
|
-
this.reapplyFilter(change.checked);
|
|
2214
|
-
}
|
|
2215
|
-
reapplyFilter(isSelected) {
|
|
2216
|
-
let self = this;
|
|
2217
|
-
this.state
|
|
2218
|
-
.pipe(map((state) => state.filters), take(1))
|
|
2219
|
-
.subscribe((filters) => {
|
|
2220
|
-
filters = filters.filter((filter) => filter.name !== 'show-selected');
|
|
2221
|
-
filters.push(self.getShowSelectedFilter(isSelected));
|
|
2222
|
-
this.dispatcher.filtersUpdate(filters);
|
|
2223
|
-
});
|
|
2224
|
-
// If "show selected" is checked and paging is enabled, go to page one.
|
|
2225
|
-
/* istanbul ignore else */
|
|
2226
|
-
if (isSelected) {
|
|
2227
|
-
this.state.pipe(take(1)).subscribe((currentState) => {
|
|
2228
|
-
if (currentState.paging.pageNumber &&
|
|
2229
|
-
currentState.paging.pageNumber !== 1) {
|
|
2230
|
-
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
2231
|
-
}
|
|
2232
|
-
});
|
|
2233
|
-
}
|
|
2234
|
-
this.dispatcher.toolbarSetDisabled(isSelected);
|
|
2235
|
-
}
|
|
2236
|
-
getShowSelectedFilter(isSelected) {
|
|
2237
|
-
return new ListFilterModel({
|
|
2238
|
-
name: 'show-selected',
|
|
2239
|
-
value: isSelected.toString(),
|
|
2240
|
-
filterFunction: (model, showOnlySelected) => {
|
|
2241
|
-
/* istanbul ignore else */
|
|
2242
|
-
if (showOnlySelected.toString() !== false.toString()) {
|
|
2243
|
-
return this.selectedIdMap.get(model.id);
|
|
2244
|
-
}
|
|
2245
|
-
},
|
|
2246
|
-
defaultValue: false.toString(),
|
|
2247
|
-
});
|
|
2248
|
-
}
|
|
2249
|
-
showSelectedValuesEqual(prev, next) {
|
|
2250
|
-
const prevShowSelectedFilter = prev.find((filter) => filter.name === 'show-selected');
|
|
2251
|
-
const nextShowSelectedFilter = next.find((filter) => filter.name === 'show-selected');
|
|
2252
|
-
// Both undefined.
|
|
2253
|
-
if (!prevShowSelectedFilter && !nextShowSelectedFilter) {
|
|
2254
|
-
return true;
|
|
2255
|
-
}
|
|
2256
|
-
// Only one undefined.
|
|
2257
|
-
if ((prevShowSelectedFilter && !nextShowSelectedFilter) ||
|
|
2258
|
-
(!prevShowSelectedFilter && nextShowSelectedFilter)) {
|
|
2259
|
-
return false;
|
|
2260
|
-
}
|
|
2261
|
-
// Defined, but with different "value".
|
|
2262
|
-
return prevShowSelectedFilter.value === nextShowSelectedFilter.value;
|
|
2263
|
-
}
|
|
2264
|
-
selectedMapEqual(prev, next) {
|
|
2265
|
-
if (prev.selectedIdMap.size !== next.selectedIdMap.size) {
|
|
2266
|
-
return false;
|
|
2267
|
-
}
|
|
2268
|
-
for (let i = 0; i < next.selectedIdMap.size; i++) {
|
|
2269
|
-
const key = Array.from(next.selectedIdMap.keys())[i];
|
|
2270
|
-
const value = next.selectedIdMap.get(key);
|
|
2271
|
-
/* istanbul ignore next */
|
|
2272
|
-
if (value !== prev.selectedIdMap.get(key)) {
|
|
2273
|
-
return false;
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
return true;
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
SkyListMultiselectToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListMultiselectToolbarComponent, deps: [{ token: ListState }, { token: ListStateDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
2280
|
-
SkyListMultiselectToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListMultiselectToolbarComponent, selector: "sky-list-multiselect-toolbar", inputs: { showOnlySelected: "showOnlySelected" }, ngImport: i0, template: "<sky-toolbar class=\"sky-list-multiselect-toolbar\">\n <sky-toolbar-section>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer [template]=\"selectAllTemplate\">\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-item>\n <sky-list-toolbar-item-renderer [template]=\"clearSelectionsTemplate\">\n </sky-list-toolbar-item-renderer>\n </sky-toolbar-item>\n <sky-toolbar-view-actions>\n <ng-container *ngTemplateOutlet=\"showSelectedTemplate\"></ng-container>\n </sky-toolbar-view-actions>\n </sky-toolbar-section>\n</sky-toolbar>\n\n<ng-template #selectAllTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-select-all'\"\n (click)=\"selectAll(); $event.preventDefault()\"\n >\n {{ 'skyux_list_mutliselect_select_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #clearSelectionsTemplate>\n <button\n class=\"sky-btn sky-btn-link\"\n type=\"button\"\n [attr.id]=\"multiselectToolbarId + '-clear-all'\"\n (click)=\"clearSelections(); $event.preventDefault()\"\n >\n {{ 'skyux_list_multiselect_clear_all' | skyLibResources }}\n </button>\n</ng-template>\n\n<ng-template #showSelectedTemplate>\n <sky-checkbox\n [attr.id]=\"multiselectToolbarId + '-show-selected'\"\n [checked]=\"showOnlySelected\"\n (change)=\"changeVisibleItems($event)\"\n >\n <sky-checkbox-label>\n {{ 'skyux_list_mutliselect_show_selected' | skyLibResources }}\n </sky-checkbox-label>\n </sky-checkbox>\n</ng-template>\n", styles: [":host-context(sky-toolbar +) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container,:host-context(.sky-list-toolbar-search +) .sky-list-multiselect-toolbar ::ng-deep .sky-toolbar-container{border-top:none}\n"], components: [{ type: i3$2.λ37, selector: "sky-toolbar" }, { type: i3$2.λ38, selector: "sky-toolbar-section" }, { type: i3$2.λ39, selector: "sky-toolbar-item" }, { type: SkyListToolbarItemRendererComponent, selector: "sky-list-toolbar-item-renderer", inputs: ["template"] }, { type: i3$2.λ40, selector: "sky-toolbar-view-actions" }, { type: i5$1.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "icon", "checkboxType", "checked", "required"], outputs: ["change", "checkedChange", "disabledChange"] }, { type: i5$1.λ4, selector: "sky-checkbox-label" }], directives: [{ type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe } });
|
|
2281
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListMultiselectToolbarComponent, decorators: [{
|
|
2282
|
-
type: Component,
|
|
2283
|
-
args: [{
|
|
2284
|
-
selector: 'sky-list-multiselect-toolbar',
|
|
2285
|
-
templateUrl: './list-multiselect-toolbar.component.html',
|
|
2286
|
-
styleUrls: ['./list-multiselect-toolbar.component.scss'],
|
|
2287
|
-
}]
|
|
2288
|
-
}], ctorParameters: function () { return [{ type: ListState }, { type: ListStateDispatcher }]; }, propDecorators: { showOnlySelected: [{
|
|
2289
|
-
type: Input
|
|
2290
|
-
}] } });
|
|
2291
|
-
|
|
2292
2311
|
let nextId = 0;
|
|
2293
2312
|
/**
|
|
2294
2313
|
* Displays a toolbar for a SKY UX-themed list of data.
|
|
@@ -2408,7 +2427,7 @@ class SkyListToolbarComponent {
|
|
|
2408
2427
|
this.isSortSelectorEnabled = this.toolbarState.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.config), distinctUntilChanged(), map((c) => c.sortSelectorEnabled));
|
|
2409
2428
|
this.isMultiselectEnabled = this.state.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.toolbar), distinctUntilChanged(), map((t) => t.showMultiselectToolbar));
|
|
2410
2429
|
this.hasAppliedFilters = this.state.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.filters), distinctUntilChanged(), map((filters) => {
|
|
2411
|
-
|
|
2430
|
+
const activeFilters = filters.filter((f) => {
|
|
2412
2431
|
return (f.value !== '' &&
|
|
2413
2432
|
f.value !== undefined &&
|
|
2414
2433
|
f.value !== false &&
|
|
@@ -2505,10 +2524,10 @@ class SkyListToolbarComponent {
|
|
|
2505
2524
|
getSortSelectors() {
|
|
2506
2525
|
return combineLatest(this.state.pipe(map((s) => s.sort.available), distinctUntilChanged()), this.state.pipe(map((s) => s.sort.global), distinctUntilChanged()), this.state.pipe(map((s) => s.sort.fieldSelectors), distinctUntilChanged()), (available, global, fieldSelectors) => {
|
|
2507
2526
|
// Get sorts that are in the global that are not in the available
|
|
2508
|
-
|
|
2527
|
+
const sorts = global.filter((g) => available.filter((a) => a.fieldSelector === g.fieldSelector)
|
|
2509
2528
|
.length === 0);
|
|
2510
|
-
|
|
2511
|
-
|
|
2529
|
+
const resultSortSelectors = [...sorts, ...available].map((sortLabels) => {
|
|
2530
|
+
const fs = fieldSelectors.filter((f) => {
|
|
2512
2531
|
return (f.fieldSelector === sortLabels.fieldSelector &&
|
|
2513
2532
|
f.descending === sortLabels.descending);
|
|
2514
2533
|
});
|
|
@@ -2617,23 +2636,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2617
2636
|
}]
|
|
2618
2637
|
}] } });
|
|
2619
2638
|
|
|
2620
|
-
/**
|
|
2621
|
-
* Displays custom actions in the toolbar beside to the search bar.
|
|
2622
|
-
*/
|
|
2623
|
-
class SkyListToolbarSearchActionsComponent {
|
|
2624
|
-
}
|
|
2625
|
-
SkyListToolbarSearchActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2626
|
-
SkyListToolbarSearchActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyListToolbarSearchActionsComponent, selector: "sky-list-toolbar-search-actions", ngImport: i0, template: "<div class=\"sky-list-toolbar-search-actions\">\n <ng-content></ng-content>\n</div>\n", styles: [".sky-list-toolbar-search-actions{margin-left:10px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2627
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, decorators: [{
|
|
2628
|
-
type: Component,
|
|
2629
|
-
args: [{
|
|
2630
|
-
selector: 'sky-list-toolbar-search-actions',
|
|
2631
|
-
templateUrl: './list-toolbar-search-actions.component.html',
|
|
2632
|
-
styleUrls: ['./list-toolbar-search-actions.component.scss'],
|
|
2633
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2634
|
-
}]
|
|
2635
|
-
}] });
|
|
2636
|
-
|
|
2637
2639
|
class SkyListToolbarModule {
|
|
2638
2640
|
}
|
|
2639
2641
|
SkyListToolbarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|