@itwin/grouping-mapping-widget 0.12.0 → 0.13.0

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 (191) hide show
  1. package/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -1
  2. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  3. package/lib/cjs/widget/components/GroupAction.js +50 -66
  4. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  5. package/lib/cjs/widget/components/GroupAction.scss +0 -18
  6. package/lib/cjs/widget/components/GroupDetails.d.ts +13 -0
  7. package/lib/cjs/widget/components/GroupDetails.js +34 -0
  8. package/lib/cjs/widget/components/GroupDetails.js.map +1 -0
  9. package/lib/cjs/widget/components/GroupDetailsActionPanel.d.ts +8 -0
  10. package/lib/cjs/widget/components/GroupDetailsActionPanel.js +19 -0
  11. package/lib/cjs/widget/components/GroupDetailsActionPanel.js.map +1 -0
  12. package/lib/cjs/widget/components/GroupDetailsStep.d.ts +13 -0
  13. package/lib/cjs/widget/components/GroupDetailsStep.js +25 -0
  14. package/lib/cjs/widget/components/GroupDetailsStep.js.map +1 -0
  15. package/lib/cjs/widget/components/GroupDetailsStep.scss +11 -0
  16. package/lib/cjs/widget/components/Grouping.js +1 -2
  17. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  18. package/lib/cjs/widget/components/GroupingMapping.js +1 -1
  19. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  20. package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +1 -2
  21. package/lib/cjs/widget/components/GroupingMappingHeader.js +9 -2
  22. package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
  23. package/lib/cjs/widget/components/Mapping.js +2 -3
  24. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  25. package/lib/cjs/widget/components/MappingAction.js +1 -1
  26. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  27. package/lib/cjs/widget/components/MappingImportWizardModal.js +1 -1
  28. package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
  29. package/lib/cjs/widget/components/PropertyAction.d.ts +8 -0
  30. package/lib/cjs/widget/components/PropertyAction.js +100 -0
  31. package/lib/cjs/widget/components/PropertyAction.js.map +1 -0
  32. package/lib/cjs/widget/components/PropertyAction.scss +9 -0
  33. package/lib/cjs/widget/components/QueryBuilder.d.ts +1 -1
  34. package/lib/cjs/widget/components/QueryBuilder.js +4 -4
  35. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  36. package/lib/cjs/widget/components/QueryBuilderActionPanel.d.ts +6 -0
  37. package/lib/cjs/widget/components/QueryBuilderActionPanel.js +17 -0
  38. package/lib/cjs/widget/components/QueryBuilderActionPanel.js.map +1 -0
  39. package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +11 -0
  40. package/lib/cjs/widget/components/QueryBuilderCustomUI.js +27 -0
  41. package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -0
  42. package/lib/cjs/widget/components/QueryBuilderStep.d.ts +16 -0
  43. package/lib/cjs/widget/components/QueryBuilderStep.js +30 -0
  44. package/lib/cjs/widget/components/QueryBuilderStep.js.map +1 -0
  45. package/lib/cjs/widget/components/QueryBuilderStep.scss +18 -0
  46. package/lib/cjs/widget/components/SelectMappings.js +1 -1
  47. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  48. package/lib/cjs/widget/components/StatusIcon.d.ts +15 -0
  49. package/lib/cjs/widget/components/StatusIcon.js +26 -0
  50. package/lib/cjs/widget/components/StatusIcon.js.map +1 -0
  51. package/lib/cjs/widget/components/StatusIcon.scss +26 -0
  52. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
  53. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js +0 -2
  54. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
  55. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
  56. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +51 -32
  57. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
  58. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
  59. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
  60. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
  61. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
  62. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +1 -1
  63. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
  64. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
  65. package/lib/cjs/widget/components/utils.d.ts +1 -1
  66. package/lib/cjs/widget/components/utils.js.map +1 -1
  67. package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -1
  68. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  69. package/lib/esm/widget/components/GroupAction.js +53 -69
  70. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  71. package/lib/esm/widget/components/GroupAction.scss +0 -18
  72. package/lib/esm/widget/components/GroupDetails.d.ts +13 -0
  73. package/lib/esm/widget/components/GroupDetails.js +27 -0
  74. package/lib/esm/widget/components/GroupDetails.js.map +1 -0
  75. package/lib/esm/widget/components/GroupDetailsActionPanel.d.ts +8 -0
  76. package/lib/esm/widget/components/GroupDetailsActionPanel.js +12 -0
  77. package/lib/esm/widget/components/GroupDetailsActionPanel.js.map +1 -0
  78. package/lib/esm/widget/components/GroupDetailsStep.d.ts +13 -0
  79. package/lib/esm/widget/components/GroupDetailsStep.js +18 -0
  80. package/lib/esm/widget/components/GroupDetailsStep.js.map +1 -0
  81. package/lib/esm/widget/components/GroupDetailsStep.scss +11 -0
  82. package/lib/esm/widget/components/Grouping.js +1 -2
  83. package/lib/esm/widget/components/Grouping.js.map +1 -1
  84. package/lib/esm/widget/components/GroupingMapping.js +1 -1
  85. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  86. package/lib/esm/widget/components/GroupingMappingHeader.d.ts +1 -2
  87. package/lib/esm/widget/components/GroupingMappingHeader.js +9 -2
  88. package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
  89. package/lib/esm/widget/components/Mapping.js +2 -3
  90. package/lib/esm/widget/components/Mapping.js.map +1 -1
  91. package/lib/esm/widget/components/MappingAction.js +1 -1
  92. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  93. package/lib/esm/widget/components/MappingImportWizardModal.js +1 -1
  94. package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
  95. package/lib/esm/widget/components/PropertyAction.d.ts +8 -0
  96. package/lib/esm/widget/components/PropertyAction.js +77 -0
  97. package/lib/esm/widget/components/PropertyAction.js.map +1 -0
  98. package/lib/esm/widget/components/PropertyAction.scss +9 -0
  99. package/lib/esm/widget/components/QueryBuilder.d.ts +1 -1
  100. package/lib/esm/widget/components/QueryBuilder.js +4 -4
  101. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  102. package/lib/esm/widget/components/QueryBuilderActionPanel.d.ts +6 -0
  103. package/lib/esm/widget/components/QueryBuilderActionPanel.js +10 -0
  104. package/lib/esm/widget/components/QueryBuilderActionPanel.js.map +1 -0
  105. package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +11 -0
  106. package/lib/esm/widget/components/QueryBuilderCustomUI.js +20 -0
  107. package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -0
  108. package/lib/esm/widget/components/QueryBuilderStep.d.ts +16 -0
  109. package/lib/esm/widget/components/QueryBuilderStep.js +23 -0
  110. package/lib/esm/widget/components/QueryBuilderStep.js.map +1 -0
  111. package/lib/esm/widget/components/QueryBuilderStep.scss +18 -0
  112. package/lib/esm/widget/components/SelectMappings.js +1 -1
  113. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  114. package/lib/esm/widget/components/StatusIcon.d.ts +15 -0
  115. package/lib/esm/widget/components/StatusIcon.js +19 -0
  116. package/lib/esm/widget/components/StatusIcon.js.map +1 -0
  117. package/lib/esm/widget/components/StatusIcon.scss +26 -0
  118. package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
  119. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js +0 -2
  120. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
  121. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
  122. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +53 -34
  123. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
  124. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
  125. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
  126. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
  127. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
  128. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +2 -2
  129. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
  130. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
  131. package/lib/esm/widget/components/utils.d.ts +1 -1
  132. package/lib/esm/widget/components/utils.js.map +1 -1
  133. package/package.json +1 -1
  134. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
  135. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -91
  136. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
  137. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
  138. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -62
  139. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
  140. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +0 -67
  141. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +0 -198
  142. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +0 -1
  143. package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +0 -71
  144. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
  145. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +0 -77
  146. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
  147. package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +0 -69
  148. package/lib/cjs/widget/components/property-grid/PropertyList.js +0 -87
  149. package/lib/cjs/widget/components/property-grid/PropertyList.js.map +0 -1
  150. package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +0 -92
  151. package/lib/cjs/widget/components/property-grid/PropertyRender.js +0 -109
  152. package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +0 -1
  153. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +0 -22
  154. package/lib/cjs/widget/components/property-grid/PropertyView.js +0 -232
  155. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +0 -1
  156. package/lib/cjs/widget/components/property-grid/PropertyView.scss +0 -77
  157. package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +0 -8
  158. package/lib/cjs/widget/components/property-grid/countMatchesInString.js +0 -32
  159. package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +0 -1
  160. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
  161. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +0 -65
  162. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
  163. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
  164. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -68
  165. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
  166. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
  167. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -39
  168. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
  169. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +0 -67
  170. package/lib/esm/widget/components/property-grid/PropertyGrid.js +0 -172
  171. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +0 -1
  172. package/lib/esm/widget/components/property-grid/PropertyGrid.scss +0 -71
  173. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
  174. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +0 -54
  175. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
  176. package/lib/esm/widget/components/property-grid/PropertyList.d.ts +0 -69
  177. package/lib/esm/widget/components/property-grid/PropertyList.js +0 -60
  178. package/lib/esm/widget/components/property-grid/PropertyList.js.map +0 -1
  179. package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +0 -92
  180. package/lib/esm/widget/components/property-grid/PropertyRender.js +0 -86
  181. package/lib/esm/widget/components/property-grid/PropertyRender.js.map +0 -1
  182. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +0 -22
  183. package/lib/esm/widget/components/property-grid/PropertyView.js +0 -209
  184. package/lib/esm/widget/components/property-grid/PropertyView.js.map +0 -1
  185. package/lib/esm/widget/components/property-grid/PropertyView.scss +0 -77
  186. package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +0 -8
  187. package/lib/esm/widget/components/property-grid/countMatchesInString.js +0 -28
  188. package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +0 -1
  189. package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
  190. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +0 -42
  191. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
