@itwin/components-react 4.8.3 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/lib/cjs/components-react/UiComponents.d.ts.map +1 -1
- package/lib/cjs/components-react/UiComponents.js +1 -0
- package/lib/cjs/components-react/UiComponents.js.map +1 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts +2 -2
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.d.ts +2 -2
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.js +1 -0
- package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js +1 -0
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/IconEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts +2 -2
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.d.ts +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +2 -2
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +7 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +3 -7
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +0 -36
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +1 -73
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts +24 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js +30 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.d.ts +31 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js +76 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +4 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +16 -12
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +38 -29
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +10 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +15 -40
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +25 -59
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +11 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +43 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +4 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +40 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +10 -11
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +151 -44
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts +20 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +30 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +24 -19
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +40 -64
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.d.ts +2 -2
- package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.d.ts +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.d.ts +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/ActionButtonList.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/ArrayValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/StructValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +5 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +42 -10
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts +12 -0
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +22 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -2
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ItemWrapper.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.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/ToolbarWithOverflow.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Column.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Columns.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Panel.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Title.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts +12 -0
- package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js +22 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +1 -0
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +2 -2
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeEditor.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts +1 -1
- package/lib/cjs/components-react.d.ts +3 -0
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +3 -0
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/UiComponents.d.ts.map +1 -1
- package/lib/esm/components-react/UiComponents.js +1 -0
- package/lib/esm/components-react/UiComponents.js.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.d.ts +2 -2
- package/lib/esm/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.d.ts +2 -2
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.js +1 -0
- package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js +1 -0
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.d.ts +2 -2
- package/lib/esm/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -2
- package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.d.ts +2 -2
- package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/IconEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts +2 -2
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.d.ts +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +2 -2
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +7 -3
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +4 -8
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +0 -36
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +0 -71
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts +24 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js +23 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.d.ts +31 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js +73 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +4 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +20 -16
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +38 -29
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +10 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +17 -42
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +25 -59
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +11 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +41 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +4 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +39 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +10 -11
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +149 -42
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts +20 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +23 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts +24 -19
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +37 -61
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.d.ts +2 -2
- package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.d.ts +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.d.ts +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/ActionButtonList.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/ArrayValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/StructValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +5 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +21 -9
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts +12 -0
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +20 -0
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -2
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts +2 -2
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ItemWrapper.d.ts +1 -1
- package/lib/esm/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Items.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.d.ts +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.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/ToolbarWithOverflow.d.ts +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Column.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Columns.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Panel.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Title.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts +12 -0
- package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.js +21 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +1 -0
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +2 -2
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeEditor.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts +1 -1
- package/lib/esm/components-react.d.ts +3 -0
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +3 -0
- package/lib/esm/components-react.js.map +1 -1
- package/lib/public/locales/en/UiComponents.json +12 -7
- package/package.json +8 -8
|
@@ -9,10 +9,17 @@ import { produce } from "immer";
|
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
11
11
|
import { Guid } from "@itwin/core-bentley";
|
|
12
|
-
import {
|
|
13
|
-
import { isUnaryPropertyFilterOperator, PropertyFilterRuleGroupOperator, } from "./Operators";
|
|
12
|
+
import { isUnaryPropertyFilterBuilderOperator, isUnaryPropertyFilterOperator, } from "./Operators";
|
|
14
13
|
import { isPropertyFilterRuleGroup } from "./Types";
|
|
15
14
|
import { UiComponents } from "../UiComponents";
|
|
15
|
+
import { PropertyFilterBuilderRuleRangeValue } from "./FilterBuilderRangeValue";
|
|
16
|
+
/**
|
|
17
|
+
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
18
|
+
* @beta
|
|
19
|
+
*/
|
|
20
|
+
export function isPropertyFilterBuilderRuleGroup(item) {
|
|
21
|
+
return item.items !== undefined;
|
|
22
|
+
}
|
|
16
23
|
/**
|
|
17
24
|
* Actions for controlling [[PropertyFilterBuilder]] component state.
|
|
18
25
|
* @beta
|
|
@@ -41,12 +48,14 @@ export class PropertyFilterBuilderActions {
|
|
|
41
48
|
function removeItemFromGroup(state, pathToItem) {
|
|
42
49
|
const pathToParent = pathToItem.slice(0, -1);
|
|
43
50
|
const parentGroup = findRuleGroup(state.rootGroup, pathToParent);
|
|
44
|
-
if (!parentGroup)
|
|
51
|
+
if (!parentGroup) {
|
|
45
52
|
return;
|
|
53
|
+
}
|
|
46
54
|
const itemId = pathToItem[pathToItem.length - 1];
|
|
47
55
|
const itemIndex = parentGroup.items.findIndex((item) => item.id === itemId);
|
|
48
|
-
if (itemIndex === -1)
|
|
56
|
+
if (itemIndex === -1) {
|
|
49
57
|
return;
|
|
58
|
+
}
|
|
50
59
|
if (parentGroup.items.length === 1) {
|
|
51
60
|
parentGroup.items[0] = createEmptyRule(parentGroup.id);
|
|
52
61
|
return;
|
|
@@ -67,8 +76,9 @@ export class PropertyFilterBuilderActions {
|
|
|
67
76
|
setRuleGroupOperator(path, operator) {
|
|
68
77
|
this.updateState((state) => {
|
|
69
78
|
const group = findRuleGroup(state.rootGroup, path);
|
|
70
|
-
if (!group)
|
|
79
|
+
if (!group) {
|
|
71
80
|
return;
|
|
81
|
+
}
|
|
72
82
|
group.operator = operator;
|
|
73
83
|
});
|
|
74
84
|
}
|
|
@@ -76,8 +86,9 @@ export class PropertyFilterBuilderActions {
|
|
|
76
86
|
setRuleProperty(path, property) {
|
|
77
87
|
this.updateState((state) => {
|
|
78
88
|
const rule = findRule(state.rootGroup, path);
|
|
79
|
-
if (!rule)
|
|
89
|
+
if (!rule) {
|
|
80
90
|
return;
|
|
91
|
+
}
|
|
81
92
|
rule.property = property;
|
|
82
93
|
rule.operator = undefined;
|
|
83
94
|
rule.value = undefined;
|
|
@@ -88,10 +99,12 @@ export class PropertyFilterBuilderActions {
|
|
|
88
99
|
setRuleOperator(path, operator) {
|
|
89
100
|
this.updateState((state) => {
|
|
90
101
|
const rule = findRule(state.rootGroup, path);
|
|
91
|
-
if (!rule)
|
|
102
|
+
if (!rule) {
|
|
92
103
|
return;
|
|
93
|
-
|
|
104
|
+
}
|
|
105
|
+
if (isUnaryPropertyFilterBuilderOperator(operator)) {
|
|
94
106
|
rule.value = undefined;
|
|
107
|
+
}
|
|
95
108
|
if (operator !== rule.operator &&
|
|
96
109
|
!areOperatorsSimilar(operator, rule.operator)) {
|
|
97
110
|
rule.value = undefined;
|
|
@@ -103,8 +116,9 @@ export class PropertyFilterBuilderActions {
|
|
|
103
116
|
setRuleValue(path, value) {
|
|
104
117
|
this.updateState((state) => {
|
|
105
118
|
const rule = findRule(state.rootGroup, path);
|
|
106
|
-
if (!rule)
|
|
119
|
+
if (!rule) {
|
|
107
120
|
return;
|
|
121
|
+
}
|
|
108
122
|
rule.value = value;
|
|
109
123
|
});
|
|
110
124
|
}
|
|
@@ -128,13 +142,6 @@ export class PropertyFilterBuilderActions {
|
|
|
128
142
|
});
|
|
129
143
|
}
|
|
130
144
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
133
|
-
* @beta
|
|
134
|
-
*/
|
|
135
|
-
export function isPropertyFilterBuilderRuleGroup(item) {
|
|
136
|
-
return item.items !== undefined;
|
|
137
|
-
}
|
|
138
145
|
/**
|
|
139
146
|
* Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes
|
|
140
147
|
* state from supplied initial filter.
|
|
@@ -186,16 +193,25 @@ function validateRules(rule, ruleValidator) {
|
|
|
186
193
|
export function defaultPropertyFilterBuilderRuleValidator(item) {
|
|
187
194
|
if (item.property === undefined ||
|
|
188
195
|
item.operator === undefined ||
|
|
189
|
-
|
|
196
|
+
isUnaryPropertyFilterBuilderOperator(item.operator)) {
|
|
190
197
|
return undefined;
|
|
191
198
|
}
|
|
192
|
-
if (item.
|
|
199
|
+
if (item.operator === "between" || item.operator === "not-between") {
|
|
200
|
+
return rangeRuleValidator(item.value);
|
|
201
|
+
}
|
|
202
|
+
if (isEmptyValue(item.value)) {
|
|
193
203
|
return UiComponents.translate("filterBuilder.errorMessages.emptyValue");
|
|
194
204
|
}
|
|
195
|
-
|
|
196
|
-
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
function rangeRuleValidator(value) {
|
|
208
|
+
const range = PropertyFilterBuilderRuleRangeValue.parse(value);
|
|
209
|
+
if (isEmptyValue(range.from) || isEmptyValue(range.to)) {
|
|
197
210
|
return UiComponents.translate("filterBuilder.errorMessages.emptyValue");
|
|
198
211
|
}
|
|
212
|
+
if (!PropertyFilterBuilderRuleRangeValue.isRangeValid(range)) {
|
|
213
|
+
return UiComponents.translate("filterBuilder.errorMessages.invalidRange");
|
|
214
|
+
}
|
|
199
215
|
return undefined;
|
|
200
216
|
}
|
|
201
217
|
/** @internal */
|
|
@@ -213,8 +229,9 @@ function buildPropertyFilterFromRuleGroup(rootGroup) {
|
|
|
213
229
|
}
|
|
214
230
|
if (rules.length === 0)
|
|
215
231
|
return undefined;
|
|
216
|
-
if (rules.length === 1)
|
|
232
|
+
if (rules.length === 1 && !isPropertyFilterRuleGroup(rules[0])) {
|
|
217
233
|
return rules[0];
|
|
234
|
+
}
|
|
218
235
|
return {
|
|
219
236
|
operator: rootGroup.operator,
|
|
220
237
|
rules,
|
|
@@ -222,15 +239,49 @@ function buildPropertyFilterFromRuleGroup(rootGroup) {
|
|
|
222
239
|
}
|
|
223
240
|
function buildPropertyFilterFromRule(rule) {
|
|
224
241
|
const { property, operator, value } = rule;
|
|
225
|
-
if (!property || operator === undefined)
|
|
242
|
+
if (!property || operator === undefined) {
|
|
226
243
|
return undefined;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
}
|
|
245
|
+
if (operator === "between" || operator === "not-between") {
|
|
246
|
+
return buildPropertyFilterFromRangeRule({
|
|
247
|
+
...rule,
|
|
248
|
+
property,
|
|
249
|
+
operator,
|
|
250
|
+
value,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
if (!isUnaryPropertyFilterOperator(operator) && isEmptyValue(value)) {
|
|
231
254
|
return undefined;
|
|
255
|
+
}
|
|
232
256
|
return { property, operator, value };
|
|
233
257
|
}
|
|
258
|
+
function buildPropertyFilterFromRangeRule(rule) {
|
|
259
|
+
const { property, operator, value } = rule;
|
|
260
|
+
if (!value ||
|
|
261
|
+
value.valueFormat !== PropertyValueFormat.Primitive ||
|
|
262
|
+
typeof value.value !== "string") {
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
265
|
+
const { to, from } = PropertyFilterBuilderRuleRangeValue.parse(value);
|
|
266
|
+
if (isEmptyValue(to) || isEmptyValue(from)) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
operator: operator === "between" ? "and" : "or",
|
|
271
|
+
rules: [
|
|
272
|
+
{
|
|
273
|
+
property,
|
|
274
|
+
operator: operator === "between" ? "greater-or-equal" : "less",
|
|
275
|
+
value: from,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
property,
|
|
279
|
+
operator: operator === "between" ? "less-or-equal" : "greater",
|
|
280
|
+
value: to,
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
};
|
|
284
|
+
}
|
|
234
285
|
function createEmptyRule(groupId) {
|
|
235
286
|
return {
|
|
236
287
|
id: Guid.createValue(),
|
|
@@ -242,7 +293,7 @@ function createEmptyRuleGroup(groupId) {
|
|
|
242
293
|
return {
|
|
243
294
|
id,
|
|
244
295
|
groupId,
|
|
245
|
-
operator:
|
|
296
|
+
operator: "and",
|
|
246
297
|
items: [createEmptyRule(id)],
|
|
247
298
|
};
|
|
248
299
|
}
|
|
@@ -268,13 +319,17 @@ function findRule(rootGroup, path) {
|
|
|
268
319
|
}
|
|
269
320
|
function getRuleGroupItem(filter, parentId) {
|
|
270
321
|
const id = Guid.createValue();
|
|
271
|
-
if (isPropertyFilterRuleGroup(filter))
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
322
|
+
if (isPropertyFilterRuleGroup(filter)) {
|
|
323
|
+
const rangeRule = getRangeRuleItems(filter, parentId);
|
|
324
|
+
return rangeRule
|
|
325
|
+
? rangeRule
|
|
326
|
+
: {
|
|
327
|
+
id,
|
|
328
|
+
groupId: parentId,
|
|
329
|
+
operator: filter.operator,
|
|
330
|
+
items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
278
333
|
return getRuleItem(filter, id);
|
|
279
334
|
}
|
|
280
335
|
function getRuleItem(filter, parentId) {
|
|
@@ -286,6 +341,50 @@ function getRuleItem(filter, parentId) {
|
|
|
286
341
|
value: filter.value,
|
|
287
342
|
};
|
|
288
343
|
}
|
|
344
|
+
function getRangeRuleItems(group, parentId) {
|
|
345
|
+
if (group.rules.length !== 2) {
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
const [from, to] = group.rules;
|
|
349
|
+
if (isPropertyFilterRuleGroup(from) ||
|
|
350
|
+
!from.value ||
|
|
351
|
+
from.value.valueFormat !== PropertyValueFormat.Primitive ||
|
|
352
|
+
isPropertyFilterRuleGroup(to) ||
|
|
353
|
+
!to.value ||
|
|
354
|
+
to.value.valueFormat !== PropertyValueFormat.Primitive ||
|
|
355
|
+
from.property.name !== to.property.name) {
|
|
356
|
+
return undefined;
|
|
357
|
+
}
|
|
358
|
+
if (from.operator === "greater-or-equal" &&
|
|
359
|
+
to.operator === "less-or-equal" &&
|
|
360
|
+
group.operator === "and") {
|
|
361
|
+
return {
|
|
362
|
+
id: Guid.createValue(),
|
|
363
|
+
groupId: parentId,
|
|
364
|
+
operator: "between",
|
|
365
|
+
property: from.property,
|
|
366
|
+
value: PropertyFilterBuilderRuleRangeValue.serialize({
|
|
367
|
+
from: from.value,
|
|
368
|
+
to: to.value,
|
|
369
|
+
}),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
if (from.operator === "less" &&
|
|
373
|
+
to.operator === "greater" &&
|
|
374
|
+
group.operator === "or") {
|
|
375
|
+
return {
|
|
376
|
+
id: Guid.createValue(),
|
|
377
|
+
groupId: parentId,
|
|
378
|
+
operator: "not-between",
|
|
379
|
+
property: from.property,
|
|
380
|
+
value: PropertyFilterBuilderRuleRangeValue.serialize({
|
|
381
|
+
from: from.value,
|
|
382
|
+
to: to.value,
|
|
383
|
+
}),
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
289
388
|
function convertFilterToState(filter) {
|
|
290
389
|
const id = Guid.createValue();
|
|
291
390
|
if (isPropertyFilterRuleGroup(filter)) {
|
|
@@ -300,25 +399,33 @@ function convertFilterToState(filter) {
|
|
|
300
399
|
return {
|
|
301
400
|
rootGroup: {
|
|
302
401
|
id,
|
|
303
|
-
operator:
|
|
402
|
+
operator: "and",
|
|
304
403
|
items: [getRuleItem(filter, id)],
|
|
305
404
|
},
|
|
306
405
|
};
|
|
307
406
|
}
|
|
407
|
+
function isEmptyValue(value) {
|
|
408
|
+
return ((value === null || value === void 0 ? void 0 : value.valueFormat) !== PropertyValueFormat.Primitive ||
|
|
409
|
+
value.value === undefined ||
|
|
410
|
+
value.value === "");
|
|
411
|
+
}
|
|
308
412
|
function areOperatorsSimilar(firstOperator, secondOperator) {
|
|
309
413
|
return ((isOperatorEqualOrIsNotEqual(firstOperator) &&
|
|
310
414
|
isOperatorEqualOrIsNotEqual(secondOperator)) ||
|
|
311
415
|
(isInequalityOperator(firstOperator) &&
|
|
312
|
-
isInequalityOperator(secondOperator))
|
|
416
|
+
isInequalityOperator(secondOperator)) ||
|
|
417
|
+
(isRangeOperator(firstOperator) && isRangeOperator(secondOperator)));
|
|
313
418
|
}
|
|
314
419
|
function isOperatorEqualOrIsNotEqual(operator) {
|
|
315
|
-
return
|
|
316
|
-
operator === PropertyFilterRuleOperator.IsNotEqual);
|
|
420
|
+
return operator === "is-equal" || operator === "is-not-equal";
|
|
317
421
|
}
|
|
318
422
|
function isInequalityOperator(operator) {
|
|
319
|
-
return (operator ===
|
|
320
|
-
operator ===
|
|
321
|
-
operator ===
|
|
322
|
-
operator ===
|
|
423
|
+
return (operator === "less" ||
|
|
424
|
+
operator === "less-or-equal" ||
|
|
425
|
+
operator === "greater" ||
|
|
426
|
+
operator === "greater-or-equal");
|
|
427
|
+
}
|
|
428
|
+
function isRangeOperator(operator) {
|
|
429
|
+
return operator === "between" || operator === "not-between";
|
|
323
430
|
}
|
|
324
431
|
//# sourceMappingURL=FilterBuilderState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAoD/C;;;GAGG;AACH,MAAM,OAAO,4BA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,EAAE,EAAE,CAAC,CAAC;aAC9D;SACF,CAAC;KACH;IACD,OAAO;QACL,SAAS,EAAE;YACT,EAAE;YACF,QAAQ,EAAE,+BAA+B,CAAC,GAAG;YAC7C,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACjC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,aAA0C,EAC1C,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,0BAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,0BAA0B,CAAC,UAAU,CACnD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAqC;IACjE,OAAO,CACL,QAAQ,KAAK,0BAA0B,CAAC,IAAI;QAC5C,QAAQ,KAAK,0BAA0B,CAAC,WAAW;QACnD,QAAQ,KAAK,0BAA0B,CAAC,OAAO;QAC/C,QAAQ,KAAK,0BAA0B,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 /** Removes all items from root group. */\n public removeAllItems() {\n this.updateState((state) => {\n state.rootGroup = createEmptyRuleGroup();\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.operator = undefined;\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"]}
|
|
1
|
+
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAK3C,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAqDhF;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,IAAwC;IAExC,OAAQ,IAAY,CAAC,KAAK,KAAK,SAAS,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IACvC,YACU,QAIC;QAJD,aAAQ,GAAR,QAAQ,CAIP;IACR,CAAC;IAEI,WAAW,CACjB,OAA2D;QAE3D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACl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AAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAA4C;IACnE,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,aAAa,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 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 type {\n PropertyFilterBuilderRuleOperator,\n PropertyFilterRuleGroupOperator,\n} from \"./Operators\";\nimport {\n isUnaryPropertyFilterBuilderOperator,\n isUnaryPropertyFilterOperator,\n} from \"./Operators\";\nimport type {\n PropertyFilter,\n PropertyFilterRule,\n PropertyFilterRuleGroup,\n} from \"./Types\";\nimport { isPropertyFilterRuleGroup } from \"./Types\";\nimport { UiComponents } from \"../UiComponents\";\nimport { PropertyFilterBuilderRuleRangeValue } from \"./FilterBuilderRangeValue\";\n\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?: PropertyFilterBuilderRuleOperator;\n /** Value that property should be compared to. */\n value?: PropertyValue;\n /** Error message of this rule. */\n errorMessage?: string;\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 * 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) {\n return;\n }\n\n const itemId = pathToItem[pathToItem.length - 1];\n const itemIndex = parentGroup.items.findIndex(\n (item) => item.id === itemId\n );\n if (itemIndex === -1) {\n return;\n }\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 /** Removes all items from root group. */\n public removeAllItems() {\n this.updateState((state) => {\n state.rootGroup = createEmptyRuleGroup();\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) {\n return;\n }\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) {\n return;\n }\n rule.property = property;\n rule.operator = undefined;\n rule.value = undefined;\n rule.errorMessage = undefined;\n });\n }\n\n /** Sets operator of rule specified by the path. */\n public setRuleOperator(\n path: string[],\n operator: PropertyFilterBuilderRuleOperator\n ) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule) {\n return;\n }\n if (isUnaryPropertyFilterBuilderOperator(operator)) {\n rule.value = undefined;\n }\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) {\n return;\n }\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 * 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 isUnaryPropertyFilterBuilderOperator(item.operator)\n ) {\n return undefined;\n }\n if (item.operator === \"between\" || item.operator === \"not-between\") {\n return rangeRuleValidator(item.value);\n }\n if (isEmptyValue(item.value)) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n return undefined;\n}\n\nfunction rangeRuleValidator(value?: PropertyValue) {\n const range = PropertyFilterBuilderRuleRangeValue.parse(value);\n if (isEmptyValue(range.from) || isEmptyValue(range.to)) {\n return UiComponents.translate(\"filterBuilder.errorMessages.emptyValue\");\n }\n if (!PropertyFilterBuilderRuleRangeValue.isRangeValid(range)) {\n return UiComponents.translate(\"filterBuilder.errorMessages.invalidRange\");\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 && !isPropertyFilterRuleGroup(rules[0])) {\n return rules[0];\n }\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) {\n return undefined;\n }\n\n if (operator === \"between\" || operator === \"not-between\") {\n return buildPropertyFilterFromRangeRule({\n ...rule,\n property,\n operator,\n value,\n });\n }\n\n if (!isUnaryPropertyFilterOperator(operator) && isEmptyValue(value)) {\n return undefined;\n }\n\n return { property, operator, value };\n}\n\nfunction buildPropertyFilterFromRangeRule(\n rule: PropertyFilterBuilderRule & {\n property: PropertyDescription;\n operator: \"between\" | \"not-between\";\n }\n): PropertyFilter | undefined {\n const { property, operator, value } = rule;\n if (\n !value ||\n value.valueFormat !== PropertyValueFormat.Primitive ||\n typeof value.value !== \"string\"\n ) {\n return undefined;\n }\n\n const { to, from } = PropertyFilterBuilderRuleRangeValue.parse(value);\n if (isEmptyValue(to) || isEmptyValue(from)) {\n return undefined;\n }\n\n return {\n operator: operator === \"between\" ? \"and\" : \"or\",\n rules: [\n {\n property,\n operator: operator === \"between\" ? \"greater-or-equal\" : \"less\",\n value: from,\n },\n {\n property,\n operator: operator === \"between\" ? \"less-or-equal\" : \"greater\",\n value: to,\n },\n ],\n };\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: \"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}\nfunction getRuleGroupItem(\n filter: PropertyFilter,\n parentId: string\n): PropertyFilterBuilderRuleGroupItem {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter)) {\n const rangeRule = getRangeRuleItems(filter, parentId);\n\n return rangeRule\n ? rangeRule\n : {\n id,\n groupId: parentId,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n };\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 getRangeRuleItems(\n group: PropertyFilterRuleGroup,\n parentId: string\n): PropertyFilterBuilderRuleGroupItem | undefined {\n if (group.rules.length !== 2) {\n return undefined;\n }\n\n const [from, to] = group.rules;\n if (\n isPropertyFilterRuleGroup(from) ||\n !from.value ||\n from.value.valueFormat !== PropertyValueFormat.Primitive ||\n isPropertyFilterRuleGroup(to) ||\n !to.value ||\n to.value.valueFormat !== PropertyValueFormat.Primitive ||\n from.property.name !== to.property.name\n ) {\n return undefined;\n }\n\n if (\n from.operator === \"greater-or-equal\" &&\n to.operator === \"less-or-equal\" &&\n group.operator === \"and\"\n ) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n operator: \"between\",\n property: from.property,\n value: PropertyFilterBuilderRuleRangeValue.serialize({\n from: from.value,\n to: to.value,\n }),\n };\n }\n\n if (\n from.operator === \"less\" &&\n to.operator === \"greater\" &&\n group.operator === \"or\"\n ) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n operator: \"not-between\",\n property: from.property,\n value: PropertyFilterBuilderRuleRangeValue.serialize({\n from: from.value,\n to: to.value,\n }),\n };\n }\n\n return undefined;\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: \"and\",\n items: [getRuleItem(filter, id)],\n },\n };\n}\n\nfunction isEmptyValue(value?: PropertyValue) {\n return (\n value?.valueFormat !== PropertyValueFormat.Primitive ||\n value.value === undefined ||\n value.value === \"\"\n );\n}\n\nfunction areOperatorsSimilar(\n firstOperator?: PropertyFilterBuilderRuleOperator,\n secondOperator?: PropertyFilterBuilderRuleOperator\n) {\n return (\n (isOperatorEqualOrIsNotEqual(firstOperator) &&\n isOperatorEqualOrIsNotEqual(secondOperator)) ||\n (isInequalityOperator(firstOperator) &&\n isInequalityOperator(secondOperator)) ||\n (isRangeOperator(firstOperator) && isRangeOperator(secondOperator))\n );\n}\n\nfunction isOperatorEqualOrIsNotEqual(\n operator?: PropertyFilterBuilderRuleOperator\n) {\n return operator === \"is-equal\" || operator === \"is-not-equal\";\n}\n\nfunction isInequalityOperator(operator?: PropertyFilterBuilderRuleOperator) {\n return (\n operator === \"less\" ||\n operator === \"less-or-equal\" ||\n operator === \"greater\" ||\n operator === \"greater-or-equal\"\n );\n}\n\nfunction isRangeOperator(operator?: PropertyFilterBuilderRuleOperator) {\n return operator === \"between\" || operator === \"not-between\";\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Props for [[PropertyFilterBuilderToolbar]] component.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
interface PropertyFilterBuilderToolbarProps {
|
|
10
|
+
/** Function to add child of current group. */
|
|
11
|
+
onAddChild: () => void;
|
|
12
|
+
/** Function to remove child from current group. */
|
|
13
|
+
onDelete: () => void;
|
|
14
|
+
}
|
|
15
|
+
/** Toolbar displaying the "add" and "delete" row buttons in the filter builder
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export declare const PropertyFilterBuilderToolbar: (props: PropertyFilterBuilderToolbarProps) => React.JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=FilterBuilderToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterBuilderToolbar.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderToolbar.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;GAGG;AACH,UAAU,iCAAiC;IACzC,8CAA8C;IAC9C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,UAChC,iCAAiC,sBA8BzC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { Flex, IconButton } from "@itwin/itwinui-react";
|
|
10
|
+
import { SvgAdd, SvgDelete } from "@itwin/itwinui-icons-react";
|
|
11
|
+
import { UiComponents } from "../UiComponents";
|
|
12
|
+
/** Toolbar displaying the "add" and "delete" row buttons in the filter builder
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export const PropertyFilterBuilderToolbar = (props) => {
|
|
16
|
+
const { onAddChild, onDelete } = props;
|
|
17
|
+
return (React.createElement(Flex, { className: "fb-toolbar fb-row-toolbar", gap: "0", justifyContent: "flex-end" },
|
|
18
|
+
React.createElement(IconButton, { size: "small", className: "fb-add-rule-button", label: UiComponents.translate("filterBuilder.add"), styleType: "borderless", onClick: onAddChild },
|
|
19
|
+
React.createElement(SvgAdd, null)),
|
|
20
|
+
React.createElement(IconButton, { size: "small", className: "fb-remove-rule-button", label: UiComponents.translate("filterBuilder.delete"), styleType: "borderless", onClick: onDelete },
|
|
21
|
+
React.createElement(SvgDelete, null))));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=FilterBuilderToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterBuilderToolbar.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderToolbar.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY/C;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,KAAwC,EACxC,EAAE;IACF,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEvC,OAAO,CACL,oBAAC,IAAI,IACH,SAAS,EAAE,2BAA2B,EACtC,GAAG,EAAC,GAAG,EACP,cAAc,EAAC,UAAU;QAEzB,oBAAC,UAAU,IACT,IAAI,EAAE,OAAO,EACb,SAAS,EAAC,oBAAoB,EAC9B,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAClD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,UAAU;YAEnB,oBAAC,MAAM,OAAG,CACC;QACb,oBAAC,UAAU,IACT,IAAI,EAAE,OAAO,EACb,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,sBAAsB,CAAC,EACrD,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,QAAQ;YAEjB,oBAAC,SAAS,OAAG,CACF,CACR,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyFilterBuilder\n */\nimport React from \"react\";\nimport { Flex, IconButton } from \"@itwin/itwinui-react\";\nimport { SvgAdd, SvgDelete } from \"@itwin/itwinui-icons-react\";\nimport { UiComponents } from \"../UiComponents\";\n/**\n * Props for [[PropertyFilterBuilderToolbar]] component.\n * @internal\n */\ninterface PropertyFilterBuilderToolbarProps {\n /** Function to add child of current group. */\n onAddChild: () => void;\n /** Function to remove child from current group. */\n onDelete: () => void;\n}\n\n/** Toolbar displaying the \"add\" and \"delete\" row buttons in the filter builder\n * @beta\n */\nexport const PropertyFilterBuilderToolbar = (\n props: PropertyFilterBuilderToolbarProps\n) => {\n const { onAddChild, onDelete } = props;\n\n return (\n <Flex\n className={\"fb-toolbar fb-row-toolbar\"}\n gap=\"0\"\n justifyContent=\"flex-end\"\n >\n <IconButton\n size={\"small\"}\n className=\"fb-add-rule-button\"\n label={UiComponents.translate(\"filterBuilder.add\")}\n styleType=\"borderless\"\n onClick={onAddChild}\n >\n <SvgAdd />\n </IconButton>\n <IconButton\n size={\"small\"}\n className=\"fb-remove-rule-button\"\n label={UiComponents.translate(\"filterBuilder.delete\")}\n styleType=\"borderless\"\n onClick={onDelete}\n >\n <SvgDelete />\n </IconButton>\n </Flex>\n );\n};\n"]}
|
|
@@ -7,39 +7,44 @@ import type { PropertyDescription } from "@itwin/appui-abstract";
|
|
|
7
7
|
* @beta
|
|
8
8
|
*/
|
|
9
9
|
export declare enum PropertyFilterRuleGroupOperator {
|
|
10
|
-
And =
|
|
11
|
-
Or =
|
|
10
|
+
And = "and",
|
|
11
|
+
Or = "or"
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Operators for comparing property value in
|
|
14
|
+
* Operators for comparing property value in [[PropertyFilterRule]].
|
|
15
15
|
* @beta
|
|
16
16
|
*/
|
|
17
17
|
export declare enum PropertyFilterRuleOperator {
|
|
18
|
-
IsTrue =
|
|
19
|
-
IsFalse =
|
|
20
|
-
IsEqual =
|
|
21
|
-
IsNotEqual =
|
|
22
|
-
Greater =
|
|
23
|
-
GreaterOrEqual =
|
|
24
|
-
Less =
|
|
25
|
-
LessOrEqual =
|
|
26
|
-
Like =
|
|
27
|
-
IsNull =
|
|
28
|
-
IsNotNull =
|
|
18
|
+
IsTrue = "is-true",
|
|
19
|
+
IsFalse = "is-false",
|
|
20
|
+
IsEqual = "is-equal",
|
|
21
|
+
IsNotEqual = "is-not-equal",
|
|
22
|
+
Greater = "greater",
|
|
23
|
+
GreaterOrEqual = "greater-or-equal",
|
|
24
|
+
Less = "less",
|
|
25
|
+
LessOrEqual = "less-or-equal",
|
|
26
|
+
Like = "like",
|
|
27
|
+
IsNull = "is-null",
|
|
28
|
+
IsNotNull = "is-not-null"
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Operators supported by [[usePropertyFilterBuilder]] when building filter rules.
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export type PropertyFilterBuilderRuleOperator = `${PropertyFilterRuleOperator}` | "between" | "not-between";
|
|
30
35
|
/**
|
|
31
36
|
* Function that returns set of available operator based on property type.
|
|
32
37
|
* @beta
|
|
33
38
|
*/
|
|
34
|
-
export declare function
|
|
39
|
+
export declare function getPropertyFilterBuilderOperators(property: PropertyDescription): PropertyFilterBuilderRuleOperator[];
|
|
35
40
|
/**
|
|
36
|
-
* Function that
|
|
41
|
+
* Function that checks if supplied [[PropertyFilterBuilderRuleOperator]] operator is unary.
|
|
37
42
|
* @beta
|
|
38
43
|
*/
|
|
39
|
-
export declare function
|
|
44
|
+
export declare function isUnaryPropertyFilterBuilderOperator(operator: PropertyFilterBuilderRuleOperator): boolean;
|
|
40
45
|
/**
|
|
41
|
-
* Function that checks if supplied operator is unary.
|
|
46
|
+
* Function that checks if supplied [[PropertyFilterRuleOperator]] operator is unary.
|
|
42
47
|
* @beta
|
|
43
48
|
*/
|
|
44
|
-
export declare function isUnaryPropertyFilterOperator(operator: PropertyFilterRuleOperator): boolean;
|
|
49
|
+
export declare function isUnaryPropertyFilterOperator(operator: `${PropertyFilterRuleOperator}`): boolean;
|
|
45
50
|
//# sourceMappingURL=Operators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operators.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Operators.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE;;;GAGG;AACH,oBAAY,+BAA+B;IACzC,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,MAAM,YAAY;IAClB,OAAO,aAAa;IACpB,OAAO,aAAa;IACpB,UAAU,iBAAiB;IAC3B,OAAO,YAAY;IACnB,cAAc,qBAAqB;IACnC,IAAI,SAAS;IACb,WAAW,kBAAkB;IAC7B,IAAI,SAAS;IACb,MAAM,YAAY;IAClB,SAAS,gBAAgB;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,iCAAiC,GACzC,GAAG,0BAA0B,EAAE,GAC/B,SAAS,GACT,aAAa,CAAC;AAElB;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,mBAAmB,GAC5B,iCAAiC,EAAE,CA+CrC;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,iCAAiC,WAO5C;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,GAAG,0BAA0B,EAAE,WAU1C"}
|