@itwin/appui-react 4.2.0 → 4.2.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 +6 -1
- package/lib/cjs/appui-react/UiFramework.js +9 -5
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +2 -1
- 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 +2 -1
- package/lib/cjs/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +12 -9
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js +4 -3
- package/lib/cjs/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js +2 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/cjs/appui-react/content/IModelViewport.js +6 -3
- package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/cjs/appui-react/content/InternalContentLayoutManager.js +2 -1
- 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 +12 -10
- package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +3 -2
- package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/cjs/appui-react/dialog/ContentDialog.js +6 -3
- package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js +3 -2
- package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +4 -3
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js +3 -2
- package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +2 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js +11 -7
- package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js +11 -7
- package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js +13 -8
- package/lib/cjs/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/cjs/appui-react/messages/ActivityMessage.js +7 -5
- package/lib/cjs/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/cjs/appui-react/pickers/ViewSelector.js +6 -5
- package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js +2 -1
- package/lib/cjs/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/cjs/appui-react/popup/PopupManager.js +2 -1
- package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js +1 -2
- package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +7 -5
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/Indicator.js +2 -1
- package/lib/cjs/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBar.js +5 -3
- 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/tools/CoreToolDefinitions.js +17 -10
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js +2 -3
- package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js +14 -12
- package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +10 -9
- package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +2 -1
- package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js +14 -8
- 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 +9 -8
- package/lib/cjs/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +39 -38
- 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 +17 -12
- package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Toolbars.js +3 -2
- package/lib/cjs/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetHost.js +3 -2
- package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +9 -5
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/backstage/BackstageComposerItem.js +2 -1
- 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 +2 -1
- package/lib/esm/appui-react/configurableui/TimeTracker.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +12 -9
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/DefaultViewOverlay.js +4 -3
- package/lib/esm/appui-react/content/DefaultViewOverlay.js.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js +2 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/esm/appui-react/content/IModelViewport.js +6 -3
- package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/esm/appui-react/content/InternalContentLayoutManager.js +2 -1
- 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 +12 -10
- package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +3 -2
- package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/esm/appui-react/dialog/ContentDialog.js +6 -3
- package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
- package/lib/esm/appui-react/dialog/DialogManagerBase.js +3 -2
- package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +4 -3
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js +3 -2
- package/lib/esm/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +2 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js +11 -7
- package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js +11 -7
- package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js +13 -8
- package/lib/esm/appui-react/hooks/useSolarDataProvider.js.map +1 -1
- package/lib/esm/appui-react/messages/ActivityMessage.js +7 -5
- package/lib/esm/appui-react/messages/ActivityMessage.js.map +1 -1
- package/lib/esm/appui-react/pickers/ViewSelector.js +6 -5
- package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js +2 -1
- package/lib/esm/appui-react/popup/KeyinPalettePanel.js.map +1 -1
- package/lib/esm/appui-react/popup/PopupManager.js +2 -1
- package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js +1 -2
- package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +7 -5
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusbar/Indicator.js +2 -1
- package/lib/esm/appui-react/statusbar/Indicator.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBar.js +5 -3
- 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/tools/CoreToolDefinitions.js +17 -10
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js +2 -3
- package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js +14 -12
- package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +10 -9
- package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +2 -1
- package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
- package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js +14 -8
- 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 +9 -8
- package/lib/esm/appui-react/widget-panels/Content.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +39 -38
- 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 +17 -12
- package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Toolbars.js +3 -2
- package/lib/esm/appui-react/widget-panels/Toolbars.js.map +1 -1
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -2
- package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetHost.js +3 -2
- package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
- package/package.json +9 -9
|
@@ -37,12 +37,12 @@ class StandardContentToolsUiItemsProvider {
|
|
|
37
37
|
this.defaultContextTools = defaultContextTools;
|
|
38
38
|
}
|
|
39
39
|
provideToolbarItems(_stageId, _stageUsage, toolbarUsage, toolbarOrientation, stageAppData) {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
40
41
|
const items = [];
|
|
41
42
|
if (toolbarUsage === ToolbarItem_1.ToolbarUsage.ContentManipulation &&
|
|
42
43
|
toolbarOrientation === ToolbarItem_1.ToolbarOrientation.Horizontal) {
|
|
43
|
-
const clearSelectionGroupPriority = getGroupPriority(stageAppData
|
|
44
|
-
|
|
45
|
-
const overridesGroupPriority = getGroupPriority(stageAppData?.defaultContentTools?.horizontal?.overridesGroupPriority, 20);
|
|
44
|
+
const clearSelectionGroupPriority = getGroupPriority((_b = (_a = stageAppData === null || stageAppData === void 0 ? void 0 : stageAppData.defaultContentTools) === null || _a === void 0 ? void 0 : _a.horizontal) === null || _b === void 0 ? void 0 : _b.clearSelectionGroupPriority, 10);
|
|
45
|
+
const overridesGroupPriority = getGroupPriority((_d = (_c = stageAppData === null || stageAppData === void 0 ? void 0 : stageAppData.defaultContentTools) === null || _c === void 0 ? void 0 : _c.horizontal) === null || _d === void 0 ? void 0 : _d.overridesGroupPriority, 20);
|
|
46
46
|
if (!this.defaultContextTools ||
|
|
47
47
|
!this.defaultContextTools.horizontal ||
|
|
48
48
|
this.defaultContextTools.horizontal.clearSelection)
|
|
@@ -54,7 +54,7 @@ class StandardContentToolsUiItemsProvider {
|
|
|
54
54
|
if (!this.defaultContextTools ||
|
|
55
55
|
!this.defaultContextTools.horizontal ||
|
|
56
56
|
this.defaultContextTools.horizontal.hide) {
|
|
57
|
-
if (this.defaultContextTools
|
|
57
|
+
if (((_f = (_e = this.defaultContextTools) === null || _e === void 0 ? void 0 : _e.horizontal) === null || _f === void 0 ? void 0 : _f.hide) === "group")
|
|
58
58
|
items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(30, SelectionContextItemDef_1.SelectionContextToolDefinitions.hideSectionToolGroup, { groupPriority: overridesGroupPriority }));
|
|
59
59
|
else
|
|
60
60
|
items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(30, SelectionContextItemDef_1.SelectionContextToolDefinitions.hideElementsItemDef, { groupPriority: overridesGroupPriority }));
|
|
@@ -62,7 +62,7 @@ class StandardContentToolsUiItemsProvider {
|
|
|
62
62
|
if (!this.defaultContextTools ||
|
|
63
63
|
!this.defaultContextTools.horizontal ||
|
|
64
64
|
this.defaultContextTools.horizontal.isolate) {
|
|
65
|
-
if (this.defaultContextTools
|
|
65
|
+
if (((_h = (_g = this.defaultContextTools) === null || _g === void 0 ? void 0 : _g.horizontal) === null || _h === void 0 ? void 0 : _h.isolate) === "group")
|
|
66
66
|
items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(40, SelectionContextItemDef_1.SelectionContextToolDefinitions.isolateSelectionToolGroup, { groupPriority: overridesGroupPriority }));
|
|
67
67
|
else
|
|
68
68
|
items.push(ToolbarHelper_1.ToolbarHelper.createToolbarItemFromItemDef(40, SelectionContextItemDef_1.SelectionContextToolDefinitions.isolateElementsItemDef, { groupPriority: overridesGroupPriority }));
|
|
@@ -75,9 +75,9 @@ class StandardContentToolsUiItemsProvider {
|
|
|
75
75
|
} /* istanbul ignore else */
|
|
76
76
|
else if (toolbarUsage === ToolbarItem_1.ToolbarUsage.ContentManipulation &&
|
|
77
77
|
toolbarOrientation === ToolbarItem_1.ToolbarOrientation.Vertical) {
|
|
78
|
-
const selectElementGroupPriority = getGroupPriority(stageAppData
|
|
79
|
-
const measureGroupPriority = getGroupPriority(stageAppData
|
|
80
|
-
const selectionGroupPriority = getGroupPriority(stageAppData
|
|
78
|
+
const selectElementGroupPriority = getGroupPriority((_k = (_j = stageAppData === null || stageAppData === void 0 ? void 0 : stageAppData.defaultContentTools) === null || _j === void 0 ? void 0 : _j.vertical) === null || _k === void 0 ? void 0 : _k.selectElementGroupPriority, 10);
|
|
79
|
+
const measureGroupPriority = getGroupPriority((_m = (_l = stageAppData === null || stageAppData === void 0 ? void 0 : stageAppData.defaultContentTools) === null || _l === void 0 ? void 0 : _l.vertical) === null || _m === void 0 ? void 0 : _m.measureGroupPriority, 10);
|
|
80
|
+
const selectionGroupPriority = getGroupPriority((_p = (_o = stageAppData === null || stageAppData === void 0 ? void 0 : stageAppData.defaultContentTools) === null || _o === void 0 ? void 0 : _o.vertical) === null || _p === void 0 ? void 0 : _p.selectionGroupPriority, 10);
|
|
81
81
|
if (!this.defaultContextTools ||
|
|
82
82
|
!this.defaultContextTools.vertical ||
|
|
83
83
|
this.defaultContextTools.vertical.selectElement)
|
|
@@ -95,9 +95,10 @@ class StandardContentToolsUiItemsProvider {
|
|
|
95
95
|
return items;
|
|
96
96
|
}
|
|
97
97
|
provideStatusBarItems(_stageId, _stageUsage, _stageAppData) {
|
|
98
|
+
var _a, _b;
|
|
98
99
|
const statusBarItems = [];
|
|
99
100
|
// if the sectionGroup tools are to be shown then we want the status field added to allow clearing or manipulation the section
|
|
100
|
-
if (this.defaultContextTools
|
|
101
|
+
if ((_b = (_a = this.defaultContextTools) === null || _a === void 0 ? void 0 : _a.vertical) === null || _b === void 0 ? void 0 : _b.sectionGroup) {
|
|
101
102
|
statusBarItems.push(StatusBarItemUtilities_1.StatusBarItemUtilities.createCustomItem("uifw.Sections", StatusBarItem_1.StatusBarSection.Center, 20, React.createElement(SectionsField_1.SectionsStatusField, { hideWhenUnused: true })));
|
|
102
103
|
}
|
|
103
104
|
return statusBarItems;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardContentToolsUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,kFAAuF;AAEvF,8DAA8D;AAC9D,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,IAAI,CACR,6BAAa,CAAC,4BAA4B,CACxC,EAAE,EACF,+BAAS,CAAC,gBAAgB,EAC1B,EAAE,aAAa,EAAE,oBAAoB,EAAE,CACxC,CACF,CAAC;YAEJ,IACE,CAAC,IAAI,CAAC,mBAAmB;gBACzB,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ;gBAClC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,YAAY,EAC9C;gBACA,KAAK,CAAC,IAAI,CACR,6BAAa,CAAC,4BAA4B,CACxC,EAAE,EACF,+BAAS,CAAC,gBAAgB,EAC1B,EAAE,aAAa,EAAE,sBAAsB,EAAE,CAC1C,CACF,CAAC;aACH;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,qBAAqB,CAC1B,QAAgB,EAChB,WAAmB,EACnB,aAAmB;QAEnB,MAAM,cAAc,GAAoB,EAAE,CAAC;QAE3C,8HAA8H;QAC9H,IAAI,IAAI,CAAC,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE;YACpD,cAAc,CAAC,IAAI,CACjB,+CAAsB,CAAC,gBAAgB,CACrC,eAAe,EACf,gCAAgB,CAAC,MAAM,EACvB,EAAE,EACF,oBAAC,mCAAmB,IAAC,cAAc,SAAG,CACvC,CACF,CAAC;SACH;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AApMD,kFAoMC","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 StandardUiItemsProvider\n */\n\nimport * as React from \"react\";\nimport { SelectionContextToolDefinitions } from \"../selection/SelectionContextItemDef\";\nimport type { StatusBarItem } from \"../statusbar/StatusBarItem\";\nimport { StatusBarSection } from \"../statusbar/StatusBarItem\";\nimport { StatusBarItemUtilities } from \"../statusbar/StatusBarItemUtilities\";\nimport { SectionsStatusField } from \"../statusfields/SectionsField\";\nimport { ToolbarHelper } from \"../toolbar/ToolbarHelper\";\nimport type { ToolbarItem } from \"../toolbar/ToolbarItem\";\nimport { ToolbarOrientation, ToolbarUsage } from \"../toolbar/ToolbarItem\";\nimport { CoreTools } from \"../tools/CoreToolDefinitions\";\nimport type { UiItemsProvider } from \"./UiItemsProvider\";\n\n/**\n * Defines what tools to include from the provider. If any tools in the horizontal or vertical group are\n * specified then only those tools will be provided to stage.\n * @public\n */\nexport interface DefaultContentTools {\n horizontal?: {\n clearSelection?: boolean;\n clearDisplayOverrides?: boolean;\n /** if group then group button is shown to allow user to hide by element, category, model */\n hide?: \"group\" | \"element\";\n /** if group then group button is shown to allow user to isolate by element, category, model */\n isolate?: \"group\" | \"element\";\n /** only element is currently support for emphasize */\n emphasize?: \"element\";\n };\n vertical?: {\n selectElement?: boolean;\n measureGroup?: boolean;\n sectionGroup?: boolean;\n };\n}\n\nfunction getGroupPriority(potentialId: any, defaultValue: number) {\n if (undefined === potentialId) return defaultValue;\n\n // istanbul ignore else\n if (typeof potentialId === \"number\") {\n return potentialId;\n }\n\n // istanbul ignore next\n return defaultValue;\n}\n\n/**\n * @beta\n */\nexport class StandardContentToolsUiItemsProvider implements UiItemsProvider {\n public get id(): string {\n return \"appui-react:StandardContentToolsUiItemsProvider\";\n }\n\n constructor(private defaultContextTools?: DefaultContentTools) {}\n\n public provideToolbarItems(\n _stageId: string,\n _stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n stageAppData?: any\n ): ToolbarItem[] {\n const items: ToolbarItem[] = [];\n\n if (\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Horizontal\n ) {\n const clearSelectionGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.horizontal\n ?.clearSelectionGroupPriority,\n 10\n );\n const overridesGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.horizontal?.overridesGroupPriority,\n 20\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.clearSelection\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 10,\n CoreTools.clearSelectionItemDef,\n { groupPriority: clearSelectionGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.clearDisplayOverrides\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 20,\n SelectionContextToolDefinitions.clearHideIsolateEmphasizeElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.hide\n ) {\n if (this.defaultContextTools?.horizontal?.hide === \"group\")\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n SelectionContextToolDefinitions.hideSectionToolGroup,\n { groupPriority: overridesGroupPriority }\n )\n );\n else\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n SelectionContextToolDefinitions.hideElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.isolate\n ) {\n if (this.defaultContextTools?.horizontal?.isolate === \"group\")\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 40,\n SelectionContextToolDefinitions.isolateSelectionToolGroup,\n { groupPriority: overridesGroupPriority }\n )\n );\n else\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 40,\n SelectionContextToolDefinitions.isolateElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.emphasize\n ) {\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 50,\n SelectionContextToolDefinitions.emphasizeElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n } /* istanbul ignore else */ else if (\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n const selectElementGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.selectElementGroupPriority,\n 10\n );\n const measureGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.measureGroupPriority,\n 10\n );\n const selectionGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.selectionGroupPriority,\n 10\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.selectElement\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 10,\n CoreTools.selectElementCommand,\n { groupPriority: selectElementGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.measureGroup\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 20,\n CoreTools.measureToolGroup,\n { groupPriority: measureGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.sectionGroup\n ) {\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n CoreTools.sectionToolGroup,\n { groupPriority: selectionGroupPriority }\n )\n );\n }\n }\n return items;\n }\n\n public provideStatusBarItems(\n _stageId: string,\n _stageUsage: string,\n _stageAppData?: any\n ): StatusBarItem[] {\n const statusBarItems: StatusBarItem[] = [];\n\n // if the sectionGroup tools are to be shown then we want the status field added to allow clearing or manipulation the section\n if (this.defaultContextTools?.vertical?.sectionGroup) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.Sections\",\n StatusBarSection.Center,\n 20,\n <SectionsStatusField hideWhenUnused />\n )\n );\n }\n\n return statusBarItems;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StandardContentToolsUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/ui-items-provider/StandardContent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C","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 StandardUiItemsProvider\n */\n\nimport * as React from \"react\";\nimport { SelectionContextToolDefinitions } from \"../selection/SelectionContextItemDef\";\nimport type { StatusBarItem } from \"../statusbar/StatusBarItem\";\nimport { StatusBarSection } from \"../statusbar/StatusBarItem\";\nimport { StatusBarItemUtilities } from \"../statusbar/StatusBarItemUtilities\";\nimport { SectionsStatusField } from \"../statusfields/SectionsField\";\nimport { ToolbarHelper } from \"../toolbar/ToolbarHelper\";\nimport type { ToolbarItem } from \"../toolbar/ToolbarItem\";\nimport { ToolbarOrientation, ToolbarUsage } from \"../toolbar/ToolbarItem\";\nimport { CoreTools } from \"../tools/CoreToolDefinitions\";\nimport type { UiItemsProvider } from \"./UiItemsProvider\";\n\n/**\n * Defines what tools to include from the provider. If any tools in the horizontal or vertical group are\n * specified then only those tools will be provided to stage.\n * @public\n */\nexport interface DefaultContentTools {\n horizontal?: {\n clearSelection?: boolean;\n clearDisplayOverrides?: boolean;\n /** if group then group button is shown to allow user to hide by element, category, model */\n hide?: \"group\" | \"element\";\n /** if group then group button is shown to allow user to isolate by element, category, model */\n isolate?: \"group\" | \"element\";\n /** only element is currently support for emphasize */\n emphasize?: \"element\";\n };\n vertical?: {\n selectElement?: boolean;\n measureGroup?: boolean;\n sectionGroup?: boolean;\n };\n}\n\nfunction getGroupPriority(potentialId: any, defaultValue: number) {\n if (undefined === potentialId) return defaultValue;\n\n // istanbul ignore else\n if (typeof potentialId === \"number\") {\n return potentialId;\n }\n\n // istanbul ignore next\n return defaultValue;\n}\n\n/**\n * @beta\n */\nexport class StandardContentToolsUiItemsProvider implements UiItemsProvider {\n public get id(): string {\n return \"appui-react:StandardContentToolsUiItemsProvider\";\n }\n\n constructor(private defaultContextTools?: DefaultContentTools) {}\n\n public provideToolbarItems(\n _stageId: string,\n _stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n stageAppData?: any\n ): ToolbarItem[] {\n const items: ToolbarItem[] = [];\n\n if (\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Horizontal\n ) {\n const clearSelectionGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.horizontal\n ?.clearSelectionGroupPriority,\n 10\n );\n const overridesGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.horizontal?.overridesGroupPriority,\n 20\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.clearSelection\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 10,\n CoreTools.clearSelectionItemDef,\n { groupPriority: clearSelectionGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.clearDisplayOverrides\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 20,\n SelectionContextToolDefinitions.clearHideIsolateEmphasizeElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.hide\n ) {\n if (this.defaultContextTools?.horizontal?.hide === \"group\")\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n SelectionContextToolDefinitions.hideSectionToolGroup,\n { groupPriority: overridesGroupPriority }\n )\n );\n else\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n SelectionContextToolDefinitions.hideElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.isolate\n ) {\n if (this.defaultContextTools?.horizontal?.isolate === \"group\")\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 40,\n SelectionContextToolDefinitions.isolateSelectionToolGroup,\n { groupPriority: overridesGroupPriority }\n )\n );\n else\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 40,\n SelectionContextToolDefinitions.isolateElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.horizontal ||\n this.defaultContextTools.horizontal.emphasize\n ) {\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 50,\n SelectionContextToolDefinitions.emphasizeElementsItemDef,\n { groupPriority: overridesGroupPriority }\n )\n );\n }\n } /* istanbul ignore else */ else if (\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n const selectElementGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.selectElementGroupPriority,\n 10\n );\n const measureGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.measureGroupPriority,\n 10\n );\n const selectionGroupPriority = getGroupPriority(\n stageAppData?.defaultContentTools?.vertical?.selectionGroupPriority,\n 10\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.selectElement\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 10,\n CoreTools.selectElementCommand,\n { groupPriority: selectElementGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.measureGroup\n )\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 20,\n CoreTools.measureToolGroup,\n { groupPriority: measureGroupPriority }\n )\n );\n\n if (\n !this.defaultContextTools ||\n !this.defaultContextTools.vertical ||\n this.defaultContextTools.vertical.sectionGroup\n ) {\n items.push(\n ToolbarHelper.createToolbarItemFromItemDef(\n 30,\n CoreTools.sectionToolGroup,\n { groupPriority: selectionGroupPriority }\n )\n );\n }\n }\n return items;\n }\n\n public provideStatusBarItems(\n _stageId: string,\n _stageUsage: string,\n _stageAppData?: any\n ): StatusBarItem[] {\n const statusBarItems: StatusBarItem[] = [];\n\n // if the sectionGroup tools are to be shown then we want the status field added to allow clearing or manipulation the section\n if (this.defaultContextTools?.vertical?.sectionGroup) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.Sections\",\n StatusBarSection.Center,\n 20,\n <SectionsStatusField hideWhenUnused />\n )\n );\n }\n\n return statusBarItems;\n }\n}\n"]}
|
|
@@ -31,6 +31,7 @@ class StandardStatusbarUiItemsProvider {
|
|
|
31
31
|
this._defaultItems = _defaultItems;
|
|
32
32
|
}
|
|
33
33
|
provideStatusBarItems(_stageId, _stageUsage, _stageAppData) {
|
|
34
|
+
var _a;
|
|
34
35
|
const statusBarItems = [];
|
|
35
36
|
if (!this._defaultItems || this._defaultItems.messageCenter) {
|
|
36
37
|
statusBarItems.push(StatusBarItemUtilities_1.StatusBarItemUtilities.createCustomItem("uifw.MessageCenter", StatusBarItem_1.StatusBarSection.Left, 10, React.createElement(MessageCenter_1.MessageCenterField, null)));
|
|
@@ -42,7 +43,7 @@ class StandardStatusbarUiItemsProvider {
|
|
|
42
43
|
if (!this._defaultItems || this._defaultItems.postToolAssistanceSeparator)
|
|
43
44
|
statusBarItems.push(StatusBarItemUtilities_1.StatusBarItemUtilities.createCustomItem("uifw.PostToolAssistance", StatusBarItem_1.StatusBarSection.Left, 25, React.createElement(Separator_1.StatusBarSeparator, null)));
|
|
44
45
|
}
|
|
45
|
-
if (this._defaultItems
|
|
46
|
+
if ((_a = this._defaultItems) === null || _a === void 0 ? void 0 : _a.activityCenter) {
|
|
46
47
|
statusBarItems.push(StatusBarItemUtilities_1.StatusBarItemUtilities.createCustomItem("uifw.ActivityCenter", StatusBarItem_1.StatusBarSection.Left, 30, React.createElement(ActivityCenter_1.ActivityCenterField, null)));
|
|
47
48
|
}
|
|
48
49
|
if (!this._defaultItems || this._defaultItems.accuSnapModePicker) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardStatusbarUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,gFAA6E;AAC7E,4FAAyF;AACzF,iEAAmE;AACnE,mEAAqE;AACrE,uDAAyD;AACzD,iEAAmE;AACnE,2FAAwF;AACxF,mEAAqE;AACrE,sDAA4D;AAG5D,8DAA8D;AAoB9D;;;GAGG;AACH,MAAa,gCAAgC;IAC3C,IAAW,EAAE;QACX,OAAO,8CAA8C,CAAC;IACxD,CAAC;IAED,YAAoB,aAAqC;QAArC,kBAAa,GAAb,aAAa,CAAwB;IAAG,CAAC;IAEtD,qBAAqB,CAC1B,QAAgB,EAChB,WAAmB,EACnB,aAAmB
|
|
1
|
+
{"version":3,"file":"StandardStatusbarUiItemsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,gFAA6E;AAC7E,4FAAyF;AACzF,iEAAmE;AACnE,mEAAqE;AACrE,uDAAyD;AACzD,iEAAmE;AACnE,2FAAwF;AACxF,mEAAqE;AACrE,sDAA4D;AAG5D,8DAA8D;AAoB9D;;;GAGG;AACH,MAAa,gCAAgC;IAC3C,IAAW,EAAE;QACX,OAAO,8CAA8C,CAAC;IACxD,CAAC;IAED,YAAoB,aAAqC;QAArC,kBAAa,GAAb,aAAa,CAAwB;IAAG,CAAC;IAEtD,qBAAqB,CAC1B,QAAgB,EAChB,WAAmB,EACnB,aAAmB;;QAEnB,MAAM,cAAc,GAAoB,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YAC3D,cAAc,CAAC,IAAI,CACjB,+CAAsB,CAAC,gBAAgB,C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AAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE;YAC/D,cAAc,CAAC,IAAI,CACjB,+CAAsB,CAAC,gBAAgB,CACrC,wBAAwB,EACxB,gCAAgB,CAAC,KAAK,EACtB,EAAE,EACF,oBAAC,2CAAoB,OAAG,CACzB,CACF,CAAC;SACH;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;YAC5D,cAAc,CAAC,IAAI,CACjB,+CAAsB,CAAC,gBAAgB,CACrC,qBAAqB,EACrB,gCAAgB,CAAC,KAAK,EACtB,EAAE,EACF,oBAAC,oCAAmB,OAAG,CACxB,CACF,CAAC;SACH;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YAC3D,cAAc,CAAC,IAAI,CACjB,+CAAsB,CAAC,gBAAgB,CACrC,oBAAoB,EACpB,gCAAgB,CAAC,KAAK,EACtB,EAAE,EACF,oBAAC,kCAAkB,OAAG,CACvB,CACF,CAAC;SACH;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF;AA7GD,4EA6GC","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 StandardUiItemsProvider\n */\n\nimport * as React from \"react\";\nimport { StatusBarItemUtilities } from \"../statusbar/StatusBarItemUtilities\";\nimport { ToolAssistanceField } from \"../statusfields/toolassistance/ToolAssistanceField\";\nimport { MessageCenterField } from \"../statusfields/MessageCenter\";\nimport { ActivityCenterField } from \"../statusfields/ActivityCenter\";\nimport { SnapModeField } from \"../statusfields/SnapMode\";\nimport { SelectionInfoField } from \"../statusfields/SelectionInfo\";\nimport { TileLoadingIndicator } from \"../statusfields/tileloading/TileLoadingIndicator\";\nimport { SelectionScopeField } from \"../statusfields/SelectionScope\";\nimport { StatusBarSeparator } from \"../statusbar/Separator\";\nimport type { UiItemsProvider } from \"./UiItemsProvider\";\nimport type { StatusBarItem } from \"../statusbar/StatusBarItem\";\nimport { StatusBarSection } from \"../statusbar/StatusBarItem\";\n\n/**\n * Defines what items to include from the provider. If any items are\n * specified then only those items will be added to statusbar.\n * @public\n */\nexport interface DefaultStatusbarItems {\n messageCenter?: boolean;\n preToolAssistanceSeparator?: boolean;\n toolAssistance?: boolean;\n postToolAssistanceSeparator?: boolean;\n /** Activity center field is hidden by default. */\n activityCenter?: boolean;\n accuSnapModePicker?: boolean;\n tileLoadIndicator?: boolean;\n selectionScope?: boolean;\n selectionInfo?: boolean;\n}\n\n/**\n * Provide standard statusbar fields for the SimpleStatusbarWidget\n * @beta\n */\nexport class StandardStatusbarUiItemsProvider implements UiItemsProvider {\n public get id(): string {\n return \"appui-react:StandardStatusbarUiItemsProvider\";\n }\n\n constructor(private _defaultItems?: DefaultStatusbarItems) {}\n\n public provideStatusBarItems(\n _stageId: string,\n _stageUsage: string,\n _stageAppData?: any\n ): StatusBarItem[] {\n const statusBarItems: StatusBarItem[] = [];\n if (!this._defaultItems || this._defaultItems.messageCenter) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.MessageCenter\",\n StatusBarSection.Left,\n 10,\n <MessageCenterField />\n )\n );\n }\n if (!this._defaultItems || this._defaultItems.toolAssistance) {\n if (!this._defaultItems || this._defaultItems.preToolAssistanceSeparator)\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.PreToolAssistance\",\n StatusBarSection.Left,\n 15,\n <StatusBarSeparator />\n )\n );\n\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.ToolAssistance\",\n StatusBarSection.Left,\n 20,\n <ToolAssistanceField />\n )\n );\n\n if (!this._defaultItems || this._defaultItems.postToolAssistanceSeparator)\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.PostToolAssistance\",\n StatusBarSection.Left,\n 25,\n <StatusBarSeparator />\n )\n );\n }\n if (this._defaultItems?.activityCenter) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.ActivityCenter\",\n StatusBarSection.Left,\n 30,\n <ActivityCenterField />\n )\n );\n }\n if (!this._defaultItems || this._defaultItems.accuSnapModePicker) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.SnapMode\",\n StatusBarSection.Center,\n 10,\n <SnapModeField />\n )\n );\n }\n\n if (!this._defaultItems || this._defaultItems.tileLoadIndicator) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.TileLoadIndicator\",\n StatusBarSection.Right,\n 10,\n <TileLoadingIndicator />\n )\n );\n }\n\n if (!this._defaultItems || this._defaultItems.selectionScope) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.SelectionScope\",\n StatusBarSection.Right,\n 20,\n <SelectionScopeField />\n )\n );\n }\n\n if (!this._defaultItems || this._defaultItems.selectionInfo) {\n statusBarItems.push(\n StatusBarItemUtilities.createCustomItem(\n \"uifw.SelectionInfo\",\n StatusBarSection.Right,\n 30,\n <SelectionInfoField />\n )\n );\n }\n\n return statusBarItems;\n }\n}\n"]}
|
|
@@ -46,9 +46,10 @@ class UiItemsManager {
|
|
|
46
46
|
* @param providerId id of the UiItemsProvider to get
|
|
47
47
|
*/
|
|
48
48
|
static getUiItemsProvider(providerId) {
|
|
49
|
+
var _a;
|
|
49
50
|
if (this._abstractAdapter)
|
|
50
51
|
return this._abstractAdapter.getUiItemsProvider(providerId);
|
|
51
|
-
return UiItemsManager._registeredUiItemsProviders.get(providerId)
|
|
52
|
+
return (_a = UiItemsManager._registeredUiItemsProviders.get(providerId)) === null || _a === void 0 ? void 0 : _a.provider;
|
|
52
53
|
}
|
|
53
54
|
static sendRegisteredEvent(args) {
|
|
54
55
|
UiItemsManager.onUiProviderRegisteredEvent.raiseEvent(args);
|
|
@@ -58,9 +59,10 @@ class UiItemsManager {
|
|
|
58
59
|
* @param uiProvider the UI items provider to register.
|
|
59
60
|
*/
|
|
60
61
|
static register(uiProvider, overrides) {
|
|
62
|
+
var _a;
|
|
61
63
|
if (this._abstractAdapter)
|
|
62
64
|
return this._abstractAdapter.register(uiProvider, overrides);
|
|
63
|
-
const providerId = overrides
|
|
65
|
+
const providerId = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.providerId) !== null && _a !== void 0 ? _a : uiProvider.id;
|
|
64
66
|
if (UiItemsManager.getUiItemsProvider(providerId)) {
|
|
65
67
|
core_bentley_1.Logger.logInfo(UiFramework_1.UiFramework.loggerCategory(this), `UiItemsProvider (${providerId}) is already loaded`);
|
|
66
68
|
}
|
|
@@ -90,11 +92,11 @@ class UiItemsManager {
|
|
|
90
92
|
// istanbul ignore else
|
|
91
93
|
const overrides = entry.overrides;
|
|
92
94
|
if (undefined !== stageId &&
|
|
93
|
-
overrides
|
|
95
|
+
(overrides === null || overrides === void 0 ? void 0 : overrides.stageIds) &&
|
|
94
96
|
!overrides.stageIds.some((value) => value === stageId))
|
|
95
97
|
return false;
|
|
96
98
|
if (undefined !== stageUsage &&
|
|
97
|
-
overrides
|
|
99
|
+
(overrides === null || overrides === void 0 ? void 0 : overrides.stageUsages) &&
|
|
98
100
|
!overrides.stageUsages.some((value) => value === stageUsage))
|
|
99
101
|
return false;
|
|
100
102
|
return true;
|
|
@@ -112,8 +114,9 @@ class UiItemsManager {
|
|
|
112
114
|
return this._abstractAdapter.getToolbarButtonItems(stageId, stageUsage, usage, orientation);
|
|
113
115
|
const buttonItems = [];
|
|
114
116
|
UiItemsManager._registeredUiItemsProviders.forEach((entry) => {
|
|
117
|
+
var _a, _b;
|
|
115
118
|
const uiProvider = entry.provider;
|
|
116
|
-
const providerId = entry.overrides
|
|
119
|
+
const providerId = (_b = (_a = entry.overrides) === null || _a === void 0 ? void 0 : _a.providerId) !== null && _b !== void 0 ? _b : uiProvider.id;
|
|
117
120
|
// istanbul ignore else
|
|
118
121
|
if (uiProvider.provideToolbarItems &&
|
|
119
122
|
this.allowItemsFromProvider(entry, stageId, stageUsage)) {
|
|
@@ -139,8 +142,9 @@ class UiItemsManager {
|
|
|
139
142
|
return this._abstractAdapter.getStatusBarItems(stageId, stageUsage);
|
|
140
143
|
const statusBarItems = [];
|
|
141
144
|
UiItemsManager._registeredUiItemsProviders.forEach((entry) => {
|
|
145
|
+
var _a, _b;
|
|
142
146
|
const uiProvider = entry.provider;
|
|
143
|
-
const providerId = entry.overrides
|
|
147
|
+
const providerId = (_b = (_a = entry.overrides) === null || _a === void 0 ? void 0 : _a.providerId) !== null && _b !== void 0 ? _b : uiProvider.id;
|
|
144
148
|
// istanbul ignore else
|
|
145
149
|
if (uiProvider.provideStatusBarItems &&
|
|
146
150
|
this.allowItemsFromProvider(entry, stageId, stageUsage)) {
|
|
@@ -164,8 +168,9 @@ class UiItemsManager {
|
|
|
164
168
|
return this._abstractAdapter.getBackstageItems();
|
|
165
169
|
const backstageItems = [];
|
|
166
170
|
UiItemsManager._registeredUiItemsProviders.forEach((entry) => {
|
|
171
|
+
var _a, _b;
|
|
167
172
|
const uiProvider = entry.provider;
|
|
168
|
-
const providerId = entry.overrides
|
|
173
|
+
const providerId = (_b = (_a = entry.overrides) === null || _a === void 0 ? void 0 : _a.providerId) !== null && _b !== void 0 ? _b : uiProvider.id;
|
|
169
174
|
// istanbul ignore else
|
|
170
175
|
if (uiProvider.provideBackstageItems) {
|
|
171
176
|
// Note: We do not call this.allowItemsFromProvider here as backstage items
|
|
@@ -194,8 +199,9 @@ class UiItemsManager {
|
|
|
194
199
|
return this._abstractAdapter.getWidgets(stageId, stageUsage, location, section);
|
|
195
200
|
const widgets = [];
|
|
196
201
|
UiItemsManager._registeredUiItemsProviders.forEach((entry) => {
|
|
202
|
+
var _a, _b;
|
|
197
203
|
const uiProvider = entry.provider;
|
|
198
|
-
const providerId = entry.overrides
|
|
204
|
+
const providerId = (_b = (_a = entry.overrides) === null || _a === void 0 ? void 0 : _a.providerId) !== null && _b !== void 0 ? _b : uiProvider.id;
|
|
199
205
|
// istanbul ignore else
|
|
200
206
|
if (uiProvider.provideWidgets &&
|
|
201
207
|
this.allowItemsFromProvider(entry, stageId, stageUsage)) {
|
|
@@ -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,sDAAwD;AAUxD,gDAA6C;AAI7C,qEAA+E;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,2BAA2B;QAC3C,IAAI,IAAI,CAAC,gBAAgB;YACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC;QAE3D,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC3C,CAAC;IAED,8CAA8C;IACvC,MAAM,KAAK,qBAAqB;QACrC,IAAI,IAAI,CAAC,gBAAgB;YACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC;QAErD,MAAM,GAAG,GAAG,CAAC,GAAG,cAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;QACnE,OAAO,GAAG,CAAC;IACb,CAAC;IAED,yDAAyD;IAClD,MAAM,KAAK,sBAAsB;QACtC,IAAI,IAAI,CAAC,gBAAgB;YACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC;QAEtD,OAAO,IAAI,CAAC,2BAA2B,CAAC,IAAI,GAAG,CAAC,CAAC;IACnD,CAAC;IAED;;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C,IAAI,GAAG,EAA+B,CAAC;AAC1B,2CAA4B,GACzC,IAAI,wBAAS,EAAsC,CAAC;AACvC,+BAAgB,GAAG,IAAA,4DAAmC,GAAE,CAAC;AAL7D,wCAAc","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":"","sources":["../../../../src/appui-react/ui-items-provider/UiItemsManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAAwD;AAUxD,gDAA6C;AAI7C,qEAA+E;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,2BAA2B;QAC3C,IAAI,IAAI,CAAC,gBAAgB;YACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC;QAE3D,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC3C,CAAC;IAED,8CAA8C;IACvC,MAAM,KAAK,qBAAqB;QACrC,IAAI,IAAI,CAAC,gBAAgB;YACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC;QAErD,MAAM,GAAG,GAAG,CAAC,GAAG,cAAc,CAAC,2BAA2B,CAAC,IAAI,EAAE,CAAC,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AU,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,wBAAS,EAAsC,CAAC;AACvC,+BAAgB,GAAG,IAAA,4DAAmC,GAAE,CAAC;AAL7D,wCAAc","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"]}
|
|
@@ -82,7 +82,7 @@ class FrameworkUiAdmin extends appui_abstract_1.UiAdmin {
|
|
|
82
82
|
/** Resolve location and parent element */
|
|
83
83
|
resolveHtmlElement(location, htmlElement) {
|
|
84
84
|
const position = location;
|
|
85
|
-
const el = htmlElement
|
|
85
|
+
const el = htmlElement !== null && htmlElement !== void 0 ? htmlElement : UiFramework_1.UiFramework.controls.getWrapperElement();
|
|
86
86
|
return { position, el };
|
|
87
87
|
}
|
|
88
88
|
getKeyins() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameworkUiAdmin.js","sourceRoot":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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,+BAA+B;AAE/B,wDAAiD;AAejD,0DAAkE;AAClE,2EAAwE;AACxE,mEAAgE;AAChE,wDAAqD;AAErD,gDAA6C;AAC7C,yEAAsE;AAEtE;;GAEG;AACH,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iDAAiD;IACjD,mFAAY,CAAA;IACZ,6CAA6C;IAC7C,6EAAS,CAAA;IACT,mEAAm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,CAAC;YACF,OAAO,IAAI,CAAC;SACb;aAAM;YACL,yBAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAC/B,oBAAC,2CAAoB,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,yBAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAC5C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,yBAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,IACE,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,CAC/B,EACD;YACA,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;SACb;QAED,uBAAuB;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAvkBD,4CAukBC","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"]}
|
|
@@ -47,7 +47,7 @@ function PropertyEditor({ uiDataProvider, initialItem, isLock, setFocus, }) {
|
|
|
47
47
|
let newRecord = appui_abstract_1.UiLayoutDataProvider.getPropertyRecord(initialItem);
|
|
48
48
|
// istanbul ignore next
|
|
49
49
|
const foundItem = isLock
|
|
50
|
-
? uiDataProvider.items.find((item) => item.lockProperty
|
|
50
|
+
? uiDataProvider.items.find((item) => { var _a; return ((_a = item.lockProperty) === null || _a === void 0 ? void 0 : _a.property.name) === initialItem.property.name; })
|
|
51
51
|
: uiDataProvider.items.find((item) => item.property.name === initialItem.property.name);
|
|
52
52
|
// istanbul ignore else
|
|
53
53
|
if (foundItem) {
|