@itwin/appui-react 4.0.0-dev.14 → 4.0.0-dev.16

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 (126) hide show
  1. package/lib/cjs/appui-react/UiFramework.d.ts +6 -4
  2. package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
  3. package/lib/cjs/appui-react/UiFramework.js +6 -4
  4. package/lib/cjs/appui-react/UiFramework.js.map +1 -1
  5. package/lib/cjs/appui-react/frontstage/FrontstageConfig.d.ts +5 -0
  6. package/lib/cjs/appui-react/frontstage/FrontstageConfig.d.ts.map +1 -1
  7. package/lib/cjs/appui-react/frontstage/FrontstageConfig.js.map +1 -1
  8. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +3 -1
  9. package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  10. package/lib/cjs/appui-react/frontstage/FrontstageDef.js +17 -1
  11. package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
  12. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.d.ts +5 -0
  13. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.d.ts.map +1 -1
  14. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +1 -0
  15. package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  16. package/lib/cjs/appui-react/popup/CardPopup.js +2 -1
  17. package/lib/cjs/appui-react/popup/CardPopup.js.map +1 -1
  18. package/lib/cjs/appui-react/popup/ToolbarPopup.d.ts.map +1 -1
  19. package/lib/cjs/appui-react/popup/ToolbarPopup.js +2 -3
  20. package/lib/cjs/appui-react/popup/ToolbarPopup.js.map +1 -1
  21. package/lib/cjs/appui-react/statusfields/SelectionScope.d.ts +3 -10
  22. package/lib/cjs/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
  23. package/lib/cjs/appui-react/statusfields/SelectionScope.js +17 -24
  24. package/lib/cjs/appui-react/statusfields/SelectionScope.js.map +1 -1
  25. package/lib/cjs/appui-react/statusfields/SnapMode.d.ts +3 -24
  26. package/lib/cjs/appui-react/statusfields/SnapMode.d.ts.map +1 -1
  27. package/lib/cjs/appui-react/statusfields/SnapMode.js +43 -72
  28. package/lib/cjs/appui-react/statusfields/SnapMode.js.map +1 -1
  29. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +4 -1
  30. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
  31. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +12 -0
  32. package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
  33. package/lib/cjs/appui-react/toolbar/Toolbar.d.ts +32 -0
  34. package/lib/cjs/appui-react/toolbar/Toolbar.d.ts.map +1 -0
  35. package/lib/cjs/appui-react/toolbar/Toolbar.js +26 -0
  36. package/lib/cjs/appui-react/toolbar/Toolbar.js.map +1 -0
  37. package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
  38. package/lib/cjs/appui-react/toolbar/ToolbarComposer.js +4 -5
  39. package/lib/cjs/appui-react/toolbar/ToolbarComposer.js.map +1 -1
  40. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts +34 -0
  41. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -0
  42. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js +26 -0
  43. package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -0
  44. package/lib/cjs/appui-react/toolbar/toUIAToolbarItem.js +1 -1
  45. package/lib/cjs/appui-react/toolbar/toUIAToolbarItem.js.map +1 -1
  46. package/lib/cjs/appui-react/tools/RestoreLayoutTool.d.ts +2 -2
  47. package/lib/cjs/appui-react/tools/RestoreLayoutTool.js +2 -2
  48. package/lib/cjs/appui-react/tools/RestoreLayoutTool.js.map +1 -1
  49. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.d.ts +1 -1
  50. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.d.ts.map +1 -1
  51. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +1 -1
  52. package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  53. package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  54. package/lib/cjs/appui-react/widget-panels/Frontstage.js +7 -6
  55. package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
  56. package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +2 -2
  57. package/lib/cjs/appui-react/widgets/WidgetDef.js +2 -2
  58. package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
  59. package/lib/cjs/appui-react.d.ts +2 -0
  60. package/lib/cjs/appui-react.d.ts.map +1 -1
  61. package/lib/cjs/appui-react.js +2 -0
  62. package/lib/cjs/appui-react.js.map +1 -1
  63. package/lib/esm/appui-react/UiFramework.d.ts +6 -4
  64. package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
  65. package/lib/esm/appui-react/UiFramework.js +6 -4
  66. package/lib/esm/appui-react/UiFramework.js.map +1 -1
  67. package/lib/esm/appui-react/frontstage/FrontstageConfig.d.ts +5 -0
  68. package/lib/esm/appui-react/frontstage/FrontstageConfig.d.ts.map +1 -1
  69. package/lib/esm/appui-react/frontstage/FrontstageConfig.js.map +1 -1
  70. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +3 -1
  71. package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
  72. package/lib/esm/appui-react/frontstage/FrontstageDef.js +17 -1
  73. package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
  74. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.d.ts +5 -0
  75. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.d.ts.map +1 -1
  76. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +1 -0
  77. package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
  78. package/lib/esm/appui-react/popup/CardPopup.js +2 -1
  79. package/lib/esm/appui-react/popup/CardPopup.js.map +1 -1
  80. package/lib/esm/appui-react/popup/ToolbarPopup.d.ts.map +1 -1
  81. package/lib/esm/appui-react/popup/ToolbarPopup.js +3 -4
  82. package/lib/esm/appui-react/popup/ToolbarPopup.js.map +1 -1
  83. package/lib/esm/appui-react/statusfields/SelectionScope.d.ts +3 -10
  84. package/lib/esm/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
  85. package/lib/esm/appui-react/statusfields/SelectionScope.js +17 -24
  86. package/lib/esm/appui-react/statusfields/SelectionScope.js.map +1 -1
  87. package/lib/esm/appui-react/statusfields/SnapMode.d.ts +3 -24
  88. package/lib/esm/appui-react/statusfields/SnapMode.d.ts.map +1 -1
  89. package/lib/esm/appui-react/statusfields/SnapMode.js +43 -72
  90. package/lib/esm/appui-react/statusfields/SnapMode.js.map +1 -1
  91. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +4 -1
  92. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
  93. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +12 -0
  94. package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
  95. package/lib/esm/appui-react/toolbar/Toolbar.d.ts +32 -0
  96. package/lib/esm/appui-react/toolbar/Toolbar.d.ts.map +1 -0
  97. package/lib/esm/appui-react/toolbar/Toolbar.js +22 -0
  98. package/lib/esm/appui-react/toolbar/Toolbar.js.map +1 -0
  99. package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
  100. package/lib/esm/appui-react/toolbar/ToolbarComposer.js +5 -6
  101. package/lib/esm/appui-react/toolbar/ToolbarComposer.js.map +1 -1
  102. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts +34 -0
  103. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -0
  104. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js +22 -0
  105. package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -0
  106. package/lib/esm/appui-react/toolbar/toUIAToolbarItem.js +1 -1
  107. package/lib/esm/appui-react/toolbar/toUIAToolbarItem.js.map +1 -1
  108. package/lib/esm/appui-react/tools/RestoreLayoutTool.d.ts +2 -2
  109. package/lib/esm/appui-react/tools/RestoreLayoutTool.js +2 -2
  110. package/lib/esm/appui-react/tools/RestoreLayoutTool.js.map +1 -1
  111. package/lib/esm/appui-react/utils/InternalUiShowHideManager.d.ts +1 -1
  112. package/lib/esm/appui-react/utils/InternalUiShowHideManager.d.ts.map +1 -1
  113. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +1 -1
  114. package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
  115. package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  116. package/lib/esm/appui-react/widget-panels/Frontstage.js +7 -6
  117. package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
  118. package/lib/esm/appui-react/widgets/WidgetDef.d.ts +2 -2
  119. package/lib/esm/appui-react/widgets/WidgetDef.js +2 -2
  120. package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
  121. package/lib/esm/appui-react.d.ts +2 -0
  122. package/lib/esm/appui-react.d.ts.map +1 -1
  123. package/lib/esm/appui-react.js +2 -0
  124. package/lib/esm/appui-react.js.map +1 -1
  125. package/lib/public/locales/en/UiFramework.json +0 -5
  126. package/package.json +11 -10
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScope.js","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SelectionScope.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAA+B;AAC/B,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAsC;AACtC,kEAA4D;AAC5D,wDAA4D;AAE5D,gDAA6C;AAY7C;;;;;;;GAOG;AACH,MAAM,4BAA6B,SAAQ,KAAK,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EAAE,IAAI,CAAC,QAAQ,EACpB,IAAI,EAAC,OAAO,GAAG,CACA,CACpB,CAAC;IACJ,CAAC;CACF;AAED,+GAA+G;AAC/G,SAAS,eAAe,CAAC,KAAU;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,yBAAW,CAAC,iBAAiB,CAAC,CAAC,CAAE,8CAA8C;IAC5G,0BAA0B;IAC1B,IAAI,CAAC,cAAc;QACjB,OAAO,SAAS,CAAC;IAEnB,OAAO,EAAE,oBAAoB,EAAE,cAAc,CAAC,YAAY,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,CAAC;AACpK,CAAC;AAED,4EAA4E;AAC5E;;;;;GAKG,CAAC,gEAAgE;AACvD,QAAA,mBAAmB,GAAG,IAAA,qBAAO,EAAC,eAAe,CAAC,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport \"./SelectionScope.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { connect } from \"react-redux\";\r\nimport { FooterIndicator } from \"@itwin/appui-layout-react\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport { PresentationSelectionScope } from \"../redux/SessionState\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\n\r\n/** Defines properties supported by the SelectionScopeField Component.\r\n * @public\r\n */\r\ninterface SelectionScopeFieldProps extends CommonProps {\r\n\r\n activeSelectionScope: string;\r\n availableSelectionScopes: PresentationSelectionScope[];\r\n}\r\n\r\n/**\r\n * Status Field React component. This component is designed to be specified in a status bar definition.\r\n * It is used to display the number of selected items based on the Presentation Rules Selection Manager.\r\n * The IModelApp should call either UiFramework.setIModelConnection or SyncUiEventDispatcher.initializeConnectionEvents\r\n * with the active iModelConnection each time a new iModel is opened so the selection scope data is properly updated\r\n * in the Redux state.\r\n * @public\r\n */\r\nclass SelectionScopeFieldComponent extends React.Component<SelectionScopeFieldProps> {\r\n private _label = UiFramework.translate(\"selectionScopeField.label\");\r\n private _toolTip = UiFramework.translate(\"selectionScopeField.toolTip\");\r\n private _scopeOptions: SelectOption<string>[] = [];\r\n\r\n constructor(props: SelectionScopeFieldProps) {\r\n super(props);\r\n this._scopeOptions = this.props.availableSelectionScopes.map((scope: PresentationSelectionScope) => {\r\n const label = !!scope.label ? scope.label : UiFramework.translate(`selectionScopeLabels.${scope.id}`);\r\n return { value: scope.id, label };\r\n });\r\n }\r\n\r\n private _updateSelectValue = (newValue: string) => {\r\n // istanbul ignore else\r\n if (newValue) {\r\n UiFramework.setActiveSelectionScope(newValue);\r\n }\r\n };\r\n\r\n public override render(): React.ReactNode {\r\n\r\n return (\r\n <FooterIndicator\r\n className={classnames(\"uifw-statusFields-selectionScope\", this.props.className)}\r\n style={this.props.style}\r\n >\r\n <label className=\"uifw-statusFields-selectionScope-label\">\r\n {this._label}:\r\n </label>\r\n <Select\r\n className=\"uifw-statusFields-selectionScope-selector\"\r\n value={this.props.activeSelectionScope}\r\n options={this._scopeOptions}\r\n onChange={this._updateSelectValue}\r\n data-testid=\"components-selectionScope-selector\"\r\n title={this._toolTip}\r\n size=\"small\" />\r\n </FooterIndicator >\r\n );\r\n }\r\n}\r\n\r\n/** Function used by Redux to map state data in Redux store to props that are used to render this component. */\r\nfunction mapStateToProps(state: any) {\r\n const frameworkState = state[UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name\r\n /* istanbul ignore next */\r\n if (!frameworkState)\r\n return undefined;\r\n\r\n return { activeSelectionScope: frameworkState.sessionState.activeSelectionScope, availableSelectionScopes: frameworkState.sessionState.availableSelectionScopes };\r\n}\r\n\r\n// we declare the variable and export that rather than using export default.\r\n/**\r\n * SelectionScopeField React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active selection scope that is used by the PresentationManager to determine what elements are added to the selection nap mode.\r\n * This React component is Redux connected.\r\n * @public\r\n */ // eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const SelectionScopeField = connect(mapStateToProps)(SelectionScopeFieldComponent);\r\n"]}
1
+ {"version":3,"file":"SelectionScope.js","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SelectionScope.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,iCAA+B;AAC/B,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAsC;AACtC,kEAA4D;AAC5D,wDAA8C;AAE9C,gDAA6C;AAW7C;;;;;;;GAOG;AACH,SAAS,4BAA4B,CAAC,KAA+B;IACnE,MAAM,KAAK,GAAG,yBAAW,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,yBAAW,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;IAErE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC/E,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACjD,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAEtC,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE;QAC7C,uBAAuB;QACvB,IAAI,QAAQ,EAAE;YACZ,yBAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;SAC/C;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,oCAAe,IACd,SAAS,EAAE,IAAA,oBAAU,EAAC,kCAAkC,EAAE,KAAK,CAAC,SAAS,CAAC,EAC1E,KAAK,EAAE,KAAK,CAAC,KAAK;QAElB,+BAAO,SAAS,EAAC,wCAAwC;YACtD,KAAK;gBACA;QACR,oBAAC,sBAAM,IACL,SAAS,EAAC,2CAA2C,EACrD,KAAK,EAAE,KAAK,CAAC,oBAAoB,EACjC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,iBACf,oCAAoC,EAChD,KAAK,EAAE,OAAO,EACd,IAAI,EAAC,OAAO,GAAG,CACA,CACpB,CAAC;AACJ,CAAC;AAED,+GAA+G;AAC/G,SAAS,eAAe,CAAC,KAAU;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,yBAAW,CAAC,iBAAiB,CAAC,CAAC,CAAE,8CAA8C;IAC5G,0BAA0B;IAC1B,IAAI,CAAC,cAAc;QACjB,OAAO,SAAS,CAAC;IAEnB,OAAO,EAAE,oBAAoB,EAAE,cAAc,CAAC,YAAY,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,CAAC;AACpK,CAAC;AAED,4EAA4E;AAC5E;;;;;GAKG,CAAC,gEAAgE;AACvD,QAAA,mBAAmB,GAAG,IAAA,qBAAO,EAAC,eAAe,CAAC,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport \"./SelectionScope.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { connect } from \"react-redux\";\r\nimport { FooterIndicator } from \"@itwin/appui-layout-react\";\r\nimport { Select } from \"@itwin/itwinui-react\";\r\nimport { PresentationSelectionScope } from \"../redux/SessionState\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\n\r\n/** Defines properties supported by the SelectionScopeField Component.\r\n * @public\r\n */\r\ninterface SelectionScopeFieldProps extends CommonProps {\r\n activeSelectionScope: string;\r\n availableSelectionScopes: PresentationSelectionScope[];\r\n}\r\n\r\n/**\r\n * Status Field React component. This component is designed to be specified in a status bar definition.\r\n * It is used to display the number of selected items based on the Presentation Rules Selection Manager.\r\n * The IModelApp should call either UiFramework.setIModelConnection or SyncUiEventDispatcher.initializeConnectionEvents\r\n * with the active iModelConnection each time a new iModel is opened so the selection scope data is properly updated\r\n * in the Redux state.\r\n * @public\r\n */\r\nfunction SelectionScopeFieldComponent(props: SelectionScopeFieldProps) {\r\n const label = UiFramework.translate(\"selectionScopeField.label\");\r\n const toolTip = UiFramework.translate(\"selectionScopeField.toolTip\");\r\n\r\n const options = React.useMemo(() => props.availableSelectionScopes.map((scope) => {\r\n return { value: scope.id, label: scope.label };\r\n }), [props.availableSelectionScopes]);\r\n\r\n const updateSelectValue = (newValue: string) => {\r\n // istanbul ignore else\r\n if (newValue) {\r\n UiFramework.setActiveSelectionScope(newValue);\r\n }\r\n };\r\n\r\n return (\r\n <FooterIndicator\r\n className={classnames(\"uifw-statusFields-selectionScope\", props.className)}\r\n style={props.style}\r\n >\r\n <label className=\"uifw-statusFields-selectionScope-label\">\r\n {label}:\r\n </label>\r\n <Select\r\n className=\"uifw-statusFields-selectionScope-selector\"\r\n value={props.activeSelectionScope}\r\n options={options}\r\n onChange={updateSelectValue}\r\n data-testid=\"components-selectionScope-selector\"\r\n title={toolTip}\r\n size=\"small\" />\r\n </FooterIndicator >\r\n );\r\n}\r\n\r\n/** Function used by Redux to map state data in Redux store to props that are used to render this component. */\r\nfunction mapStateToProps(state: any) {\r\n const frameworkState = state[UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name\r\n /* istanbul ignore next */\r\n if (!frameworkState)\r\n return undefined;\r\n\r\n return { activeSelectionScope: frameworkState.sessionState.activeSelectionScope, availableSelectionScopes: frameworkState.sessionState.availableSelectionScopes };\r\n}\r\n\r\n// we declare the variable and export that rather than using export default.\r\n/**\r\n * SelectionScopeField React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active selection scope that is used by the PresentationManager to determine what elements are added to the selection nap mode.\r\n * This React component is Redux connected.\r\n * @public\r\n */ // eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const SelectionScopeField = connect(mapStateToProps)(SelectionScopeFieldComponent);\r\n"]}
@@ -1,44 +1,23 @@
1
1
  /** @packageDocumentation
2
2
  * @module StatusBar
3
3
  */
