@masterteam/components 0.0.285 → 0.0.286

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.
@@ -1576,6 +1576,19 @@ class EntityLeafDetails {
1576
1576
  }, ...(ngDevMode ? [{ debugName: "leafValue" }] : /* istanbul ignore next */ []));
1577
1577
  /** True when this item paints the level's phase badges instead of statuses. */
1578
1578
  isPhaseItem = computed(() => this.leafValue()?.kind === 'phase', ...(ngDevMode ? [{ debugName: "isPhaseItem" }] : /* istanbul ignore next */ []));
1579
+ /**
1580
+ * This tile's own saved overrides — the `leafLevels` / `leafPhases` entry for
1581
+ * its child level. The two maps are kept apart because one level can render
1582
+ * both projections, each with its own slot, width and now label.
1583
+ */
1584
+ tileConfig = computed(() => {
1585
+ const levelId = this.leafValue()?.levelId;
1586
+ if (levelId == null)
1587
+ return undefined;
1588
+ const config = this.data().configuration;
1589
+ const map = this.isPhaseItem() ? config?.leafPhases : config?.leafLevels;
1590
+ return map?.[String(levelId)];
1591
+ }, ...(ngDevMode ? [{ debugName: "tileConfig" }] : /* istanbul ignore next */ []));
1579
1592
  /**
1580
1593
  * The badges to paint. Phases and statuses carry the same `{ key, display,
1581
1594
  * color, count }` shape, so one template drives both — only which projection
@@ -1589,16 +1602,43 @@ class EntityLeafDetails {
1589
1602
  }, ...(ngDevMode ? [{ debugName: "badges" }] : /* istanbul ignore next */ []));
1590
1603
  /**
1591
1604
  * Label shown below the badges: "Level Name (total)", with a "— Phases"
1592
- * qualifier on the phase item so a level configured with both projections
1593
- * does not render two identically-labelled tiles.
1605
+ * qualifier on an unnamed phase item so a level configured with both
1606
+ * projections does not render two identically-labelled tiles.
1607
+ *
1608
+ * The custom label is read off the tile's OWN per-level entry, not from
1609
+ * `data().name` and not from the parent property's `configuration.label`.
1610
+ *
1611
+ * Not `name`, because for this view type it does not survive the trip: both
1612
+ * hosts resolve a label into `name` up front (`toEntityData` in
1613
+ * client-instance-preview, `openDrawer` in the customization builder), and
1614
+ * then `expandLeafDetailsEntity` rewrites `name` to the child level's own
1615
+ * name when it splits the property into one tile per level.
1616
+ *
1617
+ * Not the parent's label, because one property becomes many tiles — one per
1618
+ * child level, and again per projection. A label held on the parent paints
1619
+ * the same text on every one of them, which is what makes a card show
1620
+ * "Delivery Portfolio (7)" three times over. `order` and `size` were already
1621
+ * per-level for exactly this reason; the label follows them.
1622
+ *
1623
+ * A custom label owns the whole name. The "— Phases" qualifier is only the
1624
+ * *default* disambiguator for a level that renders both projections — once an
1625
+ * author names the phase tile themselves, appending it would force a suffix
1626
+ * onto text they wrote, and "Delivery Stages — Phases" is not something they
1627
+ * can spell their way out of. So the qualifier applies to the fallback name
1628
+ * only; the author is trusted to have distinguished the tile.
1629
+ *
1630
+ * `(total)` is the one thing always appended — the count is the point of the
1631
+ * tile, and it is live data, not part of anyone's label.
1594
1632
  */
