@itwin/presentation-common 5.0.0-dev.5 → 5.0.0-dev.52

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.
Files changed (222) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/lib/cjs/assets/locales/en/Presentation.json +19 -19
  3. package/lib/cjs/presentation-common/AsyncTasks.d.ts +4 -4
  4. package/lib/cjs/presentation-common/AsyncTasks.d.ts.map +1 -1
  5. package/lib/cjs/presentation-common/AsyncTasks.js +4 -3
  6. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  7. package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
  8. package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
  9. package/lib/cjs/presentation-common/EC.d.ts +31 -0
  10. package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
  11. package/lib/cjs/presentation-common/EC.js.map +1 -1
  12. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  13. package/lib/cjs/presentation-common/Error.js.map +1 -1
  14. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  15. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  16. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  17. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  18. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  19. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  20. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +29 -8
  21. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  22. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  23. package/lib/cjs/presentation-common/PresentationRpcInterface.js +4 -4
  24. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  25. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts +3 -2
  26. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  27. package/lib/cjs/presentation-common/RegisteredRuleset.js +6 -1
  28. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  29. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  30. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  31. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  32. package/lib/cjs/presentation-common/Update.js.map +1 -1
  33. package/lib/cjs/presentation-common/Utils.d.ts +9 -0
  34. package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
  35. package/lib/cjs/presentation-common/Utils.js +17 -0
  36. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  37. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  38. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  39. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +1 -1
  40. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  41. package/lib/cjs/presentation-common/content/ContentTraverser.js +95 -16
  42. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  43. package/lib/cjs/presentation-common/content/Descriptor.d.ts.map +1 -1
  44. package/lib/cjs/presentation-common/content/Descriptor.js +22 -11
  45. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  46. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  47. package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
  48. package/lib/cjs/presentation-common/content/Fields.d.ts +111 -8
  49. package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
  50. package/lib/cjs/presentation-common/content/Fields.js +137 -98
  51. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  52. package/lib/cjs/presentation-common/content/Item.d.ts +19 -0
  53. package/lib/cjs/presentation-common/content/Item.d.ts.map +1 -1
  54. package/lib/cjs/presentation-common/content/Item.js +37 -30
  55. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  56. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  57. package/lib/cjs/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  58. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +31 -23
  59. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  60. package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
  61. package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
  62. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  63. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  64. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  65. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  66. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  67. package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
  68. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  69. package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
  70. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  71. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  72. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  73. package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
  74. package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
  75. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  76. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  77. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  78. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  79. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  80. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  81. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  82. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  83. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  84. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  85. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  86. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  87. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  88. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js.map +1 -1
  89. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  90. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  91. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  92. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js.map +1 -1
  93. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  94. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js.map +1 -1
  95. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  96. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js.map +1 -1
  97. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  98. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  99. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  100. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  101. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  102. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  103. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  104. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  105. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  106. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  107. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  108. package/lib/cjs/presentation-common.d.ts +1 -1
  109. package/lib/cjs/presentation-common.d.ts.map +1 -1
  110. package/lib/cjs/presentation-common.js +4 -1
  111. package/lib/cjs/presentation-common.js.map +1 -1
  112. package/lib/esm/presentation-common/AsyncTasks.d.ts +4 -4
  113. package/lib/esm/presentation-common/AsyncTasks.d.ts.map +1 -1
  114. package/lib/esm/presentation-common/AsyncTasks.js +4 -3
  115. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  116. package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
  117. package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
  118. package/lib/esm/presentation-common/EC.d.ts +31 -0
  119. package/lib/esm/presentation-common/EC.d.ts.map +1 -1
  120. package/lib/esm/presentation-common/EC.js.map +1 -1
  121. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  122. package/lib/esm/presentation-common/Error.js.map +1 -1
  123. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  124. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  125. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  126. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  127. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  128. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  129. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +29 -8
  130. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  131. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  132. package/lib/esm/presentation-common/PresentationRpcInterface.js +4 -4
  133. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  134. package/lib/esm/presentation-common/RegisteredRuleset.d.ts +3 -2
  135. package/lib/esm/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  136. package/lib/esm/presentation-common/RegisteredRuleset.js +6 -1
  137. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  138. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  139. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  140. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  141. package/lib/esm/presentation-common/Update.js.map +1 -1
  142. package/lib/esm/presentation-common/Utils.d.ts +9 -0
  143. package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
  144. package/lib/esm/presentation-common/Utils.js +16 -0
  145. package/lib/esm/presentation-common/Utils.js.map +1 -1
  146. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  147. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  148. package/lib/esm/presentation-common/content/ContentTraverser.d.ts +1 -1
  149. package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  150. package/lib/esm/presentation-common/content/ContentTraverser.js +96 -17
  151. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  152. package/lib/esm/presentation-common/content/Descriptor.d.ts.map +1 -1
  153. package/lib/esm/presentation-common/content/Descriptor.js +22 -11
  154. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  155. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  156. package/lib/esm/presentation-common/content/Editor.js.map +1 -1
  157. package/lib/esm/presentation-common/content/Fields.d.ts +111 -8
  158. package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
  159. package/lib/esm/presentation-common/content/Fields.js +137 -98
  160. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  161. package/lib/esm/presentation-common/content/Item.d.ts +19 -0
  162. package/lib/esm/presentation-common/content/Item.d.ts.map +1 -1
  163. package/lib/esm/presentation-common/content/Item.js +37 -30
  164. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  165. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  166. package/lib/esm/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  167. package/lib/esm/presentation-common/content/PropertyValueFormatter.js +31 -23
  168. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  169. package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
  170. package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
  171. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  172. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  173. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  174. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  175. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  176. package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
  177. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  178. package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
  179. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  180. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  181. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  182. package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
  183. package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
  184. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  185. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  186. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  187. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  188. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  189. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  190. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  191. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  192. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  193. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  194. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  195. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  196. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  197. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js.map +1 -1
  198. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  199. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  200. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  201. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js.map +1 -1
  202. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  203. package/lib/esm/presentation-common/rules/customization/LabelOverride.js.map +1 -1
  204. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  205. package/lib/esm/presentation-common/rules/customization/StyleOverride.js.map +1 -1
  206. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  207. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  208. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  209. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  210. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  211. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  212. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  213. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  214. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  215. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  216. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  217. package/lib/esm/presentation-common.d.ts +1 -1
  218. package/lib/esm/presentation-common.d.ts.map +1 -1
  219. package/lib/esm/presentation-common.js +1 -1
  220. package/lib/esm/presentation-common.js.map +1 -1
  221. package/lib/public/locales/en/Presentation.json +19 -19
  222. package/package.json +12 -12
