@processpuzzle/base-entity 0.7.7 → 0.7.9

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/README.md CHANGED
@@ -130,7 +130,7 @@ export const TestEntityStore = signalStore(
130
130
 
131
131
  ### 5. Describe the attributes
132
132
 
133
- Each visible field gets a `BaseEntityAttrDescriptor`. `FormControlType` covers `TEXT_BOX`, `TEXTAREA`, `CHECKBOX`, `DATE`, `DROPDOWN`, `LOOKUP`, `RADIO`, `TAGS`, `ARTIFACT`, `COMPONENTS`, `FOREIGN_KEY`, `LABEL`, `TITLE`, and `FLEX_BOX`. Use `FlexboxDescriptor` to lay attributes out in rows and columns, and `linkedEntityType` to attach a related entity's descriptor (used by `LOOKUP`, `FOREIGN_KEY`, and nested `COMPONENTS`).
133
+ Each visible field gets a `BaseEntityAttrDescriptor`. `FormControlType` covers `TEXT_BOX`, `TEXTAREA`, `CHECKBOX`, `DATE`, `DROPDOWN`, `LOOKUP`, `RADIO`, `TAGS`, `ARTIFACT`, `COMPONENTS`, `FOREIGN_KEY`, `LABEL`, `TITLE`, and `FLEX_BOX`. Use `FlexboxDescriptor` to lay attributes out in rows and columns, and `linkedEntityType` (a string — the related entity's name) to point at a related entity (used by `LOOKUP`, `FOREIGN_KEY`, and nested `COMPONENTS`). The descriptor is resolved at runtime through `BASE_ENTITY_FACADE_REGISTRY`.
134
134
 
135
135
  ```typescript
136
136
  function createTestEntityAttrDescriptors(): AbstractAttrDescriptor[] {
@@ -144,8 +144,8 @@ function createTestEntityAttrDescriptors(): AbstractAttrDescriptor[] {
144
144
  const enumAttr = new BaseEntityAttrDescriptor('enumValue', FormControlType.DROPDOWN, 'Enum', selectables);
145
145
  const componentsAttr = new BaseEntityAttrDescriptor('components', FormControlType.COMPONENTS, 'Components');
146
146
 
147
- lookupAttr.linkedEntityType = createTrunkDataDescriptor();
148
- componentsAttr.linkedEntityType = createTestEntityComponentDescriptor();
147
+ lookupAttr.linkedEntityType = 'Trunk Data';
148
+ componentsAttr.linkedEntityType = 'Test Entity Component';
149
149
 
150
150
  const column1 = new FlexboxDescriptor([nameAttr, descriptionAttr, booleanAttr], FlexDirection.COLUMN);
151
151
  const column2 = new FlexboxDescriptor([numberAttr, dateAttr, lookupAttr, enumAttr, componentsAttr], FlexDirection.COLUMN);
@@ -154,19 +154,14 @@ function createTestEntityAttrDescriptors(): AbstractAttrDescriptor[] {
154
154
  return [layout];
155
155
  }
156
156
 
157
- let cachedDescriptor: BaseEntityDescriptor | undefined;
158
-
159
157
  export function createTestEntityDescriptor(): BaseEntityDescriptor {
160
- if (cachedDescriptor) return cachedDescriptor;
161
- cachedDescriptor = new BaseEntityDescriptor({ entityName: 'Test Entity', attrDescriptors: [] });
162
- cachedDescriptor.attrDescriptors = createTestEntityAttrDescriptors();
163
- return cachedDescriptor;
158
+ return new BaseEntityDescriptor({ entityName: 'Test Entity', attrDescriptors: createTestEntityAttrDescriptors() });
164
159
  }
165
160
  ```
166
161
 
167
162
  A few notes:
168
163
 
169
- - Caching the descriptor in a module-level variable keeps a single instance shared across components and breaks circular references between bidirectionally linked entities.
164
+ - `linkedEntityType` is just the name of the related entity. The actual `BaseEntityDescriptor` is resolved at runtime through the facade registered in `BASE_ENTITY_FACADE_REGISTRY`.
170
165
  - `BaseEntityDescriptor` takes an options object (`{ entityName, attrDescriptors, store?, entityTitle? }`); `store` and `entityTitle` are usually set later in the host component.
171
166
 
172
167
  ### 6. Render the container
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, computed, Component, effect, InjectionToken, Inject, Directive, Injector, signal, HostBinding, Injectable, EventEmitter, Output, ViewChild, DestroyRef, untracked, isDevMode, runInInjectionContext } from '@angular/core';
2
+ import { inject, input, computed, Component, effect, InjectionToken, Inject, Directive, Injector, signal, Injectable, HostBinding, EventEmitter, Output, ViewChild, DestroyRef, untracked, isDevMode, runInInjectionContext } from '@angular/core';
3
3
  import { MatSnackBar } from '@angular/material/snack-bar';
4
4
  import * as i1 from '@angular/common';
5
5
  import { CommonModule, NgClass, NgStyle, NgIf, NgForOf, SlicePipe } from '@angular/common';
@@ -899,7 +899,7 @@ class EntityRegistryComponent {
899
899
  lines: attr.lines,
900
900
  options: attr.options,
901
901
  required: attr.required,
902
- linkedEntityType: attr.linkedEntityType ? { entityName: attr.linkedEntityType.entityName } : undefined,
902
+ linkedEntityType: attr.linkedEntityType,
903
903
  }),
