@processpuzzle/base-entity 1.1.0 → 1.2.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Injectable, output, signal, forwardRef, ViewChild, Inject, Component, input, computed, Injector, effect, InjectionToken, Directive, HostBinding, EventEmitter, Output, DestroyRef, untracked, runInInjectionContext, provideAppInitializer } from '@angular/core';
2
+ import { inject, Injectable, output, signal, forwardRef, ViewChild, Inject, Component, input, computed, Injector, ChangeDetectionStrategy, effect, InjectionToken, Directive, HostBinding, EventEmitter, Output, DestroyRef, untracked, runInInjectionContext, provideAppInitializer } from '@angular/core';
3
3
  import { MatSnackBar } from '@angular/material/snack-bar';
4
4
  import * as i1$1 from '@angular/common';
5
5
  import { CommonModule, NgClass, NgStyle, NgTemplateOutlet, SlicePipe } from '@angular/common';
@@ -9,6 +9,9 @@ import * as i2 from '@angular/material/toolbar';
9
9
  import { MatToolbarModule, MatToolbar } from '@angular/material/toolbar';
10
10
  import { MatIcon } from '@angular/material/icon';
11
11
  import { MatButton, MatIconButton } from '@angular/material/button';
12
+ import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatDialog, MatDialogRef } from '@angular/material/dialog';
13
+ import { MatTooltip } from '@angular/material/tooltip';
14
+ import { firstValueFrom, map, catchError, of, throwError, filter, switchMap, Subject, from, pipe, tap } from 'rxjs';
12
15
  import * as i2$1 from '@angular/material/form-field';
13
16
  import { MatFormField, MatSuffix, MatLabel, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
14
17
  import * as i3 from '@angular/material/input';
@@ -19,7 +22,6 @@ import { withDevtools } from '@angular-architects/ngrx-toolkit';
19
22
  import { LayoutService, RUNTIME_CONFIGURATION } from '@processpuzzle/util';
20
23
  import * as i1 from '@angular/forms';
21
24
  import { NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule, FormsModule, Validators, FormBuilder } from '@angular/forms';
22
- import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatDialog } from '@angular/material/dialog';
23
25
  import { TranslocoDirective, provideTranslocoScope, TranslocoService } from '@jsverse/transloco';
24
26
  import { Compartment, EditorState } from '@codemirror/state';
25
27
  import { EditorView, keymap, placeholder } from '@codemirror/view';
@@ -28,18 +30,18 @@ import { closeBrackets, autocompletion } from '@codemirror/autocomplete';
28
30
  import { StreamLanguage, HighlightStyle, syntaxHighlighting, bracketMatching } from '@codemirror/language';
29
31
  import { tags } from '@lezer/highlight';
30
32
  import { linter } from '@codemirror/lint';
33
+ import { MatCheckbox } from '@angular/material/checkbox';
34
+ import { MatRadioGroup, MatRadioButton } from '@angular/material/radio';
35
+ import * as i2$2 from '@angular/material/select';
36
+ import { MatSelect, MatOption, MatSelectModule } from '@angular/material/select';
31
37
  import { __decorate, __param } from 'tslib';
32
- import { map, catchError, of, throwError, filter, switchMap, Subject, from, firstValueFrom, pipe, tap } from 'rxjs';
33
38
  import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
34
39
  import { buildUrl } from 'build-url-ts';
40
+ import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
35
41
  import { MatCard, MatCardContent, MatCardActions } from '@angular/material/card';
36
42
  import { NGXLogger } from 'ngx-logging-kit';
37
- import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
38
43
  import * as i4 from '@angular/material/datepicker';
39
44
  import { MatDatepickerModule } from '@angular/material/datepicker';
40
- import * as i2$2 from '@angular/material/select';
41
- import { MatSelectModule } from '@angular/material/select';
42
- import { MatCheckbox } from '@angular/material/checkbox';
43
45
  import { ENTER, COMMA } from '@angular/cdk/keycodes';
44
46
  import { MatChipGrid, MatChipRow, MatChipInput, MatChipRemove } from '@angular/material/chips';
45
47
  import * as i2$3 from '@angular/material/autocomplete';
