@itwin/components-react 4.9.0-dev.1 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts +2 -3
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/cjs/components-react/common/DelayedSpinner.js +1 -1
- package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.d.ts +2 -2
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.scss +5 -2
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.d.ts +2 -2
- package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.js +4 -8
- package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.scss +6 -3
- package/lib/cjs/components-react/editors/BooleanEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.js +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.scss +5 -3
- package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.js +1 -8
- package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.scss +6 -4
- package/lib/cjs/components-react/editors/IconEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.js +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.scss +5 -3
- package/lib/cjs/components-react/editors/PopupButton.d.ts +2 -2
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.js +2 -5
- package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.scss +5 -3
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts +0 -1
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.js +3 -4
- package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.d.ts +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.scss +8 -2
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +2 -2
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +7 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +3 -7
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +0 -36
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +1 -73
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts +24 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js +30 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.d.ts +31 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js +76 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +4 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +15 -9
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +37 -22
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +10 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +15 -40
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +25 -59
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +11 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +43 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +4 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +40 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +10 -11
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +151 -44
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts +20 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +30 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +24 -19
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +40 -64
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.d.ts +2 -2
- package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.d.ts +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.d.ts +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.scss +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.scss +4 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/ActionButtonList.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts +2 -2
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/ArrayValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/table/StructValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -4
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.scss +17 -0
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +5 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -2
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ItemWrapper.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts +2 -2
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Column.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Columns.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Panel.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Title.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts +12 -0
- package/lib/cjs/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js +22 -1
- package/lib/cjs/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +2 -2
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeEditor.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts +1 -1
- package/lib/cjs/components-react.d.ts +3 -0
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +3 -0
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.d.ts +2 -3
- package/lib/esm/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.js +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.d.ts +2 -2
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.d.ts +2 -2
- package/lib/esm/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.scss +5 -2
- package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -2
- package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.d.ts +2 -2
- package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.js +4 -5
- package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.scss +6 -3
- package/lib/esm/components-react/editors/BooleanEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.js +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.scss +5 -3
- package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.js +1 -8
- package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.scss +6 -4
- package/lib/esm/components-react/editors/IconEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.js +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.scss +5 -3
- package/lib/esm/components-react/editors/PopupButton.d.ts +2 -2
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.js +2 -5
- package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.js +1 -1
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.scss +5 -3
- package/lib/esm/components-react/editors/TextareaEditor.d.ts +0 -1
- package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.js +3 -4
- package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.d.ts +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.scss +8 -2
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +2 -2
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +7 -3
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +4 -8
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +0 -36
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +0 -71
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts +24 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js +23 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.d.ts +31 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js +73 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +4 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +19 -13
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +37 -22
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +10 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +17 -42
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +25 -59
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +11 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +41 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +4 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +39 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +10 -11
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +149 -42
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts +20 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +23 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts +24 -19
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +37 -61
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.d.ts +2 -2
- package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.d.ts +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.d.ts +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.scss +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.scss +4 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/ActionButtonList.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/PrimitivePropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts +2 -2
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/ArrayValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/table/StructValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -4
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.scss +17 -0
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +5 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -2
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts +2 -2
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ItemWrapper.d.ts +1 -1
- package/lib/esm/components-react/toolbar/ItemWrapper.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Items.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Overflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.d.ts +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts +2 -2
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Column.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Column.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Columns.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Columns.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Panel.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Panel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Title.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/Title.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts +12 -0
- package/lib/esm/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.js +21 -1
- package/lib/esm/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +2 -2
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeEditor.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts +1 -1
- package/lib/esm/components-react.d.ts +3 -0
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +3 -0
- package/lib/esm/components-react.js.map +1 -1
- package/lib/public/locales/en/UiComponents.json +12 -7
- package/package.json +10 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AACpD,wDAA6C;AAC7C,6EAA0E;AAE1E,kDAA+C;AAc/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAA8B;YAC1D,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,KAAK;SAChB,CAAC;QA0BM,sBAAiB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACrE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU;gBACjB,IAAI,CAAC,QAAQ,CACX;oBACE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;iBAC3B,EACD,KAAK,IAAI,EAAE;oBACT,IACE,IAAI,CAAC,KAAK,CAAC,oBAAoB;wBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ;wBACnB,IAAI,CAAC,KAAK,CAAC,cAAc,EACzB;wBACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;wBAC/C,uBAAuB;wBACvB,IAAI,QAAQ;4BACV,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;gCAClB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc;gCACzC,QAAQ;6BACT,CAAC,CAAC;qBACN;gBACH,CAAC,CACF,CAAC;QACN,CAAC,CA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AAI,CAAC,KAAK,CAAC,MAAM;YACzB,QAAQ,EAAE,IAAI,CAAC,iBAAiB;YAChC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;SACzD,CAAC;QAEF,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAE3C,IAAI,SAA0B,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG,CACV,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,wBAAwB,GACpC,CACH,CAAC;SACH;aAAM;YACL,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n autoFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6BAA2B;AAC3B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAG+B;AAC/B,kDAAoD;AAEpD,wDAA6C;AAC7C,6EAA0E;AAE1E,kDAA+C;AAY/C;;GAEG;AACH,MAAa,UACX,SAAQ,KAAK,CAAC,aAAmD;IADnE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACnD,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAA8B;YAC1D,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,KAAK;SAChB,CAAC;QA0BM,sBAAiB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACrE,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU;gBACjB,IAAI,CAAC,QAAQ,CACX;oBACE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;iBAC3B,EACD,KAAK,IAAI,EAAE;oBACT,IACE,IAAI,CAAC,KAAK,CAAC,oBAAoB;wBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ;wBACnB,IAAI,CAAC,KA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C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa;YAC1D,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;YAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;YAC/B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;YAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,QAAQ,EAAE,IAAI,CAAC,iBAAiB;YAChC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;SACxD,CAAC;QAEF,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAE3C,IAAI,SAA0B,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG,CACV,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,wBAAwB,GACpC,CACH,CAAC;SACH;aAAM;YACL,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,wBAAwB,EACpC,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA9LD,gCA8LC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./TextEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport type { InputProps } from \"@itwin/itwinui-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** TextEditor React component that is a property editor with text input\n * @public\n */\nexport class TextEditor\n extends React.PureComponent<PropertyEditorProps, TextEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.text\");\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextEditorState> = {\n inputValue: \"\",\n readonly: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState(\n {\n inputValue: e.target.value,\n },\n async () => {\n if (\n this.props.shouldCommitOnChange &&\n this.props.onCommit &&\n this.props.propertyRecord\n ) {\n const newValue = await this.getPropertyValue();\n // istanbul ignore else\n if (newValue)\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue,\n });\n }\n }\n );\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const iconParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Icon\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n iconSpec,\n });\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-text-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const inputProps: InputProps = {\n type: \"text\",\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onBlur: this.props.onBlur,\n onChange: this._updateInputValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n inputProps[\"aria-label\"] = this._ariaLabel;\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-text-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-text-editor\"\n size=\"small\"\n />\n );\n }\n\n return reactNode;\n }\n}\n"]}
|
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
.components-smallEditor-host {
|
|
14
14
|
.components-text-editor {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
&.iui-input {
|
|
16
|
+
min-height: $editor-component-height-small !important;
|
|
17
|
+
padding-top: 1px !important;
|
|
18
|
+
padding-bottom: 1px !important;
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -22,7 +22,6 @@ export declare class TextareaEditor extends React.PureComponent<PropertyEditorPr
|
|
|
22
22
|
private _isMounted;
|
|
23
23
|
private _ariaLabel;
|
|
24
24
|
private _divElement;
|
|
25
|
-
private _textAreaElement;
|
|
26
25
|
/** @internal */
|
|
27
26
|
readonly state: Readonly<TextareaEditorState>;
|
|
28
27
|
getPropertyValue(): Promise<PropertyValue | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextareaEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAIjC,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAID;;GAEG;AACH,qBAAa,cACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,mBAAmB,CACpE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAA6C;IAC/D,OAAO,CAAC,WAAW,CAAqC;IAExD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAI3D;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAgBnE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAGD,IAAW,QAAQ,IAAI,OAAO,CAM7B;IAED,OAAO,CAAC,oBAAoB,CAQ1B;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA0D/B,OAAO,CAAC,SAAS,CAYf;IAEF,OAAO,CAAC,aAAa,CAKnB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA+C1C;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAE5D,IAAoB,oBAAoB,IAAI,OAAO,CAElD;IAED,IAAoB,qBAAqB,IAAI,OAAO,CAEnD;IAED,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;IAED,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
|
|
@@ -53,7 +53,6 @@ class TextareaEditor extends React.PureComponent {
|
|
|
53
53
|
this._isMounted = false;
|
|
54
54
|
this._ariaLabel = UiComponents_1.UiComponents.translate("editor.textarea");
|
|
55
55
|
this._divElement = React.createRef();
|
|
56
|
-
this._textAreaElement = React.createRef();
|
|
57
56
|
/** @internal */
|
|
58
57
|
this.state = {
|
|
59
58
|
inputValue: "",
|
|
@@ -183,13 +182,13 @@ class TextareaEditor extends React.PureComponent {
|
|
|
183
182
|
maxLength: this.state.maxLength,
|
|
184
183
|
value: this.state.inputValue,
|
|
185
184
|
onChange: this._updateTextareaValue,
|
|
186
|
-
|
|
185
|
+
setFocus: this.props.setFocus && !this.state.isDisabled,
|
|
187
186
|
};
|
|
188
187
|
textareaProps["aria-label"] = this._ariaLabel;
|
|
189
188
|
return (React.createElement("div", { className: className, ref: this._divElement },
|
|
190
|
-
React.createElement(PopupButton_1.PopupButton, { label: this.state.inputValue, closeOnEnter: false, setFocus: this.props.setFocus, focusTarget:
|
|
189
|
+
React.createElement(PopupButton_1.PopupButton, { label: this.state.inputValue, closeOnEnter: false, setFocus: this.props.setFocus, focusTarget: ".iui-input" },
|
|
191
190
|
React.createElement(PopupButton_1.PopupContent, null,
|
|
192
|
-
React.createElement(itwinui_react_1.Textarea, { ...textareaProps, "data-testid": "components-textarea-editor"
|
|
191
|
+
React.createElement(itwinui_react_1.Textarea, { ...textareaProps, "data-testid": "components-textarea-editor" }),
|
|
193
192
|
React.createElement(PopupButton_1.PopupOkCancelButtons, { onOk: this._handleOk, onCancel: this._handleCancel })))));
|
|
194
193
|
}
|
|
195
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAQ/B,0DAK+B;AAC/B,wDAAgD;AAChD,6EAA0E;AAE1E,mEAGiC;AACjC,+CAAgF;AAChF,kDAA+C;AAc/C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAa,cACX,SAAQ,KAAK,CAAC,aAAuD;IADvE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAChD,qBAAgB,GAAG,KAAK,CAAC,SAAS,EAAuB,CAAC;QAElE,gBAAgB;QACS,UAAK,GAAkC;YAC9D,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,YAAY;SACnB,CAAC;QA+BM,yBAAoB,GAAG,CAC7B,CAAyC,EACzC,EAAE;YACF,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU;gBACjB,IAAI,CAAC,QAAQ,CAAC;oBACZ,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;iBAC3B,CAAC,CAAC;QACP,CAAC,CAAC;QA8EM,cAAS,GAAG,KAAK,EAAE,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S,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAzMD,wCAyMC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,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;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,OAAG,CAAC;IAC5B,CAAC;CACF;AAjBD,wDAiBC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,IAAI,EACtB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./TextareaEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n MultilineTextEditorParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport { Textarea } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport { UiComponents } from \"../UiComponents\";\n\ntype TextareaProps = React.ComponentPropsWithoutRef<typeof Textarea>;\n\n/** @internal */\ninterface TextareaEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n rows: number;\n}\n\nconst DEFAULT_ROWS = 3;\n\n/** TextareaEditor React component that is a property editor with text input\n * @public\n */\nexport class TextareaEditor\n extends React.PureComponent<PropertyEditorProps, TextareaEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.textarea\");\n private _divElement = React.createRef<HTMLDivElement>();\n private _textAreaElement = React.createRef<HTMLTextAreaElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextareaEditorState> = {\n inputValue: \"\",\n readonly: false,\n rows: DEFAULT_ROWS,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateTextareaValue = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: e.target.value,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let rows: number = DEFAULT_ROWS;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const multilineParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.MultilineText\n ) as MultilineTextEditorParams;\n if (multilineParams) {\n rows = multilineParams.rows;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n rows,\n });\n }\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-textarea-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n const textareaProps: TextareaProps = {\n className: \"components-textarea-editor-textarea\",\n style,\n rows: this.state.rows,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateTextareaValue,\n autoFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n textareaProps[\"aria-label\"] = this._ariaLabel;\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.inputValue}\n closeOnEnter={false}\n setFocus={this.props.setFocus}\n focusTarget={this._textAreaElement}\n >\n <PopupContent>\n <Textarea\n {...textareaProps}\n data-testid=\"components-textarea-editor\"\n ref={this._textAreaElement}\n />\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Textarea Property Editor registered for the \"text\" and \"string\" type names and \"multi-line\" editor name.\n * It uses the [[TextareaEditor]] React component.\n * @public\n */\nexport class TextareaPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <TextareaEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\n"]}
|
|
1
|
+
{"version":3,"file":"TextareaEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/TextareaEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AA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AI,EACtB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,sBAAsB,EACtB,oCAAmB,CAAC,SAAS,CAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./TextareaEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n MultilineTextEditorParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { TextareaProps } from \"@itwin/itwinui-react\";\nimport { Textarea } from \"@itwin/itwinui-react\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport { UiComponents } from \"../UiComponents\";\n\n/** @internal */\ninterface TextareaEditorState {\n inputValue: string;\n readonly: boolean;\n isDisabled?: boolean;\n size?: number;\n maxLength?: number;\n rows: number;\n}\n\nconst DEFAULT_ROWS = 3;\n\n/** TextareaEditor React component that is a property editor with text input\n * @public\n */\nexport class TextareaEditor\n extends React.PureComponent<PropertyEditorProps, TextareaEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _ariaLabel = UiComponents.translate(\"editor.textarea\");\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<TextareaEditorState> = {\n inputValue: \"\",\n readonly: false,\n rows: DEFAULT_ROWS,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertFromStringToPropertyValue(this.state.inputValue, record);\n (propertyValue as PrimitiveValue).displayValue = this.state.inputValue;\n }\n\n return propertyValue;\n }\n\n // istanbul ignore next\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n // istanbul ignore next\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n private _updateTextareaValue = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ) => {\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: e.target.value,\n });\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = \"\";\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const value = record.value.value;\n initialValue = await TypeConverterManager.getConverter(\n record.property.typename\n ).convertPropertyToString(record.property, value);\n }\n\n const readonly =\n record && undefined !== record.isReadonly ? record.isReadonly : false;\n let size: number | undefined;\n let maxLength: number | undefined;\n let rows: number = DEFAULT_ROWS;\n\n const isDisabled = record ? record.isDisabled : undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n // istanbul ignore else\n if (editorSizeParams.size) size = editorSizeParams.size;\n // istanbul ignore else\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const multilineParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.MultilineText\n ) as MultilineTextEditorParams;\n if (multilineParams) {\n rows = multilineParams.rows;\n }\n }\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: initialValue,\n readonly,\n size,\n maxLength,\n isDisabled,\n rows,\n });\n }\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n // istanbul ignore else\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-textarea-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n };\n const textareaProps: TextareaProps = {\n className: \"components-textarea-editor-textarea\",\n style,\n rows: this.state.rows,\n readOnly: this.state.readonly,\n disabled: this.state.isDisabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateTextareaValue,\n setFocus: this.props.setFocus && !this.state.isDisabled,\n };\n\n textareaProps[\"aria-label\"] = this._ariaLabel;\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.inputValue}\n closeOnEnter={false}\n setFocus={this.props.setFocus}\n focusTarget=\".iui-input\"\n >\n <PopupContent>\n <Textarea\n {...textareaProps}\n data-testid=\"components-textarea-editor\"\n />\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Textarea Property Editor registered for the \"text\" and \"string\" type names and \"multi-line\" editor name.\n * It uses the [[TextareaEditor]] React component.\n * @public\n */\nexport class TextareaPropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesEnter(): boolean {\n return false;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <TextareaEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Text,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.String,\n TextareaPropertyEditor,\n StandardEditorNames.MultiLine\n);\n"]}
|
|
@@ -31,7 +31,7 @@ export declare class ToggleEditor extends React.PureComponent<PropertyEditorProp
|
|
|
31
31
|
componentDidUpdate(prevProps: PropertyEditorProps): void;
|
|
32
32
|
private setStateFromProps;
|
|
33
33
|
/** @internal */
|
|
34
|
-
render(): JSX.Element;
|
|
34
|
+
render(): React.JSX.Element;
|
|
35
35
|
}
|
|
36
36
|
/** Toggle Property Editor registered for the "bool" and "boolean" type names and "toggle" editor name.
|
|
37
37
|
* It uses the [[ToggleEditor]] React component.
|
|
@@ -134,7 +134,7 @@ class ToggleEditor extends React.PureComponent {
|
|
|
134
134
|
const className = (0, classnames_1.default)("components-cell-editor", "components-toggle-editor", this.props.className);
|
|
135
135
|
const isChecked = this.state.toggleValue;
|
|
136
136
|
const isDisabled = !!this.state.isDisabled;
|
|
137
|
-
return (React.createElement(itwinui_react_1.ToggleSwitch, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: isChecked, disabled: isDisabled, onChange: this._updateToggleValue, "data-testid": "components-toggle-editor",
|
|
137
|
+
return (React.createElement(itwinui_react_1.ToggleSwitch, { ref: this._inputElement, onBlur: this.props.onBlur, className: className, style: this.props.style, checked: isChecked, disabled: isDisabled, onChange: this._updateToggleValue, "data-testid": "components-toggle-editor", setFocus: this.props.setFocus }));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
exports.ToggleEditor = ToggleEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ToggleEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA6B;AAC7B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAI+B;AAE/B,mEAGiC;AACjC,wDAAoD;AAQpD;;GAEG;AACH,MAAa,YACX,SAAQ,KAAK,CAAC,aAAqD;IADrE;;QAIU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAE5D,gBAAgB;QACS,UAAK,GAAgC;YAC5D,WAAW,EAAE,KAAK;YAClB,UAAU,EAAE,KAAK;SAClB,CAAC;QAyBM,uBAAkB,GAAG,CAC3B,CAAsC,EACjC,EAAE;YACP,uBAAuB;YACvB,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,uBAAuB;gBACvB,IAAI,IAAI,CAAC,UAAU,EAAE;oBACnB,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;oBAEvC,IAAI,CAAC,QAAQ,CACX;wBACE,WAAW;qBACZ,EACD,KAAK,IAAI,EAAE;wBACT,uBAAuB;wBACvB,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;4BACpD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;4BACpD,uBAAuB;4BACvB,IAAI,aAAa,KAAK,SAAS,EAAE;gCAC/B,IAAI,CAA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AAG,IAAI,CAAC,KAAK,CAAC;QACtC,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,uBAAuB;QACvB,IACE,cAAc;YACd,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,EAClE;YACA,MAAM,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC;YAClD,WAAW,GAAG,cAAyB,CAAC;SACzC;QAED,uBAAuB;QACvB,IAAI,cAAc,IAAI,cAAc,CAAC,UAAU;YAC7C,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;QAEzC,uBAAuB;QACvB,IAAI,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,SAAS,GAAG,IAAA,oBAAU,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,CAAC;QACF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAE3C,OAAO,CACL,oBAAC,4BAAY,IACX,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,IAAI,CAAC,kBAAkB,iBACrB,0BAA0B,EACtC,
|
|
1
|
+
{"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/ToggleEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;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CAAmB,CAAC,MAAM,CAC3B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./ToggleEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface ToggleEditorState {\n toggleValue: boolean;\n isDisabled?: boolean;\n}\n\n/** ToggleEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class ToggleEditor\n extends React.PureComponent<PropertyEditorProps, ToggleEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<ToggleEditorState> = {\n toggleValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.toggleValue,\n displayValue: \"\",\n };\n }\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateToggleValue = (\n e: React.ChangeEvent<HTMLInputElement>\n ): any => {\n // istanbul ignore else\n if (this._isMounted) {\n // istanbul ignore else\n if (this._isMounted) {\n const toggleValue = !!e.target.checked;\n\n this.setState(\n {\n toggleValue,\n },\n async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n }\n );\n }\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let toggleValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (\n propertyRecord &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n toggleValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted) this.setState({ toggleValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\n \"components-cell-editor\",\n \"components-toggle-editor\",\n this.props.className\n );\n const isChecked = this.state.toggleValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <ToggleSwitch\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={isChecked}\n disabled={isDisabled}\n onChange={this._updateToggleValue}\n data-testid=\"components-toggle-editor\"\n setFocus={this.props.setFocus}\n />\n );\n }\n}\n\n/** Toggle Property Editor registered for the \"bool\" and \"boolean\" type names and \"toggle\" editor name.\n * It uses the [[ToggleEditor]] React component.\n * @public\n */\nexport class TogglePropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <ToggleEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Bool,\n TogglePropertyEditor,\n StandardEditorNames.Toggle\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Boolean,\n TogglePropertyEditor,\n StandardEditorNames.Toggle\n);\n"]}
|
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
.components-property-list--horizontal {
|
|
6
6
|
.components-toggle-editor {
|
|
7
7
|
margin-left: var(--iui-size-2xs); // Clear the resizer in the PropertyGrid
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
&.iui-toggle-switch {
|
|
10
|
+
padding: 1px 0;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
.components-property-list--vertical {
|
|
13
16
|
.components-toggle-editor {
|
|
14
17
|
margin-left: var(--iui-size-3xs);
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
&.iui-toggle-switch {
|
|
20
|
+
padding: 1px 0;
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Favorite
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
import * as React from "react";
|
|
5
5
|
import { Orientation } from "@itwin/core-react";
|
|
6
6
|
import { PropertyValueRendererManager } from "../properties/ValueRendererManager";
|
|
7
7
|
import type { PropertyData } from "../propertygrid/PropertyDataProvider";
|
|
@@ -16,5 +16,5 @@ export interface FavoritePropertyListProps {
|
|
|
16
16
|
/** Favorite Property List React component
|
|
17
17
|
* @alpha
|
|
18
18
|
*/
|
|
19
|
-
export declare function FavoritePropertyList(props: FavoritePropertyListProps): JSX.Element | null;
|
|
19
|
+
export declare function FavoritePropertyList(props: FavoritePropertyListProps): React.JSX.Element | null;
|
|
20
20
|
//# sourceMappingURL=FavoritePropertyList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG
|
|
1
|
+
{"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,4BAwBpE"}
|
|
@@ -19,7 +19,7 @@ export interface PropertyFilterBuilderProps extends Omit<PropertyFilterBuilderRe
|
|
|
19
19
|
* Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.
|
|
20
20
|
* @beta
|
|
21
21
|
*/
|
|
22
|
-
export declare function PropertyFilterBuilder(props: PropertyFilterBuilderProps): JSX.Element;
|
|
22
|
+
export declare function PropertyFilterBuilder(props: PropertyFilterBuilderProps): React.JSX.Element;
|
|
23
23
|
/**
|
|
24
24
|
* Props for [[PropertyFilterBuilderRenderer]] component.
|
|
25
25
|
* @beta
|
|
@@ -39,14 +39,18 @@ export interface PropertyFilterBuilderRendererProps {
|
|
|
39
39
|
ruleValueRenderer?: (props: PropertyFilterBuilderRuleValueRendererProps) => React.ReactNode;
|
|
40
40
|
/** Custom renderer for property selector in rule. */
|
|
41
41
|
propertyRenderer?: (name: string) => React.ReactNode;
|
|
42
|
-
/** Specifies how deep rule groups can be nested.
|
|
42
|
+
/** Specifies how deep rule groups can be nested.
|
|
43
|
+
* @deprecated in 4.9.0. Nesting is no longer supported moving forward.
|
|
44
|
+
*/
|
|
43
45
|
ruleGroupDepthLimit?: number;
|
|
44
46
|
/** Specifies whether component is disabled or not. */
|
|
45
47
|
isDisabled?: boolean;
|
|
48
|
+
/** Controls whether the group operator is toggle-able. */
|
|
49
|
+
isGroupOperatorDisabled?: boolean;
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* Renderer for [[PropertyFilterBuilder]] component.
|
|
49
53
|
* @beta
|
|
50
54
|
*/
|
|
51
|
-
export declare function PropertyFilterBuilderRenderer(props: PropertyFilterBuilderRendererProps): JSX.Element;
|
|
55
|
+
export declare function PropertyFilterBuilderRenderer(props: PropertyFilterBuilderRendererProps): React.JSX.Element;
|
|
52
56
|
//# 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;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
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,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAUjE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,0BAA0B,CAAC;AAK5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EACV,4BAA4B,EAC5B,8BAA8B,EAC9B,6B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
63
|
-
const { rootGroup, actions, properties, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer,
|
|
64
|
-
const rootRef = React.useRef(null);
|
|
63
|
+
const { rootGroup, actions, properties, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled, isGroupOperatorDisabled, } = props;
|
|
65
64
|
const contextValue = React.useMemo(() => ({
|
|
66
65
|
actions,
|
|
67
66
|
properties,
|
|
68
67
|
onRulePropertySelected,
|
|
69
|
-
|
|
70
|
-
}), [actions, properties, onRulePropertySelected, ruleGroupDepthLimit]);
|
|
68
|
+
}), [actions, properties, onRulePropertySelected]);
|
|
71
69
|
const renderingContextValue = React.useMemo(() => ({
|
|
72
70
|
ruleOperatorRenderer,
|
|
73
71
|
ruleValueRenderer,
|
|
@@ -76,9 +74,7 @@ function PropertyFilterBuilderRenderer(props) {
|
|
|
76
74
|
}), [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]);
|
|
77
75
|
return (React.createElement(FilterBuilderContext_1.PropertyFilterBuilderRuleRenderingContext.Provider, { value: renderingContextValue },
|
|
78
76
|
React.createElement(FilterBuilderContext_1.PropertyFilterBuilderContext.Provider, { value: contextValue },
|
|
79
|
-
React.createElement(
|
|
80
|
-
React.createElement("div", { ref: rootRef, className: "filter-builder" },
|
|
81
|
-
React.createElement(FilterBuilderRuleGroup_1.PropertyFilterBuilderRuleGroupRenderer, { path: ROOT_GROUP_PATH, group: rootGroup }))))));
|
|
77
|
+
React.createElement(FilterBuilderRuleGroup_1.PropertyFilterBuilderRuleGroupRenderer, { path: ROOT_GROUP_PATH, group: rootGroup, isGroupOperatorDisabled: isGroupOperatorDisabled }))));
|
|
82
78
|
}
|
|
83
79
|
exports.PropertyFilterBuilderRenderer = PropertyFilterBuilderRenderer;
|
|
84
80
|
//# sourceMappingURL=FilterBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAM/B,
|
|
1
|
+
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAM/B,iEAGgC;AAChC,qEAAkF;AAGlF,6DAG8B;AAmB9B;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAA,6CAAwB,EAAC;QACtD,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAC1B,GAAG,EAAE,CAAC,IAAA,wCAAmB,EAAC,SAAS,CAAC,EACpC,CAAC,SAAS,CAAC,CACZ,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAClD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,6BAA6B,OACxB,KAAK,EACT,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;AACJ,CAAC;AAvBD,sDAuBC;AAmCD,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC;;;GAGG;AACH,SAAgB,6BAA6B,CAC3C,KAAyC;IAEzC,MAAM,EACJ,SAAS,EACT,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,uBAAuB,GACxB,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU;QACV,sBAAsB;KACvB,CAAC,EACF,CAAC,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAC9C,CAAC;IACF,MAAM,qBAAqB,GACzB,KAAK,CAAC,OAAO,CACX,GAAG,EAAE,CAAC,CAAC;QACL,oBAAoB;QACpB,iBAAiB;QACjB,gBAAgB;QAChB,UAAU;KACX,CAAC,EACF,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,CAAC,CACxE,CAAC;IACJ,OAAO,CACL,oBAAC,gEAAyC,CAAC,QAAQ,IACjD,KAAK,EAAE,qBAAqB;QAE5B,oBAAC,mDAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;YACxD,oBAAC,+DAAsC,IACrC,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,SAAS,EAChB,uBAAuB,EAAE,uBAAuB,GAChD,CACoC,CACW,CACtD,CAAC;AACJ,CAAC;AA9CD,sEA8CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type {\n PropertyFilterBuilderContextProps,\n PropertyFilterBuilderRuleRenderingContextProps,\n} from \"./FilterBuilderContext\";\nimport {\n PropertyFilterBuilderContext,\n PropertyFilterBuilderRuleRenderingContext,\n} from \"./FilterBuilderContext\";\nimport { PropertyFilterBuilderRuleGroupRenderer } from \"./FilterBuilderRuleGroup\";\nimport type { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\nimport type { PropertyFilterBuilderRuleValueRendererProps } from \"./FilterBuilderRuleValue\";\nimport {\n buildPropertyFilter,\n usePropertyFilterBuilder,\n} from \"./FilterBuilderState\";\nimport type { PropertyFilter } from \"./Types\";\nimport type {\n PropertyFilterBuilderActions,\n PropertyFilterBuilderRuleGroup,\n UsePropertyFilterBuilderProps,\n} from \"./FilterBuilderState\";\n\n/**\n * Props for [[PropertyFilterBuilder]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderProps\n extends Omit<PropertyFilterBuilderRendererProps, \"actions\" | \"rootGroup\">,\n UsePropertyFilterBuilderProps {\n /** Callback that is invoked when filter changes. */\n onFilterChanged: (filter?: PropertyFilter) => void;\n}\n\n/**\n * Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.\n * @beta\n */\nexport function PropertyFilterBuilder(props: PropertyFilterBuilderProps) {\n const { initialFilter, onFilterChanged } = props;\n const { actions, rootGroup } = usePropertyFilterBuilder({\n initialFilter,\n });\n\n const firstRender = React.useRef(true);\n const filter = React.useMemo(\n () => buildPropertyFilter(rootGroup),\n [rootGroup]\n );\n React.useEffect(() => {\n if (!firstRender.current) onFilterChanged(filter);\n firstRender.current = false;\n }, [filter, onFilterChanged]);\n\n return (\n <PropertyFilterBuilderRenderer\n {...props}\n actions={actions}\n rootGroup={rootGroup}\n />\n );\n}\n\n/**\n * Props for [[PropertyFilterBuilderRenderer]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderRendererProps {\n /** Root group of rules in [[PropertyFilterBuilder]] component. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n /** Actions for modifying [[PropertyFilterBuilder]] state. */\n actions: PropertyFilterBuilderActions;\n /** List of properties available to be used in filter rules. */\n properties: PropertyDescription[];\n /** Callback that is invoked when property is selected in any rule. */\n onRulePropertySelected?: (property: PropertyDescription) => void;\n /** Custom renderer for rule operator selector. */\n ruleOperatorRenderer?: (\n props: PropertyFilterBuilderRuleOperatorProps\n ) => React.ReactNode;\n /** Custom renderer for rule value input. */\n ruleValueRenderer?: (\n props: PropertyFilterBuilderRuleValueRendererProps\n ) => React.ReactNode;\n /** Custom renderer for property selector in rule. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies how deep rule groups can be nested.\n * @deprecated in 4.9.0. Nesting is no longer supported moving forward.\n */\n ruleGroupDepthLimit?: number;\n /** Specifies whether component is disabled or not. */\n isDisabled?: boolean;\n /** Controls whether the group operator is toggle-able. */\n isGroupOperatorDisabled?: boolean;\n}\n\nconst ROOT_GROUP_PATH: string[] = [];\n\n/**\n * Renderer for [[PropertyFilterBuilder]] component.\n * @beta\n */\nexport function PropertyFilterBuilderRenderer(\n props: PropertyFilterBuilderRendererProps\n) {\n const {\n rootGroup,\n actions,\n properties,\n onRulePropertySelected,\n ruleOperatorRenderer,\n ruleValueRenderer,\n propertyRenderer,\n isDisabled,\n isGroupOperatorDisabled,\n } = props;\n\n const contextValue = React.useMemo<PropertyFilterBuilderContextProps>(\n () => ({\n actions,\n properties,\n onRulePropertySelected,\n }),\n [actions, properties, onRulePropertySelected]\n );\n const renderingContextValue =\n React.useMemo<PropertyFilterBuilderRuleRenderingContextProps>(\n () => ({\n ruleOperatorRenderer,\n ruleValueRenderer,\n propertyRenderer,\n isDisabled,\n }),\n [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]\n );\n return (\n <PropertyFilterBuilderRuleRenderingContext.Provider\n value={renderingContextValue}\n >\n <PropertyFilterBuilderContext.Provider value={contextValue}>\n <PropertyFilterBuilderRuleGroupRenderer\n path={ROOT_GROUP_PATH}\n group={rootGroup}\n isGroupOperatorDisabled={isGroupOperatorDisabled}\n />\n </PropertyFilterBuilderContext.Provider>\n </PropertyFilterBuilderRuleRenderingContext.Provider>\n );\n}\n"]}
|
|
@@ -44,40 +44,4 @@ export interface PropertyFilterBuilderRuleRenderingContextProps {
|
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
46
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 focused rule group. */
|
|
53
|
-
focusedElement: HTMLElement | undefined;
|
|
54
|
-
/** Element of currently hovered rule group. */
|
|
55
|
-
hoveredElement: HTMLElement | undefined;
|
|
56
|
-
/** Even handler for rule group element 'onFocus' event */
|
|
57
|
-
onFocus: React.FocusEventHandler<HTMLElement>;
|
|
58
|
-
/** Even handler for rule group element 'onBlur' event */
|
|
59
|
-
onBlur: React.FocusEventHandler<HTMLElement>;
|
|
60
|
-
/** Even handler for rule group element 'onMouseOver' event */
|
|
61
|
-
onMouseOver: React.MouseEventHandler<HTMLElement>;
|
|
62
|
-
/** Even handler for rule group element 'onMouseOut' event */
|
|
63
|
-
onMouseOut: React.MouseEventHandler<HTMLElement>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Context for tracking and storing active rule group in [[PropertyFilterBuilder]].
|
|
67
|
-
* Group is considered active if it is focused or hovered.
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
export declare const ActiveRuleGroupContext: React.Context<ActiveRuleGroupContextProps>;
|
|
71
|
-
/**
|
|
72
|
-
* Custom hook that created value for [[ActiveRuleGroupContext]].
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
export declare function useActiveRuleGroupContextProps(rootElementRef: React.RefObject<HTMLElement>): {
|
|
76
|
-
focusedElement: HTMLElement | undefined;
|
|
77
|
-
hoveredElement: HTMLElement | undefined;
|
|
78
|
-
onFocus: React.FocusEventHandler<HTMLElement>;
|
|
79
|
-
onBlur: React.FocusEventHandler<HTMLElement>;
|
|
80
|
-
onMouseOver: React.MouseEventHandler<HTMLElement>;
|
|
81
|
-
onMouseOut: React.MouseEventHandler<HTMLElement>;
|
|
82
|
-
};
|
|
83
47
|
//# sourceMappingURL=FilterBuilderContext.d.ts.map
|
|
@@ -1 +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,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,0BAA0B,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,iCAAiC;IAChD,6DAA6D;IAC7D,OAAO,EAAE,4BAA4B,CAAC;IACtC,oCAAoC;IACpC,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,gEAAgE;IAChE,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,kDACsB,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,8CAA8C;IAC7D,qDAAqD;IACrD,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,sCAAsC,KAC1C,KAAK,CAAC,SAAS,CAAC;IACrB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,2CAA2C,KAC/C,KAAK,CAAC,SAAS,CAAC;IACrB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,yCAAyC,+DACmB,CAAC
|
|
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,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,0BAA0B,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,iCAAiC;IAChD,6DAA6D;IAC7D,OAAO,EAAE,4BAA4B,CAAC;IACtC,oCAAoC;IACpC,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,gEAAgE;IAChE,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,oDAAoD;IACpD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,kDACsB,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,8CAA8C;IAC7D,qDAAqD;IACrD,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,sCAAsC,KAC1C,KAAK,CAAC,SAAS,CAAC;IACrB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,2CAA2C,KAC/C,KAAK,CAAC,SAAS,CAAC;IACrB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,yCAAyC,+DACmB,CAAC"}
|
|
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
33
|
+
exports.PropertyFilterBuilderRuleRenderingContext = exports.PropertyFilterBuilderContext = void 0;
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
35
|
/**
|
|
36
36
|
* Context used to store data for rules and rule groups rendered inside [[PropertyFilterBuilder]] component.
|
|
@@ -42,76 +42,4 @@ exports.PropertyFilterBuilderContext = React.createContext(null);
|
|
|
42
42
|
* @internal
|
|
43
43
|
*/
|
|
44
44
|
exports.PropertyFilterBuilderRuleRenderingContext = React.createContext({});
|
|
45
|
-
/**
|
|
46
|
-
* Context for tracking and storing active rule group in [[PropertyFilterBuilder]].
|
|
47
|
-
* Group is considered active if it is focused or hovered.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
exports.ActiveRuleGroupContext = React.createContext(null);
|
|
51
|
-
/**
|
|
52
|
-
* Custom hook that created value for [[ActiveRuleGroupContext]].
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
function useActiveRuleGroupContextProps(rootElementRef) {
|
|
56
|
-
const [focusedElement, setFocusedElement] = React.useState();
|
|
57
|
-
const [hoveredElement, setHoveredElement] = React.useState();
|
|
58
|
-
// This is used to prevent handling onFocus, onBlur, onMouseOver, onMouseOut in the same event cycle.
|
|
59
|
-
const focusedTimeout = useSetTimeout();
|
|
60
|
-
const hoveredTimeout = useSetTimeout();
|
|
61
|
-
const onFocus = (e) => {
|
|
62
|
-
e.stopPropagation();
|
|
63
|
-
const target = e.currentTarget;
|
|
64
|
-
focusedTimeout(() => {
|
|
65
|
-
setFocusedElement(target);
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const onBlur = (e) => {
|
|
69
|
-
e.stopPropagation();
|
|
70
|
-
if (focusedElement !== e.currentTarget ||
|
|
71
|
-
(rootElementRef.current &&
|
|
72
|
-
rootElementRef.current.contains(e.relatedTarget)))
|
|
73
|
-
return;
|
|
74
|
-
focusedTimeout(() => {
|
|
75
|
-
setFocusedElement(undefined);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const onMouseOver = (e) => {
|
|
79
|
-
const target = e.currentTarget;
|
|
80
|
-
e.stopPropagation();
|
|
81
|
-
hoveredTimeout(() => {
|
|
82
|
-
setHoveredElement(target);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const onMouseOut = (e) => {
|
|
86
|
-
e.stopPropagation();
|
|
87
|
-
// istanbul ignore if
|
|
88
|
-
if (hoveredElement !== e.currentTarget)
|
|
89
|
-
return;
|
|
90
|
-
hoveredTimeout(() => {
|
|
91
|
-
setHoveredElement(undefined);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
return {
|
|
95
|
-
focusedElement,
|
|
96
|
-
hoveredElement,
|
|
97
|
-
onFocus,
|
|
98
|
-
onBlur,
|
|
99
|
-
onMouseOver,
|
|
100
|
-
onMouseOut,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
exports.useActiveRuleGroupContextProps = useActiveRuleGroupContextProps;
|
|
104
|
-
function useSetTimeout() {
|
|
105
|
-
const timeoutRef = React.useRef();
|
|
106
|
-
React.useEffect(() => {
|
|
107
|
-
// clear pending timeout on unmount
|
|
108
|
-
return () => {
|
|
109
|
-
window.clearTimeout(timeoutRef.current);
|
|
110
|
-
};
|
|
111
|
-
}, []);
|
|
112
|
-
return (callback) => {
|
|
113
|
-
window.clearTimeout(timeoutRef.current);
|
|
114
|
-
timeoutRef.current = window.setTimeout(callback);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
45
|
//# sourceMappingURL=FilterBuilderContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderContext.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderContext.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAqB/B;;;GAGG;AACU,QAAA,4BAA4B,GACvC,KAAK,CAAC,aAAa,CAAoC,IAAK,CAAC,CAAC;AAqBhE;;;GAGG;AACU,QAAA,yCAAyC,GACpD,KAAK,CAAC,aAAa,CAAiD,EAAE,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"FilterBuilderContext.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderContext.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAqB/B;;;GAGG;AACU,QAAA,4BAA4B,GACvC,KAAK,CAAC,aAAa,CAAoC,IAAK,CAAC,CAAC;AAqBhE;;;GAGG;AACU,QAAA,yCAAyC,GACpD,KAAK,CAAC,aAAa,CAAiD,EAAE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type { PropertyFilterBuilderActions } from \"./FilterBuilderState\";\nimport type { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\nimport type { PropertyFilterBuilderRuleValueRendererProps } from \"./FilterBuilderRuleValue\";\n\n/**\n * Data structure that describes [[PropertyFilterBuilderContext]] value.\n * @internal\n */\nexport interface PropertyFilterBuilderContextProps {\n /** Actions for modifying [[PropertyFilterBuilder]] state. */\n actions: PropertyFilterBuilderActions;\n /** List of available properties. */\n properties: PropertyDescription[];\n /** Callback to invoke when property is selected in any rule. */\n onRulePropertySelected?: (property: PropertyDescription) => void;\n /** Specifies how deep rule groups can be nested. */\n ruleGroupDepthLimit?: number;\n}\n\n/**\n * Context used to store data for rules and rule groups rendered inside [[PropertyFilterBuilder]] component.\n * @internal\n */\nexport const PropertyFilterBuilderContext =\n React.createContext<PropertyFilterBuilderContextProps>(null!);\n\n/**\n * Data structure that describes [[PropertyFilterBuilderRuleRenderingContext]] value.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleRenderingContextProps {\n /** Custom renderer for operator selector in rule. */\n ruleOperatorRenderer?: (\n props: PropertyFilterBuilderRuleOperatorProps\n ) => React.ReactNode;\n /** Custom renderer for value input in rule. */\n ruleValueRenderer?: (\n props: PropertyFilterBuilderRuleValueRendererProps\n ) => React.ReactNode;\n /** Custom renderer for property selector in rule. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies that properties selection is disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Context for rendering rules and rule groups inside [[PropertyFilterBuilder]] component.\n * @internal\n */\nexport const PropertyFilterBuilderRuleRenderingContext =\n React.createContext<PropertyFilterBuilderRuleRenderingContextProps>({});\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import type { PropertyFilterRuleGroupOperator } from "./Operators";
|
|
6
|
+
/**
|
|
7
|
+
* Props for [[PropertyFilterBuilderLogicalOperator]] component.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface PropertyFilterBuilderLogicalOperatorProps {
|
|
11
|
+
/** Allows toggling of operator by clicking operator text. */
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
/** Operator to combine FilterBuilderRules. Must be either "and" or "or". */
|
|
14
|
+
operator: `${PropertyFilterRuleGroupOperator}`;
|
|
15
|
+
/** Callback that is invoked when operator changes. */
|
|
16
|
+
onOperatorChange: (operator: `${PropertyFilterRuleGroupOperator}`) => void;
|
|
17
|
+
/** Classname to specify CSS styling */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Component to render the operator inside of the filter builder
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export declare const PropertyFilterBuilderLogicalOperator: (props: PropertyFilterBuilderLogicalOperatorProps) => React.JSX.Element;
|
|
24
|
+
//# sourceMappingURL=FilterBuilderLogicalOperator.d.ts.map
|