@itwin/components-react 4.10.0 → 4.12.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 +21 -1
- package/lib/cjs/components-react/UiComponents.d.ts +1 -5
- package/lib/cjs/components-react/UiComponents.d.ts.map +1 -1
- package/lib/cjs/components-react/UiComponents.js +3 -15
- package/lib/cjs/components-react/UiComponents.js.map +1 -1
- package/lib/cjs/components-react/UiComponents.json +153 -0
- package/lib/cjs/components-react/common/DelayedSpinner.js +3 -2
- package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +2 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +4 -2
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +2 -1
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -0
- package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.js +43 -40
- package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +8 -7
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts +1 -0
- package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/IntlFormatter.js +1 -0
- package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.js +28 -30
- package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +8 -6
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js +5 -3
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts +0 -1
- package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.js +2 -3
- package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +8 -5
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.d.ts +0 -1
- package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js +5 -4
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts +0 -1
- package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.js +1 -2
- package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
- 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 +6 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
- 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/FilterBuilderToolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +1 -0
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.d.ts +0 -3
- package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js +5 -7
- package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.d.ts +0 -1
- package/lib/cjs/components-react/filtering/ResultSelector.d.ts.map +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.js +1 -2
- package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/cjs/components-react/properties/ValueRendererManager.d.ts +3 -0
- package/lib/cjs/components-react/properties/ValueRendererManager.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/ValueRendererManager.js +12 -1
- package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
- package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
- package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +62 -0
- package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +6 -44
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyView.js +2 -3
- package/lib/cjs/components-react/properties/renderers/PropertyView.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 +2 -1
- package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
- 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 +2 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
- 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 +3 -2
- 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.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +3 -2
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +19 -21
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -4
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -3
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +6 -5
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +8 -7
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +8 -6
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -2
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +2 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/cjs/components-react/useTranslation.d.ts +7 -0
- package/lib/cjs/components-react/useTranslation.d.ts.map +1 -0
- package/lib/cjs/components-react/useTranslation.js +52 -0
- package/lib/cjs/components-react/useTranslation.js.map +1 -0
- package/lib/cjs/components-react.d.ts +2 -0
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +2 -0
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/UiComponents.d.ts +1 -5
- package/lib/esm/components-react/UiComponents.d.ts.map +1 -1
- package/lib/esm/components-react/UiComponents.js +3 -15
- package/lib/esm/components-react/UiComponents.js.map +1 -1
- package/lib/esm/components-react/UiComponents.json +153 -0
- package/lib/esm/components-react/common/DelayedSpinner.js +3 -2
- package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +2 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +4 -2
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +2 -1
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -0
- package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.js +43 -40
- package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +8 -7
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/esm/components-react/datepicker/IntlFormatter.d.ts +1 -0
- package/lib/esm/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/IntlFormatter.js +1 -0
- package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.js +28 -30
- package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +8 -6
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js +5 -3
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts +0 -1
- package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.js +2 -3
- package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +9 -6
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.d.ts +0 -1
- package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.js +5 -4
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.d.ts +0 -1
- package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.js +1 -2
- package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
- 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 +6 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
- 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/FilterBuilderToolbar.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.d.ts +1 -0
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +1 -0
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.d.ts +0 -3
- package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js +6 -8
- package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.d.ts +0 -1
- package/lib/esm/components-react/filtering/ResultSelector.d.ts.map +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.js +1 -2
- package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/esm/components-react/properties/ValueRendererManager.d.ts +3 -0
- package/lib/esm/components-react/properties/ValueRendererManager.d.ts.map +1 -1
- package/lib/esm/components-react/properties/ValueRendererManager.js +12 -1
- package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
- package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
- package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +35 -0
- package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +3 -21
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyView.js +2 -3
- package/lib/esm/components-react/properties/renderers/PropertyView.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 +2 -1
- package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
- 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 +2 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
- 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 +3 -2
- 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.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +3 -2
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +20 -22
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +2 -5
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js +3 -4
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +6 -5
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +8 -7
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +8 -6
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -2
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +2 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react/useTranslation.d.ts +7 -0
- package/lib/esm/components-react/useTranslation.d.ts.map +1 -0
- package/lib/esm/components-react/useTranslation.js +25 -0
- package/lib/esm/components-react/useTranslation.js.map +1 -0
- package/lib/esm/components-react.d.ts +2 -0
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +2 -0
- package/lib/esm/components-react.js.map +1 -1
- package/lib/public/locales/en/UiComponents.json +7 -1
- package/package.json +5 -6
package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAE9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AAIpG,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAmCtF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CACvE,KAAK,EACL,EAAE;IACF,MAAM,EACJ,QAAQ,EACR,4BAA4B,EAC5B,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,SAAS,EACT,GAAG,gBAAgB,EACpB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CACjC,oBAAC,YAAY,IACX,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAC7B,QAAQ,EAAE,QAAQ,EAClB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,YAAY,EA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AAE,EAAE;YAClD,0BAA0B;YAC1B,IAAI,KAAK,CAAC,QAAQ;gBAAE,KAAK,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,OAAO,CACL,oBAAC,eAAe,IACd,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,CAAC,YAAY,IAAI,0BAA0B,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EACrE,QAAQ,EAAE,IAAI,GACd,CACH,CAAC;KACH;IAED,OAAO,CACL,0CACG,sBAAsB,CAAC,qBAAqB,CAC3C,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,4BAA4B,EAClC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,SAAS,CAChB,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAC3B,SAAmB,EACnB,eAA6C;IAE7C,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,wBAAwB,CAAC,OAAO,IAAI,SAAS,EAAE;YAClD,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC;SACvB;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../../editors/EditorContainer\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"../../../properties/renderers/PrimitivePropertyRenderer\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer\";\nimport type { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const {\n category,\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n onHeightChanged,\n highlight,\n ...passthroughProps\n } = props;\n\n const valueElementRenderer = () => (\n <DisplayValue\n propertyRecord={passthroughProps.propertyRecord}\n orientation={passthroughProps.orientation}\n columnRatio={passthroughProps.columnRatio}\n width={passthroughProps.width}\n category={category}\n propertyValueRendererManager={propertyValueRendererManager}\n isEditing={isEditing}\n onEditCommit={onEditCommit}\n onEditCancel={onEditCancel}\n isExpanded={passthroughProps.isExpanded}\n onExpansionToggled={passthroughProps.onExpansionToggled}\n onHeightChanged={onHeightChanged}\n highlight={highlight}\n />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <FlatNonPrimitivePropertyRenderer\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n {...primitiveRendererProps}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n\n category?: PropertyCategory;\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props) => {\n useResetHeightOnEdit(props.isEditing, props.onHeightChanged);\n\n if (props.isEditing) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n /* istanbul ignore else */\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? /* istanbul ignore next */ (() => {})}\n setFocus={true}\n />\n );\n }\n\n return (\n <>\n {CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n )}\n </>\n );\n};\n\nfunction useResetHeightOnEdit(\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(27);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAG9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAExF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAC;AAmC1G;;GAEG;AACH,MAAM,CAAC,MAAM,o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C;QACjE,CAAC,CAAC;QAEF,OAAO,CACL,oBAAC,eAAe,IACd,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,MAAA,KAAK,CAAC,YAAY,mCAA+B,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EACrE,QAAQ,EAAE,IAAI,GACd,CACH,CAAC;KACH;IAED,OAAO,CACL,0CACG,sBAAsB,CAAC,qBAAqB,CAC3C,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,4BAA4B,EAClC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,SAAS,CAChB,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAC3B,WAAwB,EACxB,SAAmB,EACnB,eAA6C;IAE7C,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,wBAAwB,CAAC,OAAO,IAAI,SAAS,EAAE;YAClD,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAG,WAAW,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACnE;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../../editors/EditorContainer\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer\";\nimport { CustomizablePropertyRenderer } from \"../../../properties/renderers/CustomizablePropertyRenderer\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const {\n category,\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n onHeightChanged,\n highlight,\n ...passthroughProps\n } = props;\n\n const valueElementRenderer = () => (\n <DisplayValue\n propertyRecord={passthroughProps.propertyRecord}\n orientation={passthroughProps.orientation}\n columnRatio={passthroughProps.columnRatio}\n width={passthroughProps.width}\n category={category}\n propertyValueRendererManager={propertyValueRendererManager}\n isEditing={isEditing}\n onEditCommit={onEditCommit}\n onEditCancel={onEditCancel}\n isExpanded={passthroughProps.isExpanded}\n onExpansionToggled={passthroughProps.onExpansionToggled}\n onHeightChanged={onHeightChanged}\n highlight={highlight}\n indentation={props.indentation}\n />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n\n const rendererManager =\n propertyValueRendererManager ?? PropertyValueRendererManager.defaultManager;\n const hasCustomRenderer = rendererManager.hasCustomRenderer(\n passthroughProps.propertyRecord\n );\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty or has a custom renderer registered, render it as a customizable property\n if (props.propertyRecord.value.items.length === 0 || hasCustomRenderer)\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n // If a custom renderer is registered for the struct property, render it as a customizable property\n if (hasCustomRenderer) {\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n }\n\n return (\n <FlatNonPrimitivePropertyRenderer\n {...primitiveRendererProps}\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n valueElement={undefined}\n valueElementRenderer={undefined}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n\n category?: PropertyCategory;\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props) => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n if (props.isEditing) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n /* istanbul ignore else */\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? /* istanbul ignore next */ (() => {})}\n setFocus={true}\n />\n );\n }\n\n return (\n <>\n {CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n )}\n </>\n );\n};\n\nfunction useResetHeightOnEdit(\n orientation: Orientation,\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(orientation === Orientation.Vertical ? 48 : 28);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}
|
|
@@ -15,11 +15,12 @@ import { Select } from "@itwin/itwinui-react";
|
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
17
|
export function ControlledSelectableContent(props) {
|
|
18
|
+
var _a;
|
|
18
19
|
const { onSelectedContentIdChanged, disabled } = props;
|
|
19
20
|
const onContentIdSelected = React.useCallback((newValue) => {
|
|
20
21
|
onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);
|
|
21
22
|
}, [onSelectedContentIdChanged]);
|
|
22
|
-
const selectedContent = props.children.find((contentDef) => contentDef.id === props.selectedContentId)
|
|
23
|
+
const selectedContent = (_a = props.children.find((contentDef) => contentDef.id === props.selectedContentId)) !== null && _a !== void 0 ? _a : props.children[0];
|
|
23
24
|
const options = React.useMemo(() => {
|
|
24
25
|
return props.children.map((componentDef) => ({
|
|
25
26
|
label: componentDef.label,
|
|
@@ -28,7 +29,7 @@ export function ControlledSelectableContent(props) {
|
|
|
28
29
|
}, [props.children]);
|
|
29
30
|
return (React.createElement("div", { className: "components-selectable-content" },
|
|
30
31
|
React.createElement("div", { className: "components-selectable-content-header" }, options.length > 0 && (React.createElement(Select, { onChange: onContentIdSelected, size: "small", className: "components-selectable-content-selector", "aria-label": props.selectAriaLabel, value: selectedContent.id, options: options, disabled: disabled }))),
|
|
31
|
-
React.createElement("div", { className: "components-selectable-content-wrapper" }, selectedContent
|
|
32
|
+
React.createElement("div", { className: "components-selectable-content-wrapper" }, selectedContent === null || selectedContent === void 0 ? void 0 : selectedContent.render())));
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
34
35
|
* An uncontrolled component that accepts a list of child components with ids and labels and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAyB9C;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAuC
|
|
1
|
+
{"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,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ACG;QACN,6BAAK,SAAS,EAAC,uCAAuC,IACnD,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAAE,CACtB,CACF,CACP,CAAC;AACJ,CAAC;AAaD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9D,KAAK,CAAC,wBAAwB,CAC/B,CAAC;IACF,MAAM,0BAA0B,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QAClE,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,oBAAC,2BAA2B,IAC1B,iBAAiB,EAAE,iBAAiB,EACpC,0BAA0B,EAAE,0BAA0B,EACtD,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAEvB,KAAK,CAAC,QAAQ,CACa,CAC/B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module SelectableContent\n */\n\nimport \"./SelectableContent.scss\";\nimport * as React from \"react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/**\n * A definition for content displayed in [[ControlledSelectableContent]] and\n * [[SelectableContent]] components.\n * @public\n */\nexport interface SelectableContentDefinition {\n id: string;\n label: string;\n render: () => React.ReactNode;\n}\n\n/**\n * [[ControlledSelectableContent]] component properties\n * @public\n */\nexport interface ControlledSelectableContentProps {\n selectedContentId: string;\n onSelectedContentIdChanged?: (contentId: string) => void;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * A fully-controlled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function ControlledSelectableContent(\n props: ControlledSelectableContentProps\n) {\n const { onSelectedContentIdChanged, disabled } = props;\n\n const onContentIdSelected = React.useCallback(\n (newValue: string): void => {\n onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);\n },\n [onSelectedContentIdChanged]\n );\n\n const selectedContent =\n props.children.find(\n (contentDef) => contentDef.id === props.selectedContentId\n ) ?? props.children[0];\n const options = React.useMemo(() => {\n return props.children.map((componentDef) => ({\n label: componentDef.label,\n value: componentDef.id,\n })) as SelectOption<string>[];\n }, [props.children]);\n\n return (\n <div className=\"components-selectable-content\">\n <div className=\"components-selectable-content-header\">\n {options.length > 0 && (\n <Select\n onChange={onContentIdSelected}\n size=\"small\"\n className=\"components-selectable-content-selector\"\n aria-label={props.selectAriaLabel}\n value={selectedContent.id}\n options={options}\n disabled={disabled}\n />\n )}\n </div>\n <div className=\"components-selectable-content-wrapper\">\n {selectedContent?.render()}\n </div>\n </div>\n );\n}\n\n/**\n * [[SelectableContent]] component properties\n * @public\n */\nexport interface SelectableContentProps {\n defaultSelectedContentId: string;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * An uncontrolled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function SelectableContent(props: SelectableContentProps) {\n const [selectedContentId, setSelectedContentId] = React.useState(\n props.defaultSelectedContentId\n );\n const onSelectedContentIdChanged = React.useCallback((id: string) => {\n setSelectedContentId(id);\n }, []);\n return (\n <ControlledSelectableContent\n selectedContentId={selectedContentId}\n onSelectedContentIdChanged={onSelectedContentIdChanged}\n selectAriaLabel={props.selectAriaLabel}\n disabled={props.disabled}\n >\n {props.children}\n </ControlledSelectableContent>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalToolbarComponent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/InternalToolbarComponent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAUtE,OAAO,EACL,SAAS,EAET,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalToolbarComponent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/InternalToolbarComponent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAUtE,OAAO,EACL,SAAS,EAET,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;kEAC8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wBAAsC,CAAC;AAE/E;;;GAGG;AACH,wBAAgB,8BAA8B,YAE7C;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY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EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,uCAM7B,CAAC;AAEH,gBAAgB;AAChB,wBAAgB,uBAAuB,2BAEtC"}
|
|
@@ -9,7 +9,7 @@ import "./Toolbar.scss";
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { ConditionalBooleanValue, ConditionalStringValue, ToolbarItemUtilities, } from "@itwin/appui-abstract";
|
|
12
|
-
import {
|
|
12
|
+
import { Badge, Icon, IconHelper } from "@itwin/core-react";
|
|
13
13
|
import { ToolbarButtonItem } from "./Item";
|
|
14
14
|
import { ToolbarItems } from "./Items";
|
|
15
15
|
import { ItemWrapper, useResizeObserverSingleDimension } from "./ItemWrapper";
|
|
@@ -19,9 +19,9 @@ import { PopupItem } from "./PopupItem";
|
|
|
19
19
|
import { PopupItemsPanel } from "./PopupItemsPanel";
|
|
20
20
|
import { PopupItemWithDrag } from "./PopupItemWithDrag";
|
|
21
21
|
import { Direction, DirectionHelpers, OrthogonalDirection, OrthogonalDirectionHelpers, } from "./utilities/Direction";
|
|
22
|
-
import { UiComponents } from "../UiComponents";
|
|
23
22
|
import { SvgPlaceholder } from "@itwin/itwinui-icons-react";
|
|
24
23
|
import { useConditionalSynchedItems } from "./useConditionalSynchedItems";
|
|
24
|
+
import { useTranslation } from "../useTranslation";
|
|
25
25
|
/**
|
|
26
26
|
* Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.
|
|
27
27
|
* @public
|
|
@@ -114,29 +114,27 @@ function CustomItem({ item, addGroupSeparator, }) {
|
|
|
114
114
|
// istanbul ignore next
|
|
115
115
|
React.createElement(Icon, { className: "icon", iconSpec: React.createElement(SvgPlaceholder, null) })), [item.icon, item.internalData]);
|
|
116
116
|
const isDisabled = React.useMemo(() => ConditionalBooleanValue.getValue(item.isDisabled), [item.isDisabled]);
|
|
117
|
-
const title = React.useMemo(() =>
|
|
118
|
-
|
|
119
|
-
item.
|
|
120
|
-
|
|
121
|
-
return (React.createElement(PopupItem, { key: item.id, itemId: item.id, icon: icon, isDisabled: isDisabled, title: title, panel: item.panelContentNode, hideIndicator: useDragInteraction, badge:
|
|
117
|
+
const title = React.useMemo(() => {
|
|
118
|
+
var _a;
|
|
119
|
+
/* istanbul ignore next */ return (_a = ConditionalStringValue.getValue(item.label)) !== null && _a !== void 0 ? _a : item.id;
|
|
120
|
+
}, [item.id, item.label]);
|
|
121
|
+
return (React.createElement(PopupItem, { key: item.id, itemId: item.id, icon: icon, isDisabled: isDisabled, title: title, panel: item.panelContentNode, hideIndicator: useDragInteraction, badge: React.createElement(Badge, { type: item.badgeType }), addGroupSeparator: addGroupSeparator, keepContentsMounted: item.keepContentsLoaded }));
|
|
122
122
|
}
|
|
123
123
|
/** @internal */
|
|
124
124
|
function GroupPopupItem({ item, addGroupSeparator, }) {
|
|
125
125
|
const { useDragInteraction } = useToolbarWithOverflowDirectionContext();
|
|
126
126
|
const title = ConditionalStringValue.getValue(item.label);
|
|
127
|
-
const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);
|
|
128
127
|
const panel = React.useMemo(() => React.createElement(PopupItemsPanel, { groupItem: item, activateOnPointerUp: false }), [item]);
|
|
129
128
|
// istanbul ignore next
|
|
130
129
|
const providerId = "providerId" in item ? item.providerId : undefined;
|
|
131
130
|
if (useDragInteraction) {
|
|
132
|
-
return (React.createElement(PopupItemWithDrag, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, groupItem: item, badge:
|
|
131
|
+
return (React.createElement(PopupItemWithDrag, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, groupItem: item, badge: React.createElement(Badge, { type: item.badgeType }), addGroupSeparator: addGroupSeparator }));
|
|
133
132
|
}
|
|
134
|
-
return (React.createElement(PopupItem, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, panel: panel, badge:
|
|
133
|
+
return (React.createElement(PopupItem, { key: item.id, itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, panel: panel, badge: React.createElement(Badge, { type: item.badgeType }), hideIndicator: useDragInteraction, addGroupSeparator: addGroupSeparator }));
|
|
135
134
|
}
|
|
136
135
|
/** @internal */
|
|
137
136
|
function ActionItem({ item, addGroupSeparator, }) {
|
|
138
137
|
const title = ConditionalStringValue.getValue(item.label);
|
|
139
|
-
const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);
|
|
140
138
|
const { onItemExecuted } = useToolbarWithOverflowDirectionContext();
|
|
141
139
|
const onExecute = React.useCallback(() => {
|
|
142
140
|
item.execute();
|
|
@@ -144,7 +142,7 @@ function ActionItem({ item, addGroupSeparator, }) {
|
|
|
144
142
|
}, [item, onItemExecuted]);
|
|
145
143
|
// istanbul ignore next
|
|
146
144
|
const providerId = "providerId" in item ? item.providerId : undefined;
|
|
147
|
-
return (React.createElement(ToolbarButtonItem, { itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, key: item.id, isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isActive: item.isActive, onClick: onExecute, badge:
|
|
145
|
+
return (React.createElement(ToolbarButtonItem, { itemId: item.id, providerId: providerId, itemPriority: item.itemPriority, groupPriority: item.groupPriority, key: item.id, isDisabled: ConditionalBooleanValue.getValue(item.isDisabled), title: title, icon: IconHelper.getIconReactNode(item.icon, item.internalData), isActive: item.isActive, onClick: onExecute, badge: React.createElement(Badge, { type: item.badgeType }), addGroupSeparator: addGroupSeparator }));
|
|
148
146
|
}
|
|
149
147
|
/** @internal */
|
|
150
148
|
export function ToolbarItemComponent({ item, addGroupSeparator, }) {
|
|
@@ -198,15 +196,16 @@ function filterHiddenItems(items) {
|
|
|
198
196
|
* @internal
|
|
199
197
|
*/
|
|
200
198
|
export function InternalToolbarComponent(props) {
|
|
199
|
+
var _a, _b;
|
|
201
200
|
const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;
|
|
202
201
|
const useDragInteraction = !!props.useDragInteraction;
|
|
203
202
|
const panelAlignment = props.panelAlignment
|
|
204
203
|
? props.panelAlignment
|
|
205
204
|
: ToolbarPanelAlignment.Start;
|
|
206
205
|
const useHeight = expandsTo === Direction.Right || expandsTo === Direction.Left;
|
|
206
|
+
const { translate } = useTranslation();
|
|
207
207
|
const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);
|
|
208
208
|
const [popupPanelCount, setPopupPanelCount] = React.useState(0);
|
|
209
|
-
const overflowTitle = React.useRef(UiComponents.translate("toolbar.overflow"));
|
|
210
209
|
const isMounted = React.useRef(false);
|
|
211
210
|
React.useEffect(() => {
|
|
212
211
|
isMounted.current = true;
|
|
@@ -279,7 +278,7 @@ export function InternalToolbarComponent(props) {
|
|
|
279
278
|
: [];
|
|
280
279
|
const direction = getToolbarDirection(expandsTo);
|
|
281
280
|
const overflowExpandsTo = (typeof props.enableOverflow !== "boolean" &&
|
|
282
|
-
props.enableOverflow
|
|
281
|
+
((_a = props.enableOverflow) === null || _a === void 0 ? void 0 : _a.overflowExpandsTo)) ||
|
|
283
282
|
Direction.Right;
|
|
284
283
|
const addOverflowButton = React.useCallback((atStart) => {
|
|
285
284
|
const overflowItems = !!atStart
|
|
@@ -297,15 +296,16 @@ export function InternalToolbarComponent(props) {
|
|
|
297
296
|
useHeight,
|
|
298
297
|
onResize: () => { },
|
|
299
298
|
} }, React.createElement(ItemWrapper, { className: getItemWrapperClass(child) }, child)));
|
|
300
|
-
}))), title:
|
|
299
|
+
}))), title: translate("toolbar.overflow") })));
|
|
301
300
|
}, [
|
|
301
|
+
overflowPanelItems,
|
|
302
|
+
useHeight,
|
|
303
|
+
handleOverflowResize,
|
|
304
|
+
expandsTo,
|
|
302
305
|
handleClick,
|
|
303
306
|
handleClose,
|
|
304
|
-
handleOverflowResize,
|
|
305
307
|
isOverflowPanelOpen,
|
|
306
|
-
|
|
307
|
-
overflowPanelItems,
|
|
308
|
-
useHeight,
|
|
308
|
+
translate,
|
|
309
309
|
]);
|
|
310
310
|
const className = classnames("components-toolbar-overflow-sizer", OrthogonalDirectionHelpers.getCssClassName(direction), props.className);
|
|
311
311
|
const showOverflowAtStart = direction === OrthogonalDirection.Horizontal &&
|
|
@@ -318,9 +318,7 @@ export function InternalToolbarComponent(props) {
|
|
|
318
318
|
overflowExpandsTo,
|
|
319
319
|
panelAlignment,
|
|
320
320
|
useDragInteraction,
|
|
321
|
-
toolbarOpacitySetting:
|
|
322
|
-
? props.toolbarOpacitySetting
|
|
323
|
-
: ToolbarOpacitySetting.Proximity,
|
|
321
|
+
toolbarOpacitySetting: (_b = props.toolbarOpacitySetting) !== null && _b !== void 0 ? _b : ToolbarOpacitySetting.Proximity,
|
|
324
322
|
overflowDirection: direction === OrthogonalDirection.Horizontal
|
|
325
323
|
? OrthogonalDirection.Vertical
|
|
326
324
|
: OrthogonalDirection.Horizontal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalToolbarComponent.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/InternalToolbarComponent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KA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G,KAAK,CAAC,aAAa,CAAyB;IAC5E,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,GAAG,EAAE;QACb,uCAAuC;IACzC,CAAC;CACF,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,UAAU,uBAAuB;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA+B;IAC5D,KAAK,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE;QACzB,4CAA4C;QAC5C,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;KACzC;IACD,OAAO,GAAqB,CAAC;AAC/B,CAAC;AAED,SAAS,GAAG,CAAC,IAAmC,EAAE,KAAwB;IACxE,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,uBAAuB;IACvB,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;KAC3B;IACD,OAAO,IAAI,CAAC;AACd,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 Toolbar\n */\n\nimport \"./Toolbar.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n OnItemExecutedFunc,\n} from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport { BadgeUtilities, Icon, IconHelper } from \"@itwin/core-react\";\nimport { ToolbarButtonItem } from \"./Item\";\nimport { ToolbarItems } from \"./Items\";\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\nimport { ToolbarOverflowButton } from \"./Overflow\";\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\nimport { PopupItem } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\nimport {\n Direction,\n DirectionHelpers,\n OrthogonalDirection,\n OrthogonalDirectionHelpers,\n} from \"./utilities/Direction\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgPlaceholder } from \"@itwin/itwinui-icons-react\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport { useConditionalSynchedItems } from \"./useConditionalSynchedItems\";\n\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\n * @public\n * @deprecated in 4.0. Use [ToolbarCustomItem]($appui-react) instead.\n */\nexport interface CustomToolbarItem extends CustomButtonDefinition {\n /** defines the content to display in popup panel */\n panelContentNode?: React.ReactNode;\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\n * content node is unmounted each time the popup is closed. */\n keepContentsLoaded?: boolean;\n}\n\n/**\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\n * @public\n */\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\n\n/**\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\n * @public\n */\nexport function useToolbarPopupAutoHideContext() {\n return React.useContext(ToolbarPopupAutoHideContext);\n}\n\n/** Describes toolbar item.\n * @public\n * @deprecated in 4.0. Use [ToolbarItem]($appui-react) instead.\n */\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem; // eslint-disable-line deprecation/deprecation\n\n/** CustomToolbarItem type guard.\n * @internal\n */\nexport function isCustomToolbarItem(\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem\n // eslint-disable-next-line deprecation/deprecation\n): item is CustomToolbarItem {\n return !!(item as CustomToolbarItem).isCustom && \"panelContentNode\" in item; // eslint-disable-line deprecation/deprecation\n}\n\n/** @internal */\nexport const getToolbarDirection = (\n expandsTo: Direction\n): OrthogonalDirection => {\n const orthogonalDirection =\n DirectionHelpers.getOrthogonalDirection(expandsTo);\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\n};\n\n/** Available alignment modes of [[Toolbar]] panels.\n * @public\n */\nexport enum ToolbarPanelAlignment {\n Start,\n End,\n}\n\n/** Enumeration of Toolbar Opacity setting.\n * @public\n */\nexport enum ToolbarOpacitySetting {\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\n Defaults,\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\n Proximity,\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\n Transparent,\n}\n\n/** Helpers for [[ToolbarPanelAlignment]].\n * @internal\n */\nexport class ToolbarPanelAlignmentHelpers {\n /** Class name of [[ToolbarPanelAlignment.Start]] */\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\n /** Class name of [[ToolbarPanelAlignment.End]] */\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\n\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\n switch (panelAlignment) {\n case ToolbarPanelAlignment.Start:\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\n case ToolbarPanelAlignment.End:\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\n }\n }\n}\n\n/** @internal */\nexport interface ToolbarOverflowContextProps {\n readonly expandsTo: Direction;\n readonly direction: OrthogonalDirection;\n readonly overflowExpandsTo: Direction;\n readonly overflowDirection: OrthogonalDirection;\n readonly panelAlignment: ToolbarPanelAlignment;\n readonly useDragInteraction: boolean;\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\n readonly openPopupCount: number;\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\n readonly overflowDisplayActive: boolean;\n readonly onItemExecuted: OnItemExecutedFunc;\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Context used by Toolbar component to provide Direction to child components.\n * @internal\n */\nexport const ToolbarWithOverflowDirectionContext =\n React.createContext<ToolbarOverflowContextProps>({\n expandsTo: Direction.Bottom,\n direction: OrthogonalDirection.Horizontal,\n overflowExpandsTo: Direction.Right,\n overflowDirection: OrthogonalDirection.Vertical,\n panelAlignment: ToolbarPanelAlignment.Start,\n useDragInteraction: false,\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\n openPopupCount: 0,\n onPopupPanelOpenClose: /* istanbul ignore next */ (\n _isOpening: boolean\n ) => {},\n overflowDisplayActive: false,\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\n });\n\n/** @internal */\nfunction CustomItem({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: CustomToolbarItem;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const icon = React.useMemo(\n () =>\n (item.icon &&\n IconHelper.getIconReactNode(item.icon, item.internalData)) || (\n // istanbul ignore next\n <Icon className=\"icon\" iconSpec={<SvgPlaceholder />} />\n ),\n [item.icon, item.internalData]\n );\n const isDisabled = React.useMemo(\n () => ConditionalBooleanValue.getValue(item.isDisabled),\n [item.isDisabled]\n );\n const title = React.useMemo(\n () =>\n /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ??\n item.id,\n [item.id, item.label]\n );\n const badge = React.useMemo(\n () => BadgeUtilities.getComponentForBadgeType(item.badgeType),\n [item.badgeType]\n );\n\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n icon={icon}\n isDisabled={isDisabled}\n title={title}\n panel={item.panelContentNode}\n hideIndicator={useDragInteraction}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n keepContentsMounted={item.keepContentsLoaded}\n />\n );\n}\n\n/** @internal */\nfunction GroupPopupItem({\n item,\n addGroupSeparator,\n}: {\n item: GroupButton;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const title = ConditionalStringValue.getValue(item.label)!;\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\n const panel = React.useMemo(\n () => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />,\n [item]\n );\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n if (useDragInteraction) {\n return (\n <PopupItemWithDrag\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n groupItem={item}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n />\n );\n }\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n panel={panel}\n badge={badge}\n hideIndicator={useDragInteraction}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nfunction ActionItem({\n item,\n addGroupSeparator,\n}: {\n item: ActionButton;\n addGroupSeparator: boolean;\n}) {\n const title = ConditionalStringValue.getValue(item.label)!;\n const badge = BadgeUtilities.getComponentForBadgeType(item.badgeType);\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\n const onExecute = React.useCallback(() => {\n item.execute();\n onItemExecuted(item);\n }, [item, onItemExecuted]);\n\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n return (\n <ToolbarButtonItem\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n key={item.id}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isActive={item.isActive}\n onClick={onExecute}\n badge={badge}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nexport function ToolbarItemComponent({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem;\n addGroupSeparator: boolean;\n}) {\n if (ToolbarItemUtilities.isGroupButton(item)) {\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else if (isCustomToolbarItem(item)) {\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(item)) {\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\n }\n }\n // istanbul ignore next\n return null;\n}\n\n/** @internal */\nexport function useToolbarWithOverflowDirectionContext() {\n return React.useContext(ToolbarWithOverflowDirectionContext);\n}\n\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\n return <>{p.children}</>;\n}\n\nfunction getItemWrapperClass(child: React.ReactNode) {\n // istanbul ignore else\n if (React.isValidElement(child)) {\n if (child.props && child.props.addGroupSeparator)\n return \"components-toolbar-button-add-gap-before\";\n }\n return undefined;\n}\n\n/**\n * Recursively looks through all items and groups and removes the hidden items\n * from the working object.\n * @param items List of object to analyse\n * @returns Copy of the provided items, minus the hidden ones.\n */\nfunction filterHiddenItems<T extends CommonToolbarItem>(\n items: ReadonlyArray<T>\n): T[] {\n return items\n .filter((item) => !ConditionalBooleanValue.getValue(item.isHidden))\n .map((i) => {\n if (\"items\" in i) {\n return { ...i, items: filterHiddenItems(i.items) };\n }\n return i;\n });\n}\n\n/** Properties of [[ToolbarComponent]] component.\n * @internal\n */\nexport interface InternalToolbarComponentProps\n extends CommonProps,\n NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes if items that do not fit available space should move to an expandable panel. Defaults to: false */\n enableOverflow?:\n | boolean\n | {\n /** Describes to which direction the overflow popup panels are expanded if overflow is enabled. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n };\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: CommonToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n /** SyncEvents on which the conditional should listen to */\n syncUiEvent?: BeEvent<(args: { eventIds: Set<string> }) => void>;\n}\n\n/** Component that displays toolbar items.\n * @internal\n */\nexport function InternalToolbarComponent(props: InternalToolbarComponentProps) {\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\n const useDragInteraction = !!props.useDragInteraction;\n const panelAlignment = props.panelAlignment\n ? props.panelAlignment\n : ToolbarPanelAlignment.Start;\n const useHeight =\n expandsTo === Direction.Right || expandsTo === Direction.Left;\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\n const overflowTitle = React.useRef(\n UiComponents.translate(\"toolbar.overflow\")\n );\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\n // use setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\n setTimeout(() => {\n // istanbul ignore next\n if (!isMounted.current) return;\n setPopupPanelCount((prev) => {\n /* istanbul ignore next */\n const nextCount = isOpening ? prev + 1 : prev - 1;\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\n });\n });\n }, []);\n\n const width = React.useRef<number | undefined>(undefined);\n\n const eventSynchedItems = useConditionalSynchedItems(\n props.items,\n props.syncUiEvent\n );\n\n const availableNodes = React.useMemo<React.ReactNode>(() => {\n const filteredItems = filterHiddenItems(eventSynchedItems);\n return filteredItems.map((item, index) => {\n let addGroupSeparator = false;\n if (index > 0)\n addGroupSeparator =\n item.groupPriority !== filteredItems[index - 1].groupPriority;\n return (\n <ToolbarItemComponent\n key={item.id}\n item={item}\n addGroupSeparator={!!addGroupSeparator}\n />\n );\n });\n }, [eventSynchedItems]);\n /* overflowItemKeys - keys of items to show in overflow panel\n * handleContainerResize - handler called when container <div> is resized.\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\n * handleEntryResize - handler called when determining size of each item/button. */\n const [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\n // handler called by ResizeObserver\n const handleResize = React.useCallback(\n (w: number) => {\n width.current = w;\n width.current !== undefined && handleContainerResize(width.current);\n },\n [handleContainerResize]\n );\n const resizeObserverRef = useResizeObserverSingleDimension(\n handleResize,\n useHeight\n );\n const handleClick = React.useCallback(() => {\n setIsOverflowPanelOpen((prev) => !prev);\n }, []);\n // istanbul ignore next - NEEDSWORK add complete tests\n const handleClose = React.useCallback(() => {\n setIsOverflowPanelOpen(false);\n }, []);\n\n // Not setting the ref will disable overflow management, but will keep proper refresh of items.\n const ref = props.enableOverflow ? resizeObserverRef : undefined;\n const availableItems = React.Children.toArray(availableNodes);\n const displayedItems = availableItems.reduce<\n Array<[string, React.ReactNode]>\n >((acc, child, index) => {\n const key = getChildKey(child, index);\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\n acc.push([key, child]);\n }\n return acc;\n }, []);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const overflowPanelItems = overflowItemKeys\n ? availableItems.reduce<Array<[string, React.ReactNode]>>(\n (acc, child, index) => {\n const key = getChildKey(child, index);\n if (overflowItemKeys.indexOf(key) >= 0) {\n acc.push([key, child]);\n }\n return acc;\n },\n []\n )\n : [];\n\n const direction = getToolbarDirection(expandsTo);\n const overflowExpandsTo =\n (typeof props.enableOverflow !== \"boolean\" &&\n props.enableOverflow?.overflowExpandsTo) ||\n Direction.Right;\n const addOverflowButton = React.useCallback(\n (atStart: boolean) => {\n const overflowItems = !!atStart\n ? overflowPanelItems.reverse()\n : overflowPanelItems;\n return (\n <ToolbarItemContext.Provider\n value={{\n hasOverflow: false,\n useHeight,\n onResize: handleOverflowResize,\n }}\n >\n <ToolbarOverflowButton\n expandsTo={expandsTo}\n onClick={handleClick}\n onClose={handleClose}\n open={overflowItems.length > 0 && isOverflowPanelOpen}\n panelNode={\n <ToolbarOverflowPanel>\n <OverflowItemsContainer>\n {overflowItems.map(([key, child]) => {\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: true,\n useHeight,\n onResize: () => {},\n }}\n >\n {\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n }\n </ToolbarItemContext.Provider>\n );\n })}\n </OverflowItemsContainer>\n </ToolbarOverflowPanel>\n }\n title={overflowTitle.current}\n />\n </ToolbarItemContext.Provider>\n );\n },\n [\n handleClick,\n handleClose,\n handleOverflowResize,\n isOverflowPanelOpen,\n expandsTo,\n overflowPanelItems,\n useHeight,\n ]\n );\n\n const className = classnames(\n \"components-toolbar-overflow-sizer\",\n OrthogonalDirectionHelpers.getCssClassName(direction),\n props.className\n );\n\n const showOverflowAtStart =\n direction === OrthogonalDirection.Horizontal &&\n panelAlignment === ToolbarPanelAlignment.End;\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\n size of the item. */\n return (\n <ToolbarWithOverflowDirectionContext.Provider\n value={{\n expandsTo,\n direction,\n overflowExpandsTo,\n panelAlignment,\n useDragInteraction,\n toolbarOpacitySetting:\n undefined !== props.toolbarOpacitySetting\n ? props.toolbarOpacitySetting\n : ToolbarOpacitySetting.Proximity,\n overflowDirection:\n direction === OrthogonalDirection.Horizontal\n ? OrthogonalDirection.Vertical\n : OrthogonalDirection.Horizontal,\n openPopupCount: popupPanelCount,\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\n overflowDisplayActive:\n overflowPanelItems.length > 0 && isOverflowPanelOpen,\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => {},\n onKeyDown: props.onKeyDown\n ? props.onKeyDown\n : /* istanbul ignore next */ (_e: React.KeyboardEvent) => {},\n }}\n >\n {availableItems.length > 0 && (\n <div\n className={className}\n ref={ref}\n style={props.style}\n onKeyDown={props.onKeyDown}\n role=\"presentation\"\n >\n <ToolbarItems className=\"components-items\" direction={direction}>\n {props.enableOverflow &&\n (!overflowItemKeys || overflowItemKeys.length > 0) &&\n showOverflowAtStart &&\n addOverflowButton(true)}\n {displayedItems.map(([key, child]) => {\n const onEntryResize = handleEntryResize(key);\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: false,\n useHeight,\n onResize: onEntryResize,\n }}\n >\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n </ToolbarItemContext.Provider>\n );\n })}\n {props.enableOverflow &&\n (!overflowItemKeys || overflowItemKeys.length > 0) &&\n !showOverflowAtStart &&\n addOverflowButton(false)}\n </ToolbarItems>\n </div>\n )}\n </ToolbarWithOverflowDirectionContext.Provider>\n );\n}\n\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\n * @internal\n */\nfunction getChildKey(child: React.ReactNode, index: number) {\n // istanbul ignore else\n if (React.isValidElement(child) && child.key !== null) {\n return child.key.toString();\n }\n // istanbul ignore next\n return index.toString();\n}\n\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\n * @internal\n */\nfunction determineOverflowItems(\n size: number,\n entries: ReadonlyArray<readonly [string, number]>,\n overflowButtonSize: number,\n overflowButtonAtStart: boolean\n): string[] {\n let toolbarSize = 0;\n const buttonPadding = 2;\n if (overflowButtonAtStart && entries.length > 0) {\n let i = entries.length - 1;\n for (; i >= 0; i--) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n if (i >= 0) {\n let j = i + 1;\n for (; j < entries.length; j++) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(0, j).map((e) => e[0]);\n } else {\n return [];\n }\n } else {\n let i = 0;\n for (; i < entries.length; i++) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n let j = i;\n for (; j > 0; j--) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(j).map((e) => e[0]);\n }\n}\n\n/** Hook that returns a list of overflowItemKeys availableItems.\n * @internal\n */\nfunction useOverflow(\n availableItems: React.ReactNode,\n overflowButtonAtStart: boolean\n): [\n ReadonlyArray<string> | undefined,\n (size: number) => void,\n (size: number) => void,\n (key: string) => (size: number) => void\n] {\n const [overflowItemKeys, setOverflown] =\n React.useState<ReadonlyArray<string>>();\n const itemSizes = React.useRef(new Map<string, number | undefined>());\n const size = React.useRef<number | undefined>(undefined);\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\n\n const calculateOverflow = React.useCallback(() => {\n const sizes = verifiedMapEntries(itemSizes.current);\n if (\n size.current === undefined ||\n sizes === undefined ||\n overflowButtonSize.current === undefined\n ) {\n setOverflown(undefined);\n return;\n }\n\n // Calculate overflow.\n const newOverflown = determineOverflowItems(\n size.current,\n [...sizes.entries()],\n overflowButtonSize.current,\n overflowButtonAtStart\n );\n setOverflown((prevOverflown) => {\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\n });\n }, [overflowButtonAtStart]);\n\n React.useLayoutEffect(() => {\n const newEntryWidths = new Map<string, number | undefined>();\n const array = React.Children.toArray(availableItems);\n for (let i = 0; i < array.length; i++) {\n const child = array[i];\n const key = getChildKey(child, i);\n const lastW = itemSizes.current.get(key);\n newEntryWidths.set(key, lastW);\n }\n itemSizes.current = newEntryWidths;\n calculateOverflow();\n }, [availableItems, calculateOverflow]);\n\n const handleContainerResize = React.useCallback(\n (w: number) => {\n const calculate = size.current !== w;\n size.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleOverflowResize = React.useCallback(\n (w: number) => {\n const calculate = overflowButtonSize.current !== w;\n overflowButtonSize.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleEntryResize = React.useCallback(\n (key: string) => (w: number) => {\n const oldW = itemSizes.current.get(key);\n if (oldW !== w) {\n itemSizes.current.set(key, w);\n calculateOverflow();\n }\n },\n [calculateOverflow]\n );\n\n return [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ];\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport interface ToolbarItemContextArgs {\n readonly hasOverflow: boolean;\n readonly useHeight: boolean;\n readonly onResize: (w: number) => void;\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>({\n hasOverflow: false,\n useHeight: false,\n onResize: () => {\n // intentionally do nothing by default.\n },\n});\n\n/** @internal */\nexport function useToolItemEntryContext() {\n return React.useContext(ToolbarItemContext);\n}\n\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\n for (const [, val] of map) {\n // istanbul ignore next during unit testing\n if (val === undefined) return undefined;\n }\n return map as Map<string, T>;\n}\n\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\n if (!prev) return false;\n // istanbul ignore next\n if (prev.length !== value.length) return false;\n for (let i = 0; i < prev.length; i++) {\n const p = prev[i];\n const v = value[i];\n // istanbul ignore next\n if (p !== v) return false;\n }\n return true;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalToolbarComponent.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/InternalToolbarComponent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,0B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,CAAC,CAAC,CAAC,CAAC;QACnB,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;KAC3B;IACD,OAAO,IAAI,CAAC;AACd,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 Toolbar\n */\n\nimport \"./Toolbar.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n OnItemExecutedFunc,\n} from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport { Badge, Icon, IconHelper } from \"@itwin/core-react\";\nimport { ToolbarButtonItem } from \"./Item\";\nimport { ToolbarItems } from \"./Items\";\nimport { ItemWrapper, useResizeObserverSingleDimension } from \"./ItemWrapper\";\nimport { ToolbarOverflowButton } from \"./Overflow\";\nimport { ToolbarOverflowPanel } from \"./OverflowPanel\";\nimport { PopupItem } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport { PopupItemWithDrag } from \"./PopupItemWithDrag\";\nimport {\n Direction,\n DirectionHelpers,\n OrthogonalDirection,\n OrthogonalDirectionHelpers,\n} from \"./utilities/Direction\";\nimport { SvgPlaceholder } from \"@itwin/itwinui-icons-react\";\nimport type { BeEvent } from \"@itwin/core-bentley\";\nimport { useConditionalSynchedItems } from \"./useConditionalSynchedItems\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Describes the data needed to insert a custom `React` button into an ToolbarWithOverflow.\n * @public\n * @deprecated in 4.0. Use [ToolbarCustomItem]($appui-react) instead.\n */\nexport interface CustomToolbarItem extends CustomButtonDefinition {\n /** defines the content to display in popup panel */\n panelContentNode?: React.ReactNode;\n /** If true the popup panel is mounted once and unmounted when button is unmounted. If false the\n * content node is unmounted each time the popup is closed. */\n keepContentsLoaded?: boolean;\n}\n\n/**\n * Context used by Toolbar items to know if popup panel should be hidden - via AutoHide.\n * @public\n */\nexport const ToolbarPopupAutoHideContext = React.createContext<boolean>(false);\n\n/**\n * React hook used to retrieve the ToolbarPopupAutoHideContext.\n * @public\n */\nexport function useToolbarPopupAutoHideContext() {\n return React.useContext(ToolbarPopupAutoHideContext);\n}\n\n/** Describes toolbar item.\n * @public\n * @deprecated in 4.0. Use [ToolbarItem]($appui-react) instead.\n */\nexport type ToolbarItem = ActionButton | GroupButton | CustomToolbarItem; // eslint-disable-line deprecation/deprecation\n\n/** CustomToolbarItem type guard.\n * @internal\n */\nexport function isCustomToolbarItem(\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem\n // eslint-disable-next-line deprecation/deprecation\n): item is CustomToolbarItem {\n return !!(item as CustomToolbarItem).isCustom && \"panelContentNode\" in item; // eslint-disable-line deprecation/deprecation\n}\n\n/** @internal */\nexport const getToolbarDirection = (\n expandsTo: Direction\n): OrthogonalDirection => {\n const orthogonalDirection =\n DirectionHelpers.getOrthogonalDirection(expandsTo);\n return OrthogonalDirectionHelpers.inverse(orthogonalDirection);\n};\n\n/** Available alignment modes of [[Toolbar]] panels.\n * @public\n */\nexport enum ToolbarPanelAlignment {\n Start,\n End,\n}\n\n/** Enumeration of Toolbar Opacity setting.\n * @public\n */\nexport enum ToolbarOpacitySetting {\n /** Use the default background, box-shadow opacity and backdrop-filter blur */\n Defaults,\n /** Alter the opacity from transparent to the defaults based on mouse proximity */\n Proximity,\n /** Use a transparent background, box-shadow opacity and backdrop-filter blur */\n Transparent,\n}\n\n/** Helpers for [[ToolbarPanelAlignment]].\n * @internal\n */\nexport class ToolbarPanelAlignmentHelpers {\n /** Class name of [[ToolbarPanelAlignment.Start]] */\n public static readonly START_CLASS_NAME = \"components-panel-alignment-start\";\n /** Class name of [[ToolbarPanelAlignment.End]] */\n public static readonly END_CLASS_NAME = \"components-panel-alignment-end\";\n\n /** @returns Class name of specified [[ToolbarPanelAlignment]] */\n public static getCssClassName(panelAlignment: ToolbarPanelAlignment): string {\n switch (panelAlignment) {\n case ToolbarPanelAlignment.Start:\n return ToolbarPanelAlignmentHelpers.START_CLASS_NAME;\n case ToolbarPanelAlignment.End:\n return ToolbarPanelAlignmentHelpers.END_CLASS_NAME;\n }\n }\n}\n\n/** @internal */\nexport interface ToolbarOverflowContextProps {\n readonly expandsTo: Direction;\n readonly direction: OrthogonalDirection;\n readonly overflowExpandsTo: Direction;\n readonly overflowDirection: OrthogonalDirection;\n readonly panelAlignment: ToolbarPanelAlignment;\n readonly useDragInteraction: boolean;\n readonly toolbarOpacitySetting: ToolbarOpacitySetting;\n readonly openPopupCount: number;\n readonly onPopupPanelOpenClose: (isOpening: boolean) => void;\n readonly overflowDisplayActive: boolean;\n readonly onItemExecuted: OnItemExecutedFunc;\n readonly onKeyDown: (e: React.KeyboardEvent) => void;\n}\n\n/**\n * Context used by Toolbar component to provide Direction to child components.\n * @internal\n */\nexport const ToolbarWithOverflowDirectionContext =\n React.createContext<ToolbarOverflowContextProps>({\n expandsTo: Direction.Bottom,\n direction: OrthogonalDirection.Horizontal,\n overflowExpandsTo: Direction.Right,\n overflowDirection: OrthogonalDirection.Vertical,\n panelAlignment: ToolbarPanelAlignment.Start,\n useDragInteraction: false,\n toolbarOpacitySetting: ToolbarOpacitySetting.Proximity,\n openPopupCount: 0,\n onPopupPanelOpenClose: /* istanbul ignore next */ (\n _isOpening: boolean\n ) => {},\n overflowDisplayActive: false,\n onItemExecuted: /* istanbul ignore next */ (_item: any) => void {},\n onKeyDown: /* istanbul ignore next */ (_e: React.KeyboardEvent) => void {},\n });\n\n/** @internal */\nfunction CustomItem({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: CustomToolbarItem;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const icon = React.useMemo(\n () =>\n (item.icon &&\n IconHelper.getIconReactNode(item.icon, item.internalData)) || (\n // istanbul ignore next\n <Icon className=\"icon\" iconSpec={<SvgPlaceholder />} />\n ),\n [item.icon, item.internalData]\n );\n const isDisabled = React.useMemo(\n () => ConditionalBooleanValue.getValue(item.isDisabled),\n [item.isDisabled]\n );\n const title = React.useMemo(\n () =>\n /* istanbul ignore next */ ConditionalStringValue.getValue(item.label) ??\n item.id,\n [item.id, item.label]\n );\n\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n icon={icon}\n isDisabled={isDisabled}\n title={title}\n panel={item.panelContentNode}\n hideIndicator={useDragInteraction}\n badge={<Badge type={item.badgeType} />}\n addGroupSeparator={addGroupSeparator}\n keepContentsMounted={item.keepContentsLoaded}\n />\n );\n}\n\n/** @internal */\nfunction GroupPopupItem({\n item,\n addGroupSeparator,\n}: {\n item: GroupButton;\n addGroupSeparator: boolean;\n}) {\n const { useDragInteraction } = useToolbarWithOverflowDirectionContext();\n const title = ConditionalStringValue.getValue(item.label)!;\n const panel = React.useMemo(\n () => <PopupItemsPanel groupItem={item} activateOnPointerUp={false} />,\n [item]\n );\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n if (useDragInteraction) {\n return (\n <PopupItemWithDrag\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n groupItem={item}\n badge={<Badge type={item.badgeType} />}\n addGroupSeparator={addGroupSeparator}\n />\n );\n }\n return (\n <PopupItem\n key={item.id}\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n panel={panel}\n badge={<Badge type={item.badgeType} />}\n hideIndicator={useDragInteraction}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nfunction ActionItem({\n item,\n addGroupSeparator,\n}: {\n item: ActionButton;\n addGroupSeparator: boolean;\n}) {\n const title = ConditionalStringValue.getValue(item.label)!;\n const { onItemExecuted } = useToolbarWithOverflowDirectionContext();\n const onExecute = React.useCallback(() => {\n item.execute();\n onItemExecuted(item);\n }, [item, onItemExecuted]);\n\n // istanbul ignore next\n const providerId =\n \"providerId\" in item ? (item.providerId as string) : undefined;\n return (\n <ToolbarButtonItem\n itemId={item.id}\n providerId={providerId}\n itemPriority={item.itemPriority}\n groupPriority={item.groupPriority}\n key={item.id}\n isDisabled={ConditionalBooleanValue.getValue(item.isDisabled)}\n title={title}\n icon={IconHelper.getIconReactNode(item.icon, item.internalData)}\n isActive={item.isActive}\n onClick={onExecute}\n badge={<Badge type={item.badgeType} />}\n addGroupSeparator={addGroupSeparator}\n />\n );\n}\n\n/** @internal */\nexport function ToolbarItemComponent({\n item,\n addGroupSeparator,\n}: {\n // eslint-disable-next-line deprecation/deprecation\n item: ToolbarItem;\n addGroupSeparator: boolean;\n}) {\n if (ToolbarItemUtilities.isGroupButton(item)) {\n return <GroupPopupItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else if (isCustomToolbarItem(item)) {\n return <CustomItem item={item} addGroupSeparator={addGroupSeparator} />;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(item)) {\n return <ActionItem item={item} addGroupSeparator={addGroupSeparator} />;\n }\n }\n // istanbul ignore next\n return null;\n}\n\n/** @internal */\nexport function useToolbarWithOverflowDirectionContext() {\n return React.useContext(ToolbarWithOverflowDirectionContext);\n}\n\nfunction OverflowItemsContainer(p: { children: React.ReactNode }) {\n return <>{p.children}</>;\n}\n\nfunction getItemWrapperClass(child: React.ReactNode) {\n // istanbul ignore else\n if (React.isValidElement(child)) {\n if (child.props && child.props.addGroupSeparator)\n return \"components-toolbar-button-add-gap-before\";\n }\n return undefined;\n}\n\n/**\n * Recursively looks through all items and groups and removes the hidden items\n * from the working object.\n * @param items List of object to analyse\n * @returns Copy of the provided items, minus the hidden ones.\n */\nfunction filterHiddenItems<T extends CommonToolbarItem>(\n items: ReadonlyArray<T>\n): T[] {\n return items\n .filter((item) => !ConditionalBooleanValue.getValue(item.isHidden))\n .map((i) => {\n if (\"items\" in i) {\n return { ...i, items: filterHiddenItems(i.items) };\n }\n return i;\n });\n}\n\n/** Properties of [[ToolbarComponent]] component.\n * @internal\n */\nexport interface InternalToolbarComponentProps\n extends CommonProps,\n NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes if items that do not fit available space should move to an expandable panel. Defaults to: false */\n enableOverflow?:\n | boolean\n | {\n /** Describes to which direction the overflow popup panels are expanded if overflow is enabled. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n };\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: CommonToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n /** SyncEvents on which the conditional should listen to */\n syncUiEvent?: BeEvent<(args: { eventIds: Set<string> }) => void>;\n}\n\n/** Component that displays toolbar items.\n * @internal\n */\nexport function InternalToolbarComponent(props: InternalToolbarComponentProps) {\n const expandsTo = props.expandsTo ? props.expandsTo : Direction.Bottom;\n const useDragInteraction = !!props.useDragInteraction;\n const panelAlignment = props.panelAlignment\n ? props.panelAlignment\n : ToolbarPanelAlignment.Start;\n const useHeight =\n expandsTo === Direction.Right || expandsTo === Direction.Left;\n const { translate } = useTranslation();\n const [isOverflowPanelOpen, setIsOverflowPanelOpen] = React.useState(false);\n const [popupPanelCount, setPopupPanelCount] = React.useState(0);\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n const handlePopupPanelOpenClose = React.useCallback((isOpening: boolean) => {\n // use setTimeout to avoid warning about setting state in ToolbarWithOverflow from render method of PopupItem/PopupItemWithDrag\n setTimeout(() => {\n // istanbul ignore next\n if (!isMounted.current) return;\n setPopupPanelCount((prev) => {\n /* istanbul ignore next */\n const nextCount = isOpening ? prev + 1 : prev - 1;\n return nextCount < 0 ? /* istanbul ignore next */ 0 : nextCount;\n });\n });\n }, []);\n\n const width = React.useRef<number | undefined>(undefined);\n\n const eventSynchedItems = useConditionalSynchedItems(\n props.items,\n props.syncUiEvent\n );\n\n const availableNodes = React.useMemo<React.ReactNode>(() => {\n const filteredItems = filterHiddenItems(eventSynchedItems);\n return filteredItems.map((item, index) => {\n let addGroupSeparator = false;\n if (index > 0)\n addGroupSeparator =\n item.groupPriority !== filteredItems[index - 1].groupPriority;\n return (\n <ToolbarItemComponent\n key={item.id}\n item={item}\n addGroupSeparator={!!addGroupSeparator}\n />\n );\n });\n }, [eventSynchedItems]);\n /* overflowItemKeys - keys of items to show in overflow panel\n * handleContainerResize - handler called when container <div> is resized.\n * handleOverflowResize - handler called when determining size of overflow indicator/button.\n * handleEntryResize - handler called when determining size of each item/button. */\n const [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ] = useOverflow(availableNodes, panelAlignment === ToolbarPanelAlignment.End);\n // handler called by ResizeObserver\n const handleResize = React.useCallback(\n (w: number) => {\n width.current = w;\n width.current !== undefined && handleContainerResize(width.current);\n },\n [handleContainerResize]\n );\n const resizeObserverRef = useResizeObserverSingleDimension(\n handleResize,\n useHeight\n );\n const handleClick = React.useCallback(() => {\n setIsOverflowPanelOpen((prev) => !prev);\n }, []);\n // istanbul ignore next - NEEDSWORK add complete tests\n const handleClose = React.useCallback(() => {\n setIsOverflowPanelOpen(false);\n }, []);\n\n // Not setting the ref will disable overflow management, but will keep proper refresh of items.\n const ref = props.enableOverflow ? resizeObserverRef : undefined;\n const availableItems = React.Children.toArray(availableNodes);\n const displayedItems = availableItems.reduce<\n Array<[string, React.ReactNode]>\n >((acc, child, index) => {\n const key = getChildKey(child, index);\n if (!overflowItemKeys || overflowItemKeys.indexOf(key) < 0) {\n acc.push([key, child]);\n }\n return acc;\n }, []);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const overflowPanelItems = overflowItemKeys\n ? availableItems.reduce<Array<[string, React.ReactNode]>>(\n (acc, child, index) => {\n const key = getChildKey(child, index);\n if (overflowItemKeys.indexOf(key) >= 0) {\n acc.push([key, child]);\n }\n return acc;\n },\n []\n )\n : [];\n\n const direction = getToolbarDirection(expandsTo);\n const overflowExpandsTo =\n (typeof props.enableOverflow !== \"boolean\" &&\n props.enableOverflow?.overflowExpandsTo) ||\n Direction.Right;\n const addOverflowButton = React.useCallback(\n (atStart: boolean) => {\n const overflowItems = !!atStart\n ? overflowPanelItems.reverse()\n : overflowPanelItems;\n return (\n <ToolbarItemContext.Provider\n value={{\n hasOverflow: false,\n useHeight,\n onResize: handleOverflowResize,\n }}\n >\n <ToolbarOverflowButton\n expandsTo={expandsTo}\n onClick={handleClick}\n onClose={handleClose}\n open={overflowItems.length > 0 && isOverflowPanelOpen}\n panelNode={\n <ToolbarOverflowPanel>\n <OverflowItemsContainer>\n {overflowItems.map(([key, child]) => {\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: true,\n useHeight,\n onResize: () => {},\n }}\n >\n {\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n }\n </ToolbarItemContext.Provider>\n );\n })}\n </OverflowItemsContainer>\n </ToolbarOverflowPanel>\n }\n title={translate(\"toolbar.overflow\")}\n />\n </ToolbarItemContext.Provider>\n );\n },\n [\n overflowPanelItems,\n useHeight,\n handleOverflowResize,\n expandsTo,\n handleClick,\n handleClose,\n isOverflowPanelOpen,\n translate,\n ]\n );\n\n const className = classnames(\n \"components-toolbar-overflow-sizer\",\n OrthogonalDirectionHelpers.getCssClassName(direction),\n props.className\n );\n\n const showOverflowAtStart =\n direction === OrthogonalDirection.Horizontal &&\n panelAlignment === ToolbarPanelAlignment.End;\n /* The ItemWrapper is used to wrap the <Item> <ExpandableItem> with a <div> that specifies a ref that the sizing logic uses to determine the\n size of the item. */\n return (\n <ToolbarWithOverflowDirectionContext.Provider\n value={{\n expandsTo,\n direction,\n overflowExpandsTo,\n panelAlignment,\n useDragInteraction,\n toolbarOpacitySetting:\n props.toolbarOpacitySetting ?? ToolbarOpacitySetting.Proximity,\n overflowDirection:\n direction === OrthogonalDirection.Horizontal\n ? OrthogonalDirection.Vertical\n : OrthogonalDirection.Horizontal,\n openPopupCount: popupPanelCount,\n onPopupPanelOpenClose: handlePopupPanelOpenClose,\n overflowDisplayActive:\n overflowPanelItems.length > 0 && isOverflowPanelOpen,\n onItemExecuted: props.onItemExecuted ? props.onItemExecuted : () => {},\n onKeyDown: props.onKeyDown\n ? props.onKeyDown\n : /* istanbul ignore next */ (_e: React.KeyboardEvent) => {},\n }}\n >\n {availableItems.length > 0 && (\n <div\n className={className}\n ref={ref}\n style={props.style}\n onKeyDown={props.onKeyDown}\n role=\"presentation\"\n >\n <ToolbarItems className=\"components-items\" direction={direction}>\n {props.enableOverflow &&\n (!overflowItemKeys || overflowItemKeys.length > 0) &&\n showOverflowAtStart &&\n addOverflowButton(true)}\n {displayedItems.map(([key, child]) => {\n const onEntryResize = handleEntryResize(key);\n return (\n <ToolbarItemContext.Provider\n key={key}\n value={{\n hasOverflow: false,\n useHeight,\n onResize: onEntryResize,\n }}\n >\n <ItemWrapper className={getItemWrapperClass(child)}>\n {child}\n </ItemWrapper>\n </ToolbarItemContext.Provider>\n );\n })}\n {props.enableOverflow &&\n (!overflowItemKeys || overflowItemKeys.length > 0) &&\n !showOverflowAtStart &&\n addOverflowButton(false)}\n </ToolbarItems>\n </div>\n )}\n </ToolbarWithOverflowDirectionContext.Provider>\n );\n}\n\n/** Returns key of a child. Must be used along with React.Children.toArray to preserve the semantics of availableItems.\n * @internal\n */\nfunction getChildKey(child: React.ReactNode, index: number) {\n // istanbul ignore else\n if (React.isValidElement(child) && child.key !== null) {\n return child.key.toString();\n }\n // istanbul ignore next\n return index.toString();\n}\n\n/** Returns a subset of toolbar item entry keys that exceed given width and should be overflowItemKeys.\n * @internal\n */\nfunction determineOverflowItems(\n size: number,\n entries: ReadonlyArray<readonly [string, number]>,\n overflowButtonSize: number,\n overflowButtonAtStart: boolean\n): string[] {\n let toolbarSize = 0;\n const buttonPadding = 2;\n if (overflowButtonAtStart && entries.length > 0) {\n let i = entries.length - 1;\n for (; i >= 0; i--) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n if (i >= 0) {\n let j = i + 1;\n for (; j < entries.length; j++) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(0, j).map((e) => e[0]);\n } else {\n return [];\n }\n } else {\n let i = 0;\n for (; i < entries.length; i++) {\n const w = entries[i][1] + buttonPadding;\n const newSettingsWidth = toolbarSize + w;\n if (newSettingsWidth > size) {\n toolbarSize += overflowButtonSize + buttonPadding;\n break;\n }\n toolbarSize = newSettingsWidth;\n }\n let j = i;\n for (; j > 0; j--) {\n if (toolbarSize <= size) break;\n const w = entries[j][1] + buttonPadding;\n toolbarSize -= w;\n }\n\n return entries.slice(j).map((e) => e[0]);\n }\n}\n\n/** Hook that returns a list of overflowItemKeys availableItems.\n * @internal\n */\nfunction useOverflow(\n availableItems: React.ReactNode,\n overflowButtonAtStart: boolean\n): [\n ReadonlyArray<string> | undefined,\n (size: number) => void,\n (size: number) => void,\n (key: string) => (size: number) => void\n] {\n const [overflowItemKeys, setOverflown] =\n React.useState<ReadonlyArray<string>>();\n const itemSizes = React.useRef(new Map<string, number | undefined>());\n const size = React.useRef<number | undefined>(undefined);\n const overflowButtonSize = React.useRef<number | undefined>(undefined);\n\n const calculateOverflow = React.useCallback(() => {\n const sizes = verifiedMapEntries(itemSizes.current);\n if (\n size.current === undefined ||\n sizes === undefined ||\n overflowButtonSize.current === undefined\n ) {\n setOverflown(undefined);\n return;\n }\n\n // Calculate overflow.\n const newOverflown = determineOverflowItems(\n size.current,\n [...sizes.entries()],\n overflowButtonSize.current,\n overflowButtonAtStart\n );\n setOverflown((prevOverflown) => {\n return eql(prevOverflown, newOverflown) ? prevOverflown : newOverflown;\n });\n }, [overflowButtonAtStart]);\n\n React.useLayoutEffect(() => {\n const newEntryWidths = new Map<string, number | undefined>();\n const array = React.Children.toArray(availableItems);\n for (let i = 0; i < array.length; i++) {\n const child = array[i];\n const key = getChildKey(child, i);\n const lastW = itemSizes.current.get(key);\n newEntryWidths.set(key, lastW);\n }\n itemSizes.current = newEntryWidths;\n calculateOverflow();\n }, [availableItems, calculateOverflow]);\n\n const handleContainerResize = React.useCallback(\n (w: number) => {\n const calculate = size.current !== w;\n size.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleOverflowResize = React.useCallback(\n (w: number) => {\n const calculate = overflowButtonSize.current !== w;\n overflowButtonSize.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleEntryResize = React.useCallback(\n (key: string) => (w: number) => {\n const oldW = itemSizes.current.get(key);\n if (oldW !== w) {\n itemSizes.current.set(key, w);\n calculateOverflow();\n }\n },\n [calculateOverflow]\n );\n\n return [\n overflowItemKeys,\n handleContainerResize,\n handleOverflowResize,\n handleEntryResize,\n ];\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport interface ToolbarItemContextArgs {\n readonly hasOverflow: boolean;\n readonly useHeight: boolean;\n readonly onResize: (w: number) => void;\n}\n\n/** Interface toolbars use to define context for its items.\n * @internal\n */\nexport const ToolbarItemContext = React.createContext<ToolbarItemContextArgs>({\n hasOverflow: false,\n useHeight: false,\n onResize: () => {\n // intentionally do nothing by default.\n },\n});\n\n/** @internal */\nexport function useToolItemEntryContext() {\n return React.useContext(ToolbarItemContext);\n}\n\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\n for (const [, val] of map) {\n // istanbul ignore next during unit testing\n if (val === undefined) return undefined;\n }\n return map as Map<string, T>;\n}\n\nfunction eql(prev: readonly string[] | undefined, value: readonly string[]) {\n if (!prev) return false;\n // istanbul ignore next\n if (prev.length !== value.length) return false;\n for (let i = 0; i < prev.length; i++) {\n const p = prev[i];\n const v = value[i];\n // istanbul ignore next\n if (p !== v) return false;\n }\n return true;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemWithDrag.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGrD,OAAO,EACL,qBAAqB,EAGtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,4BAA4B;IAC5B,SAAS,EAAE,WAAW,CAAC;CACxB;AAiDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"PopupItemWithDrag.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAGrD,OAAO,EACL,qBAAqB,EAGtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,4BAA4B;IAC5B,SAAS,EAAE,WAAW,CAAC;CACxB;AAiDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAwI9D;AAED,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,qBAAqB,GAC/B,gBAAgB,CAelB"}
|
|
@@ -9,7 +9,7 @@ import "./PopupItem.scss";
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { ConditionalBooleanValue, ConditionalStringValue, RelativePosition, ToolbarItemUtilities, } from "@itwin/appui-abstract";
|
|
12
|
-
import {
|
|
12
|
+
import { Badge, IconHelper, useRefState } from "@itwin/core-react";
|
|
13
13
|
import { PopupItemPopup, ToolbarPopupContext } from "./PopupItem";
|
|
14
14
|
import { PopupItemsPanel } from "./PopupItemsPanel";
|
|
15
15
|
import { ToolbarPanelAlignment, useToolbarWithOverflowDirectionContext, useToolItemEntryContext, } from "./InternalToolbarComponent";
|
|
@@ -102,9 +102,6 @@ export function PopupItemWithDrag(props) {
|
|
|
102
102
|
!ConditionalBooleanValue.getValue(activeAction.isDisabled) &&
|
|
103
103
|
activeAction.execute();
|
|
104
104
|
}, [activeAction]);
|
|
105
|
-
const badge = activeAction
|
|
106
|
-
? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType)
|
|
107
|
-
: props.badge;
|
|
108
105
|
const icon = activeAction
|
|
109
106
|
? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)
|
|
110
107
|
: props.icon;
|
|
@@ -129,7 +126,7 @@ export function PopupItemWithDrag(props) {
|
|
|
129
126
|
} },
|
|
130
127
|
React.createElement("button", { "data-item-id": props.itemId, "data-item-type": "action-tool-button", "data-item-group-priority": props.groupPriority, "data-item-priority": props.itemPriority, "data-item-provider-id": props.providerId, ref: targetRef, onPointerDown: handlePointerDown, onClick: handleButtonClick, onKeyDown: props.onKeyDown, className: className, style: props.style, title: title },
|
|
131
128
|
React.createElement("div", { className: "components-icon" }, icon),
|
|
132
|
-
props.badge && React.createElement("div", { className: "components-badge" }, badge),
|
|
129
|
+
props.badge && (React.createElement("div", { className: "components-badge" }, activeAction ? (React.createElement(Badge, { type: activeAction.badgeType })) : (props.badge))),
|
|
133
130
|
React.createElement("div", { className: "components-triangle" })),
|
|
134
131
|
React.createElement(PopupItemPopup, { isOpen: isPanelShown, onClose: handleClose, position: toToolbarPopupRelativePosition(expandsToDirection, panelAlignment), target: target },
|
|
135
132
|
React.createElement(PopupItemsPanel, { groupItem: props.groupItem, activateOnPointerUp: true }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL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AAK,CAAC,UAAU,EACvC,GAAG,EAAE,SAAS,EACd,aAAa,EAAE,iBAAiB,EAChC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK;YAEZ,6BAAK,SAAS,EAAC,iBAAiB,IAAE,IAAI,CAAO;YAC5C,KAAK,CAAC,KAAK,IAAI,6BAAK,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAO;YAC/D,6BAAK,SAAS,EAAC,qBAAqB,GAAG,CAChC;QACT,oBAAC,cAAc,IACb,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,8BAA8B,CACtC,kBAAkB,EAClB,cAAc,CACf,EACD,MAAM,EAAE,MAAM;YAEd,oBAAC,eAAe,IACd,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,mBAAmB,EAAE,IAAI,GACzB,CACa,CACY,CAChC,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,8BAA8B,CAC5C,SAAoB,EACpB,SAAgC;IAEhC,uBAAuB;IACvB,QAAQ,SAAS,EAAE;QACjB,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,SAAS,KAAK,qBAAqB,CAAC,GAAG;gBACzC,OAAO,gBAAgB,CAAC,WAAW,CAAC;YACtC,OAAO,gBAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 Toolbar\n */\n\nimport \"./PopupItem.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n RelativePosition,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { BadgeUtilities, IconHelper, useRefState } from \"@itwin/core-react\";\nimport type { ToolbarButtonItemProps } from \"./Item\";\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport {\n ToolbarPanelAlignment,\n useToolbarWithOverflowDirectionContext,\n useToolItemEntryContext,\n} from \"./InternalToolbarComponent\";\nimport { useDragInteraction } from \"./useDragInteraction\";\nimport { Direction } from \"./utilities/Direction\";\n\n/** Properties of [[PopupItem]] component.\n * @public\n */\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\n /** Panel of the toolbar. */\n groupItem: GroupButton;\n}\n\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n if (childItem.isActive) return childItem;\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = tryFindActiveAction(childItem);\n if (nestedChild) return nestedChild;\n }\n }\n return undefined;\n}\n\nfunction getFirstAvailableChildActionItem(\n item: GroupButton\n): ActionButton | undefined {\n for (const childItem of item.items) {\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = getFirstAvailableChildActionItem(childItem);\n // istanbul ignore else\n if (nestedChild) return nestedChild;\n }\n }\n }\n return undefined;\n}\n\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\n const activeItem = tryFindActiveAction(item);\n if (activeItem) return activeItem;\n\n // initially look only in root items\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n }\n }\n\n // if not found look inside groups\n return getFirstAvailableChildActionItem(item);\n}\n\n/** Expandable Group button Item\n * @public\n */\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\n const [isPanelShown, setPanelShown] = React.useState(false);\n const [activeAction, setActiveAction] = React.useState(\n getActiveAction(props.groupItem)\n );\n const {\n expandsTo,\n overflowExpandsTo,\n panelAlignment,\n onPopupPanelOpenClose,\n } = useToolbarWithOverflowDirectionContext();\n\n React.useEffect(() => {\n const newActiveAction = getActiveAction(props.groupItem);\n // istanbul ignore else\n if (newActiveAction) {\n // istanbul ignore next\n if (newActiveAction.isActive) {\n setActiveAction(newActiveAction);\n } else {\n if (activeAction && activeAction.isActive) {\n setActiveAction({ ...activeAction, isActive: false });\n }\n }\n }\n }, [props.groupItem, activeAction]);\n\n const processPanelOpenClose = React.useCallback(\n (isOpening: boolean) => {\n setPanelShown((prev) => {\n // istanbul ignore else\n if (prev !== isOpening) onPopupPanelOpenClose(isOpening);\n return isOpening;\n });\n },\n [setPanelShown, onPopupPanelOpenClose]\n );\n\n // handle open and closing popup panel\n const onOpenPanel = React.useCallback(() => {\n processPanelOpenClose(!isPanelShown);\n }, [isPanelShown, processPanelOpenClose]);\n\n // handle open and closing popup panel\n const onGroupButtonClick = React.useCallback(() => {\n // only execute action if not disabled\n activeAction &&\n !ConditionalBooleanValue.getValue(activeAction.isDisabled) &&\n activeAction.execute();\n }, [activeAction]);\n\n const badge = activeAction\n ? BadgeUtilities.getComponentForBadgeType(activeAction.badgeType)\n : props.badge;\n const icon = activeAction\n ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)\n : props.icon;\n const title = activeAction\n ? ConditionalStringValue.getValue(activeAction.label)\n : props.title;\n const isActive = activeAction ? activeAction.isActive : props.isActive;\n const isDisabled = ConditionalBooleanValue.getValue(\n activeAction ? activeAction.isDisabled : props.isDisabled\n );\n\n const { handlePointerDown, handleButtonClick } = useDragInteraction(\n onGroupButtonClick,\n onOpenPanel\n );\n\n const className = classnames(\n \"components-toolbar-button-item\",\n \"components-toolbar-expandable-button\",\n isActive && \"components-active\",\n isDisabled && \"components-disabled-drag\",\n props.className\n );\n\n const [targetRef, target] = useRefState<HTMLButtonElement>();\n const handleClose = React.useCallback(() => {\n processPanelOpenClose(false);\n }, [processPanelOpenClose]);\n const { hasOverflow } = useToolItemEntryContext();\n const expandsToDirection = hasOverflow\n ? /* istanbul ignore next */ overflowExpandsTo\n : expandsTo;\n\n return (\n <ToolbarPopupContext.Provider\n value={{\n closePanel: /* istanbul ignore next */ () =>\n processPanelOpenClose(false),\n setSelectedItem: /* istanbul ignore next */ (\n buttonItem: ActionButton\n ) => setActiveAction(buttonItem),\n }}\n >\n <button\n data-item-id={props.itemId}\n data-item-type=\"action-tool-button\"\n data-item-group-priority={props.groupPriority}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n ref={targetRef}\n onPointerDown={handlePointerDown}\n onClick={handleButtonClick}\n onKeyDown={props.onKeyDown}\n className={className}\n style={props.style}\n title={title}\n >\n <div className=\"components-icon\">{icon}</div>\n {props.badge && <div className=\"components-badge\">{badge}</div>}\n <div className=\"components-triangle\" />\n </button>\n <PopupItemPopup\n isOpen={isPanelShown}\n onClose={handleClose}\n position={toToolbarPopupRelativePosition(\n expandsToDirection,\n panelAlignment\n )}\n target={target}\n >\n <PopupItemsPanel\n groupItem={props.groupItem}\n activateOnPointerUp={true}\n />\n </PopupItemPopup>\n </ToolbarPopupContext.Provider>\n );\n}\n\n/** @internal */\nexport function toToolbarPopupRelativePosition(\n expandsTo: Direction,\n alignment: ToolbarPanelAlignment\n): RelativePosition {\n // istanbul ignore next\n switch (expandsTo) {\n case Direction.Bottom: {\n if (alignment === ToolbarPanelAlignment.End)\n return RelativePosition.BottomRight;\n return RelativePosition.BottomLeft;\n }\n case Direction.Left:\n return RelativePosition.LeftTop;\n case Direction.Right:\n return RelativePosition.RightTop;\n case Direction.Top:\n return RelativePosition.Top;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupItemWithDrag.js","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemWithDrag.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,sCAAsC,EACtC,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAUlD,SAAS,mBAAmB,CAAC,IAAiB;IAC5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,EAAE;QAClC,uBAAuB;QACvB,IAAI,oBAAoB,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YAClD,IAAI,SAAS,CAAC,QAAQ;gBAAE,OAAO,SAAS,CAAC;SAC1C;aAAM,IAAI,oBAAoB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YACxD,MAAM,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,WAAW;gBAAE,OAAO,WAAW,CAAC;SACrC;KACF;IACD,OAAO,SAAS,CAAC;AACnB,C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AC,WAAW,CAAC;YACtC,OAAO,gBAAgB,CAAC,UAAU,CAAC;SACpC;QACD,KAAK,SAAS,CAAC,IAAI;YACjB,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,SAAS,CAAC,KAAK;YAClB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACnC,KAAK,SAAS,CAAC,GAAG;YAChB,OAAO,gBAAgB,CAAC,GAAG,CAAC;KAC/B;AACH,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 Toolbar\n */\n\nimport \"./PopupItem.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ActionButton, GroupButton } from \"@itwin/appui-abstract\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n RelativePosition,\n ToolbarItemUtilities,\n} from \"@itwin/appui-abstract\";\nimport { Badge, IconHelper, useRefState } from \"@itwin/core-react\";\nimport type { ToolbarButtonItemProps } from \"./Item\";\nimport { PopupItemPopup, ToolbarPopupContext } from \"./PopupItem\";\nimport { PopupItemsPanel } from \"./PopupItemsPanel\";\nimport {\n ToolbarPanelAlignment,\n useToolbarWithOverflowDirectionContext,\n useToolItemEntryContext,\n} from \"./InternalToolbarComponent\";\nimport { useDragInteraction } from \"./useDragInteraction\";\nimport { Direction } from \"./utilities/Direction\";\n\n/** Properties of [[PopupItem]] component.\n * @public\n */\nexport interface PopupItemWithDragProps extends ToolbarButtonItemProps {\n /** Panel of the toolbar. */\n groupItem: GroupButton;\n}\n\nfunction tryFindActiveAction(item: GroupButton): ActionButton | undefined {\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n if (childItem.isActive) return childItem;\n } else if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = tryFindActiveAction(childItem);\n if (nestedChild) return nestedChild;\n }\n }\n return undefined;\n}\n\nfunction getFirstAvailableChildActionItem(\n item: GroupButton\n): ActionButton | undefined {\n for (const childItem of item.items) {\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n } else {\n // istanbul ignore else\n if (ToolbarItemUtilities.isGroupButton(childItem)) {\n const nestedChild = getFirstAvailableChildActionItem(childItem);\n // istanbul ignore else\n if (nestedChild) return nestedChild;\n }\n }\n }\n return undefined;\n}\n\nfunction getActiveAction(item: GroupButton): ActionButton | undefined {\n const activeItem = tryFindActiveAction(item);\n if (activeItem) return activeItem;\n\n // initially look only in root items\n for (const childItem of item.items) {\n // istanbul ignore else\n if (ToolbarItemUtilities.isActionButton(childItem)) {\n return childItem;\n }\n }\n\n // if not found look inside groups\n return getFirstAvailableChildActionItem(item);\n}\n\n/** Expandable Group button Item\n * @public\n */\nexport function PopupItemWithDrag(props: PopupItemWithDragProps) {\n const [isPanelShown, setPanelShown] = React.useState(false);\n const [activeAction, setActiveAction] = React.useState(\n getActiveAction(props.groupItem)\n );\n const {\n expandsTo,\n overflowExpandsTo,\n panelAlignment,\n onPopupPanelOpenClose,\n } = useToolbarWithOverflowDirectionContext();\n\n React.useEffect(() => {\n const newActiveAction = getActiveAction(props.groupItem);\n // istanbul ignore else\n if (newActiveAction) {\n // istanbul ignore next\n if (newActiveAction.isActive) {\n setActiveAction(newActiveAction);\n } else {\n if (activeAction && activeAction.isActive) {\n setActiveAction({ ...activeAction, isActive: false });\n }\n }\n }\n }, [props.groupItem, activeAction]);\n\n const processPanelOpenClose = React.useCallback(\n (isOpening: boolean) => {\n setPanelShown((prev) => {\n // istanbul ignore else\n if (prev !== isOpening) onPopupPanelOpenClose(isOpening);\n return isOpening;\n });\n },\n [setPanelShown, onPopupPanelOpenClose]\n );\n\n // handle open and closing popup panel\n const onOpenPanel = React.useCallback(() => {\n processPanelOpenClose(!isPanelShown);\n }, [isPanelShown, processPanelOpenClose]);\n\n // handle open and closing popup panel\n const onGroupButtonClick = React.useCallback(() => {\n // only execute action if not disabled\n activeAction &&\n !ConditionalBooleanValue.getValue(activeAction.isDisabled) &&\n activeAction.execute();\n }, [activeAction]);\n\n const icon = activeAction\n ? IconHelper.getIconReactNode(activeAction.icon, activeAction.internalData)\n : props.icon;\n const title = activeAction\n ? ConditionalStringValue.getValue(activeAction.label)\n : props.title;\n const isActive = activeAction ? activeAction.isActive : props.isActive;\n const isDisabled = ConditionalBooleanValue.getValue(\n activeAction ? activeAction.isDisabled : props.isDisabled\n );\n\n const { handlePointerDown, handleButtonClick } = useDragInteraction(\n onGroupButtonClick,\n onOpenPanel\n );\n\n const className = classnames(\n \"components-toolbar-button-item\",\n \"components-toolbar-expandable-button\",\n isActive && \"components-active\",\n isDisabled && \"components-disabled-drag\",\n props.className\n );\n\n const [targetRef, target] = useRefState<HTMLButtonElement>();\n const handleClose = React.useCallback(() => {\n processPanelOpenClose(false);\n }, [processPanelOpenClose]);\n const { hasOverflow } = useToolItemEntryContext();\n const expandsToDirection = hasOverflow\n ? /* istanbul ignore next */ overflowExpandsTo\n : expandsTo;\n\n return (\n <ToolbarPopupContext.Provider\n value={{\n closePanel: /* istanbul ignore next */ () =>\n processPanelOpenClose(false),\n setSelectedItem: /* istanbul ignore next */ (\n buttonItem: ActionButton\n ) => setActiveAction(buttonItem),\n }}\n >\n <button\n data-item-id={props.itemId}\n data-item-type=\"action-tool-button\"\n data-item-group-priority={props.groupPriority}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n ref={targetRef}\n onPointerDown={handlePointerDown}\n onClick={handleButtonClick}\n onKeyDown={props.onKeyDown}\n className={className}\n style={props.style}\n title={title}\n >\n <div className=\"components-icon\">{icon}</div>\n {props.badge && (\n <div className=\"components-badge\">\n {activeAction ? (\n <Badge type={activeAction.badgeType} />\n ) : (\n props.badge\n )}\n </div>\n )}\n <div className=\"components-triangle\" />\n </button>\n <PopupItemPopup\n isOpen={isPanelShown}\n onClose={handleClose}\n position={toToolbarPopupRelativePosition(\n expandsToDirection,\n panelAlignment\n )}\n target={target}\n >\n <PopupItemsPanel\n groupItem={props.groupItem}\n activateOnPointerUp={true}\n />\n </PopupItemPopup>\n </ToolbarPopupContext.Provider>\n );\n}\n\n/** @internal */\nexport function toToolbarPopupRelativePosition(\n expandsTo: Direction,\n alignment: ToolbarPanelAlignment\n): RelativePosition {\n // istanbul ignore next\n switch (expandsTo) {\n case Direction.Bottom: {\n if (alignment === ToolbarPanelAlignment.End)\n return RelativePosition.BottomRight;\n return RelativePosition.BottomLeft;\n }\n case Direction.Left:\n return RelativePosition.LeftTop;\n case Direction.Right:\n return RelativePosition.RightTop;\n case Direction.Top:\n return RelativePosition.Top;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupItemsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAwBvE,UAAU,oBAAoB;IAC5B,SAAS,EAAE,WAAW,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"PopupItemsPanel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/toolbar/PopupItemsPanel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAwBvE,UAAU,oBAAoB;IAC5B,SAAS,EAAE,WAAW,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAmK1D"}
|