4
- import * as React from "react";
4
+ /// <reference types="react" />
5
5
  import { CommonProps } from "@itwin/core-react";
6
6
  /** Defines properties supported by the SnapMode Field Component.
7
7
  */
8
8
  interface SnapModeFieldProps extends CommonProps {
9
9
  snapMode: number;
10
- setSnapMode: (mode: number) => any;
11
- }
12
- interface SnapModeFieldState {
13
- target: HTMLElement | null;
14
10
  }
15
11
  /**
16
12
  * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will
17
13
  * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.
18
14
  */
19
- declare class SnapModeFieldComponent extends React.Component<SnapModeFieldProps, SnapModeFieldState> {
20
- private _snapModeFieldArray;
21
- private _title;
22
- readonly state: SnapModeFieldState;
23
- constructor(props: SnapModeFieldProps);
24
- /** Return icon class name for a specific snapMode. */
25
- private getSnapModeIconNameFromMode;
26
- /** Standard React render method. */
27
- render(): React.ReactNode;
28
- /** Return an IconSpec with a web component icon to replace the icons that we used to load from the webfont */
29
- private getIconFromIconName;
30
- /** Return array of SnapRow elements, one for each support snap mode. This array will populate the pop-up used
31
- * to select a SnapMode.
32
- */
33
- private getSnapEntries;
34
- /** Called when user clicks on a Snap Mode entry in the pop-up window. */
35
- private _handleSnapModeFieldClick;
36
- }
15
+ declare function SnapModeFieldComponent(props: SnapModeFieldProps): JSX.Element;
37
16
  /**
38
17
  * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will
39
18
  * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.
40
19
  * This Field React component is Redux connected.
41
20
  * @public
42
- */ export declare const SnapModeField: import("react-redux").ConnectedComponent<typeof SnapModeFieldComponent, import("react-redux").Omit<React.ClassAttributes<SnapModeFieldComponent> & SnapModeFieldProps, "setSnapMode" | "snapMode">>;
21
+ */ export declare const SnapModeField: import("react-redux").ConnectedComponent<typeof SnapModeFieldComponent, import("react-redux").Omit<SnapModeFieldProps, "snapMode">>;
43
22
  export {};
44
23
  //# sourceMappingURL=SnapMode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SnapMode.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SnapMode.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAahE;GACG;AACH,UAAU,kBAAmB,SAAQ,WAAW;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;CACpC;AASD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,cAAM,sBAAuB,SAAQ,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAC1F,OAAO,CAAC,mBAAmB,CAQzB;IACF,OAAO,CAAC,MAAM,CAAmD;IAEjE,SAAyB,KAAK,EAAE,kBAAkB,CAEhD;gBAEU,KAAK,EAAE,kBAAkB;IAIrC,sDAAsD;IACtD,OAAO,CAAC,2BAA2B;IAcnC,oCAAoC;IACpB,MAAM,IAAI,KAAK,CAAC,SAAS;IAiBzC,8GAA8G;IAC9G,OAAO,CAAC,mBAAmB;IA4B3B;;QAEI;IACJ,OAAO,CAAC,cAAc;IAkBtB,yEAAyE;IACzE,OAAO,CAAC,yBAAyB,CAE/B;CAEH;AAkBD;;;;;GAKG,CACH,eAAO,MAAM,aAAa,qMAAgE,CAAC"}
