@recursyve/nice-selectable-list 21.0.0 → 21.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, computed, InjectionToken, Injector, DestroyRef, inject, input, contentChildren, effect, untracked, forwardRef, Directive, afterRenderEffect } from '@angular/core';
2
+ import { signal, computed, afterNextRender, InjectionToken, Injector, DestroyRef, inject, input, contentChildren, effect, forwardRef, Directive, afterRenderEffect, HostListener } from '@angular/core';
3
3
  import { rxResource, takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
4
  import { MatCheckbox } from '@angular/material/checkbox';
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';
5
+ import { map, of, ReplaySubject, from, finalize } from 'rxjs';
6
+ import { Router, ActivatedRoute, NavigationStart, NavigationEnd, NavigationSkipped, NavigationCancel, NavigationError } from '@angular/router';
7
+ import { filter, map as map$1, startWith, distinctUntilChanged, take, switchMap, delay, withLatestFrom } from 'rxjs/operators';
8
8
 
9
9
  class NiceSelectableListStore {
10
10
  _injector;
@@ -12,6 +12,7 @@ class NiceSelectableListStore {
12
12
  _plugins = [];
13
13
  _entityLoader = null;
14
14
  _uiEntityLoader = null;
15
+ _initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
15
16
  _cache = signal({}, ...(ngDevMode ? [{ debugName: "_cache" }] : []));
16
17
  _entitiesMap = signal({}, ...(ngDevMode ? [{ debugName: "_entitiesMap" }] : []));
17
18
  _activeEntity = signal(null, ...(ngDevMode ? [{ debugName: "_activeEntity" }] : []));
@@ -24,11 +25,11 @@ class NiceSelectableListStore {
24
25
  // Track window loading state
25
26
  _lastWindowIds = [];
26
27
  _currentWindowIds = [];
27
- entities = computed(() => Object.values(this._entitiesMap()), ...(ngDevMode ? [{ debugName: "entities" }] : []));
28
+ entities = computed(() => Object.values(this._entitiesMap()).reverse(), ...(ngDevMode ? [{ debugName: "entities" }] : []));
28
29
  activeEntity = this._activeEntity.asReadonly();
29
30
  total = computed(() => this.entities().length, ...(ngDevMode ? [{ debugName: "total" }] : []));
30
31
  entitiesIds = computed(() => {
31
- const ids = Object.keys(this._entitiesMap());
32
+ const ids = Object.keys(this._entitiesMap()).reverse();
32
33
  return this._config.idType === "string" ? ids : ids.map((id) => +id);
33
34
  }, ...(ngDevMode ? [{ debugName: "entitiesIds" }] : []));
34
35
  activeEntityId = computed(() => this._activeEntity()?.id ?? null, ...(ngDevMode ? [{ debugName: "activeEntityId" }] : []));
@@ -36,8 +37,12 @@ class NiceSelectableListStore {
36
37
  constructor(_injector, _config) {
37
38
  this._injector = _injector;
38
39
  this._config = _config;
40
+ afterNextRender(() => this.init());
39
41
  }
40
42
  init() {
43
+ if (this._initialized()) {
44
+ return;
45
+ }
41
46
  if (!this._entityLoader && this._config.entityLoaderToken) {
42
47
  this._entityLoader = this._injector.get(this._config.entityLoaderToken);
43
48
  }
@@ -47,6 +52,7 @@ class NiceSelectableListStore {
47
52
  for (const plugin of this._plugins) {
48
53
  plugin.init();
49
54
  }
55
+ this._initialized.set(true);
50
56
  }
51
57
  registerPlugin(plugin) {
52
58
  this._plugins.push(plugin);
@@ -56,7 +62,7 @@ class NiceSelectableListStore {
56
62
  const id = this._resolveEntityId(checkbox.selectableEntity());
57
63
  const existing = this._entitiesMap()[id];
58
64
  const selectAllState = this._selectAllState();
59
- if ((existing && existing.entity === null) || selectAllState.active) {
65
+ if ((existing && !existing.entity) || selectAllState.active) {
60
66
  const initial = checkbox.selectableEntity();
61
67
  const entityResource = this._createEntityResource(id, initial);
62
68
  this._entitiesMap.update((_entitiesMap) => ({
@@ -258,7 +264,7 @@ class NiceSelectableListStore {
258
264
  }
259
265
  _isEntitySelected(entity) {
260
266
  const id = this._resolveEntityId(entity);
261
- return this._entitiesMap()[id]?.entity !== undefined;
267
+ return id in this._entitiesMap();
262
268
  }
263
269
  _resolveEntityId(entity) {
264
270
  const idProperty = this._config.idProperty;
@@ -495,7 +501,6 @@ class SelectableListDirective {
495
501
  this.selectableLists = name
496
502
  ? resolveNiceSelectableList(name, { injector: this.injector })
497
503
  : resolveNiceSelectableList({ injector: this.injector });
498
- untracked(() => this.selectableLists.init());
499
504
  });
500
505
  }
501
506
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: SelectableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
@@ -622,6 +627,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
622
627
  }]
623
628
  }], ctorParameters: () => [] });
624
629
 
630
+ class NiceSelectableListSelectAllDirective {
631
+ niceSelectableList = injectNiceSelectableList();
632
+ action = input("select", ...(ngDevMode ? [{ debugName: "action" }] : []));
633
+ total = input(null, ...(ngDevMode ? [{ debugName: "total" }] : []));
634
+ parameters = input(null, ...(ngDevMode ? [{ debugName: "parameters" }] : []));
635
+ onClick() {
636
+ if (this.action() === "select") {
637
+ this.niceSelectableList.setSelectAllState({
638
+ active: true,
639
+ total: this.total(),
640
+ parameters: this.parameters()
641
+ });
642
+ }
643
+ else {
644
+ this.niceSelectableList.setSelectAllState({
645
+ active: false,
646
+ total: null,
647
+ parameters: null
648
+ });
649
+ }
650
+ }
651
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: NiceSelectableListSelectAllDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
652
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.5", type: NiceSelectableListSelectAllDirective, isStandalone: true, selector: "button[niceSelectableListSelectAll]", inputs: { action: { classPropertyName: "action", publicName: "action", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
653
+ }
654
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: NiceSelectableListSelectAllDirective, decorators: [{
655
+ type: Directive,
656
+ args: [{
657
+ selector: "button[niceSelectableListSelectAll]"
658
+ }]
659
+ }], propDecorators: { action: [{ type: i0.Input, args: [{ isSignal: true, alias: "action", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameters", required: false }] }], onClick: [{
660
+ type: HostListener,
661
+ args: ["click"]
662
+ }] } });
663
+
625
664
  class NiceSelectableListPluginDefinition {
626
665
  _injector;
627
666
  _destroyRef;
@@ -641,12 +680,30 @@ class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition
641
680
  _storeChangesEffectRef;
642
681
  _writeQueryParamsSub;
643
682
  _isNavigating$;
683
+ _lastQueryParams = null;
644
684
  _initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
645
- _nextQueryParams = new Subject();
685
+ _nextQueryParams = new ReplaySubject(1);
686
+ _queryParamState = computed(() => ({
687
+ entities: this._store.entitiesIds(),
688
+ activeEntity: this._store.activeEntityId(),
689
+ selectAllState: this._store.selectAllState()
690
+ }), { ...(ngDevMode ? { debugName: "_queryParamState" } : {}), equal: (a, b) => {
691
+ const selectAllEqual = a.selectAllState.active === b.selectAllState.active &&
692
+ a.selectAllState.total === b.selectAllState.total &&
693
+ JSON.stringify(a.selectAllState.parameters) === JSON.stringify(b.selectAllState.parameters);
694
+ const entitiesEqual = a.entities.length === b.entities.length &&
695
+ a.entities.every((entity, index) => entity === b.entities[index]);
696
+ const activeEntityEqual = a.activeEntity === b.activeEntity;
697
+ return selectAllEqual && entitiesEqual && activeEntityEqual;
698
+ } });
646
699
  init() {
647
700
  this.router = this._injector.get(Router);
648
701
  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));
702
+ this._isNavigating$ = this.router.events.pipe(filter((event) => event instanceof NavigationStart ||
703
+ event instanceof NavigationEnd ||
704
+ event instanceof NavigationSkipped ||
705
+ event instanceof NavigationCancel ||
706
+ event instanceof NavigationError), map$1((event) => event instanceof NavigationStart), startWith(!this.router.navigated), distinctUntilChanged());
650
707
  this.listenOnQueryParams();
651
708
  this.listenOnStoreChanges();
652
709
  this.writeQueryParams();
@@ -673,9 +730,7 @@ class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition
673
730
  if (!this._initialized()) {
674
731
  return;
675
732
  }
676
- const entities = this._store.entitiesIds();
677
- const activeEntity = this._store.activeEntityId();
678
- const selectAllState = this._store.selectAllState();
733
+ const { entities, activeEntity, selectAllState } = this._queryParamState();
679
734
  const params = {
680
735
  ...(selectAllState.active && {
681
736
  allSelected: true,
@@ -711,11 +766,19 @@ class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition
711
766
  }
712
767
  }
713
768
  writeQueryParams() {
714
- this._writeQueryParamsSub = this._nextQueryParams.pipe(combineLatestWith(this._isNavigating$), switchMap(([params, isNavigating]) => {
715
- if (isNavigating) {
769
+ this._writeQueryParamsSub = this._nextQueryParams.pipe(switchMap((params) => {
770
+ if (params === this._lastQueryParams) {
716
771
  return of(false);
717
772
  }
718
- return from(this.router.navigate([], { queryParams: params, onSameUrlNavigation: "ignore" }));
773
+ return this._isNavigating$.pipe(filter((isNavigating) => !isNavigating), take(1), delay(0), withLatestFrom(this._isNavigating$), switchMap(([_, isNavigating]) => {
774
+ if (isNavigating || JSON.stringify(params) === JSON.stringify(this._lastQueryParams)) {
775
+ return of(false);
776
+ }
777
+ return from(this.router.navigate([], {
778
+ queryParams: params,
779
+ queryParamsHandling: "merge"
780
+ })).pipe(finalize(() => this._lastQueryParams = params));
781
+ }));
719
782
  })).subscribe();
720
783
  }
721
784
  }
@@ -724,5 +787,5 @@ class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition
724
787
  * Generated bundle index. Do not edit.
725
788
  */
726
789
 
727
- export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListPluginDefinition, NiceSelectableListStore, NiceSelectableQueryParamsPlugin, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
790
+ export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListPluginDefinition, NiceSelectableListSelectAllDirective, NiceSelectableListStore, NiceSelectableQueryParamsPlugin, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
728
791
  //# 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/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 params: () => ({ id }),\n stream: ({ params }) => {\n if (this._entityLoader) {\n return this._entityLoader.loadEntitiesByIds([params.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 params: () => ({ id }),\n stream: ({ params }) => this._uiEntityLoader!.loadById(params.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,kDAAC;AAEzE,IAAA,YAAY,GAAG,MAAM,CAAuD,EAAE,wDAAC;AAC/E,IAAA,aAAa,GAAG,MAAM,CAAqC,IAAI,yDAAC;AAChE,IAAA,WAAW,GAAG,MAAM,CAAiD,EAAE,uDAAC;IACxE,eAAe,GAAG,MAAM,CAAmC;AACxE,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,UAAU,EAAE;AACf,KAAA,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,GAA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C,MAAM,CAAC,KAAK,EAAE;gBAC1B,UAAU,EAAE,MAAM,CAAC;sBACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB;AACzC,sBAAE;AACT,aAAA,CAAC;QACN;IACJ;IAEQ,gBAAgB,GAAA;QACpB,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAClD,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,EACtC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,KAAI;YACjC,IAAI,YAAY,EAAE;AACd,gBAAA,OAAO,EAAE,CAAC,KAAK,CAAC;YACpB;YAEA,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC,CAAC;AACjG,QAAA,CAAC,CAAC,CACL,CAAC,SAAS,EAAE;IACjB;AACH;;AC7HD;;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/extensions/select-all.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 { afterNextRender, 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 _initialized = signal(false);\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()).reverse());\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()).reverse();\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 afterNextRender(() => this.init());\n }\n\n public init(): void {\n if (this._initialized()) {\n return;\n }\n\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 this._initialized.set(true);\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) || 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 id in this._entitiesMap();\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 params: () => ({ id }),\n stream: ({ params }) => {\n if (this._entityLoader) {\n return this._entityLoader.loadEntitiesByIds([params.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 params: () => ({ id }),\n stream: ({ params }) => this._uiEntityLoader!.loadById(params.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 }\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 { Directive, HostListener, input } from \"@angular/core\";\nimport { injectNiceSelectableList } from \"../injector\";\n\n@Directive({\n selector: \"button[niceSelectableListSelectAll]\"\n})\nexport class NiceSelectableListSelectAllDirective<T> {\n protected readonly niceSelectableList = injectNiceSelectableList<T>();\n\n public readonly action = input<\"select\" | \"unselect\">(\"select\");\n public readonly total = input<number | null>(null);\n public readonly parameters = input<object | null>(null);\n\n @HostListener(\"click\")\n public onClick(): void {\n if (this.action() === \"select\") {\n this.niceSelectableList.setSelectAllState({\n active: true,\n total: this.total(),\n parameters: this.parameters()\n });\n } else {\n this.niceSelectableList.setSelectAllState({\n active: false,\n total: null,\n parameters: null\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 { computed, effect, EffectRef, signal } from \"@angular/core\";\nimport { ActivatedRoute, NavigationCancel, NavigationEnd, NavigationError, NavigationSkipped, NavigationStart, Router } from \"@angular/router\";\nimport { finalize, from, Observable, of, ReplaySubject, Subscription } from \"rxjs\";\nimport { delay, distinctUntilChanged, filter, map, startWith, switchMap, take, withLatestFrom } 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 private _lastQueryParams: NiceSelectableListQueryParams | null = null;\n\n private readonly _initialized = signal(false);\n private readonly _nextQueryParams = new ReplaySubject<NiceSelectableListQueryParams>(1);\n\n private readonly _queryParamState = computed(() => ({\n entities: this._store.entitiesIds(),\n activeEntity: this._store.activeEntityId(),\n selectAllState: this._store.selectAllState()\n }), {\n equal: (a, b) => {\n const selectAllEqual = a.selectAllState.active === b.selectAllState.active &&\n a.selectAllState.total === b.selectAllState.total &&\n JSON.stringify(a.selectAllState.parameters) === JSON.stringify(b.selectAllState.parameters);\n const entitiesEqual = a.entities.length === b.entities.length &&\n a.entities.every((entity, index) => entity === b.entities[index]);\n const activeEntityEqual = a.activeEntity === b.activeEntity;\n\n return selectAllEqual && entitiesEqual && activeEntityEqual;\n }\n });\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) =>\n event instanceof NavigationStart ||\n event instanceof NavigationEnd ||\n event instanceof NavigationSkipped ||\n event instanceof NavigationCancel ||\n event instanceof NavigationError\n ),\n map((event) => event instanceof NavigationStart),\n startWith(!this.router.navigated),\n distinctUntilChanged()\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, activeEntity, selectAllState } = this._queryParamState();\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 switchMap((params) => {\n if (params === this._lastQueryParams) {\n return of(false);\n }\n\n return this._isNavigating$.pipe(\n filter((isNavigating) => !isNavigating),\n take(1),\n delay(0),\n withLatestFrom(this._isNavigating$),\n switchMap(([_, isNavigating]) => {\n if (isNavigating || JSON.stringify(params) === JSON.stringify(this._lastQueryParams)) {\n return of(false);\n }\n\n return from(\n this.router.navigate([], {\n queryParams: params,\n queryParamsHandling: \"merge\"\n })\n ).pipe(\n finalize(() => this._lastQueryParams = params)\n );\n })\n );\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;AAiCH,IAAA,SAAA;AAAsC,IAAA,OAAA;IAhClD,QAAQ,GAAyC,EAAE;IAC5D,aAAa,GAAsE,IAAI;IACvF,eAAe,GAAgE,IAAI;AAE1E,IAAA,YAAY,GAAG,MAAM,CAAC,KAAK,wDAAC;AAC5B,IAAA,MAAM,GAAG,MAAM,CAAuD,EAAE,kDAAC;AAEzE,IAAA,YAAY,GAAG,MAAM,CAAuD,EAAE,wDAAC;AAC/E,IAAA,aAAa,GAAG,MAAM,CAAqC,IAAI,yDAAC;AAChE,IAAA,WAAW,GAAG,MAAM,CAAiD,EAAE,uDAAC;IACxE,eAAe,GAAG,MAAM,CAAmC;AACxE,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,UAAU,EAAE;AACf,KAAA,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;IAGM,cAAc,GAAwB,EAAE;IACxC,iBAAiB,GAAwB,EAAE;AAEnC,IAAA,QAAQ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CAAC,MAAM,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,CACjD;YACL,CAAC,CAAC,CACL;AACL,QAAA,CAAC,CAAC,CACL,CAAC,SAAS,EAAE;IACjB;AACH;;ACrKD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recursyve/nice-selectable-list",
3
- "version": "21.0.0",
3
+ "version": "21.0.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/cdk": "^21.0.0",
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, OnDestroy, DestroyRef, Injector, Signal, ResourceRef, InjectionToken, Type, Provider } from '@angular/core';
2
+ import { OnInit, OnDestroy, DestroyRef, Signal, ResourceRef, Injector, InjectionToken, Type, Provider } from '@angular/core';
3
3
  import * as _recursyve_nice_selectable_list from '@recursyve/nice-selectable-list';
4
4
  import { MatCheckbox } from '@angular/material/checkbox';
5
5
  import { Observable } from 'rxjs';
@@ -30,13 +30,14 @@ declare class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {
30
30
  static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListHeaderCheckboxDirective<any>, "mat-checkbox[niceSelectableListHeaderCheckbox]", never, {}, {}, never, never, true, never>;
31
31
  }
32
32
 
33
- declare abstract class NiceSelectableListPluginDefinition {
34
- protected readonly _injector: Injector;
35
- protected readonly _destroyRef: DestroyRef;
36
- protected readonly _store: NiceSelectableListStore<unknown>;
37
- constructor(_injector: Injector, _destroyRef: DestroyRef, _store: NiceSelectableListStore<unknown>);
38
- abstract init(): void;
39
- abstract cleanup(): void;
33
+ declare class NiceSelectableListSelectAllDirective<T> {
34
+ protected readonly niceSelectableList: _recursyve_nice_selectable_list.NiceSelectableListStore<T>;
35
+ readonly action: i0.InputSignal<"select" | "unselect">;
36
+ readonly total: i0.InputSignal<number | null>;
37
+ readonly parameters: i0.InputSignal<object | null>;
38
+ onClick(): void;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<NiceSelectableListSelectAllDirective<any>, never>;
40
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListSelectAllDirective<any>, "button[niceSelectableListSelectAll]", never, { "action": { "alias": "action"; "required": false; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "parameters": { "alias": "parameters"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
40
41
  }
41
42
 
42
43
  type NiceSelectableListEntityLoader<T, TParameters = object, TID = number> = {
@@ -71,6 +72,7 @@ declare class NiceSelectableListStore<T> {
71
72
  private readonly _plugins;
72
73
  private _entityLoader;
73
74
  private _uiEntityLoader;
75
+ private readonly _initialized;
74
76
  private readonly _cache;
75
77
  private readonly _entitiesMap;
76
78
  private readonly _activeEntity;
@@ -115,6 +117,33 @@ declare class NiceSelectableListStore<T> {
115
117
  _preloadSelectAllValues(): void;
116
118
  }
117
119
 
120
+ declare abstract class NiceSelectableListPluginDefinition {
121
+ protected readonly _injector: Injector;
122
+ protected readonly _destroyRef: DestroyRef;
123
+ protected readonly _store: NiceSelectableListStore<unknown>;
124
+ constructor(_injector: Injector, _destroyRef: DestroyRef, _store: NiceSelectableListStore<unknown>);
125
+ abstract init(): void;
126
+ abstract cleanup(): void;
127
+ }
128
+
129
+ declare class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition {
130
+ private router;
131
+ private route;
132
+ private _storeChangesEffectRef;
133
+ private _writeQueryParamsSub;
134
+ private _isNavigating$;
135
+ private _lastQueryParams;
136
+ private readonly _initialized;
137
+ private readonly _nextQueryParams;
138
+ private readonly _queryParamState;
139
+ init(): void;
140
+ cleanup(): void;
141
+ private listenOnQueryParams;
142
+ private listenOnStoreChanges;
143
+ private parseQueryParams;
144
+ private writeQueryParams;
145
+ }
146
+
118
147
  declare const NICE_SELECTABLE_LIST_DIRECTIVE: InjectionToken<NiceSelectableList<unknown>>;
119
148
  type NiceSelectableList<T> = {
120
149
  name: Signal<string | null>;
@@ -135,22 +164,6 @@ declare class SelectableListDirective<T> implements NiceSelectableList<T> {
135
164
  static ɵdir: i0.ɵɵDirectiveDeclaration<SelectableListDirective<any>, "[niceSelectableList]", never, { "name": { "alias": "niceSelectableList"; "required": false; "isSignal": true; }; }, {}, ["checkboxes"], never, true, never>;
136
165
  }
137
166
 
138
- declare class NiceSelectableQueryParamsPlugin extends NiceSelectableListPluginDefinition {
139
- private router;
140
- private route;
141
- private _storeChangesEffectRef;
142
- private _writeQueryParamsSub;
143
- private _isNavigating$;
144
- private readonly _initialized;
145
- private readonly _nextQueryParams;
146
- init(): void;
147
- cleanup(): void;
148
- private listenOnQueryParams;
149
- private listenOnStoreChanges;
150
- private parseQueryParams;
151
- private writeQueryParams;
152
- }
153
-
154
167
  declare function injectNiceSelectableListDirective<T>(): NiceSelectableList<T>;
155
168
  declare function injectNiceSelectableList<T>(name?: string): NiceSelectableListStore<T>;
156
169
 
@@ -175,5 +188,5 @@ type ResolveNiceSelectableListOptions = {
175
188
  declare function resolveNiceSelectableList<T>(name: string, options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
176
189
  declare function resolveNiceSelectableList<T>(options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
177
190
 
178
- export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListPluginDefinition, NiceSelectableListStore, NiceSelectableQueryParamsPlugin, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
191
+ export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListPluginDefinition, NiceSelectableListSelectAllDirective, NiceSelectableListStore, NiceSelectableQueryParamsPlugin, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
179
192
  export type { NiceSelectableList, NiceSelectableListConfig, NiceSelectableListEntity, NiceSelectableListEntityLoader, NiceSelectableListOptions, NiceSelectableListProvider, NiceSelectableListSelectAllState, NiceSelectableListUIEntityLoader, ResolveNiceSelectableListOptions };