@recursyve/nice-selectable-list 19.0.0-beta.2 → 20.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.
@@ -7,14 +7,14 @@ import { filter, take } from 'rxjs';
7
7
 
8
8
  class NiceSelectableListStore {
9
9
  _config;
10
- _entities = signal([]);
11
- _activeEntity = signal(null);
12
- _checkboxes = signal([]);
10
+ _entities = signal([], ...(ngDevMode ? [{ debugName: "_entities" }] : []));
11
+ _activeEntity = signal(null, ...(ngDevMode ? [{ debugName: "_activeEntity" }] : []));
12
+ _checkboxes = signal([], ...(ngDevMode ? [{ debugName: "_checkboxes" }] : []));
13
13
  entities = this._entities.asReadonly();
14
14
  activeEntity = this._activeEntity.asReadonly();
15
- total = computed(() => this._entities().length);
16
- entitiesIds = computed(() => this._entities().map((entity) => entity.id));
17
- activeEntityId = computed(() => this._activeEntity()?.id ?? null);
15
+ total = computed(() => this._entities().length, ...(ngDevMode ? [{ debugName: "total" }] : []));
16
+ entitiesIds = computed(() => this._entities().map((entity) => entity.id), ...(ngDevMode ? [{ debugName: "entitiesIds" }] : []));
17
+ activeEntityId = computed(() => this._activeEntity()?.id ?? null, ...(ngDevMode ? [{ debugName: "activeEntityId" }] : []));
18
18
  constructor(_config) {
19
19
  this._config = _config;
20
20
  }
@@ -189,10 +189,10 @@ function resolveNiceSelectableList(...args) {
189
189
 
190
190
  const NICE_SELECTABLE_LIST_DIRECTIVE = new InjectionToken("_selectable_list_directive");
191
191
  class SelectableListDirective {
192
- name = input(null, { alias: "niceSelectableList" });
193
- enableQueryParams = input(false);
194
- checkboxes = contentChildren(NiceSelectableListEntityCheckboxDirective, { descendants: true });
195
- _initialized = signal(false);
192
+ name = input(null, ...(ngDevMode ? [{ debugName: "name", alias: "niceSelectableList" }] : [{ alias: "niceSelectableList" }]));
193
+ enableQueryParams = input(false, ...(ngDevMode ? [{ debugName: "enableQueryParams" }] : []));
194
+ checkboxes = contentChildren(NiceSelectableListEntityCheckboxDirective, ...(ngDevMode ? [{ debugName: "checkboxes", descendants: true }] : [{ descendants: true }]));
195
+ _initialized = signal(false, ...(ngDevMode ? [{ debugName: "_initialized" }] : []));
196
196
  initialized = this._initialized.asReadonly();
197
197
  route = inject(ActivatedRoute);
198
198
  router = inject(Router);
@@ -266,12 +266,12 @@ class SelectableListDirective {
266
266
  this.selectableLists.setActiveFromSelected(params.selected);
267
267
  }
268
268
  }
269
- 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: [
269
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SelectableListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
270
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.1", 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: [
271
271
  { provide: NICE_SELECTABLE_LIST_DIRECTIVE, useExisting: forwardRef(() => SelectableListDirective) }
272
272
  ], queries: [{ propertyName: "checkboxes", predicate: NiceSelectableListEntityCheckboxDirective, descendants: true, isSignal: true }], ngImport: i0 });
273
273
  }
