@itwin/appui-react 4.4.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/appui-react/UiFramework.js +4 -7
  3. package/lib/cjs/appui-react/UiFramework.js.map +1 -1
  4. package/lib/cjs/appui-react/backstage/BackstageComposerItem.js +1 -2
  5. package/lib/cjs/appui-react/backstage/BackstageComposerItem.js.map +1 -1
  6. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js +1 -1
  7. package/lib/cjs/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  8. package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
  9. package/lib/cjs/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
  10. package/lib/cjs/appui-react/configurableui/TimeTracker.js +1 -2
  11. package/lib/cjs/appui-react/configurableui/TimeTracker.js.map +1 -1
  12. package/lib/cjs/appui-react/content/ContentLayout.js +9 -12
  13. package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
  14. package/lib/cjs/appui-react/content/DefaultViewOverlay.js +3 -4
  15. package/lib/cjs/appui-react/content/DefaultViewOverlay.js.map +1 -1
  16. package/lib/cjs/appui-react/content/FloatingViewportContent.js +1 -2
  17. package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -1
  18. package/lib/cjs/appui-react/content/IModelViewport.js +3 -6
  19. package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
  20. package/lib/cjs/appui-react/content/InternalContentLayoutManager.js +1 -2
  21. package/lib/cjs/appui-react/content/InternalContentLayoutManager.js.map +1 -1
  22. package/lib/cjs/appui-react/content/InternalContentViewManager.js +1 -1
  23. package/lib/cjs/appui-react/content/InternalContentViewManager.js.map +1 -1
  24. package/lib/cjs/appui-react/content/split-pane/SplitPane.js +10 -12
  25. package/lib/cjs/appui-react/content/split-pane/SplitPane.js.map +1 -1
  26. package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js +2 -3
  27. package/lib/cjs/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  28. package/lib/cjs/appui-react/dialog/ContentDialog.js +3 -6
  29. package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -1
  30. package/lib/cjs/appui-react/dialog/DialogManagerBase.js +2 -3
  31. package/lib/cjs/appui-react/dialog/DialogManagerBase.js.map +1 -1
  32. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  33. package/lib/cjs/appui-react/frontstage/FrontstageDef.js +17 -7
  34. package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
  35. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts +2 -0
  36. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
  37. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js +2 -0
  38. package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
  39. package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js +2 -3
  40. package/lib/cjs/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
  41. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
  42. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  43. package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
  44. package/lib/cjs/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
  45. package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
  46. package/lib/cjs/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
  47. package/lib/cjs/appui-react/hooks/useSolarDataProvider.js +8 -13
  48. package/lib/cjs/appui-react/hooks/useSolarDataProvider.js.map +1 -1
  49. package/lib/cjs/appui-react/messages/ActivityMessage.js +5 -7
  50. package/lib/cjs/appui-react/messages/ActivityMessage.js.map +1 -1
  51. package/lib/cjs/appui-react/pickers/ViewSelector.js +5 -6
  52. package/lib/cjs/appui-react/pickers/ViewSelector.js.map +1 -1
  53. package/lib/cjs/appui-react/popup/KeyinPalettePanel.js +1 -2
  54. package/lib/cjs/appui-react/popup/KeyinPalettePanel.js.map +1 -1
  55. package/lib/cjs/appui-react/popup/PopupManager.js +1 -2
  56. package/lib/cjs/appui-react/popup/PopupManager.js.map +1 -1
  57. package/lib/cjs/appui-react/selection/SelectionContextItemDef.js +2 -2
  58. package/lib/cjs/appui-react/selection/SelectionContextItemDef.js.map +1 -1
  59. package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
  60. package/lib/cjs/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
  61. package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +5 -7
  62. package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
  63. package/lib/cjs/appui-react/statusbar/Indicator.js +1 -2
  64. package/lib/cjs/appui-react/statusbar/Indicator.js.map +1 -1
  65. package/lib/cjs/appui-react/statusbar/StatusBar.js +3 -5
  66. package/lib/cjs/appui-react/statusbar/StatusBar.js.map +1 -1
  67. package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
  68. package/lib/cjs/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  69. package/lib/cjs/appui-react/toolbar/Toolbar.d.ts +1 -1
  70. package/lib/cjs/appui-react/toolbar/Toolbar.d.ts.map +1 -1
  71. package/lib/cjs/appui-react/toolbar/Toolbar.js.map +1 -1
  72. package/lib/cjs/appui-react/toolbar/ToolbarHelper.d.ts +6 -3
  73. package/lib/cjs/appui-react/toolbar/ToolbarHelper.d.ts.map +1 -1
  74. package/lib/cjs/appui-react/toolbar/ToolbarHelper.js +53 -80
  75. package/lib/cjs/appui-react/toolbar/ToolbarHelper.js.map +1 -1
  76. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
  77. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  78. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  79. package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js +3 -4
  80. package/lib/cjs/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
  81. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js +10 -17
  82. package/lib/cjs/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  83. package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
  84. package/lib/cjs/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
  85. package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
  86. package/lib/cjs/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
  87. package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
  88. package/lib/cjs/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
  89. package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
  90. package/lib/cjs/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
  91. package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js +8 -14
  92. package/lib/cjs/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
  93. package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
  94. package/lib/cjs/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
  95. package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js +1 -1
  96. package/lib/cjs/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
  97. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +3 -3
  98. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  99. package/lib/cjs/appui-react/widget-panels/Content.js +8 -9
  100. package/lib/cjs/appui-react/widget-panels/Content.js.map +1 -1
  101. package/lib/cjs/appui-react/widget-panels/Frontstage.js +43 -45
  102. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  103. package/lib/cjs/appui-react/widget-panels/StatusBar.js +1 -1
  104. package/lib/cjs/appui-react/widget-panels/StatusBar.js.map +1 -1
  105. package/lib/cjs/appui-react/widget-panels/Tab.js +1 -1
  106. package/lib/cjs/appui-react/widget-panels/Tab.js.map +1 -1
  107. package/lib/cjs/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
  108. package/lib/cjs/appui-react/widget-panels/ToolSettings.js +21 -23
  109. package/lib/cjs/appui-react/widget-panels/ToolSettings.js.map +1 -1
  110. package/lib/cjs/appui-react/widget-panels/Toolbars.js +2 -3
  111. package/lib/cjs/appui-react/widget-panels/Toolbars.js.map +1 -1
  112. package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js +2 -2
  113. package/lib/cjs/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
  114. package/lib/cjs/appui-react/widgets/WidgetDef.js +1 -1
  115. package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
  116. package/lib/cjs/appui-react/widgets/WidgetHost.js +2 -3
  117. package/lib/cjs/appui-react/widgets/WidgetHost.js.map +1 -1
  118. package/lib/esm/appui-react/UiFramework.js +4 -7
  119. package/lib/esm/appui-react/UiFramework.js.map +1 -1
  120. package/lib/esm/appui-react/backstage/BackstageComposerItem.js +1 -2
  121. package/lib/esm/appui-react/backstage/BackstageComposerItem.js.map +1 -1
  122. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js +1 -1
  123. package/lib/esm/appui-react/childwindow/InternalChildWindowManager.js.map +1 -1
  124. package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js +1 -1
  125. package/lib/esm/appui-react/configurableui/InternalConfigurableUiManager.js.map +1 -1
  126. package/lib/esm/appui-react/configurableui/TimeTracker.js +1 -2
  127. package/lib/esm/appui-react/configurableui/TimeTracker.js.map +1 -1
  128. package/lib/esm/appui-react/content/ContentLayout.js +9 -12
  129. package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
  130. package/lib/esm/appui-react/content/DefaultViewOverlay.js +3 -4
  131. package/lib/esm/appui-react/content/DefaultViewOverlay.js.map +1 -1
  132. package/lib/esm/appui-react/content/FloatingViewportContent.js +1 -2
  133. package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -1
  134. package/lib/esm/appui-react/content/IModelViewport.js +3 -6
  135. package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
  136. package/lib/esm/appui-react/content/InternalContentLayoutManager.js +1 -2
  137. package/lib/esm/appui-react/content/InternalContentLayoutManager.js.map +1 -1
  138. package/lib/esm/appui-react/content/InternalContentViewManager.js +1 -1
  139. package/lib/esm/appui-react/content/InternalContentViewManager.js.map +1 -1
  140. package/lib/esm/appui-react/content/split-pane/SplitPane.js +10 -12
  141. package/lib/esm/appui-react/content/split-pane/SplitPane.js.map +1 -1
  142. package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js +2 -3
  143. package/lib/esm/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  144. package/lib/esm/appui-react/dialog/ContentDialog.js +3 -6
  145. package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -1
  146. package/lib/esm/appui-react/dialog/DialogManagerBase.js +2 -3
  147. package/lib/esm/appui-react/dialog/DialogManagerBase.js.map +1 -1
  148. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  149. package/lib/esm/appui-react/frontstage/FrontstageDef.js +17 -7
  150. package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
  151. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts +2 -0
  152. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
  153. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js +2 -0
  154. package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
  155. package/lib/esm/appui-react/frontstage/ModalSettingsStage.js +2 -3
  156. package/lib/esm/appui-react/frontstage/ModalSettingsStage.js.map +1 -1
  157. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +1 -2
  158. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  159. package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js +7 -11
  160. package/lib/esm/appui-react/hooks/useAnalysisAnimationDataProvider.js.map +1 -1
  161. package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js +7 -11
  162. package/lib/esm/appui-react/hooks/useScheduleAnimationDataProvider.js.map +1 -1
  163. package/lib/esm/appui-react/hooks/useSolarDataProvider.js +8 -13
  164. package/lib/esm/appui-react/hooks/useSolarDataProvider.js.map +1 -1
  165. package/lib/esm/appui-react/messages/ActivityMessage.js +5 -7
  166. package/lib/esm/appui-react/messages/ActivityMessage.js.map +1 -1
  167. package/lib/esm/appui-react/pickers/ViewSelector.js +5 -6
  168. package/lib/esm/appui-react/pickers/ViewSelector.js.map +1 -1
  169. package/lib/esm/appui-react/popup/KeyinPalettePanel.js +1 -2
  170. package/lib/esm/appui-react/popup/KeyinPalettePanel.js.map +1 -1
  171. package/lib/esm/appui-react/popup/PopupManager.js +1 -2
  172. package/lib/esm/appui-react/popup/PopupManager.js.map +1 -1
  173. package/lib/esm/appui-react/selection/SelectionContextItemDef.js +2 -2
  174. package/lib/esm/appui-react/selection/SelectionContextItemDef.js.map +1 -1
  175. package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js +2 -1
  176. package/lib/esm/appui-react/settings/quantityformatting/QuantityFormat.js.map +1 -1
  177. package/lib/esm/appui-react/stagepanels/StagePanelDef.js +5 -7
  178. package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
  179. package/lib/esm/appui-react/statusbar/Indicator.js +1 -2
  180. package/lib/esm/appui-react/statusbar/Indicator.js.map +1 -1
  181. package/lib/esm/appui-react/statusbar/StatusBar.js +3 -5
  182. package/lib/esm/appui-react/statusbar/StatusBar.js.map +1 -1
  183. package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js +1 -1
  184. package/lib/esm/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  185. package/lib/esm/appui-react/toolbar/Toolbar.d.ts +1 -1
  186. package/lib/esm/appui-react/toolbar/Toolbar.d.ts.map +1 -1
  187. package/lib/esm/appui-react/toolbar/Toolbar.js.map +1 -1
  188. package/lib/esm/appui-react/toolbar/ToolbarHelper.d.ts +6 -3
  189. package/lib/esm/appui-react/toolbar/ToolbarHelper.d.ts.map +1 -1
  190. package/lib/esm/appui-react/toolbar/ToolbarHelper.js +53 -80
  191. package/lib/esm/appui-react/toolbar/ToolbarHelper.js.map +1 -1
  192. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts +1 -1
  193. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  194. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  195. package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js +3 -4
  196. package/lib/esm/appui-react/toolbar/useUiItemsProviderToolbarItems.js.map +1 -1
  197. package/lib/esm/appui-react/tools/CoreToolDefinitions.js +10 -17
  198. package/lib/esm/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  199. package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js +3 -2
  200. package/lib/esm/appui-react/toolsettings/DefaultToolSettingsProvider.js.map +1 -1
  201. package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js +12 -14
  202. package/lib/esm/appui-react/ui-items-provider/AbstractUiItemsManager.js.map +1 -1
  203. package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js +9 -10
  204. package/lib/esm/appui-react/ui-items-provider/StandardContentToolsUiItemsProvider.js.map +1 -1
  205. package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js +1 -2
  206. package/lib/esm/appui-react/ui-items-provider/StandardStatusbarUiItemsProvider.js.map +1 -1
  207. package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js +8 -14
  208. package/lib/esm/appui-react/ui-items-provider/UiItemsManager.js.map +1 -1
  209. package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js +1 -1
  210. package/lib/esm/appui-react/uiadmin/FrameworkUiAdmin.js.map +1 -1
  211. package/lib/esm/appui-react/uiprovider/ComponentGenerator.js +1 -1
  212. package/lib/esm/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
  213. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +3 -3
  214. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  215. package/lib/esm/appui-react/widget-panels/Content.js +8 -9
  216. package/lib/esm/appui-react/widget-panels/Content.js.map +1 -1
  217. package/lib/esm/appui-react/widget-panels/Frontstage.js +43 -45
  218. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  219. package/lib/esm/appui-react/widget-panels/StatusBar.js +1 -1
  220. package/lib/esm/appui-react/widget-panels/StatusBar.js.map +1 -1
  221. package/lib/esm/appui-react/widget-panels/Tab.js +1 -1
  222. package/lib/esm/appui-react/widget-panels/Tab.js.map +1 -1
  223. package/lib/esm/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
  224. package/lib/esm/appui-react/widget-panels/ToolSettings.js +21 -23
  225. package/lib/esm/appui-react/widget-panels/ToolSettings.js.map +1 -1
  226. package/lib/esm/appui-react/widget-panels/Toolbars.js +2 -3
  227. package/lib/esm/appui-react/widget-panels/Toolbars.js.map +1 -1
  228. package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js +2 -2
  229. package/lib/esm/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
  230. package/lib/esm/appui-react/widgets/WidgetDef.js +1 -1
  231. package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
  232. package/lib/esm/appui-react/widgets/WidgetHost.js +2 -3
  233. package/lib/esm/appui-react/widgets/WidgetHost.js.map +1 -1
  234. package/package.json +10 -10
