@itwin/appui-react 5.29.0 → 5.30.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 +19 -0
- package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/appui-react/configurableui/ConfigurableUiContent.js +2 -2
- package/lib/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/appui-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/CustomNumberEditor.js +1 -0
- package/lib/appui-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/appui-react/editors/LockEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/LockEditor.js +1 -0
- package/lib/appui-react/editors/LockEditor.js.map +1 -1
- package/lib/appui-react/editors/NumericEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/NumericEditor.js +1 -0
- package/lib/appui-react/editors/NumericEditor.js.map +1 -1
- package/lib/appui-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/TextEditor.js +1 -0
- package/lib/appui-react/editors/TextEditor.js.map +1 -1
- package/lib/appui-react/popup/InputEditorPopup.d.ts +1 -15
- package/lib/appui-react/popup/InputEditorPopup.d.ts.map +1 -1
- package/lib/appui-react/popup/InputEditorPopup.js +17 -16
- package/lib/appui-react/popup/InputEditorPopup.js.map +1 -1
- package/lib/appui-react/uiprovider/ComponentGenerator.d.ts.map +1 -1
- package/lib/appui-react/uiprovider/ComponentGenerator.js +5 -2
- package/lib/appui-react/uiprovider/ComponentGenerator.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Change Log - @itwin/appui-react
|
|
2
2
|
|
|
3
|
+
## 5.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b6ca75b: Deprecated legacy editor components in `@itwin/imodel-components-react`:
|
|
8
|
+
|
|
9
|
+
- `ColorEditor`, `ColorPropertyEditor`
|
|
10
|
+
- `WeightEditor`, `WeightPropertyEditor`
|
|
11
|
+
|
|
12
|
+
Use `EditorRenderer` from `@itwin/components-react` instead of using these editor components directly.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [b6ca75b]
|
|
17
|
+
- Updated dependencies [b6ca75b]
|
|
18
|
+
- @itwin/imodel-components-react@5.30.0
|
|
19
|
+
- @itwin/components-react@5.30.0
|
|
20
|
+
- @itwin/core-react@5.30.0
|
|
21
|
+
|
|
3
22
|
## 5.29.0
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableUiContent.d.ts","sourceRoot":"","sources":["../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigurableUiContent.d.ts","sourceRoot":"","sources":["../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgCrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,gBAAgB;AAChB,eAAO,MAAM,qBAAqB;wBAGV,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;oBACvC,mBAAmB,CAAC,eAAe,CAAC;mBACrC,mBAAmB,CAAC,cAAc,CAAC;EAEjD,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FxD"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import "./ConfigurableUiContent.scss";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { Point } from "@itwin/core-react/internal";
|
|
11
|
-
import { IModelConnectionProvider, QuantityEditorSpec, } from "@itwin/imodel-components-react";
|
|
11
|
+
import { IModelConnectionProvider, QuantityEditorSpec, WeightEditorSpec, } from "@itwin/imodel-components-react";
|
|
12
12
|
import { ThemeProvider } from "@itwin/itwinui-react";
|
|
13
13
|
import { CursorInformation } from "../cursor/CursorInformation.js";
|
|
14
14
|
import { CursorPopupMenu } from "../cursor/cursormenu/CursorMenu.js";
|
|
@@ -106,7 +106,7 @@ export function StandardLayout(props) {
|
|
|
106
106
|
React.createElement(ModelessDialogRenderer, null),
|
|
107
107
|
React.createElement(ModalDialogRenderer, null)))))))));
|
|
108
108
|
}
|
|
109
|
-
const defaultEditors = [QuantityEditorSpec];
|
|
109
|
+
const defaultEditors = [QuantityEditorSpec, WeightEditorSpec];
|
|
110
110
|
function useWidgetOpacity(
|
|
111
111
|
/* eslint-disable-next-line @typescript-eslint/no-deprecated */
|
|
112
112
|
widgetOpacity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurableUiContent.js","sourceRoot":"","sources":["../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EA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AE,OAAO;YAC1B,YAAY,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAmC;IACnE,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,OAAO,CACL,oBAAC,wBAAwB,IAAC,gBAAgB,EAAE,MAAM,IAC/C,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ConfigurableUi\n */\n\nimport \"./ConfigurableUiContent.scss\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Point } from \"@itwin/core-react/internal\";\nimport {\n IModelConnectionProvider,\n QuantityEditorSpec,\n} from \"@itwin/imodel-components-react\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\nimport { CursorInformation } from \"../cursor/CursorInformation.js\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu.js\";\nimport { CursorPopupRenderer } from \"../cursor/cursorpopup/CursorPopupManager.js\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager.js\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager.js\";\nimport { ElementTooltip } from \"../feedback/ElementTooltip.js\";\nimport { KeyboardShortcutMenu } from \"../keyboardshortcut/KeyboardShortcutMenu.js\";\nimport { InputFieldMessage } from \"../messages/InputField.js\";\nimport { PointerMessage } from \"../messages/Pointer.js\";\nimport { PopupRenderer } from \"../popup/PopupManager.js\";\nimport { WidgetPanelsFrontstage } from \"../widget-panels/Frontstage.js\";\nimport { ContentDialogRenderer } from \"../dialog/ContentDialogManager.js\";\nimport { appUi, UiFramework } from \"../UiFramework.js\";\nimport { InternalConfigurableUiManager } from \"./InternalConfigurableUiManager.js\";\nimport { MessageRenderer } from \"../messages/MessageRenderer.js\";\nimport {\n TOOLBAR_OPACITY_DEFAULT,\n WIDGET_OPACITY_DEFAULT,\n} from \"../theme/ThemeId.js\";\nimport { useReduxFrameworkState } from \"../uistate/useReduxFrameworkState.js\";\nimport type { ContentProps } from \"../content/ContentGroup.js\";\nimport { ChildWindowRenderer } from \"../childwindow/ChildWindowRenderer.js\";\nimport { useActiveFrontstageDef } from \"../frontstage/FrontstageDef.js\";\nimport type { WidgetActions } from \"../layout/widget/WidgetActions.js\";\nimport type { StagePanelSection } from \"../stagepanels/StagePanelSection.js\";\nimport type { StagePanelLocation } from \"../stagepanels/StagePanelLocation.js\";\nimport type { Widget } from \"../widgets/Widget.js\";\nimport type { WidgetState } from \"../widgets/WidgetState.js\";\nimport { useActiveIModelConnection } from \"../hooks/useActiveIModelConnection.js\";\nimport { EditorsRegistryProvider } from \"@itwin/components-react\";\n\n/** @internal */\nexport const ConfigurableUiContext = React.createContext<\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n ConfigurableUiContentProps & {\n contentElementRef?: React.RefObject<HTMLElement | null>;\n widgetActions?: StandardLayoutProps[\"widgetActions\"];\n toolSettings?: StandardLayoutProps[\"toolSettings\"];\n }\n>({});\n\n/** Properties for [[ConfigurableUiContent]]\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ConfigurableUiContent>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ConfigurableUiContentProps extends CommonProps {\n /** React node of the Backstage */\n appBackstage?: React.ReactNode;\n /** Controls if the view overlay should be displayed. Uses redux store as a fallback. Defaults to `true`.\n * @note Only used by configurable control APIs. See {@link ContentProps.classId}.\n * @deprecated in 4.16.0. View overlay visibility should be controlled by the components used in {@link ContentProps.content}.\n */\n viewOverlay?: boolean;\n /** Describes the opacity of widgets. Uses redux store as a fallback. Defaults to {@link WIDGET_OPACITY_DEFAULT}. */\n widgetOpacity?: number;\n /** Controls if the widget icons should be displayed. Uses redux store as a fallback. Defaults to `true`. */\n widgetIcon?: boolean;\n /** Controls if the active widget's label should always be displayed. Defaults to `false`. */\n showActiveWidgetLabel?: boolean;\n /** Controls if the unpinned panels should be collapsed automatically. Uses redux store as a fallback. Defaults to `false`. */\n collapsePanels?: boolean;\n /** Controls if the tool settings should be animated. Uses redux store as a fallback. Defaults to `false`. */\n animateToolSettings?: boolean;\n /** Controls if the tool settings label should be set based on activated tool. Uses redux store as a fallback. Defaults to `false`. */\n toolAsToolSettingsLabel?: boolean;\n /** Describes the opacity of toolbars. Uses redux store as a fallback. Defaults to {@link TOOLBAR_OPACITY_DEFAULT}. */\n toolbarOpacity?: number;\n /** Component to wrap all popout widgets and other child windows opened via {@link UiFramework.childWindows}. */\n childWindow?: React.ComponentType;\n\n /** @internal */\n idleTimeout?: number;\n /** @internal */\n intervalTimeout?: number;\n}\n\n/**\n * Allows children to get the bounds or other properties of the wrapper element.\n * @internal\n */\nexport const WrapperContext = React.createContext<HTMLElement>(document.body);\n\n/** The main component of `AppUI` that sets up the configurable UI.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function ConfigurableUiContent(props: ConfigurableUiContentProps) {\n const frontstageDef = useActiveFrontstageDef();\n const layout = frontstageDef?.initialConfig?.layout;\n return (\n <ConfigurableUiContext.Provider\n // eslint-disable-next-line react-hooks/exhaustive-deps\n value={React.useMemo(() => props, [...Object.values(props)])}\n >\n {layout ?? <StandardLayout />}\n </ConfigurableUiContext.Provider>\n );\n}\n\ninterface ToolSettingsLocation {\n section: StagePanelSection;\n location: StagePanelLocation;\n}\n\ninterface StandardLayoutProps {\n /** Overrides widget specific actions displayed in the title bar area.\n * Use {@link WidgetActions} component to customize widget actions.\n * @alpha\n */\n widgetActions?: React.ReactNode;\n /** When enabled keeps the tool settings visible to the end user.\n * This is especially useful when the tool settings is undocked as a regular widget.\n * @alpha\n */\n visibleToolSettings?: boolean;\n /** Tool settings related configuration.\n * @alpha\n */\n toolSettings?: {\n /** The default location of the tool settings. Only used when initializing the layout and ignored when restoring a saved layout.\n * When this is specified, the tool settings will be initialized as a widget, instead of the default docked state.\n * @note Use {@link Widget} for further configuration. I.e. set {@link Widget.defaultState} to {@link WidgetState.Floating} to initialize the tool settings as a floating widget.\n * @alpha\n */\n defaultLocation?: ToolSettingsLocation;\n };\n}\n\n/** The standard widget based layout used as a default layout for all frontstages.\n * @alpha\n */\nexport function StandardLayout(props: StandardLayoutProps) {\n const { widgetActions, visibleToolSettings = false, toolSettings } = props;\n const context = React.useContext(ConfigurableUiContext);\n const {\n appBackstage,\n widgetOpacity,\n toolbarOpacity,\n idleTimeout,\n intervalTimeout,\n } = context;\n\n const contentElementRef = React.useRef<HTMLElement>(null);\n useWidgetOpacity(widgetOpacity);\n useToolbarOpacity(toolbarOpacity);\n const [mainElement, setMainElement] = React.useState<HTMLElement>();\n const [portalContainer, setPortalContainer] = React.useState<HTMLElement>();\n React.useEffect(() => {\n UiFramework.keyboardShortcuts.setFocusToHome();\n }, []);\n\n React.useEffect(() => {\n InternalConfigurableUiManager.activityTracker.initialize({\n idleTimeout,\n intervalTimeout,\n });\n return () => {\n InternalConfigurableUiManager.activityTracker.terminate();\n };\n }, [idleTimeout, intervalTimeout]);\n useVisibleToolSettings(visibleToolSettings);\n\n return (\n <ConfigurableUiContext.Provider\n value={React.useMemo(\n () => ({\n ...context,\n contentElementRef,\n widgetActions,\n toolSettings,\n }),\n [context, widgetActions, toolSettings]\n )}\n >\n <main\n role=\"main\"\n id=\"uifw-configurableui-wrapper\"\n className={context.className}\n style={context.style}\n onMouseMove={(e) => {\n const point = new Point(e.pageX, e.pageY);\n CursorInformation.handleMouseMove(point, e.view.document);\n }}\n ref={(el) => setMainElement(el ?? undefined)}\n >\n <WrapperContext.Provider value={mainElement ?? document.body}>\n <ThemeProvider\n style={{ height: \"100%\" }}\n portalContainer={portalContainer}\n >\n <IModelProvider>\n <EditorsRegistryProvider editors={defaultEditors}>\n {appBackstage}\n <WidgetPanelsFrontstage />\n\n <PointerMessage />\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <KeyboardShortcutMenu />\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <InputFieldMessage />\n <CursorPopupMenu />\n <CursorPopupRenderer />\n <PopupRenderer />\n <ElementTooltip />\n <MessageRenderer />\n <ChildWindowRenderer windowManager={appUi.windowManager} />\n <div\n className=\"uifw-configurableui-portalContainer\"\n ref={(instance) => setPortalContainer(instance ?? undefined)}\n >\n <ContentDialogRenderer />\n <ModelessDialogRenderer />\n <ModalDialogRenderer />\n </div>\n </EditorsRegistryProvider>\n </IModelProvider>\n </ThemeProvider>\n </WrapperContext.Provider>\n </main>\n </ConfigurableUiContext.Provider>\n );\n}\n\nconst defaultEditors = [QuantityEditorSpec];\n\nfunction useWidgetOpacity(\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n widgetOpacity: ConfigurableUiContentProps[\"widgetOpacity\"]\n) {\n const reduxWidgetOpacity = useReduxFrameworkState((state) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return state?.configurableUiState.widgetOpacity;\n });\n const opacity = widgetOpacity ?? reduxWidgetOpacity ?? WIDGET_OPACITY_DEFAULT;\n\n React.useEffect(() => {\n const currentWidgetOpacity =\n document.documentElement.style.getPropertyValue(\"--buic-widget-opacity\");\n if (currentWidgetOpacity === opacity.toString()) return;\n document.documentElement.style.setProperty(\n \"--buic-widget-opacity\",\n opacity.toString()\n );\n return () => {\n document.documentElement.style.removeProperty(\"--buic-widget-opacity\");\n };\n }, [opacity]);\n}\n\nfunction useToolbarOpacity(\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n toolbarOpacity: ConfigurableUiContentProps[\"toolbarOpacity\"]\n) {\n const reduxToolbarOpacity = useReduxFrameworkState((state) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return state?.configurableUiState.toolbarOpacity;\n });\n\n const opacity =\n toolbarOpacity ?? reduxToolbarOpacity ?? TOOLBAR_OPACITY_DEFAULT;\n\n React.useEffect(() => {\n const currentToolbarOpacity =\n document.documentElement.style.getPropertyValue(\"--buic-toolbar-opacity\");\n if (currentToolbarOpacity === opacity.toString()) return;\n document.documentElement.style.setProperty(\n \"--buic-toolbar-opacity\",\n opacity.toString()\n );\n return () => {\n document.documentElement.style.removeProperty(\"--buic-toolbar-opacity\");\n };\n }, [opacity]);\n}\n\nfunction useVisibleToolSettings(enabled: boolean) {\n React.useEffect(() => {\n if (!enabled) return;\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const frontstage = UiFramework.frontstages.activeFrontstageDef;\n const toolSettings = frontstage?.toolSettings;\n if (!toolSettings) return;\n toolSettings.show();\n });\n }, [enabled]);\n}\n\nfunction IModelProvider({ children }: React.PropsWithChildren<object>) {\n const imodel = useActiveIModelConnection();\n\n return (\n <IModelConnectionProvider iModelConnection={imodel}>\n {children}\n </IModelConnectionProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigurableUiContent.js","sourceRoot":"","sources":["../../../src/appui-react/configurableui/ConfigurableUiContent.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE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OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAmC;IACnE,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,OAAO,CACL,oBAAC,wBAAwB,IAAC,gBAAgB,EAAE,MAAM,IAC/C,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ConfigurableUi\n */\n\nimport \"./ConfigurableUiContent.scss\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Point } from \"@itwin/core-react/internal\";\nimport {\n IModelConnectionProvider,\n QuantityEditorSpec,\n WeightEditorSpec,\n} from \"@itwin/imodel-components-react\";\nimport { ThemeProvider } from \"@itwin/itwinui-react\";\nimport { CursorInformation } from \"../cursor/CursorInformation.js\";\nimport { CursorPopupMenu } from \"../cursor/cursormenu/CursorMenu.js\";\nimport { CursorPopupRenderer } from \"../cursor/cursorpopup/CursorPopupManager.js\";\nimport { ModalDialogRenderer } from \"../dialog/ModalDialogManager.js\";\nimport { ModelessDialogRenderer } from \"../dialog/ModelessDialogManager.js\";\nimport { ElementTooltip } from \"../feedback/ElementTooltip.js\";\nimport { KeyboardShortcutMenu } from \"../keyboardshortcut/KeyboardShortcutMenu.js\";\nimport { InputFieldMessage } from \"../messages/InputField.js\";\nimport { PointerMessage } from \"../messages/Pointer.js\";\nimport { PopupRenderer } from \"../popup/PopupManager.js\";\nimport { WidgetPanelsFrontstage } from \"../widget-panels/Frontstage.js\";\nimport { ContentDialogRenderer } from \"../dialog/ContentDialogManager.js\";\nimport { appUi, UiFramework } from \"../UiFramework.js\";\nimport { InternalConfigurableUiManager } from \"./InternalConfigurableUiManager.js\";\nimport { MessageRenderer } from \"../messages/MessageRenderer.js\";\nimport {\n TOOLBAR_OPACITY_DEFAULT,\n WIDGET_OPACITY_DEFAULT,\n} from \"../theme/ThemeId.js\";\nimport { useReduxFrameworkState } from \"../uistate/useReduxFrameworkState.js\";\nimport type { ContentProps } from \"../content/ContentGroup.js\";\nimport { ChildWindowRenderer } from \"../childwindow/ChildWindowRenderer.js\";\nimport { useActiveFrontstageDef } from \"../frontstage/FrontstageDef.js\";\nimport type { WidgetActions } from \"../layout/widget/WidgetActions.js\";\nimport type { StagePanelSection } from \"../stagepanels/StagePanelSection.js\";\nimport type { StagePanelLocation } from \"../stagepanels/StagePanelLocation.js\";\nimport type { Widget } from \"../widgets/Widget.js\";\nimport type { WidgetState } from \"../widgets/WidgetState.js\";\nimport { useActiveIModelConnection } from \"../hooks/useActiveIModelConnection.js\";\nimport { EditorsRegistryProvider } from \"@itwin/components-react\";\n\n/** @internal */\nexport const ConfigurableUiContext = React.createContext<\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n ConfigurableUiContentProps & {\n contentElementRef?: React.RefObject<HTMLElement | null>;\n widgetActions?: StandardLayoutProps[\"widgetActions\"];\n toolSettings?: StandardLayoutProps[\"toolSettings\"];\n }\n>({});\n\n/** Properties for [[ConfigurableUiContent]]\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ConfigurableUiContent>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ConfigurableUiContentProps extends CommonProps {\n /** React node of the Backstage */\n appBackstage?: React.ReactNode;\n /** Controls if the view overlay should be displayed. Uses redux store as a fallback. Defaults to `true`.\n * @note Only used by configurable control APIs. See {@link ContentProps.classId}.\n * @deprecated in 4.16.0. View overlay visibility should be controlled by the components used in {@link ContentProps.content}.\n */\n viewOverlay?: boolean;\n /** Describes the opacity of widgets. Uses redux store as a fallback. Defaults to {@link WIDGET_OPACITY_DEFAULT}. */\n widgetOpacity?: number;\n /** Controls if the widget icons should be displayed. Uses redux store as a fallback. Defaults to `true`. */\n widgetIcon?: boolean;\n /** Controls if the active widget's label should always be displayed. Defaults to `false`. */\n showActiveWidgetLabel?: boolean;\n /** Controls if the unpinned panels should be collapsed automatically. Uses redux store as a fallback. Defaults to `false`. */\n collapsePanels?: boolean;\n /** Controls if the tool settings should be animated. Uses redux store as a fallback. Defaults to `false`. */\n animateToolSettings?: boolean;\n /** Controls if the tool settings label should be set based on activated tool. Uses redux store as a fallback. Defaults to `false`. */\n toolAsToolSettingsLabel?: boolean;\n /** Describes the opacity of toolbars. Uses redux store as a fallback. Defaults to {@link TOOLBAR_OPACITY_DEFAULT}. */\n toolbarOpacity?: number;\n /** Component to wrap all popout widgets and other child windows opened via {@link UiFramework.childWindows}. */\n childWindow?: React.ComponentType;\n\n /** @internal */\n idleTimeout?: number;\n /** @internal */\n intervalTimeout?: number;\n}\n\n/**\n * Allows children to get the bounds or other properties of the wrapper element.\n * @internal\n */\nexport const WrapperContext = React.createContext<HTMLElement>(document.body);\n\n/** The main component of `AppUI` that sets up the configurable UI.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function ConfigurableUiContent(props: ConfigurableUiContentProps) {\n const frontstageDef = useActiveFrontstageDef();\n const layout = frontstageDef?.initialConfig?.layout;\n return (\n <ConfigurableUiContext.Provider\n // eslint-disable-next-line react-hooks/exhaustive-deps\n value={React.useMemo(() => props, [...Object.values(props)])}\n >\n {layout ?? <StandardLayout />}\n </ConfigurableUiContext.Provider>\n );\n}\n\ninterface ToolSettingsLocation {\n section: StagePanelSection;\n location: StagePanelLocation;\n}\n\ninterface StandardLayoutProps {\n /** Overrides widget specific actions displayed in the title bar area.\n * Use {@link WidgetActions} component to customize widget actions.\n * @alpha\n */\n widgetActions?: React.ReactNode;\n /** When enabled keeps the tool settings visible to the end user.\n * This is especially useful when the tool settings is undocked as a regular widget.\n * @alpha\n */\n visibleToolSettings?: boolean;\n /** Tool settings related configuration.\n * @alpha\n */\n toolSettings?: {\n /** The default location of the tool settings. Only used when initializing the layout and ignored when restoring a saved layout.\n * When this is specified, the tool settings will be initialized as a widget, instead of the default docked state.\n * @note Use {@link Widget} for further configuration. I.e. set {@link Widget.defaultState} to {@link WidgetState.Floating} to initialize the tool settings as a floating widget.\n * @alpha\n */\n defaultLocation?: ToolSettingsLocation;\n };\n}\n\n/** The standard widget based layout used as a default layout for all frontstages.\n * @alpha\n */\nexport function StandardLayout(props: StandardLayoutProps) {\n const { widgetActions, visibleToolSettings = false, toolSettings } = props;\n const context = React.useContext(ConfigurableUiContext);\n const {\n appBackstage,\n widgetOpacity,\n toolbarOpacity,\n idleTimeout,\n intervalTimeout,\n } = context;\n\n const contentElementRef = React.useRef<HTMLElement>(null);\n useWidgetOpacity(widgetOpacity);\n useToolbarOpacity(toolbarOpacity);\n const [mainElement, setMainElement] = React.useState<HTMLElement>();\n const [portalContainer, setPortalContainer] = React.useState<HTMLElement>();\n React.useEffect(() => {\n UiFramework.keyboardShortcuts.setFocusToHome();\n }, []);\n\n React.useEffect(() => {\n InternalConfigurableUiManager.activityTracker.initialize({\n idleTimeout,\n intervalTimeout,\n });\n return () => {\n InternalConfigurableUiManager.activityTracker.terminate();\n };\n }, [idleTimeout, intervalTimeout]);\n useVisibleToolSettings(visibleToolSettings);\n\n return (\n <ConfigurableUiContext.Provider\n value={React.useMemo(\n () => ({\n ...context,\n contentElementRef,\n widgetActions,\n toolSettings,\n }),\n [context, widgetActions, toolSettings]\n )}\n >\n <main\n role=\"main\"\n id=\"uifw-configurableui-wrapper\"\n className={context.className}\n style={context.style}\n onMouseMove={(e) => {\n const point = new Point(e.pageX, e.pageY);\n CursorInformation.handleMouseMove(point, e.view.document);\n }}\n ref={(el) => setMainElement(el ?? undefined)}\n >\n <WrapperContext.Provider value={mainElement ?? document.body}>\n <ThemeProvider\n style={{ height: \"100%\" }}\n portalContainer={portalContainer}\n >\n <IModelProvider>\n <EditorsRegistryProvider editors={defaultEditors}>\n {appBackstage}\n <WidgetPanelsFrontstage />\n\n <PointerMessage />\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <KeyboardShortcutMenu />\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <InputFieldMessage />\n <CursorPopupMenu />\n <CursorPopupRenderer />\n <PopupRenderer />\n <ElementTooltip />\n <MessageRenderer />\n <ChildWindowRenderer windowManager={appUi.windowManager} />\n <div\n className=\"uifw-configurableui-portalContainer\"\n ref={(instance) => setPortalContainer(instance ?? undefined)}\n >\n <ContentDialogRenderer />\n <ModelessDialogRenderer />\n <ModalDialogRenderer />\n </div>\n </EditorsRegistryProvider>\n </IModelProvider>\n </ThemeProvider>\n </WrapperContext.Provider>\n </main>\n </ConfigurableUiContext.Provider>\n );\n}\n\nconst defaultEditors = [QuantityEditorSpec, WeightEditorSpec];\n\nfunction useWidgetOpacity(\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n widgetOpacity: ConfigurableUiContentProps[\"widgetOpacity\"]\n) {\n const reduxWidgetOpacity = useReduxFrameworkState((state) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return state?.configurableUiState.widgetOpacity;\n });\n const opacity = widgetOpacity ?? reduxWidgetOpacity ?? WIDGET_OPACITY_DEFAULT;\n\n React.useEffect(() => {\n const currentWidgetOpacity =\n document.documentElement.style.getPropertyValue(\"--buic-widget-opacity\");\n if (currentWidgetOpacity === opacity.toString()) return;\n document.documentElement.style.setProperty(\n \"--buic-widget-opacity\",\n opacity.toString()\n );\n return () => {\n document.documentElement.style.removeProperty(\"--buic-widget-opacity\");\n };\n }, [opacity]);\n}\n\nfunction useToolbarOpacity(\n /* eslint-disable-next-line @typescript-eslint/no-deprecated */\n toolbarOpacity: ConfigurableUiContentProps[\"toolbarOpacity\"]\n) {\n const reduxToolbarOpacity = useReduxFrameworkState((state) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return state?.configurableUiState.toolbarOpacity;\n });\n\n const opacity =\n toolbarOpacity ?? reduxToolbarOpacity ?? TOOLBAR_OPACITY_DEFAULT;\n\n React.useEffect(() => {\n const currentToolbarOpacity =\n document.documentElement.style.getPropertyValue(\"--buic-toolbar-opacity\");\n if (currentToolbarOpacity === opacity.toString()) return;\n document.documentElement.style.setProperty(\n \"--buic-toolbar-opacity\",\n opacity.toString()\n );\n return () => {\n document.documentElement.style.removeProperty(\"--buic-toolbar-opacity\");\n };\n }, [opacity]);\n}\n\nfunction useVisibleToolSettings(enabled: boolean) {\n React.useEffect(() => {\n if (!enabled) return;\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const frontstage = UiFramework.frontstages.activeFrontstageDef;\n const toolSettings = frontstage?.toolSettings;\n if (!toolSettings) return;\n toolSettings.show();\n });\n }, [enabled]);\n}\n\nfunction IModelProvider({ children }: React.PropsWithChildren<object>) {\n const imodel = useActiveIModelConnection();\n\n return (\n <IModelConnectionProvider iModelConnection={imodel}>\n {children}\n </IModelConnectionProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,0BAA0B,IAAI,8BAA8B,EAC7D,MAAM,yBAAyB,CAAC;AAQjC,gBAAgB;AAChB,qBAAa,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS,sBAE5B;CACF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module PropertyEditors
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { CustomNumberEditor as BaseCustomNumberEditor, CustomNumberPropertyEditor as BaseCustomNumberPropertyEditor, } from "@itwin/components-react";
|
|
10
11
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,0BAA0B,IAAI,8BAA8B,GAC7D,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS;QAC3B,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;CACF;AAED,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,SAAS,kBAAkB,CAAC,KAAK,EAAE,YAAY;IAC7C,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,sBAAsB,OACjB,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport * as React from \"react\";\nimport {\n CustomNumberEditor as BaseCustomNumberEditor,\n CustomNumberPropertyEditor as BaseCustomNumberPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class CustomNumberPropertyEditor extends BaseCustomNumberPropertyEditor {\n public override get reactNode() {\n return <CustomNumberEditor />;\n }\n}\n\nconst CustomNumberEditor = React.forwardRef<BaseCustomNumberEditor>(\n function CustomNumberEditor(props, forwardedRef) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseCustomNumberEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,0BAA0B,IAAI,8BAA8B,GAC7D,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS;QAC3B,OAAO,oBAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;CACF;AAED,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,CACzC,SAAS,kBAAkB,CAAC,KAAK,EAAE,YAAY;IAC7C,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,sBAAsB,OACjB,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport * as React from \"react\";\nimport {\n CustomNumberEditor as BaseCustomNumberEditor,\n CustomNumberPropertyEditor as BaseCustomNumberPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class CustomNumberPropertyEditor extends BaseCustomNumberPropertyEditor {\n public override get reactNode() {\n return <CustomNumberEditor />;\n }\n}\n\nconst CustomNumberEditor = React.forwardRef<BaseCustomNumberEditor>(\n function CustomNumberEditor(props, forwardedRef) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseCustomNumberEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LockEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/LockEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"LockEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/LockEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAyE7D,gBAAgB;AAChB,qBAAa,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS,sBAEnB;CACF;AAED,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,sCAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LockEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/LockEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACjC,SAAS,UAAU,CAAC,KAAK,EAAE,YAAY;IACrC,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAClD,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,IACE,KAAK,CAAC,cAAc;YACpB,KAAK,C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AAG,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAAE,OAAO;YACrD,KAAK,CAAC,QAAQ,CAAC;gBACb,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,QAAQ,EAAE;oBACR,WAAW,EAAE,mBAAmB,CAAC,SAAS;oBAC1C,KAAK,EAAE,CAAC,YAAY;oBACpB,YAAY,EAAE,EAAE;iBACjB;aACF,CAAC,CAAC;QACL,CAAC,IAEA,YAAY,CAAC,CAAC,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAG,CACtC,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB;AAChB,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,mCAAmC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport * as React from \"react\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport { PropertyEditorBase } from \"@itwin/components-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { SvgLock, SvgLockUnlocked } from \"@itwin/itwinui-icons-react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\n\nconst LockEditor = React.forwardRef<TypeEditor, PropertyEditorProps>(\n function LockEditor(props, forwardedRef) {\n const ref = React.useRef<HTMLButtonElement>(null);\n const getCurrentValue = () => {\n if (\n props.propertyRecord &&\n props.propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n return props.propertyRecord.value.value as boolean;\n }\n return false;\n };\n const currentValue = getCurrentValue();\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n getPropertyValue: async () => {\n let propertyValue: PropertyValue | undefined;\n if (\n props.propertyRecord &&\n props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n ) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: currentValue,\n displayValue: \"\",\n };\n }\n return propertyValue;\n },\n htmlElement: ref.current,\n hasFocus: document.activeElement === ref.current,\n }),\n [currentValue, props.propertyRecord]\n );\n\n const displayLabel = props.propertyRecord?.property.displayLabel;\n const label = displayLabel ? displayLabel : \"Toggle lock\";\n const disabled = props.propertyRecord?.isDisabled;\n return (\n <IconButton\n ref={ref}\n label={label}\n size=\"small\"\n styleType=\"borderless\"\n isActive={currentValue}\n disabled={disabled}\n onClick={() => {\n if (!props.propertyRecord || !props.onCommit) return;\n props.onCommit({\n propertyRecord: props.propertyRecord,\n newValue: {\n valueFormat: PropertyValueFormat.Primitive,\n value: !currentValue,\n displayValue: \"\",\n },\n });\n }}\n >\n {currentValue ? <SvgLock /> : <SvgLockUnlocked />}\n </IconButton>\n );\n }\n);\n\n/** @internal */\nexport class LockPropertyEditor extends PropertyEditorBase {\n public get reactNode() {\n return <LockEditor />;\n }\n}\n\n/** @internal */\nexport const LockPropertyEditorName = \"appui-internal:tool-settings-lock\";\n"]}
|
|
1
|
+
{"version":3,"file":"LockEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/LockEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,mBAAm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AC;IAC1D,MAAM,QAAQ,GAAG,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC;IAClD,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAAE,OAAO;YACrD,KAAK,CAAC,QAAQ,CAAC;gBACb,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,QAAQ,EAAE;oBACR,WAAW,EAAE,mBAAmB,CAAC,SAAS;oBAC1C,KAAK,EAAE,CAAC,YAAY;oBACpB,YAAY,EAAE,EAAE;iBACjB;aACF,CAAC,CAAC;QACL,CAAC,IAEA,YAAY,CAAC,CAAC,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAG,CACtC,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB;AAChB,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IACxD,IAAW,SAAS;QAClB,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,mCAAmC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport * as React from \"react\";\nimport type { PropertyEditorProps, TypeEditor } from \"@itwin/components-react\";\nimport { PropertyEditorBase } from \"@itwin/components-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { SvgLock, SvgLockUnlocked } from \"@itwin/itwinui-icons-react\";\nimport type { PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\n\nconst LockEditor = React.forwardRef<TypeEditor, PropertyEditorProps>(\n function LockEditor(props, forwardedRef) {\n const ref = React.useRef<HTMLButtonElement>(null);\n const getCurrentValue = () => {\n if (\n props.propertyRecord &&\n props.propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n return props.propertyRecord.value.value as boolean;\n }\n return false;\n };\n const currentValue = getCurrentValue();\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n getPropertyValue: async () => {\n let propertyValue: PropertyValue | undefined;\n if (\n props.propertyRecord &&\n props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n ) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: currentValue,\n displayValue: \"\",\n };\n }\n return propertyValue;\n },\n htmlElement: ref.current,\n hasFocus: document.activeElement === ref.current,\n }),\n [currentValue, props.propertyRecord]\n );\n\n const displayLabel = props.propertyRecord?.property.displayLabel;\n const label = displayLabel ? displayLabel : \"Toggle lock\";\n const disabled = props.propertyRecord?.isDisabled;\n return (\n <IconButton\n ref={ref}\n label={label}\n size=\"small\"\n styleType=\"borderless\"\n isActive={currentValue}\n disabled={disabled}\n onClick={() => {\n if (!props.propertyRecord || !props.onCommit) return;\n props.onCommit({\n propertyRecord: props.propertyRecord,\n newValue: {\n valueFormat: PropertyValueFormat.Primitive,\n value: !currentValue,\n displayValue: \"\",\n },\n });\n }}\n >\n {currentValue ? <SvgLock /> : <SvgLockUnlocked />}\n </IconButton>\n );\n }\n);\n\n/** @internal */\nexport class LockPropertyEditor extends PropertyEditorBase {\n public get reactNode() {\n return <LockEditor />;\n }\n}\n\n/** @internal */\nexport const LockPropertyEditorName = \"appui-internal:tool-settings-lock\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,0BAA0B,IAAI,8BAA8B,EAC7D,MAAM,yBAAyB,CAAC;AAQjC,gBAAgB;AAChB,qBAAa,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS,sBAE5B;CACF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module PropertyEditors
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { NumericInputEditor as BaseNumericInputEditor, NumericInputPropertyEditor as BaseNumericInputPropertyEditor, } from "@itwin/components-react";
|
|
10
11
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,0BAA0B,IAAI,8BAA8B,GAC7D,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS;QAC3B,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,SAAS,aAAa,CAAC,KAAK,EAAE,YAAY;IACxC,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,sBAAsB,OACjB,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport * as React from \"react\";\nimport {\n NumericInputEditor as BaseNumericInputEditor,\n NumericInputPropertyEditor as BaseNumericInputPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class NumericInputPropertyEditor extends BaseNumericInputPropertyEditor {\n public override get reactNode() {\n return <NumericEditor />;\n }\n}\n\nconst NumericEditor = React.forwardRef<BaseNumericInputEditor>(\n function NumericEditor(props, forwardedRef) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseNumericInputEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,0BAA0B,IAAI,8BAA8B,GAC7D,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC5E,IAAoB,SAAS;QAC3B,OAAO,oBAAC,aAAa,OAAG,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CACpC,SAAS,aAAa,CAAC,KAAK,EAAE,YAAY;IACxC,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,sBAAsB,OACjB,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport * as React from \"react\";\nimport {\n NumericInputEditor as BaseNumericInputEditor,\n NumericInputPropertyEditor as BaseNumericInputPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class NumericInputPropertyEditor extends BaseNumericInputPropertyEditor {\n public override get reactNode() {\n return <NumericEditor />;\n }\n}\n\nconst NumericEditor = React.forwardRef<BaseNumericInputEditor>(\n function NumericEditor(props, forwardedRef) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseNumericInputEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,mBAAmB,IAAI,sBAAsB,EAC9C,MAAM,yBAAyB,CAAC;AAQjC,gBAAgB;AAChB,qBAAa,kBAAmB,SAAQ,sBAAsB;IAC5D,IAAoB,SAAS,sBAE5B;CACF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module PropertyEditors
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { TextEditor as BaseTextEditor, BasicPropertyEditor as BaseTextPropertyEditor, } from "@itwin/components-react";
|
|
10
11
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,mBAAmB,IAAI,sBAAsB,GAC9C,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,IAAoB,SAAS;QAC3B,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAiB,SAAS,UAAU,CACrE,KAAK,EACL,YAAY;IAEZ,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,cAAc,OACT,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport * as React from \"react\";\nimport {\n TextEditor as BaseTextEditor,\n BasicPropertyEditor as BaseTextPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class TextPropertyEditor extends BaseTextPropertyEditor {\n public override get reactNode() {\n return <TextEditor />;\n }\n}\n\nconst TextEditor = React.forwardRef<BaseTextEditor>(function TextEditor(\n props,\n forwardedRef\n) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseTextEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n});\n"]}
|
|
1
|
+
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,mBAAmB,IAAI,sBAAsB,GAC9C,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAE3H,gBAAgB;AAChB,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAC5D,IAAoB,SAAS;QAC3B,OAAO,oBAAC,UAAU,OAAG,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAiB,SAAS,UAAU,CACrE,KAAK,EACL,YAAY;IAEZ,MAAM,oBAAoB,GAAG,6BAA6B,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG;QACpB,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,oBAAC,yBAAyB,OAAG,CAAC,CAAC,CAAC,SAAS;KACpC,CAAC;IACrC,OAAO,CACL,oBAAC,cAAc,OACT,KAAK,KACL,aAAa,EACjB,oBAAoB,EAAE,oBAAoB,EAC1C,GAAG,EAAE,YAAY,GACjB,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport * as React from \"react\";\nimport {\n TextEditor as BaseTextEditor,\n BasicPropertyEditor as BaseTextPropertyEditor,\n} from \"@itwin/components-react\";\nimport type { InternalInputEditorProps } from \"@itwin/components-react/internal\";\nimport {\n LockButtonInputDecoration,\n useLockDecoration,\n} from \"./LockProvider.js\";\nimport { useToolSettingsKeyPressCommit } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** @internal */\nexport class TextPropertyEditor extends BaseTextPropertyEditor {\n public override get reactNode() {\n return <TextEditor />;\n }\n}\n\nconst TextEditor = React.forwardRef<BaseTextEditor>(function TextEditor(\n props,\n forwardedRef\n) {\n const shouldCommitOnChange = useToolSettingsKeyPressCommit();\n const lockDecoration = useLockDecoration();\n const internalProps = {\n decoration: lockDecoration ? <LockButtonInputDecoration /> : undefined,\n } satisfies InternalInputEditorProps;\n return (\n <BaseTextEditor\n {...props}\n {...internalProps}\n shouldCommitOnChange={shouldCommitOnChange}\n ref={forwardedRef}\n />\n );\n});\n"]}
|
|
@@ -5,7 +5,6 @@ import * as React from "react";
|
|
|
5
5
|
import type { Primitives, PropertyRecord } from "@itwin/appui-abstract";
|
|
6
6
|
import type { PropertyUpdatedArgs } from "@itwin/components-react";
|
|
7
7
|
import type { PopupPropsBase } from "./PopupManager.js";
|
|
8
|
-
import type { SizeProps } from "../utils/SizeProps.js";
|
|
9
8
|
/** @beta */
|
|
10
9
|
export declare class InputEditorCommitHandler {
|
|
11
10
|
readonly onCommit: (value: Primitives.Value) => void;
|
|
@@ -19,21 +18,8 @@ export interface InputEditorPopupProps extends PopupPropsBase {
|
|
|
19
18
|
onCancel: () => void;
|
|
20
19
|
commitHandler: InputEditorCommitHandler;
|
|
21
20
|
}
|
|
22
|
-
interface InputEditorPopupState {
|
|
23
|
-
size: SizeProps;
|
|
24
|
-
}
|
|
25
21
|
/** Popup component for Input Editor
|
|
26
22
|
* @alpha
|
|
27
23
|
*/
|
|
28
|
-
export declare
|
|
29
|
-
readonly state: {
|
|
30
|
-
size: {
|
|
31
|
-
width: number;
|
|
32
|
-
height: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
private _onSizeKnown;
|
|
36
|
-
render(): React.JSX.Element;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
24
|
+
export declare function InputEditorPopup(props: InputEditorPopupProps): React.JSX.Element;
|
|
39
25
|
//# sourceMappingURL=InputEditorPopup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputEditorPopup.d.ts","sourceRoot":"","sources":["../../../src/appui-react/popup/InputEditorPopup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"InputEditorPopup.d.ts","sourceRoot":"","sources":["../../../src/appui-react/popup/InputEditorPopup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,YAAY;AACZ,qBAAa,wBAAwB;aACP,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI;gBAA3C,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI;IAEhE,YAAY,SAAU,mBAAmB,UAS9C;CACH;AAED;WACW;AACX,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,EAAE,wBAAwB,CAAC;CACzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAgC5D"}
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
10
|
-
import {
|
|
10
|
+
import { PropertyRecordEditor } from "@itwin/components-react";
|
|
11
11
|
import { DivWithOutsideClick } from "@itwin/core-react";
|
|
12
12
|
import { PopupManager } from "./PopupManager.js";
|
|
13
13
|
import { PositionPopup, PositionPopupContent } from "./PositionPopup.js";
|
|
14
|
+
import { useMemo } from "react";
|
|
15
|
+
import { useToolSettingsNewEditors } from "../preview/tool-settings-new-editors/useToolSettingsNewEditors.js";
|
|
14
16
|
/** @beta */
|
|
15
17
|
export class InputEditorCommitHandler {
|
|
16
18
|
onCommit;
|
|
@@ -29,22 +31,21 @@ export class InputEditorCommitHandler {
|
|
|
29
31
|
/** Popup component for Input Editor
|
|
30
32
|
* @alpha
|
|
31
33
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_onSizeKnown = (newSize) => {
|
|
37
|
-
if (newSize.height ===
|
|
38
|
-
newSize.width === this.state.size.width)
|
|
34
|
+
export function InputEditorPopup(props) {
|
|
35
|
+
const { id, el, pt, offset, record, commitHandler, onCancel } = props;
|
|
36
|
+
const [size, setSize] = React.useState({ width: -1, height: -1 });
|
|
37
|
+
const newEditors = useToolSettingsNewEditors();
|
|
38
|
+
const _onSizeKnown = (newSize) => {
|
|
39
|
+
if (newSize.height === size.height && newSize.width === size.width)
|
|
39
40
|
return;
|
|
40
|
-
|
|
41
|
+
setSize(newSize);
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
React.createElement(
|
|
46
|
-
React.createElement(
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const point = useMemo(() => PopupManager.getPopupPosition(el, pt, offset, size), [el, pt, offset, size]);
|
|
44
|
+
return (React.createElement(PositionPopup, { key: id, point: point, onSizeKnown: _onSizeKnown },
|
|
45
|
+
React.createElement(DivWithOutsideClick, { onOutsideClick: onCancel },
|
|
46
|
+
React.createElement(PositionPopupContent, null,
|
|
47
|
+
React.createElement(PropertyRecordEditor, { propertyRecord: record, onCommit: commitHandler.handleCommit, onCancel: onCancel, setFocus: true,
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
49
|
+
editorSystem: newEditors ? "new" : "legacy" })))));
|
|
49
50
|
}
|
|
50
51
|
//# sourceMappingURL=InputEditorPopup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputEditorPopup.js","sourceRoot":"","sources":["../../../src/appui-react/popup/InputEditorPopup.tsx"],"names":[],"mappings":"AAAA;;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AE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAY,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7E,MAAM,UAAU,GAAG,yBAAyB,EAAE,CAAC;IAE/C,MAAM,YAAY,GAAG,CAAC,OAAkB,EAAE,EAAE;QAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,OAAO;QAC3E,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EACzD,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CACvB,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,IAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY;QAE7D,oBAAC,mBAAmB,IAAC,cAAc,EAAE,QAAQ;YAC3C,oBAAC,oBAAoB;gBACnB,oBAAC,oBAAoB,IACnB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,aAAa,CAAC,YAAY,EACpC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,IAAI;oBACd,4DAA4D;oBAC5D,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,GAC3C,CACmB,CACH,CACR,CACjB,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Popup\n */\n\nimport * as React from \"react\";\nimport type { Primitives, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { PropertyRecordEditor } from \"@itwin/components-react\";\nimport { DivWithOutsideClick } from \"@itwin/core-react\";\nimport type { PopupPropsBase } from \"./PopupManager.js\";\nimport { PopupManager } from \"./PopupManager.js\";\nimport { PositionPopup, PositionPopupContent } from \"./PositionPopup.js\";\nimport type { SizeProps } from \"../utils/SizeProps.js\";\nimport { useMemo } from \"react\";\nimport { useToolSettingsNewEditors } from \"../preview/tool-settings-new-editors/useToolSettingsNewEditors.js\";\n\n/** @beta */\nexport class InputEditorCommitHandler {\n constructor(public readonly onCommit: (value: Primitives.Value) => void) {}\n\n public handleCommit = (args: PropertyUpdatedArgs) => {\n let newValue: Primitives.Value = 0;\n if (\n args.newValue.valueFormat === PropertyValueFormat.Primitive &&\n args.newValue.value !== undefined\n ) {\n newValue = args.newValue.value;\n }\n this.onCommit(newValue);\n };\n}\n\n/** Props for popup editor\n * @beta */\nexport interface InputEditorPopupProps extends PopupPropsBase {\n record: PropertyRecord;\n onCancel: () => void;\n commitHandler: InputEditorCommitHandler;\n}\n\n/** Popup component for Input Editor\n * @alpha\n */\nexport function InputEditorPopup(props: InputEditorPopupProps) {\n const { id, el, pt, offset, record, commitHandler, onCancel } = props;\n const [size, setSize] = React.useState<SizeProps>({ width: -1, height: -1 });\n const newEditors = useToolSettingsNewEditors();\n\n const _onSizeKnown = (newSize: SizeProps) => {\n if (newSize.height === size.height && newSize.width === size.width) return;\n setSize(newSize);\n };\n\n const point = useMemo(\n () => PopupManager.getPopupPosition(el, pt, offset, size),\n [el, pt, offset, size]\n );\n\n return (\n <PositionPopup key={id} point={point} onSizeKnown={_onSizeKnown}>\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <DivWithOutsideClick onOutsideClick={onCancel}>\n <PositionPopupContent>\n <PropertyRecordEditor\n propertyRecord={record}\n onCommit={commitHandler.handleCommit}\n onCancel={onCancel}\n setFocus={true}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={newEditors ? \"new\" : \"legacy\"}\n />\n </PositionPopupContent>\n </DivWithOutsideClick>\n </PositionPopup>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentGenerator.d.ts","sourceRoot":"","sources":["../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ComponentGenerator.d.ts","sourceRoot":"","sources":["../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAuM1E;;GAEG;AACH,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,SAAS,CAAC;gBADV,eAAe,EAAE,oBAAoB,EACrC,SAAS,CAAC,GAAE,MAAM,IAAI,aAAA;IAGhC,IAAW,cAAc,yBAExB;IAED,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,iCAAiC;IA2BzC,OAAO,CAAC,mCAAmC;IAiC3C,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,YAAY;IAKb,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS;IAazD,oBAAoB,CACzB,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,GACf,iBAAiB;IAWpB,6DAA6D;IACtD,sBAAsB,IAAI,iBAAiB,EAAE;CAKrD"}
|
|
@@ -9,7 +9,7 @@ import "./DefaultDialogGridContainer.scss";
|
|
|
9
9
|
import classnames from "classnames";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { PropertyValueFormat, UiLayoutDataProvider, } from "@itwin/appui-abstract";
|
|
12
|
-
import {
|
|
12
|
+
import { PropertyRecordEditor } from "@itwin/components-react";
|
|
13
13
|
import { assert, Logger } from "@itwin/core-bentley";
|
|
14
14
|
import { Label } from "@itwin/itwinui-react";
|
|
15
15
|
import { useToolSettingsNewEditors } from "../preview/tool-settings-new-editors/useToolSettingsNewEditors.js";
|
|
@@ -116,7 +116,10 @@ function PropertyEditor(props) {
|
|
|
116
116
|
const useNewEditors = useToolSettingsNewEditors();
|
|
117
117
|
const lockPropertyName = isLock ? initialItem.property.name : undefined;
|
|
118
118
|
return (React.createElement(PropertyEditorProvider, { uiDataProvider: uiDataProvider, itemPropertyName: itemPropertyName ?? initialItem.property.name, lockPropertyName: lockPropertyName },
|
|
119
|
-
React.createElement("div", { key: initialItem.property.name, className: className },
|
|
119
|
+
React.createElement("div", { key: initialItem.property.name, className: className },
|
|
120
|
+
React.createElement(PropertyRecordEditor, { key: initialItem.property.name, propertyRecord: propertyRecord, setFocus: setFocus, onCommit: handleCommit, onCancel: onCancel ?? handleCancel,
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
122
|
+
editorSystem: useNewEditors ? "new" : "legacy", size: "small" }))));
|
|
120
123
|
}
|
|
121
124
|
/** Utility methods to generate react ui from DialogRow specs
|
|
122
125
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AAE9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAChH,OAAO,EACL,WAAW,EACX,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,IAAI,EACJ,gBAAgB,GAKjB;IACC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC1D,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,uEAAuE;IACvE,KAAK,CA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AK,CAAC;IACR,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAChE,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,eAAe,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAExC,MAAM,UAAU,GAAG,uBAAuB;QACxC,CAAC,CAAC,4DAA4D;QAC9D,CAAC,CAAC,6BAA6B,CAAC;IAClC,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU;QACvB,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;QACvC,KAAK,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { EditorContainer, PropertyRecordEditor } from \"@itwin/components-react\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { Label } from \"@itwin/itwinui-react\";\nimport { useToolSettingsNewEditors } from \"../preview/tool-settings-new-editors/useToolSettingsNewEditors.js\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings.js\";\nimport { useLockButtonPropertyRecord } from \"../preview/tool-settings-lock-button/useToolSettingsLockButton.js\";\nimport {\n LockContext,\n PropertyEditorProvider,\n} from \"../editors/LockProvider.js\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel || item.property.name;\n }, [item]);\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem) => syncItem.propertyName === item.property.name\n );\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n });\n }, [uiDataProvider, item]);\n\n const className = classnames(\n \"uifw-default-label\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\"\n );\n return (\n <Label\n className={className}\n htmlFor={item.property.name}\n disabled={isDisabled}\n >\n {displayLabel}:\n </Label>\n );\n}\n\nfunction PropertyEditor(props: {\n uiDataProvider: UiLayoutDataProvider;\n // Property or a lock property.\n initialItem: BaseDialogItem;\n // If a lock property is rendered, this prop contains the property name of the property that the lock property locks.\n itemPropertyName: string;\n isLock?: boolean;\n setFocus?: boolean;\n onCancel?: () => void;\n}) {\n const {\n uiDataProvider,\n initialItem,\n itemPropertyName,\n isLock = false,\n setFocus,\n onCancel,\n } = props;\n const getLatestRecordValue = React.useCallback(\n (initial: BaseDialogItem) => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initial);\n\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) => item.lockProperty?.property.name === initial.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initial.property.name\n );\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n },\n [isLock, uiDataProvider.items]\n );\n\n const currentRecord = getLatestRecordValue(initialItem);\n const [_propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n const propertyRecord = useLockButtonPropertyRecord(_propertyRecord, isLock);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n });\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n React.useEffect(() => {\n return uiDataProvider.onItemsReloadedEvent.addListener(() => {\n const newItem = findDialogItem(\n uiDataProvider,\n initialItem.property.name,\n isLock\n );\n if (!newItem) return;\n setPropertyRecord(getLatestRecordValue(newItem));\n });\n }, [uiDataProvider, initialItem.property.name, getLatestRecordValue, isLock]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n const handleCancel = () => {};\n\n const useNewEditors = useToolSettingsNewEditors();\n\n const lockPropertyName = isLock ? initialItem.property.name : undefined;\n return (\n <PropertyEditorProvider\n uiDataProvider={uiDataProvider}\n itemPropertyName={itemPropertyName ?? initialItem.property.name}\n lockPropertyName={lockPropertyName}\n >\n <div key={initialItem.property.name} className={className}>\n {useNewEditors ? (\n <PropertyRecordEditor\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={onCancel ?? handleCancel}\n editorSystem=\"new\"\n size=\"small\"\n />\n ) : (\n <EditorContainer\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={onCancel ?? handleCancel}\n />\n )}\n </div>\n </PropertyEditorProvider>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @public\n */\nexport class ComponentGenerator {\n constructor(\n private _uiDataProvider: UiLayoutDataProvider,\n private _onCancel?: () => void\n ) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false,\n itemPropertyName?: string\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n itemPropertyName={itemPropertyName ?? item.property.name}\n isLock={isLock}\n setFocus={setFocus}\n onCancel={this._onCancel}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item): React.ReactNode => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item): React.ReactNode => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n return (\n <LeftLockAndLabel\n key={`lock-${record.property.name}`}\n lockEditor={lockEditor}\n label={label}\n multiplePropertiesOnRow={multiplePropertiesOnRow}\n itemPropertyName={rowItem.property.name}\n />\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map(\n (item: DialogItem, index: number): React.ReactNode =>\n this.getInlineLabelAndEditor(item, index === 0)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (row.items.length === 1) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n\nfunction findDialogItem(\n uiDataProvider: UiLayoutDataProvider,\n propertyName: string,\n isLock: boolean\n) {\n const dialogItem = uiDataProvider.items.find((item) => {\n if (isLock) {\n return item.lockProperty?.property.name === propertyName;\n }\n return item.property.name === propertyName;\n });\n return isLock ? dialogItem?.lockProperty : dialogItem;\n}\n\ninterface LeftLockAndLabelProps {\n lockEditor?: React.ReactNode;\n label?: React.ReactNode;\n multiplePropertiesOnRow: boolean;\n itemPropertyName: string;\n}\n\nfunction LeftLockAndLabel(props: LeftLockAndLabelProps) {\n const { lockEditor, label, multiplePropertiesOnRow, itemPropertyName } =\n props;\n const { lockDecorations } = React.useContext(LockContext) ?? {};\n const lockDecoration = React.useMemo(() => {\n return lockDecorations?.[itemPropertyName];\n }, [lockDecorations, itemPropertyName]);\n\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div className={classNames}>\n {lockDecoration ? undefined : lockEditor}\n {label}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ComponentGenerator.js","sourceRoot":"","sources":["../../../src/appui-react/uiprovider/ComponentGenerator.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,mCAAmC,CAAC;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mEAAmE,CAAC;AAE9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAChH,OAAO,EACL,WAAW,EACX,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,IAAI,EACJ,gBAAgB,GAKjB;IACC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,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AC,KAA4B;IACpD,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,GACpE,KAAK,CAAC;IACR,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAChE,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,eAAe,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAExC,MAAM,UAAU,GAAG,uBAAuB;QACxC,CAAC,CAAC,4DAA4D;QAC9D,CAAC,CAAC,6BAA6B,CAAC;IAClC,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU;QACvB,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;QACvC,KAAK,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UiProvider\n */\n\nimport \"./DefaultDialogGridContainer.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n BaseDialogItem,\n DialogItem,\n DialogItemValue,\n DialogPropertySyncItem,\n DialogRow,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyValueFormat,\n UiLayoutDataProvider,\n} from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"@itwin/components-react\";\nimport { PropertyRecordEditor } from \"@itwin/components-react\";\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { Label } from \"@itwin/itwinui-react\";\nimport { useToolSettingsNewEditors } from \"../preview/tool-settings-new-editors/useToolSettingsNewEditors.js\";\nimport type { ToolSettingsEntry } from \"../widget-panels/ToolSettings.js\";\nimport { useLockButtonPropertyRecord } from \"../preview/tool-settings-lock-button/useToolSettingsLockButton.js\";\nimport {\n LockContext,\n PropertyEditorProvider,\n} from \"../editors/LockProvider.js\";\n\nfunction EditorLabel({\n uiDataProvider,\n item,\n isLeftmostRecord,\n}: {\n uiDataProvider: UiLayoutDataProvider;\n item: DialogItem;\n isLeftmostRecord?: boolean;\n}) {\n const [isDisabled, setIsDisabled] = React.useState(!!item.isDisabled);\n const displayLabel = React.useMemo(() => {\n return item.property.displayLabel || item.property.name;\n }, [item]);\n\n // listen for tool sync property events and update the isDisabled state\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem) => syncItem.propertyName === item.property.name\n );\n if (mySyncItem) {\n setIsDisabled(!!mySyncItem.isDisabled);\n }\n });\n }, [uiDataProvider, item]);\n\n const className = classnames(\n \"uifw-default-label\",\n !!isLeftmostRecord && \"uifw-default-narrow-only-display\"\n );\n return (\n <Label\n className={className}\n htmlFor={item.property.name}\n disabled={isDisabled}\n >\n {displayLabel}:\n </Label>\n );\n}\n\nfunction PropertyEditor(props: {\n uiDataProvider: UiLayoutDataProvider;\n // Property or a lock property.\n initialItem: BaseDialogItem;\n // If a lock property is rendered, this prop contains the property name of the property that the lock property locks.\n itemPropertyName: string;\n isLock?: boolean;\n setFocus?: boolean;\n onCancel?: () => void;\n}) {\n const {\n uiDataProvider,\n initialItem,\n itemPropertyName,\n isLock = false,\n setFocus,\n onCancel,\n } = props;\n const getLatestRecordValue = React.useCallback(\n (initial: BaseDialogItem) => {\n let newRecord = UiLayoutDataProvider.getPropertyRecord(initial);\n\n const foundItem = isLock\n ? uiDataProvider.items.find(\n (item) => item.lockProperty?.property.name === initial.property.name\n )\n : uiDataProvider.items.find(\n (item) => item.property.name === initial.property.name\n );\n if (foundItem) {\n if (isLock) {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.lockProperty!.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.lockProperty!.isDisabled;\n } else {\n newRecord = newRecord.copyWithNewValue({\n value: foundItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n });\n newRecord.isDisabled = foundItem.isDisabled;\n }\n }\n return newRecord;\n },\n [isLock, uiDataProvider.items]\n );\n\n const currentRecord = getLatestRecordValue(initialItem);\n const [_propertyRecord, setPropertyRecord] = React.useState(currentRecord);\n const propertyRecord = useLockButtonPropertyRecord(_propertyRecord, isLock);\n\n // monitor tool for sync UI events\n React.useEffect(() => {\n return uiDataProvider.onSyncPropertiesChangeEvent.addListener((args) => {\n const mySyncItem = args.properties.find(\n (syncItem: DialogPropertySyncItem) =>\n syncItem.propertyName === initialItem.property.name\n );\n if (mySyncItem) {\n const newPropertyValue = propertyRecord.copyWithNewValue(\n {\n value: mySyncItem.value.value,\n valueFormat: PropertyValueFormat.Primitive,\n displayValue: mySyncItem.value.displayValue,\n },\n mySyncItem.property\n );\n\n if (mySyncItem.property) {\n if (mySyncItem.property.name === mySyncItem.propertyName) {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n } else {\n Logger.logError(\n \"PropertyEditor\",\n `Error trying to replace propertyName=${mySyncItem.propertyName} with property named ${mySyncItem.property.name}`\n );\n }\n } else {\n newPropertyValue.isDisabled = mySyncItem.isDisabled;\n setPropertyRecord(newPropertyValue);\n }\n }\n });\n }, [uiDataProvider, propertyRecord, initialItem.property.name]);\n\n React.useEffect(() => {\n return uiDataProvider.onItemsReloadedEvent.addListener(() => {\n const newItem = findDialogItem(\n uiDataProvider,\n initialItem.property.name,\n isLock\n );\n if (!newItem) return;\n setPropertyRecord(getLatestRecordValue(newItem));\n });\n }, [uiDataProvider, initialItem.property.name, getLatestRecordValue, isLock]);\n\n const className = React.useMemo(\n () => (isLock ? \"uifw-default-property-lock\" : \"uifw-default-editor\"),\n [isLock]\n );\n const handleCommit = React.useCallback(\n (commit: PropertyUpdatedArgs) => {\n // UiLayoutDataProvider supports only primitive property types\n assert(\n commit.newValue.valueFormat === PropertyValueFormat.Primitive &&\n commit.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive\n );\n const newPropertyValue = propertyRecord.copyWithNewValue(commit.newValue);\n const syncItem: DialogPropertySyncItem = {\n value: commit.newValue as DialogItemValue,\n propertyName: initialItem.property.name,\n isDisabled: newPropertyValue.isDisabled,\n };\n uiDataProvider.applyUiPropertyChange(syncItem);\n // Now have the uiDataProvider refetch the latest property values from the tool\n uiDataProvider.reloadDialogItems(true);\n },\n [initialItem.property.name, propertyRecord, uiDataProvider]\n );\n const handleCancel = () => {};\n\n const useNewEditors = useToolSettingsNewEditors();\n\n const lockPropertyName = isLock ? initialItem.property.name : undefined;\n return (\n <PropertyEditorProvider\n uiDataProvider={uiDataProvider}\n itemPropertyName={itemPropertyName ?? initialItem.property.name}\n lockPropertyName={lockPropertyName}\n >\n <div key={initialItem.property.name} className={className}>\n <PropertyRecordEditor\n key={initialItem.property.name}\n propertyRecord={propertyRecord}\n setFocus={setFocus}\n onCommit={handleCommit}\n onCancel={onCancel ?? handleCancel}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={useNewEditors ? \"new\" : \"legacy\"}\n size=\"small\"\n />\n </div>\n </PropertyEditorProvider>\n );\n}\n\n/** Utility methods to generate react ui from DialogRow specs\n * @public\n */\nexport class ComponentGenerator {\n constructor(\n private _uiDataProvider: UiLayoutDataProvider,\n private _onCancel?: () => void\n ) {}\n\n public get uiDataProvider() {\n return this._uiDataProvider;\n }\n\n private getEditor(\n item: BaseDialogItem,\n isLock = false,\n setFocus = false,\n itemPropertyName?: string\n ): React.ReactNode {\n return (\n <PropertyEditor\n key={item.property.name}\n uiDataProvider={this.uiDataProvider}\n initialItem={item}\n itemPropertyName={itemPropertyName ?? item.property.name}\n isLock={isLock}\n setFocus={setFocus}\n onCancel={this._onCancel}\n />\n );\n }\n\n private generateRowWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): React.ReactNode {\n if (1 === row.items.length) {\n return (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n );\n }\n\n return (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item): React.ReactNode => this.getEditor(item))}\n </div>\n </div>\n );\n }\n\n private generateEntryWithButtonGroupEditors(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (1 === row.items.length) {\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={row.items[0].property.name}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n {this.getEditor(row.items[0])}\n </div>\n ),\n };\n }\n\n return {\n labelNode: \"\",\n editorNode: (\n <div\n key={rowIndex}\n className=\"uifw-default-inline-editor-group uifw-default-center-across-width\"\n >\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map((item): React.ReactNode => this.getEditor(item))}\n </div>\n </div>\n ),\n };\n }\n\n private getEditorLabel(\n item: DialogItem,\n isLeftmostRecord = false\n ): React.ReactNode {\n return (\n <EditorLabel\n uiDataProvider={this.uiDataProvider}\n item={item}\n isLeftmostRecord={isLeftmostRecord}\n />\n );\n }\n\n private getLeftLockAndLabel(\n rowItem: DialogItem,\n multiplePropertiesOnRow: boolean\n ): React.ReactNode {\n const record = UiLayoutDataProvider.getPropertyRecord(rowItem);\n const lockEditor = UiLayoutDataProvider.hasAssociatedLockProperty(rowItem)\n ? this.getEditor(rowItem.lockProperty!, true)\n : null;\n const label = UiLayoutDataProvider.editorWantsLabel(rowItem)\n ? this.getEditorLabel(rowItem)\n : null;\n return (\n <LeftLockAndLabel\n key={`lock-${record.property.name}`}\n lockEditor={lockEditor}\n label={label}\n multiplePropertiesOnRow={multiplePropertiesOnRow}\n itemPropertyName={rowItem.property.name}\n />\n );\n }\n\n private getInlineLabelAndEditor(\n item: DialogItem,\n isLeftmostRecord: boolean\n ): React.ReactNode {\n const label = UiLayoutDataProvider.editorWantsLabel(item)\n ? this.getEditorLabel(item, isLeftmostRecord)\n : null;\n return (\n <div\n key={item.property.name}\n className=\"uifw-default-inline-label-and-editor\"\n >\n {label}\n {this.getEditor(item)}\n </div>\n );\n }\n\n private getRowWithMultipleEditors(row: DialogRow): React.ReactNode {\n return (\n <div className=\"uifw-default-inline-editor-group\">\n {row.items.map(\n (item: DialogItem, index: number): React.ReactNode =>\n this.getInlineLabelAndEditor(item, index === 0)\n )}\n </div>\n );\n }\n\n private getDivForRow(row: DialogRow): React.ReactNode {\n if (row.items.length === 1) return this.getEditor(row.items[0]);\n return this.getRowWithMultipleEditors(row);\n }\n\n public getRow(row: DialogRow, rowIndex: number): React.ReactNode {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateRowWithButtonGroupEditors(row, rowIndex);\n } else {\n return (\n <React.Fragment key={rowIndex}>\n {this.getLeftLockAndLabel(row.items[0], row.items.length > 1)}\n {this.getDivForRow(row)}\n </React.Fragment>\n );\n }\n }\n\n public getToolSettingsEntry(\n row: DialogRow,\n rowIndex: number\n ): ToolSettingsEntry {\n if (UiLayoutDataProvider.onlyContainButtonGroupEditors(row)) {\n return this.generateEntryWithButtonGroupEditors(row, rowIndex);\n } else {\n return {\n labelNode: this.getLeftLockAndLabel(row.items[0], row.items.length > 1),\n editorNode: this.getDivForRow(row),\n };\n }\n }\n\n /** ToolSettingsEntries are used by the tool settings bar. */\n public getToolSettingsEntries(): ToolSettingsEntry[] {\n return this.uiDataProvider.rows.map((row: DialogRow, index: number) =>\n this.getToolSettingsEntry(row, index)\n );\n }\n}\n\nfunction findDialogItem(\n uiDataProvider: UiLayoutDataProvider,\n propertyName: string,\n isLock: boolean\n) {\n const dialogItem = uiDataProvider.items.find((item) => {\n if (isLock) {\n return item.lockProperty?.property.name === propertyName;\n }\n return item.property.name === propertyName;\n });\n return isLock ? dialogItem?.lockProperty : dialogItem;\n}\n\ninterface LeftLockAndLabelProps {\n lockEditor?: React.ReactNode;\n label?: React.ReactNode;\n multiplePropertiesOnRow: boolean;\n itemPropertyName: string;\n}\n\nfunction LeftLockAndLabel(props: LeftLockAndLabelProps) {\n const { lockEditor, label, multiplePropertiesOnRow, itemPropertyName } =\n props;\n const { lockDecorations } = React.useContext(LockContext) ?? {};\n const lockDecoration = React.useMemo(() => {\n return lockDecorations?.[itemPropertyName];\n }, [lockDecorations, itemPropertyName]);\n\n const classNames = multiplePropertiesOnRow\n ? \"uifw-default-lock-and-label uifw-default-wide-only-display\"\n : \"uifw-default-lock-and-label\";\n return (\n <div className={classNames}>\n {lockDecoration ? undefined : lockEditor}\n {label}\n </div>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/appui-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.30.0",
|
|
4
4
|
"description": "A react component library for AppUI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./lib/appui-react.d.ts",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-redux": "^7.2.2 || ^8.0.0 || ^9.0.0",
|
|
47
47
|
"redux": "^4.1.0 || ^5.0.0",
|
|
48
|
-
"@itwin/components-react": "5.
|
|
49
|
-
"@itwin/core-react": "5.
|
|
50
|
-
"@itwin/imodel-components-react": "5.
|
|
48
|
+
"@itwin/components-react": "5.30.0",
|
|
49
|
+
"@itwin/core-react": "5.30.0",
|
|
50
|
+
"@itwin/imodel-components-react": "5.30.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@itwin/appui-abstract": "^5.8.1",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"typescript": "~5.6.3",
|
|
90
90
|
"upath": "^2.0.1",
|
|
91
91
|
"vitest": "^3.2.4",
|
|
92
|
-
"@itwin/components-react": "5.
|
|
93
|
-
"@itwin/core-react": "5.
|
|
94
|
-
"@itwin/imodel-components-react": "5.
|
|
92
|
+
"@itwin/components-react": "5.30.0",
|
|
93
|
+
"@itwin/core-react": "5.30.0",
|
|
94
|
+
"@itwin/imodel-components-react": "5.30.0"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@itwin/itwinui-icons-react": "^2.11.0",
|