@skyux/list-builder 5.5.0 → 5.6.0
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 +699 -699
- package/documentation.json +123 -123
- package/esm2015/lib/modules/list/list-data-request.model.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.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 -3
- 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 +643 -643
- package/fesm2015/skyux-list-builder.js.map +1 -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 +10 -10
|
@@ -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) {
|
|
@@ -54,81 +54,6 @@ class ListDataProvider {
|
|
|
54
54
|
constructor(data) { }
|
|
55
55
|
}
|
|
56
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
|
-
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;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
57
|
/**
|
|
133
58
|
* Specifies a function to dynamically manage the data source when users change the text
|
|
134
59
|
* in the list field. The search function must return an array or a promise of an array.
|
|
@@ -179,8 +104,8 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
179
104
|
get(request) {
|
|
180
105
|
return this.filteredItems(request).pipe(map((result) => {
|
|
181
106
|
if (request.pageNumber && request.pageSize) {
|
|
182
|
-
|
|
183
|
-
|
|
107
|
+
const itemStart = (request.pageNumber - 1) * request.pageSize;
|
|
108
|
+
const pagedResult = result.slice(itemStart, itemStart + request.pageSize);
|
|
184
109
|
return new ListDataResponseModel({
|
|
185
110
|
count: result.length,
|
|
186
111
|
items: pagedResult,
|
|
@@ -199,7 +124,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
199
124
|
return this.items.pipe(map((items) => {
|
|
200
125
|
let dataChanged = false;
|
|
201
126
|
let search = request.search;
|
|
202
|
-
|
|
127
|
+
const sort = request.sort;
|
|
203
128
|
let filters = request.filters;
|
|
204
129
|
if (this.lastItems === undefined || this.lastItems !== items) {
|
|
205
130
|
dataChanged = true;
|
|
@@ -233,7 +158,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
233
158
|
else if (filters && filters.length > 0) {
|
|
234
159
|
result = result.filter((item) => {
|
|
235
160
|
for (let i = 0; i < filters.length; i++) {
|
|
236
|
-
|
|
161
|
+
const filter = filters[i];
|
|
237
162
|
if (filter.value === undefined ||
|
|
238
163
|
filter.value === '' ||
|
|
239
164
|
filter.value === false ||
|
|
@@ -262,7 +187,7 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
262
187
|
else if (search &&
|
|
263
188
|
search.searchText !== undefined &&
|
|
264
189
|
search.searchText.length > 0) {
|
|
265
|
-
|
|
190
|
+
const searchText = search.searchText.toLowerCase();
|
|
266
191
|
let searchFunctions;
|
|
267
192
|
if (this.searchFunction !== undefined) {
|
|
268
193
|
searchFunctions = [this.searchFunction];
|
|
@@ -273,8 +198,8 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
273
198
|
result = result.filter((item) => {
|
|
274
199
|
let isMatch = false;
|
|
275
200
|
for (let i = 0; i < searchFunctions.length; i++) {
|
|
276
|
-
|
|
277
|
-
|
|
201
|
+
const searchFunction = searchFunctions[i];
|
|
202
|
+
const searchResult = searchFunction(item.data, searchText);
|
|
278
203
|
if ((typeof searchResult === 'string' &&
|
|
279
204
|
searchResult.indexOf(searchText) !== -1) ||
|
|
280
205
|
searchResult === true) {
|
|
@@ -296,9 +221,9 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
296
221
|
.sort((item1, item2) => {
|
|
297
222
|
let compareResult = 0;
|
|
298
223
|
for (let i = 0; i < sort.fieldSelectors.length; i++) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
224
|
+
const selector = sort.fieldSelectors[i];
|
|
225
|
+
const value1 = getData(item1.data, selector.fieldSelector);
|
|
226
|
+
const value2 = getData(item2.data, selector.fieldSelector);
|
|
302
227
|
compareResult = compare(value1, value2);
|
|
303
228
|
if (selector.descending && compareResult !== 0) {
|
|
304
229
|
compareResult *= -1;
|
|
@@ -315,73 +240,51 @@ class SkyListInMemoryDataProvider extends ListDataProvider {
|
|
|
315
240
|
}
|
|
316
241
|
}
|
|
317
242
|
|
|
243
|
+
let idIndex$2 = 0;
|
|
318
244
|
/**
|
|
319
245
|
* @internal
|
|
320
246
|
*/
|
|
321
|
-
class
|
|
322
|
-
constructor(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
247
|
+
class ListViewComponent {
|
|
248
|
+
constructor(state, defaultName) {
|
|
249
|
+
this.viewId = `sky-list-view-cmp-${++idIndex$2}`;
|
|
250
|
+
this.state = state;
|
|
251
|
+
this.viewName = defaultName;
|
|
252
|
+
/* istanbul ignore next */
|
|
253
|
+
this.hasToolbar = this.state.pipe(map((s) => s.toolbar.exists));
|
|
254
|
+
this.active = this.state.pipe(map((s) => s.views.active === this.viewId));
|
|
255
|
+
this.active
|
|
256
|
+
.pipe(distinctUntilChanged())
|
|
257
|
+
.subscribe((isActive) => isActive ? this.onViewActive() : this.onViewInactive());
|
|
329
258
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Contains data about the selected items in the list.
|
|
334
|
-
*/
|
|
335
|
-
class ListSelectedModel {
|
|
336
|
-
constructor() {
|
|
337
|
-
this.selectedIdMap = new Map();
|
|
259
|
+
get id() {
|
|
260
|
+
return this.viewId;
|
|
338
261
|
}
|
|
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
|
-
}
|
|
262
|
+
get label() {
|
|
263
|
+
return this.viewName;
|
|
355
264
|
}
|
|
265
|
+
/* istanbul ignore next */
|
|
266
|
+
onViewActive() { }
|
|
267
|
+
onViewInactive() { }
|
|
356
268
|
}
|
|
357
269
|
|
|
358
270
|
/**
|
|
359
271
|
* @internal
|
|
360
272
|
*/
|
|
361
|
-
class
|
|
362
|
-
constructor(
|
|
363
|
-
this.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
273
|
+
class ListItemsLoadAction {
|
|
274
|
+
constructor(items, refresh = false, dataChanged = true, count) {
|
|
275
|
+
this.items = items;
|
|
276
|
+
this.refresh = refresh;
|
|
277
|
+
this.dataChanged = dataChanged;
|
|
278
|
+
this.count = count;
|
|
368
279
|
}
|
|
369
280
|
}
|
|
370
281
|
|
|
371
282
|
/**
|
|
372
283
|
* @internal
|
|
373
284
|
*/
|
|
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();
|
|
285
|
+
class ListItemsSetLoadingAction {
|
|
286
|
+
constructor(loading = true) {
|
|
287
|
+
this.loading = loading;
|
|
385
288
|
}
|
|
386
289
|
}
|
|
387
290
|
|
|
@@ -397,38 +300,38 @@ class ListFiltersUpdateAction {
|
|
|
397
300
|
/**
|
|
398
301
|
* @internal
|
|
399
302
|
*/
|
|
400
|
-
class
|
|
401
|
-
constructor(
|
|
402
|
-
this.
|
|
303
|
+
class ListSearchSetFieldSelectorsAction {
|
|
304
|
+
constructor(fieldSelectors = []) {
|
|
305
|
+
this.fieldSelectors = fieldSelectors;
|
|
403
306
|
}
|
|
404
307
|
}
|
|
405
308
|
|
|
406
309
|
/**
|
|
407
310
|
* @internal
|
|
408
311
|
*/
|
|
409
|
-
class
|
|
410
|
-
constructor(
|
|
411
|
-
this.
|
|
312
|
+
class ListSearchSetFunctionsAction {
|
|
313
|
+
constructor(functions = []) {
|
|
314
|
+
this.functions = functions;
|
|
412
315
|
}
|
|
413
316
|
}
|
|
414
317
|
|
|
415
318
|
/**
|
|
416
319
|
* @internal
|
|
417
320
|
*/
|
|
418
|
-
class
|
|
419
|
-
constructor(
|
|
420
|
-
this.
|
|
321
|
+
class ListSearchSetOptionsAction {
|
|
322
|
+
constructor(searchTextAction, setFieldSelectorsAction, setFunctionsAction) {
|
|
323
|
+
this.searchTextAction = searchTextAction;
|
|
324
|
+
this.setFieldSelectorsAction = setFieldSelectorsAction;
|
|
325
|
+
this.setFunctionsAction = setFunctionsAction;
|
|
421
326
|
}
|
|
422
327
|
}
|
|
423
328
|
|
|
424
329
|
/**
|
|
425
330
|
* @internal
|
|
426
331
|
*/
|
|
427
|
-
class
|
|
428
|
-
constructor(
|
|
429
|
-
this.
|
|
430
|
-
this.setFieldSelectorsAction = setFieldSelectorsAction;
|
|
431
|
-
this.setFunctionsAction = setFunctionsAction;
|
|
332
|
+
class ListSearchSetSearchTextAction {
|
|
333
|
+
constructor(searchText) {
|
|
334
|
+
this.searchText = searchText;
|
|
432
335
|
}
|
|
433
336
|
}
|
|
434
337
|
|
|
@@ -452,6 +355,15 @@ class ListSortSetAvailableAction {
|
|
|
452
355
|
}
|
|
453
356
|
}
|
|
454
357
|
|
|
358
|
+
/**
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
class ListSortSetFieldSelectorsAction {
|
|
362
|
+
constructor(fieldSelectors) {
|
|
363
|
+
this.fieldSelectors = fieldSelectors;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
455
367
|
/**
|
|
456
368
|
* @internal
|
|
457
369
|
*/
|
|
@@ -624,18 +536,18 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
624
536
|
const resultItems = action.refresh
|
|
625
537
|
? [...newListItems]
|
|
626
538
|
: [...state.items, ...newListItems];
|
|
627
|
-
|
|
539
|
+
const count = action.count === undefined ? resultItems.length : action.count;
|
|
628
540
|
return new AsyncList(resultItems, action.dataChanged ? Date.now() : state.lastUpdate, false, count);
|
|
629
541
|
}
|
|
630
542
|
setItemsSelected(state, action) {
|
|
631
543
|
/* istanbul ignore next */
|
|
632
544
|
const newSelectedIds = action.items || [];
|
|
633
|
-
|
|
545
|
+
const newListItemModels = this.cloneListItemModelArray(state.items);
|
|
634
546
|
if (action.refresh) {
|
|
635
547
|
newListItemModels.forEach((item) => (item.isSelected = undefined));
|
|
636
548
|
}
|
|
637
549
|
newSelectedIds.map((s) => {
|
|
638
|
-
|
|
550
|
+
const newItem = newListItemModels.find((i) => i.id === s);
|
|
639
551
|
/* istanbul ignore next */
|
|
640
552
|
if (newItem) {
|
|
641
553
|
newItem.isSelected = action.selected;
|
|
@@ -644,7 +556,7 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
644
556
|
return new AsyncList(newListItemModels, Date.now(), state.loading, state.count);
|
|
645
557
|
}
|
|
646
558
|
cloneListItemModelArray(source) {
|
|
647
|
-
|
|
559
|
+
const newListItems = [];
|
|
648
560
|
source.forEach((item) => {
|
|
649
561
|
newListItems.push(new ListItemModel(item.id, Object.assign({}, item.data), item.isSelected));
|
|
650
562
|
});
|
|
@@ -655,171 +567,146 @@ class ListItemsOrchestrator extends ListStateOrchestrator {
|
|
|
655
567
|
/**
|
|
656
568
|
* @internal
|
|
657
569
|
*/
|
|
658
|
-
class
|
|
659
|
-
constructor(
|
|
660
|
-
|
|
570
|
+
class ListPagingModel {
|
|
571
|
+
constructor(data) {
|
|
572
|
+
if (data !== undefined) {
|
|
573
|
+
this.itemsPerPage = data.itemsPerPage || 10;
|
|
574
|
+
this.maxDisplayedPages = data.maxDisplayedPages || 5;
|
|
575
|
+
this.pageCount = data.pageCount || 0;
|
|
576
|
+
this.pageNumber = data.pageNumber || 1;
|
|
577
|
+
}
|
|
661
578
|
}
|
|
662
579
|
}
|
|
663
580
|
|
|
664
581
|
/**
|
|
665
|
-
*
|
|
582
|
+
* Contains data about the selected items in the list.
|
|
666
583
|
*/
|
|
667
|
-
class
|
|
668
|
-
constructor(
|
|
669
|
-
this.
|
|
584
|
+
class ListSelectedModel {
|
|
585
|
+
constructor() {
|
|
586
|
+
this.selectedIdMap = new Map();
|
|
670
587
|
}
|
|
671
588
|
}
|
|
672
589
|
|
|
673
590
|
/**
|
|
674
|
-
*
|
|
591
|
+
* Specifies a set of fields to sort by.
|
|
675
592
|
*/
|
|
676
|
-
class
|
|
677
|
-
constructor(
|
|
678
|
-
|
|
593
|
+
class ListSortModel {
|
|
594
|
+
constructor(data) {
|
|
595
|
+
/**
|
|
596
|
+
* Specifies the list of available views to sort.
|
|
597
|
+
*/
|
|
598
|
+
this.available = [];
|
|
599
|
+
/**
|
|
600
|
+
* Specifies whether the sort applies to all list views.
|
|
601
|
+
*/
|
|
602
|
+
this.global = [];
|
|
603
|
+
/**
|
|
604
|
+
* Specifies the fields to sort.
|
|
605
|
+
* For information about `ListSortFieldSelectorModel`, see the
|
|
606
|
+
* [shared classes for lists](https://developer.blackbaud.com/skyux-list-builder-common/docs/list-builder-common).
|
|
607
|
+
*/
|
|
608
|
+
this.fieldSelectors = [];
|
|
609
|
+
if (data) {
|
|
610
|
+
this.available = data.available;
|
|
611
|
+
this.global = data.global;
|
|
612
|
+
this.fieldSelectors = data.fieldSelectors;
|
|
613
|
+
}
|
|
679
614
|
}
|
|
680
615
|
}
|
|
681
616
|
|
|
682
617
|
/**
|
|
683
618
|
* @internal
|
|
684
619
|
*/
|
|
685
|
-
class
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
.
|
|
691
|
-
.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
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) }));
|
|
620
|
+
class ListToolbarModel {
|
|
621
|
+
constructor(data) {
|
|
622
|
+
this.items = [];
|
|
623
|
+
this.showMultiselectToolbar = false;
|
|
624
|
+
if (data) {
|
|
625
|
+
this.exists = data.exists;
|
|
626
|
+
this.disabled = data.disabled;
|
|
627
|
+
this.items = data.items;
|
|
628
|
+
this.type = data.type;
|
|
629
|
+
this.showMultiselectToolbar = data.showMultiselectToolbar;
|
|
630
|
+
}
|
|
701
631
|
}
|
|
702
632
|
}
|
|
703
633
|
|
|
704
634
|
/**
|
|
705
635
|
* @internal
|
|
706
636
|
*/
|
|
707
|
-
class
|
|
708
|
-
constructor(
|
|
709
|
-
this.views =
|
|
637
|
+
class ListViewsModel {
|
|
638
|
+
constructor(data) {
|
|
639
|
+
this.views = [];
|
|
640
|
+
if (data) {
|
|
641
|
+
this.active = data.active;
|
|
642
|
+
this.views = data.views;
|
|
643
|
+
}
|
|
710
644
|
}
|
|
711
645
|
}
|
|
712
646
|
|
|
713
647
|
/**
|
|
714
648
|
* @internal
|
|
715
649
|
*/
|
|
716
|
-
class
|
|
717
|
-
/* istanbul ignore next */
|
|
650
|
+
class ListStateModel {
|
|
718
651
|
constructor() {
|
|
719
|
-
|
|
720
|
-
this.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
652
|
+
this.filters = [];
|
|
653
|
+
this.items = new AsyncList();
|
|
654
|
+
this.paging = new ListPagingModel();
|
|
655
|
+
this.search = new ListSearchModel();
|
|
656
|
+
this.selected = new AsyncItem();
|
|
657
|
+
this.sort = new ListSortModel();
|
|
658
|
+
this.toolbar = new ListToolbarModel();
|
|
659
|
+
this.views = new ListViewsModel();
|
|
660
|
+
this.selected.item = new ListSelectedModel();
|
|
724
661
|
}
|
|
725
|
-
|
|
726
|
-
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* @internal
|
|
666
|
+
*/
|
|
667
|
+
class ListPagingSetItemsPerPageAction {
|
|
668
|
+
constructor(itemsPerPage) {
|
|
669
|
+
this.itemsPerPage = itemsPerPage;
|
|
727
670
|
}
|
|
728
671
|
}
|
|
729
672
|
|
|
730
673
|
/**
|
|
731
674
|
* @internal
|
|
732
675
|
*/
|
|
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
|
-
}
|
|
676
|
+
class ListPagingSetMaxPagesAction {
|
|
677
|
+
constructor(maxPages) {
|
|
678
|
+
this.maxPages = maxPages;
|
|
743
679
|
}
|
|
744
680
|
}
|
|
745
681
|
|
|
746
682
|
/**
|
|
747
683
|
* @internal
|
|
748
684
|
*/
|
|
749
|
-
class
|
|
750
|
-
constructor(
|
|
751
|
-
this.
|
|
685
|
+
class ListPagingSetPageNumberAction {
|
|
686
|
+
constructor(pageNumber) {
|
|
687
|
+
this.pageNumber = pageNumber;
|
|
752
688
|
}
|
|
753
689
|
}
|
|
754
690
|
|
|
755
691
|
/**
|
|
756
692
|
* @internal
|
|
757
693
|
*/
|
|
758
|
-
class
|
|
694
|
+
class ListPagingOrchestrator extends ListStateOrchestrator {
|
|
759
695
|
/* istanbul ignore next */
|
|
760
696
|
constructor() {
|
|
761
697
|
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;
|
|
698
|
+
this.register(ListPagingSetMaxPagesAction, this.setMaxPages)
|
|
699
|
+
.register(ListPagingSetItemsPerPageAction, this.setItemsPerPage)
|
|
700
|
+
.register(ListPagingSetPageNumberAction, this.setPageNumber);
|
|
783
701
|
}
|
|
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;
|
|
702
|
+
setMaxPages(state, action) {
|
|
703
|
+
return new ListPagingModel(Object.assign({}, state, { maxDisplayedPages: Number(action.maxPages) }));
|
|
811
704
|
}
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
newModel.items = newModel.items.filter((item) => {
|
|
815
|
-
return action.ids.indexOf(item.id) === -1;
|
|
816
|
-
});
|
|
817
|
-
return newModel;
|
|
705
|
+
setItemsPerPage(state, action) {
|
|
706
|
+
return new ListPagingModel(Object.assign({}, state, { itemsPerPage: Number(action.itemsPerPage) }));
|
|
818
707
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
newModel.showMultiselectToolbar = action.exists;
|
|
822
|
-
return newModel;
|
|
708
|
+
setPageNumber(state, action) {
|
|
709
|
+
return new ListPagingModel(Object.assign({}, state, { pageNumber: Number(action.pageNumber) }));
|
|
823
710
|
}
|
|
824
711
|
}
|
|
825
712
|
|
|
@@ -864,6 +751,15 @@ class ListSearchOrchestrator extends ListStateOrchestrator {
|
|
|
864
751
|
}
|
|
865
752
|
}
|
|
866
753
|
|
|
754
|
+
/**
|
|
755
|
+
* @internal
|
|
756
|
+
*/
|
|
757
|
+
class ListSelectedLoadAction {
|
|
758
|
+
constructor(items) {
|
|
759
|
+
this.items = items;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
867
763
|
/**
|
|
868
764
|
* @internal
|
|
869
765
|
*/
|
|
@@ -874,6 +770,15 @@ class ListSelectedSetItemSelectedAction {
|
|
|
874
770
|
}
|
|
875
771
|
}
|
|
876
772
|
|
|
773
|
+
/**
|
|
774
|
+
* @internal
|
|
775
|
+
*/
|
|
776
|
+
class ListSelectedSetLoadingAction {
|
|
777
|
+
constructor(loading = true) {
|
|
778
|
+
this.loading = loading;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
877
782
|
/**
|
|
878
783
|
* @internal
|
|
879
784
|
*/
|
|
@@ -915,7 +820,7 @@ class ListSelectedOrchestrator extends ListStateOrchestrator {
|
|
|
915
820
|
return new AsyncItem(newListSelectedModel, state.lastUpdate, state.loading);
|
|
916
821
|
}
|
|
917
822
|
cloneListSelectedModel(source) {
|
|
918
|
-
|
|
823
|
+
const newListItems = new ListSelectedModel();
|
|
919
824
|
newListItems.selectedIdMap = new Map(source.selectedIdMap);
|
|
920
825
|
return newListItems;
|
|
921
826
|
}
|
|
@@ -970,6 +875,128 @@ class ListSortOrchestrator extends ListStateOrchestrator {
|
|
|
970
875
|
}
|
|
971
876
|
}
|
|
972
877
|
|
|
878
|
+
/**
|
|
879
|
+
* @internal
|
|
880
|
+
*/
|
|
881
|
+
class ListToolbarSetTypeAction {
|
|
882
|
+
constructor(type) {
|
|
883
|
+
this.type = type;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* @internal
|
|
889
|
+
*/
|
|
890
|
+
class ListToolbarItemModel {
|
|
891
|
+
constructor(data) {
|
|
892
|
+
this.index = -1;
|
|
893
|
+
if (data) {
|
|
894
|
+
this.index = data.index;
|
|
895
|
+
this.template = data.template;
|
|
896
|
+
this.location = data.location;
|
|
897
|
+
this.view = data.view;
|
|
898
|
+
this.id = data.id;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* @internal
|
|
905
|
+
*/
|
|
906
|
+
class ListToolbarOrchestrator extends ListStateOrchestrator {
|
|
907
|
+
/* istanbul ignore next */
|
|
908
|
+
constructor() {
|
|
909
|
+
super();
|
|
910
|
+
this.register(ListToolbarSetExistsAction, this.setExists)
|
|
911
|
+
.register(ListToolbarItemsDisableAction, this.setDisabled)
|
|
912
|
+
.register(ListToolbarItemsLoadAction, this.load)
|
|
913
|
+
.register(ListToolbarSetTypeAction, this.setType)
|
|
914
|
+
.register(ListToolbarItemsRemoveAction, this.remove)
|
|
915
|
+
.register(ListToolbarShowMultiselectToolbarAction, this.showMultiselectToolbar);
|
|
916
|
+
}
|
|
917
|
+
setExists(state, action) {
|
|
918
|
+
const newModel = new ListToolbarModel(state);
|
|
919
|
+
newModel.exists = action.exists;
|
|
920
|
+
return newModel;
|
|
921
|
+
}
|
|
922
|
+
setDisabled(state, action) {
|
|
923
|
+
const newModel = new ListToolbarModel(state);
|
|
924
|
+
newModel.disabled = action.disable;
|
|
925
|
+
return newModel;
|
|
926
|
+
}
|
|
927
|
+
setType(state, action) {
|
|
928
|
+
const newModel = new ListToolbarModel(state);
|
|
929
|
+
newModel.type = action.type;
|
|
930
|
+
return newModel;
|
|
931
|
+
}
|
|
932
|
+
load(state, action) {
|
|
933
|
+
const newModel = new ListToolbarModel(state);
|
|
934
|
+
const newListItems = action.items.map((item) => {
|
|
935
|
+
/**
|
|
936
|
+
* NOTE: Originally this function went off the action index and item models did not include
|
|
937
|
+
* the index. We changed this but must leave functionality to convert the action index for
|
|
938
|
+
* backwards compatibility.
|
|
939
|
+
*/
|
|
940
|
+
if (!item.index) {
|
|
941
|
+
item.index = action.index;
|
|
942
|
+
}
|
|
943
|
+
return new ListToolbarItemModel(item);
|
|
944
|
+
});
|
|
945
|
+
let items = [...state.items, ...newListItems];
|
|
946
|
+
items = items.sort((a, b) => {
|
|
947
|
+
if (a.index < b.index) {
|
|
948
|
+
return -1;
|
|
949
|
+
}
|
|
950
|
+
else if (a.index > b.index) {
|
|
951
|
+
return 1;
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
return 0;
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
newModel.items = items;
|
|
958
|
+
return newModel;
|
|
959
|
+
}
|
|
960
|
+
remove(state, action) {
|
|
961
|
+
const newModel = new ListToolbarModel(state);
|
|
962
|
+
newModel.items = newModel.items.filter((item) => {
|
|
963
|
+
return action.ids.indexOf(item.id) === -1;
|
|
964
|
+
});
|
|
965
|
+
return newModel;
|
|
966
|
+
}
|
|
967
|
+
showMultiselectToolbar(state, action) {
|
|
968
|
+
const newModel = new ListToolbarModel(state);
|
|
969
|
+
newModel.showMultiselectToolbar = action.exists;
|
|
970
|
+
return newModel;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* @internal
|
|
976
|
+
*/
|
|
977
|
+
class ListViewsLoadAction {
|
|
978
|
+
constructor(views) {
|
|
979
|
+
this.views = views;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* @internal
|
|
985
|
+
*/
|
|
986
|
+
class ListViewsOrchestrator extends ListStateOrchestrator {
|
|
987
|
+
/* istanbul ignore next */
|
|
988
|
+
constructor() {
|
|
989
|
+
super();
|
|
990
|
+
this.register(ListViewsSetActiveAction, this.setActive).register(ListViewsLoadAction, this.load);
|
|
991
|
+
}
|
|
992
|
+
setActive(state, action) {
|
|
993
|
+
return new ListViewsModel(Object.assign({}, state, { active: action.view }));
|
|
994
|
+
}
|
|
995
|
+
load(state, action) {
|
|
996
|
+
return new ListViewsModel(Object.assign({}, state, { views: action.views }));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
973
1000
|
/**
|
|
974
1001
|
* @internal
|
|
975
1002
|
*/
|
|
@@ -993,33 +1020,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
993
1020
|
type: Injectable
|
|
994
1021
|
}], ctorParameters: function () { return [{ type: ListStateDispatcher }]; } });
|
|
995
1022
|
|
|
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
1023
|
/**
|
|
1024
1024
|
* @internal
|
|
1025
1025
|
*/
|
|
@@ -1070,7 +1070,7 @@ class SkyListComponent {
|
|
|
1070
1070
|
this.dataFirstLoad = true;
|
|
1071
1071
|
}
|
|
1072
1072
|
if (this.listViews.length > 0) {
|
|
1073
|
-
|
|
1073
|
+
const defaultView = this.defaultView === undefined
|
|
1074
1074
|
? this.listViews.first
|
|
1075
1075
|
: this.defaultView;
|
|
1076
1076
|
this.dispatcher.next(new ListViewsLoadAction(this.listViews.map((v) => new ListViewModel(v.id, v.label))));
|
|
@@ -1100,7 +1100,7 @@ class SkyListComponent {
|
|
|
1100
1100
|
.pipe(map((current) => current.selected), takeUntil(this.ngUnsubscribe), distinctUntilChanged())
|
|
1101
1101
|
.subscribe((selected) => {
|
|
1102
1102
|
// Update lastSelectedIds to help us retain user selections.
|
|
1103
|
-
|
|
1103
|
+
const selectedIdsList = [];
|
|
1104
1104
|
selected.item.selectedIdMap.forEach((value, key) => {
|
|
1105
1105
|
if (value === true) {
|
|
1106
1106
|
selectedIdsList.push(key);
|
|
@@ -1178,7 +1178,7 @@ class SkyListComponent {
|
|
|
1178
1178
|
// This subject is used to cancel previous request to the list's data provider when a new change
|
|
1179
1179
|
// to the list's state occurs. In a future breaking change this should be replaced or coupled
|
|
1180
1180
|
// with adding a debounce time to the Observable which watches for state changes.
|
|
1181
|
-
|
|
1181
|
+
const cancelLastRequest = new Subject();
|
|
1182
1182
|
return combineLatest([
|
|
1183
1183
|
this.state.pipe(map((s) => s.filters), distinctUntilChanged()),
|
|
1184
1184
|
this.state.pipe(map((s) => s.search), distinctUntilChanged()),
|
|
@@ -1203,7 +1203,7 @@ class SkyListComponent {
|
|
|
1203
1203
|
let response;
|
|
1204
1204
|
if (this.dataFirstLoad) {
|
|
1205
1205
|
this.dataFirstLoad = false;
|
|
1206
|
-
|
|
1206
|
+
const initialItems = itemsData.map((d) => new ListItemModel(d.id || `sky-list-item-model-${++idIndex$1}`, d));
|
|
1207
1207
|
response = of(new ListDataResponseModel({
|
|
1208
1208
|
count: this.initialTotal,
|
|
1209
1209
|
items: initialItems,
|
|
@@ -1249,7 +1249,7 @@ class SkyListComponent {
|
|
|
1249
1249
|
return this.dataProvider.count();
|
|
1250
1250
|
}
|
|
1251
1251
|
getItemsAndRetainSelections(newList, selectedIds) {
|
|
1252
|
-
|
|
1252
|
+
const updatedListModel = newList.slice();
|
|
1253
1253
|
updatedListModel.forEach((item) => {
|
|
1254
1254
|
item.isSelected = selectedIds.indexOf(item.id) > -1 ? true : false;
|
|
1255
1255
|
});
|
|
@@ -1402,54 +1402,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1402
1402
|
}] } });
|
|
1403
1403
|
|
|
1404
1404
|
/**
|
|
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.
|
|
1405
|
+
* @internal
|
|
1409
1406
|
*/
|
|
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);
|
|
1407
|
+
class SkyListFilterInlineItemRendererComponent {
|
|
1408
|
+
ngOnInit() {
|
|
1409
|
+
/* istanbul ignore else */
|
|
1410
|
+
/* sanity check */
|
|
1411
|
+
if (this.template !== undefined) {
|
|
1412
|
+
this.container.createEmbeddedView(this.template, this);
|
|
1413
|
+
}
|
|
1441
1414
|
}
|
|
1442
1415
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1416
|
+
SkyListFilterInlineItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1417
|
+
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 });
|
|
1418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineItemRendererComponent, decorators: [{
|
|
1446
1419
|
type: Component,
|
|
1447
1420
|
args: [{
|
|
1448
|
-
selector: 'sky-list-filter-
|
|
1449
|
-
|
|
1421
|
+
selector: 'sky-list-filter-inline-item-renderer',
|
|
1422
|
+
template: '<ng-template #container></ng-template>',
|
|
1450
1423
|
}]
|
|
1451
|
-
}],
|
|
1452
|
-
type:
|
|
1424
|
+
}], propDecorators: { template: [{
|
|
1425
|
+
type: Input
|
|
1426
|
+
}], filter: [{
|
|
1427
|
+
type: Input
|
|
1428
|
+
}], container: [{
|
|
1429
|
+
type: ViewChild,
|
|
1430
|
+
args: ['container', {
|
|
1431
|
+
read: ViewContainerRef,
|
|
1432
|
+
static: true,
|
|
1433
|
+
}]
|
|
1453
1434
|
}] } });
|
|
1454
1435
|
|
|
1455
1436
|
/**
|
|
@@ -1495,38 +1476,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1495
1476
|
args: [TemplateRef]
|
|
1496
1477
|
}] } });
|
|
1497
1478
|
|
|
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
1479
|
/**
|
|
1531
1480
|
* Creates an inline filter area for the list. Place each filter
|
|
1532
1481
|
* in a `sky-list-filter-inline-item` component.
|
|
@@ -1552,39 +1501,90 @@ class SkyListFilterInlineComponent {
|
|
|
1552
1501
|
this.applyFilters();
|
|
1553
1502
|
});
|
|
1554
1503
|
});
|
|
1555
|
-
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1504
|
+
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1505
|
+
}
|
|
1506
|
+
applyFilters() {
|
|
1507
|
+
this.state.pipe(take(1)).subscribe((currentState) => {
|
|
1508
|
+
if (currentState.paging.pageNumber &&
|
|
1509
|
+
currentState.paging.pageNumber !== 1) {
|
|
1510
|
+
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
1511
|
+
}
|
|
1512
|
+
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
getFilterModelFromInline(inlineFilters) {
|
|
1516
|
+
return inlineFilters.map((filter) => {
|
|
1517
|
+
return new ListFilterModel({
|
|
1518
|
+
name: filter.name,
|
|
1519
|
+
value: filter.value,
|
|
1520
|
+
filterFunction: filter.filterFunction,
|
|
1521
|
+
defaultValue: filter.defaultValue,
|
|
1522
|
+
});
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
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 });
|
|
1527
|
+
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"] }] });
|
|
1528
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterInlineComponent, decorators: [{
|
|
1529
|
+
type: Component,
|
|
1530
|
+
args: [{
|
|
1531
|
+
selector: 'sky-list-filter-inline',
|
|
1532
|
+
templateUrl: './list-filter-inline.component.html',
|
|
1533
|
+
}]
|
|
1534
|
+
}], ctorParameters: function () { return [{ type: ListStateDispatcher }, { type: ListState }]; }, propDecorators: { filters: [{
|
|
1535
|
+
type: ContentChildren,
|
|
1536
|
+
args: [SkyListFilterInlineItemComponent]
|
|
1537
|
+
}] } });
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Creates a filter summary based on the
|
|
1541
|
+
* [list component's](https://developer.blackbaud.com/skyux/components/list/overview#list-properties)
|
|
1542
|
+
* `appliedFilters` property. Place this component within the
|
|
1543
|
+
* [`sky-list-toolbar`](https://developer.blackbaud.com/skyux/components/list/toolbar) component.
|
|
1544
|
+
*/
|
|
1545
|
+
class SkyListFilterSummaryComponent {
|
|
1546
|
+
constructor(state, dispatcher) {
|
|
1547
|
+
this.state = state;
|
|
1548
|
+
this.dispatcher = dispatcher;
|
|
1549
|
+
/**
|
|
1550
|
+
* Emits a `ListFilterModel` when users select a summary item. A common use case is
|
|
1551
|
+
* to open a filter modal when this event is received.
|
|
1552
|
+
*/
|
|
1553
|
+
this.summaryItemClick = new EventEmitter();
|
|
1554
|
+
}
|
|
1555
|
+
ngAfterContentInit() {
|
|
1556
|
+
// The setTimeout here is to ensure we avoid any ExpressionChangedAfterItHasBeenCheckedError issues.
|
|
1557
|
+
setTimeout(() => {
|
|
1558
|
+
this.appliedFilters = this.state.pipe(map((state) => {
|
|
1559
|
+
return state.filters.filter((filter) => {
|
|
1560
|
+
return (filter.value !== '' &&
|
|
1561
|
+
filter.value !== undefined &&
|
|
1562
|
+
filter.value !== false &&
|
|
1563
|
+
filter.value !== filter.defaultValue);
|
|
1564
|
+
});
|
|
1565
|
+
}));
|
|
1566
|
+
});
|
|
1556
1567
|
}
|
|
1557
|
-
|
|
1558
|
-
this.
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
1562
|
-
}
|
|
1563
|
-
this.dispatcher.filtersUpdate(this.getFilterModelFromInline(this.inlineFilters));
|
|
1568
|
+
filterSummaryItemDismiss(index) {
|
|
1569
|
+
this.appliedFilters.pipe(take(1)).subscribe((filters) => {
|
|
1570
|
+
filters.splice(index, 1);
|
|
1571
|
+
this.dispatcher.filtersUpdate(filters.slice());
|
|
1564
1572
|
});
|
|
1565
1573
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
return new ListFilterModel({
|
|
1569
|
-
name: filter.name,
|
|
1570
|
-
value: filter.value,
|
|
1571
|
-
filterFunction: filter.filterFunction,
|
|
1572
|
-
defaultValue: filter.defaultValue,
|
|
1573
|
-
});
|
|
1574
|
-
});
|
|
1574
|
+
filterSummaryItemClick(item) {
|
|
1575
|
+
this.summaryItemClick.emit(item);
|
|
1575
1576
|
}
|
|
1576
1577
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
1578
|
+
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 });
|
|
1579
|
+
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 } });
|
|
1580
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListFilterSummaryComponent, decorators: [{
|
|
1580
1581
|
type: Component,
|
|
1581
1582
|
args: [{
|
|
1582
|
-
selector: 'sky-list-filter-
|
|
1583
|
-
templateUrl: './list-filter-
|
|
1583
|
+
selector: 'sky-list-filter-summary',
|
|
1584
|
+
templateUrl: './list-filter-summary.component.html',
|
|
1584
1585
|
}]
|
|
1585
|
-
}], ctorParameters: function () { return [{ type:
|
|
1586
|
-
type:
|
|
1587
|
-
args: [SkyListFilterInlineItemComponent]
|
|
1586
|
+
}], ctorParameters: function () { return [{ type: ListState }, { type: ListStateDispatcher }]; }, propDecorators: { summaryItemClick: [{
|
|
1587
|
+
type: Output
|
|
1588
1588
|
}] } });
|
|
1589
1589
|
|
|
1590
1590
|
class SkyListFiltersModule {
|
|
@@ -1803,6 +1803,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1803
1803
|
type: Injectable
|
|
1804
1804
|
}] });
|
|
1805
1805
|
|
|
1806
|
+
/**
|
|
1807
|
+
* Adds actions to the secondary actions dropdown in the list toolbar.
|
|
1808
|
+
*/
|
|
1809
|
+
class SkyListSecondaryActionComponent {
|
|
1810
|
+
constructor(actionService) {
|
|
1811
|
+
this.actionService = actionService;
|
|
1812
|
+
}
|
|
1813
|
+
ngAfterContentInit() {
|
|
1814
|
+
this.actionService.addSecondaryAction({
|
|
1815
|
+
template: this.templateRef,
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
SkyListSecondaryActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionComponent, deps: [{ token: SkyListSecondaryActionsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1820
|
+
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" });
|
|
1821
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListSecondaryActionComponent, decorators: [{
|
|
1822
|
+
type: Component,
|
|
1823
|
+
args: [{
|
|
1824
|
+
selector: 'sky-list-secondary-action',
|
|
1825
|
+
templateUrl: './list-secondary-action.component.html',
|
|
1826
|
+
}]
|
|
1827
|
+
}], ctorParameters: function () { return [{ type: SkyListSecondaryActionsService }]; }, propDecorators: { templateRef: [{
|
|
1828
|
+
type: ViewChild,
|
|
1829
|
+
args: ['listSecondaryAction', {
|
|
1830
|
+
read: TemplateRef,
|
|
1831
|
+
static: true,
|
|
1832
|
+
}]
|
|
1833
|
+
}] } });
|
|
1834
|
+
|
|
1806
1835
|
// Note: this component is needed to ensure any reactive styles placed in the element have
|
|
1807
1836
|
// their host to be based off of. Without this component the host is not written via the dispatcher.
|
|
1808
1837
|
/**
|
|
@@ -1881,71 +1910,208 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1881
1910
|
}]
|
|
1882
1911
|
}] } });
|
|
1883
1912
|
|
|
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
|
+
|
|
1884
1949
|
/**
|
|
1885
|
-
*
|
|
1950
|
+
* @internal
|
|
1886
1951
|
*/
|
|
1887
|
-
class
|
|
1888
|
-
|
|
1889
|
-
this.
|
|
1952
|
+
class SkyListToolbarItemRendererComponent {
|
|
1953
|
+
ngOnInit() {
|
|
1954
|
+
if (this.template !== undefined) {
|
|
1955
|
+
this.container.createEmbeddedView(this.template, this);
|
|
1956
|
+
}
|
|
1890
1957
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1958
|
+
}
|
|
1959
|
+
SkyListToolbarItemRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1960
|
+
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 });
|
|
1961
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarItemRendererComponent, decorators: [{
|
|
1962
|
+
type: Component,
|
|
1963
|
+
args: [{
|
|
1964
|
+
selector: 'sky-list-toolbar-item-renderer',
|
|
1965
|
+
template: '<ng-template #container></ng-template>',
|
|
1966
|
+
}]
|
|
1967
|
+
}], propDecorators: { template: [{
|
|
1968
|
+
type: Input
|
|
1969
|
+
}], container: [{
|
|
1970
|
+
type: ViewChild,
|
|
1971
|
+
args: ['container', {
|
|
1972
|
+
read: ViewContainerRef,
|
|
1973
|
+
static: true,
|
|
1974
|
+
}]
|
|
1975
|
+
}] } });
|
|
1976
|
+
|
|
1977
|
+
let uniqueId = 0;
|
|
1978
|
+
/**
|
|
1979
|
+
* @internal
|
|
1980
|
+
*/
|
|
1981
|
+
class SkyListMultiselectToolbarComponent {
|
|
1982
|
+
constructor(state, dispatcher) {
|
|
1983
|
+
this.state = state;
|
|
1984
|
+
this.dispatcher = dispatcher;
|
|
1985
|
+
this.showOnlySelected = false;
|
|
1986
|
+
this.multiselectToolbarId = `sky-list-multiselect-toolbar-${uniqueId++}`;
|
|
1987
|
+
this.selectedIdMap = new Map();
|
|
1988
|
+
this.ngUnsubscribe = new Subject();
|
|
1989
|
+
}
|
|
1990
|
+
ngOnInit() {
|
|
1991
|
+
this.state
|
|
1992
|
+
.pipe(map((t) => t.selected.item), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.selectedMapEqual))
|
|
1993
|
+
.subscribe((model) => {
|
|
1994
|
+
this.selectedIdMap = model.selectedIdMap;
|
|
1995
|
+
if (this.showOnlySelected) {
|
|
1996
|
+
this.reapplyFilter(true);
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
// If 'show-selected' filter is programatically set from a child component (e.g. checkilst),
|
|
2000
|
+
// make sure the checked state of the 'show-selected' checkbox stays in sync.
|
|
2001
|
+
this.state
|
|
2002
|
+
.pipe(map((t) => t.filters), takeUntil(this.ngUnsubscribe), distinctUntilChanged(this.showSelectedValuesEqual))
|
|
2003
|
+
.subscribe((filters) => {
|
|
2004
|
+
const showSelectedFilter = filters.find((filter) => filter.name === 'show-selected');
|
|
2005
|
+
if (showSelectedFilter) {
|
|
2006
|
+
this.showOnlySelected = showSelectedFilter.value === 'true';
|
|
2007
|
+
}
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
ngOnDestroy() {
|
|
2011
|
+
this.ngUnsubscribe.next();
|
|
2012
|
+
this.ngUnsubscribe.complete();
|
|
2013
|
+
}
|
|
2014
|
+
selectAll() {
|
|
2015
|
+
this.state
|
|
2016
|
+
.pipe(map((state) => state.items.items), take(1))
|
|
2017
|
+
.subscribe((items) => {
|
|
2018
|
+
this.dispatcher.setSelected(items.map((item) => item.id), true);
|
|
2019
|
+
if (this.showOnlySelected) {
|
|
2020
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
clearSelections() {
|
|
2025
|
+
this.state
|
|
2026
|
+
.pipe(map((state) => state.items.items), take(1))
|
|
2027
|
+
.subscribe((items) => {
|
|
2028
|
+
this.dispatcher.setSelected(items.map((item) => item.id), false);
|
|
2029
|
+
if (this.showOnlySelected) {
|
|
2030
|
+
this.reapplyFilter(this.showOnlySelected);
|
|
2031
|
+
}
|
|
1894
2032
|
});
|
|
1895
2033
|
}
|
|
2034
|
+
changeVisibleItems(change) {
|
|
2035
|
+
this.showOnlySelected = change.checked;
|
|
2036
|
+
this.reapplyFilter(change.checked);
|
|
2037
|
+
}
|
|
2038
|
+
reapplyFilter(isSelected) {
|
|
2039
|
+
const self = this;
|
|
2040
|
+
this.state
|
|
2041
|
+
.pipe(map((state) => state.filters), take(1))
|
|
2042
|
+
.subscribe((filters) => {
|
|
2043
|
+
filters = filters.filter((filter) => filter.name !== 'show-selected');
|
|
2044
|
+
filters.push(self.getShowSelectedFilter(isSelected));
|
|
2045
|
+
this.dispatcher.filtersUpdate(filters);
|
|
2046
|
+
});
|
|
2047
|
+
// If "show selected" is checked and paging is enabled, go to page one.
|
|
2048
|
+
/* istanbul ignore else */
|
|
2049
|
+
if (isSelected) {
|
|
2050
|
+
this.state.pipe(take(1)).subscribe((currentState) => {
|
|
2051
|
+
if (currentState.paging.pageNumber &&
|
|
2052
|
+
currentState.paging.pageNumber !== 1) {
|
|
2053
|
+
this.dispatcher.next(new ListPagingSetPageNumberAction(Number(1)));
|
|
2054
|
+
}
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
this.dispatcher.toolbarSetDisabled(isSelected);
|
|
2058
|
+
}
|
|
2059
|
+
getShowSelectedFilter(isSelected) {
|
|
2060
|
+
return new ListFilterModel({
|
|
2061
|
+
name: 'show-selected',
|
|
2062
|
+
value: isSelected.toString(),
|
|
2063
|
+
filterFunction: (model, showOnlySelected) => {
|
|
2064
|
+
/* istanbul ignore else */
|
|
2065
|
+
if (showOnlySelected.toString() !== false.toString()) {
|
|
2066
|
+
return this.selectedIdMap.get(model.id);
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
defaultValue: false.toString(),
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
showSelectedValuesEqual(prev, next) {
|
|
2073
|
+
const prevShowSelectedFilter = prev.find((filter) => filter.name === 'show-selected');
|
|
2074
|
+
const nextShowSelectedFilter = next.find((filter) => filter.name === 'show-selected');
|
|
2075
|
+
// Both undefined.
|
|
2076
|
+
if (!prevShowSelectedFilter && !nextShowSelectedFilter) {
|
|
2077
|
+
return true;
|
|
2078
|
+
}
|
|
2079
|
+
// Only one undefined.
|
|
2080
|
+
if ((prevShowSelectedFilter && !nextShowSelectedFilter) ||
|
|
2081
|
+
(!prevShowSelectedFilter && nextShowSelectedFilter)) {
|
|
2082
|
+
return false;
|
|
2083
|
+
}
|
|
2084
|
+
// Defined, but with different "value".
|
|
2085
|
+
return prevShowSelectedFilter.value === nextShowSelectedFilter.value;
|
|
2086
|
+
}
|
|
2087
|
+
selectedMapEqual(prev, next) {
|
|
2088
|
+
if (prev.selectedIdMap.size !== next.selectedIdMap.size) {
|
|
2089
|
+
return false;
|
|
2090
|
+
}
|
|
2091
|
+
for (let i = 0; i < next.selectedIdMap.size; i++) {
|
|
2092
|
+
const key = Array.from(next.selectedIdMap.keys())[i];
|
|
2093
|
+
const value = next.selectedIdMap.get(key);
|
|
2094
|
+
/* istanbul ignore next */
|
|
2095
|
+
if (value !== prev.selectedIdMap.get(key)) {
|
|
2096
|
+
return false;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
return true;
|
|
2100
|
+
}
|
|
1896
2101
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type:
|
|
2102
|
+
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 });
|
|
2103
|
+
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 } });
|
|
2104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListMultiselectToolbarComponent, decorators: [{
|
|
1900
2105
|
type: Component,
|
|
1901
2106
|
args: [{
|
|
1902
|
-
selector: 'sky-list-
|
|
1903
|
-
templateUrl: './list-
|
|
2107
|
+
selector: 'sky-list-multiselect-toolbar',
|
|
2108
|
+
templateUrl: './list-multiselect-toolbar.component.html',
|
|
2109
|
+
styleUrls: ['./list-multiselect-toolbar.component.scss'],
|
|
1904
2110
|
}]
|
|
1905
|
-
}], ctorParameters: function () { return [{ type:
|
|
1906
|
-
type:
|
|
1907
|
-
args: ['listSecondaryAction', {
|
|
1908
|
-
read: TemplateRef,
|
|
1909
|
-
static: true,
|
|
1910
|
-
}]
|
|
2111
|
+
}], ctorParameters: function () { return [{ type: ListState }, { type: ListStateDispatcher }]; }, propDecorators: { showOnlySelected: [{
|
|
2112
|
+
type: Input
|
|
1911
2113
|
}] } });
|
|
1912
2114
|
|
|
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
2115
|
let idIndex = 0;
|
|
1950
2116
|
/**
|
|
1951
2117
|
* Defines a toolbar item for the list toolbar.
|
|
@@ -1991,6 +2157,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1991
2157
|
args: [TemplateRef]
|
|
1992
2158
|
}] } });
|
|
1993
2159
|
|
|
2160
|
+
/**
|
|
2161
|
+
* Displays custom actions in the toolbar beside to the search bar.
|
|
2162
|
+
*/
|
|
2163
|
+
class SkyListToolbarSearchActionsComponent {
|
|
2164
|
+
}
|
|
2165
|
+
SkyListToolbarSearchActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2166
|
+
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 });
|
|
2167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarSearchActionsComponent, decorators: [{
|
|
2168
|
+
type: Component,
|
|
2169
|
+
args: [{
|
|
2170
|
+
selector: 'sky-list-toolbar-search-actions',
|
|
2171
|
+
templateUrl: './list-toolbar-search-actions.component.html',
|
|
2172
|
+
styleUrls: ['./list-toolbar-search-actions.component.scss'],
|
|
2173
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2174
|
+
}]
|
|
2175
|
+
}] });
|
|
2176
|
+
|
|
1994
2177
|
/**
|
|
1995
2178
|
* Adds a sort dropdown to the list toolbar.
|
|
1996
2179
|
*/
|
|
@@ -2123,172 +2306,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2123
2306
|
type: Injectable
|
|
2124
2307
|
}], ctorParameters: function () { return [{ type: ListToolbarStateModel }, { type: ListToolbarStateDispatcher }]; } });
|
|
2125
2308
|
|
|
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
2309
|
let nextId = 0;
|
|
2293
2310
|
/**
|
|
2294
2311
|
* Displays a toolbar for a SKY UX-themed list of data.
|
|
@@ -2408,7 +2425,7 @@ class SkyListToolbarComponent {
|
|
|
2408
2425
|
this.isSortSelectorEnabled = this.toolbarState.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.config), distinctUntilChanged(), map((c) => c.sortSelectorEnabled));
|
|
2409
2426
|
this.isMultiselectEnabled = this.state.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.toolbar), distinctUntilChanged(), map((t) => t.showMultiselectToolbar));
|
|
2410
2427
|
this.hasAppliedFilters = this.state.pipe(takeUntil(this.ngUnsubscribe), map((s) => s.filters), distinctUntilChanged(), map((filters) => {
|
|
2411
|
-
|
|
2428
|
+
const activeFilters = filters.filter((f) => {
|
|
2412
2429
|
return (f.value !== '' &&
|
|
2413
2430
|
f.value !== undefined &&
|
|
2414
2431
|
f.value !== false &&
|
|
@@ -2505,10 +2522,10 @@ class SkyListToolbarComponent {
|
|
|
2505
2522
|
getSortSelectors() {
|
|
2506
2523
|
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
2524
|
// Get sorts that are in the global that are not in the available
|
|
2508
|
-
|
|
2525
|
+
const sorts = global.filter((g) => available.filter((a) => a.fieldSelector === g.fieldSelector)
|
|
2509
2526
|
.length === 0);
|
|
2510
|
-
|
|
2511
|
-
|
|
2527
|
+
const resultSortSelectors = [...sorts, ...available].map((sortLabels) => {
|
|
2528
|
+
const fs = fieldSelectors.filter((f) => {
|
|
2512
2529
|
return (f.fieldSelector === sortLabels.fieldSelector &&
|
|
2513
2530
|
f.descending === sortLabels.descending);
|
|
2514
2531
|
});
|
|
@@ -2617,23 +2634,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
2617
2634
|
}]
|
|
2618
2635
|
}] } });
|
|
2619
2636
|
|
|
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
2637
|
class SkyListToolbarModule {
|
|
2638
2638
|
}
|
|
2639
2639
|
SkyListToolbarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyListToolbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|