@@ -5,45 +5,36 @@ import { CustomItemDef } from "../shared/CustomItemDef";
5
5
  import { ToolItemDef } from "../shared/ToolItemDef";
6
6
  import { GroupItemDef } from "./GroupItem";
7
7
  import { isToolbarActionItem, isToolbarGroupItem } from "./ToolbarItem";
8
- /** Helper functions for defining an ToolbarComposer.
8
+ /**
9
+ * Common implementation for `constructChildToolbarItems` and `createToolbarItemsFromItemDefs`.
10
+ * @param itemDefs List of itemDefs to convert.
11
+ * @param allowCustom false if we are building children and don't support custom items.
12
+ * @param startingItemPriority defaults to 10.
13
+ * @param overrides Single override to apply to each itemDefs.
14
+ * @returns ToolbarItem[] or (ToolbarActionItem | ToolbarGroupItem) if allowCustom is false.
15
+ */
16
+ function constructToolbarItemArray(itemDefs, allowCustom, startingItemPriority = 10, overrides) {
17
+ let priority = startingItemPriority;
18
+ const items = [];
19
+ for (const itemDef of itemDefs) {
20
+ const item = ToolbarHelper.createToolbarItemFromItemDef(priority, itemDef, overrides);
21
+ priority = priority + 10;
22
+ if (allowCustom || isToolbarActionItem(item) || isToolbarGroupItem(item))
23
+ items.push(item);
24
+ }
25
+ return items;
26
+ }
27
+ /** Helper functions for defining a Toolbar items used in `Toolbar`, `ToolbarComposer` and `UiItemsProvider`.
9
28
  * @public
10
29
  */
11
30
  export class ToolbarHelper {
12
- /** Construct CustomToolbarItem definitions given a CustomItemDef. */
31
+ /** Construct ToolbarCustomItem definitions given a CustomItemDef. */
13
32
  static createCustomDefinitionToolbarItem(itemPriority, itemDef, overrides) {
14
- const isHidden = itemDef.isHidden;
15
- const isDisabled = itemDef.isDisabled;
16
- const internalData = new Map(); // used to store ReactNode if iconSpec hold a ReactNode
17
- const icon = IconHelper.getIconData(itemDef.iconSpec, internalData);
18
- const label = this.getStringOrConditionalString(itemDef.rawLabel);
19
- const badgeType = itemDef.badgeType;
20
- // istanbul ignore else
21
- return {
22
- id: itemDef.id,
23
- itemPriority,
24
- icon,
25
- label,
26
- isCustom: true,
27
- isHidden,
28
- isDisabled,
29
- internalData,
30
- badgeType,
31
- panelContent: itemDef.popupPanelNode,
32
- ...overrides,
33
- };
33
+ return this.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);
34
34
  }
35
- /** Construct ActionButton and GroupButton definitions given an array to ItemDefs. */
35
+ /** Construct ToolbarActionItem and ToolbarGroupItem definitions given an array of ItemDefs. */
36
36
  static constructChildToolbarItems(itemDefs) {
37
- let count = 10;
38
- const items = [];
39
- for (const itemDef of itemDefs) {
40
- const item = this.createToolbarItemFromItemDef(count, itemDef);
41
- count = count + 10;
42
- // istanbul ignore else
43
- if (isToolbarActionItem(item) || isToolbarGroupItem(item))
44
- items.push(item);
45
- }
46
- return items;
37
+ return constructToolbarItemArray(itemDefs, false);
47
38
  }
