@itwin/components-react 4.0.0 → 4.0.1
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.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
- package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +2 -4
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +3 -4
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js +2 -4
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +2 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +1 -2
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +4 -7
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +46 -51
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +8 -4
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +3 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +4 -7
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
- package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +1 -2
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +2 -4
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +3 -4
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.js +2 -4
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +2 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +1 -2
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +4 -7
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +46 -51
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +8 -4
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +3 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +4 -7
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/package.json +5 -5
|
@@ -32,7 +32,6 @@ const [PropertyGridInternalContextProvider, _PropertyGridInternalContextConsumer
|
|
|
32
32
|
export class VirtualizedPropertyGrid extends React.Component {
|
|
33
33
|
/** @internal */
|
|
34
34
|
constructor(props) {
|
|
35
|
-
var _a;
|
|
36
35
|
super(props);
|
|
37
36
|
this._listRef = React.createRef();
|
|
38
37
|
this._handleNodeHeightChange = (index, key, newHeight) => {
|
|
@@ -57,14 +56,13 @@ export class VirtualizedPropertyGrid extends React.Component {
|
|
|
57
56
|
};
|
|
58
57
|
this.state = {
|
|
59
58
|
gridItems: [],
|
|
60
|
-
orientation:
|
|
59
|
+
orientation: props.orientation ?? Orientation.Horizontal,
|
|
61
60
|
dynamicNodeHeights: new Map(),
|
|
62
61
|
resetIndex: 0,
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
64
|
/** @internal */
|
|
66
65
|
componentDidUpdate(prevProps, prevState) {
|
|
67
|
-
var _a;
|
|
68
66
|
if (this.props.orientation !== prevProps.orientation
|
|
69
67
|
|| this.props.isOrientationFixed !== prevProps.isOrientationFixed
|
|
70
68
|
|| this.props.horizontalOrientationMinWidth !== prevProps.horizontalOrientationMinWidth
|
|
@@ -75,7 +73,7 @@ export class VirtualizedPropertyGrid extends React.Component {
|
|
|
75
73
|
if (this._listRef.current)
|
|
76
74
|
this._listRef.current.resetAfterIndex(0);
|
|
77
75
|
}
|
|
78
|
-
if (this.props.highlight !== prevProps.highlight &&
|
|
76
|
+
if (this.props.highlight !== prevProps.highlight && this.props.highlight?.activeHighlight && this.state.gridItems.length !== 0) {
|
|
79
77
|
let index = 0;
|
|
80
78
|
let foundMatchingItem = false;
|
|
81
79
|
for (const item of this.state.gridItems) {
|
|
@@ -153,49 +151,46 @@ export class VirtualizedPropertyGrid extends React.Component {
|
|
|
153
151
|
}
|
|
154
152
|
/** @internal */
|
|
155
153
|
render() {
|
|
156
|
-
return React.createElement(ColumnResizingPropertyListPropsSupplier, { orientation: this.state.orientation, width: this.props.width, minLabelWidth: this.props.minLabelWidth, minValueWidth: this.props.minValueWidth, actionButtonWidth: this.props.actionButtonWidth }, (columnResizeContext) => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
React.createElement(VariableSizeList, { className: classnames("components-property-grid-wrapper", "ReactWindow__VariableSizeList", this.props.className), width: this.props.width, height: this.props.height, itemCount: this.state.gridItems.length, itemSize: this._calculateNodeHeightByIndex, estimatedItemSize: this.calculateEstimatedHeight(), overscanCount: 10, layout: "vertical", style: this.props.style, itemKey: this._getNodeKey, ref: this._listRef }, FlatGridItemNode))));
|
|
197
|
-
}));
|
|
198
|
-
});
|
|
154
|
+
return React.createElement(ColumnResizingPropertyListPropsSupplier, { orientation: this.state.orientation, width: this.props.width, minLabelWidth: this.props.minLabelWidth, minValueWidth: this.props.minValueWidth, actionButtonWidth: this.props.actionButtonWidth }, (columnResizeContext) => (React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: this.props.isPropertySelectionEnabled ?? false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged, isPropertyHoverEnabled: this.props.isPropertyHoverEnabled ?? false }, (selectionContext) => {
|
|
155
|
+
const gridContext = {
|
|
156
|
+
orientation: columnResizeContext.orientation,
|
|
157
|
+
gridWidth: this.props.width,
|
|
158
|
+
isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,
|
|
159
|
+
isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,
|
|
160
|
+
selectedPropertyKey: selectionContext.selectedPropertyKey,
|
|
161
|
+
onPropertyClicked: selectionContext.onPropertyClicked,
|
|
162
|
+
onPropertyRightClicked: selectionContext.onPropertyRightClicked,
|
|
163
|
+
onPropertyContextMenu: selectionContext.onPropertyContextMenu,
|
|
164
|
+
editingPropertyKey: selectionContext.editingPropertyKey,
|
|
165
|
+
onEditCommit: selectionContext.onEditCommit,
|
|
166
|
+
onEditCancel: selectionContext.onEditCancel,
|
|
167
|
+
eventHandler: this.props.eventHandler,
|
|
168
|
+
dataProvider: this.props.dataProvider,
|
|
169
|
+
actionButtonRenderers: this.props.actionButtonRenderers,
|
|
170
|
+
propertyValueRendererManager: this.props.propertyValueRendererManager,
|
|
171
|
+
propertyCategoryRendererManager: this.props.propertyCategoryRendererManager,
|
|
172
|
+
columnRatio: columnResizeContext.columnRatio,
|
|
173
|
+
columnInfo: columnResizeContext.columnInfo,
|
|
174
|
+
isResizeHandleBeingDragged: columnResizeContext.isResizeHandleBeingDragged,
|
|
175
|
+
isResizeHandleHovered: columnResizeContext.isResizeHandleHovered,
|
|
176
|
+
onColumnRatioChanged: columnResizeContext.onColumnChanged,
|
|
177
|
+
onResizeHandleDragChanged: columnResizeContext.onResizeHandleDragChanged,
|
|
178
|
+
onResizeHandleHoverChanged: columnResizeContext.onResizeHandleHoverChanged,
|
|
179
|
+
highlight: this.props.highlight,
|
|
180
|
+
};
|
|
181
|
+
const renderContext = {
|
|
182
|
+
gridItems: this.state.gridItems,
|
|
183
|
+
gridEventHandler: this.props.eventHandler,
|
|
184
|
+
gridModel: this.props.model,
|
|
185
|
+
style: this.props.style,
|
|
186
|
+
className: this.props.className,
|
|
187
|
+
onItemHeightChanged: this._handleNodeHeightChange,
|
|
188
|
+
gridContext,
|
|
189
|
+
};
|
|
190
|
+
return (React.createElement(PropertyGridInternalContextProvider, { value: renderContext },
|
|
191
|
+
React.createElement("div", { className: classnames("components-virtualized-property-grid", "components-smallEditor-host") },
|
|
192
|
+
React.createElement(VariableSizeList, { className: classnames("components-property-grid-wrapper", "ReactWindow__VariableSizeList", this.props.className), width: this.props.width, height: this.props.height, itemCount: this.state.gridItems.length, itemSize: this._calculateNodeHeightByIndex, estimatedItemSize: this.calculateEstimatedHeight(), overscanCount: 10, layout: "vertical", style: this.props.style, itemKey: this._getNodeKey, ref: this._listRef }, FlatGridItemNode))));
|
|
193
|
+
})));
|
|
199
194
|
}
|
|
200
195
|
}
|
|
201
196
|
const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) => {
|
|
@@ -204,15 +199,15 @@ const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) =>
|
|
|
204
199
|
const onExpansionToggled = React.useCallback(() => gridEventHandler.onExpansionToggled(node.selectionKey), [gridEventHandler, node.selectionKey]);
|
|
205
200
|
const onHeightChanged = React.useCallback((newHeight) => onItemHeightChanged(index, node.key, newHeight), [onItemHeightChanged, index, node.key]);
|
|
206
201
|
function getDisplayNode() {
|
|
207
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
208
202
|
const lastInNumberOfCategories = node.lastInNumberOfCategories;
|
|
209
203
|
switch (node.type) {
|
|
210
204
|
case FlatGridItemType.Category:
|
|
211
|
-
const categoryRendererManager =
|
|
205
|
+
const categoryRendererManager = gridContext.propertyCategoryRendererManager
|
|
206
|
+
?? PropertyCategoryRendererManager.defaultManager;
|
|
212
207
|
const customRenderer = categoryRendererManager.getCategoryComponent(node);
|
|
213
208
|
const wrapperClassName = classnames("virtualized-grid-node-content", customRenderer !== undefined ? "virtualized-grid-node-custom-category" : "virtualized-grid-node-category");
|
|
214
209
|
return (React.createElement(FlatItemNestedBorderWrapper, { borderCount: node.depth, bottomBorderCount: lastInNumberOfCategories, className: wrapperClassName },
|
|
215
|
-
React.createElement(PropertyCategoryBlock, { className: className, style: style, category: node.derivedCategory, onExpansionToggled: onExpansionToggled, highlight:
|
|
210
|
+
React.createElement(PropertyCategoryBlock, { className: className, style: style, category: node.derivedCategory, onExpansionToggled: onExpansionToggled, highlight: gridContext.highlight?.filteredTypes?.includes(FilteredType.Category) ?
|
|
216
211
|
gridContext.highlight :
|
|
217
212
|
undefined }, customRenderer !== undefined && (React.createElement(CustomCategoryContent, { renderer: customRenderer, categoryItem: node, gridContext: gridContext, onHeightChanged: onHeightChanged })))));
|
|
218
213
|
case FlatGridItemType.Array:
|
|
@@ -222,7 +217,7 @@ const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) =>
|
|
|
222
217
|
const parentCategoryItem = gridModel.getItem(node.parentCategorySelectionKey);
|
|
223
218
|
return (React.createElement(FlatItemNestedBorderWrapper, { borderCount: parentCategoryItem.depth + 1, bottomBorderCount: lastInNumberOfCategories, className: "virtualized-grid-node-content" },
|
|
224
219
|
React.createElement(FlatPropertyRenderer, { key: node.key, uniqueKey: selectionKey, propertyRecord: node.derivedRecord, orientation: gridContext.orientation, indentation: node.depth, width: gridContext.gridWidth, isHoverable: gridContext.isPropertyHoverEnabled, isSelectable: gridContext.isPropertySelectionEnabled, isSelected: selectionKey === gridContext.selectedPropertyKey, onClick: node.type === FlatGridItemType.Primitive ? gridContext.onPropertyClicked : undefined, onRightClick: node.type === FlatGridItemType.Primitive ? gridContext.onPropertyRightClicked : undefined, onContextMenu: gridContext.onPropertyContextMenu, category: parentCategoryItem.derivedCategory, isEditing: selectionKey === gridContext.editingPropertyKey, onEditCommit: gridContext.onEditCommit, onEditCancel: gridContext.onEditCancel, isExpanded: node.isExpanded, onExpansionToggled: onExpansionToggled, onHeightChanged: onHeightChanged, actionButtonRenderers: gridContext.actionButtonRenderers, propertyValueRendererManager: gridContext.propertyValueRendererManager, columnRatio: gridContext.columnRatio, columnInfo: gridContext.columnInfo, isResizeHandleBeingDragged: gridContext.isResizeHandleBeingDragged, isResizeHandleHovered: gridContext.isResizeHandleHovered, onColumnRatioChanged: gridContext.onColumnRatioChanged, onResizeHandleDragChanged: gridContext.onResizeHandleDragChanged, onResizeHandleHoverChanged: gridContext.onResizeHandleHoverChanged, highlight: gridContext.highlight ?
|
|
225
|
-
{ applyOnLabel: (
|
|
220
|
+
{ applyOnLabel: (gridContext.highlight.filteredTypes?.includes(FilteredType.Label)) ?? false, applyOnValue: (gridContext.highlight.filteredTypes?.includes(FilteredType.Value)) ?? false, ...gridContext.highlight } :
|
|
226
221
|
undefined })));
|
|
227
222
|
}
|
|
228
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAA2B,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAEnF,OAAO,EAAE,mCAAmC,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAGxF,OAAO,EAAE,+BAA+B,EAAiC,MAAM,oCAAoC,CAAC;AAEpH,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAA2B,mBAAmB,EAAqC,MAAM,uBAAuB,CAAC;AACxH,O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AAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AASlD,MAAM,qBAAqB,GAAyC,CAAC,KAAK,EAAE,EAAE;IAC5E,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,KAAK,CAAC,eAAe,CACnB,GAAG,EAAE;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EACD,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CACjD,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,MAAM,IACb,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CACvC,CACP,CAAC;AACJ,CAAC,CAAC","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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { areEqual, ListChildComponentProps, VariableSizeList } from \"react-window\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport { FlatGridItem, GridCategoryItem } from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport { PropertyCategoryRendererManager, PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { IPropertyDataProvider, PropertyCategory } from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport { CommonPropertyGridProps, PropertyGridCommons, PropertyGridContentHighlightProps } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\"PropertyGridInternalContext\");\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<VirtualizedPropertyGridProps, VirtualizedPropertyGridState> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: VirtualizedPropertyGridProps, prevState: VirtualizedPropertyGridState) {\n if (this.props.orientation !== prevProps.orientation\n || this.props.isOrientationFixed !== prevProps.isOrientationFixed\n || this.props.horizontalOrientationMinWidth !== prevProps.horizontalOrientationMinWidth\n || this.props.width !== prevProps.width)\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(0);\n }\n\n if (this.props.highlight !== prevProps.highlight && this.props.highlight?.activeHighlight && this.state.gridItems.length !== 0) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (item instanceof MutableCategorizedPrimitiveProperty && this.props.highlight.activeHighlight.highlightedItemIdentifier === item.derivedRecord.property.name\n || item instanceof MutableGridCategory && this.props.highlight.activeHighlight.highlightedItemIdentifier === item.name) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(props: VirtualizedPropertyGridProps, state: VirtualizedPropertyGridState): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = { ...this.props };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(width, orientation, isOrientationFixed, horizontalOrientationMinWidth);\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return getPropertyHeight(this.state) + node.lastInNumberOfCategories * bottomBorderPadding;\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return categoryHeaderHeight + categoryHeaderPadding\n + (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0);\n }\n\n return dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0);\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (state.orientation === Orientation.Vertical && node.type === FlatGridItemType.Primitive) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (index: number, key: string, newHeight: number) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(key, newHeight),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n /** @internal */\n public override render() {\n return <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={this.props.actionButtonWidth}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={this.props.isPropertySelectionEnabled ?? false}\n isPropertySelectionOnRightClickEnabled={this.props.isPropertySelectionOnRightClickEnabled}\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager: this.props.propertyValueRendererManager,\n propertyCategoryRendererManager: this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged: columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered: columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged: columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged: columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div className={classnames(\"components-virtualized-property-grid\", \"components-smallEditor-host\")}>\n <VariableSizeList\n className={classnames(\"components-property-grid-wrapper\", \"ReactWindow__VariableSizeList\", this.props.className)}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier >\n )}\n </ColumnResizingPropertyListPropsSupplier>;\n }\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const { gridItems, gridEventHandler, gridModel, gridContext, className, style, onItemHeightChanged } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey],\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key],\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager = gridContext.propertyCategoryRendererManager\n ?? PropertyCategoryRendererManager.defaultManager;\n const customRenderer = categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined ? \"virtualized-grid-node-custom-category\" : \"virtualized-grid-node-category\",\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={gridContext.highlight?.filteredTypes?.includes(FilteredType.Category) ?\n gridContext.highlight :\n undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(node.parentCategorySelectionKey) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n\n onClick={node.type === FlatGridItemType.Primitive ? gridContext.onPropertyClicked : undefined}\n onRightClick={node.type === FlatGridItemType.Primitive ? gridContext.onPropertyRightClicked : undefined}\n onContextMenu={gridContext.onPropertyContextMenu}\n\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={gridContext.propertyValueRendererManager}\n\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={gridContext.isResizeHandleBeingDragged}\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={gridContext.onResizeHandleDragChanged}\n onResizeHandleHoverChanged={gridContext.onResizeHandleHoverChanged}\n\n highlight={gridContext.highlight ?\n { applyOnLabel: (gridContext.highlight.filteredTypes?.includes(FilteredType.Label)) ?? false, applyOnValue: (gridContext.highlight.filteredTypes?.includes(FilteredType.Value)) ?? false, ...gridContext.highlight } :\n undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual,\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(\n () => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n },\n [props.gridContext.orientation, onHeightChanged],\n );\n\n return (\n <div ref={divRef}>\n {React.createElement(props.renderer, props)}\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAA2B,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAEnF,OAAO,EAAE,mCAAmC,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAGxF,OAAO,EAAE,+BAA+B,EAAiC,MAAM,oCAAoC,CAAC;AAEpH,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAA2B,mBAAmB,EAAqC,MAAM,uBAAuB,CAAC;AACxH,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAyFlG,MAAM,CACJ,mCAAmC,EACnC,oCAAoC,EACpC,8BAA8B,EAC/B,GA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ACnB,GAAG,EAAE;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EACD,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CACjD,CAAC;IAEF,OAAO,CACL,6BAAK,GAAG,EAAE,MAAM,IACb,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CACvC,CACP,CAAC;AACJ,CAAC,CAAC","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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { areEqual, ListChildComponentProps, VariableSizeList } from \"react-window\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport { FlatGridItem, GridCategoryItem } from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport { PropertyCategoryRendererManager, PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { IPropertyDataProvider, PropertyCategory } from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport { CommonPropertyGridProps, PropertyGridCommons, PropertyGridContentHighlightProps } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\"PropertyGridInternalContext\");\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<VirtualizedPropertyGridProps, VirtualizedPropertyGridState> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: VirtualizedPropertyGridProps, prevState: VirtualizedPropertyGridState) {\n if (this.props.orientation !== prevProps.orientation\n || this.props.isOrientationFixed !== prevProps.isOrientationFixed\n || this.props.horizontalOrientationMinWidth !== prevProps.horizontalOrientationMinWidth\n || this.props.width !== prevProps.width)\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(0);\n }\n\n if (this.props.highlight !== prevProps.highlight && this.props.highlight?.activeHighlight && this.state.gridItems.length !== 0) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (item instanceof MutableCategorizedPrimitiveProperty && this.props.highlight.activeHighlight.highlightedItemIdentifier === item.derivedRecord.property.name\n || item instanceof MutableGridCategory && this.props.highlight.activeHighlight.highlightedItemIdentifier === item.name) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(props: VirtualizedPropertyGridProps, state: VirtualizedPropertyGridState): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = { ...this.props };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(width, orientation, isOrientationFixed, horizontalOrientationMinWidth);\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return getPropertyHeight(this.state) + node.lastInNumberOfCategories * bottomBorderPadding;\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return categoryHeaderHeight + categoryHeaderPadding\n + (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0);\n }\n\n return dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0);\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (state.orientation === Orientation.Vertical && node.type === FlatGridItemType.Primitive) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (index: number, key: string, newHeight: number) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(key, newHeight),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n /** @internal */\n public override render() {\n return <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={this.props.actionButtonWidth}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={this.props.isPropertySelectionEnabled ?? false}\n isPropertySelectionOnRightClickEnabled={this.props.isPropertySelectionOnRightClickEnabled}\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager: this.props.propertyValueRendererManager,\n propertyCategoryRendererManager: this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged: columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered: columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged: columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged: columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div className={classnames(\"components-virtualized-property-grid\", \"components-smallEditor-host\")}>\n <VariableSizeList\n className={classnames(\"components-property-grid-wrapper\", \"ReactWindow__VariableSizeList\", this.props.className)}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier >\n )}\n </ColumnResizingPropertyListPropsSupplier>;\n }\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const { gridItems, gridEventHandler, gridModel, gridContext, className, style, onItemHeightChanged } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey],\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key],\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager = gridContext.propertyCategoryRendererManager\n ?? PropertyCategoryRendererManager.defaultManager;\n const customRenderer = categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined ? \"virtualized-grid-node-custom-category\" : \"virtualized-grid-node-category\",\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={gridContext.highlight?.filteredTypes?.includes(FilteredType.Category) ?\n gridContext.highlight :\n undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(node.parentCategorySelectionKey) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n\n onClick={node.type === FlatGridItemType.Primitive ? gridContext.onPropertyClicked : undefined}\n onRightClick={node.type === FlatGridItemType.Primitive ? gridContext.onPropertyRightClicked : undefined}\n onContextMenu={gridContext.onPropertyContextMenu}\n\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={gridContext.propertyValueRendererManager}\n\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={gridContext.isResizeHandleBeingDragged}\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={gridContext.onResizeHandleDragChanged}\n onResizeHandleHoverChanged={gridContext.onResizeHandleHoverChanged}\n\n highlight={gridContext.highlight ?\n { applyOnLabel: (gridContext.highlight.filteredTypes?.includes(FilteredType.Label)) ?? false, applyOnValue: (gridContext.highlight.filteredTypes?.includes(FilteredType.Value)) ?? false, ...gridContext.highlight } :\n undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual,\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(\n () => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n },\n [props.gridContext.orientation, onHeightChanged],\n );\n\n return (\n <div ref={divRef}>\n {React.createElement(props.renderer, props)}\n </div>\n );\n};\n"]}
|
|
@@ -69,32 +69,31 @@ export class FilteringPropertyDataProvider {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
async function matchHierarchy(filterer, categories, records, newRecords, parentMatchInfo) {
|
|
72
|
-
var _a, _b, _c, _d, _e;
|
|
73
72
|
const newCategories = [];
|
|
74
|
-
newRecords = newRecords
|
|
73
|
+
newRecords = newRecords ?? {};
|
|
75
74
|
let matchesCount = 0;
|
|
76
75
|
let allFilteredResultMatches = [];
|
|
77
76
|
let allFilteredTypes = [];
|
|
78
77
|
for (const category of categories) {
|
|
79
78
|
const matchInfo = await filterer.categoryMatchesFilter(category, []);
|
|
80
79
|
if (matchInfo.matchesFilter) {
|
|
81
|
-
allFilteredResultMatches.push({ id: category.name, matchesCount:
|
|
82
|
-
allFilteredTypes = allFilteredTypes.concat(
|
|
83
|
-
matchesCount +=
|
|
80
|
+
allFilteredResultMatches.push({ id: category.name, matchesCount: matchInfo.matchesCount ?? 0 });
|
|
81
|
+
allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);
|
|
82
|
+
matchesCount += matchInfo.matchesCount ?? 0;
|
|
84
83
|
}
|
|
85
|
-
const childRecords =
|
|
84
|
+
const childRecords = records[category.name] ?? [];
|
|
86
85
|
const { filteredRecords, matchesCount: count, filteredResultMatches, filteredTypes } = await matchRecordHierarchy(filterer, childRecords, []);
|
|
87
86
|
allFilteredResultMatches = allFilteredResultMatches.concat(filteredResultMatches);
|
|
88
87
|
allFilteredTypes = allFilteredTypes.concat(filteredTypes);
|
|
89
88
|
matchesCount += count;
|
|
90
|
-
const parentInfo =
|
|
91
|
-
const childCategories =
|
|
89
|
+
const parentInfo = parentMatchInfo?.matchesFilter ? parentMatchInfo : matchInfo;
|
|
90
|
+
const childCategories = category.childCategories ?? [];
|
|
92
91
|
const { filteredCategories, matchesCount: childCount, filteredResultMatches: childFilteredResultMatches, filteredTypes: childFilteredTypes } = await matchHierarchy(filterer, childCategories, records, newRecords, parentInfo);
|
|
93
92
|
allFilteredResultMatches = allFilteredResultMatches.concat(childFilteredResultMatches);
|
|
94
93
|
allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);
|
|
95
94
|
matchesCount += childCount;
|
|
96
95
|
let expand = !(count === 0 && childCount === 0);
|
|
97
|
-
if (matchInfo.matchesFilter || (
|
|
96
|
+
if (matchInfo.matchesFilter || (parentMatchInfo?.matchesFilter && parentMatchInfo.shouldForceIncludeDescendants)) {
|
|
98
97
|
newRecords[category.name] = records[category.name];
|
|
99
98
|
if (matchInfo.matchesFilter) {
|
|
100
99
|
expand = true;
|
|
@@ -102,7 +101,7 @@ async function matchHierarchy(filterer, categories, records, newRecords, parentM
|
|
|
102
101
|
const newCategory = copyPropertyCategory(category, filteredCategories, expand);
|
|
103
102
|
newCategories.push(newCategory);
|
|
104
103
|
}
|
|
105
|
-
if ((filteredRecords.length !== 0 || filteredCategories.length !== 0) && !matchInfo.matchesFilter && !(
|
|
104
|
+
if ((filteredRecords.length !== 0 || filteredCategories.length !== 0) && !matchInfo.matchesFilter && !(parentMatchInfo?.shouldExpandNodeParents && parentMatchInfo.matchesFilter)) {
|
|
106
105
|
const newCategory = copyPropertyCategory(category, filteredCategories, expand);
|
|
107
106
|
newRecords[newCategory.name] = filteredRecords;
|
|
108
107
|
newCategories.push(newCategory);
|
|
@@ -111,7 +110,6 @@ async function matchHierarchy(filterer, categories, records, newRecords, parentM
|
|
|
111
110
|
return { filteredCategories: newCategories, filteredRecords: newRecords, matchesCount, filteredResultMatches: allFilteredResultMatches, filteredTypes: allFilteredTypes };
|
|
112
111
|
}
|
|
113
112
|
async function matchRecordHierarchy(filterer, records, parents, forceIncludeItem = false) {
|
|
114
|
-
var _a, _b;
|
|
115
113
|
const newMatchedRecords = [];
|
|
116
114
|
let expandParent = false; // property passed back to parent to indicate whether it should be expanded
|
|
117
115
|
let matchesCount = 0;
|
|
@@ -128,8 +126,8 @@ async function matchRecordHierarchy(filterer, records, parents, forceIncludeItem
|
|
|
128
126
|
expandParent = expandParent || shouldExpandNodeParents;
|
|
129
127
|
let newRecord;
|
|
130
128
|
if (matchInfo.matchesFilter) {
|
|
131
|
-
filteredTypes = [...filteredTypes, ...(
|
|
132
|
-
const recordMatchesCount =
|
|
129
|
+
filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];
|
|
130
|
+
const recordMatchesCount = matchInfo.matchesCount ?? 0;
|
|
133
131
|
matchesCount += recordMatchesCount;
|
|
134
132
|
// Item is included if it matches filter
|
|
135
133
|
// If at least one matched record from records list needs its parent expanded,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/FilteringDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAiC,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI3F,OAAO,EAAyD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAiCzH;;;GAGG;AACH,MAAM,OAAO,6BAA6B;IAMxC,YAA2B,aAAoC,EAAU,SAAgC;QAA9E,kBAAa,GAAb,aAAa,CAAuB;QAAU,cAAS,GAAT,SAAS,CAAuB;QALlG,kBAAa,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAC7C,0BAAqB,GAA8C,SAAS,CAAC;QAKnF,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpK,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtK,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAI,CAAC,6BAA6B,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,qBAA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------------------------------\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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { PropertyRecord, PropertyValue, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { IDisposable } from \"@itwin/core-bentley\";\nimport { HighlightInfo } from \"../../common/HighlightingComponentProps\";\nimport { CategoryRecordsDict } from \"../internal/flat-items/MutableGridCategory\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"../PropertyDataProvider\";\nimport { FilteredType, IPropertyDataFilterer, PropertyDataFilterResult } from \"./filterers/PropertyDataFiltererBase\";\n\ninterface FilteredRecords {\n filteredRecords: PropertyRecord[];\n shouldExpandNodeParents: boolean;\n matchesCount: number;\n activeMatch?: HighlightInfo;\n filteredResultMatches: { id: string, matchesCount: number }[];\n filteredTypes: FilteredType[];\n}\n\n/**\n * Data returned by [[FilteringPropertyDataProvider]]\n * @public\n */\nexport interface FilteredPropertyData extends PropertyData {\n /**\n * Shows how many matches were found when filtering data.\n * `undefined` when filterer is not active\n */\n matchesCount?: number;\n\n /**\n * Function used for getting [[HighlightInfo]] by index from all the filtered matches.\n * `undefined` when filterer is not active\n */\n getMatchByIndex?: (index: number) => HighlightInfo | undefined;\n\n /** Types of objects that were used for filtering. */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * [[IPropertyDataProvider]] implementation which filters wrapped provider [[PropertyData]] using passed [[IPropertyDataFilterer]].\n * @public\n */\nexport class FilteringPropertyDataProvider implements IPropertyDataProvider, IDisposable {\n public onDataChanged = new PropertyDataChangeEvent();\n private _filteredPropertyData: Promise<FilteredPropertyData> | undefined = undefined;\n private _disposeFilterChangedListener: Function;\n private _disposeDataChangedListener: Function;\n\n public constructor(private _dataProvider: IPropertyDataProvider, private _filterer: IPropertyDataFilterer) {\n this._disposeFilterChangedListener = this._filterer.onFilterChanged.addListener(() => { this._filteredPropertyData = undefined; this.onDataChanged.raiseEvent(); });\n this._disposeDataChangedListener = this._dataProvider.onDataChanged.addListener(() => { this._filteredPropertyData = undefined; this.onDataChanged.raiseEvent(); });\n }\n\n public dispose(): void {\n this._disposeDataChangedListener();\n this._disposeFilterChangedListener();\n }\n\n public async getData(): Promise<FilteredPropertyData> {\n if (this._filteredPropertyData) {\n return this._filteredPropertyData;\n }\n\n this._filteredPropertyData = this._dataProvider.getData().then(async (propertyData) => {\n return ((this._filterer.isActive) ?\n this.filterPropertyData(propertyData) : propertyData);\n });\n\n return this._filteredPropertyData;\n }\n\n private async filterPropertyData(propertyData: PropertyData) {\n const { categories, records, label, description } = { ...propertyData };\n const { filteredCategories, filteredRecords, matchesCount, filteredResultMatches, filteredTypes } = await matchHierarchy(this._filterer, categories, records, undefined);\n\n const uniqueTypes = [...new Set(filteredTypes)];\n const getMatchByIndex = (index: number) => {\n let activeMatch: HighlightInfo | undefined;\n if (index <= 0)\n return undefined;\n\n let i = 1;\n for (const record of filteredResultMatches) {\n const fullMatchesCount = record.matchesCount;\n if (index < i + fullMatchesCount) {\n activeMatch = {\n highlightedItemIdentifier: record.id,\n highlightIndex: index - i,\n };\n break;\n }\n\n i += fullMatchesCount;\n }\n return activeMatch;\n };\n\n return {\n label,\n description,\n categories: filteredCategories,\n records: filteredRecords,\n reusePropertyDataState: false,\n matchesCount,\n getMatchByIndex,\n filteredTypes: uniqueTypes,\n };\n }\n}\n\nasync function matchHierarchy(filterer: IPropertyDataFilterer, categories: PropertyCategory[], records: CategoryRecordsDict, newRecords?: CategoryRecordsDict, parentMatchInfo?: PropertyDataFilterResult) {\n const newCategories: PropertyCategory[] = [];\n newRecords = newRecords ?? {};\n let matchesCount = 0;\n let allFilteredResultMatches: { id: string, matchesCount: number }[] = [];\n let allFilteredTypes: FilteredType[] = [];\n\n for (const category of categories) {\n const matchInfo = await filterer.categoryMatchesFilter(category, []);\n\n if (matchInfo.matchesFilter) {\n allFilteredResultMatches.push({ id: category.name, matchesCount: matchInfo.matchesCount ?? 0 });\n allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);\n matchesCount += matchInfo.matchesCount ?? 0;\n }\n\n const childRecords = records[category.name] ?? [];\n const { filteredRecords, matchesCount: count, filteredResultMatches, filteredTypes } = await matchRecordHierarchy(filterer, childRecords, []);\n allFilteredResultMatches = allFilteredResultMatches.concat(filteredResultMatches);\n allFilteredTypes = allFilteredTypes.concat(filteredTypes);\n matchesCount += count;\n\n const parentInfo = parentMatchInfo?.matchesFilter ? parentMatchInfo : matchInfo;\n\n const childCategories = category.childCategories ?? [];\n const { filteredCategories, matchesCount: childCount, filteredResultMatches: childFilteredResultMatches, filteredTypes: childFilteredTypes } = await matchHierarchy(filterer, childCategories, records, newRecords, parentInfo);\n allFilteredResultMatches = allFilteredResultMatches.concat(childFilteredResultMatches);\n allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);\n matchesCount += childCount;\n\n let expand = !(count === 0 && childCount === 0);\n if (matchInfo.matchesFilter || (parentMatchInfo?.matchesFilter && parentMatchInfo.shouldForceIncludeDescendants)) {\n newRecords[category.name] = records[category.name];\n if (matchInfo.matchesFilter) {\n expand = true;\n }\n const newCategory = copyPropertyCategory(category, filteredCategories, expand);\n newCategories.push(newCategory);\n }\n\n if ((filteredRecords.length !== 0 || filteredCategories.length !== 0) && !matchInfo.matchesFilter && !(parentMatchInfo?.shouldExpandNodeParents && parentMatchInfo.matchesFilter)) {\n const newCategory = copyPropertyCategory(category, filteredCategories, expand);\n newRecords[newCategory.name] = filteredRecords;\n newCategories.push(newCategory);\n }\n }\n\n return { filteredCategories: newCategories, filteredRecords: newRecords, matchesCount, filteredResultMatches: allFilteredResultMatches, filteredTypes: allFilteredTypes };\n}\n\nasync function matchRecordHierarchy(filterer: IPropertyDataFilterer, records: PropertyRecord[], parents: PropertyRecord[], forceIncludeItem: boolean = false): Promise<FilteredRecords> {\n const newMatchedRecords: PropertyRecord[] = [];\n let expandParent = false; // property passed back to parent to indicate whether it should be expanded\n let matchesCount = 0;\n let filteredResultMatches: { id: string, matchesCount: number }[] = [];\n let filteredTypes: FilteredType[] = [];\n\n for (const record of records) {\n const matchInfo = await filterer.recordMatchesFilter(record, parents);\n const shouldForceIncludeDescendants = forceIncludeItem || matchInfo.shouldForceIncludeDescendants;\n const { filteredRecords: filteredChildren, shouldExpandNodeParents, matchesCount: childrenMatchesCount, filteredResultMatches: childrenResultMatches, filteredTypes: childrenFilteredTypes } = await matchRecordHierarchy(filterer, record.getChildrenRecords(), [...parents, record], shouldForceIncludeDescendants);\n filteredResultMatches = filteredResultMatches.concat(childrenResultMatches);\n filteredTypes = [...filteredTypes, ...childrenFilteredTypes];\n matchesCount += childrenMatchesCount;\n // if child hierarchy indicates parents should be expanded, then it should be passed back up to the top parent\n expandParent = expandParent || shouldExpandNodeParents;\n\n let newRecord: PropertyRecord | undefined;\n if (matchInfo.matchesFilter) {\n filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];\n const recordMatchesCount = matchInfo.matchesCount ?? 0;\n matchesCount += recordMatchesCount;\n // Item is included if it matches filter\n // If at least one matched record from records list needs its parent expanded,\n // then `expandParent` should be set to true\n expandParent = expandParent || !!matchInfo.shouldExpandNodeParents;\n newRecord = copyPropertyRecord(record, filteredChildren, shouldExpandNodeParents);\n filteredResultMatches.push({ id: newRecord.property.name, matchesCount: recordMatchesCount });\n } else if (filteredChildren.length !== 0 || forceIncludeItem) {\n // Item is also included if it has at least one matched child or is forcefully included by its parent\n newRecord = copyPropertyRecord(record, filteredChildren, shouldExpandNodeParents);\n }\n\n if (newRecord)\n newMatchedRecords.push(newRecord);\n }\n\n return { filteredRecords: newMatchedRecords, shouldExpandNodeParents: expandParent, matchesCount, filteredResultMatches, filteredTypes };\n}\n\nfunction copyPropertyCategory(\n propertyCategory: PropertyCategory,\n newChildren: PropertyCategory[],\n expand: boolean,\n): PropertyCategory {\n return {\n ...propertyCategory,\n childCategories: newChildren,\n expand,\n };\n}\n\nfunction copyPropertyRecord(record: PropertyRecord, newChildren: PropertyRecord[], autoExpand: boolean) {\n const r = record.copyWithNewValue(createNewPropertyValue(record.value, newChildren));\n r.autoExpand = autoExpand;\n return r;\n}\n\nfunction createNewPropertyValue(value: PropertyValue, newChildren: PropertyRecord[]): PropertyValue {\n switch (value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return { ...value };\n case PropertyValueFormat.Array:\n return {\n valueFormat: PropertyValueFormat.Array,\n itemsTypeName: value.itemsTypeName,\n items: newChildren,\n };\n case PropertyValueFormat.Struct:\n const members: { [name: string]: PropertyRecord } = {};\n newChildren.forEach((child) => members[child.property.name] = child);\n return {\n valueFormat: PropertyValueFormat.Struct,\n members,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilteringDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/FilteringDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAiC,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI3F,OAAO,EAAyD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAiCzH;;;GAGG;AACH,MAAM,OAAO,6BAA6B;IAMxC,YAA2B,aAAoC,EAAU,SAAgC;QAA9E,kBAAa,GAAb,aAAa,CAAuB;QAAU,cAAS,GAAT,SAAS,CAAuB;QALlG,kBAAa,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAC7C,0BAAqB,GAA8C,SAAS,CAAC;QAKnF,IAAI,CAAC,6BAA6B,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpK,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAA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ACrE,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,MAAM;gBACvC,OAAO;aACR,CAAC;KACL;AACH,CAAC","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { PropertyRecord, PropertyValue, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { IDisposable } from \"@itwin/core-bentley\";\nimport { HighlightInfo } from \"../../common/HighlightingComponentProps\";\nimport { CategoryRecordsDict } from \"../internal/flat-items/MutableGridCategory\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"../PropertyDataProvider\";\nimport { FilteredType, IPropertyDataFilterer, PropertyDataFilterResult } from \"./filterers/PropertyDataFiltererBase\";\n\ninterface FilteredRecords {\n filteredRecords: PropertyRecord[];\n shouldExpandNodeParents: boolean;\n matchesCount: number;\n activeMatch?: HighlightInfo;\n filteredResultMatches: { id: string, matchesCount: number }[];\n filteredTypes: FilteredType[];\n}\n\n/**\n * Data returned by [[FilteringPropertyDataProvider]]\n * @public\n */\nexport interface FilteredPropertyData extends PropertyData {\n /**\n * Shows how many matches were found when filtering data.\n * `undefined` when filterer is not active\n */\n matchesCount?: number;\n\n /**\n * Function used for getting [[HighlightInfo]] by index from all the filtered matches.\n * `undefined` when filterer is not active\n */\n getMatchByIndex?: (index: number) => HighlightInfo | undefined;\n\n /** Types of objects that were used for filtering. */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * [[IPropertyDataProvider]] implementation which filters wrapped provider [[PropertyData]] using passed [[IPropertyDataFilterer]].\n * @public\n */\nexport class FilteringPropertyDataProvider implements IPropertyDataProvider, IDisposable {\n public onDataChanged = new PropertyDataChangeEvent();\n private _filteredPropertyData: Promise<FilteredPropertyData> | undefined = undefined;\n private _disposeFilterChangedListener: Function;\n private _disposeDataChangedListener: Function;\n\n public constructor(private _dataProvider: IPropertyDataProvider, private _filterer: IPropertyDataFilterer) {\n this._disposeFilterChangedListener = this._filterer.onFilterChanged.addListener(() => { this._filteredPropertyData = undefined; this.onDataChanged.raiseEvent(); });\n this._disposeDataChangedListener = this._dataProvider.onDataChanged.addListener(() => { this._filteredPropertyData = undefined; this.onDataChanged.raiseEvent(); });\n }\n\n public dispose(): void {\n this._disposeDataChangedListener();\n this._disposeFilterChangedListener();\n }\n\n public async getData(): Promise<FilteredPropertyData> {\n if (this._filteredPropertyData) {\n return this._filteredPropertyData;\n }\n\n this._filteredPropertyData = this._dataProvider.getData().then(async (propertyData) => {\n return ((this._filterer.isActive) ?\n this.filterPropertyData(propertyData) : propertyData);\n });\n\n return this._filteredPropertyData;\n }\n\n private async filterPropertyData(propertyData: PropertyData) {\n const { categories, records, label, description } = { ...propertyData };\n const { filteredCategories, filteredRecords, matchesCount, filteredResultMatches, filteredTypes } = await matchHierarchy(this._filterer, categories, records, undefined);\n\n const uniqueTypes = [...new Set(filteredTypes)];\n const getMatchByIndex = (index: number) => {\n let activeMatch: HighlightInfo | undefined;\n if (index <= 0)\n return undefined;\n\n let i = 1;\n for (const record of filteredResultMatches) {\n const fullMatchesCount = record.matchesCount;\n if (index < i + fullMatchesCount) {\n activeMatch = {\n highlightedItemIdentifier: record.id,\n highlightIndex: index - i,\n };\n break;\n }\n\n i += fullMatchesCount;\n }\n return activeMatch;\n };\n\n return {\n label,\n description,\n categories: filteredCategories,\n records: filteredRecords,\n reusePropertyDataState: false,\n matchesCount,\n getMatchByIndex,\n filteredTypes: uniqueTypes,\n };\n }\n}\n\nasync function matchHierarchy(filterer: IPropertyDataFilterer, categories: PropertyCategory[], records: CategoryRecordsDict, newRecords?: CategoryRecordsDict, parentMatchInfo?: PropertyDataFilterResult) {\n const newCategories: PropertyCategory[] = [];\n newRecords = newRecords ?? {};\n let matchesCount = 0;\n let allFilteredResultMatches: { id: string, matchesCount: number }[] = [];\n let allFilteredTypes: FilteredType[] = [];\n\n for (const category of categories) {\n const matchInfo = await filterer.categoryMatchesFilter(category, []);\n\n if (matchInfo.matchesFilter) {\n allFilteredResultMatches.push({ id: category.name, matchesCount: matchInfo.matchesCount ?? 0 });\n allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);\n matchesCount += matchInfo.matchesCount ?? 0;\n }\n\n const childRecords = records[category.name] ?? [];\n const { filteredRecords, matchesCount: count, filteredResultMatches, filteredTypes } = await matchRecordHierarchy(filterer, childRecords, []);\n allFilteredResultMatches = allFilteredResultMatches.concat(filteredResultMatches);\n allFilteredTypes = allFilteredTypes.concat(filteredTypes);\n matchesCount += count;\n\n const parentInfo = parentMatchInfo?.matchesFilter ? parentMatchInfo : matchInfo;\n\n const childCategories = category.childCategories ?? [];\n const { filteredCategories, matchesCount: childCount, filteredResultMatches: childFilteredResultMatches, filteredTypes: childFilteredTypes } = await matchHierarchy(filterer, childCategories, records, newRecords, parentInfo);\n allFilteredResultMatches = allFilteredResultMatches.concat(childFilteredResultMatches);\n allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);\n matchesCount += childCount;\n\n let expand = !(count === 0 && childCount === 0);\n if (matchInfo.matchesFilter || (parentMatchInfo?.matchesFilter && parentMatchInfo.shouldForceIncludeDescendants)) {\n newRecords[category.name] = records[category.name];\n if (matchInfo.matchesFilter) {\n expand = true;\n }\n const newCategory = copyPropertyCategory(category, filteredCategories, expand);\n newCategories.push(newCategory);\n }\n\n if ((filteredRecords.length !== 0 || filteredCategories.length !== 0) && !matchInfo.matchesFilter && !(parentMatchInfo?.shouldExpandNodeParents && parentMatchInfo.matchesFilter)) {\n const newCategory = copyPropertyCategory(category, filteredCategories, expand);\n newRecords[newCategory.name] = filteredRecords;\n newCategories.push(newCategory);\n }\n }\n\n return { filteredCategories: newCategories, filteredRecords: newRecords, matchesCount, filteredResultMatches: allFilteredResultMatches, filteredTypes: allFilteredTypes };\n}\n\nasync function matchRecordHierarchy(filterer: IPropertyDataFilterer, records: PropertyRecord[], parents: PropertyRecord[], forceIncludeItem: boolean = false): Promise<FilteredRecords> {\n const newMatchedRecords: PropertyRecord[] = [];\n let expandParent = false; // property passed back to parent to indicate whether it should be expanded\n let matchesCount = 0;\n let filteredResultMatches: { id: string, matchesCount: number }[] = [];\n let filteredTypes: FilteredType[] = [];\n\n for (const record of records) {\n const matchInfo = await filterer.recordMatchesFilter(record, parents);\n const shouldForceIncludeDescendants = forceIncludeItem || matchInfo.shouldForceIncludeDescendants;\n const { filteredRecords: filteredChildren, shouldExpandNodeParents, matchesCount: childrenMatchesCount, filteredResultMatches: childrenResultMatches, filteredTypes: childrenFilteredTypes } = await matchRecordHierarchy(filterer, record.getChildrenRecords(), [...parents, record], shouldForceIncludeDescendants);\n filteredResultMatches = filteredResultMatches.concat(childrenResultMatches);\n filteredTypes = [...filteredTypes, ...childrenFilteredTypes];\n matchesCount += childrenMatchesCount;\n // if child hierarchy indicates parents should be expanded, then it should be passed back up to the top parent\n expandParent = expandParent || shouldExpandNodeParents;\n\n let newRecord: PropertyRecord | undefined;\n if (matchInfo.matchesFilter) {\n filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];\n const recordMatchesCount = matchInfo.matchesCount ?? 0;\n matchesCount += recordMatchesCount;\n // Item is included if it matches filter\n // If at least one matched record from records list needs its parent expanded,\n // then `expandParent` should be set to true\n expandParent = expandParent || !!matchInfo.shouldExpandNodeParents;\n newRecord = copyPropertyRecord(record, filteredChildren, shouldExpandNodeParents);\n filteredResultMatches.push({ id: newRecord.property.name, matchesCount: recordMatchesCount });\n } else if (filteredChildren.length !== 0 || forceIncludeItem) {\n // Item is also included if it has at least one matched child or is forcefully included by its parent\n newRecord = copyPropertyRecord(record, filteredChildren, shouldExpandNodeParents);\n }\n\n if (newRecord)\n newMatchedRecords.push(newRecord);\n }\n\n return { filteredRecords: newMatchedRecords, shouldExpandNodeParents: expandParent, matchesCount, filteredResultMatches, filteredTypes };\n}\n\nfunction copyPropertyCategory(\n propertyCategory: PropertyCategory,\n newChildren: PropertyCategory[],\n expand: boolean,\n): PropertyCategory {\n return {\n ...propertyCategory,\n childCategories: newChildren,\n expand,\n };\n}\n\nfunction copyPropertyRecord(record: PropertyRecord, newChildren: PropertyRecord[], autoExpand: boolean) {\n const r = record.copyWithNewValue(createNewPropertyValue(record.value, newChildren));\n r.autoExpand = autoExpand;\n return r;\n}\n\nfunction createNewPropertyValue(value: PropertyValue, newChildren: PropertyRecord[]): PropertyValue {\n switch (value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return { ...value };\n case PropertyValueFormat.Array:\n return {\n valueFormat: PropertyValueFormat.Array,\n itemsTypeName: value.itemsTypeName,\n items: newChildren,\n };\n case PropertyValueFormat.Struct:\n const members: { [name: string]: PropertyRecord } = {};\n newChildren.forEach((child) => members[child.property.name] = child);\n return {\n valueFormat: PropertyValueFormat.Struct,\n members,\n };\n }\n}\n"]}
|
|
@@ -60,11 +60,11 @@ export class CompositePropertyDataFilterer extends PropertyDataFiltererBase {
|
|
|
60
60
|
function sumNullableNumbers(lhs, rhs) {
|
|
61
61
|
if (undefined === lhs && undefined === rhs)
|
|
62
62
|
return undefined;
|
|
63
|
-
return (lhs
|
|
63
|
+
return (lhs ?? 0) + (rhs ?? 0);
|
|
64
64
|
}
|
|
65
65
|
function joinNullableArrays(lhs, rhs) {
|
|
66
66
|
if (undefined === lhs && undefined === rhs)
|
|
67
67
|
return undefined;
|
|
68
|
-
return [...lhs
|
|
68
|
+
return [...lhs ?? [], ...rhs ?? []];
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=CompositePropertyDataFilterer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAuC,wBAAwB,EAA4B,MAAM,4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ACxC,OAAO,SAAS,CAAC;IACnB,OAAO,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAuC,wBAAwB,EAA4B,MAAM,4BAA4B,CAAC;AAErI;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,yDAAE,CAAA;AACJ,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,wBAAwB;IACzE,YAA2B,aAAoC,EAAU,SAA8B,EAAU,cAAqC;QACpJ,KAAK,EAAE,CAAC;QADiB,kBAAa,GAAb,aAAa,CAAuB;QAAU,cAAS,GAAT,SAAS,CAAqB;QAAU,mBAAc,GAAd,cAAc,CAAuB;QAEpJ,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;QACxF,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtF,KAAK,CAAC,mBAAmB,CAAC,IAAoB,EAAE,OAAyB;QAC9E,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACnC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC;YACrD,IAAI,CAAC,c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CAAC,6BAA6B;YACrG,YAAY,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;YACtE,aAAa;SACd,CAAC;IACJ,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,GAAuB,EAAE,GAAuB;IAC1E,IAAI,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG;QACxC,OAAO,SAAS,CAAC;IACnB,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,kBAAkB,CAAC,GAA+B,EAAE,GAA+B;IAC1F,IAAI,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG;QACxC,OAAO,SAAS,CAAC;IACnB,OAAO,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,GAAG,GAAG,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { FilteredType, IPropertyDataFilterer, PropertyDataFiltererBase, PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\n\n/**\n * Logical operator for composite filterer.\n * @public\n */\nexport enum CompositeFilterType {\n And,\n Or,\n}\n\n/**\n * Composite PropertyData filter which can join two filters using logic operators\n * @public\n */\nexport class CompositePropertyDataFilterer extends PropertyDataFiltererBase {\n public constructor(private _leftFilterer: IPropertyDataFilterer, private _operator: CompositeFilterType, private _rightFilterer: IPropertyDataFilterer) {\n super();\n this._leftFilterer.onFilterChanged.addListener(() => this.onFilterChanged.raiseEvent());\n this._rightFilterer.onFilterChanged.addListener(() => this.onFilterChanged.raiseEvent());\n }\n\n public get isActive() { return this._leftFilterer.isActive || this._rightFilterer.isActive; }\n\n public async recordMatchesFilter(node: PropertyRecord, parents: PropertyRecord[]): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.recordMatchesFilter(node, parents),\n this._rightFilterer.recordMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n public async categoryMatchesFilter(node: PropertyCategory, parents: PropertyCategory[]): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.categoryMatchesFilter(node, parents),\n this._rightFilterer.categoryMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n private getFiltererResult(lhs: PropertyDataFilterResult, rhs: PropertyDataFilterResult) {\n const matchesFilter = (this._operator === CompositeFilterType.And) ? (lhs.matchesFilter && rhs.matchesFilter) : (lhs.matchesFilter || rhs.matchesFilter);\n if (!matchesFilter)\n return { matchesFilter: false };\n\n const filteredTypes = joinNullableArrays(lhs.matchesFilter ? lhs.filteredTypes : undefined, rhs.matchesFilter ? rhs.filteredTypes : undefined);\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: lhs.shouldExpandNodeParents || rhs.shouldExpandNodeParents,\n shouldForceIncludeDescendants: lhs.shouldForceIncludeDescendants || rhs.shouldForceIncludeDescendants,\n matchesCount: (sumNullableNumbers(lhs.matchesCount, rhs.matchesCount)),\n filteredTypes,\n };\n }\n}\n\nfunction sumNullableNumbers(lhs: number | undefined, rhs: number | undefined) {\n if (undefined === lhs && undefined === rhs)\n return undefined;\n return (lhs ?? 0) + (rhs ?? 0);\n}\n\nfunction joinNullableArrays(lhs: FilteredType[] | undefined, rhs: FilteredType[] | undefined) {\n if (undefined === lhs && undefined === rhs)\n return undefined;\n return [...lhs ?? [], ...rhs ?? []];\n}\n"]}
|
|
@@ -28,12 +28,11 @@ export class DisplayValuePropertyDataFilterer extends PropertyRecordDataFilterer
|
|
|
28
28
|
}
|
|
29
29
|
get isActive() { return this.filterText !== ""; }
|
|
30
30
|
async recordMatchesFilter(node) {
|
|
31
|
-
var _a, _b;
|
|
32
31
|
if (!this.isActive)
|
|
33
32
|
return { matchesFilter: true };
|
|
34
33
|
if (node.value.valueFormat !== PropertyValueFormat.Primitive)
|
|
35
34
|
return { matchesFilter: false };
|
|
36
|
-
const displayValue =
|
|
35
|
+
const displayValue = node.value.displayValue?.toLowerCase() ?? "";
|
|
37
36
|
const matchesCount = countMatchesInString(displayValue, this.filterText);
|
|
38
37
|
if (matchesCount === 0)
|
|
39
38
|
return { matchesFilter: false };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAA4B,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAEpH;;;GAGG;AACH,MAAM,OAAO,gCAAiC,SAAQ,8BAA8B;IAGlF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;IACH,CAAC;IAED,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC;IAEjD,KAAK,CAAC,mBAAmB,CAAC,IAAoB
|
|
1
|
+
{"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAA4B,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAEpH;;;GAGG;AACH,MAAM,OAAO,gCAAiC,SAAQ,8BAA8B;IAGlF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;IACH,CAAC;IAED,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC;IAEjD,KAAK,CAAC,mBAAmB,CAAC,IAAoB;QACnD,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEjC,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClE,MAAM,YAAY,GAAG,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YACpB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAElC,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,YAAY;YACZ,aAAa,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;SACpC,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*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport { FilteredType, PropertyDataFilterResult, PropertyRecordDataFiltererBase } from \"./PropertyDataFiltererBase\";\n\n/**\n * Property data filterer which matches on Primitive Property Record display value text.\n * @public\n */\nexport class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText;\n }\n\n public get filterText(): string { return this._filterText; }\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() { return this.filterText !== \"\"; }\n\n public async recordMatchesFilter(node: PropertyRecord): Promise<PropertyDataFilterResult> {\n if (!this.isActive)\n return { matchesFilter: true };\n\n if (node.value.valueFormat !== PropertyValueFormat.Primitive)\n return { matchesFilter: false };\n\n const displayValue = node.value.displayValue?.toLowerCase() ?? \"\";\n const matchesCount = countMatchesInString(displayValue, this.filterText);\n\n if (matchesCount === 0)\n return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n matchesCount,\n filteredTypes: [FilteredType.Value],\n };\n }\n}\n"]}
|
package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js
CHANGED
|
@@ -2,7 +2,6 @@ import { FlatGridItemType, MutableFlatPropertyGridItem, } from "./MutableFlatGri
|
|
|
2
2
|
/** @internal */
|
|
3
3
|
export class MutableCustomGridCategory extends MutableFlatPropertyGridItem {
|
|
4
4
|
constructor(category, recordsDict, gridItemFactory, parentSelectionKey, depth) {
|
|
5
|
-
var _a;
|
|
6
5
|
super(depth, parentSelectionKey, parentSelectionKey);
|
|
7
6
|
this.type = FlatGridItemType.Category;
|
|
8
7
|
this.name = category.name;
|
|
@@ -12,7 +11,7 @@ export class MutableCustomGridCategory extends MutableFlatPropertyGridItem {
|
|
|
12
11
|
this._renderer = category.renderer;
|
|
13
12
|
// Even though categories are nested and have their own depth, categorized properties depth is counted starting with
|
|
14
13
|
// the parent category.
|
|
15
|
-
const categoryRecords =
|
|
14
|
+
const categoryRecords = recordsDict[category.name] ?? [];
|
|
16
15
|
this._children = categoryRecords.map((value) => gridItemFactory.createCategorizedProperty(value, this.selectionKey, this.selectionKey, 0));
|
|
17
16
|
this.lastInNumberOfCategories = -1;
|
|
18
17
|
}
|