@itwin/components-react 3.6.0-dev.8 → 3.6.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 +51 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/components-react/breadcrumb/Breadcrumb.d.ts +5 -5
- package/lib/cjs/components-react/breadcrumb/Breadcrumb.js +3 -3
- package/lib/cjs/components-react/breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbDetails.d.ts +2 -2
- package/lib/cjs/components-react/breadcrumb/BreadcrumbDetails.js +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbDetails.js.map +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbPath.d.ts +3 -3
- package/lib/cjs/components-react/breadcrumb/BreadcrumbPath.js +2 -2
- package/lib/cjs/components-react/breadcrumb/BreadcrumbPath.js.map +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbTreeUtils.d.ts +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbTreeUtils.js +1 -1
- package/lib/cjs/components-react/breadcrumb/BreadcrumbTreeUtils.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts +4 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +4 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.d.ts +2 -2
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.js +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideDialog.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideItem.d.ts +2 -2
- package/lib/cjs/components-react/common/showhide/ShowHideItem.js.map +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.d.ts +2 -2
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.js +1 -1
- package/lib/cjs/components-react/common/showhide/ShowHideMenu.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js +3 -4
- package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/cjs/components-react/editors/ThemedEnumEditor.d.ts +3 -3
- package/lib/cjs/components-react/editors/ThemedEnumEditor.js +2 -2
- package/lib/cjs/components-react/editors/ThemedEnumEditor.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +22 -24
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +24 -83
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +80 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +83 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +14 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +22 -12
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +4 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +25 -16
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +22 -14
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +14 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +16 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +14 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +52 -8
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +102 -12
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +23 -5
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +25 -7
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.d.ts +24 -4
- package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.js +11 -1
- package/lib/cjs/components-react/filter-builder/Types.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts +2 -2
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js +2 -2
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +2 -2
- package/lib/cjs/components-react/properties/LinkHandler.js +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyDataProvider.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.d.ts +3 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.js +1 -0
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts +5 -10
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +11 -0
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +6 -6
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +10 -10
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +3 -3
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.d.ts +2 -2
- 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/FlatPropertyRenderer.d.ts +3 -6
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/table/SimpleTableDataProvider.d.ts +1 -1
- package/lib/cjs/components-react/table/SimpleTableDataProvider.js +1 -1
- package/lib/cjs/components-react/table/SimpleTableDataProvider.js.map +1 -1
- package/lib/cjs/components-react/table/TableDataProvider.d.ts +8 -8
- package/lib/cjs/components-react/table/TableDataProvider.js +2 -2
- package/lib/cjs/components-react/table/TableDataProvider.js.map +1 -1
- package/lib/cjs/components-react/table/columnfiltering/ColumnFiltering.d.ts +16 -16
- package/lib/cjs/components-react/table/columnfiltering/ColumnFiltering.js +6 -6
- package/lib/cjs/components-react/table/columnfiltering/ColumnFiltering.js.map +1 -1
- package/lib/cjs/components-react/table/component/ColumnDragLayer.d.ts +1 -1
- package/lib/cjs/components-react/table/component/ColumnDragLayer.js +1 -1
- package/lib/cjs/components-react/table/component/ColumnDragLayer.js.map +1 -1
- package/lib/cjs/components-react/table/component/Table.d.ts +9 -9
- package/lib/cjs/components-react/table/component/Table.d.ts.map +1 -1
- package/lib/cjs/components-react/table/component/Table.js +2 -2
- package/lib/cjs/components-react/table/component/Table.js.map +1 -1
- package/lib/cjs/components-react/table/component/TableCell.d.ts +6 -6
- package/lib/cjs/components-react/table/component/TableCell.js +3 -3
- package/lib/cjs/components-react/table/component/TableCell.js.map +1 -1
- package/lib/cjs/components-react/table/component/TableColumn.d.ts +1 -1
- package/lib/cjs/components-react/table/component/TableColumn.js.map +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/BeDragDropContext.d.ts +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/BeDragDropContext.js +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/BeDragDropContext.js.map +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/DragDropDef.d.ts +8 -8
- package/lib/cjs/components-react/table/component/dragdrop/DragDropDef.js +2 -2
- package/lib/cjs/components-react/table/component/dragdrop/DragDropDef.js.map +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/withDragSource.d.ts +2 -2
- package/lib/cjs/components-react/table/component/dragdrop/withDragSource.js +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/withDragSource.js.map +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/withDropTarget.d.ts +2 -2
- package/lib/cjs/components-react/table/component/dragdrop/withDropTarget.js +1 -1
- package/lib/cjs/components-react/table/component/dragdrop/withDropTarget.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/tree/TreeDataProvider.d.ts +2 -2
- package/lib/cjs/components-react/tree/TreeDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/TreeDataProvider.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +1 -4
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts +2 -5
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/cjs/components-react.d.ts +4 -6
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +4 -6
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/breadcrumb/Breadcrumb.d.ts +5 -5
- package/lib/esm/components-react/breadcrumb/Breadcrumb.js +3 -3
- package/lib/esm/components-react/breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbDetails.d.ts +2 -2
- package/lib/esm/components-react/breadcrumb/BreadcrumbDetails.js +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbDetails.js.map +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbPath.d.ts +3 -3
- package/lib/esm/components-react/breadcrumb/BreadcrumbPath.js +2 -2
- package/lib/esm/components-react/breadcrumb/BreadcrumbPath.js.map +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbTreeUtils.d.ts +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbTreeUtils.js +1 -1
- package/lib/esm/components-react/breadcrumb/BreadcrumbTreeUtils.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts +4 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +4 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideDialog.d.ts +2 -2
- package/lib/esm/components-react/common/showhide/ShowHideDialog.js +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideDialog.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideItem.d.ts +2 -2
- package/lib/esm/components-react/common/showhide/ShowHideItem.js.map +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideMenu.d.ts +2 -2
- package/lib/esm/components-react/common/showhide/ShowHideMenu.js +1 -1
- package/lib/esm/components-react/common/showhide/ShowHideMenu.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js +3 -4
- package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/esm/components-react/editors/ThemedEnumEditor.d.ts +3 -3
- package/lib/esm/components-react/editors/ThemedEnumEditor.js +2 -2
- package/lib/esm/components-react/editors/ThemedEnumEditor.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +22 -24
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +17 -75
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +80 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +60 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +14 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +17 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +4 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +25 -16
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +15 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +14 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +16 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +14 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +52 -8
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +96 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.d.ts +23 -5
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +23 -5
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.d.ts +24 -4
- package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.js +11 -1
- package/lib/esm/components-react/filter-builder/Types.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts +2 -2
- package/lib/esm/components-react/iconpicker/IconPickerButton.js +2 -2
- package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +2 -2
- package/lib/esm/components-react/properties/LinkHandler.js +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyDataProvider.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.d.ts +3 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.js +1 -0
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts +5 -10
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +11 -0
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +6 -6
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +10 -10
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +3 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.d.ts +2 -2
- 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/FlatPropertyRenderer.d.ts +3 -6
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/table/SimpleTableDataProvider.d.ts +1 -1
- package/lib/esm/components-react/table/SimpleTableDataProvider.js +1 -1
- package/lib/esm/components-react/table/SimpleTableDataProvider.js.map +1 -1
- package/lib/esm/components-react/table/TableDataProvider.d.ts +8 -8
- package/lib/esm/components-react/table/TableDataProvider.js +2 -2
- package/lib/esm/components-react/table/TableDataProvider.js.map +1 -1
- package/lib/esm/components-react/table/columnfiltering/ColumnFiltering.d.ts +16 -16
- package/lib/esm/components-react/table/columnfiltering/ColumnFiltering.js +6 -6
- package/lib/esm/components-react/table/columnfiltering/ColumnFiltering.js.map +1 -1
- package/lib/esm/components-react/table/component/ColumnDragLayer.d.ts +1 -1
- package/lib/esm/components-react/table/component/ColumnDragLayer.js +1 -1
- package/lib/esm/components-react/table/component/ColumnDragLayer.js.map +1 -1
- package/lib/esm/components-react/table/component/Table.d.ts +9 -9
- package/lib/esm/components-react/table/component/Table.d.ts.map +1 -1
- package/lib/esm/components-react/table/component/Table.js +2 -2
- package/lib/esm/components-react/table/component/Table.js.map +1 -1
- package/lib/esm/components-react/table/component/TableCell.d.ts +6 -6
- package/lib/esm/components-react/table/component/TableCell.js +3 -3
- package/lib/esm/components-react/table/component/TableCell.js.map +1 -1
- package/lib/esm/components-react/table/component/TableColumn.d.ts +1 -1
- package/lib/esm/components-react/table/component/TableColumn.js.map +1 -1
- package/lib/esm/components-react/table/component/dragdrop/BeDragDropContext.d.ts +1 -1
- package/lib/esm/components-react/table/component/dragdrop/BeDragDropContext.js +1 -1
- package/lib/esm/components-react/table/component/dragdrop/BeDragDropContext.js.map +1 -1
- package/lib/esm/components-react/table/component/dragdrop/DragDropDef.d.ts +8 -8
- package/lib/esm/components-react/table/component/dragdrop/DragDropDef.js +2 -2
- package/lib/esm/components-react/table/component/dragdrop/DragDropDef.js.map +1 -1
- package/lib/esm/components-react/table/component/dragdrop/withDragSource.d.ts +2 -2
- package/lib/esm/components-react/table/component/dragdrop/withDragSource.js +1 -1
- package/lib/esm/components-react/table/component/dragdrop/withDragSource.js.map +1 -1
- package/lib/esm/components-react/table/component/dragdrop/withDropTarget.d.ts +2 -2
- package/lib/esm/components-react/table/component/dragdrop/withDropTarget.js +1 -1
- package/lib/esm/components-react/table/component/dragdrop/withDropTarget.js.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +2 -2
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/tree/TreeDataProvider.d.ts +2 -2
- package/lib/esm/components-react/tree/TreeDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/tree/TreeDataProvider.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +1 -4
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts +2 -5
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/esm/components-react.d.ts +4 -6
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +4 -6
- package/lib/esm/components-react.js.map +1 -1
- package/package.json +23 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedEnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ThemedEnumEditor.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,O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,EACxB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,IAAI,CAAC,kBAAkB,iBACrB,0BAA0B,EACtC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAC3D,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,KAAK;YACd,iDAAiD;YACjD,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC9B,OAAO,EAAE,OAAO,GAAI,CACvB,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,kBAAkB;IAE9D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAoB,sBAAsB;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAoB,qBAAqB;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,gBAAgB,OAAG,CAAC;IAC9B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module PropertyEditors\r\n */\r\n\r\nimport \"./ThemedEnumEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { EnumerationChoice, PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { OptionType, ThemedSelect } from \"@itwin/core-react\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\nimport { ActionMeta, ValueType } from \"react-select/src/types\";\r\n\r\n/** Properties for [[EnumEditor]] component\r\n * @beta @deprecated\r\n */\r\nexport interface ThemedEnumEditorProps extends PropertyEditorProps {\r\n /** Allow searching in enum list */\r\n isSearchable?: boolean;\r\n /** The prompt string used when no enum member has been selected */\r\n placeholder?: string;\r\n /** The function to return an error message used when the search string can't be found in the list */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n}\r\n/** @internal */\r\ninterface EnumEditorState {\r\n selectValue: string | number;\r\n valueIsNumber: boolean;\r\n options: OptionType[] | undefined;\r\n}\r\n\r\n/** EnumEditor React component that is a property editor with select input\r\n * @beta @deprecated\r\n */\r\nexport class ThemedEnumEditor extends React.PureComponent<ThemedEnumEditorProps, EnumEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<EnumEditorState> = {\r\n selectValue: \"\",\r\n valueIsNumber: false,\r\n options: undefined,\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.selectValue,\r\n displayValue: \"\",\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n // istanbul ignore next\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n // istanbul ignore next\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this._divElement.current)\r\n containsFocus = this._divElement.current.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n private _updateSelectValue = (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => {\r\n // istanbul ignore else\r\n if (this._isMounted && action.action === \"select-option\" && value) {\r\n let selectValue: string | number;\r\n const selectedOption: OptionType = value as OptionType;\r\n // istanbul ignore next\r\n if (selectedOption === undefined) // no multi-select allowed\r\n return;\r\n\r\n if (this.state.valueIsNumber)\r\n selectValue = parseInt(selectedOption.value, 10);\r\n else\r\n selectValue = selectedOption.value;\r\n\r\n this.setState({\r\n selectValue,\r\n }, async () => {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue) {\r\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n });\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this._isMounted = true;\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._isMounted = false;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const { propertyRecord } = this.props;\r\n let initialValue: string | number = \"\";\r\n let valueIsNumber: boolean = false;\r\n let choices: EnumerationChoice[] | undefined;\r\n\r\n if (propertyRecord && propertyRecord.property.enum) {\r\n // istanbul ignore else\r\n if (propertyRecord.property.enum.choices instanceof Promise) {\r\n choices = await propertyRecord.property.enum.choices;\r\n } else {\r\n choices = propertyRecord.property.enum.choices;\r\n }\r\n }\r\n\r\n let options: OptionType[] = [];\r\n if (this.state.options === undefined) {\r\n if (choices) {\r\n choices.forEach((choice: EnumerationChoice) => {\r\n options.push({ value: choice.value.toString(), label: choice.label });\r\n });\r\n }\r\n } else {\r\n options = this.state.options;\r\n }\r\n\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = propertyRecord.value.value;\r\n if (typeof primitiveValue === \"string\") {\r\n initialValue = primitiveValue;\r\n valueIsNumber = false;\r\n } else {\r\n initialValue = primitiveValue as number;\r\n valueIsNumber = true;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({ selectValue: initialValue, valueIsNumber, options });\r\n }\r\n\r\n /** @internal */\r\n public override render() {\r\n const className = classnames(\"components-cell-editor\", \"components-enum-editor\", this.props.className);\r\n const selectValue = this.state.selectValue ? this.state.selectValue.toString() : undefined;\r\n const options = this.state.options === undefined ? [] : this.state.options;\r\n const selectedOption = options.find((e) => e.value === selectValue);\r\n const { isSearchable, placeholder, noOptionsMessage } = this.props;\r\n // set min-width to show about 4 characters + down arrow\r\n const minWidthStyle: React.CSSProperties = {\r\n minWidth: `${6 * 0.75}em`,\r\n };\r\n\r\n return (\r\n <ThemedSelect\r\n divRef={this._divElement}\r\n className={className}\r\n value={selectedOption}\r\n onChange={this._updateSelectValue}\r\n data-testid=\"components-select-editor\"\r\n styles={this.props.style ? this.props.style : minWidthStyle}\r\n isSearchable={isSearchable}\r\n placeholder={placeholder}\r\n noOptionsMessage={noOptionsMessage}\r\n isMulti={false}\r\n // eslint-disable-next-line jsx-a11y/no-autofocus\r\n autoFocus={this.props.setFocus}\r\n options={options} />\r\n );\r\n }\r\n}\r\n\r\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\r\n * It uses the [[EnumEditor]] React component.\r\n * @beta @deprecated\r\n */\r\nexport class ThemedEnumPropertyEditor extends PropertyEditorBase {\r\n\r\n // istanbul ignore next\r\n public override get containerHandlesBlur(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesEscape(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesEnter(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public get reactNode(): React.ReactNode {\r\n return <ThemedEnumEditor />;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, ThemedEnumPropertyEditor, StandardEditorNames.ThemedEnum);\r\n"]}
|
|
1
|
+
{"version":3,"file":"ThemedEnumEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ThemedEnumEditor.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAoC,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAc,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAqBpF;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK,CAAC,aAAqD;IAAjG;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAExD,gBAAgB;QACS,UAAK,GAA8B;YAC1D,WAAW,EAAE,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,SAAS;SACnB,CAAC;QAgCM,uBAAkB,GAAG,CAAC,KAA4B,EAAE,MAA8B,EAAE,EAAE;YAC5F,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,KAAK,eAA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AAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,uBAAuB;IACvB,IAAW,SAAS;QAClB,OAAO,oBAAC,gBAAgB,OAAG,CAAC;IAC9B,CAAC;CACF;AAED,qBAAqB,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n/** @packageDocumentation\r\n * @module PropertyEditors\r\n */\r\n\r\nimport \"./ThemedEnumEditor.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { EnumerationChoice, PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { OptionType, ThemedSelect } from \"@itwin/core-react\";\r\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\r\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\r\nimport { ActionMeta, ValueType } from \"react-select/src/types\";\r\n\r\n/** Properties for [[EnumEditor]] component\r\n * @beta @deprecated in 3.0.\r\n */\r\nexport interface ThemedEnumEditorProps extends PropertyEditorProps {\r\n /** Allow searching in enum list */\r\n isSearchable?: boolean;\r\n /** The prompt string used when no enum member has been selected */\r\n placeholder?: string;\r\n /** The function to return an error message used when the search string can't be found in the list */\r\n noOptionsMessage?: (obj: { inputValue: string }) => string | null;\r\n}\r\n/** @internal */\r\ninterface EnumEditorState {\r\n selectValue: string | number;\r\n valueIsNumber: boolean;\r\n options: OptionType[] | undefined;\r\n}\r\n\r\n/** EnumEditor React component that is a property editor with select input\r\n * @beta @deprecated in 3.0.\r\n */\r\nexport class ThemedEnumEditor extends React.PureComponent<ThemedEnumEditorProps, EnumEditorState> implements TypeEditor {\r\n private _isMounted = false;\r\n private _divElement = React.createRef<HTMLDivElement>();\r\n\r\n /** @internal */\r\n public override readonly state: Readonly<EnumEditorState> = {\r\n selectValue: \"\",\r\n valueIsNumber: false,\r\n options: undefined,\r\n };\r\n\r\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\r\n const record = this.props.propertyRecord;\r\n let propertyValue: PropertyValue | undefined;\r\n\r\n // istanbul ignore else\r\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\r\n propertyValue = {\r\n valueFormat: PropertyValueFormat.Primitive,\r\n value: this.state.selectValue,\r\n displayValue: \"\",\r\n };\r\n }\r\n\r\n return propertyValue;\r\n }\r\n\r\n // istanbul ignore next\r\n public get htmlElement(): HTMLElement | null {\r\n return this._divElement.current;\r\n }\r\n\r\n // istanbul ignore next\r\n public get hasFocus(): boolean {\r\n let containsFocus = false;\r\n // istanbul ignore else\r\n if (this._divElement.current)\r\n containsFocus = this._divElement.current.contains(document.activeElement);\r\n return containsFocus;\r\n }\r\n\r\n private _updateSelectValue = (value: ValueType<OptionType>, action: ActionMeta<OptionType>) => {\r\n // istanbul ignore else\r\n if (this._isMounted && action.action === \"select-option\" && value) {\r\n let selectValue: string | number;\r\n const selectedOption: OptionType = value as OptionType;\r\n // istanbul ignore next\r\n if (selectedOption === undefined) // no multi-select allowed\r\n return;\r\n\r\n if (this.state.valueIsNumber)\r\n selectValue = parseInt(selectedOption.value, 10);\r\n else\r\n selectValue = selectedOption.value;\r\n\r\n this.setState({\r\n selectValue,\r\n }, async () => {\r\n // istanbul ignore else\r\n if (this.props.propertyRecord && this.props.onCommit) {\r\n const propertyValue = await this.getPropertyValue();\r\n // istanbul ignore else\r\n if (propertyValue) {\r\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\r\n }\r\n }\r\n });\r\n }\r\n };\r\n\r\n /** @internal */\r\n public override componentDidMount() {\r\n this._isMounted = true;\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._isMounted = false;\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\r\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\r\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n }\r\n\r\n private async setStateFromProps() {\r\n const { propertyRecord } = this.props;\r\n let initialValue: string | number = \"\";\r\n let valueIsNumber: boolean = false;\r\n let choices: EnumerationChoice[] | undefined;\r\n\r\n if (propertyRecord && propertyRecord.property.enum) {\r\n // istanbul ignore else\r\n if (propertyRecord.property.enum.choices instanceof Promise) {\r\n choices = await propertyRecord.property.enum.choices;\r\n } else {\r\n choices = propertyRecord.property.enum.choices;\r\n }\r\n }\r\n\r\n let options: OptionType[] = [];\r\n if (this.state.options === undefined) {\r\n if (choices) {\r\n choices.forEach((choice: EnumerationChoice) => {\r\n options.push({ value: choice.value.toString(), label: choice.label });\r\n });\r\n }\r\n } else {\r\n options = this.state.options;\r\n }\r\n\r\n // istanbul ignore else\r\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\r\n const primitiveValue = propertyRecord.value.value;\r\n if (typeof primitiveValue === \"string\") {\r\n initialValue = primitiveValue;\r\n valueIsNumber = false;\r\n } else {\r\n initialValue = primitiveValue as number;\r\n valueIsNumber = true;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (this._isMounted)\r\n this.setState({ selectValue: initialValue, valueIsNumber, options });\r\n }\r\n\r\n /** @internal */\r\n public override render() {\r\n const className = classnames(\"components-cell-editor\", \"components-enum-editor\", this.props.className);\r\n const selectValue = this.state.selectValue ? this.state.selectValue.toString() : undefined;\r\n const options = this.state.options === undefined ? [] : this.state.options;\r\n const selectedOption = options.find((e) => e.value === selectValue);\r\n const { isSearchable, placeholder, noOptionsMessage } = this.props;\r\n // set min-width to show about 4 characters + down arrow\r\n const minWidthStyle: React.CSSProperties = {\r\n minWidth: `${6 * 0.75}em`,\r\n };\r\n\r\n return (\r\n <ThemedSelect\r\n divRef={this._divElement}\r\n className={className}\r\n value={selectedOption}\r\n onChange={this._updateSelectValue}\r\n data-testid=\"components-select-editor\"\r\n styles={this.props.style ? this.props.style : minWidthStyle}\r\n isSearchable={isSearchable}\r\n placeholder={placeholder}\r\n noOptionsMessage={noOptionsMessage}\r\n isMulti={false}\r\n // eslint-disable-next-line jsx-a11y/no-autofocus\r\n autoFocus={this.props.setFocus}\r\n options={options} />\r\n );\r\n }\r\n}\r\n\r\n/** Enum Property Button Group Editor registered for the \"enum\" type name.\r\n * It uses the [[EnumEditor]] React component.\r\n * @beta @deprecated in 3.0.\r\n */\r\nexport class ThemedEnumPropertyEditor extends PropertyEditorBase {\r\n\r\n // istanbul ignore next\r\n public override get containerHandlesBlur(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesEscape(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesEnter(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public override get containerHandlesTab(): boolean {\r\n return false;\r\n }\r\n // istanbul ignore next\r\n public get reactNode(): React.ReactNode {\r\n return <ThemedEnumEditor />;\r\n }\r\n}\r\n\r\nPropertyEditorManager.registerEditor(StandardTypeNames.Enum, ThemedEnumPropertyEditor, StandardEditorNames.ThemedEnum);\r\n"]}
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
1
4
|
import * as React from "react";
|
|
2
5
|
import { PropertyDescription } from "@itwin/appui-abstract";
|
|
3
6
|
import { PropertyFilterBuilderRuleOperatorProps } from "./FilterBuilderRuleOperator";
|
|
4
7
|
import { PropertyFilterBuilderRuleValueProps } from "./FilterBuilderRuleValue";
|
|
5
|
-
import { PropertyFilterBuilderActions, PropertyFilterBuilderRuleGroupItem } from "./FilterBuilderState";
|
|
6
8
|
import { PropertyFilter } from "./Types";
|
|
7
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Props for [[PropertyFilterBuilder]] component.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
8
13
|
export interface PropertyFilterBuilderProps {
|
|
14
|
+
/** List of properties available to be used in filter rules. */
|
|
9
15
|
properties: PropertyDescription[];
|
|
16
|
+
/** Callback that is invoked when filter changes. */
|
|
10
17
|
onFilterChanged: (filter?: PropertyFilter) => void;
|
|
18
|
+
/** Callback that is invoked when property is selected in any rule. */
|
|
11
19
|
onRulePropertySelected?: (property: PropertyDescription) => void;
|
|
20
|
+
/** Custom renderer for rule operator selector. */
|
|
12
21
|
ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;
|
|
22
|
+
/** Custom renderer for rule value input. */
|
|
13
23
|
ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;
|
|
14
|
-
|
|
24
|
+
/** Custom renderer for property selector in rule. */
|
|
15
25
|
propertyRenderer?: (name: string) => React.ReactNode;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
/** @alpha */
|
|
19
|
-
export interface PropertyFilterBuilderContextProps {
|
|
20
|
-
actions: PropertyFilterBuilderActions;
|
|
21
|
-
properties: PropertyDescription[];
|
|
22
|
-
onRulePropertySelected?: (property: PropertyDescription) => void;
|
|
26
|
+
/** Specifies how deep rule groups can be nested. */
|
|
23
27
|
ruleGroupDepthLimit?: number;
|
|
28
|
+
/** Specifies whether component is disabled or not. */
|
|
29
|
+
isDisabled?: boolean;
|
|
30
|
+
/** Initial filter that should be shown when component is mounted. */
|
|
31
|
+
initialFilter?: PropertyFilter;
|
|
24
32
|
}
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;
|
|
30
|
-
ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;
|
|
31
|
-
propertyRenderer?: (name: string) => React.ReactNode;
|
|
32
|
-
disablePropertySelection?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/** @alpha */
|
|
35
|
-
export declare const PropertyFilterBuilderRuleRenderingContext: React.Context<PropertyFilterBuilderRuleRenderingContextProps>;
|
|
36
|
-
/** @alpha */
|
|
33
|
+
/**
|
|
34
|
+
* Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
37
|
export declare function PropertyFilterBuilder(props: PropertyFilterBuilderProps): JSX.Element;
|
|
38
|
-
/** @internal */
|
|
39
|
-
export declare function buildPropertyFilter(groupItem: PropertyFilterBuilderRuleGroupItem): PropertyFilter | undefined;
|
|
40
38
|
//# sourceMappingURL=FilterBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,+DAA+D;IAC/D,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,oDAAoD;IACpD,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,kDAAkD;IAClD,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,sCAAsC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC1F,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,mCAAmC,KAAK,KAAK,CAAC,SAAS,CAAC;IACpF,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qEAAqE;IACrE,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eAgCtE"}
|
|
@@ -2,93 +2,35 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
5
8
|
import * as React from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { isUnaryPropertyFilterOperator } from "./Operators";
|
|
10
|
-
/** @alpha */
|
|
11
|
-
export const PropertyFilterBuilderContext = React.createContext(null);
|
|
12
|
-
/** @alpha */
|
|
13
|
-
export const PropertyFilterBuilderRuleRenderingContext = React.createContext({});
|
|
9
|
+
import { ActiveRuleGroupContext, PropertyFilterBuilderContext, PropertyFilterBuilderRuleRenderingContext, useActiveRuleGroupContextProps, } from "./FilterBuilderContext";
|
|
10
|
+
import { PropertyFilterBuilderRuleGroupRenderer } from "./FilterBuilderRuleGroup";
|
|
11
|
+
import { buildPropertyFilter, usePropertyFilterBuilderState } from "./FilterBuilderState";
|
|
14
12
|
const ROOT_GROUP_PATH = [];
|
|
15
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
16
17
|
export function PropertyFilterBuilder(props) {
|
|
17
|
-
const { properties, onFilterChanged, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, ruleGroupDepthLimit, propertyRenderer,
|
|
18
|
-
const { state, actions } = usePropertyFilterBuilderState();
|
|
18
|
+
const { properties, onFilterChanged, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, ruleGroupDepthLimit, propertyRenderer, isDisabled, initialFilter } = props;
|
|
19
|
+
const { state, actions } = usePropertyFilterBuilderState(initialFilter);
|
|
19
20
|
const rootRef = React.useRef(null);
|
|
21
|
+
const firstRender = React.useRef(true);
|
|
20
22
|
const filter = React.useMemo(() => buildPropertyFilter(state.rootGroup), [state]);
|
|
21
23
|
React.useEffect(() => {
|
|
22
|
-
|
|
24
|
+
if (!firstRender.current)
|
|
25
|
+
onFilterChanged(filter);
|
|
26
|
+
firstRender.current = false;
|
|
23
27
|
}, [filter, onFilterChanged]);
|
|
24
28
|
const contextValue = React.useMemo(() => ({ actions, properties, onRulePropertySelected, ruleGroupDepthLimit }), [actions, properties, onRulePropertySelected, ruleGroupDepthLimit]);
|
|
25
|
-
const renderingContextValue = React.useMemo(() => ({ ruleOperatorRenderer, ruleValueRenderer, propertyRenderer,
|
|
29
|
+
const renderingContextValue = React.useMemo(() => ({ ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled }), [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]);
|
|
26
30
|
return (React.createElement(PropertyFilterBuilderRuleRenderingContext.Provider, { value: renderingContextValue },
|
|
27
31
|
React.createElement(PropertyFilterBuilderContext.Provider, { value: contextValue },
|
|
28
32
|
React.createElement(ActiveRuleGroupContext.Provider, { value: useActiveRuleGroupContextProps(rootRef) },
|
|
29
33
|
React.createElement("div", { ref: rootRef, className: "filter-builder" },
|
|
30
34
|
React.createElement(PropertyFilterBuilderRuleGroupRenderer, { path: ROOT_GROUP_PATH, group: state.rootGroup }))))));
|
|
31
35
|
}
|
|
32
|
-
/** @internal */
|
|
33
|
-
export function buildPropertyFilter(groupItem) {
|
|
34
|
-
if (isPropertyFilterBuilderRuleGroup(groupItem))
|
|
35
|
-
return buildPropertyFilterFromRuleGroup(groupItem);
|
|
36
|
-
return buildPropertyFilterFromRule(groupItem);
|
|
37
|
-
}
|
|
38
|
-
function buildPropertyFilterFromRuleGroup(rootGroup) {
|
|
39
|
-
if (rootGroup.items.length === 0)
|
|
40
|
-
return undefined;
|
|
41
|
-
const rules = new Array();
|
|
42
|
-
for (const item of rootGroup.items) {
|
|
43
|
-
const rule = buildPropertyFilter(item);
|
|
44
|
-
if (!rule)
|
|
45
|
-
return undefined;
|
|
46
|
-
rules.push(rule);
|
|
47
|
-
}
|
|
48
|
-
if (rules.length === 1)
|
|
49
|
-
return rules[0];
|
|
50
|
-
return {
|
|
51
|
-
operator: rootGroup.operator,
|
|
52
|
-
rules,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function buildPropertyFilterFromRule(rule) {
|
|
56
|
-
const { property, operator, value } = rule;
|
|
57
|
-
if (!property || operator === undefined)
|
|
58
|
-
return undefined;
|
|
59
|
-
if (!isUnaryPropertyFilterOperator(operator) && (value === undefined || value.valueFormat !== PropertyValueFormat.Primitive || value.value === undefined))
|
|
60
|
-
return undefined;
|
|
61
|
-
return { property, operator, value };
|
|
62
|
-
}
|
|
63
|
-
function useActiveRuleGroupContextProps(rootElementRef) {
|
|
64
|
-
const [activeElement, setActiveElement] = React.useState();
|
|
65
|
-
const onFocus = React.useCallback((e) => {
|
|
66
|
-
e.stopPropagation();
|
|
67
|
-
setActiveElement(e.currentTarget);
|
|
68
|
-
}, []);
|
|
69
|
-
const onBlur = React.useCallback((e) => {
|
|
70
|
-
e.stopPropagation();
|
|
71
|
-
if (activeElement !== e.currentTarget || (rootElementRef.current && rootElementRef.current.contains(e.relatedTarget)))
|
|
72
|
-
return;
|
|
73
|
-
setActiveElement(undefined);
|
|
74
|
-
}, [activeElement, rootElementRef]);
|
|
75
|
-
const onMouseOver = React.useCallback((e) => {
|
|
76
|
-
e.stopPropagation();
|
|
77
|
-
setActiveElement(e.currentTarget);
|
|
78
|
-
}, []);
|
|
79
|
-
const onMouseOut = React.useCallback((e) => {
|
|
80
|
-
e.stopPropagation();
|
|
81
|
-
// istanbul ignore if
|
|
82
|
-
if (activeElement !== e.currentTarget)
|
|
83
|
-
return;
|
|
84
|
-
setActiveElement(undefined);
|
|
85
|
-
}, [activeElement]);
|
|
86
|
-
return React.useMemo(() => ({
|
|
87
|
-
activeElement,
|
|
88
|
-
onFocus,
|
|
89
|
-
onBlur,
|
|
90
|
-
onMouseOver,
|
|
91
|
-
onMouseOut,
|
|
92
|
-
}), [activeElement, onFocus, onBlur, onMouseOver, onMouseOut]);
|
|
93
|
-
}
|
|
94
36
|
//# sourceMappingURL=FilterBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAuB,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,sCAAsC,EAAE,MAAM,0BAA0B,CAAC;AAG1G,OAAO,EACL,gCAAgC,EACI,6BAA6B,GAClE,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,6BAA6B,EAAE,MAA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,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAyC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/E,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,qBAAqB;QACrB,IAAI,aAAa,KAAK,CAAC,CAAC,aAAa;YACnC,OAAO;QAET,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1B,aAAa;QACb,OAAO;QACP,MAAM;QACN,WAAW;QACX,UAAU;KACX,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { PropertyDescription, PropertyValueFormat } from \"@itwin/appui-abstract\";\r\nimport { ActiveRuleGroupContext, PropertyFilterBuilderRuleGroupRenderer } from \"./FilterBuilderRuleGroup\";\r\nimport { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\r\nimport { PropertyFilterBuilderRuleValueProps } from \"./FilterBuilderRuleValue\";\r\nimport {\r\n isPropertyFilterBuilderRuleGroup, PropertyFilterBuilderActions, PropertyFilterBuilderRule, PropertyFilterBuilderRuleGroup,\r\n PropertyFilterBuilderRuleGroupItem, usePropertyFilterBuilderState,\r\n} from \"./FilterBuilderState\";\r\nimport { isUnaryPropertyFilterOperator } from \"./Operators\";\r\nimport { PropertyFilter } from \"./Types\";\r\n\r\n/** @alpha */\r\nexport interface PropertyFilterBuilderProps {\r\n properties: PropertyDescription[];\r\n onFilterChanged: (filter?: PropertyFilter) => void;\r\n onRulePropertySelected?: (property: PropertyDescription) => void;\r\n ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;\r\n ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;\r\n ruleGroupDepthLimit?: number;\r\n propertyRenderer?: (name: string) => React.ReactNode;\r\n disablePropertySelection?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport interface PropertyFilterBuilderContextProps {\r\n actions: PropertyFilterBuilderActions;\r\n properties: PropertyDescription[];\r\n onRulePropertySelected?: (property: PropertyDescription) => void;\r\n ruleGroupDepthLimit?: number;\r\n}\r\n\r\n/** @alpha */\r\nexport const PropertyFilterBuilderContext = React.createContext<PropertyFilterBuilderContextProps>(null!);\r\n\r\n/** @alpha */\r\nexport interface PropertyFilterBuilderRuleRenderingContextProps {\r\n ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;\r\n ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;\r\n propertyRenderer?: (name: string) => React.ReactNode;\r\n disablePropertySelection?: boolean;\r\n}\r\n\r\n/** @alpha */\r\nexport const PropertyFilterBuilderRuleRenderingContext = React.createContext<PropertyFilterBuilderRuleRenderingContextProps>({});\r\n\r\nconst ROOT_GROUP_PATH: string[] = [];\r\n\r\n/** @alpha */\r\nexport function PropertyFilterBuilder(props: PropertyFilterBuilderProps) {\r\n const { properties, onFilterChanged, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, ruleGroupDepthLimit, propertyRenderer, disablePropertySelection } = props;\r\n const { state, actions } = usePropertyFilterBuilderState();\r\n const rootRef = React.useRef<HTMLDivElement>(null);\r\n\r\n const filter = React.useMemo(() => buildPropertyFilter(state.rootGroup), [state]);\r\n React.useEffect(() => {\r\n onFilterChanged(filter);\r\n }, [filter, onFilterChanged]);\r\n\r\n const contextValue = React.useMemo<PropertyFilterBuilderContextProps>(\r\n () => ({ actions, properties, onRulePropertySelected, ruleGroupDepthLimit }),\r\n [actions, properties, onRulePropertySelected, ruleGroupDepthLimit]\r\n );\r\n const renderingContextValue = React.useMemo<PropertyFilterBuilderRuleRenderingContextProps>(\r\n () => ({ ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, disablePropertySelection }),\r\n [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, disablePropertySelection]\r\n );\r\n return (\r\n <PropertyFilterBuilderRuleRenderingContext.Provider value={renderingContextValue}>\r\n <PropertyFilterBuilderContext.Provider value={contextValue}>\r\n <ActiveRuleGroupContext.Provider value={useActiveRuleGroupContextProps(rootRef)}>\r\n <div ref={rootRef} className=\"filter-builder\">\r\n <PropertyFilterBuilderRuleGroupRenderer path={ROOT_GROUP_PATH} group={state.rootGroup} />\r\n </div>\r\n </ActiveRuleGroupContext.Provider>\r\n </PropertyFilterBuilderContext.Provider>\r\n </PropertyFilterBuilderRuleRenderingContext.Provider>\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport function buildPropertyFilter(groupItem: PropertyFilterBuilderRuleGroupItem): PropertyFilter | undefined {\r\n if (isPropertyFilterBuilderRuleGroup(groupItem))\r\n return buildPropertyFilterFromRuleGroup(groupItem);\r\n return buildPropertyFilterFromRule(groupItem);\r\n}\r\n\r\nfunction buildPropertyFilterFromRuleGroup(rootGroup: PropertyFilterBuilderRuleGroup): PropertyFilter | undefined {\r\n if (rootGroup.items.length === 0)\r\n return undefined;\r\n\r\n const rules = new Array<PropertyFilter>();\r\n for (const item of rootGroup.items) {\r\n const rule = buildPropertyFilter(item);\r\n if (!rule)\r\n return undefined;\r\n rules.push(rule);\r\n }\r\n\r\n if (rules.length === 1)\r\n return rules[0];\r\n\r\n return {\r\n operator: rootGroup.operator,\r\n rules,\r\n };\r\n}\r\n\r\nfunction buildPropertyFilterFromRule(rule: PropertyFilterBuilderRule): PropertyFilter | undefined {\r\n const { property, operator, value } = rule;\r\n if (!property || operator === undefined)\r\n return undefined;\r\n\r\n if (!isUnaryPropertyFilterOperator(operator) && (value === undefined || value.valueFormat !== PropertyValueFormat.Primitive || value.value === undefined))\r\n return undefined;\r\n\r\n return { property, operator, value };\r\n}\r\n\r\nfunction useActiveRuleGroupContextProps(rootElementRef: React.RefObject<HTMLElement>) {\r\n const [activeElement, setActiveElement] = React.useState<HTMLElement | undefined>();\r\n\r\n const onFocus: React.FocusEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n setActiveElement(e.currentTarget);\r\n }, []);\r\n\r\n const onBlur: React.FocusEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n if (activeElement !== e.currentTarget || (rootElementRef.current && rootElementRef.current.contains(e.relatedTarget)))\r\n return;\r\n\r\n setActiveElement(undefined);\r\n }, [activeElement, rootElementRef]);\r\n\r\n const onMouseOver: React.MouseEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n setActiveElement(e.currentTarget);\r\n }, []);\r\n\r\n const onMouseOut: React.MouseEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n // istanbul ignore if\r\n if (activeElement !== e.currentTarget)\r\n return;\r\n\r\n setActiveElement(undefined);\r\n }, [activeElement]);\r\n\r\n return React.useMemo(() => ({\r\n activeElement,\r\n onFocus,\r\n onBlur,\r\n onMouseOver,\r\n onMouseOut,\r\n }), [activeElement, onFocus, onBlur, onMouseOver, onMouseOut]);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,sBAAsB,EAAE,4BAA4B,EAAqC,yCAAyC,EAClF,8BAA8B,GAC/E,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sCAAsC,E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iB,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,EACjF,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,CAAC,CACxE,CAAC;IACF,OAAO,CACL,oBAAC,yCAAyC,CAAC,QAAQ,IAAC,KAAK,EAAE,qBAAqB;QAC9E,oBAAC,4BAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;YACxD,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B,CAAC,OAAO,CAAC;gBAC7E,6BAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,gBAAgB;oBAC3C,oBAAC,sCAAsC,IAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,GAAI,CACrF,CAC0B,CACI,CACW,CACtD,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyFilterBuilder\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PropertyDescription } from \"@itwin/appui-abstract\";\r\nimport {\r\n ActiveRuleGroupContext, PropertyFilterBuilderContext, PropertyFilterBuilderContextProps, PropertyFilterBuilderRuleRenderingContext,\r\n PropertyFilterBuilderRuleRenderingContextProps, useActiveRuleGroupContextProps,\r\n} from \"./FilterBuilderContext\";\r\nimport { PropertyFilterBuilderRuleGroupRenderer } from \"./FilterBuilderRuleGroup\";\r\nimport { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\r\nimport { PropertyFilterBuilderRuleValueProps } from \"./FilterBuilderRuleValue\";\r\nimport { buildPropertyFilter, usePropertyFilterBuilderState } from \"./FilterBuilderState\";\r\nimport { PropertyFilter } from \"./Types\";\r\n\r\n/**\r\n * Props for [[PropertyFilterBuilder]] component.\r\n * @beta\r\n */\r\nexport interface PropertyFilterBuilderProps {\r\n /** List of properties available to be used in filter rules. */\r\n properties: PropertyDescription[];\r\n /** Callback that is invoked when filter changes. */\r\n onFilterChanged: (filter?: PropertyFilter) => void;\r\n /** Callback that is invoked when property is selected in any rule. */\r\n onRulePropertySelected?: (property: PropertyDescription) => void;\r\n /** Custom renderer for rule operator selector. */\r\n ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;\r\n /** Custom renderer for rule value input. */\r\n ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;\r\n /** Custom renderer for property selector in rule. */\r\n propertyRenderer?: (name: string) => React.ReactNode;\r\n /** Specifies how deep rule groups can be nested. */\r\n ruleGroupDepthLimit?: number;\r\n /** Specifies whether component is disabled or not. */\r\n isDisabled?: boolean;\r\n /** Initial filter that should be shown when component is mounted. */\r\n initialFilter?: PropertyFilter;\r\n}\r\n\r\nconst ROOT_GROUP_PATH: string[] = [];\r\n\r\n/**\r\n * Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.\r\n * @beta\r\n */\r\nexport function PropertyFilterBuilder(props: PropertyFilterBuilderProps) {\r\n const { properties, onFilterChanged, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, ruleGroupDepthLimit, propertyRenderer, isDisabled, initialFilter } = props;\r\n const { state, actions } = usePropertyFilterBuilderState(initialFilter);\r\n const rootRef = React.useRef<HTMLDivElement>(null);\r\n\r\n const firstRender = React.useRef(true);\r\n const filter = React.useMemo(() => buildPropertyFilter(state.rootGroup), [state]);\r\n React.useEffect(() => {\r\n if (!firstRender.current)\r\n onFilterChanged(filter);\r\n firstRender.current = false;\r\n }, [filter, onFilterChanged]);\r\n\r\n const contextValue = React.useMemo<PropertyFilterBuilderContextProps>(\r\n () => ({ actions, properties, onRulePropertySelected, ruleGroupDepthLimit }),\r\n [actions, properties, onRulePropertySelected, ruleGroupDepthLimit]\r\n );\r\n const renderingContextValue = React.useMemo<PropertyFilterBuilderRuleRenderingContextProps>(\r\n () => ({ ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled }),\r\n [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]\r\n );\r\n return (\r\n <PropertyFilterBuilderRuleRenderingContext.Provider value={renderingContextValue}>\r\n <PropertyFilterBuilderContext.Provider value={contextValue}>\r\n <ActiveRuleGroupContext.Provider value={useActiveRuleGroupContextProps(rootRef)}>\r\n <div ref={rootRef} className=\"filter-builder\">\r\n <PropertyFilterBuilderRuleGroupRenderer path={ROOT_GROUP_PATH} group={state.rootGroup} />\r\n </div>\r\n </ActiveRuleGroupContext.Provider>\r\n </PropertyFilterBuilderContext.Provider>\r\n </PropertyFilterBuilderRuleRenderingContext.Provider>\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { PropertyDescription } from "@itwin/appui-abstract";
|
|
6
|
+
import { PropertyFilterBuilderActions } from "./FilterBuilderState";
|
|
7
|
+
import { PropertyFilterBuilderRuleOperatorProps } from "./FilterBuilderRuleOperator";
|
|
8
|
+
import { PropertyFilterBuilderRuleValueProps } from "./FilterBuilderRuleValue";
|
|
9
|
+
/**
|
|
10
|
+
* Data structure that describes [[PropertyFilterBuilderContext]] value.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export interface PropertyFilterBuilderContextProps {
|
|
14
|
+
/** Actions for modifying [[PropertyFilterBuilder]] state. */
|
|
15
|
+
actions: PropertyFilterBuilderActions;
|
|
16
|
+
/** List of available properties. */
|
|
17
|
+
properties: PropertyDescription[];
|
|
18
|
+
/** Callback to invoke when property is selected in any rule. */
|
|
19
|
+
onRulePropertySelected?: (property: PropertyDescription) => void;
|
|
20
|
+
/** Specifies how deep rule groups can be nested. */
|
|
21
|
+
ruleGroupDepthLimit?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Context used to store data for rules and rule groups rendered inside [[PropertyFilterBuilder]] component.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare const PropertyFilterBuilderContext: React.Context<PropertyFilterBuilderContextProps>;
|
|
28
|
+
/**
|
|
29
|
+
* Data structure that describes [[PropertyFilterBuilderRuleRenderingContext]] value.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export interface PropertyFilterBuilderRuleRenderingContextProps {
|
|
33
|
+
/** Custom renderer for operator selector in rule. */
|
|
34
|
+
ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;
|
|
35
|
+
/** Custom renderer for value input in rule. */
|
|
36
|
+
ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;
|
|
37
|
+
/** Custom renderer for property selector in rule. */
|
|
38
|
+
propertyRenderer?: (name: string) => React.ReactNode;
|
|
39
|
+
/** Specifies that properties selection is disabled. */
|
|
40
|
+
isDisabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Context for rendering rules and rule groups inside [[PropertyFilterBuilder]] component.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare const PropertyFilterBuilderRuleRenderingContext: React.Context<PropertyFilterBuilderRuleRenderingContextProps>;
|
|
47
|
+
/**
|
|
48
|
+
* Data structure that describes value of [[ActiveRuleGroupContext]].
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export interface ActiveRuleGroupContextProps {
|
|
52
|
+
/** Element of currently active rule group. */
|
|
53
|
+
activeElement: HTMLElement | undefined;
|
|
54
|
+
/** Even handler for rule group element 'onFocus' event */
|
|
55
|
+
onFocus: React.FocusEventHandler<HTMLElement>;
|
|
56
|
+
/** Even handler for rule group element 'onBlur' event */
|
|
57
|
+
onBlur: React.FocusEventHandler<HTMLElement>;
|
|
58
|
+
/** Even handler for rule group element 'onMouseOver' event */
|
|
59
|
+
onMouseOver: React.MouseEventHandler<HTMLElement>;
|
|
60
|
+
/** Even handler for rule group element 'onMouseOut' event */
|
|
61
|
+
onMouseOut: React.MouseEventHandler<HTMLElement>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Context for tracking and storing active rule group in [[PropertyFilterBuilder]].
|
|
65
|
+
* Group is considered active if it is focused or hovered.
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare const ActiveRuleGroupContext: React.Context<ActiveRuleGroupContextProps>;
|
|
69
|
+
/**
|
|
70
|
+
* Custom hook that created value for [[ActiveRuleGroupContext]].
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare function useActiveRuleGroupContextProps(rootElementRef: React.RefObject<HTMLElement>): {
|
|
74
|
+
activeElement: HTMLElement | undefined;
|
|
75
|
+
onFocus: React.FocusEventHandler<HTMLElement>;
|
|
76
|
+
onBlur: React.FocusEventHandler<HTMLElement>;
|
|
77
|
+
onMouseOver: React.MouseEventHandler<HTMLElement>;
|
|
78
|
+
onMouseOut: React.MouseEventHandler<HTMLElement>;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=FilterBuilderContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterBuilderContext.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderContext.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,iCAAiC;IAChD,6DA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AAgB,8BAA8B,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;EAqC1F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
/**
|
|
10
|
+
* Context used to store data for rules and rule groups rendered inside [[PropertyFilterBuilder]] component.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export const PropertyFilterBuilderContext = React.createContext(null);
|
|
14
|
+
/**
|
|
15
|
+
* Context for rendering rules and rule groups inside [[PropertyFilterBuilder]] component.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export const PropertyFilterBuilderRuleRenderingContext = React.createContext({});
|
|
19
|
+
/**
|
|
20
|
+
* Context for tracking and storing active rule group in [[PropertyFilterBuilder]].
|
|
21
|
+
* Group is considered active if it is focused or hovered.
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export const ActiveRuleGroupContext = React.createContext(null);
|
|
25
|
+
/**
|
|
26
|
+
* Custom hook that created value for [[ActiveRuleGroupContext]].
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export function useActiveRuleGroupContextProps(rootElementRef) {
|
|
30
|
+
const [activeElement, setActiveElement] = React.useState();
|
|
31
|
+
const onFocus = React.useCallback((e) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
setActiveElement(e.currentTarget);
|
|
34
|
+
}, []);
|
|
35
|
+
const onBlur = React.useCallback((e) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
if (activeElement !== e.currentTarget || (rootElementRef.current && rootElementRef.current.contains(e.relatedTarget)))
|
|
38
|
+
return;
|
|
39
|
+
setActiveElement(undefined);
|
|
40
|
+
}, [activeElement, rootElementRef]);
|
|
41
|
+
const onMouseOver = React.useCallback((e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
setActiveElement(e.currentTarget);
|
|
44
|
+
}, []);
|
|
45
|
+
const onMouseOut = React.useCallback((e) => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
// istanbul ignore if
|
|
48
|
+
if (activeElement !== e.currentTarget)
|
|
49
|
+
return;
|
|
50
|
+
setActiveElement(undefined);
|
|
51
|
+
}, [activeElement]);
|
|
52
|
+
return React.useMemo(() => ({
|
|
53
|
+
activeElement,
|
|
54
|
+
onFocus,
|
|
55
|
+
onBlur,
|
|
56
|
+
onMouseOver,
|
|
57
|
+
onMouseOut,
|
|
58
|
+
}), [activeElement, onFocus, onBlur, onMouseOver, onMouseOut]);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=FilterBuilderContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterBuilderContext.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderContext.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,CAAC,aAAa,CAAoC,IAAK,CAAC,CAAC;AAiB1G;;;GAGG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,KAAK,CAAC,aAAa,CAAiD,EAAE,CAAC,CAAC;AAmBjI;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAK,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,cAA4C;IACzF,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,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WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyFilterBuilder\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { PropertyDescription } from \"@itwin/appui-abstract\";\r\nimport { PropertyFilterBuilderActions } from \"./FilterBuilderState\";\r\nimport { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\r\nimport { PropertyFilterBuilderRuleValueProps } from \"./FilterBuilderRuleValue\";\r\n\r\n/**\r\n * Data structure that describes [[PropertyFilterBuilderContext]] value.\r\n * @internal\r\n */\r\nexport interface PropertyFilterBuilderContextProps {\r\n /** Actions for modifying [[PropertyFilterBuilder]] state. */\r\n actions: PropertyFilterBuilderActions;\r\n /** List of available properties. */\r\n properties: PropertyDescription[];\r\n /** Callback to invoke when property is selected in any rule. */\r\n onRulePropertySelected?: (property: PropertyDescription) => void;\r\n /** Specifies how deep rule groups can be nested. */\r\n ruleGroupDepthLimit?: number;\r\n}\r\n\r\n/**\r\n * Context used to store data for rules and rule groups rendered inside [[PropertyFilterBuilder]] component.\r\n * @internal\r\n */\r\nexport const PropertyFilterBuilderContext = React.createContext<PropertyFilterBuilderContextProps>(null!);\r\n\r\n/**\r\n * Data structure that describes [[PropertyFilterBuilderRuleRenderingContext]] value.\r\n * @internal\r\n */\r\nexport interface PropertyFilterBuilderRuleRenderingContextProps {\r\n /** Custom renderer for operator selector in rule. */\r\n ruleOperatorRenderer?: (props: PropertyFilterBuilderRuleOperatorProps) => React.ReactNode;\r\n /** Custom renderer for value input in rule. */\r\n ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueProps) => React.ReactNode;\r\n /** Custom renderer for property selector in rule. */\r\n propertyRenderer?: (name: string) => React.ReactNode;\r\n /** Specifies that properties selection is disabled. */\r\n isDisabled?: boolean;\r\n}\r\n\r\n/**\r\n * Context for rendering rules and rule groups inside [[PropertyFilterBuilder]] component.\r\n * @internal\r\n */\r\nexport const PropertyFilterBuilderRuleRenderingContext = React.createContext<PropertyFilterBuilderRuleRenderingContextProps>({});\r\n\r\n/**\r\n * Data structure that describes value of [[ActiveRuleGroupContext]].\r\n * @internal\r\n */\r\nexport interface ActiveRuleGroupContextProps {\r\n /** Element of currently active rule group. */\r\n activeElement: HTMLElement | undefined;\r\n /** Even handler for rule group element 'onFocus' event */\r\n onFocus: React.FocusEventHandler<HTMLElement>;\r\n /** Even handler for rule group element 'onBlur' event */\r\n onBlur: React.FocusEventHandler<HTMLElement>;\r\n /** Even handler for rule group element 'onMouseOver' event */\r\n onMouseOver: React.MouseEventHandler<HTMLElement>;\r\n /** Even handler for rule group element 'onMouseOut' event */\r\n onMouseOut: React.MouseEventHandler<HTMLElement>;\r\n}\r\n\r\n/**\r\n * Context for tracking and storing active rule group in [[PropertyFilterBuilder]].\r\n * Group is considered active if it is focused or hovered.\r\n * @internal\r\n */\r\nexport const ActiveRuleGroupContext = React.createContext<ActiveRuleGroupContextProps>(null!);\r\n\r\n/**\r\n * Custom hook that created value for [[ActiveRuleGroupContext]].\r\n * @internal\r\n */\r\nexport function useActiveRuleGroupContextProps(rootElementRef: React.RefObject<HTMLElement>) {\r\n const [activeElement, setActiveElement] = React.useState<HTMLElement | undefined>();\r\n\r\n const onFocus: React.FocusEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n setActiveElement(e.currentTarget);\r\n }, []);\r\n\r\n const onBlur: React.FocusEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n if (activeElement !== e.currentTarget || (rootElementRef.current && rootElementRef.current.contains(e.relatedTarget)))\r\n return;\r\n\r\n setActiveElement(undefined);\r\n }, [activeElement, rootElementRef]);\r\n\r\n const onMouseOver: React.MouseEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n setActiveElement(e.currentTarget);\r\n }, []);\r\n\r\n const onMouseOut: React.MouseEventHandler<HTMLElement> = React.useCallback((e) => {\r\n e.stopPropagation();\r\n // istanbul ignore if\r\n if (activeElement !== e.currentTarget)\r\n return;\r\n\r\n setActiveElement(undefined);\r\n }, [activeElement]);\r\n\r\n return React.useMemo(() => ({\r\n activeElement,\r\n onFocus,\r\n onBlur,\r\n onMouseOver,\r\n onMouseOut,\r\n }), [activeElement, onFocus, onBlur, onMouseOver, onMouseOut]);\r\n}\r\n"]}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
1
4
|
/// <reference types="react" />
|
|
2
|
-
import { PropertyFilterBuilderRule } from "./FilterBuilderState";
|
|
3
5
|
import "./FilterBuilderRule.scss";
|
|
4
|
-
|
|
6
|
+
import { PropertyFilterBuilderRule } from "./FilterBuilderState";
|
|
7
|
+
/**
|
|
8
|
+
* Props for [[PropertyFilterBuilderRuleRenderer]] component.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
5
11
|
export interface PropertyFilterBuilderRuleRendererProps {
|
|
12
|
+
/** Path from [[PropertyFilterBuilder]] root to this rule. */
|
|
6
13
|
path: string[];
|
|
14
|
+
/** Rule to render. */
|
|
7
15
|
rule: PropertyFilterBuilderRule;
|
|
8
16
|
}
|
|
9
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Component that renders single rule in [[PropertyFilterBuilder]] component.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
10
21
|
export declare function PropertyFilterBuilderRuleRenderer(props: PropertyFilterBuilderRuleRendererProps): JSX.Element;
|
|
11
22
|
//# sourceMappingURL=FilterBuilderRule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRule.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FilterBuilderRule.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,0BAA0B,CAAC;AASlC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD,6DAA6D;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,yBAAyB,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,sCAAsC,eA8D9F"}
|
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
8
|
+
import "./FilterBuilderRule.scss";
|
|
5
9
|
import * as React from "react";
|
|
6
10
|
import { SvgDelete } from "@itwin/itwinui-icons-react";
|
|
7
11
|
import { IconButton } from "@itwin/itwinui-react";
|
|
8
|
-
import { PropertyFilterBuilderContext, PropertyFilterBuilderRuleRenderingContext } from "./
|
|
12
|
+
import { PropertyFilterBuilderContext, PropertyFilterBuilderRuleRenderingContext } from "./FilterBuilderContext";
|
|
9
13
|
import { PropertyFilterBuilderRuleOperator } from "./FilterBuilderRuleOperator";
|
|
10
14
|
import { PropertyFilterBuilderRuleProperty } from "./FilterBuilderRuleProperty";
|
|
11
15
|
import { PropertyFilterBuilderRuleValue } from "./FilterBuilderRuleValue";
|
|
12
16
|
import { isUnaryPropertyFilterOperator } from "./Operators";
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Component that renders single rule in [[PropertyFilterBuilder]] component.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
15
21
|
export function PropertyFilterBuilderRuleRenderer(props) {
|
|
16
22
|
const { path, rule } = props;
|
|
17
23
|
const { properties, actions, onRulePropertySelected } = React.useContext(PropertyFilterBuilderContext);
|
|
18
|
-
const { ruleOperatorRenderer, ruleValueRenderer, propertyRenderer,
|
|
24
|
+
const { ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled } = React.useContext(PropertyFilterBuilderRuleRenderingContext);
|
|
19
25
|
const { property, operator, value } = rule;
|
|
20
26
|
const onSelectedPropertyChanged = React.useCallback((newProperty) => {
|
|
21
27
|
actions.setRuleProperty(path, newProperty);
|
|
@@ -46,8 +52,12 @@ export function PropertyFilterBuilderRuleRenderer(props) {
|
|
|
46
52
|
React.createElement(IconButton, { onClick: removeRule, styleType: "borderless", size: "small" },
|
|
47
53
|
React.createElement(SvgDelete, null))),
|
|
48
54
|
React.createElement("div", { className: "rule-condition" },
|
|
49
|
-
React.createElement(PropertyFilterBuilderRuleProperty, { properties: properties, selectedProperty: rule.property, onSelectedPropertyChanged: onSelectedPropertyChanged, propertyRenderer: propertyRenderer, isDisabled:
|
|
50
|
-
property
|
|
51
|
-
|
|
55
|
+
React.createElement(PropertyFilterBuilderRuleProperty, { properties: properties, selectedProperty: rule.property, onSelectedPropertyChanged: onSelectedPropertyChanged, propertyRenderer: propertyRenderer, isDisabled: isDisabled }),
|
|
56
|
+
property !== undefined
|
|
57
|
+
? operatorRenderer(property)
|
|
58
|
+
: null,
|
|
59
|
+
property !== undefined && operator !== undefined && !isUnaryPropertyFilterOperator(operator)
|
|
60
|
+
? valueRenderer(property)
|
|
61
|
+
: null));
|
|
52
62
|
}
|
|
53
63
|
//# sourceMappingURL=FilterBuilderRule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRule.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAAA;;;+F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,CAAC,IAAyB,EAAE,EAAE;QACpE,IAAI,iBAAiB;YACnB,OAAO,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACnF,OAAO,oBAAC,8BAA8B,IAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;IACvG,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAElD,OAAO,6BAAK,SAAS,EAAC,MAAM;QAC1B,6BAAK,SAAS,EAAC,oBAAoB;YACjC,oBAAC,UAAU,IAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAC,YAAY,EAAC,IAAI,EAAC,OAAO;gBAClE,oBAAC,SAAS,OAAG,CACF,CACT;QACN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,oBAAC,iCAAiC,IAChC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAC/B,yBAAyB,EAAE,yBAAyB,EACpD,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,GACtB;YAEA,QAAQ,KAAK,SAAS;gBACpB,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC;gBAC5B,CAAC,CAAC,IAAI;YAGR,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC;gBAC1F,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC;gBACzB,CAAC,CAAC,IAAI,CAEN,CACF,CAAC;AACT,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PropertyFilterBuilder\r\n */\r\n\r\nimport \"./FilterBuilderRule.scss\";\r\nimport * as React from \"react\";\r\nimport { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\r\nimport { SvgDelete } from \"@itwin/itwinui-icons-react\";\r\nimport { IconButton } from \"@itwin/itwinui-react\";\r\nimport { PropertyFilterBuilderContext, PropertyFilterBuilderRuleRenderingContext } from \"./FilterBuilderContext\";\r\nimport { PropertyFilterBuilderRuleOperator } from \"./FilterBuilderRuleOperator\";\r\nimport { PropertyFilterBuilderRuleProperty } from \"./FilterBuilderRuleProperty\";\r\nimport { PropertyFilterBuilderRuleValue } from \"./FilterBuilderRuleValue\";\r\nimport { PropertyFilterBuilderRule } from \"./FilterBuilderState\";\r\nimport { isUnaryPropertyFilterOperator, PropertyFilterRuleOperator } from \"./Operators\";\r\n\r\n/**\r\n * Props for [[PropertyFilterBuilderRuleRenderer]] component.\r\n * @internal\r\n */\r\nexport interface PropertyFilterBuilderRuleRendererProps {\r\n /** Path from [[PropertyFilterBuilder]] root to this rule. */\r\n path: string[];\r\n /** Rule to render. */\r\n rule: PropertyFilterBuilderRule;\r\n}\r\n\r\n/**\r\n * Component that renders single rule in [[PropertyFilterBuilder]] component.\r\n * @internal\r\n */\r\nexport function PropertyFilterBuilderRuleRenderer(props: PropertyFilterBuilderRuleRendererProps) {\r\n const { path, rule } = props;\r\n const { properties, actions, onRulePropertySelected } = React.useContext(PropertyFilterBuilderContext);\r\n const { ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled } = React.useContext(PropertyFilterBuilderRuleRenderingContext);\r\n const { property, operator, value } = rule;\r\n\r\n const onSelectedPropertyChanged = React.useCallback((newProperty?: PropertyDescription) => {\r\n actions.setRuleProperty(path, newProperty);\r\n // invoke 'onRulePropertySelected' when new property is selected. There is no way to deselect property\r\n // so 'newProperty' will be 'undefined' only if selected property is no longer in 'properties' list.\r\n if (onRulePropertySelected && newProperty)\r\n onRulePropertySelected(newProperty);\r\n }, [path, onRulePropertySelected, actions]);\r\n\r\n const onRuleOperatorChange = React.useCallback((newOperator: PropertyFilterRuleOperator) => {\r\n actions.setRuleOperator(path, newOperator);\r\n }, [path, actions]);\r\n\r\n const onRuleValueChange = React.useCallback((newValue: PropertyValue) => {\r\n actions.setRuleValue(path, newValue);\r\n }, [path, actions]);\r\n\r\n const removeRule = () => actions.removeItem(path);\r\n\r\n const operatorRenderer = React.useCallback((prop: PropertyDescription) => {\r\n if (ruleOperatorRenderer)\r\n return ruleOperatorRenderer({ property: prop, operator, onChange: onRuleOperatorChange });\r\n return <PropertyFilterBuilderRuleOperator property={prop} onChange={onRuleOperatorChange} operator={operator} />;\r\n }, [operator, ruleOperatorRenderer, onRuleOperatorChange]);\r\n\r\n const valueRenderer = React.useCallback((prop: PropertyDescription) => {\r\n if (ruleValueRenderer)\r\n return ruleValueRenderer({ property: prop, value, onChange: onRuleValueChange });\r\n return <PropertyFilterBuilderRuleValue property={prop} onChange={onRuleValueChange} value={value} />;\r\n }, [value, ruleValueRenderer, onRuleValueChange]);\r\n\r\n return <div className=\"rule\">\r\n <div className=\"rule-remove-action\">\r\n <IconButton onClick={removeRule} styleType=\"borderless\" size=\"small\">\r\n <SvgDelete />\r\n </IconButton>\r\n </div>\r\n <div className=\"rule-condition\">\r\n <PropertyFilterBuilderRuleProperty\r\n properties={properties}\r\n selectedProperty={rule.property}\r\n onSelectedPropertyChanged={onSelectedPropertyChanged}\r\n propertyRenderer={propertyRenderer}\r\n isDisabled={isDisabled}\r\n />\r\n {\r\n property !== undefined\r\n ? operatorRenderer(property)\r\n : null\r\n }\r\n {\r\n property !== undefined && operator !== undefined && !isUnaryPropertyFilterOperator(operator)\r\n ? valueRenderer(property)\r\n : null\r\n }\r\n </div>\r\n </div>;\r\n}\r\n"]}
|