48
39
  static getStringOrConditionalString(inString) {
49
40
  if (inString instanceof ConditionalStringValue ||
@@ -56,71 +47,53 @@ export class ToolbarHelper {
56
47
  }
57
48
  /** Helper method to creates a generic toolbar item entry */
58
49
  static createToolbarItemFromItemDef(itemPriority, itemDef, overrides) {
59
- const isHidden = itemDef.isHidden;
60
- const isDisabled = itemDef.isDisabled;
61
- const icon = itemDef.iconSpec;
62
- const label = this.getStringOrConditionalString(itemDef.rawLabel);
63
- const badge = itemDef.badgeType;
50
+ const { badgeType, icon, internalData, ...itemOverrides } = overrides ?? {};
51
+ const itemBase = {
52
+ id: itemDef.id,
53
+ itemPriority,
54
+ isActive: itemDef.isActive,
55
+ isHidden: itemDef.isHidden,
56
+ isDisabled: itemDef.isDisabled,
57
+ icon: internalData?.get(IconHelper.reactIconKey) ??
58
+ internalData?.get(IconHelper.conditionalIconItemKey) ??
59
+ icon ??
60
+ itemDef.iconSpec,
61
+ label: this.getStringOrConditionalString(itemDef.rawLabel),
62
+ badge: badgeType ?? itemDef.badgeType,
63
+ };
64
64
  // istanbul ignore else
65
- if (itemDef instanceof CommandItemDef) {
65
+ if (itemDef instanceof CommandItemDef || itemDef instanceof ToolItemDef) {
66
66
  return {
67
- id: itemDef.id,
68
- itemPriority,
69
- icon,
70
- label,
71
- isHidden,
72
- isDisabled,
73
- isActive: itemDef.isActive,
67
+ ...itemBase,
74
68
  execute: itemDef.execute,
75
- badge,
76
- ...overrides,
69
+ ...itemOverrides,
77
70
  };
78
71
  }
79
72
  else if (itemDef instanceof CustomItemDef) {
80
- return ToolbarHelper.createCustomDefinitionToolbarItem(itemPriority, itemDef, overrides);
73
+ return {
74
+ ...itemBase,
75
+ panelContent: itemDef.popupPanelNode,
76
+ ...itemOverrides,
77
+ };
81
78
  }
82
79
  else if (itemDef instanceof GroupItemDef) {
83
- const children = this.constructChildToolbarItems(itemDef.items);
84
80
  return {
85
- id: itemDef.id,
86
- itemPriority,
87
- icon,
88
- label,
81
+ ...itemBase,
89
82
  panelLabel: itemDef.panelLabel,
90
- isHidden,
91
- isDisabled,
92
- items: children,
83
+ items: this.constructChildToolbarItems(itemDef.items),
93
84
  isActive: false,
94
- badge,
95
- ...overrides,
96
- };
97
- }
98
- else if (itemDef instanceof ToolItemDef) {
99
- return {
100
- id: itemDef.id,
101
- itemPriority,
102
- icon,
103
- label,
104
- isHidden,
105
- isDisabled,
106
- isActive: itemDef.isActive,
107
- execute: itemDef.execute,
108
- badge,
109
- ...overrides,
85
+ ...itemOverrides,
110
86
  };
111
87
  }
112
88
  else {
113
89
  throw new Error(`Invalid Item type encountered, item id=${itemDef.id}`);
114
90
  }
115
91
  }
92
+ /**
93
+ * Helper method to creates a generic toolbar item entry list.
94
+ */
116
95
  static createToolbarItemsFromItemDefs(itemDefs, startingItemPriority = 10, overrides) {
117
- let itemPriority = startingItemPriority;
118
- const items = itemDefs.map((itemDef) => {
119
- const item = ToolbarHelper.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);
120
- itemPriority = itemPriority + 10;
121
- return item;
122
- });
123
- return items;
96
+ return constructToolbarItemArray(itemDefs, true, startingItemPriority, overrides);
124
97
  }
125
98
  }
126
99
  //# sourceMappingURL=ToolbarHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarH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I,GAAG,aAAa,CAAC,4BAA4B,CACrD,YAAY,EACZ,OAAO,EACP,SAAS,CACV,CAAC;YACF,YAAY,GAAG,YAAY,GAAG,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\nimport type * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalStringValue } from \"@itwin/appui-abstract\";\nimport { IconHelper } from \"@itwin/core-react\";\nimport type { AnyItemDef } from \"../shared/AnyItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { CustomItemDef } from \"../shared/CustomItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { GroupItemDef } from \"./GroupItem\";\nimport type {\n ToolbarActionItem,\n ToolbarCustomItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarActionItem, isToolbarGroupItem } from \"./ToolbarItem\";\n\n/** Helper functions for defining an ToolbarComposer.\n * @public\n */\nexport class ToolbarHelper {\n /** Construct CustomToolbarItem definitions given a CustomItemDef. */\n public static createCustomDefinitionToolbarItem(\n itemPriority: number,\n itemDef: CustomItemDef,\n overrides?: Partial<CustomButtonDefinition>\n ): ToolbarCustomItem {\n const isHidden = itemDef.isHidden;\n const isDisabled = itemDef.isDisabled;\n const internalData = new Map<string, any>(); // used to store ReactNode if iconSpec hold a ReactNode\n const icon = IconHelper.getIconData(itemDef.iconSpec, internalData);\n const label = this.getStringOrConditionalString(itemDef.rawLabel);\n const badgeType = itemDef.badgeType;\n\n // istanbul ignore else\n return {\n id: itemDef.id,\n itemPriority,\n icon,\n label,\n isCustom: true,\n isHidden,\n isDisabled,\n internalData,\n badgeType,\n panelContent: itemDef.popupPanelNode,\n ...overrides,\n };\n }\n\n /** Construct ActionButton and GroupButton definitions given an array to ItemDefs. */\n public static constructChildToolbarItems(\n itemDefs: AnyItemDef[]\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n let count = 10;\n const items: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n for (const itemDef of itemDefs) {\n const item = this.createToolbarItemFromItemDef(count, itemDef);\n count = count + 10;\n // istanbul ignore else\n if (isToolbarActionItem(item) || isToolbarGroupItem(item))\n items.push(item);\n }\n return items;\n }\n\n private static getStringOrConditionalString(\n inString: string | StringGetter | ConditionalStringValue\n ): string | ConditionalStringValue {\n if (\n inString instanceof ConditionalStringValue ||\n typeof inString === \"string\"\n )\n return inString;\n\n return inString();\n }\n\n public static getIconReactNode(\n item: ActionButton | GroupButton\n ): React.ReactNode {\n return IconHelper.getIconReactNode(item.icon, item.internalData);\n }\n\n /** Helper method to creates a generic toolbar item entry */\n public static createToolbarItemFromItemDef(\n itemPriority: number,\n itemDef: AnyItemDef,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem {\n const isHidden = itemDef.isHidden;\n const isDisabled = itemDef.isDisabled;\n const icon = itemDef.iconSpec;\n const label = this.getStringOrConditionalString(itemDef.rawLabel);\n const badge = itemDef.badgeType;\n\n // istanbul ignore else\n if (itemDef instanceof CommandItemDef) {\n return {\n id: itemDef.id,\n itemPriority,\n icon,\n label,\n isHidden,\n isDisabled,\n isActive: itemDef.isActive,\n execute: itemDef.execute,\n badge,\n ...overrides,\n };\n } else if (itemDef instanceof CustomItemDef) {\n return ToolbarHelper.createCustomDefinitionToolbarItem(\n itemPriority,\n itemDef,\n overrides\n );\n } else if (itemDef instanceof GroupItemDef) {\n const children: Array<ToolbarActionItem | ToolbarGroupItem> =\n this.constructChildToolbarItems(itemDef.items);\n return {\n id: itemDef.id,\n itemPriority,\n icon,\n label,\n panelLabel: itemDef.panelLabel,\n isHidden,\n isDisabled,\n items: children,\n isActive: false,\n badge,\n ...overrides,\n };\n } else if (itemDef instanceof ToolItemDef) {\n return {\n id: itemDef.id,\n itemPriority,\n icon,\n label,\n isHidden,\n isDisabled,\n isActive: itemDef.isActive,\n execute: itemDef.execute,\n badge,\n ...overrides,\n };\n } else {\n throw new Error(`Invalid Item type encountered, item id=${itemDef.id}`);\n }\n }\n\n public static createToolbarItemsFromItemDefs(\n itemDefs: AnyItemDef[],\n startingItemPriority = 10,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem[] {\n let itemPriority = startingItemPriority;\n const items = itemDefs.map((itemDef: AnyItemDef) => {\n const item = ToolbarHelper.createToolbarItemFromItemDef(\n itemPriority,\n itemDef,\n overrides\n );\n itemPriority = itemPriority + 10;\n return item;\n });\n return items;\n }\n}\n"]}
1
+ {"version":3,"file":"ToolbarHelper.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarHelper.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAChC,QAAsB,EACtB,WAAc,EACd,oBAAoB,GAAG,EAAE,EACzB,SAAsC;IAEtC,IAAI,QAAQ,GAAG,oBAAoB,CAAC;IACpC,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,OAAO,IAAI,QA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,CACV,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\nimport type * as React from \"react\";\nimport type {\n ActionButton,\n CommonToolbarItem,\n CustomButtonDefinition,\n GroupButton,\n StringGetter,\n} from \"@itwin/appui-abstract\";\nimport { ConditionalStringValue } from \"@itwin/appui-abstract\";\nimport { IconHelper } from \"@itwin/core-react\";\nimport type { AnyItemDef } from \"../shared/AnyItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { CustomItemDef } from \"../shared/CustomItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { GroupItemDef } from \"./GroupItem\";\nimport type {\n ToolbarActionItem,\n ToolbarCustomItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem\";\nimport { isToolbarActionItem, isToolbarGroupItem } from \"./ToolbarItem\";\n\n/**\n * Common implementation for `constructChildToolbarItems` and `createToolbarItemsFromItemDefs`.\n * @param itemDefs List of itemDefs to convert.\n * @param allowCustom false if we are building children and don't support custom items.\n * @param startingItemPriority defaults to 10.\n * @param overrides Single override to apply to each itemDefs.\n * @returns ToolbarItem[] or (ToolbarActionItem | ToolbarGroupItem) if allowCustom is false.\n */\nfunction constructToolbarItemArray<T extends boolean>(\n itemDefs: AnyItemDef[],\n allowCustom: T,\n startingItemPriority = 10,\n overrides?: Partial<CommonToolbarItem>\n) {\n let priority = startingItemPriority;\n const items = [];\n for (const itemDef of itemDefs) {\n const item = ToolbarHelper.createToolbarItemFromItemDef(\n priority,\n itemDef,\n overrides\n );\n priority = priority + 10;\n if (allowCustom || isToolbarActionItem(item) || isToolbarGroupItem(item))\n items.push(item);\n }\n return items as T extends true\n ? Array<ToolbarItem>\n : Array<ToolbarActionItem | ToolbarGroupItem>;\n}\n\n/** Helper functions for defining a Toolbar items used in `Toolbar`, `ToolbarComposer` and `UiItemsProvider`.\n * @public\n */\nexport class ToolbarHelper {\n /** Construct ToolbarCustomItem definitions given a CustomItemDef. */\n public static createCustomDefinitionToolbarItem(\n itemPriority: number,\n itemDef: CustomItemDef,\n overrides?: Partial<CustomButtonDefinition>\n ): ToolbarCustomItem {\n return this.createToolbarItemFromItemDef(itemPriority, itemDef, overrides);\n }\n\n /** Construct ToolbarActionItem and ToolbarGroupItem definitions given an array of ItemDefs. */\n public static constructChildToolbarItems(\n itemDefs: AnyItemDef[]\n ): Array<ToolbarActionItem | ToolbarGroupItem> {\n return constructToolbarItemArray(itemDefs, false);\n }\n\n private static getStringOrConditionalString(\n inString: string | StringGetter | ConditionalStringValue\n ): string | ConditionalStringValue {\n if (\n inString instanceof ConditionalStringValue ||\n typeof inString === \"string\"\n )\n return inString;\n\n return inString();\n }\n\n public static getIconReactNode(\n item: ActionButton | GroupButton\n ): React.ReactNode {\n return IconHelper.getIconReactNode(item.icon, item.internalData);\n }\n\n /** Helper method to creates a generic toolbar item entry */\n public static createToolbarItemFromItemDef(\n itemPriority: number,\n itemDef: AnyItemDef,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem {\n const { badgeType, icon, internalData, ...itemOverrides } = overrides ?? {};\n const itemBase: ToolbarItem = {\n id: itemDef.id,\n itemPriority,\n isActive: itemDef.isActive,\n isHidden: itemDef.isHidden,\n isDisabled: itemDef.isDisabled,\n icon:\n internalData?.get(IconHelper.reactIconKey) ??\n internalData?.get(IconHelper.conditionalIconItemKey) ??\n icon ??\n itemDef.iconSpec,\n label: this.getStringOrConditionalString(itemDef.rawLabel),\n badge: badgeType ?? itemDef.badgeType,\n };\n\n // istanbul ignore else\n if (itemDef instanceof CommandItemDef || itemDef instanceof ToolItemDef) {\n return {\n ...itemBase,\n execute: itemDef.execute,\n ...itemOverrides,\n };\n } else if (itemDef instanceof CustomItemDef) {\n return {\n ...itemBase,\n panelContent: itemDef.popupPanelNode,\n ...itemOverrides,\n };\n } else if (itemDef instanceof GroupItemDef) {\n return {\n ...itemBase,\n panelLabel: itemDef.panelLabel,\n items: this.constructChildToolbarItems(itemDef.items),\n isActive: false,\n ...itemOverrides,\n };\n } else {\n throw new Error(`Invalid Item type encountered, item id=${itemDef.id}`);\n }\n }\n\n /**\n * Helper method to creates a generic toolbar item entry list.\n */\n public static createToolbarItemsFromItemDefs(\n itemDefs: AnyItemDef[],\n startingItemPriority = 10,\n overrides?: Partial<CommonToolbarItem>\n ): ToolbarItem[] {\n return constructToolbarItemArray(\n itemDefs,\n true,\n startingItemPriority,\n overrides\n );\n }\n}\n"]}
@@ -10,7 +10,7 @@ import type { ToolbarItem } from "./ToolbarItem";
10
10
  * @beta