904
904
  };
905
905
  }
@@ -914,6 +914,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
914
914
  }]
915
915
  }] });
916
916
 
917
+ class BaseEntityDescriptorRegistry {
918
+ registry = inject(BASE_ENTITY_FACADE_REGISTRY);
919
+ injector = inject(Injector);
920
+ getDescriptor(entityName) {
921
+ const facade = this.resolveFacade(entityName);
922
+ return facade?.descriptor;
923
+ }
924
+ getStore(entityName) {
925
+ const facade = this.resolveFacade(entityName);
926
+ return facade?.store;
927
+ }
928
+ resolveFacade(entityName) {
929
+ if (!entityName)
930
+ return undefined;
931
+ const facadeToken = this.registry[entityName];
932
+ if (!facadeToken)
933
+ return undefined;
934
+ return this.injector.get(facadeToken, undefined);
935
+ }
936
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityDescriptorRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
937
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityDescriptorRegistry, providedIn: 'root' });
938
+ }
939
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityDescriptorRegistry, decorators: [{
940
+ type: Injectable,
941
+ args: [{ providedIn: 'root' }]
942
+ }] });
943
+
917
944
  function entityNameFromType(entityType) {
918
945
  return entityType.name ?? 'base-entity';
919
946
  }
@@ -940,14 +967,15 @@ class BaseFormControlComponent {
940
967
  formGroup;
941
968
  store;
942
969
  style = computed(() => this.config().style, ...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
943
- linkedEntityType = computed(() => {
944
- const linkedEntityType = this.config().linkedEntityType;
945
- if (linkedEntityType === undefined) {
970
+ linkedEntityName = computed(() => {
971
+ const linkedEntityName = this.config().linkedEntityType;
972
+ if (linkedEntityName === undefined) {
946
973
  this.logger.error(`linkedEntityType should be defined for '${this.config().attrName}'.`);
947
974
  throw new Error(`linkedEntityType should be defined for '${this.config().attrName}'.`);
948
975
  }
949
- return linkedEntityType;
950
- }, ...(ngDevMode ? [{ debugName: "linkedEntityType" }] : /* istanbul ignore next */ []));
976
+ return linkedEntityName;
977
+ }, ...(ngDevMode ? [{ debugName: "linkedEntityName" }] : /* istanbul ignore next */ []));
978
+ linkedEntityDescriptor = computed(() => this.descriptorRegistry.getDescriptor(this.linkedEntityName()), ...(ngDevMode ? [{ debugName: "linkedEntityDescriptor" }] : /* istanbul ignore next */ []));
951
979
  value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
952
980
  get testId() {
953
981
  const attrName = this.config()?.attrName;
@@ -958,34 +986,7 @@ class BaseFormControlComponent {
958
986
  }
959
987
  logger = inject(NGXLogger);
960
988
  formNavigator = inject(BaseFormNavigatorSingletonStore);
961
- injector = inject(Injector);
962
- facadeRegistry = inject(BASE_ENTITY_FACADE_REGISTRY);
963
- // region Angular lifecycle hooks
964
- // endregion
965
- resolveRelatedEntityStore() {
966
- const entityName = this.config().linkedEntityType?.entityName;
967
- const facadeToken = entityName ? this.facadeRegistry[entityName] : undefined;
968
- if (facadeToken) {
969
- const facade = this.injector.get(facadeToken, undefined);
970
- return facade?.store;
971
- }
972
- const store = this.config().linkedEntityType?.store;
973
- if (!store) {
974
- return undefined;
975
- }
976
- if (this.isStoreInstance(store)) {
977
- return store;
978
- }
979
- try {
980
- return this.injector.get(store, undefined);
981
- }
982
- catch {
983
- return undefined;
984
- }
985
- }
986
- isStoreInstance(store) {
987
- return !!store && (typeof store === 'object' || typeof store === 'function') && ('load' in store || 'loadById' in store || 'entities' in store);
988
- }
989
+ descriptorRegistry = inject(BaseEntityDescriptorRegistry);
989
990
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseFormControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
990
991
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: BaseFormControlComponent, isStandalone: true, selector: "ng-component", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.data-testid": "this.testId" } }, ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
991
992
  }
@@ -1371,24 +1372,24 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1371
1372
  this.hasFocus.set(!!currentTarget && !!relatedTarget && currentTarget.contains(relatedTarget));
1372
1373
  }
1373
1374
  navigateToRelated() {
1374
- this.formNavigator.navigateToRelated(this.linkedEntityType().entityName, this.foreignKeyId(), this.formNavigator.determineCurrentUrl());
1375
+ this.formNavigator.navigateToRelated(this.linkedEntityName(), this.foreignKeyId(), this.formNavigator.determineCurrentUrl());
1375
1376
  }
1376
1377
  navigateToRelatedList() {
1377
1378
  if (this.config().disabled) {
1378
1379
  return;
1379
1380
  }
1380
1381
  this.formNavigator.captureFormSnapshot(this.formGroup.getRawValue());
1381
- this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
1382
+ this.formNavigator.navigateToRelatedList(this.linkedEntityName(), this.formNavigator.determineCurrentUrl(), {
1382
1383
  command: NavigatorCommand.SELECT_OR_CREATE,
1383
1384
  attrName: this.config().attrName,
1384
1385
  });
1385
1386
  }
1386
1387
  // endregion
1387
1388
  selectEntityTitle() {
1388
- return 'Select ' + this.linkedEntityType().entityName;
1389
+ return 'Select ' + this.linkedEntityName();
1389
1390
  }
1390
1391
  foreignKeyLabel() {
1391
- return this.linkedEntityType().entityName;
1392
+ return this.linkedEntityName();
1392
1393
  }
1393
1394
  showSelectEntityButton() {
1394
1395
  return !this.config().disabled && this.hasFocus();
@@ -1401,8 +1402,8 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1401
1402
  if (!relatedEntity) {
1402
1403
  return this.foreignKeyId();
1403
1404
  }
1404
- const attrName = this.linkedEntityType().componentIdentification();
1405
- const componentName = relatedEntity[attrName];
1405
+ const attrName = this.linkedEntityDescriptor()?.componentIdentification() ?? '';
1406
+ const componentName = attrName ? relatedEntity[attrName] : undefined;
1406
1407
  return componentName === undefined || componentName === null ? relatedEntity.id : String(componentName);
1407
1408
  }
1408
1409
  addSelectedComponentFromNavigatorResponse() {
@@ -1440,7 +1441,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1440
1441
  }
1441
1442
  relatedEntityFromLinkedStore() {
1442
1443
  const id = this.foreignKeyId();
1443
- const linkedStore = this.resolveRelatedEntityStore();
1444
+ const linkedStore = this.descriptorRegistry.getStore(this.config().linkedEntityType);
1444
1445
  if (!id || !linkedStore) {
1445
1446
  return undefined;
1446
1447
  }
@@ -1468,14 +1469,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1468
1469
  </mat-form-field>
1469
1470
  @if (showSelectEntityButton()) {
1470
1471
  <div class="foreign-key-select-row">
1471
- <button
1472
- type="button"
1473
- class="foreign-key-select-button"
1474
- mat-button
1475
- [title]="selectEntityTitle()"
1476
- [attr.aria-label]="selectEntityTitle()"
1477
- (click)="navigateToRelatedList()"
1478
- >
1472
+ <button type="button" class="foreign-key-select-button" mat-button [title]="selectEntityTitle()" [attr.aria-label]="selectEntityTitle()" (click)="navigateToRelatedList()">
1479
1473
  <mat-icon>add</mat-icon>
1480
1474
  {{ selectEntityTitle() }}
1481
1475
  </button>
@@ -1485,7 +1479,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1485
1479
  <input type="hidden" [formControlName]="config().attrName" />
1486
1480
  </div>
1487
1481
  }
1488
- `, isInline: true, styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
1482
+ `, isInline: true, styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}:host .foreign-key-field .mdc-notched-outline,:host .foreign-key-field .mdc-notched-outline *{pointer-events:none}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
1489
1483
  }
1490
1484
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ForeignKeyComponent, decorators: [{
1491
1485
  type: Component,
@@ -1504,14 +1498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
1504
1498
  </mat-form-field>
1505
1499
  @if (showSelectEntityButton()) {
1506
1500
  <div class="foreign-key-select-row">
1507
- <button
1508
- type="button"
1509
- class="foreign-key-select-button"
1510
- mat-button
1511
- [title]="selectEntityTitle()"
1512
- [attr.aria-label]="selectEntityTitle()"
1513
- (click)="navigateToRelatedList()"
1514
- >
1501
+ <button type="button" class="foreign-key-select-button" mat-button [title]="selectEntityTitle()" [attr.aria-label]="selectEntityTitle()" (click)="navigateToRelatedList()">
1515
1502
  <mat-icon>add</mat-icon>
1516
1503
  {{ selectEntityTitle() }}
1517
1504
  </button>
@@ -1521,7 +1508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
1521
1508
  <input type="hidden" [formControlName]="config().attrName" />
1522
1509
  </div>
1523
1510
  }
1524
- `, imports: [MatButton, MatIconButton, MatIcon, MatLabel, MatFormField, MatInput, MatSuffix, ReactiveFormsModule], styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}\n"] }]
1511
+ `, imports: [MatButton, MatIconButton, MatIcon, MatLabel, MatFormField, MatInput, MatSuffix, ReactiveFormsModule], styles: [".foreign-key-control{display:inline-flex;flex-direction:column;align-items:stretch}.foreign-key-field{width:100%}.foreign-key-select-row{display:flex;min-height:28px;margin-top:-18px;padding:0 12px 0 16px;justify-content:flex-start}.foreign-key-select-button{height:28px;min-width:max-content;padding:0 8px;line-height:28px;white-space:nowrap}.foreign-key-select-button mat-icon{width:18px;height:18px;margin-right:4px;font-size:18px;line-height:18px}:host .foreign-key-field .mdc-notched-outline,:host .foreign-key-field .mdc-notched-outline *{pointer-events:none}\n"] }]
1525
1512
  }] });
