@masterteam/components 0.0.293 → 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.293",
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;
@@ -327,9 +336,20 @@ declare class EntityListField implements ControlValueAccessor {
327
336
  readonly label: _angular_core.InputSignal<string>;
328
337
  readonly readonly: _angular_core.InputSignal<boolean>;
329
338
  readonly required: _angular_core.InputSignal<boolean>;
330
- /** 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
+ */
331
344
  readonly propertyId: _angular_core.InputSignal<number | null>;
332
- /** 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
+ */
333
353
  readonly configuration: _angular_core.InputSignal<Record<string, unknown> | null>;
334
354
  /** Runtime ids needed to call the read endpoint. */
335
355
  readonly runtimeContext: _angular_core.InputSignal<EntityListFieldRuntimeContext | null>;
@@ -350,6 +370,9 @@ declare class EntityListField implements ControlValueAccessor {
350
370
  /** Optional HttpContext (kept for back-compat). */
351
371
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
352
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>;
353
376
  protected readonly columns: _angular_core.WritableSignal<EntityListColumnDef[]>;
354
377
  /** Rows loaded from the backend (existing target records). */
355
378
  protected readonly rows: _angular_core.WritableSignal<EntityListRow[]>;
@@ -360,10 +383,31 @@ declare class EntityListField implements ControlValueAccessor {
360
383
  ngControl: NgControl | null;
361
384
  protected readonly levelId: _angular_core.Signal<string | number | null>;
362
385
  protected readonly levelDataId: _angular_core.Signal<string | number | null>;
363
- 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. */
364
391
  protected readonly readFields: _angular_core.Signal<string[]>;
365
- /** 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. */
366
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>;
367
411
  protected readonly canRead: _angular_core.Signal<boolean>;
368
412
  /**
369
413
  * Whether the field has rows it may display. Write-only access cannot read
@@ -375,6 +419,12 @@ declare class EntityListField implements ControlValueAccessor {
375
419
  private readonly writeAllowed;
376
420
  /** Write UI is rendered only when access allows it and the field is editable. */
377
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
+ */
378
428
  protected readonly writeFields: _angular_core.Signal<string[]>;
379
429
  /**
380
430
  * Pending create/update rows, in the exact shape persisted by the backend
@@ -420,10 +470,18 @@ declare class EntityListField implements ControlValueAccessor {
420
470
  */
421
471
  protected readonly displayRows: _angular_core.Signal<EntityListRow[]>;
422
472
  protected readonly hasRows: _angular_core.Signal<boolean>;
473
+ /** Enough context to ask the backend what this field should render. */
423
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>;
424
481
  protected onTouched: () => void;
425
482
  protected onModelChange: (value: EntityListStoredValue | null) => void;
426
483
  private readonly http;
484
+ private metadataSubscription?;
427
485
  private fetchSubscription?;
428
486
  private readonly destroyRef;
429
487
  private readonly modal;
@@ -478,7 +536,23 @@ declare class EntityListField implements ControlValueAccessor {
478
536
  private setRowDraft;
479
537
  private clearRowDraft;
480
538
  private buildRow;
481
- /** 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
+ */
482
556
  private buildCell;
483
557
  /**
484
558
  * Shape a raw form value into the value an entity renderer expects for the
@@ -528,16 +602,48 @@ declare class EntityListField implements ControlValueAccessor {
528
602
  private diffValues;
529
603
  private isEmptyValue;
530
604
  private isSameValue;
531
- private fetchDraftColumns;
532
605
  /**
533
- * Project a Create form into the catalog shape the column builder expects.
534
- * Sections and their fields are flattened into reading order and renumbered
535
- * from there — a field's own `order` is section-relative, so carrying it over
536
- * 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.
537
618
  */
538
- private mapProcessFormProperties;
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.
634
+ */
635
+ private buildColumns;
636
+ /** Catalog properties of the loaded metadata, keyed by property key. */
637
+ private readonly propertyByKey;
539
638
  private fetchRows;
540
- 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;
541
647
  private toEntityData;
542
648
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
543
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>;
@@ -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
  }