1
+ {"version":3,"file":"SnapMode.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SnapMode.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAOH,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAahE;GACG;AACH,UAAU,kBAAmB,SAAQ,WAAW;IAC9C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqCD;;;GAGG;AACH,iBAAS,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,eAiDxD;AAaD;;;;;GAKG,CACH,eAAO,MAAM,aAAa,qIAAmD,CAAC"}
@@ -12,7 +12,6 @@ const React = require("react");
12
12
  const react_redux_1 = require("react-redux");
13
13
  const core_frontend_1 = require("@itwin/core-frontend");
14
14
  const appui_layout_react_1 = require("@itwin/appui-layout-react");
15
- const state_1 = require("../configurableui/state");
16
15
  const UiFramework_1 = require("../UiFramework");
17
16
  const core_react_1 = require("@itwin/core-react");
18
17
  const LabelIndicator_1 = require("../statusbar/LabelIndicator");
@@ -24,34 +23,50 @@ const snaps_nearest_svg_1 = require("@bentley/icons-generic/icons/snaps-nearest.
24
23
  const snaps_origin_svg_1 = require("@bentley/icons-generic/icons/snaps-origin.svg");
25
24
  const snaps_midpoint_svg_1 = require("@bentley/icons-generic/icons/snaps-midpoint.svg");
26
25
  const snaps_bisector_svg_1 = require("@bentley/icons-generic/icons/snaps-bisector.svg");
26
+ function getIconFromIconName(iconName) {
27
+ let iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_svg_1.default);
28
+ switch (iconName) {
29
+ case "snaps":
30
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_svg_1.default);
31
+ break;
32
+ case "snaps-intersection":
33
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_intersection_svg_1.default);
34
+ break;
35
+ case "snaps-center":
36
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_center_svg_1.default);
37
+ break;
38
+ case "snaps-nearest":
39
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_nearest_svg_1.default);
40
+ break;
41
+ case "snaps-origin":
42
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_origin_svg_1.default);
43
+ break;
44
+ case "snaps-midpoint":
45
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_midpoint_svg_1.default);
46
+ break;
47
+ case "snaps-bisector":
48
+ iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_bisector_svg_1.default);
49
+ break;
50
+ }
51
+ return iconSpec;
52
+ }
27
53
  /**
28
54
  * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will
29
55
  * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.
30
56
  */
31
- class SnapModeFieldComponent extends React.Component {
32
- constructor(props) {
33
- super(props);
34
- this._snapModeFieldArray = [
35
- { label: UiFramework_1.UiFramework.translate("snapModeField.keypoint"), value: core_frontend_1.SnapMode.NearestKeypoint, iconName: "snaps" },
36
- { label: UiFramework_1.UiFramework.translate("snapModeField.intersection"), value: core_frontend_1.SnapMode.Intersection, iconName: "snaps-intersection" },
37
- { label: UiFramework_1.UiFramework.translate("snapModeField.center"), value: core_frontend_1.SnapMode.Center, iconName: "snaps-center" },
38
- { label: UiFramework_1.UiFramework.translate("snapModeField.nearest"), value: core_frontend_1.SnapMode.Nearest, iconName: "snaps-nearest" },
39
- { label: UiFramework_1.UiFramework.translate("snapModeField.origin"), value: core_frontend_1.SnapMode.Origin, iconName: "snaps-origin" },
40
- { label: UiFramework_1.UiFramework.translate("snapModeField.midpoint"), value: core_frontend_1.SnapMode.MidPoint, iconName: "snaps-midpoint" },
41
- { label: UiFramework_1.UiFramework.translate("snapModeField.bisector"), value: core_frontend_1.SnapMode.Bisector, iconName: "snaps-bisector" },
42
- ];
43
- this._title = UiFramework_1.UiFramework.translate("snapModeField.snapMode");
44
- this.state = {
45
- target: null,
46
- };
47
- /** Called when user clicks on a Snap Mode entry in the pop-up window. */
48
- this._handleSnapModeFieldClick = (snapModeField) => {
49
- this.props.setSnapMode(snapModeField);
50
- };
51
- }
57
+ function SnapModeFieldComponent(props) {
58
+ const snapModes = React.useMemo(() => [
59
+ { label: UiFramework_1.UiFramework.translate("snapModeField.keypoint"), value: core_frontend_1.SnapMode.NearestKeypoint, iconName: "snaps" },
60
+ { label: UiFramework_1.UiFramework.translate("snapModeField.intersection"), value: core_frontend_1.SnapMode.Intersection, iconName: "snaps-intersection" },
61
+ { label: UiFramework_1.UiFramework.translate("snapModeField.center"), value: core_frontend_1.SnapMode.Center, iconName: "snaps-center" },
62
+ { label: UiFramework_1.UiFramework.translate("snapModeField.nearest"), value: core_frontend_1.SnapMode.Nearest, iconName: "snaps-nearest" },
63
+ { label: UiFramework_1.UiFramework.translate("snapModeField.origin"), value: core_frontend_1.SnapMode.Origin, iconName: "snaps-origin" },
64
+ { label: UiFramework_1.UiFramework.translate("snapModeField.midpoint"), value: core_frontend_1.SnapMode.MidPoint, iconName: "snaps-midpoint" },
65
+ { label: UiFramework_1.UiFramework.translate("snapModeField.bisector"), value: core_frontend_1.SnapMode.Bisector, iconName: "snaps-bisector" },
66
+ ], []);
52
67
  /** Return icon class name for a specific snapMode. */
53
- getSnapModeIconNameFromMode(snapMode) {
54
- for (const mode of this._snapModeFieldArray) {
68
+ const getSnapModeIconNameFromMode = React.useCallback(function (snapMode) {
69
+ for (const mode of snapModes) {
55
70
  if (mode.value === snapMode)
56
71
  return mode.iconName;
57
72
  }
@@ -60,54 +75,10 @@ class SnapModeFieldComponent extends React.Component {
60
75
  return "snaps-multione";
61
76
  /* istanbul ignore next */
62
77
  return "placeholder";
63
- }
64
- /** Standard React render method. */
65
- render() {
66
- return (React.createElement(React.Fragment, null,
67
- React.createElement(LabelIndicator_1.StatusBarLabelIndicator, { iconSpec: `${this.getIconFromIconName(`${this.getSnapModeIconNameFromMode(this.props.snapMode)}`)}`, title: this._title, label: this._title, popup: React.createElement(appui_layout_react_1.SnapModePanel, { title: this._title }, this.getSnapEntries()) })));
68
- }
69
- /** Return an IconSpec with a web component icon to replace the icons that we used to load from the webfont */
70
- getIconFromIconName(iconName) {
71
- let iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_svg_1.default);
72
- switch (iconName) {
73
- case "snaps":
74
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_svg_1.default);
75
- break;
76
- case "snaps-intersection":
77
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_intersection_svg_1.default);
78
- break;
79
- case "snaps-center":
80
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_center_svg_1.default);
81
- break;
82
- case "snaps-nearest":
83
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_nearest_svg_1.default);
84
- break;
85
- case "snaps-origin":
86
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_origin_svg_1.default);
87
- break;
88
- case "snaps-midpoint":
89
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_midpoint_svg_1.default);
90
- break;
91
- case "snaps-bisector":
92
- iconSpec = appui_abstract_1.IconSpecUtilities.createWebComponentIconSpec(snaps_bisector_svg_1.default);
93
- break;
94
- }
95
- return iconSpec;
96
- }
97
- /** Return array of SnapRow elements, one for each support snap mode. This array will populate the pop-up used
98
- * to select a SnapMode.
99
- */
100
- getSnapEntries() {
101
- return this._snapModeFieldArray.map((item, index) => {
102
- const iconSpec = this.getIconFromIconName(item.iconName);
103
- return (React.createElement(appui_layout_react_1.Snap, { key: `SM_${index}`, onClick: () => this._handleSnapModeFieldClick(item.value), isActive: (this.props.snapMode & item.value) === item.value, icon: React.createElement(core_react_1.Icon, { className: `icon`, iconSpec: iconSpec }) }, item.label));
104
- });
105
- }
78
+ }, [snapModes]);
79
+ const title = UiFramework_1.UiFramework.translate("snapModeField.snapMode");
80
+ return (React.createElement(LabelIndicator_1.StatusBarLabelIndicator, { iconSpec: getIconFromIconName(getSnapModeIconNameFromMode(props.snapMode)), title: title, label: title, popup: React.createElement(appui_layout_react_1.SnapModePanel, { title: title }, snapModes.map((item, index) => React.createElement(appui_layout_react_1.Snap, { key: `SM_${index}`, onClick: () => UiFramework_1.UiFramework.setAccudrawSnapMode(item.value), isActive: (props.snapMode & item.value) === item.value, icon: React.createElement(core_react_1.Icon, { className: `icon`, iconSpec: getIconFromIconName(item.iconName) }) }, item.label))) }));
106
81
  }
107
- // Used by Redux to map dispatch functions to props entry. This requires SnapModeFieldProps interface above to include a setSnapMode entry */
108
- const mapDispatch = {
109
- setSnapMode: state_1.ConfigurableUiActions.setSnapMode,
110
- };
111
82
  /** Function used by Redux to map state data in Redux store to props that are used to render this component. */