@@ -1334,11 +1336,369 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
1334
1336
  `, styles: [".query-wrapper{display:inline-flex;align-items:center;gap:8px}.field-label{font-size:14px;white-space:nowrap}.query-field{width:320px}\n"] }]
1335
1337
  }], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
1336
1338
 
1339
+ /**
1340
+ * Generates and downloads a PDF table from entity store data, client-side.
1341
+ *
1342
+ * Uses jsPDF + jspdf-autotable, both lazy-loaded on first call so the ~500 KB
1343
+ * bundle is never fetched until the user actually requests an export.
1344
+ *
1345
+ * Usage in BaseEntityList:
1346
+ *
1347
+ * ```typescript
1348
+ * private readonly pdfExport = inject(PdfExportService);
1349
+ *
1350
+ * async onExportPdf() {
1351
+ * await this.pdfExport.export(
1352
+ * this.store.entities(), // signal snapshot → plain array
1353
+ * this.pdfColumns(), // derived from entity descriptor
1354
+ * { title: 'Orders', filename: 'orders-export' }
1355
+ * );
1356
+ * }
1357
+ * ```
1358
+ *
1359
+ * Install dependencies:
1360
+ * npm install jspdf jspdf-autotable
1361
+ * npm install --save-dev @types/jspdf-autotable
1362
+ */
1363
+ class PdfExportService {
1364
+ /** Tracks whether a PDF generation is currently in progress. */
1365
+ exporting = signal(false, /* @ts-ignore */
1366
+ ...(ngDevMode ? [{ debugName: "exporting" }] : /* istanbul ignore next */ []));
1367
+ /**
1368
+ * Exports entities to a PDF and triggers a browser download.
1369
+ *
1370
+ * @param entities The raw entity array — typically `store.entities()`.
1371
+ * @param columns Column definitions derived from the entity descriptor.
1372
+ * @param options Title, filename, orientation, page size.
1373
+ */
1374
+ async export(entities, columns, options = {}) {
1375
+ const filename = `${options.filename ?? 'export'}.pdf`;
1376
+ if (entities.length === 0) {
1377
+ return { success: false, filename, rowCount: 0, error: 'No data to export.' };
1378
+ }
1379
+ this.exporting.set(true);
1380
+ try {
1381
+ return await this.generate(entities, columns, options, filename);
1382
+ }
1383
+ catch (err) {
1384
+ const error = err instanceof Error ? err.message : 'PDF generation failed.';
1385
+ console.error('[PdfExportService]', error);
1386
+ return { success: false, filename, rowCount: entities.length, error };
1387
+ }
1388
+ finally {
1389
+ this.exporting.set(false);
1390
+ }
1391
+ }
1392
+ async generate(entities, columns, options, filename) {
1393
+ // Lazy-load — neither jsPDF nor autotable is bundled into the main chunk.
1394
+ const [{ default: jsPDF }, { default: autoTable }] = await Promise.all([
1395
+ import('jspdf'),
1396
+ import('jspdf-autotable'),
1397
+ ]);
1398
+ const orientation = options.orientation ?? (columns.length > 5 ? 'landscape' : 'portrait');
1399
+ const doc = new jsPDF({
1400
+ orientation,
1401
+ unit: 'mm',
1402
+ format: options.pageSize ?? 'a4',
1403
+ });
1404
+ const pageWidth = doc.internal.pageSize.getWidth();
1405
+ const margin = 14;
1406
+ const contentWidth = pageWidth - margin * 2;
1407
+ // ── Title block ───────────────────────────────────────────────────────────
1408
+ let cursorY = margin;
1409
+ if (options.title) {
1410
+ doc.setFontSize(16);
1411
+ doc.setFont('helvetica', 'bold');
1412
+ doc.text(options.title, margin, cursorY);
1413
+ cursorY += 7;
1414
+ }
1415
+ if (options.subtitle) {
1416
+ doc.setFontSize(10);
1417
+ doc.setFont('helvetica', 'normal');
1418
+ doc.setTextColor(100);
1419
+ doc.text(options.subtitle, margin, cursorY);
1420
+ doc.setTextColor(0);
1421
+ cursorY += 5;
1422
+ }
1423
+ // Export timestamp — always shown so the reader knows when this was generated.
1424
+ doc.setFontSize(8);
1425
+ doc.setFont('helvetica', 'normal');
1426
+ doc.setTextColor(150);
1427
+ doc.text(`Exported ${new Date().toLocaleString()}`, margin, cursorY);
1428
+ doc.setTextColor(0);
1429
+ cursorY += 4;
1430
+ // ── Table ─────────────────────────────────────────────────────────────────
1431
+ const head = [columns.map(c => c.header)];
1432
+ const body = entities.map(entity => columns.map(col => {
1433
+ const value = entity[col.field];
1434
+ return col.formatter
1435
+ ? col.formatter(value, entity)
1436
+ : this.formatValue(value);
1437
+ }));
1438
+ // Distribute column widths proportionally from the weight hints.
1439
+ const totalWeight = columns.reduce((sum, c) => sum + (c.width ?? 1), 0);
1440
+ const columnStyles = {};
1441
+ columns.forEach((col, i) => {
1442
+ columnStyles[i] = {
1443
+ cellWidth: ((col.width ?? 1) / totalWeight) * contentWidth,
1444
+ halign: col.align ?? 'left',
1445
+ };
1446
+ });
1447
+ autoTable(doc, {
1448
+ head,
1449
+ body,
1450
+ startY: cursorY,
1451
+ margin: { left: margin, right: margin },
1452
+ columnStyles,
1453
+ headStyles: {
1454
+ fillColor: [41, 128, 185], // neutral blue — swap to your brand color
1455
+ textColor: 255,
1456
+ fontStyle: 'bold',
1457
+ fontSize: 9,
1458
+ },
1459
+ bodyStyles: {
1460
+ fontSize: 8,
1461
+ textColor: 40,
1462
+ },
1463
+ alternateRowStyles: {
1464
+ fillColor: [245, 247, 250],
1465
+ },
1466
+ // Repeat column headers on every page for long exports.
1467
+ showHead: 'everyPage',
1468
+ });
1469
+ // Page footer with filename + page numbers. Added in a post-pass so the total
1470
+ // page count is known (it isn't yet while autotable is still laying out pages).
1471
+ if (options.includeFooter !== false) {
1472
+ const pageCount = doc.getNumberOfPages();
1473
+ for (let page = 1; page <= pageCount; page++) {
1474
+ doc.setPage(page);
1475
+ this.drawFooter(doc, page, pageCount, filename);
1476
+ }
1477
+ }
1478
+ doc.save(filename);
1479
+ return { success: true, filename, rowCount: entities.length };
1480
+ }
1481
+ /**
1482
+ * Formats a raw entity field value as a readable string for the PDF cell.
1483
+ * Handles the common cases; override per-column with a custom `formatter`.
1484
+ */
1485
+ formatValue(value) {
1486
+ if (value === null || value === undefined)
1487
+ return '';
1488
+ if (value instanceof Date)
1489
+ return value.toLocaleDateString();
1490
+ if (typeof value === 'boolean')
1491
+ return value ? 'Yes' : 'No';
1492
+ if (typeof value === 'number')
1493
+ return value.toLocaleString();
1494
+ if (typeof value === 'bigint')
1495
+ return value.toString();
1496
+ if (typeof value === 'string')
1497
+ return this.formatString(value);
1498
+ if (typeof value === 'object')
1499
+ return JSON.stringify(value);
1500
+ return ''; // symbol / function — not meaningful in a table cell
1501
+ }
1502
+ /** Renders ISO date strings as locale dates, leaving all other strings untouched. */
1503
+ formatString(value) {
1504
+ const isoDatePattern = /^\d{4}-\d{2}-\d{2}(T.*)?$/;
1505
+ if (!isoDatePattern.test(value))
1506
+ return value;
1507
+ const date = new Date(value);
1508
+ return Number.isNaN(date.getTime()) ? value : date.toLocaleDateString();
1509
+ }
1510
+ drawFooter(doc, pageNumber, pageCount, filename) {
1511
+ const pageWidth = doc.internal.pageSize.getWidth();
1512
+ const pageHeight = doc.internal.pageSize.getHeight();
1513
+ doc.setFontSize(7);
1514
+ doc.setFont('helvetica', 'normal');
1515
+ doc.setTextColor(150);
1516
+ // Left: filename
1517
+ doc.text(filename, 14, pageHeight - 8);
1518
+ // Right: page numbers
1519
+ doc.text(`Page ${pageNumber} of ${pageCount}`, pageWidth - 14, pageHeight - 8, { align: 'right' });
1520
+ doc.setTextColor(0);
1521
+ }
1522
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PdfExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1523
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PdfExportService, providedIn: 'root' });
1524
+ }
1525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PdfExportService, decorators: [{
1526
+ type: Injectable,
1527
+ args: [{ providedIn: 'root' }]
1528
+ }] });
1529
+
1530
+ /**
1531
+ * Asks the user for the few PDF layout choices we expose — orientation, page size and
1532
+ * whether to print a footer. Deliberately narrow: this is not a full layout editor.
1533
+ *
1534
+ * Closes with a {@link PdfExportDialogResult} on Export, or `undefined` on Cancel.
1535
+ */
1536
+ class PdfExportOptionsDialog {
1537
+ dialogRef = inject(MatDialogRef);
1538
+ orientation = signal('portrait', /* @ts-ignore */
1539
+ ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
1540
+ pageSize = signal('a4', /* @ts-ignore */
1541
+ ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
1542
+ includeFooter = signal(true, /* @ts-ignore */
1543
+ ...(ngDevMode ? [{ debugName: "includeFooter" }] : /* istanbul ignore next */ []));
1544
+ onExport() {
1545
+ this.dialogRef.close({
1546
+ orientation: this.orientation(),
1547
+ pageSize: this.pageSize(),
1548
+ includeFooter: this.includeFooter(),
1549
+ });
1550
+ }
1551
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PdfExportOptionsDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
1552
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: PdfExportOptionsDialog, isStandalone: true, selector: "base-entity-pdf-export-options-dialog", providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], ngImport: i0, template: `
1553
+ <ng-container *transloco="let t">
1554
+ <h2 mat-dialog-title>{{ t('base_entity.pdf_export.dialog_title') }}</h2>
1555
+ <mat-dialog-content>
1556
+ <fieldset class="pdf-export-field">
1557
+ <legend>{{ t('base_entity.pdf_export.orientation_label') }}</legend>
1558
+ <mat-radio-group [(ngModel)]="orientation" aria-labelledby="pdf-orientation">
1559
+ <mat-radio-button value="portrait">{{ t('base_entity.pdf_export.orientation_portrait') }}</mat-radio-button>
1560
+ <mat-radio-button value="landscape">{{ t('base_entity.pdf_export.orientation_landscape') }}</mat-radio-button>
1561
+ </mat-radio-group>
1562
+ </fieldset>
1563
+
1564
+ <mat-form-field class="pdf-export-field" subscriptSizing="dynamic">
1565
+ <mat-label>{{ t('base_entity.pdf_export.page_size_label') }}</mat-label>
1566
+ <mat-select [(ngModel)]="pageSize">
1567
+ <mat-option value="a4">A4</mat-option>
1568
+ <mat-option value="a3">A3</mat-option>
1569
+ <mat-option value="letter">Letter</mat-option>
1570
+ </mat-select>
1571
+ </mat-form-field>
1572
+
1573
+ <mat-checkbox class="pdf-export-field" [(ngModel)]="includeFooter">{{ t('base_entity.pdf_export.include_footer_label') }}</mat-checkbox>
1574
+ </mat-dialog-content>
1575
+ <mat-dialog-actions align="end">
1576
+ <button type="button" mat-button [mat-dialog-close]="undefined">{{ t('base_entity.pdf_export.cancel_button') }}</button>
1577
+ <button type="button" mat-raised-button color="primary" (click)="onExport()">{{ t('base_entity.pdf_export.export_button') }}</button>
1578
+ </mat-dialog-actions>
1579
+ </ng-container>
1580
+ `, isInline: true, styles: [".pdf-export-field{display:block;margin-bottom:16px}mat-radio-group{display:flex;flex-direction:column;gap:4px}mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { 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: 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: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1581
+ }
1582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PdfExportOptionsDialog, decorators: [{
1583
+ type: Component,
1584
+ args: [{ selector: 'base-entity-pdf-export-options-dialog', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatButton, MatCheckbox, MatFormField, MatLabel, MatRadioGroup, MatRadioButton, MatSelect, MatOption, TranslocoDirective], providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], template: `
1585
+ <ng-container *transloco="let t">
1586
+ <h2 mat-dialog-title>{{ t('base_entity.pdf_export.dialog_title') }}</h2>
1587
+ <mat-dialog-content>
1588
+ <fieldset class="pdf-export-field">
1589
+ <legend>{{ t('base_entity.pdf_export.orientation_label') }}</legend>
1590
+ <mat-radio-group [(ngModel)]="orientation" aria-labelledby="pdf-orientation">
1591
+ <mat-radio-button value="portrait">{{ t('base_entity.pdf_export.orientation_portrait') }}</mat-radio-button>
1592
+ <mat-radio-button value="landscape">{{ t('base_entity.pdf_export.orientation_landscape') }}</mat-radio-button>
1593
+ </mat-radio-group>
1594
+ </fieldset>
1595
+
1596
+ <mat-form-field class="pdf-export-field" subscriptSizing="dynamic">
1597
+ <mat-label>{{ t('base_entity.pdf_export.page_size_label') }}</mat-label>
1598
+ <mat-select [(ngModel)]="pageSize">
1599
+ <mat-option value="a4">A4</mat-option>
1600
+ <mat-option value="a3">A3</mat-option>
1601
+ <mat-option value="letter">Letter</mat-option>
1602
+ </mat-select>
1603
+ </mat-form-field>
1604
+
1605
+ <mat-checkbox class="pdf-export-field" [(ngModel)]="includeFooter">{{ t('base_entity.pdf_export.include_footer_label') }}</mat-checkbox>
1606
+ </mat-dialog-content>
1607
+ <mat-dialog-actions align="end">
1608
+ <button type="button" mat-button [mat-dialog-close]="undefined">{{ t('base_entity.pdf_export.cancel_button') }}</button>
1609
+ <button type="button" mat-raised-button color="primary" (click)="onExport()">{{ t('base_entity.pdf_export.export_button') }}</button>
1610
+ </mat-dialog-actions>
1611
+ </ng-container>
1612
+ `, styles: [".pdf-export-field{display:block;margin-bottom:16px}mat-radio-group{display:flex;flex-direction:column;gap:4px}mat-form-field{width:100%}\n"] }]
1613
+ }] });
1614
+
1615
+ /**
1616
+ * Converts a BaseEntityDescriptor's attribute descriptors into PdfColumnDefinition[]
1617
+ * for {@link PdfExportService}.
1618
+ *
1619
+ * The set of columns mirrors exactly what BaseEntityListComponent renders in its table:
1620
+ * descriptors are flattened via {@link filterAttributeDescriptors} (so nested FlexBox
1621
+ * attributes are included) and any attribute with `hideInTable === true` is dropped — the
1622
+ * same rule the list uses. An attribute hidden from the list is therefore also absent from
1623
+ * the PDF.
1624
+ *
1625
+ * Type-appropriate alignment and value formatters are derived from `formControlType` so
1626
+ * booleans, dates, tags and artifacts render sensibly without per-field configuration.
1627
+ */
1628
+ function entityDescriptorToPdfColumns(descriptors) {
1629
+ return filterAttributeDescriptors(descriptors)
1630
+ .filter((descriptor) => descriptor.hideInTable !== true)
1631
+ .map((descriptor) => ({
1632
+ field: descriptor.attrName,
1633
+ header: descriptor.label,
1634
+ align: columnAlign(descriptor.formControlType),
1635
+ formatter: columnFormatter(descriptor),
1636
+ }));
1637
+ }
1638
+ function columnAlign(type) {
1639
+ return type === FormControlType.CHECKBOX ? 'center' : 'left';
1640
+ }
1641
+ function columnFormatter(descriptor) {
1642
+ switch (descriptor.formControlType) {
1643
+ case FormControlType.CHECKBOX:
1644
+ return formatBoolean;
1645
+ case FormControlType.DATE:
1646
+ return formatDate;
1647
+ case FormControlType.TAGS:
1648
+ return formatTags;
1649
+ case FormControlType.ARTIFACT:
1650
+ return formatArtifact;
1651
+ // TEXT_BOX, TEXTAREA, DROPDOWN, FOREIGN_KEY, LOOKUP, etc. → default string coercion in the service
1652
+ default:
1653
+ return undefined;
1654
+ }
1655
+ }
1656
+ function formatBoolean(value) {
1657
+ if (value === true || value === 'true')
1658
+ return '✓';
1659
+ if (value === false || value === 'false')
1660
+ return '✗';
1661
+ return '';
1662
+ }
1663
+ function formatDate(value) {
1664
+ if (!value)
1665
+ return '';
1666
+ const date = value instanceof Date ? value : new Date(toText(value));
1667
+ return Number.isNaN(date.getTime()) ? toText(value) : date.toLocaleDateString();
1668
+ }
1669
+ function formatTags(value) {
1670
+ if (Array.isArray(value))
1671
+ return value.join(', ');
1672
+ return toText(value);
1673
+ }
1674
+ function formatArtifact(value) {
1675
+ if (value == null)
1676
+ return '';
1677
+ const artifact = value;
1678
+ return artifact.name ?? artifact.objectId ?? '';
1679
+ }
1680
+ /** Coerces an arbitrary value to a cell string without ever relying on Object's default `[object Object]` stringification. */
1681
+ function toText(value) {
1682
+ if (value === null || value === undefined)
1683
+ return '';
1684
+ if (typeof value === 'string')
1685
+ return value;
1686
+ if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint')
1687
+ return value.toString();
1688
+ if (typeof value === 'object')
1689
+ return JSON.stringify(value);
1690
+ return ''; // symbol / function — not meaningful in a table cell
1691
+ }
1692
+
1337
1693
  class BaseEntityToolbarComponent {
1338
1694
  entityDescriptor = input.required(/* @ts-ignore */
1339
1695
  ...(ngDevMode ? [{ debugName: "entityDescriptor" }] : /* istanbul ignore next */ []));
1340
1696
  layoutService = inject(LayoutService);
1341
1697
  formNavigator = inject(BaseFormNavigatorSingletonStore);
1698
+ dialog = inject(MatDialog);
1699
+ snackBar = inject(MatSnackBar);
1700
+ pdfExportService = inject(PdfExportService);
1701
+ translocoService = inject(TranslocoService);
1342
1702
  store;
1343
1703
  isDeleteEnabled = computed(() => this.store?.selectedEntities().length != 0 && !this.entityDescriptor().isAbstract, /* @ts-ignore */
1344
1704
  ...(ngDevMode ? [{ debugName: "isDeleteEnabled" }] : /* istanbul ignore next */ []));
@@ -1346,6 +1706,9 @@ class BaseEntityToolbarComponent {
1346
1706
  ...(ngDevMode ? [{ debugName: "isEditEnabled" }] : /* istanbul ignore next */ []));
1347
1707
  isNewEnabled = computed(() => !this.entityDescriptor().isAbstract, /* @ts-ignore */
1348
1708
  ...(ngDevMode ? [{ debugName: "isNewEnabled" }] : /* istanbul ignore next */ []));
1709
+ isPdfExportEnabled = computed(() => (this.store?.entities().length ?? 0) > 0, /* @ts-ignore */
1710
+ ...(ngDevMode ? [{ debugName: "isPdfExportEnabled" }] : /* istanbul ignore next */ []));
1711
+ isExporting = this.pdfExportService.exporting;
1349
1712
  // region Angular lifecycle hooks
1350
1713
  ngOnInit() {
1351
1714
  this.store = this.entityDescriptor().store;
@@ -1367,6 +1730,20 @@ class BaseEntityToolbarComponent {
1367
1730
  if (entityId)
1368
1731
  this.formNavigator.navigateToDetails(this.entityDescriptor().entityName, entityId);
1369
1732
  }
1733
+ async onExportPdf() {
1734
+ const dialogResult = await firstValueFrom(this.dialog.open(PdfExportOptionsDialog, { width: '360px', autoFocus: false }).afterClosed());
1735
+ if (!dialogResult)
1736
+ return; // user cancelled
1737
+ const columns = entityDescriptorToPdfColumns(this.entityDescriptor().attrDescriptors);
1738
+ const entities = this.store.entities();
1739
+ const result = await this.pdfExportService.export(entities, columns, {
1740
+ ...dialogResult,
1741
+ title: this.resolveTitle(),
1742
+ subtitle: this.translocoService.translate('base_entity.pdf_export.subtitle', { count: entities.length }),
1743
+ filename: this.entityDescriptor().entityName.toLowerCase() + '-export',
1744
+ });
1745
+ this.notifyExportResult(result);
1746
+ }
1370
1747
  onDoFilter($event) {
1371
1748
  const filterValue = $event.target.value;
1372
1749
  this.store.doFilter(filterValue);
@@ -1383,13 +1760,22 @@ class BaseEntityToolbarComponent {
1383
1760
  }
1384
1761
  // endregion
1385
1762
  // protected, private helper methods
1763
+ resolveTitle() {
1764
+ const entityTitle = this.entityDescriptor().entityTitle;
1765
+ const title = typeof entityTitle === 'function' ? entityTitle() : entityTitle;
1766
+ return title || this.entityDescriptor().entityName;
1767
+ }
1768
+ notifyExportResult(result) {
1769
+ const message = result.success ? this.translocoService.translate('base_entity.pdf_export.success', { count: result.rowCount }) : (result.error ?? this.translocoService.translate('base_entity.pdf_export.failure'));
1770
+ this.snackBar.open(message, undefined, { duration: 4000 });
1771
+ }
1386
1772
  RouteSegments = RouteSegments;
1387
1773
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: BaseEntityToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1388
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], ngImport: i0, template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <ng-container *transloco=\"let t;\">\n <div class=\"dense-3 toolbar-inputs\" [ngStyle]=\"{'padding-top': '12px' }\">\n <base-entity-query [entityDescriptor]=\"entityDescriptor()\"></base-entity-query>\n <div class=\"filter-wrapper\">\n <label class=\"field-label\" [attr.for]=\"entityDescriptor().createTestId('filter-input')\">{{ t('base_entity.toolbar.filter_label') }}</label>\n <mat-form-field subscriptSizing=\"dynamic\">\n <input #filterInput [id]=\"entityDescriptor().createTestId('filter-input')\" [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n", styles: [".toolbar-inputs{display:flex;align-items:center;gap:40px}.filter-wrapper{display:inline-flex;align-items:center;gap:8px}.field-label{font-size:14px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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: "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: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: BaseEntityQueryComponent, selector: "base-entity-query", inputs: ["entityDescriptor"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
1774
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: BaseEntityToolbarComponent, isStandalone: true, selector: "base-entity-toolbar", inputs: { entityDescriptor: { classPropertyName: "entityDescriptor", publicName: "entityDescriptor", isSignal: true, isRequired: true, transformFunction: null } }, providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], ngImport: i0, template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <ng-container *transloco=\"let t;\">\n <div class=\"dense-3 toolbar-inputs\" [ngStyle]=\"{'padding-top': '12px' }\">\n <base-entity-query [entityDescriptor]=\"entityDescriptor()\"></base-entity-query>\n <div class=\"filter-wrapper\">\n <label class=\"field-label\" [attr.for]=\"entityDescriptor().createTestId('filter-input')\">{{ t('base_entity.toolbar.filter_label') }}</label>\n <mat-form-field subscriptSizing=\"dynamic\">\n <input #filterInput [id]=\"entityDescriptor().createTestId('filter-input')\" [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n @if (isPdfExportEnabled()) {\n <button *transloco=\"let t\" [attr.data-testid]=\"entityDescriptor().createTestId('pdf-export')\" mat-menu-item [disabled]=\"isExporting()\" (click)=\"onExportPdf()\"><mat-icon>picture_as_pdf</mat-icon> {{ t('base_entity.pdf_export.button') }}</button>\n }\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n @if (isPdfExportEnabled()) {\n <button *transloco=\"let t\" [attr.data-testid]=\"entityDescriptor().createTestId('pdf-export')\" mat-button [disabled]=\"isExporting()\" [matTooltip]=\"t('base_entity.pdf_export.tooltip')\" (click)=\"onExportPdf()\"><mat-icon>picture_as_pdf</mat-icon> {{ t('base_entity.pdf_export.button') }}</button>\n }\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n", styles: [".toolbar-inputs{display:flex;align-items:center;gap:40px}.filter-wrapper{display:inline-flex;align-items:center;gap:8px}.field-label{font-size:14px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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: "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: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: BaseEntityQueryComponent, selector: "base-entity-query", inputs: ["entityDescriptor"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }] });
1389
1775
  }
1390
1776
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: BaseEntityToolbarComponent, decorators: [{
1391
1777
  type: Component,
1392
- args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbarModule, MatIcon, MatFormField, MatInput, MatButton, MatIconButton, MatSuffix, MatMenu, MatMenuItem, MatMenuTrigger, BaseEntityQueryComponent, TranslocoDirective], providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <ng-container *transloco=\"let t;\">\n <div class=\"dense-3 toolbar-inputs\" [ngStyle]=\"{'padding-top': '12px' }\">\n <base-entity-query [entityDescriptor]=\"entityDescriptor()\"></base-entity-query>\n <div class=\"filter-wrapper\">\n <label class=\"field-label\" [attr.for]=\"entityDescriptor().createTestId('filter-input')\">{{ t('base_entity.toolbar.filter_label') }}</label>\n <mat-form-field subscriptSizing=\"dynamic\">\n <input #filterInput [id]=\"entityDescriptor().createTestId('filter-input')\" [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n", styles: [".toolbar-inputs{display:flex;align-items:center;gap:40px}.filter-wrapper{display:inline-flex;align-items:center;gap:8px}.field-label{font-size:14px;white-space:nowrap}\n"] }]
1778
+ args: [{ selector: 'base-entity-toolbar', standalone: true, imports: [CommonModule, MatToolbarModule, MatIcon, MatFormField, MatInput, MatButton, MatIconButton, MatSuffix, MatMenu, MatMenuItem, MatMenuTrigger, MatTooltip, BaseEntityQueryComponent, TranslocoDirective], providers: [provideTranslocoScope({ scope: 'base_entity', alias: 'base_entity' })], template: "<mat-toolbar *ngIf=\"formNavigator.activeRouteSegment() === RouteSegments.LIST_ROUTE\">\n <ng-container *transloco=\"let t;\">\n <div class=\"dense-3 toolbar-inputs\" [ngStyle]=\"{'padding-top': '12px' }\">\n <base-entity-query [entityDescriptor]=\"entityDescriptor()\"></base-entity-query>\n <div class=\"filter-wrapper\">\n <label class=\"field-label\" [attr.for]=\"entityDescriptor().createTestId('filter-input')\">{{ t('base_entity.toolbar.filter_label') }}</label>\n <mat-form-field subscriptSizing=\"dynamic\">\n <input #filterInput [id]=\"entityDescriptor().createTestId('filter-input')\" [attr.data-testid]=\"entityDescriptor().createTestId('filter')\" matInput type=\"text\" (keyup)=\"onDoFilter( $event )\">\n @if (filterInput.value) {\n <button [attr.data-testid]=\"entityDescriptor().createTestId('filter-clear')\" type=\"button\" mat-icon-button matSuffix aria-label=\"Clear filter\" (click)=\"onClearFilter(filterInput)\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n <span class=\"toolbar-spacer\"></span>\n @if(isSmallDevice()) {\n <div [ngClass]=\"layoutService.layoutClass()\">\n <button test-id=\"menu-button\" mat-button [matMenuTriggerFor]=\"beforeMenu\"><mat-icon>menu</mat-icon> Choose action</button>\n <mat-menu #beforeMenu=\"matMenu\" xPosition=\"before\">\n @if (isPdfExportEnabled()) {\n <button *transloco=\"let t\" [attr.data-testid]=\"entityDescriptor().createTestId('pdf-export')\" mat-menu-item [disabled]=\"isExporting()\" (click)=\"onExportPdf()\"><mat-icon>picture_as_pdf</mat-icon> {{ t('base_entity.pdf_export.button') }}</button>\n }\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-menu-item [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-menu-item [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-menu-item [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </mat-menu>\n </div>\n } @else {\n <div [ngClass]=\"layoutService.layoutClass()\">\n @if (isPdfExportEnabled()) {\n <button *transloco=\"let t\" [attr.data-testid]=\"entityDescriptor().createTestId('pdf-export')\" mat-button [disabled]=\"isExporting()\" [matTooltip]=\"t('base_entity.pdf_export.tooltip')\" (click)=\"onExportPdf()\"><mat-icon>picture_as_pdf</mat-icon> {{ t('base_entity.pdf_export.button') }}</button>\n }\n <button [attr.data-testid]=\"entityDescriptor().createTestId('edit')\" mat-button [disabled]=\"!isEditEnabled()\" (click)=\"onEditEntity()\"><mat-icon>edit</mat-icon> Edit</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('new')\" mat-button [disabled]=\"!isNewEnabled()\" (click)=\"onAddEntity()\"><mat-icon>add</mat-icon> New</button>\n <button [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-button [disabled]=\"!isDeleteEnabled()\" (click)=\"onDeleteEntities()\"><mat-icon>delete</mat-icon> Delete</button>\n </div>\n }\n</mat-toolbar>\n", styles: [".toolbar-inputs{display:flex;align-items:center;gap:40px}.filter-wrapper{display:inline-flex;align-items:center;gap:8px}.field-label{font-size:14px;white-space:nowrap}\n"] }]
1393
1779
  }], propDecorators: { entityDescriptor: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityDescriptor", required: true }] }] } });
1394
1780
 
1395
1781
  const INITIAL_STATE = {
@@ -3474,6 +3860,10 @@ class BaseEntityFormComponent {
3474
3860
  ...(ngDevMode ? [{ debugName: "violations" }] : /* istanbul ignore next */ []));
3475
3861
  hasErrorViolations = computed(() => this.violations().some((v) => v.severity === 'ERROR'), /* @ts-ignore */
3476
3862
  ...(ngDevMode ? [{ debugName: "hasErrorViolations" }] : /* istanbul ignore next */ []));
3863
+ // Reactive Save-button state: recomputes on any form value/status/pristine change so it also refreshes under
3864
+ // zoneless change detection, where a bare `baseEntityForm.dirty` binding stays stale after signal-less mutations
3865
+ // (e.g. the components-list navigator flow that only calls setValue()/markAsDirty()).
3866
+ saveDisabled;
3477
3867
  entityFormBuilder = inject((BaseEntityFormBuilder));
3478
3868
  formBuilder = inject(FormBuilder);
3479
3869
  formNavigator = inject(BaseFormNavigatorSingletonStore);
@@ -3485,13 +3875,19 @@ class BaseEntityFormComponent {
3485
3875
  ruleLoad$ = new Subject();
3486
3876
  ruleSubscription;
3487
3877
  constructor() {
3878
+ this.baseEntityForm = this.formBuilder.group({});
3879
+ const formEvents = toSignal(this.baseEntityForm.events, { initialValue: null });
3880
+ this.saveDisabled = computed(() => {
3881
+ formEvents(); // establishes the reactive dependency; child setValue()/markAsDirty() bubble value/status events to the parent group
3882
+ return this.baseEntityForm.invalid || !this.baseEntityForm.dirty || this.isAbstract() || this.hasErrorViolations();
3883
+ }, /* @ts-ignore */
3884
+ ...(ngDevMode ? [{ debugName: "saveDisabled" }] : /* istanbul ignore next */ []));
3488
3885
  this.registerEffects();
3489
3886
  }
3490
3887
  // region angular lifecycle hooks
3491
3888
  ngOnInit() {
3492
3889
  this.formNavigator.setEntityName(this.entityDescriptor().entityName);
3493
3890
  this.formNavigator.determineActiveRouteSegment();
3494
- this.baseEntityForm = this.formBuilder.group({});
3495
3891
  this.logger.info('BaseEntityFormComponent initialized with: ', { entityDescriptor: this.entityDescriptor() });
3496
3892
  this.loadRules();
3497
3893
  }
@@ -3600,11 +3996,11 @@ class BaseEntityFormComponent {
3600
3996
  });
3601
3997
  }
3602
3998
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: BaseEntityFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3603
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: BaseEntityFormComponent, isStandalone: true, selector: "base-form", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], viewQueries: [{ propertyName: "componentHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\" (focusout)=\"onFieldBlur()\">\n <ng-template baseFormHost></ng-template>\n </form>\n @if (violations().length > 0) {\n <ul class=\"rule-violations\" data-testid=\"rule-violations\">\n @for (violation of violations(); track violation.ruleId) {\n <li [class]=\"'rule-violation severity-' + violation.severity.toLowerCase()\">\n <mat-icon>{{ violation.severity === 'ERROR' ? 'error' : violation.severity === 'WARNING' ? 'warning' : 'info' }}</mat-icon>\n <span>{{ violation.message ?? violation.error ?? violation.ruleId }}</span>\n </li>\n }\n </ul>\n }\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject() || isAbstract()\" (click)=\"onDelete()\">Delete</button>\n @if (entityDescriptor().extraFormActionsTemplate?.(); as extraTpl) {\n <ng-container [ngTemplateOutlet]=\"extraTpl\"></ng-container>\n }\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty || isAbstract() || hasErrorViolations()\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:0;list-style:none}.base-entity-form-focus-action{display:none}.base-entity-form-field:focus-within .base-entity-form-focus-action{display:revert}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violations{list-style:none;margin:12px 0 0;padding:0}.rule-violation{display:flex;align-items:center;gap:8px;padding:6px 8px;border-left:4px solid transparent;margin-bottom:4px;font-size:14px}.rule-violation mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violation.severity-error{border-left-color:#d32f2f;background-color:#d32f2f14;color:#4a0000}.rule-violation.severity-warning{border-left-color:#f57c00;background-color:#f57c0014;color:#4a2b00}.rule-violation.severity-info{border-left-color:#1976d2;background-color:#1976d214;color:#051f47}\n"], dependencies: [{ kind: "directive", type: BaseFormHostDirective, selector: "[baseFormHost]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { 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: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3999
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: BaseEntityFormComponent, isStandalone: true, selector: "base-form", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], viewQueries: [{ propertyName: "componentHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\" (focusout)=\"onFieldBlur()\">\n <ng-template baseFormHost></ng-template>\n </form>\n @if (violations().length > 0) {\n <ul class=\"rule-violations\" data-testid=\"rule-violations\">\n @for (violation of violations(); track violation.ruleId) {\n <li [class]=\"'rule-violation severity-' + violation.severity.toLowerCase()\">\n <mat-icon>{{ violation.severity === 'ERROR' ? 'error' : violation.severity === 'WARNING' ? 'warning' : 'info' }}</mat-icon>\n <span>{{ violation.message ?? violation.error ?? violation.ruleId }}</span>\n </li>\n }\n </ul>\n }\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject() || isAbstract()\" (click)=\"onDelete()\">Delete</button>\n @if (entityDescriptor().extraFormActionsTemplate?.(); as extraTpl) {\n <ng-container [ngTemplateOutlet]=\"extraTpl\"></ng-container>\n }\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"saveDisabled()\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:0;list-style:none}.base-entity-form-focus-action{display:none}.base-entity-form-field:focus-within .base-entity-form-focus-action{display:revert}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violations{list-style:none;margin:12px 0 0;padding:0}.rule-violation{display:flex;align-items:center;gap:8px;padding:6px 8px;border-left:4px solid transparent;margin-bottom:4px;font-size:14px}.rule-violation mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violation.severity-error{border-left-color:#d32f2f;background-color:#d32f2f14;color:#4a0000}.rule-violation.severity-warning{border-left-color:#f57c00;background-color:#f57c0014;color:#4a2b00}.rule-violation.severity-info{border-left-color:#1976d2;background-color:#1976d214;color:#051f47}\n"], dependencies: [{ kind: "directive", type: BaseFormHostDirective, selector: "[baseFormHost]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { 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: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3604
4000
  }
3605
4001
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: BaseEntityFormComponent, decorators: [{
3606
4002
  type: Component,
3607
- args: [{ selector: 'base-form', standalone: true, imports: [BaseFormHostDirective, NgTemplateOutlet, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton, MatIcon], providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\" (focusout)=\"onFieldBlur()\">\n <ng-template baseFormHost></ng-template>\n </form>\n @if (violations().length > 0) {\n <ul class=\"rule-violations\" data-testid=\"rule-violations\">\n @for (violation of violations(); track violation.ruleId) {\n <li [class]=\"'rule-violation severity-' + violation.severity.toLowerCase()\">\n <mat-icon>{{ violation.severity === 'ERROR' ? 'error' : violation.severity === 'WARNING' ? 'warning' : 'info' }}</mat-icon>\n <span>{{ violation.message ?? violation.error ?? violation.ruleId }}</span>\n </li>\n }\n </ul>\n }\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject() || isAbstract()\" (click)=\"onDelete()\">Delete</button>\n @if (entityDescriptor().extraFormActionsTemplate?.(); as extraTpl) {\n <ng-container [ngTemplateOutlet]=\"extraTpl\"></ng-container>\n }\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"baseEntityForm.invalid || !baseEntityForm.dirty || isAbstract() || hasErrorViolations()\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:0;list-style:none}.base-entity-form-focus-action{display:none}.base-entity-form-field:focus-within .base-entity-form-focus-action{display:revert}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violations{list-style:none;margin:12px 0 0;padding:0}.rule-violation{display:flex;align-items:center;gap:8px;padding:6px 8px;border-left:4px solid transparent;margin-bottom:4px;font-size:14px}.rule-violation mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violation.severity-error{border-left-color:#d32f2f;background-color:#d32f2f14;color:#4a0000}.rule-violation.severity-warning{border-left-color:#f57c00;background-color:#f57c0014;color:#4a2b00}.rule-violation.severity-info{border-left-color:#1976d2;background-color:#1976d214;color:#051f47}\n"] }]
4003
+ args: [{ selector: 'base-form', standalone: true, imports: [BaseFormHostDirective, NgTemplateOutlet, ReactiveFormsModule, MatCard, MatCardContent, MatCardActions, MatButton, MatIcon], providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }], template: "<mat-card appearance=\"outlined\" class=\"dense-3\">\n <mat-card-content>\n <form [formGroup]=\"baseEntityForm\" (ngSubmit)=\"onSubmit()\" (focusout)=\"onFieldBlur()\">\n <ng-template baseFormHost></ng-template>\n </form>\n @if (violations().length > 0) {\n <ul class=\"rule-violations\" data-testid=\"rule-violations\">\n @for (violation of violations(); track violation.ruleId) {\n <li [class]=\"'rule-violation severity-' + violation.severity.toLowerCase()\">\n <mat-icon>{{ violation.severity === 'ERROR' ? 'error' : violation.severity === 'WARNING' ? 'warning' : 'info' }}</mat-icon>\n <span>{{ violation.message ?? violation.error ?? violation.ruleId }}</span>\n </li>\n }\n </ul>\n }\n </mat-card-content>\n <mat-card-actions>\n <button id=\"cancel\" [attr.data-testid]=\"entityDescriptor().createTestId('cancel')\" mat-raised-button color=\"secondary\" (click)=\"onCancel()\">Cancel</button>\n <button id=\"delete\" [attr.data-testid]=\"entityDescriptor().createTestId('delete')\" mat-raised-button color=\"primary\" type=\"button\" [disabled]=\"isNewObject() || isAbstract()\" (click)=\"onDelete()\">Delete</button>\n @if (entityDescriptor().extraFormActionsTemplate?.(); as extraTpl) {\n <ng-container [ngTemplateOutlet]=\"extraTpl\"></ng-container>\n }\n <button id=\"submit\" [attr.data-testid]=\"entityDescriptor().createTestId('save')\" mat-raised-button color=\"primary\" type=\"submit\" [disabled]=\"saveDisabled()\" (click)=\"onSubmit()\">Save</button>\n </mat-card-actions>\n</mat-card>\n", styles: [":host{display:block}.base-entity-form-field{box-sizing:border-box;min-width:0;margin:0 0 16px;padding:0 12px 8px;border:var(--mat-form-field-outlined-outline-width, 1px) solid var(--mat-form-field-outlined-outline-color, rgba(0, 0, 0, .38));border-radius:var(--mat-form-field-outlined-container-shape, 4px);color:var(--mat-form-field-outlined-input-text-color, rgba(0, 0, 0, .87));font-family:var(--mat-form-field-container-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-container-text-size, 16px);font-weight:var(--mat-form-field-container-text-weight, 400);line-height:var(--mat-form-field-container-text-line-height, 24px)}.base-entity-form-field:hover{border-color:var(--mat-form-field-outlined-hover-outline-color, rgba(0, 0, 0, .87))}.base-entity-form-field legend{padding:0 4px;color:var(--mat-form-field-outlined-label-text-color, rgba(0, 0, 0, .54));font-family:var(--mat-form-field-outlined-label-text-font, Roboto, \"Helvetica Neue\", sans-serif);font-size:var(--mat-form-field-outlined-label-text-size, 12px);font-weight:var(--mat-form-field-outlined-label-text-weight, 400);line-height:1}.base-entity-form-list{min-height:24px;margin:4px 0 0;padding-left:0;list-style:none}.base-entity-form-focus-action{display:none}.base-entity-form-field:focus-within .base-entity-form-focus-action{display:revert}.base-entity-form-delete-button{width:24px;height:24px;padding:0;margin-left:4px;line-height:24px;vertical-align:middle}.base-entity-form-delete-button mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violations{list-style:none;margin:12px 0 0;padding:0}.rule-violation{display:flex;align-items:center;gap:8px;padding:6px 8px;border-left:4px solid transparent;margin-bottom:4px;font-size:14px}.rule-violation mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}.rule-violation.severity-error{border-left-color:#d32f2f;background-color:#d32f2f14;color:#4a0000}.rule-violation.severity-warning{border-left-color:#f57c00;background-color:#f57c0014;color:#4a2b00}.rule-violation.severity-info{border-left-color:#1976d2;background-color:#1976d214;color:#051f47}\n"] }]
3608
4004
  }], ctorParameters: () => [], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }], componentHost: [{
3609
4005
  type: ViewChild,
3610
4006
  args: [BaseFormHostDirective, { static: true, read: BaseFormHostDirective }]
@@ -4305,5 +4701,5 @@ const BASE_ENTITY_ROUTES = [
4305
4701
  * Generated bundle index. Do not edit.
4306
4702
  */
4307
4703
 
4308
- 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_NAME_ROUTE_DATA_KEY, Entity, EntityRegistryComponent, EntityRouteRegistry, FlexDirection, FlexboxDescriptor, FormControlType, Id, NavigatorCommand, OrderByDirection, RULE_ENGINE, RouteSegments, RuleViolationsSingletonStore, SimpleEntityMapper, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey, provideEntityRouteRegistry };
4704
+ 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_NAME_ROUTE_DATA_KEY, Entity, EntityRegistryComponent, EntityRouteRegistry, FlexDirection, FlexboxDescriptor, FormControlType, Id, NavigatorCommand, OrderByDirection, PdfExportOptionsDialog, PdfExportService, RULE_ENGINE, RouteSegments, RuleViolationsSingletonStore, SimpleEntityMapper, entityDescriptorToPdfColumns, getEntityIds, getEntityOptions, getEnumKeyByValue, getEnumValueByKey, provideEntityRouteRegistry };
4309
4705
  //# sourceMappingURL=processpuzzle-base-entity.mjs.map