@masterteam/components 0.0.291 → 0.0.293

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.291",
3
+ "version": "0.0.293",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -298,6 +298,12 @@ type EntityListAccess = 'Auto' | 'Read' | 'Write' | 'ReadWrite' | 'None';
298
298
  interface EntityListSubmitValue {
299
299
  propertyKey: string;
300
300
  rawValue: string | null;
301
+ /**
302
+ * Backend-resolved display value for `rawValue`, present only on a loaded
303
+ * value's rendered rows (a user object, an attachment list, a formatted
304
+ * percentage). It is display-only and never submitted — see `emitValue`.
305
+ */
306
+ value?: unknown;
301
307
  }
302
308
  /**
303
309
  * A pending create/update row in the stored EntityList payload.
@@ -327,6 +333,14 @@ declare class EntityListField implements ControlValueAccessor {
327
333
  readonly configuration: _angular_core.InputSignal<Record<string, unknown> | null>;
328
334
  /** Runtime ids needed to call the read endpoint. */
329
335
  readonly runtimeContext: _angular_core.InputSignal<EntityListFieldRuntimeContext | null>;
336
+ /**
337
+ * The bound value is an unapplied process submission — an Approval step's
338
+ * frozen create/update/delete operations — rather than a persisted record
339
+ * value. Its `rows[]` and `deletedIds` are pending intent the approver has
340
+ * to see staged over the loaded records, not markers of writes the backend
341
+ * already applied. See `.github/instructions/properties/EntityList.md`.
342
+ */
343
+ readonly pendingSubmission: _angular_core.InputSignal<boolean>;
330
344
  /**
331
345
  * Full lookup catalog of the host form, forwarded to the add/edit dialog's
332
346
  * nested form. `process-form-load` returns only the lookup *id* per field,
@@ -368,7 +382,16 @@ declare class EntityListField implements ControlValueAccessor {
368
382
  * partial updates of existing records; `entityId = 0` rows are creates.
369
383
  */
370
384
  private readonly pendingRows;
371
- /** Existing entity ids the user removed (submitted as `deletedIds`). */
385
+ /** Existing entity ids the user removed in this session. */
386
+ private readonly stagedDeletedIds;
387
+ /** `deletedIds` carried by the loaded value, before they mean anything. */
388
+ private readonly loadedDeletedIds;
389
+ /**
390
+ * Delete intents that apply to the table right now. On a persisted value the
391
+ * loaded `deletedIds` are historical operation markers — the records are
392
+ * already gone — so only this session's removals count. On an unapplied
393
+ * submission they are deletes awaiting approval and must be staged too.
394
+ */
372
395
  private readonly deletedIds;
373
396
  /** rowId → original form values / option labels (view state only). */
374
397
  private readonly rowDrafts;
