@itwin/appui-react 4.0.0-dev.15 → 4.0.0-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/appui-react/UiFramework.d.ts +6 -4
- package/lib/cjs/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/cjs/appui-react/UiFramework.js +6 -4
- package/lib/cjs/appui-react/UiFramework.js.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.d.ts +6 -2
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
- package/lib/cjs/appui-react/framework/FrameworkFrontstages.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageConfig.d.ts +5 -0
- package/lib/cjs/appui-react/frontstage/FrontstageConfig.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageConfig.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +4 -2
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +29 -4
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts +6 -2
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js +5 -1
- package/lib/cjs/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.d.ts +5 -0
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js +1 -0
- package/lib/cjs/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/cjs/appui-react/popup/CardPopup.js +2 -1
- package/lib/cjs/appui-react/popup/CardPopup.js.map +1 -1
- package/lib/cjs/appui-react/popup/ToolbarPopup.d.ts.map +1 -1
- package/lib/cjs/appui-react/popup/ToolbarPopup.js +2 -3
- package/lib/cjs/appui-react/popup/ToolbarPopup.js.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts +13 -197
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js +32 -4
- package/lib/cjs/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/SelectionScope.d.ts +3 -10
- package/lib/cjs/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/SelectionScope.js +17 -24
- package/lib/cjs/appui-react/statusfields/SelectionScope.js.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts +3 -24
- package/lib/cjs/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/cjs/appui-react/statusfields/SnapMode.js +43 -72
- package/lib/cjs/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts +4 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js +12 -0
- package/lib/cjs/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts +32 -0
- package/lib/cjs/appui-react/toolbar/Toolbar.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/Toolbar.js +26 -0
- package/lib/cjs/appui-react/toolbar/Toolbar.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js +4 -5
- package/lib/cjs/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts +34 -0
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -0
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js +26 -0
- package/lib/cjs/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -0
- package/lib/cjs/appui-react/toolbar/toUIAToolbarItem.js +1 -1
- package/lib/cjs/appui-react/toolbar/toUIAToolbarItem.js.map +1 -1
- package/lib/cjs/appui-react/tools/RestoreLayoutTool.d.ts +2 -2
- package/lib/cjs/appui-react/tools/RestoreLayoutTool.js +2 -2
- package/lib/cjs/appui-react/tools/RestoreLayoutTool.js.map +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.d.ts +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js +1 -1
- package/lib/cjs/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +7 -6
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react/widgets/WidgetDef.d.ts +2 -2
- package/lib/cjs/appui-react/widgets/WidgetDef.js +2 -2
- package/lib/cjs/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +2 -0
- package/lib/cjs/appui-react.d.ts.map +1 -1
- package/lib/cjs/appui-react.js +2 -0
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/UiFramework.d.ts +6 -4
- package/lib/esm/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/esm/appui-react/UiFramework.js +6 -4
- package/lib/esm/appui-react/UiFramework.js.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkFrontstages.d.ts +6 -2
- package/lib/esm/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
- package/lib/esm/appui-react/framework/FrameworkFrontstages.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageConfig.d.ts +5 -0
- package/lib/esm/appui-react/frontstage/FrontstageConfig.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageConfig.js.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +4 -2
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +29 -4
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts +6 -2
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js +5 -1
- package/lib/esm/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.d.ts +5 -0
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js +1 -0
- package/lib/esm/appui-react/frontstage/StandardFrontstageProvider.js.map +1 -1
- package/lib/esm/appui-react/popup/CardPopup.js +2 -1
- package/lib/esm/appui-react/popup/CardPopup.js.map +1 -1
- package/lib/esm/appui-react/popup/ToolbarPopup.d.ts.map +1 -1
- package/lib/esm/appui-react/popup/ToolbarPopup.js +3 -4
- package/lib/esm/appui-react/popup/ToolbarPopup.js.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts +13 -197
- package/lib/esm/appui-react/stagepanels/StagePanelDef.d.ts.map +1 -1
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js +31 -3
- package/lib/esm/appui-react/stagepanels/StagePanelDef.js.map +1 -1
- package/lib/esm/appui-react/statusfields/SelectionScope.d.ts +3 -10
- package/lib/esm/appui-react/statusfields/SelectionScope.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/SelectionScope.js +17 -24
- package/lib/esm/appui-react/statusfields/SelectionScope.js.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts +3 -24
- package/lib/esm/appui-react/statusfields/SnapMode.d.ts.map +1 -1
- package/lib/esm/appui-react/statusfields/SnapMode.js +43 -72
- package/lib/esm/appui-react/statusfields/SnapMode.js.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts +4 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.d.ts.map +1 -1
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js +12 -0
- package/lib/esm/appui-react/syncui/SyncUiEventDispatcher.js.map +1 -1
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts +32 -0
- package/lib/esm/appui-react/toolbar/Toolbar.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/Toolbar.js +22 -0
- package/lib/esm/appui-react/toolbar/Toolbar.js.map +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js +5 -6
- package/lib/esm/appui-react/toolbar/ToolbarComposer.js.map +1 -1
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts +34 -0
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -0
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js +22 -0
- package/lib/esm/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -0
- package/lib/esm/appui-react/toolbar/toUIAToolbarItem.js +1 -1
- package/lib/esm/appui-react/toolbar/toUIAToolbarItem.js.map +1 -1
- package/lib/esm/appui-react/tools/RestoreLayoutTool.d.ts +2 -2
- package/lib/esm/appui-react/tools/RestoreLayoutTool.js +2 -2
- package/lib/esm/appui-react/tools/RestoreLayoutTool.js.map +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.d.ts +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.d.ts.map +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js +1 -1
- package/lib/esm/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +7 -6
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react/widgets/WidgetDef.d.ts +2 -2
- package/lib/esm/appui-react/widgets/WidgetDef.js +2 -2
- package/lib/esm/appui-react/widgets/WidgetDef.js.map +1 -1
- package/lib/esm/appui-react.d.ts +2 -0
- package/lib/esm/appui-react.d.ts.map +1 -1
- package/lib/esm/appui-react.js +2 -0
- package/lib/esm/appui-react.js.map +1 -1
- package/lib/public/locales/en/UiFramework.json +0 -5
- package/package.json +11 -10
|
@@ -20,30 +20,23 @@ import { UiFramework } from "../UiFramework";
|
|
|
20
20
|
* in the Redux state.
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
render() {
|
|
41
|
-
return (React.createElement(FooterIndicator, { className: classnames("uifw-statusFields-selectionScope", this.props.className), style: this.props.style },
|
|
42
|
-
React.createElement("label", { className: "uifw-statusFields-selectionScope-label" },
|
|
43
|
-
this._label,
|
|
44
|
-
":"),
|
|
45
|
-
React.createElement(Select, { className: "uifw-statusFields-selectionScope-selector", value: this.props.activeSelectionScope, options: this._scopeOptions, onChange: this._updateSelectValue, "data-testid": "components-selectionScope-selector", title: this._toolTip, size: "small" })));
|
|
46
|
-
}
|
|
23
|
+
function SelectionScopeFieldComponent(props) {
|
|
24
|
+
const label = UiFramework.translate("selectionScopeField.label");
|
|
25
|
+
const toolTip = UiFramework.translate("selectionScopeField.toolTip");
|
|
26
|
+
const options = React.useMemo(() => props.availableSelectionScopes.map((scope) => {
|
|
27
|
+
return { value: scope.id, label: scope.label };
|
|
28
|
+
}), [props.availableSelectionScopes]);
|
|
29
|
+
const updateSelectValue = (newValue) => {
|
|
30
|
+
// istanbul ignore else
|
|
31
|
+
if (newValue) {
|
|
32
|
+
UiFramework.setActiveSelectionScope(newValue);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return (React.createElement(FooterIndicator, { className: classnames("uifw-statusFields-selectionScope", props.className), style: props.style },
|
|
36
|
+
React.createElement("label", { className: "uifw-statusFields-selectionScope-label" },
|
|
37
|
+
label,
|
|
38
|
+
":"),
|
|
39
|
+
React.createElement(Select, { className: "uifw-statusFields-selectionScope-selector", value: props.activeSelectionScope, options: options, onChange: updateSelectValue, "data-testid": "components-selectionScope-selector", title: toolTip, size: "small" })));
|
|
47
40
|
}
|
|
48
41
|
/** Function used by Redux to map state data in Redux store to props that are used to render this component. */
|
|
49
42
|
function mapStateToProps(state) {
|
|
@@ -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,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SelectionScope.js","sourceRoot":"","sources":["../../../../src/appui-react/statusfields/SelectionScope.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa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AAED,+GAA+G;AAC/G,SAAS,eAAe,CAAC,KAAU;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,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;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,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
|
-
|
|
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
|
|
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<
|
|
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
|
|
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"}
|
|
@@ -9,7 +9,6 @@ import * as React from "react";
|
|
|
9
9
|
import { connect } from "react-redux";
|
|
10
10
|
import { SnapMode } from "@itwin/core-frontend";
|
|
11
11
|
import { Snap, SnapModePanel } from "@itwin/appui-layout-react";
|
|
12
|
-
import { ConfigurableUiActions } from "../configurableui/state";
|
|
13
12
|
import { UiFramework } from "../UiFramework";
|
|
14
13
|
import { Icon } from "@itwin/core-react";
|
|
15
14
|
import { StatusBarLabelIndicator } from "../statusbar/LabelIndicator";
|
|
@@ -21,34 +20,50 @@ import snapModeNearest from "@bentley/icons-generic/icons/snaps-nearest.svg";
|
|
|
21
20
|
import snapModeOrigin from "@bentley/icons-generic/icons/snaps-origin.svg";
|
|
22
21
|
import snapModeMidpoint from "@bentley/icons-generic/icons/snaps-midpoint.svg";
|
|
23
22
|
import snapModeBisector from "@bentley/icons-generic/icons/snaps-bisector.svg";
|
|
23
|
+
function getIconFromIconName(iconName) {
|
|
24
|
+
let iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);
|
|
25
|
+
switch (iconName) {
|
|
26
|
+
case "snaps":
|
|
27
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);
|
|
28
|
+
break;
|
|
29
|
+
case "snaps-intersection":
|
|
30
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeIntersection);
|
|
31
|
+
break;
|
|
32
|
+
case "snaps-center":
|
|
33
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeCenter);
|
|
34
|
+
break;
|
|
35
|
+
case "snaps-nearest":
|
|
36
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeNearest);
|
|
37
|
+
break;
|
|
38
|
+
case "snaps-origin":
|
|
39
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeOrigin);
|
|
40
|
+
break;
|
|
41
|
+
case "snaps-midpoint":
|
|
42
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeMidpoint);
|
|
43
|
+
break;
|
|
44
|
+
case "snaps-bisector":
|
|
45
|
+
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeBisector);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return iconSpec;
|
|
49
|
+
}
|
|
24
50
|
/**
|
|
25
51
|
* Snap Mode Field React component. This component is designed to be specified in a status bar definition. It will
|
|
26
52
|
* display the active snap mode that AccuSnap will use and allow the user to select a new snap mode.
|
|
27
53
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{ label: UiFramework.translate("snapModeField.bisector"), value: SnapMode.Bisector, iconName: "snaps-bisector" },
|
|
39
|
-
];
|
|
40
|
-
this._title = UiFramework.translate("snapModeField.snapMode");
|
|
41
|
-
this.state = {
|
|
42
|
-
target: null,
|
|
43
|
-
};
|
|
44
|
-
/** Called when user clicks on a Snap Mode entry in the pop-up window. */
|
|
45
|
-
this._handleSnapModeFieldClick = (snapModeField) => {
|
|
46
|
-
this.props.setSnapMode(snapModeField);
|
|
47
|
-
};
|
|
48
|
-
}
|
|
54
|
+
function SnapModeFieldComponent(props) {
|
|
55
|
+
const snapModes = React.useMemo(() => [
|
|
56
|
+
{ label: UiFramework.translate("snapModeField.keypoint"), value: SnapMode.NearestKeypoint, iconName: "snaps" },
|
|
57
|
+
{ label: UiFramework.translate("snapModeField.intersection"), value: SnapMode.Intersection, iconName: "snaps-intersection" },
|
|
58
|
+
{ label: UiFramework.translate("snapModeField.center"), value: SnapMode.Center, iconName: "snaps-center" },
|
|
59
|
+
{ label: UiFramework.translate("snapModeField.nearest"), value: SnapMode.Nearest, iconName: "snaps-nearest" },
|
|
60
|
+
{ label: UiFramework.translate("snapModeField.origin"), value: SnapMode.Origin, iconName: "snaps-origin" },
|
|
61
|
+
{ label: UiFramework.translate("snapModeField.midpoint"), value: SnapMode.MidPoint, iconName: "snaps-midpoint" },
|
|
62
|
+
{ label: UiFramework.translate("snapModeField.bisector"), value: SnapMode.Bisector, iconName: "snaps-bisector" },
|
|
63
|
+
], []);
|
|
49
64
|
/** Return icon class name for a specific snapMode. */
|
|
50
|
-
getSnapModeIconNameFromMode(snapMode) {
|
|
51
|
-
for (const mode of
|
|
65
|
+
const getSnapModeIconNameFromMode = React.useCallback(function (snapMode) {
|
|
66
|
+
for (const mode of snapModes) {
|
|
52
67
|
if (mode.value === snapMode)
|
|
53
68
|
return mode.iconName;
|
|
54
69
|
}
|
|
@@ -57,54 +72,10 @@ class SnapModeFieldComponent extends React.Component {
|
|
|
57
72
|
return "snaps-multione";
|
|
58
73
|
/* istanbul ignore next */
|
|
59
74
|
return "placeholder";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return (React.createElement(React.Fragment, null,
|
|
64
|
-
React.createElement(StatusBarLabelIndicator, { iconSpec: `${this.getIconFromIconName(`${this.getSnapModeIconNameFromMode(this.props.snapMode)}`)}`, title: this._title, label: this._title, popup: React.createElement(SnapModePanel, { title: this._title }, this.getSnapEntries()) })));
|
|
65
|
-
}
|
|
66
|
-
/** Return an IconSpec with a web component icon to replace the icons that we used to load from the webfont */
|
|
67
|
-
getIconFromIconName(iconName) {
|
|
68
|
-
let iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);
|
|
69
|
-
switch (iconName) {
|
|
70
|
-
case "snaps":
|
|
71
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeKeypoint);
|
|
72
|
-
break;
|
|
73
|
-
case "snaps-intersection":
|
|
74
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeIntersection);
|
|
75
|
-
break;
|
|
76
|
-
case "snaps-center":
|
|
77
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeCenter);
|
|
78
|
-
break;
|
|
79
|
-
case "snaps-nearest":
|
|
80
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeNearest);
|
|
81
|
-
break;
|
|
82
|
-
case "snaps-origin":
|
|
83
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeOrigin);
|
|
84
|
-
break;
|
|
85
|
-
case "snaps-midpoint":
|
|
86
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeMidpoint);
|
|
87
|
-
break;
|
|
88
|
-
case "snaps-bisector":
|
|
89
|
-
iconSpec = IconSpecUtilities.createWebComponentIconSpec(snapModeBisector);
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
return iconSpec;
|
|
93
|
-
}
|
|
94
|
-
/** Return array of SnapRow elements, one for each support snap mode. This array will populate the pop-up used
|
|
95
|
-
* to select a SnapMode.
|
|
96
|
-
*/
|
|
97
|
-
getSnapEntries() {
|
|
98
|
-
return this._snapModeFieldArray.map((item, index) => {
|
|
99
|
-
const iconSpec = this.getIconFromIconName(item.iconName);
|
|
100
|
-
return (React.createElement(Snap, { key: `SM_${index}`, onClick: () => this._handleSnapModeFieldClick(item.value), isActive: (this.props.snapMode & item.value) === item.value, icon: React.createElement(Icon, { className: `icon`, iconSpec: iconSpec }) }, item.label));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
75
|
+
}, [snapModes]);
|
|
76
|
+
const title = UiFramework.translate("snapModeField.snapMode");
|
|
77
|
+
return (React.createElement(StatusBarLabelIndicator, { iconSpec: getIconFromIconName(getSnapModeIconNameFromMode(props.snapMode)), title: title, label: title, popup: React.createElement(SnapModePanel, { title: title }, snapModes.map((item, index) => React.createElement(Snap, { key: `SM_${index}`, onClick: () => UiFramework.setAccudrawSnapMode(item.value), isActive: (props.snapMode & item.value) === item.value, icon: React.createElement(Icon, { className: `icon`, iconSpec: getIconFromIconName(item.iconName) }) }, item.label))) }));
|
|
103
78
|
}
|
|
104
|
-
// Used by Redux to map dispatch functions to props entry. This requires SnapModeFieldProps interface above to include a setSnapMode entry */
|
|
105
|
-
const mapDispatch = {
|
|
106
|
-
setSnapMode: ConfigurableUiActions.setSnapMode,
|
|
107
|
-
};
|
|
108
79
|
/** Function used by Redux to map state data in Redux store to props that are used to render this component. */
|
|
109
80
|
function mapStateToProps(state) {
|
|
110
81
|
const frameworkState = state[UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name
|
|
@@ -120,5 +91,5 @@ function mapStateToProps(state) {
|
|
|
120
91
|
* This Field React component is Redux connected.
|
|
121
92
|
* @public
|
|
122
93
|
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
123
|
-
export const SnapModeField = connect(mapStateToProps
|
|
94
|
+
export const SnapModeField = connect(mapStateToProps)(SnapModeFieldComponent);
|
|
124
95
|
//# sourceMappingURL=SnapMode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapMode.js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AW,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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAe,IAAI,EAAY,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,oBAAoB,MAAM,qDAAqD,CAAC;AACvF,OAAO,cAAc,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AC","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 { 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,mFAAmF;IACnF,gBAAgB,qBAAqB;IACrC,mEAAmE;IACnE,qBAAqB,0BAA0B;IAC/C,4BAA4B,6BAA6B;
|
|
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,mFAAmF;IACnF,gBAAgB,qBAAqB;IACrC,mEAAmE;IACnE,qBAAqB,0BAA0B;IAC/C,4BAA4B,6BAA6B;IACzD,6DAA6D;IAC7D,uBAAuB,4BAA4B;CACpD;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA2B;IAC5D,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAa;IACpD,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAyB;IAEhE,wCAAwC;WAE1B,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpD,+DAA+D;IAC/D,WAAkB,YAAY,IAAI,GAAG,CAAC,MAAM,CAAC,CAE5C;IAED,oEAAoE;IACpE,WAAkB,aAAa,IAAI,WAAW,CAE7C;IAED,iDAAiD;WACnC,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjE,0CAA0C;WAC5B,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"}
|
|
@@ -57,6 +57,8 @@ export var SyncUiEventId;
|
|
|
57
57
|
/** The current object the reads and write UI State has changed. */
|
|
58
58
|
SyncUiEventId["UiStateStorageChanged"] = "uistatestoragechanged";
|
|
59
59
|
SyncUiEventId["ShowHideManagerSettingChange"] = "show-hide-setting-change";
|
|
60
|
+
/** The list of feature overrides applied has been changed */
|
|
61
|
+
SyncUiEventId["FeatureOverridesChanged"] = "featureoverrideschanged";
|
|
60
62
|
})(SyncUiEventId || (SyncUiEventId = {}));
|
|
61
63
|
/** This class is used to send eventIds to interested UI components so the component can determine if it needs
|
|
62
64
|
* to refresh its display by calling setState on itself.
|
|
@@ -104,6 +106,10 @@ class SyncUiEventDispatcher {
|
|
|
104
106
|
static _dispatchViewChange() {
|
|
105
107
|
SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.ViewStateChanged);
|
|
106
108
|
}
|
|
109
|
+
// istanbul ignore next
|
|
110
|
+
static _dispatchFeatureOverridesChange() {
|
|
111
|
+
SyncUiEventDispatcher._uiEventDispatcher.dispatchSyncUiEvent(SyncUiEventId.FeatureOverridesChanged);
|
|
112
|
+
}
|
|
107
113
|
/** Initializes the Monitoring of Events that trigger dispatching sync events */
|
|
108
114
|
static initialize() {
|
|
109
115
|
// clear any registered listeners - this should only be encountered in unit test scenarios
|
|
@@ -150,11 +156,17 @@ class SyncUiEventDispatcher {
|
|
|
150
156
|
// istanbul ignore next
|
|
151
157
|
if (args.previous.onViewChanged && typeof args.previous.onViewChanged.removeListener === "function") // not set during unit test
|
|
152
158
|
args.previous.onViewChanged.removeListener(SyncUiEventDispatcher._dispatchViewChange);
|
|
159
|
+
// istanbul ignore next
|
|
160
|
+
if (args.previous.onFeatureOverridesChanged && typeof args.previous.onFeatureOverridesChanged.removeListener === "function") // not set during unit test
|
|
161
|
+
args.previous.onFeatureOverridesChanged.removeListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);
|
|
153
162
|
}
|
|
154
163
|
// istanbul ignore next
|
|
155
164
|
if (args.current) {
|
|
156
165
|
if (args.current.onViewChanged && typeof args.current.onViewChanged.addListener === "function") // not set during unit test
|
|
157
166
|
args.current.onViewChanged.addListener(SyncUiEventDispatcher._dispatchViewChange);
|
|
167
|
+
// istanbul ignore next
|
|
168
|
+
if (args.current.onFeatureOverridesChanged && typeof args.current.onFeatureOverridesChanged.addListener === "function") // not set during unit test
|
|
169
|
+
args.current.onFeatureOverridesChanged.addListener(SyncUiEventDispatcher._dispatchFeatureOverridesChange);
|
|
158
170
|
}
|
|
159
171
|
}));
|
|
160
172
|
}
|
|
@@ -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,OAAO,EAAE,iBAAiB,EAAe,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAoE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,yJAAyJ;AACzJ,yJAAyJ;AACzJ,2JAA2J;AAC3J,wHAAwH;AACxH,6HAA6H;AAE7H;;GAEG;AACH,MAAM,CAAN,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,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;IAC/B,yCAAyC;IACzC,0DAAyC,CAAA;IACzC,oEAAoE;IACpE,4DAA2C,CAAA;I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C;IAEO,MAAM,CAAC,uBAAuB,CAAC,GAAsB;QAC3D,qBAAqB,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAClG,CAAC;IAED,qFAAqF;IAC9E,MAAM,CAAC,qBAAqB,CAAC,gBAAkC;QACpE,gBAAgB,CAAC,YAAY,CAAC,SAAS,CAAC,cAAc,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;QACtG,qBAAqB,CAAC,uBAAuB,IAAI,qBAAqB,CAAC,uBAAuB,EAAE,CAAC;IACnG,CAAC;IAED,0FAA0F;IACnF,MAAM,CAAC,0BAA0B,CAAC,gBAAkC;QACzE,IAAI,qBAAqB,CAAC,uBAAuB;YAC/C,qBAAqB,CAAC,uBAAuB,EAAE,CAAC;QAElD,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YACpE,WAAW,CAAC,qBAAqB,CAAC,oBAAoB,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,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;;AA/Ic,wCAAkB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE7C,8CAAwB,GAAsB,EAAE,CAAC;SAHrD,qBAAqB","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,OAAO,EAAE,iBAAiB,EAAe,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAoE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,yJAAyJ;AACzJ,yJAAyJ;AACzJ,2JAA2J;AAC3J,wHAAwH;AACxH,6HAA6H;AAE7H;;GAEG;AACH,MAAM,CAAN,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;IAC/B,yCAAyC;IACzC,0DAAyC,CAAA;IACzC,oEAAoE;IACpE,4DAA2C,CAAA;IAC3C,kFAAkF;IAClF,sEAAqD,CAAA;IACrD,mFAAmF;IACnF,s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AAC,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,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;;AA1Jc,wCAAkB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE7C,8CAAwB,GAAsB,EAAE,CAAC;SAHrD,qBAAqB","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,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Toolbar
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Toolbar as CR_Toolbar } from "@itwin/components-react";
|
|
10
|
+
import { toUIAToolbarItem } from "./toUIAToolbarItem";
|
|
11
|
+
/** Component that displays toolbar items.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export function Toolbar(props) {
|
|
15
|
+
const { items, ...other } = props;
|
|
16
|
+
const uiaItems = React.useMemo(() => {
|
|
17
|
+
return items.map((item) => toUIAToolbarItem(item));
|
|
18
|
+
}, [items]);
|
|
19
|
+
return (React.createElement(CR_Toolbar // eslint-disable-line deprecation/deprecation
|
|
20
|
+
, { items: uiaItems, ...other }));
|
|
21
|
+
}
|
|
22
|
+
//# 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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,OAAO,IAAI,UAAU,EAA2D,MAAM,yBAAyB,CAAC;AAEzH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsBtD;;GAEG;AACH,MAAM,UAAU,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,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,CACL,oBAAC,UAAU,CAAC,8CAA8C;QACxD,KAAK,EAAE,QAAQ,KACX,KAAK,GACT,CACH,CAAC;AACJ,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 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,
|
|
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"}
|