1595
1633
  labelWithTotal = computed(() => {
1596
1634
  const leaf = this.leafValue();
1597
1635
  const lang = this.activeLang();
1598
- const base = this.data().name ?? leaf?.levelName ?? '';
1599
- const name = this.isPhaseItem()
1600
- ? `${base} — ${this.transloco.translate('components.entitiesPreview.leafPhases', {}, lang)}`
1601
- : base;
1636
+ const custom = resolveLocalizedLabel(this.tileConfig()?.label, lang);
1637
+ const fallback = this.data().name || leaf?.levelName || '';
1638
+ const qualified = this.isPhaseItem() && fallback
1639
+ ? `${fallback} — ${this.transloco.translate('components.entitiesPreview.leafPhases', {}, lang)}`
1640
+ : fallback;
1641
+ const name = custom || qualified;
1602
1642
  if (!leaf)
1603
1643
  return name;
1604
1644
  const total = this.badges().reduce((sum, badge) => sum + badge.count, 0);
@@ -2347,7 +2387,7 @@ class EntityPreview {
2347
2387
  return null;
2348
2388
  }, ...(ngDevMode ? [{ debugName: "comparisonKind" }] : /* istanbul ignore next */ []));
2349
2389
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
2350
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.relative": "infoText()", "class.pe-4": "infoText()" }, classAttribute: "w-full" }, ngImport: i0, template: "@if (infoText(); as info) {\n <!--\n The note affordance. Absolutely positioned so it stays out of the value's\n own layout \u2014 each viewType renders its own markup and there is no shared\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\n long value truncates before it can run underneath the icon.\n -->\n <!--\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\n -->\n <mt-icon\n icon=\"general.info-circle\"\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\n [mtTooltip]=\"info\"\n tooltipPosition=\"top\"\n tooltipStyleClass=\"mt-entity-info-tooltip\"\n [attr.aria-label]=\"info\"\n />\n}\n\n@switch (comparisonKind()) {\n @case (\"Value\") {\n <mt-comparison-value [data]=\"data()\" />\n }\n @case (\"EntityList\") {\n <mt-comparison-entity-list [data]=\"data()\" />\n }\n @default {\n <mt-entity-preview-body\n [data]=\"data()\"\n [attachmentShape]=\"attachmentShape()\"\n />\n }\n}\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }, { kind: "component", type: ComparisonValue, selector: "mt-comparison-value", inputs: ["data"] }, { kind: "component", type: ComparisonEntityList, selector: "mt-comparison-entity-list", inputs: ["data"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2390
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPreview, isStandalone: true, selector: "mt-entity-preview", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, attachmentShape: { classPropertyName: "attachmentShape", publicName: "attachmentShape", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.relative": "infoText()", "class.pe-4": "infoText()" }, classAttribute: "w-full" }, ngImport: i0, template: "@if (infoText(); as info) {\r\n <!--\r\n The note affordance. Absolutely positioned so it stays out of the value's\r\n own layout \u2014 each viewType renders its own markup and there is no shared\r\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\r\n long value truncates before it can run underneath the icon.\r\n -->\r\n <!--\r\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\r\n -->\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n [mtTooltip]=\"info\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n [attr.aria-label]=\"info\"\r\n />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n @case (\"Value\") {\r\n <mt-comparison-value [data]=\"data()\" />\r\n }\r\n @case (\"EntityList\") {\r\n <mt-comparison-entity-list [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-preview-body\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n }\r\n}\r\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "component", type: EntityPreviewBody, selector: "mt-entity-preview-body", inputs: ["data", "attachmentShape"] }, { kind: "component", type: ComparisonValue, selector: "mt-comparison-value", inputs: ["data"] }, { kind: "component", type: ComparisonEntityList, selector: "mt-comparison-entity-list", inputs: ["data"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2351
2391
  }
2352
2392
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPreview, decorators: [{
2353
2393
  type: Component,
@@ -2363,7 +2403,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
2363
2403
  // exactly the box it had before this feature existed.
2364
2404
  '[class.relative]': 'infoText()',
2365
2405
  '[class.pe-4]': 'infoText()',
2366
- }, template: "@if (infoText(); as info) {\n <!--\n The note affordance. Absolutely positioned so it stays out of the value's\n own layout \u2014 each viewType renders its own markup and there is no shared\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\n long value truncates before it can run underneath the icon.\n -->\n <!--\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\n -->\n <mt-icon\n icon=\"general.info-circle\"\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\n [mtTooltip]=\"info\"\n tooltipPosition=\"top\"\n tooltipStyleClass=\"mt-entity-info-tooltip\"\n [attr.aria-label]=\"info\"\n />\n}\n\n@switch (comparisonKind()) {\n @case (\"Value\") {\n <mt-comparison-value [data]=\"data()\" />\n }\n @case (\"EntityList\") {\n <mt-comparison-entity-list [data]=\"data()\" />\n }\n @default {\n <mt-entity-preview-body\n [data]=\"data()\"\n [attachmentShape]=\"attachmentShape()\"\n />\n }\n}\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"] }]
2406
+ }, template: "@if (infoText(); as info) {\r\n <!--\r\n The note affordance. Absolutely positioned so it stays out of the value's\r\n own layout \u2014 each viewType renders its own markup and there is no shared\r\n slot to put this in \u2014 while the host reserves the corner with `pe-4`, so a\r\n long value truncates before it can run underneath the icon.\r\n -->\r\n <!--\r\n Sized with `text-sm`, not a `size` input: `mt-icon` has none, and its host\r\n is `width: 1em` \u2014 so font-size is what actually scales the glyph.\r\n -->\r\n <mt-icon\r\n icon=\"general.info-circle\"\r\n class=\"absolute top-0 end-0 z-10 cursor-help text-sm text-surface-400 transition-colors hover:text-primary-600\"\r\n [mtTooltip]=\"info\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"mt-entity-info-tooltip\"\r\n [attr.aria-label]=\"info\"\r\n />\r\n}\r\n\r\n@switch (comparisonKind()) {\r\n @case (\"Value\") {\r\n <mt-comparison-value [data]=\"data()\" />\r\n }\r\n @case (\"EntityList\") {\r\n <mt-comparison-entity-list [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-preview-body\r\n [data]=\"data()\"\r\n [attachmentShape]=\"attachmentShape()\"\r\n />\r\n }\r\n}\r\n", styles: [".mt-entity-info-tooltip{max-width:22rem}.mt-entity-info-tooltip .p-tooltip-text{white-space:pre-wrap;text-align:start;overflow-wrap:anywhere}\n"] }]
2367
2407
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
2368
2408
 
2369
2409
  const EMPTY_KEY_SET = new Set();