@masterteam/components 0.0.274 → 0.0.275

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.
@@ -57,6 +57,22 @@ function displayOrPlaceholder(value) {
57
57
  }
58
58
  return String(value);
59
59
  }
60
+ /**
61
+ * Text/LongText values are a plain string, except for translatable
62
+ * properties, where the backend sends `{ display, ar?, en? }` instead.
63
+ * Unwraps either shape to the string to render.
64
+ */
65
+ function extractDisplayText(value) {
66
+ if (typeof value === 'string') {
67
+ return value;
68
+ }
69
+ if (value &&
70
+ typeof value === 'object' &&
71
+ typeof value.display === 'string') {
72
+ return value.display;
73
+ }
74
+ return null;
75
+ }
60
76
  function isEntityLabelHidden(configuration) {
61
77
  const config = configuration;
62
78
  return config?.hideLabel ?? config?.hideName ?? false;
@@ -202,7 +218,7 @@ class EntityText {
202
218
  displayValue = computed(() => {
203
219
  const d = this.data();
204
220
  if (d) {
205
- return displayOrPlaceholder(typeof d.value === 'string' ? d.value : null);
221
+ return displayOrPlaceholder(extractDisplayText(d.value));
206
222
  }
207
223
  return displayOrPlaceholder(this.value());
208
224
  }, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
@@ -818,11 +834,7 @@ class EntityLongText {
818
834
  displayName = computed(() => this.data()?.name ?? this.name() ?? '', ...(ngDevMode ? [{ debugName: "displayName" }] : /* istanbul ignore next */ []));
819
835
  displayValue = computed(() => {
820
836
  const d = this.data();
821
- const raw = d
822
- ? typeof d.value === 'string'
823
- ? d.value
824
- : null
825
- : this.value();
837
+ const raw = d ? extractDisplayText(d.value) : this.value();
826
838
  if (isValueMissing(raw)) {
827
839
  return ENTITY_EMPTY_VALUE_PLACEHOLDER;
828
840
  }
@@ -2470,5 +2482,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
2470
2482
  * Generated bundle index. Do not edit.
2471
2483
  */
2472
2484
 
2473
- 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, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, getEntitySectionTitle, groupEntitiesIntoSections, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, isValueMissing, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, resolveConnectionLevelName, resolveEntityLabelPosition, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, splitConnectionKey };
2485
+ 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, EntityLeafDetails, EntityLocation, EntityLongText, EntityLookup, EntityLookupModuleCheckList, EntityPercentage, EntityPhaseGate, EntityPreview, EntityPreviewBody, EntityScheduleItem, EntityStatus, EntityText, EntityUser, FitText, LEAF_DETAILS_KEY_SEPARATOR, SECTION_KEY_PREFIX, buildConnectionKey, buildDisplayEntities, buildSectionKey, compactCurrencyDisplay, currencyUnitOf, displayOrPlaceholder, expandConnectionEntity, expandLeafDetailsEntity, extractDisplayText, getEntitySectionTitle, groupEntitiesIntoSections, isConnectionSyntheticKey, isEntityAlignEnd, isEntityLabelHidden, isEntitySection, isLeafDetailsCatalogConfiguration, isLeafDetailsCollectionValue, isLeafDetailsRuntimeValue, isLeafDetailsSyntheticKey, isLeafDetailsValue, isSectionKey, isValueMissing, matchesPercentageColorRule, normalizeConnectionSourceLevels, normalizeNumerals, parseCurrencyAmount, resolveConnectionLevelName, resolveEntityLabelPosition, resolveLocalizedLabel, resolvePercentageColor, serializeEntityRawValue, splitConnectionKey };
2474
2486
  //# sourceMappingURL=masterteam-components-entities.mjs.map