112
83
  function mapStateToProps(state) {
113
84
  const frameworkState = state[UiFramework_1.UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name
@@ -123,5 +94,5 @@ function mapStateToProps(state) {
123
94
  * This Field React component is Redux connected.
124
95
  * @public
125
96
  */ // eslint-disable-next-line @typescript-eslint/naming-convention
126
- exports.SnapModeField = (0, react_redux_1.connect)(mapStateToProps, mapDispatch)(SnapModeFieldComponent);
97
+ exports.SnapModeField = (0, react_redux_1.connect)(mapStateToProps)(SnapModeFieldComponent);
127
98
  //# sourceMappingURL=SnapMode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SnapMode.js","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SnapMode.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,6CAAsC;AACtC,wDAAgD;AAChD,kEAAgE;AAChE,mDAAgE;AAChE,gDAA6C;AAC7C,kDAAgE;AAChE,gEAAsE;AACtE,0DAA0D;AAC1D,sEAAsE;AACtE,gGAAuF;AACvF,oFAA2E;AAC3E,sFAA6E;AAC7E,oFAA2E;AAC3E,wFAA+E;AAC/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AqB,CAAC,WAAW;CAC/C,CAAC;AAEF,+GAA+G;AAC/G,SAAS,eAAe,CAAC,KAAU;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,yBAAW,CAAC,iBAAiB,CAAC,CAAC,CAAE,8CAA8C;IAC5G,0BAA0B;IAC1B,IAAI,CAAC,cAAc;QACjB,OAAO,SAAS,CAAC;IAEnB,OAAO,EAAE,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;AACnE,CAAC;AAED,4EAA4E;AAC5E;;;;;GAKG,CAAC,gEAAgE;AACvD,QAAA,aAAa,GAAG,IAAA,qBAAO,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC,sBAAsB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { connect } from \"react-redux\";\r\nimport { SnapMode } from \"@itwin/core-frontend\";\r\nimport { Snap, SnapModePanel } from \"@itwin/appui-layout-react\";\r\nimport { ConfigurableUiActions } from \"../configurableui/state\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { CommonProps, Icon, IconSpec } from \"@itwin/core-react\";\r\nimport { StatusBarLabelIndicator } from \"../statusbar/LabelIndicator\";\r\nimport { IconSpecUtilities } from \"@itwin/appui-abstract\";\r\nimport snapModeKeypoint from \"@bentley/icons-generic/icons/snaps.svg\";\r\nimport snapModeIntersection from \"@bentley/icons-generic/icons/snaps-intersection.svg\";\r\nimport snapModeCenter from \"@bentley/icons-generic/icons/snaps-center.svg\";\r\nimport snapModeNearest from \"@bentley/icons-generic/icons/snaps-nearest.svg\";\r\nimport snapModeOrigin from \"@bentley/icons-generic/icons/snaps-origin.svg\";\r\nimport snapModeMidpoint from \"@bentley/icons-generic/icons/snaps-midpoint.svg\";\r\nimport snapModeBisector from \"@bentley/icons-generic/icons/snaps-bisector.svg\";\r\n\r\n// cSpell:ignore multione\r\n\r\n/** Defines properties supported by the SnapMode Field Component.\r\n */\r\ninterface SnapModeFieldProps extends CommonProps {\r\n snapMode: number;\r\n setSnapMode: (mode: number) => any;\r\n}\r\n\r\n/** Define the properties that will be used to represent the available snap modes. */\r\ninterface SnapModeFieldEntry {\r\n label: string;\r\n value: number;\r\n iconName: string;\r\n}\r\n\r\ninterface SnapModeFieldState {\r\n target: HTMLElement | null;\r\n}\r\n\r\n/**\r\n * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\r\n */\r\nclass SnapModeFieldComponent extends React.Component<SnapModeFieldProps, SnapModeFieldState> {\r\n private _snapModeFieldArray: SnapModeFieldEntry[] = [\r\n { label: UiFramework.translate(\"snapModeField.keypoint\"), value: SnapMode.NearestKeypoint as number, iconName: \"snaps\" },\r\n { label: UiFramework.translate(\"snapModeField.intersection\"), value: SnapMode.Intersection as number, iconName: \"snaps-intersection\" },\r\n { label: UiFramework.translate(\"snapModeField.center\"), value: SnapMode.Center as number, iconName: \"snaps-center\" },\r\n { label: UiFramework.translate(\"snapModeField.nearest\"), value: SnapMode.Nearest as number, iconName: \"snaps-nearest\" },\r\n { label: UiFramework.translate(\"snapModeField.origin\"), value: SnapMode.Origin as number, iconName: \"snaps-origin\" },\r\n { label: UiFramework.translate(\"snapModeField.midpoint\"), value: SnapMode.MidPoint as number, iconName: \"snaps-midpoint\" },\r\n { label: UiFramework.translate(\"snapModeField.bisector\"), value: SnapMode.Bisector as number, iconName: \"snaps-bisector\" },\r\n ];\r\n private _title = UiFramework.translate(\"snapModeField.snapMode\");\r\n\r\n public override readonly state: SnapModeFieldState = {\r\n target: null,\r\n };\r\n\r\n constructor(props: SnapModeFieldProps) {\r\n super(props);\r\n }\r\n\r\n /** Return icon class name for a specific snapMode. */\r\n private getSnapModeIconNameFromMode(snapMode: number): string {\r\n for (const mode of this._snapModeFieldArray) {\r\n if (mode.value === snapMode)\r\n return mode.iconName;\r\n }\r\n\r\n /* istanbul ignore else */\r\n if (snapMode > 0)\r\n return \"snaps-multione\";\r\n\r\n /* istanbul ignore next */\r\n return \"placeholder\";\r\n }\r\n\r\n /** Standard React render method. */\r\n public override render(): React.ReactNode {\r\n return (\r\n <>\r\n <StatusBarLabelIndicator\r\n iconSpec={`${this.getIconFromIconName(`${this.getSnapModeIconNameFromMode(this.props.snapMode)}`)}`}\r\n title={this._title}\r\n label={this._title}\r\n popup={\r\n <SnapModePanel title={this._title}>\r\n {this.getSnapEntries()}\r\n </SnapModePanel>\r\n }\r\n />\r\n </>\r\n );\r\n }\r\n\r\n /** Return an IconSpec with a web component icon to replace the icons that we used to load from the webfont */\r\n private getIconFromIconName(iconName: string): IconSpec {\r\n let iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);\r\n switch (iconName) {\r\n case \"snaps\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);\r\n break;\r\n case \"snaps-intersection\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeIntersection);\r\n break;\r\n case \"snaps-center\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeCenter);\r\n break;\r\n case \"snaps-nearest\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeNearest);\r\n break;\r\n case \"snaps-origin\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeOrigin);\r\n break;\r\n case \"snaps-midpoint\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeMidpoint);\r\n break;\r\n case \"snaps-bisector\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeBisector);\r\n break;\r\n }\r\n return iconSpec;\r\n }\r\n\r\n /** Return array of SnapRow elements, one for each support snap mode. This array will populate the pop-up used\r\n * to select a SnapMode.\r\n */\r\n private getSnapEntries(): JSX.Element[] {\r\n return this._snapModeFieldArray.map((item: SnapModeFieldEntry, index: number) => {\r\n const iconSpec = this.getIconFromIconName(item.iconName);\r\n return (\r\n <Snap\r\n key={`SM_${index}`}\r\n onClick={() => this._handleSnapModeFieldClick(item.value)}\r\n isActive={(this.props.snapMode & item.value) === item.value}\r\n icon={\r\n <Icon className={`icon`} iconSpec={iconSpec} />\r\n }\r\n >\r\n {item.label}\r\n </Snap >\r\n );\r\n });\r\n }\r\n\r\n /** Called when user clicks on a Snap Mode entry in the pop-up window. */\r\n private _handleSnapModeFieldClick = (snapModeField: number) => {\r\n this.props.setSnapMode(snapModeField);\r\n };\r\n\r\n}\r\n\r\n// Used by Redux to map dispatch functions to props entry. This requires SnapModeFieldProps interface above to include a setSnapMode entry */\r\nconst mapDispatch = {\r\n setSnapMode: ConfigurableUiActions.setSnapMode,\r\n};\r\n\r\n/** Function used by Redux to map state data in Redux store to props that are used to render this component. */\r\nfunction mapStateToProps(state: any) {\r\n const frameworkState = state[UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name\r\n /* istanbul ignore next */\r\n if (!frameworkState)\r\n return undefined;\r\n\r\n return { snapMode: frameworkState.configurableUiState.snapMode };\r\n}\r\n\r\n// we declare the variable and export that rather than using export default.\r\n/**\r\n * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\r\n * This Field React component is Redux connected.\r\n * @public\r\n */ // eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const SnapModeField = connect(mapStateToProps, mapDispatch)(SnapModeFieldComponent);\r\n"]}
1
+ {"version":3,"file":"SnapMode.js","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SnapMode.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,6CAAsC;AACtC,wDAAgD;AAChD,kEAAgE;AAChE,gDAA6C;AAC7C,kDAAgE;AAChE,gEAAs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\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module StatusBar\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { connect } from \"react-redux\";\r\nimport { SnapMode } from \"@itwin/core-frontend\";\r\nimport { Snap, SnapModePanel } from \"@itwin/appui-layout-react\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { CommonProps, Icon, IconSpec } from \"@itwin/core-react\";\r\nimport { StatusBarLabelIndicator } from \"../statusbar/LabelIndicator\";\r\nimport { IconSpecUtilities } from \"@itwin/appui-abstract\";\r\nimport snapModeKeypoint from \"@bentley/icons-generic/icons/snaps.svg\";\r\nimport snapModeIntersection from \"@bentley/icons-generic/icons/snaps-intersection.svg\";\r\nimport snapModeCenter from \"@bentley/icons-generic/icons/snaps-center.svg\";\r\nimport snapModeNearest from \"@bentley/icons-generic/icons/snaps-nearest.svg\";\r\nimport snapModeOrigin from \"@bentley/icons-generic/icons/snaps-origin.svg\";\r\nimport snapModeMidpoint from \"@bentley/icons-generic/icons/snaps-midpoint.svg\";\r\nimport snapModeBisector from \"@bentley/icons-generic/icons/snaps-bisector.svg\";\r\n\r\n// cSpell:ignore multione\r\n\r\n/** Defines properties supported by the SnapMode Field Component.\r\n */\r\ninterface SnapModeFieldProps extends CommonProps {\r\n snapMode: number;\r\n}\r\n\r\n/** Define the properties that will be used to represent the available snap modes. */\r\ninterface SnapModeFieldEntry {\r\n label: string;\r\n value: number;\r\n iconName: string;\r\n}\r\n\r\nfunction getIconFromIconName(iconName: string): IconSpec {\r\n let iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);\r\n switch (iconName) {\r\n case \"snaps\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);\r\n break;\r\n case \"snaps-intersection\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeIntersection);\r\n break;\r\n case \"snaps-center\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeCenter);\r\n break;\r\n case \"snaps-nearest\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeNearest);\r\n break;\r\n case \"snaps-origin\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeOrigin);\r\n break;\r\n case \"snaps-midpoint\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeMidpoint);\r\n break;\r\n case \"snaps-bisector\":\r\n iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeBisector);\r\n break;\r\n }\r\n return iconSpec;\r\n}\r\n\r\n/**\r\n * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\r\n */\r\nfunction SnapModeFieldComponent(props: SnapModeFieldProps) {\r\n const snapModes: SnapModeFieldEntry[] = React.useMemo(() => [\r\n { label: UiFramework.translate(\"snapModeField.keypoint\"), value: SnapMode.NearestKeypoint as number, iconName: \"snaps\" },\r\n { label: UiFramework.translate(\"snapModeField.intersection\"), value: SnapMode.Intersection as number, iconName: \"snaps-intersection\" },\r\n { label: UiFramework.translate(\"snapModeField.center\"), value: SnapMode.Center as number, iconName: \"snaps-center\" },\r\n { label: UiFramework.translate(\"snapModeField.nearest\"), value: SnapMode.Nearest as number, iconName: \"snaps-nearest\" },\r\n { label: UiFramework.translate(\"snapModeField.origin\"), value: SnapMode.Origin as number, iconName: \"snaps-origin\" },\r\n { label: UiFramework.translate(\"snapModeField.midpoint\"), value: SnapMode.MidPoint as number, iconName: \"snaps-midpoint\" },\r\n { label: UiFramework.translate(\"snapModeField.bisector\"), value: SnapMode.Bisector as number, iconName: \"snaps-bisector\" },\r\n ], []);\r\n\r\n /** Return icon class name for a specific snapMode. */\r\n const getSnapModeIconNameFromMode = React.useCallback(function (snapMode: number): string {\r\n for (const mode of snapModes) {\r\n if (mode.value === snapMode)\r\n return mode.iconName;\r\n }\r\n\r\n /* istanbul ignore else */\r\n if (snapMode > 0)\r\n return \"snaps-multione\";\r\n\r\n /* istanbul ignore next */\r\n return \"placeholder\";\r\n }, [snapModes]);\r\n\r\n const title = UiFramework.translate(\"snapModeField.snapMode\");\r\n return (\r\n <StatusBarLabelIndicator\r\n iconSpec={getIconFromIconName(getSnapModeIconNameFromMode(props.snapMode))}\r\n title={title}\r\n label={title}\r\n popup={\r\n <SnapModePanel title={title}>\r\n {snapModes.map((item, index) => <Snap\r\n key={`SM_${index}`}\r\n onClick={() => UiFramework.setAccudrawSnapMode(item.value)}\r\n isActive={(props.snapMode & item.value) === item.value}\r\n icon={\r\n <Icon className={`icon`} iconSpec={getIconFromIconName(item.iconName)} />\r\n }\r\n >\r\n {item.label}\r\n </Snap >\r\n )}\r\n </SnapModePanel>\r\n }\r\n />\r\n );\r\n}\r\n\r\n/** Function used by Redux to map state data in Redux store to props that are used to render this component. */\r\nfunction mapStateToProps(state: any) {\r\n const frameworkState = state[UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name\r\n /* istanbul ignore next */\r\n if (!frameworkState)\r\n return undefined;\r\n\r\n return { snapMode: frameworkState.configurableUiState.snapMode };\r\n}\r\n\r\n// we declare the variable and export that rather than using export default.\r\n/**\r\n * Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will\r\n * display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.\r\n * This Field React component is Redux connected.\r\n * @public\r\n */ // eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const SnapModeField = connect(mapStateToProps)(SnapModeFieldComponent);\r\n"]}
@@ -43,7 +43,9 @@ export declare enum SyncUiEventId {
43
43
  ViewStateChanged = "viewstatechanged",
44
44
  /** The current object the reads and write UI State has changed. */
45
45
  UiStateStorageChanged = "uistatestoragechanged",
46
- ShowHideManagerSettingChange = "show-hide-setting-change"
46
+ ShowHideManagerSettingChange = "show-hide-setting-change",
47
+ /** The list of feature overrides applied has been changed */
48
+ FeatureOverridesChanged = "featureoverrideschanged"
47
49
  }
48
50
  /** This class is used to send eventIds to interested UI components so the component can determine if it needs
49
51
  * to refresh its display by calling setState on itself.
@@ -68,6 +70,7 @@ export declare class SyncUiEventDispatcher {
68
70
  /** Checks to see if an eventId of interest is contained in the set of eventIds */
69
71
  static hasEventOfInterest(eventIds: Set<string>, idsOfInterest: string[]): boolean;
70
72
  private static _dispatchViewChange;
73
+ private static _dispatchFeatureOverridesChange;
71
74
  /** Initializes the Monitoring of Events that trigger dispatching sync events */
72
75
  static initialize(): void;
73
76
  private static selectionChangedHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"SyncUiEventDispatcher.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/syncui/SyncUiEventDispatcher.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAqB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAa,gBAAgB,EAAkD,MAAM,sBAAsB,CAAC;AAUnH;;GAEG;AACH,oBAAY,aAAa;IACvB,yCAAyC;IACzC,0BAA0B,+BAA+B;IACzD,qCAAqC;IACrC,uBAAuB,4BAA4B;IACnD,8EAA8E;IAC9E,oBAAoB,yBAAyB;IAC7C,iEAAiE;IACjE,qBAAqB,0BAA0B;IAC/C,kCAAkC;IAClC,cAAc,mBAAmB;IACjC,4CAA4C;IAC5C,sBAAsB,2BAA2B;IACjD,kFAAkF;IAClF,uBAAuB,4BAA4B;IACnD,kCAAkC;IAClC,oBAAoB,yBAAyB;IAC7C,yEAAyE;IACzE,eAAe,oBAAoB;IACnC,oDAAoD;IACpD,sBAAsB,2BAA2B;IACjD,gDAAgD;IAChD,kBAAkB,uBAAuB;IACzC,0CAA0C;IAC1C,sBAAsB,2BAA2B;IACjD,+DAA+D;IAC/D,aAAa,kBAAkB;IAC/B,yCAAyC;IACzC,kBAAkB,uBAAuB;IACzC,oEAAoE;IACpE,mBAAmB,wBAAwB;IAC3C,kFAAkF;IAClF,wBAAwB,6BAA6B;IACrD,mF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C5B,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQxD,oDAAoD;WACtC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAQ5D,kFAAkF;WACpE,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE;IAK/E,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAKlC,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAI9C,gFAAgF;WAClE,UAAU;IAwExB,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAItC,qFAAqF;WACvE,qBAAqB,CAAC,gBAAgB,EAAE,gBAAgB;IAKtE,0FAA0F;WAC5E,0BAA0B,CAAC,gBAAgB,EAAE,gBAAgB;CAa5E"}
@@ -60,6 +60,8 @@ var SyncUiEventId;
60
60
  /** The current object the reads and write UI State has changed. */
61
61
  SyncUiEventId["UiStateStorageChanged"] = "uistatestoragechanged";
62
62
  SyncUiEventId["ShowHideManagerSettingChange"] = "show-hide-setting-change";
63
+ /** The list of feature overrides applied has been changed */
64
+ SyncUiEventId["FeatureOverridesChanged"] = "featureoverrideschanged";
63
65
  })(SyncUiEventId = exports.SyncUiEventId || (exports.SyncUiEventId = {}));
