@masterteam/components 0.0.292 → 0.0.294

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/components",
3
- "version": "0.0.292",
3
+ "version": "0.0.294",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -275,6 +275,15 @@ declare class SchedulePredecessorField implements ControlValueAccessor {
275
275
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SchedulePredecessorField, "mt-schedule-predecessor-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
276
276
  }
277
277
 
278
+ /**
279
+ * Why the metadata request produced no table.
280
+ *
281
+ * - `forbidden` — `403`: the user may not read the target module in this level.
282
+ * - `unavailable` — `400` / `404`: the property is missing, not an EntityList,
283
+ * invalidly configured, or out of the supplied level's scope.
284
+ * - `failed` — anything else, i.e. an actual request failure.
285
+ */
286
+ type EntityListMetadataFailure = 'forbidden' | 'unavailable' | 'failed';
278
287
  interface EntityListColumnDef extends ColumnDef {
279
288
  key: string;
280
289
  label: string;
@@ -298,6 +307,12 @@ type EntityListAccess = 'Auto' | 'Read' | 'Write' | 'ReadWrite' | 'None';
298
307
  interface EntityListSubmitValue {
299
308
  propertyKey: string;
300
309
  rawValue: string | null;
310
+ /**
311
+ * Backend-resolved display value for `rawValue`, present only on a loaded
312
+ * value's rendered rows (a user object, an attachment list, a formatted
313
+ * percentage). It is display-only and never submitted — see `emitValue`.
314
+ */
315
+ value?: unknown;
301
316
  }
302
317
  /**
303
318
  * A pending create/update row in the stored EntityList payload.
@@ -321,12 +336,31 @@ declare class EntityListField implements ControlValueAccessor {
321
336
  readonly label: _angular_core.InputSignal<string>;
322
337
  readonly readonly: _angular_core.InputSignal<boolean>;
323
338
  readonly required: _angular_core.InputSignal<boolean>;
324
- /** EntityList property id (kept for back-compat; unused by fetch/query). */
339
+ /**
340
+ * EntityList property id. **Required** — with the owning level it addresses
341
+ * the table-metadata endpoint, which is the only source of this field's
342
+ * effective configuration.
343
+ */
325
344
  readonly propertyId: _angular_core.InputSignal<number | null>;
326
- /** Property configuration (sourceType, moduleId, access, readFields, etc). */
345
+ /**
346
+ * Stored property configuration (sourceType, moduleId, access, readFields …).
347
+ *
348
+ * Kept for hosts that still bind it, but **not read**: the stored value is
349
+ * the un-overridden one, and the backend resolves the level-module override
350
+ * before answering the metadata request. Everything this field gates on comes
351
+ * from that response.
352
+ */
327
353
  readonly configuration: _angular_core.InputSignal<Record<string, unknown> | null>;
328
354
  /** Runtime ids needed to call the read endpoint. */
329
355
  readonly runtimeContext: _angular_core.InputSignal<EntityListFieldRuntimeContext | null>;
356
+ /**
357
+ * The bound value is an unapplied process submission — an Approval step's
358
+ * frozen create/update/delete operations — rather than a persisted record
359
+ * value. Its `rows[]` and `deletedIds` are pending intent the approver has
360
+ * to see staged over the loaded records, not markers of writes the backend
361
+ * already applied. See `.github/instructions/properties/EntityList.md`.
362
+ */
363
+ readonly pendingSubmission: _angular_core.InputSignal<boolean>;
330
364
  /**
331
365
  * Full lookup catalog of the host form, forwarded to the add/edit dialog's
332
366
  * nested form. `process-form-load` returns only the lookup *id* per field,
@@ -336,6 +370,9 @@ declare class EntityListField implements ControlValueAccessor {
336
370
  /** Optional HttpContext (kept for back-compat). */
337
371
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
338
372
  private readonly storedValue;
373
+ /** Runtime-scoped metadata; null until the endpoint answers. */
374
+ private readonly metadata;
375
+ protected readonly metadataFailure: _angular_core.WritableSignal<EntityListMetadataFailure | null>;
339
376
  protected readonly columns: _angular_core.WritableSignal<EntityListColumnDef[]>;
340
377
  /** Rows loaded from the backend (existing target records). */
341
378
  protected readonly rows: _angular_core.WritableSignal<EntityListRow[]>;
@@ -346,10 +383,31 @@ declare class EntityListField implements ControlValueAccessor {
346
383
  ngControl: NgControl | null;
347
384
  protected readonly levelId: _angular_core.Signal<string | number | null>;
348
385
  protected readonly levelDataId: _angular_core.Signal<string | number | null>;
349
- protected readonly moduleId: _angular_core.Signal<string | number | null>;
386
+ /** EntityList property id as a number; `0` when the host bound none. */
387
+ protected readonly propertyKeyId: _angular_core.Signal<number>;
388
+ /** Target module id, as resolved for this level. */
389
+ protected readonly moduleId: _angular_core.Signal<number | null>;
390
+ /** Canonical readable target keys — the columns this field renders. */
350
391
  protected readonly readFields: _angular_core.Signal<string[]>;
351
- /** Normalized `access` from the property configuration. */
392
+ /**
393
+ * Keys the row projection asks for: readable **and** writable.
394
+ *
395
+ * A writable key that is not readable has no column, but the edit dialog
396
+ * still renders it — and several are `isRequired` on the target module (the
397
+ * schedule module's `task_planned_finish` is). Projecting only `readFields`
398
+ * left those controls empty, so the form was invalid until the user retyped a
399
+ * value that already existed, and a different value silently overwrote the
400
+ * stored one. Read order first, so the request body stays stable.
401
+ */
402
+ protected readonly projectedKeys: _angular_core.Signal<string[]>;
403
+ /** Effective `access` for this level, as resolved by the backend. */
352
404
  protected readonly accessMode: _angular_core.Signal<EntityListAccess>;
405
+ /**
406
+ * The table is backed by target module records. Inline lists resolve their
407
+ * rows from the stored value and have no module form to write through, so
408
+ * this field does not render them.
409
+ */
410
+ protected readonly moduleBacked: _angular_core.Signal<boolean>;
353
411
  protected readonly canRead: _angular_core.Signal<boolean>;
354
412
  /**
355
413
  * Whether the field has rows it may display. Write-only access cannot read
@@ -361,6 +419,12 @@ declare class EntityListField implements ControlValueAccessor {
361
419
  private readonly writeAllowed;
362
420
  /** Write UI is rendered only when access allows it and the field is editable. */
363
421
  protected readonly canWrite: _angular_core.Signal<boolean>;
422
+ /**
423
+ * Canonical writable target keys. They are what the add/edit dialog renders
424
+ * and what a submitted row is restricted to — canonical, so a configuration
425
+ * that listed `normalizedKey` aliases still matches the target module's form
426
+ * value keys.
427
+ */
364
428
  protected readonly writeFields: _angular_core.Signal<string[]>;
365
429
  /**
366
430
  * Pending create/update rows, in the exact shape persisted by the backend
@@ -368,7 +432,16 @@ declare class EntityListField implements ControlValueAccessor {
368
432
  * partial updates of existing records; `entityId = 0` rows are creates.
369
433
  */
370
434
  private readonly pendingRows;
371
- /** Existing entity ids the user removed (submitted as `deletedIds`). */
435
+ /** Existing entity ids the user removed in this session. */
436
+ private readonly stagedDeletedIds;
437
+ /** `deletedIds` carried by the loaded value, before they mean anything. */
438
+ private readonly loadedDeletedIds;
439
+ /**
440
+ * Delete intents that apply to the table right now. On a persisted value the
441
+ * loaded `deletedIds` are historical operation markers — the records are
442
+ * already gone — so only this session's removals count. On an unapplied
443
+ * submission they are deletes awaiting approval and must be staged too.
444
+ */
372
445
  private readonly deletedIds;
373
446
  /** rowId → original form values / option labels (view state only). */
374
447
  private readonly rowDrafts;
@@ -382,16 +455,33 @@ declare class EntityListField implements ControlValueAccessor {
382
455
  /** Pending edits of existing rows, keyed by entity id. */
383
456
  private readonly editedRowsByEntityId;
384
457
  /**
385
- * Rows rendered in the table. In editable write modes, and in a read-only
386
- * Write-only preview, existing rows are merged with pending edits, removed
387
- * rows are hidden, and locally created rows are appended.
458
+ * Whether the table stages pending operations over the loaded records.
459
+ *
460
+ * Editable write modes stage the user's own edits, and a read-only
461
+ * Write-only field has nothing but its stored rows to show. A pending
462
+ * submission stages them too even though it is read-only and `ReadWrite`:
463
+ * an approver reviewing a request has to see what it *will* do to the target
464
+ * module, not the records as they stand.
465
+ */
466
+ private readonly showsPendingOperations;
467
+ /**
468
+ * Rows rendered in the table: existing rows merged with pending edits,
469
+ * removed rows hidden, and created rows appended.
388
470
  */
389
471
  protected readonly displayRows: _angular_core.Signal<EntityListRow[]>;
390
472
  protected readonly hasRows: _angular_core.Signal<boolean>;
473
+ /** Enough context to ask the backend what this field should render. */
391
474
  protected readonly hasRequiredContext: _angular_core.Signal<boolean>;
475
+ /**
476
+ * The non-error state the field renders instead of a table, as a translation
477
+ * key. Null while the metadata request is still in flight, so the template
478
+ * falls through to the skeleton.
479
+ */
480
+ protected readonly noticeKey: _angular_core.Signal<string | null>;
392
481
  protected onTouched: () => void;
393
482
  protected onModelChange: (value: EntityListStoredValue | null) => void;
394
483
  private readonly http;
484
+ private metadataSubscription?;
395
485
  private fetchSubscription?;
396
486
  private readonly destroyRef;
397
487
  private readonly modal;
@@ -446,7 +536,23 @@ declare class EntityListField implements ControlValueAccessor {
446
536
  private setRowDraft;
447
537
  private clearRowDraft;
448
538
  private buildRow;
449
- /** Render one table cell from a raw form value and its resolved label. */
539
+ /**
540
+ * Render one table cell from a raw form value and its resolved label.
541
+ *
542
+ * The cell has to arrive in the shape the backend would have sent, because
543
+ * that is what the entity renderers bind. Two things a control value is not:
544
+ *
545
+ * - **A scalar `value` is a string.** `mt-entity-percentage` reads `d.value`
546
+ * only when `typeof` it is `'string'` and prints its placeholder otherwise,
547
+ * so a numeric control value rendered as a filled bar with no number beside
548
+ * it. Objects and arrays are the resolved shapes the rich renderers want,
549
+ * and pass through untouched.
550
+ * - **The column configuration has to travel with it.** Colour rules live
551
+ * there, and `mt-entity-percentage` falls back to evaluating them itself
552
+ * exactly when no per-value colour was resolved — which is every locally
553
+ * added row. Without it a new 45% row rendered in the default colour while
554
+ * the same value loaded from the backend rendered in its band colour.
555
+ */
450
556
  private buildCell;
451
557
  /**
452
558
  * Shape a raw form value into the value an entity renderer expects for the
@@ -472,6 +578,15 @@ declare class EntityListField implements ControlValueAccessor {
472
578
  /** Backend `rawValue` is a serialized scalar; objects/arrays go as JSON. */
473
579
  private toRawValue;
474
580
  private toValueMap;
581
+ /**
582
+ * Backend-resolved display values of a loaded row, keyed like `toValueMap`.
583
+ *
584
+ * A row the user just added carries its labels in a `rowDrafts` entry, but a
585
+ * row that arrived on a loaded value has none — only what the backend
586
+ * rendered beside each `rawValue`. Without this the approver's table prints
587
+ * the stored scalar: a bare GUID where the assignee belongs.
588
+ */
589
+ private toDisplayMap;
475
590
  private dropEmptyValues;
476
591
  /**
477
592
  * Keys the user actually changed. A key that was empty before and is still
@@ -487,19 +602,51 @@ declare class EntityListField implements ControlValueAccessor {
487
602
  private diffValues;
488
603
  private isEmptyValue;
489
604
  private isSameValue;
490
- private fetchDraftColumns;
491
605
  /**
492
- * Project a Create form into the catalog shape the column builder expects.
493
- * Sections and their fields are flattened into reading order and renumbered
494
- * from there — a field's own `order` is section-relative, so carrying it over
495
- * as the column order interleaves the sections once `applyResponse` sorts.
606
+ * Load the runtime-scoped table description, then its rows.
607
+ *
608
+ * The metadata endpoint is the authorization boundary for this field: it
609
+ * answers `403` when the user may not read the target module in this level,
610
+ * so the columns are never built from a source that skipped that check.
611
+ */
612
+ private loadTable;
613
+ /**
614
+ * Apply the metadata, then fetch rows when there is a persisted parent to
615
+ * scope them to. A draft parent (no `levelDataId`) and a write-only field
616
+ * both stop at the columns — the first has no records yet, the second may
617
+ * not read them.
618
+ */
619
+ private applyMetadata;
620
+ /**
621
+ * Table columns, in the order the backend returned them.
622
+ *
623
+ * `projectionMeta.columns[].key` is the catalog property key here — the same
624
+ * key `fetch/query` keys its record values by — so a column maps onto a row
625
+ * value directly. The lookup still falls back to `normalizedKey` so a column
626
+ * fed from any other projection keeps resolving.
627
+ *
628
+ * The columns are the *union* of readable and writable fields, so a
629
+ * write-only key arrives as a column too — a `Planned Finish` the user may
630
+ * set in the dialog but may not read. It is not projected into the rows and
631
+ * would render as an empty column, so only readable keys become columns.
632
+ * Write-only access is the exception: its readable set is empty by
633
+ * definition, and its stored rows have nothing else to render through.
496
634
  */
497
- private mapProcessFormProperties;
635
+ private buildColumns;
636
+ /** Catalog properties of the loaded metadata, keyed by property key. */
637
+ private readonly propertyByKey;
498
638
  private fetchRows;
499
- private applyResponse;
639
+ /**
640
+ * Project fetched records onto the metadata columns.
641
+ *
642
+ * Cells are built per rendered column, but the row's value maps cover every
643
+ * **projected** key — a writable key without a column has no cell to render
644
+ * and still has to reach the edit dialog and the update diff.
645
+ */
646
+ private applyRecords;
500
647
  private toEntityData;
501
648
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
502
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListField, "mt-entity-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
649
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityListField, "mt-entity-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyId": { "alias": "propertyId"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "pendingSubmission": { "alias": "pendingSubmission"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
503
650
  }
504
651
 
505
652
  /** Inputs the EntityList add-row dialog will receive via ModalService inputValues. */
@@ -1460,7 +1460,7 @@ declare class EntityPreview {
1460
1460
  * `mt-entity-preview` usages in the app.
1461
1461
  */
1462
1462
  readonly infoText: _angular_core.Signal<string>;
1463
- readonly comparisonKind: _angular_core.Signal<"Value" | "EntityList" | null>;
1463
+ readonly comparisonKind: _angular_core.Signal<"EntityList" | "Value" | null>;
1464
1464
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityPreview, never>;
1465
1465
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<EntityPreview, "mt-entity-preview", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "attachmentShape": { "alias": "attachmentShape"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1466
1466
  }
@@ -742,12 +742,20 @@ declare class EntityListFieldConfig extends BaseFieldConfig {
742
742
  */
743
743
  lookups: unknown[];
744
744
  context: HttpContext | undefined;
745
+ /**
746
+ * The bound value is an unapplied process submission — an Approval step's
747
+ * frozen create/update/delete operations — rather than a persisted record
748
+ * value. Its `rows[]` and `deletedIds` are pending intent to overlay on the
749
+ * loaded records, not markers of writes the backend already applied.
750
+ */
751
+ pendingSubmission: boolean;
745
752
  constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
746
753
  propertyId?: number | null;
747
754
  configuration?: any;
748
755
  runtimeContext?: EntityListFieldRuntimeContext | null;
749
756
  lookups?: unknown[];
750
757
  context?: HttpContext | undefined;
758
+ pendingSubmission?: boolean;
751
759
  });
752
760
  }
753
761
  interface ScheduleItemSelectorFieldRuntimeContext {