@processpuzzle/base-entity 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processpuzzle/base-entity",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Zsolt Zsuffa",
@@ -16,20 +16,20 @@
16
16
  },
17
17
  "homepage": "https://github.com/ZsZs/processpuzzle#readme",
18
18
  "peerDependencies": {
19
- "@angular/cdk": "^21.2.3",
20
- "@angular/common": "~21.2.5",
21
- "@angular/core": "~21.2.5",
22
- "@angular/forms": "~21.2.5",
23
- "@angular/material": "^21.2.3",
24
- "@angular/platform-browser": "~21.2.5",
25
- "@angular/router": "~21.2.5",
19
+ "@angular/cdk": "^21.2.9",
20
+ "@angular/common": "~21.2.11",
21
+ "@angular/core": "~21.2.11",
22
+ "@angular/forms": "~21.2.11",
23
+ "@angular/material": "^21.2.9",
24
+ "@angular/platform-browser": "~21.2.11",
25
+ "@angular/router": "~21.2.11",
26
26
  "@angular/fire": "^20.0.1",
27
- "@ngrx/operators": "^21.0.1",
28
- "@ngrx/signals": "^21.0.1",
27
+ "@ngrx/operators": "^21.1.0",
28
+ "@ngrx/signals": "^21.1.0",
29
29
  "@processpuzzle/util": "^0.2.4",
30
30
  "build-url-ts": "^6.2.0",
31
31
  "rxjs": "~7.8.2",
32
- "uuid": "^13.0.0"
32
+ "uuid": "^14.0.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "tslib": "^2.8.1"
@@ -1,24 +1,27 @@
1
- import * as i0 from '@angular/core';
2
- import { OnDestroy, OnInit, InjectionToken, ViewContainerRef, Signal, AfterViewInit, ProviderToken } from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnDestroy, OnInit, InjectionToken, ViewContainerRef, Signal, InputSignal, AfterViewInit, ProviderToken } from '@angular/core';
3
3
  import { MatSnackBar } from '@angular/material/snack-bar';
4
4
  import * as _ngrx_signals from '@ngrx/signals';
5
5
  import { Observable } from 'rxjs';
6
6
  import { HttpClient, HttpHeaders } from '@angular/common/http';
7
7
  import { WhereFilterOp, Firestore } from '@angular/fire/firestore';
8
+ import * as _______________dist_libs_util_types_processpuzzle_util from '../../../dist/libs/util/types/processpuzzle-util';
9
+ import * as _processpuzzle_base_entity from '@processpuzzle/base-entity';
8
10
  import { FormGroup } from '@angular/forms';
9
11
  import { MatTableDataSource } from '@angular/material/table';
10
12
  import { MatSort } from '@angular/material/sort';
11
13
  import * as _angular_material_paginator from '@angular/material/paginator';
12
14
  import { MatPaginator } from '@angular/material/paginator';
13
- import { Router, Routes } from '@angular/router';
14
15
  import { SelectionModel } from '@angular/cdk/collections';
15
- import * as _processpuzzle_base_entity from '@processpuzzle/base-entity';
16
16
  import * as _ngrx_signals_rxjs_interop from '@ngrx/signals/rxjs-interop';
17
+ import { Stack } from '@processpuzzle/util';
17
18
  import * as _firebase_firestore from '@firebase/firestore';
19
+ import { Routes } from '@angular/router';
18
20
 
