@processpuzzle/base-entity 0.4.0 → 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.0",
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;
@@ -161,12 +179,14 @@ declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
161
179
  value: any;
162
180
  }>;
163
181
  visible: boolean;
182
+ hideInTable?: boolean;
164
183
  isHeading?: boolean;
165
184
  placeholder?: string;
166
185
  lines?: number;
167
186
  options: {
168
187
  inputType: 'text';
169
188
  };
189
+ required: boolean;
170
190
  private _label?;
171
191
  private _linkedEntityType?;
172
192
  constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: Array<{
@@ -175,26 +195,66 @@ declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
175
195
  }>, isLinkToDetails?: boolean, options?: object);
176
196
  get label(): string;
177
197
  set label(label: string);
178
- get linkedEntityType(): any;
179
- 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;
180
209
  }
181
210
 
182
211
  declare class BaseFormHostDirective {
183
212
  viewContainerRef: ViewContainerRef;
184
213
  constructor(viewContainerRef: ViewContainerRef);
185
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
186
- 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>;
187
216
  }
188
217
 
189
218
  declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit {
190
219
  baseEntityForm: FormGroup;
191
220
  entityDescriptor: Signal<BaseEntityDescriptor>;
192
221
  entity: Signal<Entity>;
193
- entityId: Signal<string>;
222
+ entityId: InputSignal<string>;
194
223
  componentHost: BaseFormHostDirective;
195
224
  store: Signal<any>;
196
225
  private readonly entityFormBuilder;
197
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
+ }>;
198
258
  private readonly isNewObject;
199
259
  private readonly logger;
200
260
  constructor();
@@ -202,32 +262,24 @@ declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnIn
202
262
  onCancel(): Promise<void>;
203
263
  onSubmit(): Promise<void>;
204
264
  private registerEffects;
205
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
206
- 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>;
207
267
  }
208
268
 
209
- interface ArtifactReference {
210
- objectID?: string;
211
- objectId?: string;
212
- id?: string;
213
- bucketName?: string;
214
- bucket?: string;
215
- name?: string;
216
- fileName?: string;
217
- }
218
269
  declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
219
270
  declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
220
271
  dataSource: MatTableDataSource<Entity>;
221
272
  selection: SelectionModel<Entity>;
222
273
  private readonly entityDescriptor;
223
274
  private readonly logger;
275
+ private readonly formNavigator;
224
276
  private readonly objectStoreService;
225
277
  columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
226
278
  displayedColumns: Signal<string[]>;
227
279
  sort: MatSort;
228
280
  paginator: MatPaginator;
229
281
  store: any;
230
- router: Router;
282
+ protected selectOrCreateMode: boolean;
231
283
  constructor();
232
284
  ngAfterViewInit(): void;
233
285
  ngOnInit(): void;
@@ -235,8 +287,10 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
235
287
  onNavigateToDetails(entity: Entity): void;
236
288
  onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: Entity): void;
237
289
  onRowClick(entity: Entity): void;
238
- onDownloadObject(artifact: ArtifactReference, event?: MouseEvent): void;
290
+ onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
239
291
  onToggleAllRows(): void;
292
+ onCancelSelectOrCreate(): Promise<void>;
293
+ onSelectEntity(): Promise<void>;
240
294
  private cancelSelections;
241
295
  private doFilter;
242
296
  private getPropertyValue;
@@ -244,8 +298,9 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
244
298
  protected registerEffects(): void;
245
299
  isAllSelected(): boolean;
246
300
  isSelected(row: Entity): boolean;
247
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
248
- 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>;
249
304
  }
250
305
 
251
306
  declare function BaseEntityTabsStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
@@ -275,8 +330,8 @@ declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () =
275
330
  selectedEntities: Entity[];
276
331
  };
277
332
  props: {
278
- countOfEntities: i0.Signal<number>;
279
- 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>>;
280
335
  };
281
336
  methods: {
282
337
  clearCurrentEntity: () => void;
@@ -300,30 +355,69 @@ declare enum RouteSegments {
300
355
  DETAILS_ROUTE = "DETAILS_ROUTE"
301
356
  }
302
357
  interface NavigationState {
303
- activeRouteSegment: RouteSegments;
358
+ activeRouteSegment: RouteSegments | undefined;
304
359
  entityName: string;
305
360
  navigationError?: string;
306
361
  navigateTo: string;
362
+ responsePayloads: Stack<NavigationPayload>;
363
+ requestPayloads: Stack<NavigationPayload>;
307
364
  returnTo: string;
308
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
+ }>>;
309
397
  declare function BaseFormNavigatorStore(entityName: string): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
310
- state: {
311
- activeRouteSegment: RouteSegments;
312
- entityName: string;
313
- navigationError?: string | undefined;
314
- navigateTo: string;
315
- returnTo: string;
316
- };
317
- props: {};
318
- methods: {
319
- 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>;
320
408
  determineActiveRouteSegment: () => void;
409
+ determineCurrentUrl: () => string;
321
410
  navigateBack: (defaultUrl?: string) => Promise<void>;
322
- navigateToDetails: (id: string, returnTo?: string) => Promise<void>;
323
- navigateToList: (returnTo?: string) => Promise<void>;
324
- 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>;
325
415
  navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
416
+ popRequestPayload: () => NavigationPayload | undefined;
417
+ popResponsePayload: (command?: NavigatorCommand) => NavigationPayload | undefined;
418
+ pushResponsePayload: (payload: NavigationPayload) => void;
326
419
  };
420
+ methods: {};
327
421
  }>;
328
422
 
329
423
  declare abstract class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
@@ -398,5 +492,5 @@ declare function getEntityIds(instance: any): string[];
398
492
 
399
493
  declare const BASE_ENTITY_ROUTES: Routes;
400
494
 
401
- 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 };
402
- 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 };