@@ -12,6 +12,7 @@ const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const EC_1 = require("../EC");
13
13
  const Error_1 = require("../Error");
14
14
  const RelatedPropertiesSpecification_1 = require("../rules/content/modifiers/RelatedPropertiesSpecification");
15
+ const Utils_1 = require("../Utils");
15
16
  const Property_1 = require("./Property");
16
17
  function isPropertiesField(field) {
17
18
  return !!field.properties;
@@ -32,28 +33,30 @@ function isNestedContentField(field) {
32
33
  * @public
33
34
  */
34
35
  class Field {
35
- /**
36
- * Creates an instance of Field.
37
- * @param category Category information
38
- * @param name Unique name
39
- * @param label Display label
40
- * @param type Description of this field's values data type
41
- * @param isReadonly Are values in this field read-only
42
- * @param priority Priority of the field
43
- * @param editor Property editor used to edit values of this field
44
- * @param renderer Property renderer used to render values of this field
45
- * @param extendedData Extended data associated with this field
46
- */
47
- constructor(category, name, label, type, isReadonly, priority, editor, renderer, extendedData) {
48
- this.category = category;
49
- this.name = name;
50
- this.label = label;
51
- this.type = type;
52
- this.isReadonly = isReadonly;
53
- this.priority = priority;
54
- this.editor = editor;
55
- this.renderer = renderer;
56
- this.extendedData = extendedData;
36
+ constructor(categoryOrProps, name, label, type, isReadonly, priority, editor, renderer, extendedData) {
37
+ /* istanbul ignore next */
38
+ const props = "category" in categoryOrProps
39
+ ? categoryOrProps
40
+ : {
41
+ category: categoryOrProps,
42
+ name: name,
43
+ label: label,
44
+ type: type,
45
+ isReadonly: isReadonly,
46
+ priority: priority,
47
+ editor,
48
+ renderer,
49
+ extendedData,
50
+ };
51
+ this.category = props.category;
52
+ this.name = props.name;
53
+ this.label = props.label;
54
+ this.type = props.type;
55
+ this.isReadonly = props.isReadonly;
56
+ this.priority = props.priority;
57
+ this.editor = props.editor;
58
+ this.renderer = props.renderer;
59
+ this.extendedData = props.extendedData;
57
60
  }
58
61
  /**
59
62
  * Is this a [[PropertiesField]]
@@ -74,13 +77,13 @@ class Field {
74
77
  return this._parent;
75
78
  }
76
79
  clone() {
77
- const clone = new Field(this.category, this.name, this.label, this.type, this.isReadonly, this.priority, this.editor, this.renderer, this.extendedData);
80
+ const clone = new Field(this);
78
81
  clone.rebuildParentship(this.parent);
79
82
  return clone;
80
83
  }
81
84
  /** Serialize this object to JSON */
82
85
  toJSON() {
83
- return {
86
+ return (0, Utils_1.omitUndefined)({
84
87
  category: this.category.name,
85
88
  name: this.name,
86
89
  label: this.label,
@@ -89,8 +92,8 @@ class Field {
89
92
  priority: this.priority,
90
93
  renderer: this.renderer,
91
94
  editor: this.editor,
92
- extendedData: this.extendedData
93
- };
95
+ extendedData: this.extendedData,
96
+ });
94
97
  }
95
98
  /** Serialize this object to compressed JSON */
96
99
  toCompressedJSON(_classesMap) {
@@ -108,8 +111,8 @@ class Field {
108
111
  // eslint-disable-next-line @typescript-eslint/no-deprecated
109
112
  return NestedContentField.fromJSON(json, categories);
110
113
  }
111
- const field = Object.create(Field.prototype);
112
- return Object.assign(field, json, {
114
+ return new Field({
115
+ ...json,
113
116
  category: Field.getCategoryFromFieldJson(json, categories),
114
117
  });
115
118
  }
@@ -124,8 +127,8 @@ class Field {
124
127
  if (isNestedContentField(json)) {
125
128
  return NestedContentField.fromCompressedJSON(json, classesMap, categories);
126
129
  }
127
- const field = Object.create(Field.prototype);
128
- return Object.assign(field, json, {
130
+ return new Field({
131
+ ...json,
129
132
  category: Field.getCategoryFromFieldJson(json, categories),
130
133
  });
131
134
  }
@@ -170,21 +173,23 @@ exports.Field = Field;
170
173
  * @public
171
174
  */
172
175
  class PropertiesField extends Field {
173
- /**
174
- * Creates an instance of PropertiesField.
175
- * @param category Category information
176
- * @param name Unique name
177
- * @param label Display label
178
- * @param type Description of this field's values data type
179
- * @param isReadonly Are values in this field read-only
180
- * @param priority Priority of the field
181
- * @param properties A list of properties this field is created from
182
- * @param editor Property editor used to edit values of this field
183
- * @param renderer Property renderer used to render values of this field
184
- */
185
- constructor(category, name, label, description, isReadonly, priority, properties, editor, renderer) {
186
- super(category, name, label, description, isReadonly, priority, editor, renderer);
187
- this.properties = properties;
176
+ constructor(categoryOrProps, name, label, type, isReadonly, priority, properties, editor, renderer) {
177
+ /* istanbul ignore next */
178
+ const props = "category" in categoryOrProps
179
+ ? categoryOrProps
180
+ : {
181
+ category: categoryOrProps,
182
+ name: name,
183
+ label: label,
184
+ type: type,
185
+ isReadonly: isReadonly,
186
+ priority: priority,
187
+ editor,
188
+ renderer,
189
+ properties: properties,
190
+ };
191
+ super(props);
192
+ this.properties = props.properties;
188
193
  }
189
194
  /** Is this a an array property field */
190
195
  isArrayPropertiesField() {
@@ -195,7 +200,7 @@ class PropertiesField extends Field {
195
200
  return false;
196
201
  }
197
202
  clone() {
198
- const clone = new PropertiesField(this.category, this.name, this.label, this.type, this.isReadonly, this.priority, this.properties, this.editor, this.renderer);
203
+ const clone = new PropertiesField(this);
199
204
  clone.rebuildParentship(this.parent);
200
205
  return clone;
201
206
  }
@@ -224,8 +229,8 @@ class PropertiesField extends Field {
224
229
  if (isStructPropertiesField(json)) {
225
230
  return StructPropertiesField.fromJSON(json, categories);
226
231
  }
227
- const field = Object.create(PropertiesField.prototype);
228
- return Object.assign(field, json, {
232
+ return new PropertiesField({
233
+ ...json,
229
234
  category: this.getCategoryFromFieldJson(json, categories),
230
235
  });
231
236
  }
@@ -240,8 +245,8 @@ class PropertiesField extends Field {
240
245
  if (isStructPropertiesField(json)) {
241
246
  return StructPropertiesField.fromCompressedJSON(json, classesMap, categories);
242
247
  }
243
- const field = Object.create(PropertiesField.prototype);
244
- return Object.assign(field, json, {
248
+ return new PropertiesField({
249
+ ...json,
245
250
  category: this.getCategoryFromFieldJson(json, categories),
246
251
  properties: json.properties.map((propertyJson) => fromCompressedPropertyJSON(propertyJson, classesMap)),
247
252
  });
@@ -303,15 +308,30 @@ exports.PropertiesField = PropertiesField;
303
308
  * @public
304
309
  */
305
310
  class ArrayPropertiesField extends PropertiesField {
306
- constructor(category, name, label, description, itemsField, isReadonly, priority, properties, editor, renderer) {
307
- super(category, name, label, description, isReadonly, priority, properties, editor, renderer);
308
- this.itemsField = itemsField;
311
+ constructor(categoryOrProps, name, label, type, itemsField, isReadonly, priority, properties, editor, renderer) {
312
+ /* istanbul ignore next */
313
+ const props = "category" in categoryOrProps
314
+ ? categoryOrProps
315
+ : {
316
+ category: categoryOrProps,
317
+ name: name,
318
+ label: label,
319
+ type: type,
320
+ isReadonly: isReadonly,
321
+ priority: priority,
322
+ editor,
323
+ renderer,
324
+ properties: properties,
325
+ itemsField: itemsField,
326
+ };
327
+ super(props);
328
+ this.itemsField = props.itemsField;
309
329
  }
310
330
  isArrayPropertiesField() {
311
331
  return true;
312
332
  }
313
333
  clone() {
314
- const clone = new ArrayPropertiesField(this.category, this.name, this.label, this.type, this.itemsField.clone(), this.isReadonly, this.priority, this.properties, this.editor, this.renderer);
334
+ const clone = new ArrayPropertiesField(this);
315
335
  clone.rebuildParentship(this.parent);
316
336
  return clone;
317
337
  }
@@ -331,8 +351,8 @@ class ArrayPropertiesField extends PropertiesField {
331
351
  }
332
352
  /** Deserialize [[ArrayPropertiesField]] from JSON */
333
353
  static fromJSON(json, categories) {
334
- const field = Object.create(ArrayPropertiesField.prototype);
335
- return Object.assign(field, json, {
354
+ return new ArrayPropertiesField({
355
+ ...json,
336
356
  category: this.getCategoryFromFieldJson(json, categories),
337
357
  itemsField: PropertiesField.fromJSON(json.itemsField, categories),
338
358
  });
@@ -342,8 +362,8 @@ class ArrayPropertiesField extends PropertiesField {
342
362
  * @public
343
363
  */
344
364
  static fromCompressedJSON(json, classesMap, categories) {
345
- const field = Object.create(ArrayPropertiesField.prototype);
346
- return Object.assign(field, json, {
365
+ return new ArrayPropertiesField({
366
+ ...json,
347
367
  category: this.getCategoryFromFieldJson(json, categories),
348
368
  properties: json.properties.map((propertyJson) => fromCompressedPropertyJSON(propertyJson, classesMap)),
349
369
  itemsField: PropertiesField.fromCompressedJSON(json.itemsField, classesMap, categories),
@@ -356,15 +376,30 @@ exports.ArrayPropertiesField = ArrayPropertiesField;
356
376
  * @public
357
377
  */
358
378
  class StructPropertiesField extends PropertiesField {
359
- constructor(category, name, label, description, memberFields, isReadonly, priority, properties, editor, renderer) {
360
- super(category, name, label, description, isReadonly, priority, properties, editor, renderer);
361
- this.memberFields = memberFields;
379
+ constructor(categoryOrProps, name, label, type, memberFields, isReadonly, priority, properties, editor, renderer) {
380
+ /* istanbul ignore next */
381
+ const props = "category" in categoryOrProps
382
+ ? categoryOrProps
383
+ : {
384
+ category: categoryOrProps,
385
+ name: name,
386
+ label: label,
387
+ type: type,
388
+ isReadonly: isReadonly,
389
+ priority: priority,
390
+ editor,
391
+ renderer,
392
+ properties: properties,
393
+ memberFields: memberFields,
394
+ };
395
+ super(props);
396
+ this.memberFields = props.memberFields;
362
397
  }
363
398
  isStructPropertiesField() {
364
399
  return true;
365
400
  }
366
401
  clone() {
367
- const clone = new StructPropertiesField(this.category, this.name, this.label, this.type, this.memberFields.map((m) => m.clone()), this.isReadonly, this.priority, this.properties, this.editor, this.renderer);
402
+ const clone = new StructPropertiesField(this);
368
403
  clone.rebuildParentship(this.parent);
369
404
  return clone;
370
405
  }
@@ -384,8 +419,8 @@ class StructPropertiesField extends PropertiesField {
384
419
  }
385
420
  /** Deserialize [[StructPropertiesField]] from JSON */
386
421
  static fromJSON(json, categories) {
387
- const field = Object.create(StructPropertiesField.prototype);
388
- return Object.assign(field, json, {
422
+ return new StructPropertiesField({
423
+ ...json,
389
424
  category: this.getCategoryFromFieldJson(json, categories),
390
425
  memberFields: json.memberFields.map((m) => PropertiesField.fromJSON(m, categories)),
391
426
  });
@@ -395,8 +430,8 @@ class StructPropertiesField extends PropertiesField {
395
430
  * @public
396
431
  */
397
432
  static fromCompressedJSON(json, classesMap, categories) {
398
- const field = Object.create(StructPropertiesField.prototype);
399
- return Object.assign(field, json, {
433
+ return new StructPropertiesField({
434
+ ...json,
400
435
  category: this.getCategoryFromFieldJson(json, categories),
401
436
  properties: json.properties.map((propertyJson) => fromCompressedPropertyJSON(propertyJson, classesMap)),
402
437
  memberFields: json.memberFields.map((m) => PropertiesField.fromCompressedJSON(m, classesMap, categories)),
@@ -410,35 +445,37 @@ exports.StructPropertiesField = StructPropertiesField;
410
445
  * @public
411
446
  */
412
447
  class NestedContentField extends Field {
413
- /**
414
- * Creates an instance of NestedContentField.
415
- * @param category Category information
416
- * @param name Unique name
417
- * @param label Display label
418
- * @param type Description of this field's values data type
419
- * @param isReadonly Are values in this field read-only
420
- * @param priority Priority of the field
421
- * @param contentClassInfo Information about an ECClass whose properties are nested inside this field
422
- * @param pathToPrimaryClass Relationship path to [Primary class]($docs/presentation/content/Terminology#primary-class)
423
- * @param nestedFields Contained nested fields
424
- * @param editor Property editor used to edit values of this field
425
- * @param autoExpand Flag specifying whether field should be expanded
426
- * @param relationshipMeaning RelationshipMeaning of the field
427
- * @param renderer Property renderer used to render values of this field
428
- */
429
- constructor(category, name, label, description, isReadonly, priority, contentClassInfo, pathToPrimaryClass, nestedFields, editor, autoExpand, renderer) {
430
- super(category, name, label, description, isReadonly, priority, editor, renderer);
431
- this.contentClassInfo = contentClassInfo;
432
- this.pathToPrimaryClass = pathToPrimaryClass;
433
- this.relationshipMeaning = RelatedPropertiesSpecification_1.RelationshipMeaning.RelatedInstance;
434
- this.nestedFields = nestedFields;
435
- this.autoExpand = autoExpand;
436
- this.actualPrimaryClassIds = [];
448
+ constructor(categoryOrProps, name, label, type, isReadonly, priority, contentClassInfo, pathToPrimaryClass, nestedFields, editor, autoExpand, renderer) {
449
+ /* istanbul ignore next */
450
+ const props = "category" in categoryOrProps
451
+ ? categoryOrProps
452
+ : {
453
+ category: categoryOrProps,
454
+ name: name,
455
+ label: label,
456
+ type: type,
457
+ isReadonly: isReadonly,
458
+ priority: priority,
459
+ editor,
460
+ renderer,
461
+ contentClassInfo: contentClassInfo,
462
+ pathToPrimaryClass: pathToPrimaryClass,
463
+ nestedFields: nestedFields,
464
+ autoExpand,
465
+ };
466
+ super(props);
467
+ this.contentClassInfo = props.contentClassInfo;
468
+ this.pathToPrimaryClass = props.pathToPrimaryClass;
469
+ this.relationshipMeaning = props.relationshipMeaning ?? RelatedPropertiesSpecification_1.RelationshipMeaning.RelatedInstance;
470
+ this.nestedFields = props.nestedFields;
471
+ this.autoExpand = props.autoExpand;
472
+ this.actualPrimaryClassIds = props.actualPrimaryClassIds ?? [];
437
473
  }
438
474
  clone() {
439
- const clone = new NestedContentField(this.category, this.name, this.label, this.type, this.isReadonly, this.priority, this.contentClassInfo, this.pathToPrimaryClass, this.nestedFields.map((n) => n.clone()), this.editor, this.autoExpand, this.renderer);
440
- clone.actualPrimaryClassIds = this.actualPrimaryClassIds;
441
- clone.relationshipMeaning = this.relationshipMeaning;
475
+ const clone = new NestedContentField({
476
+ ...this,
477
+ nestedFields: this.nestedFields.map((n) => n.clone()),
478
+ });
442
479
  clone.rebuildParentship(this.parent);
443
480
  return clone;
444
481
  }
@@ -459,7 +496,7 @@ class NestedContentField extends Field {
459
496
  relationshipMeaning: this.relationshipMeaning,
460
497
  actualPrimaryClassIds: this.actualPrimaryClassIds,
461
498
  nestedFields: this.nestedFields.map((field) => field.toJSON()),
462
- autoExpand: this.autoExpand,
499
+ ...(this.autoExpand ? { autoExpand: true } : undefined),
463
500
  };
464
501
  }
465
502
  /** Serialize this object to compressed JSON */
@@ -481,8 +518,9 @@ class NestedContentField extends Field {
481
518
  if (!json) {
482
519
  return undefined;
483
520
  }
484
- const field = Object.create(NestedContentField.prototype);
485
- return Object.assign(field, json, this.fromCommonJSON(json, categories), {
521
+ return new NestedContentField({
522
+ ...json,
523
+ ...this.fromCommonJSON(json, categories),
486
524
  nestedFields: json.nestedFields
487
525
  .map((nestedFieldJson) => Field.fromJSON(nestedFieldJson, categories))
488
526
  .filter((nestedField) => !!nestedField),
@@ -491,8 +529,9 @@ class NestedContentField extends Field {
491
529
  /** Deserialize a [[NestedContentField]] from compressed JSON. */
492
530
  static fromCompressedJSON(json, classesMap, categories) {
493
531
  (0, core_bentley_1.assert)(classesMap.hasOwnProperty(json.contentClassInfo));
494
- const field = Object.create(NestedContentField.prototype);
495
- return Object.assign(field, json, this.fromCommonJSON(json, categories), {
532
+ return new NestedContentField({
533
+ ...json,
534
+ ...this.fromCommonJSON(json, categories),
496
535
  category: this.getCategoryFromFieldJson(json, categories),
497
536
  nestedFields: json.nestedFields
498
537
  .map((nestedFieldJson) => Field.fromCompressedJSON(nestedFieldJson, classesMap, categories))