19
21
  declare enum FormControlType {
20
22
  ARTIFACT = "ARTIFACT",
21
23
  CHECKBOX = "CHECKBOX",
24
+ COMPONENTS = "COMPONENTS",
22
25
  DATE = "DATE",
23
26
  DROPDOWN = "DROPDOWN",
24
27
  FLEX_BOX = "FLEX_BOX",
@@ -47,23 +50,32 @@ interface ArtifactAttr {
47
50
  readonly mimeType: string;
48
51
  }
49
52
 
50
- interface BaseEntityDescriptor {
53
+ interface BaseEntityDescriptorOptions {
54
+ store?: any;
55
+ attrDescriptors: AbstractAttrDescriptor[];
56
+ entityName: string;
57
+ entityTitle?: string;
58
+ }
59
+ declare class BaseEntityDescriptor {
51
60
  store: any;
52
61
  attrDescriptors: AbstractAttrDescriptor[];
53
62
  entityName: string;
54
63
  entityTitle: string;
64
+ constructor({ store, attrDescriptors, entityName, entityTitle }: BaseEntityDescriptorOptions);
65
+ componentIdentification(): string;
66
+ overwriteLinkedEntityAttr(attrName: string, linkedEntityDescr: BaseEntityDescriptor): void;
55
67
  }
56
68
 
57
69
  declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
58
- entityDescriptor: i0.InputSignal<BaseEntityDescriptor>;
70
+ entityDescriptor: _angular_core.InputSignal<BaseEntityDescriptor>;
59
71
  protected snackBar: MatSnackBar;
60
72
  store: any;
61
73
  constructor();
62
74
  ngOnDestroy(): void;
63
75
  ngOnInit(): void;
64
76
  private registerEffects;
65
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
66
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "entityDescriptor": { "alias": "entityDescriptor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
77
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
78
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "entityDescriptor": { "alias": "entityDescriptor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
67
79
  }
68
80
 
69
81
  declare function BaseEntityContainerStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
@@ -84,6 +96,12 @@ interface BaseEntityMapper<Entity extends BaseEntity> {
84
96
  fromDto(dto: any, index?: number): Entity;
85
97
  toDto(entity: Entity): any;
86
98
  }
99
+ declare function getEnumKeyByValue<E>(myEnum: {
100
+ [key: number]: string;
101
+ }, enumValue: any): E | undefined;
102
+ declare function getEnumValueByKey<E>(myEnum: {
103
+ [key: string]: E | string;
104
+ }, enumKey: string): E | undefined;
87
105
 
88
106
  interface OrderByCondition<Entity extends BaseEntity> {
89
107
  field: keyof Entity;
@@ -168,6 +186,7 @@ declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
168
186
  options: {
169
187
  inputType: 'text';
170
188
  };
189
+ required: boolean;
171
190
  private _label?;
172
191
  private _linkedEntityType?;
173
192
  constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: Array<{
@@ -176,26 +195,66 @@ declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
176
195
  }>, isLinkToDetails?: boolean, options?: object);
177
196
  get label(): string;
178
197
  set label(label: string);
179
- get linkedEntityType(): any;
180
- set linkedEntityType(linkedEntityType: string);
198
+ get linkedEntityType(): BaseEntityDescriptor | undefined;
199
+ set linkedEntityType(linkedEntityType: BaseEntityDescriptor);
200
+ }
201
+
202
+ declare enum NavigatorCommand {
203
+ SELECT_OR_CREATE = "SelectOrCreate",
204
+ EDIT = "Edit"
205
+ }
206
+ interface NavigationPayload {
207
+ command: NavigatorCommand;
208
+ payload?: object;
181
209
  }
182
210
 
183
211
  declare class BaseFormHostDirective {
184
212
  viewContainerRef: ViewContainerRef;
185
213
  constructor(viewContainerRef: ViewContainerRef);
186
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
187
- static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
214
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
215
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
188
216
  }
189
217
 
190
218
  declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit {
191
219
  baseEntityForm: FormGroup;
192
220
  entityDescriptor: Signal<BaseEntityDescriptor>;
193
221
  entity: Signal<Entity>;
194
- entityId: Signal<string>;
222
+ entityId: InputSignal<string>;
195
223
  componentHost: BaseFormHostDirective;
196
224
  store: Signal<any>;
197
225
  private readonly entityFormBuilder;
198
226
  private readonly formBuilder;
227
+ protected readonly formNavigator: {
228
+ activeRouteSegment: Signal<_processpuzzle_base_entity.RouteSegments | undefined>;
229
+ entityName: Signal<string>;
230
+ navigationError?: Signal<string | undefined> | undefined;
231
+ navigateTo: Signal<string>;
232
+ responsePayloads: _ngrx_signals.DeepSignal<_______________dist_libs_util_types_processpuzzle_util.Stack<NavigationPayload>>;
233
+ requestPayloads: _ngrx_signals.DeepSignal<_______________dist_libs_util_types_processpuzzle_util.Stack<NavigationPayload>>;
234
+ returnTo: Signal<string>;
235
+ determineCurrentUrl: () => string;
236
+ determineActiveRouteSegment: () => void;
237
+ navigateBack: (defaultUrl?: string) => Promise<void>;
238
+ navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
239
+ navigateToList: (entityName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
240
+ navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
241
+ navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
242
+ navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
243
+ destroyNavigationTracking: () => void;
244
+ initializeNavigationTracking: () => void;
245
+ popRequestPayload: () => NavigationPayload | undefined;
246
+ popResponsePayload: (command?: NavigatorCommand) => NavigationPayload | undefined;
247
+ pushResponsePayload: (payload: NavigationPayload) => void;
248
+ setEntityName: (entityName: string) => void;
249
+ } & _ngrx_signals.StateSource<{
250
+ activeRouteSegment: _processpuzzle_base_entity.RouteSegments | undefined;
251
+ entityName: string;
252
+ navigationError?: string | undefined;
253
+ navigateTo: string;
254
+ responsePayloads: _______________dist_libs_util_types_processpuzzle_util.Stack<NavigationPayload>;
255
+ requestPayloads: _______________dist_libs_util_types_processpuzzle_util.Stack<NavigationPayload>;
256
+ returnTo: string;
257
+ }>;
199
258
  private readonly isNewObject;
200
259
  private readonly logger;
201
260
  constructor();
@@ -203,8 +262,8 @@ declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnIn
203
262
  onCancel(): Promise<void>;
204
263
  onSubmit(): Promise<void>;
205
264
  private registerEffects;
206
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
207
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, { "entityId": { "alias": "entityId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
265
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
266
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, { "entityId": { "alias": "entityId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
208
267
  }
209
268
 
210
269
  declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
@@ -213,13 +272,14 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
213
272
  selection: SelectionModel<Entity>;
214
273
  private readonly entityDescriptor;
215
274
  private readonly logger;
275
+ private readonly formNavigator;
216
276
  private readonly objectStoreService;
217
277
  columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
218
278
  displayedColumns: Signal<string[]>;
219
279
  sort: MatSort;
220
280
  paginator: MatPaginator;
221
281
  store: any;
222
- router: Router;
282
+ protected selectOrCreateMode: boolean;
223
283
  constructor();
224
284
  ngAfterViewInit(): void;
225
285
  ngOnInit(): void;
@@ -229,6 +289,8 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
229
289
  onRowClick(entity: Entity): void;
230
290
  onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
231
291
  onToggleAllRows(): void;
292
+ onCancelSelectOrCreate(): Promise<void>;
293
+ onSelectEntity(): Promise<void>;
232
294
  private cancelSelections;
233
295
  private doFilter;
234
296
  private getPropertyValue;
@@ -236,8 +298,9 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
236
298
  protected registerEffects(): void;
237
299
  isAllSelected(): boolean;
238
300
  isSelected(row: Entity): boolean;
239
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
240
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
301
+ canSelectEntity(): boolean;
302
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
303
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
241
304
  }
242
305
 
243
306
  declare function BaseEntityTabsStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
@@ -267,8 +330,8 @@ declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () =
267
330
  selectedEntities: Entity[];
268
331
  };
269
332
  props: {
270
- countOfEntities: i0.Signal<number>;
271
- matTableDataSource: i0.Signal<MatTableDataSource<Entity, _angular_material_paginator.MatPaginator>>;
333
+ countOfEntities: _angular_core.Signal<number>;
334
+ matTableDataSource: _angular_core.Signal<MatTableDataSource<Entity, _angular_material_paginator.MatPaginator>>;
272
335
  };
273
336
  methods: {
274
337
  clearCurrentEntity: () => void;
@@ -292,30 +355,69 @@ declare enum RouteSegments {
292
355
  DETAILS_ROUTE = "DETAILS_ROUTE"
293
356
  }
294
357
  interface NavigationState {
295
- activeRouteSegment: RouteSegments;
358
+ activeRouteSegment: RouteSegments | undefined;
296
359
  entityName: string;
297
360
  navigationError?: string;
298
361
  navigateTo: string;
362
+ responsePayloads: Stack<NavigationPayload>;
363
+ requestPayloads: Stack<NavigationPayload>;
299
364
  returnTo: string;
300
365
  }
366
+ declare const BaseFormNavigatorSingletonStore: _angular_core.Type<{
367
+ activeRouteSegment: _angular_core.Signal<RouteSegments | undefined>;
368
+ entityName: _angular_core.Signal<string>;
369
+ navigationError?: _angular_core.Signal<string | undefined> | undefined;
370
+ navigateTo: _angular_core.Signal<string>;
371
+ responsePayloads: _ngrx_signals.DeepSignal<Stack<NavigationPayload>>;
372
+ requestPayloads: _ngrx_signals.DeepSignal<Stack<NavigationPayload>>;
373
+ returnTo: _angular_core.Signal<string>;
374
+ determineCurrentUrl: () => string;
375
+ determineActiveRouteSegment: () => void;
376
+ navigateBack: (defaultUrl?: string) => Promise<void>;
377
+ navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
378
+ navigateToList: (entityName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
379
+ navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
380
+ navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
381
+ navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
382
+ destroyNavigationTracking: () => void;
383
+ initializeNavigationTracking: () => void;
384
+ popRequestPayload: () => NavigationPayload | undefined;
385
+ popResponsePayload: (command?: NavigatorCommand) => NavigationPayload | undefined;
386
+ pushResponsePayload: (payload: NavigationPayload) => void;
387
+ setEntityName: (entityName: string) => void;
388
+ } & _ngrx_signals.StateSource<{
389
+ activeRouteSegment: RouteSegments | undefined;
390
+ entityName: string;
391
+ navigationError?: string | undefined;
392
+ navigateTo: string;
393
+ responsePayloads: Stack<NavigationPayload>;
394
+ requestPayloads: Stack<NavigationPayload>;
395
+ returnTo: string;
396
+ }>>;
301
397
  declare function BaseFormNavigatorStore(entityName: string): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
302
- state: {
303
- activeRouteSegment: RouteSegments;
304
- entityName: string;
305
- navigationError?: string | undefined;
306
- navigateTo: string;
307
- returnTo: string;
308
- };
309
- props: {};
310
- methods: {
311
- determineCurrentUrl: () => string;
398
+ state: {};
399
+ props: {
400
+ activeRouteSegment: _angular_core.Signal<RouteSegments | undefined>;
401
+ entityName: _angular_core.Signal<string>;
402
+ navigationError: _angular_core.Signal<string | undefined> | undefined;
403
+ navigateTo: _angular_core.Signal<string>;
404
+ navigatorPayloads: _ngrx_signals.DeepSignal<Stack<NavigationPayload>>;
405
+ requestPayloads: _ngrx_signals.DeepSignal<Stack<NavigationPayload>>;
406
+ responsePayloads: _ngrx_signals.DeepSignal<Stack<NavigationPayload>>;
407
+ returnTo: _angular_core.Signal<string>;
312
408
  determineActiveRouteSegment: () => void;
409
+ determineCurrentUrl: () => string;
313
410
  navigateBack: (defaultUrl?: string) => Promise<void>;
314
- navigateToDetails: (id: string, returnTo?: string) => Promise<void>;
315
- navigateToList: (returnTo?: string) => Promise<void>;
316
- navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string) => Promise<void>;
411
+ navigateToDetails: (id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
412
+ navigateToList: (returnTo?: string, payload?: NavigationPayload) => Promise<void>;
413
+ navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
414
+ navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
317
415
  navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
416
+ popRequestPayload: () => NavigationPayload | undefined;
417
+ popResponsePayload: (command?: NavigatorCommand) => NavigationPayload | undefined;
418
+ pushResponsePayload: (payload: NavigationPayload) => void;
318
419
  };
420
+ methods: {};
319
421
  }>;
320
422
 
321
423
  declare abstract class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
@@ -390,5 +492,5 @@ declare function getEntityIds(instance: any): string[];
390
492
 
391
493
  declare const BASE_ENTITY_ROUTES: Routes;
392
494
 
393
- export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
394
- export type { ArtifactAttr, BaseEntity, BaseEntityDescriptor, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, EntityOptions, FilterCondition, NavigationState, OrderByCondition };
495
+ export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorSingletonStore, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey };
496
+ export type { ArtifactAttr, BaseEntity, BaseEntityDescriptorOptions, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, EntityOptions, FilterCondition, NavigationState, OrderByCondition };