@itwin/appui-react 4.16.4 → 4.17.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 +32 -1
- package/lib/cjs/appui-react/UiFramework.d.ts +5 -0
- package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/cjs/appui-react/UiFramework.js +5 -0
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawDialog.d.ts +1 -0
- package/lib/cjs/appui-react/accudraw/AccuDrawDialog.d.ts.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawDialog.js +1 -0
- package/lib/cjs/appui-react/accudraw/AccuDrawDialog.js.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawFieldContainer.d.ts +1 -0
- package/lib/cjs/appui-react/accudraw/AccuDrawFieldContainer.d.ts.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawFieldContainer.js +1 -0
- package/lib/cjs/appui-react/accudraw/AccuDrawFieldContainer.js.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawInputField.d.ts +1 -0
- package/lib/cjs/appui-react/accudraw/AccuDrawInputField.d.ts.map +1 -1
- package/lib/cjs/appui-react/accudraw/AccuDrawInputField.js.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposer.d.ts +1 -0
- package/lib/cjs/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposer.js +2 -0
- package/lib/cjs/appui-react/backstage/BackstageComposer.js.map +1 -1
- package/lib/cjs/appui-react/backstage/useUiItemsProviderBackstageItems.d.ts +2 -1
- package/lib/cjs/appui-react/backstage/useUiItemsProviderBackstageItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/backstage/useUiItemsProviderBackstageItems.js +2 -1
- package/lib/cjs/appui-react/backstage/useUiItemsProviderBackstageItems.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.js +10 -5
- package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.d.ts +1 -0
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js +7 -2
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.d.ts +8 -4
- package/lib/cjs/appui-react/content/ContentGroup.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.d.ts +2 -1
- package/lib/cjs/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +44 -10
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayoutProps.d.ts +63 -0
- package/lib/cjs/appui-react/content/ContentLayoutProps.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/ContentLayoutProps.js +10 -0
- package/lib/cjs/appui-react/content/ContentLayoutProps.js.map +1 -0
- package/lib/cjs/appui-react/content/ContentOverlay.d.ts +4 -0
- package/lib/cjs/appui-react/content/ContentOverlay.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentOverlay.js +33 -1
- package/lib/cjs/appui-react/content/ContentOverlay.js.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.d.ts +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.js +9 -3
- package/lib/cjs/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/cjs/appui-react/content/StageContentLayout.d.ts +1 -1
- package/lib/cjs/appui-react/content/StageContentLayout.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/StageContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/StandardContentLayouts.d.ts +20 -0
- package/lib/cjs/appui-react/content/StandardContentLayouts.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/StandardContentLayouts.js +169 -0
- package/lib/cjs/appui-react/content/StandardContentLayouts.js.map +1 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.d.ts +1 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js +1 -0
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkContent.d.ts +1 -1
- package/lib/cjs/appui-react/framework/FrameworkContent.d.ts.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkContent.js.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.d.ts +3 -0
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +1 -0
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +2 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts +2 -0
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js +5 -0
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useConditionalProp.d.ts +3 -3
- package/lib/cjs/appui-react/hooks/useConditionalProp.d.ts.map +1 -1
- package/lib/cjs/appui-react/hooks/useConditionalProp.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useConditionalValue.d.ts +1 -1
- package/lib/cjs/appui-react/hooks/useConditionalValue.js +1 -1
- package/lib/cjs/appui-react/hooks/useConditionalValue.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useUiVisibility.d.ts.map +1 -1
- package/lib/cjs/appui-react/hooks/useUiVisibility.js +1 -0
- package/lib/cjs/appui-react/hooks/useUiVisibility.js.map +1 -1
- package/lib/cjs/appui-react/layout/base/LayoutStore.d.ts +3 -1
- package/lib/cjs/appui-react/layout/base/LayoutStore.d.ts.map +1 -1
- package/lib/cjs/appui-react/layout/base/LayoutStore.js +9 -1
- package/lib/cjs/appui-react/layout/base/LayoutStore.js.map +1 -1
- package/lib/cjs/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/shared/ConditionalValue.d.ts +10 -7
- package/lib/cjs/appui-react/shared/ConditionalValue.d.ts.map +1 -1
- package/lib/cjs/appui-react/shared/ConditionalValue.js +3 -4
- package/lib/cjs/appui-react/shared/ConditionalValue.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.d.ts +1 -0
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js +10 -6
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/useDefaultStatusBarItems.d.ts +1 -0
- package/lib/cjs/appui-react/statusbar/useDefaultStatusBarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/useDefaultStatusBarItems.js +1 -0
- package/lib/cjs/appui-react/statusbar/useDefaultStatusBarItems.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/useUiItemsProviderStatusBarItems.d.ts +1 -0
- package/lib/cjs/appui-react/statusbar/useUiItemsProviderStatusBarItems.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/useUiItemsProviderStatusBarItems.js +1 -0
- package/lib/cjs/appui-react/statusbar/useUiItemsProviderStatusBarItems.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/SelectionScope.js +1 -1
- package/lib/cjs/appui-react/statusfields/SelectionScope.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts +2 -0
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.js +59 -83
- package/lib/cjs/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/cjs/appui-react/theme/ThemeManager.d.ts +7 -8
- package/lib/cjs/appui-react/theme/ThemeManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/theme/ThemeManager.js +7 -8
- package/lib/cjs/appui-react/theme/ThemeManager.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js +11 -6
- package/lib/cjs/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/BaseUiItemsProvider.d.ts +1 -0
- package/lib/cjs/appui-react/ui-items-provider/BaseUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/BaseUiItemsProvider.js +1 -0
- package/lib/cjs/appui-react/ui-items-provider/BaseUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsProvider.d.ts +3 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsProvider.js +4 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.d.ts +6 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +117 -88
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts +2 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.js +4 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts +3 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js +79 -60
- package/lib/cjs/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts +1 -0
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js +3 -0
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.d.ts +4 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +6 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/cjs/appui-react/uistate/useUiStateStorage.d.ts +1 -0
- package/lib/cjs/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
- package/lib/cjs/appui-react/uistate/useUiStateStorage.js +1 -0
- package/lib/cjs/appui-react/uistate/useUiStateStorage.js.map +1 -1
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js +26 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js.map +1 -0
- package/lib/cjs/appui-react/widgets/BasicNavigationWidget.d.ts +1 -0
- package/lib/cjs/appui-react/widgets/BasicNavigationWidget.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/BasicNavigationWidget.js +1 -0
- package/lib/cjs/appui-react/widgets/BasicNavigationWidget.js.map +1 -1
- package/lib/cjs/appui-react/widgets/BasicToolWidget.d.ts +1 -0
- package/lib/cjs/appui-react/widgets/BasicToolWidget.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/BasicToolWidget.js +1 -0
- package/lib/cjs/appui-react/widgets/BasicToolWidget.js.map +1 -1
- package/lib/cjs/appui-react/widgets/ContentToolWidgetComposer.d.ts +1 -0
- package/lib/cjs/appui-react/widgets/ContentToolWidgetComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/ContentToolWidgetComposer.js +3 -1
- package/lib/cjs/appui-react/widgets/ContentToolWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.d.ts +2 -0
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -0
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/ToolWidgetComposer.d.ts +2 -1
- package/lib/cjs/appui-react/widgets/ToolWidgetComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/ToolWidgetComposer.js +1 -0
- package/lib/cjs/appui-react/widgets/ToolWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/ViewToolWidgetComposer.d.ts +1 -0
- package/lib/cjs/appui-react/widgets/ViewToolWidgetComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/ViewToolWidgetComposer.js +1 -0
- package/lib/cjs/appui-react/widgets/ViewToolWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +7 -7
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +3 -0
- package/lib/cjs/appui-react.d.ts.map +1 -1
- package/lib/cjs/appui-react.js +3 -0
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.d.ts +5 -0
- package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +6 -1
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawDialog.d.ts +1 -0
- package/lib/esm/appui-react/accudraw/AccuDrawDialog.d.ts.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawDialog.js +1 -0
- package/lib/esm/appui-react/accudraw/AccuDrawDialog.js.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawFieldContainer.d.ts +1 -0
- package/lib/esm/appui-react/accudraw/AccuDrawFieldContainer.d.ts.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawFieldContainer.js +1 -0
- package/lib/esm/appui-react/accudraw/AccuDrawFieldContainer.js.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawInputField.d.ts +1 -0
- package/lib/esm/appui-react/accudraw/AccuDrawInputField.d.ts.map +1 -1
- package/lib/esm/appui-react/accudraw/AccuDrawInputField.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposer.d.ts +1 -0
- package/lib/esm/appui-react/backstage/BackstageComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposer.js +2 -0
- package/lib/esm/appui-react/backstage/BackstageComposer.js.map +1 -1
- package/lib/esm/appui-react/backstage/useUiItemsProviderBackstageItems.d.ts +2 -1
- package/lib/esm/appui-react/backstage/useUiItemsProviderBackstageItems.d.ts.map +1 -1
- package/lib/esm/appui-react/backstage/useUiItemsProviderBackstageItems.js +2 -1
- package/lib/esm/appui-react/backstage/useUiItemsProviderBackstageItems.js.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.js +8 -3
- package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.d.ts +1 -0
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js +7 -2
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/esm/appui-react/content/ContentGroup.d.ts +8 -4
- package/lib/esm/appui-react/content/ContentGroup.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.d.ts +2 -1
- package/lib/esm/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +45 -11
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayoutProps.d.ts +63 -0
- package/lib/esm/appui-react/content/ContentLayoutProps.d.ts.map +1 -0
- package/lib/esm/appui-react/content/ContentLayoutProps.js +9 -0
- package/lib/esm/appui-react/content/ContentLayoutProps.js.map +1 -0
- package/lib/esm/appui-react/content/ContentOverlay.d.ts +4 -0
- package/lib/esm/appui-react/content/ContentOverlay.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentOverlay.js +32 -0
- package/lib/esm/appui-react/content/ContentOverlay.js.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.d.ts +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.d.ts.map +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.d.ts.map +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.js +9 -3
- package/lib/esm/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/esm/appui-react/content/StageContentLayout.d.ts +1 -1
- package/lib/esm/appui-react/content/StageContentLayout.d.ts.map +1 -1
- package/lib/esm/appui-react/content/StageContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/StandardContentLayouts.d.ts +20 -0
- package/lib/esm/appui-react/content/StandardContentLayouts.d.ts.map +1 -0
- package/lib/esm/appui-react/content/StandardContentLayouts.js +165 -0
- package/lib/esm/appui-react/content/StandardContentLayouts.js.map +1 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.d.ts +1 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.d.ts.map +1 -1
- package/lib/esm/appui-react/content/split-pane/SplitPane.js +1 -0
- package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkContent.d.ts +1 -1
- package/lib/esm/appui-react/framework/FrameworkContent.d.ts.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkContent.js.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkFrontstages.d.ts +3 -0
- package/lib/esm/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkFrontstages.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +1 -0
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +2 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts +2 -0
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js +5 -0
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/esm/appui-react/hooks/useConditionalProp.d.ts +3 -3
- package/lib/esm/appui-react/hooks/useConditionalProp.d.ts.map +1 -1
- package/lib/esm/appui-react/hooks/useConditionalProp.js.map +1 -1
- package/lib/esm/appui-react/hooks/useConditionalValue.d.ts +1 -1
- package/lib/esm/appui-react/hooks/useConditionalValue.js +1 -1
- package/lib/esm/appui-react/hooks/useConditionalValue.js.map +1 -1
- package/lib/esm/appui-react/hooks/useUiVisibility.d.ts.map +1 -1
- package/lib/esm/appui-react/hooks/useUiVisibility.js +1 -0
- package/lib/esm/appui-react/hooks/useUiVisibility.js.map +1 -1
- package/lib/esm/appui-react/layout/base/LayoutStore.d.ts +3 -1
- package/lib/esm/appui-react/layout/base/LayoutStore.d.ts.map +1 -1
- package/lib/esm/appui-react/layout/base/LayoutStore.js +7 -0
- package/lib/esm/appui-react/layout/base/LayoutStore.js.map +1 -1
- package/lib/esm/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/esm/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/shared/ConditionalValue.d.ts +10 -7
- package/lib/esm/appui-react/shared/ConditionalValue.d.ts.map +1 -1
- package/lib/esm/appui-react/shared/ConditionalValue.js +2 -3
- package/lib/esm/appui-react/shared/ConditionalValue.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.d.ts +1 -0
- package/lib/esm/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js +10 -6
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/esm/appui-react/statusbar/useDefaultStatusBarItems.d.ts +1 -0
- package/lib/esm/appui-react/statusbar/useDefaultStatusBarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/useDefaultStatusBarItems.js +1 -0
- package/lib/esm/appui-react/statusbar/useDefaultStatusBarItems.js.map +1 -1
- package/lib/esm/appui-react/statusbar/useUiItemsProviderStatusBarItems.d.ts +1 -0
- package/lib/esm/appui-react/statusbar/useUiItemsProviderStatusBarItems.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/useUiItemsProviderStatusBarItems.js +1 -0
- package/lib/esm/appui-react/statusbar/useUiItemsProviderStatusBarItems.js.map +1 -1
- package/lib/esm/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/SelectionScope.js +1 -1
- package/lib/esm/appui-react/statusfields/SelectionScope.js.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts +2 -0
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.js +59 -83
- package/lib/esm/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/esm/appui-react/theme/ThemeManager.d.ts +7 -8
- package/lib/esm/appui-react/theme/ThemeManager.d.ts.map +1 -1
- package/lib/esm/appui-react/theme/ThemeManager.js +7 -8
- package/lib/esm/appui-react/theme/ThemeManager.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js +11 -6
- package/lib/esm/appui-react/toolbar/ToolbarItemsManager.js.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/BaseUiItemsProvider.d.ts +1 -0
- package/lib/esm/appui-react/ui-items-provider/BaseUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/BaseUiItemsProvider.js +1 -0
- package/lib/esm/appui-react/ui-items-provider/BaseUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsProvider.d.ts +3 -2
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsProvider.js +4 -2
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.d.ts +6 -2
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +117 -88
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts +2 -2
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.js +4 -2
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts +3 -2
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js +79 -60
- package/lib/esm/appui-react/ui-items-provider/StandardNavigationToolsUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts +1 -0
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js +3 -0
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.d.ts +4 -2
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +6 -2
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/esm/appui-react/uistate/useUiStateStorage.d.ts +1 -0
- package/lib/esm/appui-react/uistate/useUiStateStorage.d.ts.map +1 -1
- package/lib/esm/appui-react/uistate/useUiStateStorage.js +1 -0
- package/lib/esm/appui-react/uistate/useUiStateStorage.js.map +1 -1
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js +22 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js.map +1 -0
- package/lib/esm/appui-react/widgets/BasicNavigationWidget.d.ts +1 -0
- package/lib/esm/appui-react/widgets/BasicNavigationWidget.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/BasicNavigationWidget.js +1 -0
- package/lib/esm/appui-react/widgets/BasicNavigationWidget.js.map +1 -1
- package/lib/esm/appui-react/widgets/BasicToolWidget.d.ts +1 -0
- package/lib/esm/appui-react/widgets/BasicToolWidget.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/BasicToolWidget.js +1 -0
- package/lib/esm/appui-react/widgets/BasicToolWidget.js.map +1 -1
- package/lib/esm/appui-react/widgets/ContentToolWidgetComposer.d.ts +1 -0
- package/lib/esm/appui-react/widgets/ContentToolWidgetComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/ContentToolWidgetComposer.js +3 -1
- package/lib/esm/appui-react/widgets/ContentToolWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.d.ts +2 -0
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -0
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/ToolWidgetComposer.d.ts +2 -1
- package/lib/esm/appui-react/widgets/ToolWidgetComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/ToolWidgetComposer.js +1 -0
- package/lib/esm/appui-react/widgets/ToolWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/ViewToolWidgetComposer.d.ts +1 -0
- package/lib/esm/appui-react/widgets/ViewToolWidgetComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/ViewToolWidgetComposer.js +1 -0
- package/lib/esm/appui-react/widgets/ViewToolWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +7 -7
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react.d.ts +3 -0
- package/lib/esm/appui-react.d.ts.map +1 -1
- package/lib/esm/appui-react.js +3 -0
- package/lib/esm/appui-react.js.map +1 -1
- package/package.json +7 -7
|
@@ -28,16 +28,15 @@ const highContrastColorThemes = [
|
|
|
28
28
|
ThemeId_1.ColorTheme.HighContrastDark,
|
|
29
29
|
ThemeId_1.ColorTheme.HighContrastLight,
|
|
30
30
|
];
|
|
31
|
-
/** ThemeManager handles setting color themes
|
|
32
|
-
* affect the entire application by setting the data-theme attribute
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* Any other string will only apply the `data-theme` attribute to the `html` element
|
|
31
|
+
/** `ThemeManager` handles setting color themes. Note that this component will
|
|
32
|
+
* affect the entire application by setting the internal `data-theme` attribute.
|
|
33
|
+
* Component children are wrapped with `v2` and `v3` iTwinUI `ThemeProvider` components, so all nodes within the tree will have the same theme, and should be using iTwinUI 2.x or later.
|
|
34
|
+
* Specified `ThemeId` will be mapped to iTwinUI `theme` accordingly.
|
|
35
|
+
* Any other string will only apply the `data-theme` attribute to the underlying `html` element
|
|
37
36
|
* and `ThemeProvider` theme will be set to `inherit`, in this case the application is
|
|
38
|
-
* responsible for setting the theme by
|
|
37
|
+
* responsible for setting the theme, i.e. by using iTwinUI css variables.
|
|
39
38
|
*
|
|
40
|
-
* This
|
|
39
|
+
* This component should wrap {@link ConfigurableUiContent}.
|
|
41
40
|
*
|
|
42
41
|
* ```tsx
|
|
43
42
|
* <ThemeManager>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeManager.js","sourceRoot":"","sources":["../../../../src/appui-react/theme/ThemeManager.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA6B;AAC7B,+BAA+B;AAE/B,wDAAqD;AACrD,8DAA2E;AAE3E,uCAAqE;AACrE,8EAA2E;AAG3E,sCAAsC;AACtC,MAAM,wBAAwB,GAA+B;IAC3D,CAAC,oBAAU,CAAC,KAAK,CAAC,EAAE,OAAO;IAC3B,CAAC,oBAAU,CAAC,iBAAiB,CAAC,EAAE,OAAO;IACvC,CAAC,oBAAU,CAAC,IAAI,CAAC,EAAE,MAAM;IACzB,CAAC,oBAAU,CAAC,gBAAgB,CAAC,EAAE,MAAM;IACrC,CAAC,oBAAU,CAAC,MAAM,CAAC,EAAE,IAAI;IACzB,EAAE,EAAE,IAAI,EAAE,0CAA0C;CACrD,CAAC;AAEF,0CAA0C;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AC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,aAAa,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE7D,OAAO,CACL,oBAAC,6BAAa,IACZ,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE,aAAa,IAAI,SAAS,EACjC,YAAY,EAAE,EAAE,YAAY,EAAE,yBACV,eAAe,EACnC,UAAU,EAAE,IAAI;QAEhB,oBAAC,gCAAe,CAAC,iFAAiF,IAChG,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACzB,KAAK,EAAE,aAAa,IAAI,SAAS,EACjC,YAAY,EAAE,EAAE,YAAY,EAAE,IAE7B,QAAQ,CACO,CACJ,CACjB,CAAC;AACJ,CAAC;AA/BD,oCA+BC","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 State\n */\n\nimport \"./ThemeManager.scss\";\nimport * as React from \"react\";\nimport type { ThemeType } from \"@itwin/itwinui-react\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\nimport { ThemeProvider as ThemeProviderV2 } from \"@itwin/itwinui-react-v2\";\nimport type { ThemeId } from \"./ThemeId\";\nimport { ColorTheme, SYSTEM_PREFERRED_COLOR_THEME } from \"./ThemeId\";\nimport { useReduxFrameworkState } from \"../uistate/useReduxFrameworkState\";\nimport type { ConfigurableUiContent } from \"../configurableui/ConfigurableUiContent\";\n\n/** Map of ColorTheme to ThemeType. */\nconst colorThemeToThemeTypeMap: { [x: string]: ThemeType } = {\n [ColorTheme.Light]: \"light\",\n [ColorTheme.HighContrastLight]: \"light\",\n [ColorTheme.Dark]: \"dark\",\n [ColorTheme.HighContrastDark]: \"dark\",\n [ColorTheme.System]: \"os\",\n os: \"os\", // handle \"os\" for backwards compatibility\n};\n\n/** List of high contrast color themes. */\nconst highContrastColorThemes: string[] = [\n ColorTheme.HighContrastDark,\n ColorTheme.HighContrastLight,\n];\n\ninterface ThemeManagerProps {\n children?: React.ReactNode;\n /** Uses redux store as a fallback. Defaults to {@link SYSTEM_PREFERRED_COLOR_THEME}. */\n theme?: ThemeId;\n}\n\n/** `ThemeManager` handles setting color themes. Note that this component will\n * affect the entire application by setting the internal `data-theme` attribute.\n * Component children are wrapped with `v2` and `v3` iTwinUI `ThemeProvider` components, so all nodes within the tree will have the same theme, and should be using iTwinUI 2.x or later.\n * Specified `ThemeId` will be mapped to iTwinUI `theme` accordingly.\n * Any other string will only apply the `data-theme` attribute to the underlying `html` element\n * and `ThemeProvider` theme will be set to `inherit`, in this case the application is\n * responsible for setting the theme, i.e. by using iTwinUI css variables.\n *\n * This component should wrap {@link ConfigurableUiContent}.\n *\n * ```tsx\n * <ThemeManager>\n * <ConfigurableUiContent />\n * </ThemeManager>\n * ```\n * @public\n */\nexport function ThemeManager({ children, ...props }: ThemeManagerProps) {\n const reduxTheme = useReduxFrameworkState((state) => {\n // eslint-disable-next-line deprecation/deprecation\n return state?.configurableUiState.theme;\n });\n const theme = props.theme ?? reduxTheme ?? SYSTEM_PREFERRED_COLOR_THEME;\n\n React.useEffect(() => {\n document.documentElement.setAttribute(\"data-theme\", theme);\n }, [theme]);\n\n const providerTheme = colorThemeToThemeTypeMap[theme];\n const highContrast = highContrastColorThemes.includes(theme);\n\n return (\n <ThemeProvider\n className=\"uifw-root\"\n theme={providerTheme ?? \"inherit\"}\n themeOptions={{ highContrast }}\n data-root-container=\"appui-root-id\"\n includeCss={true}\n >\n <ThemeProviderV2 /* v2 ThemeProvider is required to fix popup styling issues in widget popouts. */\n style={{ height: \"100%\" }}\n theme={providerTheme ?? \"inherit\"}\n themeOptions={{ highContrast }}\n >\n {children}\n </ThemeProviderV2>\n </ThemeProvider>\n );\n}\n"]}
|
|
@@ -6,6 +6,7 @@ import type { ToolbarItem } from "./ToolbarItem";
|
|
|
6
6
|
import { ToolbarOrientation, ToolbarUsage } from "./ToolbarItem";
|
|
7
7
|
/** Properties for the [[ToolbarComposer]] React components
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof ToolbarComposer>`
|
|
9
10
|
*/
|
|
10
11
|
export interface ExtensibleToolbarProps {
|
|
11
12
|
/** Toolbar items. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,kBAAkB,EAClB,YAAY,EACb,MAAM,eAAe,CAAC;AA4JvB
|
|
1
|
+
{"version":3,"file":"ToolbarComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,kBAAkB,EAClB,YAAY,EACb,MAAM,eAAe,CAAC;AA4JvB;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,qBAAqB;IACrB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8FAA8F;IAC9F,KAAK,EAAE,YAAY,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED;;;;GAIG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,qBA8C5D"}
|
|
@@ -130,6 +130,7 @@ const useSnapWidgetOpacitySetting = () => {
|
|
|
130
130
|
* @note Overrides `isActive` property based on the active tool id.
|
|
131
131
|
* @public
|
|
132
132
|
*/
|
|
133
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
133
134
|
function ToolbarComposer(props) {
|
|
134
135
|
const { usage, orientation } = props;
|
|
135
136
|
// process items from addon UI providers
|
|
@@ -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,8DAKiC;AACjC,sDAA8D;AAC9D,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,CAAC;QAChC,IAAI,CAAC,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE,CAAC;YACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3B,SAAS;QACX,CAAC;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,CAAC;gBAC/C,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;YACxB,8EAA8E;YAC9E,YAAY;iBACT,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;iBACrB,OAAO,EAAE;iBACT,OAAO,CA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IACN,cAAc,EAAE,IAAI,EACpB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,aAAa,EACjC,qBAAqB,EACnB,CAAC,mBAAmB,IAAI,iBAAiB,CAAC;YAC1C,CAAC,8BAAe,CAAC,eAAe;YAC9B,CAAC,CAAC,wCAAqB,CAAC,SAAS;YACjC,CAAC,CAAC,wCAAqB,CAAC,QAAQ,GAEpC,CACH,CAAC;AACJ,CAAC;AA9CD,0CA8CC","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 Orientation,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger, ProcessDetector } from \"@itwin/core-bentley\";\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 if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort((a, b) => a - b)\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 = undefined === item.groupPriority ? 0 : 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 // eslint-disable-line deprecation/deprecation\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(\n () => setProximityOpacity(UiFramework.visibility.useProximityOpacity) // eslint-disable-line deprecation/deprecation\n );\n }, []);\n\n return proximityOpacity;\n};\n\nconst useSnapWidgetOpacitySetting = () => {\n const [snapWidgetOpacity, setSnapWidgetOpacity] = React.useState(\n UiFramework.visibility.snapWidgetOpacity\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(() =>\n setSnapWidgetOpacity(UiFramework.visibility.snapWidgetOpacity)\n );\n }, []);\n\n return snapWidgetOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n */\nexport interface ExtensibleToolbarProps {\n /** Toolbar items. */\n items: ToolbarItem[];\n /** Toolbar usage based on which additional toolbar items are added from UI item providers. */\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n}\n\n/**\n * Toolbar that is populated and maintained by UI item providers.\n * @note Overrides `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 const snapWidgetOpacity = useSnapWidgetOpacitySetting();\n\n return (\n <Toolbar\n enableOverflow={true}\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n toolbarOpacitySetting={\n (useProximityOpacity || snapWidgetOpacity) &&\n !ProcessDetector.isMobileBrowser\n ? ToolbarOpacitySetting.Proximity\n : 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,8DAKiC;AACjC,sDAA8D;AAC9D,gDAA6C;AAC7C,uDAAkE;AAMlE,+CAKuB;AACvB,uCAAoC;AACpC,+EAA4E;AAC5E,6FAA0F;AAE1F,SAAS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2B,EAAC,QAAQ,EAAE,yBAAW,CAAC,WAAW,CAAC,CAAC;IAE7E,MAAM,kBAAkB,GACtB,WAAW,KAAK,gCAAkB,CAAC,UAAU;QAC3C,CAAC,CAAC,8BAAW,CAAC,UAAU;QACxB,CAAC,CAAC,8BAAW,CAAC,QAAQ,CAAC;IAC3B,MAAM,SAAS,GACb,kBAAkB,KAAK,8BAAW,CAAC,UAAU;QAC3C,CAAC,CAAC,4BAAS,CAAC,MAAM;QAClB,CAAC,CAAC,KAAK,KAAK,0BAAY,CAAC,cAAc;YACvC,CAAC,CAAC,4BAAS,CAAC,IAAI;YAChB,CAAC,CAAC,4BAAS,CAAC,KAAK,CAAC;IACtB,MAAM,cAAc,GAClB,kBAAkB,KAAK,8BAAW,CAAC,UAAU;QAC7C,KAAK,KAAK,0BAAY,CAAC,cAAc;QACnC,CAAC,CAAC,wCAAqB,CAAC,GAAG;QAC3B,CAAC,CAAC,wCAAqB,CAAC,KAAK,CAAC;IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,+CAA6B,CAAC,CAAC;IACtE,MAAM,mBAAmB,GAAG,0BAA0B,EAAE,CAAC;IACzD,MAAM,iBAAiB,GAAG,2BAA2B,EAAE,CAAC;IAExD,OAAO,CACL,oBAAC,iBAAO,IACN,cAAc,EAAE,IAAI,EACpB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,aAAa,EACjC,qBAAqB,EACnB,CAAC,mBAAmB,IAAI,iBAAiB,CAAC;YAC1C,CAAC,8BAAe,CAAC,eAAe;YAC9B,CAAC,CAAC,wCAAqB,CAAC,SAAS;YACjC,CAAC,CAAC,wCAAqB,CAAC,QAAQ,GAEpC,CACH,CAAC;AACJ,CAAC;AA9CD,0CA8CC","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 Orientation,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger, ProcessDetector } from \"@itwin/core-bentley\";\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 if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort((a, b) => a - b)\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 = undefined === item.groupPriority ? 0 : 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 // eslint-disable-line deprecation/deprecation\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(\n () => setProximityOpacity(UiFramework.visibility.useProximityOpacity) // eslint-disable-line deprecation/deprecation\n );\n }, []);\n\n return proximityOpacity;\n};\n\nconst useSnapWidgetOpacitySetting = () => {\n const [snapWidgetOpacity, setSnapWidgetOpacity] = React.useState(\n UiFramework.visibility.snapWidgetOpacity\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(() =>\n setSnapWidgetOpacity(UiFramework.visibility.snapWidgetOpacity)\n );\n }, []);\n\n return snapWidgetOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ToolbarComposer>`\n */\nexport interface ExtensibleToolbarProps {\n /** Toolbar items. */\n items: ToolbarItem[];\n /** Toolbar usage based on which additional toolbar items are added from UI item providers. */\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n}\n\n/**\n * Toolbar that is populated and maintained by UI item providers.\n * @note Overrides `isActive` property based on the active tool id.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\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 const snapWidgetOpacity = useSnapWidgetOpacitySetting();\n\n return (\n <Toolbar\n enableOverflow={true}\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n toolbarOpacitySetting={\n (useProximityOpacity || snapWidgetOpacity) &&\n !ProcessDetector.isMobileBrowser\n ? ToolbarOpacitySetting.Proximity\n : ToolbarOpacitySetting.Defaults\n }\n />\n );\n}\n"]}
|
|
@@ -61,7 +61,7 @@ export interface CommonToolbarItem {
|
|
|
61
61
|
*/
|
|
62
62
|
export interface ToolbarActionItem extends CommonToolbarItem {
|
|
63
63
|
/** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id.
|
|
64
|
-
* @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.
|
|
64
|
+
* @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead and specify `undefined` for this property. This will be made optional in 5.0.0.
|
|
65
65
|
*/
|
|
66
66
|
readonly icon: IconSpec;
|
|
67
67
|
/** label, shown as tool tip on a button or an item label in a group. */
|
|
@@ -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,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAiGD;;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 ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\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 /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\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 /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\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\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
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,4BAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAiGD;;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 ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\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 /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\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 /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead and specify `undefined` for this property. This will be made optional in 5.0.0.\n */\n // eslint-disable-next-line deprecation/deprecation\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\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 * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\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\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItemsManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolbarItemsManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItemsManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,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;;;;GAIG;AACH,qBAAa,mBAAmB;IAG9B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAM;gBAEtC,KAAK,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;IAI9C;;OAEG;IACH,SAAgB,cAAc,iBACrB,uBAAuB,KAAK,IAAI,EACrC;IAEJ,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC;IAIlD,yCAAyC;IACzC,IAAW,KAAK,IAAI,aAAa,CAAC,WAAW,CAAC,CAE7C;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,EAEjD;IAEM,GAAG,CAAC,WAAW,EAAE,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;IAkBhE,uCAAuC;IAChC,MAAM,CACX,eAAe,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAUvE,gBAAgB;IACT,SAAS;IAIhB,OAAO,CAAC,MAAM,CAAC,aAAa;WA2Bd,oBAAoB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,EAAE;IAM3E,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA8ChC,OAAO,CAAC,4BAA4B;IA6C7B,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC;IAWjD,OAAO,CAAC,MAAM,CAAC,wCAAwC;IAoBvD,OAAO,CAAC,6BAA6B;IAwBrC,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAyBvC,eAAe,CAAC,MAAM,EAAE,MAAM;CAyBtC"}
|
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.ToolbarItemsManager = void 0;
|
|
11
11
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
12
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
+
const core_react_1 = require("@itwin/core-react");
|
|
13
14
|
const ToolbarItem_1 = require("./ToolbarItem");
|
|
14
|
-
const ConditionalValue_1 = require("../shared/ConditionalValue");
|
|
15
15
|
function isInstance(args) {
|
|
16
16
|
return !Array.isArray(args);
|
|
17
17
|
}
|
|
@@ -94,8 +94,9 @@ class ToolbarItemsManager {
|
|
|
94
94
|
}
|
|
95
95
|
else if (entry instanceof appui_abstract_1.ConditionalStringValue) {
|
|
96
96
|
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
|
97
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
97
98
|
}
|
|
98
|
-
else if (entry instanceof
|
|
99
|
+
else if (entry instanceof core_react_1.ConditionalIconItem) {
|
|
99
100
|
entry.syncEventIds.forEach((eventId) => eventIds.add(eventId.toLowerCase()));
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -133,9 +134,11 @@ class ToolbarItemsManager {
|
|
|
133
134
|
else if (entry instanceof appui_abstract_1.ConditionalStringValue) {
|
|
134
135
|
if (appui_abstract_1.ConditionalStringValue.refreshValue(entry, eventIds))
|
|
135
136
|
itemsUpdated = true;
|
|
137
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
136
138
|
}
|
|
137
|
-
else if (entry instanceof
|
|
138
|
-
|
|
139
|
+
else if (entry instanceof core_react_1.ConditionalIconItem) {
|
|
140
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
141
|
+
if (core_react_1.ConditionalIconItem.refreshValue(entry, eventIds))
|
|
139
142
|
itemsUpdated = true;
|
|
140
143
|
}
|
|
141
144
|
}
|
|
@@ -170,9 +173,11 @@ class ToolbarItemsManager {
|
|
|
170
173
|
else if (entry instanceof appui_abstract_1.ConditionalStringValue) {
|
|
171
174
|
if (appui_abstract_1.ConditionalStringValue.refreshValue(entry, eventIds))
|
|
172
175
|
updateRequired = true;
|
|
176
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
173
177
|
}
|
|
174
|
-
else if (entry instanceof
|
|
175
|
-
|
|
178
|
+
else if (entry instanceof core_react_1.ConditionalIconItem) {
|
|
179
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
180
|
+
if (core_react_1.ConditionalIconItem.refreshValue(entry, eventIds))
|
|
176
181
|
updateRequired = true;
|
|
177
182
|
}
|
|
178
183
|
}
|
|
@@ -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,sDAA8C;AAM9C,+CAAmD;AACnD,iEAAkE;AAElE,SAAS,UAAU,CAAI,IAA0B;IAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AASD;;;;GAIG;AACH,MAAa,mBAAmB;IAK9B,YAAY,KAAkC;QAJ9C,gIAAgI;QAChI,oJAAoJ;QAC1I,WAAM,GAA+B,EAAE,CAAC;QAMlD;;WAEG;QACa,mBAAc,GAAG,IAAI,sBAAO,EAEzC,CAAC;QARF,IAAI,KAAK;YAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IASO,iBAAiB,CACvB,KAAiC,EACjC,iBAA0B,EAC1B,eAAwB;QAExB,IAAI,iBAAiB,IAAI,KAAK,EAAE,CAAC;YAC/B,mDAAmD;YACnD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACjE,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC1B,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAClC,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAE9D,IAAI,YAAY;oBAAE,KAAK,GAAG,YAAY,CAAC;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,IAAI,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE,CAAC;gBACpC,WAAW,GAAG;oBACZ,GAAG,WAAW;oBACd,mDAAmD;oBACnD,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;YACJ,CAAC;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,eAAe,CAAC,MAAc;QACnC,gDAAgD;QAChD,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC;YAAE,OAAO;QAExD,MAAM,QAAQ,GAAkB,EAAE,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,WAAW,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;YAE9B,IAAI,IAAA,gCAAkB,EAAC,WAAW,CAAC,EAAE,CAAC;gBACpC,WAAW,GAAG;oBACZ,GAAG,WAAW;oBACd,mDAAmD;oBACnD,KAAK,EAAE,mBAAmB,CAAC,+BAA+B,CACxD,WAAW,EACX,MAAM,CACP;iBACF,CAAC;YACJ,CAAC;YAED,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,EAAE,KAAK,MAAM,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;CACF;AAvTD,kDAuTC","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 { BeEvent } from \"@itwin/core-bentley\";\nimport type {\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarGroupItem } from \"./ToolbarItem\";\nimport { ConditionalIconValue } from \"../shared/ConditionalValue\";\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 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 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 } else if (entry instanceof ConditionalIconValue) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\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 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 if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } else if (entry instanceof ConditionalStringValue) {\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } else if (entry instanceof ConditionalIconValue) {\n if (ConditionalIconValue.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 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 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 if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalIconValue) {\n if (ConditionalIconValue.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 if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\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"]}
|
|
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,sDAA8C;AAC9C,kDAAwD;AAMxD,+CAAmD;AAEnD,SAAS,UAAU,CAAI,IAA0B;IAC/C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AASD;;;;GAIG;AACH,MAAa,mBAAmB;IAK9B,YAAY,KAAkC;QAJ9C,gIAAgI;QAChI,oJAAoJ;QAC1I,WAAM,GAA+B,EAAE,CAAC;QAMlD;;WAEG;QACa,mBAAc,GAAG,IAAI,sBAAO,EAEzC,CAAC;QARF,IAAI,KAAK;YAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IASO,iBAAiB,CACvB,KAAiC,EACjC,iBAA0B,EAC1B,eAAwB;QAExB,IAAI,iBAAiB,IAAI,KAAK,EAAE,CAAC;YAC/B,mDAAmD;YACnD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YACjE,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC1B,MAAM,EA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,CAAC;IACxB,CAAC;CACF;AA5TD,kDA4TC","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { ConditionalIconItem } from \"@itwin/core-react\";\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 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 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 // eslint-disable-next-line deprecation/deprecation\n } else if (entry instanceof ConditionalIconItem) {\n entry.syncEventIds.forEach((eventId: string) =>\n eventIds.add(eventId.toLowerCase())\n );\n }\n }\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 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 if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n } else if (entry instanceof ConditionalStringValue) {\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n itemsUpdated = true;\n // eslint-disable-next-line deprecation/deprecation\n } else if (entry instanceof ConditionalIconItem) {\n // eslint-disable-next-line deprecation/deprecation\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 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 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 if (ConditionalBooleanValue.refreshValue(entry, eventIds))\n updateRequired = true;\n } else if (entry instanceof ConditionalStringValue) {\n if (ConditionalStringValue.refreshValue(entry, eventIds))\n updateRequired = true;\n // eslint-disable-next-line deprecation/deprecation\n } else if (entry instanceof ConditionalIconItem) {\n // eslint-disable-next-line deprecation/deprecation\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 if (0 === eventIds.size) return;\n\n const { itemsUpdated, updatedItems } = this.internalRefreshAffectedItems(\n this.items,\n eventIds\n );\n\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAcpD;;;GAGG;AACH,qBAAa,SAAS;IACpB,WAAkB,yBAAyB,gBAW1C;IAED,WAAkB,cAAc,gBAa/B;IAED,WAAkB,iBAAiB,gBAYlC;IAED,WAAkB,eAAe,gBAYhC;IAED,WAAkB,cAAc,gBAY/B;IAED,WAAkB,iBAAiB,gBAoBlC;IAED,WAAkB,eAAe,gBAoBhC;IAED,WAAkB,oBAAoB,gBAQrC;IAED,WAAkB,mBAAmB,gBAQpC;IAED,WAAkB,uBAAuB,gBA2CxC;IAED,WAAkB,cAAc,gBAY/B;IAID,WAAkB,eAAe,gBAqBhC;IAED,WAAkB,eAAe,gBAqBhC;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,8BAA8B,gBAc/C;IAGD,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,4BAA4B,gBAc7C;IAED,WAAkB,gBAAgB,iBA0BjC;IAED,WAAkB,yBAAyB,iBAuC1C;IAGD,WAAkB,0BAA0B,gBAU3C;IAGD,WAAkB,0BAA0B,gBAU3C;IAED,WAAkB,gBAAgB,iBAWjC;IAED,WAAkB,qBAAqB,mBAgBtC;IAED,WAAkB,qCAAqC,gBAUtD;CACF"}
|
|
@@ -25,6 +25,7 @@ const section_tool_svg_1 = require("@bentley/icons-generic/icons/section-tool.sv
|
|
|
25
25
|
const selection_clear_svg_1 = require("@bentley/icons-generic/icons/selection-clear.svg");
|
|
26
26
|
const itwinui_icons_react_2 = require("@itwin/itwinui-icons-react");
|
|
27
27
|
const core_react_1 = require("@itwin/core-react");
|
|
28
|
+
const getActiveViewport_1 = require("../utils/getActiveViewport");
|
|
28
29
|
/* eslint-disable deprecation/deprecation */
|
|
29
30
|
/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.
|
|
30
31
|
* @public
|
|
@@ -81,8 +82,8 @@ class CoreTools {
|
|
|
81
82
|
return new ToolItemDef_1.ToolItemDef({
|
|
82
83
|
toolId: core_frontend_1.RotateViewTool.toolId,
|
|
83
84
|
iconSpec: new appui_abstract_1.ConditionalStringValue(() => {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
85
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
86
|
+
if (viewport?.view.is2d())
|
|
86
87
|
return rotate_left_svg_1.default;
|
|
87
88
|
return gyroscope_svg_1.default;
|
|
88
89
|
}, [
|
|
@@ -102,8 +103,8 @@ class CoreTools {
|
|
|
102
103
|
label: core_frontend_1.WalkViewTool.flyover,
|
|
103
104
|
description: core_frontend_1.WalkViewTool.description,
|
|
104
105
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
105
|
-
const
|
|
106
|
-
return !!
|
|
106
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
107
|
+
return !!viewport?.view.is2d();
|
|
107
108
|
}, [
|
|
108
109
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
109
110
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -134,9 +135,8 @@ class CoreTools {
|
|
|
134
135
|
return new ToolItemDef_1.ToolItemDef({
|
|
135
136
|
toolId: core_frontend_1.ViewToggleCameraTool.toolId,
|
|
136
137
|
iconSpec: new core_react_1.ConditionalIconItem(() => {
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
138
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
139
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
140
140
|
return React.createElement(itwinui_icons_react_1.SvgCameraAnimation, null);
|
|
141
141
|
}
|
|
142
142
|
return React.createElement(itwinui_icons_react_1.SvgCameraAnimationDisabled, null);
|
|
@@ -146,9 +146,8 @@ class CoreTools {
|
|
|
146
146
|
SyncUiEventDispatcher_1.SyncUiEventId.ViewStateChanged,
|
|
147
147
|
]),
|
|
148
148
|
label: new appui_abstract_1.ConditionalStringValue(() => {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
149
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
150
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
152
151
|
return UiFramework_1.UiFramework.translate("tools.View.ToggleCamera.turnOffFlyover");
|
|
153
152
|
}
|
|
154
153
|
return UiFramework_1.UiFramework.translate("tools.View.ToggleCamera.turnOnFlyover");
|
|
@@ -159,9 +158,8 @@ class CoreTools {
|
|
|
159
158
|
]),
|
|
160
159
|
description: core_frontend_1.ViewToggleCameraTool.description,
|
|
161
160
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
162
|
-
const
|
|
163
|
-
return !(
|
|
164
|
-
activeContentControl?.viewport?.view.supportsCamera());
|
|
161
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
162
|
+
return !(viewport?.view.is3d() && viewport?.view.supportsCamera());
|
|
165
163
|
}, [
|
|
166
164
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
167
165
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -185,10 +183,10 @@ class CoreTools {
|
|
|
185
183
|
return new ToolItemDef_1.ToolItemDef({
|
|
186
184
|
toolId: core_frontend_1.ViewUndoTool.toolId,
|
|
187
185
|
isDisabled: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
190
|
-
return
|
|
191
|
-
return
|
|
186
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
187
|
+
if (!viewport)
|
|
188
|
+
return false;
|
|
189
|
+
return !viewport.isUndoPossible;
|
|
192
190
|
}, [
|
|
193
191
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
194
192
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -208,10 +206,10 @@ class CoreTools {
|
|
|
208
206
|
description: core_frontend_1.ViewRedoTool.description,
|
|
209
207
|
execute: async () => core_frontend_1.IModelApp.tools.run(core_frontend_1.ViewRedoTool.toolId, core_frontend_1.IModelApp.viewManager.selectedView),
|
|
210
208
|
isDisabled: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
return
|
|
214
|
-
return
|
|
209
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
210
|
+
if (!viewport)
|
|
211
|
+
return false;
|
|
212
|
+
return !viewport.isRedoPossible;
|
|
215
213
|
}, [
|
|
216
214
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
217
215
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -288,8 +286,8 @@ class CoreTools {
|
|
|
288
286
|
labelKey: "UiFramework:tools.sectionTools",
|
|
289
287
|
iconSpec: section_tool_svg_1.default,
|
|
290
288
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
291
|
-
const
|
|
292
|
-
return !!
|
|
289
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
290
|
+
return !!viewport?.view.is2d();
|
|
293
291
|
}, [
|
|
294
292
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
295
293
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|
|
@@ -315,8 +313,8 @@ class CoreTools {
|
|
|
315
313
|
panelLabelKey: "UiFramework:tools.sectionPanelLabel",
|
|
316
314
|
iconSpec: section_tool_svg_1.default,
|
|
317
315
|
isHidden: new appui_abstract_1.ConditionalBooleanValue(() => {
|
|
318
|
-
const
|
|
319
|
-
return !!
|
|
316
|
+
const viewport = (0, getActiveViewport_1.getActiveViewport)();
|
|
317
|
+
return !!viewport?.view.is2d();
|
|
320
318
|
}, [
|
|
321
319
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveContentChanged,
|
|
322
320
|
SyncUiEventDispatcher_1.SyncUiEventId.ActiveViewportChanged,
|