@itwin/components-react 4.9.0-dev.1 → 4.10.0-dev.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 +30 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts +1 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts.map +1 -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/HighlightedText.d.ts +2 -2
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/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/datepicker/TimeField.scss +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.d.ts +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/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/EnumEditor.js +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.js.map +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/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/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/favorite/FavoritePropertyList.js +3 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.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 +15 -9
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +37 -22
- 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 +44 -8
- 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 +4 -4
- 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 +41 -3
- 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 +153 -46
- 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/CommonPropertyRenderer.js +3 -4
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +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.d.ts +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/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/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/Common.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/Common.js.map +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/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.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/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.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/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/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/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/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/VirtualizedPropertyGrid.js +49 -54
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +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/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.d.ts +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.d.ts +2 -2
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.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.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.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/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/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.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/TreeModel.js +7 -8
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/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/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/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/common/DelayedSpinner.d.ts +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.d.ts.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/HighlightedText.d.ts +2 -2
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +1 -2
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/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/datepicker/TimeField.scss +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.d.ts +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/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/EnumEditor.js +1 -1
- package/lib/esm/components-react/editors/EnumEditor.js.map +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/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/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/favorite/FavoritePropertyList.js +3 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.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 +19 -13
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +37 -22
- 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 +42 -7
- 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 +4 -4
- 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 +40 -2
- 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 +151 -44
- 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/CommonPropertyRenderer.js +3 -4
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +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.d.ts +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/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/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/Common.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/Common.js.map +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/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.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/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.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/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/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/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/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/VirtualizedPropertyGrid.js +49 -54
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +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/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.d.ts +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.d.ts +2 -2
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.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.d.ts +2 -2
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.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/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/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.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/TreeModel.js +7 -8
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/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/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +2 -4
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/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 +7 -8
|
@@ -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;
|
|
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;AAC7D,wDAAkD;AAClD,uEAAgF;AAEhF,kDAA+C;AAyB/C;;;GAGG;AACH,SAAgB,8BAA8B,CAC5C,KAAkD;IAElD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAEzC,OAAO,QAAQ,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AC;AACJ,CAAC;AAED,uBAAuB;AACvB,SAAS,uBAAuB,CAAC,IAAmB,EAAE,EAAiB;IACrE,OAAO,6DAAmC,CAAC,SAAS,CAAC;QACnD,IAAI,EACF,IAAI,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAChD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,EAAE,WAAW,EAAE,oCAAmB,CAAC,SAAS,EAAE;QACpD,EAAE,EACA,EAAE,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC9C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,WAAW,EAAE,oCAAmB,CAAC,SAAS,EAAE;KACrD,CAAC,CAAC;AACL,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 * 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 { Flex, Text } from \"@itwin/itwinui-react\";\nimport { PropertyFilterBuilderRuleRangeValue } from \"./FilterBuilderRangeValue\";\nimport type { PropertyFilterBuilderRuleOperator } from \"./Operators\";\nimport { UiComponents } from \"../UiComponents\";\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: PropertyFilterBuilderRuleOperator;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @beta\n */\nexport function PropertyFilterBuilderRuleValue(\n props: PropertyFilterBuilderRuleValueRendererProps\n) {\n const { operator, ...restProps } = props;\n\n return operator === \"between\" || operator === \"not-between\" ? (\n <FilterBuilderRuleRangeValueRenderer {...restProps} />\n ) : (\n <FilterBuilderRulePrimitiveValueRenderer {...restProps} />\n );\n}\n\nfunction FilterBuilderRulePrimitiveValueRenderer({\n property,\n value,\n onChange,\n}: PropertyFilterBuilderRuleValueProps) {\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\nfunction FilterBuilderRuleRangeValueRenderer({\n property,\n value,\n onChange,\n}: PropertyFilterBuilderRuleValueProps) {\n const { from, to } = React.useMemo(() => {\n const rangeValue = PropertyFilterBuilderRuleRangeValue.parse(value);\n return {\n from: new PropertyRecord(rangeValue.from, property),\n to: new PropertyRecord(rangeValue.to, property),\n };\n }, [property, value]);\n\n const handleFromValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(newValue, to.value));\n },\n [onChange, to]\n );\n\n const handleToValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(from.value, newValue));\n },\n [onChange, from]\n );\n\n return (\n <Flex\n className=\"rule-value-range\"\n display=\"inline-flex\"\n flexDirection=\"row\"\n >\n <Flex.Item>\n <EditorContainer\n propertyRecord={from}\n onCancel={/* istanbul ignore next */ () => {}}\n onCommit={handleFromValue}\n setFocus={false}\n shouldCommitOnChange={false}\n />\n </Flex.Item>\n <Text>\n {UiComponents.translate(\"filterBuilder.operators.and\").toLowerCase()}\n </Text>\n <Flex.Item>\n <EditorContainer\n propertyRecord={to}\n onCancel={/* istanbul ignore next */ () => {}}\n onCommit={handleToValue}\n setFocus={false}\n shouldCommitOnChange={false}\n />\n </Flex.Item>\n </Flex>\n );\n}\n\n// istanbul ignore next\nfunction getSerializedRangeValue(from: PropertyValue, to: PropertyValue) {\n return PropertyFilterBuilderRuleRangeValue.serialize({\n from:\n from.valueFormat === PropertyValueFormat.Primitive\n ? from\n : { valueFormat: PropertyValueFormat.Primitive },\n to:\n to.valueFormat === PropertyValueFormat.Primitive\n ? to\n : { valueFormat: PropertyValueFormat.Primitive },\n });\n}\n"]}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* @module PropertyFilterBuilder
|
|
3
3
|
*/
|
|
4
4
|
import type { PropertyDescription, PropertyValue } from "@itwin/appui-abstract";
|
|
5
|
-
import {
|
|
6
|
-
import { PropertyFilterRuleGroupOperator } from "./Operators";
|
|
5
|
+
import type { PropertyFilterBuilderRuleOperator, PropertyFilterRuleGroupOperator } from "./Operators";
|
|
7
6
|
import type { PropertyFilter } from "./Types";
|
|
8
7
|
/**
|
|
9
8
|
* Data structure that describes [[PropertyFilterBuilder]] component state.
|
|
@@ -28,7 +27,7 @@ export interface PropertyFilterBuilderRuleGroup {
|
|
|
28
27
|
/** Id of rule group that this group is nested in. */
|
|
29
28
|
groupId?: string;
|
|
30
29
|
/** Operator that should join items in this group. */
|
|
31
|
-
operator: PropertyFilterRuleGroupOperator
|
|
30
|
+
operator: `${PropertyFilterRuleGroupOperator}`;
|
|
32
31
|
/** Items in this group. */
|
|
33
32
|
items: PropertyFilterBuilderRuleGroupItem[];
|
|
34
33
|
}
|
|
@@ -44,12 +43,17 @@ export interface PropertyFilterBuilderRule {
|
|
|
44
43
|
/** Property used in this rule. */
|
|
45
44
|
property?: PropertyDescription;
|
|
46
45
|
/** Operator that should be used to compare property value. */
|
|
47
|
-
operator?:
|
|
46
|
+
operator?: PropertyFilterBuilderRuleOperator;
|
|
48
47
|
/** Value that property should be compared to. */
|
|
49
48
|
value?: PropertyValue;
|
|
50
49
|
/** Error message of this rule. */
|
|
51
50
|
errorMessage?: string;
|
|
52
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export declare function isPropertyFilterBuilderRuleGroup(item: PropertyFilterBuilderRuleGroupItem): item is PropertyFilterBuilderRuleGroup;
|
|
53
57
|
/**
|
|
54
58
|
* Actions for controlling [[PropertyFilterBuilder]] component state.
|
|
55
59
|
* @beta
|
|
@@ -65,11 +69,11 @@ export declare class PropertyFilterBuilderActions {
|
|
|
65
69
|
/** Removes all items from root group. */
|
|
66
70
|
removeAllItems(): void;
|
|
67
71
|
/** Sets operator of rule group specified by the path. */
|
|
68
|
-
setRuleGroupOperator(path: string[], operator: PropertyFilterRuleGroupOperator): void;
|
|
72
|
+
setRuleGroupOperator(path: string[], operator: `${PropertyFilterRuleGroupOperator}`): void;
|
|
69
73
|
/** Sets property of rule specified by the path. */
|
|
70
74
|
setRuleProperty(path: string[], property?: PropertyDescription): void;
|
|
71
75
|
/** Sets operator of rule specified by the path. */
|
|
72
|
-
setRuleOperator(path: string[], operator:
|
|
76
|
+
setRuleOperator(path: string[], operator: PropertyFilterBuilderRuleOperator): void;
|
|
73
77
|
/** Sets value of rule specified by the path. */
|
|
74
78
|
setRuleValue(path: string[], value: PropertyValue): void;
|
|
75
79
|
/**
|
|
@@ -78,11 +82,6 @@ export declare class PropertyFilterBuilderActions {
|
|
|
78
82
|
*/
|
|
79
83
|
setRuleErrorMessages(ruleIdsAndErrorMessages: Map<string, string>): void;
|
|
80
84
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
83
|
-
* @beta
|
|
84
|
-
*/
|
|
85
|
-
export declare function isPropertyFilterBuilderRuleGroup(item: PropertyFilterBuilderRuleGroupItem): item is PropertyFilterBuilderRuleGroup;
|
|
86
85
|
/**
|
|
87
86
|
* Props for [[usePropertyFilterBuilder]]
|
|
88
87
|
* @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,
|
|
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,KAAK,EACV,iCAAiC,EACjC,+BAA+B,EAChC,MAAM,aAAa,CAAC;AAKrB,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,SAAS,CAAC;AAKjB;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,kEAAkE;IAClE,SAAS,EAAE,8BAA8B,CAAC;CAC3C;AAED;;;GAGG;AACH,MAAM,MAAM,kCAAkC,GAC1C,8BAA8B,GAC9B,yBAAyB,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,QAAQ,EAAE,GAAG,+BAA+B,EAAE,CAAC;IAC/C,2BAA2B;IAC3B,KAAK,EAAE,kCAAkC,EAAE,C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AAM,EAAE,MAAM,CAAC;CAezE;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,kBAAkB;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;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,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,cAAc,GAAG,SAAS,CAAC;CAC3E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,CAAC,EAAE,6BAA6B,GACpC,8BAA8B,CA6BhC;AA0BD;;;GAGG;AACH,wBAAgB,yCAAyC,CACvD,IAAI,EAAE,yBAAyB,GAC9B,MAAM,GAAG,SAAS,CAepB;AAaD,gBAAgB;AAChB,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,kCAAkC,GAC5C,cAAc,GAAG,SAAS,CAI5B"}
|
|
@@ -30,15 +30,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.buildPropertyFilter = exports.defaultPropertyFilterBuilderRuleValidator = exports.usePropertyFilterBuilder = exports.
|
|
33
|
+
exports.buildPropertyFilter = exports.defaultPropertyFilterBuilderRuleValidator = exports.usePropertyFilterBuilder = exports.PropertyFilterBuilderActions = exports.isPropertyFilterBuilderRuleGroup = void 0;
|
|
34
34
|
const immer_1 = require("immer");
|
|
35
35
|
const React = __importStar(require("react"));
|
|
36
36
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
37
37
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
38
38
|
const Operators_1 = require("./Operators");
|
|
39
|
-
const Operators_2 = require("./Operators");
|
|
40
39
|
const Types_1 = require("./Types");
|
|
41
40
|
const UiComponents_1 = require("../UiComponents");
|
|
41
|
+
const FilterBuilderRangeValue_1 = require("./FilterBuilderRangeValue");
|
|
42
|
+
/**
|
|
43
|
+
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
44
|
+
* @beta
|
|
45
|
+
*/
|
|
46
|
+
function isPropertyFilterBuilderRuleGroup(item) {
|
|
47
|
+
return item.items !== undefined;
|
|
48
|
+
}
|
|
49
|
+
exports.isPropertyFilterBuilderRuleGroup = isPropertyFilterBuilderRuleGroup;
|
|
42
50
|
/**
|
|
43
51
|
* Actions for controlling [[PropertyFilterBuilder]] component state.
|
|
44
52
|
* @beta
|
|
@@ -67,12 +75,14 @@ class PropertyFilterBuilderActions {
|
|
|
67
75
|
function removeItemFromGroup(state, pathToItem) {
|
|
68
76
|
const pathToParent = pathToItem.slice(0, -1);
|
|
69
77
|
const parentGroup = findRuleGroup(state.rootGroup, pathToParent);
|
|
70
|
-
if (!parentGroup)
|
|
78
|
+
if (!parentGroup) {
|
|
71
79
|
return;
|
|
80
|
+
}
|
|
72
81
|
const itemId = pathToItem[pathToItem.length - 1];
|
|
73
82
|
const itemIndex = parentGroup.items.findIndex((item) => item.id === itemId);
|
|
74
|
-
if (itemIndex === -1)
|
|
83
|
+
if (itemIndex === -1) {
|
|
75
84
|
return;
|
|
85
|
+
}
|
|
76
86
|
if (parentGroup.items.length === 1) {
|
|
77
87
|
parentGroup.items[0] = createEmptyRule(parentGroup.id);
|
|
78
88
|
return;
|
|
@@ -93,8 +103,9 @@ class PropertyFilterBuilderActions {
|
|
|
93
103
|
setRuleGroupOperator(path, operator) {
|
|
94
104
|
this.updateState((state) => {
|
|
95
105
|
const group = findRuleGroup(state.rootGroup, path);
|
|
96
|
-
if (!group)
|
|
106
|
+
if (!group) {
|
|
97
107
|
return;
|
|
108
|
+
}
|
|
98
109
|
group.operator = operator;
|
|
99
110
|
});
|
|
100
111
|
}
|
|
@@ -102,8 +113,9 @@ class PropertyFilterBuilderActions {
|
|
|
102
113
|
setRuleProperty(path, property) {
|
|
103
114
|
this.updateState((state) => {
|
|
104
115
|
const rule = findRule(state.rootGroup, path);
|
|
105
|
-
if (!rule)
|
|
116
|
+
if (!rule) {
|
|
106
117
|
return;
|
|
118
|
+
}
|
|
107
119
|
rule.property = property;
|
|
108
120
|
rule.operator = undefined;
|
|
109
121
|
rule.value = undefined;
|
|
@@ -114,10 +126,12 @@ class PropertyFilterBuilderActions {
|
|
|
114
126
|
setRuleOperator(path, operator) {
|
|
115
127
|
this.updateState((state) => {
|
|
116
128
|
const rule = findRule(state.rootGroup, path);
|
|
117
|
-
if (!rule)
|
|
129
|
+
if (!rule) {
|
|
118
130
|
return;
|
|
119
|
-
|
|
131
|
+
}
|
|
132
|
+
if ((0, Operators_1.isUnaryPropertyFilterBuilderOperator)(operator)) {
|
|
120
133
|
rule.value = undefined;
|
|
134
|
+
}
|
|
121
135
|
if (operator !== rule.operator &&
|
|
122
136
|
!areOperatorsSimilar(operator, rule.operator)) {
|
|
123
137
|
rule.value = undefined;
|
|
@@ -129,8 +143,9 @@ class PropertyFilterBuilderActions {
|
|
|
129
143
|
setRuleValue(path, value) {
|
|
130
144
|
this.updateState((state) => {
|
|
131
145
|
const rule = findRule(state.rootGroup, path);
|
|
132
|
-
if (!rule)
|
|
146
|
+
if (!rule) {
|
|
133
147
|
return;
|
|
148
|
+
}
|
|
134
149
|
rule.value = value;
|
|
135
150
|
});
|
|
136
151
|
}
|
|
@@ -155,21 +170,13 @@ class PropertyFilterBuilderActions {
|
|
|
155
170
|
}
|
|
156
171
|
}
|
|
157
172
|
exports.PropertyFilterBuilderActions = PropertyFilterBuilderActions;
|
|
158
|
-
/**
|
|
159
|
-
* Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].
|
|
160
|
-
* @beta
|
|
161
|
-
*/
|
|
162
|
-
function isPropertyFilterBuilderRuleGroup(item) {
|
|
163
|
-
return item.items !== undefined;
|
|
164
|
-
}
|
|
165
|
-
exports.isPropertyFilterBuilderRuleGroup = isPropertyFilterBuilderRuleGroup;
|
|
166
173
|
/**
|
|
167
174
|
* Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes
|
|
168
175
|
* state from supplied initial filter.
|
|
169
176
|
* @beta
|
|
170
177
|
*/
|
|
171
178
|
function usePropertyFilterBuilder(props) {
|
|
172
|
-
const { initialFilter, ruleValidator } = props
|
|
179
|
+
const { initialFilter, ruleValidator } = props ?? {
|
|
173
180
|
initialFilter: undefined,
|
|
174
181
|
ruleValidator: undefined,
|
|
175
182
|
};
|
|
@@ -179,7 +186,7 @@ function usePropertyFilterBuilder(props) {
|
|
|
179
186
|
const [actions] = React.useState(() => new PropertyFilterBuilderActions(setState));
|
|
180
187
|
const buildFilter = React.useCallback((options) => {
|
|
181
188
|
const ruleErrors = validateRules(state.rootGroup, ruleValidator);
|
|
182
|
-
if (!
|
|
189
|
+
if (!options?.ignoreErrors) {
|
|
183
190
|
actions.setRuleErrorMessages(ruleErrors);
|
|
184
191
|
}
|
|
185
192
|
return ruleErrors.size === 0
|
|
@@ -215,19 +222,28 @@ function validateRules(rule, ruleValidator) {
|
|
|
215
222
|
function defaultPropertyFilterBuilderRuleValidator(item) {
|
|
216
223
|
if (item.property === undefined ||
|
|
217
224
|
item.operator === undefined ||
|
|
218
|
-
(0,
|
|
225
|
+
(0, Operators_1.isUnaryPropertyFilterBuilderOperator)(item.operator)) {
|
|
219
226
|
return undefined;
|
|
220
227
|
}
|
|
221
|
-
if (item.
|
|
222
|
-
return
|
|
228
|
+
if (item.operator === "between" || item.operator === "not-between") {
|
|
229
|
+
return rangeRuleValidator(item.value);
|
|
223
230
|
}
|
|
224
|
-
if (item.value
|
|
225
|
-
(item.value.value === undefined || item.value.value === "")) {
|
|
231
|
+
if (isEmptyValue(item.value)) {
|
|
226
232
|
return UiComponents_1.UiComponents.translate("filterBuilder.errorMessages.emptyValue");
|
|
227
233
|
}
|
|
228
234
|
return undefined;
|
|
229
235
|
}
|
|
230
236
|
exports.defaultPropertyFilterBuilderRuleValidator = defaultPropertyFilterBuilderRuleValidator;
|
|
237
|
+
function rangeRuleValidator(value) {
|
|
238
|
+
const range = FilterBuilderRangeValue_1.PropertyFilterBuilderRuleRangeValue.parse(value);
|
|
239
|
+
if (isEmptyValue(range.from) || isEmptyValue(range.to)) {
|
|
240
|
+
return UiComponents_1.UiComponents.translate("filterBuilder.errorMessages.emptyValue");
|
|
241
|
+
}
|
|
242
|
+
if (!FilterBuilderRangeValue_1.PropertyFilterBuilderRuleRangeValue.isRangeValid(range)) {
|
|
243
|
+
return UiComponents_1.UiComponents.translate("filterBuilder.errorMessages.invalidRange");
|
|
244
|
+
}
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
231
247
|
/** @internal */
|
|
232
248
|
function buildPropertyFilter(groupItem) {
|
|
233
249
|
if (isPropertyFilterBuilderRuleGroup(groupItem))
|
|
@@ -244,8 +260,9 @@ function buildPropertyFilterFromRuleGroup(rootGroup) {
|
|
|
244
260
|
}
|
|
245
261
|
if (rules.length === 0)
|
|
246
262
|
return undefined;
|
|
247
|
-
if (rules.length === 1)
|
|
263
|
+
if (rules.length === 1 && !(0, Types_1.isPropertyFilterRuleGroup)(rules[0])) {
|
|
248
264
|
return rules[0];
|
|
265
|
+
}
|
|
249
266
|
return {
|
|
250
267
|
operator: rootGroup.operator,
|
|
251
268
|
rules,
|
|
@@ -253,15 +270,49 @@ function buildPropertyFilterFromRuleGroup(rootGroup) {
|
|
|
253
270
|
}
|
|
254
271
|
function buildPropertyFilterFromRule(rule) {
|
|
255
272
|
const { property, operator, value } = rule;
|
|
256
|
-
if (!property || operator === undefined)
|
|
273
|
+
if (!property || operator === undefined) {
|
|
257
274
|
return undefined;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
275
|
+
}
|
|
276
|
+
if (operator === "between" || operator === "not-between") {
|
|
277
|
+
return buildPropertyFilterFromRangeRule({
|
|
278
|
+
...rule,
|
|
279
|
+
property,
|
|
280
|
+
operator,
|
|
281
|
+
value,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (!(0, Operators_1.isUnaryPropertyFilterOperator)(operator) && isEmptyValue(value)) {
|
|
262
285
|
return undefined;
|
|
286
|
+
}
|
|
263
287
|
return { property, operator, value };
|
|
264
288
|
}
|
|
289
|
+
function buildPropertyFilterFromRangeRule(rule) {
|
|
290
|
+
const { property, operator, value } = rule;
|
|
291
|
+
if (!value ||
|
|
292
|
+
value.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive ||
|
|
293
|
+
typeof value.value !== "string") {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
const { to, from } = FilterBuilderRangeValue_1.PropertyFilterBuilderRuleRangeValue.parse(value);
|
|
297
|
+
if (isEmptyValue(to) || isEmptyValue(from)) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
operator: operator === "between" ? "and" : "or",
|
|
302
|
+
rules: [
|
|
303
|
+
{
|
|
304
|
+
property,
|
|
305
|
+
operator: operator === "between" ? "greater-or-equal" : "less",
|
|
306
|
+
value: from,
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
property,
|
|
310
|
+
operator: operator === "between" ? "less-or-equal" : "greater",
|
|
311
|
+
value: to,
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
265
316
|
function createEmptyRule(groupId) {
|
|
266
317
|
return {
|
|
267
318
|
id: core_bentley_1.Guid.createValue(),
|
|
@@ -273,7 +324,7 @@ function createEmptyRuleGroup(groupId) {
|
|
|
273
324
|
return {
|
|
274
325
|
id,
|
|
275
326
|
groupId,
|
|
276
|
-
operator:
|
|
327
|
+
operator: "and",
|
|
277
328
|
items: [createEmptyRule(id)],
|
|
278
329
|
};
|
|
279
330
|
}
|
|
@@ -299,13 +350,17 @@ function findRule(rootGroup, path) {
|
|
|
299
350
|
}
|
|
300
351
|
function getRuleGroupItem(filter, parentId) {
|
|
301
352
|
const id = core_bentley_1.Guid.createValue();
|
|
302
|
-
if ((0, Types_1.isPropertyFilterRuleGroup)(filter))
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
353
|
+
if ((0, Types_1.isPropertyFilterRuleGroup)(filter)) {
|
|
354
|
+
const rangeRule = getRangeRuleItems(filter, parentId);
|
|
355
|
+
return rangeRule
|
|
356
|
+
? rangeRule
|
|
357
|
+
: {
|
|
358
|
+
id,
|
|
359
|
+
groupId: parentId,
|
|
360
|
+
operator: filter.operator,
|
|
361
|
+
items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
309
364
|
return getRuleItem(filter, id);
|
|
310
365
|
}
|
|
311
366
|
function getRuleItem(filter, parentId) {
|
|
@@ -317,6 +372,50 @@ function getRuleItem(filter, parentId) {
|
|
|
317
372
|
value: filter.value,
|
|
318
373
|
};
|
|
319
374
|
}
|
|
375
|
+
function getRangeRuleItems(group, parentId) {
|
|
376
|
+
if (group.rules.length !== 2) {
|
|
377
|
+
return undefined;
|
|
378
|
+
}
|
|
379
|
+
const [from, to] = group.rules;
|
|
380
|
+
if ((0, Types_1.isPropertyFilterRuleGroup)(from) ||
|
|
381
|
+
!from.value ||
|
|
382
|
+
from.value.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive ||
|
|
383
|
+
(0, Types_1.isPropertyFilterRuleGroup)(to) ||
|
|
384
|
+
!to.value ||
|
|
385
|
+
to.value.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive ||
|
|
386
|
+
from.property.name !== to.property.name) {
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
389
|
+
if (from.operator === "greater-or-equal" &&
|
|
390
|
+
to.operator === "less-or-equal" &&
|
|
391
|
+
group.operator === "and") {
|
|
392
|
+
return {
|
|
393
|
+
id: core_bentley_1.Guid.createValue(),
|
|
394
|
+
groupId: parentId,
|
|
395
|
+
operator: "between",
|
|
396
|
+
property: from.property,
|
|
397
|
+
value: FilterBuilderRangeValue_1.PropertyFilterBuilderRuleRangeValue.serialize({
|
|
398
|
+
from: from.value,
|
|
399
|
+
to: to.value,
|
|
400
|
+
}),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if (from.operator === "less" &&
|
|
404
|
+
to.operator === "greater" &&
|
|
405
|
+
group.operator === "or") {
|
|
406
|
+
return {
|
|
407
|
+
id: core_bentley_1.Guid.createValue(),
|
|
408
|
+
groupId: parentId,
|
|
409
|
+
operator: "not-between",
|
|
410
|
+
property: from.property,
|
|
411
|
+
value: FilterBuilderRangeValue_1.PropertyFilterBuilderRuleRangeValue.serialize({
|
|
412
|
+
from: from.value,
|
|
413
|
+
to: to.value,
|
|
414
|
+
}),
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
320
419
|
function convertFilterToState(filter) {
|
|
321
420
|
const id = core_bentley_1.Guid.createValue();
|
|
322
421
|
if ((0, Types_1.isPropertyFilterRuleGroup)(filter)) {
|
|
@@ -331,25 +430,33 @@ function convertFilterToState(filter) {
|
|
|
331
430
|
return {
|
|
332
431
|
rootGroup: {
|
|
333
432
|
id,
|
|
334
|
-
operator:
|
|
433
|
+
operator: "and",
|
|
335
434
|
items: [getRuleItem(filter, id)],
|
|
336
435
|
},
|
|
337
436
|
};
|
|
338
437
|
}
|
|
438
|
+
function isEmptyValue(value) {
|
|
439
|
+
return (value?.valueFormat !== appui_abstract_1.PropertyValueFormat.Primitive ||
|
|
440
|
+
value.value === undefined ||
|
|
441
|
+
value.value === "");
|
|
442
|
+
}
|
|
339
443
|
function areOperatorsSimilar(firstOperator, secondOperator) {
|
|
340
444
|
return ((isOperatorEqualOrIsNotEqual(firstOperator) &&
|
|
341
445
|
isOperatorEqualOrIsNotEqual(secondOperator)) ||
|
|
342
446
|
(isInequalityOperator(firstOperator) &&
|
|
343
|
-
isInequalityOperator(secondOperator))
|
|
447
|
+
isInequalityOperator(secondOperator)) ||
|
|
448
|
+
(isRangeOperator(firstOperator) && isRangeOperator(secondOperator)));
|
|
344
449
|
}
|
|
345
450
|
function isOperatorEqualOrIsNotEqual(operator) {
|
|
346
|
-
return
|
|
347
|
-
operator === Operators_1.PropertyFilterRuleOperator.IsNotEqual);
|
|
451
|
+
return operator === "is-equal" || operator === "is-not-equal";
|
|
348
452
|
}
|
|
349
453
|
function isInequalityOperator(operator) {
|
|
350
|
-
return (operator ===
|
|
351
|
-
operator ===
|
|
352
|
-
operator ===
|
|
353
|
-
operator ===
|
|
454
|
+
return (operator === "less" ||
|
|
455
|
+
operator === "less-or-equal" ||
|
|
456
|
+
operator === "greater" ||
|
|
457
|
+
operator === "greater-or-equal");
|
|
458
|
+
}
|
|
459
|
+
function isRangeOperator(operator) {
|
|
460
|
+
return operator === "between" || operator === "not-between";
|
|
354
461
|
}
|
|
355
462
|
//# 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,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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AAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAC9D;SACF,CAAC;KACH;IACD,OAAO;QACL,SAAS,EAAE;YACT,EAAE;YACF,QAAQ,EAAE,2CAA+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,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 /** 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,iCAAgC;AAChC,6CAA+B;AAE/B,0DAA4D;AAC5D,sDAA2C;AAK3C,2CAGqB;AAMrB,mCAAoD;AACpD,kDAA+C;AAC/C,uEAAgF;AAqDhF;;;GAGG;AACH,SAAgB,gCAAgC,CAC9C,IAAwC;IAExC,OAAQ,IAAY,CAAC,KAAK,KAAK,SAAS,CAAC;AAC3C,CAAC;AAJD,4EAIC;AAED;;;GAGG;AACH,MAAa,4BAA4B;IACvC,YACU,QAIC;QAJD,aAAQ,GAAR,QAAQ,CAIP;IACR,CAAC;IAEI,WAAW,CACjB,OAA2D;QAE3D,IAAI,CAAC,QAAQ,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,sEAAsE;IAC/D,OAAO,CAAC,IAAc,EAAE,QAA+B;QAC5D,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACzD,IAAI,CAAC,WAAW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,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAC9D;SACF,CAAC;KACH;IACD,OAAO;QACL,SAAS,EAAE;YACT,EAAE;YACF,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACjC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAqB;IACzC,OAAO,CACL,KAAK,EAAE,WAAW,KAAK,oCAAmB,CAAC,SAAS;QACpD,KAAK,CAAC,KAAK,KAAK,SAAS;QACzB,KAAK,CAAC,KAAK,KAAK,EAAE,CACnB,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,aAAiD,EACjD,cAAkD;IAElD,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;QACvC,CAAC,eAAe,CAAC,aAAa,CAAC,IAAI,eAAe,CAAC,cAAc,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B,CAClC,QAA4C;IAE5C,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,cAAc,CAAC;AAChE,CAAC;AAED,SAAS,oBAAoB,CAAC,QAA4C;IACxE,OAAO,CACL,QAAQ,KAAK,MAAM;QACnB,QAAQ,KAAK,eAAe;QAC5B,QAAQ,KAAK,SAAS;QACtB,QAAQ,KAAK,kBAAkB,CAChC,CAAC;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"}
|