@masterteam/components 0.0.232 → 0.0.234

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.
@@ -8,6 +8,7 @@ import { TranslocoPipe, TranslocoService } from '@jsverse/transloco';
8
8
  import { Avatar } from '@masterteam/components/avatar';
9
9
  import { SecureImagePipe, UploadField } from '@masterteam/components/upload-field';
10
10
  import { Progress } from '@masterteam/components/progress';
11
+ import { toSignal } from '@angular/core/rxjs-interop';
11
12
  import * as i1 from '@angular/forms';
12
13
  import { FormsModule } from '@angular/forms';
13
14
  import { Button } from '@masterteam/components/button';
@@ -468,6 +469,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
468
469
  args: [{ selector: 'mt-entity-lookup', standalone: true, imports: [EntityField], template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (lookupValue(); as lookup) {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit\"\r\n [style]=\"badgeStyle()\"\r\n >\r\n {{ lookupLabel() }}\r\n </span>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n" }]
469
470
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
470
471
 
472
+ /**
473
+ * A section is persisted/transported as an ordinary display item whose
474
+ * `propertyKey` carries this sentinel prefix instead of a real property key
475
+ * (mirrors the LeafDetails synthetic-key convention). Both the customization
476
+ * builder and the runtime renderer recognize it, so the constant lives here in
477
+ * the shared entities layer rather than in either consumer.
478
+ */
479
+ const SECTION_KEY_PREFIX = '__section__::';
480
+ /** True when a display item's key denotes a section marker. */
481
+ function isSectionKey(key) {
482
+ return typeof key === 'string' && key.startsWith(SECTION_KEY_PREFIX);
483
+ }
484
+ /** Mints a unique section marker key. */
485
+ function buildSectionKey() {
486
+ return `${SECTION_KEY_PREFIX}${crypto.randomUUID()}`;
487
+ }
488
+ /**
489
+ * Resolves a localized label (`{ en, ar }`) for the given language, falling
490
+ * back across locales. Returns '' when nothing is set.
491
+ */
492
+ function resolveLocalizedLabel(label, lang) {
493
+ if (!label)
494
+ return '';
495
+ const primary = lang === 'ar' ? label.ar : label.en;
496
+ return (primary || label.en || label.ar || '').trim();
497
+ }
498
+ /** True when the entity is a `Section` layout marker rather than a value. */
499
+ function isEntitySection(entity) {
500
+ return entity?.viewType === 'Section';
501
+ }
502
+ /**
503
+ * Splits a flat, order-sorted entity list into section groups. Membership is
504
+ * purely positional: each entity belongs to whichever `Section` marker precedes
505
+ * it. Pass the output of `buildDisplayEntities` (already sorted by `order`).
506
+ *
507
+ * Zero markers → a single `{ section: null }` group holding everything, so the
508
+ * bare-grid rendering is unchanged. Empty leading/trailing runs are dropped.
509
+ */
510
+ function groupEntitiesIntoSections(entities) {
511
+ const groups = [];
512
+ let current = { section: null, entities: [] };
513
+ const flush = () => {
514
+ if (current.section || current.entities.length > 0) {
515
+ groups.push(current);
516
+ }
517
+ };
518
+ for (const entity of entities) {
519
+ if (isEntitySection(entity)) {
520
+ flush();
521
+ current = { section: entity, entities: [] };
522
+ }
523
+ else {
524
+ current.entities.push(entity);
525
+ }
526
+ }
527
+ flush();
528
+ return groups;
529
+ }
530
+ /**
531
+ * Resolves a section marker's display label for the given language, falling
532
+ * back across locales and finally to the entity's `name`.
533
+ */
534
+ function getEntitySectionTitle(section, lang) {
535
+ if (!section)
536
+ return '';
537
+ const label = section.configuration
538
+ ?.label;
539
+ return resolveLocalizedLabel(label, lang) || (section.name ?? '');
540
+ }
541
+
542
+ /** `#RGB` / `#RRGGBB`. Anything else is used as-is for the text color only. */
543
+ const HEX_COLOR_PATTERN = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
544
+ /**
545
+ * Badge color used when the phase gate carries no `color`. `color` is optional
546
+ * presentation metadata, so a phase gate without one must still read as a
547
+ * badge rather than as bare text — this is the same neutral slate the table
548
+ * falls back to for uncategorized status chips.
549
+ */
550
+ const DEFAULT_PHASE_GATE_COLOR = '#475569';
551
+ /**
552
+ * Preview renderer for `PhaseGate` properties — a calculated, read-only lookup
553
+ * pointing at the schema phase gate the record currently sits on. It renders
554
+ * exactly like {@link EntityLookup} (colored badge) but resolves its label
555
+ * per-language.
556
+ *
557
+ * Label resolution, in order:
558
+ * 1. `value.ar` / `value.en` for the active language — the backend sends both
559
+ * so a client-side language switch re-renders without a refetch, which is
560
+ * why they win over the already-resolved `display`.
561
+ * 2. `value.display`, then the other locale.
562
+ * 3. The flat display, for payloads that send the value as a bare string
563
+ * (comparison snapshots build their sides that way).
564
+ * 4. `rawValue` — the schema phase-gate id — as a last resort.
565
+ */
566
+ class EntityPhaseGate {
567
+ transloco = inject(TranslocoService);
568
+ /** Full entity data object */
569
+ data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : /* istanbul ignore next */ []));
570
+ /** Individual inputs (used when data is not provided) */
571
+ name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
572
+ value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
573
+ activeLang = toSignal(this.transloco.langChanges$, {
574
+ initialValue: this.transloco.getActiveLang(),
575
+ });
576
+ displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
577
+ phaseGateValue = computed(() => {
578
+ const value = this.data()?.value;
579
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
580
+ return value;
581
+ }
582
+ return this.value() ?? null;
583
+ }, ...(ngDevMode ? [{ debugName: "phaseGateValue" }] : /* istanbul ignore next */ []));
584
+ /** Resolved label, or `null` when nothing at all is available. */
585
+ resolvedLabel = computed(() => {
586
+ const phaseGate = this.phaseGateValue();
587
+ if (phaseGate) {
588
+ const localized = resolveLocalizedLabel(phaseGate, this.activeLang());
589
+ const label = localized || phaseGate.display?.trim();
590
+ if (label)
591
+ return label;
592
+ }
593
+ return this.flatDisplay() ?? this.rawId();
594
+ }, ...(ngDevMode ? [{ debugName: "resolvedLabel" }] : /* istanbul ignore next */ []));
595
+ hasValue = computed(() => this.resolvedLabel() !== null, ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
596
+ phaseGateLabel = computed(() => displayOrPlaceholder(this.resolvedLabel()), ...(ngDevMode ? [{ debugName: "phaseGateLabel" }] : /* istanbul ignore next */ []));
597
+ badgeStyle = computed(() => {
598
+ const color = this.phaseGateValue()?.color?.trim() || DEFAULT_PHASE_GATE_COLOR;
599
+ if (!HEX_COLOR_PATTERN.test(color))
600
+ return { color };
601
+ return {
602
+ color,
603
+ backgroundColor: this.hexToRgba(color, 0.12),
604
+ };
605
+ }, ...(ngDevMode ? [{ debugName: "badgeStyle" }] : /* istanbul ignore next */ []));
606
+ emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
607
+ /** The value flattened to a plain display string by the sender. */
608
+ flatDisplay() {
609
+ const value = this.data()?.value;
610
+ return typeof value === 'string' && value.trim() ? value.trim() : null;
611
+ }
612
+ /** The schema phase-gate id. */
613
+ rawId() {
614
+ const rawValue = this.data()?.rawValue;
615
+ return typeof rawValue === 'string' && rawValue.trim()
616
+ ? rawValue.trim()
617
+ : null;
618
+ }
619
+ hexToRgba(hex, alpha) {
620
+ const expanded = hex.length === 4
621
+ ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`
622
+ : hex;
623
+ const r = parseInt(expanded.slice(1, 3), 16);
624
+ const g = parseInt(expanded.slice(3, 5), 16);
625
+ const b = parseInt(expanded.slice(5, 7), 16);
626
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
627
+ }
628
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPhaseGate, deps: [], target: i0.ɵɵFactoryTarget.Component });
629
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityPhaseGate, isStandalone: true, selector: "mt-entity-phase-gate", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (hasValue()) {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit\"\n [style]=\"badgeStyle()\"\n >\n {{ phaseGateLabel() }}\n </span>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }] });
630
+ }
631
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityPhaseGate, decorators: [{
632
+ type: Component,
633
+ args: [{ selector: 'mt-entity-phase-gate', standalone: true, imports: [EntityField], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (hasValue()) {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit\"\n [style]=\"badgeStyle()\"\n >\n {{ phaseGateLabel() }}\n </span>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n" }]
634
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
635
+
471
636
  class EntityAttachment {
472
637
  data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : /* istanbul ignore next */ []));
473
638
  name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
@@ -842,11 +1007,11 @@ class EntityConnection {
842
1007
  }, ...(ngDevMode ? [{ debugName: "connection" }] : /* istanbul ignore next */ []));
843
1008
  displayValue = computed(() => displayOrPlaceholder(this.connection()?.display), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
844
1009
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, deps: [], target: i0.ɵɵFactoryTarget.Component });
845
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityConnection, isStandalone: true, selector: "mt-entity-connection", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n>\r\n <div\r\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >\r\n {{ displayValue() }}\r\n </div>\r\n</mt-entity-field>\r\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }] });
1010
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: EntityConnection, isStandalone: true, selector: "mt-entity-connection", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <div\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </div>\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "directive", type: TruncateTooltip, selector: "[mtTruncateTooltip]" }] });
846
1011
  }
847
1012
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityConnection, decorators: [{
848
1013
  type: Component,
849
- args: [{ selector: 'mt-entity-connection', standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n>\r\n <div\r\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\r\n mtTruncateTooltip\r\n tooltipPosition=\"top\"\r\n >\r\n {{ displayValue() }}\r\n </div>\r\n</mt-entity-field>\r\n" }]
1014
+ args: [{ selector: 'mt-entity-connection', standalone: true, imports: [EntityField, TruncateTooltip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n>\n <div\n class=\"min-w-0 max-w-full truncate text-sm font-semibold\"\n mtTruncateTooltip\n tooltipPosition=\"top\"\n >\n {{ displayValue() }}\n </div>\n</mt-entity-field>\n" }]
850
1015
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
851
1016
  function normalizeEntityConnection(value) {
852
1017
  if (value === null || value === undefined || value === '') {
@@ -894,11 +1059,11 @@ class EntityScheduleItem {
894
1059
  }, ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
895
1060
  emptyLabel = ENTITY_EMPTY_VALUE_PLACEHOLDER;
896
1061
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
897
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityScheduleItem, isStandalone: true, selector: "mt-entity-schedule-item", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (items().length) {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (item of items(); track item.id) {\r\n <mt-chip [label]=\"item.name\" size=\"small\" />\r\n }\r\n </div>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "component", type: Chip, selector: "mt-chip", inputs: ["label", "icon", "image", "removable", "removeIcon", "styleClass", "size"], outputs: ["onRemove", "onImageError"] }] });
1062
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityScheduleItem, isStandalone: true, selector: "mt-entity-schedule-item", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (items().length) {\n <div class=\"flex flex-wrap items-center gap-2\">\n @for (item of items(); track item.id) {\n <mt-chip [label]=\"item.name\" size=\"small\" />\n }\n </div>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n", dependencies: [{ kind: "component", type: EntityField, selector: "mt-entity-field", inputs: ["label", "labelIconName", "configuration", "gap"] }, { kind: "component", type: Chip, selector: "mt-chip", inputs: ["label", "icon", "image", "removable", "removeIcon", "styleClass", "size"], outputs: ["onRemove", "onImageError"] }] });
898
1063
  }
899
1064
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityScheduleItem, decorators: [{
900
1065
  type: Component,
901
- args: [{ selector: 'mt-entity-schedule-item', standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\r\n [label]=\"displayName()\"\r\n [configuration]=\"data()?.configuration\"\r\n gap=\"normal\"\r\n>\r\n @if (items().length) {\r\n <div class=\"flex flex-wrap items-center gap-2\">\r\n @for (item of items(); track item.id) {\r\n <mt-chip [label]=\"item.name\" size=\"small\" />\r\n }\r\n </div>\r\n } @else {\r\n <span\r\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\r\n >\r\n {{ emptyLabel }}\r\n </span>\r\n }\r\n</mt-entity-field>\r\n" }]
1066
+ args: [{ selector: 'mt-entity-schedule-item', standalone: true, imports: [EntityField, Chip], template: "<mt-entity-field\n [label]=\"displayName()\"\n [configuration]=\"data()?.configuration\"\n gap=\"normal\"\n>\n @if (items().length) {\n <div class=\"flex flex-wrap items-center gap-2\">\n @for (item of items(); track item.id) {\n <mt-chip [label]=\"item.name\" size=\"small\" />\n }\n </div>\n } @else {\n <span\n class=\"inline-flex items-center px-3 py-2 rounded-md text-xs font-semibold w-fit text-gray-500 bg-gray-100\"\n >\n {{ emptyLabel }}\n </span>\n }\n</mt-entity-field>\n" }]
902
1067
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
903
1068
 
904
1069
  class EntityLeafDetails {
@@ -959,7 +1124,7 @@ class EntityValuePreview {
959
1124
  return viewType === 'LookupMatrix' ? 'Lookup' : viewType;
960
1125
  }, ...(ngDevMode ? [{ debugName: "previewType" }] : /* istanbul ignore next */ []));
961
1126
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityValuePreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
962
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityValuePreview, isStandalone: true, selector: "mt-entity-value-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: { classAttribute: "block min-w-0 w-full" }, ngImport: i0, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Number\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"Location\") {\r\n <mt-entity-location [data]=\"data()\" />\r\n }\r\n @case (\"Connection\") {\r\n <mt-entity-connection [data]=\"data()\" />\r\n }\r\n @case (\"ScheduleItemSelector\") {\r\n <mt-entity-schedule-item [data]=\"data()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n", dependencies: [{ kind: "component", type: EntityText, selector: "mt-entity-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLongText, selector: "mt-entity-long-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityDate, selector: "mt-entity-date", inputs: ["data", "name", "value", "viewType"] }, { kind: "component", type: EntityUser, selector: "mt-entity-user", inputs: ["data"] }, { kind: "component", type: EntityPercentage, selector: "mt-entity-percentage", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityCurrency, selector: "mt-entity-currency", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityCheckbox, selector: "mt-entity-checkbox", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityLookup, selector: "mt-entity-lookup", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityAttachment, selector: "mt-entity-attachment", inputs: ["data", "name", "shape", "value", "endPoint", "context"] }, { kind: "component", type: EntityStatus, selector: "mt-entity-status", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLeafDetails, selector: "mt-entity-leaf-details", inputs: ["data"] }, { kind: "component", type: EntityLocation, selector: "mt-entity-location", inputs: ["data"] }, { kind: "component", type: EntityConnection, selector: "mt-entity-connection", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityScheduleItem, selector: "mt-entity-schedule-item", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1127
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityValuePreview, isStandalone: true, selector: "mt-entity-value-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: { classAttribute: "block min-w-0 w-full" }, ngImport: i0, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Number\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"PhaseGate\") {\r\n <mt-entity-phase-gate [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"Location\") {\r\n <mt-entity-location [data]=\"data()\" />\r\n }\r\n @case (\"Connection\") {\r\n <mt-entity-connection [data]=\"data()\" />\r\n }\r\n @case (\"ScheduleItemSelector\") {\r\n <mt-entity-schedule-item [data]=\"data()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n", dependencies: [{ kind: "component", type: EntityText, selector: "mt-entity-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLongText, selector: "mt-entity-long-text", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityDate, selector: "mt-entity-date", inputs: ["data", "name", "value", "viewType"] }, { kind: "component", type: EntityUser, selector: "mt-entity-user", inputs: ["data"] }, { kind: "component", type: EntityPercentage, selector: "mt-entity-percentage", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityCurrency, selector: "mt-entity-currency", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityCheckbox, selector: "mt-entity-checkbox", inputs: ["data", "name", "value", "rawValue"] }, { kind: "component", type: EntityLookup, selector: "mt-entity-lookup", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityPhaseGate, selector: "mt-entity-phase-gate", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityAttachment, selector: "mt-entity-attachment", inputs: ["data", "name", "shape", "value", "endPoint", "context"] }, { kind: "component", type: EntityStatus, selector: "mt-entity-status", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityLeafDetails, selector: "mt-entity-leaf-details", inputs: ["data"] }, { kind: "component", type: EntityLocation, selector: "mt-entity-location", inputs: ["data"] }, { kind: "component", type: EntityConnection, selector: "mt-entity-connection", inputs: ["data", "name", "value"] }, { kind: "component", type: EntityScheduleItem, selector: "mt-entity-schedule-item", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
963
1128
  }
964
1129
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityValuePreview, decorators: [{
965
1130
  type: Component,
@@ -972,6 +1137,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
972
1137
  EntityCurrency,
973
1138
  EntityCheckbox,
974
1139
  EntityLookup,
1140
+ EntityPhaseGate,
975
1141
  EntityAttachment,
976
1142
  EntityStatus,
977
1143
  EntityLeafDetails,
@@ -980,7 +1146,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
980
1146
  EntityScheduleItem,
981
1147
  ], host: {
982
1148
  class: 'block min-w-0 w-full',
983
- }, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Number\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"Location\") {\r\n <mt-entity-location [data]=\"data()\" />\r\n }\r\n @case (\"Connection\") {\r\n <mt-entity-connection [data]=\"data()\" />\r\n }\r\n @case (\"ScheduleItemSelector\") {\r\n <mt-entity-schedule-item [data]=\"data()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n" }]
1149
+ }, template: "@switch (previewType()) {\r\n @case (\"Text\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"LongText\") {\r\n <mt-entity-long-text [data]=\"data()\" />\r\n }\r\n @case (\"Date\") {\r\n <mt-entity-date [data]=\"data()\" />\r\n }\r\n @case (\"DateTime\") {\r\n <mt-entity-date [data]=\"data()\" [viewType]=\"'DateTime'\" />\r\n }\r\n @case (\"User\") {\r\n <mt-entity-user [data]=\"data()\" />\r\n }\r\n @case (\"Percentage\") {\r\n <mt-entity-percentage [data]=\"data()\" />\r\n }\r\n @case (\"Currency\") {\r\n <mt-entity-currency [data]=\"data()\" />\r\n }\r\n @case (\"Number\") {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n @case (\"Checkbox\") {\r\n <mt-entity-checkbox [data]=\"data()\" />\r\n }\r\n @case (\"Lookup\") {\r\n <mt-entity-lookup [data]=\"data()\" />\r\n }\r\n @case (\"Status\") {\r\n <mt-entity-status [data]=\"data()\" />\r\n }\r\n @case (\"PhaseGate\") {\r\n <mt-entity-phase-gate [data]=\"data()\" />\r\n }\r\n @case (\"Attachment\") {\r\n <mt-entity-attachment [data]=\"data()\" [shape]=\"attachmentShape()\" />\r\n }\r\n @case (\"Location\") {\r\n <mt-entity-location [data]=\"data()\" />\r\n }\r\n @case (\"Connection\") {\r\n <mt-entity-connection [data]=\"data()\" />\r\n }\r\n @case (\"ScheduleItemSelector\") {\r\n <mt-entity-schedule-item [data]=\"data()\" />\r\n }\r\n @case (\"LeafDetails\") {\r\n <mt-entity-leaf-details [data]=\"data()\" />\r\n }\r\n @default {\r\n <mt-entity-text [data]=\"data()\" />\r\n }\r\n}\r\n" }]
984
1150
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], attachmentShape: [{ type: i0.Input, args: [{ isSignal: true, alias: "attachmentShape", required: false }] }] } });
985
1151
 
986
1152
  /**
@@ -1276,76 +1442,6 @@ function buildDisplayEntities(entities) {
1276
1442
  .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
1277
1443
  }
1278
1444
 
1279
- /**
1280
- * A section is persisted/transported as an ordinary display item whose
1281
- * `propertyKey` carries this sentinel prefix instead of a real property key
1282
- * (mirrors the LeafDetails synthetic-key convention). Both the customization
1283
- * builder and the runtime renderer recognize it, so the constant lives here in
1284
- * the shared entities layer rather than in either consumer.
1285
- */
1286
- const SECTION_KEY_PREFIX = '__section__::';
1287
- /** True when a display item's key denotes a section marker. */
1288
- function isSectionKey(key) {
1289
- return typeof key === 'string' && key.startsWith(SECTION_KEY_PREFIX);
1290
- }
1291
- /** Mints a unique section marker key. */
1292
- function buildSectionKey() {
1293
- return `${SECTION_KEY_PREFIX}${crypto.randomUUID()}`;
1294
- }
1295
- /**
1296
- * Resolves a localized label (`{ en, ar }`) for the given language, falling
1297
- * back across locales. Returns '' when nothing is set.
1298
- */
1299
- function resolveLocalizedLabel(label, lang) {
1300
- if (!label)
1301
- return '';
1302
- const primary = lang === 'ar' ? label.ar : label.en;
1303
- return (primary || label.en || label.ar || '').trim();
1304
- }
1305
- /** True when the entity is a `Section` layout marker rather than a value. */
1306
- function isEntitySection(entity) {
1307
- return entity?.viewType === 'Section';
1308
- }
1309
- /**
1310
- * Splits a flat, order-sorted entity list into section groups. Membership is
1311
- * purely positional: each entity belongs to whichever `Section` marker precedes
1312
- * it. Pass the output of `buildDisplayEntities` (already sorted by `order`).
1313
- *
1314
- * Zero markers → a single `{ section: null }` group holding everything, so the
1315
- * bare-grid rendering is unchanged. Empty leading/trailing runs are dropped.
1316
- */
1317
- function groupEntitiesIntoSections(entities) {
1318
- const groups = [];
1319
- let current = { section: null, entities: [] };
1320
- const flush = () => {
1321
- if (current.section || current.entities.length > 0) {
1322
- groups.push(current);
1323
- }
1324
- };
1325
- for (const entity of entities) {
1326
- if (isEntitySection(entity)) {
1327
- flush();
1328
- current = { section: entity, entities: [] };
1329
- }
1330
- else {
1331
- current.entities.push(entity);
1332
- }
1333
- }
1334
- flush();
1335
- return groups;
1336
- }
1337
- /**
1338
- * Resolves a section marker's display label for the given language, falling
1339
- * back across locales and finally to the entity's `name`.
1340
- */
1341
- function getEntitySectionTitle(section, lang) {
1342
- if (!section)
1343
- return '';
1344
- const label = section.configuration
1345
- ?.label;
1346
- return resolveLocalizedLabel(label, lang) || (section.name ?? '');
1347
- }
1348
-
1349
1445
  class EntityPreviewBody {
1350
1446
  data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
1351
1447
  attachmentShape = input('default', ...(ngDevMode ? [{ debugName: "attachmentShape" }] : /* istanbul ignore next */ []));
@@ -1757,5 +1853,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1757
1853
  * Generated bundle index. Do not edit.
1758
1854
  */
1759
1855
 
1760
- export { ComparisonEntityList, ComparisonValue, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildDisplayEntities, buildSectionKey, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, resolveLocalizedLabel };
1856
+ export { ComparisonEntityList, ComparisonValue, DEFAULT_PHASE_GATE_COLOR, EntitiesManage, EntitiesPreview, EntitiesResizeBase, EntityAttachment, EntityCheckbox, EntityConnection, EntityCurrency, EntityDate, EntityField, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildDisplayEntities, buildSectionKey, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, resolveLocalizedLabel };
1761
1857
  //# sourceMappingURL=masterteam-components-entities.mjs.map