@itwin/appui-react 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/lib/cjs/appui-react/UiFramework.js +4 -7
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +1 -2
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
- package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/TimeTracker.js +1 -2
- package/lib/cjs/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +9 -12
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js +3 -4
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js +1 -2
- package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/cjs/appui-react/content/IModelViewport.js +3 -6
- package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js +1 -2
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.js +1 -1
- package/lib/cjs/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js +10 -12
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +2 -3
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/cjs/appui-react/dialog/ContentDialog.js +3 -6
- package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js +2 -3
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +33 -51
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js +2 -3
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js +8 -13
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/messages/ActivityMessage.js +5 -7
- package/lib/cjs/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/cjs/appui-react/pickers/ViewSelector.js +5 -6
- package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js +1 -2
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/cjs/appui-react/popup/PopupManager.js +1 -2
- package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +2 -2
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +11 -16
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/Indicator.js +1 -2
- package/lib/cjs/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBar.js +3 -5
- package/lib/cjs/appui-react/statusbar/StatusBar.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.js +6 -4
- package/lib/cjs/appui-react/toolbar/ToolbarHelper.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js +3 -4
- package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +10 -17
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js +8 -14
- package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
- package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +3 -3
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Content.js +8 -9
- package/lib/cjs/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +34 -32
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/StatusBar.js +1 -1
- package/lib/cjs/appui-react/widget-panels/StatusBar.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Tab.js +1 -1
- package/lib/cjs/appui-react/widget-panels/Tab.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js +13 -19
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Toolbars.js +2 -3
- package/lib/cjs/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +5 -6
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.js +2 -3
- package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +4 -7
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js +1 -2
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
- package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
- package/lib/esm/appui-react/configurableui/TimeTracker.js +1 -2
- package/lib/esm/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +9 -12
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/DefaultViewOverlay.js +3 -4
- package/lib/esm/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js +1 -2
- package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/esm/appui-react/content/IModelViewport.js +3 -6
- package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js +1 -2
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.js +1 -1
- package/lib/esm/appui-react/content/InternalContentViewManager.js.map +1 -1
- package/lib/esm/appui-react/content/split-pane/SplitPane.js +10 -12
- package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +2 -3
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/esm/appui-react/dialog/ContentDialog.js +3 -6
- package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/esm/appui-react/dialog/DialogManagerBase.js +2 -3
- package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +33 -51
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js +2 -3
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js +8 -13
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/esm/appui-react/messages/ActivityMessage.js +5 -7
- package/lib/esm/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/esm/appui-react/pickers/ViewSelector.js +5 -6
- package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js +1 -2
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/esm/appui-react/popup/PopupManager.js +1 -2
- package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +2 -2
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +11 -16
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusbar/Indicator.js +1 -2
- package/lib/esm/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBar.js +3 -5
- package/lib/esm/appui-react/statusbar/StatusBar.js.map +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
- package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarHelper.js +6 -4
- package/lib/esm/appui-react/toolbar/ToolbarHelper.js.map +1 -1
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js +3 -4
- package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js +10 -17
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js +8 -14
- package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
- package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
- package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +3 -3
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Content.js +8 -9
- package/lib/esm/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +34 -32
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/StatusBar.js +1 -1
- package/lib/esm/appui-react/widget-panels/StatusBar.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Tab.js +1 -1
- package/lib/esm/appui-react/widget-panels/Tab.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/ToolSettings.js +13 -19
- package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Toolbars.js +2 -3
- package/lib/esm/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +5 -6
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.js +2 -3
- package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiItemsManager.js","sourceRoot":"","sources":["../../../../src/appui-react/ui-items-provider/UiItemsManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAUxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AA0C/E;;GAEG;AACH,MAAa,cAAc;IAOzB;mBACe;IACR,MAAM,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAE5E,cAAc,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;IAED,wEAAwE;IACjE,MAAM,KAAK,2BA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AC,CAAC,KAAK,EAAE,EAAE;;YAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC;YAClC,MAAM,UAAU,GAAG,MAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,UAAU,mCAAI,UAAU,CAAC,EAAE,CAAC;YAEhE,uBAAuB;YACvB,IACE,UAAU,CAAC,cAAc;gBACzB,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EACvD;gBACA,UAAU;qBACP,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC;qBACtD,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAClB,uBAAuB;oBACvB,IACE,CAAC,CAAC;wBACF,OAAO,CAAC,SAAS,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC;wBAElE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;gBAC5C,CAAC,CAAC,CAAC;aACN;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;;AArTc,0CAA2B,GACxC,IAAI,GAAG,EAA+B,CAAC;AAC1B,2CAA4B,GACzC,IAAI,SAAS,EAAsC,CAAC;AACvC,+BAAgB,GAAG,mCAAmC,EAAE,CAAC;SAL7D,cAAc","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport type { MarkRequired } from \"@itwin/core-bentley\";\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\nimport type { BackstageItem } from \"../backstage/BackstageItem\";\nimport type { StagePanelLocation } from \"../stagepanels/StagePanelLocation\";\nimport type { StagePanelSection } from \"../stagepanels/StagePanelSection\";\nimport type { StatusBarItem } from \"../statusbar/StatusBarItem\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"../toolbar/ToolbarItem\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { Widget } from \"../widgets/Widget\";\nimport type { ProviderItem } from \"./ProviderItem\";\nimport type { UiItemsProvider } from \"./UiItemsProvider\";\nimport { createAbstractUiItemsManagerAdapter } from \"./AbstractUiItemsManager\";\n\n/** UiItemsProvider register event args.\n * @public\n */\nexport interface UiItemsProviderRegisteredEventArgs {\n providerId: string;\n}\n\n/** UiItemsProvider overrides allows the application that registers a provider to limit when it is allowed to provide items\n * @public\n */\nexport interface AllowedUiItemsProviderOverrides {\n /** allows providerId to be overridden in the items manager for cases where the same provider needs to provide different content to different stages */\n providerId?: string;\n /** if specified then the current stage's Usage will be compared before allowing any items to be provided */\n stageUsages?: string[];\n /** if specified then the current stage's Id will be compared before allowing any items to be provided */\n stageIds?: string[];\n}\n\n/** Allowed overrides applied to a UiItemsProvider the application that registers a provider to limit when it is allowed to provide items.\n * Note that if an override `providerId` is specified then either `stageIds` or `stageUsages` must be defined to limit when the provider's\n * items are allowed.\n * @public\n */\nexport type UiItemsProviderOverrides =\n | MarkRequired<AllowedUiItemsProviderOverrides, \"providerId\" | \"stageUsages\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"providerId\" | \"stageIds\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"stageIds\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"stageUsages\">\n | MarkRequired<\n AllowedUiItemsProviderOverrides,\n \"providerId\" | \"stageUsages\" | \"stageIds\"\n >;\n\n/** Interface that defines an instance of a UiItemsProvider and its application specified overrides. */\ninterface UiItemProviderEntry {\n provider: UiItemsProvider;\n overrides?: UiItemsProviderOverrides;\n}\n\n/** Controls registering of UiItemsProviders and calls the provider's methods when populating different parts of the User Interface.\n * @public\n */\nexport class UiItemsManager {\n private static _registeredUiItemsProviders: Map<string, UiItemProviderEntry> =\n new Map<string, UiItemProviderEntry>();\n private static _onUiProviderRegisteredEvent =\n new BeUiEvent<UiItemsProviderRegisteredEventArgs>();\n private static _abstractAdapter = createAbstractUiItemsManagerAdapter();\n\n /** For use in unit testing\n * @internal */\n public static clearAllProviders() {\n if (this._abstractAdapter) return this._abstractAdapter.clearAllProviders();\n\n UiItemsManager._registeredUiItemsProviders.clear();\n }\n\n /** Event raised any time a UiProvider is registered or unregistered. */\n public static get onUiProviderRegisteredEvent(): BeUiEvent<UiItemsProviderRegisteredEventArgs> {\n if (this._abstractAdapter)\n return this._abstractAdapter.onUiProviderRegisteredEvent;\n\n return this._onUiProviderRegisteredEvent;\n }\n\n /** Return number of registered UiProvider. */\n public static get registeredProviderIds(): string[] {\n if (this._abstractAdapter)\n return this._abstractAdapter.registeredProviderIds;\n\n const ids = [...UiItemsManager._registeredUiItemsProviders.keys()];\n return ids;\n }\n\n /** Return true if there is any registered UiProvider. */\n public static get hasRegisteredProviders(): boolean {\n if (this._abstractAdapter)\n return this._abstractAdapter.hasRegisteredProviders;\n\n return this._registeredUiItemsProviders.size > 0;\n }\n\n /**\n * Retrieves a previously loaded UiItemsProvider.\n * @param providerId id of the UiItemsProvider to get\n */\n public static getUiItemsProvider(\n providerId: string\n ): UiItemsProvider | undefined {\n if (this._abstractAdapter)\n return this._abstractAdapter.getUiItemsProvider(providerId);\n\n return UiItemsManager._registeredUiItemsProviders.get(providerId)?.provider;\n }\n\n private static sendRegisteredEvent(args: UiItemsProviderRegisteredEventArgs) {\n UiItemsManager.onUiProviderRegisteredEvent.raiseEvent(args);\n }\n\n /**\n * Registers a UiItemsProvider with the UiItemsManager.\n * @param uiProvider the UI items provider to register.\n */\n public static register(\n uiProvider: UiItemsProvider,\n overrides?: UiItemsProviderOverrides\n ): void {\n if (this._abstractAdapter)\n return this._abstractAdapter.register(uiProvider, overrides);\n\n const providerId = overrides?.providerId ?? uiProvider.id;\n\n if (UiItemsManager.getUiItemsProvider(providerId)) {\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider (${providerId}) is already loaded`\n );\n } else {\n UiItemsManager._registeredUiItemsProviders.set(providerId, {\n provider: uiProvider,\n overrides,\n });\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider ${uiProvider.id} registered as ${providerId} `\n );\n\n UiItemsManager.sendRegisteredEvent({ providerId });\n }\n }\n\n /** Remove a specific UiItemsProvider from the list of available providers. */\n public static unregister(providerId: string): void {\n if (this._abstractAdapter)\n return this._abstractAdapter.unregister(providerId);\n\n const provider = UiItemsManager.getUiItemsProvider(providerId);\n if (!provider) return;\n\n provider.onUnregister && provider.onUnregister();\n\n UiItemsManager._registeredUiItemsProviders.delete(providerId);\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider (${providerId}) unloaded`\n );\n\n // trigger a refresh of the ui\n UiItemsManager.sendRegisteredEvent({ providerId });\n }\n\n private static allowItemsFromProvider(\n entry: UiItemProviderEntry,\n stageId?: string,\n stageUsage?: string\n ) {\n // istanbul ignore else\n const overrides = entry.overrides;\n if (\n undefined !== stageId &&\n overrides?.stageIds &&\n !overrides.stageIds.some((value: string) => value === stageId)\n )\n return false;\n if (\n undefined !== stageUsage &&\n overrides?.stageUsages &&\n !overrides.stageUsages.some((value: string) => value === stageUsage)\n )\n return false;\n return true;\n }\n\n /** Called when the application is populating a toolbar so that any registered UiItemsProvider can add tool buttons that either either execute\n * an action or specify a registered ToolId into toolbar.\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @param usage usage of the toolbar\n * @param orientation orientation of the toolbar\n * @returns an array of error messages. The array will be empty if the load is successful, otherwise it is a list of one or more problems.\n */\n public static getToolbarButtonItems(\n stageId: string,\n stageUsage: string,\n usage: ToolbarUsage,\n orientation: ToolbarOrientation\n ): ReadonlyArray<ProviderItem<ToolbarItem>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getToolbarButtonItems(\n stageId,\n stageUsage,\n usage,\n orientation\n );\n\n const buttonItems: ProviderItem<ToolbarItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n // istanbul ignore else\n if (\n uiProvider.provideToolbarItems &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideToolbarItems(stageId, stageUsage, usage, orientation)\n .forEach((spec: ToolbarItem) => {\n // ignore duplicate ids\n if (\n -1 ===\n buttonItems.findIndex(\n (existingItem) => spec.id === existingItem.id\n )\n )\n buttonItems.push({ ...spec, providerId });\n });\n }\n }\n );\n\n return buttonItems;\n }\n\n /** Called when the application is populating the statusbar so that any registered UiItemsProvider can add status fields\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @returns An array of CommonStatusBarItem that will be used to create controls for the status bar.\n */\n public static getStatusBarItems(\n stageId: string,\n stageUsage: string\n ): ReadonlyArray<ProviderItem<StatusBarItem>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getStatusBarItems(stageId, stageUsage);\n\n const statusBarItems: ProviderItem<StatusBarItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (\n uiProvider.provideStatusBarItems &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideStatusBarItems(stageId, stageUsage)\n .forEach((item: StatusBarItem) => {\n // ignore duplicate ids\n if (\n -1 ===\n statusBarItems.findIndex(\n (existingItem) => item.id === existingItem.id\n )\n )\n statusBarItems.push({ ...item, providerId });\n });\n }\n }\n );\n\n return statusBarItems;\n }\n\n /** Called when the application is populating the statusbar so that any registered UiItemsProvider can add status fields\n * @returns An array of BackstageItem that will be used to create controls for the backstage menu.\n */\n public static getBackstageItems(): ReadonlyArray<\n ProviderItem<BackstageItem>\n > {\n if (this._abstractAdapter) return this._abstractAdapter.getBackstageItems();\n\n const backstageItems: ProviderItem<BackstageItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (uiProvider.provideBackstageItems) {\n // Note: We do not call this.allowItemsFromProvider here as backstage items\n uiProvider\n .provideBackstageItems() // should not be considered stage specific. If they need to be hidden\n .forEach((item: BackstageItem) => {\n // the isHidden property should be set to a ConditionalBooleanValue\n // ignore duplicate ids\n if (\n -1 ===\n backstageItems.findIndex(\n (existingItem) => item.id === existingItem.id\n )\n )\n backstageItems.push({ ...item, providerId });\n });\n }\n }\n );\n\n return backstageItems;\n }\n\n /** Called when the application is populating the Stage Panels so that any registered UiItemsProvider can add widgets\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @param location the location within the stage.\n * @param section the section within location.\n * @returns An array of widgets.\n */\n public static getWidgets(\n stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection\n ): ReadonlyArray<ProviderItem<Widget>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getWidgets(\n stageId,\n stageUsage,\n location,\n section\n );\n\n const widgets: ProviderItem<Widget>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach((entry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (\n uiProvider.provideWidgets &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideWidgets(stageId, stageUsage, location, section)\n .forEach((widget) => {\n // ignore duplicate ids\n if (\n -1 ===\n widgets.findIndex((existingItem) => widget.id === existingItem.id)\n )\n widgets.push({ ...widget, providerId });\n });\n }\n });\n\n return widgets;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UiItemsManager.js","sourceRoot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,cAAc","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport type { MarkRequired } from \"@itwin/core-bentley\";\nimport { BeUiEvent, Logger } from \"@itwin/core-bentley\";\nimport type { BackstageItem } from \"../backstage/BackstageItem\";\nimport type { StagePanelLocation } from \"../stagepanels/StagePanelLocation\";\nimport type { StagePanelSection } from \"../stagepanels/StagePanelSection\";\nimport type { StatusBarItem } from \"../statusbar/StatusBarItem\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"../toolbar/ToolbarItem\";\nimport { UiFramework } from \"../UiFramework\";\nimport type { Widget } from \"../widgets/Widget\";\nimport type { ProviderItem } from \"./ProviderItem\";\nimport type { UiItemsProvider } from \"./UiItemsProvider\";\nimport { createAbstractUiItemsManagerAdapter } from \"./AbstractUiItemsManager\";\n\n/** UiItemsProvider register event args.\n * @public\n */\nexport interface UiItemsProviderRegisteredEventArgs {\n providerId: string;\n}\n\n/** UiItemsProvider overrides allows the application that registers a provider to limit when it is allowed to provide items\n * @public\n */\nexport interface AllowedUiItemsProviderOverrides {\n /** allows providerId to be overridden in the items manager for cases where the same provider needs to provide different content to different stages */\n providerId?: string;\n /** if specified then the current stage's Usage will be compared before allowing any items to be provided */\n stageUsages?: string[];\n /** if specified then the current stage's Id will be compared before allowing any items to be provided */\n stageIds?: string[];\n}\n\n/** Allowed overrides applied to a UiItemsProvider the application that registers a provider to limit when it is allowed to provide items.\n * Note that if an override `providerId` is specified then either `stageIds` or `stageUsages` must be defined to limit when the provider's\n * items are allowed.\n * @public\n */\nexport type UiItemsProviderOverrides =\n | MarkRequired<AllowedUiItemsProviderOverrides, \"providerId\" | \"stageUsages\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"providerId\" | \"stageIds\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"stageIds\">\n | MarkRequired<AllowedUiItemsProviderOverrides, \"stageUsages\">\n | MarkRequired<\n AllowedUiItemsProviderOverrides,\n \"providerId\" | \"stageUsages\" | \"stageIds\"\n >;\n\n/** Interface that defines an instance of a UiItemsProvider and its application specified overrides. */\ninterface UiItemProviderEntry {\n provider: UiItemsProvider;\n overrides?: UiItemsProviderOverrides;\n}\n\n/** Controls registering of UiItemsProviders and calls the provider's methods when populating different parts of the User Interface.\n * @public\n */\nexport class UiItemsManager {\n private static _registeredUiItemsProviders: Map<string, UiItemProviderEntry> =\n new Map<string, UiItemProviderEntry>();\n private static _onUiProviderRegisteredEvent =\n new BeUiEvent<UiItemsProviderRegisteredEventArgs>();\n private static _abstractAdapter = createAbstractUiItemsManagerAdapter();\n\n /** For use in unit testing\n * @internal */\n public static clearAllProviders() {\n if (this._abstractAdapter) return this._abstractAdapter.clearAllProviders();\n\n UiItemsManager._registeredUiItemsProviders.clear();\n }\n\n /** Event raised any time a UiProvider is registered or unregistered. */\n public static get onUiProviderRegisteredEvent(): BeUiEvent<UiItemsProviderRegisteredEventArgs> {\n if (this._abstractAdapter)\n return this._abstractAdapter.onUiProviderRegisteredEvent;\n\n return this._onUiProviderRegisteredEvent;\n }\n\n /** Return number of registered UiProvider. */\n public static get registeredProviderIds(): string[] {\n if (this._abstractAdapter)\n return this._abstractAdapter.registeredProviderIds;\n\n const ids = [...UiItemsManager._registeredUiItemsProviders.keys()];\n return ids;\n }\n\n /** Return true if there is any registered UiProvider. */\n public static get hasRegisteredProviders(): boolean {\n if (this._abstractAdapter)\n return this._abstractAdapter.hasRegisteredProviders;\n\n return this._registeredUiItemsProviders.size > 0;\n }\n\n /**\n * Retrieves a previously loaded UiItemsProvider.\n * @param providerId id of the UiItemsProvider to get\n */\n public static getUiItemsProvider(\n providerId: string\n ): UiItemsProvider | undefined {\n if (this._abstractAdapter)\n return this._abstractAdapter.getUiItemsProvider(providerId);\n\n return UiItemsManager._registeredUiItemsProviders.get(providerId)?.provider;\n }\n\n private static sendRegisteredEvent(args: UiItemsProviderRegisteredEventArgs) {\n UiItemsManager.onUiProviderRegisteredEvent.raiseEvent(args);\n }\n\n /**\n * Registers a UiItemsProvider with the UiItemsManager.\n * @param uiProvider the UI items provider to register.\n */\n public static register(\n uiProvider: UiItemsProvider,\n overrides?: UiItemsProviderOverrides\n ): void {\n if (this._abstractAdapter)\n return this._abstractAdapter.register(uiProvider, overrides);\n\n const providerId = overrides?.providerId ?? uiProvider.id;\n\n if (UiItemsManager.getUiItemsProvider(providerId)) {\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider (${providerId}) is already loaded`\n );\n } else {\n UiItemsManager._registeredUiItemsProviders.set(providerId, {\n provider: uiProvider,\n overrides,\n });\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider ${uiProvider.id} registered as ${providerId} `\n );\n\n UiItemsManager.sendRegisteredEvent({ providerId });\n }\n }\n\n /** Remove a specific UiItemsProvider from the list of available providers. */\n public static unregister(providerId: string): void {\n if (this._abstractAdapter)\n return this._abstractAdapter.unregister(providerId);\n\n const provider = UiItemsManager.getUiItemsProvider(providerId);\n if (!provider) return;\n\n provider.onUnregister && provider.onUnregister();\n\n UiItemsManager._registeredUiItemsProviders.delete(providerId);\n Logger.logInfo(\n UiFramework.loggerCategory(this),\n `UiItemsProvider (${providerId}) unloaded`\n );\n\n // trigger a refresh of the ui\n UiItemsManager.sendRegisteredEvent({ providerId });\n }\n\n private static allowItemsFromProvider(\n entry: UiItemProviderEntry,\n stageId?: string,\n stageUsage?: string\n ) {\n // istanbul ignore else\n const overrides = entry.overrides;\n if (\n undefined !== stageId &&\n overrides?.stageIds &&\n !overrides.stageIds.some((value: string) => value === stageId)\n )\n return false;\n if (\n undefined !== stageUsage &&\n overrides?.stageUsages &&\n !overrides.stageUsages.some((value: string) => value === stageUsage)\n )\n return false;\n return true;\n }\n\n /** Called when the application is populating a toolbar so that any registered UiItemsProvider can add tool buttons that either either execute\n * an action or specify a registered ToolId into toolbar.\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @param usage usage of the toolbar\n * @param orientation orientation of the toolbar\n * @returns an array of error messages. The array will be empty if the load is successful, otherwise it is a list of one or more problems.\n */\n public static getToolbarButtonItems(\n stageId: string,\n stageUsage: string,\n usage: ToolbarUsage,\n orientation: ToolbarOrientation\n ): ReadonlyArray<ProviderItem<ToolbarItem>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getToolbarButtonItems(\n stageId,\n stageUsage,\n usage,\n orientation\n );\n\n const buttonItems: ProviderItem<ToolbarItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n // istanbul ignore else\n if (\n uiProvider.provideToolbarItems &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideToolbarItems(stageId, stageUsage, usage, orientation)\n .forEach((spec: ToolbarItem) => {\n // ignore duplicate ids\n if (\n -1 ===\n buttonItems.findIndex(\n (existingItem) => spec.id === existingItem.id\n )\n )\n buttonItems.push({ ...spec, providerId });\n });\n }\n }\n );\n\n return buttonItems;\n }\n\n /** Called when the application is populating the statusbar so that any registered UiItemsProvider can add status fields\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @returns An array of CommonStatusBarItem that will be used to create controls for the status bar.\n */\n public static getStatusBarItems(\n stageId: string,\n stageUsage: string\n ): ReadonlyArray<ProviderItem<StatusBarItem>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getStatusBarItems(stageId, stageUsage);\n\n const statusBarItems: ProviderItem<StatusBarItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (\n uiProvider.provideStatusBarItems &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideStatusBarItems(stageId, stageUsage)\n .forEach((item: StatusBarItem) => {\n // ignore duplicate ids\n if (\n -1 ===\n statusBarItems.findIndex(\n (existingItem) => item.id === existingItem.id\n )\n )\n statusBarItems.push({ ...item, providerId });\n });\n }\n }\n );\n\n return statusBarItems;\n }\n\n /** Called when the application is populating the statusbar so that any registered UiItemsProvider can add status fields\n * @returns An array of BackstageItem that will be used to create controls for the backstage menu.\n */\n public static getBackstageItems(): ReadonlyArray<\n ProviderItem<BackstageItem>\n > {\n if (this._abstractAdapter) return this._abstractAdapter.getBackstageItems();\n\n const backstageItems: ProviderItem<BackstageItem>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach(\n (entry: UiItemProviderEntry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (uiProvider.provideBackstageItems) {\n // Note: We do not call this.allowItemsFromProvider here as backstage items\n uiProvider\n .provideBackstageItems() // should not be considered stage specific. If they need to be hidden\n .forEach((item: BackstageItem) => {\n // the isHidden property should be set to a ConditionalBooleanValue\n // ignore duplicate ids\n if (\n -1 ===\n backstageItems.findIndex(\n (existingItem) => item.id === existingItem.id\n )\n )\n backstageItems.push({ ...item, providerId });\n });\n }\n }\n );\n\n return backstageItems;\n }\n\n /** Called when the application is populating the Stage Panels so that any registered UiItemsProvider can add widgets\n * @param stageId a string identifier the active stage.\n * @param stageUsage the StageUsage of the active stage.\n * @param location the location within the stage.\n * @param section the section within location.\n * @returns An array of widgets.\n */\n public static getWidgets(\n stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection\n ): ReadonlyArray<ProviderItem<Widget>> {\n if (this._abstractAdapter)\n return this._abstractAdapter.getWidgets(\n stageId,\n stageUsage,\n location,\n section\n );\n\n const widgets: ProviderItem<Widget>[] = [];\n\n UiItemsManager._registeredUiItemsProviders.forEach((entry) => {\n const uiProvider = entry.provider;\n const providerId = entry.overrides?.providerId ?? uiProvider.id;\n\n // istanbul ignore else\n if (\n uiProvider.provideWidgets &&\n this.allowItemsFromProvider(entry, stageId, stageUsage)\n ) {\n uiProvider\n .provideWidgets(stageId, stageUsage, location, section)\n .forEach((widget) => {\n // ignore duplicate ids\n if (\n -1 ===\n widgets.findIndex((existingItem) => widget.id === existingItem.id)\n )\n widgets.push({ ...widget, providerId });\n });\n }\n });\n\n return widgets;\n }\n}\n"]}
|
|
@@ -79,7 +79,7 @@ export class FrameworkUiAdmin extends UiAdmin {
|
|
|
79
79
|
/** Resolve location and parent element */
|
|
80
80
|
resolveHtmlElement(location, htmlElement) {
|
|
81
81
|
const position = location;
|
|
82
|
-
const el = htmlElement
|
|
82
|
+
const el = htmlElement ?? UiFramework.controls.getWrapperElement();
|
|
83
83
|
return { position, el };
|
|
84
84
|
}
|
|
85
85
|
getKeyins() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameworkUiAdmin.js","sourceRoot":"","sources":["../../../../src/appui-react/uiadmin/FrameworkUiAdmin.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAejD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iDAAi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ACF,aAAa,GACjB,EACF,EAAE,CACH,CAAC;YACF,OAAO,IAAI,CAAC;SACb;aAAM;YACL,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAC/B,oBAAC,oBAAoB,IACnB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,EAAE,KACF,aAAa,GACjB,EACF,EAAE,CACH,CAAC;YACF,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,yCAAyC;IACzB,WAAW,CAAC,QAAgB;QAC1C,uBAAuB;QACvB,IACE,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAC5C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,IACE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;CACF","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 Admin\n */\n\nimport * as React from \"react\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n AbstractMenuItemProps,\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n DialogProps,\n IMatch,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnNumberCommitFunc,\n OnValueCommitFunc,\n Primitives,\n PropertyDescription,\n PropertyRecord,\n} from \"@itwin/appui-abstract\";\nimport { RelativePosition, UiAdmin } from \"@itwin/appui-abstract\";\nimport { AccuDrawPopupManager } from \"../accudraw/AccuDrawPopupManager\";\nimport { CursorInformation } from \"../cursor/CursorInformation\";\nimport { PopupManager } from \"../popup/PopupManager\";\nimport type { CursorMenuData } from \"../redux/SessionState\";\nimport { UiFramework } from \"../UiFramework\";\nimport { UiDataProvidedDialog } from \"../dialog/UiDataProvidedDialog\";\n\n/** Controls whether localized and/or non-localized key-in strings appear in a KeyinField's auto-completion list.\n * @public\n */\nexport enum KeyinFieldLocalization {\n /** Include only non-localized key-in strings. */\n NonLocalized,\n /** Include only localized key-in strings. */\n Localized,\n /** Include localized and non-localized strings for each key-in. */\n Both,\n}\n\n/** Defines a keyin entry to show/filter in UI\n * @public\n */\nexport interface KeyinEntry {\n /** string that matched a filter string */\n value: string;\n /** define array of start and end positions of filter matches. */\n matches?: IMatch[];\n /** true if entry was loaded from key-in history */\n isHistory?: boolean;\n}\n\n/** The UiAdmin controls various UI components and is callable from IModelApp.uiAdmin in the core-frontend package.\n * @public\n */\nexport class FrameworkUiAdmin extends UiAdmin {\n private _localizedKeyinPreference: KeyinFieldLocalization =\n KeyinFieldLocalization.NonLocalized;\n\n public get localizedKeyinPreference(): KeyinFieldLocalization {\n return this._localizedKeyinPreference;\n }\n public set localizedKeyinPreference(preference: KeyinFieldLocalization) {\n this._localizedKeyinPreference = preference;\n }\n\n /** @internal */\n public override onInitialized() {}\n\n /** Gets the cursor X and Y position, which is mouseEvent.pageX and mouseEvent.pageY. */\n public override get cursorPosition(): XAndY {\n return CursorInformation.cursorPosition;\n }\n\n /** Determines if focus is set to Home */\n public override get isFocusOnHome(): boolean {\n return UiFramework.keyboardShortcuts.isFocusOnHome;\n }\n\n /** Sets focus to Home */\n public override setFocusToHome(): void {\n UiFramework.keyboardShortcuts.setFocusToHome();\n }\n\n /** Show a context menu at a particular location.\n * @param items Properties of the menu items to display.\n * @param location Location of the context menu, relative to the origin of htmlElement or the overall window.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showContextMenu(\n items: AbstractMenuItemProps[],\n location: XAndY,\n htmlElement?: HTMLElement\n ): boolean {\n let position = location;\n let childWindowId: string | undefined;\n if (htmlElement) {\n const anchorOffset = htmlElement.getBoundingClientRect();\n position = {\n x: anchorOffset.left + location.x,\n y: anchorOffset.top + location.y,\n };\n childWindowId = UiFramework.childWindows.findId(\n htmlElement.ownerDocument.defaultView\n );\n }\n\n const offset = -8;\n position = { x: position.x + offset, y: position.y + offset };\n\n const cursorMenu: CursorMenuData = { position, items, childWindowId };\n UiFramework.openCursorMenu(cursorMenu);\n\n return true;\n }\n\n /** Resolve location and parent element */\n private resolveHtmlElement(\n location: XAndY,\n htmlElement?: HTMLElement\n ): { position: XAndY; el: HTMLElement } {\n const position = location;\n const el = htmlElement ?? UiFramework.controls.getWrapperElement();\n return { position, el };\n }\n\n public getKeyins(): KeyinEntry[] {\n const toolKeyins: KeyinEntry[] = [];\n const tools = IModelApp.tools.getToolList();\n for (const tool of tools) {\n switch (this.localizedKeyinPreference) {\n case KeyinFieldLocalization.Localized:\n toolKeyins.push({ value: tool.keyin });\n break;\n case KeyinFieldLocalization.Both:\n toolKeyins.push({ value: tool.keyin });\n // istanbul ignore else\n if (tool.keyin === tool.englishKeyin) break;\n // istanbul ignore next\n default: // eslint-disable-line no-fallthrough\n case KeyinFieldLocalization.NonLocalized:\n // istanbul ignore next\n if (\n KeyinFieldLocalization.NonLocalized ===\n this.localizedKeyinPreference ||\n (KeyinFieldLocalization.Both === this.localizedKeyinPreference &&\n tool.englishKeyin !== tool.keyin)\n )\n toolKeyins.push({ value: tool.englishKeyin });\n break;\n }\n }\n\n return toolKeyins;\n }\n\n /** Show the Key-in Palette to display key-in from all registered Tools.\n * @param htmlElement The HTMLElement that anchors the Popup. If undefined, the location is relative to the overall window.\n * @return true if the Command Palette was displayed, false if it could not be displayed.\n */\n public override showKeyinPalette(htmlElement?: HTMLElement): boolean {\n if (!this.featureFlags.allowKeyinPalette) return false;\n\n // istanbul ignore next\n const el = htmlElement\n ? htmlElement\n : UiFramework.controls.getWrapperElement();\n\n // istanbul ignore next\n const hidePopup = () => {\n IModelApp.uiAdmin.hideKeyinPalette();\n };\n\n return PopupManager.showKeyinPalette(\n this.getKeyins(),\n el,\n hidePopup,\n hidePopup\n );\n }\n\n /** Hides the Key-in Palette. */\n public override hideKeyinPalette(): boolean {\n if (!this.featureFlags.allowKeyinPalette) return false;\n\n return PopupManager.hideKeyinPalette();\n }\n\n /** Show a Toolbar at a particular location.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Toolbar, relative to the origin of htmlElement or the overall window.\n * @param offset Offset of the Toolbar from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Toolbar\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param htmlElement The HTMLElement that anchors the Toolbar. If undefined, the location is relative to the overall window.\n * @return true if the Toolbar was displayed, false if the Toolbar could not be displayed.\n */\n public override showToolbar(\n toolbarProps: AbstractToolbarProps,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showToolbar(\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the toolbar. */\n public override hideToolbar(): boolean {\n return PopupManager.hideToolbar();\n }\n\n /** Show a menu button at a particular location. A menu button opens a context menu.\n * @param id Id of the menu button. Multiple menu buttons may be displayed.\n * @param menuItemsProps Properties of the menu items to display.\n * @param location Location of the context menu, relative to the origin of htmlElement or the window.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showMenuButton(\n id: string,\n menuItemsProps: AbstractMenuItemProps[],\n location: XAndY,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showMenuButton(\n id,\n el,\n position,\n menuItemsProps\n );\n }\n\n /** Hides a menu button.\n * @param id Id of the menu button. Multiple menu buttons may be displayed.\n * @return true if the menu was hidden, false if the menu could not be hidden.\n */\n public override hideMenuButton(id: string): boolean {\n return AccuDrawPopupManager.hideMenuButton(id);\n }\n\n /** Show a calculator at a particular location.\n * @param initialValue Value initially displayed in the calculator.\n * @param resultIcon Icon displayed to the left of the value.\n * @param location Location of the calculator, relative to the origin of htmlElement or the window.\n * @param onOk Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showCalculator(\n initialValue: number,\n resultIcon: string,\n location: XAndY,\n onOk: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showCalculator(\n el,\n position,\n initialValue,\n resultIcon,\n onOk,\n onCancel\n );\n }\n\n /** Hides the calculator. */\n public override hideCalculator(): boolean {\n return AccuDrawPopupManager.hideCalculator();\n }\n\n /** Show an input editor for an angle value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showAngleEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showAngleEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a length value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showLengthEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showLengthEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a height value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showHeightEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showHeightEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a primitive value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param propertyDescription Description of the primitive value property\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showInputEditor(\n initialValue: Primitives.Value,\n propertyDescription: PropertyDescription,\n location: XAndY,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return PopupManager.showInputEditor(\n el,\n position,\n initialValue,\n propertyDescription,\n onCommit,\n onCancel\n );\n }\n\n /** Hides the input editor. */\n public override hideInputEditor(): boolean {\n return PopupManager.hideInputEditor();\n }\n\n /** Show an HTML element at a particular location.\n * @param displayElement The HTMLElement to display\n * @param location Location of the display element, relative to the origin of htmlElement or the window\n * @param offset Offset of the display element from the location\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the display element\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the display element. If undefined, the location is relative to the overall window.\n * @return true if the display element was displayed, false if the display element could not be displayed.\n */\n public override showHTMLElement(\n displayElement: HTMLElement,\n location: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showHTMLElement(\n displayElement,\n el,\n position,\n offset,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the HTML Element. */\n public override hideHTMLElement(): boolean {\n return PopupManager.hideHTMLElement();\n }\n\n /** Show a Card containing content, a title and a toolbar at a particular location.\n * @param content The HTMLElement of the content to display\n * @param title Title to display at the top of the card.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Card, relative to the origin of htmlElement or the window.\n * @param offset Offset of the Card from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Card\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the Card. If undefined, the location is relative to the overall window.\n * @return true if the Card was displayed, false if the Card could not be displayed.\n */\n public override showCard(\n content: HTMLElement,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showCard(\n content,\n title,\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Show a Card containing React-based content, a title and a toolbar at a particular location.\n * @param content The React node of the content to display\n * @param title Title to display at the top of the card.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Card, relative to the origin of htmlElement or the window.\n * @param offset Offset of the Card from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Card\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the Card. If undefined, the location is relative to the overall window.\n * @return true if the Card was displayed, false if the Card could not be displayed.\n */\n public showReactCard(\n content: React.ReactNode,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n const reactContent = { reactNode: content };\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showCard(\n reactContent,\n title,\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the Card. */\n public override hideCard(): boolean {\n return PopupManager.hideCard();\n }\n\n /** Opens a Tool Settings Ui popup at a particular location.\n * @param dataProvider The DialogLayoutDataProvider for the tool settings popup dialog.\n * @param location Location of the tool settings, relative to the origin of anchorElement or the window\n * @param offset Offset of the tool settings from the location\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the tool settings\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the tool settings. If undefined, the location is relative to the overall window.\n * @return true if the tool settings were displayed, false if the tool settings could not be displayed.\n */\n public override openToolSettingsPopup(\n dataProvider: DialogLayoutDataProvider,\n location: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.openToolSettings(\n dataProvider,\n el,\n position,\n offset,\n onCancel,\n relativePosition\n );\n }\n\n /** Closes the Tool Settings Ui popup. */\n public override closeToolSettingsPopup(): boolean {\n return PopupManager.closeToolSettings();\n }\n\n /** Opens a Dialog and automatically populates it using the properties defined by the UiDataProvider.\n * @param uiDataProvider The UiDataProvider for the tool settings\n * @param title Specify title for dialog.\n * @param isModal Specify if the dialog is opened as a modal or modeless.\n * @param id Id of the dialog that is used to close it.\n * @param optionalProps Optional props for Dialog construction.\n * @return true if the tool settings were displayed, false if the tool settings could not be displayed.\n */\n public override openDialog(\n uiDataProvider: DialogLayoutDataProvider,\n title: string,\n isModal: boolean,\n id: string,\n optionalProps?: DialogProps\n ): boolean {\n if (isModal) {\n UiFramework.dialogs.modal.open(\n <UiDataProvidedDialog\n uiDataProvider={uiDataProvider}\n title={title}\n isModal={isModal}\n id={id}\n {...optionalProps}\n />,\n id\n );\n return true;\n } else {\n UiFramework.dialogs.modeless.open(\n <UiDataProvidedDialog\n uiDataProvider={uiDataProvider}\n title={title}\n isModal={isModal}\n id={id}\n {...optionalProps}\n />,\n id\n );\n return true;\n }\n }\n\n /** Closes the Tool Settings Ui popup. */\n public override closeDialog(dialogId: string): boolean {\n // istanbul ignore else\n if (\n UiFramework.dialogs.modeless.dialogs.findIndex(\n (info) => info.id === dialogId\n )\n ) {\n UiFramework.dialogs.modeless.close(dialogId);\n return true;\n }\n\n // istanbul ignore else\n if (\n UiFramework.dialogs.modal.dialogs.findIndex(\n (info) => info.id === dialogId\n )\n ) {\n UiFramework.dialogs.modal.close();\n return true;\n }\n\n // istanbul ignore next\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FrameworkUiAdmin.js","sourceRoot":"","sources":["../../../../src/appui-react/uiadmin/FrameworkUiAdmin.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAejD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iDAAiD;IACjD,mFAAY,CAAA;IACZ,6CAA6C;IAC7C,6EAAS,CAAA;IACT,mEAAmE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,CAAC,QAAQ,CAAC,IAAI,CAC/B,oBAAC,oBAAoB,IACnB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,EAAE,KACF,aAAa,GACjB,EACF,EAAE,CACH,CAAC;YACF,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,yCAAyC;IACzB,WAAW,CAAC,QAAgB;QAC1C,uBAAuB;QACvB,IACE,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAC5C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,IACE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;CACF","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 Admin\n */\n\nimport * as React from \"react\";\nimport type { XAndY } from \"@itwin/core-geometry\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n AbstractMenuItemProps,\n AbstractToolbarProps,\n DialogLayoutDataProvider,\n DialogProps,\n IMatch,\n OnCancelFunc,\n OnItemExecutedFunc,\n OnNumberCommitFunc,\n OnValueCommitFunc,\n Primitives,\n PropertyDescription,\n PropertyRecord,\n} from \"@itwin/appui-abstract\";\nimport { RelativePosition, UiAdmin } from \"@itwin/appui-abstract\";\nimport { AccuDrawPopupManager } from \"../accudraw/AccuDrawPopupManager\";\nimport { CursorInformation } from \"../cursor/CursorInformation\";\nimport { PopupManager } from \"../popup/PopupManager\";\nimport type { CursorMenuData } from \"../redux/SessionState\";\nimport { UiFramework } from \"../UiFramework\";\nimport { UiDataProvidedDialog } from \"../dialog/UiDataProvidedDialog\";\n\n/** Controls whether localized and/or non-localized key-in strings appear in a KeyinField's auto-completion list.\n * @public\n */\nexport enum KeyinFieldLocalization {\n /** Include only non-localized key-in strings. */\n NonLocalized,\n /** Include only localized key-in strings. */\n Localized,\n /** Include localized and non-localized strings for each key-in. */\n Both,\n}\n\n/** Defines a keyin entry to show/filter in UI\n * @public\n */\nexport interface KeyinEntry {\n /** string that matched a filter string */\n value: string;\n /** define array of start and end positions of filter matches. */\n matches?: IMatch[];\n /** true if entry was loaded from key-in history */\n isHistory?: boolean;\n}\n\n/** The UiAdmin controls various UI components and is callable from IModelApp.uiAdmin in the core-frontend package.\n * @public\n */\nexport class FrameworkUiAdmin extends UiAdmin {\n private _localizedKeyinPreference: KeyinFieldLocalization =\n KeyinFieldLocalization.NonLocalized;\n\n public get localizedKeyinPreference(): KeyinFieldLocalization {\n return this._localizedKeyinPreference;\n }\n public set localizedKeyinPreference(preference: KeyinFieldLocalization) {\n this._localizedKeyinPreference = preference;\n }\n\n /** @internal */\n public override onInitialized() {}\n\n /** Gets the cursor X and Y position, which is mouseEvent.pageX and mouseEvent.pageY. */\n public override get cursorPosition(): XAndY {\n return CursorInformation.cursorPosition;\n }\n\n /** Determines if focus is set to Home */\n public override get isFocusOnHome(): boolean {\n return UiFramework.keyboardShortcuts.isFocusOnHome;\n }\n\n /** Sets focus to Home */\n public override setFocusToHome(): void {\n UiFramework.keyboardShortcuts.setFocusToHome();\n }\n\n /** Show a context menu at a particular location.\n * @param items Properties of the menu items to display.\n * @param location Location of the context menu, relative to the origin of htmlElement or the overall window.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showContextMenu(\n items: AbstractMenuItemProps[],\n location: XAndY,\n htmlElement?: HTMLElement\n ): boolean {\n let position = location;\n let childWindowId: string | undefined;\n if (htmlElement) {\n const anchorOffset = htmlElement.getBoundingClientRect();\n position = {\n x: anchorOffset.left + location.x,\n y: anchorOffset.top + location.y,\n };\n childWindowId = UiFramework.childWindows.findId(\n htmlElement.ownerDocument.defaultView\n );\n }\n\n const offset = -8;\n position = { x: position.x + offset, y: position.y + offset };\n\n const cursorMenu: CursorMenuData = { position, items, childWindowId };\n UiFramework.openCursorMenu(cursorMenu);\n\n return true;\n }\n\n /** Resolve location and parent element */\n private resolveHtmlElement(\n location: XAndY,\n htmlElement?: HTMLElement\n ): { position: XAndY; el: HTMLElement } {\n const position = location;\n const el = htmlElement ?? UiFramework.controls.getWrapperElement();\n return { position, el };\n }\n\n public getKeyins(): KeyinEntry[] {\n const toolKeyins: KeyinEntry[] = [];\n const tools = IModelApp.tools.getToolList();\n for (const tool of tools) {\n switch (this.localizedKeyinPreference) {\n case KeyinFieldLocalization.Localized:\n toolKeyins.push({ value: tool.keyin });\n break;\n case KeyinFieldLocalization.Both:\n toolKeyins.push({ value: tool.keyin });\n // istanbul ignore else\n if (tool.keyin === tool.englishKeyin) break;\n // istanbul ignore next\n default: // eslint-disable-line no-fallthrough\n case KeyinFieldLocalization.NonLocalized:\n // istanbul ignore next\n if (\n KeyinFieldLocalization.NonLocalized ===\n this.localizedKeyinPreference ||\n (KeyinFieldLocalization.Both === this.localizedKeyinPreference &&\n tool.englishKeyin !== tool.keyin)\n )\n toolKeyins.push({ value: tool.englishKeyin });\n break;\n }\n }\n\n return toolKeyins;\n }\n\n /** Show the Key-in Palette to display key-in from all registered Tools.\n * @param htmlElement The HTMLElement that anchors the Popup. If undefined, the location is relative to the overall window.\n * @return true if the Command Palette was displayed, false if it could not be displayed.\n */\n public override showKeyinPalette(htmlElement?: HTMLElement): boolean {\n if (!this.featureFlags.allowKeyinPalette) return false;\n\n // istanbul ignore next\n const el = htmlElement\n ? htmlElement\n : UiFramework.controls.getWrapperElement();\n\n // istanbul ignore next\n const hidePopup = () => {\n IModelApp.uiAdmin.hideKeyinPalette();\n };\n\n return PopupManager.showKeyinPalette(\n this.getKeyins(),\n el,\n hidePopup,\n hidePopup\n );\n }\n\n /** Hides the Key-in Palette. */\n public override hideKeyinPalette(): boolean {\n if (!this.featureFlags.allowKeyinPalette) return false;\n\n return PopupManager.hideKeyinPalette();\n }\n\n /** Show a Toolbar at a particular location.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Toolbar, relative to the origin of htmlElement or the overall window.\n * @param offset Offset of the Toolbar from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Toolbar\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param htmlElement The HTMLElement that anchors the Toolbar. If undefined, the location is relative to the overall window.\n * @return true if the Toolbar was displayed, false if the Toolbar could not be displayed.\n */\n public override showToolbar(\n toolbarProps: AbstractToolbarProps,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showToolbar(\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the toolbar. */\n public override hideToolbar(): boolean {\n return PopupManager.hideToolbar();\n }\n\n /** Show a menu button at a particular location. A menu button opens a context menu.\n * @param id Id of the menu button. Multiple menu buttons may be displayed.\n * @param menuItemsProps Properties of the menu items to display.\n * @param location Location of the context menu, relative to the origin of htmlElement or the window.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showMenuButton(\n id: string,\n menuItemsProps: AbstractMenuItemProps[],\n location: XAndY,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showMenuButton(\n id,\n el,\n position,\n menuItemsProps\n );\n }\n\n /** Hides a menu button.\n * @param id Id of the menu button. Multiple menu buttons may be displayed.\n * @return true if the menu was hidden, false if the menu could not be hidden.\n */\n public override hideMenuButton(id: string): boolean {\n return AccuDrawPopupManager.hideMenuButton(id);\n }\n\n /** Show a calculator at a particular location.\n * @param initialValue Value initially displayed in the calculator.\n * @param resultIcon Icon displayed to the left of the value.\n * @param location Location of the calculator, relative to the origin of htmlElement or the window.\n * @param onOk Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the menu was displayed, false if the menu could not be displayed.\n */\n public override showCalculator(\n initialValue: number,\n resultIcon: string,\n location: XAndY,\n onOk: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showCalculator(\n el,\n position,\n initialValue,\n resultIcon,\n onOk,\n onCancel\n );\n }\n\n /** Hides the calculator. */\n public override hideCalculator(): boolean {\n return AccuDrawPopupManager.hideCalculator();\n }\n\n /** Show an input editor for an angle value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showAngleEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showAngleEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a length value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showLengthEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showLengthEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a height value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showHeightEditor(\n initialValue: number,\n location: XAndY,\n onCommit: OnNumberCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return AccuDrawPopupManager.showHeightEditor(\n el,\n position,\n initialValue,\n onCommit,\n onCancel\n );\n }\n\n /** Show an input editor for a primitive value at a particular location.\n * @param initialValue Value initially displayed in the editor.\n * @param propertyDescription Description of the primitive value property\n * @param location Location of the editor, relative to the origin of htmlElement or the window.\n * @param onCommit Function called when the OK button or the Enter key is pressed.\n * @param onCancel Function called when the Cancel button or the Escape key is pressed.\n * @param htmlElement The HTMLElement that anchors the context menu. If undefined, the location is relative to the overall window.\n * @return true if the editor was displayed, false if the editor could not be displayed.\n */\n public override showInputEditor(\n initialValue: Primitives.Value,\n propertyDescription: PropertyDescription,\n location: XAndY,\n onCommit: OnValueCommitFunc,\n onCancel: OnCancelFunc,\n htmlElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, htmlElement);\n\n return PopupManager.showInputEditor(\n el,\n position,\n initialValue,\n propertyDescription,\n onCommit,\n onCancel\n );\n }\n\n /** Hides the input editor. */\n public override hideInputEditor(): boolean {\n return PopupManager.hideInputEditor();\n }\n\n /** Show an HTML element at a particular location.\n * @param displayElement The HTMLElement to display\n * @param location Location of the display element, relative to the origin of htmlElement or the window\n * @param offset Offset of the display element from the location\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the display element\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the display element. If undefined, the location is relative to the overall window.\n * @return true if the display element was displayed, false if the display element could not be displayed.\n */\n public override showHTMLElement(\n displayElement: HTMLElement,\n location: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showHTMLElement(\n displayElement,\n el,\n position,\n offset,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the HTML Element. */\n public override hideHTMLElement(): boolean {\n return PopupManager.hideHTMLElement();\n }\n\n /** Show a Card containing content, a title and a toolbar at a particular location.\n * @param content The HTMLElement of the content to display\n * @param title Title to display at the top of the card.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Card, relative to the origin of htmlElement or the window.\n * @param offset Offset of the Card from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Card\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the Card. If undefined, the location is relative to the overall window.\n * @return true if the Card was displayed, false if the Card could not be displayed.\n */\n public override showCard(\n content: HTMLElement,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showCard(\n content,\n title,\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Show a Card containing React-based content, a title and a toolbar at a particular location.\n * @param content The React node of the content to display\n * @param title Title to display at the top of the card.\n * @param toolbarProps Properties of the Toolbar to display.\n * @param location Location of the Card, relative to the origin of htmlElement or the window.\n * @param offset Offset of the Card from the location.\n * @param onItemExecuted Function invoked after a Toolbar item is executed\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the Card\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the Card. If undefined, the location is relative to the overall window.\n * @return true if the Card was displayed, false if the Card could not be displayed.\n */\n public showReactCard(\n content: React.ReactNode,\n title: string | PropertyRecord | undefined,\n toolbarProps: AbstractToolbarProps | undefined,\n location: XAndY,\n offset: XAndY,\n onItemExecuted: OnItemExecutedFunc,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n const reactContent = { reactNode: content };\n\n // istanbul ignore if\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.showCard(\n reactContent,\n title,\n toolbarProps,\n el,\n position,\n offset,\n onItemExecuted,\n onCancel,\n relativePosition\n );\n }\n\n /** Hides the Card. */\n public override hideCard(): boolean {\n return PopupManager.hideCard();\n }\n\n /** Opens a Tool Settings Ui popup at a particular location.\n * @param dataProvider The DialogLayoutDataProvider for the tool settings popup dialog.\n * @param location Location of the tool settings, relative to the origin of anchorElement or the window\n * @param offset Offset of the tool settings from the location\n * @param onCancel Function invoked when the Escape key is pressed or a click occurs outside the tool settings\n * @param relativePosition Position relative to the given location. Defaults to TopRight.\n * @param anchorElement The HTMLElement that anchors the tool settings. If undefined, the location is relative to the overall window.\n * @return true if the tool settings were displayed, false if the tool settings could not be displayed.\n */\n public override openToolSettingsPopup(\n dataProvider: DialogLayoutDataProvider,\n location: XAndY,\n offset: XAndY,\n onCancel: OnCancelFunc,\n relativePosition?: RelativePosition,\n anchorElement?: HTMLElement\n ): boolean {\n const { position, el } = this.resolveHtmlElement(location, anchorElement);\n\n if (relativePosition === undefined)\n relativePosition = RelativePosition.TopRight;\n\n return PopupManager.openToolSettings(\n dataProvider,\n el,\n position,\n offset,\n onCancel,\n relativePosition\n );\n }\n\n /** Closes the Tool Settings Ui popup. */\n public override closeToolSettingsPopup(): boolean {\n return PopupManager.closeToolSettings();\n }\n\n /** Opens a Dialog and automatically populates it using the properties defined by the UiDataProvider.\n * @param uiDataProvider The UiDataProvider for the tool settings\n * @param title Specify title for dialog.\n * @param isModal Specify if the dialog is opened as a modal or modeless.\n * @param id Id of the dialog that is used to close it.\n * @param optionalProps Optional props for Dialog construction.\n * @return true if the tool settings were displayed, false if the tool settings could not be displayed.\n */\n public override openDialog(\n uiDataProvider: DialogLayoutDataProvider,\n title: string,\n isModal: boolean,\n id: string,\n optionalProps?: DialogProps\n ): boolean {\n if (isModal) {\n UiFramework.dialogs.modal.open(\n <UiDataProvidedDialog\n uiDataProvider={uiDataProvider}\n title={title}\n isModal={isModal}\n id={id}\n {...optionalProps}\n />,\n id\n );\n return true;\n } else {\n UiFramework.dialogs.modeless.open(\n <UiDataProvidedDialog\n uiDataProvider={uiDataProvider}\n title={title}\n isModal={isModal}\n id={id}\n {...optionalProps}\n />,\n id\n );\n return true;\n }\n }\n\n /** Closes the Tool Settings Ui popup. */\n public override closeDialog(dialogId: string): boolean {\n // istanbul ignore else\n if (\n UiFramework.dialogs.modeless.dialogs.findIndex(\n (info) => info.id === dialogId\n )\n ) {\n UiFramework.dialogs.modeless.close(dialogId);\n return true;\n }\n\n // istanbul ignore else\n if (\n UiFramework.dialogs.modal.dialogs.findIndex(\n (info) => info.id === dialogId\n )\n ) {\n UiFramework.dialogs.modal.close();\n return true;\n }\n\n // istanbul ignore next\n return false;\n }\n}\n"]}
|
|
@@ -44,7 +44,7 @@ function PropertyEditor({ uiDataProvider, initialItem, isLock, setFocus, }) {
|
|
|
44
44
|
let newRecord = UiLayoutDataProvider.getPropertyRecord(initialItem);
|
|
45
45
|
// istanbul ignore next
|
|
46
46
|
const foundItem = isLock
|
|
47
|
-
? uiDataProvider.items.find((item) =>
|
|
47
|
+
? uiDataProvider.items.find((item) => item.lockProperty?.property.name === initialItem.property.name)
|
|
48
48
|
: uiDataProvider.items.find((item) => item.property.name === initialItem.property.name);
|
|
49
49
|
// istanbul ignore else
|
|
50
50
|
if (foundItem) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,C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,CAAC;IAED,6DAA6D;IACtD,sBAAsB;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAc,EAAE,KAAa,EAAE,EAAE,CACpE,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CACtC,CAAC;IACJ,CAAC;CACF","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 UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n SyncPropertiesChangeEventArgs,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { EditorContainer } from \"@itwin/components-react\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel\n ? item.property.displayLabel\n : /* istanbul ignore next */ item.property.name;\n }, [item]);\n const propertyId = React.useMemo(\n () => `dialogItemProperty-${item.property.name}`,\n [item]\n );\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n const handleSync = (args: SyncPropertiesChangeEventArgs) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === item.property.name\n );\n // istanbul ignore next\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n };\n uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);\n return () => {\n uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);\n };\n }, [uiDataProvider, item]);\n\n // istanbul ignore next\n const className = classnames(\n \"uifw-default-label\",\n isDisabled && \"uifw-label-disabled\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\",\n !isLeftmostRecord && \"uifw-default-inline-label\"\n );\n return (\n <label className={className} htmlFor={propertyId}>\n {displayLabel}:\n </label>\n );\n}\n\nfunction PropertyEditor({\n uiDataProvider,\n initialItem,\n isLock,\n setFocus,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n initialItem: BaseDialogItem;\n isLock?: boolean;\n setFocus?: boolean;\n}) {\n const getLatestRecordValue = React.useCallback(() => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initialItem);\n\n // istanbul ignore next\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) =>\n item.lockProperty?.property.name === initialItem.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initialItem.property.name\n );\n // istanbul ignore else\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n }, [initialItem, isLock, uiDataProvider.items]);\n\n const currentRecord = getLatestRecordValue();\n const [propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n const handleSync = (args: SyncPropertiesChangeEventArgs) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n // istanbul ignore else\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n // istanbul ignore else\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n };\n uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);\n return () => {\n uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);\n };\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n // istanbul ignore next\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n // istanbul ignore next\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n // istanbul ignore next\n const handleCancel = () => {};\n\n return (\n <div key={initialItem.property.name} className={className}>\n <EditorContainer\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={handleCancel}\n />\n </div>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @internal\n */\nexport class ComponentGenerator {\n constructor(private _uiDataProvider: UiLayoutDataProvider) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n isLock={isLock}\n setFocus={setFocus}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n // istanbul ignore else\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n // istanbul ignore else\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n // istanbul ignore next\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div key={`lock-${record.property.name}`} className={classNames}>\n {lockEditor}\n {label}\n </div>\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item: DialogItem, index: number) =>\n this.getInlineLabelAndEditor(item, 0 === index)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (1 === row.items.length) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,IAAI,EACJ,gBAAgB,GAKjB;IACC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;YAC/B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY;YAC5B,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IACpD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACX,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAC9B,GAAG,EAAE,CAAC,sBAAsB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAChD,CAAC,IAAI,CAAC,C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AC1B,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC5D,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CACR,CAClB,CAAC;SACH;IACH,CAAC;IAEM,oBAAoB,CACzB,GAAc,EACd,QAAgB;QAEhB,IAAI,oBAAoB,CAAC,6BAA6B,CAAC,GAAG,CAAC,EAAE;YAC3D,OAAO,IAAI,CAAC,mCAAmC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;SAChE;aAAM;YACL,OAAO;gBACL,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;gBACvE,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC;aACnC,CAAC;SACH;IACH,CAAC;IAED,6DAA6D;IACtD,sBAAsB;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAc,EAAE,KAAa,EAAE,EAAE,CACpE,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,CACtC,CAAC;IACJ,CAAC;CACF","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 UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n SyncPropertiesChangeEventArgs,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { EditorContainer } from \"@itwin/components-react\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel\n ? item.property.displayLabel\n : /* istanbul ignore next */ item.property.name;\n }, [item]);\n const propertyId = React.useMemo(\n () => `dialogItemProperty-${item.property.name}`,\n [item]\n );\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n const handleSync = (args: SyncPropertiesChangeEventArgs) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === item.property.name\n );\n // istanbul ignore next\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n };\n uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);\n return () => {\n uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);\n };\n }, [uiDataProvider, item]);\n\n // istanbul ignore next\n const className = classnames(\n \"uifw-default-label\",\n isDisabled && \"uifw-label-disabled\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\",\n !isLeftmostRecord && \"uifw-default-inline-label\"\n );\n return (\n <label className={className} htmlFor={propertyId}>\n {displayLabel}:\n </label>\n );\n}\n\nfunction PropertyEditor({\n uiDataProvider,\n initialItem,\n isLock,\n setFocus,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n initialItem: BaseDialogItem;\n isLock?: boolean;\n setFocus?: boolean;\n}) {\n const getLatestRecordValue = React.useCallback(() => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initialItem);\n\n // istanbul ignore next\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) =>\n item.lockProperty?.property.name === initialItem.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initialItem.property.name\n );\n // istanbul ignore else\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n }, [initialItem, isLock, uiDataProvider.items]);\n\n const currentRecord = getLatestRecordValue();\n const [propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n const handleSync = (args: SyncPropertiesChangeEventArgs) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n // istanbul ignore else\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n // istanbul ignore else\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n };\n uiDataProvider.onSyncPropertiesChangeEvent.addListener(handleSync);\n return () => {\n uiDataProvider.onSyncPropertiesChangeEvent.removeListener(handleSync);\n };\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n // istanbul ignore next\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n // istanbul ignore next\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n // istanbul ignore next\n const handleCancel = () => {};\n\n return (\n <div key={initialItem.property.name} className={className}>\n <EditorContainer\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={handleCancel}\n />\n </div>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @internal\n */\nexport class ComponentGenerator {\n constructor(private _uiDataProvider: UiLayoutDataProvider) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n isLock={isLock}\n setFocus={setFocus}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n // istanbul ignore else\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n // istanbul ignore else\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item) => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n // istanbul ignore next\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div key={`lock-${record.property.name}`} className={classNames}>\n {lockEditor}\n {label}\n </div>\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item: DialogItem, index: number) =>\n this.getInlineLabelAndEditor(item, 0 === index)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (1 === row.items.length) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n"]}
|
|
@@ -30,13 +30,13 @@ class UiShowHideSettingsProvider {
|
|
|
30
30
|
InternalUiShowHideManager.setSnapWidgetOpacity(result.setting);
|
|
31
31
|
}
|
|
32
32
|
static async storeAutoHideUi(v, storage) {
|
|
33
|
-
void (storage
|
|
33
|
+
void (storage ?? UiFramework.getUiStateStorage()).saveSetting(this._settingsNamespace, this._autoHideUiKey, v);
|
|
34
34
|
}
|
|
35
35
|
static async storeUseProximityOpacity(v, storage) {
|
|
36
|
-
void (storage
|
|
36
|
+
void (storage ?? UiFramework.getUiStateStorage()).saveSetting(this._settingsNamespace, this._useProximityOpacityKey, v);
|
|
37
37
|
}
|
|
38
38
|
static async storeSnapWidgetOpacity(v, storage) {
|
|
39
|
-
void (storage
|
|
39
|
+
void (storage ?? UiFramework.getUiStateStorage()).saveSetting(this._settingsNamespace, this._snapWidgetOpacityKey, v);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
UiShowHideSettingsProvider._settingsNamespace = "AppUiSettings";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalUiShowHideManager.js","sourceRoot":"","sources":["../../../../src/appui-react/utils/InternalUiShowHideManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,MAAa,0BAA0B;IAAvC;QAKkB,eAAU,GAAG,4BAA4B,CAAC;IA0D5D,CAAC;IAxDQ,MAAM,CAAC,UAAU;QACtB,WAAW,CAAC,4BAA4B,CAAC,IAAI,0BAA0B,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAuB;QACnD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CACnC,0BAA0B,CAAC,kBAAkB,EAC7C,0BAA0B,CAAC,cAAc,CAC1C,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,KAAK,oBAAoB,CAAC,OAAO;YAChD,yBAAyB,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE1D,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAC/B,0BAA0B,CAAC,kBAAkB,EAC7C,0BAA0B,CAAC,uBAAuB,CACnD,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,KAAK,oBAAoB,CAAC,OAAO;YAChD,yBAAyB,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,CA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AC,MAAM;QACnB,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,SAAS;QACrB,yBAAyB,CAAC,WAAW,EAAE,CAAC;QACxC,2DAA2D;QAC3D,yBAAyB,CAAC,YAAY,GAAG,IAAI,CAAC;QAC9C,yBAAyB,CAAC,WAAW,GAAG,IAAI,CAAC;QAC7C,yBAAyB,CAAC,eAAe,GAAG,KAAK,CAAC;QAClD,yBAAyB,CAAC,eAAe,GAAG,KAAK,CAAC;QAClD,yBAAyB,CAAC,eAAe,GAAG,uBAAuB,CAAC;QACpE,yBAAyB,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACvD,yBAAyB,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACvD,CAAC;;AAnLc,sCAAY,GAAY,IAAI,CAAC;AAC7B,qCAAW,GAAY,IAAI,CAAC;AAC5B,yCAAe,GAAY,KAAK,CAAC;AACjC,yCAAe,GAAY,KAAK,CAAC;AACjC,yCAAe,GAAW,uBAAuB,CAAC;AAElD,8CAAoB,GAAY,KAAK,CAAC;AACtC,4CAAkB,GAAY,KAAK,CAAC;SARxC,yBAAyB","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 Utilities\n */\n\nimport type { UiStateStorage } from \"@itwin/core-react\";\nimport { UiStateStorageStatus } from \"@itwin/core-react\";\nimport {\n SyncUiEventDispatcher,\n SyncUiEventId,\n} from \"../syncui/SyncUiEventDispatcher\";\nimport type { UserSettingsProvider } from \"../UiFramework\";\nimport { UiFramework } from \"../UiFramework\";\n\n/** Class that maintain UiShowHide user settings between sessions\n * @internal\n */\nexport class UiShowHideSettingsProvider implements UserSettingsProvider {\n private static _settingsNamespace = \"AppUiSettings\";\n private static _autoHideUiKey = \"AutoHideUi\";\n private static _useProximityOpacityKey = \"UseProximityOpacity\";\n private static _snapWidgetOpacityKey = \"SnapWidgetOpacity\";\n public readonly providerId = \"UiShowHideSettingsProvider\";\n\n public static initialize() {\n UiFramework.registerUserSettingsProvider(new UiShowHideSettingsProvider());\n }\n\n public async loadUserSettings(storage: UiStateStorage): Promise<void> {\n let result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._autoHideUiKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setAutoHideUi(result.setting);\n\n result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._useProximityOpacityKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setUseProximityOpacity(result.setting);\n\n result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._snapWidgetOpacityKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setSnapWidgetOpacity(result.setting);\n }\n\n public static async storeAutoHideUi(v: boolean, storage?: UiStateStorage) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._autoHideUiKey,\n v\n );\n }\n\n public static async storeUseProximityOpacity(\n v: boolean,\n storage?: UiStateStorage\n ) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._useProximityOpacityKey,\n v\n );\n }\n\n public static async storeSnapWidgetOpacity(\n v: boolean,\n storage?: UiStateStorage\n ) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._snapWidgetOpacityKey,\n v\n );\n }\n}\n\n/** The default inactivity time.\n * @internal\n */\nexport const INACTIVITY_TIME_DEFAULT = 3500; /** Wait 3.5 seconds */\n\n/** Maintains Ui Show/Hide state. The `Ui` includes widgets, panels and the status bar.\n * @internal\n */\nexport class InternalUiShowHideManager {\n private static _isUiVisible: boolean = true;\n private static _autoHideUi: boolean = true;\n private static _showHidePanels: boolean = false;\n private static _showHideFooter: boolean = false;\n private static _inactivityTime: number = INACTIVITY_TIME_DEFAULT;\n private static _timeout: NodeJS.Timeout;\n private static _useProximityOpacity: boolean = false;\n private static _snapWidgetOpacity: boolean = false;\n\n /** Determines if the Ui is visible */\n public static get isUiVisible() {\n return InternalUiShowHideManager._isUiVisible;\n }\n public static set isUiVisible(visible: boolean) {\n InternalUiShowHideManager._isUiVisible = visible;\n }\n\n /** @public */\n public static setAutoHideUi(value: boolean) {\n InternalUiShowHideManager._autoHideUi = value;\n }\n\n /** @internal */\n public static setUseProximityOpacity(value: boolean) {\n InternalUiShowHideManager._useProximityOpacity = value;\n }\n\n /** @internal */\n public static setSnapWidgetOpacity(value: boolean) {\n InternalUiShowHideManager._snapWidgetOpacity = value;\n }\n\n /** Determines whether the `auto-hide Ui` feature is on. Defaults to false.\n * When true, the Ui automatically hides after a few seconds of inactivity.\n */\n public static get autoHideUi(): boolean {\n return InternalUiShowHideManager._autoHideUi;\n }\n\n public static set autoHideUi(autoHide: boolean) {\n void UiShowHideSettingsProvider.storeAutoHideUi(autoHide);\n InternalUiShowHideManager._autoHideUi = autoHide;\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n }\n /** Determines whether the widget panels are shown and hidden. Defaults to false. */\n public static get showHidePanels(): boolean {\n return InternalUiShowHideManager._showHidePanels;\n }\n public static set showHidePanels(showHide: boolean) {\n InternalUiShowHideManager._showHidePanels = showHide;\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines whether the status bar is shown and hidden. Defaults to false. */\n public static get showHideFooter(): boolean {\n return InternalUiShowHideManager._showHideFooter;\n }\n public static set showHideFooter(showHide: boolean) {\n InternalUiShowHideManager._showHideFooter = showHide;\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines the amount of inactivity time before the Ui is hidden. Defaults to 3.5 seconds. */\n public static get inactivityTime(): number {\n return InternalUiShowHideManager._inactivityTime;\n }\n public static set inactivityTime(time: number) {\n InternalUiShowHideManager._inactivityTime = time;\n }\n\n /** Determines whether the proximity of the mouse should alter the opacity of a toolbar. Defaults to true. */\n public static get useProximityOpacity(): boolean {\n return InternalUiShowHideManager._useProximityOpacity;\n }\n public static set useProximityOpacity(value: boolean) {\n InternalUiShowHideManager._useProximityOpacity = value;\n void UiShowHideSettingsProvider.storeUseProximityOpacity(value);\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines whether the opacity of a toolbar should snap. Defaults to false. */\n public static get snapWidgetOpacity(): boolean {\n return InternalUiShowHideManager._snapWidgetOpacity;\n }\n public static set snapWidgetOpacity(value: boolean) {\n InternalUiShowHideManager._snapWidgetOpacity = value;\n void UiShowHideSettingsProvider.storeSnapWidgetOpacity(value);\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Handler for when a Frontstage is ready */\n public static handleFrontstageReady() {\n // istanbul ignore next\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndResetTimer();\n }\n\n /** Handler for when the mouse moves over the content area */\n public static handleContentMouseMove(\n _event?: React.MouseEvent<HTMLElement, MouseEvent>\n ) {\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndResetTimer();\n }\n\n /** Handler for when the mouse enters a widget */\n public static handleWidgetMouseEnter(\n _event?: React.MouseEvent<HTMLElement, MouseEvent>\n ) {\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndCancelTimer();\n }\n\n /** Shows the Ui and resets the inactivity timer */\n public static showUiAndResetTimer() {\n setTimeout(() => {\n InternalUiShowHideManager.showUi();\n InternalUiShowHideManager.resetTimer();\n });\n }\n\n /** Shows the Ui and cancels the inactivity timer */\n public static showUiAndCancelTimer() {\n setTimeout(() => {\n InternalUiShowHideManager.showUi();\n InternalUiShowHideManager.cancelTimer();\n });\n }\n\n private static cancelTimer() {\n clearTimeout(InternalUiShowHideManager._timeout);\n }\n\n private static resetTimer() {\n InternalUiShowHideManager.cancelTimer();\n InternalUiShowHideManager._timeout = setTimeout(\n InternalUiShowHideManager.hideUi,\n InternalUiShowHideManager._inactivityTime\n );\n }\n\n private static showUi() {\n UiFramework.setIsUiVisible(true);\n }\n\n private static hideUi() {\n UiFramework.setIsUiVisible(false);\n }\n\n /** @internal */\n public static terminate() {\n InternalUiShowHideManager.cancelTimer();\n // Ensure that next use will have default values for tests.\n InternalUiShowHideManager._isUiVisible = true;\n InternalUiShowHideManager._autoHideUi = true;\n InternalUiShowHideManager._showHidePanels = false;\n InternalUiShowHideManager._showHideFooter = false;\n InternalUiShowHideManager._inactivityTime = INACTIVITY_TIME_DEFAULT;\n InternalUiShowHideManager._useProximityOpacity = false;\n InternalUiShowHideManager._snapWidgetOpacity = false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalUiShowHideManager.js","sourceRoot":"","sources":["../../../../src/appui-react/utils/InternalUiShowHideManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,MAAa,0BAA0B;IAAvC;QAKkB,eAAU,GAAG,4BAA4B,CAAC;IA0D5D,CAAC;IAxDQ,MAAM,CAAC,UAAU;QACtB,WAAW,CAAC,4BAA4B,CAAC,IAAI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------------------------------------------------------------\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 Utilities\n */\n\nimport type { UiStateStorage } from \"@itwin/core-react\";\nimport { UiStateStorageStatus } from \"@itwin/core-react\";\nimport {\n SyncUiEventDispatcher,\n SyncUiEventId,\n} from \"../syncui/SyncUiEventDispatcher\";\nimport type { UserSettingsProvider } from \"../UiFramework\";\nimport { UiFramework } from \"../UiFramework\";\n\n/** Class that maintain UiShowHide user settings between sessions\n * @internal\n */\nexport class UiShowHideSettingsProvider implements UserSettingsProvider {\n private static _settingsNamespace = \"AppUiSettings\";\n private static _autoHideUiKey = \"AutoHideUi\";\n private static _useProximityOpacityKey = \"UseProximityOpacity\";\n private static _snapWidgetOpacityKey = \"SnapWidgetOpacity\";\n public readonly providerId = \"UiShowHideSettingsProvider\";\n\n public static initialize() {\n UiFramework.registerUserSettingsProvider(new UiShowHideSettingsProvider());\n }\n\n public async loadUserSettings(storage: UiStateStorage): Promise<void> {\n let result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._autoHideUiKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setAutoHideUi(result.setting);\n\n result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._useProximityOpacityKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setUseProximityOpacity(result.setting);\n\n result = await storage.getSetting(\n UiShowHideSettingsProvider._settingsNamespace,\n UiShowHideSettingsProvider._snapWidgetOpacityKey\n );\n if (result.status === UiStateStorageStatus.Success)\n InternalUiShowHideManager.setSnapWidgetOpacity(result.setting);\n }\n\n public static async storeAutoHideUi(v: boolean, storage?: UiStateStorage) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._autoHideUiKey,\n v\n );\n }\n\n public static async storeUseProximityOpacity(\n v: boolean,\n storage?: UiStateStorage\n ) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._useProximityOpacityKey,\n v\n );\n }\n\n public static async storeSnapWidgetOpacity(\n v: boolean,\n storage?: UiStateStorage\n ) {\n void (storage ?? UiFramework.getUiStateStorage()).saveSetting(\n this._settingsNamespace,\n this._snapWidgetOpacityKey,\n v\n );\n }\n}\n\n/** The default inactivity time.\n * @internal\n */\nexport const INACTIVITY_TIME_DEFAULT = 3500; /** Wait 3.5 seconds */\n\n/** Maintains Ui Show/Hide state. The `Ui` includes widgets, panels and the status bar.\n * @internal\n */\nexport class InternalUiShowHideManager {\n private static _isUiVisible: boolean = true;\n private static _autoHideUi: boolean = true;\n private static _showHidePanels: boolean = false;\n private static _showHideFooter: boolean = false;\n private static _inactivityTime: number = INACTIVITY_TIME_DEFAULT;\n private static _timeout: NodeJS.Timeout;\n private static _useProximityOpacity: boolean = false;\n private static _snapWidgetOpacity: boolean = false;\n\n /** Determines if the Ui is visible */\n public static get isUiVisible() {\n return InternalUiShowHideManager._isUiVisible;\n }\n public static set isUiVisible(visible: boolean) {\n InternalUiShowHideManager._isUiVisible = visible;\n }\n\n /** @public */\n public static setAutoHideUi(value: boolean) {\n InternalUiShowHideManager._autoHideUi = value;\n }\n\n /** @internal */\n public static setUseProximityOpacity(value: boolean) {\n InternalUiShowHideManager._useProximityOpacity = value;\n }\n\n /** @internal */\n public static setSnapWidgetOpacity(value: boolean) {\n InternalUiShowHideManager._snapWidgetOpacity = value;\n }\n\n /** Determines whether the `auto-hide Ui` feature is on. Defaults to false.\n * When true, the Ui automatically hides after a few seconds of inactivity.\n */\n public static get autoHideUi(): boolean {\n return InternalUiShowHideManager._autoHideUi;\n }\n\n public static set autoHideUi(autoHide: boolean) {\n void UiShowHideSettingsProvider.storeAutoHideUi(autoHide);\n InternalUiShowHideManager._autoHideUi = autoHide;\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n }\n /** Determines whether the widget panels are shown and hidden. Defaults to false. */\n public static get showHidePanels(): boolean {\n return InternalUiShowHideManager._showHidePanels;\n }\n public static set showHidePanels(showHide: boolean) {\n InternalUiShowHideManager._showHidePanels = showHide;\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines whether the status bar is shown and hidden. Defaults to false. */\n public static get showHideFooter(): boolean {\n return InternalUiShowHideManager._showHideFooter;\n }\n public static set showHideFooter(showHide: boolean) {\n InternalUiShowHideManager._showHideFooter = showHide;\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines the amount of inactivity time before the Ui is hidden. Defaults to 3.5 seconds. */\n public static get inactivityTime(): number {\n return InternalUiShowHideManager._inactivityTime;\n }\n public static set inactivityTime(time: number) {\n InternalUiShowHideManager._inactivityTime = time;\n }\n\n /** Determines whether the proximity of the mouse should alter the opacity of a toolbar. Defaults to true. */\n public static get useProximityOpacity(): boolean {\n return InternalUiShowHideManager._useProximityOpacity;\n }\n public static set useProximityOpacity(value: boolean) {\n InternalUiShowHideManager._useProximityOpacity = value;\n void UiShowHideSettingsProvider.storeUseProximityOpacity(value);\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Determines whether the opacity of a toolbar should snap. Defaults to false. */\n public static get snapWidgetOpacity(): boolean {\n return InternalUiShowHideManager._snapWidgetOpacity;\n }\n public static set snapWidgetOpacity(value: boolean) {\n InternalUiShowHideManager._snapWidgetOpacity = value;\n void UiShowHideSettingsProvider.storeSnapWidgetOpacity(value);\n SyncUiEventDispatcher.dispatchImmediateSyncUiEvent(\n SyncUiEventId.ShowHideManagerSettingChange\n );\n UiFramework.onUiVisibilityChanged.emit({\n visible: UiFramework.getIsUiVisible(),\n });\n }\n\n /** Handler for when a Frontstage is ready */\n public static handleFrontstageReady() {\n // istanbul ignore next\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndResetTimer();\n }\n\n /** Handler for when the mouse moves over the content area */\n public static handleContentMouseMove(\n _event?: React.MouseEvent<HTMLElement, MouseEvent>\n ) {\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndResetTimer();\n }\n\n /** Handler for when the mouse enters a widget */\n public static handleWidgetMouseEnter(\n _event?: React.MouseEvent<HTMLElement, MouseEvent>\n ) {\n if (!InternalUiShowHideManager._autoHideUi) return;\n\n InternalUiShowHideManager.showUiAndCancelTimer();\n }\n\n /** Shows the Ui and resets the inactivity timer */\n public static showUiAndResetTimer() {\n setTimeout(() => {\n InternalUiShowHideManager.showUi();\n InternalUiShowHideManager.resetTimer();\n });\n }\n\n /** Shows the Ui and cancels the inactivity timer */\n public static showUiAndCancelTimer() {\n setTimeout(() => {\n InternalUiShowHideManager.showUi();\n InternalUiShowHideManager.cancelTimer();\n });\n }\n\n private static cancelTimer() {\n clearTimeout(InternalUiShowHideManager._timeout);\n }\n\n private static resetTimer() {\n InternalUiShowHideManager.cancelTimer();\n InternalUiShowHideManager._timeout = setTimeout(\n InternalUiShowHideManager.hideUi,\n InternalUiShowHideManager._inactivityTime\n );\n }\n\n private static showUi() {\n UiFramework.setIsUiVisible(true);\n }\n\n private static hideUi() {\n UiFramework.setIsUiVisible(false);\n }\n\n /** @internal */\n public static terminate() {\n InternalUiShowHideManager.cancelTimer();\n // Ensure that next use will have default values for tests.\n InternalUiShowHideManager._isUiVisible = true;\n InternalUiShowHideManager._autoHideUi = true;\n InternalUiShowHideManager._showHidePanels = false;\n InternalUiShowHideManager._showHideFooter = false;\n InternalUiShowHideManager._inactivityTime = INACTIVITY_TIME_DEFAULT;\n InternalUiShowHideManager._useProximityOpacity = false;\n InternalUiShowHideManager._snapWidgetOpacity = false;\n }\n}\n"]}
|
|
@@ -24,31 +24,30 @@ function WidgetFallback() {
|
|
|
24
24
|
}
|
|
25
25
|
/** @internal */
|
|
26
26
|
export function WidgetContent() {
|
|
27
|
-
var _a, _b;
|
|
28
27
|
const widget = useWidgetDef();
|
|
29
28
|
// istanbul ignore next
|
|
30
|
-
const itemId =
|
|
29
|
+
const itemId = widget?.id ?? widget?.label ?? "unknown";
|
|
31
30
|
const onSave = React.useCallback(() => {
|
|
32
31
|
// istanbul ignore next
|
|
33
|
-
widget
|
|
32
|
+
widget?.saveTransientState();
|
|
34
33
|
}, [widget]);
|
|
35
34
|
const onRestore = React.useCallback(() => {
|
|
36
35
|
// istanbul ignore next
|
|
37
|
-
widget
|
|
36
|
+
widget?.restoreTransientState();
|
|
38
37
|
}, [widget]);
|
|
39
38
|
useTransientState(onSave, onRestore);
|
|
40
|
-
const providerId =
|
|
41
|
-
? widget
|
|
39
|
+
const providerId = widget?.initialConfig && isProviderItem(widget?.initialConfig)
|
|
40
|
+
? widget?.initialConfig.providerId
|
|
42
41
|
: undefined;
|
|
43
42
|
return (React.createElement(ScrollableWidgetContent, { itemId: itemId, providerId: providerId },
|
|
44
|
-
React.createElement(ErrorBoundary, { FallbackComponent: WidgetFallback }, widget
|
|
43
|
+
React.createElement(ErrorBoundary, { FallbackComponent: WidgetFallback }, widget?.reactNode)));
|
|
45
44
|
}
|
|
46
45
|
/** @internal */
|
|
47
46
|
export function useWidgetDef() {
|
|
48
47
|
const tabId = React.useContext(TabIdContext);
|
|
49
48
|
assert(!!tabId);
|
|
50
49
|
const frontstage = useActiveFrontstageDef();
|
|
51
|
-
const [widgetDef, setWidgetDef] = React.useState(() => frontstage
|
|
50
|
+
const [widgetDef, setWidgetDef] = React.useState(() => frontstage?.findWidgetDef(tabId));
|
|
52
51
|
React.useEffect(() => {
|
|
53
52
|
return InternalFrontstageManager.onFrontstageNineZoneStateChangedEvent.addListener((args) => {
|
|
54
53
|
if (args.frontstageDef !== frontstage ||
|
|
@@ -61,7 +60,7 @@ export function useWidgetDef() {
|
|
|
61
60
|
}, [frontstage, tabId]);
|
|
62
61
|
React.useEffect(() => {
|
|
63
62
|
return UiItemsManager.onUiProviderRegisteredEvent.addListener(() => {
|
|
64
|
-
setWidgetDef(frontstage
|
|
63
|
+
setWidgetDef(frontstage?.findWidgetDef(tabId));
|
|
65
64
|
});
|
|
66
65
|
}, [frontstage, tabId]);
|
|
67
66
|
return widgetDef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/appui-react/widget-panels/Content.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,uBAAuB,EACvB,YAAY,GACb,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,SAAS,cAAc;IACrB,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CACxC,kCAAkC,CACnC,CAAC;IACF,OAAO,CACL,6BAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EA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,CACjC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,yBAAyB,CAAC,qCAAqC,CAAC,WAAW,CAChF,CAAC,IAAI,EAAE,EAAE;YACP,IACE,IAAI,CAAC,aAAa,KAAK,UAAU;gBACjC,CAAC,UAAU;gBACX,UAAU,CAAC,cAAc;gBACzB,UAAU,CAAC,oBAAoB;gBAE/B,OAAO;YACT,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC,CACF,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAExB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,cAAc,CAAC,2BAA2B,CAAC,WAAW,CAAC,GAAG,EAAE;YACjE,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAExB,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Widget\n */\nimport * as React from \"react\";\nimport {\n ScrollableWidgetContent,\n TabIdContext,\n} from \"@itwin/appui-layout-react\";\nimport type { WidgetDef } from \"../widgets/WidgetDef\";\nimport { useActiveFrontstageDef } from \"../frontstage/FrontstageDef\";\nimport { useTransientState } from \"./useTransientState\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { UiItemsManager } from \"../ui-items-provider/UiItemsManager\";\nimport { isProviderItem } from \"../ui-items-provider/isProviderItem\";\nimport { InternalFrontstageManager } from \"../frontstage/InternalFrontstageManager\";\nimport { ErrorBoundary } from \"react-error-boundary\";\nimport { SvgError } from \"@itwin/itwinui-illustrations-react\";\nimport { NonIdealState } from \"@itwin/itwinui-react\";\nimport { UiFramework } from \"../UiFramework\";\n\nfunction WidgetFallback() {\n const errorMessage = UiFramework.translate(\n \"widget.errorMessage.unknownError\"\n );\n return (\n <div role=\"alert\" style={{ position: \"relative\", minHeight: 400 }}>\n <NonIdealState svg={<SvgError />} heading={errorMessage} />\n </div>\n );\n}\n\n/** @internal */\nexport function WidgetContent() {\n const widget = useWidgetDef();\n // istanbul ignore next\n const itemId = widget?.id ?? widget?.label ?? \"unknown\";\n const onSave = React.useCallback(() => {\n // istanbul ignore next\n widget?.saveTransientState();\n }, [widget]);\n const onRestore = React.useCallback(() => {\n // istanbul ignore next\n widget?.restoreTransientState();\n }, [widget]);\n useTransientState(onSave, onRestore);\n const providerId =\n widget?.initialConfig && isProviderItem(widget?.initialConfig)\n ? widget?.initialConfig.providerId\n : undefined;\n return (\n <ScrollableWidgetContent itemId={itemId} providerId={providerId}>\n <ErrorBoundary FallbackComponent={WidgetFallback}>\n {widget?.reactNode}\n </ErrorBoundary>\n </ScrollableWidgetContent>\n );\n}\n\n/** @internal */\nexport function useWidgetDef(): WidgetDef | undefined {\n const tabId = React.useContext(TabIdContext);\n assert(!!tabId);\n\n const frontstage = useActiveFrontstageDef();\n const [widgetDef, setWidgetDef] = React.useState(() =>\n frontstage?.findWidgetDef(tabId)\n );\n\n React.useEffect(() => {\n return InternalFrontstageManager.onFrontstageNineZoneStateChangedEvent.addListener(\n (args) => {\n if (\n args.frontstageDef !== frontstage ||\n !frontstage ||\n frontstage.isStageClosing ||\n frontstage.isApplicationClosing\n )\n return;\n setWidgetDef(frontstage.findWidgetDef(tabId));\n }\n );\n }, [frontstage, tabId]);\n\n React.useEffect(() => {\n return UiItemsManager.onUiProviderRegisteredEvent.addListener(() => {\n setWidgetDef(frontstage?.findWidgetDef(tabId));\n });\n }, [frontstage, tabId]);\n\n return widgetDef;\n}\n"]}
|