@itwin/appui-react 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/lib/appui-react/UiFramework.d.ts +6 -2
- package/lib/appui-react/UiFramework.d.ts.map +1 -1
- package/lib/appui-react/UiFramework.js +29 -2
- package/lib/appui-react/UiFramework.js.map +1 -1
- package/lib/appui-react/accudraw/AccuDrawFieldContainer.d.ts.map +1 -1
- package/lib/appui-react/accudraw/AccuDrawFieldContainer.js +4 -4
- package/lib/appui-react/accudraw/AccuDrawFieldContainer.js.map +1 -1
- package/lib/appui-react/accudraw/AccuDrawPopupManager.d.ts.map +1 -1
- package/lib/appui-react/accudraw/AccuDrawPopupManager.js +10 -6
- package/lib/appui-react/accudraw/AccuDrawPopupManager.js.map +1 -1
- package/lib/appui-react/accudraw/Calculator.js +2 -2
- package/lib/appui-react/accudraw/Calculator.js.map +1 -1
- package/lib/appui-react/childwindow/ChildWindowRenderer.d.ts +2 -0
- package/lib/appui-react/childwindow/ChildWindowRenderer.d.ts.map +1 -1
- package/lib/appui-react/childwindow/ChildWindowRenderer.js +15 -10
- package/lib/appui-react/childwindow/ChildWindowRenderer.js.map +1 -1
- package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts +23 -1
- package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/appui-react/configurableui/ConfigurableUiContent.js +20 -12
- package/lib/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/appui-react/content/ContentLayout.js +10 -11
- package/lib/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/appui-react/content/ContentOverlay.d.ts +1 -0
- package/lib/appui-react/content/ContentOverlay.d.ts.map +1 -1
- package/lib/appui-react/content/ContentOverlay.js +3 -1
- package/lib/appui-react/content/ContentOverlay.js.map +1 -1
- package/lib/appui-react/content/FloatingViewportContent.d.ts.map +1 -1
- package/lib/appui-react/content/FloatingViewportContent.js +1 -1
- package/lib/appui-react/content/FloatingViewportContent.js.map +1 -1
- package/lib/appui-react/cursor/CursorInformation.d.ts +4 -1
- package/lib/appui-react/cursor/CursorInformation.d.ts.map +1 -1
- package/lib/appui-react/cursor/CursorInformation.js +6 -1
- package/lib/appui-react/cursor/CursorInformation.js.map +1 -1
- package/lib/appui-react/cursor/cursormenu/CursorMenu.d.ts +1 -24
- package/lib/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
- package/lib/appui-react/cursor/cursormenu/CursorMenu.js +37 -58
- package/lib/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
- package/lib/appui-react/cursor/cursorpopup/CursorPopup.scss +3 -0
- package/lib/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts +8 -22
- package/lib/appui-react/cursor/cursorpopup/CursorPopupManager.d.ts.map +1 -1
- package/lib/appui-react/cursor/cursorpopup/CursorPopupManager.js +109 -116
- package/lib/appui-react/cursor/cursorpopup/CursorPopupManager.js.map +1 -1
- package/lib/appui-react/cursor/cursorprompt/CursorPrompt.d.ts +12 -15
- package/lib/appui-react/cursor/cursorprompt/CursorPrompt.d.ts.map +1 -1
- package/lib/appui-react/cursor/cursorprompt/CursorPrompt.js +85 -48
- package/lib/appui-react/cursor/cursorprompt/CursorPrompt.js.map +1 -1
- package/lib/appui-react/framework/FrameworkFrontstages.d.ts +47 -0
- package/lib/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
- package/lib/appui-react/framework/FrameworkFrontstages.js +136 -0
- package/lib/appui-react/framework/FrameworkFrontstages.js.map +1 -1
- package/lib/appui-react/framework/FrameworkVisibility.d.ts +2 -0
- package/lib/appui-react/framework/FrameworkVisibility.d.ts.map +1 -1
- package/lib/appui-react/framework/FrameworkVisibility.js.map +1 -1
- package/lib/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
- package/lib/appui-react/frontstage/InternalFrontstageManager.js +121 -115
- package/lib/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
- package/lib/appui-react/hooks/useActiveTool.d.ts +9 -0
- package/lib/appui-react/hooks/useActiveTool.d.ts.map +1 -0
- package/lib/appui-react/hooks/useActiveTool.js +23 -0
- package/lib/appui-react/hooks/useActiveTool.js.map +1 -0
- package/lib/appui-react/icons/SvgAngle.d.ts +7 -0
- package/lib/appui-react/icons/SvgAngle.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgAngle.js +15 -0
- package/lib/appui-react/icons/SvgAngle.js.map +1 -0
- package/lib/appui-react/icons/SvgBackspace.d.ts +7 -0
- package/lib/appui-react/icons/SvgBackspace.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgBackspace.js +14 -0
- package/lib/appui-react/icons/SvgBackspace.js.map +1 -0
- package/lib/appui-react/icons/SvgDistance.d.ts +7 -0
- package/lib/appui-react/icons/SvgDistance.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgDistance.js +16 -0
- package/lib/appui-react/icons/SvgDistance.js.map +1 -0
- package/lib/appui-react/icons/SvgHeight.d.ts +7 -0
- package/lib/appui-react/icons/SvgHeight.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgHeight.js +17 -0
- package/lib/appui-react/icons/SvgHeight.js.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickLeftDrag.d.ts +7 -0
- package/lib/appui-react/icons/SvgMouseClickLeftDrag.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickLeftDrag.js +15 -0
- package/lib/appui-react/icons/SvgMouseClickLeftDrag.js.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickRightDrag.d.ts +7 -0
- package/lib/appui-react/icons/SvgMouseClickRightDrag.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickRightDrag.js +15 -0
- package/lib/appui-react/icons/SvgMouseClickRightDrag.js.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickWheelDrag.d.ts +7 -0
- package/lib/appui-react/icons/SvgMouseClickWheelDrag.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgMouseClickWheelDrag.js +15 -0
- package/lib/appui-react/icons/SvgMouseClickWheelDrag.js.map +1 -0
- package/lib/appui-react/icons/SvgTouchCursorPan.d.ts +7 -0
- package/lib/appui-react/icons/SvgTouchCursorPan.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgTouchCursorPan.js +15 -0
- package/lib/appui-react/icons/SvgTouchCursorPan.js.map +1 -0
- package/lib/appui-react/icons/SvgTouchCursorPoint.d.ts +7 -0
- package/lib/appui-react/icons/SvgTouchCursorPoint.d.ts.map +1 -0
- package/lib/appui-react/icons/SvgTouchCursorPoint.js +16 -0
- package/lib/appui-react/icons/SvgTouchCursorPoint.js.map +1 -0
- package/lib/appui-react/layout/StandardLayout.scss +3 -8
- package/lib/appui-react/layout/base/DragManager.d.ts.map +1 -1
- package/lib/appui-react/layout/base/DragManager.js +10 -15
- package/lib/appui-react/layout/base/DragManager.js.map +1 -1
- package/lib/appui-react/layout/state/NineZoneAction.d.ts +1 -0
- package/lib/appui-react/layout/state/NineZoneAction.d.ts.map +1 -1
- package/lib/appui-react/layout/state/NineZoneAction.js.map +1 -1
- package/lib/appui-react/layout/state/NineZoneStateReducer.d.ts.map +1 -1
- package/lib/appui-react/layout/state/NineZoneStateReducer.js +23 -16
- package/lib/appui-react/layout/state/NineZoneStateReducer.js.map +1 -1
- package/lib/appui-react/shared/MenuItem.d.ts +3 -0
- package/lib/appui-react/shared/MenuItem.d.ts.map +1 -1
- package/lib/appui-react/shared/MenuItem.js +2 -3
- package/lib/appui-react/shared/MenuItem.js.map +1 -1
- package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.d.ts +2 -55
- package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.d.ts.map +1 -1
- package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.js +333 -403
- package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
- package/lib/appui-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/appui-react/toolbar/Toolbar.js +4 -3
- package/lib/appui-react/toolbar/Toolbar.js.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/ActionItem.d.ts.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/ActionItem.js +3 -0
- package/lib/appui-react/toolbar/new-toolbars/ActionItem.js.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/GroupItem.d.ts.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/GroupItem.js +2 -0
- package/lib/appui-react/toolbar/new-toolbars/GroupItem.js.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/Toolbar.d.ts +6 -3
- package/lib/appui-react/toolbar/new-toolbars/Toolbar.d.ts.map +1 -1
- package/lib/appui-react/toolbar/new-toolbars/Toolbar.js +4 -3
- package/lib/appui-react/toolbar/new-toolbars/Toolbar.js.map +1 -1
- package/lib/appui-react/utils/InternalUiShowHideManager.d.ts +2 -0
- package/lib/appui-react/utils/InternalUiShowHideManager.d.ts.map +1 -1
- package/lib/appui-react/utils/InternalUiShowHideManager.js +6 -0
- package/lib/appui-react/utils/InternalUiShowHideManager.js.map +1 -1
- package/lib/appui-react/widget-panels/Frontstage.d.ts +7 -2
- package/lib/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/appui-react/widget-panels/Frontstage.js +29 -12
- package/lib/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/appui-react/widgets/BackstageAppButton.scss +8 -3
- package/lib/appui-react.d.ts +1 -1
- package/lib/appui-react.d.ts.map +1 -1
- package/lib/appui-react.js +1 -1
- package/lib/appui-react.js.map +1 -1
- package/lib/cjs/appui-react/cursor/cursorpopup/CursorPopup.scss +3 -0
- package/lib/cjs/appui-react/layout/StandardLayout.scss +3 -8
- package/lib/cjs/appui-react/widgets/BackstageAppButton.scss +8 -3
- package/lib/esm/appui-react/cursor/cursorpopup/CursorPopup.scss +3 -0
- package/lib/esm/appui-react/layout/StandardLayout.scss +3 -8
- package/lib/esm/appui-react/widgets/BackstageAppButton.scss +8 -3
- package/package.json +8 -10
- package/lib/appui-react/accudraw/angle.svg +0 -1
- package/lib/appui-react/accudraw/backspace.svg +0 -9
- package/lib/appui-react/accudraw/constraint-2d.svg +0 -11
- package/lib/appui-react/accudraw/distance.svg +0 -1
- package/lib/appui-react/accudraw/height-2.svg +0 -10
- package/lib/appui-react/accudraw/height.svg +0 -11
- package/lib/appui-react/statusfields/toolassistance/accept-point.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/cursor-click.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-one-finger-drag.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-one-finger-tap-double.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-one-finger-tap.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-pinch.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-two-finger-drag.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/gesture-two-finger-tap.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-left-drag.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-left.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-right-drag.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-right.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-wheel-drag.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/mouse-click-wheel.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/touch-cursor-pan.svg +0 -1
- package/lib/appui-react/statusfields/toolassistance/touch-cursor-point.svg +0 -1
- package/lib/cjs/appui-react/accudraw/angle.svg +0 -1
- package/lib/cjs/appui-react/accudraw/backspace.svg +0 -9
- package/lib/cjs/appui-react/accudraw/constraint-2d.svg +0 -11
- package/lib/cjs/appui-react/accudraw/distance.svg +0 -1
- package/lib/cjs/appui-react/accudraw/height-2.svg +0 -10
- package/lib/cjs/appui-react/accudraw/height.svg +0 -11
- package/lib/cjs/appui-react/statusfields/toolassistance/accept-point.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/cursor-click.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-one-finger-drag.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-one-finger-tap-double.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-one-finger-tap.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-pinch.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-two-finger-drag.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/gesture-two-finger-tap.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-left-drag.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-left.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-right-drag.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-right.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-wheel-drag.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/mouse-click-wheel.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/touch-cursor-pan.svg +0 -1
- package/lib/cjs/appui-react/statusfields/toolassistance/touch-cursor-point.svg +0 -1
- package/lib/esm/appui-react/accudraw/angle.svg +0 -1
- package/lib/esm/appui-react/accudraw/backspace.svg +0 -9
- package/lib/esm/appui-react/accudraw/constraint-2d.svg +0 -11
- package/lib/esm/appui-react/accudraw/distance.svg +0 -1
- package/lib/esm/appui-react/accudraw/height-2.svg +0 -10
- package/lib/esm/appui-react/accudraw/height.svg +0 -11
- package/lib/esm/appui-react/statusfields/toolassistance/accept-point.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/cursor-click.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-one-finger-drag.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-one-finger-tap-double.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-one-finger-tap.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-pinch.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-two-finger-drag.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/gesture-two-finger-tap.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-left-drag.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-left.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-right-drag.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-right.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-wheel-drag.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/mouse-click-wheel.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/touch-cursor-pan.svg +0 -1
- package/lib/esm/appui-react/statusfields/toolassistance/touch-cursor-point.svg +0 -1
|
@@ -6,452 +6,382 @@
|
|
|
6
6
|
* @module Notification
|
|
7
7
|
*/
|
|
8
8
|
import { Logger, ProcessDetector } from "@itwin/core-bentley";
|
|
9
|
-
import {
|
|
10
|
-
import { FillCentered, Icon
|
|
9
|
+
import { ToolAssistanceImage, ToolAssistanceInputMethod, } from "@itwin/core-frontend";
|
|
10
|
+
import { FillCentered, Icon } from "@itwin/core-react";
|
|
11
11
|
import { Button, Tabs, ToggleSwitch } from "@itwin/itwinui-react";
|
|
12
12
|
import classnames from "classnames";
|
|
13
13
|
import * as React from "react";
|
|
14
14
|
import { UiFramework } from "../../UiFramework.js";
|
|
15
|
-
import {
|
|
15
|
+
import { useCursorPrompt } from "../../cursor/cursorprompt/CursorPrompt.js";
|
|
16
16
|
import { MessageManager } from "../../messages/MessageManager.js";
|
|
17
17
|
import { UiStateStorageContext } from "../../uistate/useUiStateStorage.js";
|
|
18
18
|
import "./ToolAssistanceField.scss";
|
|
19
|
-
import { SvgClose, SvgPin } from "@itwin/itwinui-icons-react";
|
|
19
|
+
import { SvgAdd, SvgClose, SvgCursorClick, SvgGestureOneFingerDrag, SvgGestureOneFingerTap, SvgGestureOneFingerTapDouble, SvgGesturePinch, SvgGestureTwoFingerDrag, SvgGestureTwoFingerTap, SvgMouseClickLeft, SvgMouseClickRight, SvgMouseClickWheel, SvgPin, } from "@itwin/itwinui-icons-react";
|
|
20
20
|
import { ToolAssistanceDialog } from "../../layout/footer/tool-assistance/Dialog.js";
|
|
21
21
|
import { ToolAssistanceInstruction as NZ_ToolAssistanceInstruction } from "../../layout/footer/tool-assistance/Instruction.js";
|
|
22
22
|
import { ToolAssistanceItem } from "../../layout/footer/tool-assistance/Item.js";
|
|
23
23
|
import { ToolAssistanceSeparator } from "../../layout/footer/tool-assistance/Separator.js";
|
|
24
24
|
import { StatusBarDialog } from "../../statusbar/dialog/Dialog.js";
|
|
25
|
-
import acceptPointIcon from "./accept-point.svg";
|
|
26
|
-
import cursorClickIcon from "./cursor-click.svg";
|
|
27
|
-
import oneTouchDragIcon from "./gesture-one-finger-drag.svg";
|
|
28
|
-
import oneTouchDoubleTapIcon from "./gesture-one-finger-tap-double.svg";
|
|
29
|
-
import oneTouchTapIcon from "./gesture-one-finger-tap.svg";
|
|
30
|
-
import twoTouchPinchIcon from "./gesture-pinch.svg";
|
|
31
|
-
import twoTouchDragIcon from "./gesture-two-finger-drag.svg";
|
|
32
|
-
import twoTouchTapIcon from "./gesture-two-finger-tap.svg";
|
|
33
|
-
import clickLeftDragIcon from "./mouse-click-left-drag.svg";
|
|
34
|
-
import clickLeftIcon from "./mouse-click-left.svg";
|
|
35
|
-
import clickRightDragIcon from "./mouse-click-right-drag.svg";
|
|
36
|
-
import clickRightIcon from "./mouse-click-right.svg";
|
|
37
|
-
import clickMouseWheelDragIcon from "./mouse-click-wheel-drag.svg";
|
|
38
|
-
import mouseWheelClickIcon from "./mouse-click-wheel.svg";
|
|
39
|
-
import touchCursorDragIcon from "./touch-cursor-pan.svg";
|
|
40
|
-
import touchCursorTapIcon from "./touch-cursor-point.svg";
|
|
41
25
|
import { StatusBarPopover } from "../../statusbar/popup/StatusBarPopover.js";
|
|
42
26
|
import { UiStateStorageStatus, } from "../../uistate/UiStateStorage.js";
|
|
43
|
-
import {
|
|
27
|
+
import { SvgTouchCursorPoint } from "../../icons/SvgTouchCursorPoint.js";
|
|
28
|
+
import { SvgTouchCursorPan } from "../../icons/SvgTouchCursorPan.js";
|
|
29
|
+
import { SvgMouseClickLeftDrag } from "../../icons/SvgMouseClickLeftDrag.js";
|
|
30
|
+
import { SvgMouseClickRightDrag } from "../../icons/SvgMouseClickRightDrag.js";
|
|
31
|
+
import { SvgMouseClickWheelDrag } from "../../icons/SvgMouseClickWheelDrag.js";
|
|
32
|
+
import { useTranslation } from "../../hooks/useTranslation.js";
|
|
33
|
+
import { useActiveTool } from "../../hooks/useActiveTool.js";
|
|
34
|
+
const toolAssistanceKey = "ToolAssistance";
|
|
35
|
+
const showPromptAtCursorKey = "showPromptAtCursor";
|
|
36
|
+
const mouseTouchTabIndexKey = "mouseTouchTabIndex";
|
|
44
37
|
/** Tool Assistance Field React component.
|
|
45
38
|
* @public
|
|
46
39
|
* @note Tool assistance field will only display 30 characters in the status bar. Any additional text will be hidden. The full text will always be shown in the opened popover.
|
|
47
40
|
*/
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let showTouchInstructions = false;
|
|
57
|
-
if (args.instructions && args.instructions.sections) {
|
|
58
|
-
const hasMouseInstructions = args.instructions.sections.some((section) => {
|
|
59
|
-
return section.instructions.some((instruction) => this._isMouseInstruction(instruction));
|
|
60
|
-
});
|
|
61
|
-
const hasTouchInstructions = args.instructions.sections.some((section) => {
|
|
62
|
-
return section.instructions.some((instruction) => this._isTouchInstruction(instruction));
|
|
63
|
-
});
|
|
64
|
-
if (this.state.includeMouseInstructions &&
|
|
65
|
-
this.state.includeTouchInstructions &&
|
|
66
|
-
hasMouseInstructions &&
|
|
67
|
-
hasTouchInstructions) {
|
|
68
|
-
showMouseTouchTabs = true;
|
|
69
|
-
showMouseInstructions = this.state.mouseTouchTabIndex === 0;
|
|
70
|
-
showTouchInstructions = this.state.mouseTouchTabIndex === 1;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
if (this.state.includeMouseInstructions && hasMouseInstructions)
|
|
74
|
-
showMouseInstructions = true;
|
|
75
|
-
else if (this.state.includeTouchInstructions && hasTouchInstructions)
|
|
76
|
-
showTouchInstructions = true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (this._isMounted)
|
|
80
|
-
this.setState({
|
|
81
|
-
instructions: args.instructions,
|
|
82
|
-
showMouseTouchTabs,
|
|
83
|
-
showMouseInstructions,
|
|
84
|
-
showTouchInstructions,
|
|
85
|
-
}, () => {
|
|
86
|
-
this._showCursorPrompt();
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
this._isBothInstruction = (instruction) => {
|
|
90
|
-
return (instruction.inputMethod === undefined ||
|
|
91
|
-
instruction.inputMethod === ToolAssistanceInputMethod.Both);
|
|
92
|
-
};
|
|
93
|
-
this._isMouseInstruction = (instruction) => instruction.inputMethod === ToolAssistanceInputMethod.Mouse;
|
|
94
|
-
this._isTouchInstruction = (instruction) => instruction.inputMethod === ToolAssistanceInputMethod.Touch;
|
|
95
|
-
this._handleToolIconChangedEvent = (args) => {
|
|
96
|
-
if (this._isMounted)
|
|
97
|
-
this.setState({
|
|
98
|
-
toolIconSpec: args.iconSpec,
|
|
99
|
-
}, () => {
|
|
100
|
-
this._showCursorPrompt();
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
this._handleMouseTouchTab = async (index) => {
|
|
104
|
-
const showMouseInstructions = index === 0;
|
|
105
|
-
const showTouchInstructions = index === 1;
|
|
106
|
-
if (this._isMounted)
|
|
107
|
-
this.setState({
|
|
108
|
-
mouseTouchTabIndex: index,
|
|
109
|
-
showMouseInstructions,
|
|
110
|
-
showTouchInstructions,
|
|
111
|
-
}, async () => {
|
|
112
|
-
await this._mouseTouchTabIndexSetting.saveSetting(this._uiSettingsStorage);
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
this._onPromptAtCursorChange = async (e) => {
|
|
116
|
-
if (this._isMounted)
|
|
117
|
-
this.setState({
|
|
118
|
-
showPromptAtCursor: e.target.checked,
|
|
119
|
-
}, async () => {
|
|
120
|
-
await this._showPromptAtCursorSetting.saveSetting(this._uiSettingsStorage);
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
this._handlePinButtonClick = () => {
|
|
124
|
-
if (this._isMounted)
|
|
125
|
-
this.setState({ isPinned: true });
|
|
126
|
-
};
|
|
127
|
-
this._handleCloseButtonClick = () => {
|
|
128
|
-
this.setIsOpen(false);
|
|
129
|
-
};
|
|
130
|
-
const mobile = ProcessDetector.isMobileBrowser;
|
|
131
|
-
this.state = {
|
|
41
|
+
export function ToolAssistanceField(props) {
|
|
42
|
+
const { includePromptAtCursor = true, cursorPromptTimeout = 5000, fadeOutCursorPrompt = true, defaultPromptAtCursor = false, uiStateStorage: uiStateStorageProp, promptAtContent = false, } = props;
|
|
43
|
+
const uiStateStorageCtx = React.useContext(UiStateStorageContext);
|
|
44
|
+
const uiStateStorage = uiStateStorageProp ?? uiStateStorageCtx;
|
|
45
|
+
const { translate } = useTranslation();
|
|
46
|
+
const activeTool = useActiveTool();
|
|
47
|
+
const [state, setState] = React.useState(() => {
|
|
48
|
+
return {
|
|
132
49
|
instructions: undefined,
|
|
133
50
|
toolIconSpec: "",
|
|
134
|
-
showPromptAtCursor:
|
|
135
|
-
includeMouseInstructions: !mobile,
|
|
136
|
-
includeTouchInstructions: true,
|
|
137
|
-
showMouseTouchTabs: false,
|
|
138
|
-
showMouseInstructions: false,
|
|
139
|
-
showTouchInstructions: false,
|
|
51
|
+
showPromptAtCursor: defaultPromptAtCursor,
|
|
140
52
|
mouseTouchTabIndex: 0,
|
|
141
53
|
isPinned: false,
|
|
142
54
|
isOpen: false,
|
|
143
55
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this._uiSettingsStorage = this.props.uiStateStorage;
|
|
157
|
-
else if (this.context)
|
|
158
|
-
this._uiSettingsStorage = this.context;
|
|
159
|
-
await this.restoreSettings();
|
|
160
|
-
}
|
|
161
|
-
/** @internal */
|
|
162
|
-
componentDidUpdate() {
|
|
163
|
-
if (!this.state.showPromptAtCursor)
|
|
164
|
-
this._cursorPrompt.close(this.props.fadeOutCursorPrompt);
|
|
165
|
-
}
|
|
166
|
-
componentWillUnmount() {
|
|
167
|
-
this._isMounted = false;
|
|
168
|
-
this._cursorPrompt.close(this.props.fadeOutCursorPrompt);
|
|
169
|
-
MessageManager.onToolAssistanceChangedEvent.removeListener(this._handleToolAssistanceChangedEvent);
|
|
170
|
-
UiFramework.frontstages.onToolIconChangedEvent.removeListener(this._handleToolIconChangedEvent);
|
|
171
|
-
}
|
|
172
|
-
async restoreSettings() {
|
|
173
|
-
let getShowPromptAtCursor;
|
|
174
|
-
if (this.props.includePromptAtCursor) {
|
|
175
|
-
getShowPromptAtCursor = this._showPromptAtCursorSetting.getSetting(this._uiSettingsStorage);
|
|
176
|
-
}
|
|
177
|
-
const getMouseTouchTabIndex = this._mouseTouchTabIndexSetting.getSetting(this._uiSettingsStorage);
|
|
178
|
-
const [showPromptAtCursorResult, mouseTouchTabIndexResult] = await Promise.all([getShowPromptAtCursor, getMouseTouchTabIndex]);
|
|
179
|
-
if (showPromptAtCursorResult !== undefined &&
|
|
180
|
-
showPromptAtCursorResult.status === UiStateStorageStatus.Success) {
|
|
181
|
-
if (this._isMounted)
|
|
182
|
-
this.setState({ showPromptAtCursor: showPromptAtCursorResult.setting });
|
|
183
|
-
}
|
|
184
|
-
if (mouseTouchTabIndexResult.status === UiStateStorageStatus.Success) {
|
|
185
|
-
if (this._isMounted)
|
|
186
|
-
this.setState({ mouseTouchTabIndex: mouseTouchTabIndexResult.setting });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
_showCursorPrompt() {
|
|
190
|
-
const instruction = this.state.instructions?.mainInstruction.text;
|
|
191
|
-
if (!this.state.showPromptAtCursor || !instruction) {
|
|
192
|
-
this._cursorPrompt.close(this.props.fadeOutCursorPrompt);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
this._cursorPrompt.open({
|
|
196
|
-
timeout: this.props.cursorPromptTimeout,
|
|
197
|
-
fadeout: this.props.fadeOutCursorPrompt,
|
|
198
|
-
iconSpec: this.state.toolIconSpec,
|
|
199
|
-
instruction,
|
|
200
|
-
promptAtContent: this.props.promptAtContent ?? false,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
_sectionHasDisplayableInstructions(section) {
|
|
204
|
-
const displayableInstructions = this._getDisplayableInstructions(section);
|
|
205
|
-
return displayableInstructions.length > 0;
|
|
206
|
-
}
|
|
207
|
-
_getDisplayableInstructions(section) {
|
|
208
|
-
const displayableInstructions = section.instructions.filter((instruction) => {
|
|
209
|
-
return (this._isBothInstruction(instruction) ||
|
|
210
|
-
(this.state.showMouseInstructions &&
|
|
211
|
-
this._isMouseInstruction(instruction)) ||
|
|
212
|
-
(this.state.showTouchInstructions &&
|
|
213
|
-
this._isTouchInstruction(instruction)));
|
|
214
|
-
});
|
|
215
|
-
return displayableInstructions;
|
|
216
|
-
}
|
|
217
|
-
render() {
|
|
218
|
-
const { instructions } = this.state;
|
|
219
|
-
const dialogTitle = IModelApp.toolAdmin.activeTool
|
|
220
|
-
? IModelApp.toolAdmin.activeTool.flyover
|
|
221
|
-
: UiFramework.translate("toolAssistance.title");
|
|
222
|
-
const mouseLabel = UiFramework.translate("toolAssistance.mouse");
|
|
223
|
-
const touchLabel = UiFramework.translate("toolAssistance.touch");
|
|
224
|
-
let prompt = "";
|
|
225
|
-
let tooltip = "";
|
|
226
|
-
let toolIcon;
|
|
227
|
-
let dialogContent;
|
|
228
|
-
if (instructions) {
|
|
229
|
-
prompt = instructions.mainInstruction.text;
|
|
230
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
231
|
-
toolIcon = React.createElement(Icon, { iconSpec: this.state.toolIconSpec });
|
|
232
|
-
let displayableSections;
|
|
233
|
-
if (instructions.sections) {
|
|
234
|
-
displayableSections = instructions.sections.filter((section) => this._sectionHasDisplayableInstructions(section));
|
|
235
|
-
}
|
|
236
|
-
dialogContent = (React.createElement("div", null,
|
|
237
|
-
this.state.showMouseTouchTabs && (React.createElement(Tabs.Wrapper, { type: "pill", value: String(this.state.mouseTouchTabIndex) },
|
|
238
|
-
React.createElement(Tabs.TabList, { className: "uifw-toolAssistance-tabs" }, [mouseLabel, touchLabel].map((label, index) => (React.createElement(Tabs.Tab, { key: index, className: "uifw-tab", value: String(index), label: label, onClick: async () => this._handleMouseTouchTab(index) })))))),
|
|
239
|
-
React.createElement("div", { className: "uifw-toolAssistance-content" },
|
|
240
|
-
React.createElement(NZ_ToolAssistanceInstruction, { key: "main", image: ToolAssistanceField.getInstructionImage(instructions.mainInstruction), text: instructions.mainInstruction.text, isNew: instructions.mainInstruction.isNew }),
|
|
241
|
-
displayableSections &&
|
|
242
|
-
displayableSections.map((section, index1) => {
|
|
243
|
-
return (React.createElement(React.Fragment, { key: index1.toString() },
|
|
244
|
-
React.createElement(ToolAssistanceSeparator, { key: index1.toString() }, section.label),
|
|
245
|
-
this._getDisplayableInstructions(section).map((instruction, index2) => {
|
|
246
|
-
return (React.createElement(NZ_ToolAssistanceInstruction, { key: `${index1.toString()}-${index2.toString()}`, image: ToolAssistanceField.getInstructionImage(instruction), text: instruction.text, isNew: instruction.isNew }));
|
|
247
|
-
})));
|
|
248
|
-
}),
|
|
249
|
-
this.props.includePromptAtCursor && (React.createElement(React.Fragment, null,
|
|
250
|
-
React.createElement(ToolAssistanceSeparator, { key: "prompt-sep" }),
|
|
251
|
-
React.createElement(ToolAssistanceItem, { key: "prompt-item" },
|
|
252
|
-
React.createElement(ToggleSwitch, { label: UiFramework.translate("toolAssistance.promptAtCursor"), labelPosition: "right", checked: this.state.showPromptAtCursor, onChange: this._onPromptAtCursorChange })))))));
|
|
253
|
-
}
|
|
254
|
-
if (prompt)
|
|
255
|
-
tooltip = prompt;
|
|
256
|
-
if (IModelApp.toolAdmin.activeTool)
|
|
257
|
-
tooltip = `${IModelApp.toolAdmin.activeTool.flyover} > ${tooltip} `;
|
|
258
|
-
if (tooltip) {
|
|
259
|
-
const lineBreak = "\u000d\u000a";
|
|
260
|
-
tooltip = tooltip + lineBreak;
|
|
261
|
-
}
|
|
262
|
-
tooltip += UiFramework.translate("toolAssistance.moreInfo");
|
|
263
|
-
return (React.createElement(StatusBarPopover, { visible: this.state.isOpen, onVisibleChange: (visible) => {
|
|
264
|
-
this.setIsOpen(visible);
|
|
265
|
-
}, closeOnOutsideClick: !this.state.isPinned, content: React.createElement(ToolAssistanceDialog, { buttons: React.createElement(React.Fragment, null,
|
|
266
|
-
!this.state.isPinned && (React.createElement(StatusBarDialog.TitleBarButton, { onClick: this._handlePinButtonClick, title: UiFramework.translate("toolAssistance.pin") },
|
|
267
|
-
React.createElement(SvgPin, null))),
|
|
268
|
-
this.state.isPinned && (React.createElement(StatusBarDialog.TitleBarButton, { onClick: this._handleCloseButtonClick, title: UiFramework.translate("dialog.close") },
|
|
269
|
-
React.createElement(SvgClose, null)))), title: dialogTitle }, dialogContent) },
|
|
270
|
-
React.createElement(Button, { styleType: "borderless", startIcon: React.createElement(React.Fragment, null, toolIcon), className: classnames("uifw-statusFields-toolAssistance-toolAssistanceField", this.props.className), title: tooltip, style: this.props.style, ref: this._indicator, labelProps: { className: "prompt" } },
|
|
271
|
-
prompt,
|
|
272
|
-
React.createElement(StatusBarPopover.ExpandIndicator, null))));
|
|
273
|
-
}
|
|
274
|
-
setIsOpen(isOpen) {
|
|
56
|
+
});
|
|
57
|
+
const { showPromptAtCursor, toolIconSpec, mouseTouchTabIndex, instructions } = state;
|
|
58
|
+
const mainInstruction = state.instructions?.mainInstruction.text;
|
|
59
|
+
const { open } = useCursorPrompt({
|
|
60
|
+
show: showPromptAtCursor,
|
|
61
|
+
timeout: cursorPromptTimeout,
|
|
62
|
+
iconSpec: toolIconSpec,
|
|
63
|
+
instruction: mainInstruction,
|
|
64
|
+
fadeOut: fadeOutCursorPrompt,
|
|
65
|
+
promptAtContent,
|
|
66
|
+
});
|
|
67
|
+
const setIsOpen = (isOpen) => {
|
|
275
68
|
let newState = {
|
|
276
69
|
isOpen,
|
|
277
70
|
};
|
|
278
|
-
if (!isOpen &&
|
|
71
|
+
if (!isOpen && state.isPinned) {
|
|
279
72
|
newState = { ...newState, ...{ isPinned: false } };
|
|
280
73
|
}
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
74
|
+
setState((prev) => ({ ...prev, ...newState }));
|
|
75
|
+
};
|
|
76
|
+
const getDisplayableInstructions = (section) => {
|
|
77
|
+
const displayableInstructions = section.instructions.filter((instruction) => {
|
|
78
|
+
const includeMouseInstructions = showMouseTouchTabs
|
|
79
|
+
? mouseTouchTabIndex === 0 && showMouseInstructions
|
|
80
|
+
: showMouseInstructions;
|
|
81
|
+
const includeTouchInstructions = showMouseTouchTabs
|
|
82
|
+
? mouseTouchTabIndex === 1 && showTouchInstructions
|
|
83
|
+
: showTouchInstructions;
|
|
84
|
+
return (isBothInstruction(instruction) ||
|
|
85
|
+
(includeMouseInstructions && isMouseInstruction(instruction)) ||
|
|
86
|
+
(includeTouchInstructions && isTouchInstruction(instruction)));
|
|
87
|
+
});
|
|
88
|
+
return displayableInstructions;
|
|
89
|
+
};
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
void (async () => {
|
|
92
|
+
const result = await uiStateStorage.getSetting(toolAssistanceKey, showPromptAtCursorKey);
|
|
93
|
+
if (result.status !== UiStateStorageStatus.Success)
|
|
94
|
+
return;
|
|
95
|
+
setState((prev) => ({
|
|
96
|
+
...prev,
|
|
97
|
+
showPromptAtCursor: result.setting,
|
|
98
|
+
}));
|
|
99
|
+
})();
|
|
100
|
+
}, [uiStateStorage]);
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
void (async () => {
|
|
103
|
+
const result = await uiStateStorage.getSetting(toolAssistanceKey, mouseTouchTabIndexKey);
|
|
104
|
+
if (result.status !== UiStateStorageStatus.Success)
|
|
105
|
+
return;
|
|
106
|
+
setState((prev) => ({
|
|
107
|
+
...prev,
|
|
108
|
+
mouseTouchTabIndex: result.setting,
|
|
109
|
+
}));
|
|
110
|
+
})();
|
|
111
|
+
}, [uiStateStorage]);
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
return MessageManager.onToolAssistanceChangedEvent.addListener((args) => {
|
|
114
|
+
setState((prev) => ({
|
|
115
|
+
...prev,
|
|
116
|
+
instructions: args.instructions,
|
|
117
|
+
}));
|
|
118
|
+
open();
|
|
119
|
+
});
|
|
120
|
+
}, [open]);
|
|
121
|
+
React.useEffect(() => {
|
|
122
|
+
return UiFramework.frontstages.onToolIconChangedEvent.addListener((args) => {
|
|
123
|
+
setState((prev) => ({
|
|
124
|
+
...prev,
|
|
125
|
+
toolIconSpec: args.iconSpec,
|
|
126
|
+
}));
|
|
127
|
+
open();
|
|
128
|
+
});
|
|
129
|
+
}, [open]);
|
|
130
|
+
const hasMouseInstructions = !!instructions?.sections?.some((section) => {
|
|
131
|
+
return section.instructions.some((instruction) => isMouseInstruction(instruction));
|
|
132
|
+
});
|
|
133
|
+
const hasTouchInstructions = !!instructions?.sections?.some((section) => {
|
|
134
|
+
return section.instructions.some((instruction) => isTouchInstruction(instruction));
|
|
135
|
+
});
|
|
136
|
+
const isMobileBrowser = React.useMemo(() => {
|
|
137
|
+
return ProcessDetector.isMobileBrowser;
|
|
138
|
+
}, []);
|
|
139
|
+
const showMouseInstructions = !isMobileBrowser && hasMouseInstructions;
|
|
140
|
+
const showTouchInstructions = hasTouchInstructions;
|
|
141
|
+
const showMouseTouchTabs = showMouseInstructions && showTouchInstructions;
|
|
142
|
+
const sectionInstructions = (instructions?.sections ?? [])
|
|
143
|
+
.map((section) => {
|
|
144
|
+
const displayableInstructions = getDisplayableInstructions(section);
|
|
145
|
+
return {
|
|
146
|
+
displayableInstructions,
|
|
147
|
+
section,
|
|
148
|
+
};
|
|
149
|
+
})
|
|
150
|
+
.filter((section) => {
|
|
151
|
+
return section.displayableInstructions.length > 0;
|
|
152
|
+
});
|
|
153
|
+
const prompt = instructions?.mainInstruction.text;
|
|
154
|
+
const tooltip = React.useMemo(() => {
|
|
155
|
+
const lineBreak = "\u000d\u000a";
|
|
156
|
+
const moreInfo = translate("toolAssistance.moreInfo");
|
|
157
|
+
const postfix = `${lineBreak}${moreInfo}`;
|
|
158
|
+
if (activeTool) {
|
|
159
|
+
return `${activeTool.flyover}${prompt ? ` > ${prompt}` : ""}${postfix}`;
|
|
303
160
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const svgSource = getWebComponentSource(instruction.image);
|
|
307
|
-
const className = svgSource !== undefined
|
|
308
|
-
? "uifw-toolassistance-svg"
|
|
309
|
-
: "uifw-toolassistance-icon-large";
|
|
310
|
-
image = (React.createElement("div", { className: className },
|
|
311
|
-
React.createElement(Icon, { iconSpec: svgSource ?? instruction.image })));
|
|
312
|
-
}
|
|
161
|
+
if (prompt) {
|
|
162
|
+
return `${prompt}${postfix}`;
|
|
313
163
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
164
|
+
return moreInfo;
|
|
165
|
+
}, [prompt, activeTool, translate]);
|
|
166
|
+
const dialogTitle = activeTool?.flyover ?? translate("toolAssistance.title");
|
|
167
|
+
const tabs = [
|
|
168
|
+
translate("toolAssistance.mouse"),
|
|
169
|
+
translate("toolAssistance.touch"),
|
|
170
|
+
];
|
|
171
|
+
return (React.createElement(StatusBarPopover, { visible: state.isOpen, onVisibleChange: (visible) => {
|
|
172
|
+
setIsOpen(visible);
|
|
173
|
+
}, closeOnOutsideClick: !state.isPinned, content: React.createElement(ToolAssistanceDialog, { buttons: React.createElement(StatusBarDialog.TitleBarButton, { onClick: () => {
|
|
174
|
+
if (state.isPinned) {
|
|
175
|
+
setIsOpen(false);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
setState((prev) => ({ ...prev, isPinned: true }));
|
|
179
|
+
}, title: translate(state.isPinned ? "dialog.close" : "toolAssistance.pin") }, state.isPinned ? React.createElement(SvgClose, null) : React.createElement(SvgPin, null)), title: dialogTitle },
|
|
180
|
+
React.createElement("div", null,
|
|
181
|
+
showMouseTouchTabs && (React.createElement(Tabs.Wrapper, { type: "pill", value: String(mouseTouchTabIndex) },
|
|
182
|
+
React.createElement(Tabs.TabList, { className: "uifw-toolAssistance-tabs" }, tabs.map((tab, index) => (React.createElement(Tabs.Tab, { key: index, className: "uifw-tab", value: String(index), label: tab, onClick: async () => {
|
|
183
|
+
setState((prev) => ({
|
|
184
|
+
...prev,
|
|
185
|
+
mouseTouchTabIndex: index,
|
|
186
|
+
}));
|
|
187
|
+
void uiStateStorage.saveSetting(toolAssistanceKey, mouseTouchTabIndexKey, index);
|
|
188
|
+
} })))))),
|
|
189
|
+
instructions ? (React.createElement("div", { className: "uifw-toolAssistance-content" },
|
|
190
|
+
React.createElement(NZ_ToolAssistanceInstruction, { key: "main", image: React.createElement(InstructionImage, { instruction: instructions.mainInstruction }), text: instructions.mainInstruction.text, isNew: instructions.mainInstruction.isNew }),
|
|
191
|
+
sectionInstructions.map((sectionInstruction, index) => {
|
|
192
|
+
const { section, displayableInstructions } = sectionInstruction;
|
|
193
|
+
return (React.createElement(React.Fragment, { key: index.toString() },
|
|
194
|
+
React.createElement(ToolAssistanceSeparator, null, section.label),
|
|
195
|
+
displayableInstructions.map((instruction, index1) => {
|
|
196
|
+
return (React.createElement(NZ_ToolAssistanceInstruction, { key: `${index1.toString()}-${index.toString()}`, image: React.createElement(InstructionImage, { instruction: instruction }), text: instruction.text, isNew: instruction.isNew }));
|
|
197
|
+
})));
|
|
198
|
+
}),
|
|
199
|
+
includePromptAtCursor && (React.createElement(React.Fragment, null,
|
|
200
|
+
React.createElement(ToolAssistanceSeparator, { key: "prompt-sep" }),
|
|
201
|
+
React.createElement(ToolAssistanceItem, { key: "prompt-item" },
|
|
202
|
+
React.createElement(ToggleSwitch, { label: translate("toolAssistance.promptAtCursor"), labelPosition: "right", checked: state.showPromptAtCursor, onChange: (e) => {
|
|
203
|
+
const checked = e.target.checked;
|
|
204
|
+
setState((prev) => ({
|
|
205
|
+
...prev,
|
|
206
|
+
showPromptAtCursor: checked,
|
|
207
|
+
}));
|
|
208
|
+
void uiStateStorage.saveSetting(toolAssistanceKey, showPromptAtCursorKey, checked);
|
|
209
|
+
} })))))) : undefined)) },
|
|
210
|
+
React.createElement(Button, { styleType: "borderless", startIcon: instructions ? (
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
212
|
+
React.createElement(Icon, { iconSpec: state.toolIconSpec })) : (React.createElement(React.Fragment, null)), className: classnames("uifw-statusFields-toolAssistance-toolAssistanceField", props.className), title: tooltip, style: props.style, labelProps: { className: "prompt" } },
|
|
213
|
+
prompt,
|
|
214
|
+
React.createElement(StatusBarPopover.ExpandIndicator, null))));
|
|
215
|
+
}
|
|
216
|
+
function isBothInstruction(instruction) {
|
|
217
|
+
return (instruction.inputMethod === undefined ||
|
|
218
|
+
instruction.inputMethod === ToolAssistanceInputMethod.Both);
|
|
219
|
+
}
|
|
220
|
+
function isMouseInstruction(instruction) {
|
|
221
|
+
return instruction.inputMethod === ToolAssistanceInputMethod.Mouse;
|
|
222
|
+
}
|
|
223
|
+
function isTouchInstruction(instruction) {
|
|
224
|
+
return instruction.inputMethod === ToolAssistanceInputMethod.Touch;
|
|
225
|
+
}
|
|
226
|
+
function getWebComponentSource(iconSpec) {
|
|
227
|
+
if (iconSpec.startsWith("webSvg:") && iconSpec.length > 7) {
|
|
228
|
+
return iconSpec.slice(7);
|
|
229
|
+
}
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
function InstructionImage({ instruction, }) {
|
|
233
|
+
let image;
|
|
234
|
+
if ((typeof instruction.image === "string" ||
|
|
235
|
+
instruction.image !== ToolAssistanceImage.Keyboard) &&
|
|
236
|
+
instruction.keyboardInfo) {
|
|
237
|
+
if (instruction.keyboardInfo.keys.length === 1 &&
|
|
238
|
+
!instruction.keyboardInfo.bottomKeys) {
|
|
239
|
+
const key = instruction.keyboardInfo.keys[0];
|
|
240
|
+
const rightImage = typeof instruction.image === "string" ? (React.createElement("div", { className: "uifw-toolassistance-icon-medium" },
|
|
241
|
+
React.createElement(Icon, { iconSpec: instruction.image }))) : (React.createElement(InstructionSvgImage, { instruction: instruction, mediumSize: true }));
|
|
242
|
+
image = (
|
|
243
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
244
|
+
React.createElement(FillCentered, null,
|
|
245
|
+
React.createElement(KeyNode, { keyboardKey: key, className: "uifw-toolassistance-key-modifier" }),
|
|
246
|
+
rightImage));
|
|
321
247
|
}
|
|
322
248
|
else {
|
|
323
|
-
|
|
249
|
+
Logger.logError(UiFramework.loggerCategory("ToolAssistanceField"), `getInstructionImage: Invalid keyboardInfo provided with image`);
|
|
324
250
|
}
|
|
325
|
-
return image;
|
|
326
251
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
let svgImage = "";
|
|
336
|
-
switch (toolAssistanceImage) {
|
|
337
|
-
case ToolAssistanceImage.AcceptPoint:
|
|
338
|
-
svgImage = acceptPointIcon;
|
|
339
|
-
break;
|
|
340
|
-
case ToolAssistanceImage.CursorClick:
|
|
341
|
-
svgImage = cursorClickIcon;
|
|
342
|
-
break;
|
|
343
|
-
case ToolAssistanceImage.LeftClick:
|
|
344
|
-
svgImage = clickLeftIcon;
|
|
345
|
-
break;
|
|
346
|
-
case ToolAssistanceImage.RightClick:
|
|
347
|
-
svgImage = clickRightIcon;
|
|
348
|
-
break;
|
|
349
|
-
case ToolAssistanceImage.MouseWheel:
|
|
350
|
-
svgImage = mouseWheelClickIcon;
|
|
351
|
-
break;
|
|
352
|
-
case ToolAssistanceImage.LeftClickDrag:
|
|
353
|
-
svgImage = clickLeftDragIcon;
|
|
354
|
-
className = mediumSize
|
|
355
|
-
? "uifw-toolassistance-svg-medium-wide"
|
|
356
|
-
: "uifw-toolassistance-svg-wide";
|
|
357
|
-
break;
|
|
358
|
-
case ToolAssistanceImage.RightClickDrag:
|
|
359
|
-
svgImage = clickRightDragIcon;
|
|
360
|
-
className = mediumSize
|
|
361
|
-
? "uifw-toolassistance-svg-medium-wide"
|
|
362
|
-
: "uifw-toolassistance-svg-wide";
|
|
363
|
-
break;
|
|
364
|
-
case ToolAssistanceImage.MouseWheelClickDrag:
|
|
365
|
-
svgImage = clickMouseWheelDragIcon;
|
|
366
|
-
className = mediumSize
|
|
367
|
-
? "uifw-toolassistance-svg-medium-wide"
|
|
368
|
-
: "uifw-toolassistance-svg-wide";
|
|
369
|
-
break;
|
|
370
|
-
case ToolAssistanceImage.OneTouchTap:
|
|
371
|
-
svgImage = oneTouchTapIcon;
|
|
372
|
-
break;
|
|
373
|
-
case ToolAssistanceImage.OneTouchDoubleTap:
|
|
374
|
-
svgImage = oneTouchDoubleTapIcon;
|
|
375
|
-
break;
|
|
376
|
-
case ToolAssistanceImage.OneTouchDrag:
|
|
377
|
-
svgImage = oneTouchDragIcon;
|
|
378
|
-
break;
|
|
379
|
-
case ToolAssistanceImage.TwoTouchTap:
|
|
380
|
-
svgImage = twoTouchTapIcon;
|
|
381
|
-
break;
|
|
382
|
-
case ToolAssistanceImage.TwoTouchDrag:
|
|
383
|
-
svgImage = twoTouchDragIcon;
|
|
384
|
-
break;
|
|
385
|
-
case ToolAssistanceImage.TwoTouchPinch:
|
|
386
|
-
svgImage = twoTouchPinchIcon;
|
|
387
|
-
break;
|
|
388
|
-
case ToolAssistanceImage.TouchCursorTap:
|
|
389
|
-
svgImage = touchCursorTapIcon;
|
|
390
|
-
break;
|
|
391
|
-
case ToolAssistanceImage.TouchCursorDrag:
|
|
392
|
-
svgImage = touchCursorDragIcon;
|
|
393
|
-
className = mediumSize
|
|
394
|
-
? "uifw-toolassistance-svg-medium-wide"
|
|
395
|
-
: "uifw-toolassistance-svg-wide";
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
image = (React.createElement("div", { className: className }, svgImage && React.createElement(Icon, { iconSpec: svgImage })));
|
|
252
|
+
else if (typeof instruction.image === "string") {
|
|
253
|
+
if (instruction.image.length > 0) {
|
|
254
|
+
const svgSource = getWebComponentSource(instruction.image);
|
|
255
|
+
const className = svgSource !== undefined
|
|
256
|
+
? "uifw-toolassistance-svg"
|
|
257
|
+
: "uifw-toolassistance-icon-large";
|
|
258
|
+
image = (React.createElement("div", { className: className },
|
|
259
|
+
React.createElement(Icon, { iconSpec: svgSource ?? instruction.image })));
|
|
399
260
|
}
|
|
400
|
-
return image;
|
|
401
261
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
image = (React.createElement("div", { className: "uifw-toolassistance-key-group" },
|
|
406
|
-
React.createElement("span", { className: "row1" }, keyboardInfo.keys.map((key, index1) => {
|
|
407
|
-
return ToolAssistanceField.getKeyNode(key, index1, "uifw-toolassistance-key-small");
|
|
408
|
-
})),
|
|
409
|
-
React.createElement("br", null),
|
|
410
|
-
React.createElement("span", { className: "row2" }, keyboardInfo.bottomKeys.map((key, index2) => {
|
|
411
|
-
return ToolAssistanceField.getKeyNode(key, index2, "uifw-toolassistance-key-small");
|
|
412
|
-
}))));
|
|
413
|
-
}
|
|
414
|
-
else if (keyboardInfo.keys.length === 2) {
|
|
415
|
-
image = (
|
|
416
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
417
|
-
React.createElement(FillCentered, null, keyboardInfo.keys.map((key, index3) => {
|
|
418
|
-
let className = "uifw-toolassistance-key-medium";
|
|
419
|
-
if (key.length > 1)
|
|
420
|
-
className = "uifw-toolassistance-key-modifier";
|
|
421
|
-
return ToolAssistanceField.getKeyNode(key, index3, className);
|
|
422
|
-
})));
|
|
423
|
-
}
|
|
424
|
-
else if (keyboardInfo.keys[0]) {
|
|
425
|
-
if (keyboardInfo.keys[0].length > 1)
|
|
426
|
-
image = ToolAssistanceField.getKeyNode(keyboardInfo.keys[0], 0, "uifw-toolassistance-key-large");
|
|
427
|
-
else
|
|
428
|
-
image = ToolAssistanceField.getKeyNode(keyboardInfo.keys[0], 0);
|
|
262
|
+
else if (instruction.image === ToolAssistanceImage.Keyboard) {
|
|
263
|
+
if (instruction.keyboardInfo) {
|
|
264
|
+
image = (React.createElement(InstructionKeyboardImage, { keyboardInfo: instruction.keyboardInfo }));
|
|
429
265
|
}
|
|
430
266
|
else {
|
|
431
|
-
Logger.logError(UiFramework.loggerCategory("ToolAssistanceField"), `ToolAssistanceImage.Keyboard specified but
|
|
267
|
+
Logger.logError(UiFramework.loggerCategory("ToolAssistanceField"), `getInstructionImage: ToolAssistanceImage.Keyboard specified but no keyboardInfo provided`);
|
|
432
268
|
}
|
|
433
|
-
return image;
|
|
434
269
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
React.createElement(FillCentered, null, key)));
|
|
270
|
+
else {
|
|
271
|
+
image = (React.createElement(InstructionSvgImage, { instruction: instruction, mediumSize: false }));
|
|
438
272
|
}
|
|
273
|
+
return image;
|
|
439
274
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
275
|
+
function InstructionSvgImage({ instruction, mediumSize, }) {
|
|
276
|
+
let image;
|
|
277
|
+
let className = mediumSize
|
|
278
|
+
? "uifw-toolassistance-svg-medium"
|
|
279
|
+
: "uifw-toolassistance-svg";
|
|
280
|
+
if (typeof instruction.image !== "string" &&
|
|
281
|
+
instruction.image !== ToolAssistanceImage.Keyboard) {
|
|
282
|
+
const toolAssistanceImage = instruction.image;
|
|
283
|
+
let svgImage;
|
|
284
|
+
switch (toolAssistanceImage) {
|
|
285
|
+
case ToolAssistanceImage.AcceptPoint:
|
|
286
|
+
svgImage = React.createElement(SvgAdd, null);
|
|
287
|
+
break;
|
|
288
|
+
case ToolAssistanceImage.CursorClick:
|
|
289
|
+
svgImage = React.createElement(SvgCursorClick, null);
|
|
290
|
+
break;
|
|
291
|
+
case ToolAssistanceImage.LeftClick:
|
|
292
|
+
svgImage = React.createElement(SvgMouseClickLeft, null);
|
|
293
|
+
break;
|
|
294
|
+
case ToolAssistanceImage.RightClick:
|
|
295
|
+
svgImage = React.createElement(SvgMouseClickRight, null);
|
|
296
|
+
break;
|
|
297
|
+
case ToolAssistanceImage.MouseWheel:
|
|
298
|
+
svgImage = React.createElement(SvgMouseClickWheel, null);
|
|
299
|
+
break;
|
|
300
|
+
case ToolAssistanceImage.LeftClickDrag:
|
|
301
|
+
svgImage = React.createElement(SvgMouseClickLeftDrag, null);
|
|
302
|
+
className = mediumSize
|
|
303
|
+
? "uifw-toolassistance-svg-medium-wide"
|
|
304
|
+
: "uifw-toolassistance-svg-wide";
|
|
305
|
+
break;
|
|
306
|
+
case ToolAssistanceImage.RightClickDrag:
|
|
307
|
+
svgImage = React.createElement(SvgMouseClickRightDrag, null);
|
|
308
|
+
className = mediumSize
|
|
309
|
+
? "uifw-toolassistance-svg-medium-wide"
|
|
310
|
+
: "uifw-toolassistance-svg-wide";
|
|
311
|
+
break;
|
|
312
|
+
case ToolAssistanceImage.MouseWheelClickDrag:
|
|
313
|
+
svgImage = React.createElement(SvgMouseClickWheelDrag, null);
|
|
314
|
+
className = mediumSize
|
|
315
|
+
? "uifw-toolassistance-svg-medium-wide"
|
|
316
|
+
: "uifw-toolassistance-svg-wide";
|
|
317
|
+
break;
|
|
318
|
+
case ToolAssistanceImage.OneTouchTap:
|
|
319
|
+
svgImage = React.createElement(SvgGestureOneFingerTap, null);
|
|
320
|
+
break;
|
|
321
|
+
case ToolAssistanceImage.OneTouchDoubleTap:
|
|
322
|
+
svgImage = React.createElement(SvgGestureOneFingerTapDouble, null);
|
|
323
|
+
break;
|
|
324
|
+
case ToolAssistanceImage.OneTouchDrag:
|
|
325
|
+
svgImage = React.createElement(SvgGestureOneFingerDrag, null);
|
|
326
|
+
break;
|
|
327
|
+
case ToolAssistanceImage.TwoTouchTap:
|
|
328
|
+
svgImage = React.createElement(SvgGestureTwoFingerTap, null);
|
|
329
|
+
break;
|
|
330
|
+
case ToolAssistanceImage.TwoTouchDrag:
|
|
331
|
+
svgImage = React.createElement(SvgGestureTwoFingerDrag, null);
|
|
332
|
+
break;
|
|
333
|
+
case ToolAssistanceImage.TwoTouchPinch:
|
|
334
|
+
svgImage = React.createElement(SvgGesturePinch, null);
|
|
335
|
+
break;
|
|
336
|
+
case ToolAssistanceImage.TouchCursorTap:
|
|
337
|
+
svgImage = React.createElement(SvgTouchCursorPoint, null);
|
|
338
|
+
break;
|
|
339
|
+
case ToolAssistanceImage.TouchCursorDrag:
|
|
340
|
+
svgImage = React.createElement(SvgTouchCursorPan, null);
|
|
341
|
+
className = mediumSize
|
|
342
|
+
? "uifw-toolassistance-svg-medium-wide"
|
|
343
|
+
: "uifw-toolassistance-svg-wide";
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
image = (React.createElement("div", { className: className }, svgImage && React.createElement(Icon, { iconSpec: svgImage })));
|
|
454
347
|
}
|
|
455
|
-
return
|
|
348
|
+
return image;
|
|
349
|
+
}
|
|
350
|
+
function InstructionKeyboardImage({ keyboardInfo, }) {
|
|
351
|
+
let image;
|
|
352
|
+
if (keyboardInfo.bottomKeys !== undefined) {
|
|
353
|
+
image = (React.createElement("div", { className: "uifw-toolassistance-key-group" },
|
|
354
|
+
React.createElement("span", { className: "row1" }, keyboardInfo.keys.map((key, index) => {
|
|
355
|
+
return (React.createElement(KeyNode, { key: index, keyboardKey: key, className: "uifw-toolassistance-key-small" }));
|
|
356
|
+
})),
|
|
357
|
+
React.createElement("br", null),
|
|
358
|
+
React.createElement("span", { className: "row2" }, keyboardInfo.bottomKeys.map((key, index) => {
|
|
359
|
+
return (React.createElement(KeyNode, { key: index, keyboardKey: key, className: "uifw-toolassistance-key-small" }));
|
|
360
|
+
}))));
|
|
361
|
+
}
|
|
362
|
+
else if (keyboardInfo.keys.length === 2) {
|
|
363
|
+
image = (
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
365
|
+
React.createElement(FillCentered, null, keyboardInfo.keys.map((key, index) => {
|
|
366
|
+
let className = "uifw-toolassistance-key-medium";
|
|
367
|
+
if (key.length > 1)
|
|
368
|
+
className = "uifw-toolassistance-key-modifier";
|
|
369
|
+
return (React.createElement(KeyNode, { key: index, keyboardKey: key, className: className }));
|
|
370
|
+
})));
|
|
371
|
+
}
|
|
372
|
+
else if (keyboardInfo.keys[0]) {
|
|
373
|
+
if (keyboardInfo.keys[0].length > 1)
|
|
374
|
+
image = (React.createElement(KeyNode, { keyboardKey: keyboardInfo.keys[0], className: "uifw-toolassistance-key-large" }));
|
|
375
|
+
else
|
|
376
|
+
image = React.createElement(KeyNode, { keyboardKey: keyboardInfo.keys[0] });
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
Logger.logError(UiFramework.loggerCategory("ToolAssistanceField"), `ToolAssistanceImage.Keyboard specified but ToolAssistanceKeyboardInfo not valid`);
|
|
380
|
+
}
|
|
381
|
+
return image;
|
|
382
|
+
}
|
|
383
|
+
function KeyNode({ keyboardKey, className, }) {
|
|
384
|
+
return (React.createElement("div", { className: classnames("uifw-toolassistance-key", className) },
|
|
385
|
+
React.createElement(FillCentered, null, keyboardKey)));
|
|
456
386
|
}
|
|
457
387
|
//# sourceMappingURL=ToolAssistanceField.js.map
|