274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectableListDirective, decorators: [{
274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SelectableListDirective, decorators: [{
275
275
  type: Directive,
276
276
  args: [{
277
277
  selector: "[niceSelectableList]",
@@ -301,8 +301,8 @@ class NiceSelectableListEntityCheckboxDirective {
301
301
  matCheckbox = inject(MatCheckbox);
302
302
  destroyRef = inject(DestroyRef);
303
303
  niceSelectableList = injectNiceSelectableList();
304
- selectableEntity = input.required();
305
- isSelected = computed(() => this.niceSelectableList.isEntitySelected(this.selectableEntity())());
304
+ selectableEntity = input.required(...(ngDevMode ? [{ debugName: "selectableEntity" }] : []));
305
+ isSelected = computed(() => this.niceSelectableList.isEntitySelected(this.selectableEntity())(), ...(ngDevMode ? [{ debugName: "isSelected" }] : []));
306
306
  constructor() {
307
307
  effect(() => {
308
308
  this.matCheckbox.checked = this.niceSelectableList.isEntitySelected(this.selectableEntity())();
@@ -330,10 +330,10 @@ class NiceSelectableListEntityCheckboxDirective {
330
330
  this.matCheckbox.checked = false;
331
331
  this.matCheckbox.change.emit({ checked: false, source: this.matCheckbox });
332
332
  }
333
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NiceSelectableListEntityCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
334
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: NiceSelectableListEntityCheckboxDirective, isStandalone: true, selector: "mat-checkbox[niceSelectableListEntityCheckbox]", inputs: { selectableEntity: { classPropertyName: "selectableEntity", publicName: "selectableEntity", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
333
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceSelectableListEntityCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
334
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.1", type: NiceSelectableListEntityCheckboxDirective, isStandalone: true, selector: "mat-checkbox[niceSelectableListEntityCheckbox]", inputs: { selectableEntity: { classPropertyName: "selectableEntity", publicName: "selectableEntity", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
335
335
  }
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NiceSelectableListEntityCheckboxDirective, decorators: [{
336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceSelectableListEntityCheckboxDirective, decorators: [{
337
337
  type: Directive,
338
338
  args: [{
339
339
  selector: "mat-checkbox[niceSelectableListEntityCheckbox]"
@@ -365,10 +365,10 @@ class NiceSelectableListHeaderCheckboxDirective {
365
365
  }
366
366
  });
367
367
  }
368
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NiceSelectableListHeaderCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
369
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.14", type: NiceSelectableListHeaderCheckboxDirective, isStandalone: true, selector: "mat-checkbox[niceSelectableListHeaderCheckbox]", ngImport: i0 });
368
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceSelectableListHeaderCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
369
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: NiceSelectableListHeaderCheckboxDirective, isStandalone: true, selector: "mat-checkbox[niceSelectableListHeaderCheckbox]", ngImport: i0 });
370
370
  }
371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NiceSelectableListHeaderCheckboxDirective, decorators: [{
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: NiceSelectableListHeaderCheckboxDirective, decorators: [{
372
372
  type: Directive,
373
373
  args: [{
374
374
  selector: "mat-checkbox[niceSelectableListHeaderCheckbox]"
@@ -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,CAAC,QAAsD,EAAA;AAC1E,QAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,KAAK,CAAC,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAC;QAElE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAA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 {"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((checkb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,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAzC,yCAAyC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gDAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAzC,yCAAyC,EAAA,UAAA,EAAA,CAAA;kBAHrD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;;ACPD;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1 +1,109 @@
1
- export * from "./selectable-list";
1
+ import * as i0 from '@angular/core';
2
+ import { OnInit, OnDestroy, DestroyRef, Signal, InjectionToken, Injector, FactoryProvider } from '@angular/core';
3
+ import * as _recursyve_nice_selectable_list from '@recursyve/nice-selectable-list';
4
+ import { MatCheckbox } from '@angular/material/checkbox';
5
+ import { ActivatedRoute, Router } from '@angular/router';
6
+
7
+ declare class NiceSelectableListEntityCheckboxDirective<T> implements OnInit, OnDestroy {
8
+ protected readonly matCheckbox: MatCheckbox;
9
+ protected readonly destroyRef: DestroyRef;
10
+ protected readonly niceSelectableList: _recursyve_nice_selectable_list.NiceSelectableListStore<T>;
11
+ readonly selectableEntity: i0.InputSignal<T>;
12
+ readonly isSelected: i0.Signal<boolean>;
13
+ constructor();
14
+ ngOnInit(): void;
15
+ ngOnDestroy(): void;
16
+ selectEntity(): void;
17
+ deselectEntity(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<NiceSelectableListEntityCheckboxDirective<any>, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListEntityCheckboxDirective<any>, "mat-checkbox[niceSelectableListEntityCheckbox]", never, { "selectableEntity": { "alias": "selectableEntity"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
20
+ }
21
+
22
+ declare class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {
23
+ private readonly niceSelectableListDirective;
24
+ private readonly matCheckbox;
25
+ private readonly destroyRef;
26
+ constructor();
27
+ ngOnInit(): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<NiceSelectableListHeaderCheckboxDirective<any>, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListHeaderCheckboxDirective<any>, "mat-checkbox[niceSelectableListHeaderCheckbox]", never, {}, {}, never, never, true, never>;
30
+ }
31
+
32
+ type NiceSelectableListConfig<T> = {
33
+ idProperty: keyof T;
34
+ idType?: "string" | "number";
35
+ };
36
+ type NiceSelectableListEntity<T> = {
37
+ id: string | number;
38
+ entity: T | null;
39
+ };
40
+ declare class NiceSelectableListStore<T> {
41
+ private readonly _config;
42
+ private readonly _entities;
43
+ private readonly _activeEntity;
44
+ private readonly _checkboxes;
45
+ readonly entities: Signal<NiceSelectableListEntity<T>[]>;
46
+ readonly activeEntity: Signal<NiceSelectableListEntity<T> | null>;
47
+ readonly total: Signal<number>;
48
+ readonly entitiesIds: Signal<(string | number)[]>;
49
+ readonly activeEntityId: Signal<string | number | null>;
50
+ constructor(_config: NiceSelectableListConfig<T>);
51
+ registerCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
52
+ unregisterCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
53
+ isEntitySelected(entity: T): Signal<boolean>;
54
+ setEntitiesFromSelections(selections: string[]): void;
55
+ selectEntity(entity: T): void;
56
+ deselectEntity(entity: T): void;
57
+ clear(): void;
58
+ setActiveFromSelected(selected: string): void;
59
+ setActiveEntity(entity: T | null): void;
60
+ selectFirstEntity(): void;
61
+ selectNextEntity(): void;
62
+ selectPreviousEntity(): void;
63
+ selectLastEntity(): void;
64
+ private _isEntitySelected;
65
+ private _resolveEntityId;
66
+ }
67
+
68
+ declare const NICE_SELECTABLE_LIST_DIRECTIVE: InjectionToken<NiceSelectableList<unknown>>;
69
+ type NiceSelectableList<T> = {
70
+ name: Signal<string | null>;
71
+ checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
72
+ };
73
+ declare class SelectableListDirective<T> implements NiceSelectableList<T>, OnInit {
74
+ readonly name: i0.InputSignal<string | null>;
75
+ readonly enableQueryParams: i0.InputSignal<boolean>;
76
+ readonly checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
77
+ private readonly _initialized;
78
+ readonly initialized: Signal<boolean>;
79
+ protected readonly route: ActivatedRoute;
80
+ protected readonly router: Router;
81
+ protected readonly injector: Injector;
82
+ protected selectableLists: NiceSelectableListStore<T>;
83
+ constructor();
84
+ ngOnInit(): void;
85
+ private loadQueryParams;
86
+ private parseQueryParams;
87
+ static ɵfac: i0.ɵɵFactoryDeclaration<SelectableListDirective<any>, never>;
88
+ 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>;
89
+ }
90
+
91
+ declare function injectNiceSelectableListDirective<T>(): NiceSelectableList<T>;
92
+ declare function injectNiceSelectableList<T>(name?: string): NiceSelectableListStore<T>;
93
+
94
+ declare const NICE_SELECTABLE_LISTS: InjectionToken<NiceSelectableListProvider<unknown>[]>;
95
+ declare const NICE_SELECTABLE_LIST: InjectionToken<NiceSelectableListStore<unknown>>;
96
+ type NiceSelectableListProvider<T> = {
97
+ name: string;
98
+ store: NiceSelectableListStore<T>;
99
+ };
100
+ declare function provideNiceSelectableList<T>(config?: NiceSelectableListConfig<T>): FactoryProvider;
101
+ declare function provideNiceSelectableList<T>(name: string, config?: NiceSelectableListConfig<T>): FactoryProvider;
102
+ type ResolveNiceSelectableListOptions = {
103
+ injector: Injector;
104
+ };
105
+ declare function resolveNiceSelectableList<T>(name: string, options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
106
+ declare function resolveNiceSelectableList<T>(options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
107
+
108
+ export { NICE_SELECTABLE_LIST, NICE_SELECTABLE_LISTS, NICE_SELECTABLE_LIST_DIRECTIVE, NiceSelectableListEntityCheckboxDirective, NiceSelectableListHeaderCheckboxDirective, NiceSelectableListStore, SelectableListDirective, injectNiceSelectableList, injectNiceSelectableListDirective, provideNiceSelectableList, resolveNiceSelectableList };
109
+ export type { NiceSelectableList, NiceSelectableListConfig, NiceSelectableListEntity, NiceSelectableListProvider, ResolveNiceSelectableListOptions };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@recursyve/nice-selectable-list",
3
- "version": "19.0.0-beta.2",
3
+ "version": "20.0.0-beta.3",
4
4
  "peerDependencies": {
5
- "@angular/common": "^19.2.0",
6
- "@angular/cdk": "^19.2.0",
7
- "@angular/core": "^19.2.0",
8
- "@angular/material": "^19.2.0"
5
+ "@angular/common": "^20.2.0",
6
+ "@angular/cdk": "^20.2.0",
7
+ "@angular/core": "^20.2.0",
8
+ "@angular/material": "^20.2.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "tslib": "^2.3.0"
@@ -1,17 +0,0 @@
1
- import { DestroyRef, OnDestroy, OnInit } from "@angular/core";
2
- import { MatCheckbox } from "@angular/material/checkbox";
3
- import * as i0 from "@angular/core";
4
- export declare class NiceSelectableListEntityCheckboxDirective<T> implements OnInit, OnDestroy {
5
- protected readonly matCheckbox: MatCheckbox;
6
- protected readonly destroyRef: DestroyRef;
7
- protected readonly niceSelectableList: import("@recursyve/nice-selectable-list").NiceSelectableListStore<T>;
8
- readonly selectableEntity: import("@angular/core").InputSignal<T>;
9
- readonly isSelected: import("@angular/core").Signal<boolean>;
10
- constructor();
11
- ngOnInit(): void;
12
- ngOnDestroy(): void;
13
- selectEntity(): void;
14
- deselectEntity(): void;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<NiceSelectableListEntityCheckboxDirective<any>, never>;
16
- static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListEntityCheckboxDirective<any>, "mat-checkbox[niceSelectableListEntityCheckbox]", never, { "selectableEntity": { "alias": "selectableEntity"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
17
- }
@@ -1,11 +0,0 @@
1
- import { OnInit } from "@angular/core";
2
- import * as i0 from "@angular/core";
3
- export declare class NiceSelectableListHeaderCheckboxDirective<T> implements OnInit {
4
- private readonly niceSelectableListDirective;
5
- private readonly matCheckbox;
6
- private readonly destroyRef;
7
- constructor();
8
- ngOnInit(): void;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<NiceSelectableListHeaderCheckboxDirective<any>, never>;
10
- static ɵdir: i0.ɵɵDirectiveDeclaration<NiceSelectableListHeaderCheckboxDirective<any>, "mat-checkbox[niceSelectableListHeaderCheckbox]", never, {}, {}, never, never, true, never>;
11
- }
@@ -1,6 +0,0 @@
1
- export * from "./entity-checkbox.directive";
2
- export * from "./header-checkbox.directive";
3
- export * from "./selectable-list";
4
- export * from "./injector";
5
- export * from "./provider";
6
- export * from "./store";
@@ -1,4 +0,0 @@
1
- import { NiceSelectableList } from "./selectable-list";
2
- import { NiceSelectableListStore } from "./store";
3
- export declare function injectNiceSelectableListDirective<T>(): NiceSelectableList<T>;
4
- export declare function injectNiceSelectableList<T>(name?: string): NiceSelectableListStore<T>;
@@ -1,15 +0,0 @@
1
- import { FactoryProvider, InjectionToken, Injector } from "@angular/core";
2
- import { NiceSelectableListConfig, NiceSelectableListStore } from "./store";
3
- export declare const NICE_SELECTABLE_LISTS: InjectionToken<NiceSelectableListProvider<unknown>[]>;
4
- export declare const NICE_SELECTABLE_LIST: InjectionToken<NiceSelectableListStore<unknown>>;
5
- export type NiceSelectableListProvider<T> = {
6
- name: string;
7
- store: NiceSelectableListStore<T>;
8
- };
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 ResolveNiceSelectableListOptions = {
12
- injector: Injector;
13
- };
14
- export declare function resolveNiceSelectableList<T>(name: string, options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
15
- export declare function resolveNiceSelectableList<T>(options?: ResolveNiceSelectableListOptions): NiceSelectableListStore<T>;
@@ -1,27 +0,0 @@
1
- import { InjectionToken, Injector, OnInit, Signal } from "@angular/core";
2
- import { ActivatedRoute, Router } from "@angular/router";
3
- import { NiceSelectableListEntityCheckboxDirective } from "./entity-checkbox.directive";
4
- import { NiceSelectableListStore } from "./store";
5
- import * as i0 from "@angular/core";
6
- export declare const NICE_SELECTABLE_LIST_DIRECTIVE: InjectionToken<NiceSelectableList<unknown>>;
7
- export type NiceSelectableList<T> = {
8
- name: Signal<string | null>;
9
- checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
10
- };
11
- export declare class SelectableListDirective<T> implements NiceSelectableList<T>, OnInit {
12
- readonly name: import("@angular/core").InputSignal<string | null>;
13
- readonly enableQueryParams: import("@angular/core").InputSignal<boolean>;
14
- readonly checkboxes: Signal<readonly NiceSelectableListEntityCheckboxDirective<T>[]>;
15
- private readonly _initialized;
16
- readonly initialized: Signal<boolean>;
17
- protected readonly route: ActivatedRoute;
18
- protected readonly router: Router;
19
- protected readonly injector: Injector;
20
- protected selectableLists: NiceSelectableListStore<T>;
21
- constructor();
22
- ngOnInit(): void;
23
- private loadQueryParams;
24
- private parseQueryParams;
25
- 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>;
27
- }
@@ -1,37 +0,0 @@
1
- import { Signal } from "@angular/core";
2
- import { NiceSelectableListEntityCheckboxDirective } from "./entity-checkbox.directive";
3
- export type NiceSelectableListConfig<T> = {
4
- idProperty: keyof T;
5
- idType?: "string" | "number";
6
- };
7
- export type NiceSelectableListEntity<T> = {
8
- id: string | number;
9
- entity: T | null;
10
- };
11
- export declare class NiceSelectableListStore<T> {
12
- private readonly _config;
13
- private readonly _entities;
14
- private readonly _activeEntity;
15
- private readonly _checkboxes;
16
- readonly entities: Signal<NiceSelectableListEntity<T>[]>;
17
- readonly activeEntity: Signal<NiceSelectableListEntity<T> | null>;
18
- readonly total: Signal<number>;
19
- readonly entitiesIds: Signal<(string | number)[]>;
20
- readonly activeEntityId: Signal<string | number | null>;
21
- constructor(_config: NiceSelectableListConfig<T>);
22
- registerCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
23
- unregisterCheckbox(checkbox: NiceSelectableListEntityCheckboxDirective<T>): void;
24
- isEntitySelected(entity: T): Signal<boolean>;
25
- setEntitiesFromSelections(selections: string[]): void;
26
- selectEntity(entity: T): void;
27
- deselectEntity(entity: T): void;
28
- clear(): void;
29
- setActiveFromSelected(selected: string): void;
30
- setActiveEntity(entity: T | null): void;
31
- selectFirstEntity(): void;
32
- selectNextEntity(): void;
33
- selectPreviousEntity(): void;
34
- selectLastEntity(): void;
35
- private _isEntitySelected;
36
- private _resolveEntityId;
37
- }