@itwin/appui-react 4.3.1 → 4.5.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 +22 -4
- package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/cjs/appui-react/UiFramework.js +14 -16
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +1 -2
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
- package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/TimeTracker.js +1 -2
- package/lib/cjs/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +9 -12
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js +3 -4
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js +1 -2
- package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/cjs/appui-react/content/IModelViewport.js +3 -6
- package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js +1 -2
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.js +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js +10 -12
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +6 -6
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/cjs/appui-react/dialog/ContentDialog.js +3 -6
- package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js +2 -3
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +5 -7
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js +2 -3
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js +8 -13
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/messages/ActivityMessage.js +5 -7
- package/lib/cjs/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/cjs/appui-react/pickers/ViewSelector.js +5 -6
- package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js +1 -2
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/cjs/appui-react/popup/PopupManager.js +1 -2
- package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js +3 -0
- package/lib/cjs/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +12 -8
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +5 -7
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/Indicator.js +1 -2
- package/lib/cjs/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBar.js +3 -5
- package/lib/cjs/appui-react/statusbar/StatusBar.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +6 -4
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +49 -78
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts +11 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.js +3 -2
- package/lib/cjs/appui-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts +2 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js +45 -129
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.d.ts +6 -3
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.js +53 -80
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts +2 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js +2 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.d.ts +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js +12 -2
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts +3 -2
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js +5 -9
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts +11 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.js +46 -0
- package/lib/cjs/appui-react/toolbar/useActiveStageProvidedToolbarItems.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts +25 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.js +63 -0
- package/lib/cjs/appui-react/toolbar/useActiveToolIdSynchedItems.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.d.ts +1 -0
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.js +4 -1
- package/lib/cjs/appui-react/toolbar/useDefaultToolbarItems.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts +2 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js +12 -30
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +10 -17
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js +8 -14
- package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
- package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +3 -3
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Content.js +8 -9
- package/lib/cjs/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +43 -45
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/StatusBar.js +1 -1
- package/lib/cjs/appui-react/widget-panels/StatusBar.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Tab.js +1 -1
- package/lib/cjs/appui-react/widget-panels/Tab.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js +21 -23
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Toolbars.js +2 -3
- package/lib/cjs/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.js +2 -3
- package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +14 -16
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js +1 -2
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
- package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
- package/lib/esm/appui-react/configurableui/TimeTracker.js +1 -2
- package/lib/esm/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +9 -12
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/DefaultViewOverlay.js +3 -4
- package/lib/esm/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js +1 -2
- package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/esm/appui-react/content/IModelViewport.js +3 -6
- package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js +1 -2
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.js +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/esm/appui-react/content/split-pane/SplitPane.js +10 -12
- package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +6 -6
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/esm/appui-react/dialog/ContentDialog.js +3 -6
- package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/esm/appui-react/dialog/DialogManagerBase.js +2 -3
- package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +5 -7
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js +2 -3
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js +8 -13
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/esm/appui-react/messages/ActivityMessage.js +5 -7
- package/lib/esm/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/esm/appui-react/pickers/ViewSelector.js +5 -6
- package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js +1 -2
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/esm/appui-react/popup/PopupManager.js +1 -2
- package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js +3 -0
- package/lib/esm/appui-react/selection/HideIsolateEmphasizeManager.js.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +12 -8
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +5 -7
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusbar/Indicator.js +1 -2
- package/lib/esm/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBar.js +3 -5
- package/lib/esm/appui-react/statusbar/StatusBar.js.map +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +6 -4
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +49 -78
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts +11 -1
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/Toolbar.js +3 -2
- package/lib/esm/appui-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts +2 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js +45 -129
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarHelper.d.ts +6 -3
- package/lib/esm/appui-react/toolbar/ToolbarHelper.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarHelper.js +53 -80
- package/lib/esm/appui-react/toolbar/ToolbarHelper.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts +2 -2
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.js +2 -2
- package/lib/esm/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.d.ts +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js +12 -2
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts +3 -2
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js +5 -9
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts +11 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.js +42 -0
- package/lib/esm/appui-react/toolbar/useActiveStageProvidedToolbarItems.js.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts +25 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.js +59 -0
- package/lib/esm/appui-react/toolbar/useActiveToolIdSynchedItems.js.map +1 -0
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.d.ts +1 -0
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.js +4 -1
- package/lib/esm/appui-react/toolbar/useDefaultToolbarItems.js.map +1 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts +2 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js +12 -30
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js +10 -17
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js +8 -14
- package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
- package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
- package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +3 -3
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Content.js +8 -9
- package/lib/esm/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +43 -45
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/StatusBar.js +1 -1
- package/lib/esm/appui-react/widget-panels/StatusBar.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Tab.js +1 -1
- package/lib/esm/appui-react/widget-panels/Tab.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.js +21 -23
- package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Toolbars.js +2 -3
- package/lib/esm/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.js +2 -3
- package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
- package/package.json +14 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,0DAAgE;AAChE,8DAIiC;AACjC,sDAA6C;AAC7C,kDAAgD;AAChD,2EAAwE;AACxE,gDAA6C;AAC7C,uDAAkE;AAClE,qEAAkE;AAClE,qFAAkF;AAMlF,+CAKuB;AACvB,+DAA4D;AAC5D,+DAA4D;AAE5D,wEAAwE;AACxE,SAAS,wBAAwB,CAC/B,cAAmC,EACnC,iBAA2B;IAE3B,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,6CAAqB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9D,IAAI,CAAC,KAAK,iBAAiB,CAAC,MAAM;gBAAE,OAAO;YAE3C,uBAAuB;YACvB,IACE,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAa,EAAW,EAAE,CAChD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CACvC,EACD;gBACA,sCAAsC;gBACtC,cAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACpD;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,cAAc,EAAE,iBAAiB,EAAE,cAAc,CAAC,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IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,+CAA6B,CAAC,CAAC;IACtE,MAAM,mBAAmB,GAAG,0BAA0B,EAAE,CAAC;IAEzD,OAAO,CACL,oBAAC,yCAAmB,IAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,aAAa,EACjC,qBAAqB,EACnB,mBAAmB,IAAI,CAAC,yBAAW,CAAC,QAAQ,EAAE;YAC5C,CAAC,CAAC,wCAAqB,CAAC,SAAS;YACjC,CAAC,CAAC,0BAA0B,CAAC,wCAAqB,CAAC,QAAQ,GAE/D,CACH,CAAC;AACJ,CAAC;AAlED,0CAkEC","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 * as React from \"react\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\nimport { UiFramework } from \"../UiFramework\";\nimport { ToolbarDragInteractionContext } from \"./DragInteraction\";\nimport { useDefaultToolbarItems } from \"./useDefaultToolbarItems\";\nimport { useUiItemsProviderToolbarItems } from \"./useUiItemsProviderToolbarItems\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport {\n isToolbarActionItem,\n isToolbarGroupItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport { ToolbarItemsManager } from \"./ToolbarItemsManager\";\nimport { ToolbarWithOverflow } from \"./ToolbarWithOverflow\";\n\n/** Private function to set up sync event monitoring of toolbar items */\nfunction useToolbarItemSyncEffect(\n uiDataProvider: ToolbarItemsManager,\n syncIdsOfInterest: string[]\n) {\n React.useEffect(() => {\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n if (0 === syncIdsOfInterest.length) return;\n\n // istanbul ignore else\n if (\n syncIdsOfInterest.some((value: string): boolean =>\n args.eventIds.has(value.toLowerCase())\n )\n ) {\n // process each item that has interest\n uiDataProvider.refreshAffectedItems(args.eventIds);\n }\n });\n }, [uiDataProvider, syncIdsOfInterest, uiDataProvider.items]);\n\n React.useEffect(() => {\n return UiFramework.frontstages.onToolActivatedEvent.addListener(\n ({ toolId }) => {\n uiDataProvider.setActiveToolId(toolId);\n }\n );\n }, [uiDataProvider, uiDataProvider.items]);\n}\n\nfunction nestedAddItemToSpecifiedParentGroup(\n items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>,\n groupChildren: Array<ToolbarActionItem | ToolbarGroupItem>\n): Array<ToolbarActionItem | ToolbarGroupItem> {\n const outItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const toolbarItem of items) {\n if (!isToolbarGroupItem(toolbarItem)) {\n outItems.push(toolbarItem);\n continue;\n }\n\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> =\n nestedAddItemToSpecifiedParentGroup(toolbarItem.items, groupChildren);\n const foundIndices: number[] = [];\n\n groupChildren.forEach((entry, index) => {\n if (entry.parentGroupItemId === toolbarItem.id) {\n foundIndices.push(index);\n }\n });\n\n // istanbul ignore else\n if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort(\n // istanbul ignore next\n (a, b) => a - b\n )\n .reverse()\n .forEach((foundIndex) => {\n newChildren.push(groupChildren[foundIndex]);\n groupChildren.splice(foundIndex);\n });\n }\n\n outItems.push({ ...toolbarItem, items: newChildren });\n }\n return outItems;\n}\n\nfunction addItemToSpecifiedParentGroup(\n items: readonly ToolbarItem[],\n groupChildren: Array<ToolbarActionItem | ToolbarGroupItem>\n): ToolbarItem[] {\n const outItems: ToolbarItem[] = [];\n for (const toolbarItem of items) {\n if (!isToolbarGroupItem(toolbarItem)) {\n outItems.push(toolbarItem);\n continue;\n }\n\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> =\n nestedAddItemToSpecifiedParentGroup(toolbarItem.items, groupChildren);\n const foundIndices: number[] = [];\n\n groupChildren.forEach((entry, index) => {\n if (entry.parentGroupItemId === toolbarItem.id) {\n foundIndices.push(index);\n }\n });\n\n // istanbul ignore else\n if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort(\n // istanbul ignore next\n (a, b) => a - b\n )\n .reverse()\n .forEach((foundIndex) => {\n newChildren.push(groupChildren[foundIndex]);\n groupChildren.splice(foundIndex);\n });\n }\n\n outItems.push({ ...toolbarItem, items: newChildren });\n }\n return outItems;\n}\n\nfunction cloneGroup(inGroup: ToolbarGroupItem): ToolbarGroupItem {\n const childItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n inGroup.items.forEach((item) => {\n if (isToolbarGroupItem(item)) childItems.push(cloneGroup(item));\n else childItems.push(item);\n });\n\n const clonedGroup = { ...inGroup, items: childItems };\n return clonedGroup;\n}\n\nfunction getItemSortValue(item: ToolbarItem) {\n const groupValue =\n undefined === item.groupPriority\n ? 0\n : /* istanbul ignore next */ item.groupPriority;\n return groupValue * 10000 + item.itemPriority;\n}\n\nfunction getSortedChildren(\n group: ToolbarGroupItem\n): ReadonlyArray<ToolbarActionItem | ToolbarGroupItem> {\n const sortedChildren = group.items\n .filter((item) => !ConditionalBooleanValue.getValue(item.isHidden))\n .sort((a, b) => getItemSortValue(a) - getItemSortValue(b))\n .map((i) => {\n if (isToolbarGroupItem(i)) {\n return { ...i, items: getSortedChildren(i) };\n }\n return i;\n });\n return sortedChildren;\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n defaultItems: ReadonlyArray<ToolbarItem>,\n addonItems: ReadonlyArray<ToolbarItem>\n): ToolbarItem[] {\n let items: ToolbarItem[] = [];\n const groupChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n\n // istanbul ignore else\n if (defaultItems.length) {\n defaultItems.forEach((srcItem: ToolbarItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n // if the default item is a group that an addon may insert into copy it so we don't mess with original\n const toolbarItem = isToolbarGroupItem(srcItem)\n ? cloneGroup(srcItem)\n : srcItem;\n if (\n (isToolbarGroupItem(toolbarItem) ||\n isToolbarActionItem(toolbarItem)) &&\n toolbarItem.parentGroupItemId\n )\n groupChildren.push(toolbarItem);\n else items.push(toolbarItem);\n }\n });\n }\n // istanbul ignore else\n if (addonItems.length) {\n addonItems.forEach((srcItem: ToolbarItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n // if the default item is a group that an addon may insert into copy it so we don't mess with original\n const toolbarItem = isToolbarGroupItem(srcItem)\n ? cloneGroup(srcItem)\n : srcItem;\n if (\n (isToolbarGroupItem(toolbarItem) ||\n isToolbarActionItem(toolbarItem)) &&\n toolbarItem.parentGroupItemId\n )\n groupChildren.push(toolbarItem);\n else items.push(toolbarItem);\n }\n });\n }\n\n // if an item from an addon has specified a parent group then try to find it and insert it. If no parent is found, add item at root level.\n if (groupChildren.length) {\n items = addItemToSpecifiedParentGroup(items, groupChildren);\n\n if (groupChildren.length) {\n groupChildren.forEach((toolbarItem) => {\n Logger.logWarning(\n \"ToolbarComposer\",\n `Requested Parent Group [${toolbarItem.parentGroupItemId!}] not found, so item [${\n toolbarItem.id\n }] is added directly to toolbar.`\n );\n items.push(toolbarItem);\n });\n }\n }\n\n const availableItems = items\n .filter((item) => !ConditionalBooleanValue.getValue(item.isHidden))\n .sort((a, b) => getItemSortValue(a) - getItemSortValue(b))\n .map((i) => {\n if (isToolbarGroupItem(i)) {\n return { ...i, items: getSortedChildren(i) };\n }\n return i;\n });\n\n return availableItems;\n}\n\nconst useProximityOpacitySetting = () => {\n const [proximityOpacity, setProximityOpacity] = React.useState(\n UiFramework.visibility.useProximityOpacity\n );\n React.useEffect(() => {\n // istanbul ignore next\n const handleUiVisibilityChanged = () => {\n setProximityOpacity(UiFramework.visibility.useProximityOpacity);\n };\n UiFramework.onUiVisibilityChanged.addListener(handleUiVisibilityChanged);\n return () => {\n UiFramework.onUiVisibilityChanged.removeListener(\n handleUiVisibilityChanged\n );\n };\n }, []);\n return proximityOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n */\nexport interface ExtensibleToolbarProps {\n items: ToolbarItem[];\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n}\n\n/**\n * Toolbar that is populated and maintained by item managers.\n * @public\n */\nexport function ToolbarComposer(props: ExtensibleToolbarProps) {\n const { usage, orientation } = props;\n\n const [defaultItemsManager, setDefaultItemsManager] = React.useState(\n () => new ToolbarItemsManager(props.items)\n );\n React.useEffect(() => {\n setDefaultItemsManager(new ToolbarItemsManager(props.items));\n }, [props.items]);\n\n // process default items\n const defaultItems = useDefaultToolbarItems(defaultItemsManager);\n const syncIdsOfInterest = React.useMemo(\n () => ToolbarItemsManager.getSyncIdsOfInterest(defaultItems),\n [defaultItems]\n );\n useToolbarItemSyncEffect(defaultItemsManager, syncIdsOfInterest);\n\n // process items from addon UI providers\n const [addonItemsManager] = React.useState(() => new ToolbarItemsManager());\n const addonItems = useUiItemsProviderToolbarItems(\n addonItemsManager,\n usage,\n orientation\n );\n const addonSyncIdsOfInterest = React.useMemo(\n () => ToolbarItemsManager.getSyncIdsOfInterest(addonItems),\n [addonItems]\n );\n useToolbarItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);\n\n const items = React.useMemo(() => {\n return combineItems(defaultItems, addonItems);\n }, [defaultItems, addonItems]);\n\n const toolbarOrientation =\n orientation === ToolbarOrientation.Horizontal\n ? Orientation.Horizontal\n : Orientation.Vertical;\n const expandsTo =\n toolbarOrientation === Orientation.Horizontal\n ? Direction.Bottom\n : usage === ToolbarUsage.ViewNavigation\n ? Direction.Left\n : Direction.Right;\n const panelAlignment =\n toolbarOrientation === Orientation.Horizontal &&\n usage === ToolbarUsage.ViewNavigation\n ? ToolbarPanelAlignment.End\n : ToolbarPanelAlignment.Start;\n const isDragEnabled = React.useContext(ToolbarDragInteractionContext);\n const useProximityOpacity = useProximityOpacitySetting();\n\n return (\n <ToolbarWithOverflow\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n toolbarOpacitySetting={\n useProximityOpacity && !UiFramework.isMobile()\n ? ToolbarOpacitySetting.Proximity\n : /* istanbul ignore next */ ToolbarOpacitySetting.Defaults\n }\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,8DAIiC;AACjC,sDAA6C;AAC7C,kDAAgD;AAChD,gDAA6C;AAC7C,uDAAkE;AAMlE,+CAKuB;AACvB,uCAAoC;AACpC,+EAA4E;AAC5E,6FAA0F;AAE1F,SAAS,6BAA6B,CACpC,KAAmB,EACnB,aAA0D;IAE1D,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE;QAC/B,IAAI,CAAC,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE;YACpC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3B,SAAS;SACV;QAED,MAAM,WAAW,GAAG,6BAA6B,CAC/C,WAAW,CAAC,KAAK,EACjB,aAAa,CACd,CAAC;QACF,MAAM,YAAY,GAAa,EAAE,CAAC;QAElC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACrC,IAAI,KAAK,CAAC,iBAAiB,KAAK,WAAW,CAAC,EAAE,EAAE;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E,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,aAAa,EACjC,qBAAqB,EACnB,mBAAmB,IAAI,CAAC,yBAAW,CAAC,QAAQ,EAAE;YAC5C,CAAC,CAAC,wCAAqB,CAAC,SAAS;YACjC,CAAC,CAAC,0BAA0B,CAAC,wCAAqB,CAAC,QAAQ,GAE/D,CACH,CAAC;AACJ,CAAC;AA5CD,0CA4CC","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 * as React from \"react\";\nimport {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { UiFramework } from \"../UiFramework\";\nimport { ToolbarDragInteractionContext } from \"./DragInteraction\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport {\n isToolbarActionItem,\n isToolbarGroupItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport { Toolbar } from \"./Toolbar\";\nimport { useActiveToolIdSynchedItems } from \"./useActiveToolIdSynchedItems\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems\";\n\nfunction addItemToSpecifiedParentGroup<T extends ToolbarItem>(\n items: readonly T[],\n groupChildren: Array<ToolbarActionItem | ToolbarGroupItem>\n): T[] {\n const outItems: T[] = [];\n for (const toolbarItem of items) {\n if (!isToolbarGroupItem(toolbarItem)) {\n outItems.push(toolbarItem);\n continue;\n }\n\n const newChildren = addItemToSpecifiedParentGroup(\n toolbarItem.items,\n groupChildren\n );\n const foundIndices: number[] = [];\n\n groupChildren.forEach((entry, index) => {\n if (entry.parentGroupItemId === toolbarItem.id) {\n foundIndices.push(index);\n }\n });\n\n // istanbul ignore else\n if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort(\n // istanbul ignore next\n (a, b) => a - b\n )\n .reverse()\n .forEach((foundIndex) => {\n newChildren.push(groupChildren[foundIndex]);\n groupChildren.splice(foundIndex);\n });\n }\n\n outItems.push({ ...toolbarItem, items: newChildren });\n }\n return outItems;\n}\n\nfunction cloneGroup(inGroup: ToolbarGroupItem): ToolbarGroupItem {\n const childItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n inGroup.items.forEach((item) => {\n if (isToolbarGroupItem(item)) childItems.push(cloneGroup(item));\n else childItems.push(item);\n });\n\n const clonedGroup = { ...inGroup, items: childItems };\n return clonedGroup;\n}\n\nfunction getItemSortValue(item: ToolbarItem) {\n const groupValue =\n undefined === item.groupPriority\n ? 0\n : /* istanbul ignore next */ item.groupPriority;\n return groupValue * 10000 + item.itemPriority;\n}\n\nfunction sortItems(items: ReadonlyArray<ToolbarItem>): ToolbarItem[] {\n return [...items]\n .sort((a, b) => getItemSortValue(a) - getItemSortValue(b))\n .map((i) => {\n if (isToolbarGroupItem(i)) {\n return { ...i, items: sortItems(i.items) };\n }\n return i;\n });\n}\n\n/**\n * Create a forEach handler that will add every element of an array of ToolbarItems\n * to a list of items that can then be replaced in its proper place, ensuring that\n * the same item, from different list, is not added multiple times.\n * @param items Output list of items\n * @param groupChildren Output list of group children to redistribute.\n * @returns Array<ToolbarItem>.forEach handler.\n */\nfunction addIfNotDuplicate(\n items: ToolbarItem[],\n groupChildren: (ToolbarActionItem | ToolbarGroupItem)[]\n): (value: ToolbarItem) => void {\n return (srcItem: ToolbarItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n // if the default item is a group that an addon may insert into copy it so we don't mess with original\n const toolbarItem = isToolbarGroupItem(srcItem)\n ? cloneGroup(srcItem)\n : srcItem;\n if (\n (isToolbarGroupItem(toolbarItem) || isToolbarActionItem(toolbarItem)) &&\n toolbarItem.parentGroupItemId\n )\n groupChildren.push(toolbarItem);\n else items.push(toolbarItem);\n }\n };\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n defaultItems: ReadonlyArray<ToolbarItem>,\n addonItems: ReadonlyArray<ToolbarItem>\n): ToolbarItem[] {\n let items: ToolbarItem[] = [];\n const groupChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n\n defaultItems.forEach(addIfNotDuplicate(items, groupChildren));\n addonItems.forEach(addIfNotDuplicate(items, groupChildren));\n\n // if an item from an addon has specified a parent group then try to find it and insert it. If no parent is found, add item at root level.\n if (groupChildren.length) {\n items = addItemToSpecifiedParentGroup(items, groupChildren);\n\n groupChildren.forEach((toolbarItem) => {\n Logger.logWarning(\n \"ToolbarComposer\",\n `Requested Parent Group [${toolbarItem.parentGroupItemId!}] not found, so item [${\n toolbarItem.id\n }] is added directly to toolbar.`\n );\n items.push(toolbarItem);\n });\n }\n\n return sortItems(items);\n}\n\nconst useProximityOpacitySetting = () => {\n const [proximityOpacity, setProximityOpacity] = React.useState(\n UiFramework.visibility.useProximityOpacity\n );\n React.useEffect(() => {\n // istanbul ignore next\n const handleUiVisibilityChanged = () => {\n setProximityOpacity(UiFramework.visibility.useProximityOpacity);\n };\n UiFramework.onUiVisibilityChanged.addListener(handleUiVisibilityChanged);\n return () => {\n UiFramework.onUiVisibilityChanged.removeListener(\n handleUiVisibilityChanged\n );\n };\n }, []);\n return proximityOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n */\nexport interface ExtensibleToolbarProps {\n items: ToolbarItem[];\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n}\n\n/**\n * Toolbar that is populated and maintained by item managers, will override\n * isActive property based on the active tool id.\n * @public\n */\nexport function ToolbarComposer(props: ExtensibleToolbarProps) {\n const { usage, orientation } = props;\n\n // process items from addon UI providers\n const addonItems = useActiveStageProvidedToolbarItems(usage, orientation);\n\n const allItems = React.useMemo(() => {\n return combineItems(props.items, addonItems);\n }, [props.items, addonItems]);\n\n const items = useActiveToolIdSynchedItems(allItems, UiFramework.frontstages);\n\n const toolbarOrientation =\n orientation === ToolbarOrientation.Horizontal\n ? Orientation.Horizontal\n : Orientation.Vertical;\n const expandsTo =\n toolbarOrientation === Orientation.Horizontal\n ? Direction.Bottom\n : usage === ToolbarUsage.ViewNavigation\n ? Direction.Left\n : Direction.Right;\n const panelAlignment =\n toolbarOrientation === Orientation.Horizontal &&\n usage === ToolbarUsage.ViewNavigation\n ? ToolbarPanelAlignment.End\n : ToolbarPanelAlignment.Start;\n const isDragEnabled = React.useContext(ToolbarDragInteractionContext);\n const useProximityOpacity = useProximityOpacitySetting();\n\n return (\n <Toolbar\n enableOverflow={true}\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n toolbarOpacitySetting={\n useProximityOpacity && !UiFramework.isMobile()\n ? ToolbarOpacitySetting.Proximity\n : /* istanbul ignore next */ ToolbarOpacitySetting.Defaults\n }\n />\n );\n}\n"]}
|
|
@@ -6,18 +6,21 @@ import type { ActionButton, CommonToolbarItem, CustomButtonDefinition, GroupButt
|
|
|
6
6
|
import type { AnyItemDef } from "../shared/AnyItemDef";
|
|
7
7
|
import { CustomItemDef } from "../shared/CustomItemDef";
|
|
8
8
|
import type { ToolbarActionItem, ToolbarCustomItem, ToolbarGroupItem, ToolbarItem } from "./ToolbarItem";
|
|
9
|
-
/** Helper functions for defining
|
|
9
|
+
/** Helper functions for defining a Toolbar items used in `Toolbar`, `ToolbarComposer` and `UiItemsProvider`.
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export declare class ToolbarHelper {
|
|
13
|
-
/** Construct
|
|
13
|
+
/** Construct ToolbarCustomItem definitions given a CustomItemDef. */
|
|
14
14
|
static createCustomDefinitionToolbarItem(itemPriority: number, itemDef: CustomItemDef, overrides?: Partial<CustomButtonDefinition>): ToolbarCustomItem;
|
|
15
|
-
/** Construct
|
|
15
|
+
/** Construct ToolbarActionItem and ToolbarGroupItem definitions given an array of ItemDefs. */
|
|
16
16
|
static constructChildToolbarItems(itemDefs: AnyItemDef[]): Array<ToolbarActionItem | ToolbarGroupItem>;
|
|
17
17
|
private static getStringOrConditionalString;
|
|
18
18
|
static getIconReactNode(item: ActionButton | GroupButton): React.ReactNode;
|
|
19
19
|
/** Helper method to creates a generic toolbar item entry */
|
|
20
20
|
static createToolbarItemFromItemDef(itemPriority: number, itemDef: AnyItemDef, overrides?: Partial<CommonToolbarItem>): ToolbarItem;
|
|
21
|
+
/**
|
|
22
|
+
* Helper method to creates a generic toolbar item entry list.
|
|
23
|
+
*/
|
|
21
24
|
static createToolbarItemsFromItemDefs(itemDefs: AnyItemDef[], startingItemPriority?: number, overrides?: Partial<CommonToolbarItem>): ToolbarItem[];
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=ToolbarHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarHelper.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarHelper.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EAEZ,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolbarHelper.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarHelper.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EAEZ,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACZ,MAAM,eAAe,CAAC;AAkCvB;;GAEG;AACH,qBAAa,aAAa;IACxB,qEAAqE;WACvD,iCAAiC,CAC7C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,aAAa,EACtB,SAAS,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAC1C,iBAAiB;IAIpB,+FAA+F;WACjF,0BAA0B,CACtC,QAAQ,EAAE,UAAU,EAAE,GACrB,KAAK,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAI9C,OAAO,CAAC,MAAM,CAAC,4BAA4B;WAY7B,gBAAgB,CAC5B,IAAI,EAAE,YAAY,GAAG,WAAW,GAC/B,KAAK,CAAC,SAAS;IAIlB,4DAA4D;WAC9C,4BAA4B,CACxC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,UAAU,EACnB,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,WAAW;IA2Cd;;OAEG;WACW,8BAA8B,CAC1C,QAAQ,EAAE,UAAU,EAAE,EACtB,oBAAoB,SAAK,EACzB,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACrC,WAAW,EAAE;CAQjB"}
|
|
@@ -8,45 +8,36 @@ const CustomItemDef_1 = require("../shared/CustomItemDef");
|
|
|
8
8
|
const ToolItemDef_1 = require("../shared/ToolItemDef");
|
|
9
9
|
const GroupItem_1 = require("./GroupItem");
|
|
10
10
|
const ToolbarItem_1 = require("./ToolbarItem");
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Common implementation for `constructChildToolbarItems` and `createToolbarItemsFromItemDefs`.
|
|
13
|
+
* @param itemDefs List of itemDefs to convert.
|
|
14
|
+
* @param allowCustom false if we are building children and don't support custom items.
|
|
15
|
+
* @param startingItemPriority defaults to 10.
|
|
16
|
+
* @param overrides Single override to apply to each itemDefs.
|
|
17
|
+
* @returns ToolbarItem[] or (ToolbarActionItem | ToolbarGroupItem) if allowCustom is false.
|
|
18
|
+
*/
|
|
19
|
+
function constructToolbarItemArray(itemDefs, allowCustom, startingItemPriority = 10, overrides) {
|
|
20
|
+
let priority = startingItemPriority;
|
|
21
|
+
const items = [];
|
|
22
|
+
for (const itemDef of itemDefs) {
|
|
23
|
+
const item = ToolbarHelper.createToolbarItemFromItemDef(priority, itemDef, overrides);
|
|
24
|
+
priority = priority + 10;
|
|
25
|
+
if (allowCustom || (0, ToolbarItem_1.isToolbarActionItem)(item) || (0, ToolbarItem_1.isToolbarGroupItem)(item))
|
|
26
|
+
items.push(item);
|
|
27
|
+
}
|
|
28
|
+
return items;
|
|
29
|
+
}
|
|
30
|
+
/** Helper functions for defining a Toolbar items used in `Toolbar`, `ToolbarComposer` and `UiItemsProvider`.
|
|
12
31
|
* @public
|
|
13
32
|
*/
|
|
14
33
|
class ToolbarHelper {
|
|
15
|
-
/** Construct
|
|
34
|
+
/** Construct ToolbarCustomItem definitions given a CustomItemDef. */
|
|
16
35
|
static createCustomDefinitionToolbarItem(itemPriority, itemDef, overrides) {
|
|
17
|
-
|
|
18
|
-
const isDisabled = itemDef.isDisabled;
|
|
19
|
-
const internalData = new Map(); // used to store ReactNode if iconSpec hold a ReactNode
|
|
20
|
-
const icon = core_react_1.IconHelper.getIconData(itemDef.iconSpec, internalData);
|
|
21
|
-
const label = this.getStringOrConditionalString(itemDef.rawLabel);
|
|
22
|
-
const badgeType = itemDef.badgeType;
|
|
23
|
-
// istanbul ignore else
|
|
24
|
-
return {
|
|
25
|
-
id: itemDef.id,
|
|
26
|
-
itemPriority,
|
|
27
|
-
icon,
|
|
28
|
-
label,
|
|
29
|
-
isCustom: true,
|
|
30
|
-
isHidden,
|
|
31
|
-
isDisabled,
|
|
32
|
-
internalData,
|
|
33
|
-
badgeType,
|
|
34
|
-
panelContent: itemDef.popupPanelNode,
|
|
35
|
-
...overrides,
|
|
36
|
-
};
|
|
36
|
+
return this.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);
|
|
37
37
|
}
|
|
38
|
-
/** Construct
|
|
38
|
+
/** Construct ToolbarActionItem and ToolbarGroupItem definitions given an array of ItemDefs. */
|
|
39
39
|
static constructChildToolbarItems(itemDefs) {
|
|
40
|
-
|
|
41
|
-
const items = [];
|
|
42
|
-
for (const itemDef of itemDefs) {
|
|
43
|
-
const item = this.createToolbarItemFromItemDef(count, itemDef);
|
|
44
|
-
count = count + 10;
|
|
45
|
-
// istanbul ignore else
|
|
46
|
-
if ((0, ToolbarItem_1.isToolbarActionItem)(item) || (0, ToolbarItem_1.isToolbarGroupItem)(item))
|
|
47
|
-
items.push(item);
|
|
48
|
-
}
|
|
49
|
-
return items;
|
|
40
|
+
return constructToolbarItemArray(itemDefs, false);
|
|
50
41
|
}
|
|
51
42
|
static getStringOrConditionalString(inString) {
|
|
52
43
|
if (inString instanceof appui_abstract_1.ConditionalStringValue ||
|
|
@@ -59,71 +50,53 @@ class ToolbarHelper {
|
|
|
59
50
|
}
|
|
60
51
|
/** Helper method to creates a generic toolbar item entry */
|
|
61
52
|
static createToolbarItemFromItemDef(itemPriority, itemDef, overrides) {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
const { badgeType, icon, internalData, ...itemOverrides } = overrides ?? {};
|
|
54
|
+
const itemBase = {
|
|
55
|
+
id: itemDef.id,
|
|
56
|
+
itemPriority,
|
|
57
|
+
isActive: itemDef.isActive,
|
|
58
|
+
isHidden: itemDef.isHidden,
|
|
59
|
+
isDisabled: itemDef.isDisabled,
|
|
60
|
+
icon: internalData?.get(core_react_1.IconHelper.reactIconKey) ??
|
|
61
|
+
internalData?.get(core_react_1.IconHelper.conditionalIconItemKey) ??
|
|
62
|
+
icon ??
|
|
63
|
+
itemDef.iconSpec,
|
|
64
|
+
label: this.getStringOrConditionalString(itemDef.rawLabel),
|
|
65
|
+
badge: badgeType ?? itemDef.badgeType,
|
|
66
|
+
};
|
|
67
67
|
// istanbul ignore else
|
|
68
|
-
if (itemDef instanceof CommandItemDef_1.CommandItemDef) {
|
|
68
|
+
if (itemDef instanceof CommandItemDef_1.CommandItemDef || itemDef instanceof ToolItemDef_1.ToolItemDef) {
|
|
69
69
|
return {
|
|
70
|
-
|
|
71
|
-
itemPriority,
|
|
72
|
-
icon,
|
|
73
|
-
label,
|
|
74
|
-
isHidden,
|
|
75
|
-
isDisabled,
|
|
76
|
-
isActive: itemDef.isActive,
|
|
70
|
+
...itemBase,
|
|
77
71
|
execute: itemDef.execute,
|
|
78
|
-
|
|
79
|
-
...overrides,
|
|
72
|
+
...itemOverrides,
|
|
80
73
|
};
|
|
81
74
|
}
|
|
82
75
|
else if (itemDef instanceof CustomItemDef_1.CustomItemDef) {
|
|
83
|
-
return
|
|
76
|
+
return {
|
|
77
|
+
...itemBase,
|
|
78
|
+
panelContent: itemDef.popupPanelNode,
|
|
79
|
+
...itemOverrides,
|
|
80
|
+
};
|
|
84
81
|
}
|
|
85
82
|
else if (itemDef instanceof GroupItem_1.GroupItemDef) {
|
|
86
|
-
const children = this.constructChildToolbarItems(itemDef.items);
|
|
87
83
|
return {
|
|
88
|
-
|
|
89
|
-
itemPriority,
|
|
90
|
-
icon,
|
|
91
|
-
label,
|
|
84
|
+
...itemBase,
|
|
92
85
|
panelLabel: itemDef.panelLabel,
|
|
93
|
-
|
|
94
|
-
isDisabled,
|
|
95
|
-
items: children,
|
|
86
|
+
items: this.constructChildToolbarItems(itemDef.items),
|
|
96
87
|
isActive: false,
|
|
97
|
-
|
|
98
|
-
...overrides,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
else if (itemDef instanceof ToolItemDef_1.ToolItemDef) {
|
|
102
|
-
return {
|
|
103
|
-
id: itemDef.id,
|
|
104
|
-
itemPriority,
|
|
105
|
-
icon,
|
|
106
|
-
label,
|
|
107
|
-
isHidden,
|
|
108
|
-
isDisabled,
|
|
109
|
-
isActive: itemDef.isActive,
|
|
110
|
-
execute: itemDef.execute,
|
|
111
|
-
badge,
|
|
112
|
-
...overrides,
|
|
88
|
+
...itemOverrides,
|
|
113
89
|
};
|
|
114
90
|
}
|
|
115
91
|
else {
|
|
116
92
|
throw new Error(`Invalid Item type encountered, item id=${itemDef.id}`);
|
|
117
93
|
}
|
|
118
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Helper method to creates a generic toolbar item entry list.
|
|
97
|
+
*/
|
|
119
98
|
static createToolbarItemsFromItemDefs(itemDefs, startingItemPriority = 10, overrides) {
|
|
120
|
-
|
|
121
|
-
const items = itemDefs.map((itemDef) => {
|
|
122
|
-
const item = ToolbarHelper.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);
|
|
123
|
-
itemPriority = itemPriority + 10;
|
|
124
|
-
return item;
|
|
125
|
-
});
|
|
126
|
-
return items;
|
|
99
|
+
return constructToolbarItemArray(itemDefs, true, startingItemPriority, overrides);
|
|
127
100
|
}
|
|
128
101
|
}
|
|
129
102
|
exports.ToolbarHelper = ToolbarHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarHelper.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarHelper.tsx"],"names":[],"mappings":";;;AAeA,0DAA+D;AAC/D,kDAA+C;AAE/C,6DAA0D;AAC1D,2DAAwD;AACxD,uDAAoD;AACpD,2CAA2C;AAO3C,+CAAwE;AAExE
|
|
1
|
+
{"version":3,"file":"ToolbarHelper.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarHelper.tsx"],"names":[],"mappings":";;;AAeA,0DAA+D;AAC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QAAQ,EAAE,KAAK;gBACf,GAAG,aAAa;aACjB,CAAC;SACH;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,0CAA0C,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;SACzE;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,8BAA8B,CAC1C,QAAsB,EACtB,oBAAoB,GAAG,EAAE,EACzB,SAAsC;QAEtC,OAAO,yBAAyB,CAC9B,QAAQ,EACR,IAAI,EACJ,oBAAoB,EACpB,SAAS,CACV,CAAC;IACJ,CAAC;CACF;AAlGD,sCAkGC","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 */\nimport type * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalStringValue } from \"@itwin/appui-abstract\";\nimport { IconHelper } from \"@itwin/core-react\";\nimport type { AnyItemDef } from \"../shared/AnyItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { CustomItemDef } from \"../shared/CustomItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { GroupItemDef } from \"./GroupItem\";\nimport type {\n ToolbarActionItem,\n ToolbarCustomItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarActionItem, isToolbarGroupItem } from \"./ToolbarItem\";\n\n/**\n * Common implementation for `constructChildToolbarItems` and `createToolbarItemsFromItemDefs`.\n * @param itemDefs List of itemDefs to convert.\n * @param allowCustom false if we are building children and don't support custom items.\n * @param startingItemPriority defaults to 10.\n * @param overrides Single override to apply to each itemDefs.\n * @returns ToolbarItem[] or (ToolbarActionItem | ToolbarGroupItem) if allowCustom is false.\n */\nfunction constructToolbarItemArray<T extends boolean>(\n itemDefs: AnyItemDef[],\n allowCustom: T,\n startingItemPriority = 10,\n overrides?: Partial<CommonToolbarItem>\n) {\n let priority = startingItemPriority;\n const items = [];\n for (const itemDef of itemDefs) {\n const item = ToolbarHelper.createToolbarItemFromItemDef(\n priority,\n itemDef,\n overrides\n );\n priority = priority + 10;\n if (allowCustom || isToolbarActionItem(item) || isToolbarGroupItem(item))\n items.push(item);\n }\n return items as T extends true\n ? Array<ToolbarItem>\n : Array<ToolbarActionItem | ToolbarGroupItem>;\n}\n\n/** Helper functions for defining a Toolbar items used in `Toolbar`, `ToolbarComposer` and `UiItemsProvider`.\n * @public\n */\nexport class ToolbarHelper {\n /** Construct ToolbarCustomItem definitions given a CustomItemDef. */\n public static createCustomDefinitionToolbarItem(\n itemPriority: number,\n itemDef: CustomItemDef,\n overrides?: Partial<CustomButtonDefinition>\n ): ToolbarCustomItem {\n return this.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);\n }\n\n /** Construct ToolbarActionItem and ToolbarGroupItem definitions given an array of ItemDefs. */\n public static constructChildToolbarItems(\n itemDefs: AnyItemDef[]\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n return constructToolbarItemArray(itemDefs, false);\n }\n\n private static getStringOrConditionalString(\n inString: string | StringGetter | ConditionalStringValue\n ): string | ConditionalStringValue {\n if (\n inString instanceof ConditionalStringValue ||\n typeof inString === \"string\"\n )\n return inString;\n\n return inString();\n }\n\n public static getIconReactNode(\n item: ActionButton | GroupButton\n ): React.ReactNode {\n return IconHelper.getIconReactNode(item.icon, item.internalData);\n }\n\n /** Helper method to creates a generic toolbar item entry */\n public static createToolbarItemFromItemDef(\n itemPriority: number,\n itemDef: AnyItemDef,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem {\n const { badgeType, icon, internalData, ...itemOverrides } = overrides ?? {};\n const itemBase: ToolbarItem = {\n id: itemDef.id,\n itemPriority,\n isActive: itemDef.isActive,\n isHidden: itemDef.isHidden,\n isDisabled: itemDef.isDisabled,\n icon:\n internalData?.get(IconHelper.reactIconKey) ??\n internalData?.get(IconHelper.conditionalIconItemKey) ??\n icon ??\n itemDef.iconSpec,\n label: this.getStringOrConditionalString(itemDef.rawLabel),\n badge: badgeType ?? itemDef.badgeType,\n };\n\n // istanbul ignore else\n if (itemDef instanceof CommandItemDef || itemDef instanceof ToolItemDef) {\n return {\n ...itemBase,\n execute: itemDef.execute,\n ...itemOverrides,\n };\n } else if (itemDef instanceof CustomItemDef) {\n return {\n ...itemBase,\n panelContent: itemDef.popupPanelNode,\n ...itemOverrides,\n };\n } else if (itemDef instanceof GroupItemDef) {\n return {\n ...itemBase,\n panelLabel: itemDef.panelLabel,\n items: this.constructChildToolbarItems(itemDef.items),\n isActive: false,\n ...itemOverrides,\n };\n } else {\n throw new Error(`Invalid Item type encountered, item id=${itemDef.id}`);\n }\n }\n\n /**\n * Helper method to creates a generic toolbar item entry list.\n */\n public static createToolbarItemsFromItemDefs(\n itemDefs: AnyItemDef[],\n startingItemPriority = 10,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem[] {\n return constructToolbarItemArray(\n itemDefs,\n true,\n startingItemPriority,\n overrides\n );\n }\n}\n"]}
|
|
@@ -8,9 +8,9 @@ import type { IconSpec } from "@itwin/core-react";
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export declare enum ToolbarUsage {
|
|
11
|
-
/** Contains tools to Create Update and Delete content - in
|
|
11
|
+
/** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */
|
|
12
12
|
ContentManipulation = 0,
|
|
13
|
-
/** Manipulate view/camera - in
|
|
13
|
+
/** Manipulate view/camera - in AppUI this is in top right of content area. */
|
|
14
14
|
ViewNavigation = 1
|
|
15
15
|
}
|
|
16
16
|
/** Used to specify the orientation of the toolbar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItem.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings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AE3B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAChB,IAAI,IAAI,gBAAgB,CAE1B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAChB,IAAI,IAAI,iBAAiB,CAE3B"}
|
|
@@ -13,9 +13,9 @@ exports.isToolbarCustomItem = exports.isToolbarGroupItem = exports.isToolbarActi
|
|
|
13
13
|
*/
|
|
14
14
|
var ToolbarUsage;
|
|
15
15
|
(function (ToolbarUsage) {
|
|
16
|
-
/** Contains tools to Create Update and Delete content - in
|
|
16
|
+
/** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */
|
|
17
17
|
ToolbarUsage[ToolbarUsage["ContentManipulation"] = 0] = "ContentManipulation";
|
|
18
|
-
/** Manipulate view/camera - in
|
|
18
|
+
/** Manipulate view/camera - in AppUI this is in top right of content area. */
|
|
19
19
|
ToolbarUsage[ToolbarUsage["ViewNavigation"] = 1] = "ViewNavigation";
|
|
20
20
|
})(ToolbarUsage = exports.ToolbarUsage || (exports.ToolbarUsage = {}));
|
|
21
21
|
/** Used to specify the orientation of the toolbar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,
|
|
1
|
+
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AA6ED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAJD,kDAIC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,IAAiB;IAEjB,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAJD,gDAIC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAJD,kDAIC","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 type {\n BadgeType,\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { IconSpec } from \"@itwin/core-react\";\n\n/** Used to specify the usage of the toolbar which determine the toolbar position.\n * @public\n */\nexport enum ToolbarUsage {\n /** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */\n ContentManipulation = 0,\n /** Manipulate view/camera - in AppUI this is in top right of content area. */\n ViewNavigation = 1,\n}\n\n/** Used to specify the orientation of the toolbar.\n * @public\n */\nexport enum ToolbarOrientation {\n /** Horizontal toolbar. */\n Horizontal = 0,\n /** Vertical toolbar. */\n Vertical = 1,\n}\n\n/** Describes the data needed to insert a UI items into an existing set of UI items.\n * @public\n */\nexport interface CommonToolbarItem {\n /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\n readonly id: string;\n /** Describes badge. Renders no badge if not specified. */\n readonly badge?: BadgeType;\n /** Optional description */\n readonly description?: string | ConditionalStringValue;\n /** Defines if the item is active (shown with an active stripe/bar). */\n readonly isActive?: boolean;\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\n readonly isHidden?: boolean | ConditionalBooleanValue;\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\n */\n readonly groupPriority?: number;\n /** Priority within a toolbar or group. */\n readonly itemPriority: number;\n}\n\n/** Describes the data needed to insert an action button into a toolbar.\n * @public\n */\nexport interface ToolbarActionItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id. */\n readonly icon: IconSpec;\n /** label, shown as tool tip on a button or an item label in a group. */\n readonly label: string | ConditionalStringValue;\n /** function to run when the button is pressed. */\n readonly execute: () => void;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a group button into a toolbar.\n * @public\n */\nexport interface ToolbarGroupItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id. */\n readonly icon: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label: string | ConditionalStringValue;\n /** label shown as the title in at top of group panel. */\n readonly panelLabel?: string | ConditionalStringValue;\n /** children of the group */\n readonly items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a custom button into a toolbar.\n * @public\n */\nexport interface ToolbarCustomItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id. */\n readonly icon?: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label?: string | ConditionalStringValue;\n /** defines the content to display in popup panel */\n readonly panelContent?: React.ReactNode;\n}\n\n/** Any Button Type that can be inserted into a toolbar.\n * @public\n */\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarGroupItem\n | ToolbarCustomItem;\n\n/** ToolbarActionItem type guard.\n * @public\n */\nexport function isToolbarActionItem(\n item: ToolbarItem\n): item is ToolbarActionItem {\n return \"execute\" in item;\n}\n\n/** ToolbarGroupItem type guard.\n * @public\n */\nexport function isToolbarGroupItem(\n item: ToolbarItem\n): item is ToolbarGroupItem {\n return \"items\" in item;\n}\n\n/** ToolbarCustomItem type guard.\n * @public\n */\nexport function isToolbarCustomItem(\n item: ToolbarItem\n): item is ToolbarCustomItem {\n return !isToolbarActionItem(item) && !isToolbarGroupItem(item);\n}\n"]}
|
|
@@ -12,6 +12,7 @@ export interface ToolbarItemsChangedArgs {
|
|
|
12
12
|
/**
|
|
13
13
|
* Controls status bar items.
|
|
14
14
|
* @internal
|
|
15
|
+
* @deprecated in 4.4.0. This is no longer used internally, left because of an erroneous public dependency that is also deprecated.
|
|
15
16
|
*/
|
|
16
17
|
export declare class ToolbarItemsManager {
|
|
17
18
|
protected _items: ReadonlyArray<ToolbarItem>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAOH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,eAAe,CAAC;AAOvB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CAC5C;AAED
|
|
1
|
+
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AAC,MAAM,CAAC,wCAAwC;IAoBvD,OAAO,CAAC,6BAA6B;IAwBrC,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAyBvC,eAAe,CAAC,MAAM,EAAE,MAAM;CAyBtC"}
|
|
@@ -18,9 +18,12 @@ function isInstance(args) {
|
|
|
18
18
|
/**
|
|
19
19
|
* Controls status bar items.
|
|
20
20
|
* @internal
|
|
21
|
+
* @deprecated in 4.4.0. This is no longer used internally, left because of an erroneous public dependency that is also deprecated.
|
|
21
22
|
*/
|
|
22
23
|
class ToolbarItemsManager {
|
|
23
24
|
constructor(items) {
|
|
25
|
+
// This class should be removed once `useDefaultToolbarItems` and `useUiItemsProviderToolbarItems` (public version) get removed.
|
|
26
|
+
// If you are attempting to fix/clean this class, it is probably an error as it is no longer used and should not be reintroduced, use Hooks instead.
|
|
24
27
|
this._items = [];
|
|
25
28
|
/** Event raised when Toolbar items are changed.
|
|
26
29
|
* @internal
|
|
@@ -31,6 +34,7 @@ class ToolbarItemsManager {
|
|
|
31
34
|
}
|
|
32
35
|
loadItemsInternal(items, processConditions, sendItemChanged) {
|
|
33
36
|
if (processConditions && items) {
|
|
37
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
34
38
|
const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);
|
|
35
39
|
if (0 !== eventIds.length) {
|
|
36
40
|
const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(items, new Set(eventIds));
|
|
@@ -155,7 +159,9 @@ class ToolbarItemsManager {
|
|
|
155
159
|
for (const item of items) {
|
|
156
160
|
let updatedItem = { ...item };
|
|
157
161
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
158
|
-
const { childrenUpdated, childItems } =
|
|
162
|
+
const { childrenUpdated, childItems } =
|
|
163
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
164
|
+
ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);
|
|
159
165
|
// istanbul ignore else
|
|
160
166
|
if (childrenUpdated) {
|
|
161
167
|
updatedItem = {
|
|
@@ -213,7 +219,9 @@ class ToolbarItemsManager {
|
|
|
213
219
|
isActiveToolIdRefreshRequired(toolId) {
|
|
214
220
|
for (const item of this.items) {
|
|
215
221
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(item)) {
|
|
216
|
-
if (
|
|
222
|
+
if (
|
|
223
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
224
|
+
ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))
|
|
217
225
|
return true;
|
|
218
226
|
}
|
|
219
227
|
else {
|
|
@@ -232,6 +240,7 @@ class ToolbarItemsManager {
|
|
|
232
240
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
233
241
|
updatedItem = {
|
|
234
242
|
...updatedItem,
|
|
243
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
235
244
|
items: ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId),
|
|
236
245
|
};
|
|
237
246
|
}
|
|
@@ -250,6 +259,7 @@ class ToolbarItemsManager {
|
|
|
250
259
|
if ((0, ToolbarItem_1.isToolbarGroupItem)(updatedItem)) {
|
|
251
260
|
updatedItem = {
|
|
252
261
|
...updatedItem,
|
|
262
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
253
263
|
items: ToolbarItemsManager.refreshActiveToolIdInChildItems(updatedItem, toolId),
|
|
254
264
|
};
|
|
255
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,0DAG+B;AAC/B,kDAAwD;AACxD,sDAA8C;AAM9C,+CAAmD;AAEnD,SAAS,UAAU,CAAI,IAA0B;IAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AASD;;;G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W;oBACd,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;aACH;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF;AAhVD,kDAgVC","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 {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarGroupItem } from \"./ToolbarItem\";\n\nfunction isInstance<T>(args: T | ReadonlyArray<T>): args is T {\n return !Array.isArray(args);\n}\n\n/** Arguments of [[ToolbarItemsManager.onChanged]] event.\n * @internal\n */\nexport interface ToolbarItemsChangedArgs {\n readonly items: ReadonlyArray<ToolbarItem>;\n}\n\n/**\n * Controls status bar items.\n * @internal\n */\nexport class ToolbarItemsManager {\n protected _items: ReadonlyArray<ToolbarItem> = [];\n\n constructor(items?: ReadonlyArray<ToolbarItem>) {\n if (items) this.loadItemsInternal(items, true, false);\n }\n\n /** Event raised when Toolbar items are changed.\n * @internal\n */\n public readonly onItemsChanged = new BeEvent<\n (args: ToolbarItemsChangedArgs) => void\n >();\n\n private loadItemsInternal(\n items: ReadonlyArray<ToolbarItem>,\n processConditions: boolean,\n sendItemChanged: boolean\n ) {\n if (processConditions && items) {\n const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);\n if (0 !== eventIds.length) {\n const { itemsUpdated, updatedItems } =\n this.internalRefreshAffectedItems(items, new Set(eventIds));\n\n // istanbul ignore else\n if (itemsUpdated) items = updatedItems;\n }\n }\n\n this._items = items;\n if (sendItemChanged) this.onItemsChanged.raiseEvent({ items });\n }\n\n /** load items but do not fire onItemsChanged\n * @internal\n */\n public loadItems(items: ReadonlyArray<ToolbarItem>) {\n this.loadItemsInternal(items, true, false);\n }\n\n /** Get an array of the Toolbar items */\n public get items(): ReadonlyArray<ToolbarItem> {\n return this._items;\n }\n\n public set items(items: ReadonlyArray<ToolbarItem>) {\n // istanbul ignore else\n if (items !== this._items) this.loadItemsInternal(items, true, true);\n }\n\n public add(itemOrItems: ToolbarItem | ReadonlyArray<ToolbarItem>) {\n let itemsToAdd;\n if (isInstance(itemOrItems)) itemsToAdd = [itemOrItems];\n else {\n itemsToAdd = itemOrItems.filter(\n (itemToAdd, index) =>\n itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index\n );\n }\n itemsToAdd = itemsToAdd.filter(\n (itemToAdd) =>\n this._items.find((item) => item.id === itemToAdd.id) === undefined\n );\n if (itemsToAdd.length === 0) return;\n const items = [...this._items, ...itemsToAdd];\n this.items = items;\n }\n\n /** Remove Toolbar items based on id */\n public remove(\n itemIdOrItemIds: ToolbarItem[\"id\"] | ReadonlyArray<ToolbarItem[\"id\"]>\n ) {\n const items = this._items.filter((item) => {\n return isInstance(itemIdOrItemIds)\n ? item.id !== itemIdOrItemIds\n : !itemIdOrItemIds.find((itemId) => itemId === item.id);\n });\n this.items = items;\n }\n\n /** @internal */\n public removeAll() {\n this._items = [];\n }\n\n private static gatherSyncIds(\n eventIds: Set<string>,\n items: readonly ToolbarItem[]\n ) {\n for (const item of items) {\n for (const [, entry] of Object.entries(item)) {\n if (entry instanceof ConditionalBooleanValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } else if (entry instanceof ConditionalStringValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\n // istanbul ignore else\n if (isToolbarGroupItem(item)) {\n this.gatherSyncIds(eventIds, item.items);\n }\n }\n }\n\n public static getSyncIdsOfInterest(items: readonly ToolbarItem[]): string[] {\n const eventIds = new Set<string>();\n this.gatherSyncIds(eventIds, items);\n return [...eventIds.values()];\n }\n\n private static refreshChildItems(\n parentItem: ToolbarGroupItem,\n eventIds: Set<string>\n ): {\n childrenUpdated: boolean;\n childItems: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n } {\n const updatedItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n let itemsUpdated = false;\n\n for (const item of parentItem.items) {\n let updatedItem;\n if (isToolbarGroupItem(item)) {\n updatedItem = { ...item };\n const { childrenUpdated, childItems } = this.refreshChildItems(\n updatedItem,\n eventIds\n );\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem.items = childItems;\n itemsUpdated = true;\n }\n } else {\n updatedItem = { ...item };\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n entry instanceof ConditionalStringValue\n ) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (\n ConditionalIconItem.refreshValue(\n entry as ConditionalIconItem,\n eventIds\n )\n )\n itemsUpdated = true;\n }\n }\n\n updatedItems.push(updatedItem);\n }\n return { childrenUpdated: itemsUpdated, childItems: updatedItems };\n }\n\n private internalRefreshAffectedItems(\n items: readonly ToolbarItem[],\n eventIds: Set<string>\n ): { itemsUpdated: boolean; updatedItems: ToolbarItem[] } {\n // istanbul ignore next\n if (0 === eventIds.size) return { itemsUpdated: false, updatedItems: [] };\n\n let updateRequired = false;\n\n const newItems: ToolbarItem[] = [];\n for (const item of items) {\n let updatedItem = { ...item };\n if (isToolbarGroupItem(updatedItem)) {\n const { childrenUpdated, childItems } =\n ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem = {\n ...updatedItem,\n items: childItems,\n };\n updateRequired = true;\n }\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (\n ConditionalIconItem.refreshValue(\n entry as ConditionalIconItem,\n eventIds\n )\n )\n updateRequired = true;\n }\n }\n\n newItems.push(updatedItem);\n }\n\n return { itemsUpdated: updateRequired, updatedItems: newItems };\n }\n\n public refreshAffectedItems(eventIds: Set<string>) {\n // istanbul ignore next\n if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\n // istanbul ignore else\n if (itemsUpdated) this.loadItemsInternal(updatedItems, false, true);\n }\n\n private static isActiveToolIdRefreshRequiredForChildren(\n children: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>,\n toolId: string\n ): boolean {\n for (const item of children) {\n if (isToolbarGroupItem(item)) {\n if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n return false;\n }\n\n private isActiveToolIdRefreshRequired(toolId: string): boolean {\n for (const item of this.items) {\n if (isToolbarGroupItem(item)) {\n if (\n ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(\n item.items,\n toolId\n )\n )\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n\n return false;\n }\n\n private static refreshActiveToolIdInChildItems(\n parentItem: ToolbarGroupItem,\n toolId: string\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const item of parentItem.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newChildren.push(updatedItem);\n }\n return newChildren;\n }\n\n public setActiveToolId(toolId: string) {\n // first see if any updates are really necessary\n if (!this.isActiveToolIdRefreshRequired(toolId)) return;\n\n const newItems: ToolbarItem[] = [];\n for (const item of this.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newItems.push(updatedItem);\n }\n\n this.items = newItems;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,0DAG+B;AAC/B,kDAAwD;AACxD,sDAA8C;AAM9C,+CAAmD;AAEnD,SAAS,UAAU,CAAI,IAA0B;IAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AASD;;;;GAIG;A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C;YAE9B,IAAI,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE;gBACnC,WAAW,GAAG;oBACZ,GAAG,WAAW;oBACd,mDAAmD;oBACnD,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;aACH;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC5B;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF;AA7UD,kDA6UC","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 {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarGroupItem } from \"./ToolbarItem\";\n\nfunction isInstance<T>(args: T | ReadonlyArray<T>): args is T {\n return !Array.isArray(args);\n}\n\n/** Arguments of [[ToolbarItemsManager.onChanged]] event.\n * @internal\n */\nexport interface ToolbarItemsChangedArgs {\n readonly items: ReadonlyArray<ToolbarItem>;\n}\n\n/**\n * Controls status bar items.\n * @internal\n * @deprecated in 4.4.0. This is no longer used internally, left because of an erroneous public dependency that is also deprecated.\n */\nexport class ToolbarItemsManager {\n // This class should be removed once `useDefaultToolbarItems` and `useUiItemsProviderToolbarItems` (public version) get removed.\n // If you are attempting to fix/clean this class, it is probably an error as it is no longer used and should not be reintroduced, use Hooks instead.\n protected _items: ReadonlyArray<ToolbarItem> = [];\n\n constructor(items?: ReadonlyArray<ToolbarItem>) {\n if (items) this.loadItemsInternal(items, true, false);\n }\n\n /** Event raised when Toolbar items are changed.\n * @internal\n */\n public readonly onItemsChanged = new BeEvent<\n (args: ToolbarItemsChangedArgs) => void\n >();\n\n private loadItemsInternal(\n items: ReadonlyArray<ToolbarItem>,\n processConditions: boolean,\n sendItemChanged: boolean\n ) {\n if (processConditions && items) {\n // eslint-disable-next-line deprecation/deprecation\n const eventIds = ToolbarItemsManager.getSyncIdsOfInterest(items);\n if (0 !== eventIds.length) {\n const { itemsUpdated, updatedItems } =\n this.internalRefreshAffectedItems(items, new Set(eventIds));\n\n // istanbul ignore else\n if (itemsUpdated) items = updatedItems;\n }\n }\n\n this._items = items;\n if (sendItemChanged) this.onItemsChanged.raiseEvent({ items });\n }\n\n /** load items but do not fire onItemsChanged\n * @internal\n */\n public loadItems(items: ReadonlyArray<ToolbarItem>) {\n this.loadItemsInternal(items, true, false);\n }\n\n /** Get an array of the Toolbar items */\n public get items(): ReadonlyArray<ToolbarItem> {\n return this._items;\n }\n\n public set items(items: ReadonlyArray<ToolbarItem>) {\n // istanbul ignore else\n if (items !== this._items) this.loadItemsInternal(items, true, true);\n }\n\n public add(itemOrItems: ToolbarItem | ReadonlyArray<ToolbarItem>) {\n let itemsToAdd;\n if (isInstance(itemOrItems)) itemsToAdd = [itemOrItems];\n else {\n itemsToAdd = itemOrItems.filter(\n (itemToAdd, index) =>\n itemOrItems.findIndex((item) => item.id === itemToAdd.id) === index\n );\n }\n itemsToAdd = itemsToAdd.filter(\n (itemToAdd) =>\n this._items.find((item) => item.id === itemToAdd.id) === undefined\n );\n if (itemsToAdd.length === 0) return;\n const items = [...this._items, ...itemsToAdd];\n this.items = items;\n }\n\n /** Remove Toolbar items based on id */\n public remove(\n itemIdOrItemIds: ToolbarItem[\"id\"] | ReadonlyArray<ToolbarItem[\"id\"]>\n ) {\n const items = this._items.filter((item) => {\n return isInstance(itemIdOrItemIds)\n ? item.id !== itemIdOrItemIds\n : !itemIdOrItemIds.find((itemId) => itemId === item.id);\n });\n this.items = items;\n }\n\n /** @internal */\n public removeAll() {\n this._items = [];\n }\n\n private static gatherSyncIds(\n eventIds: Set<string>,\n items: readonly ToolbarItem[]\n ) {\n for (const item of items) {\n for (const [, entry] of Object.entries(item)) {\n if (entry instanceof ConditionalBooleanValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } else if (entry instanceof ConditionalStringValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\n // istanbul ignore else\n if (isToolbarGroupItem(item)) {\n this.gatherSyncIds(eventIds, item.items);\n }\n }\n }\n\n public static getSyncIdsOfInterest(items: readonly ToolbarItem[]): string[] {\n const eventIds = new Set<string>();\n this.gatherSyncIds(eventIds, items);\n return [...eventIds.values()];\n }\n\n private static refreshChildItems(\n parentItem: ToolbarGroupItem,\n eventIds: Set<string>\n ): {\n childrenUpdated: boolean;\n childItems: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n } {\n const updatedItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n let itemsUpdated = false;\n\n for (const item of parentItem.items) {\n let updatedItem;\n if (isToolbarGroupItem(item)) {\n updatedItem = { ...item };\n const { childrenUpdated, childItems } = this.refreshChildItems(\n updatedItem,\n eventIds\n );\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem.items = childItems;\n itemsUpdated = true;\n }\n } else {\n updatedItem = { ...item };\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n entry instanceof ConditionalStringValue\n ) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (ConditionalIconItem.refreshValue(entry, eventIds))\n itemsUpdated = true;\n }\n }\n\n updatedItems.push(updatedItem);\n }\n return { childrenUpdated: itemsUpdated, childItems: updatedItems };\n }\n\n private internalRefreshAffectedItems(\n items: readonly ToolbarItem[],\n eventIds: Set<string>\n ): { itemsUpdated: boolean; updatedItems: ToolbarItem[] } {\n // istanbul ignore next\n if (0 === eventIds.size) return { itemsUpdated: false, updatedItems: [] };\n\n let updateRequired = false;\n\n const newItems: ToolbarItem[] = [];\n for (const item of items) {\n let updatedItem = { ...item };\n if (isToolbarGroupItem(updatedItem)) {\n const { childrenUpdated, childItems } =\n // eslint-disable-next-line deprecation/deprecation\n ToolbarItemsManager.refreshChildItems(updatedItem, eventIds);\n // istanbul ignore else\n if (childrenUpdated) {\n updatedItem = {\n ...updatedItem,\n items: childItems,\n };\n updateRequired = true;\n }\n }\n\n for (const [, entry] of Object.entries(updatedItem)) {\n if (entry instanceof ConditionalBooleanValue) {\n // istanbul ignore else\n if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n // istanbul ignore else\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } /* istanbul ignore else */ else if (\n ConditionalIconItem.isConditionalIconItem(entry)\n ) {\n // istanbul ignore else\n if (ConditionalIconItem.refreshValue(entry, eventIds))\n updateRequired = true;\n }\n }\n\n newItems.push(updatedItem);\n }\n\n return { itemsUpdated: updateRequired, updatedItems: newItems };\n }\n\n public refreshAffectedItems(eventIds: Set<string>) {\n // istanbul ignore next\n if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\n // istanbul ignore else\n if (itemsUpdated) this.loadItemsInternal(updatedItems, false, true);\n }\n\n private static isActiveToolIdRefreshRequiredForChildren(\n children: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>,\n toolId: string\n ): boolean {\n for (const item of children) {\n if (isToolbarGroupItem(item)) {\n if (this.isActiveToolIdRefreshRequiredForChildren(item.items, toolId))\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n return false;\n }\n\n private isActiveToolIdRefreshRequired(toolId: string): boolean {\n for (const item of this.items) {\n if (isToolbarGroupItem(item)) {\n if (\n // eslint-disable-next-line deprecation/deprecation\n ToolbarItemsManager.isActiveToolIdRefreshRequiredForChildren(\n item.items,\n toolId\n )\n )\n return true;\n } else {\n const isActive = !!item.isActive;\n if (\n (isActive && item.id !== toolId) ||\n (!isActive && item.id === toolId)\n )\n return true;\n }\n }\n\n return false;\n }\n\n private static refreshActiveToolIdInChildItems(\n parentItem: ToolbarGroupItem,\n toolId: string\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n const newChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const item of parentItem.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n // eslint-disable-next-line deprecation/deprecation\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newChildren.push(updatedItem);\n }\n return newChildren;\n }\n\n public setActiveToolId(toolId: string) {\n // first see if any updates are really necessary\n if (!this.isActiveToolIdRefreshRequired(toolId)) return;\n\n const newItems: ToolbarItem[] = [];\n for (const item of this.items) {\n let updatedItem = { ...item };\n\n if (isToolbarGroupItem(updatedItem)) {\n updatedItem = {\n ...updatedItem,\n // eslint-disable-next-line deprecation/deprecation\n items: ToolbarItemsManager.refreshActiveToolIdInChildItems(\n updatedItem,\n toolId\n ),\n };\n }\n\n updatedItem.isActive = updatedItem.id === toolId;\n newItems.push(updatedItem);\n }\n\n this.items = newItems;\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import type { ToolbarItem } from "./ToolbarItem";
|
|
|
10
10
|
* @beta
|
|
11
11
|
*/
|
|
12
12
|
export interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {
|
|
13
|
-
/** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */
|
|
13
|
+
/** Describes to which direction the popup panels are expanded, also defines the orientation of the toolbar (Top/Bottom will create an horizontal toolbar, Left/Right will create a vertical toolbar). Defaults to: [[Direction.Bottom]] */
|
|
14
14
|
expandsTo?: Direction;
|
|
15
15
|
/** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */
|
|
16
16
|
overflowExpandsTo?: Direction;
|
|
@@ -27,7 +27,8 @@ export interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {
|
|
|
27
27
|
/** Optional function to call on any KeyDown events processed by toolbar */
|
|
28
28
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
29
29
|
}
|
|
30
|
-
/** Component that displays toolbar items
|
|
30
|
+
/** Component that displays toolbar items, displaying only the elements that can fit in the available space,
|
|
31
|
+
* and put the other items into a single panel.
|
|
31
32
|
* @beta
|
|
32
33
|
*/
|
|
33
34
|
export declare function ToolbarWithOverflow(props: ToolbarWithOverflowProps): JSX.Element;
|