@recursyve/nice-selectable-list 19.0.0-beta.2 → 19.0.0-beta.3

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.
@@ -1,30 +1,73 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, computed, InjectionToken, inject, input, contentChildren, Injector, effect, untracked, forwardRef, Directive, DestroyRef, afterRenderEffect } from '@angular/core';
3
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
2
+ import { signal, computed, InjectionToken, Injector, DestroyRef, inject, input, contentChildren, effect, untracked, forwardRef, Directive, afterRenderEffect } from '@angular/core';
3
+ import { rxResource, takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
4
  import { MatCheckbox } from '@angular/material/checkbox';
5
- import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
6
- import { filter, take } from 'rxjs';
5
+ import { map, of, Subject, from } from 'rxjs';
6
+ import { Router, ActivatedRoute, NavigationStart, NavigationEnd } from '@angular/router';
7
+ import { filter, map as map$1, startWith, take, combineLatestWith, switchMap } from 'rxjs/operators';
7
8
 
8
9
  class NiceSelectableListStore {
10
+ _injector;
9
11
  _config;
10
- _entities = signal([]);
12
+ _plugins = [];
13
+ _entityLoader = null;
14
+ _uiEntityLoader = null;
15
+ _cache = signal({});
16
+ _entitiesMap = signal({});
11
17
  _activeEntity = signal(null);
12
18
  _checkboxes = signal([]);
13
- entities = this._entities.asReadonly();
19
+ _selectAllState = signal({
20
+ active: false,
21
+ total: null,
22
+ parameters: null
23
+ });
24
+ // Track window loading state
25
+ _lastWindowIds = [];
26
+ _currentWindowIds = [];
27
+ entities = computed(() => Object.values(this._entitiesMap()));
14
28
  activeEntity = this._activeEntity.asReadonly();
15
- total = computed(() => this._entities().length);
16
- entitiesIds = computed(() => this._entities().map((entity) => entity.id));
29
+ total = computed(() => this.entities().length);
30
+ entitiesIds = computed(() => {
31
+ const ids = Object.keys(this._entitiesMap());
32
+ return this._config.idType === "string" ? ids : ids.map((id) => +id);
33
+ });
17
34
  activeEntityId = computed(() => this._activeEntity()?.id ?? null);
18
- constructor(_config) {
35
+ selectAllState = this._selectAllState.asReadonly();
36
+ constructor(_injector, _config) {
37
+ this._injector = _injector;
19
38
  this._config = _config;
20
39
  }
40
+ init() {
41
+ if (!this._entityLoader && this._config.entityLoaderToken) {
42
+ this._entityLoader = this._injector.get(this._config.entityLoaderToken);
43
+ }
44
+ if (!this._uiEntityLoader && this._config.uiEntityLoaderToken) {
45
+ this._uiEntityLoader = this._injector.get(this._config.uiEntityLoaderToken);
46
+ }
47
+ for (const plugin of this._plugins) {
48
+ plugin.init();
49
+ }
50
+ }
51
+ registerPlugin(plugin) {
52
+ this._plugins.push(plugin);
53
+ }
21
54
  registerCheckbox(checkbox) {
22
55
  this._checkboxes.update((checkboxes) => [...checkboxes, checkbox]);
23
56
  const id = this._resolveEntityId(checkbox.selectableEntity());
24
- const entity = this._entities().find((_entity) => _entity.id === id);
25
- if (entity && entity.entity === null) {
26
- this._entities.update((_entities) => _entities.map((_entity) => _entity.id === id ? { id, entity: checkbox.selectableEntity() } : _entity));
27
- entity.entity = checkbox.selectableEntity();
57
+ const existing = this._entitiesMap()[id];
58
+ const selectAllState = this._selectAllState();
59
+ if ((existing && existing.entity === null) || selectAllState.active) {
60
+ const initial = checkbox.selectableEntity();
61
+ const entityResource = this._createEntityResource(id, initial);
62
+ this._entitiesMap.update((_entitiesMap) => ({
63
+ ..._entitiesMap,
64
+ [id]: {
65
+ id,
66
+ entity: entityResource,
67
+ ui: null
68
+ }
69
+ }));
70
+ return;
28
71
  }
29
72
  }
30
73
  unregisterCheckbox(checkbox) {
@@ -35,14 +78,30 @@ class NiceSelectableListStore {
35
78
  }
36
79
  setEntitiesFromSelections(selections) {
37
80
  const ids = this._config.idType === "string" ? selections : selections.map((id) => +id);
38
- const registeredEntities = this._checkboxes().map((checkbox) => ({
39
- id: this._resolveEntityId(checkbox.selectableEntity()), entity: checkbox.selectableEntity()
81
+ const registered = this._checkboxes().map((checkbox) => ({
82
+ id: this._resolveEntityId(checkbox.selectableEntity()), value: checkbox.selectableEntity()
40
83
  }));
41
- const entities = ids.map((id) => ({
42
- id,
43
- entity: registeredEntities.find(_entity => _entity.id === id)?.entity ?? null
44
- }));
45
- this._entities.set(entities);
84
+ const cache = this._cache();
85
+ const entities = ids.map((id) => {
86
+ const known = registered.find(_e => _e.id === id)?.value;
87
+ const cached = cache[id]?.entity;
88
+ const entityResource = known ? this._createEntityResource(id, known) : (cached ?? null);
89
+ return {
90
+ id,
91
+ entity: entityResource
92
+ };
93
+ });
94
+ const mapOut = entities.reduce((map, entity) => ({
95
+ ...map,
96
+ [entity.id]: {
97
+ id: entity.id,
98
+ entity: entity.entity,
99
+ ui: null
100
+ }
101
+ }), {});
102
+ this._entitiesMap.set(mapOut);
103
+ this._processCacheFromEntities();
104
+ this._updateWindowForActive();
46
105
  }
47
106
  selectEntity(entity) {
48
107
  const isSelected = this._isEntitySelected(entity);
@@ -50,7 +109,40 @@ class NiceSelectableListStore {
50
109
  return;
51
110
  }
52
111
  const id = this._resolveEntityId(entity);
53
- this._entities.update((entities) => [...entities, { id, entity }]);
112
+ const cached = this._cache()[id];
113
+ const newEntity = {
114
+ id,
115
+ entity: cached?.entity ?? this._createEntityResource(id, entity),
116
+ ui: cached?.ui ?? this._createUIResource(id)
117
+ };
118
+ this._entitiesMap.update((entitiesMap) => ({
119
+ ...entitiesMap,
120
+ [id]: newEntity
121
+ }));
122
+ this._cache.update((cache) => ({
123
+ ...cache,
124
+ [id]: newEntity
125
+ }));
126
+ // Window might change if this selection impacts first/last buckets
127
+ this._updateWindowForActive();
128
+ }
129
+ selectEntities(entities) {
130
+ this._entitiesMap.update((entitiesMap) => {
131
+ const newEntitiesMap = { ...entitiesMap };
132
+ const cache = this._cache();
133
+ for (const entity of entities) {
134
+ const id = this._resolveEntityId(entity);
135
+ const cached = cache[id];
136
+ newEntitiesMap[id] = cached ?? {
137
+ id,
138
+ entity: this._createEntityResource(id, entity),
139
+ ui: null
140
+ };
141
+ }
142
+ return newEntitiesMap;
143
+ });
144
+ this._processCacheFromEntities();
145
+ this._updateWindowForActive();
54
146
  }
55
147
  deselectEntity(entity) {
56
148
  const isSelected = this._isEntitySelected(entity);
@@ -58,19 +150,54 @@ class NiceSelectableListStore {
58
150
  return;
59
151
  }
60
152
  const id = this._resolveEntityId(entity);
61
- this._entities.update((entities) => entities.filter((_entity) => _entity.id !== id));
153
+ this._entitiesMap.update((entitiesMap) => {
154
+ const newEntitiesMap = { ...entitiesMap };
155
+ delete newEntitiesMap[id];
156
+ return newEntitiesMap;
157
+ });
158
+ }
159
+ deselectEntities(entities) {
160
+ const toRemove = entities.filter((entity) => this._isEntitySelected(entity));
161
+ this._entitiesMap.update((entitiesMap) => {
162
+ const newEntitiesMap = { ...entitiesMap };
163
+ for (const entity of toRemove) {
164
+ const id = this._resolveEntityId(entity);
165
+ delete newEntitiesMap[id];
166
+ }
167
+ return newEntitiesMap;
168
+ });
62
169
  }
63
170
  clear() {
64
- this._entities.set([]);
171
+ this._entitiesMap.set({});
65
172
  this._activeEntity.set(null);
66
173
  }
174
+ setSelectAllState(state) {
175
+ this._selectAllState.set(state);
176
+ if (!state.active) {
177
+ this.clear();
178
+ return;
179
+ }
180
+ const entities = this._checkboxes().map((checkbox) => checkbox.selectableEntity());
181
+ this._entitiesMap.set(entities.reduce((map, entity) => {
182
+ const id = this._resolveEntityId(entity);
183
+ return {
184
+ ...map,
185
+ [id]: {
186
+ id,
187
+ entity: null,
188
+ ui: null
189
+ }
190
+ };
191
+ }, {}));
192
+ this._preloadSelectAllValues();
193
+ }
67
194
  setActiveFromSelected(selected) {
68
195
  const id = this._config.idType === "string" ? selected : +selected;
69
- const entity = this._entities().find((_entity) => _entity.id === id);
196
+ const entity = this._entitiesMap()[id];
70
197
  if (!entity) {
71
198
  return;
72
199
  }
73
- this._activeEntity.set(entity);
200
+ this._setActiveEntity(id);
74
201
  }
75
202
  setActiveEntity(entity) {
76
203
  if (!entity) {
@@ -78,60 +205,60 @@ class NiceSelectableListStore {
78
205
  return;
79
206
  }
80
207
  const id = this._resolveEntityId(entity);
81
- this._activeEntity.set({ id, entity });
208
+ this._setActiveEntity(id);
82
209
  }
83
210
  selectFirstEntity() {
84
- const entity = this._entities()[0];
85
- if (!entity) {
211
+ const id = this.entitiesIds()[0];
212
+ if (!id) {
86
213
  return;
87
214
  }
88
- this._activeEntity.set(entity);
215
+ this._setActiveEntity(id);
89
216
  }
90
217
  selectNextEntity() {
91
- const entities = this._entities();
92
218
  const activeEntity = this._activeEntity();
93
219
  if (!activeEntity) {
94
220
  this.selectFirstEntity();
95
221
  return;
96
222
  }
97
- const index = entities.findIndex((_entity) => activeEntity.id === _entity.id);
98
- const nextEntity = entities[index + 1];
99
- if (!nextEntity) {
223
+ const entitiesIds = this.entitiesIds();
224
+ const index = entitiesIds.findIndex((id) => activeEntity.id === id);
225
+ const nextEntityId = entitiesIds[index + 1];
226
+ if (!nextEntityId) {
100
227
  return;
101
228
  }
102
- this._activeEntity.set(nextEntity);
229
+ this._setActiveEntity(nextEntityId);
103
230
  }
104
231
  selectPreviousEntity() {
105
- const entities = this._entities();
106
232
  const activeEntity = this._activeEntity();
107
233
  if (!activeEntity) {
108
234
  this.selectFirstEntity();
109
235
  return;
110
236
  }
111
- const index = entities.findIndex((_entity) => activeEntity.id === _entity.id);
237
+ const entitiesIds = this.entitiesIds();
238
+ const index = entitiesIds.findIndex((id) => activeEntity.id === id);
112
239
  if (index === 0) {
113
240
  return;
114
241
  }
115
- const previousEntity = entities[index - 1];
116
- if (!previousEntity) {
242
+ const previousEntityId = entitiesIds[index - 1];
243
+ if (!previousEntityId) {
117
244
  return;
118
245
  }
119
- this._activeEntity.set(previousEntity);
246
+ this._setActiveEntity(previousEntityId);
120
247
  }
121
248
  selectLastEntity() {
122
- const entities = this._entities();
123
- if (entities.length === 0) {
249
+ const entitiesIds = this.entitiesIds();
250
+ if (entitiesIds.length === 0) {
124
251
  return;
125
252
  }
126
- const lastEntity = entities[entities.length - 1];
127
- if (!lastEntity) {
253
+ const lastEntityId = entitiesIds[entitiesIds.length - 1];
254
+ if (!lastEntityId) {
128
255
  return;
129
256
  }
130
- this._activeEntity.set(lastEntity);
257
+ this._setActiveEntity(lastEntityId);
131
258
  }
132
259
  _isEntitySelected(entity) {
133
260
  const id = this._resolveEntityId(entity);
134
- return this._entities().findIndex((_entity) => _entity.id === id) >= 0;
261
+ return this._entitiesMap()[id]?.entity !== undefined;
135
262
  }
136
263
  _resolveEntityId(entity) {
137
264
  const idProperty = this._config.idProperty;
@@ -141,33 +268,199 @@ class NiceSelectableListStore {
141
268
  }
142
269
  return id;
143
270
  }
271
+ _processCacheFromEntities() {
272
+ const entities = this._entitiesMap();
273
+ this._cache.update((cache) => ({ ...cache, ...entities }));
274
+ }
275
+ _createEntityResource(id, initial) {
276
+ const resource = rxResource({
277
+ request: () => ({ id }),
278
+ loader: ({ request }) => {
279
+ if (this._entityLoader) {
280
+ return this._entityLoader.loadEntitiesByIds([request.id]).pipe(map((arr) => arr?.[0]));
281
+ }
282
+ return of(initial ?? undefined);
283
+ },
284
+ defaultValue: initial ?? undefined,
285
+ injector: this._injector
286
+ });
287
+ if (initial) {
288
+ resource.set(initial);
289
+ }
290
+ return resource;
291
+ }
292
+ _createUIResource(id) {
293
+ if (!this._uiEntityLoader) {
294
+ return null;
295
+ }
296
+ return rxResource({
297
+ request: () => ({ id }),
298
+ loader: ({ request }) => this._uiEntityLoader.loadById(request.id),
299
+ injector: this._injector
300
+ });
301
+ }
302
+ _computeWindowIds() {
303
+ const ids = this.entitiesIds();
304
+ const n = ids.length;
305
+ if (n === 0) {
306
+ return [];
307
+ }
308
+ const set = new Set();
309
+ // first 3
310
+ for (let i = 0; i < Math.min(3, n); i++) {
311
+ set.add(ids[i]);
312
+ }
313
+ // last 3
314
+ for (let i = Math.max(0, n - 3); i < n; i++) {
315
+ set.add(ids[i]);
316
+ }
317
+ // active and +/- 3
318
+ const activeId = this.activeEntityId();
319
+ const activeIndex = activeId !== null ? ids.findIndex((i) => i === activeId) : -1;
320
+ if (activeIndex >= 0) {
321
+ for (let i = Math.max(0, activeIndex - 3); i <= Math.min(n - 1, activeIndex + 3); i++) {
322
+ set.add(ids[i]);
323
+ }
324
+ }
325
+ return Array.from(set.values());
326
+ }
327
+ _ensureResourcesForIds(ids) {
328
+ const mapCopy = { ...this._entitiesMap() };
329
+ const cache = this._cache();
330
+ for (const id of ids) {
331
+ const entry = mapCopy[id] ?? cache[id];
332
+ if (!entry) {
333
+ mapCopy[id] = {
334
+ id,
335
+ entity: this._createEntityResource(id),
336
+ ui: this._uiEntityLoader ? this._createUIResource(id) : null
337
+ };
338
+ continue;
339
+ }
340
+ if (!entry.entity) {
341
+ entry.entity = this._createEntityResource(id);
342
+ }
343
+ if (!entry.ui && this._uiEntityLoader) {
344
+ entry.ui = this._createUIResource(id);
345
+ }
346
+ }
347
+ this._entitiesMap.set(mapCopy);
348
+ this._processCacheFromEntities();
349
+ }
350
+ _updateWindowForActive() {
351
+ this._lastWindowIds = this._currentWindowIds;
352
+ this._currentWindowIds = this._computeWindowIds();
353
+ if (this._currentWindowIds.length) {
354
+ this._ensureResourcesForIds(this._currentWindowIds);
355
+ }
356
+ }
357
+ _setActiveEntity(id) {
358
+ const entity = this._entitiesMap()[id];
359
+ if (!entity) {
360
+ return;
361
+ }
362
+ if (!entity.entity) {
363
+ entity.entity = this._createEntityResource(id);
364
+ }
365
+ if (!entity.ui) {
366
+ entity.ui = this._createUIResource(id);
367
+ }
368
+ this._activeEntity.set(entity);
369
+ this._updateWindowForActive();
370
+ }
371
+ _preloadSelectAllValues() {
372
+ if (!this._config.preload || !this._entityLoader) {
373
+ return;
374
+ }
375
+ this._entityLoader
376
+ .loadIdsFromParameters(this._selectAllState().parameters ?? {})
377
+ .pipe(map((ids) => {
378
+ const cache = this._cache();
379
+ this._entitiesMap.set(ids.reduce((map, id) => {
380
+ const cached = cache[id];
381
+ return {
382
+ ...map,
383
+ [id]: cached ?? {
384
+ id,
385
+ entity: null,
386
+ ui: null
387
+ }
388
+ };
389
+ }, {}));
390
+ this._processCacheFromEntities();
391
+ this._updateWindowForActive();
392
+ }))
393
+ .subscribe();
394
+ }
144
395
  }
145
396
 
146
397
  const NICE_SELECTABLE_LISTS = new InjectionToken("_selectable_list_providers");
147
398
  const NICE_SELECTABLE_LIST = new InjectionToken("_selectable_list_provider");
148
399
  function provideNiceSelectableList(...args) {
149
400
  const name = typeof args[0] === "string" ? args[0] : null;
150
- const config = (typeof args[0] === "string" ? args[1] : args[0]);
401
+ const options = (typeof args[0] === "string" ? args[1] : args[0]);
402
+ const providers = [];
403
+ const entityLoaderToken = options?.entityLoader
404
+ ? new InjectionToken(options.entityLoader.name)
405
+ : null;
406
+ if (entityLoaderToken && options?.entityLoader) {
407
+ providers.push({
408
+ provide: entityLoaderToken,
409
+ useClass: options.entityLoader
410
+ });
411
+ }
412
+ const uiEntityLoaderToken = options?.uiEntityLoader
413
+ ? new InjectionToken(options.uiEntityLoader.name)
414
+ : null;
415
+ if (uiEntityLoaderToken && options?.uiEntityLoader) {
416
+ providers.push({
417
+ provide: uiEntityLoaderToken,
418
+ useClass: options.uiEntityLoader
419
+ });
420
+ }
151
421
  if (!name) {
152
- return {
422
+ providers.push({
153
423
  provide: NICE_SELECTABLE_LIST,
154
- useFactory: () => new NiceSelectableListStore({
155
- idProperty: config?.idProperty ?? "id",
156
- idType: config?.idType ?? "number"
157
- })
158
- };
424
+ useFactory: (injector, destroyRef) => {
425
+ const store = new NiceSelectableListStore(injector, {
426
+ idProperty: options?.idProperty ?? "id",
427
+ idType: options?.idType ?? "number",
428
+ entityLoaderToken,
429
+ uiEntityLoaderToken,
430
+ preload: options?.preload ?? entityLoaderToken !== null
431
+ });
432
+ for (const plugin of options?.plugins ?? []) {
433
+ new plugin(injector, destroyRef, store);
434
+ }
435
+ return store;
436
+ },
437
+ deps: [Injector, DestroyRef]
438
+ });
159
439
  }
160
- return {
161
- provide: NICE_SELECTABLE_LISTS,
162
- useFactory: () => ({
163
- name,
164
- store: new NiceSelectableListStore({
165
- idProperty: config?.idProperty ?? "id",
166
- idType: config?.idType ?? "number"
167
- })
168
- }),
169
- multi: true
170
- };
440
+ else {
441
+ providers.push({
442
+ provide: NICE_SELECTABLE_LISTS,
443
+ useFactory: (injector, destroyRef) => {
444
+ const store = new NiceSelectableListStore(injector, {
445
+ idProperty: options?.idProperty ?? "id",
446
+ idType: options?.idType ?? "number",
447
+ entityLoaderToken,
448
+ uiEntityLoaderToken,
449
+ preload: options?.preload ?? entityLoaderToken !== null
450
+ });
451
+ for (const plugin of options?.plugins ?? []) {
452
+ new plugin(injector, destroyRef, store);
453
+ }
454
+ return {
455
+ name,
456
+ store
457
+ };
458
+ },
459
+ deps: [Injector, DestroyRef],
460
+ multi: true
461
+ });
462
+ }
463
+ return providers;
171
464
  }
172
465
  function resolveNiceSelectableList(...args) {
173
466
  const name = typeof args[0] === "string" ? args[0] : null;
@@ -190,12 +483,10 @@ function resolveNiceSelectableList(...args) {
190
483
  const NICE_SELECTABLE_LIST_DIRECTIVE = new InjectionToken("_selectable_list_directive");
191
484
  class SelectableListDirective {
192
485
  name = input(null, { alias: "niceSelectableList" });
193
- enableQueryParams = input(false);
194
486
  checkboxes = contentChildren(NiceSelectableListEntityCheckboxDirective, { descendants: true });
195
487
  _initialized = signal(false);
196
488
  initialized = this._initialized.asReadonly();
197
- route = inject(ActivatedRoute);
198
- router = inject(Router);
489
+ allSelected = computed(() => this.selectableLists.selectAllState().active);
199
490
  injector = inject(Injector);
200
491
  selectableLists;
201
492
  constructor() {
@@ -204,70 +495,11 @@ class SelectableListDirective {
204
495
  this.selectableLists = name
205
496
  ? resolveNiceSelectableList(name, { injector: this.injector })
206
497
  : resolveNiceSelectableList({ injector: this.injector });
207
- });
208
- effect(() => {
209
- if (!this._initialized() || !this.name()) {
210
- return;
211
- }
212
- if (!this.enableQueryParams()) {
213
- this.router.navigate([], {
214
- relativeTo: this.route,
215
- queryParams: {
216
- selections: null,
217
- selected: null
218
- }
219
- });
220
- return;
221
- }
222
- });
223
- effect(() => {
224
- if (!this._initialized()) {
225
- return;
226
- }
227
- const shouldWrite = untracked(() => this.enableQueryParams() && this.name());
228
- if (!shouldWrite) {
229
- return;
230
- }
231
- const entities = this.selectableLists.entitiesIds();
232
- const activeEntity = this.selectableLists.activeEntityId();
233
- this.router.navigate([], {
234
- relativeTo: this.route,
235
- queryParams: {
236
- selections: entities,
237
- selected: activeEntity
238
- }
239
- });
240
- });
241
- }
242
- ngOnInit() {
243
- this.loadQueryParams();
244
- }
245
- loadQueryParams() {
246
- if (this.router.navigated) {
247
- this.parseQueryParams(this.route.snapshot.queryParams);
248
- this._initialized.set(true);
249
- return;
250
- }
251
- this.router.events
252
- .pipe(filter((event) => event instanceof NavigationEnd), take(1))
253
- .subscribe(() => {
254
- this.parseQueryParams(this.route.snapshot.queryParams);
255
- this._initialized.set(true);
498
+ untracked(() => this.selectableLists.init());
256
499
  });
257
500
  }
258
- parseQueryParams(params) {
259
- if (params.selections) {
260
- const selections = Array.isArray(params.selections)
261
- ? params.selections
262
- : [params.selections];
263
- this.selectableLists.setEntitiesFromSelections(selections);
264
- }
265
- if (params.selected) {
266
- this.selectableLists.setActiveFromSelected(params.selected);
267
- }
268
- }
269
501
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
270
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.14", type: SelectableListDirective, isStandalone: true, selector: "[niceSelectableList]", inputs: { name: { classPropertyName: "name", publicName: "niceSelectableList", isSignal: true, isRequired: false, transformFunction: null }, enableQueryParams: { classPropertyName: "enableQueryParams", publicName: "enableQueryParams", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
502
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.14", type: SelectableListDirective, isStandalone: true, selector: "[niceSelectableList]", inputs: { name: { classPropertyName: "name", publicName: "niceSelectableList", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
271
503
  { provide: NICE_SELECTABLE_LIST_DIRECTIVE, useExisting: forwardRef(() => SelectableListDirective) }
272
504
  ], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListEntityCheckboxDirective, descendants: true, isSignal: true }], ngImport: i0 });
273
505
  }
@@ -304,6 +536,9 @@ class NiceSelectableListEntityCheckboxDirective {
304
536
  selectableEntity = input.required();
305
537
  isSelected = computed(() => this.niceSelectableList.isEntitySelected(this.selectableEntity())());
306
538
  constructor() {
539
+ effect(() => {
540
+ this.matCheckbox.disabled = this.niceSelectableList.selectAllState().active;
541
+ });
307
542
  effect(() => {
308
543
  this.matCheckbox.checked = this.niceSelectableList.isEntitySelected(this.selectableEntity())();
309
544
  });
@@ -342,11 +577,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
342
577
 
343
578
  class NiceSelectableListHeaderCheckboxDirective {
344
579
  niceSelectableListDirective = injectNiceSelectableListDirective();
580
+ niceSelectableList = injectNiceSelectableList();
345
581
  matCheckbox = inject(MatCheckbox);
346
582
  destroyRef = inject(DestroyRef);
347
583
  constructor() {
584
+ effect(() => {
585
+ this.matCheckbox.disabled = this.niceSelectableListDirective.allSelected();
586
+ });
348
587
  afterRenderEffect({
349
588
  read: () => {
589
+ const allSelected = this.niceSelectableListDirective.allSelected();
590
+ if (allSelected) {
591
+ this.matCheckbox.checked = true;
592
+ return;
593
+ }
350
594
  const checkboxes = this.niceSelectableListDirective.checkboxes();
351
595
  const empty = checkboxes.length === 0;
352
596
  this.matCheckbox.checked = !empty && checkboxes.every((checkbox) => checkbox.isSelected());
@@ -357,11 +601,14 @@ class NiceSelectableListHeaderCheckboxDirective {
357
601
  }
358
602
  ngOnInit() {
359
603
  this.matCheckbox.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ checked }) => {
604
+ const entities = this.niceSelectableListDirective
605
+ .checkboxes()
606
+ .map((checkbox) => checkbox.selectableEntity());
360
607
  if (checked) {
361
- this.niceSelectableListDirective.checkboxes().forEach((checkbox) => checkbox.selectEntity());
608
+ this.niceSelectableList.selectEntities(entities);
362
609
  }
363
610
  else {
364
- this.niceSelectableListDirective.checkboxes().forEach((checkbox) => checkbox.deselectEntity());
611
+ this.niceSelectableList.deselectEntities(entities);
365
612
  }
366
613
  });
367
614
  }
@@ -375,9 +622,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
375
622
  }]
376
623
  }], ctorParameters: () => [] });
377
624
 
625
+ class NiceSelectableListPluginDefinition {
626
+ _injector;
627
+ _destroyRef;
628
+ _store;
629
+ constructor(_injector, _destroyRef, _store) {
630
+ this._injector = _injector;
631
+ this._destroyRef = _destroyRef;
632
+ this._store = _store;
633
+ this._store.registerPlugin(this);
634
+ _destroyRef.onDestroy(() => this.cleanup());
635
+ }
636
+ }
637
+
638
+ class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition {
639
+ router;
640
+ route;
641
+ _storeChangesEffectRef;
642
+ _writeQueryParamsSub;
643
+ _isNavigating$;
644
+ _initialized = signal(false);
645
+ _nextQueryParams = new Subject();
646
+ init() {
647
+ this.router = this._injector.get(Router);
648
+ this.route = this._injector.get(ActivatedRoute);
649
+ this._isNavigating$ = this.router.events.pipe(filter((event) => event instanceof NavigationStart || event instanceof NavigationEnd), map$1((event) => event instanceof NavigationStart), startWith(!this.router.navigated));
650
+ this.listenOnQueryParams();
651
+ this.listenOnStoreChanges();
652
+ this.writeQueryParams();
653
+ }
654
+ cleanup() {
655
+ this._storeChangesEffectRef.destroy();
656
+ this._writeQueryParamsSub.unsubscribe();
657
+ }
658
+ listenOnQueryParams() {
659
+ if (this.router.navigated) {
660
+ this.parseQueryParams(this.route.snapshot.queryParams);
661
+ this._initialized.set(true);
662
+ return;
663
+ }
664
+ this.router.events
665
+ .pipe(filter((event) => event instanceof NavigationEnd), take(1))
666
+ .subscribe(() => {
667
+ this.parseQueryParams(this.route.snapshot.queryParams);
668
+ this._initialized.set(true);
669
+ });
670
+ }
671
+ listenOnStoreChanges() {
672
+ this._storeChangesEffectRef = effect(() => {
673
+ if (!this._initialized()) {
674
+ return;
675
+ }
676
+ const entities = this._store.entitiesIds();
677
+ const activeEntity = this._store.activeEntityId();
678
+ const selectAllState = this._store.selectAllState();
679
+ const params = {
680
+ ...(selectAllState.active && {
681
+ allSelected: true,
682
+ ...(selectAllState.parameters && ({
683
+ allSelectedParameters: JSON.stringify(selectAllState.parameters)
684
+ }))
685
+ }),
686
+ selection: entities,
687
+ selected: activeEntity
688
+ };
689
+ this._nextQueryParams.next(params);
690
+ }, {
691
+ injector: this._injector,
692
+ manualCleanup: true
693
+ });
694
+ }
695
+ parseQueryParams(params) {
696
+ if (params.selection) {
697
+ const selection = Array.isArray(params.selection)
698
+ ? params.selection
699
+ : [params.selection];
700
+ this._store.setEntitiesFromSelections(selection);
701
+ }
702
+ if (params.selected) {
703
+ this._store.setActiveFromSelected(params.selected);
704
+ }
705
+ if (params.allSelected) {
706
+ this._store.setSelectAllState({
707
+ active: true,
708
+ total: this._store.total(),
709
+ parameters: params.allSelectedParameters
710
+ ? JSON.parse(params.allSelectedParameters)
711
+ : null
712
+ });
713
+ }
714
+ }
715
+ writeQueryParams() {
716
+ this._writeQueryParamsSub = this._nextQueryParams.pipe(combineLatestWith(this._isNavigating$), switchMap(([params, isNavigating]) => {
717
+ if (isNavigating) {
718
+ return of(false);
719
+ }
720
+ return from(this.router.navigate([], { queryParams: params, onSameUrlNavigation: "ignore" }));
721
+ })).subscribe();
722
+ }
723
+ }
724
+
378
725
  /**
379
726
  * Generated bundle index. Do not edit.
380
727
  */
381
728
 
382
- export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListStore, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
729
+ export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListPluginDefinition, NiceSelectableListStore, NiceSelectableQueryParamsPlugin, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
383
730
  //# sourceMappingURL=recursyve-nice-selectable-list.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"recursyve-nice-selectable-list.mjs","sources":["../../../src/nice-selectable-list/selectable-list/store.ts","../../../src/nice-selectable-list/selectable-list/provider.ts","../../../src/nice-selectable-list/selectable-list/selectable-list.ts","../../../src/nice-selectable-list/selectable-list/injector.ts","../../../src/nice-selectable-list/selectable-list/entity-checkbox.directive.ts","../../../src/nice-selectable-list/selectable-list/header-checkbox.directive.ts","../../../src/nice-selectable-list/recursyve-nice-selectable-list.ts"],"sourcesContent":["import { computed, Signal, signal } from \"@angular/core\";\nimport { NiceSelectableListEntityCheckboxDirective } from \"./entity-checkbox.directive\";\n\nexport type NiceSelectableListConfig<T> = {\n idProperty: keyof T;\n idType?: \"string\" | \"number\";\n}\n\nexport type NiceSelectableListEntity<T> = {\n id: string | number;\n entity: T | null;\n};\n\nexport class NiceSelectableListStore<T> {\n private readonly _entities = signal<NiceSelectableListEntity<T>[]>([]);\n private readonly _activeEntity = signal<NiceSelectableListEntity<T> | null>(null);\n private readonly _checkboxes = signal<NiceSelectableListEntityCheckboxDirective<T>[]>([]);\n\n public readonly entities = this._entities.asReadonly();\n public readonly activeEntity = this._activeEntity.asReadonly();\n\n public readonly total = computed(() => this._entities().length);\n public readonly entitiesIds = computed(() => this._entities().map((entity) => entity.id));\n public readonly activeEntityId = computed(() => this._activeEntity()?.id ?? null);\n\n constructor(private readonly _config: NiceSelectableListConfig<T>) {}\n\n public registerCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void {\n this._checkboxes.update((checkboxes) => [...checkboxes, checkbox]);\n\n const id = this._resolveEntityId(checkbox.selectableEntity());\n const entity = this._entities().find((_entity) => _entity.id === id);\n if (entity && entity.entity === null) {\n this._entities.update(\n (_entities) => _entities.map((_entity) =>\n _entity.id === id ? { id, entity: checkbox.selectableEntity() } : _entity\n )\n );\n entity.entity = checkbox.selectableEntity();\n }\n }\n\n public unregisterCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void {\n this._checkboxes.update((checkboxes) => checkboxes.filter((_checkbox) => _checkbox !== checkbox));\n }\n\n public isEntitySelected(entity: T): Signal<boolean> {\n return computed(() => this._isEntitySelected(entity));\n }\n\n public setEntitiesFromSelections(selections: string[]): void {\n const ids: (string | number)[] = this._config.idType === \"string\" ? selections : selections.map((id) => +id);\n\n const registeredEntities = this._checkboxes().map((checkbox) => ({\n id: this._resolveEntityId(checkbox.selectableEntity()), entity: checkbox.selectableEntity()\n }));\n const entities = ids.map((id) => ({\n id,\n entity: registeredEntities.find(_entity => _entity.id === id)?.entity ?? null\n }));\n this._entities.set(entities);\n }\n\n public selectEntity(entity: T): void {\n const isSelected = this._isEntitySelected(entity);\n if (isSelected) {\n return;\n }\n\n const id = this._resolveEntityId(entity);\n this._entities.update((entities) => [...entities, { id, entity }]);\n }\n\n public deselectEntity(entity: T): void {\n const isSelected = this._isEntitySelected(entity);\n if (!isSelected) {\n return;\n }\n\n const id = this._resolveEntityId(entity);\n this._entities.update((entities) => entities.filter((_entity) => _entity.id !== id));\n }\n\n public clear(): void {\n this._entities.set([]);\n this._activeEntity.set(null);\n }\n\n public setActiveFromSelected(selected: string): void {\n const id = this._config.idType === \"string\" ? selected : +selected;\n const entity = this._entities().find((_entity) => _entity.id === id);\n if (!entity) {\n return;\n }\n\n this._activeEntity.set(entity);\n }\n\n public setActiveEntity(entity: T | null): void {\n if (!entity) {\n this._activeEntity.set(null);\n return;\n }\n\n const id = this._resolveEntityId(entity);\n this._activeEntity.set({ id, entity });\n }\n\n public selectFirstEntity(): void {\n const entity = this._entities()[0];\n if (!entity) {\n return;\n }\n\n this._activeEntity.set(entity);\n }\n\n public selectNextEntity(): void {\n const entities = this._entities();\n const activeEntity = this._activeEntity();\n if (!activeEntity) {\n this.selectFirstEntity();\n return;\n }\n\n const index = entities.findIndex((_entity) => activeEntity.id === _entity.id);\n const nextEntity = entities[index + 1];\n if (!nextEntity) {\n return;\n }\n\n this._activeEntity.set(nextEntity);\n }\n\n public selectPreviousEntity(): void {\n const entities = this._entities();\n const activeEntity = this._activeEntity();\n if (!activeEntity) {\n this.selectFirstEntity();\n return;\n }\n\n const index = entities.findIndex((_entity) => activeEntity.id === _entity.id);\n if (index === 0) {\n return;\n }\n\n const previousEntity = entities[index - 1];\n if (!previousEntity) {\n return;\n }\n\n this._activeEntity.set(previousEntity);\n }\n\n public selectLastEntity(): void {\n const entities = this._entities();\n if (entities.length === 0) {\n return;\n }\n\n const lastEntity = entities[entities.length - 1];\n if (!lastEntity) {\n return;\n }\n\n this._activeEntity.set(lastEntity);\n }\n\n private _isEntitySelected(entity: T): boolean {\n const id = this._resolveEntityId(entity);\n return this._entities().findIndex((_entity) => _entity.id === id) >= 0;\n }\n\n private _resolveEntityId(entity: T): string | number {\n const idProperty = this._config.idProperty;\n const id = entity[idProperty];\n if (typeof id !== \"string\" && typeof id !== \"number\") {\n throw new Error(`The id property must be a string or a number, but got ${typeof id}`);\n }\n\n return id;\n }\n}\n","import { FactoryProvider, inject, InjectionToken, Injector } from \"@angular/core\";\nimport { NiceSelectableListConfig, NiceSelectableListStore } from \"./store\";\n\nexport const NICE_SELECTABLE_LISTS\n = new InjectionToken<NiceSelectableListProvider<unknown>[]>(\"_selectable_list_providers\");\n\nexport const NICE_SELECTABLE_LIST\n = new InjectionToken<NiceSelectableListStore<unknown>>(\"_selectable_list_provider\");\n\nexport type NiceSelectableListProvider<T> = {\n name: string;\n store: NiceSelectableListStore<T>;\n};\n\nexport function provideNiceSelectableList<T>(config?: NiceSelectableListConfig<T>): FactoryProvider;\nexport function provideNiceSelectableList<T>(name: string, config?: NiceSelectableListConfig<T>): FactoryProvider;\nexport function provideNiceSelectableList<T>(...args: unknown[]): FactoryProvider {\n const name: string | null = typeof args[0] === \"string\" ? args[0] : null;\n const config = (typeof args[0] === \"string\" ? args[1] : args[0]) as NiceSelectableListConfig<T> | undefined;\n\n if (!name) {\n return {\n provide: NICE_SELECTABLE_LIST,\n useFactory: () => new NiceSelectableListStore({\n idProperty: config?.idProperty ?? \"id\" as keyof T,\n idType: config?.idType ?? \"number\" as \"string\" | \"number\"\n })\n };\n }\n\n return {\n provide: NICE_SELECTABLE_LISTS,\n useFactory: () => ({\n name,\n store: new NiceSelectableListStore({\n idProperty: config?.idProperty ?? \"id\" as keyof T,\n idType: config?.idType ?? \"number\" as \"string\" | \"number\"\n })\n }),\n multi: true\n };\n}\n\nexport type ResolveNiceSelectableListOptions = { injector: Injector };\n\nexport function resolveNiceSelectableList<T>(\n name: string,\n options?: ResolveNiceSelectableListOptions\n): NiceSelectableListStore<T>;\nexport function resolveNiceSelectableList<T>(options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;\nexport function resolveNiceSelectableList<T>(...args: unknown[]): NiceSelectableListStore<T> {\n const name: string | null = typeof args[0] === \"string\" ? args[0] : null;\n const options = (typeof args[0] === \"string\" ? args[1] : args[0]) as ResolveNiceSelectableListOptions | undefined;\n\n if (!name) {\n return (options?.injector\n ? options.injector.get(NICE_SELECTABLE_LIST)\n : inject(NICE_SELECTABLE_LIST)) as NiceSelectableListStore<T>;\n }\n\n const selectableLists = options?.injector\n ? options.injector.get(NICE_SELECTABLE_LISTS)\n : inject(NICE_SELECTABLE_LISTS);\n\n const provider = selectableLists.find((_provider) => _provider.name === name);\n if (!provider) {\n throw new Error(`No selectable list provider found for name: ${name}`);\n }\n\n return provider.store as NiceSelectableListStore<T>;\n}\n","import {\n contentChildren,\n Directive,\n effect,\n forwardRef,\n inject,\n InjectionToken,\n Injector,\n input,\n OnInit,\n signal,\n Signal,\n untracked\n} from \"@angular/core\";\nimport { ActivatedRoute, NavigationEnd, Router } from \"@angular/router\";\nimport { filter, take } from \"rxjs\";\nimport { NiceSelectableListEntityCheckboxDirective } from \"./entity-checkbox.directive\";\nimport { resolveNiceSelectableList } from \"./provider\";\nimport { NiceSelectableListStore } from \"./store\";\n\nexport const NICE_SELECTABLE_LIST_DIRECTIVE\n = new InjectionToken<NiceSelectableList<unknown>>(\"_selectable_list_directive\");\n\nexport type NiceSelectableList<T> = {\n name: Signal<string | null>;\n checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;\n};\n\n@Directive({\n selector: \"[niceSelectableList]\",\n providers: [\n { provide: NICE_SELECTABLE_LIST_DIRECTIVE, useExisting: forwardRef(() => SelectableListDirective) }\n ]\n})\nexport class SelectableListDirective<T> implements NiceSelectableList<T>, OnInit {\n public readonly name = input<string | null>(null, { alias: \"niceSelectableList\" });\n public readonly enableQueryParams = input<boolean>(false);\n\n public readonly checkboxes = contentChildren<NiceSelectableListEntityCheckboxDirective<T>>(\n NiceSelectableListEntityCheckboxDirective,\n { descendants: true }\n );\n\n private readonly _initialized = signal(false);\n public readonly initialized = this._initialized.asReadonly();\n\n protected readonly route = inject(ActivatedRoute);\n protected readonly router = inject(Router);\n protected readonly injector = inject(Injector);\n\n protected selectableLists!: NiceSelectableListStore<T>;\n\n constructor() {\n effect(() => {\n const name = this.name();\n this.selectableLists = name\n ? resolveNiceSelectableList(name, { injector: this.injector })\n : resolveNiceSelectableList({ injector: this.injector });\n });\n\n effect(() => {\n if (!this._initialized() || !this.name()) {\n return;\n }\n\n if (!this.enableQueryParams()) {\n this.router.navigate([], {\n relativeTo: this.route,\n queryParams: {\n selections: null,\n selected: null\n }\n });\n return;\n }\n });\n\n effect(() => {\n if (!this._initialized()) {\n return;\n }\n\n const shouldWrite = untracked(() => this.enableQueryParams() && this.name());\n if (!shouldWrite) {\n return;\n }\n\n const entities = this.selectableLists.entitiesIds();\n const activeEntity = this.selectableLists.activeEntityId();\n this.router.navigate([], {\n relativeTo: this.route,\n queryParams: {\n selections: entities,\n selected: activeEntity\n }\n });\n });\n }\n\n public ngOnInit(): void {\n this.loadQueryParams();\n }\n\n private loadQueryParams(): void {\n if (this.router.navigated) {\n this.parseQueryParams(this.route.snapshot.queryParams);\n this._initialized.set(true);\n return;\n }\n\n this.router.events\n .pipe(\n filter((event) => event instanceof NavigationEnd),\n take(1)\n )\n .subscribe(() => {\n this.parseQueryParams(this.route.snapshot.queryParams);\n this._initialized.set(true);\n });\n }\n\n private parseQueryParams(params: {\n selections?: string | string[];\n selected?: string;\n }): void {\n if (params.selections) {\n const selections = Array.isArray(params.selections)\n ? params.selections\n : [params.selections]\n this.selectableLists.setEntitiesFromSelections(selections);\n }\n\n if (params.selected) {\n this.selectableLists.setActiveFromSelected(params.selected);\n }\n }\n}\n","import { inject } from \"@angular/core\";\nimport { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS } from \"./provider\";\nimport { NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableList } from \"./selectable-list\";\nimport { NiceSelectableListStore } from \"./store\";\n\nexport function injectNiceSelectableListDirective<T>(): NiceSelectableList<T> {\n return inject(NICE_SELECTABLE_LIST_DIRECTIVE, { optional: true }) as NiceSelectableList<T>;\n}\n\nexport function injectNiceSelectableList<T>(name?: string): NiceSelectableListStore<T> {\n const storeName = name ?? injectNiceSelectableListDirective()?.name();\n if (!storeName) {\n return inject(NICE_SELECTABLE_LIST) as NiceSelectableListStore<T>;\n }\n\n const selectableLists = inject(NICE_SELECTABLE_LISTS);\n const provider = selectableLists.find((_provider) => _provider.name === storeName);\n if (!provider) {\n throw new Error(`No selectable list provider found for name: ${storeName}`);\n }\n\n return provider.store as NiceSelectableListStore<T>;\n}\n","import { computed, DestroyRef, Directive, effect, inject, input, OnDestroy, OnInit } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { MatCheckbox } from \"@angular/material/checkbox\";\nimport { injectNiceSelectableList } from \"./injector\";\n\n@Directive({\n selector: \"mat-checkbox[niceSelectableListEntityCheckbox]\"\n})\nexport class NiceSelectableListEntityCheckboxDirective<T> implements OnInit, OnDestroy {\n protected readonly matCheckbox = inject(MatCheckbox);\n protected readonly destroyRef = inject(DestroyRef);\n protected readonly niceSelectableList = injectNiceSelectableList<T>();\n\n public readonly selectableEntity = input.required<T>();\n public readonly isSelected = computed(() => this.niceSelectableList.isEntitySelected(this.selectableEntity())());\n\n constructor() {\n effect(() => {\n this.matCheckbox.checked = this.niceSelectableList.isEntitySelected(this.selectableEntity())();\n });\n }\n\n public ngOnInit(): void {\n this.niceSelectableList.registerCheckbox(this);\n\n this.matCheckbox.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ checked }) => {\n if (checked) {\n this.niceSelectableList.selectEntity(this.selectableEntity());\n } else {\n this.niceSelectableList.deselectEntity(this.selectableEntity());\n }\n });\n }\n\n public ngOnDestroy(): void {\n this.niceSelectableList.unregisterCheckbox(this);\n }\n\n public selectEntity(): void {\n this.matCheckbox.checked = true;\n this.matCheckbox.change.emit({ checked: true, source: this.matCheckbox });\n }\n\n public deselectEntity(): void {\n this.matCheckbox.checked = false;\n this.matCheckbox.change.emit({ checked: false, source: this.matCheckbox });\n }\n}\n","import { afterRenderEffect, DestroyRef, Directive, inject, OnInit } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { MatCheckbox } from \"@angular/material/checkbox\";\nimport { injectNiceSelectableListDirective } from \"./injector\";\n\n@Directive({\n selector: \"mat-checkbox[niceSelectableListHeaderCheckbox]\"\n})\nexport class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {\n private readonly niceSelectableListDirective = injectNiceSelectableListDirective<T>();\n private readonly matCheckbox = inject(MatCheckbox);\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n afterRenderEffect({\n read: () => {\n const checkboxes = this.niceSelectableListDirective.checkboxes();\n const empty = checkboxes.length === 0;\n\n this.matCheckbox.checked = !empty && checkboxes.every((checkbox) => checkbox.isSelected());\n this.matCheckbox.indeterminate = !this.matCheckbox.checked\n && checkboxes.some((checkbox) => checkbox.isSelected());\n }\n });\n }\n\n public ngOnInit(): void {\n this.matCheckbox.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ checked }) => {\n if (checked) {\n this.niceSelectableListDirective.checkboxes().forEach((checkbox) => checkbox.selectEntity());\n } else {\n this.niceSelectableListDirective.checkboxes().forEach((checkbox) => checkbox.deselectEntity());\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAaa,uBAAuB,CAAA;AAYH,IAAA,OAAA;AAXZ,IAAA,SAAS,GAAG,MAAM,CAAgC,EAAE,CAAC;AACrD,IAAA,aAAa,GAAG,MAAM,CAAqC,IAAI,CAAC;AAChE,IAAA,WAAW,GAAG,MAAM,CAAiD,EAAE,CAAC;AAEzE,IAAA,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;AACtC,IAAA,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE;AAE9C,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC;IAC/C,WAAW,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;AACzE,IAAA,cAAc,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,IAAI,IAAI,CAAC;AAEjF,IAAA,WAAA,CAA6B,OAAoC,EAAA;QAApC,IAAO,CAAA,OAAA,GAAP,OAAO;;AAE7B,IAAA,gBAAgB,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A,SAAA,EAAA,CAAA;4FAAzC,yCAAyC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gDAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAzC,yCAAyC,EAAA,UAAA,EAAA,CAAA;kBAHrD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;;ACPD;;AAEG;;;;"}
1
+ {"version":3,"file":"recursyve-nice-selectable-list.mjs","sources":["../../../src/nice-selectable-list/selectable-list/store.ts","../../../src/nice-selectable-list/selectable-list/provider.ts","../../../src/nice-selectable-list/selectable-list/selectable-list.ts","../../../src/nice-selectable-list/selectable-list/injector.ts","../../../src/nice-selectable-list/selectable-list/entity-checkbox.directive.ts","../../../src/nice-selectable-list/selectable-list/header-checkbox.directive.ts","../../../src/nice-selectable-list/selectable-list/pluggins/plugin-definition.ts","../../../src/nice-selectable-list/selectable-list/pluggins/query-params/plugin.ts","../../../src/nice-selectable-list/recursyve-nice-selectable-list.ts"],"sourcesContent":["import { computed, InjectionToken, Injector, ResourceRef, Signal, signal } from \"@angular/core\";\nimport { rxResource } from \"@angular/core/rxjs-interop\";\nimport { NiceSelectableListPluginDefinition } from \"./pluggins/plugin-definition\";\nimport { map, of } from \"rxjs\";\nimport { NiceSelectableListEntityCheckboxDirective } from \"./entity-checkbox.directive\";\nimport { NiceSelectableListEntityLoader, NiceSelectableListUIEntityLoader } from \"./loader\";\n\nexport type NiceSelectableListConfig<T> = {\n idProperty: keyof T;\n idType?: \"string\" | \"number\";\n\n entityLoaderToken: InjectionToken<NiceSelectableListEntityLoader<T>> | null;\n uiEntityLoaderToken: InjectionToken<NiceSelectableListUIEntityLoader<T>> | null;\n preload?: boolean;\n}\n\nexport type NiceSelectableListEntity<T> = {\n id: string | number;\n entity: ResourceRef<T | undefined> | null;\n ui: ResourceRef<T | undefined> | null;\n};\n\nexport type NiceSelectableListSelectAllState = {\n active: boolean;\n total: number | null;\n parameters: object | null;\n};\n\nexport class NiceSelectableListStore<T> {\n private readonly _plugins: NiceSelectableListPluginDefinition[] = [];\n private _entityLoader: NiceSelectableListEntityLoader<T, object, number | string> | null = null;\n private _uiEntityLoader: NiceSelectableListUIEntityLoader<T, number | string> | null = null;\n\n private readonly _cache = signal<Record<string | number, NiceSelectableListEntity<T>>>({});\n\n private readonly _entitiesMap = signal<Record<string | number, NiceSelectableListEntity<T>>>({});\n private readonly _activeEntity = signal<NiceSelectableListEntity<T> | null>(null);\n private readonly _checkboxes = signal<NiceSelectableListEntityCheckboxDirective<T>[]>([]);\n private readonly _selectAllState = signal<NiceSelectableListSelectAllState>({\n active: false,\n total: null,\n parameters: null\n });\n\n // Track window loading state\n private _lastWindowIds: (string | number)[] = [];\n private _currentWindowIds: (string | number)[] = [];\n\n public readonly entities = computed(() => Object.values(this._entitiesMap()));\n public readonly activeEntity = this._activeEntity.asReadonly();\n\n public readonly total: Signal<number> = computed(() => this.entities().length);\n public readonly entitiesIds: Signal<(string | number)[]> = computed(() => {\n const ids = Object.keys(this._entitiesMap());\n return this._config.idType === \"string\" ? ids : ids.map((id) => +id);\n });\n public readonly activeEntityId: Signal<string | number | null> = computed(() => this._activeEntity()?.id ?? null);\n\n public readonly selectAllState = this._selectAllState.asReadonly();\n\n constructor(private readonly _injector: Injector, private readonly _config: NiceSelectableListConfig<T>) {}\n\n public init(): void {\n if (!this._entityLoader && this._config.entityLoaderToken) {\n this._entityLoader = this._injector.get(this._config.entityLoaderToken) as\n NiceSelectableListEntityLoader<T, object, number | string>;\n }\n\n if (!this._uiEntityLoader && this._config.uiEntityLoaderToken) {\n this._uiEntityLoader = this._injector.get(this._config.uiEntityLoaderToken) as\n NiceSelectableListUIEntityLoader<T, number | string>;\n }\n\n for (const plugin of this._plugins) {\n plugin.init();\n }\n }\n\n public registerPlugin(plugin: NiceSelectableListPluginDefinition): void {\n this._plugins.push(plugin);\n }\n\n public registerCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void {\n this._checkboxes.update((checkboxes) => [...checkboxes, checkbox]);\n\n const id = this._resolveEntityId(checkbox.selectableEntity());\n const existing = this._entitiesMap()[id];\n\n const selectAllState = this._selectAllState();\n if ((existing && existing.entity === null) || selectAllState.active) {\n const initial = checkbox.selectableEntity();\n const entityResource = this._createEntityResource(id, initial);\n this._entitiesMap.update(\n (_entitiesMap) => ({\n ..._entitiesMap,\n [id]: {\n id,\n entity: entityResource,\n ui: null\n }\n })\n );\n return;\n }\n }\n\n public unregisterCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void {\n this._checkboxes.update((checkboxes) => checkboxes.filter((_checkbox) => _checkbox !== checkbox));\n }\n\n public isEntitySelected(entity: T): Signal<boolean> {\n return computed(() => this._isEntitySelected(entity));\n }\n\n public setEntitiesFromSelections(selections: string[]): void {\n const ids: (string | number)[] = this._config.idType === \"string\" ? selections : selections.map((id) => +id);\n\n const registered = this._checkboxes().map((checkbox) => ({\n id: this._resolveEntityId(checkbox.selectableEntity()), value: checkbox.selectableEntity()\n }));\n const cache = this._cache();\n const entities = ids.map((id) => {\n const known = registered.find(_e => _e.id === id)?.value;\n const cached = cache[id]?.entity;\n const entityResource = known ? this._createEntityResource(id, known) : (cached ?? null);\n return {\n id,\n entity: entityResource\n } as { id: string | number; entity: ResourceRef<T | undefined> | null };\n });\n const mapOut = entities.reduce((map, entity) => ({\n ...map,\n [entity.id]: {\n id: entity.id,\n entity: entity.entity,\n ui: null\n }\n }), {} as Record<string | number, NiceSelectableListEntity<T>>);\n\n this._entitiesMap.set(mapOut);\n this._processCacheFromEntities();\n this._updateWindowForActive();\n }\n\n public selectEntity(entity: T): void {\n const isSelected = this._isEntitySelected(entity);\n if (isSelected) {\n return;\n }\n\n const id = this._resolveEntityId(entity);\n const cached = this._cache()[id];\n const newEntity = {\n id,\n entity: cached?.entity ?? this._createEntityResource(id, entity),\n ui: cached?.ui ?? this._createUIResource(id)\n };\n\n this._entitiesMap.update((entitiesMap) => ({\n ...entitiesMap,\n [id]: newEntity\n }));\n\n this._cache.update((cache) => ({\n ...cache,\n [id]: newEntity\n }));\n\n // Window might change if this selection impacts first/last buckets\n this._updateWindowForActive();\n }\n\n public selectEntities(entities: T[]): void {\n this._entitiesMap.update((entitiesMap) => {\n const newEntitiesMap = { ...entitiesMap };\n const cache = this._cache();\n for (const entity of entities) {\n const id = this._resolveEntityId(entity);\n const cached = cache[id];\n newEntitiesMap[id] = cached ?? {\n id,\n entity: this._createEntityResource(id, entity),\n ui: null\n };\n }\n\n return newEntitiesMap;\n });\n\n this._processCacheFromEntities();\n this._updateWindowForActive();\n }\n\n public deselectEntity(entity: T): void {\n const isSelected = this._isEntitySelected(entity);\n if (!isSelected) {\n return;\n }\n\n const id = this._resolveEntityId(entity);\n this._entitiesMap.update((entitiesMap) => {\n const newEntitiesMap = { ...entitiesMap };\n delete newEntitiesMap[id];\n return newEntitiesMap;\n });\n }\n\n public deselectEntities(entities: T[]): void {\n const toRemove = entities.filter((entity) => this._isEntitySelected(entity));\n\n this._entitiesMap.update((entitiesMap) => {\n const newEntitiesMap = { ...entitiesMap };\n for (const entity of toRemove) {\n const id = this._resolveEntityId(entity);\n delete newEntitiesMap[id];\n }\n\n return newEntitiesMap;\n });\n }\n\n public clear(): void {\n this._entitiesMap.set({});\n this._activeEntity.set(null);\n }\n\n public setSelectAllState(state: NiceSelectableListSelectAllState): void {\n this._selectAllState.set(state);\n\n if (!state.active) {\n this.clear();\n return;\n }\n\n const entities = this._checkboxes().map((checkbox) => checkbox.selectableEntity());\n this._entitiesMap.set(entities.reduce((map, entity) => {\n const id = this._resolveEntityId(entity);\n return {\n ...map,\n [id]: {\n id,\n entity: null,\n ui: null\n }\n };\n }, {} as Record<string | number, NiceSelectableListEntity<T>>));\n\n this._preloadSelectAllValues()\n }\n\n public setActiveFromSelected(selected: string): void {\n const id = this._config.idType === \"string\" ? selected : +selected;\n const entity = this._entitiesMap()[id];\n if (!entity) {\n return;\n }\n\n this._setActiveEntity(id);\n }\n\n public setActiveEntity(entity: T | null): void {\n if (!entity) {\n this._activeEntity.set(null);\n return;\n }\n\n const id = this._resolveEntityId(entity);\n this._setActiveEntity(id);\n }\n\n public selectFirstEntity(): void {\n const id = this.entitiesIds()[0];\n if (!id) {\n return;\n }\n\n this._setActiveEntity(id);\n }\n\n public selectNextEntity(): void {\n const activeEntity = this._activeEntity();\n if (!activeEntity) {\n this.selectFirstEntity();\n return;\n }\n\n const entitiesIds = this.entitiesIds();\n const index = entitiesIds.findIndex((id) => activeEntity.id === id);\n const nextEntityId = entitiesIds[index + 1];\n if (!nextEntityId) {\n return;\n }\n\n this._setActiveEntity(nextEntityId);\n }\n\n public selectPreviousEntity(): void {\n const activeEntity = this._activeEntity();\n if (!activeEntity) {\n this.selectFirstEntity();\n return;\n }\n\n const entitiesIds = this.entitiesIds();\n const index = entitiesIds.findIndex((id) => activeEntity.id === id);\n if (index === 0) {\n return;\n }\n\n const previousEntityId = entitiesIds[index - 1];\n if (!previousEntityId) {\n return;\n }\n\n this._setActiveEntity(previousEntityId);\n }\n\n public selectLastEntity(): void {\n const entitiesIds = this.entitiesIds();\n if (entitiesIds.length === 0) {\n return;\n }\n\n const lastEntityId = entitiesIds[entitiesIds.length - 1];\n if (!lastEntityId) {\n return;\n }\n\n this._setActiveEntity(lastEntityId);\n }\n\n private _isEntitySelected(entity: T): boolean {\n const id = this._resolveEntityId(entity);\n return this._entitiesMap()[id]?.entity !== undefined;\n }\n\n private _resolveEntityId(entity: T): string | number {\n const idProperty = this._config.idProperty;\n const id = entity[idProperty];\n if (typeof id !== \"string\" && typeof id !== \"number\") {\n throw new Error(`The id property must be a string or a number, but got ${typeof id}`);\n }\n\n return id;\n }\n\n private _processCacheFromEntities(): void {\n const entities = this._entitiesMap();\n this._cache.update((cache) => ({ ...cache, ...entities }));\n }\n\n private _createEntityResource(id: string | number, initial?: T | null): ResourceRef<T | undefined> {\n const resource = rxResource<T | undefined, { id: string | number}>({\n request: () => ({ id }),\n loader: ({ request }) => {\n if (this._entityLoader) {\n return this._entityLoader.loadEntitiesByIds([request.id]).pipe(map((arr) => arr?.[0]));\n }\n return of(initial ?? undefined);\n },\n defaultValue: initial ?? undefined,\n injector: this._injector\n });\n\n if (initial) {\n resource.set(initial);\n }\n\n return resource;\n }\n\n private _createUIResource(id: string | number): ResourceRef<T | undefined> | null {\n if (!this._uiEntityLoader) {\n return null;\n }\n\n return rxResource({\n request: () => ({ id }),\n loader: ({ request }) => this._uiEntityLoader!.loadById(request.id),\n injector: this._injector\n });\n }\n\n private _computeWindowIds(): (string | number)[] {\n const ids = this.entitiesIds();\n const n = ids.length;\n if (n === 0) {\n return [];\n }\n\n const set = new Set<string | number>();\n\n // first 3\n for (let i = 0; i < Math.min(3, n); i++) {\n set.add(ids[i]);\n }\n\n // last 3\n for (let i = Math.max(0, n - 3); i < n; i++) {\n set.add(ids[i]);\n }\n\n // active and +/- 3\n const activeId = this.activeEntityId();\n const activeIndex = activeId !== null ? ids.findIndex((i) => i === activeId) : -1;\n if (activeIndex >= 0) {\n for (let i = Math.max(0, activeIndex - 3); i <= Math.min(n - 1, activeIndex + 3); i++) {\n set.add(ids[i]);\n }\n }\n return Array.from(set.values());\n }\n\n private _ensureResourcesForIds(ids: (string | number)[]): void {\n const mapCopy = { ...this._entitiesMap() } as Record<string | number, NiceSelectableListEntity<T>>;\n const cache = this._cache();\n for (const id of ids) {\n const entry = mapCopy[id] ?? cache[id];\n if (!entry) {\n mapCopy[id] = {\n id,\n entity: this._createEntityResource(id),\n ui: this._uiEntityLoader ? this._createUIResource(id) : null\n };\n continue;\n }\n\n if (!entry.entity) {\n entry.entity = this._createEntityResource(id);\n }\n\n if (!entry.ui && this._uiEntityLoader) {\n entry.ui = this._createUIResource(id);\n }\n }\n\n this._entitiesMap.set(mapCopy);\n this._processCacheFromEntities();\n }\n\n private _updateWindowForActive(): void {\n this._lastWindowIds = this._currentWindowIds;\n\n this._currentWindowIds = this._computeWindowIds();\n if (this._currentWindowIds.length) {\n this._ensureResourcesForIds(this._currentWindowIds);\n }\n }\n\n private _setActiveEntity(id: string | number): void {\n const entity = this._entitiesMap()[id];\n if (!entity) {\n return;\n }\n\n if (!entity.entity) {\n entity.entity = this._createEntityResource(id);\n }\n\n if (!entity.ui) {\n entity.ui = this._createUIResource(id);\n }\n\n this._activeEntity.set(entity);\n this._updateWindowForActive();\n }\n\n public _preloadSelectAllValues(): void {\n if (!this._config.preload || !this._entityLoader) {\n return;\n }\n\n this._entityLoader\n .loadIdsFromParameters(this._selectAllState().parameters ?? {})\n .pipe(\n map((ids) => {\n const cache = this._cache();\n this._entitiesMap.set(ids.reduce((map, id) => {\n const cached = cache[id];\n return {\n ...map,\n [id]: cached ?? {\n id,\n entity: null,\n ui: null\n }\n };\n }, {} as Record<string | number, NiceSelectableListEntity<T>>));\n\n this._processCacheFromEntities();\n this._updateWindowForActive();\n })\n )\n .subscribe();\n }\n}\n","import { DestroyRef, inject, InjectionToken, Injector, Provider, Type } from \"@angular/core\";\nimport { NiceSelectableListEntityLoader, NiceSelectableListUIEntityLoader } from \"./loader\";\nimport { NiceSelectableListPluginDefinition } from \"./pluggins/plugin-definition\";\nimport { NiceSelectableListConfig, NiceSelectableListStore } from \"./store\";\n\nexport const NICE_SELECTABLE_LISTS\n = new InjectionToken<NiceSelectableListProvider<unknown>[]>(\"_selectable_list_providers\");\n\nexport const NICE_SELECTABLE_LIST\n = new InjectionToken<NiceSelectableListStore<unknown>>(\"_selectable_list_provider\");\n\nexport type NiceSelectableListProvider<T> = {\n name: string;\n store: NiceSelectableListStore<T>;\n};\n\nexport type NiceSelectableListOptions<T> =\n & { entityLoader?: Type<NiceSelectableListEntityLoader<T>> }\n & { uiEntityLoader?: Type<NiceSelectableListUIEntityLoader<T>> }\n & { plugins?: Type<NiceSelectableListPluginDefinition>[] }\n & Omit<NiceSelectableListConfig<T>, \"entityLoaderToken\" | \"uiEntityLoaderToken\">;\n\nexport function provideNiceSelectableList<T>(options?: NiceSelectableListOptions<T>): Provider[];\nexport function provideNiceSelectableList<T>(name: string, options?: NiceSelectableListOptions<T>): Provider[];\nexport function provideNiceSelectableList<T>(...args: unknown[]): Provider[] {\n const name: string | null = typeof args[0] === \"string\" ? args[0] : null;\n const options = (typeof args[0] === \"string\" ? args[1] : args[0]) as NiceSelectableListOptions<T> | undefined;\n\n const providers: Provider[] = [];\n\n const entityLoaderToken = options?.entityLoader\n ? new InjectionToken<unknown>(options.entityLoader.name)\n : null;\n if (entityLoaderToken && options?.entityLoader) {\n providers.push({\n provide: entityLoaderToken,\n useClass: options.entityLoader\n });\n }\n\n const uiEntityLoaderToken = options?.uiEntityLoader\n ? new InjectionToken<unknown>(options.uiEntityLoader.name)\n : null;\n if (uiEntityLoaderToken && options?.uiEntityLoader) {\n providers.push({\n provide: uiEntityLoaderToken,\n useClass: options.uiEntityLoader\n });\n }\n\n if (!name) {\n providers.push({\n provide: NICE_SELECTABLE_LIST,\n useFactory: (injector: Injector, destroyRef: DestroyRef) => {\n const store = new NiceSelectableListStore(injector, {\n idProperty: options?.idProperty ?? \"id\" as keyof T,\n idType: options?.idType ?? \"number\" as \"string\" | \"number\",\n entityLoaderToken,\n uiEntityLoaderToken,\n preload: options?.preload ?? entityLoaderToken !== null\n });\n\n for (const plugin of options?.plugins ?? []) {\n new plugin(injector, destroyRef, store);\n }\n\n return store;\n },\n deps: [Injector, DestroyRef]\n });\n } else {\n providers.push({\n provide: NICE_SELECTABLE_LISTS,\n useFactory: (injector: Injector, destroyRef: DestroyRef) => {\n const store = new NiceSelectableListStore(injector, {\n idProperty: options?.idProperty ?? \"id\" as keyof T,\n idType: options?.idType ?? \"number\" as \"string\" | \"number\",\n entityLoaderToken,\n uiEntityLoaderToken,\n preload: options?.preload ?? entityLoaderToken !== null\n });\n\n for (const plugin of options?.plugins ?? []) {\n new plugin(injector, destroyRef, store);\n }\n\n return {\n name,\n store\n };\n },\n deps: [Injector, DestroyRef],\n multi: true\n });\n }\n\n return providers;\n}\n\nexport type ResolveNiceSelectableListOptions = { injector: Injector };\n\nexport function resolveNiceSelectableList<T>(\n name: string,\n options?: ResolveNiceSelectableListOptions\n): NiceSelectableListStore<T>;\nexport function resolveNiceSelectableList<T>(options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;\nexport function resolveNiceSelectableList<T>(...args: unknown[]): NiceSelectableListStore<T> {\n const name: string | null = typeof args[0] === \"string\" ? args[0] : null;\n const options = (typeof args[0] === \"string\" ? args[1] : args[0]) as ResolveNiceSelectableListOptions | undefined;\n\n if (!name) {\n return (options?.injector\n ? options.injector.get(NICE_SELECTABLE_LIST)\n : inject(NICE_SELECTABLE_LIST)) as NiceSelectableListStore<T>;\n }\n\n const selectableLists = options?.injector\n ? options.injector.get(NICE_SELECTABLE_LISTS)\n : inject(NICE_SELECTABLE_LISTS);\n\n const provider = selectableLists.find((_provider) => _provider.name === name);\n if (!provider) {\n throw new Error(`No selectable list provider found for name: ${name}`);\n }\n\n return provider.store as NiceSelectableListStore<T>;\n}\n","import {\n computed,\n contentChildren,\n Directive,\n effect,\n forwardRef,\n inject,\n InjectionToken,\n Injector,\n input,\n signal,\n Signal, untracked\n} from \"@angular/core\";\nimport { NiceSelectableListEntityCheckboxDirective } from \"./entity-checkbox.directive\";\nimport { resolveNiceSelectableList } from \"./provider\";\nimport { NiceSelectableListStore } from \"./store\";\n\nexport const NICE_SELECTABLE_LIST_DIRECTIVE\n = new InjectionToken<NiceSelectableList<unknown>>(\"_selectable_list_directive\");\n\nexport type NiceSelectableList<T> = {\n name: Signal<string | null>;\n initialized: Signal<boolean>;\n allSelected: Signal<boolean>;\n checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;\n};\n\n@Directive({\n selector: \"[niceSelectableList]\",\n providers: [\n { provide: NICE_SELECTABLE_LIST_DIRECTIVE, useExisting: forwardRef(() => SelectableListDirective) }\n ]\n})\nexport class SelectableListDirective<T> implements NiceSelectableList<T> {\n public readonly name = input<string | null>(null, { alias: \"niceSelectableList\" });\n\n public readonly checkboxes = contentChildren<NiceSelectableListEntityCheckboxDirective<T>>(\n NiceSelectableListEntityCheckboxDirective,\n { descendants: true }\n );\n\n private readonly _initialized = signal(false);\n public readonly initialized = this._initialized.asReadonly();\n\n public readonly allSelected = computed(() => this.selectableLists.selectAllState().active);\n\n protected readonly injector = inject(Injector);\n\n protected selectableLists!: NiceSelectableListStore<T>;\n\n constructor() {\n effect(() => {\n const name = this.name();\n this.selectableLists = name\n ? resolveNiceSelectableList(name, { injector: this.injector })\n : resolveNiceSelectableList({ injector: this.injector });\n\n untracked(() => this.selectableLists.init());\n });\n }\n}\n","import { inject } from \"@angular/core\";\nimport { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS } from \"./provider\";\nimport { NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableList } from \"./selectable-list\";\nimport { NiceSelectableListStore } from \"./store\";\n\nexport function injectNiceSelectableListDirective<T>(): NiceSelectableList<T> {\n return inject(NICE_SELECTABLE_LIST_DIRECTIVE, { optional: true }) as NiceSelectableList<T>;\n}\n\nexport function injectNiceSelectableList<T>(name?: string): NiceSelectableListStore<T> {\n const storeName = name ?? injectNiceSelectableListDirective()?.name();\n if (!storeName) {\n return inject(NICE_SELECTABLE_LIST) as NiceSelectableListStore<T>;\n }\n\n const selectableLists = inject(NICE_SELECTABLE_LISTS);\n const provider = selectableLists.find((_provider) => _provider.name === storeName);\n if (!provider) {\n throw new Error(`No selectable list provider found for name: ${storeName}`);\n }\n\n return provider.store as NiceSelectableListStore<T>;\n}\n","import {\n computed,\n DestroyRef,\n Directive,\n effect,\n inject,\n input,\n OnDestroy,\n OnInit\n} from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { MatCheckbox } from \"@angular/material/checkbox\";\nimport { injectNiceSelectableList } from \"./injector\";\n\n@Directive({\n selector: \"mat-checkbox[niceSelectableListEntityCheckbox]\"\n})\nexport class NiceSelectableListEntityCheckboxDirective<T> implements OnInit, OnDestroy {\n protected readonly matCheckbox = inject(MatCheckbox);\n protected readonly destroyRef = inject(DestroyRef);\n protected readonly niceSelectableList = injectNiceSelectableList<T>();\n\n public readonly selectableEntity = input.required<T>();\n public readonly isSelected = computed(() => this.niceSelectableList.isEntitySelected(this.selectableEntity())());\n\n constructor() {\n effect(() => {\n this.matCheckbox.disabled = this.niceSelectableList.selectAllState().active;\n });\n\n effect(() => {\n this.matCheckbox.checked = this.niceSelectableList.isEntitySelected(this.selectableEntity())();\n });\n }\n\n public ngOnInit(): void {\n this.niceSelectableList.registerCheckbox(this);\n\n this.matCheckbox.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ checked }) => {\n if (checked) {\n this.niceSelectableList.selectEntity(this.selectableEntity());\n } else {\n this.niceSelectableList.deselectEntity(this.selectableEntity());\n }\n });\n }\n\n public ngOnDestroy(): void {\n this.niceSelectableList.unregisterCheckbox(this);\n }\n\n public selectEntity(): void {\n this.matCheckbox.checked = true;\n this.matCheckbox.change.emit({ checked: true, source: this.matCheckbox });\n }\n\n public deselectEntity(): void {\n this.matCheckbox.checked = false;\n this.matCheckbox.change.emit({ checked: false, source: this.matCheckbox });\n }\n}\n","import { afterRenderEffect, DestroyRef, Directive, effect, inject, OnInit } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { MatCheckbox } from \"@angular/material/checkbox\";\nimport { injectNiceSelectableList, injectNiceSelectableListDirective } from \"./injector\";\n\n@Directive({\n selector: \"mat-checkbox[niceSelectableListHeaderCheckbox]\"\n})\nexport class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {\n private readonly niceSelectableListDirective = injectNiceSelectableListDirective<T>();\n private readonly niceSelectableList = injectNiceSelectableList<T>();\n private readonly matCheckbox = inject(MatCheckbox);\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n effect(() => {\n this.matCheckbox.disabled = this.niceSelectableListDirective.allSelected();\n });\n\n afterRenderEffect({\n read: () => {\n const allSelected = this.niceSelectableListDirective.allSelected();\n if (allSelected) {\n this.matCheckbox.checked = true;\n return;\n }\n\n const checkboxes = this.niceSelectableListDirective.checkboxes();\n const empty = checkboxes.length === 0;\n\n this.matCheckbox.checked = !empty && checkboxes.every((checkbox) => checkbox.isSelected());\n this.matCheckbox.indeterminate = !this.matCheckbox.checked\n && checkboxes.some((checkbox) => checkbox.isSelected());\n }\n });\n }\n\n public ngOnInit(): void {\n this.matCheckbox.change.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(({ checked }) => {\n const entities = this.niceSelectableListDirective\n .checkboxes()\n .map((checkbox) => checkbox.selectableEntity());\n\n if (checked) {\n this.niceSelectableList.selectEntities(entities);\n } else {\n this.niceSelectableList.deselectEntities(entities);\n }\n });\n }\n}\n","import { DestroyRef, Injector } from \"@angular/core\";\nimport { NiceSelectableListStore } from \"../store\";\n\nexport abstract class NiceSelectableListPluginDefinition {\n constructor(\n protected readonly _injector: Injector,\n protected readonly _destroyRef: DestroyRef,\n protected readonly _store: NiceSelectableListStore<unknown>\n ) {\n this._store.registerPlugin(this);\n _destroyRef.onDestroy(() => this.cleanup());\n }\n\n public abstract init(): void;\n public abstract cleanup(): void;\n}\n","import { effect, EffectRef, signal } from \"@angular/core\";\nimport { ActivatedRoute, NavigationEnd, NavigationStart, Router } from \"@angular/router\";\nimport { from, Observable, of, Subject, Subscription } from \"rxjs\";\nimport { combineLatestWith, filter, map, startWith, switchMap, take } from \"rxjs/operators\";\nimport { NiceSelectableListPluginDefinition } from \"../plugin-definition\";\nimport { NiceSelectableListQueryParams } from \"./types/query-params.type\";\n\nexport class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition {\n private router!: Router;\n private route!: ActivatedRoute;\n\n private _storeChangesEffectRef!: EffectRef;\n private _writeQueryParamsSub!: Subscription;\n\n private _isNavigating$!: Observable<boolean>;\n\n private readonly _initialized = signal(false);\n private readonly _nextQueryParams = new Subject<NiceSelectableListQueryParams>();\n\n public override init(): void {\n this.router = this._injector.get(Router);\n this.route = this._injector.get(ActivatedRoute);\n\n this._isNavigating$ = this.router.events.pipe(\n filter((event) => event instanceof NavigationStart || event instanceof NavigationEnd),\n map((event) => event instanceof NavigationStart),\n startWith(!this.router.navigated)\n );\n\n this.listenOnQueryParams();\n this.listenOnStoreChanges();\n this.writeQueryParams();\n }\n\n public override cleanup(): void {\n this._storeChangesEffectRef.destroy();\n this._writeQueryParamsSub.unsubscribe();\n }\n\n private listenOnQueryParams(): void {\n if (this.router.navigated) {\n this.parseQueryParams(this.route.snapshot.queryParams);\n this._initialized.set(true);\n return;\n }\n\n this.router.events\n .pipe(\n filter((event) => event instanceof NavigationEnd),\n take(1)\n )\n .subscribe(() => {\n this.parseQueryParams(this.route.snapshot.queryParams);\n this._initialized.set(true);\n });\n }\n\n private listenOnStoreChanges(): void {\n this._storeChangesEffectRef = effect(() => {\n if (!this._initialized()) {\n return;\n }\n\n const entities = this._store.entitiesIds();\n const activeEntity = this._store.activeEntityId();\n const selectAllState = this._store.selectAllState();\n\n const params: NiceSelectableListQueryParams = {\n ...(selectAllState.active && {\n allSelected: true,\n ...(selectAllState.parameters && ({\n allSelectedParameters: JSON.stringify(selectAllState.parameters)\n }))\n }),\n selection: entities,\n selected: activeEntity\n };\n this._nextQueryParams.next(params);\n }, {\n injector: this._injector,\n manualCleanup: true\n });\n }\n\n private parseQueryParams(params: {\n allSelected?: boolean;\n allSelectedParameters?: string;\n selection?: string | string[];\n selected?: string;\n }): void {\n if (params.selection) {\n const selection = Array.isArray(params.selection)\n ? params.selection\n : [params.selection];\n\n this._store.setEntitiesFromSelections(selection);\n }\n\n if (params.selected) {\n this._store.setActiveFromSelected(params.selected);\n }\n\n if (params.allSelected) {\n this._store.setSelectAllState({\n active: true,\n total: this._store.total(),\n parameters: params.allSelectedParameters\n ? JSON.parse(params.allSelectedParameters)\n : null\n });\n }\n }\n\n private writeQueryParams(): void {\n this._writeQueryParamsSub = this._nextQueryParams.pipe(\n combineLatestWith(this._isNavigating$),\n switchMap(([params, isNavigating]) => {\n if (isNavigating) {\n return of(false);\n }\n\n return from(this.router.navigate([], { queryParams: params, onSameUrlNavigation: \"ignore\" }));\n })\n ).subscribe();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["map"],"mappings":";;;;;;;;MA4Ba,uBAAuB,CAAA;AAgCH,IAAA,SAAA;AAAsC,IAAA,OAAA;IA/BlD,QAAQ,GAAyC,EAAE;IAC5D,aAAa,GAAsE,IAAI;IACvF,eAAe,GAAgE,IAAI;AAE1E,IAAA,MAAM,GAAG,MAAM,CAAuD,EAAE,CAAC;AAEzE,IAAA,YAAY,GAAG,MAAM,CAAuD,EAAE,CAAC;AAC/E,IAAA,aAAa,GAAG,MAAM,CAAqC,IAAI,CAAC;AAChE,IAAA,WAAW,GAAG,MAAM,CAAiD,EAAE,CAAC;IACxE,eAAe,GAAG,MAAM,CAAmC;AACxE,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,UAAU,EAAE;AACf,KAAA,CAAC;;IAGM,cAAc,GAAwB,EAAE;IACxC,iBAAiB,GAAwB,EAAE;AAEnC,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;AAC7D,IAAA,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE;AAE9C,IAAA,KAAK,GAAmB,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;AAC9D,IAAA,WAAW,GAAgC,QAAQ,CAAC,MAAK;QACrE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;AACxE,KAAC,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AC,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC,CAAC;AACjG,SAAC,CAAC,CACL,CAAC,SAAS,EAAE;;AAEpB;;AC7HD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recursyve/nice-selectable-list",
3
- "version": "19.0.0-beta.2",
3
+ "version": "19.0.0-beta.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.0",
6
6
  "@angular/cdk": "^19.2.0",
@@ -2,6 +2,7 @@ import { OnInit } from "@angular/core";
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {
4
4
  private readonly niceSelectableListDirective;
5
+ private readonly niceSelectableList;
5
6
  private readonly matCheckbox;
6
7
  private readonly destroyRef;
7
8
  constructor();
@@ -1,6 +1,8 @@
1
1
  export * from "./entity-checkbox.directive";
2
2
  export * from "./header-checkbox.directive";
3
3
  export * from "./selectable-list";
4
+ export * from "./loader";
5
+ export * from "./pluggins";
4
6
  export * from "./injector";
5
7
  export * from "./provider";
6
8
  export * from "./store";
@@ -0,0 +1,5 @@
1
+ import { Observable } from "rxjs";
2
+ export type NiceSelectableListEntityLoader<T, TParameters = object, TID = number> = {
3
+ loadEntitiesByIds: (ids: TID[]) => Observable<T[]>;
4
+ loadIdsFromParameters: (parameters: TParameters) => Observable<TID[]>;
5
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./entity-loader";
2
+ export * from "./ui-entity-loader";
@@ -0,0 +1,4 @@
1
+ import { Observable } from "rxjs";
2
+ export type NiceSelectableListUIEntityLoader<T, TID = number> = {
3
+ loadById: (ids: TID) => Observable<T>;
4
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./plugin-definition";
2
+ export * from "./query-params/plugin";
@@ -0,0 +1,10 @@
1
+ import { DestroyRef, Injector } from "@angular/core";
2
+ import { NiceSelectableListStore } from "../store";
3
+ export declare abstract class NiceSelectableListPluginDefinition {
4
+ protected readonly _injector: Injector;
5
+ protected readonly _destroyRef: DestroyRef;
6
+ protected readonly _store: NiceSelectableListStore<unknown>;
7
+ constructor(_injector: Injector, _destroyRef: DestroyRef, _store: NiceSelectableListStore<unknown>);
8
+ abstract init(): void;
9
+ abstract cleanup(): void;
10
+ }
@@ -0,0 +1,16 @@
1
+ import { NiceSelectableListPluginDefinition } from "../plugin-definition";
2
+ export declare class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition {
3
+ private router;
4
+ private route;
5
+ private _storeChangesEffectRef;
6
+ private _writeQueryParamsSub;
7
+ private _isNavigating$;
8
+ private readonly _initialized;
9
+ private readonly _nextQueryParams;
10
+ init(): void;
11
+ cleanup(): void;
12
+ private listenOnQueryParams;
13
+ private listenOnStoreChanges;
14
+ private parseQueryParams;
15
+ private writeQueryParams;
16
+ }
@@ -0,0 +1,6 @@
1
+ export type NiceSelectableListQueryParams = {
2
+ allSelected?: boolean;
3
+ allSelectedParameters?: string;
4
+ selection?: (string | number)[];
5
+ selected?: string | number | null;
6
+ };
@@ -1,4 +1,6 @@
1
- import { FactoryProvider, InjectionToken, Injector } from "@angular/core";
1
+ import { InjectionToken, Injector, Provider, Type } from "@angular/core";
2
+ import { NiceSelectableListEntityLoader, NiceSelectableListUIEntityLoader } from "./loader";
3
+ import { NiceSelectableListPluginDefinition } from "./pluggins/plugin-definition";
2
4
  import { NiceSelectableListConfig, NiceSelectableListStore } from "./store";
3
5
  export declare const NICE_SELECTABLE_LISTS: InjectionToken<NiceSelectableListProvider<unknown>[]>;
4
6
  export declare const NICE_SELECTABLE_LIST: InjectionToken<NiceSelectableListStore<unknown>>;
@@ -6,8 +8,15 @@ export type NiceSelectableListProvider<T> = {
6
8
  name: string;
7
9
  store: NiceSelectableListStore<T>;
8
10
  };
9
- export declare function provideNiceSelectableList<T>(config?: NiceSelectableListConfig<T>): FactoryProvider;
10
- export declare function provideNiceSelectableList<T>(name: string, config?: NiceSelectableListConfig<T>): FactoryProvider;
11
+ export type NiceSelectableListOptions<T> = {
12
+ entityLoader?: Type<NiceSelectableListEntityLoader<T>>;
13
+ } & {
14
+ uiEntityLoader?: Type<NiceSelectableListUIEntityLoader<T>>;
15
+ } & {
16
+ plugins?: Type<NiceSelectableListPluginDefinition>[];
17
+ } & Omit<NiceSelectableListConfig<T>, "entityLoaderToken" | "uiEntityLoaderToken">;
18
+ export declare function provideNiceSelectableList<T>(options?: NiceSelectableListOptions<T>): Provider[];
19
+ export declare function provideNiceSelectableList<T>(name: string, options?: NiceSelectableListOptions<T>): Provider[];
11
20
  export type ResolveNiceSelectableListOptions = {
12
21
  injector: Injector;
13
22
  };
@@ -1,27 +1,23 @@
1
- import { InjectionToken, Injector, OnInit, Signal } from "@angular/core";
2
- import { ActivatedRoute, Router } from "@angular/router";
1
+ import { InjectionToken, Injector, Signal } from "@angular/core";
3
2
  import { NiceSelectableListEntityCheckboxDirective } from "./entity-checkbox.directive";
4
3
  import { NiceSelectableListStore } from "./store";
5
4
  import * as i0 from "@angular/core";
6
5
  export declare const NICE_SELECTABLE_LIST_DIRECTIVE: InjectionToken<NiceSelectableList<unknown>>;
7
6
  export type NiceSelectableList<T> = {
8
7
  name: Signal<string | null>;
8
+ initialized: Signal<boolean>;
9
+ allSelected: Signal<boolean>;
9
10
  checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
10
11
  };
11
- export declare class SelectableListDirective<T> implements NiceSelectableList<T>, OnInit {
12
+ export declare class SelectableListDirective<T> implements NiceSelectableList<T> {
12
13
  readonly name: import("@angular/core").InputSignal<string | null>;
13
- readonly enableQueryParams: import("@angular/core").InputSignal<boolean>;
14
14
  readonly checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
15
15
  private readonly _initialized;
16
16
  readonly initialized: Signal<boolean>;
17
- protected readonly route: ActivatedRoute;
18
- protected readonly router: Router;
17
+ readonly allSelected: Signal<boolean>;
19
18
  protected readonly injector: Injector;
20
19
  protected selectableLists: NiceSelectableListStore<T>;
21
20
  constructor();
22
- ngOnInit(): void;
23
- private loadQueryParams;
24
- private parseQueryParams;
25
21
  static ɵfac: i0.ɵɵFactoryDeclaration<SelectableListDirective<any>, never>;
26
- static ɵdir: i0.ɵɵDirectiveDeclaration<SelectableListDirective<any>, "[niceSelectableList]", never, { "name": { "alias": "niceSelectableList"; "required": false; "isSignal": true; }; "enableQueryParams": { "alias": "enableQueryParams"; "required": false; "isSignal": true; }; }, {}, ["checkboxes"], never, true, never>;
22
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SelectableListDirective<any>, "[niceSelectableList]", never, { "name": { "alias": "niceSelectableList"; "required": false; "isSignal": true; }; }, {}, ["checkboxes"], never, true, never>;
27
23
  }
@@ -1,31 +1,56 @@
1
- import { Signal } from "@angular/core";
1
+ import { InjectionToken, Injector, ResourceRef, Signal } from "@angular/core";
2
+ import { NiceSelectableListPluginDefinition } from "./pluggins/plugin-definition";
2
3
  import { NiceSelectableListEntityCheckboxDirective } from "./entity-checkbox.directive";
4
+ import { NiceSelectableListEntityLoader, NiceSelectableListUIEntityLoader } from "./loader";
3
5
  export type NiceSelectableListConfig<T> = {
4
6
  idProperty: keyof T;
5
7
  idType?: "string" | "number";
8
+ entityLoaderToken: InjectionToken<NiceSelectableListEntityLoader<T>> | null;
9
+ uiEntityLoaderToken: InjectionToken<NiceSelectableListUIEntityLoader<T>> | null;
10
+ preload?: boolean;
6
11
  };
7
12
  export type NiceSelectableListEntity<T> = {
8
13
  id: string | number;
9
- entity: T | null;
14
+ entity: ResourceRef<T | undefined> | null;
15
+ ui: ResourceRef<T | undefined> | null;
16
+ };
17
+ export type NiceSelectableListSelectAllState = {
18
+ active: boolean;
19
+ total: number | null;
20
+ parameters: object | null;
10
21
  };
11
22
  export declare class NiceSelectableListStore<T> {
23
+ private readonly _injector;
12
24
  private readonly _config;
13
- private readonly _entities;
25
+ private readonly _plugins;
26
+ private _entityLoader;
27
+ private _uiEntityLoader;
28
+ private readonly _cache;
29
+ private readonly _entitiesMap;
14
30
  private readonly _activeEntity;
15
31
  private readonly _checkboxes;
32
+ private readonly _selectAllState;
33
+ private _lastWindowIds;
34
+ private _currentWindowIds;
16
35
  readonly entities: Signal<NiceSelectableListEntity<T>[]>;
17
36
  readonly activeEntity: Signal<NiceSelectableListEntity<T> | null>;
18
37
  readonly total: Signal<number>;
19
38
  readonly entitiesIds: Signal<(string | number)[]>;
20
39
  readonly activeEntityId: Signal<string | number | null>;
21
- constructor(_config: NiceSelectableListConfig<T>);
40
+ readonly selectAllState: Signal<NiceSelectableListSelectAllState>;
41
+ constructor(_injector: Injector, _config: NiceSelectableListConfig<T>);
42
+ init(): void;
43
+ registerPlugin(plugin: NiceSelectableListPluginDefinition): void;
22
44
  registerCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
23
45
  unregisterCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
24
46
  isEntitySelected(entity: T): Signal<boolean>;
25
47
  setEntitiesFromSelections(selections: string[]): void;
26
48
  selectEntity(entity: T): void;
49
+ selectEntities(entities: T[]): void;
27
50
  deselectEntity(entity: T): void;
51
+ deselectEntities(entities: T[]): void;
28
52
  clear(): void;
53
+ setSelectAllState(state: NiceSelectableListSelectAllState): void;
29
54
  setActiveFromSelected(selected: string): void;
30
55
  setActiveEntity(entity: T | null): void;
31
56
  selectFirstEntity(): void;
@@ -34,4 +59,12 @@ export declare class NiceSelectableListStore<T> {
34
59
  selectLastEntity(): void;
35
60
  private _isEntitySelected;
36
61
  private _resolveEntityId;
62
+ private _processCacheFromEntities;
63
+ private _createEntityResource;
64
+ private _createUIResource;
65
+ private _computeWindowIds;
66
+ private _ensureResourcesForIds;
67
+ private _updateWindowForActive;
68
+ private _setActiveEntity;
69
+ _preloadSelectAllValues(): void;
37
70
  }