@itwin/appui-react 4.16.3 → 4.16.5
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 +19 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/CopyStyles.js +28 -7
- package/lib/cjs/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +3 -3
- package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js +1 -1
- package/lib/cjs/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/cjs/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js +7 -6
- package/lib/cjs/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/cjs/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js +26 -0
- package/lib/cjs/appui-react/utils/getActiveViewport.js.map +1 -0
- package/lib/esm/appui-react/childwindow/CopyStyles.d.ts +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/CopyStyles.js +26 -5
- package/lib/esm/appui-react/childwindow/CopyStyles.js.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.d.ts.map +1 -1
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +3 -3
- package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js +1 -1
- package/lib/esm/appui-react/content/ContentGroup.js.map +1 -1
- package/lib/esm/appui-react/preview/new-toolbars/ToolGroup.scss +4 -0
- package/lib/esm/appui-react/selection/SelectionContextItemDef.d.ts.map +1 -1
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js +27 -25
- package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js +7 -6
- package/lib/esm/appui-react/statusbar/StatusBarComposer.js.map +1 -1
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js +2 -0
- package/lib/esm/appui-react/statusbar/StatusBarCornerComponentContext.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.d.ts +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js +23 -25
- package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +16 -12
- package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts +10 -0
- package/lib/esm/appui-react/utils/getActiveViewport.d.ts.map +1 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js +22 -0
- package/lib/esm/appui-react/utils/getActiveViewport.js.map +1 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionContextItemDef.js","sourceRoot":"","sources":["../../../../src/appui-react/selection/SelectionContextItemDef.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAC7E,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAC7E,OAAO,UAAU,MAAM,0CAA0C,CAAC;AAClE,OAAO,YAAY,MAAM,6CAA6C,CAAC;AACvE,OAAO,aAAa,MAAM,8CAA8C,CAAC;AACzE,OAAO,0BAA0B,MAAM,4DAA4D,CAAC;AACpG,OAAO,4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AAE,+BAA+B;YAC1C,QAAQ,EAAE,4BAA4B;YACtC,QAAQ,EAAE,qCAAqC;YAC/C,QAAQ,EAAE,+BAA+B,EAAE;YAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,CAClB,WAAW,CAAC,iCAAiC,CAAC,wBAAwB,EAAE;SAC3E,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,KAAK,wCAAwC;QACxD,OAAO,IAAI,cAAc,CAAC;YACxB,SAAS,EAAE,uCAAuC;YAClD,QAAQ,EAAE,aAAa;YACvB,QAAQ,EAAE,mCAAmC;YAC7C,QAAQ,EAAE,mCAAmC,EAAE;YAC/C,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,WAAW,CAAC,iCAAiC,CAAC,qBAAqB,EAAE,CAAC;gBAC5E,MAAM,WAAW,CAAC,iCAAiC,CAAC,0BAA0B,EAAE,CAAC;gBACjF,MAAM,WAAW,CAAC,iCAAiC,CAAC,8BAA8B,EAAE,CAAC;YACvF,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport { SessionStateActionId } from \"../redux/SessionState\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport type { BaseItemState } from \"../shared/ItemDefBase\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { UiFramework } from \"../UiFramework\";\nimport svgModelIsolate from \"@bentley/icons-generic/icons/model-isolate.svg\";\nimport svgLayersIsolate from \"@bentley/icons-generic/icons/layers-isolate.svg\";\nimport svgAssetIsolate from \"@bentley/icons-generic/icons/asset-isolate.svg\";\nimport svgIsolate from \"@bentley/icons-generic/icons/isolate.svg\";\nimport svgModelHide from \"@bentley/icons-generic/icons/model-hide.svg\";\nimport svgLayersHide from \"@bentley/icons-generic/icons/layers-hide.svg\";\nimport svgAssetClassificationHide from \"@bentley/icons-generic/icons/asset-classification-hide.svg\";\nimport svgVisibilitySemiTransparent from \"@bentley/icons-generic/icons/visibility-semi-transparent.svg\";\nimport svgVisibilityHide from \"@bentley/icons-generic/icons/visibility-hide_2.svg\";\nimport svgVisibility from \"@bentley/icons-generic/icons/visibility.svg\";\nimport type { ToolbarItems } from \"../tools/ToolbarItems\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getFeatureOverrideSyncEventIds(): string[] {\n return [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.FeatureOverridesChanged,\n SyncUiEventId.ViewedModelsChanged,\n ];\n}\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getSelectionContextSyncEventIds(): string[] {\n return [\n SyncUiEventId.SelectionSetChanged,\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n // eslint-disable-next-line deprecation/deprecation\n SessionStateActionId.SetNumItemsSelected,\n SyncUiEventId.FeatureOverridesChanged,\n SyncUiEventId.ViewedModelsChanged,\n ];\n}\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function isNoSelectionActive(): boolean {\n const activeContentControl = UiFramework.content.getActiveContentControl();\n const selectionCount = UiFramework.getNumItemsSelected();\n\n if (activeContentControl?.viewport) {\n const hiddenElementsSet = activeContentControl.viewport.neverDrawn;\n const selectedElementsSet =\n activeContentControl.viewport.view.iModel.selectionSet.elements;\n // TODO: add check for categories, subcategories and models\n if (\n selectionCount > 0 ||\n ![...selectedElementsSet].every((value) => hiddenElementsSet?.has(value))\n )\n return false;\n }\n return true;\n}\n\n/** Return ConditionalBooleanValue object used to show items if selection set is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function areNoFeatureOverridesActive(): boolean {\n const activeContentControl = UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !UiFramework.hideIsolateEmphasizeActionHandler.areFeatureOverridesActive(\n activeContentControl.viewport\n );\n\n return true;\n}\n\n/** Return ConditionalBooleanValue object used to show item if feature overrides are active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getIsHiddenIfFeatureOverridesActive(): ConditionalBooleanValue {\n return new ConditionalBooleanValue(\n areNoFeatureOverridesActive,\n getFeatureOverrideSyncEventIds()\n );\n}\n\n/** Return ConditionalBooleanValue object used to show items if selection set is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getIsHiddenIfSelectionNotActive(): ConditionalBooleanValue {\n return new ConditionalBooleanValue(\n isNoSelectionActive,\n getSelectionContextSyncEventIds()\n );\n}\n\n/** Return state with isVisible set to true is SectionSet is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function featureOverridesActiveStateFunc(\n state: Readonly<BaseItemState>\n): BaseItemState {\n const activeContentControl = UiFramework.content.getActiveContentControl();\n let isVisible = false;\n\n if (activeContentControl && activeContentControl.viewport)\n isVisible =\n UiFramework.hideIsolateEmphasizeActionHandler.areFeatureOverridesActive(\n activeContentControl.viewport\n );\n\n return { ...state, isVisible };\n}\n\n/** Return state with isVisible set to true is SectionSet is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function selectionContextStateFunc(\n state: Readonly<BaseItemState>\n): BaseItemState {\n const activeContentControl = UiFramework.content.getActiveContentControl();\n let isVisible = false;\n\n const selectionCount = UiFramework.getNumItemsSelected();\n if (\n activeContentControl &&\n activeContentControl.viewport &&\n (activeContentControl.viewport.view.iModel.selectionSet.size > 0 ||\n selectionCount > 0)\n )\n isVisible = true;\n return { ...state, isVisible };\n}\n\n/** Utility Class that provides definitions for tools dependent on current selection. These definitions can be used to populate toolbars.\n * @public\n * @deprecated in 4.15.0. Use {@link ToolbarItems} instead.\n */\nexport class SelectionContextToolDefinitions {\n public static get isolateModelsInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateModel\",\n iconSpec: svgModelIsolate,\n labelKey: \"UiFramework:tools.isolateModels\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelectedElementsModel(),\n });\n }\n\n public static get isolateCategoriesInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateCategory\",\n iconSpec: svgLayersIsolate,\n labelKey: \"UiFramework:tools.isolateCategories\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelectedElementsCategory(),\n });\n }\n\n public static get isolateElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateSelected\",\n iconSpec: svgAssetIsolate,\n labelKey: \"UiFramework:tools.isolateSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelected(),\n });\n }\n\n public static get isolateSelectionToolGroup() {\n return new GroupItemDef({\n groupId: \"UiFramework.IsolateSelectionGroup\",\n labelKey: \"UiFramework:tools.isolate\",\n iconSpec: svgIsolate,\n isHidden: getIsHiddenIfSelectionNotActive(),\n items: [\n this.isolateElementsItemDef,\n this.isolateCategoriesInSelectionItemDef,\n this.isolateModelsInSelectionItemDef,\n ],\n itemsInColumn: 3,\n });\n }\n\n public static get hideModelsInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideModel\",\n iconSpec: svgModelHide,\n labelKey: \"UiFramework:tools.hideModels\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelectedElementsModel(),\n });\n }\n\n public static get hideCategoriesInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideCategory\",\n iconSpec: svgLayersHide,\n labelKey: \"UiFramework:tools.hideCategories\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelectedElementsCategory(),\n });\n }\n\n public static get hideElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideSelected\",\n iconSpec: svgAssetClassificationHide,\n labelKey: \"UiFramework:tools.hideSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelected(),\n });\n }\n\n public static get hideSectionToolGroup() {\n return new GroupItemDef({\n groupId: \"UiFramework.HideSelectionGroup\",\n labelKey: \"UiFramework:tools.hide\",\n iconSpec: svgVisibilityHide,\n isHidden: getIsHiddenIfSelectionNotActive(),\n items: [\n this.hideElementsItemDef,\n this.hideCategoriesInSelectionItemDef,\n this.hideModelsInSelectionItemDef,\n ],\n itemsInColumn: 3,\n });\n }\n\n public static get emphasizeElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.EmphasizeSelected\",\n iconSpec: svgVisibilitySemiTransparent,\n labelKey: \"UiFramework:tools.emphasizeSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processEmphasizeSelected(),\n });\n }\n\n public static get clearHideIsolateEmphasizeElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearHideIsolateEmphasize\",\n iconSpec: svgVisibility,\n labelKey: \"UiFramework:tools.clearVisibility\",\n isHidden: getIsHiddenIfFeatureOverridesActive(),\n execute: async () => {\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearEmphasize();\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearOverrideModels();\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearOverrideCategories();\n },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionContextItemDef.js","sourceRoot":"","sources":["../../../../src/appui-react/selection/SelectionContextItemDef.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAC7E,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAC7E,OAAO,UAAU,MAAM,0CAA0C,CAAC;AAClE,OAAO,YAAY,MAAM,6CAA6C,CAAC;AACvE,OAAO,aAAa,MAAM,8CAA8C,CAAC;AACzE,OAAO,0BAA0B,MAAM,4DAA4D,CAAC;AACpG,OAAO,4BAA4B,MAAM,8DAA8D,CAAC;AACxG,OAAO,iBAAiB,MAAM,oDAAoD,CAAC;AACnF,OAAO,aAAa,MAAM,6CAA6C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,4CAA4C;AAE5C;;;GAGG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO;QACL,aAAa,CAAC,oBAAoB;QAClC,aAAa,CAAC,qBAAqB;QACnC,aAAa,CAAC,uBAAuB;QACrC,aAAa,CAAC,mBAAmB;KAClC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,aAAa,CA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AqB,EAAE,CAAC;gBAC5E,MAAM,WAAW,CAAC,iCAAiC,CAAC,0BAA0B,EAAE,CAAC;gBACjF,MAAM,WAAW,CAAC,iCAAiC,CAAC,8BAA8B,EAAE,CAAC;YACvF,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport { SessionStateActionId } from \"../redux/SessionState\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport type { BaseItemState } from \"../shared/ItemDefBase\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { UiFramework } from \"../UiFramework\";\nimport svgModelIsolate from \"@bentley/icons-generic/icons/model-isolate.svg\";\nimport svgLayersIsolate from \"@bentley/icons-generic/icons/layers-isolate.svg\";\nimport svgAssetIsolate from \"@bentley/icons-generic/icons/asset-isolate.svg\";\nimport svgIsolate from \"@bentley/icons-generic/icons/isolate.svg\";\nimport svgModelHide from \"@bentley/icons-generic/icons/model-hide.svg\";\nimport svgLayersHide from \"@bentley/icons-generic/icons/layers-hide.svg\";\nimport svgAssetClassificationHide from \"@bentley/icons-generic/icons/asset-classification-hide.svg\";\nimport svgVisibilitySemiTransparent from \"@bentley/icons-generic/icons/visibility-semi-transparent.svg\";\nimport svgVisibilityHide from \"@bentley/icons-generic/icons/visibility-hide_2.svg\";\nimport svgVisibility from \"@bentley/icons-generic/icons/visibility.svg\";\nimport type { ToolbarItems } from \"../tools/ToolbarItems\";\nimport { getActiveViewport } from \"../utils/getActiveViewport\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getFeatureOverrideSyncEventIds(): string[] {\n return [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.FeatureOverridesChanged,\n SyncUiEventId.ViewedModelsChanged,\n ];\n}\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getSelectionContextSyncEventIds(): string[] {\n return [\n SyncUiEventId.SelectionSetChanged,\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n // eslint-disable-next-line deprecation/deprecation\n SessionStateActionId.SetNumItemsSelected,\n SyncUiEventId.FeatureOverridesChanged,\n SyncUiEventId.ViewedModelsChanged,\n ];\n}\n\n/** Return SyncEventIds that trigger selection state function refresh.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function isNoSelectionActive(): boolean {\n const viewport = getActiveViewport();\n if (!viewport) {\n return true;\n }\n\n const selectionCount = UiFramework.getNumItemsSelected();\n if (selectionCount > 0) return false;\n\n // TODO: add check for categories, subcategories and models\n const hiddenElementsSet = viewport.neverDrawn;\n const selectedElementsSet = viewport.view.iModel.selectionSet.elements;\n if (![...selectedElementsSet].every((value) => hiddenElementsSet?.has(value)))\n return false;\n\n return true;\n}\n\n/** Return ConditionalBooleanValue object used to show items if selection set is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function areNoFeatureOverridesActive(): boolean {\n const viewport = getActiveViewport();\n if (!viewport) {\n return true;\n }\n\n return !UiFramework.hideIsolateEmphasizeActionHandler.areFeatureOverridesActive(\n viewport\n );\n}\n\n/** Return ConditionalBooleanValue object used to show item if feature overrides are active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getIsHiddenIfFeatureOverridesActive(): ConditionalBooleanValue {\n return new ConditionalBooleanValue(\n areNoFeatureOverridesActive,\n getFeatureOverrideSyncEventIds()\n );\n}\n\n/** Return ConditionalBooleanValue object used to show items if selection set is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function getIsHiddenIfSelectionNotActive(): ConditionalBooleanValue {\n return new ConditionalBooleanValue(\n isNoSelectionActive,\n getSelectionContextSyncEventIds()\n );\n}\n\n/** Return state with isVisible set to true is SectionSet is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function featureOverridesActiveStateFunc(\n state: Readonly<BaseItemState>\n): BaseItemState {\n const viewport = getActiveViewport();\n if (!viewport) {\n return { ...state, isVisible: false };\n }\n\n const isVisible =\n UiFramework.hideIsolateEmphasizeActionHandler.areFeatureOverridesActive(\n viewport\n );\n return { ...state, isVisible };\n}\n\n/** Return state with isVisible set to true is SectionSet is active.\n * @beta\n * @deprecated in 4.15.0. Use {@link ToolbarItems} or a custom conditional value instead.\n */\nexport function selectionContextStateFunc(\n state: Readonly<BaseItemState>\n): BaseItemState {\n const viewport = getActiveViewport();\n if (!viewport) {\n return { ...state, isVisible: false };\n }\n\n const selectionCount = UiFramework.getNumItemsSelected();\n const isVisible =\n viewport.view.iModel.selectionSet.size > 0 || selectionCount > 0;\n return { ...state, isVisible };\n}\n\n/** Utility Class that provides definitions for tools dependent on current selection. These definitions can be used to populate toolbars.\n * @public\n * @deprecated in 4.15.0. Use {@link ToolbarItems} instead.\n */\nexport class SelectionContextToolDefinitions {\n public static get isolateModelsInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateModel\",\n iconSpec: svgModelIsolate,\n labelKey: \"UiFramework:tools.isolateModels\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelectedElementsModel(),\n });\n }\n\n public static get isolateCategoriesInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateCategory\",\n iconSpec: svgLayersIsolate,\n labelKey: \"UiFramework:tools.isolateCategories\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelectedElementsCategory(),\n });\n }\n\n public static get isolateElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.IsolateSelected\",\n iconSpec: svgAssetIsolate,\n labelKey: \"UiFramework:tools.isolateSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processIsolateSelected(),\n });\n }\n\n public static get isolateSelectionToolGroup() {\n return new GroupItemDef({\n groupId: \"UiFramework.IsolateSelectionGroup\",\n labelKey: \"UiFramework:tools.isolate\",\n iconSpec: svgIsolate,\n isHidden: getIsHiddenIfSelectionNotActive(),\n items: [\n this.isolateElementsItemDef,\n this.isolateCategoriesInSelectionItemDef,\n this.isolateModelsInSelectionItemDef,\n ],\n itemsInColumn: 3,\n });\n }\n\n public static get hideModelsInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideModel\",\n iconSpec: svgModelHide,\n labelKey: \"UiFramework:tools.hideModels\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelectedElementsModel(),\n });\n }\n\n public static get hideCategoriesInSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideCategory\",\n iconSpec: svgLayersHide,\n labelKey: \"UiFramework:tools.hideCategories\",\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelectedElementsCategory(),\n });\n }\n\n public static get hideElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.HideSelected\",\n iconSpec: svgAssetClassificationHide,\n labelKey: \"UiFramework:tools.hideSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processHideSelected(),\n });\n }\n\n public static get hideSectionToolGroup() {\n return new GroupItemDef({\n groupId: \"UiFramework.HideSelectionGroup\",\n labelKey: \"UiFramework:tools.hide\",\n iconSpec: svgVisibilityHide,\n isHidden: getIsHiddenIfSelectionNotActive(),\n items: [\n this.hideElementsItemDef,\n this.hideCategoriesInSelectionItemDef,\n this.hideModelsInSelectionItemDef,\n ],\n itemsInColumn: 3,\n });\n }\n\n public static get emphasizeElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.EmphasizeSelected\",\n iconSpec: svgVisibilitySemiTransparent,\n labelKey: \"UiFramework:tools.emphasizeSelected\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () =>\n UiFramework.hideIsolateEmphasizeActionHandler.processEmphasizeSelected(),\n });\n }\n\n public static get clearHideIsolateEmphasizeElementsItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearHideIsolateEmphasize\",\n iconSpec: svgVisibility,\n labelKey: \"UiFramework:tools.clearVisibility\",\n isHidden: getIsHiddenIfFeatureOverridesActive(),\n execute: async () => {\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearEmphasize();\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearOverrideModels();\n await UiFramework.hideIsolateEmphasizeActionHandler.processClearOverrideCategories();\n },\n });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBarComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/StatusBarComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAEV,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAqBzB,UAAU,8BAA8B;IACtC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAMD,gBAAgB;AAChB,wBAAgB,iBAAiB,mCAEhC;AAED;;GAEG;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K,CAAC,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,qBAqB5D;AAoLD;;GAEG;AAEH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,uBAAuB;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;IAEvB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAoR9D"}
|
|
@@ -197,8 +197,10 @@ export function StatusBarComposer(props) {
|
|
|
197
197
|
const combinedItems = combineItems(defaultItems, addonItems);
|
|
198
198
|
return sortItems(combinedItems);
|
|
199
199
|
}, [defaultItems, addonItems]);
|
|
200
|
-
const
|
|
201
|
-
return statusBarItems
|
|
200
|
+
const notOverflown = React.useMemo(() => {
|
|
201
|
+
return statusBarItems
|
|
202
|
+
.filter((item) => !isItemInOverflow(item.id, overflown))
|
|
203
|
+
.map((item) => item.id);
|
|
202
204
|
}, [overflown, statusBarItems]);
|
|
203
205
|
const calculateOverflow = React.useCallback(() => {
|
|
204
206
|
const widths = verifiedMapEntries(entryWidths.current);
|
|
@@ -251,10 +253,9 @@ export function StatusBarComposer(props) {
|
|
|
251
253
|
const providerId = isProviderItem(item) ? item.providerId : undefined;
|
|
252
254
|
return (React.createElement(DockedStatusBarEntry, { key: key, entryKey: key, getOnResize: handleEntryResize },
|
|
253
255
|
React.createElement(DockedStatusBarItem, { key: key, itemId: item.id, itemPriority: itemPriority, providerId: providerId, section: getSectionName(section) },
|
|
254
|
-
React.createElement(StatusBarCornerComponentContext.Provider, { value: key ===
|
|
256
|
+
React.createElement(StatusBarCornerComponentContext.Provider, { value: key === notOverflown[0]
|
|
255
257
|
? "left-corner"
|
|
256
|
-
: (key ===
|
|
257
|
-
itemsNotInOverflow[itemsNotInOverflow.length - 1].id &&
|
|
258
|
+
: (key === notOverflown[notOverflown.length - 1] &&
|
|
258
259
|
overflown?.length === 0) ||
|
|
259
260
|
isItemInOverflow(key, overflown)
|
|
260
261
|
? "right-corner"
|
|
@@ -262,7 +263,7 @@ export function StatusBarComposer(props) {
|
|
|
262
263
|
isStatusBarCustomItem(item) && item.content,
|
|
263
264
|
isStatusBarActionItem(item) && (React.createElement(StatusBarActionItemComponent, { ...item })),
|
|
264
265
|
isStatusBarLabelItem(item) && (React.createElement(StatusBarLabelItemComponent, { ...item }))))));
|
|
265
|
-
}, [handleEntryResize,
|
|
266
|
+
}, [handleEntryResize, notOverflown, overflown]);
|
|
266
267
|
const getSectionItems = React.useCallback((section) => {
|
|
267
268
|
const sectionItems = statusBarItems
|
|
268
269
|
.filter((item) => item.section.valueOf() === section.valueOf() &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBarComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/StatusBarComposer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCA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AC7C,CAAC,eAAe,CAAC,CAClB,CAAC;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAC/C,CAAC,eAAe,CAAC,CAClB,CAAC;IACF,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CACjC,GAAG,EAAE,CAAC,gBAAgB,EAAE,EACxB,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,MAAM,kBAAkB,GAAG,UAAU,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;IAE1E,OAAO,CACL,6BACE,SAAS,EAAE,kBAAkB,EAC7B,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,cAAc;QAEnB,oBAAC,qBAAqB,IAAC,SAAS,EAAE,aAAa;YAC7C,oBAAC,oBAAoB,IAAC,SAAS,EAAE,aAAa,IAC3C,SAAS,CACW;YACvB,oBAAC,sBAAsB,IAAC,SAAS,EAAE,eAAe;gBAC/C,WAAW;gBACX,YAAY,CACU;YACzB,oBAAC,qBAAqB,IAAC,SAAS,EAAE,cAAc;gBAC7C,UAAU;gBACV,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACvC,oBAAC,iBAAiB,IAChB,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,aAAa,GAC5B,CACH,CACqB,CACF,CACpB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { useRefs, useResizeObserver } from \"@itwin/core-react\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { eqlOverflown } from \"../layout/tool-settings/Docked\";\nimport { StatusBarLabelIndicator } from \"../statusbar/LabelIndicator\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\nimport { isProviderItem } from \"../ui-items-provider/isProviderItem\";\nimport { StatusBarOverflow } from \"./Overflow\";\nimport {\n StatusBarCenterSection,\n StatusBarLeftSection,\n StatusBarRightSection,\n StatusBarSpaceBetween,\n} from \"./StatusBar\";\nimport type {\n StatusBarActionItem,\n StatusBarItem,\n StatusBarLabelItem,\n} from \"./StatusBarItem\";\nimport {\n isStatusBarActionItem,\n isStatusBarCustomItem,\n isStatusBarLabelItem,\n StatusBarSection,\n} from \"./StatusBarItem\";\nimport { StatusBarItemsManager } from \"./StatusBarItemsManager\";\nimport { useDefaultStatusBarItems } from \"./useDefaultStatusBarItems\";\nimport { useUiItemsProviderStatusBarItems } from \"./useUiItemsProviderStatusBarItems\";\nimport { StatusBarCornerComponentContext } from \"./StatusBarCornerComponentContext\";\n\n/** Private function to generate a value that will allow the proper order to be maintained when items are placed in overflow panel */\nfunction getCombinedSectionItemPriority(item: StatusBarItem) {\n let sectionValue = 0;\n if (item.section === StatusBarSection.Center) sectionValue = 100000;\n else if (item.section === StatusBarSection.Context) sectionValue = 200000;\n else if (item.section === StatusBarSection.Right) sectionValue = 300000;\n return sectionValue + item.itemPriority;\n}\n\ninterface DockedStatusBarEntryContextArg {\n readonly isOverflown: boolean;\n readonly onResize: (w: number) => void;\n}\n\nconst DockedStatusBarEntryContext =\n React.createContext<DockedStatusBarEntryContextArg>(null!);\nDockedStatusBarEntryContext.displayName = \"nz:DockedStatusBarEntryContext\";\n\n/** @internal */\nexport function useStatusBarEntry() {\n return React.useContext(DockedStatusBarEntryContext);\n}\n\n/** Properties of [[DockedStatusBarItem]] component.\n * @internal future\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface StatusBarItemProps extends CommonProps {\n /** Tool setting content. */\n children?: React.ReactNode;\n itemPriority?: number;\n providerId?: string;\n section?: string;\n}\n\n/** Used in [[StatusBarComposer]] component to display a statusbar item.\n * @internal future\n */\nexport function DockedStatusBarItem(props: StatusBarItemProps) {\n const { onResize } = useStatusBarEntry();\n const ref = useResizeObserver<HTMLDivElement>(onResize);\n const className = classnames(\n \"uifw-statusBar-item-container\",\n props.className\n );\n return (\n <div\n data-item-id={props.itemId}\n data-item-type=\"status-bar-item\"\n data-item-location={props.section}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n className={className}\n ref={ref}\n style={props.style}\n >\n {props.children}\n </div>\n );\n}\n\ninterface DockedStatusBarEntryProps {\n children?: React.ReactNode;\n entryKey: string;\n getOnResize: (key: string) => (w: number) => void;\n}\n\n/** Wrapper for status bar entries so their size can be used to determine if the status bar container can display them or if they will need to be placed in an overflow panel. */\nfunction DockedStatusBarEntry({\n children,\n entryKey,\n getOnResize,\n}: DockedStatusBarEntryProps) {\n const onResize = React.useMemo(\n () => getOnResize(entryKey),\n [getOnResize, entryKey]\n );\n const entry = React.useMemo<DockedStatusBarEntryContextArg>(\n () => ({\n isOverflown: false,\n onResize,\n }),\n [onResize]\n );\n return (\n <DockedStatusBarEntryContext.Provider value={entry}>\n {children}\n </DockedStatusBarEntryContext.Provider>\n );\n}\n\n/** Private function to set up sync event monitoring of statusbar items */\nfunction useStatusBarItemSyncEffect(\n itemsManager: StatusBarItemsManager,\n syncIdsOfInterest: string[]\n) {\n React.useEffect(() => {\n // Note: that items with conditions have condition run when loaded into the items manager\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n if (0 === syncIdsOfInterest.length) return;\n\n if (\n syncIdsOfInterest.some((value: string): boolean =>\n args.eventIds.has(value.toLowerCase())\n )\n ) {\n // process each item that has interest\n itemsManager.refreshAffectedItems(args.eventIds);\n }\n });\n }, [itemsManager, itemsManager.items, syncIdsOfInterest]);\n}\n\nfunction StatusBarLabelItemComponent(props: StatusBarLabelItem) {\n const label = ConditionalStringValue.getValue(props.label);\n // eslint-disable-next-line deprecation/deprecation\n return <StatusBarLabelIndicator iconSpec={props.icon} label={label} />;\n}\n\nfunction StatusBarActionItemComponent(props: StatusBarActionItem) {\n const title = ConditionalStringValue.getValue(props.tooltip);\n return (\n // eslint-disable-next-line deprecation/deprecation\n <StatusBarLabelIndicator\n title={title}\n onClick={props.execute}\n // eslint-disable-next-line deprecation/deprecation\n iconSpec={props.icon}\n />\n );\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n stageItems: ReadonlyArray<StatusBarItem>,\n addonItems: ReadonlyArray<StatusBarItem>\n) {\n const items: StatusBarItem[] = [];\n if (stageItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n stageItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n if (addonItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n addonItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n return items;\n}\n\n/** local function to sort status bar items from left to right */\nconst sortItems = (items: StatusBarItem[]) => {\n const sortedItems: StatusBarItem[] = [];\n [\n StatusBarSection.Left,\n StatusBarSection.Center,\n StatusBarSection.Context,\n StatusBarSection.Right,\n ].forEach((section) => {\n items\n .filter((item) => item.section.valueOf() === section.valueOf())\n .sort((a, b) => a.itemPriority - b.itemPriority)\n .forEach((item) => sortedItems.push(item));\n });\n\n return sortedItems;\n};\n\n/** local function to ensure a width value is defined for a status bar entries. */\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\n for (const [, val] of map) {\n if (val === undefined) return undefined;\n }\n return map as Map<string, T>;\n}\n\n/** local function to sort status bar item widths */\nconst sortWidths = (\n widths: Map<string, number>,\n statusBarItems: StatusBarItem[]\n) => {\n const widthsArray = Array.from(widths.entries());\n widthsArray.sort((a, b) => {\n const aIndex = statusBarItems.findIndex((item) => item.id === a[0]);\n const bIndex = statusBarItems.findIndex((item) => item.id === b[0]);\n return aIndex - bIndex;\n });\n\n return new Map<string, number>(widthsArray);\n};\n\n/** Returns a subset of docked entry keys that exceed given width and should be placed in overflow panel. */\nfunction getItemToPlaceInOverflow(\n width: number,\n docked: ReadonlyArray<readonly [string, number]>,\n overflowWidth: number\n) {\n let settingsWidth = 0;\n\n let i = 0;\n for (; i < docked.length; i++) {\n const w = docked[i][1];\n const newSettingsWidth = settingsWidth + w;\n if (newSettingsWidth > width) {\n settingsWidth += overflowWidth;\n break;\n }\n settingsWidth = newSettingsWidth;\n }\n\n let j = i;\n for (; j > 0; j--) {\n if (settingsWidth <= width) break;\n const w = docked[j - 1][1];\n settingsWidth -= w;\n }\n\n const overflowItems = new Array<string>();\n for (i = j; i < docked.length; i++) {\n overflowItems.push(docked[i][0]);\n }\n return overflowItems;\n}\n\nfunction isItemInOverflow(\n id: string,\n overflowItemIds: ReadonlyArray<string> | undefined\n) {\n if (!overflowItemIds || 0 === overflowItemIds.length) return false;\n return !!overflowItemIds.find((value) => value === id);\n}\n\n/** Properties for the [[StatusBarComposer]] React components\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface StatusBarComposerProps extends CommonProps {\n /** Status Bar items */\n items: StatusBarItem[];\n\n /** CSS class name override for the overall Status Bar */\n mainClassName?: string;\n /** CSS class name override for the left section */\n leftClassName?: string;\n /** CSS class name override for the center section */\n centerClassName?: string;\n /** CSS class name override for the right section */\n rightClassName?: string;\n}\n\n/** Component to load components into the [[StatusBar]].\n * @public\n */\nexport function StatusBarComposer(props: StatusBarComposerProps) {\n const {\n className,\n style,\n items,\n mainClassName,\n leftClassName,\n centerClassName,\n rightClassName,\n } = props;\n const [defaultItemsManager, setDefaultItemsManager] = React.useState(\n () => new StatusBarItemsManager(items)\n );\n const containerWidth = React.useRef<number | undefined>(undefined);\n\n const isInitialMount = React.useRef(true);\n React.useEffect(() => {\n if (isInitialMount.current) isInitialMount.current = false;\n else {\n setDefaultItemsManager(new StatusBarItemsManager(items));\n }\n }, [items]);\n const defaultItems = useDefaultStatusBarItems(defaultItemsManager);\n const syncIdsOfInterest = React.useMemo(\n () => StatusBarItemsManager.getSyncIdsOfInterest(defaultItems),\n [defaultItems]\n );\n useStatusBarItemSyncEffect(defaultItemsManager, syncIdsOfInterest);\n\n const [addonItemsManager] = React.useState(() => new StatusBarItemsManager());\n const addonItems = useUiItemsProviderStatusBarItems(addonItemsManager);\n const addonSyncIdsOfInterest = React.useMemo(\n () => StatusBarItemsManager.getSyncIdsOfInterest(addonItems),\n [addonItems]\n );\n useStatusBarItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);\n\n const entryWidths = React.useRef(new Map<string, number | undefined>());\n const overflowWidth = React.useRef<number | undefined>(undefined);\n const [overflown, setOverflown] = React.useState<ReadonlyArray<string>>();\n const statusBarItems = React.useMemo(() => {\n const combinedItems = combineItems(defaultItems, addonItems);\n return sortItems(combinedItems);\n }, [defaultItems, addonItems]);\n const itemsNotInOverflow = React.useMemo(() => {\n return statusBarItems.filter(\n (item) => !isItemInOverflow(item.id, overflown)\n );\n }, [overflown, statusBarItems]);\n\n const calculateOverflow = React.useCallback(() => {\n const widths = verifiedMapEntries(entryWidths.current);\n\n if (\n containerWidth.current === undefined ||\n widths === undefined ||\n overflowWidth.current === undefined\n ) {\n setOverflown(new Array<string>());\n return;\n }\n\n // Calculate overflow.\n const newOverflown = getItemToPlaceInOverflow(\n containerWidth.current,\n [...widths.entries()],\n overflowWidth.current\n );\n if (!eqlOverflown(overflown, newOverflown)) {\n setOverflown(newOverflown);\n }\n }, [overflown]);\n\n const handleOverflowResize = React.useCallback(\n (w: number) => {\n const calculate = overflowWidth.current !== w;\n overflowWidth.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleEntryResize = React.useCallback(\n (key: string) => (w: number) => {\n const oldW = entryWidths.current.get(key);\n if (oldW === undefined || Math.abs(oldW - w) > 2) {\n entryWidths.current.set(key, w);\n if (oldW === undefined) {\n const widths = verifiedMapEntries(entryWidths.current);\n if (widths !== undefined)\n entryWidths.current = sortWidths(widths, statusBarItems);\n }\n\n calculateOverflow();\n }\n },\n [calculateOverflow, statusBarItems]\n );\n\n const getSectionName = (section: StatusBarSection) => {\n switch (section) {\n case StatusBarSection.Center:\n case StatusBarSection.Stage:\n return \"status-bar-center\";\n case StatusBarSection.Context:\n return \"status-bar-right-start\";\n case StatusBarSection.Right:\n case StatusBarSection.Selection:\n return \"status-bar-right-end\";\n case StatusBarSection.Left:\n case StatusBarSection.Message:\n return \"status-bar-left\";\n }\n };\n\n /** generate a wrapped status bar entry that will report its size. */\n const getComponent = React.useCallback(\n (\n item: StatusBarItem,\n key: string,\n itemPriority: number,\n section: StatusBarSection\n ): React.ReactNode => {\n const providerId = isProviderItem(item) ? item.providerId : undefined;\n return (\n <DockedStatusBarEntry\n key={key}\n entryKey={key}\n getOnResize={handleEntryResize}\n >\n <DockedStatusBarItem\n key={key}\n itemId={item.id}\n itemPriority={itemPriority}\n providerId={providerId}\n section={getSectionName(section)}\n >\n <StatusBarCornerComponentContext.Provider\n value={\n key === itemsNotInOverflow[0].id\n ? \"left-corner\"\n : (key ===\n itemsNotInOverflow[itemsNotInOverflow.length - 1].id &&\n overflown?.length === 0) ||\n isItemInOverflow(key, overflown)\n ? \"right-corner\"\n : undefined\n }\n >\n {isStatusBarCustomItem(item) && item.content}\n {isStatusBarActionItem(item) && (\n <StatusBarActionItemComponent {...item} />\n )}\n {isStatusBarLabelItem(item) && (\n <StatusBarLabelItemComponent {...item} />\n )}\n </StatusBarCornerComponentContext.Provider>\n </DockedStatusBarItem>\n </DockedStatusBarEntry>\n );\n },\n [handleEntryResize, itemsNotInOverflow, overflown]\n );\n\n const getSectionItems = React.useCallback(\n (section: StatusBarSection): React.ReactNode[] => {\n const sectionItems = statusBarItems\n .filter(\n (item) =>\n item.section.valueOf() === section.valueOf() &&\n !isItemInOverflow(item.id, overflown) &&\n !ConditionalBooleanValue.getValue(item.isHidden)\n )\n .sort((a, b) => a.itemPriority - b.itemPriority);\n\n return sectionItems.map((sectionItem) => (\n <React.Fragment key={sectionItem.id}>\n {getComponent(\n sectionItem,\n sectionItem.id,\n sectionItem.itemPriority,\n sectionItem.section\n )}\n </React.Fragment>\n ));\n },\n [statusBarItems, overflown, getComponent]\n );\n\n const getOverflowItems = React.useCallback((): React.ReactNode[] => {\n const itemsInOverflow = statusBarItems\n .filter(\n (item) =>\n isItemInOverflow(item.id, overflown) &&\n !ConditionalBooleanValue.getValue(item.isHidden)\n )\n .sort(\n (a, b) =>\n getCombinedSectionItemPriority(a) - getCombinedSectionItemPriority(b)\n )\n .reverse();\n\n return itemsInOverflow.map((item) => (\n <React.Fragment key={item.id}>\n {getComponent(item, item.id, item.itemPriority, item.section)}\n </React.Fragment>\n ));\n }, [statusBarItems, overflown, getComponent]);\n\n const handleContainerResize = React.useCallback(\n (w: number) => {\n if (\n undefined === containerWidth.current ||\n Math.abs(containerWidth.current - w) > 2\n ) {\n containerWidth.current = w;\n calculateOverflow();\n }\n },\n [calculateOverflow]\n );\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const resizeObserverRef = useResizeObserver(handleContainerResize);\n // allow both the containerRef and the resize observer function that takes a ref to be processed when the ref is set.\n const refs = useRefs(containerRef, resizeObserverRef);\n\n const leftItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Left),\n [getSectionItems]\n );\n const centerItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Center),\n [getSectionItems]\n );\n const rightItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Right),\n [getSectionItems]\n );\n const contextItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Context),\n [getSectionItems]\n );\n const overflowItems = React.useMemo(\n () => getOverflowItems(),\n [getOverflowItems]\n );\n\n const containerClassName = classnames(\"uifw-statusBar-docked\", className);\n\n return (\n <div\n className={containerClassName}\n ref={refs}\n style={style}\n role=\"presentation\"\n >\n <StatusBarSpaceBetween className={mainClassName}>\n <StatusBarLeftSection className={leftClassName}>\n {leftItems}\n </StatusBarLeftSection>\n <StatusBarCenterSection className={centerClassName}>\n {centerItems}\n {contextItems}\n </StatusBarCenterSection>\n <StatusBarRightSection className={rightClassName}>\n {rightItems}\n {(!overflown || overflown.length > 0) && (\n <StatusBarOverflow\n onResize={handleOverflowResize}\n overflowItems={overflowItems}\n />\n )}\n </StatusBarRightSection>\n </StatusBarSpaceBetween>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StatusBarComposer.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/StatusBarComposer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,E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T,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,cAAc;QAEnB,oBAAC,qBAAqB,IAAC,SAAS,EAAE,aAAa;YAC7C,oBAAC,oBAAoB,IAAC,SAAS,EAAE,aAAa,IAC3C,SAAS,CACW;YACvB,oBAAC,sBAAsB,IAAC,SAAS,EAAE,eAAe;gBAC/C,WAAW;gBACX,YAAY,CACU;YACzB,oBAAC,qBAAqB,IAAC,SAAS,EAAE,cAAc;gBAC7C,UAAU;gBACV,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACvC,oBAAC,iBAAiB,IAChB,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,EAAE,aAAa,GAC5B,CACH,CACqB,CACF,CACpB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module StatusBar\n */\n\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { useRefs, useResizeObserver } from \"@itwin/core-react\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { eqlOverflown } from \"../layout/tool-settings/Docked\";\nimport { StatusBarLabelIndicator } from \"../statusbar/LabelIndicator\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher\";\nimport { isProviderItem } from \"../ui-items-provider/isProviderItem\";\nimport { StatusBarOverflow } from \"./Overflow\";\nimport {\n StatusBarCenterSection,\n StatusBarLeftSection,\n StatusBarRightSection,\n StatusBarSpaceBetween,\n} from \"./StatusBar\";\nimport type {\n StatusBarActionItem,\n StatusBarItem,\n StatusBarLabelItem,\n} from \"./StatusBarItem\";\nimport {\n isStatusBarActionItem,\n isStatusBarCustomItem,\n isStatusBarLabelItem,\n StatusBarSection,\n} from \"./StatusBarItem\";\nimport { StatusBarItemsManager } from \"./StatusBarItemsManager\";\nimport { useDefaultStatusBarItems } from \"./useDefaultStatusBarItems\";\nimport { useUiItemsProviderStatusBarItems } from \"./useUiItemsProviderStatusBarItems\";\nimport { StatusBarCornerComponentContext } from \"./StatusBarCornerComponentContext\";\n\n/** Private function to generate a value that will allow the proper order to be maintained when items are placed in overflow panel */\nfunction getCombinedSectionItemPriority(item: StatusBarItem) {\n let sectionValue = 0;\n if (item.section === StatusBarSection.Center) sectionValue = 100000;\n else if (item.section === StatusBarSection.Context) sectionValue = 200000;\n else if (item.section === StatusBarSection.Right) sectionValue = 300000;\n return sectionValue + item.itemPriority;\n}\n\ninterface DockedStatusBarEntryContextArg {\n readonly isOverflown: boolean;\n readonly onResize: (w: number) => void;\n}\n\nconst DockedStatusBarEntryContext =\n React.createContext<DockedStatusBarEntryContextArg>(null!);\nDockedStatusBarEntryContext.displayName = \"nz:DockedStatusBarEntryContext\";\n\n/** @internal */\nexport function useStatusBarEntry() {\n return React.useContext(DockedStatusBarEntryContext);\n}\n\n/** Properties of [[DockedStatusBarItem]] component.\n * @internal future\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface StatusBarItemProps extends CommonProps {\n /** Tool setting content. */\n children?: React.ReactNode;\n itemPriority?: number;\n providerId?: string;\n section?: string;\n}\n\n/** Used in [[StatusBarComposer]] component to display a statusbar item.\n * @internal future\n */\nexport function DockedStatusBarItem(props: StatusBarItemProps) {\n const { onResize } = useStatusBarEntry();\n const ref = useResizeObserver<HTMLDivElement>(onResize);\n const className = classnames(\n \"uifw-statusBar-item-container\",\n props.className\n );\n return (\n <div\n data-item-id={props.itemId}\n data-item-type=\"status-bar-item\"\n data-item-location={props.section}\n data-item-priority={props.itemPriority}\n data-item-provider-id={props.providerId}\n className={className}\n ref={ref}\n style={props.style}\n >\n {props.children}\n </div>\n );\n}\n\ninterface DockedStatusBarEntryProps {\n children?: React.ReactNode;\n entryKey: string;\n getOnResize: (key: string) => (w: number) => void;\n}\n\n/** Wrapper for status bar entries so their size can be used to determine if the status bar container can display them or if they will need to be placed in an overflow panel. */\nfunction DockedStatusBarEntry({\n children,\n entryKey,\n getOnResize,\n}: DockedStatusBarEntryProps) {\n const onResize = React.useMemo(\n () => getOnResize(entryKey),\n [getOnResize, entryKey]\n );\n const entry = React.useMemo<DockedStatusBarEntryContextArg>(\n () => ({\n isOverflown: false,\n onResize,\n }),\n [onResize]\n );\n return (\n <DockedStatusBarEntryContext.Provider value={entry}>\n {children}\n </DockedStatusBarEntryContext.Provider>\n );\n}\n\n/** Private function to set up sync event monitoring of statusbar items */\nfunction useStatusBarItemSyncEffect(\n itemsManager: StatusBarItemsManager,\n syncIdsOfInterest: string[]\n) {\n React.useEffect(() => {\n // Note: that items with conditions have condition run when loaded into the items manager\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n if (0 === syncIdsOfInterest.length) return;\n\n if (\n syncIdsOfInterest.some((value: string): boolean =>\n args.eventIds.has(value.toLowerCase())\n )\n ) {\n // process each item that has interest\n itemsManager.refreshAffectedItems(args.eventIds);\n }\n });\n }, [itemsManager, itemsManager.items, syncIdsOfInterest]);\n}\n\nfunction StatusBarLabelItemComponent(props: StatusBarLabelItem) {\n const label = ConditionalStringValue.getValue(props.label);\n // eslint-disable-next-line deprecation/deprecation\n return <StatusBarLabelIndicator iconSpec={props.icon} label={label} />;\n}\n\nfunction StatusBarActionItemComponent(props: StatusBarActionItem) {\n const title = ConditionalStringValue.getValue(props.tooltip);\n return (\n // eslint-disable-next-line deprecation/deprecation\n <StatusBarLabelIndicator\n title={title}\n onClick={props.execute}\n // eslint-disable-next-line deprecation/deprecation\n iconSpec={props.icon}\n />\n );\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n stageItems: ReadonlyArray<StatusBarItem>,\n addonItems: ReadonlyArray<StatusBarItem>\n) {\n const items: StatusBarItem[] = [];\n if (stageItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n stageItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n if (addonItems.length) {\n // Walk through each and ensure no duplicate ids are added.\n addonItems.forEach((srcItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n items.push(srcItem);\n }\n });\n }\n return items;\n}\n\n/** local function to sort status bar items from left to right */\nconst sortItems = (items: StatusBarItem[]) => {\n const sortedItems: StatusBarItem[] = [];\n [\n StatusBarSection.Left,\n StatusBarSection.Center,\n StatusBarSection.Context,\n StatusBarSection.Right,\n ].forEach((section) => {\n items\n .filter((item) => item.section.valueOf() === section.valueOf())\n .sort((a, b) => a.itemPriority - b.itemPriority)\n .forEach((item) => sortedItems.push(item));\n });\n\n return sortedItems;\n};\n\n/** local function to ensure a width value is defined for a status bar entries. */\nfunction verifiedMapEntries<T>(map: Map<string, T | undefined>) {\n for (const [, val] of map) {\n if (val === undefined) return undefined;\n }\n return map as Map<string, T>;\n}\n\n/** local function to sort status bar item widths */\nconst sortWidths = (\n widths: Map<string, number>,\n statusBarItems: StatusBarItem[]\n) => {\n const widthsArray = Array.from(widths.entries());\n widthsArray.sort((a, b) => {\n const aIndex = statusBarItems.findIndex((item) => item.id === a[0]);\n const bIndex = statusBarItems.findIndex((item) => item.id === b[0]);\n return aIndex - bIndex;\n });\n\n return new Map<string, number>(widthsArray);\n};\n\n/** Returns a subset of docked entry keys that exceed given width and should be placed in overflow panel. */\nfunction getItemToPlaceInOverflow(\n width: number,\n docked: ReadonlyArray<readonly [string, number]>,\n overflowWidth: number\n) {\n let settingsWidth = 0;\n\n let i = 0;\n for (; i < docked.length; i++) {\n const w = docked[i][1];\n const newSettingsWidth = settingsWidth + w;\n if (newSettingsWidth > width) {\n settingsWidth += overflowWidth;\n break;\n }\n settingsWidth = newSettingsWidth;\n }\n\n let j = i;\n for (; j > 0; j--) {\n if (settingsWidth <= width) break;\n const w = docked[j - 1][1];\n settingsWidth -= w;\n }\n\n const overflowItems = new Array<string>();\n for (i = j; i < docked.length; i++) {\n overflowItems.push(docked[i][0]);\n }\n return overflowItems;\n}\n\nfunction isItemInOverflow(\n id: string,\n overflowItemIds: ReadonlyArray<string> | undefined\n) {\n if (!overflowItemIds || 0 === overflowItemIds.length) return false;\n return !!overflowItemIds.find((value) => value === id);\n}\n\n/** Properties for the [[StatusBarComposer]] React components\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface StatusBarComposerProps extends CommonProps {\n /** Status Bar items */\n items: StatusBarItem[];\n\n /** CSS class name override for the overall Status Bar */\n mainClassName?: string;\n /** CSS class name override for the left section */\n leftClassName?: string;\n /** CSS class name override for the center section */\n centerClassName?: string;\n /** CSS class name override for the right section */\n rightClassName?: string;\n}\n\n/** Component to load components into the [[StatusBar]].\n * @public\n */\nexport function StatusBarComposer(props: StatusBarComposerProps) {\n const {\n className,\n style,\n items,\n mainClassName,\n leftClassName,\n centerClassName,\n rightClassName,\n } = props;\n const [defaultItemsManager, setDefaultItemsManager] = React.useState(\n () => new StatusBarItemsManager(items)\n );\n const containerWidth = React.useRef<number | undefined>(undefined);\n\n const isInitialMount = React.useRef(true);\n React.useEffect(() => {\n if (isInitialMount.current) isInitialMount.current = false;\n else {\n setDefaultItemsManager(new StatusBarItemsManager(items));\n }\n }, [items]);\n const defaultItems = useDefaultStatusBarItems(defaultItemsManager);\n const syncIdsOfInterest = React.useMemo(\n () => StatusBarItemsManager.getSyncIdsOfInterest(defaultItems),\n [defaultItems]\n );\n useStatusBarItemSyncEffect(defaultItemsManager, syncIdsOfInterest);\n\n const [addonItemsManager] = React.useState(() => new StatusBarItemsManager());\n const addonItems = useUiItemsProviderStatusBarItems(addonItemsManager);\n const addonSyncIdsOfInterest = React.useMemo(\n () => StatusBarItemsManager.getSyncIdsOfInterest(addonItems),\n [addonItems]\n );\n useStatusBarItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);\n\n const entryWidths = React.useRef(new Map<string, number | undefined>());\n const overflowWidth = React.useRef<number | undefined>(undefined);\n const [overflown, setOverflown] = React.useState<ReadonlyArray<string>>();\n const statusBarItems = React.useMemo(() => {\n const combinedItems = combineItems(defaultItems, addonItems);\n return sortItems(combinedItems);\n }, [defaultItems, addonItems]);\n const notOverflown = React.useMemo(() => {\n return statusBarItems\n .filter((item) => !isItemInOverflow(item.id, overflown))\n .map((item) => item.id);\n }, [overflown, statusBarItems]);\n\n const calculateOverflow = React.useCallback(() => {\n const widths = verifiedMapEntries(entryWidths.current);\n\n if (\n containerWidth.current === undefined ||\n widths === undefined ||\n overflowWidth.current === undefined\n ) {\n setOverflown(new Array<string>());\n return;\n }\n\n // Calculate overflow.\n const newOverflown = getItemToPlaceInOverflow(\n containerWidth.current,\n [...widths.entries()],\n overflowWidth.current\n );\n if (!eqlOverflown(overflown, newOverflown)) {\n setOverflown(newOverflown);\n }\n }, [overflown]);\n\n const handleOverflowResize = React.useCallback(\n (w: number) => {\n const calculate = overflowWidth.current !== w;\n overflowWidth.current = w;\n calculate && calculateOverflow();\n },\n [calculateOverflow]\n );\n\n const handleEntryResize = React.useCallback(\n (key: string) => (w: number) => {\n const oldW = entryWidths.current.get(key);\n if (oldW === undefined || Math.abs(oldW - w) > 2) {\n entryWidths.current.set(key, w);\n if (oldW === undefined) {\n const widths = verifiedMapEntries(entryWidths.current);\n if (widths !== undefined)\n entryWidths.current = sortWidths(widths, statusBarItems);\n }\n\n calculateOverflow();\n }\n },\n [calculateOverflow, statusBarItems]\n );\n\n const getSectionName = (section: StatusBarSection) => {\n switch (section) {\n case StatusBarSection.Center:\n case StatusBarSection.Stage:\n return \"status-bar-center\";\n case StatusBarSection.Context:\n return \"status-bar-right-start\";\n case StatusBarSection.Right:\n case StatusBarSection.Selection:\n return \"status-bar-right-end\";\n case StatusBarSection.Left:\n case StatusBarSection.Message:\n return \"status-bar-left\";\n }\n };\n\n /** generate a wrapped status bar entry that will report its size. */\n const getComponent = React.useCallback(\n (\n item: StatusBarItem,\n key: string,\n itemPriority: number,\n section: StatusBarSection\n ): React.ReactNode => {\n const providerId = isProviderItem(item) ? item.providerId : undefined;\n return (\n <DockedStatusBarEntry\n key={key}\n entryKey={key}\n getOnResize={handleEntryResize}\n >\n <DockedStatusBarItem\n key={key}\n itemId={item.id}\n itemPriority={itemPriority}\n providerId={providerId}\n section={getSectionName(section)}\n >\n <StatusBarCornerComponentContext.Provider\n value={\n key === notOverflown[0]\n ? \"left-corner\"\n : (key === notOverflown[notOverflown.length - 1] &&\n overflown?.length === 0) ||\n isItemInOverflow(key, overflown)\n ? \"right-corner\"\n : undefined\n }\n >\n {isStatusBarCustomItem(item) && item.content}\n {isStatusBarActionItem(item) && (\n <StatusBarActionItemComponent {...item} />\n )}\n {isStatusBarLabelItem(item) && (\n <StatusBarLabelItemComponent {...item} />\n )}\n </StatusBarCornerComponentContext.Provider>\n </DockedStatusBarItem>\n </DockedStatusBarEntry>\n );\n },\n [handleEntryResize, notOverflown, overflown]\n );\n\n const getSectionItems = React.useCallback(\n (section: StatusBarSection): React.ReactNode[] => {\n const sectionItems = statusBarItems\n .filter(\n (item) =>\n item.section.valueOf() === section.valueOf() &&\n !isItemInOverflow(item.id, overflown) &&\n !ConditionalBooleanValue.getValue(item.isHidden)\n )\n .sort((a, b) => a.itemPriority - b.itemPriority);\n\n return sectionItems.map((sectionItem) => (\n <React.Fragment key={sectionItem.id}>\n {getComponent(\n sectionItem,\n sectionItem.id,\n sectionItem.itemPriority,\n sectionItem.section\n )}\n </React.Fragment>\n ));\n },\n [statusBarItems, overflown, getComponent]\n );\n\n const getOverflowItems = React.useCallback((): React.ReactNode[] => {\n const itemsInOverflow = statusBarItems\n .filter(\n (item) =>\n isItemInOverflow(item.id, overflown) &&\n !ConditionalBooleanValue.getValue(item.isHidden)\n )\n .sort(\n (a, b) =>\n getCombinedSectionItemPriority(a) - getCombinedSectionItemPriority(b)\n )\n .reverse();\n\n return itemsInOverflow.map((item) => (\n <React.Fragment key={item.id}>\n {getComponent(item, item.id, item.itemPriority, item.section)}\n </React.Fragment>\n ));\n }, [statusBarItems, overflown, getComponent]);\n\n const handleContainerResize = React.useCallback(\n (w: number) => {\n if (\n undefined === containerWidth.current ||\n Math.abs(containerWidth.current - w) > 2\n ) {\n containerWidth.current = w;\n calculateOverflow();\n }\n },\n [calculateOverflow]\n );\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const resizeObserverRef = useResizeObserver(handleContainerResize);\n // allow both the containerRef and the resize observer function that takes a ref to be processed when the ref is set.\n const refs = useRefs(containerRef, resizeObserverRef);\n\n const leftItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Left),\n [getSectionItems]\n );\n const centerItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Center),\n [getSectionItems]\n );\n const rightItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Right),\n [getSectionItems]\n );\n const contextItems = React.useMemo(\n () => getSectionItems(StatusBarSection.Context),\n [getSectionItems]\n );\n const overflowItems = React.useMemo(\n () => getOverflowItems(),\n [getOverflowItems]\n );\n\n const containerClassName = classnames(\"uifw-statusBar-docked\", className);\n\n return (\n <div\n className={containerClassName}\n ref={refs}\n style={style}\n role=\"presentation\"\n >\n <StatusBarSpaceBetween className={mainClassName}>\n <StatusBarLeftSection className={leftClassName}>\n {leftItems}\n </StatusBarLeftSection>\n <StatusBarCenterSection className={centerClassName}>\n {centerItems}\n {contextItems}\n </StatusBarCenterSection>\n <StatusBarRightSection className={rightClassName}>\n {rightItems}\n {(!overflown || overflown.length > 0) && (\n <StatusBarOverflow\n onResize={handleOverflowResize}\n overflowItems={overflowItems}\n />\n )}\n </StatusBarRightSection>\n </StatusBarSpaceBetween>\n </div>\n );\n}\n"]}
|
|
@@ -8,4 +8,6 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export const StatusBarCornerComponentContext = React.createContext(undefined);
|
|
11
|
+
StatusBarCornerComponentContext.displayName =
|
|
12
|
+
"uifw:StatusBarCornerComponentContext";
|
|
11
13
|
//# sourceMappingURL=StatusBarCornerComponentContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBarCornerComponentContext.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/StatusBarCornerComponentContext.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC,aAAa,CAEhE,SAAS,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\n\n/** @internal */\nexport const StatusBarCornerComponentContext = React.createContext<\n \"right-corner\" | \"left-corner\" | undefined\n>(undefined);\n"]}
|
|
1
|
+
{"version":3,"file":"StatusBarCornerComponentContext.js","sourceRoot":"","sources":["../../../../src/appui-react/statusbar/StatusBarCornerComponentContext.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC,aAAa,CAEhE,SAAS,CAAC,CAAC;AACb,+BAA+B,CAAC,WAAW;IACzC,sCAAsC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\n\n/** @internal */\nexport const StatusBarCornerComponentContext = React.createContext<\n \"right-corner\" | \"left-corner\" | undefined\n>(undefined);\nStatusBarCornerComponentContext.displayName =\n \"uifw:StatusBarCornerComponentContext\";\n"]}
|
|
@@ -61,7 +61,7 @@ export interface CommonToolbarItem {
|
|
|
61
61
|
*/
|
|
62
62
|
export interface ToolbarActionItem extends CommonToolbarItem {
|
|
63
63
|
/** Name of icon WebFont entry or if specifying an imported SVG symbol use "webSvg:" prefix to imported symbol Id.
|
|
64
|
-
* @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.
|
|
64
|
+
* @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead and specify `undefined` for this property. This will be made optional in 5.0.0.
|
|
65
65
|
*/
|
|
66
66
|
readonly icon: IconSpec;
|
|
67
67
|
/** label, shown as tool tip on a button or an item label in a group. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AASH;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAiGD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAiB;IAEjB,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport type {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\n\n/** Used to specify the usage of the toolbar which determine the toolbar position.\n * @public\n */\nexport enum ToolbarUsage {\n /** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */\n ContentManipulation = 0,\n /** Manipulate view/camera - in AppUI this is in top right of content area. */\n ViewNavigation = 1,\n}\n\n/** Used to specify the orientation of the toolbar.\n * @public\n */\nexport enum ToolbarOrientation {\n /** Horizontal toolbar. */\n Horizontal = 0,\n /** Vertical toolbar. */\n Vertical = 1,\n}\n\n/** Describes the data needed to insert a UI items into an existing set of UI items.\n * @public\n */\nexport interface CommonToolbarItem {\n /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\n readonly id: string;\n /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\n /** Optional description */\n readonly description?: string | ConditionalStringValue;\n /** Defines if the item is active (shown with an active stripe/bar). */\n readonly isActive?: boolean;\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\n readonly isHidden?: boolean | ConditionalBooleanValue;\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\n */\n readonly groupPriority?: number;\n /** Priority within a toolbar or group. */\n readonly itemPriority: number;\n /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\n}\n\n/** Describes the data needed to insert an action button into a toolbar.\n * @public\n */\nexport interface ToolbarActionItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on a button or an item label in a group. */\n readonly label: string | ConditionalStringValue;\n /** function to run when the button is pressed. */\n readonly execute: () => void;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a group button into a toolbar.\n * @public\n */\nexport interface ToolbarGroupItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label: string | ConditionalStringValue;\n /** label shown as the title in at top of group panel. */\n readonly panelLabel?: string | ConditionalStringValue;\n /** children of the group */\n readonly items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a custom button into a toolbar.\n * @public\n */\nexport interface ToolbarCustomItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon?: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label?: string | ConditionalStringValue;\n /** defines the content to display in popup panel */\n readonly panelContent?: React.ReactNode;\n}\n\n/** Any Button Type that can be inserted into a toolbar.\n * @public\n */\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarGroupItem\n | ToolbarCustomItem;\n\n/** ToolbarActionItem type guard.\n * @public\n */\nexport function isToolbarActionItem(\n item: ToolbarItem\n): item is ToolbarActionItem {\n return \"execute\" in item;\n}\n\n/** ToolbarGroupItem type guard.\n * @public\n */\nexport function isToolbarGroupItem(\n item: ToolbarItem\n): item is ToolbarGroupItem {\n return \"items\" in item;\n}\n\n/** ToolbarCustomItem type guard.\n * @public\n */\nexport function isToolbarCustomItem(\n item: ToolbarItem\n): item is ToolbarCustomItem {\n return !isToolbarActionItem(item) && !isToolbarGroupItem(item);\n}\n\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolbarItem.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarItem.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AASH;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yGAAyG;IACzG,6EAAuB,CAAA;IACvB,8EAA8E;IAC9E,mEAAkB,CAAA;AACpB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,0BAA0B;IAC1B,uEAAc,CAAA;IACd,wBAAwB;IACxB,mEAAY,CAAA;AACd,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAiGD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAiB;IAEjB,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAiB;IAEjB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport type {\n ConditionalBooleanValue,\n ConditionalStringValue,\n} from \"@itwin/appui-abstract\";\nimport type { BadgeKind, BadgeType, IconSpec } from \"@itwin/core-react\";\nimport { UiItemsProvider } from \"../ui-items-provider/UiItemsProvider\";\n\n/** Used to specify the usage of the toolbar which determine the toolbar position.\n * @public\n */\nexport enum ToolbarUsage {\n /** Contains tools to Create Update and Delete content - in AppUI this is in top left of content area. */\n ContentManipulation = 0,\n /** Manipulate view/camera - in AppUI this is in top right of content area. */\n ViewNavigation = 1,\n}\n\n/** Used to specify the orientation of the toolbar.\n * @public\n */\nexport enum ToolbarOrientation {\n /** Horizontal toolbar. */\n Horizontal = 0,\n /** Vertical toolbar. */\n Vertical = 1,\n}\n\n/** Describes the data needed to insert a UI items into an existing set of UI items.\n * @public\n */\nexport interface CommonToolbarItem {\n /** Require uniqueId for the item. To ensure uniqueness it is suggested that a namespace prefix of the extension name be used. */\n readonly id: string;\n /** Icon of a toolbar item. */\n readonly iconNode?: React.ReactNode;\n /** Describes badge. Renders no badge if not specified.\n * @deprecated in 4.16.0. Use `badgeKind` property instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly badge?: BadgeType;\n /** Specifies the kind of badge, if any, to be rendered. */\n readonly badgeKind?: BadgeKind;\n /** Optional description */\n readonly description?: string | ConditionalStringValue;\n /** Defines if the item is active (shown with an active stripe/bar). */\n readonly isActive?: boolean;\n /** Describes if the item is visible or hidden. The default is for the item to be visible. */\n readonly isHidden?: boolean | ConditionalBooleanValue;\n /** Describes if the item is enabled or disabled. The default is for the item to be enabled. */\n readonly isDisabled?: boolean | ConditionalBooleanValue;\n /** Specifies the item's grouping value. Items are sorted by group and then item priority. When\n * group priority changes a separator is inserted. It is recommended using values 10 through 100, incrementing by 10. This\n * allows extensions enough gaps to insert their own groups. If the value is not specified a groupPriority of 0 is used.\n */\n readonly groupPriority?: number;\n /** Priority within a toolbar or group. */\n readonly itemPriority: number;\n /** Describes layout specific configuration of a toolbar item.\n * @note Only used by {@link UiItemsProvider.getToolbarItems}.\n */\n readonly layouts?: ToolbarItemLayouts;\n}\n\n/** Describes the data needed to insert an action button into a toolbar.\n * @public\n */\nexport interface ToolbarActionItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead and specify `undefined` for this property. This will be made optional in 5.0.0.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on a button or an item label in a group. */\n readonly label: string | ConditionalStringValue;\n /** function to run when the button is pressed. */\n readonly execute: () => void;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a group button into a toolbar.\n * @public\n */\nexport interface ToolbarGroupItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label: string | ConditionalStringValue;\n /** label shown as the title in at top of group panel. */\n readonly panelLabel?: string | ConditionalStringValue;\n /** children of the group */\n readonly items: ReadonlyArray<ToolbarActionItem | ToolbarGroupItem>;\n /** Optional parent tool group to add the tool to. */\n readonly parentGroupItemId?: string;\n}\n\n/** Describes the data needed to insert a custom button into a toolbar.\n * @public\n */\nexport interface ToolbarCustomItem extends CommonToolbarItem {\n /** Name of icon WebFont entry or if specifying an imported SVG symbol use \"webSvg:\" prefix to imported symbol Id.\n * @deprecated in 4.16.0. Use {@link CommonToolbarItem.iconNode} instead.\n */\n // eslint-disable-next-line deprecation/deprecation\n readonly icon?: IconSpec;\n /** label, shown as tool tip on group button or a group button label in a group panel. */\n readonly label?: string | ConditionalStringValue;\n /** defines the content to display in popup panel */\n readonly panelContent?: React.ReactNode;\n}\n\n/** Any Button Type that can be inserted into a toolbar.\n * @public\n */\nexport type ToolbarItem =\n | ToolbarActionItem\n | ToolbarGroupItem\n | ToolbarCustomItem;\n\n/** ToolbarActionItem type guard.\n * @public\n */\nexport function isToolbarActionItem(\n item: ToolbarItem\n): item is ToolbarActionItem {\n return \"execute\" in item;\n}\n\n/** ToolbarGroupItem type guard.\n * @public\n */\nexport function isToolbarGroupItem(\n item: ToolbarItem\n): item is ToolbarGroupItem {\n return \"items\" in item;\n}\n\n/** ToolbarCustomItem type guard.\n * @public\n */\nexport function isToolbarCustomItem(\n item: ToolbarItem\n): item is ToolbarCustomItem {\n return !isToolbarActionItem(item) && !isToolbarGroupItem(item);\n}\n\n/** Describes toolbar item configuration specific for each layout.\n * @public\n */\nexport interface ToolbarItemLayouts {\n /** Toolbar item configuration in a standard layout. */\n readonly standard?: StandardLayoutToolbarItem;\n}\n\n/** Describes toolbar item configuration specific to a standard layout.\n * @public\n */\nexport interface StandardLayoutToolbarItem {\n /** Describes toolbar usage. */\n readonly usage: ToolbarUsage;\n /** Describes toolbar orientation. */\n readonly orientation: ToolbarOrientation;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAcpD;;;GAGG;AACH,qBAAa,SAAS;IACpB,WAAkB,yBAAyB,gBAW1C;IAED,WAAkB,cAAc,gBAa/B;IAED,WAAkB,iBAAiB,gBAYlC;IAED,WAAkB,eAAe,gBAYhC;IAED,WAAkB,cAAc,gBAY/B;IAED,WAAkB,iBAAiB,gBAoBlC;IAED,WAAkB,eAAe,gBAoBhC;IAED,WAAkB,oBAAoB,gBAQrC;IAED,WAAkB,mBAAmB,gBAQpC;IAED,WAAkB,uBAAuB,gBA2CxC;IAED,WAAkB,cAAc,gBAY/B;IAID,WAAkB,eAAe,gBAqBhC;IAED,WAAkB,eAAe,gBAqBhC;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,8BAA8B,gBAc/C;IAGD,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,4BAA4B,gBAc7C;IAED,WAAkB,gBAAgB,iBA0BjC;IAED,WAAkB,yBAAyB,iBAuC1C;IAGD,WAAkB,0BAA0B,gBAU3C;IAGD,WAAkB,0BAA0B,gBAU3C;IAED,WAAkB,gBAAgB,iBAWjC;IAED,WAAkB,qBAAqB,mBAgBtC;IAED,WAAkB,qCAAqC,gBAUtD;CACF"}
|
|
@@ -22,6 +22,7 @@ import svgSectionTool from "@bentley/icons-generic/icons/section-tool.svg";
|
|
|
22
22
|
import svgSelectionClear from "@bentley/icons-generic/icons/selection-clear.svg";
|
|
23
23
|
import { SvgMeasure, SvgProcess } from "@itwin/itwinui-icons-react";
|
|
24
24
|
import { ConditionalIconItem } from "@itwin/core-react";
|
|
25
|
+
import { getActiveViewport } from "../utils/getActiveViewport";
|
|
25
26
|
/* eslint-disable deprecation/deprecation */
|
|
26
27
|
/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.
|
|
27
28
|
* @public
|
|
@@ -78,8 +79,8 @@ export class CoreTools {
|
|
|
78
79
|
return new ToolItemDef({
|
|
79
80
|
toolId: RotateViewTool.toolId,
|
|
80
81
|
iconSpec: new ConditionalStringValue(() => {
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
82
|
+
const viewport = getActiveViewport();
|
|
83
|
+
if (viewport?.view.is2d())
|
|
83
84
|
return svgRotateLeft;
|
|
84
85
|
return svgGyroscope;
|
|
85
86
|
}, [
|
|
@@ -99,8 +100,8 @@ export class CoreTools {
|
|
|
99
100
|
label: WalkViewTool.flyover,
|
|
100
101
|
description: WalkViewTool.description,
|
|
101
102
|
isHidden: new ConditionalBooleanValue(() => {
|
|
102
|
-
const
|
|
103
|
-
return !!
|
|
103
|
+
const viewport = getActiveViewport();
|
|
104
|
+
return !!viewport?.view.is2d();
|
|
104
105
|
}, [
|
|
105
106
|
SyncUiEventId.ActiveContentChanged,
|
|
106
107
|
SyncUiEventId.ActiveViewportChanged,
|
|
@@ -131,9 +132,8 @@ export class CoreTools {
|
|
|
131
132
|
return new ToolItemDef({
|
|
132
133
|
toolId: ViewToggleCameraTool.toolId,
|
|
133
134
|
iconSpec: new ConditionalIconItem(() => {
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
135
|
+
const viewport = getActiveViewport();
|
|
136
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
137
137
|
return React.createElement(SvgCameraAnimation, null);
|
|
138
138
|
}
|
|
139
139
|
return React.createElement(SvgCameraAnimationDisabled, null);
|
|
@@ -143,9 +143,8 @@ export class CoreTools {
|
|
|
143
143
|
SyncUiEventId.ViewStateChanged,
|
|
144
144
|
]),
|
|
145
145
|
label: new ConditionalStringValue(() => {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
activeContentControl?.viewport?.isCameraOn) {
|
|
146
|
+
const viewport = getActiveViewport();
|
|
147
|
+
if (viewport?.view.is3d() && viewport?.isCameraOn) {
|
|
149
148
|
return UiFramework.translate("tools.View.ToggleCamera.turnOffFlyover");
|
|
150
149
|
}
|
|
151
150
|
return UiFramework.translate("tools.View.ToggleCamera.turnOnFlyover");
|
|
@@ -156,9 +155,8 @@ export class CoreTools {
|
|
|
156
155
|
]),
|
|
157
156
|
description: ViewToggleCameraTool.description,
|
|
158
157
|
isHidden: new ConditionalBooleanValue(() => {
|
|
159
|
-
const
|
|
160
|
-
return !(
|
|
161
|
-
activeContentControl?.viewport?.view.supportsCamera());
|
|
158
|
+
const viewport = getActiveViewport();
|
|
159
|
+
return !(viewport?.view.is3d() && viewport?.view.supportsCamera());
|
|
162
160
|
}, [
|
|
163
161
|
SyncUiEventId.ActiveContentChanged,
|
|
164
162
|
SyncUiEventId.ActiveViewportChanged,
|
|
@@ -182,10 +180,10 @@ export class CoreTools {
|
|
|
182
180
|
return new ToolItemDef({
|
|
183
181
|
toolId: ViewUndoTool.toolId,
|
|
184
182
|
isDisabled: new ConditionalBooleanValue(() => {
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
return
|
|
188
|
-
return
|
|
183
|
+
const viewport = getActiveViewport();
|
|
184
|
+
if (!viewport)
|
|
185
|
+
return false;
|
|
186
|
+
return !viewport.isUndoPossible;
|
|
189
187
|
}, [
|
|
190
188
|
SyncUiEventId.ActiveContentChanged,
|
|
191
189
|
SyncUiEventId.ActiveViewportChanged,
|
|
@@ -205,10 +203,10 @@ export class CoreTools {
|
|
|
205
203
|
description: ViewRedoTool.description,
|
|
206
204
|
execute: async () => IModelApp.tools.run(ViewRedoTool.toolId, IModelApp.viewManager.selectedView),
|
|
207
205
|
isDisabled: new ConditionalBooleanValue(() => {
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
return
|
|
211
|
-
return
|
|
206
|
+
const viewport = getActiveViewport();
|
|
207
|
+
if (!viewport)
|
|
208
|
+
return false;
|
|
209
|
+
return !viewport.isRedoPossible;
|
|
212
210
|
}, [
|
|
213
211
|
SyncUiEventId.ActiveContentChanged,
|
|
214
212
|
SyncUiEventId.ActiveViewportChanged,
|
|
@@ -285,8 +283,8 @@ export class CoreTools {
|
|
|
285
283
|
labelKey: "UiFramework:tools.sectionTools",
|
|
286
284
|
iconSpec: svgSectionTool,
|
|
287
285
|
isHidden: new ConditionalBooleanValue(() => {
|
|
288
|
-
const
|
|
289
|
-
return !!
|
|
286
|
+
const viewport = getActiveViewport();
|
|
287
|
+
return !!viewport?.view.is2d();
|
|
290
288
|
}, [
|
|
291
289
|
SyncUiEventId.ActiveContentChanged,
|
|
292
290
|
SyncUiEventId.ActiveViewportChanged,
|
|
@@ -312,8 +310,8 @@ export class CoreTools {
|
|
|
312
310
|
panelLabelKey: "UiFramework:tools.sectionPanelLabel",
|
|
313
311
|
iconSpec: svgSectionTool,
|
|
314
312
|
isHidden: new ConditionalBooleanValue(() => {
|
|
315
|
-
const
|
|
316
|
-
return !!
|
|
313
|
+
const viewport = getActiveViewport();
|
|
314
|
+
return !!viewport?.view.is2d();
|
|
317
315
|
}, [
|
|
318
316
|
SyncUiEventId.ActiveContentChanged,
|
|
319
317
|
SyncUiEventId.ActiveViewportChanged,
|