11
11
  */
12
12
  export interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {
13
- /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */
13
+ /** Describes to which direction the popup panels are expanded, also defines the orientation of the toolbar (Top/Bottom will create an horizontal toolbar, Left/Right will create a vertical toolbar). Defaults to: [[Direction.Bottom]] */
14
14
  expandsTo?: Direction;
15
15
  /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */
16
16
  overflowExpandsTo?: Direction;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;GAEG;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AAW,EAAE,CAAC;IACrB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oFAAoF;IACpF,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,sDAAsD;IACtD,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAGlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACrD,OAAO,oBAAC,OAAO,IAAC,cAAc,EAAE,EAAE,iBAAiB,EAAE,KAAM,YAAY,GAAI,CAAC;AAC9E,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 * as React from \"react\";\nimport type { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport type { ToolbarItem } from \"./ToolbarItem\";\nimport { Toolbar } from \"./Toolbar\";\n\n/** Component that displays toolbar items.\n * @beta\n */\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: ToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @beta\n */\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...toolbarProps } = props;\n return <Toolbar enableOverflow={{ overflowExpandsTo }} {...toolbarProps} />;\n}\n"]}
1
+ {"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACrD,OAAO,oBAAC,OAAO,IAAC,cAAc,EAAE,EAAE,iBAAiB,EAAE,KAAM,YAAY,GAAI,CAAC;AAC9E,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 * as React from \"react\";\nimport type { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport type { ToolbarItem } from \"./ToolbarItem\";\nimport { Toolbar } from \"./Toolbar\";\n\n/** Component that displays toolbar items.\n * @beta\n */\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded, also defines the orientation of the toolbar (Top/Bottom will create an horizontal toolbar, Left/Right will create a vertical toolbar). Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: ToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @beta\n */\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...toolbarProps } = props;\n return <Toolbar enableOverflow={{ overflowExpandsTo }} {...toolbarProps} />;\n}\n"]}
@@ -17,10 +17,9 @@ manager, toolbarUsage, toolbarOrientation) => {
17
17
  const providedItems = useActiveStageProvidedToolbarItems(toolbarUsage, toolbarOrientation);
18
18
  const [items, setItems] = React.useState(providedItems);
19
19
  React.useEffect(() => {
20
- var _a;
21
- manager === null || manager === void 0 ? void 0 : manager.loadItems(providedItems);
22
- setItems((_a = manager === null || manager === void 0 ? void 0 : manager.items) !== null && _a !== void 0 ? _a : providedItems);
23
- return manager === null || manager === void 0 ? void 0 : manager.onItemsChanged.addListener((args) => {
20
+ manager?.loadItems(providedItems);
21
+ setItems(manager?.items ?? providedItems);
22
+ return manager?.onItemsChanged.addListener((args) => {
24
23
  setItems(args.items);
25
24
  });
26
25
  }, [manager, providedItems]);
@@ -1 +1 @@
1
- {"version":3,"file":"useUiItemsProviderToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE1F;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;AAC5C,mDAAmD;AACnD,OAA4B,EAC5B,YAA0B,EAC1B,kBAAsC,EACd,EAAE;IAC1B,MAAM,aAAa,GAAG,kCAAkC,CACtD,YAAY,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAClC,QAAQ,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,aAAa,CAAC,CAAC;QAE1C,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAC7B,OAAO,KAAK,CAAC;AACf,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 Toolbar\n */\n\nimport * as React from \"react\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport type { ToolbarItemsManager } from \"./ToolbarItemsManager\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems\";\n\n/** Hook that retrieves active frontstage toolbar items from UiItemsProviders and manage them through [[ToolbarItemsManager]].\n * @public\n * @deprecated in 4.4.0. This uses ToolbarItemsManager which is internal, directly use [[ToolbarComposer]] instead.\n */\nexport const useUiItemsProviderToolbarItems = (\n // eslint-disable-next-line deprecation/deprecation\n manager: ToolbarItemsManager,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation\n): readonly ToolbarItem[] => {\n const providedItems = useActiveStageProvidedToolbarItems(\n toolbarUsage,\n toolbarOrientation\n );\n const [items, setItems] = React.useState(providedItems);\n React.useEffect(() => {\n manager?.loadItems(providedItems);\n setItems(manager?.items ?? providedItems);\n\n return manager?.onItemsChanged.addListener((args) => {\n setItems(args.items);\n });\n }, [manager, providedItems]);\n return items;\n};\n"]}
1
+ {"version":3,"file":"useUiItemsProviderToolbarItems.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/useUiItemsProviderToolbarItems.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE1F;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;AAC5C,mDAAmD;AACnD,OAA4B,EAC5B,YAA0B,EAC1B,kBAAsC,EACd,EAAE;IAC1B,MAAM,aAAa,GAAG,kCAAkC,CACtD,YAAY,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;QAClC,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,aAAa,CAAC,CAAC;QAE1C,OAAO,OAAO,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAClD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAC7B,OAAO,KAAK,CAAC;AACf,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 Toolbar\n */\n\nimport * as React from \"react\";\nimport type {\n ToolbarItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem\";\nimport type { ToolbarItemsManager } from \"./ToolbarItemsManager\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems\";\n\n/** Hook that retrieves active frontstage toolbar items from UiItemsProviders and manage them through [[ToolbarItemsManager]].\n * @public\n * @deprecated in 4.4.0. This uses ToolbarItemsManager which is internal, directly use [[ToolbarComposer]] instead.\n */\nexport const useUiItemsProviderToolbarItems = (\n // eslint-disable-next-line deprecation/deprecation\n manager: ToolbarItemsManager,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation\n): readonly ToolbarItem[] => {\n const providedItems = useActiveStageProvidedToolbarItems(\n toolbarUsage,\n toolbarOrientation\n );\n const [items, setItems] = React.useState(providedItems);\n React.useEffect(() => {\n manager?.loadItems(providedItems);\n setItems(manager?.items ?? providedItems);\n\n return manager?.onItemsChanged.addListener((args) => {\n setItems(args.items);\n });\n }, [manager, providedItems]);\n return items;\n};\n"]}
@@ -77,9 +77,8 @@ export class CoreTools {
77
77
  return new ToolItemDef({
78
78
  toolId: RotateViewTool.toolId,
79
79
  iconSpec: new ConditionalStringValue(() => {
80
- var _a;
81
80
  const activeContentControl = UiFramework.content.getActiveContentControl();
82
- if ((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is2d())
81
+ if (activeContentControl?.viewport?.view.is2d())
83
82
  return IconSpecUtilities.createWebComponentIconSpec(svgRotateLeft);
84
83
  return IconSpecUtilities.createWebComponentIconSpec(svgGyroscope);
85
84
  }, [
@@ -99,9 +98,8 @@ export class CoreTools {
99
98
  label: WalkViewTool.flyover,
100
99
  description: WalkViewTool.description,
101
100
  isHidden: new ConditionalBooleanValue(() => {
102
- var _a;
103
101
  const activeContentControl = UiFramework.content.getActiveContentControl();
104
- return !!((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is2d());
102
+ return !!activeContentControl?.viewport?.view.is2d();
105
103
  }, [
106
104
  SyncUiEventId.ActiveContentChanged,
107
105
  SyncUiEventId.ActiveViewportChanged,
@@ -132,10 +130,9 @@ export class CoreTools {
132
130
  return new ToolItemDef({
133
131
  toolId: ViewToggleCameraTool.toolId,
134
132
  iconSpec: new ConditionalStringValue(() => {
135
- var _a, _b;
136
133
  const activeContentControl = UiFramework.content.getActiveContentControl();
137
- if (((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is3d()) &&
138
- ((_b = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _b === void 0 ? void 0 : _b.isCameraOn)) {
134
+ if (activeContentControl?.viewport?.view.is3d() &&
135
+ activeContentControl?.viewport?.isCameraOn) {
139
136
  return IconSpecUtilities.createWebComponentIconSpec(cameraAnimationIcon);
140
137
  }
141
138
  return IconSpecUtilities.createWebComponentIconSpec(cameraAnimationDisabledIcon);
@@ -145,10 +142,9 @@ export class CoreTools {
145
142
  SyncUiEventId.ViewStateChanged,
146
143
  ]),
147
144
  label: new ConditionalStringValue(() => {
148
- var _a, _b;
149
145
  const activeContentControl = UiFramework.content.getActiveContentControl();
150
- if (((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is3d()) &&
151
- ((_b = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _b === void 0 ? void 0 : _b.isCameraOn)) {
146
+ if (activeContentControl?.viewport?.view.is3d() &&
147
+ activeContentControl?.viewport?.isCameraOn) {
152
148
  return UiFramework.translate("tools.View.ToggleCamera.turnOffFlyover");
153
149
  }
154
150
  return UiFramework.translate("tools.View.ToggleCamera.turnOnFlyover");
@@ -159,10 +155,9 @@ export class CoreTools {
159
155
  ]),
160
156
  description: ViewToggleCameraTool.description,
161
157
  isHidden: new ConditionalBooleanValue(() => {
162
- var _a, _b;
163
158
  const activeContentControl = UiFramework.content.getActiveContentControl();
164
- return !(((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is3d()) &&
165
- ((_b = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _b === void 0 ? void 0 : _b.view.supportsCamera()));
159
+ return !(activeContentControl?.viewport?.view.is3d() &&
160
+ activeContentControl?.viewport?.view.supportsCamera());
166
161
  }, [
167
162
  SyncUiEventId.ActiveContentChanged,
168
163
  SyncUiEventId.ActiveViewportChanged,
@@ -289,9 +284,8 @@ export class CoreTools {
289
284
  labelKey: "UiFramework:tools.sectionTools",
290
285
  iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),
291
286
  isHidden: new ConditionalBooleanValue(() => {
292
- var _a;
293
287
  const activeContentControl = UiFramework.content.getActiveContentControl();
294
- return !!((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is2d());
288
+ return !!activeContentControl?.viewport?.view.is2d();
295
289
  }, [
296
290
  SyncUiEventId.ActiveContentChanged,
297
291
  SyncUiEventId.ActiveViewportChanged,
@@ -317,9 +311,8 @@ export class CoreTools {
317
311
  panelLabelKey: "UiFramework:tools.sectionPanelLabel",
318
312
  iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),
319
313
  isHidden: new ConditionalBooleanValue(() => {
320
- var _a;
321
314
  const activeContentControl = UiFramework.content.getActiveContentControl();
322
- return !!((_a = activeContentControl === null || activeContentControl === void 0 ? void 0 : activeContentControl.viewport) === null || _a === void 0 ? void 0 : _a.view.is2d());
315
+ return !!activeContentControl?.viewport?.view.is2d();
323
316
  }, [
324
317
  SyncUiEventId.ActiveContentChanged,
325
318
  SyncUiEventId.ActiveViewportChanged,
@@ -1 +1 @@
1
- {"version":3,"file":"CoreToolDefinitions.js","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC,CAAC,6BAA6B;AAC7D,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EAC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EAAE,2BAA2B,CAAC,MAAM;YAC1C,QAAQ,EAAE,2BAA2B,CAAC,QAAQ;YAC9C,KAAK,EAAE,2BAA2B,CAAC,OAAO;YAC1C,WAAW,EAAE,2BAA2B,CAAC,WAAW;YACpD,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;YACjE,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 * as React from \"react\"; // cSpell:ignore keyinbrowser\nimport {\n FitViewTool,\n FlyViewTool,\n IModelApp,\n MeasureDistanceTool,\n MeasureLocationTool,\n PanViewTool,\n RotateViewTool,\n SelectionTool,\n SetupWalkCameraTool,\n ViewClipByElementTool,\n ViewClipByPlaneTool,\n ViewClipByRangeTool,\n ViewClipByShapeTool,\n ViewClipDecorationProvider,\n ViewRedoTool,\n ViewToggleCameraTool,\n ViewUndoTool,\n WalkViewTool,\n WindowAreaTool,\n ZoomViewTool,\n} from \"@itwin/core-frontend\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n IconSpecUtilities,\n} from \"@itwin/appui-abstract\";\nimport { getIsHiddenIfSelectionNotActive } from \"../selection/SelectionContextItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { RestoreFrontstageLayoutTool } from \"./RestoreLayoutTool\";\nimport { UiFramework } from \"../UiFramework\";\nimport cameraAnimationIcon from \"@itwin/itwinui-icons/icons/camera-animation.svg\";\nimport cameraAnimationDisabledIcon from \"@itwin/itwinui-icons/icons/camera-animation-disabled.svg\";\nimport svgGyroscope from \"@bentley/icons-generic/icons/gyroscope.svg\";\nimport svgRotateLeft from \"@bentley/icons-generic/icons/rotate-left.svg\";\nimport svgSectionTool from \"@bentley/icons-generic/icons/section-tool.svg\";\nimport svgSelectionClear from \"@bentley/icons-generic/icons/selection-clear.svg\";\nimport { SvgMeasure, SvgProcess } from \"@itwin/itwinui-icons-react\";\n\n/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.\n * @public\n */\n// istanbul ignore next\nexport class CoreTools {\n public static get keyinPaletteButtonItemDef() {\n return new ToolItemDef({\n toolId: \"uif:keyinpalette\",\n iconSpec: <SvgProcess />,\n labelKey: \"UiFramework:keyinbrowser.label\",\n execute: () => {\n IModelApp.uiAdmin.showKeyinPalette();\n },\n });\n }\n\n public static get fitViewCommand() {\n return new ToolItemDef({\n toolId: FitViewTool.toolId,\n iconSpec: FitViewTool.iconSpec,\n label: FitViewTool.flyover,\n description: FitViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FitViewTool.toolId,\n IModelApp.viewManager.selectedView,\n true\n ),\n });\n }\n\n public static get windowAreaCommand() {\n return new ToolItemDef({\n toolId: WindowAreaTool.toolId,\n iconSpec: WindowAreaTool.iconSpec,\n label: WindowAreaTool.flyover,\n description: WindowAreaTool.description,\n execute: async () =>\n IModelApp.tools.run(\n WindowAreaTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get zoomViewCommand() {\n return new ToolItemDef({\n toolId: ZoomViewTool.toolId,\n iconSpec: ZoomViewTool.iconSpec,\n label: ZoomViewTool.flyover,\n description: ZoomViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ZoomViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get panViewCommand() {\n return new ToolItemDef({\n toolId: PanViewTool.toolId,\n iconSpec: PanViewTool.iconSpec,\n label: PanViewTool.flyover,\n description: PanViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n PanViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get rotateViewCommand() {\n return new ToolItemDef({\n toolId: RotateViewTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl?.viewport?.view.is2d())\n return IconSpecUtilities.createWebComponentIconSpec(svgRotateLeft);\n return IconSpecUtilities.createWebComponentIconSpec(svgGyroscope);\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: RotateViewTool.flyover,\n description: RotateViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n RotateViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get walkViewCommand() {\n return new ToolItemDef({\n toolId: WalkViewTool.toolId,\n iconSpec: WalkViewTool.iconSpec,\n label: WalkViewTool.flyover,\n description: WalkViewTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n WalkViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get selectElementCommand() {\n return new ToolItemDef({\n toolId: SelectionTool.toolId,\n iconSpec: SelectionTool.iconSpec,\n label: SelectionTool.flyover,\n description: SelectionTool.description,\n execute: async () => IModelApp.tools.run(SelectionTool.toolId),\n });\n }\n\n public static get setupCameraWalkTool() {\n return new ToolItemDef({\n toolId: SetupWalkCameraTool.toolId,\n iconSpec: SetupWalkCameraTool.iconSpec,\n label: SetupWalkCameraTool.flyover,\n description: SetupWalkCameraTool.description,\n execute: async () => IModelApp.tools.run(SetupWalkCameraTool.toolId),\n });\n }\n\n public static get toggleCameraViewCommand() {\n return new ToolItemDef({\n toolId: ViewToggleCameraTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return IconSpecUtilities.createWebComponentIconSpec(\n cameraAnimationIcon\n );\n }\n return IconSpecUtilities.createWebComponentIconSpec(\n cameraAnimationDisabledIcon\n );\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return UiFramework.translate(\n \"tools.View.ToggleCamera.turnOffFlyover\"\n );\n }\n return UiFramework.translate(\"tools.View.ToggleCamera.turnOnFlyover\");\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n description: ViewToggleCameraTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !(\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.view.supportsCamera()\n );\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n ViewToggleCameraTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get flyViewCommand() {\n return new ToolItemDef({\n toolId: FlyViewTool.toolId,\n iconSpec: FlyViewTool.iconSpec,\n label: FlyViewTool.flyover,\n description: FlyViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FlyViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n // TODO - Need to provide a sync message that is fired when the Undo/Redo button needs to be refreshed in the\n // active view.\n public static get viewUndoCommand() {\n return new ToolItemDef({\n toolId: ViewUndoTool.toolId,\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isUndoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n iconSpec: ViewUndoTool.iconSpec,\n label: ViewUndoTool.flyover,\n description: ViewUndoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewUndoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get viewRedoCommand() {\n return new ToolItemDef({\n toolId: ViewRedoTool.toolId,\n iconSpec: ViewRedoTool.iconSpec,\n label: ViewRedoTool.flyover,\n description: ViewRedoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewRedoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isRedoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n });\n }\n\n private static turnOnClipVolume() {\n const vp = IModelApp.viewManager.selectedView;\n if (!vp || !vp.view.is3d()) return;\n\n // Turn on clip volume flag for section tools\n vp.viewFlags = vp.viewFlags.with(\"clipVolume\", true);\n }\n\n // note current ViewClipByPlaneTool is not automatically registered so the app must call ViewClipByPlaneTool.register();\n public static get sectionByPlaneCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByPlaneTool.toolId,\n iconSpec: ViewClipByPlaneTool.iconSpec,\n label: ViewClipByPlaneTool.flyover,\n description: ViewClipByPlaneTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByPlaneTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByElementTool is not automatically registered so the app must call ViewClipByElementTool.register();\n public static get sectionByElementCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByElementTool.toolId,\n iconSpec: ViewClipByElementTool.iconSpec,\n label: ViewClipByElementTool.flyover,\n description: ViewClipByElementTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByElementTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByRangeTool is not automatically registered so the app must call ViewClipByRangeTool.register();\n public static get sectionByRangeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByRangeTool.toolId,\n iconSpec: ViewClipByRangeTool.iconSpec,\n label: ViewClipByRangeTool.flyover,\n description: ViewClipByRangeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByRangeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByShapeTool is not automatically registered so the app must call ViewClipByShapeTool.register();\n public static get sectionByShapeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByShapeTool.toolId,\n iconSpec: ViewClipByShapeTool.iconSpec,\n label: ViewClipByShapeTool.flyover,\n description: ViewClipByShapeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByShapeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n public static get sectionToolGroup() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group\",\n labelKey: \"UiFramework:tools.sectionTools\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n this.sectionByPlaneCommandItemDef,\n this.sectionByElementCommandItemDef,\n this.sectionByRangeCommandItemDef,\n this.sectionByShapeCommandItemDef,\n ],\n itemsInColumn: 4,\n });\n }\n\n public static get sectionToolGroupWithPanel() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group-with-panel\",\n labelKey: \"UiFramework:tools.sectionTools\",\n panelLabelKey: \"UiFramework:tools.sectionPanelLabel\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n new ToolItemDef({\n ...this.sectionByPlaneCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByPlane\",\n }),\n new ToolItemDef({\n ...this.sectionByElementCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByElement\",\n }),\n new ToolItemDef({\n ...this.sectionByRangeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByRange\",\n }),\n new ToolItemDef({\n ...this.sectionByShapeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByShape\",\n }),\n ],\n itemsInColumn: 4,\n });\n }\n\n // note current MeasureDistanceTool is not automatically registered so the app must call MeasureDistanceTool.register();\n public static get measureDistanceToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureDistanceTool.toolId,\n iconSpec: MeasureDistanceTool.iconSpec,\n label: MeasureDistanceTool.flyover,\n description: MeasureDistanceTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureDistanceTool.toolId);\n },\n });\n }\n\n // note current MeasureLocationTool is not automatically registered so the app must call MeasureLocationTool.register();\n public static get measureLocationToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureLocationTool.toolId,\n iconSpec: MeasureLocationTool.iconSpec,\n label: MeasureLocationTool.flyover,\n description: MeasureLocationTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureLocationTool.toolId);\n },\n });\n }\n\n public static get measureToolGroup() {\n MeasureDistanceTool.register();\n MeasureLocationTool.register();\n\n return new GroupItemDef({\n groupId: \"measureTools-group\",\n labelKey: \"UiFramework:tools.measureTools\",\n iconSpec: <SvgMeasure />,\n items: [this.measureDistanceToolItemDef, this.measureLocationToolItemDef],\n itemsInColumn: 2,\n });\n }\n\n public static get clearSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearSelection\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSelectionClear),\n labelKey: \"UiFramework:buttons.clearSelection\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () => {\n const iModelConnection = UiFramework.getIModelConnection();\n if (iModelConnection) {\n iModelConnection.selectionSet.emptyAll();\n }\n const tool = IModelApp.toolAdmin.primitiveTool;\n if (tool) await tool.onRestartTool();\n else await IModelApp.toolAdmin.startDefaultTool();\n },\n });\n }\n\n public static get restoreFrontstageLayoutCommandItemDef() {\n return new ToolItemDef({\n toolId: RestoreFrontstageLayoutTool.toolId,\n iconSpec: RestoreFrontstageLayoutTool.iconSpec,\n label: RestoreFrontstageLayoutTool.flyover,\n description: RestoreFrontstageLayoutTool.description,\n execute: async () => {\n return IModelApp.tools.run(RestoreFrontstageLayoutTool.toolId);\n },\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CoreToolDefinitions.js","sourceRoot":"","sources":["../../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC,CAAC,6BAA6B;AAC7D,OAAO,EAC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------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tools\n */\n\nimport * as React from \"react\"; // cSpell:ignore keyinbrowser\nimport {\n FitViewTool,\n FlyViewTool,\n IModelApp,\n MeasureDistanceTool,\n MeasureLocationTool,\n PanViewTool,\n RotateViewTool,\n SelectionTool,\n SetupWalkCameraTool,\n ViewClipByElementTool,\n ViewClipByPlaneTool,\n ViewClipByRangeTool,\n ViewClipByShapeTool,\n ViewClipDecorationProvider,\n ViewRedoTool,\n ViewToggleCameraTool,\n ViewUndoTool,\n WalkViewTool,\n WindowAreaTool,\n ZoomViewTool,\n} from \"@itwin/core-frontend\";\nimport {\n ConditionalBooleanValue,\n ConditionalStringValue,\n IconSpecUtilities,\n} from \"@itwin/appui-abstract\";\nimport { getIsHiddenIfSelectionNotActive } from \"../selection/SelectionContextItemDef\";\nimport { CommandItemDef } from \"../shared/CommandItemDef\";\nimport { ToolItemDef } from \"../shared/ToolItemDef\";\nimport { SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\nimport { GroupItemDef } from \"../toolbar/GroupItem\";\nimport { RestoreFrontstageLayoutTool } from \"./RestoreLayoutTool\";\nimport { UiFramework } from \"../UiFramework\";\nimport cameraAnimationIcon from \"@itwin/itwinui-icons/icons/camera-animation.svg\";\nimport cameraAnimationDisabledIcon from \"@itwin/itwinui-icons/icons/camera-animation-disabled.svg\";\nimport svgGyroscope from \"@bentley/icons-generic/icons/gyroscope.svg\";\nimport svgRotateLeft from \"@bentley/icons-generic/icons/rotate-left.svg\";\nimport svgSectionTool from \"@bentley/icons-generic/icons/section-tool.svg\";\nimport svgSelectionClear from \"@bentley/icons-generic/icons/selection-clear.svg\";\nimport { SvgMeasure, SvgProcess } from \"@itwin/itwinui-icons-react\";\n\n/** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.\n * @public\n */\n// istanbul ignore next\nexport class CoreTools {\n public static get keyinPaletteButtonItemDef() {\n return new ToolItemDef({\n toolId: \"uif:keyinpalette\",\n iconSpec: <SvgProcess />,\n labelKey: \"UiFramework:keyinbrowser.label\",\n execute: () => {\n IModelApp.uiAdmin.showKeyinPalette();\n },\n });\n }\n\n public static get fitViewCommand() {\n return new ToolItemDef({\n toolId: FitViewTool.toolId,\n iconSpec: FitViewTool.iconSpec,\n label: FitViewTool.flyover,\n description: FitViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FitViewTool.toolId,\n IModelApp.viewManager.selectedView,\n true\n ),\n });\n }\n\n public static get windowAreaCommand() {\n return new ToolItemDef({\n toolId: WindowAreaTool.toolId,\n iconSpec: WindowAreaTool.iconSpec,\n label: WindowAreaTool.flyover,\n description: WindowAreaTool.description,\n execute: async () =>\n IModelApp.tools.run(\n WindowAreaTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get zoomViewCommand() {\n return new ToolItemDef({\n toolId: ZoomViewTool.toolId,\n iconSpec: ZoomViewTool.iconSpec,\n label: ZoomViewTool.flyover,\n description: ZoomViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ZoomViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get panViewCommand() {\n return new ToolItemDef({\n toolId: PanViewTool.toolId,\n iconSpec: PanViewTool.iconSpec,\n label: PanViewTool.flyover,\n description: PanViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n PanViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get rotateViewCommand() {\n return new ToolItemDef({\n toolId: RotateViewTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl?.viewport?.view.is2d())\n return IconSpecUtilities.createWebComponentIconSpec(svgRotateLeft);\n return IconSpecUtilities.createWebComponentIconSpec(svgGyroscope);\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: RotateViewTool.flyover,\n description: RotateViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n RotateViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get walkViewCommand() {\n return new ToolItemDef({\n toolId: WalkViewTool.toolId,\n iconSpec: WalkViewTool.iconSpec,\n label: WalkViewTool.flyover,\n description: WalkViewTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n WalkViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get selectElementCommand() {\n return new ToolItemDef({\n toolId: SelectionTool.toolId,\n iconSpec: SelectionTool.iconSpec,\n label: SelectionTool.flyover,\n description: SelectionTool.description,\n execute: async () => IModelApp.tools.run(SelectionTool.toolId),\n });\n }\n\n public static get setupCameraWalkTool() {\n return new ToolItemDef({\n toolId: SetupWalkCameraTool.toolId,\n iconSpec: SetupWalkCameraTool.iconSpec,\n label: SetupWalkCameraTool.flyover,\n description: SetupWalkCameraTool.description,\n execute: async () => IModelApp.tools.run(SetupWalkCameraTool.toolId),\n });\n }\n\n public static get toggleCameraViewCommand() {\n return new ToolItemDef({\n toolId: ViewToggleCameraTool.toolId,\n iconSpec: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return IconSpecUtilities.createWebComponentIconSpec(\n cameraAnimationIcon\n );\n }\n return IconSpecUtilities.createWebComponentIconSpec(\n cameraAnimationDisabledIcon\n );\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n label: new ConditionalStringValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.isCameraOn\n ) {\n return UiFramework.translate(\n \"tools.View.ToggleCamera.turnOffFlyover\"\n );\n }\n return UiFramework.translate(\"tools.View.ToggleCamera.turnOnFlyover\");\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n description: ViewToggleCameraTool.description,\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !(\n activeContentControl?.viewport?.view.is3d() &&\n activeContentControl?.viewport?.view.supportsCamera()\n );\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n execute: async () =>\n IModelApp.tools.run(\n ViewToggleCameraTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get flyViewCommand() {\n return new ToolItemDef({\n toolId: FlyViewTool.toolId,\n iconSpec: FlyViewTool.iconSpec,\n label: FlyViewTool.flyover,\n description: FlyViewTool.description,\n execute: async () =>\n IModelApp.tools.run(\n FlyViewTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n // TODO - Need to provide a sync message that is fired when the Undo/Redo button needs to be refreshed in the\n // active view.\n public static get viewUndoCommand() {\n return new ToolItemDef({\n toolId: ViewUndoTool.toolId,\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isUndoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n iconSpec: ViewUndoTool.iconSpec,\n label: ViewUndoTool.flyover,\n description: ViewUndoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewUndoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n });\n }\n\n public static get viewRedoCommand() {\n return new ToolItemDef({\n toolId: ViewRedoTool.toolId,\n iconSpec: ViewRedoTool.iconSpec,\n label: ViewRedoTool.flyover,\n description: ViewRedoTool.description,\n execute: async () =>\n IModelApp.tools.run(\n ViewRedoTool.toolId,\n IModelApp.viewManager.selectedView\n ),\n isDisabled: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n if (activeContentControl && activeContentControl.viewport)\n return !activeContentControl.viewport.isRedoPossible;\n return false;\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n });\n }\n\n private static turnOnClipVolume() {\n const vp = IModelApp.viewManager.selectedView;\n if (!vp || !vp.view.is3d()) return;\n\n // Turn on clip volume flag for section tools\n vp.viewFlags = vp.viewFlags.with(\"clipVolume\", true);\n }\n\n // note current ViewClipByPlaneTool is not automatically registered so the app must call ViewClipByPlaneTool.register();\n public static get sectionByPlaneCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByPlaneTool.toolId,\n iconSpec: ViewClipByPlaneTool.iconSpec,\n label: ViewClipByPlaneTool.flyover,\n description: ViewClipByPlaneTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByPlaneTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByElementTool is not automatically registered so the app must call ViewClipByElementTool.register();\n public static get sectionByElementCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByElementTool.toolId,\n iconSpec: ViewClipByElementTool.iconSpec,\n label: ViewClipByElementTool.flyover,\n description: ViewClipByElementTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByElementTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByRangeTool is not automatically registered so the app must call ViewClipByRangeTool.register();\n public static get sectionByRangeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByRangeTool.toolId,\n iconSpec: ViewClipByRangeTool.iconSpec,\n label: ViewClipByRangeTool.flyover,\n description: ViewClipByRangeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByRangeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n // note current ViewClipByShapeTool is not automatically registered so the app must call ViewClipByShapeTool.register();\n public static get sectionByShapeCommandItemDef() {\n return new ToolItemDef({\n toolId: ViewClipByShapeTool.toolId,\n iconSpec: ViewClipByShapeTool.iconSpec,\n label: ViewClipByShapeTool.flyover,\n description: ViewClipByShapeTool.description,\n execute: async () => {\n this.turnOnClipVolume();\n return IModelApp.tools.run(\n ViewClipByShapeTool.toolId,\n ViewClipDecorationProvider.create()\n );\n },\n });\n }\n\n public static get sectionToolGroup() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group\",\n labelKey: \"UiFramework:tools.sectionTools\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n this.sectionByPlaneCommandItemDef,\n this.sectionByElementCommandItemDef,\n this.sectionByRangeCommandItemDef,\n this.sectionByShapeCommandItemDef,\n ],\n itemsInColumn: 4,\n });\n }\n\n public static get sectionToolGroupWithPanel() {\n ViewClipByElementTool.register();\n ViewClipByPlaneTool.register();\n ViewClipByRangeTool.register();\n ViewClipByShapeTool.register();\n\n return new GroupItemDef({\n groupId: \"sectionTools-group-with-panel\",\n labelKey: \"UiFramework:tools.sectionTools\",\n panelLabelKey: \"UiFramework:tools.sectionPanelLabel\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSectionTool),\n isHidden: new ConditionalBooleanValue(() => {\n const activeContentControl =\n UiFramework.content.getActiveContentControl();\n return !!activeContentControl?.viewport?.view.is2d();\n }, [\n SyncUiEventId.ActiveContentChanged,\n SyncUiEventId.ActiveViewportChanged,\n SyncUiEventId.ViewStateChanged,\n ]),\n items: [\n new ToolItemDef({\n ...this.sectionByPlaneCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByPlane\",\n }),\n new ToolItemDef({\n ...this.sectionByElementCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByElement\",\n }),\n new ToolItemDef({\n ...this.sectionByRangeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByRange\",\n }),\n new ToolItemDef({\n ...this.sectionByShapeCommandItemDef,\n labelKey: \"UiFramework:tools.sectionByShape\",\n }),\n ],\n itemsInColumn: 4,\n });\n }\n\n // note current MeasureDistanceTool is not automatically registered so the app must call MeasureDistanceTool.register();\n public static get measureDistanceToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureDistanceTool.toolId,\n iconSpec: MeasureDistanceTool.iconSpec,\n label: MeasureDistanceTool.flyover,\n description: MeasureDistanceTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureDistanceTool.toolId);\n },\n });\n }\n\n // note current MeasureLocationTool is not automatically registered so the app must call MeasureLocationTool.register();\n public static get measureLocationToolItemDef() {\n return new ToolItemDef({\n toolId: MeasureLocationTool.toolId,\n iconSpec: MeasureLocationTool.iconSpec,\n label: MeasureLocationTool.flyover,\n description: MeasureLocationTool.description,\n execute: async () => {\n return IModelApp.tools.run(MeasureLocationTool.toolId);\n },\n });\n }\n\n public static get measureToolGroup() {\n MeasureDistanceTool.register();\n MeasureLocationTool.register();\n\n return new GroupItemDef({\n groupId: \"measureTools-group\",\n labelKey: \"UiFramework:tools.measureTools\",\n iconSpec: <SvgMeasure />,\n items: [this.measureDistanceToolItemDef, this.measureLocationToolItemDef],\n itemsInColumn: 2,\n });\n }\n\n public static get clearSelectionItemDef() {\n return new CommandItemDef({\n commandId: \"UiFramework.ClearSelection\",\n iconSpec: IconSpecUtilities.createWebComponentIconSpec(svgSelectionClear),\n labelKey: \"UiFramework:buttons.clearSelection\",\n isHidden: getIsHiddenIfSelectionNotActive(),\n execute: async () => {\n const iModelConnection = UiFramework.getIModelConnection();\n if (iModelConnection) {\n iModelConnection.selectionSet.emptyAll();\n }\n const tool = IModelApp.toolAdmin.primitiveTool;\n if (tool) await tool.onRestartTool();\n else await IModelApp.toolAdmin.startDefaultTool();\n },\n });\n }\n\n public static get restoreFrontstageLayoutCommandItemDef() {\n return new ToolItemDef({\n toolId: RestoreFrontstageLayoutTool.toolId,\n iconSpec: RestoreFrontstageLayoutTool.iconSpec,\n label: RestoreFrontstageLayoutTool.flyover,\n description: RestoreFrontstageLayoutTool.description,\n execute: async () => {\n return IModelApp.tools.run(RestoreFrontstageLayoutTool.toolId);\n },\n });\n }\n}\n"]}
@@ -20,9 +20,10 @@ class ToolSettingsUiDataProvider extends UiLayoutDataProvider {
20
20
  super(...arguments);
21
21
  // send property changes from UI back to tool
22
22
  this.applyUiPropertyChange = (syncItem) => {
23
- var _a;
24
23
  // istanbul ignore next
25
- (_a = IModelApp.toolAdmin.activeTool) === null || _a === void 0 ? void 0 : _a.applyToolSettingPropertyChange(syncItem).catch((err) => UnexpectedErrors.handle(err));
24
+ IModelApp.toolAdmin.activeTool
25
+ ?.applyToolSettingPropertyChange(syncItem)
26
+ .catch((err) => UnexpectedErrors.handle(err));
26
27
  };
27
28
  }
28
29
  supplyDialogItems() {
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultToolSettingsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/toolsettings/DefaultToolSettingsProvider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GA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G,IAAI,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAEvE,IAAI,CAAC,gBAAgB,GAAG,CACtB,oBAAC,0BAA0B,IACzB,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,IAAI,GACpB,CACH,CAAC;YACF,IAAI,CAAC,0BAA0B;gBAC7B,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;SAC/C;aAAM;YACL,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;SACtC;QACD,sHAAsH;QACtH,0DAA0D;QAC1D,WAAW,CAAC,WAAW,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC;IAC3D,CAAC;IAEe,wBAAwB;QACtC,wDAAwD;QACxD,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAED,6DAA6D;IAC7C,YAAY;QAC1B,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAED,gFAAgF;IAChE,0BAA0B,CACxC,IAAyC;QAEzC,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,CAAC;CACF;AAED,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAC3B,qBAAqB,EACrB,2BAA2B,CAC5B,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 ToolSettings\n */\n\nimport * as React from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { DialogItem, DialogPropertySyncItem } from \"@itwin/appui-abstract\";\nimport { UiLayoutDataProvider } from \"@itwin/appui-abstract\";\nimport type { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\nimport { ComponentGenerator } from \"../uiprovider/ComponentGenerator\";\nimport { DefaultDialogGridContainer } from \"../uiprovider/DefaultDialogGridContainer\";\nimport type { SyncToolSettingsPropertiesEventArgs } from \"../framework/FrameworkToolSettings\";\nimport { ToolUiProvider } from \"./ToolUiProvider\";\nimport { UiFramework } from \"../UiFramework\";\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\n\n/** @internal */\n\n/** ToolSettingsUiDataProvider keeps tool data in sync with UI display */\nclass ToolSettingsUiDataProvider extends UiLayoutDataProvider {\n public override supplyDialogItems(): DialogItem[] | undefined {\n return UiFramework.toolSettings.toolSettingsProperties;\n }\n\n // send property changes from UI back to tool\n public override applyUiPropertyChange = (\n syncItem: DialogPropertySyncItem\n ) => {\n // istanbul ignore next\n IModelApp.toolAdmin.activeTool\n ?.applyToolSettingPropertyChange(syncItem)\n .catch((err) => UnexpectedErrors.handle(err));\n };\n}\n\n/** ToolUiProvider class that informs ConfigurableUi that Tool Settings are provided for the specified tool.\n * @internal\n */\nexport class DefaultToolSettingsProvider extends ToolUiProvider {\n constructor(info: ConfigurableCreateInfo, options: any) {\n super(info, options);\n this._dataProvider = new ToolSettingsUiDataProvider();\n }\n\n public get uiDataProvider() {\n return this._dataProvider as ToolSettingsUiDataProvider;\n }\n\n public updateToolSettingsNodes(): void {\n // istanbul ignore else\n if (this.uiDataProvider.layoutDialogRows()) {\n const componentGenerator = new ComponentGenerator(this.uiDataProvider);\n\n this.toolSettingsNode = (\n <DefaultDialogGridContainer\n componentGenerator={componentGenerator}\n isToolSettings={true}\n />\n );\n this.horizontalToolSettingNodes =\n componentGenerator.getToolSettingsEntries();\n } else {\n this.toolSettingsNode = null;\n this.horizontalToolSettingNodes = [];\n }\n // We emit the UiFramework.frontstages.onToolSettingsReloadEvent event here because the Frontstage Manager is a static\n // class that UI components can easily register listeners.\n UiFramework.frontstages.onToolSettingsReloadEvent.emit();\n }\n\n public override reloadPropertiesFromTool(): void {\n // trigger the items to be reloaded from the active tool\n this.uiDataProvider.reloadDialogItems(false);\n this.updateToolSettingsNodes();\n }\n\n // called when tool is activated to repopulate tool settings.\n public override onInitialize(): void {\n this.reloadPropertiesFromTool();\n }\n\n // called to process UiFramework.toolSettings.onSyncToolSettingsProperties event\n public override syncToolSettingsProperties(\n args: SyncToolSettingsPropertiesEventArgs\n ): void {\n this.uiDataProvider.fireSyncPropertiesEvent(args.syncProperties);\n }\n}\n\nUiFramework.controls.register(\n \"DefaultToolSettings\",\n DefaultToolSettingsProvider\n);\n"]}
1
+ {"version":3,"file":"DefaultToolSettingsProvider.js","sourceRoot":"","sources":["../../../../src/appui-react/toolsettings/DefaultToolSettingsProvider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEtF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,gBAAgB;AAEhB,yEAAyE;AACzE,MAAM,0BAA2B,SAAQ,oBAAoB;IAA7D;;QAKE,6CAA6C;QAC7B,0BAAqB,GAAG,CACtC,QAAgC,EAChC,EAAE;YACF,uBAAuB;YACvB,SAAS,CAAC,SAAS,CAAC,UAAU;gBAC5B,EAAE,8BAA8B,CAAC,QAAQ,CAAC;iBACzC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ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,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACnE,CAAC;CACF;AAED,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAC3B,qBAAqB,EACrB,2BAA2B,CAC5B,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 ToolSettings\n */\n\nimport * as React from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { DialogItem, DialogPropertySyncItem } from \"@itwin/appui-abstract\";\nimport { UiLayoutDataProvider } from \"@itwin/appui-abstract\";\nimport type { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\nimport { ComponentGenerator } from \"../uiprovider/ComponentGenerator\";\nimport { DefaultDialogGridContainer } from \"../uiprovider/DefaultDialogGridContainer\";\nimport type { SyncToolSettingsPropertiesEventArgs } from \"../framework/FrameworkToolSettings\";\nimport { ToolUiProvider } from \"./ToolUiProvider\";\nimport { UiFramework } from \"../UiFramework\";\nimport { UnexpectedErrors } from \"@itwin/core-bentley\";\n\n/** @internal */\n\n/** ToolSettingsUiDataProvider keeps tool data in sync with UI display */\nclass ToolSettingsUiDataProvider extends UiLayoutDataProvider {\n public override supplyDialogItems(): DialogItem[] | undefined {\n return UiFramework.toolSettings.toolSettingsProperties;\n }\n\n // send property changes from UI back to tool\n public override applyUiPropertyChange = (\n syncItem: DialogPropertySyncItem\n ) => {\n // istanbul ignore next\n IModelApp.toolAdmin.activeTool\n ?.applyToolSettingPropertyChange(syncItem)\n .catch((err) => UnexpectedErrors.handle(err));\n };\n}\n\n/** ToolUiProvider class that informs ConfigurableUi that Tool Settings are provided for the specified tool.\n * @internal\n */\nexport class DefaultToolSettingsProvider extends ToolUiProvider {\n constructor(info: ConfigurableCreateInfo, options: any) {\n super(info, options);\n this._dataProvider = new ToolSettingsUiDataProvider();\n }\n\n public get uiDataProvider() {\n return this._dataProvider as ToolSettingsUiDataProvider;\n }\n\n public updateToolSettingsNodes(): void {\n // istanbul ignore else\n if (this.uiDataProvider.layoutDialogRows()) {\n const componentGenerator = new ComponentGenerator(this.uiDataProvider);\n\n this.toolSettingsNode = (\n <DefaultDialogGridContainer\n componentGenerator={componentGenerator}\n isToolSettings={true}\n />\n );\n this.horizontalToolSettingNodes =\n componentGenerator.getToolSettingsEntries();\n } else {\n this.toolSettingsNode = null;\n this.horizontalToolSettingNodes = [];\n }\n // We emit the UiFramework.frontstages.onToolSettingsReloadEvent event here because the Frontstage Manager is a static\n // class that UI components can easily register listeners.\n UiFramework.frontstages.onToolSettingsReloadEvent.emit();\n }\n\n public override reloadPropertiesFromTool(): void {\n // trigger the items to be reloaded from the active tool\n this.uiDataProvider.reloadDialogItems(false);\n this.updateToolSettingsNodes();\n }\n\n // called when tool is activated to repopulate tool settings.\n public override onInitialize(): void {\n this.reloadPropertiesFromTool();\n }\n\n // called to process UiFramework.toolSettings.onSyncToolSettingsProperties event\n public override syncToolSettingsProperties(\n args: SyncToolSettingsPropertiesEventArgs\n ): void {\n this.uiDataProvider.fireSyncPropertiesEvent(args.syncProperties);\n }\n}\n\nUiFramework.controls.register(\n \"DefaultToolSettings\",\n DefaultToolSettingsProvider\n);\n"]}