@processpuzzle/base-entity 0.7.6 → 0.7.8

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.
@@ -99,6 +99,7 @@ const INITIAL_NAVIGATION_STATE = {
99
99
  responsePayloads: new Map(),
100
100
  requestPayloads: new Map(),
101
101
  returnTo: '',
102
+ formSnapshot: undefined,
102
103
  };
103
104
  function snakeCaseName(entityName) {
104
105
  return entityName
@@ -130,8 +131,17 @@ const BaseFormNavigatorSingletonStore = signalStore({ providedIn: 'root' }, with
130
131
  patchState(store, {
131
132
  requestPayloads: new Map(),
132
133
  responsePayloads: new Map(),
134
+ formSnapshot: undefined,
133
135
  });
134
136
  }
137
+ function captureFormSnapshot(snapshot) {
138
+ patchState(store, { formSnapshot: snapshot });
139
+ }
140
+ function popFormSnapshot() {
141
+ const snapshot = store.formSnapshot();
142
+ patchState(store, { formSnapshot: undefined });
143
+ return snapshot;
144
+ }
135
145
  function determineActiveRouteSegment() {
136
146
  const currentUrl = Reflect.get(route, '_routerState').snapshot.url;
137
147
  if (currentUrl.endsWith(BaseUrlSegments.ListForm)) {
@@ -299,6 +309,7 @@ const BaseFormNavigatorSingletonStore = signalStore({ providedIn: 'root' }, with
299
309
  });
300
310
  }
301
311
  return {
312
+ captureFormSnapshot,
302
313
  determineCurrentUrl,
303
314
  determineActiveRouteSegment,
304
315
  navigateBack,
@@ -309,6 +320,7 @@ const BaseFormNavigatorSingletonStore = signalStore({ providedIn: 'root' }, with
309
320
  navigateToUrl,
310
321
  destroyNavigationTracking,
311
322
  initializeNavigationTracking,
323
+ popFormSnapshot,
312
324
  popRequestPayload,
313
325
  popResponsePayload,
314
326
  pushResponsePayload,
@@ -1365,6 +1377,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1365
1377
  if (this.config().disabled) {
1366
1378
  return;
1367
1379
  }
1380
+ this.formNavigator.captureFormSnapshot(this.formGroup.getRawValue());
1368
1381
  this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
1369
1382
  command: NavigatorCommand.SELECT_OR_CREATE,
1370
1383
  attrName: this.config().attrName,
@@ -1455,14 +1468,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1455
1468
  </mat-form-field>
1456
1469
  @if (showSelectEntityButton()) {
1457
1470
  <div class="foreign-key-select-row">
1458
- <button
1459
- type="button"
1460
- class="foreign-key-select-button"
1461
- mat-button
1462
- [title]="selectEntityTitle()"
1463
- [attr.aria-label]="selectEntityTitle()"
1464
- (click)="navigateToRelatedList()"
1465
- >
1471
+ <button type="button" class="foreign-key-select-button" mat-button [title]="selectEntityTitle()" [attr.aria-label]="selectEntityTitle()" (click)="navigateToRelatedList()">
1466
1472
  <mat-icon>add</mat-icon>
1467
1473
  {{ selectEntityTitle() }}
1468
1474
  </button>
@@ -1472,7 +1478,7 @@ class ForeignKeyComponent extends BaseFormControlComponent {
1472
1478
  <input type="hidden" [formControlName]="config().attrName" />
1473
1479
  </div>
1474
1480
  }
1475
- `, 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"] }] });
1481
+ `, 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"] }] });
1476
1482
  }
1477
1483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ForeignKeyComponent, decorators: [{
1478
1484
  type: Component,
@@ -1491,14 +1497,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
1491
1497
  </mat-form-field>
1492
1498
  @if (showSelectEntityButton()) {
1493
1499
  <div class="foreign-key-select-row">
1494
- <button
1495
- type="button"
1496
- class="foreign-key-select-button"
1497
- mat-button
1498
- [title]="selectEntityTitle()"
1499
- [attr.aria-label]="selectEntityTitle()"
1500
- (click)="navigateToRelatedList()"
1501
- >
1500
+ <button type="button" class="foreign-key-select-button" mat-button [title]="selectEntityTitle()" [attr.aria-label]="selectEntityTitle()" (click)="navigateToRelatedList()">
1502
1501
  <mat-icon>add</mat-icon>
1503
1502
  {{ selectEntityTitle() }}
1504
1503
  </button>
@@ -1508,7 +1507,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
1508
1507
  <input type="hidden" [formControlName]="config().attrName" />
1509
1508
  </div>
1510
1509
  }
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}\n"] }]
1510
+ `, 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"] }]
1512
1511
  }] });
1513
1512
 
1514
1513
  class TextboxComponent extends BaseFormControlComponent {
@@ -1768,9 +1767,11 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
1768
1767
  if (this.config().disabled) {
1769
1768
  return;
1770
1769
  }
1770
+ this.formNavigator.captureFormSnapshot(this.formGroup.getRawValue());
1771
1771
  this.formNavigator.navigateToRelatedList(this.linkedEntityType().entityName, this.formNavigator.determineCurrentUrl(), {
1772
1772
  command: NavigatorCommand.SELECT_OR_CREATE,
1773
1773
  attrName: this.config().attrName,
1774
+ context: this.components(),
1774
1775
  });
1775
1776
  }
1776
1777
  addSelectedComponentFromNavigatorResponse() {
@@ -1783,7 +1784,8 @@ class EntityComponentsListComponent extends BaseFormControlComponent {
1783
1784
  }
1784
1785
  const selectedComponent = responsePayload.payload;
1785
1786
  assertPersistedEntity(selectedComponent);
1786
- const components = [...this.components(), selectedComponent];
1787
+ const previousComponents = Array.isArray(responsePayload.context) ? responsePayload.context : this.components();
1788
+ const components = [...previousComponents, selectedComponent];
1787
1789
  const attrName = this.config().attrName;
1788
1790
  const entity = this.entity();
1789
1791
  entity[attrName] = components;
@@ -2046,7 +2048,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
2046
2048
  class BaseEntityFormBuilder {
2047
2049
  logger = inject(NGXLogger);
2048
2050
  // region public methods
2049
- buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity) {
2051
+ buildForm(viewContainerRef, baseEntityForm, store, attrDescriptors, entity, initialValues) {
2050
2052
  this.logger.trace('Starting to build form for: ', { attrDescriptors: attrDescriptors });
2051
2053
  viewContainerRef.clear();
2052
2054
  attrDescriptors.forEach((column) => {
@@ -2054,7 +2056,8 @@ class BaseEntityFormBuilder {
2054
2056
  const formControlType = this.createFormControl(column);
2055
2057
  if (formControlType) {
2056
2058
  if (column instanceof BaseEntityAttrDescriptor) {
2057
- const currentAttrValue = Reflect.get(entity(), column.attrName);
2059
+ const hasSnapshotValue = initialValues != null && Object.prototype.hasOwnProperty.call(initialValues, column.attrName);
2060
+ const currentAttrValue = hasSnapshotValue ? initialValues[column.attrName] : Reflect.get(entity(), column.attrName);
2058
2061
  const formControl = new FormControl({ value: currentAttrValue, disabled: column.disabled }, column.required ? Validators.required : null);
2059
2062
  baseEntityForm.addControl(column.attrName, formControl);
2060
2063
  const componentRef = viewContainerRef.createComponent(formControlType);
@@ -2070,7 +2073,7 @@ class BaseEntityFormBuilder {
2070
2073
  componentRef.setInput('entity', entity());
2071
2074
  componentRef.instance.formGroup = baseEntityForm;
2072
2075
  componentRef.instance.store = store;
2073
- this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity);
2076
+ this.buildForm(componentRef.instance.flexBoxHost.viewContainerRef, baseEntityForm, store, column.attrDescriptors, entity, initialValues);
2074
2077
  }
2075
2078
  else
2076
2079
  throw Error('Undefined subclass of AbstractAttrDescriptor');
@@ -2179,7 +2182,8 @@ class BaseEntityFormComponent {
2179
2182
  effect(() => {
2180
2183
  if (this.entityId() && this.entityDescriptor() && this.entity())
2181
2184
  untracked(() => {
2182
- this.entityFormBuilder.buildForm(this.componentHost.viewContainerRef, this.baseEntityForm, this.store(), this.entityDescriptor().attrDescriptors, this.entity);
2185
+ const snapshot = this.formNavigator.popFormSnapshot();
2186
+ this.entityFormBuilder.buildForm(this.componentHost.viewContainerRef, this.baseEntityForm, this.store(), this.entityDescriptor().attrDescriptors, this.entity, snapshot);
2183
2187
  });
2184
2188
  });
2185
2189
  effect(() => {
@@ -2338,6 +2342,7 @@ class BaseEntityListComponent {
2338
2342
  command: NavigatorCommand.SELECT_OR_CREATE,
2339
2343
  attrName: this.requestPayload?.attrName,
2340
2344
  payload: this.selection.selected[0],
2345
+ context: this.requestPayload?.context,
2341
2346
  });
2342
2347
  await this.formNavigator.navigateBack();
2343
2348
  }
@@ -2376,7 +2381,7 @@ class BaseEntityListComponent {
2376
2381
  return this.selection.selected.length === 1;
2377
2382
  }
2378
2383
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2379
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: BaseEntityListComponent, isStandalone: true, selector: "base-list", viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode()) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { 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: "pipe", type: SlicePipe, name: "slice" }] });
2384
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: BaseEntityListComponent, isStandalone: true, selector: "base-list", viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <div class=\"base-entity-list-footer\">\n @if (selectOrCreateMode()) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n }\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n </div>\n</div>\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-footer{display:flex;align-items:center;justify-content:space-between;gap:16px}.base-entity-list-actions{display:flex;gap:8px;padding-left:16px}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { 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: "pipe", type: SlicePipe, name: "slice" }] });
2380
2385
  }
2381
2386
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: BaseEntityListComponent, decorators: [{
2382
2387
  type: Component,
@@ -2398,7 +2403,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
2398
2403
  MatCheckbox,
2399
2404
  SlicePipe,
2400
2405
  MatButton,
2401
- ], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n</div>\n@if (selectOrCreateMode()) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n}\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}\n"] }]
2406
+ ], template: "@if (store.isLoading()) {\n <mat-progress-bar mode=\"query\"></mat-progress-bar>\n}\n<div class=\"base-entity-list mat-elevation-z8\">\n <mat-table [dataSource]=\"dataSource\" matSort aria-describedby=\"base-entity-list\">\n <!-- Checkbox Column -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef>\n <mat-checkbox (change)=\"$event ? onToggleAllRows() : null\" [checked]=\"selection.hasValue() && isAllSelected()\" [indeterminate]=\"selection.hasValue() && !isAllSelected()\"> </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null; onChangeSelection(row)\" [checked]=\"selection.isSelected(row)\"></mat-checkbox>\n </mat-cell>\n </ng-container>\n\n @for (colDescriptor of columnDescriptors(); track colDescriptor.attrName; let i = $index) {\n <ng-container [matColumnDef]=\"colDescriptor.attrName\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ colDescriptor.label }}</mat-header-cell>\n <mat-cell (click)=\"onRowClick(element)\" *matCellDef=\"let element\">\n @if (colDescriptor.isLinkToDetails) {\n <a (click)=\"onNavigateToDetails(element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.linkedEntityType !== undefined ) {\n <a (click)=\"onNavigateToRelated(colDescriptor, element)\">{{ element[colDescriptor.attrName] }}</a>\n } @else if (colDescriptor.formControlType === 'ARTIFACT' && element[colDescriptor.attrName] !== undefined ) {\n @let artifact = element[colDescriptor.attrName];\n <a (click)=\"onDownloadObject(artifact, $event)\">{{ ((artifact.name ?? artifact.objectId ?? '') | slice:0:20) + ((artifact.name ?? artifact.objectId ?? '').length > 20 ? '...' : '') }}</a>\n } @else if (colDescriptor.formControlType === 'TAGS' && element[colDescriptor.attrName] !== undefined ) {\n {{ (element[colDescriptor.attrName].join(', ') | slice:0:20) + (element[colDescriptor.attrName].join(', ').length > 20 ? '...' : '') }}\n } @else {\n {{ element[colDescriptor.attrName] }}\n }\n </mat-cell>\n </ng-container>\n }\n <mat-header-row *matHeaderRowDef=\"displayedColumns()\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns()\"></mat-row>\n </mat-table>\n <div class=\"base-entity-list-footer\">\n @if (selectOrCreateMode()) {\n <div class=\"base-entity-list-actions\">\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" type=\"button\" mat-raised-button color=\"secondary\" (click)=\"onCancelSelectOrCreate()\">Cancel</button>\n <button id=\"select\" [attr.data-testid]=\"entityDescriptor().createTestId( 'select')\" type=\"button\" mat-raised-button color=\"primary\" [disabled]=\"!canSelectEntity()\" (click)=\"onSelectEntity()\">Select</button>\n </div>\n }\n <mat-paginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\n </div>\n</div>\n", styles: [".base-entity-list{display:flex;flex-direction:column;max-height:500px;min-width:300px}.mat-table{overflow:auto;max-height:500px}.mat-column-select{overflow:visible}.mat-column-select{overflow:initial}.mat-mdc-row:hover{background-color:#6495ed;cursor:pointer}.base-entity-list-footer{display:flex;align-items:center;justify-content:space-between;gap:16px}.base-entity-list-actions{display:flex;gap:8px;padding-left:16px}\n"] }]
2402
2407
  }], ctorParameters: () => [], propDecorators: { sort: [{
2403
2408
  type: ViewChild,
2404
2409
  args: [MatSort]