@@ -382,9 +405,18 @@ declare class EntityListField implements ControlValueAccessor {
382
405
  /** Pending edits of existing rows, keyed by entity id. */
383
406
  private readonly editedRowsByEntityId;
384
407
  /**
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.
408
+ * Whether the table stages pending operations over the loaded records.
409
+ *
410
+ * Editable write modes stage the user's own edits, and a read-only
411
+ * Write-only field has nothing but its stored rows to show. A pending
412
+ * submission stages them too even though it is read-only and `ReadWrite`:
413
+ * an approver reviewing a request has to see what it *will* do to the target
414
+ * module, not the records as they stand.
415
+ */
416
+ private readonly showsPendingOperations;
417
+ /**
418
+ * Rows rendered in the table: existing rows merged with pending edits,
419
+ * removed rows hidden, and created rows appended.
388
420
  */
389
421
  protected readonly displayRows: _angular_core.Signal<EntityListRow[]>;
390
422
  protected readonly hasRows: _angular_core.Signal<boolean>;
@@ -457,16 +489,41 @@ declare class EntityListField implements ControlValueAccessor {
457
489
  */
458
490
  private toLocalEntityValue;
459
491
  private emitValue;
460
- /** `values[]` entries, restricted to `writeFields` when configured. */
492
+ /**
493
+ * `values[]` entries, restricted to `writeFields` when configured.
494
+ *
495
+ * `submitShaped` carries the dialog-normalized counterpart of `values`,
496
+ * keyed the same way, and is preferred per key. The control value a rich
497
+ * field holds is not the scalar the backend stores — a user picker holds
498
+ * the whole search result, a date picker a `Date` — and only the dialog
499
+ * knows the target module's view types, so it does that reduction. Without
500
+ * it we would stringify the control value as-is and the row would carry a
501
+ * JSON user object where a bare id belongs.
502
+ */
461
503
  private toSubmitValues;
462
504
  /** Backend `rawValue` is a serialized scalar; objects/arrays go as JSON. */
463
505
  private toRawValue;
464
506
  private toValueMap;
507
+ /**
508
+ * Backend-resolved display values of a loaded row, keyed like `toValueMap`.
509
+ *
510
+ * A row the user just added carries its labels in a `rowDrafts` entry, but a
511
+ * row that arrived on a loaded value has none — only what the backend
512
+ * rendered beside each `rawValue`. Without this the approver's table prints
513
+ * the stored scalar: a bare GUID where the assignee belongs.
514
+ */
515
+ private toDisplayMap;
465
516
  private dropEmptyValues;
466
517
  /**
467
518
  * Keys the user actually changed. A key that was empty before and is still
468
519
  * empty is skipped (the dialog simply could not pre-fill it); a key that had
469
520
  * a value and is now empty is kept so the backend clears it.
521
+ *
522
+ * `initial` holds stored scalars (a `User` column pre-fills as a bare id)
523
+ * while `next` holds control values (the whole picker result), so the two
524
+ * are only comparable once reduced — hence comparing `submitShaped`.
525
+ * Comparing the rich value directly marked every rich-valued column as
526
+ * changed even when untouched, and the partial update then rewrote it.
470
527
  */
471
528
  private diffValues;
472
529
  private isEmptyValue;
@@ -483,7 +540,7 @@ declare class EntityListField implements ControlValueAccessor {
483
540
  private applyResponse;
484
541
  private toEntityData;
485
542
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EntityListField, never>;
486
- 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>;
543
+ 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>;
487
544
  }
488
545
 
489
546
  /** Inputs the EntityList add-row dialog will receive via ModalService inputValues. */
@@ -547,6 +547,22 @@ interface EntityData {
547
547
  normalizedKey?: string;
548
548
  name?: string;
549
549
  rawValue?: string;
550
+ /**
551
+ * The colour the backend resolved for *this value*, from the value cell's own
552
+ * `color` field.
553
+ *
554
+ * Distinct from `configuration.color`, which is a colour the configuration
555
+ * declares for every value alike. This one is per-record: the backend
556
+ * evaluates a Percentage property's colour rules — or, in `property` mode,
557
+ * the record's colour-bearing source property — and ships the winner here.
558
+ * It is therefore the most specific answer available and outranks anything
559
+ * derived from the configuration.
560
+ *
561
+ * Status and Lookup cells repeat the same colour inside `value`, which is
562
+ * where those renderers already read it; a Percentage's `value` is a
563
+ * formatted string with nowhere to hang a colour, which is why this exists.
564
+ */
565
+ color?: string;
550
566
  order?: number;
551
567
  propertyConfiguration?: EntityPropertyConfiguration;
552
568
  /**
@@ -580,6 +596,19 @@ declare function isValueMissing(value: unknown): boolean;
580
596
  * `String()` so dates/percentages/checkboxes are not wrapped in quotes.
581
597
  */
582
598
  declare function serializeEntityRawValue(raw: unknown): string | undefined;
599
+ /**
600
+ * Reads the colour the backend resolved for a value cell.
601
+ *
602
+ * The cell carries it as a sibling of `raw`/`value` — `{ raw: "22", value:
603
+ * "22%", color: "#FF0000" }` — because for a Percentage the value is a
604
+ * formatted string with nowhere to hang a colour on. Status and Lookup cells
605
+ * repeat it inside `value`, where those renderers already read it.
606
+ *
607
+ * Typed as `unknown` on purpose: every fetch-cell interface in the consuming
608
+ * packages carries an index signature, so a mistyped or absent `color` is a
609
+ * runtime possibility rather than a compile error.
610
+ */
611
+ declare function readEntityValueColor(color: unknown): string | undefined;
583
612
  declare function displayOrPlaceholder(value: unknown): string;
584
613
  /**
585
614
  * Text/LongText values are a plain string, except for translatable
@@ -780,21 +809,18 @@ declare class EntityPercentage {
780
809
  readonly maxValue: _angular_core.Signal<number>;
781
810
  readonly hideName: _angular_core.Signal<boolean>;
782
811
  /**
783
- * The bar colour. The backend evaluates the property's configuration and
812
+ * The bar colour. The backend evaluates the property's colour rules and
784
813
  * returns the winner as `color` on render/value/fetch responses, so a
785
- * resolved colour always wins — the configuration is only evaluated here for
786
- * ones that arrive without it (a catalog read, or the property-form preview).
814
+ * resolved colour always wins — the rules are only evaluated here for
815
+ * configurations that arrive without one (a catalog read, or the
816
+ * property-form preview).
787
817
  *
788
- * A configuration that takes its colour from another property has no
789
- * client-side answer at all: this component is given one entity and cannot
790
- * see the Status or Lookup sitting next to it. Its fallback is the declared
791
- * `defaultColor`, and the rules are skipped entirely.
792
- *
793
- * Dynamic-ness is decided once, across *both* configurations, before either
794
- * is evaluated. Deciding it per-configuration would let a `colorRules` copy
795
- * left on the instance config paint a band colour for a property whose own
796
- * configuration replaced those rules — the one outcome this mode exists to
797
- * prevent.
818
+ * The value's own `color` is checked first and is not the same thing as
819
+ * `configuration.color`: it is resolved per record, so it is the only one
820
+ * that can carry a band colour for *this* value, or the colour a
821
+ * `colorSource: 'property'` configuration took from a sibling property on
822
+ * this record. A configuration-level colour applies to every value alike and
823
+ * cannot answer either question.
798
824
  */
799
825
  readonly progressColor: _angular_core.Signal<string>;
800
826
  /**
@@ -1351,13 +1377,10 @@ declare function currencyUnitOf(formatted: string): string;
1351
1377
  declare function compactCurrencyDisplay(formatted: string, rawValue: string | null | undefined, locale: string, threshold?: number): string;
1352
1378
 
1353
1379
  /**
1354
- * Anything that can supply a percentage colour: a mode, the ordered rule set
1355
- * that mode may consult, the colour-bearing property it may point at instead,
1356
- * and the fallback used when neither produces one.
1380
+ * Anything that can supply a percentage colour: an ordered rule set plus the
1381
+ * fallback used when no rule matches.
1357
1382
  */
1358
1383
  interface PercentageColorSource {
1359
- colorSource?: PercentageColorMode | null;
1360
- colorProperty?: PercentageColorPropertyRef | null;
1361
1384
  colorRules?: PercentageColorRule[] | null;
1362
1385
  defaultColor?: string | null;
1363
1386
  }
@@ -1368,37 +1391,14 @@ interface PercentageColorSource {
1368
1391
  */
1369
1392
  declare function matchesPercentageColorRule(value: number, rule?: PercentageColorRule | null): boolean;
1370
1393
  /**
1371
- * Whether the configuration takes its colour from another property rather than
1372
- * from the percentage value. A mode of `property` with no usable reference is
1373
- * not dynamic — a half-authored configuration must keep behaving like the
1374
- * value-based one rather than losing its colour entirely.
1375
- */
1376
- declare function isDynamicPercentageColorSource(source?: PercentageColorSource | null): boolean;
1377
- /**
1378
- * The colour-bearing property the configuration points at, or `null` when it
1379
- * is value-based.
1380
- *
1381
- * The mode is also inferred from a present reference, not only from
1382
- * `colorSource`: the reference is the part that carries meaning, and a stored
1383
- * configuration that kept it while losing the discriminator must still resolve
1384
- * dynamically instead of silently repainting itself from the rules.
1385
- */
1386
- declare function resolvePercentageColorPropertyRef(source?: PercentageColorSource | null): PercentageColorPropertyRef | null;
1387
- /**
1388
- * The colour for a percentage value.
1389
- *
1390
- * In `rules` mode: the rules in their configured order, first match wins,
1391
- * `defaultColor` when nothing matches. In `property` mode the value decides
1392
- * nothing, and there is nothing here to decide it with — the colour belongs to
1393
- * another property on the same record, which only the backend can read — so the
1394
- * answer is `defaultColor`. The rules are never consulted in that mode: they
1395
- * would paint a value-based colour that the author deliberately replaced.
1394
+ * The colour for a percentage value: rules in their configured order, first
1395
+ * match wins, `defaultColor` when nothing matches.
1396
1396
  *
1397
1397
  * The backend owns this evaluation and ships the winner as `color` on
1398
1398
  * render/value/fetch responses, so callers must prefer that resolved colour.
1399
- * This exists for the surfaces that hold a raw configuration and no resolved
1400
- * colour — the property-form preview, and catalog reads that never went through
1401
- * a value response.
1399
+ * This exists for the surfaces that hold a raw rule set and no resolved colour
1400
+ * — the property-form preview, and catalog reads that never went through a
1401
+ * value response.
1402
1402
  */
1403
1403
  declare function resolvePercentageColor(value: unknown, source?: PercentageColorSource | null): string | null;
1404
1404
 
@@ -1723,5 +1723,5 @@ declare class FitText {
1723
1723
 
1724
1724
  declare function sharedActiveLang(transloco: TranslocoService): Signal<string>;
1725
1725
 
1726
- export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isDynamicPercentageColorSource, isEntityAlignEnd, isEntityLabelHidden, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalizedLabel, resolvePercentageColor, resolvePercentageColorPropertyRef, serializeEntityRawValue, sharedActiveLang, splitConnectionKey, splitLeafKey, summarizeEntityListRows };
1726
+ export { CONNECTION_KEY_SEPARATOR, CURRENCY_COMPACT_THRESHOLD, ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, ENTITY_EMPTY_VALUE_PLACEHOLDER, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityIcon, EntityLeafDetails, EntityListDrawer, EntityListPreview, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, LEAF_PHASES_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildEntityListRows, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, humanizeEntityListKey, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isLeafPhasesSyntheticKey, isLeafSyntheticKey, isSectionKey, isValueMissing, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, readEntityValueColor, resolveConnectionLevelName, resolveEntityInfo, resolveEntityLabelPosition, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, sharedActiveLang, splitConnectionKey, splitLeafKey, summarizeEntityListRows };
1727
1727
  export type { ComparisonValueSide, ConnectionCatalogConfiguration, ConnectionLevelSavedConfig, ConnectionSourceLevelConfig, EntityAttachmentItemValue, EntityAttachmentValue, EntityBaseConfig, EntityClickEvent, EntityComparisonField, EntityComparisonOperation, EntityConfiguration, EntityConnectionConfig, EntityConnectionSourceValue, EntityConnectionValue, EntityData, EntityLabelPosition, EntityLeafDetailsConfig, EntityListComparison, EntityListComparisonRow, EntityListEntityValue, EntityListInlineFieldMeta, EntityListRenderedRow, EntityListRowValue, EntityListValueItem, EntityLocationValue, EntityLookupCheckListItem, EntityLookupCheckListPropValue, EntityLookupCheckListValue, EntityLookupValue, EntityMultiLookupValue, EntityMultiUserValue, EntityNestedPropertyMeta, EntityPercentageConfig, EntityPhaseGateValue, EntityPropertyConfiguration, EntityResizeEvent, EntityScheduleItemValue, EntitySectionConfig, EntitySectionGroup, EntitySectionLabel, EntitySize, EntityStatusValue, EntityTranslatableTextValue, EntityUserConfig, EntityUserValue, EntityViewType, LeafDetailsBadgeKind, LeafDetailsCatalogConfiguration, LeafDetailsCatalogLevelValue, LeafDetailsCatalogPhaseValue, LeafDetailsCatalogStatusValue, LeafDetailsEntityCollectionValue, LeafDetailsEntityValue, LeafDetailsPhaseSummary, LeafDetailsRuntimeChildSchema, LeafDetailsRuntimePhaseCount, LeafDetailsRuntimePhaseDetails, LeafDetailsRuntimeStatusCount, LeafDetailsRuntimeStatusDetails, LeafDetailsRuntimeValue, LeafDetailsStatusSummary, LeafLevelSavedConfig, LeafPhaseSavedConfig, PercentageColorMode, PercentageColorPropertyRef, PercentageColorRule, PercentageColorSource, PropertyValueComparison, ValueComparison };
@@ -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 {