@contrail/documents 1.1.17 → 1.1.19

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.
@@ -52,5 +52,6 @@ export interface DocumentElement extends Document {
52
52
  numberFormat?: any;
53
53
  dateFormat?: any;
54
54
  displayLabel?: boolean;
55
+ propertyLevel?: string;
55
56
  };
56
57
  }
@@ -59,14 +59,23 @@ class DynamicTextUtil {
59
59
  const displayFunction = ((_c = dynamicTextElement.propertyBindingsMetaData) === null || _c === void 0 ? void 0 : _c.displayFunction) || DynamicTextDisplayFunction.VALUE;
60
60
  const displayLabel = (_d = dynamicTextElement.propertyBindingsMetaData) === null || _d === void 0 ? void 0 : _d.displayLabel;
61
61
  const bindingProperty = dynamicTextElement.propertyBindings.text;
62
+ if (['projectItem.project.name', 'specificationProjectItem.project.name'].includes(bindingProperty)) {
63
+ property = {
64
+ slug: 'name',
65
+ label: 'Project name',
66
+ propertyType: types_1.PropertyType.String,
67
+ };
68
+ }
62
69
  const [entityType, propertySlug] = bindingProperty === null || bindingProperty === void 0 ? void 0 : bindingProperty.split('.');
63
70
  let text = '';
64
- if (['showcase', 'board', 'project'].includes(entityType)) {
71
+ if (['showcase', 'board', 'project'].includes(entityType) || isSpecRelated) {
65
72
  if (!ownerReferenceModel) {
66
73
  return '';
67
74
  }
68
75
  text = util_1.ObjectUtil.getByPath(ownerReferenceModel, bindingProperty);
69
- text = formatter.formatValue(text, (property === null || property === void 0 ? void 0 : property.propertyType) || types_1.PropertyType.String);
76
+ text = property
77
+ ? formatter.formatValueForProperty(text, property)
78
+ : formatter.formatValue(text, types_1.PropertyType.String);
70
79
  }
71
80
  else {
72
81
  if (!frame && !isSpecRelated) {
@@ -88,13 +97,6 @@ class DynamicTextUtil {
88
97
  if (frameProperties.includes(bindingProperty)) {
89
98
  property = null;
90
99
  }
91
- else if (['projectItem.project.name', 'specificationProjectItem.project.name'].includes(bindingProperty)) {
92
- property = {
93
- slug: 'name',
94
- label: 'Project name',
95
- propertyType: types_1.PropertyType.String,
96
- };
97
- }
98
100
  const frameMemberValues = [];
99
101
  componentModels.forEach((elementModel) => {
100
102
  frameMemberValues.push(util_1.ObjectUtil.getByPath(elementModel, bindingProperty));
@@ -106,7 +108,7 @@ class DynamicTextUtil {
106
108
  }
107
109
  }
108
110
  if (displayFunction === DynamicTextDisplayFunction.LABEL) {
109
- if (['showcase', 'board', 'project', 'frame'].includes(entityType)) {
111
+ if (['showcase', 'board', 'project', 'frame'].includes(entityType) || isSpecRelated) {
110
112
  text = exports.HARD_CODED_TEXT[bindingProperty] || (property === null || property === void 0 ? void 0 : property.label);
111
113
  }
112
114
  else if (!frame) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",