64
66
  /** This class is used to send eventIds to interested UI components so the component can determine if it needs
65
67
  * to refresh its display by calling setState on itself.
@@ -107,6 +109,10 @@ class SyncUiEventDispatcher {
107
109
  static _dispatchViewChange() {
108
110
  SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ViewStateChanged);
109
111
  }
112
+ // istanbul ignore next
113
+ static _dispatchFeatureOverridesChange() {
114
+ SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FeatureOverridesChanged);
115
+ }
110
116
  /** Initializes the Monitoring of Events that trigger dispatching sync events */
111
117
  static initialize() {
112
118
  // clear any registered listeners - this should only be encountered in unit test scenarios
@@ -153,11 +159,17 @@ class SyncUiEventDispatcher {
153
159
  // istanbul ignore next
154
160
  if (args.previous.onViewChanged && typeof args.previous.onViewChanged.removeListener === "function") // not set during unit test
155
161
  args.previous.onViewChanged.removeListener(SyncUiEventDispatcher._dispatchViewChange);
162
+ // istanbul ignore next
163
+ if (args.previous.onFeatureOverridesChanged && typeof args.previous.onFeatureOverridesChanged.removeListener === "function") // not set during unit test
164
+ args.previous.onFeatureOverridesChanged.removeListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);
156
165
  }
157
166
  // istanbul ignore next
158
167
  if (args.current) {
159
168
  if (args.current.onViewChanged && typeof args.current.onViewChanged.addListener === "function") // not set during unit test
160
169
  args.current.onViewChanged.addListener(SyncUiEventDispatcher._dispatchViewChange);
170
+ // istanbul ignore next
171
+ if (args.current.onFeatureOverridesChanged && typeof args.current.onFeatureOverridesChanged.addListener === "function") // not set during unit test
172
+ args.current.onFeatureOverridesChanged.addListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);
161
173
  }
162
174
  }));