1526
1513
 
1527
1514
  class TextboxComponent extends BaseFormControlComponent {
@@ -1762,7 +1749,7 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
1762
1749
  }
1763
1750
  componentNameAttr() {
1764
1751
  return {
1765
- attrName: this.linkedEntityType().componentIdentification(),
1752
+ attrName: this.linkedEntityDescriptor()?.componentIdentification() ?? '',
1766
1753
  name: this.config().attrName,
1767
1754
  };
1768
1755
  }
@@ -1775,14 +1762,14 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
1775
1762
  return value;
1776
1763
  }
1777
1764
  addComponentTitle() {
1778
- return 'Add ' + this.linkedEntityType().entityName;
1765
+ return 'Add ' + this.linkedEntityName();
1779
1766
  }
1780
1767
  navigateToRelatedList() {
1781
1768
  if (this.config().disabled) {
1782
1769
  return;
1783
1770
  }
1784
1771
  this.formNavigator.captureFormSnapshot(this.formGroup.getRawValue());
1785
- this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
1772
+ this.formNavigator.navigateToRelatedList(this.linkedEntityName(), this.formNavigator.determineCurrentUrl(), {
1786
1773
  command: NavigatorCommand.SELECT_OR_CREATE,
1787
1774
  attrName: this.config().attrName,
1788
1775
  context: this.components(),
@@ -1849,7 +1836,7 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
1849
1836
  [componentNameAttr]="componentNameAttr()"
1850
1837
  [disabled]="config().disabled"
1851
1838
  [formGroup]="formGroup"
1852
- [linkedEntityType]="linkedEntityType().entityName"
1839
+ [linkedEntityType]="linkedEntityName()"
1853
1840
  />
1854
1841
  </li>
1855
1842
  }
@@ -1881,7 +1868,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
1881
1868
  [componentNameAttr]="componentNameAttr()"
1882
1869
  [disabled]="config().disabled"
1883
1870
  [formGroup]="formGroup"
1884
- [linkedEntityType]="linkedEntityType().entityName"
1871
+ [linkedEntityType]="linkedEntityName()"
1885
1872
  />
1886
1873
  </li>
1887
1874
  }
@@ -1902,7 +1889,7 @@ class LookupComponent extends BaseFormControlComponent {
1902
1889
  displayControl = new FormControl('', { nonNullable: true });
1903
1890
  filterText = signal('', ...(ngDevMode ? [{ debugName: "filterText" }] : /* istanbul ignore next */ []));
1904
1891
  destroyRef = inject(DestroyRef);
1905
- lookupStore = computed(() => this.resolveRelatedEntityStore(), ...(ngDevMode ? [{ debugName: "lookupStore" }] : /* istanbul ignore next */ []));
1892
+ lookupStore = computed(() => this.descriptorRegistry.getStore(this.config().linkedEntityType), ...(ngDevMode ? [{ debugName: "lookupStore" }] : /* istanbul ignore next */ []));
1906
1893
  lookupItems = computed(() => this.lookupStore()?.entities?.() ?? [], ...(ngDevMode ? [{ debugName: "lookupItems" }] : /* istanbul ignore next */ []));
1907
1894
  filteredLookupItems = computed(() => {
1908
1895
  const filterText = this.filterText().trim().toLocaleLowerCase();
@@ -1954,7 +1941,7 @@ class LookupComponent extends BaseFormControlComponent {
1954
1941
  if (!relatedEntityId) {
1955
1942
  return;
1956
1943
  }
1957
- this.formNavigator.navigateToRelated(this.linkedEntityType().entityName, relatedEntityId, this.formNavigator.determineCurrentUrl());
1944
+ this.formNavigator.navigateToRelated(this.linkedEntityName(), relatedEntityId, this.formNavigator.determineCurrentUrl());
1958
1945
  }
1959
1946
  canNavigateToRelated() {
1960
1947
  return !!(this.selectedLookupItem()?.id ?? this.lookupKey());
@@ -2237,10 +2224,10 @@ class BaseEntityDescriptor {
2237
2224
  const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.isLinkToDetails === true);
2238
2225
  return attrDescriptor?.attrName ?? '';
2239
2226
  }
2240
- overwriteLinkedEntityAttr(attrName, linkedEntityDescr) {
2227
+ overwriteLinkedEntityAttr(attrName, linkedEntityName) {
2241
2228
  const attrDescriptor = filterAttributeDescriptors(this.attrDescriptors).find((attrDescriptor) => attrDescriptor.attrName === attrName);
2242
2229
  if (attrDescriptor) {
2243
- attrDescriptor.linkedEntityType = linkedEntityDescr;
2230
+ attrDescriptor.linkedEntityType = linkedEntityName;
2244
2231
  }
2245
2232
  }
2246
2233
  }
@@ -2284,8 +2271,6 @@ class BaseEntityListComponent {
2284
2271
  this.formNavigator.determineActiveRouteSegment();
2285
2272
  this.requestPayload = this.formNavigator.popRequestPayload();
2286
2273
  this.selectOrCreateMode.set(this.requestPayload?.command === NavigatorCommand.SELECT_OR_CREATE);
2287
- // eslint-disable-next-line no-console
2288
- console.debug('[BaseEntityListComponent] ngOnInit', { entityName: this.entityDescriptor().entityName, requestPayload: this.requestPayload, selectOrCreateMode: this.selectOrCreateMode() });
2289
2274
  this.logger.info('BaseEntityListComponent initialized with:', { columnDescriptors: this.columnDescriptors() });
2290
2275
  }
2291
2276
  // endregion
@@ -2305,7 +2290,7 @@ class BaseEntityListComponent {
2305
2290
  this.store.setCurrentEntity(entity.id);
2306
2291
  }
2307
2292
  onNavigateToRelated(config, entity) {
2308
- const relatedEntityName = config.linkedEntityType?.entityName;
2293
+ const relatedEntityName = config.linkedEntityType;
2309
2294
  if (!relatedEntityName)
2310
2295
  return;
2311
2296
  this.formNavigator.navigateToRelated(relatedEntityName, this.getPropertyValue(entity, config.attrName));
@@ -2760,7 +2745,6 @@ function BaseEntityTabsStore() {
2760
2745
  }
2761
2746
 
2762
2747
  class BaseEntityFacade {
2763
- entityTitle = "this.store.currentEntity() ? this.store.currentEntity().name : ''";
2764
2748
  serviceKind = 'rest';
2765
2749
  endpoint;
2766
2750
  backendRoot;
@@ -2789,6 +2773,15 @@ class BaseEntityFacade {
2789
2773
  }
2790
2774
  return this._descriptor;
2791
2775
  }
2776
+ get entityName() {
2777
+ return this.descriptor.entityName;
2778
+ }
2779
+ get attrDescriptors() {
2780
+ return this.descriptor.attrDescriptors;
2781
+ }
2782
+ get entityTitle() {
2783
+ return this.descriptor.entityTitle;
2784
+ }
2792
2785
  createMapper() {
2793
2786
  return new SimpleEntityMapper(this.entityType);
2794
2787
  }
@@ -2809,13 +2802,6 @@ class BaseEntityFacade {
2809
2802
  createStoreClass() {
2810
2803
  return signalStore({ providedIn: 'root' }, BaseEntityStore(this.entityType, () => this.service), BaseEntityTabsStore(), BaseEntityContainerStore());
2811
2804
  }
2812
- createDescriptor() {
2813
- return new BaseEntityDescriptor({
2814
- entityName: this.entityName,
2815
- entityTitle: this.entityTitle,
2816
- attrDescriptors: this.attrDescriptors,
2817
- });
2818
- }
2819
2805
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2820
2806
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityFacade });
2821
2807
  }
@@ -2913,5 +2899,5 @@ const BASE_ENTITY_ROUTES = [
2913
2899
  * Generated bundle index. Do not edit.
2914
2900
  */
2915
2901
 
2916
- export { ACTIVE_ENTITY_FACADE, AbstractAttrDescriptor, BASE_ENTITY_FACADE_REGISTRY, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityFacade, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorSingletonStore, BaseFormNavigatorStore, Entity, EntityRegistryComponent, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, SimpleEntityMapper, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey };
2902
+ export { ACTIVE_ENTITY_FACADE, AbstractAttrDescriptor, BASE_ENTITY_FACADE_REGISTRY, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityDescriptor, BaseEntityDescriptorRegistry, BaseEntityFacade, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorSingletonStore, BaseFormNavigatorStore, Entity, EntityRegistryComponent, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, SimpleEntityMapper, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey };
2917
2903
  //# sourceMappingURL=processpuzzle-base-entity.mjs.map