@itwin/components-react 4.4.0 → 4.5.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 +18 -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/SubscriptionScheduler.d.ts +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.js +18 -23
- package/lib/cjs/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/cjs/components-react/common/UseAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseAsyncValue.js +6 -8
- package/lib/cjs/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +8 -7
- 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/StringTypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/StringTypeConverter.js +3 -5
- package/lib/cjs/components-react/converters/StringTypeConverter.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/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js +8 -2
- package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +6 -8
- 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 +3 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +6 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.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/filter-builder/FilterBuilderState.d.ts +13 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +8 -7
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.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 +4 -4
- 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 +3 -6
- 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/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.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 +48 -54
- 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/InternalToolbarComponent.js +4 -6
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/Observable.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/Observable.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/Observable.js +3 -4
- package/lib/cjs/components-react/tree/controlled/Observable.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts +1 -2
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js +37 -68
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js +6 -7
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +28 -35
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +6 -14
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js +3 -3
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.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/TreeModelMutator.js +2 -2
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +2 -3
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +53 -100
- 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/SubscriptionScheduler.d.ts +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.js +12 -17
- package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/esm/components-react/common/UseAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseAsyncValue.js +1 -3
- package/lib/esm/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +7 -6
- 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/StringTypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/StringTypeConverter.js +3 -5
- package/lib/esm/components-react/converters/StringTypeConverter.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/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js +7 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +6 -8
- 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 +3 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +6 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.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/filter-builder/FilterBuilderState.d.ts +13 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +8 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderState.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 +4 -4
- 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 +3 -6
- 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/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.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 +48 -54
- 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/InternalToolbarComponent.js +4 -6
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/Observable.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/Observable.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/Observable.js +1 -2
- package/lib/esm/components-react/tree/controlled/Observable.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts +1 -2
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js +24 -55
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.js +1 -2
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +18 -25
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +6 -14
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js +3 -3
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.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/TreeModelMutator.js +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +2 -3
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +52 -99
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRuleProperty.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleProperty.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA0D;AAC1D,kDAA+C;AAmB/C;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C,KAA6C;IAE7C,MAAM,EACJ,gBAAgB,EAChB,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,GACX,GAAG,KAAK,CAAC;IAEV,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CACjC,GAAG,EAAE,CACH,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5B,EAAE,EAAE,QAAQ,CAAC,IAAI;QACjB,KAAK,EAAE,QAAQ,CAAC,YAAY;QAC5B,KAAK,EAAE,QAAQ,CAAC,IAAI;KACrB,CAAC,CAAC,EACL,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,CAAC,IAAY,EAAE,EAAE;QACf,yBAAyB,CACvB,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CACtD,CAAC;IACJ,CAAC,EACD,CAAC,UAAU,EAAE,yBAAyB,CAAC,CACxC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,uBAAuB,GAAG,UAAU,CAAC,IAAI,CAC7C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"FilterBuilderRuleProperty.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleProperty.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA0D;AAC1D,kDAA+C;AAmB/C;;;GAGG;AACH,SAAgB,iCAAiC,CAC/C,KAA6C;IAE7C,MAAM,EACJ,gBAAgB,EAChB,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,GACX,GAAG,KAAK,CAAC;IAEV,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CACjC,GAAG,EAAE,CACH,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5B,EAAE,EAAE,QAAQ,CAAC,IAAI;QACjB,KAAK,EAAE,QAAQ,CAAC,YAAY;QAC5B,KAAK,EAAE,QAAQ,CAAC,IAAI;KACrB,CAAC,CAAC,EACL,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,CAAC,IAAY,EAAE,EAAE;QACf,yBAAyB,CACvB,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CACtD,CAAC;IACJ,CAAC,EACD,CAAC,UAAU,EAAE,yBAAyB,CAAC,CACxC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,uBAAuB,GAAG,UAAU,CAAC,IAAI,CAC7C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,gBAAgB,EAAE,IAAI,CACvD,CAAC;QACF,IAAI,uBAAuB,EAAE,IAAI,KAAK,gBAAgB,EAAE,IAAI;YAC1D,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;IACvD,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAE9D,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAGpC,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,EAAE;QACnC,OAAO,CACL,oBAAC,wBAAQ,IAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,IAC9C,gBAAgB;YACf,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC;YACtC,CAAC,CAAC,YAAY,CAAC,KAAK,CACb,CACZ,CAAC;IACJ,CAAC,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,eAAe;QAC5B,oBAAC,wBAAQ,IACP,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAC7B,UAAU,EAAE;gBACV,WAAW,EAAE,2BAAY,CAAC,SAAS,CAAC,8BAA8B,CAAC;gBACnE,QAAQ,EAAE,UAAU;gBACpB,IAAI,EAAE,OAAO;aACd,EACD,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,IAAI,GAC1B,CACE,CACP,CAAC;AACJ,CAAC;AArED,8EAqEC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type { ComboBoxProps, SelectOption } from \"@itwin/itwinui-react\";\nimport { ComboBox, MenuItem } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleProperty]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRulePropertyProps {\n /** List of available properties. */\n properties: PropertyDescription[];\n /** Currently selected property. */\n selectedProperty?: PropertyDescription;\n /** Callback that is invoked when selected property changes. */\n onSelectedPropertyChanged: (property?: PropertyDescription) => void;\n /** Custom renderer for property item inside selector. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies whether selector should be disabled or not. */\n isDisabled?: boolean;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] property selector.\n * @internal\n */\nexport function PropertyFilterBuilderRuleProperty(\n props: PropertyFilterBuilderRulePropertyProps\n) {\n const {\n selectedProperty,\n properties,\n onSelectedPropertyChanged,\n propertyRenderer,\n isDisabled,\n } = props;\n\n const selectOptions = React.useMemo<SelectOption<string>[]>(\n () =>\n properties.map((property) => ({\n id: property.name,\n label: property.displayLabel,\n value: property.name,\n })),\n [properties]\n );\n\n const onPropertyChanged = React.useCallback(\n (name: string) => {\n onSelectedPropertyChanged(\n properties.find((property) => property.name === name)\n );\n },\n [properties, onSelectedPropertyChanged]\n );\n\n React.useEffect(() => {\n const currentSelectedProperty = properties.find(\n (property) => property.name === selectedProperty?.name\n );\n if (currentSelectedProperty?.name !== selectedProperty?.name)\n onSelectedPropertyChanged(currentSelectedProperty);\n }, [properties, selectedProperty, onSelectedPropertyChanged]);\n\n const itemRenderer = React.useCallback<\n Required<ComboBoxProps<string>>[\"itemRenderer\"]\n >(\n (selectOption, { isSelected, id }) => {\n return (\n <MenuItem key={id} id={id} isSelected={isSelected}>\n {propertyRenderer\n ? propertyRenderer(selectOption.value)\n : selectOption.label}\n </MenuItem>\n );\n },\n [propertyRenderer]\n );\n\n return (\n <div className=\"rule-property\">\n <ComboBox\n options={selectOptions}\n onChange={onPropertyChanged}\n value={selectedProperty?.name}\n inputProps={{\n placeholder: UiComponents.translate(\"filterBuilder.chooseProperty\"),\n disabled: isDisabled,\n size: \"small\",\n }}\n itemRenderer={itemRenderer}\n enableVirtualization={true}\n />\n </div>\n );\n}\n"]}
|
|
@@ -41,7 +41,7 @@ const EditorContainer_1 = require("../editors/EditorContainer");
|
|
|
41
41
|
function PropertyFilterBuilderRuleValue(props) {
|
|
42
42
|
const { value, property, onChange } = props;
|
|
43
43
|
const propertyRecord = React.useMemo(() => {
|
|
44
|
-
return new appui_abstract_1.PropertyRecord(value
|
|
44
|
+
return new appui_abstract_1.PropertyRecord(value ?? { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive }, property);
|
|
45
45
|
}, [value, property]);
|
|
46
46
|
const onValueChange = React.useCallback(({ newValue }) => {
|
|
47
47
|
onChange(newValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4E;AAE5E,gEAA6D;AA0B7D;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,IAAI,+BAAc,CACvB,KAAK,
|
|
1
|
+
{"version":3,"file":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4E;AAE5E,gEAA6D;AA0B7D;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,IAAI,+BAAc,CACvB,KAAK,IAAI,EAAE,WAAW,EAAE,oCAAmB,CAAC,SAAS,EAAE,EACvD,QAAQ,CACT,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtB,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,EAAE,QAAQ,EAAuB,EAAE,EAAE;QACpC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,iCAAe,IACd,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,0BAA0B,CAAC,GAAG,EAAE,GAAE,CAAC,EAC7C,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,EACf,oBAAoB,EAAE,KAAK,GAC3B,CACH,CAAC;AACJ,CAAC;AA5BD,wEA4BC","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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../editors/EditorContainer\";\nimport { EditorContainer } from \"../editors/EditorContainer\";\nimport type { PropertyFilterRuleOperator } from \"./Operators\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleValue]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleValueProps {\n /** Currently entered value. */\n value?: PropertyValue;\n /** Property used in rule to which this value will be compared to. */\n property: PropertyDescription;\n /** Callback that is invoked when value changes. */\n onChange: (value: PropertyValue) => void;\n}\n\n/**\n * Props for custom [[PropertyFilterBuilderRuleValue]] renderer.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleValueRendererProps\n extends PropertyFilterBuilderRuleValueProps {\n /** Current operator. */\n operator: PropertyFilterRuleOperator;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @beta\n */\nexport function PropertyFilterBuilderRuleValue(\n props: PropertyFilterBuilderRuleValueProps\n) {\n const { value, property, onChange } = props;\n\n const propertyRecord = React.useMemo(() => {\n return new PropertyRecord(\n value ?? { valueFormat: PropertyValueFormat.Primitive },\n property\n );\n }, [value, property]);\n\n const onValueChange = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <EditorContainer\n propertyRecord={propertyRecord}\n onCancel={/* istanbul ignore next */ () => {}}\n onCommit={onValueChange}\n setFocus={false}\n shouldCommitOnChange={false}\n />\n );\n}\n"]}
|
|
@@ -91,6 +91,17 @@ export interface UsePropertyFilterBuilderProps {
|
|
|
91
91
|
/** Custom rule validator to be used when [[UsePropertyFilterBuilderResult.buildFilter]] is invoked. Should return error message or `undefined`, if rule is valid. */
|
|
92
92
|
ruleValidator?: (rule: PropertyFilterBuilderRule) => string | undefined;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Options for [[UsePropertyFilterBuilderResult.buildFilter]].
|
|
96
|
+
* @beta
|
|
97
|
+
*/
|
|
98
|
+
export interface BuildFilterOptions {
|
|
99
|
+
/**
|
|
100
|
+
* Specifies whether errors encountered while validating filter rules should be ignored and not persisted in state.
|
|
101
|
+
* This is useful in case component needs to get filter matching rule validator but does not want to show errors in UI.
|
|
102
|
+
*/
|
|
103
|
+
ignoreErrors?: boolean;
|
|
104
|
+
}
|
|
94
105
|
/**
|
|
95
106
|
* Type for [[usePropertyFilterBuilder]] return object.
|
|
96
107
|
* @beta
|
|
@@ -105,18 +116,14 @@ export interface UsePropertyFilterBuilderResult {
|
|
|
105
116
|
* custom validator provided through [[UsePropertyFilterBuilderProps]] to validate each rule.
|
|
106
117
|
* @returns [[PropertyFilter]] if all rules are valid, `undefined` otherwise.
|
|
107
118
|
*/
|
|
108
|
-
buildFilter: () => PropertyFilter | undefined;
|
|
119
|
+
buildFilter: (options?: BuildFilterOptions) => PropertyFilter | undefined;
|
|
109
120
|
}
|
|
110
121
|
/**
|
|
111
122
|
* Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes
|
|
112
123
|
* state from supplied initial filter.
|
|
113
124
|
* @beta
|
|
114
125
|
*/
|
|
115
|
-
export declare function usePropertyFilterBuilder(props?: UsePropertyFilterBuilderProps):
|
|
116
|
-
rootGroup: PropertyFilterBuilderRuleGroup;
|
|
117
|
-
actions: PropertyFilterBuilderActions;
|
|
118
|
-
buildFilter: () => PropertyFilter | undefined;
|
|
119
|
-
};
|
|
126
|
+
export declare function usePropertyFilterBuilder(props?: UsePropertyFilterBuilderProps): UsePropertyFilterBuilderResult;
|
|
120
127
|
/**
|
|
121
128
|
* Default rule validator.
|
|
122
129
|
* @beta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderState.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAEL,+BAA+B,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,K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AAmD;IAC5C,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,mBAAmB;IAUrE,mDAAmD;IAC5C,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,0BAA0B;IAe3E,gDAAgD;IACzC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,aAAa;IAQxD;;;OAGG;IACI,oBAAoB,CAAC,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAezE;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,kCAAkC,GACvC,IAAI,IAAI,8BAA8B,CAExC;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,mDAAmD;IACnD,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,qKAAqK;IACrK,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,yBAAyB,KAAK,MAAM,GAAG,SAAS,CAAC;CACzE;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mDAAmD;IACnD,SAAS,EAAE,8BAA8B,CAAC;IAC1C,gEAAgE;IAChE,OAAO,EAAE,4BAA4B,CAAC;IACtC;;;;OAIG;IACH,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"FilterBuilderState.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAEL,+BAA+B,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,SAAS,CAAC;AAGlE;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,kEAAkE;IAClE,SAAS,EAAE,8BAA8B,CAAC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|
164
164
|
function usePropertyFilterBuilder(props) {
|
|
165
|
-
const { initialFilter, ruleValidator } = props
|
|
165
|
+
const { initialFilter, ruleValidator } = props ?? {
|
|
166
166
|
initialFilter: undefined,
|
|
167
167
|
ruleValidator: undefined,
|
|
168
168
|
};
|
|
@@ -170,14 +170,15 @@ function usePropertyFilterBuilder(props) {
|
|
|
170
170
|
? convertFilterToState(initialFilter)
|
|
171
171
|
: { rootGroup: createEmptyRuleGroup() });
|
|
172
172
|
const [actions] = React.useState(() => new PropertyFilterBuilderActions(setState));
|
|
173
|
-
const buildFilter = () => {
|
|
173
|
+
const buildFilter = React.useCallback((options) => {
|
|
174
174
|
const ruleErrors = validateRules(state.rootGroup, ruleValidator);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return undefined;
|
|
175
|
+
if (!options?.ignoreErrors) {
|
|
176
|
+
actions.setRuleErrorMessages(ruleErrors);
|
|
178
177
|
}
|
|
179
|
-
return
|
|
180
|
-
|
|
178
|
+
return ruleErrors.size === 0
|
|
179
|
+
? buildPropertyFilter(state.rootGroup)
|
|
180
|
+
: undefined;
|
|
181
|
+
}, [state.rootGroup, actions, ruleValidator]);
|
|
181
182
|
return { rootGroup: state.rootGroup, actions, buildFilter };
|
|
182
183
|
}
|
|
183
184
|
exports.usePropertyFilterBuilder = usePropertyFilterBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,iCAAgC;AAChC,6CAA+B;AAE/B,0DAA4D;AAC5D,sDAA2C;AAC3C,2CAAyD;AACzD,2CAGqB;AAErB,mCAAoD;AACpD,kDAA+C;AAoD/C;;;GAGG;AACH,MAAa,4BAA4B;IACvC,YACU,QAIC;QAJD,aAAQ,GAAR,QAAQ,CAIP;IACR,CAAC;IAEI,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oBAAoB,CAAC,aAAa,CAAC;YAClC,oBAAoB,CAAC,cAAc,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAqC;IACxE,OAAO,CACL,QAAQ,KAAK,sCAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,sCAA0B,CAAC,UAAU,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAqC;IACjE,OAAO,CACL,QAAQ,KAAK,sCAA0B,CAAC,IAAI;QAC5C,QAAQ,KAAK,sCAA0B,CAAC,WAAW;QACnD,QAAQ,KAAK,sCAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,sCAA0B,CAAC,cAAc,CACvD,CAAC;AACJ,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 PropertyFilterBuilder\n */\n\nimport type { Draft } from \"immer\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { PropertyFilterRuleOperator } from \"./Operators\";\nimport {\n isUnaryPropertyFilterOperator,\n PropertyFilterRuleGroupOperator,\n} from \"./Operators\";\nimport type { PropertyFilter, PropertyFilterRule } from \"./Types\";\nimport { isPropertyFilterRuleGroup } from \"./Types\";\nimport { UiComponents } from \"../UiComponents\";\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component state.\n * @beta\n */\nexport interface PropertyFilterBuilderState {\n /** Root group of rules in [[PropertyFilterBuilder]] component. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n}\n\n/**\n * Type that describes [[PropertyFilterBuilder]] component group item.\n * @beta\n */\nexport type PropertyFilterBuilderRuleGroupItem =\n | PropertyFilterBuilderRuleGroup\n | PropertyFilterBuilderRule;\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component rule group.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleGroup {\n /** Id of this rule group. */\n id: string;\n /** Id of rule group that this group is nested in. */\n groupId?: string;\n /** Operator that should join items in this group. */\n operator: PropertyFilterRuleGroupOperator;\n /** Items in this group. */\n items: PropertyFilterBuilderRuleGroupItem[];\n}\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component single rule.\n * @beta\n */\nexport interface PropertyFilterBuilderRule {\n /** Id of this rule. */\n id: string;\n /** Id of rule group that this rule is nested in. */\n groupId: string;\n /** Property used in this rule. */\n property?: PropertyDescription;\n /** Operator that should be used to compare property value. */\n operator?: PropertyFilterRuleOperator;\n /** Value that property should be compared to. */\n value?: PropertyValue;\n /** Error message of this rule. */\n errorMessage?: string;\n}\n\n/**\n * Actions for controlling [[PropertyFilterBuilder]] component state.\n * @beta\n */\nexport class PropertyFilterBuilderActions {\n constructor(\n private setState: (\n setter: (\n prevState: PropertyFilterBuilderState\n ) => PropertyFilterBuilderState\n ) => void\n ) {}\n\n private updateState(\n updater: (state: Draft<PropertyFilterBuilderState>) => void\n ) {\n this.setState(produce(updater));\n }\n\n /** Adds new rule or group of rules to the group specified by path. */\n public addItem(path: string[], itemType: \"RULE_GROUP\" | \"RULE\") {\n this.updateState((state) => {\n const parentGroup = findRuleGroup(state.rootGroup, path);\n if (!parentGroup) return;\n const item =\n itemType === \"RULE_GROUP\"\n ? createEmptyRuleGroup(parentGroup.id)\n : createEmptyRule(parentGroup.id);\n parentGroup.items.push(item);\n });\n }\n\n /** Removes item specified by path. */\n public removeItem(path: string[]) {\n function removeItemFromGroup(\n state: Draft<PropertyFilterBuilderState>,\n pathToItem: string[]\n ) {\n const pathToParent = pathToItem.slice(0, -1);\n const parentGroup = findRuleGroup(state.rootGroup, pathToParent);\n if (!parentGroup) return;\n const itemId = pathToItem[pathToItem.length - 1];\n const itemIndex = parentGroup.items.findIndex(\n (item) => item.id === itemId\n );\n if (itemIndex === -1) return;\n if (parentGroup.items.length === 1) {\n parentGroup.items[0] = createEmptyRule(parentGroup.id);\n return;\n }\n parentGroup.items.splice(itemIndex, 1);\n }\n\n this.updateState((state) => {\n removeItemFromGroup(state, path);\n });\n }\n\n /** Sets operator of rule group specified by the path. */\n public setRuleGroupOperator(\n path: string[],\n operator: PropertyFilterRuleGroupOperator\n ) {\n this.updateState((state) => {\n const group = findRuleGroup(state.rootGroup, path);\n if (!group) return;\n group.operator = operator;\n });\n }\n\n /** Sets property of rule specified by the path. */\n public setRuleProperty(path: string[], property?: PropertyDescription) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n rule.property = property;\n rule.value = undefined;\n rule.errorMessage = undefined;\n });\n }\n\n /** Sets operator of rule specified by the path. */\n public setRuleOperator(path: string[], operator: PropertyFilterRuleOperator) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n if (isUnaryPropertyFilterOperator(operator)) rule.value = undefined;\n if (\n operator !== rule.operator &&\n !areOperatorsSimilar(operator, rule.operator)\n ) {\n rule.value = undefined;\n }\n rule.operator = operator;\n });\n }\n\n /** Sets value of rule specified by the path. */\n public setRuleValue(path: string[], value: PropertyValue) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n rule.value = value;\n });\n }\n\n /**\n * Sets error messages of the rules specified by id.\n * If rule id is not present in the map, then its error message will be cleared.\n */\n public setRuleErrorMessages(ruleIdsAndErrorMessages: Map<string, string>) {\n this.updateState((state) => {\n const setErrorMessages = (item: PropertyFilterBuilderRuleGroupItem) => {\n if (isPropertyFilterBuilderRuleGroup(item)) {\n item.items.forEach((itm) => {\n setErrorMessages(itm);\n });\n } else {\n item.errorMessage = ruleIdsAndErrorMessages.get(item.id);\n }\n };\n\n setErrorMessages(state.rootGroup);\n });\n }\n}\n\n/**\n * Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].\n * @beta\n */\nexport function isPropertyFilterBuilderRuleGroup(\n item: PropertyFilterBuilderRuleGroupItem\n): item is PropertyFilterBuilderRuleGroup {\n return (item as any).items !== undefined;\n}\n\n/**\n * Props for [[usePropertyFilterBuilder]]\n * @beta\n */\nexport interface UsePropertyFilterBuilderProps {\n /** Initial filter for [[PropertyFilterBuilder]] */\n initialFilter?: PropertyFilter;\n /** Custom rule validator to be used when [[UsePropertyFilterBuilderResult.buildFilter]] is invoked. Should return error message or `undefined`, if rule is valid. */\n ruleValidator?: (rule: PropertyFilterBuilderRule) => string | undefined;\n}\n\n/**\n * Type for [[usePropertyFilterBuilder]] return object.\n * @beta\n */\nexport interface UsePropertyFilterBuilderResult {\n /** Root group of the [[PropertyFilterBuilder]]. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n /** Actions for manipulating [[PropertyFilterBuilder]] state. */\n actions: PropertyFilterBuilderActions;\n /**\n * Validates and builds [[PropertyFilter]] based on current state. It uses [[defaultPropertyFilterBuilderRuleValidator]] or\n * custom validator provided through [[UsePropertyFilterBuilderProps]] to validate each rule.\n * @returns [[PropertyFilter]] if all rules are valid, `undefined` otherwise.\n */\n buildFilter: () => PropertyFilter | undefined;\n}\n\n/**\n * Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes\n * state from supplied initial filter.\n * @beta\n */\nexport function usePropertyFilterBuilder(\n props?: UsePropertyFilterBuilderProps\n) {\n const { initialFilter, ruleValidator } = props ?? {\n initialFilter: undefined,\n ruleValidator: undefined,\n };\n const [state, setState] = React.useState<PropertyFilterBuilderState>(\n initialFilter\n ? convertFilterToState(initialFilter)\n : { rootGroup: createEmptyRuleGroup() }\n );\n\n const [actions] = React.useState(\n () => new PropertyFilterBuilderActions(setState)\n );\n\n const buildFilter = () => {\n const ruleErrors = validateRules(state.rootGroup, ruleValidator);\n actions.setRuleErrorMessages(ruleErrors);\n if (ruleErrors.size > 0) {\n return undefined;\n }\n return buildPropertyFilter(state.rootGroup);\n };\n return { rootGroup: state.rootGroup, actions, buildFilter };\n}\n\nfunction validateRules(\n rule: PropertyFilterBuilderRuleGroupItem,\n ruleValidator?: (item: PropertyFilterBuilderRule) => string | undefined\n) {\n const ruleIdsAndErrorMessages = new Map<string, string>();\n\n const validateRulesInner = (item: PropertyFilterBuilderRuleGroupItem) => {\n if (isPropertyFilterBuilderRuleGroup(item)) {\n item.items.forEach((itm) => {\n validateRulesInner(itm);\n });\n } else {\n const errorMessage = ruleValidator\n ? ruleValidator(item)\n : defaultPropertyFilterBuilderRuleValidator(item);\n if (errorMessage) ruleIdsAndErrorMessages.set(item.id, errorMessage);\n }\n };\n\n validateRulesInner(rule);\n\n return ruleIdsAndErrorMessages;\n}\n\n/**\n * Default rule validator.\n * @beta\n */\nexport function defaultPropertyFilterBuilderRuleValidator(\n item: PropertyFilterBuilderRule\n): string | undefined {\n if (\n item.property === undefined ||\n item.operator === undefined ||\n isUnaryPropertyFilterOperator(item.operator)\n ) {\n return undefined;\n }\n if (item.value === undefined) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n if (\n item.value.valueFormat === PropertyValueFormat.Primitive &&\n (item.value.value === undefined || item.value.value === \"\")\n ) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n return undefined;\n}\n\n/** @internal */\nexport function buildPropertyFilter(\n groupItem: PropertyFilterBuilderRuleGroupItem\n): PropertyFilter | undefined {\n if (isPropertyFilterBuilderRuleGroup(groupItem))\n return buildPropertyFilterFromRuleGroup(groupItem);\n return buildPropertyFilterFromRule(groupItem);\n}\n\nfunction buildPropertyFilterFromRuleGroup(\n rootGroup: PropertyFilterBuilderRuleGroup\n): PropertyFilter | undefined {\n const rules = new Array<PropertyFilter>();\n for (const item of rootGroup.items) {\n const rule = buildPropertyFilter(item);\n if (rule) rules.push(rule);\n }\n\n if (rules.length === 0) return undefined;\n\n if (rules.length === 1) return rules[0];\n\n return {\n operator: rootGroup.operator,\n rules,\n };\n}\n\nfunction buildPropertyFilterFromRule(\n rule: PropertyFilterBuilderRule\n): PropertyFilter | undefined {\n const { property, operator, value } = rule;\n if (!property || operator === undefined) return undefined;\n\n if (\n !isUnaryPropertyFilterOperator(operator) &&\n (!value ||\n value.valueFormat !== PropertyValueFormat.Primitive ||\n value.value === undefined)\n )\n return undefined;\n\n return { property, operator, value };\n}\n\nfunction createEmptyRule(groupId: string): PropertyFilterBuilderRule {\n return {\n id: Guid.createValue(),\n groupId,\n };\n}\n\nfunction createEmptyRuleGroup(\n groupId?: string\n): PropertyFilterBuilderRuleGroup {\n const id = Guid.createValue();\n return {\n id,\n groupId,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [createEmptyRule(id)],\n };\n}\n\nfunction findRuleGroup(\n rootGroup: PropertyFilterBuilderRuleGroup,\n path: string[]\n): PropertyFilterBuilderRuleGroup | undefined {\n if (path.length === 0) return rootGroup;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem || !isPropertyFilterBuilderRuleGroup(currentItem))\n return undefined;\n\n return findRuleGroup(currentItem, rest);\n}\n\nfunction findRule(\n rootGroup: PropertyFilterBuilderRuleGroup,\n path: string[]\n): PropertyFilterBuilderRule | undefined {\n if (path.length === 0) return undefined;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem) return undefined;\n\n if (isPropertyFilterBuilderRuleGroup(currentItem))\n return findRule(currentItem, rest);\n\n return currentItem;\n}\n\nfunction getRuleGroupItem(\n filter: PropertyFilter,\n parentId: string\n): PropertyFilterBuilderRuleGroupItem {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter))\n return {\n id,\n groupId: parentId,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n };\n return getRuleItem(filter, id);\n}\n\nfunction getRuleItem(filter: PropertyFilterRule, parentId: string) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n property: filter.property,\n operator: filter.operator,\n value: filter.value,\n };\n}\n\nfunction convertFilterToState(\n filter: PropertyFilter\n): PropertyFilterBuilderState {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter)) {\n return {\n rootGroup: {\n id,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n },\n };\n }\n return {\n rootGroup: {\n id,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [getRuleItem(filter, id)],\n },\n };\n}\n\nfunction areOperatorsSimilar(\n firstOperator?: PropertyFilterRuleOperator,\n secondOperator?: PropertyFilterRuleOperator\n) {\n return (\n (isOperatorEqualOrIsNotEqual(firstOperator) &&\n isOperatorEqualOrIsNotEqual(secondOperator)) ||\n (isInequalityOperator(firstOperator) &&\n isInequalityOperator(secondOperator))\n );\n}\n\nfunction isOperatorEqualOrIsNotEqual(operator?: PropertyFilterRuleOperator) {\n return (\n operator === PropertyFilterRuleOperator.IsEqual ||\n operator === PropertyFilterRuleOperator.IsNotEqual\n );\n}\n\nfunction isInequalityOperator(operator?: PropertyFilterRuleOperator) {\n return (\n operator === PropertyFilterRuleOperator.Less ||\n operator === PropertyFilterRuleOperator.LessOrEqual ||\n operator === PropertyFilterRuleOperator.Greater ||\n operator === PropertyFilterRuleOperator.GreaterOrEqual\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,iCAAgC;AAChC,6CAA+B;AAE/B,0DAA4D;AAC5D,sDAA2C;AAC3C,2CAAyD;AACzD,2CAGqB;AAErB,mCAAoD;AACpD,kDAA+C;AAoD/C;;;GAGG;AACH,MAAa,4BAA4B;IACvC,YACU,QAIC;QAJD,aAAQ,GAAR,QAAQ,CAIP;IACR,CAAC;IAEI,WAAW,CACjB,O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C,cAA2C;IAE3C,OAAO,CACL,CAAC,2BAA2B,CAAC,aAAa,CAAC;QACzC,2BAA2B,CAAC,cAAc,CAAC,CAAC;QAC9C,CAAC,oBAAoB,CAAC,aAAa,CAAC;YAClC,oBAAoB,CAAC,cAAc,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAqC;IACxE,OAAO,CACL,QAAQ,KAAK,sCAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,sCAA0B,CAAC,UAAU,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAqC;IACjE,OAAO,CACL,QAAQ,KAAK,sCAA0B,CAAC,IAAI;QAC5C,QAAQ,KAAK,sCAA0B,CAAC,WAAW;QACnD,QAAQ,KAAK,sCAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,sCAA0B,CAAC,cAAc,CACvD,CAAC;AACJ,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 PropertyFilterBuilder\n */\n\nimport type { Draft } from \"immer\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { PropertyFilterRuleOperator } from \"./Operators\";\nimport {\n isUnaryPropertyFilterOperator,\n PropertyFilterRuleGroupOperator,\n} from \"./Operators\";\nimport type { PropertyFilter, PropertyFilterRule } from \"./Types\";\nimport { isPropertyFilterRuleGroup } from \"./Types\";\nimport { UiComponents } from \"../UiComponents\";\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component state.\n * @beta\n */\nexport interface PropertyFilterBuilderState {\n /** Root group of rules in [[PropertyFilterBuilder]] component. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n}\n\n/**\n * Type that describes [[PropertyFilterBuilder]] component group item.\n * @beta\n */\nexport type PropertyFilterBuilderRuleGroupItem =\n | PropertyFilterBuilderRuleGroup\n | PropertyFilterBuilderRule;\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component rule group.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleGroup {\n /** Id of this rule group. */\n id: string;\n /** Id of rule group that this group is nested in. */\n groupId?: string;\n /** Operator that should join items in this group. */\n operator: PropertyFilterRuleGroupOperator;\n /** Items in this group. */\n items: PropertyFilterBuilderRuleGroupItem[];\n}\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component single rule.\n * @beta\n */\nexport interface PropertyFilterBuilderRule {\n /** Id of this rule. */\n id: string;\n /** Id of rule group that this rule is nested in. */\n groupId: string;\n /** Property used in this rule. */\n property?: PropertyDescription;\n /** Operator that should be used to compare property value. */\n operator?: PropertyFilterRuleOperator;\n /** Value that property should be compared to. */\n value?: PropertyValue;\n /** Error message of this rule. */\n errorMessage?: string;\n}\n\n/**\n * Actions for controlling [[PropertyFilterBuilder]] component state.\n * @beta\n */\nexport class PropertyFilterBuilderActions {\n constructor(\n private setState: (\n setter: (\n prevState: PropertyFilterBuilderState\n ) => PropertyFilterBuilderState\n ) => void\n ) {}\n\n private updateState(\n updater: (state: Draft<PropertyFilterBuilderState>) => void\n ) {\n this.setState(produce(updater));\n }\n\n /** Adds new rule or group of rules to the group specified by path. */\n public addItem(path: string[], itemType: \"RULE_GROUP\" | \"RULE\") {\n this.updateState((state) => {\n const parentGroup = findRuleGroup(state.rootGroup, path);\n if (!parentGroup) return;\n const item =\n itemType === \"RULE_GROUP\"\n ? createEmptyRuleGroup(parentGroup.id)\n : createEmptyRule(parentGroup.id);\n parentGroup.items.push(item);\n });\n }\n\n /** Removes item specified by path. */\n public removeItem(path: string[]) {\n function removeItemFromGroup(\n state: Draft<PropertyFilterBuilderState>,\n pathToItem: string[]\n ) {\n const pathToParent = pathToItem.slice(0, -1);\n const parentGroup = findRuleGroup(state.rootGroup, pathToParent);\n if (!parentGroup) return;\n const itemId = pathToItem[pathToItem.length - 1];\n const itemIndex = parentGroup.items.findIndex(\n (item) => item.id === itemId\n );\n if (itemIndex === -1) return;\n if (parentGroup.items.length === 1) {\n parentGroup.items[0] = createEmptyRule(parentGroup.id);\n return;\n }\n parentGroup.items.splice(itemIndex, 1);\n }\n\n this.updateState((state) => {\n removeItemFromGroup(state, path);\n });\n }\n\n /** Sets operator of rule group specified by the path. */\n public setRuleGroupOperator(\n path: string[],\n operator: PropertyFilterRuleGroupOperator\n ) {\n this.updateState((state) => {\n const group = findRuleGroup(state.rootGroup, path);\n if (!group) return;\n group.operator = operator;\n });\n }\n\n /** Sets property of rule specified by the path. */\n public setRuleProperty(path: string[], property?: PropertyDescription) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n rule.property = property;\n rule.value = undefined;\n rule.errorMessage = undefined;\n });\n }\n\n /** Sets operator of rule specified by the path. */\n public setRuleOperator(path: string[], operator: PropertyFilterRuleOperator) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n if (isUnaryPropertyFilterOperator(operator)) rule.value = undefined;\n if (\n operator !== rule.operator &&\n !areOperatorsSimilar(operator, rule.operator)\n ) {\n rule.value = undefined;\n }\n rule.operator = operator;\n });\n }\n\n /** Sets value of rule specified by the path. */\n public setRuleValue(path: string[], value: PropertyValue) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) return;\n rule.value = value;\n });\n }\n\n /**\n * Sets error messages of the rules specified by id.\n * If rule id is not present in the map, then its error message will be cleared.\n */\n public setRuleErrorMessages(ruleIdsAndErrorMessages: Map<string, string>) {\n this.updateState((state) => {\n const setErrorMessages = (item: PropertyFilterBuilderRuleGroupItem) => {\n if (isPropertyFilterBuilderRuleGroup(item)) {\n item.items.forEach((itm) => {\n setErrorMessages(itm);\n });\n } else {\n item.errorMessage = ruleIdsAndErrorMessages.get(item.id);\n }\n };\n\n setErrorMessages(state.rootGroup);\n });\n }\n}\n\n/**\n * Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].\n * @beta\n */\nexport function isPropertyFilterBuilderRuleGroup(\n item: PropertyFilterBuilderRuleGroupItem\n): item is PropertyFilterBuilderRuleGroup {\n return (item as any).items !== undefined;\n}\n\n/**\n * Props for [[usePropertyFilterBuilder]]\n * @beta\n */\nexport interface UsePropertyFilterBuilderProps {\n /** Initial filter for [[PropertyFilterBuilder]] */\n initialFilter?: PropertyFilter;\n /** Custom rule validator to be used when [[UsePropertyFilterBuilderResult.buildFilter]] is invoked. Should return error message or `undefined`, if rule is valid. */\n ruleValidator?: (rule: PropertyFilterBuilderRule) => string | undefined;\n}\n\n/**\n * Options for [[UsePropertyFilterBuilderResult.buildFilter]].\n * @beta\n */\nexport interface BuildFilterOptions {\n /**\n * Specifies whether errors encountered while validating filter rules should be ignored and not persisted in state.\n * This is useful in case component needs to get filter matching rule validator but does not want to show errors in UI.\n */\n ignoreErrors?: boolean;\n}\n\n/**\n * Type for [[usePropertyFilterBuilder]] return object.\n * @beta\n */\nexport interface UsePropertyFilterBuilderResult {\n /** Root group of the [[PropertyFilterBuilder]]. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n /** Actions for manipulating [[PropertyFilterBuilder]] state. */\n actions: PropertyFilterBuilderActions;\n /**\n * Validates and builds [[PropertyFilter]] based on current state. It uses [[defaultPropertyFilterBuilderRuleValidator]] or\n * custom validator provided through [[UsePropertyFilterBuilderProps]] to validate each rule.\n * @returns [[PropertyFilter]] if all rules are valid, `undefined` otherwise.\n */\n buildFilter: (options?: BuildFilterOptions) => PropertyFilter | undefined;\n}\n\n/**\n * Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes\n * state from supplied initial filter.\n * @beta\n */\nexport function usePropertyFilterBuilder(\n props?: UsePropertyFilterBuilderProps\n): UsePropertyFilterBuilderResult {\n const { initialFilter, ruleValidator } = props ?? {\n initialFilter: undefined,\n ruleValidator: undefined,\n };\n const [state, setState] = React.useState<PropertyFilterBuilderState>(\n initialFilter\n ? convertFilterToState(initialFilter)\n : { rootGroup: createEmptyRuleGroup() }\n );\n\n const [actions] = React.useState(\n () => new PropertyFilterBuilderActions(setState)\n );\n\n const buildFilter = React.useCallback(\n (options?: BuildFilterOptions) => {\n const ruleErrors = validateRules(state.rootGroup, ruleValidator);\n if (!options?.ignoreErrors) {\n actions.setRuleErrorMessages(ruleErrors);\n }\n\n return ruleErrors.size === 0\n ? buildPropertyFilter(state.rootGroup)\n : undefined;\n },\n [state.rootGroup, actions, ruleValidator]\n );\n return { rootGroup: state.rootGroup, actions, buildFilter };\n}\n\nfunction validateRules(\n rule: PropertyFilterBuilderRuleGroupItem,\n ruleValidator?: (item: PropertyFilterBuilderRule) => string | undefined\n) {\n const ruleIdsAndErrorMessages = new Map<string, string>();\n\n const validateRulesInner = (item: PropertyFilterBuilderRuleGroupItem) => {\n if (isPropertyFilterBuilderRuleGroup(item)) {\n item.items.forEach((itm) => {\n validateRulesInner(itm);\n });\n } else {\n const errorMessage = ruleValidator\n ? ruleValidator(item)\n : defaultPropertyFilterBuilderRuleValidator(item);\n if (errorMessage) ruleIdsAndErrorMessages.set(item.id, errorMessage);\n }\n };\n\n validateRulesInner(rule);\n\n return ruleIdsAndErrorMessages;\n}\n\n/**\n * Default rule validator.\n * @beta\n */\nexport function defaultPropertyFilterBuilderRuleValidator(\n item: PropertyFilterBuilderRule\n): string | undefined {\n if (\n item.property === undefined ||\n item.operator === undefined ||\n isUnaryPropertyFilterOperator(item.operator)\n ) {\n return undefined;\n }\n if (item.value === undefined) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n if (\n item.value.valueFormat === PropertyValueFormat.Primitive &&\n (item.value.value === undefined || item.value.value === \"\")\n ) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n return undefined;\n}\n\n/** @internal */\nexport function buildPropertyFilter(\n groupItem: PropertyFilterBuilderRuleGroupItem\n): PropertyFilter | undefined {\n if (isPropertyFilterBuilderRuleGroup(groupItem))\n return buildPropertyFilterFromRuleGroup(groupItem);\n return buildPropertyFilterFromRule(groupItem);\n}\n\nfunction buildPropertyFilterFromRuleGroup(\n rootGroup: PropertyFilterBuilderRuleGroup\n): PropertyFilter | undefined {\n const rules = new Array<PropertyFilter>();\n for (const item of rootGroup.items) {\n const rule = buildPropertyFilter(item);\n if (rule) rules.push(rule);\n }\n\n if (rules.length === 0) return undefined;\n\n if (rules.length === 1) return rules[0];\n\n return {\n operator: rootGroup.operator,\n rules,\n };\n}\n\nfunction buildPropertyFilterFromRule(\n rule: PropertyFilterBuilderRule\n): PropertyFilter | undefined {\n const { property, operator, value } = rule;\n if (!property || operator === undefined) return undefined;\n\n if (\n !isUnaryPropertyFilterOperator(operator) &&\n (!value ||\n value.valueFormat !== PropertyValueFormat.Primitive ||\n value.value === undefined)\n )\n return undefined;\n\n return { property, operator, value };\n}\n\nfunction createEmptyRule(groupId: string): PropertyFilterBuilderRule {\n return {\n id: Guid.createValue(),\n groupId,\n };\n}\n\nfunction createEmptyRuleGroup(\n groupId?: string\n): PropertyFilterBuilderRuleGroup {\n const id = Guid.createValue();\n return {\n id,\n groupId,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [createEmptyRule(id)],\n };\n}\n\nfunction findRuleGroup(\n rootGroup: PropertyFilterBuilderRuleGroup,\n path: string[]\n): PropertyFilterBuilderRuleGroup | undefined {\n if (path.length === 0) return rootGroup;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem || !isPropertyFilterBuilderRuleGroup(currentItem))\n return undefined;\n\n return findRuleGroup(currentItem, rest);\n}\n\nfunction findRule(\n rootGroup: PropertyFilterBuilderRuleGroup,\n path: string[]\n): PropertyFilterBuilderRule | undefined {\n if (path.length === 0) return undefined;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem) return undefined;\n\n if (isPropertyFilterBuilderRuleGroup(currentItem))\n return findRule(currentItem, rest);\n\n return currentItem;\n}\n\nfunction getRuleGroupItem(\n filter: PropertyFilter,\n parentId: string\n): PropertyFilterBuilderRuleGroupItem {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter))\n return {\n id,\n groupId: parentId,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n };\n return getRuleItem(filter, id);\n}\n\nfunction getRuleItem(filter: PropertyFilterRule, parentId: string) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n property: filter.property,\n operator: filter.operator,\n value: filter.value,\n };\n}\n\nfunction convertFilterToState(\n filter: PropertyFilter\n): PropertyFilterBuilderState {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter)) {\n return {\n rootGroup: {\n id,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n },\n };\n }\n return {\n rootGroup: {\n id,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [getRuleItem(filter, id)],\n },\n };\n}\n\nfunction areOperatorsSimilar(\n firstOperator?: PropertyFilterRuleOperator,\n secondOperator?: PropertyFilterRuleOperator\n) {\n return (\n (isOperatorEqualOrIsNotEqual(firstOperator) &&\n isOperatorEqualOrIsNotEqual(secondOperator)) ||\n (isInequalityOperator(firstOperator) &&\n isInequalityOperator(secondOperator))\n );\n}\n\nfunction isOperatorEqualOrIsNotEqual(operator?: PropertyFilterRuleOperator) {\n return (\n operator === PropertyFilterRuleOperator.IsEqual ||\n operator === PropertyFilterRuleOperator.IsNotEqual\n );\n}\n\nfunction isInequalityOperator(operator?: PropertyFilterRuleOperator) {\n return (\n operator === PropertyFilterRuleOperator.Less ||\n operator === PropertyFilterRuleOperator.LessOrEqual ||\n operator === PropertyFilterRuleOperator.Greater ||\n operator === PropertyFilterRuleOperator.GreaterOrEqual\n );\n}\n"]}
|
|
@@ -61,7 +61,7 @@ class CommonPropertyRenderer {
|
|
|
61
61
|
return currentSize - minColumnLabelWidth;
|
|
62
62
|
}
|
|
63
63
|
static createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
|
|
64
|
-
const highlightCallback =
|
|
64
|
+
const highlightCallback = highlight?.applyOnValue
|
|
65
65
|
? CommonPropertyRenderer.createHighlightCallback(highlight, propertyRecord)
|
|
66
66
|
: undefined;
|
|
67
67
|
const rendererContext = {
|
|
@@ -85,10 +85,9 @@ class CommonPropertyRenderer {
|
|
|
85
85
|
return displayValue;
|
|
86
86
|
}
|
|
87
87
|
static createHighlightCallback(highlight, propertyRecord) {
|
|
88
|
-
var _a;
|
|
89
88
|
const activeMatch = highlight.activeHighlight;
|
|
90
|
-
const propertyName = activeMatch
|
|
91
|
-
const matchIndex =
|
|
89
|
+
const propertyName = activeMatch?.highlightedItemIdentifier;
|
|
90
|
+
const matchIndex = activeMatch?.highlightIndex ?? 0;
|
|
92
91
|
let labelMatches;
|
|
93
92
|
if (highlight.applyOnLabel) {
|
|
94
93
|
labelMatches = (0, countMatchesInString_1.countMatchesInString)(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAgD;AAChD,4EAAyE;AACzE,kEAA+D;AAG/D,kEAGiC;AAEjC;;GAEG;AACH,MAAa,sBAAsB;IAC1B,MAAM,CAAC,cAAc,CAC1B,WAAoB,EACpB,WAAyB,EACzB,KAAc,EACd,WAAoB,EACpB,mBAA4B;QAE5B,IAAI,CAAC,WAAW;YAAE,OAAO,CAAC,CAAC;QAE3B,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,CAAC,CAAC;QACpB,IACE,WAAW,KAAK,wBAAW,CAAC,UAAU;YACtC,CAAC,KAAK;YACN,CAAC,WAAW;YACZ,CAAC,mBAAmB;YAEpB,OAAO,WAAW,GAAG,SAAS,CAAC;QAEjC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC;QACnD,MAAM,eAAe,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;QACtE,IAAI,WAAW,IAAI,eAAe;YAAE,OAAO,WAAW,GAAG,SAAS,CAAC;QAEnE,MAAM,SAAS,GACb,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,WAAW,IAAI,SAAS;YAC1B,OAAO,CACL,SAAS;gBACT,IAAI,CAAC,cAAc,CACjB,WAAW,GAAG,CAAC,EACf,WAAW,EACX,KAAK,EACL,WAAW,EACX,mBAAmB,CACpB,CACF,CAAC;QAEJ,OAAO,WAAW,GAAG,mBAAmB,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,qBAAqB,CACjC,WAAwB,EACxB,cAA8B,EAC9B,WAAoB,EACpB,4BAA2D,EAC3D,UAAoB,EACpB,kBAA+B,EAC/B,eAA6C,EAC7C,SAGC;QAED,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAgD;AAChD,4EAAyE;AACzE,kEAA+D;AAG/D,kEAGiC;AAEjC;;GAEG;AACH,MAAa,sBAAsB;IAC1B,MAAM,CAAC,cAAc,CAC1B,WAAoB,EACpB,WA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AAU,EAAE,SAAS,CAAC,eAAe,GACrC,CACH,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AApID,wDAoIC","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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { countMatchesInString } from \"../../common/countMatchesInString\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyValueRendererContext } from \"../ValueRendererManager\";\nimport {\n PropertyContainerType,\n PropertyValueRendererManager,\n} from \"../ValueRendererManager\";\n\n/**\n * @internal\n */\nexport class CommonPropertyRenderer {\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n if (!indentation) return 0;\n\n const maxIndent = 17;\n const minIndent = 6;\n if (\n orientation !== Orientation.Horizontal ||\n !width ||\n !columnRatio ||\n !minColumnLabelWidth\n )\n return indentation * maxIndent;\n\n const currentSize = Math.ceil(width * columnRatio);\n const shrinkThreshold = minColumnLabelWidth + maxIndent * indentation;\n if (currentSize >= shrinkThreshold) return indentation * maxIndent;\n\n const minShrink =\n minColumnLabelWidth + minIndent + maxIndent * (indentation - 1);\n if (currentSize <= minShrink)\n return (\n minIndent +\n this.getLabelOffset(\n indentation - 1,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n )\n );\n\n return currentSize - minColumnLabelWidth;\n }\n\n public static createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n }\n ) {\n const highlightCallback = highlight?.applyOnValue\n ? CommonPropertyRenderer.createHighlightCallback(\n highlight,\n propertyRecord\n )\n : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(\n propertyRecord,\n rendererContext\n );\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(\n propertyRecord,\n rendererContext\n );\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = (\n <span\n style={{\n paddingLeft: CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation\n ),\n }}\n >\n {displayValue}\n </span>\n );\n\n return displayValue;\n }\n\n private static createHighlightCallback(\n highlight: HighlightingComponentProps & { applyOnLabel: boolean },\n propertyRecord: PropertyRecord\n ) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(\n propertyRecord.property.displayLabel.toLowerCase(),\n highlight.highlightedText\n );\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex =\n propertyRecord.property.name === propertyName &&\n matchIndex - labelMatches >= 0\n ? matchIndex - labelMatches\n : undefined;\n const highlightCallback = (text: string) => (\n <HighlightedText\n text={text}\n activeMatchIndex={activeMatchIndex}\n searchText={highlight.highlightedText}\n />\n );\n\n return highlightCallback;\n }\n}\n"]}
|
|
@@ -66,7 +66,7 @@ class NonPrimitivePropertyRenderer extends React.Component {
|
|
|
66
66
|
getLabel(props, state) {
|
|
67
67
|
const { orientation, indentation, width, columnRatio, columnInfo } = props;
|
|
68
68
|
// istanbul ignore next
|
|
69
|
-
const minLabelWidth = columnInfo
|
|
69
|
+
const minLabelWidth = columnInfo?.minLabelWidth;
|
|
70
70
|
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minLabelWidth);
|
|
71
71
|
let displayLabel = props.propertyRecord.property.displayLabel;
|
|
72
72
|
if (this.props.propertyRecord.value.valueFormat === appui_abstract_1.PropertyValueFormat.Array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAA6C;AAC7C,6CAA+B;AAC/B,0DAA4E;AAC5E,qEAAkE;AAClE,iGAA8F;AAE9F,yDAAsD;AACtD,iDAA8C;AAmB9C;;GAEG;AACH,MAAa,4BAA6B,SAAQ,KAAK,CAAC,SAGvD;IAQC,YAAY,KAAwC;QAClD,KAAK,CAAC,KAAK,CAAC,CAAC;QARf,gBAAgB;QACS,UAAK,GAAsC;YAClE,0FAA0F;YAC1F,UAAU,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;SACpE,CAAC;QAMM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QAEM,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;QAiDM,2BAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS;gBACjC,CAAC,CAAC,IAAI,CAA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GACT,CACH,CAAC,CAAC,CAAC,SAAS;YAEZ,IAAI,CAAC,KAAK,CAAC,UAAU;gBACpB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC;gBACxC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF;AAxHD,oEAwHC","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 Properties\n */\n\nimport \"./NonPrimitivePropertyRenderer.scss\";\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyLabelRenderer } from \"./label/NonPrimitivePropertyLabelRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PropertyRenderer } from \"./PropertyRenderer\";\nimport { PropertyView } from \"./PropertyView\";\n\n/** Properties of [[NonPrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface NonPrimitivePropertyRendererProps\n extends PrimitiveRendererProps {\n /** Can struct/array property be collapsed */\n isCollapsible?: boolean;\n}\n\n/** State of [[NonPrimitivePropertyRenderer]] React component\n * @internal\n */\ninterface NonPrimitivePropertyRendererState {\n /** Is struct/array property expanded */\n isExpanded?: boolean;\n}\n\n/** React Component that renders struct and array properties\n * @public\n */\nexport class NonPrimitivePropertyRenderer extends React.Component<\n NonPrimitivePropertyRendererProps,\n NonPrimitivePropertyRendererState\n> {\n /** @internal */\n public override readonly state: NonPrimitivePropertyRendererState = {\n /** If it's not collapsible, that means it's expanded by default and can't be collapsed */\n isExpanded:\n !this.props.isCollapsible || this.props.propertyRecord.autoExpand,\n };\n\n constructor(props: NonPrimitivePropertyRendererProps) {\n super(props);\n }\n\n private _onExpanded = () => {\n this.setState({ isExpanded: true });\n };\n\n private _onCollapsed = () => {\n this.setState({ isExpanded: false });\n };\n\n private getLabel(\n props: NonPrimitivePropertyRendererProps,\n state: NonPrimitivePropertyRendererState\n ): React.ReactNode {\n const { orientation, indentation, width, columnRatio, columnInfo } = props;\n // istanbul ignore next\n const minLabelWidth = columnInfo?.minLabelWidth;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minLabelWidth\n );\n\n let displayLabel = props.propertyRecord.property.displayLabel;\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;\n\n return (\n <NonPrimitivePropertyLabelRenderer\n isExpanded={!!state.isExpanded}\n onExpand={this._onExpanded}\n onCollapse={this._onCollapsed}\n offset={offset}\n renderColon={false}\n >\n {displayLabel}\n </NonPrimitivePropertyLabelRenderer>\n );\n }\n\n private overrideArrayChildrenNames(items: PropertyRecord[]) {\n const modifiedProperties: PropertyRecord[] = items.map(\n (item, index): PropertyRecord => {\n const newProperty = { ...item.property };\n newProperty.displayLabel = `[${index + 1}]`;\n newProperty.name = `${newProperty.name}_${index}`;\n return new PropertyRecord(item.value, newProperty);\n }\n );\n\n return modifiedProperties;\n }\n\n private _renderPropertyForItem = (item: PropertyRecord) => {\n const prefix = this.props.uniqueKey\n ? this.props.uniqueKey\n : this.props.propertyRecord.property.name;\n const uniqueKey = `${prefix}_${item.property.name}`;\n return (\n <PropertyRenderer\n key={uniqueKey}\n uniqueKey={uniqueKey}\n propertyRecord={item}\n indentation={this.props.indentation ? this.props.indentation + 1 : 1}\n orientation={this.props.orientation}\n columnRatio={this.props.columnRatio}\n actionButtonRenderers={this.props.actionButtonRenderers}\n onColumnRatioChanged={this.props.onColumnRatioChanged}\n width={this.props.width}\n isResizeHandleHovered={this.props.isResizeHandleHovered}\n onResizeHandleHoverChanged={this.props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={this.props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={this.props.onResizeHandleDragChanged}\n columnInfo={this.props.columnInfo}\n />\n );\n };\n\n /** @internal */\n public override render() {\n let items: PropertyRecord[] =\n this.props.propertyRecord.getChildrenRecords();\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n items = this.overrideArrayChildrenNames(items);\n\n const { indentation, ...props } = this.props;\n return (\n <>\n {this.props.isCollapsible ? (\n <PropertyView\n labelElement={this.getLabel(this.props, this.state)}\n {...props}\n />\n ) : undefined}\n\n {this.state.isExpanded\n ? items.map(this._renderPropertyForItem)\n : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -46,12 +46,11 @@ class PrimitivePropertyRenderer extends React.Component {
|
|
|
46
46
|
}
|
|
47
47
|
/** @internal */
|
|
48
48
|
render() {
|
|
49
|
-
var _a, _b;
|
|
50
49
|
const { indentation, highlight, ...props } = this.props;
|
|
51
50
|
const displayLabel = this.props.propertyRecord.property.displayLabel;
|
|
52
|
-
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio,
|
|
51
|
+
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio, props.columnInfo?.minLabelWidth);
|
|
53
52
|
const activeMatchIndex = this.props.propertyRecord.property.name ===
|
|
54
|
-
|
|
53
|
+
highlight?.activeHighlight?.highlightedItemIdentifier
|
|
55
54
|
? highlight.activeHighlight.highlightIndex
|
|
56
55
|
: undefined;
|
|
57
56
|
const label = highlight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C;AAiB9C;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAAiC;IACpF,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,gBAAgB;IACA,MAAM
|
|
1
|
+
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C;AAiB9C;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAAiC;IACpF,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;QACrE,MAAM,MAAM,GAAG,+CAAsB,CAAC,cAAc,CAClD,WAAW,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,UAAU,EAAE,aAAa,CAChC,CAAC;QAEF,MAAM,gBAAgB,GACpB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI;YACvC,SAAS,EAAE,eAAe,EAAE,yBAAyB;YACnD,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,cAAc;YAC1C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,KAAK,GAAG,SAAS;YACrB,CAAC,CAAC,IAAA,iCAAe,EAAC;gBACd,IAAI,EAAE,YAAY;gBAClB,UAAU,EAAE,SAAS,CAAC,eAAe;gBACrC,gBAAgB;aACjB,CAAC;YACJ,CAAC,CAAC,YAAY,CAAC;QAEjB,OAAO,CACL,oBAAC,2BAAY,OACP,KAAK,EACT,YAAY,EACV,oBAAC,+DAA8B,IAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,wBAAW,CAAC,UAAU,EAC9D,OAAO,EAAE,YAAY,IAEpB,KAAK,CACyB,GAEnC,CACH,CAAC;IACJ,CAAC;CACF;AA7CD,8DA6CC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { PrimitivePropertyLabelRenderer } from \"./label/PrimitivePropertyLabelRenderer\";\nimport type { SharedRendererProps } from \"./PropertyRenderer\";\nimport { PropertyView } from \"./PropertyView\";\n\n/** Properties of [[PrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface PrimitiveRendererProps extends SharedRendererProps {\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Properties used for highlighting\n */\n highlight?: HighlightingComponentProps;\n}\n\n/** React Component that renders primitive properties\n * @public\n */\nexport class PrimitivePropertyRenderer extends React.Component<PrimitiveRendererProps> {\n constructor(props: PrimitiveRendererProps) {\n super(props);\n }\n\n /** @internal */\n public override render() {\n const { indentation, highlight, ...props } = this.props;\n const displayLabel = this.props.propertyRecord.property.displayLabel;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\n );\n\n const activeMatchIndex =\n this.props.propertyRecord.property.name ===\n highlight?.activeHighlight?.highlightedItemIdentifier\n ? highlight.activeHighlight.highlightIndex\n : undefined;\n const label = highlight\n ? HighlightedText({\n text: displayLabel,\n searchText: highlight.highlightedText,\n activeMatchIndex,\n })\n : displayLabel;\n\n return (\n <PropertyView\n {...props}\n labelElement={\n <PrimitivePropertyLabelRenderer\n offset={offset}\n renderColon={this.props.orientation === Orientation.Horizontal}\n tooltip={displayLabel}\n >\n {label}\n </PrimitivePropertyLabelRenderer>\n }\n />\n );\n }\n}\n"]}
|
|
@@ -44,10 +44,10 @@ class PropertyLabelRenderer extends React.PureComponent {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const title = this.props.tooltip ??
|
|
48
|
+
(typeof this.props.children == "string"
|
|
49
|
+
? this.props.children
|
|
50
|
+
: /* istanbul ignore next */ undefined);
|
|
51
51
|
return (React.createElement(React.Fragment, null,
|
|
52
52
|
React.createElement("span", { className: "components-property-label-renderer", title: title }, this.props.children),
|
|
53
53
|
this.props.renderColon ? (React.createElement("span", { className: "components-property-label-renderer-colon" }, ":")) : undefined));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;AAc/B,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAyC;IACxF,6EAA6E;IACtE,MAAM,CAAC,QAAQ,CAAC,MAAe;QACpC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,eAAe,MAAM,KAAK;SAClC,CAAC;IACJ,CAAC;IAEe,MAAM
|
|
1
|
+
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;AAc/B,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAyC;IACxF,6EAA6E;IACtE,MAAM,CAAC,QAAQ,CAAC,MAAe;QACpC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,eAAe,MAAM,KAAK;SAClC,CAAC;IACJ,CAAC;IAEe,MAAM;QACpB,MAAM,KAAK,GACT,IAAI,CAAC,KAAK,CAAC,OAAO;YAClB,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ;gBACrC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACrB,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,CACL;YACE,8BAAM,SAAS,EAAC,oCAAoC,EAAC,KAAK,EAAE,KAAK,IAC9D,IAAI,CAAC,KAAK,CAAC,QAAQ,CACf;YACN,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CACxB,8BAAM,SAAS,EAAC,0CAA0C,QAAS,CACpE,CAAC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF;AA3BD,sDA2BC","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 Properties\n */\n\nimport \"./PropertyLabelRenderer.scss\";\nimport * as React from \"react\";\n\n/** Base properties for a property label renderer\n * @public\n */\nexport interface PropertyLabelRendererProps {\n /** Label to be rendered */\n children: string | React.ReactElement;\n /** Indicates whether to render a colon after the label */\n renderColon?: boolean;\n /** Custom tooltip for the component. */\n tooltip?: string;\n}\n\n/** @internal */\nexport class PropertyLabelRenderer extends React.PureComponent<PropertyLabelRendererProps> {\n /** Get React CSS style object based on provided offset from the left side */\n public static getStyle(offset?: number): React.CSSProperties {\n offset = offset ? offset : 0;\n return {\n paddingLeft: offset,\n width: `calc(100% - ${offset}px)`,\n };\n }\n\n public override render() {\n const title =\n this.props.tooltip ??\n (typeof this.props.children == \"string\"\n ? this.props.children\n : /* istanbul ignore next */ undefined);\n return (\n <>\n <span className=\"components-property-label-renderer\" title={title}>\n {this.props.children}\n </span>\n {this.props.renderColon ? (\n <span className=\"components-property-label-renderer-colon\">:</span>\n ) : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -51,10 +51,9 @@ class DoublePropertyValueRenderer {
|
|
|
51
51
|
}
|
|
52
52
|
exports.DoublePropertyValueRenderer = DoublePropertyValueRenderer;
|
|
53
53
|
function convertRecordToString(record) {
|
|
54
|
-
var _a;
|
|
55
54
|
const primitive = record.value;
|
|
56
55
|
if (primitive.displayValue)
|
|
57
56
|
return primitive.displayValue;
|
|
58
|
-
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename,
|
|
57
|
+
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);
|
|
59
58
|
}
|
|
60
59
|
//# sourceMappingURL=DoublePropertyValueRenderer.js.map
|
package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAC/E,mFAAgF;AAKhF,qFAAsF;AAEtF;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,MAAM,CACtD,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,mEAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;IACJ,CAAC;CACF;AAtBD,kEAsBC;AAED,SAAS,qBAAqB,CAC5B,MAAsB
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAC/E,mFAAgF;AAKhF,qFAAsF;AAEtF;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,MAAM,CACtD,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,mEAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;IACJ,CAAC;CACF;AAtBD,kEAsBC;AAED,SAAS,qBAAqB,CAC5B,MAAsB;IAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,IAAI,SAAS,CAAC,YAAY;QAAE,OAAO,SAAS,CAAC,YAAY,CAAC;IAC1D,OAAO,2CAAoB,CAAC,YAAY,CACtC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAChC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9D,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PrimitiveValue, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\n\n/** Default Double Property Renderer\n * @public\n */\nexport class DoublePropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n record.value.valueFormat === PropertyValueFormat.Primitive &&\n record.property.typename === StandardTypeNames.Double\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return (\n <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertRecordToString}\n />\n );\n }\n}\n\nfunction convertRecordToString(\n record: PropertyRecord\n): string | Promise<string> {\n const primitive = record.value as PrimitiveValue;\n if (primitive.displayValue) return primitive.displayValue;\n return TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, primitive.value);\n}\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js
CHANGED
|
@@ -54,9 +54,8 @@ class MultilineTextPropertyValueRenderer {
|
|
|
54
54
|
}
|
|
55
55
|
exports.MultilineTextPropertyValueRenderer = MultilineTextPropertyValueRenderer;
|
|
56
56
|
const MultilineTextPropertyValueRendererImpl = (props) => {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
58
57
|
const { stringValue, element } = (0, PrimitivePropertyValueRenderer_1.useRenderedStringValue)(props.record, convertRecordToString, props.context);
|
|
59
|
-
return (React.createElement(exports.MultilineTextRenderer, { style:
|
|
58
|
+
return (React.createElement(exports.MultilineTextRenderer, { style: props.context?.style, stringValue: stringValue, isExpanded: props.context?.isExpanded, onExpansionToggled: props.context?.onExpansionToggled, onHeightChanged: props.context?.onHeightChanged }, element));
|
|
60
59
|
};
|
|
61
60
|
/** @internal */
|
|
62
61
|
const MultilineTextRenderer = (props) => {
|
|
@@ -66,18 +65,16 @@ const MultilineTextRenderer = (props) => {
|
|
|
66
65
|
const [contentOverflows, setContentOverflows] = (0, react_1.useState)(false);
|
|
67
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
67
|
(0, react_1.useLayoutEffect)(() => {
|
|
69
|
-
var _a;
|
|
70
68
|
(0, core_bentley_1.assert)(divRef.current !== null && spanRef.current !== null);
|
|
71
69
|
setContentOverflows(spanRef.current.clientWidth < spanRef.current.scrollWidth);
|
|
72
70
|
const currentHeight = Math.max(divRef.current.offsetHeight, 27);
|
|
73
71
|
if (currentHeight !== previousHeightRef.current) {
|
|
74
|
-
|
|
72
|
+
props.onHeightChanged?.(currentHeight);
|
|
75
73
|
previousHeightRef.current = currentHeight;
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
76
|
const handleExpansionToggleClick = (event) => {
|
|
79
|
-
|
|
80
|
-
(_a = props.onExpansionToggled) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
77
|
+
props.onExpansionToggled?.();
|
|
81
78
|
event.stopPropagation();
|
|
82
79
|
};
|
|
83
80
|
// In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,iCAA0D;AAC1D,sDAA6C;AAE7C,0DAA+E;AAC/E,mFAAgF;AAChF,wDAAqD;AAKrD,qFAA0E;AAC1E,4DAAoC;AAEpC,gBAAgB;AAChB,MAAa,kCAAkC;IAGtC,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAEM,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,sCAAsC,IACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;IACJ,CAAC;CACF;AAlBD,gFAkBC;AAQD,MAAM,sCAAsC,GAExC,CAAC,KAAK,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,CAAC,MAAM,EAAE,EAC9D,OAAO,EAAE,0BAA0B,IAElC,2BAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC,CACrC,CACJ;QACN,gBAAgB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACxC,gCAAQ,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,0BAA0B,IAClE,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CACnC,CACV,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,qBAAqB,yBAqDhC;AAEF,SAAS,qBAAqB,CAC5B,MAAsB;IAEtB,OAAO,2CAAoB,CAAC,YAAY,CACtC,kCAAiB,CAAC,IAAI,CACvB,CAAC,uBAAuB,CACvB,MAAM,CAAC,QAAQ,EACd,MAAM,CAAC,KAAwB,CAAC,KAAK,CACvC,CAAC;AACJ,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 Properties\n */\n\nimport * as React from \"react\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { PrimitiveValue, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { useRenderedStringValue } from \"./PrimitivePropertyValueRenderer\";\nimport classnames from \"classnames\";\n\n/** @internal */\nexport class MultilineTextPropertyValueRenderer\n implements IPropertyValueRenderer\n{\n public canRender(record: PropertyRecord): boolean {\n return record.value.valueFormat === PropertyValueFormat.Primitive;\n }\n\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ): React.ReactNode {\n return (\n <MultilineTextPropertyValueRendererImpl\n record={record}\n context={context}\n />\n );\n }\n}\n\ninterface MultilineTextPropertyValueRendererImplProps {\n record: PropertyRecord;\n context?: PropertyValueRendererContext;\n children?: never;\n}\n\nconst MultilineTextPropertyValueRendererImpl: React.FC<\n MultilineTextPropertyValueRendererImplProps\n> = (props) => {\n const { stringValue, element } = useRenderedStringValue(\n props.record,\n convertRecordToString,\n props.context\n );\n return (\n <MultilineTextRenderer\n style={props.context?.style}\n stringValue={stringValue}\n isExpanded={props.context?.isExpanded}\n onExpansionToggled={props.context?.onExpansionToggled}\n onHeightChanged={props.context?.onHeightChanged}\n >\n {element}\n </MultilineTextRenderer>\n );\n};\n\ninterface MultilineTextRendererProps {\n stringValue?: string;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n style?: React.CSSProperties;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\nexport const MultilineTextRenderer: React.FC<MultilineTextRendererProps> = (\n props\n) => {\n const spanRef = useRef<HTMLSpanElement>(null);\n const divRef = useRef<HTMLDivElement>(null);\n const previousHeightRef = useRef(0);\n const [contentOverflows, setContentOverflows] = useState<boolean>(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n assert(divRef.current !== null && spanRef.current !== null);\n\n setContentOverflows(\n spanRef.current.clientWidth < spanRef.current.scrollWidth\n );\n\n const currentHeight = Math.max(divRef.current.offsetHeight, 27);\n if (currentHeight !== previousHeightRef.current) {\n props.onHeightChanged?.(currentHeight);\n previousHeightRef.current = currentHeight;\n }\n });\n\n const handleExpansionToggleClick = (event: React.MouseEvent) => {\n props.onExpansionToggled?.();\n event.stopPropagation();\n };\n\n // In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.\n // https://github.com/facebook/react/issues/6807\n return (\n <div ref={divRef} className=\"multiline\">\n <span\n ref={spanRef}\n className={classnames(\"content\", { expanded: props.isExpanded })}\n style={props.style}\n title={props.isExpanded ? undefined : props.stringValue}\n >\n {props.children}\n <button\n className=\"expand-toggle\"\n style={{ display: props.isExpanded ? \"inline-block\" : \"none\" }}\n onClick={handleExpansionToggleClick}\n >\n {UiComponents.translate(\"property.collapse\")}\n </button>\n </span>\n {contentOverflows && !props.isExpanded && (\n <button className=\"expand-toggle\" onClick={handleExpansionToggleClick}>\n {UiComponents.translate(\"property.expand\")}\n </button>\n )}\n </div>\n );\n};\n\nfunction convertRecordToString(\n record: PropertyRecord\n): string | Promise<string> {\n return TypeConverterManager.getConverter(\n StandardTypeNames.Text\n ).convertPropertyToString(\n record.property,\n (record.value as PrimitiveValue).value\n );\n}\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js
CHANGED
|
@@ -51,10 +51,9 @@ class NavigationPropertyValueRenderer {
|
|
|
51
51
|
}
|
|
52
52
|
exports.NavigationPropertyValueRenderer = NavigationPropertyValueRenderer;
|
|
53
53
|
function convertRecordToString(record) {
|
|
54
|
-
var _a;
|
|
55
54
|
const primitive = record.value;
|
|
56
55
|
if (primitive.displayValue)
|
|
57
56
|
return primitive.displayValue;
|
|
58
|
-
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename,
|
|
57
|
+
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);
|
|
59
58
|
}
|
|
60
59
|
//# sourceMappingURL=NavigationPropertyValueRenderer.js.map
|