163
175
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SyncUiEventDispatcher.js","sourceRoot":"","sources":["../../../../src/appui-react/syncui/SyncUiEventDispatcher.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAAuE;AACvE,sDAA6C;AAC7C,wDAAmH;AACnH,wDAA6D;AAC7D,gDAA6C;AAE7C,yJAAyJ;AACzJ,yJAAyJ;AACzJ,2JAA2J;AAC3J,wHAAwH;AACxH,6HAA6H;AAE7H;;GAEG;AACH,IAAY,aAsCX;AAtCD,WAAY,aAAa;IACvB,yCAAyC;IACzC,0EAAyD,CAAA;IACzD,qCAAqC;IACrC,oEAAmD,CAAA;IACnD,8EAA8E;IAC9E,8DAA6C,CAAA;IAC7C,iEAAiE;IACjE,gEAA+C,CAAA;IAC/C,kCAAkC;IAClC,kDAAiC,CAAA;IACjC,4CAA4C;IAC5C,kEAAiD,CAAA;IACjD,kFAAkF;IAClF,oEAAm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,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;;AA/Ic,wCAAkB,GAAG,IAAI,kCAAiB,EAAE,CAAC;AAE7C,8CAAwB,GAAsB,EAAE,CAAC;AAHrD,sDAAqB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module SyncUi\r\n */\r\n\r\nimport { UiEventDispatcher, UiSyncEvent } from \"@itwin/appui-abstract\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp, IModelConnection, SelectedViewportChangedArgs, SelectionSetEvent } from \"@itwin/core-frontend\";\r\nimport { SessionStateActionId } from \"../redux/SessionState\";\r\nimport { UiFramework } from \"../UiFramework\";\r\n\r\n// cSpell:ignore activecontentchanged, activitymessageupdated, activitymessagecancelled, backstageevent, contentlayoutactivated, contentcontrolactivated,\r\n// cSpell:ignore elementtooltipchanged, frontstageactivated, inputfieldmessageadded, inputfieldmessageremoved, modalfrontstagechanged, modaldialogchanged\r\n// cSpell:ignore navigationaidactivated, notificationmessageadded, toolactivated, taskactivated, widgetstatechanged, workflowactivated frontstageactivating\r\n// cSpell:ignore frontstageready activeviewportchanged selectionsetchanged presentationselectionchanged viewstatechanged\r\n// cSpell:ignore accudrawcompassmodechanged accudrawfieldlockchanged accudrawrotationchanged uisettingschanged configurableui\r\n\r\n/** Event Id used to sync UI components. Used to refresh visibility or enable state of control.\r\n * @public\r\n */\r\nexport enum SyncUiEventId {\r\n /** AccuDraw compass mode has changed. */\r\n AccuDrawCompassModeChanged = \"accudrawcompassmodechanged\",\r\n /** AccuDraw rotation has changed. */\r\n AccuDrawRotationChanged = \"accudrawrotationchanged\",\r\n /** The active content as maintained by the ContentViewManager has changed. */\r\n ActiveContentChanged = \"activecontentchanged\",\r\n /** The active view maintained by the ViewManager has changed. */\r\n ActiveViewportChanged = \"activeviewportchanged\",\r\n /** Backstage has been toggled. */\r\n BackstageEvent = \"backstageevent\",\r\n /** A Content Layout has been activated. */\r\n ContentLayoutActivated = \"contentlayoutactivated\",\r\n /** A Content Control maintained by UiFramework.frontstages has been activated. */\r\n ContentControlActivated = \"contentcontrolactivated\",\r\n /** A Frontstage is activating. */\r\n FrontstageActivating = \"frontstageactivating\",\r\n /** A Frontstage has been activated and the content has been assigned. */\r\n FrontstageReady = \"frontstageready\",\r\n /** A Modal Frontstage has been opened or closed. */\r\n ModalFrontstageChanged = \"modalfrontstagechanged\",\r\n /** A Modal Dialog has been opened or closed. */\r\n ModalDialogChanged = \"modaldialogchanged\",\r\n /** A NavigationAid has been activated. */\r\n NavigationAidActivated = \"navigationaidactivated\",\r\n /** An InteractiveTool has been activated via the ToolAdmin. */\r\n ToolActivated = \"toolactivated\",\r\n /** The state of a Widget has changed. */\r\n WidgetStateChanged = \"widgetstatechanged\",\r\n /** The SelectionSet for the active IModelConnection has changed. */\r\n SelectionSetChanged = \"selectionsetchanged\",\r\n /** The list of settings providers registered with SettingsManager has changed. */\r\n SettingsProvidersChanged = \"settingsproviderschanged\",\r\n /** The current view state has changed (used by view undo/redo toolbar buttons). */\r\n ViewStateChanged = \"viewstatechanged\",\r\n /** The current object the reads and write UI State has changed. */\r\n UiStateStorageChanged = \"uistatestoragechanged\",\r\n ShowHideManagerSettingChange = \"show-hide-setting-change\",\r\n}\r\n\r\n/** This class is used to send eventIds to interested UI components so the component can determine if it needs\r\n * to refresh its display by calling setState on itself.\r\n * @public\r\n */\r\nexport class SyncUiEventDispatcher {\r\n private static _uiEventDispatcher = new UiEventDispatcher();\r\n private static _unregisterListenerFunc?: () => void;\r\n private static _unregisterListenerFuncs: Array<() => void> = [];\r\n\r\n /** @internal - used for testing only */\r\n /* istanbul ignore next */\r\n public static setTimeoutPeriod(period: number): void {\r\n SyncUiEventDispatcher._uiEventDispatcher.setTimeoutPeriod(period);\r\n }\r\n\r\n /** Return set of event ids that will be sent to listeners/. */\r\n public static get syncEventIds(): Set<string> {\r\n return SyncUiEventDispatcher._uiEventDispatcher.syncEventIds;\r\n }\r\n\r\n /** Return SyncUiEvent so callers can register an event callback. */\r\n public static get onSyncUiEvent(): UiSyncEvent {\r\n return SyncUiEventDispatcher._uiEventDispatcher.onSyncUiEvent;\r\n }\r\n\r\n /** Immediately trigger sync event processing. */\r\n public static dispatchImmediateSyncUiEvent(eventId: string): void {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchImmediateSyncUiEvent(eventId);\r\n }\r\n\r\n /** Save eventId in Set for processing. */\r\n public static dispatchSyncUiEvent(eventId: string): void {\r\n if (0 === SyncUiEventDispatcher._uiEventDispatcher.timeoutPeriod) {\r\n Logger.logInfo(UiFramework.loggerCategory(this), `[dispatchSyncUiEvent] not processed because timeoutPeriod=0`);\r\n return;\r\n }\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(eventId);\r\n }\r\n\r\n /** Save multiple eventIds in Set for processing. */\r\n public static dispatchSyncUiEvents(eventIds: string[]): void {\r\n // istanbul ignore if\r\n if (0 === SyncUiEventDispatcher._uiEventDispatcher.timeoutPeriod) {\r\n Logger.logInfo(UiFramework.loggerCategory(this), `[dispatchSyncUiEvents] not processed because _timeoutPeriod=0`);\r\n }\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvents(eventIds);\r\n }\r\n\r\n /** Checks to see if an eventId of interest is contained in the set of eventIds */\r\n public static hasEventOfInterest(eventIds: Set<string>, idsOfInterest: string[]) {\r\n return SyncUiEventDispatcher._uiEventDispatcher.hasEventOfInterest(eventIds, idsOfInterest);\r\n }\r\n\r\n // istanbul ignore next\r\n private static _dispatchViewChange() {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ViewStateChanged);\r\n }\r\n\r\n /** Initializes the Monitoring of Events that trigger dispatching sync events */\r\n public static initialize() {\r\n // clear any registered listeners - this should only be encountered in unit test scenarios\r\n this._unregisterListenerFuncs.forEach((unregisterListenerFunc) => unregisterListenerFunc());\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onContentControlActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ContentControlActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onContentLayoutActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ContentLayoutActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onFrontstageActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FrontstageActivating);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onFrontstageReadyEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FrontstageReady);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onModalFrontstageChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ModalFrontstageChanged);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onNavigationAidActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.NavigationAidActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ToolActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onWidgetStateChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.WidgetStateChanged);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.backstage.onToggled.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.BackstageEvent);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.content.onActiveContentChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ActiveContentChanged);\r\n }));\r\n\r\n // istanbul ignore else\r\n if (IModelApp && IModelApp.viewManager) {\r\n this._unregisterListenerFuncs.push(IModelApp.viewManager.onSelectedViewportChanged.addListener((args: SelectedViewportChangedArgs) => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ActiveViewportChanged);\r\n\r\n // if this is the first view being opened up start the default tool so tool admin is happy.\r\n if (undefined === args.previous) {\r\n IModelApp.toolAdmin.startDefaultTool();// eslint-disable-line @typescript-eslint/no-floating-promises\r\n } else {\r\n // istanbul ignore next\r\n if (args.previous.onViewChanged && typeof args.previous.onViewChanged.removeListener === \"function\") // not set during unit test\r\n args.previous.onViewChanged.removeListener(SyncUiEventDispatcher._dispatchViewChange);\r\n }\r\n // istanbul ignore next\r\n if (args.current) {\r\n if (args.current.onViewChanged && typeof args.current.onViewChanged.addListener === \"function\") // not set during unit test\r\n args.current.onViewChanged.addListener(SyncUiEventDispatcher._dispatchViewChange);\r\n }\r\n }));\r\n }\r\n }\r\n\r\n private static selectionChangedHandler(_ev: SelectionSetEvent) {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.SelectionSetChanged);\r\n }\r\n\r\n /** This should be called by IModelApp when the active IModelConnection is closed. */\r\n public static clearConnectionEvents(iModelConnection: IModelConnection) {\r\n iModelConnection.selectionSet.onChanged.removeListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n SyncUiEventDispatcher._unregisterListenerFunc && SyncUiEventDispatcher._unregisterListenerFunc();\r\n }\r\n\r\n /** This should be called by IModelApp when the active IModelConnection is established. */\r\n public static initializeConnectionEvents(iModelConnection: IModelConnection) {\r\n if (SyncUiEventDispatcher._unregisterListenerFunc)\r\n SyncUiEventDispatcher._unregisterListenerFunc();\r\n\r\n if (iModelConnection.isBlankConnection() || !iModelConnection.isOpen) {\r\n UiFramework.dispatchActionToStore(SessionStateActionId.SetNumItemsSelected, 0);\r\n return;\r\n }\r\n\r\n iModelConnection.selectionSet.onChanged.removeListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n iModelConnection.selectionSet.onChanged.addListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n iModelConnection.iModelId && UiFramework.setActiveIModelId(iModelConnection.iModelId);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SyncUiEventDispatcher.js","sourceRoot":"","sources":["../../../../src/appui-react/syncui/SyncUiEventDispatcher.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAAuE;AACvE,sDAA6C;AAC7C,wDAAmH;AACnH,wDAA6D;AAC7D,gDAA6C;AAE7C,yJAAyJ;AACzJ,yJAAyJ;AACzJ,2JAA2J;AAC3J,wHAAwH;AACxH,6HAA6H;AAE7H;;GAEG;AACH,IAAY,aAwCX;AAxCD,WAAY,aAAa;IACvB,yCAAyC;IACzC,0EAAyD,CAAA;IACzD,qCAAqC;IACrC,oEAAmD,CAAA;IACnD,8EAA8E;IAC9E,8DAA6C,CAAA;IAC7C,iEAAiE;IACjE,gEAA+C,CAAA;IAC/C,kCAAkC;IAClC,kDAAiC,CAAA;IACjC,4CAA4C;IAC5C,kEAAiD,CAAA;IACjD,kFAAkF;IAClF,oEAAmD,CAAA;IACnD,kCAAkC;IAClC,8DAA6C,CAAA;IAC7C,yEAAyE;IACzE,oDAAmC,CAAA;IACnC,oDAAoD;IACpD,kEAAiD,CAAA;IACjD,gDAAgD;IAChD,0DAAyC,CAAA;IACzC,0CAA0C;IAC1C,kEAAiD,CAAA;IACjD,+DAA+D;IAC/D,gDAA+B,CAAA;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C,uBAAuB,EAAE,CAAC;QAElD,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YACpE,yBAAW,CAAC,qBAAqB,CAAC,mCAAoB,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;YAC/E,OAAO;SACR;QAED,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,cAAc,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;QACtG,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,WAAW,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;QACnG,gBAAgB,CAAC,QAAQ,IAAI,yBAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;;AA1Jc,wCAAkB,GAAG,IAAI,kCAAiB,EAAE,CAAC;AAE7C,8CAAwB,GAAsB,EAAE,CAAC;AAHrD,sDAAqB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module SyncUi\r\n */\r\n\r\nimport { UiEventDispatcher, UiSyncEvent } from \"@itwin/appui-abstract\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp, IModelConnection, SelectedViewportChangedArgs, SelectionSetEvent } from \"@itwin/core-frontend\";\r\nimport { SessionStateActionId } from \"../redux/SessionState\";\r\nimport { UiFramework } from \"../UiFramework\";\r\n\r\n// cSpell:ignore activecontentchanged, activitymessageupdated, activitymessagecancelled, backstageevent, contentlayoutactivated, contentcontrolactivated,\r\n// cSpell:ignore elementtooltipchanged, frontstageactivated, inputfieldmessageadded, inputfieldmessageremoved, modalfrontstagechanged, modaldialogchanged\r\n// cSpell:ignore navigationaidactivated, notificationmessageadded, toolactivated, taskactivated, widgetstatechanged, workflowactivated frontstageactivating\r\n// cSpell:ignore frontstageready activeviewportchanged selectionsetchanged presentationselectionchanged viewstatechanged\r\n// cSpell:ignore accudrawcompassmodechanged accudrawfieldlockchanged accudrawrotationchanged uisettingschanged configurableui\r\n\r\n/** Event Id used to sync UI components. Used to refresh visibility or enable state of control.\r\n * @public\r\n */\r\nexport enum SyncUiEventId {\r\n /** AccuDraw compass mode has changed. */\r\n AccuDrawCompassModeChanged = \"accudrawcompassmodechanged\",\r\n /** AccuDraw rotation has changed. */\r\n AccuDrawRotationChanged = \"accudrawrotationchanged\",\r\n /** The active content as maintained by the ContentViewManager has changed. */\r\n ActiveContentChanged = \"activecontentchanged\",\r\n /** The active view maintained by the ViewManager has changed. */\r\n ActiveViewportChanged = \"activeviewportchanged\",\r\n /** Backstage has been toggled. */\r\n BackstageEvent = \"backstageevent\",\r\n /** A Content Layout has been activated. */\r\n ContentLayoutActivated = \"contentlayoutactivated\",\r\n /** A Content Control maintained by UiFramework.frontstages has been activated. */\r\n ContentControlActivated = \"contentcontrolactivated\",\r\n /** A Frontstage is activating. */\r\n FrontstageActivating = \"frontstageactivating\",\r\n /** A Frontstage has been activated and the content has been assigned. */\r\n FrontstageReady = \"frontstageready\",\r\n /** A Modal Frontstage has been opened or closed. */\r\n ModalFrontstageChanged = \"modalfrontstagechanged\",\r\n /** A Modal Dialog has been opened or closed. */\r\n ModalDialogChanged = \"modaldialogchanged\",\r\n /** A NavigationAid has been activated. */\r\n NavigationAidActivated = \"navigationaidactivated\",\r\n /** An InteractiveTool has been activated via the ToolAdmin. */\r\n ToolActivated = \"toolactivated\",\r\n /** The state of a Widget has changed. */\r\n WidgetStateChanged = \"widgetstatechanged\",\r\n /** The SelectionSet for the active IModelConnection has changed. */\r\n SelectionSetChanged = \"selectionsetchanged\",\r\n /** The list of settings providers registered with SettingsManager has changed. */\r\n SettingsProvidersChanged = \"settingsproviderschanged\",\r\n /** The current view state has changed (used by view undo/redo toolbar buttons). */\r\n ViewStateChanged = \"viewstatechanged\",\r\n /** The current object the reads and write UI State has changed. */\r\n UiStateStorageChanged = \"uistatestoragechanged\",\r\n ShowHideManagerSettingChange = \"show-hide-setting-change\",\r\n /** The list of feature overrides applied has been changed */\r\n FeatureOverridesChanged = \"featureoverrideschanged\",\r\n}\r\n\r\n/** This class is used to send eventIds to interested UI components so the component can determine if it needs\r\n * to refresh its display by calling setState on itself.\r\n * @public\r\n */\r\nexport class SyncUiEventDispatcher {\r\n private static _uiEventDispatcher = new UiEventDispatcher();\r\n private static _unregisterListenerFunc?: () => void;\r\n private static _unregisterListenerFuncs: Array<() => void> = [];\r\n\r\n /** @internal - used for testing only */\r\n /* istanbul ignore next */\r\n public static setTimeoutPeriod(period: number): void {\r\n SyncUiEventDispatcher._uiEventDispatcher.setTimeoutPeriod(period);\r\n }\r\n\r\n /** Return set of event ids that will be sent to listeners/. */\r\n public static get syncEventIds(): Set<string> {\r\n return SyncUiEventDispatcher._uiEventDispatcher.syncEventIds;\r\n }\r\n\r\n /** Return SyncUiEvent so callers can register an event callback. */\r\n public static get onSyncUiEvent(): UiSyncEvent {\r\n return SyncUiEventDispatcher._uiEventDispatcher.onSyncUiEvent;\r\n }\r\n\r\n /** Immediately trigger sync event processing. */\r\n public static dispatchImmediateSyncUiEvent(eventId: string): void {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchImmediateSyncUiEvent(eventId);\r\n }\r\n\r\n /** Save eventId in Set for processing. */\r\n public static dispatchSyncUiEvent(eventId: string): void {\r\n if (0 === SyncUiEventDispatcher._uiEventDispatcher.timeoutPeriod) {\r\n Logger.logInfo(UiFramework.loggerCategory(this), `[dispatchSyncUiEvent] not processed because timeoutPeriod=0`);\r\n return;\r\n }\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(eventId);\r\n }\r\n\r\n /** Save multiple eventIds in Set for processing. */\r\n public static dispatchSyncUiEvents(eventIds: string[]): void {\r\n // istanbul ignore if\r\n if (0 === SyncUiEventDispatcher._uiEventDispatcher.timeoutPeriod) {\r\n Logger.logInfo(UiFramework.loggerCategory(this), `[dispatchSyncUiEvents] not processed because _timeoutPeriod=0`);\r\n }\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvents(eventIds);\r\n }\r\n\r\n /** Checks to see if an eventId of interest is contained in the set of eventIds */\r\n public static hasEventOfInterest(eventIds: Set<string>, idsOfInterest: string[]) {\r\n return SyncUiEventDispatcher._uiEventDispatcher.hasEventOfInterest(eventIds, idsOfInterest);\r\n }\r\n\r\n // istanbul ignore next\r\n private static _dispatchViewChange() {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ViewStateChanged);\r\n }\r\n\r\n // istanbul ignore next\r\n private static _dispatchFeatureOverridesChange() {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FeatureOverridesChanged);\r\n }\r\n\r\n /** Initializes the Monitoring of Events that trigger dispatching sync events */\r\n public static initialize() {\r\n // clear any registered listeners - this should only be encountered in unit test scenarios\r\n this._unregisterListenerFuncs.forEach((unregisterListenerFunc) => unregisterListenerFunc());\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onContentControlActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ContentControlActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onContentLayoutActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ContentLayoutActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onFrontstageActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FrontstageActivating);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onFrontstageReadyEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FrontstageReady);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onModalFrontstageChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ModalFrontstageChanged);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onNavigationAidActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.NavigationAidActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ToolActivated);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.frontstages.onWidgetStateChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.WidgetStateChanged);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.backstage.onToggled.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.BackstageEvent);\r\n }));\r\n\r\n this._unregisterListenerFuncs.push(UiFramework.content.onActiveContentChangedEvent.addListener(() => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ActiveContentChanged);\r\n }));\r\n\r\n // istanbul ignore else\r\n if (IModelApp && IModelApp.viewManager) {\r\n this._unregisterListenerFuncs.push(IModelApp.viewManager.onSelectedViewportChanged.addListener((args: SelectedViewportChangedArgs) => {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ActiveViewportChanged);\r\n\r\n // if this is the first view being opened up start the default tool so tool admin is happy.\r\n if (undefined === args.previous) {\r\n IModelApp.toolAdmin.startDefaultTool();// eslint-disable-line @typescript-eslint/no-floating-promises\r\n } else {\r\n // istanbul ignore next\r\n if (args.previous.onViewChanged && typeof args.previous.onViewChanged.removeListener === \"function\") // not set during unit test\r\n args.previous.onViewChanged.removeListener(SyncUiEventDispatcher._dispatchViewChange);\r\n // istanbul ignore next\r\n if (args.previous.onFeatureOverridesChanged && typeof args.previous.onFeatureOverridesChanged.removeListener === \"function\") // not set during unit test\r\n args.previous.onFeatureOverridesChanged.removeListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);\r\n }\r\n // istanbul ignore next\r\n if (args.current) {\r\n if (args.current.onViewChanged && typeof args.current.onViewChanged.addListener === \"function\") // not set during unit test\r\n args.current.onViewChanged.addListener(SyncUiEventDispatcher._dispatchViewChange);\r\n // istanbul ignore next\r\n if (args.current.onFeatureOverridesChanged && typeof args.current.onFeatureOverridesChanged.addListener === \"function\") // not set during unit test\r\n args.current.onFeatureOverridesChanged.addListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);\r\n }\r\n }));\r\n }\r\n }\r\n\r\n private static selectionChangedHandler(_ev: SelectionSetEvent) {\r\n SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.SelectionSetChanged);\r\n }\r\n\r\n /** This should be called by IModelApp when the active IModelConnection is closed. */\r\n public static clearConnectionEvents(iModelConnection: IModelConnection) {\r\n iModelConnection.selectionSet.onChanged.removeListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n SyncUiEventDispatcher._unregisterListenerFunc && SyncUiEventDispatcher._unregisterListenerFunc();\r\n }\r\n\r\n /** This should be called by IModelApp when the active IModelConnection is established. */\r\n public static initializeConnectionEvents(iModelConnection: IModelConnection) {\r\n if (SyncUiEventDispatcher._unregisterListenerFunc)\r\n SyncUiEventDispatcher._unregisterListenerFunc();\r\n\r\n if (iModelConnection.isBlankConnection() || !iModelConnection.isOpen) {\r\n UiFramework.dispatchActionToStore(SessionStateActionId.SetNumItemsSelected, 0);\r\n return;\r\n }\r\n\r\n iModelConnection.selectionSet.onChanged.removeListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n iModelConnection.selectionSet.onChanged.addListener(SyncUiEventDispatcher.selectionChangedHandler);\r\n iModelConnection.iModelId && UiFramework.setActiveIModelId(iModelConnection.iModelId);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,32 @@
1
+ /** @packageDocumentation
2
+ * @module Toolbar
3
+ */
4
+ import * as React from "react";
5
+ import { OnItemExecutedFunc } from "@itwin/appui-abstract";
6
+ import { CommonProps, NoChildrenProps } from "@itwin/core-react";
7
+ import { Direction, ToolbarOpacitySetting, ToolbarPanelAlignment } from "@itwin/components-react";
8
+ import { ToolbarItem } from "./ToolbarItem";
9
+ /** Properties of [[Toolbar]] component.
10
+ * @beta
11
+ */
12
+ export interface ToolbarProps extends CommonProps, NoChildrenProps {
13
+ /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */
14
+ expandsTo?: Direction;
15
+ /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */
16
+ items: ToolbarItem[];
17
+ /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */
18
+ panelAlignment?: ToolbarPanelAlignment;
19
+ /** Use Drag Interaction to open popups with nest action buttons */
20
+ useDragInteraction?: boolean;
21
+ /** Determines whether to use mouse proximity to alter the opacity of the toolbar */
22
+ toolbarOpacitySetting?: ToolbarOpacitySetting;
23
+ /** Optional function to call on any item execution */
24
+ onItemExecuted?: OnItemExecutedFunc;
25
+ /** Optional function to call on any KeyDown events processed by toolbar */
26
+ onKeyDown?: (e: React.KeyboardEvent) => void;
27
+ }
28
+ /** Component that displays toolbar items.
29
+ * @beta
30
+ */
31
+ export declare function Toolbar(props: ToolbarProps): JSX.Element;
32
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAyB,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,eAAe;IAChE,oGAAoG;IACpG,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uGAAuG;IACvG,KAAK,EAAE,WAAW,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;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,eAW1C"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Toolbar
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Toolbar = void 0;
11
+ const React = require("react");
12
+ const components_react_1 = require("@itwin/components-react");
13
+ const toUIAToolbarItem_1 = require("./toUIAToolbarItem");
14
+ /** Component that displays toolbar items.
15
+ * @beta
16
+ */
17
+ function Toolbar(props) {
18
+ const { items, ...other } = props;
19
+ const uiaItems = React.useMemo(() => {
20
+ return items.map((item) => (0, toUIAToolbarItem_1.toUIAToolbarItem)(item));
21
+ }, [items]);
22
+ return (React.createElement(components_react_1.Toolbar // eslint-disable-line deprecation/deprecation
23
+ , { items: uiaItems, ...other }));
24
+ }
25
+ exports.Toolbar = Toolbar;
26
+ //# sourceMappingURL=Toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/Toolbar.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAG/B,8DAAyH;AAEzH,yDAAsD;AAsBtD;;GAEG;AACH,SAAgB,OAAO,CAAC,KAAmB;IACzC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAClC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mCAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,CACL,oBAAC,0BAAU,CAAC,8CAA8C;QACxD,KAAK,EAAE,QAAQ,KACX,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AAXD,0BAWC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Toolbar\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\r\nimport { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\r\nimport { Toolbar as CR_Toolbar, Direction, ToolbarOpacitySetting, ToolbarPanelAlignment } from \"@itwin/components-react\";\r\nimport { ToolbarItem } from \"./ToolbarItem\";\r\nimport { toUIAToolbarItem } from \"./toUIAToolbarItem\";\r\n\r\n/** Properties of [[Toolbar]] component.\r\n * @beta\r\n */\r\nexport interface ToolbarProps extends CommonProps, NoChildrenProps {\r\n /** Describes to which direction the popup panels are expanded. Defaults to: [[Direction.Bottom]] */\r\n expandsTo?: Direction;\r\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\r\n items: ToolbarItem[];\r\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\r\n panelAlignment?: ToolbarPanelAlignment;\r\n /** Use Drag Interaction to open popups with nest action buttons */\r\n useDragInteraction?: boolean;\r\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\r\n toolbarOpacitySetting?: ToolbarOpacitySetting;\r\n /** Optional function to call on any item execution */\r\n onItemExecuted?: OnItemExecutedFunc;\r\n /** Optional function to call on any KeyDown events processed by toolbar */\r\n onKeyDown?: (e: React.KeyboardEvent) => void;\r\n}\r\n\r\n/** Component that displays toolbar items.\r\n * @beta\r\n */\r\nexport function Toolbar(props: ToolbarProps) {\r\n const { items, ...other } = props;\r\n const uiaItems = React.useMemo(() => {\r\n return items.map((item) => toUIAToolbarItem(item));\r\n }, [items]);\r\n return (\r\n <CR_Toolbar // eslint-disable-line deprecation/deprecation\r\n items={uiaItems}\r\n {...other}\r\n />\r\n );\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAYH,OAAO,EAAgF,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqM5J;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,eAqC5D"}
1
+ {"version":3,"file":"ToolbarComposer.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAYH,OAAO,EAAgF,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqM5J;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;IACpB,2BAA2B;IAC3B,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,eAoC5D"}
@@ -20,7 +20,7 @@ const useDefaultToolbarItems_1 = require("./useDefaultToolbarItems");
20
20
  const useUiItemsProviderToolbarItems_1 = require("./useUiItemsProviderToolbarItems");
21
21
  const ToolbarItem_1 = require("./ToolbarItem");
22
22
  const ToolbarItemsManager_1 = require("./ToolbarItemsManager");
23
- const toUIAToolbarItem_1 = require("./toUIAToolbarItem");
23
+ const ToolbarWithOverflow_1 = require("./ToolbarWithOverflow");
24
24
  /** Private function to set up sync event monitoring of toolbar items */
25
25
  function useToolbarItemSyncEffect(uiDataProvider, syncIdsOfInterest) {
26
26
  React.useEffect(() => {
@@ -207,16 +207,15 @@ function ToolbarComposer(props) {
207
207
  const addonItems = (0, useUiItemsProviderToolbarItems_1.useUiItemsProviderToolbarItems)(addonItemsManager, usage, orientation);
208
208
  const addonSyncIdsOfInterest = React.useMemo(() => ToolbarItemsManager_1.ToolbarItemsManager.getSyncIdsOfInterest(addonItems), [addonItems]);
209
209
  useToolbarItemSyncEffect(addonItemsManager, addonSyncIdsOfInterest);
210
- const toolbarItems = React.useMemo(() => {
211
- const items = combineItems(defaultItems, addonItems);
212
- return items.map((item) => (0, toUIAToolbarItem_1.toUIAToolbarItem)(item));
210
+ const items = React.useMemo(() => {
211
+ return combineItems(defaultItems, addonItems);
213
212
  }, [defaultItems, addonItems]);
214
213
  const toolbarOrientation = orientation === ToolbarItem_1.ToolbarOrientation.Horizontal ? core_react_1.Orientation.Horizontal : core_react_1.Orientation.Vertical;
215
214
  const expandsTo = toolbarOrientation === core_react_1.Orientation.Horizontal ? components_react_1.Direction.Bottom : usage === ToolbarItem_1.ToolbarUsage.ViewNavigation ? components_react_1.Direction.Left : components_react_1.Direction.Right;
216
215
  const panelAlignment = (toolbarOrientation === core_react_1.Orientation.Horizontal && usage === ToolbarItem_1.ToolbarUsage.ViewNavigation) ? components_react_1.ToolbarPanelAlignment.End : components_react_1.ToolbarPanelAlignment.Start;
217
216
  const isDragEnabled = React.useContext(DragInteraction_1.ToolbarDragInteractionContext);
218
217
  const useProximityOpacity = useProximityOpacitySetting();
219
- return React.createElement(components_react_1.ToolbarWithOverflow, { expandsTo: expandsTo, panelAlignment: panelAlignment, items: toolbarItems, useDragInteraction: isDragEnabled, toolbarOpacitySetting: useProximityOpacity && !UiFramework_1.UiFramework.isMobile() ? components_react_1.ToolbarOpacitySetting.Proximity : /* istanbul ignore next */ components_react_1.ToolbarOpacitySetting.Defaults });
218
+ return React.createElement(ToolbarWithOverflow_1.ToolbarWithOverflow, { expandsTo: expandsTo, panelAlignment: panelAlignment, items: items, useDragInteraction: isDragEnabled, toolbarOpacitySetting: useProximityOpacity && !UiFramework_1.UiFramework.isMobile() ? components_react_1.ToolbarOpacitySetting.Proximity : /* istanbul ignore next */ components_react_1.ToolbarOpacitySetting.Defaults });
220
219
  }
221
220
  exports.ToolbarComposer = ToolbarComposer;
222
221
  //# sourceMappingURL=ToolbarComposer.js.map