@itwin/components-react 4.13.4 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -5
- package/lib/cjs/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.js +0 -4
- package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/cjs/components-react/common/Links.d.ts.map +1 -1
- package/lib/cjs/components-react/common/Links.js +0 -7
- package/lib/cjs/components-react/common/Links.js.map +1 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js +0 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseElementsScrollStorage.js +0 -1
- package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -1
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.js +0 -13
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js +0 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.js +1 -8
- package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.js +0 -2
- package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +0 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.js +0 -9
- package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.js +0 -8
- 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 +7 -25
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js +0 -21
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -14
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.js +1 -13
- package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/IconEditor.js +0 -9
- package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +0 -6
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.js +1 -10
- package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +0 -2
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PropertyEditorManager.js +0 -1
- package/lib/cjs/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.js +0 -10
- 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 +0 -7
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.js +0 -15
- package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js +0 -9
- package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +0 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js +0 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js +0 -3
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js +0 -5
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js +1 -2
- package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +0 -2
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.js +7 -4
- package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +6 -3
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +5 -5
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +1 -0
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -0
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +1 -0
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -0
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +5 -9
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js +0 -2
- package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +0 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +3 -4
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +3 -4
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyList.js +0 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +0 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +0 -4
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +0 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js +0 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -6
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +0 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +0 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +1 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +7 -24
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.js +0 -2
- package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.js +0 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js +3 -6
- package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +3 -13
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +1 -7
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js +0 -3
- package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/useDragInteraction.js +0 -2
- package/lib/cjs/components-react/toolbar/useDragInteraction.js.map +1 -1
- package/lib/cjs/components-react/tree/TreeDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/TreeDataProvider.js +0 -1
- package/lib/cjs/components-react/tree/TreeDataProvider.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js +1 -8
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +0 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +0 -4
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js +0 -5
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js +0 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +1 -10
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.js +0 -4
- package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/esm/components-react/common/Links.d.ts.map +1 -1
- package/lib/esm/components-react/common/Links.js +0 -7
- package/lib/esm/components-react/common/Links.js.map +1 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js +0 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseElementsScrollStorage.js +0 -1
- package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -1
- package/lib/esm/components-react/converters/DateTimeTypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/DateTimeTypeConverter.js +0 -13
- package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js +0 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.js +1 -8
- package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.js +0 -2
- package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +0 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.js +0 -9
- package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.js +0 -8
- 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 +7 -25
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js +0 -21
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -14
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.js +1 -13
- package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/esm/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/IconEditor.js +0 -9
- package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +0 -6
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.js +1 -10
- package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +0 -2
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PropertyEditorManager.js +0 -1
- package/lib/esm/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.js +0 -10
- 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 +0 -7
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.js +0 -15
- package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js +0 -9
- package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +0 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js +0 -1
- package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.d.ts.map +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.js +0 -3
- package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js +0 -5
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js +1 -2
- package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +0 -2
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.js +7 -4
- package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +3 -3
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +5 -5
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts +1 -0
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -0
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts +1 -0
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -0
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js +5 -9
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js +0 -2
- package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +0 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +3 -4
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +3 -4
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyList.js +0 -1
- package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +0 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +0 -4
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +0 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js +0 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +0 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +0 -2
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +1 -2
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +7 -24
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/Items.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Items.js +0 -2
- package/lib/esm/components-react/toolbar/Items.js.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.js +0 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js +3 -6
- package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +3 -13
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js +1 -7
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js +0 -3
- package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.js.map +1 -1
- package/lib/esm/components-react/toolbar/useDragInteraction.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/useDragInteraction.js +0 -2
- package/lib/esm/components-react/toolbar/useDragInteraction.js.map +1 -1
- package/lib/esm/components-react/tree/TreeDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/tree/TreeDataProvider.js +0 -1
- package/lib/esm/components-react/tree/TreeDataProvider.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js +1 -8
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +0 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +0 -4
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js +0 -5
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js +0 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +1 -10
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/package.json +3 -5
|
@@ -61,28 +61,24 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
61
61
|
this._applyUpdatedValue(e.target.value);
|
|
62
62
|
};
|
|
63
63
|
this._onKeyPress = (e) => {
|
|
64
|
-
// istanbul ignore else
|
|
65
64
|
if (e.key === ts_key_enum_1.Key.Escape.valueOf()) {
|
|
66
65
|
const initialDisplayValue = (this._lastValidValue &&
|
|
67
66
|
this._lastValidValue.displayValue) ??
|
|
68
|
-
|
|
67
|
+
this._getInitialDisplayValue();
|
|
69
68
|
if (initialDisplayValue !== this.state.inputValue) {
|
|
70
69
|
e.preventDefault();
|
|
71
70
|
e.stopPropagation();
|
|
72
71
|
this._resetToLastValidDisplayValue();
|
|
73
72
|
}
|
|
74
73
|
else {
|
|
75
|
-
// istanbul ignore else
|
|
76
74
|
if (this.props.onCancel)
|
|
77
75
|
this.props.onCancel();
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
|
-
// istanbul ignore else
|
|
81
78
|
if (e.key !== ts_key_enum_1.Key.Enter.valueOf()) {
|
|
82
79
|
appui_abstract_1.UiAdmin.messagePresenter.closeInputFieldMessage();
|
|
83
80
|
}
|
|
84
81
|
};
|
|
85
|
-
// istanbul ignore next
|
|
86
82
|
this._onFocus = (e) => {
|
|
87
83
|
e.target.select();
|
|
88
84
|
};
|
|
@@ -97,7 +93,6 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
97
93
|
displayValue: record.value.displayValue,
|
|
98
94
|
};
|
|
99
95
|
}
|
|
100
|
-
// istanbul ignore else
|
|
101
96
|
if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
102
97
|
const parseResults = this._formatParams.parseFunction(this.state.inputValue);
|
|
103
98
|
if (!parseResults.parseError && undefined !== parseResults.value) {
|
|
@@ -109,30 +104,28 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
109
104
|
};
|
|
110
105
|
this._lastValidValue = { ...propertyValue };
|
|
111
106
|
// make sure the text in the input item matches the latest formatted text... this could get out if the input string say 1.5 === the display string of 1'-6"
|
|
112
|
-
// istanbul ignore else
|
|
113
107
|
if (newDisplayValue !== this.state.inputValue) {
|
|
114
108
|
this.setState({ inputValue: newDisplayValue });
|
|
115
109
|
}
|
|
116
110
|
}
|
|
117
111
|
else {
|
|
118
|
-
// istanbul ignore else
|
|
119
112
|
if (this.htmlElement) {
|
|
120
113
|
appui_abstract_1.UiAdmin.messagePresenter.displayInputFieldMessage(this.htmlElement, appui_abstract_1.MessageSeverity.Error, parseResults.parseError
|
|
121
114
|
? parseResults.parseError
|
|
122
|
-
:
|
|
115
|
+
: UiComponents_1.UiComponents.translate("errors.unable-to-parse-quantity"));
|
|
123
116
|
this.htmlElement.focus();
|
|
124
117
|
}
|
|
125
118
|
else {
|
|
126
119
|
appui_abstract_1.UiAdmin.messagePresenter.displayMessage(appui_abstract_1.MessageSeverity.Error, parseResults.parseError
|
|
127
120
|
? parseResults.parseError
|
|
128
|
-
:
|
|
121
|
+
: UiComponents_1.UiComponents.translate("errors.unable-to-parse-quantity"));
|
|
129
122
|
}
|
|
130
123
|
const displayValue = record.value.displayValue && record.value.displayValue.length > 0
|
|
131
124
|
? record.value.displayValue
|
|
132
|
-
:
|
|
125
|
+
: this._formatParams.formatFunction(record.value.value);
|
|
133
126
|
propertyValue = this._lastValidValue
|
|
134
127
|
? { ...this._lastValidValue }
|
|
135
|
-
:
|
|
128
|
+
: {
|
|
136
129
|
valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
|
|
137
130
|
value: record.value.value,
|
|
138
131
|
displayValue,
|
|
@@ -161,7 +154,6 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
161
154
|
const disabled = record && !record.isDisabled ? false : true;
|
|
162
155
|
if (readonly || disabled)
|
|
163
156
|
return;
|
|
164
|
-
// istanbul ignore else
|
|
165
157
|
if (this._isMounted)
|
|
166
158
|
this.setState({
|
|
167
159
|
inputValue: userInput,
|
|
@@ -186,16 +178,13 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
186
178
|
const record = this.props.propertyRecord;
|
|
187
179
|
let initialDisplayValue = "";
|
|
188
180
|
let numberValue = 0;
|
|
189
|
-
// istanbul ignore else
|
|
190
181
|
if (record) {
|
|
191
|
-
// istanbul ignore else
|
|
192
182
|
if (record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
193
183
|
const primitiveValue = record.value;
|
|
194
184
|
numberValue =
|
|
195
185
|
undefined !== primitiveValue.value
|
|
196
186
|
? primitiveValue.value
|
|
197
|
-
:
|
|
198
|
-
// istanbul ignore else
|
|
187
|
+
: 0;
|
|
199
188
|
if (primitiveValue.displayValue)
|
|
200
189
|
initialDisplayValue = primitiveValue.displayValue;
|
|
201
190
|
else
|
|
@@ -206,12 +195,10 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
206
195
|
}
|
|
207
196
|
async setStateFromProps() {
|
|
208
197
|
const record = this.props.propertyRecord;
|
|
209
|
-
// istanbul ignore next
|
|
210
198
|
if (!record || !record.property) {
|
|
211
199
|
core_bentley_1.Logger.logError(UiComponents_1.UiComponents.loggerCategory(this), "PropertyRecord must be defined to use CustomNumberPropertyEditor");
|
|
212
200
|
return;
|
|
213
201
|
}
|
|
214
|
-
// istanbul ignore else
|
|
215
202
|
if (record.property &&
|
|
216
203
|
record.property.editor &&
|
|
217
204
|
record.property.editor.params) {
|
|
@@ -231,17 +218,13 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
231
218
|
let size;
|
|
232
219
|
let maxLength;
|
|
233
220
|
let iconSpec;
|
|
234
|
-
// istanbul ignore else
|
|
235
221
|
if (record.property &&
|
|
236
222
|
record.property.editor &&
|
|
237
223
|
record.property.editor.params) {
|
|
238
224
|
const editorSizeParams = record.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.InputEditorSize.valueOf());
|
|
239
|
-
// istanbul ignore else
|
|
240
225
|
if (editorSizeParams) {
|
|
241
|
-
// istanbul ignore else
|
|
242
226
|
if (editorSizeParams.size)
|
|
243
227
|
size = editorSizeParams.size;
|
|
244
|
-
// istanbul ignore else
|
|
245
228
|
if (editorSizeParams.maxLength)
|
|
246
229
|
maxLength = editorSizeParams.maxLength;
|
|
247
230
|
}
|
|
@@ -250,7 +233,6 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
250
233
|
iconSpec = iconParams.definition.iconSpec;
|
|
251
234
|
}
|
|
252
235
|
}
|
|
253
|
-
// istanbul ignore else
|
|
254
236
|
if (this._isMounted)
|
|
255
237
|
this.setState({
|
|
256
238
|
inputValue: initialDisplayValue,
|
|
@@ -262,7 +244,7 @@ class CustomNumberEditor extends React.PureComponent {
|
|
|
262
244
|
_resetToLastValidDisplayValue() {
|
|
263
245
|
const initialDisplayValue = (this._lastValidValue &&
|
|
264
246
|
this._lastValidValue.displayValue) ??
|
|
265
|
-
|
|
247
|
+
this._getInitialDisplayValue();
|
|
266
248
|
this.setState({ inputValue: initialDisplayValue });
|
|
267
249
|
}
|
|
268
250
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAoC;AAEpC,qCAAmC;AACnC,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAClC,sDAA6C;AAU7C,0DAO+B;AAC/B,kDAAoD;AACpD,wDAA6C;AAI7C,kDAA+C;AAE/C,mEAGiC;AAUjC;;GAEG;AACH,MAAa,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAD3E;;QAIU,eAAU,GAAG,KAAK,CAAC;QAEnB,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QAG5D,gBAAgB;QACS,UAAK,GAAsC;YAClE,UAAU,EAAE,EAAE;SACf,CAAC;QA6GM,sBAAiB,GAAG,CAAC,CAAsC,EAAE,EAAE;YACrE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAC;QAoIM,gBAAW,GAAG,CAAC,CAAwC,EAAE,EAAE;YACjE,uBAAuB;YACvB,IAAI,CAAC,CAAC,GAAG,KAAK,iBAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;gBACnC,MAAM,mBAAmB,GACvB,CAAC,IAAI,CAAC,eAAe;oBAClB,IAAI,CAAC,eAAkC,CAAC,YAAY,CAAC;oBACxD,0BAA0B,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC5D,IAAI,mBAAmB,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;oBAClD,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,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SAAS,EAAE,IAAI,CAAC,cAAc,EAAE;YAChC,SAAS,EAAE,IAAI,CAAC,WAAW;SAC5B,CAAC;QAEF,IAAI,SAA0B,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,oBAAC,iBAAI,IAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAI,CAAC;YACrD,SAAS,GAAG;YACV,mDAAmD;YACnD,oBAAC,sBAAS,OACJ,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,IAAI,EAAE,IAAI,iBACE,gCAAgC,GAC5C,CACH,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,CACV,oBAAC,qBAAK,OACA,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,aAAa,iBACX,gCAAgC,EAC5C,IAAI,EAAC,OAAO,EACZ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,GAC5C,CACH,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArVD,gDAqVC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0CAAkB;IAChE,IAAW,SAAS;QAClB,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;IACD,IAAoB,sBAAsB;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAPD,gEAOC;AACD,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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\n// cSpell:ignore customnumber testid\n\nimport \"./CustomNumberEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type {\n CustomFormattedNumberParams,\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n MessageSeverity,\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n UiAdmin,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\nimport { UiComponents } from \"../UiComponents\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface CustomNumberEditorState {\n inputValue: string;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\n * @alpha\n */\nexport class CustomNumberEditor\n extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _formatParams: CustomFormattedNumberParams | undefined;\n private _inputElement = React.createRef<HTMLInputElement>();\n private _lastValidValue: PropertyValue | undefined;\n\n /** @internal */\n public override readonly state: Readonly<CustomNumberEditorState> = {\n inputValue: \"\",\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord as PropertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record.isReadonly) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: (record.value as PrimitiveValue).displayValue,\n };\n }\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const parseResults = (\n this._formatParams as CustomFormattedNumberParams\n ).parseFunction(this.state.inputValue);\n if (!parseResults.parseError && undefined !== parseResults.value) {\n const newDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(parseResults.value as number);\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: parseResults.value,\n displayValue: newDisplayValue,\n };\n this._lastValidValue = { ...propertyValue };\n // make sure the text in the input item matches the latest formatted text... this could get out if the input string say 1.5 === the display string of 1'-6\"\n // istanbul ignore else\n if (newDisplayValue !== this.state.inputValue) {\n this.setState({ inputValue: newDisplayValue });\n }\n } else {\n // istanbul ignore else\n if (this.htmlElement) {\n UiAdmin.messagePresenter.displayInputFieldMessage(\n this.htmlElement,\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : /* istanbul ignore next */ UiComponents.translate(\n \"errors.unable-to-parse-quantity\"\n )\n );\n this.htmlElement.focus();\n } else {\n UiAdmin.messagePresenter.displayMessage(\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : /* istanbul ignore next */ UiComponents.translate(\n \"errors.unable-to-parse-quantity\"\n )\n );\n }\n\n const displayValue =\n record.value.displayValue && record.value.displayValue.length > 0\n ? record.value.displayValue\n : /* istanbul ignore next */ (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(record.value.value as number);\n propertyValue = this._lastValidValue\n ? { ...this._lastValidValue }\n : /* istanbul ignore next */ {\n valueFormat: PropertyValueFormat.Primitive,\n value: record.value.value,\n displayValue,\n };\n }\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 shouldSetFocus(): boolean {\n if (!this.props.setFocus) return false;\n\n const record = this.props.propertyRecord as PropertyRecord;\n const disabled = record && !record.isDisabled ? false : true;\n const readonly = record && !record.isReadonly ? false : true;\n\n return !disabled && !readonly;\n }\n\n private _applyUpdatedValue(userInput: string) {\n const record = this.props.propertyRecord as PropertyRecord;\n const readonly = record && !record.isReadonly ? false : true;\n const disabled = record && !record.isDisabled ? false : true;\n\n if (readonly || disabled) return;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n inputValue: userInput,\n });\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n this._applyUpdatedValue(e.target.value);\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 _getInitialDisplayValue(): string {\n const record = this.props.propertyRecord;\n let initialDisplayValue = \"\";\n let numberValue = 0;\n // istanbul ignore else\n if (record) {\n // istanbul ignore else\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = record.value;\n numberValue =\n undefined !== primitiveValue.value\n ? (primitiveValue.value as number)\n : /* istanbul ignore next */ 0;\n // istanbul ignore else\n if (primitiveValue.displayValue)\n initialDisplayValue = primitiveValue.displayValue;\n else\n initialDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(numberValue);\n }\n }\n\n return initialDisplayValue;\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n // istanbul ignore next\n if (!record || !record.property) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n \"PropertyRecord must be defined to use CustomNumberPropertyEditor\"\n );\n return;\n }\n // istanbul ignore else\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n this._formatParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type ===\n PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) as CustomFormattedNumberParams;\n }\n\n if (!this._formatParams) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n `CustomFormattedNumberParams must be defined for property ${record.property.name}`\n );\n return;\n }\n\n const initialDisplayValue = this._getInitialDisplayValue();\n this._lastValidValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: initialDisplayValue,\n };\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n // istanbul ignore else\n if (\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.valueOf()\n ) as InputEditorSizeParams;\n // istanbul ignore else\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.valueOf()\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: initialDisplayValue,\n size,\n maxLength,\n iconSpec,\n });\n }\n\n private _resetToLastValidDisplayValue() {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n /* istanbul ignore next */ this._getInitialDisplayValue();\n this.setState({ inputValue: initialDisplayValue });\n }\n\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (e.key === Key.Escape.valueOf()) {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n /* istanbul ignore next */ this._getInitialDisplayValue();\n if (initialDisplayValue !== this.state.inputValue) {\n e.preventDefault();\n e.stopPropagation();\n this._resetToLastValidDisplayValue();\n } else {\n // istanbul ignore else\n if (this.props.onCancel) this.props.onCancel();\n }\n }\n\n // istanbul ignore else\n if (e.key !== Key.Enter.valueOf()) {\n UiAdmin.messagePresenter.closeInputFieldMessage();\n }\n };\n\n // istanbul ignore next\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const record = this.props.propertyRecord as PropertyRecord;\n if (!record || !this._formatParams) return null;\n\n const readOnly = !record.isReadonly ? false : true;\n const disabled = !record.isDisabled ? false : true;\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-customnumber-editor\",\n this.props.className\n );\n\n const inputProps: Omit<InputProps, \"size\"> = {\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly,\n disabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateInputValue,\n onBlur: this.props.onBlur,\n onFocus: this._onFocus,\n autoFocus: this.shouldSetFocus(),\n onKeyDown: this._onKeyPress,\n };\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n // eslint-disable-next-line deprecation/deprecation\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-customnumber-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n id={this.props.propertyRecord?.property.name}\n />\n );\n }\n\n return reactNode;\n }\n}\n\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\n * It uses the [[CustomNumberEditor]] React component.\n * @alpha\n */\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <CustomNumberEditor />;\n }\n public override get containerHandlesEscape(): boolean {\n return false;\n }\n}\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n CustomNumberPropertyEditor,\n StandardEditorNames.NumberCustom\n);\n"]}
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/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gCAAgC,EAC5C,IAAI,EAAC,OAAO,EACZ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,GAC5C,CACH,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA/TD,gDA+TC;AAED;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0CAAkB;IAChE,IAAW,SAAS;QAClB,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;IACD,IAAoB,sBAAsB;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAPD,gEAOC;AACD,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,MAAM,EACxB,0BAA0B,EAC1B,oCAAmB,CAAC,YAAY,CACjC,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\n// cSpell:ignore customnumber testid\n\nimport \"./CustomNumberEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type {\n CustomFormattedNumberParams,\n IconEditorParams,\n InputEditorSizeParams,\n PrimitiveValue,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n MessageSeverity,\n PropertyEditorParamTypes,\n PropertyValueFormat,\n StandardEditorNames,\n StandardTypeNames,\n UiAdmin,\n} from \"@itwin/appui-abstract\";\nimport { Icon, IconInput } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Input>;\n\nimport { UiComponents } from \"../UiComponents\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\n\n/** @internal */\ninterface CustomNumberEditorState {\n inputValue: string;\n size?: number;\n maxLength?: number;\n iconSpec?: string;\n}\n\n/** CustomNumberEditor is a React component that is a property editor for numbers that specify custom formatting and parsing functions.\n * @alpha\n */\nexport class CustomNumberEditor\n extends React.PureComponent<PropertyEditorProps, CustomNumberEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _formatParams: CustomFormattedNumberParams | undefined;\n private _inputElement = React.createRef<HTMLInputElement>();\n private _lastValidValue: PropertyValue | undefined;\n\n /** @internal */\n public override readonly state: Readonly<CustomNumberEditorState> = {\n inputValue: \"\",\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord as PropertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record.isReadonly) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: (record.value as PrimitiveValue).displayValue,\n };\n }\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n const parseResults = (\n this._formatParams as CustomFormattedNumberParams\n ).parseFunction(this.state.inputValue);\n if (!parseResults.parseError && undefined !== parseResults.value) {\n const newDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(parseResults.value as number);\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: parseResults.value,\n displayValue: newDisplayValue,\n };\n this._lastValidValue = { ...propertyValue };\n // make sure the text in the input item matches the latest formatted text... this could get out if the input string say 1.5 === the display string of 1'-6\"\n if (newDisplayValue !== this.state.inputValue) {\n this.setState({ inputValue: newDisplayValue });\n }\n } else {\n if (this.htmlElement) {\n UiAdmin.messagePresenter.displayInputFieldMessage(\n this.htmlElement,\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n this.htmlElement.focus();\n } else {\n UiAdmin.messagePresenter.displayMessage(\n MessageSeverity.Error,\n parseResults.parseError\n ? parseResults.parseError\n : UiComponents.translate(\"errors.unable-to-parse-quantity\")\n );\n }\n\n const displayValue =\n record.value.displayValue && record.value.displayValue.length > 0\n ? record.value.displayValue\n : (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(record.value.value as number);\n propertyValue = this._lastValidValue\n ? { ...this._lastValidValue }\n : {\n valueFormat: PropertyValueFormat.Primitive,\n value: record.value.value,\n displayValue,\n };\n }\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 shouldSetFocus(): boolean {\n if (!this.props.setFocus) return false;\n\n const record = this.props.propertyRecord as PropertyRecord;\n const disabled = record && !record.isDisabled ? false : true;\n const readonly = record && !record.isReadonly ? false : true;\n\n return !disabled && !readonly;\n }\n\n private _applyUpdatedValue(userInput: string) {\n const record = this.props.propertyRecord as PropertyRecord;\n const readonly = record && !record.isReadonly ? false : true;\n const disabled = record && !record.isDisabled ? false : true;\n\n if (readonly || disabled) return;\n\n if (this._isMounted)\n this.setState({\n inputValue: userInput,\n });\n }\n\n private _updateInputValue = (e: React.ChangeEvent<HTMLInputElement>) => {\n this._applyUpdatedValue(e.target.value);\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 _getInitialDisplayValue(): string {\n const record = this.props.propertyRecord;\n let initialDisplayValue = \"\";\n let numberValue = 0;\n if (record) {\n if (record.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = record.value;\n numberValue =\n undefined !== primitiveValue.value\n ? (primitiveValue.value as number)\n : 0;\n if (primitiveValue.displayValue)\n initialDisplayValue = primitiveValue.displayValue;\n else\n initialDisplayValue = (\n this._formatParams as CustomFormattedNumberParams\n ).formatFunction(numberValue);\n }\n }\n\n return initialDisplayValue;\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n if (!record || !record.property) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n \"PropertyRecord must be defined to use CustomNumberPropertyEditor\"\n );\n return;\n }\n if (\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n this._formatParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type ===\n PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) as CustomFormattedNumberParams;\n }\n\n if (!this._formatParams) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n `CustomFormattedNumberParams must be defined for property ${record.property.name}`\n );\n return;\n }\n\n const initialDisplayValue = this._getInitialDisplayValue();\n this._lastValidValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: (record.value as PrimitiveValue).value,\n displayValue: initialDisplayValue,\n };\n let size: number | undefined;\n let maxLength: number | undefined;\n let iconSpec: string | undefined;\n\n if (\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.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n if (editorSizeParams.size) size = editorSizeParams.size;\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.valueOf()\n ) as IconEditorParams;\n if (iconParams) {\n iconSpec = iconParams.definition.iconSpec;\n }\n }\n\n if (this._isMounted)\n this.setState({\n inputValue: initialDisplayValue,\n size,\n maxLength,\n iconSpec,\n });\n }\n\n private _resetToLastValidDisplayValue() {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n this.setState({ inputValue: initialDisplayValue });\n }\n\n private _onKeyPress = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === Key.Escape.valueOf()) {\n const initialDisplayValue =\n (this._lastValidValue &&\n (this._lastValidValue as PrimitiveValue).displayValue) ??\n this._getInitialDisplayValue();\n if (initialDisplayValue !== this.state.inputValue) {\n e.preventDefault();\n e.stopPropagation();\n this._resetToLastValidDisplayValue();\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n }\n\n if (e.key !== Key.Enter.valueOf()) {\n UiAdmin.messagePresenter.closeInputFieldMessage();\n }\n };\n\n private _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const minSize = this.state.size ? this.state.size : 8;\n const minWidthStyle: React.CSSProperties = {\n minWidth: `${minSize * 0.75}em`,\n };\n const record = this.props.propertyRecord as PropertyRecord;\n if (!record || !this._formatParams) return null;\n\n const readOnly = !record.isReadonly ? false : true;\n const disabled = !record.isDisabled ? false : true;\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-customnumber-editor\",\n this.props.className\n );\n\n const inputProps: Omit<InputProps, \"size\"> = {\n className,\n style: this.props.style ? this.props.style : minWidthStyle,\n readOnly,\n disabled,\n maxLength: this.state.maxLength,\n value: this.state.inputValue,\n onChange: this._updateInputValue,\n onBlur: this.props.onBlur,\n onFocus: this._onFocus,\n autoFocus: this.shouldSetFocus(),\n onKeyDown: this._onKeyPress,\n };\n\n let reactNode: React.ReactNode;\n if (this.state.iconSpec) {\n const icon = <Icon iconSpec={this.state.iconSpec} />;\n reactNode = (\n // eslint-disable-next-line deprecation/deprecation\n <IconInput\n {...inputProps}\n ref={this._inputElement}\n icon={icon}\n data-testid=\"components-customnumber-editor\"\n />\n );\n } else {\n reactNode = (\n <Input\n {...inputProps}\n ref={this._inputElement}\n data-testid=\"components-customnumber-editor\"\n size=\"small\"\n id={this.props.propertyRecord?.property.name}\n />\n );\n }\n\n return reactNode;\n }\n}\n\n/** Custom Property Editor registered for the \"number\" type name and the \"number-custom\" editor name.\n * It uses the [[CustomNumberEditor]] React component.\n * @alpha\n */\nexport class CustomNumberPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <CustomNumberEditor />;\n }\n public override get containerHandlesEscape(): boolean {\n return false;\n }\n}\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n CustomNumberPropertyEditor,\n StandardEditorNames.NumberCustom\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAIL,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AASjE,gBAAgB;AAChB,UAAU,mBAAmB;IAC3B,KAAK,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAChB,UAAU,mBAAoB,SAAQ,mBAAmB;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,cACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,mBAAmB,CACpE,YAAW,UAAU;IAErB,OAAO,C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,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAG3D;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAK7B;IAEY,iBAAiB,CAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,IAAI,GACb,OAAO,CAAC,IAAI,CAAC;IAahB,OAAO,CAAC,aAAa,CAWnB;IAEF,OAAO,CAAC,iBAAiB,CAWvB;IAEF,gBAAgB;IACA,iBAAiB;IAKjC,gBAAgB;IACA,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAiG/B,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,YAAY,CAMlB;IAEF,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,aAAa,CAInB;IAEF,OAAO,CAAC,aAAa,CAUnB;IAEF,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA0D1C;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;IACD,IAAoB,mBAAmB,IAAI,OAAO,CAEjD;CACF"}
|
|
@@ -61,9 +61,7 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
61
61
|
editInUtc: false,
|
|
62
62
|
};
|
|
63
63
|
this._handleChange = (newValue) => {
|
|
64
|
-
// istanbul ignore else
|
|
65
64
|
if (this._isMounted && this.state.typeConverter) {
|
|
66
|
-
// istanbul ignore else
|
|
67
65
|
if (this.state.editInUtc) {
|
|
68
66
|
newValue = (0, DateUtils_1.adjustDateToTimezone)(newValue, newValue.getTimezoneOffset() * -1);
|
|
69
67
|
}
|
|
@@ -92,7 +90,6 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
92
90
|
this._enterKey = false;
|
|
93
91
|
}
|
|
94
92
|
else {
|
|
95
|
-
// istanbul ignore next
|
|
96
93
|
if (this.props.onCancel)
|
|
97
94
|
this.props.onCancel();
|
|
98
95
|
}
|
|
@@ -101,16 +98,13 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
101
98
|
await this._handleCommit();
|
|
102
99
|
};
|
|
103
100
|
this._handleCancel = (_event) => {
|
|
104
|
-
// istanbul ignore else
|
|
105
101
|
if (this.props.onCancel) {
|
|
106
102
|
this.props.onCancel();
|
|
107
103
|
}
|
|
108
104
|
};
|
|
109
105
|
this._handleCommit = async () => {
|
|
110
|
-
// istanbul ignore else
|
|
111
106
|
if (this.props.propertyRecord && this.props.onCommit) {
|
|
112
107
|
const propertyValue = await this.getPropertyValue();
|
|
113
|
-
// istanbul ignore else
|
|
114
108
|
if (propertyValue !== undefined) {
|
|
115
109
|
this.props.onCommit({
|
|
116
110
|
propertyRecord: this.props.propertyRecord,
|
|
@@ -123,7 +117,6 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
123
117
|
async getPropertyValue() {
|
|
124
118
|
const record = this.props.propertyRecord;
|
|
125
119
|
let propertyValue;
|
|
126
|
-
// istanbul ignore else
|
|
127
120
|
if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
128
121
|
propertyValue = {
|
|
129
122
|
valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
|
|
@@ -138,13 +131,11 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
138
131
|
}
|
|
139
132
|
get hasFocus() {
|
|
140
133
|
let containsFocus = false;
|
|
141
|
-
// istanbul ignore else
|
|
142
134
|
if (this.htmlElement)
|
|
143
135
|
containsFocus = this.htmlElement.contains(document.activeElement);
|
|
144
136
|
return containsFocus;
|
|
145
137
|
}
|
|
146
138
|
async processDateChange(typeConverter, newValue) {
|
|
147
|
-
// istanbul ignore else
|
|
148
139
|
if (this.props.propertyRecord) {
|
|
149
140
|
const displayValue = await typeConverter.convertPropertyToString(this.props.propertyRecord.property, newValue);
|
|
150
141
|
this.setState({
|
|
@@ -175,12 +166,9 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
175
166
|
let timeDisplay;
|
|
176
167
|
let alternateDateFormat = appui_abstract_1.AlternateDateFormats.None;
|
|
177
168
|
let editInUtc = false;
|
|
178
|
-
// istanbul ignore else
|
|
179
169
|
if (this.props.showTime)
|
|
180
170
|
timeDisplay = appui_abstract_1.TimeDisplay.H12MC;
|
|
181
|
-
// istanbul ignore else
|
|
182
171
|
if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
183
|
-
// istanbul ignore else
|
|
184
172
|
if (record.value.value instanceof Date)
|
|
185
173
|
initialValue = new Date(record.value.value);
|
|
186
174
|
else if (typeof record.value.value === "string")
|
|
@@ -190,9 +178,7 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
190
178
|
typeConverter = TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name);
|
|
191
179
|
const options = record.property.converter?.options;
|
|
192
180
|
if (options) {
|
|
193
|
-
// istanbul ignore else
|
|
194
181
|
if ("alternateDateFormat" in options) {
|
|
195
|
-
// istanbul ignore else
|
|
196
182
|
if (DateTimeTypeConverter_1.DateTimeTypeConverterBase.isAlternateDateFormats(options.alternateDateFormat)) {
|
|
197
183
|
timeDisplay = appui_abstract_1.TimeDisplay.H24MS;
|
|
198
184
|
alternateDateFormat = options.alternateDateFormat;
|
|
@@ -201,13 +187,11 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
201
187
|
if ("timeDisplay" in options && this.props.showTime) {
|
|
202
188
|
timeDisplay = options.timeDisplay;
|
|
203
189
|
// use 24 hr time display if alternateDateFormat is defined
|
|
204
|
-
// istanbul ignore next
|
|
205
190
|
if (alternateDateFormat &&
|
|
206
191
|
timeDisplay !== appui_abstract_1.TimeDisplay.H24MS &&
|
|
207
192
|
timeDisplay !== appui_abstract_1.TimeDisplay.H24M)
|
|
208
193
|
timeDisplay = appui_abstract_1.TimeDisplay.H24MS;
|
|
209
194
|
}
|
|
210
|
-
// istanbul ignore else
|
|
211
195
|
if (alternateDateFormat) {
|
|
212
196
|
editInUtc = true;
|
|
213
197
|
if (this.props.showTime) {
|
|
@@ -233,17 +217,14 @@ class DateTimeEditor extends React.PureComponent {
|
|
|
233
217
|
}
|
|
234
218
|
}
|
|
235
219
|
}
|
|
236
|
-
// istanbul ignore next
|
|
237
220
|
if (!initialValue) {
|
|
238
221
|
throw new Error("Bad Value");
|
|
239
222
|
}
|
|
240
|
-
// istanbul ignore next
|
|
241
223
|
if (!typeConverter) {
|
|
242
224
|
throw new Error("Unable to determine TypeConverter");
|
|
243
225
|
}
|
|
244
226
|
const isDisabled = record && !!record.isDisabled;
|
|
245
227
|
const displayValue = await typeConverter.convertPropertyToString(record.property, initialValue);
|
|
246
|
-
// istanbul ignore else
|
|
247
228
|
if (this._isMounted)
|
|
248
229
|
this.setState({
|
|
249
230
|
value: initialValue,
|
|
@@ -287,7 +268,6 @@ class ShortDateTimePropertyEditor extends PropertyEditorManager_1.PropertyEditor
|
|
|
287
268
|
get reactNode() {
|
|
288
269
|
return React.createElement(DateTimeEditor, { showTime: false });
|
|
289
270
|
}
|
|
290
|
-
// istanbul ignore next
|
|
291
271
|
get containerHandlesTab() {
|
|
292
272
|
return false;
|
|
293
273
|
}
|
|
@@ -301,7 +281,6 @@ class DateTimePropertyEditor extends PropertyEditorManager_1.PropertyEditorBase
|
|
|
301
281
|
get reactNode() {
|
|
302
282
|
return React.createElement(DateTimeEditor, { showTime: true });
|
|
303
283
|
}
|
|
304
|
-
// istanbul ignore next
|
|
305
284
|
get containerHandlesTab() {
|
|
306
285
|
return false;
|
|
307
286
|
}
|
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,gBAAgB,EAAE,KAAK,GACvB;4BACD,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CACzB,6BAAK,SAAS,EAAC,gBAAgB;gCAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,MAAM,CACF;gCACP,oBAAC,qBAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,YAAY,EAAE,IAAI,CAAC,iBAAiB,GACpC,CACE,CACP,CACG,CACL;oBACH,oBAAC,kCAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAtTD,wCAsTC;AAED;;;GAGG;AACH,MAAa,2BAA4B,SAAQ,0CAAkB;IACjE,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,KAAK,GAAI,CAAC;IAC7C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,kEAQC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,uBAAuB;IACvB,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AARD,wDAQC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,SAAS,EAC3B,2BAA2B,CAC5B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,QAAQ,EAC1B,sBAAsB,CACvB,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 \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n StandardTypeNames,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport type { TimeSpec } from \"../datepicker/TimeField\";\nimport { TimeField } from \"../datepicker/TimeField\";\nimport type { TypeConverter } from \"../converters/TypeConverter\";\nimport { DatePicker } from \"../datepicker/DatePicker\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\n\n// cSpell:ignore datepicker\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n isDisabled?: boolean;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: 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.value,\n displayValue: this.state.displayValue,\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n // istanbul ignore else\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n // istanbul ignore else\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n // istanbul ignore else\n if (this._isMounted && this.state.typeConverter) {\n // istanbul ignore else\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\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: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n // istanbul ignore else\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n // istanbul ignore else\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n // istanbul ignore else\n if (\"alternateDateFormat\" in options) {\n // istanbul ignore else\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n // istanbul ignore next\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n // istanbul ignore else\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n // istanbul ignore next\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n // istanbul ignore next\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const isDisabled = record && !!record.isDisabled;\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n // istanbul ignore next\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\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 private _handleCommit = async (): 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 /** @internal */\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n // istanbul ignore next\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.ShortDate,\n ShortDateTimePropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.DateTime,\n DateTimePropertyEditor\n);\n"]}
|
|
1
|
+
{"version":3,"file":"DateTimeEditor.js","sourceRoot":"","sources":["../../../../src/components-react/editors/DateTimeEditor.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAE/B,0DAK+B;AAE/B,mEAGiC;AACjC,+CAAgF;AAEhF,uDAAoD;AAEpD,yDAAsD;AACtD,6EAA0E;AAC1E,+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,EAAE,KAAK,GAAI,CAAC;IAC7C,CAAC;IACD,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAPD,kEAOC;AAED;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,0CAAkB;IAC5D,IAAW,SAAS;QAClB,OAAO,oBAAC,cAAc,IAAC,QAAQ,EAAE,IAAI,GAAI,CAAC;IAC5C,CAAC;IACD,IAAoB,mBAAmB;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAPD,wDAOC;AAED,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,SAAS,EAC3B,2BAA2B,CAC5B,CAAC;AACF,6CAAqB,CAAC,cAAc,CAClC,kCAAiB,CAAC,QAAQ,EAC1B,sBAAsB,CACvB,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 \"./DateTimeEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport {\n AlternateDateFormats,\n PropertyValueFormat,\n StandardTypeNames,\n TimeDisplay,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport {\n PropertyEditorBase,\n PropertyEditorManager,\n} from \"./PropertyEditorManager\";\nimport { PopupButton, PopupContent, PopupOkCancelButtons } from \"./PopupButton\";\nimport type { TimeSpec } from \"../datepicker/TimeField\";\nimport { TimeField } from \"../datepicker/TimeField\";\nimport type { TypeConverter } from \"../converters/TypeConverter\";\nimport { DatePicker } from \"../datepicker/DatePicker\";\nimport { TypeConverterManager } from \"../converters/TypeConverterManager\";\nimport { DateTimeTypeConverterBase } from \"../converters/DateTimeTypeConverter\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { adjustDateToTimezone } from \"../common/DateUtils\";\n\n// cSpell:ignore datepicker\n\n/** @internal */\ninterface DateTimeEditorState {\n value: Date;\n displayValue?: string;\n timeDisplay?: TimeDisplay;\n isDisabled?: boolean;\n typeConverter?: TypeConverter;\n editInUtc: boolean;\n}\n\n/** @internal */\ninterface DateTimeEditorProps extends PropertyEditorProps {\n showTime?: boolean;\n}\n\n/** DateTimeEditor React component that is a property editor for selection of date and time.\n * @internal\n */\nexport class DateTimeEditor\n extends React.PureComponent<DateTimeEditorProps, DateTimeEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n /** @internal */\n public override readonly state: Readonly<DateTimeEditorState> = {\n value: new Date(),\n editInUtc: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: this.state.displayValue,\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n public async processDateChange(\n typeConverter: TypeConverter,\n newValue: Date\n ): Promise<void> {\n if (this.props.propertyRecord) {\n const displayValue = await typeConverter.convertPropertyToString(\n this.props.propertyRecord.property,\n newValue\n );\n this.setState({\n value: newValue,\n displayValue,\n });\n }\n }\n\n private _handleChange = (newValue: Date): void => {\n if (this._isMounted && this.state.typeConverter) {\n if (this.state.editInUtc) {\n newValue = adjustDateToTimezone(\n newValue,\n newValue.getTimezoneOffset() * -1\n );\n }\n\n void this.processDateChange(this.state.typeConverter, newValue);\n }\n };\n\n private _handleTimeChange = (time: TimeSpec): void => {\n // Combine new time into selected Date\n if (this.state.editInUtc) {\n const newWorkingDate = adjustDateToTimezone(this.state.value, 0);\n newWorkingDate.setUTCHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\n } else {\n const newWorkingDate = new Date(this.state.value.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n this._handleChange(newWorkingDate);\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: Date | undefined;\n let typeConverter: TypeConverter | undefined;\n let timeDisplay: TimeDisplay | undefined;\n let alternateDateFormat = AlternateDateFormats.None;\n let editInUtc = false;\n\n if (this.props.showTime) timeDisplay = TimeDisplay.H12MC;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n if (record.value.value instanceof Date)\n initialValue = new Date(record.value.value);\n else if (typeof record.value.value === \"string\")\n initialValue = new Date(record.value.value);\n else if (record.value.value === undefined) initialValue = new Date();\n\n typeConverter = TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n );\n\n const options = record.property.converter?.options;\n if (options) {\n if (\"alternateDateFormat\" in options) {\n if (\n DateTimeTypeConverterBase.isAlternateDateFormats(\n options.alternateDateFormat\n )\n ) {\n timeDisplay = TimeDisplay.H24MS;\n alternateDateFormat = options.alternateDateFormat;\n }\n }\n\n if (\"timeDisplay\" in options && this.props.showTime) {\n timeDisplay = options.timeDisplay;\n // use 24 hr time display if alternateDateFormat is defined\n if (\n alternateDateFormat &&\n timeDisplay !== TimeDisplay.H24MS &&\n timeDisplay !== TimeDisplay.H24M\n )\n timeDisplay = TimeDisplay.H24MS;\n }\n\n if (alternateDateFormat) {\n editInUtc = true;\n\n if (this.props.showTime) {\n if (alternateDateFormat === AlternateDateFormats.IsoShort) {\n alternateDateFormat = AlternateDateFormats.IsoDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShort) {\n alternateDateFormat = AlternateDateFormats.UtcDateTime;\n }\n if (alternateDateFormat === AlternateDateFormats.UtcShortWithDay) {\n alternateDateFormat = AlternateDateFormats.UtcDateTimeWithDay;\n }\n } else {\n timeDisplay = undefined;\n if (alternateDateFormat === AlternateDateFormats.IsoDateTime)\n alternateDateFormat = AlternateDateFormats.IsoShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTime)\n alternateDateFormat = AlternateDateFormats.UtcShort;\n if (alternateDateFormat === AlternateDateFormats.UtcDateTimeWithDay)\n alternateDateFormat = AlternateDateFormats.UtcShortWithDay;\n }\n }\n }\n }\n\n if (!initialValue) {\n throw new Error(\"Bad Value\");\n }\n\n if (!typeConverter) {\n throw new Error(\"Unable to determine TypeConverter\");\n }\n\n const isDisabled = record && !!record.isDisabled;\n const displayValue = await typeConverter.convertPropertyToString(\n record!.property,\n initialValue\n );\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n isDisabled,\n timeDisplay,\n typeConverter,\n displayValue,\n editInUtc,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n /** @internal */\n public override render(): React.ReactNode {\n const date = this.state.editInUtc\n ? adjustDateToTimezone(this.state.value, 0)\n : this.state.value;\n const timeSpec: TimeSpec = {\n hours: date.getHours(),\n minutes: date.getMinutes(),\n seconds: date.getSeconds(),\n };\n\n const className = classnames(\n \"components-cell-editor\",\n \"components-datetime-editor\",\n this.props.className\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.displayValue}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n >\n <PopupContent>\n <>\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={date}\n onDateChange={this._handleChange}\n showFocusOutline={false}\n />\n {this.state.timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {\"Time\"}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={this.state.timeDisplay}\n onTimeChange={this._handleTimeChange}\n />\n </div>\n )}\n </div>\n </>\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class ShortDateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={false} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\n/** DateTime Property Editor registered for the \"number\" type name and \"DateTime\" editor name.\n * It uses the [[DateTimeEditor]] React component.\n * @internal\n */\nexport class DateTimePropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <DateTimeEditor showTime={true} />;\n }\n public override get containerHandlesTab(): boolean {\n return false;\n }\n}\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.ShortDate,\n ShortDateTimePropertyEditor\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.DateTime,\n DateTimePropertyEditor\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumButtonGroupEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EAGd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,0BAA0B;IAClC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,qBACX,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,0BAA0B,CACvE,YAAW,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAiD;IACjE,OAAO,CAAC,WAAW,CAAqC;IAExD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAIlE;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"EnumButtonGroupEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EAGd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAKjC,gBAAgB;AAChB,UAAU,0BAA0B;IAClC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,qBACX,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,0BAA0B,CACvE,YAAW,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAiD;IACjE,OAAO,CAAC,WAAW,CAAqC;IAExD,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAIlE;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAK7B;IAED,gBAAgB;IACA,iBAAiB;IAIjC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA0D/B,OAAO,CAAC,kBAAkB,CAoBxB;IAEF,OAAO,CAAC,SAAS;IAiCjB,gBAAgB;IACA,MAAM;CAkBvB;AAED;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kBAAkB;IACnE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
|
|
@@ -57,16 +57,13 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
57
57
|
};
|
|
58
58
|
this._handleButtonClick = (index) => {
|
|
59
59
|
const propertyRecord = this.props.propertyRecord;
|
|
60
|
-
// istanbul ignore else
|
|
61
60
|
if (this.state.choices && this.state.choices.length > index) {
|
|
62
61
|
const selectValue = this.state.choices[index].value;
|
|
63
62
|
this.setState({
|
|
64
63
|
selectValue,
|
|
65
64
|
}, async () => {
|
|
66
|
-
// istanbul ignore else
|
|
67
65
|
if (propertyRecord && this.props.onCommit) {
|
|
68
66
|
const propertyValue = await this.getPropertyValue();
|
|
69
|
-
// istanbul ignore else
|
|
70
67
|
if (propertyValue !== undefined) {
|
|
71
68
|
this.props.onCommit({ propertyRecord, newValue: propertyValue });
|
|
72
69
|
}
|
|
@@ -78,7 +75,6 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
78
75
|
async getPropertyValue() {
|
|
79
76
|
const record = this.props.propertyRecord;
|
|
80
77
|
let propertyValue;
|
|
81
|
-
// istanbul ignore else
|
|
82
78
|
if (record && record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
83
79
|
propertyValue = {
|
|
84
80
|
valueFormat: appui_abstract_1.PropertyValueFormat.Primitive,
|
|
@@ -93,7 +89,6 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
93
89
|
}
|
|
94
90
|
get hasFocus() {
|
|
95
91
|
let containsFocus = false;
|
|
96
|
-
// istanbul ignore else
|
|
97
92
|
if (this._divElement.current)
|
|
98
93
|
containsFocus = this._divElement.current.contains(document.activeElement);
|
|
99
94
|
return containsFocus;
|
|
@@ -110,7 +105,6 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
110
105
|
}
|
|
111
106
|
async setStateFromProps() {
|
|
112
107
|
const { propertyRecord } = this.props;
|
|
113
|
-
// istanbul ignore else
|
|
114
108
|
if (propertyRecord &&
|
|
115
109
|
propertyRecord.property.enum &&
|
|
116
110
|
propertyRecord.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
|
|
@@ -123,7 +117,6 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
123
117
|
selectValue = primitiveValue;
|
|
124
118
|
}
|
|
125
119
|
let choices = [];
|
|
126
|
-
// istanbul ignore else
|
|
127
120
|
if (propertyRecord && propertyRecord.property.enum) {
|
|
128
121
|
if (propertyRecord.property.enum.choices instanceof Promise) {
|
|
129
122
|
choices = await propertyRecord.property.enum.choices;
|
|
@@ -135,17 +128,13 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
135
128
|
const numChoices = choices.length;
|
|
136
129
|
const enumIcons = new Array(numChoices);
|
|
137
130
|
enumIcons.fill({ iconSpec: placeholder_svg_1.default });
|
|
138
|
-
// istanbul ignore else
|
|
139
131
|
if (propertyRecord.property.editor &&
|
|
140
132
|
propertyRecord.property.editor.params) {
|
|
141
|
-
// istanbul ignore else
|
|
142
133
|
if (propertyRecord.property.editor &&
|
|
143
134
|
propertyRecord.property.editor.params) {
|
|
144
135
|
const bgParams = propertyRecord.property.editor.params.find((param) => param.type === appui_abstract_1.PropertyEditorParamTypes.ButtonGroupData.valueOf());
|
|
145
|
-
// istanbul ignore else
|
|
146
136
|
if (bgParams) {
|
|
147
137
|
bgParams.buttons.forEach((iconDef, index) => {
|
|
148
|
-
// istanbul ignore else
|
|
149
138
|
if (index < numChoices) {
|
|
150
139
|
enumIcons[index] = iconDef;
|
|
151
140
|
}
|
|
@@ -159,11 +148,10 @@ class EnumButtonGroupEditor extends React.Component {
|
|
|
159
148
|
getButton(choice, index) {
|
|
160
149
|
const choiceValue = this.state.choices
|
|
161
150
|
? this.state.choices[index].value
|
|
162
|
-
:
|
|
151
|
+
: 0;
|
|
163
152
|
const isActive = choiceValue === this.state.selectValue ? true : false;
|
|
164
153
|
let isDisabled = false;
|
|
165
154
|
const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;
|
|
166
|
-
// istanbul ignore else
|
|
167
155
|
if (isEnabledFunction) {
|
|
168
156
|
isDisabled = !isEnabledFunction();
|
|
169
157
|
}
|
|
@@ -184,7 +172,6 @@ exports.EnumButtonGroupEditor = EnumButtonGroupEditor;
|
|
|
184
172
|
* @public
|
|
185
173
|
*/
|
|
186
174
|
class EnumPropertyButtonGroupEditor extends PropertyEditorManager_1.PropertyEditorBase {
|
|
187
|
-
// istanbul ignore next
|
|
188
175
|
get reactNode() {
|
|
189
176
|
return React.createElement(EnumButtonGroupEditor, null);
|
|
190
177
|
}
|