@itwin/components-react 4.9.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts +2 -1
- package/lib/cjs/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
- package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.js +1 -1
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/PointTypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/PointTypeConverter.js +2 -0
- package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +2 -2
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.scss +2 -5
- package/lib/cjs/components-react/datepicker/DatePicker.js +5 -5
- package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.js +29 -22
- package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.scss +4 -7
- package/lib/cjs/components-react/editors/BooleanEditor.js +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +13 -14
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.scss +3 -5
- package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.js +3 -3
- package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js +1 -1
- 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 +8 -1
- package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.scss +4 -6
- package/lib/cjs/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/IconEditor.js +1 -1
- package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.js +3 -3
- package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.scss +3 -5
- package/lib/cjs/components-react/editors/PopupButton.js +5 -6
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.js +6 -3
- 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 +5 -7
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.scss +3 -5
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts +1 -0
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.js +6 -5
- package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.scss +2 -8
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +13 -13
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.js +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.scss +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js +2 -2
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.scss +1 -4
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/Common.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +5 -4
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.scss +0 -17
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +49 -54
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +2 -3
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +4 -6
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +3 -5
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.d.ts +2 -1
- package/lib/esm/components-react/common/DelayedSpinner.d.ts.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
- package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/converters/DateTimeTypeConverter.js +1 -1
- package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/PointTypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/PointTypeConverter.js +2 -0
- package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +2 -2
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.scss +2 -5
- package/lib/esm/components-react/datepicker/DatePicker.js +5 -5
- package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.js +26 -22
- package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.scss +4 -7
- package/lib/esm/components-react/editors/BooleanEditor.js +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +13 -14
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.scss +3 -5
- package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.js +3 -3
- package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js +1 -1
- 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 +8 -1
- package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.scss +4 -6
- package/lib/esm/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/IconEditor.js +1 -1
- package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.js +3 -3
- package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.scss +3 -5
- package/lib/esm/components-react/editors/PopupButton.js +5 -6
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.js +6 -3
- 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 +5 -7
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.scss +3 -5
- package/lib/esm/components-react/editors/TextareaEditor.d.ts +1 -0
- package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.js +6 -5
- package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.scss +2 -8
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +13 -13
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.js +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.scss +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js +2 -2
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.scss +1 -4
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/Common.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +5 -4
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.scss +0 -17
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +49 -54
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +2 -3
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +4 -6
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +3 -5
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAElC,kDAAiD;AACjD,wDAA6C;AAC7C,kDAA+C;AAE/C,qDAAkD;AAClD,oEAAiE;AA0CjE;;;GAGG;AACH,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,mCAAmC;IACnC,iFAAa,CAAA;IACb,gDAAgD;IAChD,6FAAmB,CAAA;IACnB,gDAAgD;IAChD,yFAAiB,CAAA;AACnB,CAAC,EAPW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAO/B;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAGzC;IAMC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QACpD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAClD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACjD,gBAAW,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAgBjD,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC1B,0DAA0D;gBAC1D,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;gBACxD,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gB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EAAiE;oBACjE,8BACE,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,IAAI,CAAC,mBAAmB,iBACrB,oBAAoB,EAChC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,IAAI,CAAC,WAAW;wBAEvB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,8BAAQ,OAAG,GAAI;wBAAC,GAAG,CAC/B,CACR,CAAC,CAAC,CAAC,SAAS,CACR,CACF,CACH,CACP,CAAC;IACJ,CAAC;CACF;AAxJD,wCAwJC","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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, UiCore } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type { ResultSelectorProps } from \"./ResultSelector\";\nimport { ResultSelector } from \"./ResultSelector\";\nimport { SvgClose, SvgSearch } from \"@itwin/itwinui-icons-react\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @public\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<\n FilteringInputProps,\n FilteringInputState\n> {\n private _inputElement = React.createRef<HTMLInputElement>();\n private _searchLabel = UiCore.translate(\"general.search\");\n private _cancelLabel = UiCore.translate(\"dialog.cancel\");\n private _clearLabel = UiCore.translate(\"general.search\");\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current) this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter) return;\n\n if (!this.state.searchText) return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({\n resultSelectorKey: state.resultSelectorKey + 1,\n }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n return (\n // TODO: What is filtering-input-preload-images?\n <div\n className={classnames(\n \"components-filtering-input\",\n \"filtering-input-preload-images\",\n this.props.className\n )}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input\n type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput.placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={UiCore.translate(\"general.search\")}\n size=\"small\"\n />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished &&\n this.props.resultSelectorProps ? (\n <ResultSelector\n key={this.state.resultSelectorKey}\n {...this.props.resultSelectorProps}\n />\n ) : undefined}\n {status === FilteringInputStatus.ReadyToFilter ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onSearchButtonClick}\n data-testid=\"filter-input-search\"\n role=\"button\"\n tabIndex={-1}\n title={this._searchLabel}\n >\n <Icon iconSpec={<SvgSearch />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringInProgress ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onCancelButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={this._cancelLabel}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringFinished ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"components-filtering-input-clear icon\"\n onClick={this._onClearButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={this._clearLabel}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAElC,kDAAiD;AACjD,wDAA6C;AAC7C,kDAA+C;AAE/C,qDAAkD;AAClD,oEAAiE;AA0CjE;;;GAGG;AACH,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,mCAAmC;IACnC,iFAAa,CAAA;IACb,gDAAgD;IAChD,6FAAmB,CAAA;IACnB,gDAAgD;IAChD,yFAAiB,CAAA;AACnB,CAAC,EAPW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAO/B;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAGzC;IAMC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QACpD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAClD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACjD,gBAAW,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAgBjD,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC1B,0DAA0D;gBAC1D,IAAI,CAAC,QAAQ,CAAC,EAA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,OAAG,GAAI;wBAAC,GAAG,CAC/B,CACR,CAAC,CAAC,CAAC,SAAS;oBACZ,MAAM,KAAK,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,CAAC;oBACnD,iEAAiE;oBACjE,8BACE,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,IAAI,CAAC,mBAAmB,iBACrB,oBAAoB,EAChC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,IAAI,CAAC,WAAW;wBAEvB,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,8BAAQ,OAAG,GAAI;wBAAC,GAAG,CAC/B,CACR,CAAC,CAAC,CAAC,SAAS,CACR,CACF,CACH,CACP,CAAC;IACJ,CAAC;CACF;AAxJD,wCAwJC","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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, UiCore } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type { ResultSelectorProps } from \"./ResultSelector\";\nimport { ResultSelector } from \"./ResultSelector\";\nimport { SvgClose, SvgSearch } from \"@itwin/itwinui-icons-react\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @public\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<\n FilteringInputProps,\n FilteringInputState\n> {\n private _inputElement = React.createRef<HTMLInputElement>();\n private _searchLabel = UiCore.translate(\"general.search\");\n private _cancelLabel = UiCore.translate(\"dialog.cancel\");\n private _clearLabel = UiCore.translate(\"general.search\");\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current) this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter.valueOf()) return;\n\n if (!this.state.searchText) return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({\n resultSelectorKey: state.resultSelectorKey + 1,\n }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n return (\n // TODO: What is filtering-input-preload-images?\n <div\n className={classnames(\n \"components-filtering-input\",\n \"filtering-input-preload-images\",\n this.props.className\n )}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input\n type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput.placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={UiCore.translate(\"general.search\")}\n size=\"small\"\n />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished &&\n this.props.resultSelectorProps ? (\n <ResultSelector\n key={this.state.resultSelectorKey}\n {...this.props.resultSelectorProps}\n />\n ) : undefined}\n {status === FilteringInputStatus.ReadyToFilter ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onSearchButtonClick}\n data-testid=\"filter-input-search\"\n role=\"button\"\n tabIndex={-1}\n title={this._searchLabel}\n >\n <Icon iconSpec={<SvgSearch />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringInProgress ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onCancelButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={this._cancelLabel}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringFinished ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"components-filtering-input-clear icon\"\n onClick={this._onClearButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={this._clearLabel}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -96,7 +96,7 @@ class ResultSelector extends React.PureComponent {
|
|
|
96
96
|
}));
|
|
97
97
|
};
|
|
98
98
|
this._onSelectedResultKeyDown = (event) => {
|
|
99
|
-
if (event.key === ts_key_enum_1.Key.Enter)
|
|
99
|
+
if (event.key === ts_key_enum_1.Key.Enter.valueOf())
|
|
100
100
|
this._onSelectedResultConfirmed();
|
|
101
101
|
};
|
|
102
102
|
this.state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultSelector.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/ResultSelector.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAElC,kDAAyC;AACzC,kDAA+C;AAC/C,oEAA6E;AAwB7E;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAGzC;IAGC,gBAAgB;IAChB,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAJP,aAAQ,GAAG,2BAAY,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAYhD,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE;gBACvC,IAAI,CAAC,0BAA0B,EAAE,CAAC;g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,EACvC,SAAS,EAAE,IAAI,CAAC,wBAAwB,GACxC,CACH,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAC5B;gBACD,8BAAM,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IACnD,IAAI,CAAC,QAAQ,CACT;gBACP,kCAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAQ,CAChC;YAEP,gCACE,SAAS,EAAC,wCAAwC,iBACtC,aAAa,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC;gBAErC,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,qCAAe,OAAG,GAAI,CAChC,CACJ,CACR,CAAC;IACJ,CAAC;CACF;AAjJD,wCAiJC","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 Filtering\n */\n\nimport \"./ResultSelector.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\n\n/** [[ResultSelector]] React Component state\n * @internal\n */\ninterface ResultSelectorState {\n /** Currently selected result/entry index */\n selectedResultId: number;\n /** Input string */\n selectedResultEdit: string;\n /** Informs if selectedResult is currently being edited */\n selectedResultInEditMode: boolean;\n}\n\n/** [[ResultSelector]] React Component properties\n * @public\n */\nexport interface ResultSelectorProps extends CommonProps {\n /** Total number of results/entries */\n resultCount: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged: (index: number) => void;\n}\n\n/** Component for stepping through results/entries\n * @public\n */\nexport class ResultSelector extends React.PureComponent<\n ResultSelectorProps,\n ResultSelectorState\n> {\n private _ofLabel = UiComponents.translate(\"general.of\");\n\n /** @internal */\n constructor(props: ResultSelectorProps) {\n super(props);\n this.state = {\n selectedResultId: props.resultCount ? 1 : 0,\n selectedResultEdit: \"\",\n selectedResultInEditMode: false,\n };\n }\n\n private _onClickPrevious = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId > 1) {\n this.props.onSelectedChanged(this.state.selectedResultId - 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId - 1,\n }));\n }\n };\n\n private _onClickNext = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId < this.props.resultCount) {\n this.props.onSelectedChanged(this.state.selectedResultId + 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId + 1,\n }));\n }\n };\n\n private get _maxSelectedResultInputLength() {\n return this.props.resultCount.toString().length;\n }\n\n private _onSelectedResultChanged = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n if (event.target.value.length <= this._maxSelectedResultInputLength)\n this.setState({ selectedResultEdit: event.target.value });\n };\n\n private _onSelectedResultConfirmed = () => {\n let selectedId = +this.state.selectedResultEdit;\n if (selectedId > this.props.resultCount)\n selectedId = this.props.resultCount;\n else if (selectedId < 1) selectedId = 1;\n\n this.setState({\n selectedResultInEditMode: false,\n selectedResultId: selectedId,\n });\n this.props.onSelectedChanged(selectedId);\n };\n\n private _onSelectedResultClick = () => {\n this.setState((state) => ({\n selectedResultInEditMode: true,\n selectedResultEdit: state.selectedResultId.toString(),\n }));\n };\n\n private _onSelectedResultKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === Key.Enter) this._onSelectedResultConfirmed();\n };\n\n /** @internal */\n public override componentDidMount() {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: ResultSelectorProps) {\n if (this.props.resultCount !== prevProps.resultCount) {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n }\n\n /** @internal */\n public override render() {\n return (\n <span\n className={classnames(\n \"components-result-selector\",\n this.props.className\n )}\n style={this.props.style}\n >\n <button\n className={classnames(\"components-result-selector-button\", \"icon\")}\n data-testid=\"previous-button\"\n onClick={this._onClickPrevious}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n\n <span\n style={{ pointerEvents: this.props.resultCount ? \"auto\" : \"none\" }}\n className=\"components-result-selector-current-result\"\n onClick={this._onSelectedResultClick}\n role=\"presentation\"\n >\n {this.state.selectedResultInEditMode ? (\n <input\n type=\"number\"\n style={{\n width: `${this.state.selectedResultEdit.length * 0.6 + 1}em`,\n }}\n value={this.state.selectedResultEdit}\n onChange={this._onSelectedResultChanged}\n onBlur={this._onSelectedResultConfirmed}\n onKeyDown={this._onSelectedResultKeyDown}\n />\n ) : (\n this.state.selectedResultId\n )}\n <span style={{ marginLeft: \"5px\", marginRight: \"5px\" }}>\n {this._ofLabel}\n </span>\n <span>{this.props.resultCount}</span>\n </span>\n\n <button\n className=\"components-result-selector-button icon\"\n data-testid=\"next-button\"\n onClick={this._onClickNext}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </span>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ResultSelector.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/ResultSelector.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAElC,kDAAyC;AACzC,kDAA+C;AAC/C,oEAA6E;AAwB7E;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAGzC;IAGC,gBAAgB;IAChB,YAAY,KAA0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,KAAK,EAAE;wBACL,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI;qBAC7D,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACpC,QAAQ,EAAE,IAAI,CAAC,wBAAwB,EACvC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EACvC,SAAS,EAAE,IAAI,CAAC,wBAAwB,GACxC,CACH,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAC5B;gBACD,8BAAM,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IACnD,IAAI,CAAC,QAAQ,CACT;gBACP,kCAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAQ,CAChC;YAEP,gCACE,SAAS,EAAC,wCAAwC,iBACtC,aAAa,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC;gBAErC,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,qCAAe,OAAG,GAAI,CAChC,CACJ,CACR,CAAC;IACJ,CAAC;CACF;AAjJD,wCAiJC","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 Filtering\n */\n\nimport \"./ResultSelector.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\n\n/** [[ResultSelector]] React Component state\n * @internal\n */\ninterface ResultSelectorState {\n /** Currently selected result/entry index */\n selectedResultId: number;\n /** Input string */\n selectedResultEdit: string;\n /** Informs if selectedResult is currently being edited */\n selectedResultInEditMode: boolean;\n}\n\n/** [[ResultSelector]] React Component properties\n * @public\n */\nexport interface ResultSelectorProps extends CommonProps {\n /** Total number of results/entries */\n resultCount: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged: (index: number) => void;\n}\n\n/** Component for stepping through results/entries\n * @public\n */\nexport class ResultSelector extends React.PureComponent<\n ResultSelectorProps,\n ResultSelectorState\n> {\n private _ofLabel = UiComponents.translate(\"general.of\");\n\n /** @internal */\n constructor(props: ResultSelectorProps) {\n super(props);\n this.state = {\n selectedResultId: props.resultCount ? 1 : 0,\n selectedResultEdit: \"\",\n selectedResultInEditMode: false,\n };\n }\n\n private _onClickPrevious = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId > 1) {\n this.props.onSelectedChanged(this.state.selectedResultId - 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId - 1,\n }));\n }\n };\n\n private _onClickNext = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId < this.props.resultCount) {\n this.props.onSelectedChanged(this.state.selectedResultId + 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId + 1,\n }));\n }\n };\n\n private get _maxSelectedResultInputLength() {\n return this.props.resultCount.toString().length;\n }\n\n private _onSelectedResultChanged = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n if (event.target.value.length <= this._maxSelectedResultInputLength)\n this.setState({ selectedResultEdit: event.target.value });\n };\n\n private _onSelectedResultConfirmed = () => {\n let selectedId = +this.state.selectedResultEdit;\n if (selectedId > this.props.resultCount)\n selectedId = this.props.resultCount;\n else if (selectedId < 1) selectedId = 1;\n\n this.setState({\n selectedResultInEditMode: false,\n selectedResultId: selectedId,\n });\n this.props.onSelectedChanged(selectedId);\n };\n\n private _onSelectedResultClick = () => {\n this.setState((state) => ({\n selectedResultInEditMode: true,\n selectedResultEdit: state.selectedResultId.toString(),\n }));\n };\n\n private _onSelectedResultKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === Key.Enter.valueOf()) this._onSelectedResultConfirmed();\n };\n\n /** @internal */\n public override componentDidMount() {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: ResultSelectorProps) {\n if (this.props.resultCount !== prevProps.resultCount) {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n }\n\n /** @internal */\n public override render() {\n return (\n <span\n className={classnames(\n \"components-result-selector\",\n this.props.className\n )}\n style={this.props.style}\n >\n <button\n className={classnames(\"components-result-selector-button\", \"icon\")}\n data-testid=\"previous-button\"\n onClick={this._onClickPrevious}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n\n <span\n style={{ pointerEvents: this.props.resultCount ? \"auto\" : \"none\" }}\n className=\"components-result-selector-current-result\"\n onClick={this._onSelectedResultClick}\n role=\"presentation\"\n >\n {this.state.selectedResultInEditMode ? (\n <input\n type=\"number\"\n style={{\n width: `${this.state.selectedResultEdit.length * 0.6 + 1}em`,\n }}\n value={this.state.selectedResultEdit}\n onChange={this._onSelectedResultChanged}\n onBlur={this._onSelectedResultConfirmed}\n onKeyDown={this._onSelectedResultKeyDown}\n />\n ) : (\n this.state.selectedResultId\n )}\n <span style={{ marginLeft: \"5px\", marginRight: \"5px\" }}>\n {this._ofLabel}\n </span>\n <span>{this.props.resultCount}</span>\n </span>\n\n <button\n className=\"components-result-selector-button icon\"\n data-testid=\"next-button\"\n onClick={this._onClickNext}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </span>\n );\n }\n}\n"]}
|
|
@@ -96,11 +96,11 @@ const ForwardRefParsedInput = React.forwardRef(function ForwardRefParsedInput({
|
|
|
96
96
|
}, [updateValueFromString]);
|
|
97
97
|
const handleKeyDown = React.useCallback((event) => {
|
|
98
98
|
// istanbul ignore else
|
|
99
|
-
if (event.key === ts_key_enum_1.Key.Enter) {
|
|
99
|
+
if (event.key === ts_key_enum_1.Key.Enter.valueOf()) {
|
|
100
100
|
updateValueFromString(event.currentTarget.value);
|
|
101
101
|
event.preventDefault();
|
|
102
102
|
}
|
|
103
|
-
if (event.key === ts_key_enum_1.Key.Escape) {
|
|
103
|
+
if (event.key === ts_key_enum_1.Key.Escape.valueOf()) {
|
|
104
104
|
setFormattedValue(formatValue(currentValueRef.current));
|
|
105
105
|
setHasBadInput(false);
|
|
106
106
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedInput.js","sourceRoot":"","sources":["../../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,6CAAkC;AAClC,wDAA6C;AAG7C,8BAA4B;AAoB5B,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAG5C,SAAS,qBAAqB,CAC9B,EACE,YAAY,EACZ,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EACD,GAAG;IAEH,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IACtE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CACxD,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,CACpC,CAAC;IACF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,Q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uBAAuB;QACvB,IAAI,KAAK,CAAC,GAAG,KAAK,iBAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE;YACrC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACjD,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;QACD,IAAI,KAAK,CAAC,GAAG,KAAK,iBAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;YACtC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YACxD,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;IACH,CAAC,EACD,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACrC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,oBAAU,EAC3B,SAAS,EACT,yBAAyB,EACzB,WAAW,IAAI,mCAAmC,CACnD,CAAC;IAEF,OAAO,CACL,oBAAC,qBAAK,mBACQ,yBAAyB,EACrC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;GAEG;AACU,QAAA,WAAW,GAES,qBAAqB,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 Inputs\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport \"./ParsedInput.scss\";\n\n/** Props for [[ParsedInput]] control\n * @public\n */\nexport interface ParsedInputProps extends CommonProps {\n /** InitialValue which is used to restore input field if ESC is pressed */\n initialValue: number;\n /** Function used to format the value */\n formatValue: (value: number) => string;\n /** Function used to parse user input into a value */\n parseString: (stringValue: string) => ParseResults;\n /** Function to call when value is changed */\n onChange?: (newValue: number) => void;\n /** if readonly then only the formatValue function is used. */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\nconst ForwardRefParsedInput = React.forwardRef<\n HTMLInputElement,\n ParsedInputProps\n>(function ForwardRefParsedInput(\n {\n initialValue,\n formatValue,\n parseString,\n readonly,\n className,\n style,\n onChange,\n },\n ref\n) {\n const currentValueRef = React.useRef(initialValue);\n const isMountedRef = React.useRef(false);\n const lastFormattedValueRef = React.useRef(formatValue(initialValue));\n const [formattedValue, setFormattedValue] = React.useState(\n () => lastFormattedValueRef.current\n );\n const [hasBadInput, setHasBadInput] = React.useState(false);\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = initialValue;\n const currentFormattedValue = formatValue(currentValueRef.current);\n if (currentFormattedValue !== lastFormattedValueRef.current) {\n lastFormattedValueRef.current = currentFormattedValue;\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }, [formatValue, initialValue]);\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n },\n []\n );\n\n const updateValueFromString = React.useCallback(\n (strVal: string) => {\n if (lastFormattedValueRef.current === strVal) return;\n\n const parseResults = parseString(strVal);\n // istanbul ignore else\n if (!parseResults.parseError) {\n // istanbul ignore else\n if (\n undefined !== parseResults.value &&\n typeof parseResults.value === \"number\"\n ) {\n const currentValue = parseResults.value;\n // istanbul ignore else\n if (currentValue !== currentValueRef.current) {\n currentValueRef.current = currentValue;\n onChange && onChange(currentValueRef.current);\n }\n // istanbul ignore else\n if (isMountedRef.current) {\n lastFormattedValueRef.current = formatValue(currentValue);\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }\n } else {\n setHasBadInput(true);\n }\n },\n [formatValue, onChange, parseString]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n updateValueFromString(event.target.value);\n },\n [updateValueFromString]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.Enter.valueOf()) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n }\n if (event.key === Key.Escape.valueOf()) {\n setFormattedValue(formatValue(currentValueRef.current));\n setHasBadInput(false);\n event.preventDefault();\n }\n },\n [formatValue, updateValueFromString]\n );\n\n const classNames = classnames(\n className,\n \"components-parsed-input\",\n hasBadInput && \"components-parsed-input-has-error\"\n );\n\n return (\n <Input\n data-testid=\"components-parsed-input\"\n ref={ref}\n style={style}\n className={classNames}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n onChange={handleChange}\n value={formattedValue}\n disabled={readonly}\n size=\"small\"\n />\n );\n});\n\n/** Generic Input component that requires formatting and parsing functions to be passed in as props.\n * @public\n */\nexport const ParsedInput: (\n props: ParsedInputProps\n) => React.ReactElement | null = ForwardRefParsedInput;\n"]}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
.components-parsed-input {
|
|
9
9
|
width: auto;
|
|
10
|
+
padding: $uicore-iui-input-padding;
|
|
10
11
|
|
|
11
12
|
&.components-parsed-input-has-error {
|
|
12
13
|
color: var(--iui-color-text-negative);
|
|
@@ -17,8 +18,4 @@
|
|
|
17
18
|
color: var(--iui-color-text);
|
|
18
19
|
opacity: 0.65;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
&.iui-input {
|
|
22
|
-
padding: $uicore-iui-input-padding;
|
|
23
|
-
}
|
|
24
21
|
}
|
|
@@ -61,7 +61,7 @@ class CommonPropertyRenderer {
|
|
|
61
61
|
return currentSize - minColumnLabelWidth;
|
|
62
62
|
}
|
|
63
63
|
static createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
|
|
64
|
-
const highlightCallback =
|
|
64
|
+
const highlightCallback = highlight?.applyOnValue
|
|
65
65
|
? CommonPropertyRenderer.createHighlightCallback(highlight, propertyRecord)
|
|
66
66
|
: undefined;
|
|
67
67
|
const rendererContext = {
|
|
@@ -85,10 +85,9 @@ class CommonPropertyRenderer {
|
|
|
85
85
|
return displayValue;
|
|
86
86
|
}
|
|
87
87
|
static createHighlightCallback(highlight, propertyRecord) {
|
|
88
|
-
var _a;
|
|
89
88
|
const activeMatch = highlight.activeHighlight;
|
|
90
|
-
const propertyName = activeMatch
|
|
91
|
-
const matchIndex =
|
|
89
|
+
const propertyName = activeMatch?.highlightedItemIdentifier;
|
|
90
|
+
const matchIndex = activeMatch?.highlightIndex ?? 0;
|
|
92
91
|
let labelMatches;
|
|
93
92
|
if (highlight.applyOnLabel) {
|
|
94
93
|
labelMatches = (0, countMatchesInString_1.countMatchesInString)(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAgD;AAChD,4EAAyE;AACzE,kEAA+D;AAG/D,kEAGiC;AAEjC;;GAEG;AACH,MAAa,sBAAsB;IAC1B,MAAM,CAAC,cAAc,CAC1B,WAAoB,EACpB,WAAyB,EACzB,KAAc,EACd,WAAoB,EACpB,mBAA4B;QAE5B,IAAI,CAAC,WAAW;YAAE,OAAO,CAAC,CAAC;QAE3B,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,CAAC,CAAC;QACpB,IACE,WAAW,KAAK,wBAAW,CAAC,UAAU;YACtC,CAAC,KAAK;YACN,CAAC,WAAW;YACZ,CAAC,mBAAmB;YAEpB,OAAO,WAAW,GAAG,SAAS,CAAC;QAEjC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC;QACnD,MAAM,eAAe,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;QACtE,IAAI,WAAW,IAAI,eAAe;YAAE,OAAO,WAAW,GAAG,SAAS,CAAC;QAEnE,MAAM,SAAS,GACb,mBAAmB,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;QAClE,IAAI,WAAW,IAAI,SAAS;YAC1B,OAAO,CACL,SAAS;gBACT,IAAI,CAAC,cAAc,CACjB,WAAW,GAAG,CAAC,EACf,WAAW,EACX,KAAK,EACL,WAAW,EACX,mBAAmB,CACpB,CACF,CAAC;QAEJ,OAAO,WAAW,GAAG,mBAAmB,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,qBAAqB,CACjC,WAAwB,EACxB,cAA8B,EAC9B,WAAoB,EACpB,4BAA2D,EAC3D,UAAoB,EACpB,kBAA+B,EAC/B,eAA6C,EAC7C,SAGC;QAED,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAAgD;AAChD,4EAAyE;AACzE,kEAA+D;AAG/D,kEAGiC;AAEjC;;GAEG;AACH,MAAa,sBAAs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AI,EAAE,IAAI,EACV,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,SAAS,CAAC,eAAe,GACrC,CACH,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AApID,wDAoIC","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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { countMatchesInString } from \"../../common/countMatchesInString\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyValueRendererContext } from \"../ValueRendererManager\";\nimport {\n PropertyContainerType,\n PropertyValueRendererManager,\n} from \"../ValueRendererManager\";\n\n/**\n * @internal\n */\nexport class CommonPropertyRenderer {\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n if (!indentation) return 0;\n\n const maxIndent = 17;\n const minIndent = 6;\n if (\n orientation !== Orientation.Horizontal ||\n !width ||\n !columnRatio ||\n !minColumnLabelWidth\n )\n return indentation * maxIndent;\n\n const currentSize = Math.ceil(width * columnRatio);\n const shrinkThreshold = minColumnLabelWidth + maxIndent * indentation;\n if (currentSize >= shrinkThreshold) return indentation * maxIndent;\n\n const minShrink =\n minColumnLabelWidth + minIndent + maxIndent * (indentation - 1);\n if (currentSize <= minShrink)\n return (\n minIndent +\n this.getLabelOffset(\n indentation - 1,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n )\n );\n\n return currentSize - minColumnLabelWidth;\n }\n\n public static createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n }\n ) {\n const highlightCallback = highlight?.applyOnValue\n ? CommonPropertyRenderer.createHighlightCallback(\n highlight,\n propertyRecord\n )\n : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(\n propertyRecord,\n rendererContext\n );\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(\n propertyRecord,\n rendererContext\n );\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = (\n <span\n style={{\n paddingLeft: CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation\n ),\n }}\n >\n {displayValue}\n </span>\n );\n\n return displayValue;\n }\n\n private static createHighlightCallback(\n highlight: HighlightingComponentProps & { applyOnLabel: boolean },\n propertyRecord: PropertyRecord\n ) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(\n propertyRecord.property.displayLabel.toLowerCase(),\n highlight.highlightedText\n );\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex =\n propertyRecord.property.name === propertyName &&\n matchIndex - labelMatches >= 0\n ? matchIndex - labelMatches\n : undefined;\n const highlightCallback = (text: string) => (\n <HighlightedText\n text={text}\n activeMatchIndex={activeMatchIndex}\n searchText={highlight.highlightedText}\n />\n );\n\n return highlightCallback;\n }\n}\n"]}
|
|
@@ -66,7 +66,7 @@ class NonPrimitivePropertyRenderer extends React.Component {
|
|
|
66
66
|
getLabel(props, state) {
|
|
67
67
|
const { orientation, indentation, width, columnRatio, columnInfo } = props;
|
|
68
68
|
// istanbul ignore next
|
|
69
|
-
const minLabelWidth = columnInfo
|
|
69
|
+
const minLabelWidth = columnInfo?.minLabelWidth;
|
|
70
70
|
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minLabelWidth);
|
|
71
71
|
let displayLabel = props.propertyRecord.property.displayLabel;
|
|
72
72
|
if (this.props.propertyRecord.value.valueFormat === appui_abstract_1.PropertyValueFormat.Array)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAA6C;AAC7C,6CAA+B;AAC/B,0DAA4E;AAC5E,qEAAkE;AAClE,iGAA8F;AAE9F,yDAAsD;AACtD,iDAA8C;AAmB9C;;GAEG;AACH,MAAa,4BAA6B,SAAQ,KAAK,CAAC,SAGvD;IAQC,YAAY,KAAwC;QAClD,KAAK,CAAC,KAAK,CAAC,CAAC;QARf,gBAAgB;QACS,UAAK,GAAsC;YAClE,0FAA0F;YAC1F,UAAU,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;SACpE,CAAC;QAMM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QAEM,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;QAiDM,2BAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,IAAI,CA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,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAA6C;AAC7C,6CAA+B;AAC/B,0DAA4E;AAC5E,qEAAkE;AAClE,iGAA8F;AAE9F,yDAAsD;AACtD,iDAA8C;AAmB9C;;GAEG;AACH,MAAa,4BAA6B,SAAQ,KAAK,CAAC,SAGvD;IAQC,YAAY,KAAwC;QAClD,KAAK,CAAC,KAAK,CAAC,CAAC;QARf,gBAAgB;QACS,UAAK,GAAsC;YAClE,0FAA0F;YAC1F,UAAU,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;SACpE,CAAC;QAMM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC;QAEM,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;QAiDM,2BAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE;YACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS;gBACjC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS;gBACtB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC5C,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACpD,OAAO,CACL,oBAAC,mCAAgB,IACf,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,IAAI,EACpB,WAAW,EAAE,I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,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAC/C,KAAK,GACT,CACH,CAAC,CAAC,CAAC,SAAS;YAEZ,IAAI,CAAC,KAAK,CAAC,UAAU;gBACpB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC;gBACxC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF;AAxHD,oEAwHC","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 Properties\n */\n\nimport \"./NonPrimitivePropertyRenderer.scss\";\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyLabelRenderer } from \"./label/NonPrimitivePropertyLabelRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PropertyRenderer } from \"./PropertyRenderer\";\nimport { PropertyView } from \"./PropertyView\";\n\n/** Properties of [[NonPrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface NonPrimitivePropertyRendererProps\n extends PrimitiveRendererProps {\n /** Can struct/array property be collapsed */\n isCollapsible?: boolean;\n}\n\n/** State of [[NonPrimitivePropertyRenderer]] React component\n * @internal\n */\ninterface NonPrimitivePropertyRendererState {\n /** Is struct/array property expanded */\n isExpanded?: boolean;\n}\n\n/** React Component that renders struct and array properties\n * @public\n */\nexport class NonPrimitivePropertyRenderer extends React.Component<\n NonPrimitivePropertyRendererProps,\n NonPrimitivePropertyRendererState\n> {\n /** @internal */\n public override readonly state: NonPrimitivePropertyRendererState = {\n /** If it's not collapsible, that means it's expanded by default and can't be collapsed */\n isExpanded:\n !this.props.isCollapsible || this.props.propertyRecord.autoExpand,\n };\n\n constructor(props: NonPrimitivePropertyRendererProps) {\n super(props);\n }\n\n private _onExpanded = () => {\n this.setState({ isExpanded: true });\n };\n\n private _onCollapsed = () => {\n this.setState({ isExpanded: false });\n };\n\n private getLabel(\n props: NonPrimitivePropertyRendererProps,\n state: NonPrimitivePropertyRendererState\n ): React.ReactNode {\n const { orientation, indentation, width, columnRatio, columnInfo } = props;\n // istanbul ignore next\n const minLabelWidth = columnInfo?.minLabelWidth;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minLabelWidth\n );\n\n let displayLabel = props.propertyRecord.property.displayLabel;\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;\n\n return (\n <NonPrimitivePropertyLabelRenderer\n isExpanded={!!state.isExpanded}\n onExpand={this._onExpanded}\n onCollapse={this._onCollapsed}\n offset={offset}\n renderColon={false}\n >\n {displayLabel}\n </NonPrimitivePropertyLabelRenderer>\n );\n }\n\n private overrideArrayChildrenNames(items: PropertyRecord[]) {\n const modifiedProperties: PropertyRecord[] = items.map(\n (item, index): PropertyRecord => {\n const newProperty = { ...item.property };\n newProperty.displayLabel = `[${index + 1}]`;\n newProperty.name = `${newProperty.name}_${index}`;\n return new PropertyRecord(item.value, newProperty);\n }\n );\n\n return modifiedProperties;\n }\n\n private _renderPropertyForItem = (item: PropertyRecord) => {\n const prefix = this.props.uniqueKey\n ? this.props.uniqueKey\n : this.props.propertyRecord.property.name;\n const uniqueKey = `${prefix}_${item.property.name}`;\n return (\n <PropertyRenderer\n key={uniqueKey}\n uniqueKey={uniqueKey}\n propertyRecord={item}\n indentation={this.props.indentation ? this.props.indentation + 1 : 1}\n orientation={this.props.orientation}\n columnRatio={this.props.columnRatio}\n actionButtonRenderers={this.props.actionButtonRenderers}\n onColumnRatioChanged={this.props.onColumnRatioChanged}\n width={this.props.width}\n isResizeHandleHovered={this.props.isResizeHandleHovered}\n onResizeHandleHoverChanged={this.props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={this.props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={this.props.onResizeHandleDragChanged}\n columnInfo={this.props.columnInfo}\n />\n );\n };\n\n /** @internal */\n public override render() {\n let items: PropertyRecord[] =\n this.props.propertyRecord.getChildrenRecords();\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n items = this.overrideArrayChildrenNames(items);\n\n const { indentation, ...props } = this.props;\n return (\n <>\n {this.props.isCollapsible ? (\n <PropertyView\n labelElement={this.getLabel(this.props, this.state)}\n {...props}\n />\n ) : undefined}\n\n {this.state.isExpanded\n ? items.map(this._renderPropertyForItem)\n : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -46,12 +46,11 @@ class PrimitivePropertyRenderer extends React.Component {
|
|
|
46
46
|
}
|
|
47
47
|
/** @internal */
|
|
48
48
|
render() {
|
|
49
|
-
var _a, _b;
|
|
50
49
|
const { indentation, highlight, ...props } = this.props;
|
|
51
50
|
const displayLabel = this.props.propertyRecord.property.displayLabel;
|
|
52
|
-
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio,
|
|
51
|
+
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio, props.columnInfo?.minLabelWidth);
|
|
53
52
|
const activeMatchIndex = this.props.propertyRecord.property.name ===
|
|
54
|
-
|
|
53
|
+
highlight?.activeHighlight?.highlightedItemIdentifier
|
|
55
54
|
? highlight.activeHighlight.highlightIndex
|
|
56
55
|
: undefined;
|
|
57
56
|
const label = highlight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C;AAiB9C;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAAiC;IACpF,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,gBAAgB;IACA,MAAM
|
|
1
|
+
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C;AAiB9C;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK,CAAC,SAAiC;IACpF,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;QACrE,MAAM,MAAM,GAAG,+CAAsB,CAAC,cAAc,CAClD,WAAW,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,UAAU,EAAE,aAAa,CAChC,CAAC;QAEF,MAAM,gBAAgB,GACpB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI;YACvC,SAAS,EAAE,eAAe,EAAE,yBAAyB;YACnD,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,cAAc;YAC1C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,KAAK,GAAG,SAAS;YACrB,CAAC,CAAC,IAAA,iCAAe,EAAC;gBACd,IAAI,EAAE,YAAY;gBAClB,UAAU,EAAE,SAAS,CAAC,eAAe;gBACrC,gBAAgB;aACjB,CAAC;YACJ,CAAC,CAAC,YAAY,CAAC;QAEjB,OAAO,CACL,oBAAC,2BAAY,OACP,KAAK,EACT,YAAY,EACV,oBAAC,+DAA8B,IAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,wBAAW,CAAC,UAAU,EAC9D,OAAO,EAAE,YAAY,IAEpB,KAAK,CACyB,GAEnC,CACH,CAAC;IACJ,CAAC;CACF;AA7CD,8DA6CC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { PrimitivePropertyLabelRenderer } from \"./label/PrimitivePropertyLabelRenderer\";\nimport type { SharedRendererProps } from \"./PropertyRenderer\";\nimport { PropertyView } from \"./PropertyView\";\n\n/** Properties of [[PrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface PrimitiveRendererProps extends SharedRendererProps {\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Properties used for highlighting\n */\n highlight?: HighlightingComponentProps;\n}\n\n/** React Component that renders primitive properties\n * @public\n */\nexport class PrimitivePropertyRenderer extends React.Component<PrimitiveRendererProps> {\n constructor(props: PrimitiveRendererProps) {\n super(props);\n }\n\n /** @internal */\n public override render() {\n const { indentation, highlight, ...props } = this.props;\n const displayLabel = this.props.propertyRecord.property.displayLabel;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\n );\n\n const activeMatchIndex =\n this.props.propertyRecord.property.name ===\n highlight?.activeHighlight?.highlightedItemIdentifier\n ? highlight.activeHighlight.highlightIndex\n : undefined;\n const label = highlight\n ? HighlightedText({\n text: displayLabel,\n searchText: highlight.highlightedText,\n activeMatchIndex,\n })\n : displayLabel;\n\n return (\n <PropertyView\n {...props}\n labelElement={\n <PrimitivePropertyLabelRenderer\n offset={offset}\n renderColon={this.props.orientation === Orientation.Horizontal}\n tooltip={displayLabel}\n >\n {label}\n </PrimitivePropertyLabelRenderer>\n }\n />\n );\n }\n}\n"]}
|
|
@@ -44,10 +44,10 @@ class PropertyLabelRenderer extends React.PureComponent {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const title = this.props.tooltip ??
|
|
48
|
+
(typeof this.props.children == "string"
|
|
49
|
+
? this.props.children
|
|
50
|
+
: /* istanbul ignore next */ undefined);
|
|
51
51
|
return (React.createElement(React.Fragment, null,
|
|
52
52
|
React.createElement("span", { className: "components-property-label-renderer", title: title }, this.props.children),
|
|
53
53
|
this.props.renderColon ? (React.createElement("span", { className: "components-property-label-renderer-colon" }, ":")) : undefined));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;AAc/B,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAyC;IACxF,6EAA6E;IACtE,MAAM,CAAC,QAAQ,CAAC,MAAe;QACpC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,eAAe,MAAM,KAAK;SAClC,CAAC;IACJ,CAAC;IAEe,MAAM
|
|
1
|
+
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;AAc/B,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAyC;IACxF,6EAA6E;IACtE,MAAM,CAAC,QAAQ,CAAC,MAAe;QACpC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,eAAe,MAAM,KAAK;SAClC,CAAC;IACJ,CAAC;IAEe,MAAM;QACpB,MAAM,KAAK,GACT,IAAI,CAAC,KAAK,CAAC,OAAO;YAClB,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ;gBACrC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACrB,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,CACL;YACE,8BAAM,SAAS,EAAC,oCAAoC,EAAC,KAAK,EAAE,KAAK,IAC9D,IAAI,CAAC,KAAK,CAAC,QAAQ,CACf;YACN,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CACxB,8BAAM,SAAS,EAAC,0CAA0C,QAAS,CACpE,CAAC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF;AA3BD,sDA2BC","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 Properties\n */\n\nimport \"./PropertyLabelRenderer.scss\";\nimport * as React from \"react\";\n\n/** Base properties for a property label renderer\n * @public\n */\nexport interface PropertyLabelRendererProps {\n /** Label to be rendered */\n children: string | React.ReactElement;\n /** Indicates whether to render a colon after the label */\n renderColon?: boolean;\n /** Custom tooltip for the component. */\n tooltip?: string;\n}\n\n/** @internal */\nexport class PropertyLabelRenderer extends React.PureComponent<PropertyLabelRendererProps> {\n /** Get React CSS style object based on provided offset from the left side */\n public static getStyle(offset?: number): React.CSSProperties {\n offset = offset ? offset : 0;\n return {\n paddingLeft: offset,\n width: `calc(100% - ${offset}px)`,\n };\n }\n\n public override render() {\n const title =\n this.props.tooltip ??\n (typeof this.props.children == \"string\"\n ? this.props.children\n : /* istanbul ignore next */ undefined);\n return (\n <>\n <span className=\"components-property-label-renderer\" title={title}>\n {this.props.children}\n </span>\n {this.props.renderColon ? (\n <span className=\"components-property-label-renderer-colon\">:</span>\n ) : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -4,10 +4,9 @@ exports.convertRecordToString = void 0;
|
|
|
4
4
|
const TypeConverterManager_1 = require("../../../converters/TypeConverterManager");
|
|
5
5
|
/** @internal */
|
|
6
6
|
function convertRecordToString(record) {
|
|
7
|
-
var _a;
|
|
8
7
|
const primitive = record.value;
|
|
9
8
|
return (primitive.displayValue ||
|
|
10
|
-
TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename,
|
|
9
|
+
TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value));
|
|
11
10
|
}
|
|
12
11
|
exports.convertRecordToString = convertRecordToString;
|
|
13
12
|
//# sourceMappingURL=Common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/Common.ts"],"names":[],"mappings":";;;AAKA,mFAAgF;AAEhF,gBAAgB;AAChB,SAAgB,qBAAqB,CACnC,MAAsB
|
|
1
|
+
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/Common.ts"],"names":[],"mappings":";;;AAKA,mFAAgF;AAEhF,gBAAgB;AAChB,SAAgB,qBAAqB,CACnC,MAAsB;IAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,OAAO,CACL,SAAS,CAAC,YAAY;QACtB,2CAAoB,CAAC,YAAY,CAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAChC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAC5D,CAAC;AACJ,CAAC;AAXD,sDAWC","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 *--------------------------------------------------------------------------------------------*/\nimport type { PrimitiveValue, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\n\n/** @internal */\nexport function convertRecordToString(\n record: PropertyRecord\n): string | Promise<string> {\n const primitive = record.value as PrimitiveValue;\n return (\n primitive.displayValue ||\n TypeConverterManager.getConverter(\n record.property.typename,\n record.property.converter?.name\n ).convertPropertyToString(record.property, primitive.value)\n );\n}\n"]}
|
|
@@ -42,7 +42,7 @@ class DoublePropertyValueRenderer {
|
|
|
42
42
|
/** Checks if the renderer can handle given property */
|
|
43
43
|
canRender(record) {
|
|
44
44
|
return (record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive &&
|
|
45
|
-
record.property.typename === appui_abstract_1.StandardTypeNames.Double);
|
|
45
|
+
record.property.typename === appui_abstract_1.StandardTypeNames.Double.valueOf());
|
|
46
46
|
}
|
|
47
47
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
48
48
|
render(record, context) {
|
package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAK/E,qFAAsF;AACtF,qCAAiD;AAEjD;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"DoublePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/DoublePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAK/E,qFAAsF;AACtF,qCAAiD;AAEjD;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,CAChE,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,mEAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,8BAAqB,GAC5C,CACH,CAAC;IACJ,CAAC;CACF;AAtBD,kEAsBC","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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\nimport { convertRecordToString } from \"./Common\";\n\n/** Default Double Property Renderer\n * @public\n */\nexport class DoublePropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n record.value.valueFormat === PropertyValueFormat.Primitive &&\n record.property.typename === StandardTypeNames.Double.valueOf()\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return (\n <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertRecordToString}\n />\n );\n }\n}\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js
CHANGED
|
@@ -54,9 +54,8 @@ class MultilineTextPropertyValueRenderer {
|
|
|
54
54
|
}
|
|
55
55
|
exports.MultilineTextPropertyValueRenderer = MultilineTextPropertyValueRenderer;
|
|
56
56
|
const MultilineTextPropertyValueRendererImpl = (props) => {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
58
57
|
const { stringValue, element } = (0, PrimitivePropertyValueRenderer_1.useRenderedStringValue)(props.record, Common_1.convertRecordToString, props.context);
|
|
59
|
-
return (React.createElement(exports.MultilineTextRenderer, { style:
|
|
58
|
+
return (React.createElement(exports.MultilineTextRenderer, { style: props.context?.style, stringValue: stringValue, isExpanded: props.context?.isExpanded, onExpansionToggled: props.context?.onExpansionToggled, onHeightChanged: props.context?.onHeightChanged }, element));
|
|
60
59
|
};
|
|
61
60
|
/** @internal */
|
|
62
61
|
const MultilineTextRenderer = (props) => {
|
|
@@ -66,18 +65,16 @@ const MultilineTextRenderer = (props) => {
|
|
|
66
65
|
const [contentOverflows, setContentOverflows] = (0, react_1.useState)(false);
|
|
67
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
67
|
(0, react_1.useLayoutEffect)(() => {
|
|
69
|
-
var _a;
|
|
70
68
|
(0, core_bentley_1.assert)(divRef.current !== null && spanRef.current !== null);
|
|
71
69
|
setContentOverflows(spanRef.current.clientWidth < spanRef.current.scrollWidth);
|
|
72
70
|
const currentHeight = Math.max(divRef.current.offsetHeight, 27);
|
|
73
71
|
if (currentHeight !== previousHeightRef.current) {
|
|
74
|
-
|
|
72
|
+
props.onHeightChanged?.(currentHeight);
|
|
75
73
|
previousHeightRef.current = currentHeight;
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
76
|
const handleExpansionToggleClick = (event) => {
|
|
79
|
-
|
|
80
|
-
(_a = props.onExpansionToggled) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
77
|
+
props.onExpansionToggled?.();
|
|
81
78
|
event.stopPropagation();
|
|
82
79
|
};
|
|
83
80
|
// In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,iCAA0D;AAC1D,sDAA6C;AAE7C,0DAA4D;AAC5D,wDAAqD;AAKrD,qFAA0E;AAC1E,4DAAoC;AACpC,qCAAiD;AAEjD,gBAAgB;AAChB,MAAa,kCAAkC;IAGtC,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAEM,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,sCAAsC,IACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;IACJ,CAAC;CACF;AAlBD,gFAkBC;AAQD,MAAM,sCAAsC,GAExC,CAAC,KAAK,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"MultilineTextPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,iCAA0D;AAC1D,sDAA6C;AAE7C,0DAA4D;AAC5D,wDAAqD;AAKrD,qFAA0E;AAC1E,4DAAoC;AACpC,qCAAiD;AAEjD,gBAAgB;AAChB,MAAa,kCAAkC;IAGtC,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAEM,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,sCAAsC,IACrC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;IACJ,CAAC;CACF;AAlBD,gFAkBC;AAQD,MAAM,sCAAsC,GAExC,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAA,uDAAsB,EACrD,KAAK,CAAC,MAAM,EACZ,8BAAqB,EAC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0B,GAAG,CAAC,KAAuB,EAAE,EAAE;QAC7D,KAAK,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC7B,KAAK,CAAC,eAAe,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,mHAAmH;IACnH,gDAAgD;IAChD,OAAO,CACL,6BAAK,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,WAAW;QACrC,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,EAChE,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW;YAEtD,KAAK,CAAC,QAAQ;YACf,gCACE,SAAS,EAAC,eAAe,EACzB,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,EAC9D,OAAO,EAAE,0BAA0B,IAElC,2BAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC,CACrC,CACJ;QACN,gBAAgB,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACxC,gCAAQ,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,0BAA0B,IAClE,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC,CACnC,CACV,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,qBAAqB,yBAqDhC","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/**\n * @packageDocumentation\n * @module Properties\n */\n\nimport * as React from \"react\";\nimport { useLayoutEffect, useRef, useState } from \"react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { useRenderedStringValue } from \"./PrimitivePropertyValueRenderer\";\nimport classnames from \"classnames\";\nimport { convertRecordToString } from \"./Common\";\n\n/** @internal */\nexport class MultilineTextPropertyValueRenderer\n implements IPropertyValueRenderer\n{\n public canRender(record: PropertyRecord): boolean {\n return record.value.valueFormat === PropertyValueFormat.Primitive;\n }\n\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ): React.ReactNode {\n return (\n <MultilineTextPropertyValueRendererImpl\n record={record}\n context={context}\n />\n );\n }\n}\n\ninterface MultilineTextPropertyValueRendererImplProps {\n record: PropertyRecord;\n context?: PropertyValueRendererContext;\n children?: never;\n}\n\nconst MultilineTextPropertyValueRendererImpl: React.FC<\n MultilineTextPropertyValueRendererImplProps\n> = (props) => {\n const { stringValue, element } = useRenderedStringValue(\n props.record,\n convertRecordToString,\n props.context\n );\n return (\n <MultilineTextRenderer\n style={props.context?.style}\n stringValue={stringValue}\n isExpanded={props.context?.isExpanded}\n onExpansionToggled={props.context?.onExpansionToggled}\n onHeightChanged={props.context?.onHeightChanged}\n >\n {element}\n </MultilineTextRenderer>\n );\n};\n\ninterface MultilineTextRendererProps {\n stringValue?: string;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n style?: React.CSSProperties;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\nexport const MultilineTextRenderer: React.FC<MultilineTextRendererProps> = (\n props\n) => {\n const spanRef = useRef<HTMLSpanElement>(null);\n const divRef = useRef<HTMLDivElement>(null);\n const previousHeightRef = useRef(0);\n const [contentOverflows, setContentOverflows] = useState<boolean>(false);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n assert(divRef.current !== null && spanRef.current !== null);\n\n setContentOverflows(\n spanRef.current.clientWidth < spanRef.current.scrollWidth\n );\n\n const currentHeight = Math.max(divRef.current.offsetHeight, 27);\n if (currentHeight !== previousHeightRef.current) {\n props.onHeightChanged?.(currentHeight);\n previousHeightRef.current = currentHeight;\n }\n });\n\n const handleExpansionToggleClick = (event: React.MouseEvent) => {\n props.onExpansionToggled?.();\n event.stopPropagation();\n };\n\n // In order to always trigger onMouseLeave event on PropertyView, collapse button must remain mounted at all times.\n // https://github.com/facebook/react/issues/6807\n return (\n <div ref={divRef} className=\"multiline\">\n <span\n ref={spanRef}\n className={classnames(\"content\", { expanded: props.isExpanded })}\n style={props.style}\n title={props.isExpanded ? undefined : props.stringValue}\n >\n {props.children}\n <button\n className=\"expand-toggle\"\n style={{ display: props.isExpanded ? \"inline-block\" : \"none\" }}\n onClick={handleExpansionToggleClick}\n >\n {UiComponents.translate(\"property.collapse\")}\n </button>\n </span>\n {contentOverflows && !props.isExpanded && (\n <button className=\"expand-toggle\" onClick={handleExpansionToggleClick}>\n {UiComponents.translate(\"property.expand\")}\n </button>\n )}\n </div>\n );\n};\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js
CHANGED
|
@@ -42,7 +42,7 @@ class NavigationPropertyValueRenderer {
|
|
|
42
42
|
/** Checks if the renderer can handle given property */
|
|
43
43
|
canRender(record) {
|
|
44
44
|
return (record.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive &&
|
|
45
|
-
record.property.typename === appui_abstract_1.StandardTypeNames.Navigation);
|
|
45
|
+
record.property.typename === appui_abstract_1.StandardTypeNames.Navigation.valueOf());
|
|
46
46
|
}
|
|
47
47
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
48
48
|
render(record, context) {
|
package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAK/E,qFAAsF;AACtF,qCAAiD;AAEjD;;GAEG;AACH,MAAa,+BAA+B;IAC1C,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"NavigationPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/NavigationPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA+E;AAK/E,qFAAsF;AACtF,qCAAiD;AAEjD;;GAEG;AACH,MAAa,+BAA+B;IAC1C,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,kCAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,mEAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,8BAAqB,GAC5C,CACH,CAAC;IACJ,CAAC;CACF;AAtBD,0EAsBC","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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\nimport { convertRecordToString } from \"./Common\";\n\n/** Default Navigation Property Renderer\n * @public\n */\nexport class NavigationPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n record.value.valueFormat === PropertyValueFormat.Primitive &&\n record.property.typename === StandardTypeNames.Navigation.valueOf()\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return (\n <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertRecordToString}\n />\n );\n }\n}\n"]}
|
package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js
CHANGED
|
@@ -56,16 +56,14 @@ exports.PrimitivePropertyValueRenderer = PrimitivePropertyValueRenderer;
|
|
|
56
56
|
* @internal
|
|
57
57
|
*/
|
|
58
58
|
function convertPrimitiveRecordToString(record) {
|
|
59
|
-
var _a;
|
|
60
59
|
const primitive = record.value;
|
|
61
|
-
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename,
|
|
60
|
+
return TypeConverterManager_1.TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);
|
|
62
61
|
}
|
|
63
62
|
exports.convertPrimitiveRecordToString = convertPrimitiveRecordToString;
|
|
64
63
|
/** @internal */
|
|
65
64
|
function PrimitivePropertyValueRendererImpl(props) {
|
|
66
|
-
var _a;
|
|
67
65
|
const { stringValue, element } = useRenderedStringValue(props.record, props.stringValueCalculator, props.context, props.linksHandler);
|
|
68
|
-
return (React.createElement("span", { style:
|
|
66
|
+
return (React.createElement("span", { style: props.context?.style, title: stringValue }, element));
|
|
69
67
|
}
|
|
70
68
|
exports.PrimitivePropertyValueRendererImpl = PrimitivePropertyValueRendererImpl;
|
|
71
69
|
/**
|
|
@@ -82,9 +80,8 @@ exports.DEFAULT_LINKS_HANDLER = {
|
|
|
82
80
|
};
|
|
83
81
|
/** @internal */
|
|
84
82
|
function useRenderedStringValue(record, stringValueCalculator, context, linksHandler) {
|
|
85
|
-
var _a, _b;
|
|
86
83
|
const stringValue = (0, UseAsyncValue_1.useAsyncValue)(stringValueCalculator(record));
|
|
87
|
-
const el = stringValue === undefined ? (context
|
|
84
|
+
const el = stringValue === undefined ? (context?.defaultValue) : (React.createElement(LinkHandler_1.LinksRenderer, { value: stringValue, links: record.links ?? linksHandler ?? exports.DEFAULT_LINKS_HANDLER, highlighter: context?.textHighlighter }));
|
|
88
85
|
return { stringValue, element: el };
|
|
89
86
|
}
|
|
90
87
|
exports.useRenderedStringValue = useRenderedStringValue;
|