@@ -1,232 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.PropertyView = void 0;
23
- /*---------------------------------------------------------------------------------------------
24
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
- * See LICENSE.md in the project root for license terms and full copyright notice.
26
- *--------------------------------------------------------------------------------------------*/
27
- const react_1 = __importStar(require("react"));
28
- const appui_abstract_1 = require("@itwin/appui-abstract");
29
- const core_react_1 = require("@itwin/core-react");
30
- const components_react_1 = require("@itwin/components-react");
31
- require("./PropertyView.scss");
32
- const PropertyGridColumns_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns");
33
- const itwinui_react_1 = require("@itwin/itwinui-react");
34
- const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
35
- const PropertyGridWrapperContext_1 = require("../context/PropertyGridWrapperContext");
36
- /**
37
- * A React component that renders property as label/value pair
38
- * @public
39
- */
40
- const PropertyView = (props) => {
41
- var _a;
42
- const [isCheckboxLoading, setIsCheckboxLoading] = react_1.useState(false);
43
- const { currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery, isUpdating, } = PropertyGridWrapperContext_1.usePropertyGridWrapper();
44
- const _validatePropertySelection = () => {
45
- if (currentPropertyList.includes(props.propertyRecord)) {
46
- return true;
47
- }
48
- // Check if all subproperties are selected
49
- if (!_validateNestedPropertiesSelection(props.propertyRecord)) {
50
- return false;
51
- }
52
- return true;
53
- };
54
- const _validateNestedPropertiesSelection = (prop) => {
55
- switch (prop.value.valueFormat) {
56
- case appui_abstract_1.PropertyValueFormat.Primitive:
57
- if (!currentPropertyList.includes(prop)) {
58
- return false;
59
- }
60
- break;
61
- case appui_abstract_1.PropertyValueFormat.Array:
62
- if (prop.value.items.length === 0) {
63
- if (!currentPropertyList.includes(prop)) {
64
- return false;
65
- }
66
- }
67
- break;
68
- case appui_abstract_1.PropertyValueFormat.Struct:
69
- for (const subPropName in prop.value.members) {
70
- if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
71
- if (!_validateNestedPropertiesSelection(prop.value.members[subPropName])) {
72
- return false;
73
- }
74
- }
75
- }
76
- }
77
- return true;
78
- };
79
- const [isHovered, setIsHovered] = react_1.useState(false);
80
- const [isPropertySelected, setIsPropertySelected] = react_1.useState(_validatePropertySelection());
81
- const _addSelectedProperty = react_1.useCallback(async (prop) => {
82
- var _a;
83
- // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)
84
- if (!currentPropertyList.includes(prop) &&
85
- prop.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
86
- if (!(await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.addProperty(prop)))) {
87
- setIsCheckboxLoading(false);
88
- setIsPropertySelected(false);
89
- return;
90
- }
91
- setCurrentPropertyList(currentPropertyList.concat(prop));
92
- setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
93
- }
94
- }, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
95
- const _addNestedProperties = react_1.useCallback((prop) => {
96
- switch (prop.value.valueFormat) {
97
- case appui_abstract_1.PropertyValueFormat.Primitive:
98
- void _addSelectedProperty(prop);
99
- break;
100
- case appui_abstract_1.PropertyValueFormat.Array:
101
- if (prop.value.items.length === 0) {
102
- void _addSelectedProperty(prop);
103
- }
104
- break;
105
- case appui_abstract_1.PropertyValueFormat.Struct:
106
- for (const subPropName in prop.value.members) {
107
- if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
108
- _addNestedProperties(prop.value.members[subPropName]);
109
- }
110
- }
111
- }
112
- }, [_addSelectedProperty]);
113
- const _removeSelectedProperty = react_1.useCallback(async (prop) => {
114
- var _a;
115
- if (currentPropertyList.includes(prop)) {
116
- setCurrentPropertyList(currentPropertyList.filter((x) => x !== prop));
117
- await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.removeProperty(prop));
118
- setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
119
- }
120
- }, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
121
- const _removeNestedProperties = react_1.useCallback((prop) => {
122
- switch (prop.value.valueFormat) {
123
- case appui_abstract_1.PropertyValueFormat.Primitive:
124
- void _removeSelectedProperty(prop);
125
- break;
126
- case appui_abstract_1.PropertyValueFormat.Array:
127
- if (prop.value.items.length === 0) {
128
- void _removeSelectedProperty(prop);
129
- }
130
- break;
131
- case appui_abstract_1.PropertyValueFormat.Struct:
132
- for (const subPropName in prop.value.members) {
133
- if (Object.prototype.hasOwnProperty.call(prop.value.members, subPropName)) {
134
- _removeNestedProperties(prop.value.members[subPropName]);
135
- }
136
- }
137
- }
138
- }, [_removeSelectedProperty]);
139
- react_1.useEffect(() => {
140
- if (!currentPropertyList.includes(props.propertyRecord)) {
141
- setIsPropertySelected(false);
142
- }
143
- }, [currentPropertyList, props.propertyRecord]);
144
- react_1.useEffect(() => {
145
- if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
146
- if (isPropertySelected) {
147
- if (isUpdating) {
148
- setIsCheckboxLoading(true);
149
- }
150
- _addNestedProperties(props.propertyRecord);
151
- }
152
- else {
153
- _removeNestedProperties(props.propertyRecord);
154
- }
155
- }
156
- }, [
157
- _addNestedProperties,
158
- _removeNestedProperties,
159
- isPropertySelected,
160
- props.propertyRecord,
161
- isUpdating,
162
- ]);
163
- react_1.useEffect(() => {
164
- if (!isUpdating) {
165
- setIsCheckboxLoading(false);
166
- }
167
- }, [isUpdating]);
168
- const _onPropertySelectionChanged = () => {
169
- setIsPropertySelected(!isPropertySelected);
170
- };
171
- const _onClick = () => {
172
- if (props.onClick) {
173
- props.onClick(props.propertyRecord, props.uniqueKey);
174
- }
175
- };
176
- const _onMouseEnter = () => {
177
- if (props.isHoverable) {
178
- setIsHovered(true);
179
- }
180
- };
181
- const _onMouseLeave = () => {
182
- if (props.isHoverable) {
183
- setIsHovered(false);
184
- }
185
- };
186
- const _onContextMenu = (e) => {
187
- if (props.onContextMenu) {
188
- props.onContextMenu(props.propertyRecord, e);
189
- }
190
- if (props.onRightClick) {
191
- props.onRightClick(props.propertyRecord, props.uniqueKey);
192
- }
193
- e.preventDefault();
194
- return false;
195
- };
196
- const getClassName = (viewProps) => {
197
- let propertyRecordClassName = viewProps.orientation === core_react_1.Orientation.Horizontal
198
- ? "gmw-components-property-record--horizontal"
199
- : "gmw-components-property-record--vertical";
200
- if (viewProps.isSelected) {
201
- propertyRecordClassName += " components--selected";
202
- }
203
- if (viewProps.onClick) {
204
- propertyRecordClassName += " components--clickable";
205
- }
206
- if (viewProps.isHoverable) {
207
- propertyRecordClassName += " components--hoverable";
208
- }
209
- return propertyRecordClassName;
210
- };
211
- const ratio = props.columnRatio ? props.columnRatio : 0.25;
212
- const needElementSeparator = props.orientation === core_react_1.Orientation.Horizontal &&
213
- !!props.onColumnRatioChanged;
214
- const needActionButtons = !!props.actionButtonRenderers;
215
- const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
216
- const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(props.indentation, props.orientation, props.width, props.columnRatio, (_a = props.columnInfo) === null || _a === void 0 ? void 0 : _a.minLabelWidth);
217
- return (react_1.default.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role: "presentation" },
218
- react_1.default.createElement("div", { className: "gmw-components-property-record-label" },
219
- props.propertyRecord.value.valueFormat ===
220
- appui_abstract_1.PropertyValueFormat.Primitive && (react_1.default.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: isUpdating ||
221
- props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
222
- props.labelElement),
223
- needElementSeparator ? (react_1.default.createElement(core_react_1.ElementSeparator, { movableArea: props.width, onRatioChanged: props.onColumnRatioChanged, ratio: ratio, orientation: props.orientation, isResizeHandleHovered: props.isResizeHandleHovered, onResizeHandleHoverChanged: props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: props.isResizeHandleBeingDragged, onResizeHandleDragChanged: props.onResizeHandleDragChanged })) : undefined,
224
- props.propertyRecord.value.valueFormat ===
225
- appui_abstract_1.PropertyValueFormat.Primitive ? (react_1.default.createElement("div", { className: "gmw-components-property-record-value" },
226
- react_1.default.createElement("span", null, props.valueElementRenderer
227
- ? props.valueElementRenderer()
228
- : props.valueElement))) : undefined,
229
- props.actionButtonRenderers ? (react_1.default.createElement(components_react_1.ActionButtonList, { orientation: props.orientation, property: props.propertyRecord, isPropertyHovered: isHovered, actionButtonRenderers: props.actionButtonRenderers })) : undefined));
230
- };
231
- exports.PropertyView = PropertyView;
232
- //# sourceMappingURL=PropertyView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PropertyView.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,+CAAgE;A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EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,iBAAiB,EAAE,SAAS,EAC5B,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAClD,CACH,CAAC,CAAC,CAAC,SAAS,CACT,CACP,CAAC;AACJ,CAAC,CAAC;AAvTW,QAAA,YAAY,gBAuTvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { ElementSeparator, Orientation } from \"@itwin/core-react\";\nimport { ActionButtonList } from \"@itwin/components-react\";\nimport \"./PropertyView.scss\";\nimport type { SharedRendererProps } from \"./PropertyRender\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { usePropertyGridWrapper } from \"../context/PropertyGridWrapperContext\";\n\n/** Properties of [[PropertyView]] React component\n * @public\n */\nexport interface PropertyViewProps extends SharedRendererProps {\n /** Property label as a React element */\n labelElement: React.ReactNode;\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n}\n\n/**\n * A React component that renders property as label/value pair\n * @public\n */\nexport const PropertyView = (props: PropertyViewProps) => {\n const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);\n const {\n currentPropertyList,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n isUpdating,\n } = usePropertyGridWrapper();\n\n const _validatePropertySelection = () => {\n if (currentPropertyList.includes(props.propertyRecord)) {\n return true;\n }\n // Check if all subproperties are selected\n if (!_validateNestedPropertiesSelection(props.propertyRecord)) {\n return false;\n }\n return true;\n };\n\n const _validateNestedPropertiesSelection = (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n if (!currentPropertyList.includes(prop)) {\n return false;\n }\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n if (!currentPropertyList.includes(prop)) {\n return false;\n }\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n if (\n !_validateNestedPropertiesSelection(\n prop.value.members[subPropName]\n )\n ) {\n return false;\n }\n }\n }\n }\n return true;\n };\n\n const [isHovered, setIsHovered] = useState<boolean>(false);\n const [isPropertySelected, setIsPropertySelected] = useState<boolean>(\n _validatePropertySelection()\n );\n\n const _addSelectedProperty = useCallback(\n async (prop: PropertyRecord) => {\n // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)\n if (\n !currentPropertyList.includes(prop) &&\n prop.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n if (!(await queryBuilder?.addProperty(prop))) {\n setIsCheckboxLoading(false);\n setIsPropertySelected(false);\n return;\n }\n setCurrentPropertyList(\n currentPropertyList.concat(prop)\n );\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n },\n [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]\n );\n\n const _addNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _addSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _addSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _addNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_addSelectedProperty]\n );\n\n const _removeSelectedProperty = useCallback(\n async (prop: PropertyRecord): Promise<void> => {\n if (currentPropertyList.includes(prop)) {\n setCurrentPropertyList(\n currentPropertyList.filter((x: PropertyRecord) => x !== prop)\n );\n await queryBuilder?.removeProperty(prop);\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n },\n [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]\n );\n\n const _removeNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _removeSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _removeSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _removeNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_removeSelectedProperty]\n );\n\n useEffect(() => {\n if (!currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(false);\n }\n }, [currentPropertyList, props.propertyRecord]);\n\n useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n if (isUpdating) {\n setIsCheckboxLoading(true);\n }\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n isUpdating,\n ]);\n\n useEffect(() => {\n if (!isUpdating) {\n setIsCheckboxLoading(false);\n }\n }, [isUpdating]);\n\n const _onPropertySelectionChanged = () => {\n setIsPropertySelected(!isPropertySelected);\n };\n\n const _onClick = () => {\n if (props.onClick) {\n props.onClick(props.propertyRecord, props.uniqueKey);\n }\n };\n\n const _onMouseEnter = () => {\n if (props.isHoverable) {\n setIsHovered(true);\n }\n };\n\n const _onMouseLeave = () => {\n if (props.isHoverable) {\n setIsHovered(false);\n }\n };\n\n const _onContextMenu = (e: React.MouseEvent) => {\n if (props.onContextMenu) {\n props.onContextMenu(props.propertyRecord, e);\n }\n if (props.onRightClick) {\n props.onRightClick(props.propertyRecord, props.uniqueKey);\n }\n e.preventDefault();\n return false;\n };\n\n const getClassName = (viewProps: PropertyViewProps) => {\n let propertyRecordClassName =\n viewProps.orientation === Orientation.Horizontal\n ? \"gmw-components-property-record--horizontal\"\n : \"gmw-components-property-record--vertical\";\n if (viewProps.isSelected) {\n propertyRecordClassName += \" components--selected\";\n }\n if (viewProps.onClick) {\n propertyRecordClassName += \" components--clickable\";\n }\n if (viewProps.isHoverable) {\n propertyRecordClassName += \" components--hoverable\";\n }\n return propertyRecordClassName;\n };\n\n const ratio = props.columnRatio ? props.columnRatio : 0.25;\n const needElementSeparator =\n props.orientation === Orientation.Horizontal &&\n !!props.onColumnRatioChanged;\n const needActionButtons = !!props.actionButtonRenderers;\n const columnsStyleProvider = new PropertyGridColumnStyleProvider(\n props.columnInfo\n );\n\n const offset = CommonPropertyRenderer.getLabelOffset(\n props.indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\n );\n\n return (\n <div\n style={columnsStyleProvider.getStyle(\n props.orientation,\n needActionButtons,\n ratio,\n needElementSeparator\n )}\n className={getClassName(props)}\n onClick={_onClick}\n onContextMenu={_onContextMenu}\n onMouseEnter={_onMouseEnter}\n onMouseLeave={_onMouseLeave}\n role=\"presentation\"\n >\n <div className=\"gmw-components-property-record-label\">\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className=\"gmw-components-property-selection-checkbox\"\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={\n isUpdating ||\n props.propertyRecord.value.value === undefined\n }\n isLoading={isCheckboxLoading}\n />\n )}\n {props.labelElement}\n </div>\n {needElementSeparator ? (\n <ElementSeparator\n movableArea={props.width}\n onRatioChanged={props.onColumnRatioChanged}\n ratio={ratio}\n orientation={props.orientation}\n isResizeHandleHovered={props.isResizeHandleHovered}\n onResizeHandleHoverChanged={props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={props.onResizeHandleDragChanged}\n />\n ) : undefined}\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive ? (\n <div className=\"gmw-components-property-record-value\">\n <span>\n {props.valueElementRenderer\n ? props.valueElementRenderer()\n : props.valueElement}\n </span>\n </div>\n ) : undefined}\n {props.actionButtonRenderers ? (\n <ActionButtonList\n orientation={props.orientation}\n property={props.propertyRecord}\n isPropertyHovered={isHovered}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n ) : undefined}\n </div>\n );\n};\n"]}
@@ -1,77 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import '~@itwin/core-react/lib/cjs/core-react/style/themecolors';
6
- @import '~@itwin/itwinui-css/scss/style/typography';
7
- @import '~@itwin/itwinui-css/scss/variables';
8
-
9
- $text-font-size: $iui-font-size;
10
- $text-font-color: $buic-text-color;
11
-
12
- .gmw-components-property-record--horizontal {
13
- height: 100%;
14
- display: grid;
15
- padding: 0 8px;
16
-
17
- .gmw-components-property-record-label {
18
- font-size: $iui-font-size-small;
19
- color: $buic-foreground-muted;
20
- }
21
-
22
- .gmw-components-property-record-value {
23
- min-height: 24px;
24
- font-size: $text-font-size;
25
- color: $text-font-color;
26
- padding: 0px 5px;
27
- }
28
- }
29
-
30
- .gmw-components-property-record--vertical {
31
- height: 100%;
32
- padding: 0 8px;
33
- display: grid;
34
- align-content: center;
35
-
36
- .gmw-components-property-record-label {
37
- font-size: $iui-font-size-small;
38
- color: $buic-foreground-muted;
39
- }
40
-
41
- .gmw-components-property-record-value {
42
- min-height: 22px;
43
- font-size: $text-font-size;
44
- color: $text-font-color;
45
- }
46
- }
47
-
48
- @mixin gmw-record-cell {
49
- display: flex;
50
- align-items: center;
51
- }
52
-
53
- .gmw-components-property-record-label {
54
- @include gmw-record-cell;
55
- position: relative;
56
- .gmw-components-property-selection-checkbox {
57
- flex-shrink: 0;
58
- position: absolute;
59
- z-index: 1;
60
- }
61
- // Radial does not respect checkbox positioning, have to force it.
62
- > .gmw-iui-progress-indicator-radial {
63
- position: absolute;
64
- }
65
- }
66
-
67
- .gmw-components-property-record-value {
68
- @include gmw-record-cell;
69
- overflow: hidden;
70
-
71
- span {
72
- white-space: nowrap;
73
- overflow: hidden;
74
- text-overflow: ellipsis;
75
- width: 100%;
76
- }
77
- }
@@ -1,8 +0,0 @@
1
- /** @packageDocumentation
2
- * @module Common
3
- */
4
- /** Counts how many times string 'lookup' is repeated in string 'str'.
5
- * @internal
6
- */
7
- export declare function countMatchesInString(str: string, lookup: string): number;
8
- //# sourceMappingURL=countMatchesInString.d.ts.map
@@ -1,32 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /* @author Vitim.us https://gist.github.com/victornpb/7736865 */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.countMatchesInString = void 0;
9
- /** @packageDocumentation
10
- * @module Common
11
- */
12
- /** Counts how many times string 'lookup' is repeated in string 'str'.
13
- * @internal
14
- */
15
- function countMatchesInString(str, lookup) {
16
- if (!str.length || !lookup.length)
17
- return 0;
18
- let n = 0, pos = 0;
19
- const step = lookup.length;
20
- while (true) {
21
- pos = str.indexOf(lookup, pos);
22
- if (pos >= 0) {
23
- ++n;
24
- pos += step;
25
- }
26
- else
27
- break;
28
- }
29
- return n;
30
- }
31
- exports.countMatchesInString = countMatchesInString;
32
- //# sourceMappingURL=countMatchesInString.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"countMatchesInString.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/countMatchesInString.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,gEAAgE;;;AAEhE;;GAEG;AAEH;;GAEG;AACH,SAAgB,oBAAoB,CAAC,GAAW,EAAE,MAAc;IAC9D,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM;QAC/B,OAAO,CAAC,CAAC;IAEX,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IACnB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAE3B,OAAO,IAAI,EAAE;QACX,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,IAAI,CAAC,EAAE;YACZ,EAAE,CAAC,CAAC;YACJ,GAAG,IAAI,IAAI,CAAC;SACb;;YACC,MAAM;KACT;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAhBD,oDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* @author Vitim.us https://gist.github.com/victornpb/7736865 */\n\n/** @packageDocumentation\n * @module Common\n */\n\n/** Counts how many times string 'lookup' is repeated in string 'str'.\n * @internal\n */\nexport function countMatchesInString(str: string, lookup: string) {\n if (!str.length || !lookup.length)\n return 0;\n\n let n = 0, pos = 0;\n const step = lookup.length;\n\n while (true) {\n pos = str.indexOf(lookup, pos);\n if (pos >= 0) {\n ++n;\n pos += step;\n } else\n break;\n }\n return n;\n}\n"]}
@@ -1,10 +0,0 @@
1
- import type { PropertyRecord } from "@itwin/appui-abstract";
2
- import type { HighlightingComponentProps } from "@itwin/components-react";
3
- import { PropertyValueRendererManager } from "@itwin/components-react";
4
- import { Orientation } from "@itwin/core-react";
5
- import * as React from "react";
6
- export declare function createNewDisplayValue(orientation: Orientation, propertyRecord: PropertyRecord, indentation?: number, propertyValueRendererManager?: PropertyValueRendererManager, isExpanded?: boolean, onExpansionToggled?: () => void, onHeightChanged?: (newHeight: number) => void, highlight?: HighlightingComponentProps & {
7
- applyOnLabel: boolean;
8
- applyOnValue: boolean;
9
- }): React.ReactNode;
10
- //# sourceMappingURL=createNewDisplayValue.d.ts.map
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.createNewDisplayValue = void 0;
23
- const components_react_1 = require("@itwin/components-react");
24
- const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
25
- const core_react_1 = require("@itwin/core-react");
26
- const React = __importStar(require("react"));
27
- const countMatchesInString_1 = require("./countMatchesInString");
28
- function createHighlightCallback(highlight, propertyRecord) {
29
- var _a;
30
- const activeMatch = highlight.activeHighlight;
31
- const propertyName = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightedItemIdentifier;
32
- const matchIndex = (_a = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightIndex) !== null && _a !== void 0 ? _a : 0;
33
- let labelMatches;
34
- if (highlight.applyOnLabel) {
35
- labelMatches = countMatchesInString_1.countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);
36
- }
37
- else {
38
- labelMatches = 0;
39
- }
40
- const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;
41
- const highlightCallback = (text) => (React.createElement(components_react_1.HighlightedText, { text: text, activeMatchIndex: activeMatchIndex, searchText: highlight.highlightedText }));
42
- return highlightCallback;
43
- }
44
- function createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
45
- const highlightCallback = (highlight === null || highlight === void 0 ? void 0 : highlight.applyOnValue) ? (createHighlightCallback(highlight, propertyRecord)) : undefined;
46
- const rendererContext = {
47
- orientation,
48
- containerType: components_react_1.PropertyContainerType.PropertyPane,
49
- isExpanded,
50
- onExpansionToggled,
51
- onHeightChanged,
52
- textHighlighter: highlightCallback,
53
- };
54
- let displayValue;
55
- if (propertyValueRendererManager)
56
- displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);
57
- else
58
- displayValue = components_react_1.PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);
59
- // Align value with label if orientation is vertical
60
- if (orientation === core_react_1.Orientation.Vertical)
61
- displayValue = React.createElement("span", { style: { paddingLeft: CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation) } }, displayValue);
62
- return displayValue;
63
- }
64
- exports.createNewDisplayValue = createNewDisplayValue;
65
- //# sourceMappingURL=createNewDisplayValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createNewDisplayValue.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/createNewDisplayValue.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,8DAA+G;AAC/G,yIAAsI;AACtI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SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrH,MAAM,eAAe,GAAiC;QACpD,WAAW;QACX,aAAa,EAAE,wCAAqB,CAAC,YAAY;QACjD,UAAU;QACV,kBAAkB;QAClB,eAAe;QACf,eAAe,EAAE,iBAAiB;KACnC,CAAC;IAEF,IAAI,YAAyC,CAAC;IAC9C,IAAI,4BAA4B;QAC9B,YAAY,GAAG,4BAA4B,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;;QAEpF,YAAY,GAAG,+CAA4B,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAErG,oDAAoD;IACpD,IAAI,WAAW,KAAK,wBAAW,CAAC,QAAQ;QACtC,YAAY,GAAG,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,+CAAsB,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAG,YAAY,CAAQ,CAAC;IAEtI,OAAO,YAAY,CAAC;AACtB,CAAC;AA/BD,sDA+BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps, PropertyValueRendererContext } from \"@itwin/components-react\";\nimport { HighlightedText, PropertyContainerType, PropertyValueRendererManager } from \"@itwin/components-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { Orientation } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { countMatchesInString } from \"./countMatchesInString\";\n\nfunction createHighlightCallback(highlight: HighlightingComponentProps & { applyOnLabel: boolean }, propertyRecord: PropertyRecord) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;\n const highlightCallback = (text: string) => (<HighlightedText text={text} activeMatchIndex={activeMatchIndex} searchText={highlight.highlightedText} />);\n\n return highlightCallback;\n}\n\nexport function createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & { applyOnLabel: boolean, applyOnValue: boolean }\n) {\n const highlightCallback = highlight?.applyOnValue ? (createHighlightCallback(highlight, propertyRecord)) : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = <span style={{ paddingLeft: CommonPropertyRenderer.getLabelOffset(indentation, orientation) }}>{displayValue}</span>;\n\n return displayValue;\n}\n"]}
@@ -1,32 +0,0 @@
1
- import * as React from "react";
2
- import type { PrimitiveRendererProps } from "./PrimitivePropertyRenderer";
3
- /** Properties of [[NonPrimitivePropertyRenderer]] React component
4
- * @public
5
- */
6
- export interface NonPrimitivePropertyRendererProps extends PrimitiveRendererProps {
7
- /** Can struct/array property be collapsed */
8
- isCollapsible?: boolean;
9
- }
10
- /** State of [[NonPrimitivePropertyRenderer]] React component
11
- * @internal
12
- */
13
- interface NonPrimitivePropertyRendererState {
14
- /** Is struct/array property expanded */
15
- isExpanded?: boolean;
16
- }
17
- /** React Component that renders struct and array properties
18
- * @public
19
- */
20
- export declare class NonPrimitivePropertyRenderer extends React.Component<NonPrimitivePropertyRendererProps, NonPrimitivePropertyRendererState> {
21
- /** @internal */
22
- readonly state: NonPrimitivePropertyRendererState;
23
- private _onExpanded;
24
- private _onCollapsed;
25
- private getLabel;
26
- private overrideArrayChildrenNames;
27
- private _renderPropertyForItem;
28
- /** @internal */
29
- render(): JSX.Element;
30
- }
31
- export {};
32
- //# sourceMappingURL=NonPrimitivePropertyRenderer.d.ts.map
@@ -1,68 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import * as React from "react";
6
- import { PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract";
7
- import { CommonPropertyRenderer } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer";
8
- import { NonPrimitivePropertyLabelRenderer } from "@itwin/components-react";
9
- import { PropertyRenderer } from "./PropertyRender";
10
- import { PropertyView } from "./PropertyView";
11
- /** React Component that renders struct and array properties
12
- * @public
13
- */
14
- export class NonPrimitivePropertyRenderer extends React.Component {
15
- constructor() {
16
- super(...arguments);
17
- /** @internal */
18
- this.state = {
19
- /** If it's not collapsible, that means it's expanded by default and can't be collapsed */
20
- isExpanded: !this.props.isCollapsible || this.props.propertyRecord.autoExpand,
21
- };
22
- this._onExpanded = () => {
23
- this.setState({ isExpanded: true });
24
- };
25
- this._onCollapsed = () => {
26
- this.setState({ isExpanded: false });
27
- };
28
- this._renderPropertyForItem = (item) => {
29
- const prefix = this.props.uniqueKey
30
- ? this.props.uniqueKey
31
- : this.props.propertyRecord.property.name;
32
- const uniqueKey = `${prefix}_${item.property.name}`;
33
- return (React.createElement(PropertyRenderer, { key: uniqueKey, uniqueKey: uniqueKey, propertyRecord: item, indentation: this.props.indentation ? this.props.indentation + 1 : 1, orientation: this.props.orientation, columnRatio: this.props.columnRatio, actionButtonRenderers: this.props.actionButtonRenderers, onColumnRatioChanged: this.props.onColumnRatioChanged, width: this.props.width, isResizeHandleHovered: this.props.isResizeHandleHovered, onResizeHandleHoverChanged: this.props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: this.props.isResizeHandleBeingDragged, onResizeHandleDragChanged: this.props.onResizeHandleDragChanged, columnInfo: this.props.columnInfo }));
34
- };
35
- }
36
- getLabel(props, state) {
37
- const { orientation, indentation, width, columnRatio, columnInfo } = props;
38
- const offset = CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, columnInfo === null || columnInfo === void 0 ? void 0 : columnInfo.minLabelWidth);
39
- let displayLabel = props.propertyRecord.property.displayLabel;
40
- if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array) {
41
- displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;
42
- }
43
- return (React.createElement(NonPrimitivePropertyLabelRenderer, { isExpanded: !!state.isExpanded, onExpand: this._onExpanded, onCollapse: this._onCollapsed, offset: offset, renderColon: false }, displayLabel));
44
- }
45
- overrideArrayChildrenNames(items) {
46
- const modifiedProperties = items.map((item, index) => {
47
- const newProperty = { ...item.property };
48
- newProperty.displayLabel = `[${index + 1}]`;
49
- newProperty.name = `${newProperty.name}_${index}`;
50
- return new PropertyRecord(item.value, newProperty);
51
- });
52
- return modifiedProperties;
53
- }
54
- /** @internal */
55
- render() {
56
- let items = this.props.propertyRecord.getChildrenRecords();
57
- if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array) {
58
- items = this.overrideArrayChildrenNames(items);
59
- }
60
- const { ...props } = this.props;
61
- return (React.createElement(React.Fragment, null,
62
- this.props.isCollapsible ? (React.createElement(PropertyView, { labelElement: this.getLabel(this.props, this.state), ...props })) : undefined,
63
- this.state.isExpanded
64
- ? items.map(this._renderPropertyForItem)
65
- : undefined));
66
- }
67
- }
68
- //# sourceMappingURL=NonPrimitivePropertyRenderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8FAA8F,CAAC;AACtI,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoB9C;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK,CAAC,SAGvD;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAsC;YAClE,0FAA0F;YAC1F,UAAU,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;SACpE,CAAC;QAEM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QAEM,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;QAgDM,2BAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS;gBACjC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS;gBACtB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC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CAAC,CAAC;SAChD;QAED,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,OAAO,CACL;YACG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAC1B,oBAAC,YAAY,IACX,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAC/C,KAAK,GACT,CACH,CAAC,CAAC,CAAC,SAAS;YAEZ,IAAI,CAAC,KAAK,CAAC,UAAU;gBACpB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC;gBACxC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { NonPrimitivePropertyLabelRenderer } from \"@itwin/components-react\";\nimport { PropertyRenderer } from \"./PropertyRender\";\nimport { PropertyView } from \"./PropertyView\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\n\n/** Properties of [[NonPrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface NonPrimitivePropertyRendererProps\n extends PrimitiveRendererProps {\n /** Can struct/array property be collapsed */\n isCollapsible?: boolean;\n}\n\n/** State of [[NonPrimitivePropertyRenderer]] React component\n * @internal\n */\ninterface NonPrimitivePropertyRendererState {\n /** Is struct/array property expanded */\n isExpanded?: boolean;\n}\n\n/** React Component that renders struct and array properties\n * @public\n */\nexport class NonPrimitivePropertyRenderer extends React.Component<\nNonPrimitivePropertyRendererProps,\nNonPrimitivePropertyRendererState\n> {\n /** @internal */\n public override readonly state: NonPrimitivePropertyRendererState = {\n /** If it's not collapsible, that means it's expanded by default and can't be collapsed */\n isExpanded:\n !this.props.isCollapsible || this.props.propertyRecord.autoExpand,\n };\n\n private _onExpanded = () => {\n this.setState({ isExpanded: true });\n };\n\n private _onCollapsed = () => {\n this.setState({ isExpanded: false });\n };\n\n private getLabel(\n props: NonPrimitivePropertyRendererProps,\n state: NonPrimitivePropertyRendererState,\n ): React.ReactNode {\n const { orientation, indentation, width, columnRatio, columnInfo } = props;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n columnInfo?.minLabelWidth,\n );\n\n let displayLabel = props.propertyRecord.property.displayLabel;\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n ) {\n displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;\n }\n\n return (\n <NonPrimitivePropertyLabelRenderer\n isExpanded={!!state.isExpanded}\n onExpand={this._onExpanded}\n onCollapse={this._onCollapsed}\n offset={offset}\n renderColon={false}\n >\n {displayLabel}\n </NonPrimitivePropertyLabelRenderer>\n );\n }\n\n private overrideArrayChildrenNames(items: PropertyRecord[]) {\n const modifiedProperties: PropertyRecord[] = items.map(\n (item, index): PropertyRecord => {\n const newProperty = { ...item.property };\n newProperty.displayLabel = `[${index + 1}]`;\n newProperty.name = `${newProperty.name}_${index}`;\n return new PropertyRecord(item.value, newProperty);\n },\n );\n\n return modifiedProperties;\n }\n\n private _renderPropertyForItem = (item: PropertyRecord) => {\n const prefix = this.props.uniqueKey\n ? this.props.uniqueKey\n : this.props.propertyRecord.property.name;\n const uniqueKey = `${prefix}_${item.property.name}`;\n return (\n <PropertyRenderer\n key={uniqueKey}\n uniqueKey={uniqueKey}\n propertyRecord={item}\n indentation={this.props.indentation ? this.props.indentation + 1 : 1}\n orientation={this.props.orientation}\n columnRatio={this.props.columnRatio}\n actionButtonRenderers={this.props.actionButtonRenderers}\n onColumnRatioChanged={this.props.onColumnRatioChanged}\n width={this.props.width}\n isResizeHandleHovered={this.props.isResizeHandleHovered}\n onResizeHandleHoverChanged={this.props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={this.props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={this.props.onResizeHandleDragChanged}\n columnInfo={this.props.columnInfo}\n />\n );\n };\n\n /** @internal */\n public override render() {\n let items: PropertyRecord[] =\n this.props.propertyRecord.getChildrenRecords();\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n ) {\n items = this.overrideArrayChildrenNames(items);\n }\n\n const { ...props } = this.props;\n return (\n <>\n {this.props.isCollapsible ? (\n <PropertyView\n labelElement={this.getLabel(this.props, this.state)}\n {...props}\n />\n ) : undefined}\n\n {this.state.isExpanded\n ? items.map(this._renderPropertyForItem)\n : undefined}\n </>\n );\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import * as React from "react";
2
- import type { HighlightingComponentProps } from "@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps";
3
- import type { SharedRendererProps } from "./PropertyRender";
4
- /** Properties of [[PrimitivePropertyRenderer]] React component
5
- * @public
6
- */
7
- export interface PrimitiveRendererProps extends SharedRendererProps {
8
- /** Property value as a React element */
9
- valueElement?: React.ReactNode;
10
- /** Render callback for property value. If specified, `valueElement` is ignored. */
11
- valueElementRenderer?: () => React.ReactNode;
12
- /** Multiplier of how much the property is indented to the right */
13
- indentation?: number;
14
- /** Properties used for highlighting
15
- * @beta
16
- */
17
- highlight?: HighlightingComponentProps;
18
- }
19
- /** React Component that renders primitive properties
20
- * @public
21
- */
22
- export declare class PrimitivePropertyRenderer extends React.Component<PrimitiveRendererProps> {
23
- /** @internal */
24
- render(): JSX.Element;
25
- }
26
- //# sourceMappingURL=PrimitivePropertyRenderer.d.ts.map