@itwin/appui-react 5.7.0 → 5.8.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 +12 -0
- package/lib/appui-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/CustomNumberEditor.js +3 -1
- package/lib/appui-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/appui-react/editors/NumericEditor.d.ts.map +1 -1
- package/lib/appui-react/editors/NumericEditor.js +3 -1
- 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 +3 -1
- package/lib/appui-react/editors/TextEditor.js.map +1 -1
- package/lib/appui-react/preview/PreviewFeatures.d.ts +4 -0
- package/lib/appui-react/preview/PreviewFeatures.d.ts.map +1 -1
- package/lib/appui-react/preview/PreviewFeatures.js +1 -0
- package/lib/appui-react/preview/PreviewFeatures.js.map +1 -1
- package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.d.ts +6 -0
- package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.d.ts.map +1 -0
- package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js +15 -0
- package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js.map +1 -0
- package/lib/appui-react/widget-panels/ToolSettings.d.ts.map +1 -1
- package/lib/appui-react/widget-panels/ToolSettings.js +10 -7
- package/lib/appui-react/widget-panels/ToolSettings.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log - @itwin/appui-react
|
|
2
2
|
|
|
3
|
+
## 5.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4f2fc30: Add the `toolSettingsKeyPressCommit` preview feature, which enables input-like editors in the tool settings to commit entered values immediately upon key press.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @itwin/components-react@5.8.0
|
|
12
|
+
- @itwin/core-react@5.8.0
|
|
13
|
+
- @itwin/imodel-components-react@5.8.0
|
|
14
|
+
|
|
3
15
|
## 5.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,0BAA0B,IAAI,8BAA8B,EAC7D,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { CustomNumberEditor as BaseCustomNumberEditor, CustomNumberPropertyEditor as BaseCustomNumberPropertyEditor, } from "@itwin/components-react";
|
|
10
10
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
11
|
+
import { useToolSettingsKeyPressCommit } from "../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export class CustomNumberPropertyEditor extends BaseCustomNumberPropertyEditor {
|
|
13
14
|
get reactNode() {
|
|
@@ -15,10 +16,11 @@ export class CustomNumberPropertyEditor extends BaseCustomNumberPropertyEditor {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
const CustomNumberEditor = React.forwardRef(function CustomNumberEditor(props, forwardedRef) {
|
|
19
|
+
const shouldCommitOnChange = useToolSettingsKeyPressCommit();
|
|
18
20
|
const lockDecoration = useLockDecoration();
|
|
19
21
|
const internalProps = {
|
|
20
22
|
decoration: lockDecoration ? React.createElement(LockButtonInputDecoration, null) : undefined,
|
|
21
23
|
};
|
|
22
|
-
return (React.createElement(BaseCustomNumberEditor, { ...props, ...internalProps, ref: forwardedRef }));
|
|
24
|
+
return (React.createElement(BaseCustomNumberEditor, { ...props, ...internalProps, shouldCommitOnChange: shouldCommitOnChange, ref: forwardedRef }));
|
|
23
25
|
});
|
|
24
26
|
//# sourceMappingURL=CustomNumberEditor.js.map
|
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,0BAA0B,IAAI,8BAA8B,EAC7D,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/NumericEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { NumericInputEditor as BaseNumericInputEditor, NumericInputPropertyEditor as BaseNumericInputPropertyEditor, } from "@itwin/components-react";
|
|
10
10
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
11
|
+
import { useToolSettingsKeyPressCommit } from "../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export class NumericInputPropertyEditor extends BaseNumericInputPropertyEditor {
|
|
13
14
|
get reactNode() {
|
|
@@ -15,10 +16,11 @@ export class NumericInputPropertyEditor extends BaseNumericInputPropertyEditor {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
const NumericEditor = React.forwardRef(function NumericEditor(props, forwardedRef) {
|
|
19
|
+
const shouldCommitOnChange = useToolSettingsKeyPressCommit();
|
|
18
20
|
const lockDecoration = useLockDecoration();
|
|
19
21
|
const internalProps = {
|
|
20
22
|
decoration: lockDecoration ? React.createElement(LockButtonInputDecoration, null) : undefined,
|
|
21
23
|
};
|
|
22
|
-
return (React.createElement(BaseNumericInputEditor, { ...props, ...internalProps, ref: forwardedRef }));
|
|
24
|
+
return (React.createElement(BaseNumericInputEditor, { ...props, ...internalProps, shouldCommitOnChange: shouldCommitOnChange, ref: forwardedRef }));
|
|
23
25
|
});
|
|
24
26
|
//# sourceMappingURL=NumericEditor.js.map
|
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,mBAAmB,IAAI,sBAAsB,EAC9C,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/appui-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { TextEditor as BaseTextEditor, BasicPropertyEditor as BaseTextPropertyEditor, } from "@itwin/components-react";
|
|
10
10
|
import { LockButtonInputDecoration, useLockDecoration, } from "./LockProvider.js";
|
|
11
|
+
import { useToolSettingsKeyPressCommit } from "../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js";
|
|
11
12
|
/** @internal */
|
|
12
13
|
export class TextPropertyEditor extends BaseTextPropertyEditor {
|
|
13
14
|
get reactNode() {
|
|
@@ -15,10 +16,11 @@ export class TextPropertyEditor extends BaseTextPropertyEditor {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
const TextEditor = React.forwardRef(function TextEditor(props, forwardedRef) {
|
|
19
|
+
const shouldCommitOnChange = useToolSettingsKeyPressCommit();
|
|
18
20
|
const lockDecoration = useLockDecoration();
|
|
19
21
|
const internalProps = {
|
|
20
22
|
decoration: lockDecoration ? React.createElement(LockButtonInputDecoration, null) : undefined,
|
|
21
23
|
};
|
|
22
|
-
return React.createElement(BaseTextEditor, { ...props, ...internalProps, ref: forwardedRef });
|
|
24
|
+
return (React.createElement(BaseTextEditor, { ...props, ...internalProps, shouldCommitOnChange: shouldCommitOnChange, ref: forwardedRef }));
|
|
23
25
|
});
|
|
24
26
|
//# sourceMappingURL=TextEditor.js.map
|
|
@@ -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;
|
|
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"]}
|
|
@@ -64,6 +64,10 @@ interface KnownPreviewFeatures {
|
|
|
64
64
|
* Additionally, the icon button will be rendered as an input decoration in editors that support it.
|
|
65
65
|
*/
|
|
66
66
|
toolSettingsLockButton: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* If `true`, the input-like editors rendered in the tool settings will commit the entered value on key press.
|
|
69
|
+
*/
|
|
70
|
+
toolSettingsKeyPressCommit: boolean;
|
|
67
71
|
}
|
|
68
72
|
/** List of preview features that can be enabled/disabled.
|
|
69
73
|
* This list is expected to change over time, the interface is made
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewFeatures.d.ts","sourceRoot":"","sources":["../../../src/appui-react/preview/PreviewFeatures.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,sCAAsC;AACtC,UAAU,oBAAoB;IAC5B;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,6BAA6B,EAAE,OAAO,CAAC;IACvC;;;OAGG;IACH,0BAA0B,EAAE,OAAO,CAAC;IACpC;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,oBAAoB,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C;;;OAGG;IACH,wCAAwC,EAAE,OAAO,CAAC;IAClD;;;;;;OAMG;IACH,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD;;;;;OAKG;IACH,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACrD;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,sBAAsB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PreviewFeatures.d.ts","sourceRoot":"","sources":["../../../src/appui-react/preview/PreviewFeatures.tsx"],"names":[],"mappings":"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{
|
|
|
23
23
|
controlWidgetVisibility: undefined,
|
|
24
24
|
toolSettingsNewEditors: undefined,
|
|
25
25
|
toolSettingsLockButton: undefined,
|
|
26
|
+
toolSettingsKeyPressCommit: undefined,
|
|
26
27
|
};
|
|
27
28
|
/** Trim an object to only contain known feature keys.
|
|
28
29
|
* @param previewFeatures object potentially containing unknown features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewFeatures.js","sourceRoot":"","sources":["../../../src/appui-react/preview/PreviewFeatures.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkEhD;;GAEG;AACH,MAAM,mBAAmB,GAAkD;IACzE,oBAAoB,EAAE,SAAS;IAC/B,6BAA6B,EAAE,SAAS;IACxC,0BAA0B,EAAE,SAAS;IACrC,wBAAwB,EAAE,SAAS;IACnC,oBAAoB,EAAE,SAAS;IAC/B,wCAAwC,EAAE,SAAS;IACnD,qBAAqB,EAAE,SAAS;IAChC,uBAAuB,EAAE,SAAS;IAClC,sBAAsB,EAAE,SAAS;IACjC,sBAAsB,EAAE,SAAS;CAClC,CAAC;AAYF;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,eAAgC;IAC/D,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC1D,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,GAAG,MAAM,CAAC,OAAO,CACrD,eAAe,CAChB,CAAC,MAAM,CACN,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACjC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,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,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEnC,0CAA0C;IAC1C,KAAK,CAAC,SAAS,CACb,GAAG,EAAE,CAAC,GAAG,EAAE;QACT,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,EACD,CAAC,kBAAkB,CAAC,CACrB,CAAC;IACF,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,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 Utilities\n */\n\nimport * as React from \"react\";\nimport { create } from \"zustand\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport type { useTransientState } from \"../widget-panels/useTransientState.js\";\nimport type { WidgetDef } from \"../widgets/WidgetDef.js\";\nimport type { UiItemsManager } from \"../ui-items-provider/UiItemsManager.js\";\n\n/** List of known preview features. */\ninterface KnownPreviewFeatures {\n /** If `true`, the panels and tool settings will always be rendered over the content.\n * The content will never change size.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/672\n */\n contentAlwaysMaxSize: boolean;\n /** If `true`, the floating widget will have a \"maximize\" button. Use `enableMaximizedPanelWidget` to enable the feature for panel widgets.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/673\n */\n enableMaximizedFloatingWidget: boolean;\n /** If `true`, the panel widget will have a \"maximize\" button. Use `enableMaximizedFloatingWidget` to enable the feature for floating widgets.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/673\n */\n enableMaximizedPanelWidget: boolean;\n /** If `true`, the horizontal panels will have an additional \"Align\" button.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/706\n */\n horizontalPanelAlignment: boolean;\n /** If enabled, a dropdown menu will be rendered for widgets that exceed the specified threshold of title bar buttons.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/723\n */\n widgetActionDropdown: { threshold: number };\n /** If `true`, the accudraw input field will accept some letters for bearing angle. Defaults to `false`.\n *\n * This allows to type letters for Bearing angles in the accudraw input field. (N, S, E, W)\n */\n allowBearingLettersInAccuDrawInputFields: boolean;\n /** If `true`, popout widgets will not be rendered in a separate element tree, instead widget content will be re-parented to a popout content container.\n * Alternatively, an array of widget ids can be specified to only re-parent specific widgets.\n * @note Use {@link useTransientState} to save and restore DOM transient state when re-parenting widgets.\n * @note There is a known limitation where iTwinUI v2 popover elements will be rendered in the main window. Prefer using iTwinUI v3 when using this feature.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/925\n */\n reparentPopoutWidgets: boolean | WidgetDef[\"id\"][];\n /** If `true`, additional UI elements are rendered to allow the end user of the layout to control widget visibility.\n * Alternatively, an array of widget ids can be specified to only control specific widgets.\n * @note Use {@link UiItemsManager} APIs to manage what widgets are available to the end-user.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/859\n */\n controlWidgetVisibility: boolean | WidgetDef[\"id\"][];\n /**\n * If `true`, the tool settings will be using the new editor API. The new system delivers same default editors as the old one.\n * However, in order to use custom editors they need to be provided using `EditorsRegistryProvider` component.\n */\n toolSettingsNewEditors: boolean;\n /**\n * If `true`, the default tool settings lock editor will be rendered as an icon button rather than a checkbox.\n * Consumers can still use a custom component to render the lock by customizing the `PropertyDescription`.\n * Additionally, the icon button will be rendered as an input decoration in editors that support it.\n */\n toolSettingsLockButton: boolean;\n}\n\n/** Object used trim to only known features at runtime.\n * @internal\n */\nconst knownFeaturesObject: Record<keyof KnownPreviewFeatures, undefined> = {\n contentAlwaysMaxSize: undefined,\n enableMaximizedFloatingWidget: undefined,\n enableMaximizedPanelWidget: undefined,\n horizontalPanelAlignment: undefined,\n widgetActionDropdown: undefined,\n allowBearingLettersInAccuDrawInputFields: undefined,\n reparentPopoutWidgets: undefined,\n controlWidgetVisibility: undefined,\n toolSettingsNewEditors: undefined,\n toolSettingsLockButton: undefined,\n};\n\n/** List of preview features that can be enabled/disabled.\n * This list is expected to change over time, the interface is made\n * so that new features can be added or removed without breaking existing code.\n * A console warning will simply appear if unknown features are passed.\n * @beta\n */\nexport interface PreviewFeatures extends Partial<KnownPreviewFeatures> {\n [featureName: string]: any;\n}\n\n/** Trim an object to only contain known feature keys.\n * @param previewFeatures object potentially containing unknown features\n * @returns object containing only known features\n * @internal\n */\nfunction trimToKnownFeaturesOnly(previewFeatures: PreviewFeatures) {\n const knownFeatureKeys = Object.keys(knownFeaturesObject);\n const [knownFeatures, unknownFeatures] = Object.entries(\n previewFeatures\n ).reduce(\n ([known, unknown], [key, value]) => {\n if (knownFeatureKeys.includes(key)) {\n known[key] = value;\n } else {\n unknown.push(key);\n }\n return [known, unknown];\n },\n [{}, []] as [PreviewFeatures, string[]]\n );\n if (Object.keys(unknownFeatures).length > 0) {\n Logger.logWarning(\n UiFramework.loggerCategory(\"trimToKnownFeaturesOnly\"),\n `Features used in \"setPreviewFeatures\" are unknown or no longer in preview`,\n {\n unknownFeatures,\n }\n );\n }\n return knownFeatures;\n}\n\ninterface PreviewFeaturesState {\n previewFeatures: PreviewFeatures;\n setPreviewFeatures: (previewFeatures: PreviewFeatures) => void;\n}\n\n/** Preview features store used by `UiFramework.previewFeatures` and `UiFramework.setPreviewFeatures()` APIs to manage the preview features.\n * Use `usePreviewFeatures` hook to access the preview features set from a react component.\n * Use `usePreviewFeaturesStore.getState().previewFeatures` to access the preview features set from a non-react component.\n * Use `usePreviewFeaturesStore.subscribe()` to subscribe to changes to the preview features set from a non-react component.\n * @internal\n */\nconst usePreviewFeaturesStore = create<PreviewFeaturesState>((set) => {\n return {\n previewFeatures: {},\n setPreviewFeatures: (newPreviewFeatures: PreviewFeatures) => {\n const previewFeatures = trimToKnownFeaturesOnly(newPreviewFeatures);\n set({ previewFeatures });\n },\n };\n});\n\n/** Hook to access the preview features set.\n * @internal\n */\nexport function usePreviewFeatures() {\n return usePreviewFeaturesStore((state) => state.previewFeatures);\n}\n\n/** Props for PreviewFeaturesProvider.\n * @beta\n */\nexport interface PreviewFeaturesProviderProps {\n children?: React.ReactNode;\n features?: PreviewFeatures;\n}\n\n/** Set which preview features are enabled. These features are not yet ready for production use nor have\n * a proper API defined yet.\n * The available set of features are defined in the [[PreviewFeatures]] interface.\n *\n * This component should wrap the Provider component.\n *\n * ```tsx\n * <PreviewFeaturesProvider features={{ enableMaximizedFloatingWidget: true }}>\n * <Provider store={UiFramework.store}>\n * [...]\n * <ConfigurableUIContent />\n * [/...]\n * </Provider>\n * </PreviewFeaturesProvider>\n * ```\n * @beta\n */\nexport function PreviewFeaturesProvider({\n children,\n features,\n}: PreviewFeaturesProviderProps) {\n const setPreviewFeatures = usePreviewFeaturesStore(\n (state) => state.setPreviewFeatures\n );\n React.useEffect(() => {\n setPreviewFeatures(features ?? {});\n }, [features, setPreviewFeatures]);\n\n // Clear preview features when unmounting.\n React.useEffect(\n () => () => {\n setPreviewFeatures({});\n },\n [setPreviewFeatures]\n );\n return <>{children}</>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PreviewFeatures.js","sourceRoot":"","sources":["../../../src/appui-react/preview/PreviewFeatures.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsEhD;;GAEG;AACH,MAAM,mBAAmB,GAAkD;IACzE,oBAAoB,EAAE,SAAS;IAC/B,6BAA6B,EAAE,SAAS;IACxC,0BAA0B,EAAE,SAAS;IACrC,wBAAwB,EAAE,SAAS;IACnC,oBAAoB,EAAE,SAAS;IAC/B,wCAAwC,EAAE,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pE,GAAG,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,uBAAuB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AACnE,CAAC;AAUD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,EACR,QAAQ,GACqB;IAC7B,MAAM,kBAAkB,GAAG,uBAAuB,CAChD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,kBAAkB,CACpC,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,kBAAkB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAEnC,0CAA0C;IAC1C,KAAK,CAAC,SAAS,CACb,GAAG,EAAE,CAAC,GAAG,EAAE;QACT,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC,EACD,CAAC,kBAAkB,CAAC,CACrB,CAAC;IACF,OAAO,0CAAG,QAAQ,CAAI,CAAC;AACzB,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 Utilities\n */\n\nimport * as React from \"react\";\nimport { create } from \"zustand\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport type { useTransientState } from \"../widget-panels/useTransientState.js\";\nimport type { WidgetDef } from \"../widgets/WidgetDef.js\";\nimport type { UiItemsManager } from \"../ui-items-provider/UiItemsManager.js\";\n\n/** List of known preview features. */\ninterface KnownPreviewFeatures {\n /** If `true`, the panels and tool settings will always be rendered over the content.\n * The content will never change size.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/672\n */\n contentAlwaysMaxSize: boolean;\n /** If `true`, the floating widget will have a \"maximize\" button. Use `enableMaximizedPanelWidget` to enable the feature for panel widgets.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/673\n */\n enableMaximizedFloatingWidget: boolean;\n /** If `true`, the panel widget will have a \"maximize\" button. Use `enableMaximizedFloatingWidget` to enable the feature for floating widgets.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/673\n */\n enableMaximizedPanelWidget: boolean;\n /** If `true`, the horizontal panels will have an additional \"Align\" button.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/706\n */\n horizontalPanelAlignment: boolean;\n /** If enabled, a dropdown menu will be rendered for widgets that exceed the specified threshold of title bar buttons.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/723\n */\n widgetActionDropdown: { threshold: number };\n /** If `true`, the accudraw input field will accept some letters for bearing angle. Defaults to `false`.\n *\n * This allows to type letters for Bearing angles in the accudraw input field. (N, S, E, W)\n */\n allowBearingLettersInAccuDrawInputFields: boolean;\n /** If `true`, popout widgets will not be rendered in a separate element tree, instead widget content will be re-parented to a popout content container.\n * Alternatively, an array of widget ids can be specified to only re-parent specific widgets.\n * @note Use {@link useTransientState} to save and restore DOM transient state when re-parenting widgets.\n * @note There is a known limitation where iTwinUI v2 popover elements will be rendered in the main window. Prefer using iTwinUI v3 when using this feature.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/925\n */\n reparentPopoutWidgets: boolean | WidgetDef[\"id\"][];\n /** If `true`, additional UI elements are rendered to allow the end user of the layout to control widget visibility.\n * Alternatively, an array of widget ids can be specified to only control specific widgets.\n * @note Use {@link UiItemsManager} APIs to manage what widgets are available to the end-user.\n *\n * Discuss or upvote this feature: https://github.com/iTwin/appui/discussions/859\n */\n controlWidgetVisibility: boolean | WidgetDef[\"id\"][];\n /**\n * If `true`, the tool settings will be using the new editor API. The new system delivers same default editors as the old one.\n * However, in order to use custom editors they need to be provided using `EditorsRegistryProvider` component.\n */\n toolSettingsNewEditors: boolean;\n /**\n * If `true`, the default tool settings lock editor will be rendered as an icon button rather than a checkbox.\n * Consumers can still use a custom component to render the lock by customizing the `PropertyDescription`.\n * Additionally, the icon button will be rendered as an input decoration in editors that support it.\n */\n toolSettingsLockButton: boolean;\n /**\n * If `true`, the input-like editors rendered in the tool settings will commit the entered value on key press.\n */\n toolSettingsKeyPressCommit: boolean;\n}\n\n/** Object used trim to only known features at runtime.\n * @internal\n */\nconst knownFeaturesObject: Record<keyof KnownPreviewFeatures, undefined> = {\n contentAlwaysMaxSize: undefined,\n enableMaximizedFloatingWidget: undefined,\n enableMaximizedPanelWidget: undefined,\n horizontalPanelAlignment: undefined,\n widgetActionDropdown: undefined,\n allowBearingLettersInAccuDrawInputFields: undefined,\n reparentPopoutWidgets: undefined,\n controlWidgetVisibility: undefined,\n toolSettingsNewEditors: undefined,\n toolSettingsLockButton: undefined,\n toolSettingsKeyPressCommit: undefined,\n};\n\n/** List of preview features that can be enabled/disabled.\n * This list is expected to change over time, the interface is made\n * so that new features can be added or removed without breaking existing code.\n * A console warning will simply appear if unknown features are passed.\n * @beta\n */\nexport interface PreviewFeatures extends Partial<KnownPreviewFeatures> {\n [featureName: string]: any;\n}\n\n/** Trim an object to only contain known feature keys.\n * @param previewFeatures object potentially containing unknown features\n * @returns object containing only known features\n * @internal\n */\nfunction trimToKnownFeaturesOnly(previewFeatures: PreviewFeatures) {\n const knownFeatureKeys = Object.keys(knownFeaturesObject);\n const [knownFeatures, unknownFeatures] = Object.entries(\n previewFeatures\n ).reduce(\n ([known, unknown], [key, value]) => {\n if (knownFeatureKeys.includes(key)) {\n known[key] = value;\n } else {\n unknown.push(key);\n }\n return [known, unknown];\n },\n [{}, []] as [PreviewFeatures, string[]]\n );\n if (Object.keys(unknownFeatures).length > 0) {\n Logger.logWarning(\n UiFramework.loggerCategory(\"trimToKnownFeaturesOnly\"),\n `Features used in \"setPreviewFeatures\" are unknown or no longer in preview`,\n {\n unknownFeatures,\n }\n );\n }\n return knownFeatures;\n}\n\ninterface PreviewFeaturesState {\n previewFeatures: PreviewFeatures;\n setPreviewFeatures: (previewFeatures: PreviewFeatures) => void;\n}\n\n/** Preview features store used by `UiFramework.previewFeatures` and `UiFramework.setPreviewFeatures()` APIs to manage the preview features.\n * Use `usePreviewFeatures` hook to access the preview features set from a react component.\n * Use `usePreviewFeaturesStore.getState().previewFeatures` to access the preview features set from a non-react component.\n * Use `usePreviewFeaturesStore.subscribe()` to subscribe to changes to the preview features set from a non-react component.\n * @internal\n */\nconst usePreviewFeaturesStore = create<PreviewFeaturesState>((set) => {\n return {\n previewFeatures: {},\n setPreviewFeatures: (newPreviewFeatures: PreviewFeatures) => {\n const previewFeatures = trimToKnownFeaturesOnly(newPreviewFeatures);\n set({ previewFeatures });\n },\n };\n});\n\n/** Hook to access the preview features set.\n * @internal\n */\nexport function usePreviewFeatures() {\n return usePreviewFeaturesStore((state) => state.previewFeatures);\n}\n\n/** Props for PreviewFeaturesProvider.\n * @beta\n */\nexport interface PreviewFeaturesProviderProps {\n children?: React.ReactNode;\n features?: PreviewFeatures;\n}\n\n/** Set which preview features are enabled. These features are not yet ready for production use nor have\n * a proper API defined yet.\n * The available set of features are defined in the [[PreviewFeatures]] interface.\n *\n * This component should wrap the Provider component.\n *\n * ```tsx\n * <PreviewFeaturesProvider features={{ enableMaximizedFloatingWidget: true }}>\n * <Provider store={UiFramework.store}>\n * [...]\n * <ConfigurableUIContent />\n * [/...]\n * </Provider>\n * </PreviewFeaturesProvider>\n * ```\n * @beta\n */\nexport function PreviewFeaturesProvider({\n children,\n features,\n}: PreviewFeaturesProviderProps) {\n const setPreviewFeatures = usePreviewFeaturesStore(\n (state) => state.setPreviewFeatures\n );\n React.useEffect(() => {\n setPreviewFeatures(features ?? {});\n }, [features, setPreviewFeatures]);\n\n // Clear preview features when unmounting.\n React.useEffect(\n () => () => {\n setPreviewFeatures({});\n },\n [setPreviewFeatures]\n );\n return <>{children}</>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolSettingsKeyPressCommit.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,gBAAgB;AAChB,wBAAgB,6BAA6B,YAI5C;AAED,gBAAgB;AAChB,eAAO,MAAM,mBAAmB,wBAA6B,CAAC"}
|
package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { usePreviewFeatures } from "../PreviewFeatures.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function useToolSettingsKeyPressCommit() {
|
|
9
|
+
const { toolSettingsKeyPressCommit } = usePreviewFeatures();
|
|
10
|
+
const isToolSettings = React.useContext(ToolSettingsContext);
|
|
11
|
+
return !!toolSettingsKeyPressCommit && isToolSettings;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const ToolSettingsContext = React.createContext(false);
|
|
15
|
+
//# sourceMappingURL=useToolSettingsKeyPressCommit.js.map
|
package/lib/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolSettingsKeyPressCommit.js","sourceRoot":"","sources":["../../../../src/appui-react/preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,gBAAgB;AAChB,MAAM,UAAU,6BAA6B;IAC3C,MAAM,EAAE,0BAA0B,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAC5D,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC,0BAA0B,IAAI,cAAc,CAAC;AACxD,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,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 *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { usePreviewFeatures } from \"../PreviewFeatures.js\";\n\n/** @internal */\nexport function useToolSettingsKeyPressCommit() {\n const { toolSettingsKeyPressCommit } = usePreviewFeatures();\n const isToolSettings = React.useContext(ToolSettingsContext);\n return !!toolSettingsKeyPressCommit && isToolSettings;\n}\n\n/** @internal */\nexport const ToolSettingsContext = React.createContext(false);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolSettings.d.ts","sourceRoot":"","sources":["../../../src/appui-react/widget-panels/ToolSettings.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolSettings.d.ts","sourceRoot":"","sources":["../../../src/appui-react/widget-panels/ToolSettings.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,qBAAqB,CAAC;AAS7B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAeD;;eAEe;AACf,wBAAgB,iCAAiC,YAMhD;AAED,gBAAgB;AAChB,wBAAgB,wBAAwB,6BAGvC;AAED,gBAAgB;AAChB,wBAAgB,yBAAyB,sBA+CxC;AAED,gBAAgB;AAChB,wBAAgB,+BAA+B,oCA4B9C;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,sKAwBlC;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,6BAKlC;AAED,gBAAgB;AAChB,wBAAgB,yBAAyB,sBA2BxC"}
|
|
@@ -21,6 +21,7 @@ import { DockedBar } from "./DockedBar.js";
|
|
|
21
21
|
import { useActiveFrontstageDef } from "../frontstage/FrontstageDef.js";
|
|
22
22
|
import { LockProvider } from "../editors/LockProvider.js";
|
|
23
23
|
import { ToolSettingsEditorsProvider } from "../preview/tool-settings-lock-button/useToolSettingsLockButton.js";
|
|
24
|
+
import { ToolSettingsContext } from "../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js";
|
|
24
25
|
function EmptyToolSettingsLabel({ toolId }) {
|
|
25
26
|
const { translate } = useTranslation();
|
|
26
27
|
const tool = IModelApp.tools.find(toolId);
|
|
@@ -64,12 +65,13 @@ export function ToolSettingsDockedContent() {
|
|
|
64
65
|
: toolSettingEntries;
|
|
65
66
|
// for the overflow to work properly each setting in the DockedToolSettings should be wrapped by a DockedToolSetting component
|
|
66
67
|
return (React.createElement(DockedBar, { placement: "top" },
|
|
67
|
-
React.createElement(
|
|
68
|
-
React.createElement(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
React.createElement(ToolSettingsContext.Provider, { value: true },
|
|
69
|
+
React.createElement(ToolSettingsEditorsProvider, null,
|
|
70
|
+
React.createElement(DockedToolSettings, { itemId: InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ??
|
|
71
|
+
"none", key: forceRefreshKey }, entries.map((entry, index) => (React.createElement(DockedToolSetting, { key: index },
|
|
72
|
+
React.createElement(LockProvider, null,
|
|
73
|
+
entry.labelNode,
|
|
74
|
+
entry.editorNode)))))))));
|
|
73
75
|
}
|
|
74
76
|
/** @internal */
|
|
75
77
|
export function useHorizontalToolSettingEntries() {
|
|
@@ -134,7 +136,8 @@ export function ToolSettingsWidgetContent() {
|
|
|
134
136
|
const providerId = InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ?? "none";
|
|
135
137
|
return (React.createElement("div", { "data-toolsettings-provider": providerId, className: "uifw-floating-toolSettings-container", ref: floatingToolSettingsContainerRef, key: forceRefreshKey },
|
|
136
138
|
React.createElement(ScrollableWidgetContent, null,
|
|
137
|
-
React.createElement(
|
|
139
|
+
React.createElement(ToolSettingsContext.Provider, { value: true },
|
|
140
|
+
React.createElement(ToolSettingsEditorsProvider, null, node ?? frontstageDef?.activeToolEmptyNode ?? (React.createElement(EmptyToolSettingsLabel, { toolId: activeToolId })))))));
|
|
138
141
|
}
|
|
139
142
|
/**
|
|
140
143
|
* Hook that returns a key that can be used to force refresh the tool settings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolSettings.js","sourceRoot":"","sources":["../../../src/appui-react/widget-panels/ToolSettings.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iB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C,MAAM,UAAU,GACd,yBAAyB,CAAC,0BAA0B,EAAE,QAAQ,IAAI,MAAM,CAAC;IAC3E,OAAO,CACL,2DAC8B,UAAU,EACtC,SAAS,EAAC,sCAAsC,EAChD,GAAG,EAAE,gCAAgC,EACrC,GAAG,EAAE,eAAe;QAEpB,oBAAC,uBAAuB;YACtB,oBAAC,2BAA2B,QACzB,IAAI,IAAI,aAAa,EAAE,mBAAmB,IAAI,CAC7C,oBAAC,sBAAsB,IAAC,MAAM,EAAE,YAAY,GAAI,CACjD,CAC2B,CACN,CACtB,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,gBAAqB;IAC1C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACzE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,+EAA+E;QAC/E,0BAA0B;QAC1B,kBAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvB,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ToolSettings\n */\n\nimport * as React from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { InternalFrontstageManager } from \"../frontstage/InternalFrontstageManager.js\";\nimport { useLayout } from \"../layout/base/LayoutStore.js\";\nimport { DockedToolSettings } from \"../layout/tool-settings/Docked.js\";\nimport { DockedToolSetting } from \"../layout/tool-settings/Setting.js\";\nimport { ScrollableWidgetContent } from \"../layout/widget/Content.js\";\nimport \"./ToolSettings.scss\";\nimport { useActiveToolId } from \"../hooks/useActiveToolId.js\";\nimport { useTranslation } from \"../hooks/useTranslation.js\";\nimport { DockedBar } from \"./DockedBar.js\";\nimport { useActiveFrontstageDef } from \"../frontstage/FrontstageDef.js\";\nimport { LockProvider } from \"../editors/LockProvider.js\";\nimport { ToolSettingsEditorsProvider } from \"../preview/tool-settings-lock-button/useToolSettingsLockButton.js\";\n\n/** Defines a ToolSettings property entry.\n * @public\n */\nexport interface ToolSettingsEntry {\n // label node which potentially can contain a lock node as well.\n labelNode: React.ReactNode;\n // editor entry used to display and edit the property value\n editorNode: React.ReactNode;\n}\n\nfunction EmptyToolSettingsLabel({ toolId }: { toolId: string }) {\n const { translate } = useTranslation();\n const tool = IModelApp.tools.find(toolId);\n const toolName = tool?.flyover;\n return (\n <Text as=\"i\" isMuted={true} className=\"uifw-toolSettings-label-empty\">\n {translate(\"tools.noToolSettingsStart\")}\n {toolName || translate(\"tools.noToolSettingsPlaceholderName\")}\n {translate(\"tools.noToolSettingsEnd\")}\n </Text>\n );\n}\n\n/**\n * Hook that returns true if the tool settings should be rendered docked.\n * @internal */\nexport function useShouldRenderDockedToolSettings() {\n return useLayout((state) => {\n const toolSettings = state.toolSettings;\n if (!toolSettings || toolSettings.type === \"widget\") return false;\n return !toolSettings.hidden;\n });\n}\n\n/** @internal */\nexport function WidgetPanelsToolSettings() {\n if (!useShouldRenderDockedToolSettings()) return null;\n return <ToolSettingsDockedContent />;\n}\n\n/** @internal */\nexport function ToolSettingsDockedContent() {\n const activeToolId = useActiveToolId();\n const toolSettingEntries = useHorizontalToolSettingEntries();\n const forceRefreshKey = useRefreshKey(toolSettingEntries);\n const frontstageDef = useActiveFrontstageDef();\n\n const emptySettings = React.useMemo<ToolSettingsEntry[]>(\n () => [\n {\n editorNode: null,\n labelNode: frontstageDef?.activeToolEmptyNode ?? (\n <EmptyToolSettingsLabel toolId={activeToolId} />\n ),\n },\n ],\n [activeToolId, frontstageDef]\n );\n const entries =\n !toolSettingEntries || toolSettingEntries.length === 0\n ? emptySettings\n : toolSettingEntries;\n\n // for the overflow to work properly each setting in the DockedToolSettings should be wrapped by a DockedToolSetting component\n return (\n <DockedBar placement=\"top\">\n <ToolSettingsEditorsProvider>\n <DockedToolSettings\n itemId={\n InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ??\n \"none\"\n }\n key={forceRefreshKey}\n >\n {entries.map((entry, index) => (\n <DockedToolSetting key={index}>\n <LockProvider>\n {entry.labelNode}\n {entry.editorNode}\n </LockProvider>\n </DockedToolSetting>\n ))}\n </DockedToolSettings>\n </ToolSettingsEditorsProvider>\n </DockedBar>\n );\n}\n\n/** @internal */\nexport function useHorizontalToolSettingEntries() {\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.frontstages.activeToolInformation?.toolUiProvider?.reloadPropertiesFromTool();\n }, []);\n const [settings, setSettings] = React.useState(\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes\n );\n React.useEffect(() => {\n return UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes;\n setSettings(nodes);\n });\n }, []);\n\n React.useEffect(() => {\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes;\n setSettings(nodes);\n });\n }, []);\n\n return settings;\n}\n\n/** @internal */\nexport function useToolSettingsNode() {\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.frontstages.activeToolInformation?.toolUiProvider?.reloadPropertiesFromTool();\n }, []);\n const [settings, setSettings] = React.useState(\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode\n );\n React.useEffect(() => {\n return UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode;\n setSettings(nodes);\n });\n }, [setSettings]);\n\n React.useEffect(() => {\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode;\n setSettings(nodes);\n });\n }, [setSettings]);\n return settings;\n}\n\n/** @internal */\nexport function ToolSettingsContent() {\n const toolSettingsType = useLayout((state) => state.toolSettings?.type);\n // This is needed to remount underlying components tree when going into widget state.\n if (!toolSettingsType || toolSettingsType === \"docked\") return null;\n return <ToolSettingsWidgetContent />;\n}\n\n/** @internal */\nexport function ToolSettingsWidgetContent() {\n const floatingToolSettingsContainerRef = React.useRef<HTMLDivElement>(null);\n const node = useToolSettingsNode();\n const activeToolId = useActiveToolId();\n const forceRefreshKey = useRefreshKey(node);\n const frontstageDef = useActiveFrontstageDef();\n\n const providerId =\n InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ?? \"none\";\n return (\n <div\n data-toolsettings-provider={providerId}\n className=\"uifw-floating-toolSettings-container\"\n ref={floatingToolSettingsContainerRef}\n key={forceRefreshKey}\n >\n <ScrollableWidgetContent>\n <ToolSettingsEditorsProvider>\n {node ?? frontstageDef?.activeToolEmptyNode ?? (\n <EmptyToolSettingsLabel toolId={activeToolId} />\n )}\n </ToolSettingsEditorsProvider>\n </ScrollableWidgetContent>\n </div>\n );\n}\n\n/**\n * Hook that returns a key that can be used to force refresh the tool settings.\n * @param toolSettingNodes Nodes that are used to determine if the tool settings should be refreshed.\n * @returns a new key if the dependency changes.\n */\nfunction useRefreshKey(toolSettingNodes: any) {\n const [forceRefreshKey, setForceRefreshKey] = React.useState(Date.now());\n React.useEffect(() => {\n // We cant work with the content of the settings, but we can force refresh when\n // the array is different.\n setForceRefreshKey(Date.now());\n }, [toolSettingNodes]);\n return forceRefreshKey;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ToolSettings.js","sourceRoot":"","sources":["../../../src/appui-react/widget-panels/ToolSettings.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAE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EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvB,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ToolSettings\n */\n\nimport * as React from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { InternalFrontstageManager } from \"../frontstage/InternalFrontstageManager.js\";\nimport { useLayout } from \"../layout/base/LayoutStore.js\";\nimport { DockedToolSettings } from \"../layout/tool-settings/Docked.js\";\nimport { DockedToolSetting } from \"../layout/tool-settings/Setting.js\";\nimport { ScrollableWidgetContent } from \"../layout/widget/Content.js\";\nimport \"./ToolSettings.scss\";\nimport { useActiveToolId } from \"../hooks/useActiveToolId.js\";\nimport { useTranslation } from \"../hooks/useTranslation.js\";\nimport { DockedBar } from \"./DockedBar.js\";\nimport { useActiveFrontstageDef } from \"../frontstage/FrontstageDef.js\";\nimport { LockProvider } from \"../editors/LockProvider.js\";\nimport { ToolSettingsEditorsProvider } from \"../preview/tool-settings-lock-button/useToolSettingsLockButton.js\";\nimport { ToolSettingsContext } from \"../preview/tool-settings-key-press-commit/useToolSettingsKeyPressCommit.js\";\n\n/** Defines a ToolSettings property entry.\n * @public\n */\nexport interface ToolSettingsEntry {\n // label node which potentially can contain a lock node as well.\n labelNode: React.ReactNode;\n // editor entry used to display and edit the property value\n editorNode: React.ReactNode;\n}\n\nfunction EmptyToolSettingsLabel({ toolId }: { toolId: string }) {\n const { translate } = useTranslation();\n const tool = IModelApp.tools.find(toolId);\n const toolName = tool?.flyover;\n return (\n <Text as=\"i\" isMuted={true} className=\"uifw-toolSettings-label-empty\">\n {translate(\"tools.noToolSettingsStart\")}\n {toolName || translate(\"tools.noToolSettingsPlaceholderName\")}\n {translate(\"tools.noToolSettingsEnd\")}\n </Text>\n );\n}\n\n/**\n * Hook that returns true if the tool settings should be rendered docked.\n * @internal */\nexport function useShouldRenderDockedToolSettings() {\n return useLayout((state) => {\n const toolSettings = state.toolSettings;\n if (!toolSettings || toolSettings.type === \"widget\") return false;\n return !toolSettings.hidden;\n });\n}\n\n/** @internal */\nexport function WidgetPanelsToolSettings() {\n if (!useShouldRenderDockedToolSettings()) return null;\n return <ToolSettingsDockedContent />;\n}\n\n/** @internal */\nexport function ToolSettingsDockedContent() {\n const activeToolId = useActiveToolId();\n const toolSettingEntries = useHorizontalToolSettingEntries();\n const forceRefreshKey = useRefreshKey(toolSettingEntries);\n const frontstageDef = useActiveFrontstageDef();\n\n const emptySettings = React.useMemo<ToolSettingsEntry[]>(\n () => [\n {\n editorNode: null,\n labelNode: frontstageDef?.activeToolEmptyNode ?? (\n <EmptyToolSettingsLabel toolId={activeToolId} />\n ),\n },\n ],\n [activeToolId, frontstageDef]\n );\n const entries =\n !toolSettingEntries || toolSettingEntries.length === 0\n ? emptySettings\n : toolSettingEntries;\n\n // for the overflow to work properly each setting in the DockedToolSettings should be wrapped by a DockedToolSetting component\n return (\n <DockedBar placement=\"top\">\n <ToolSettingsContext.Provider value={true}>\n <ToolSettingsEditorsProvider>\n <DockedToolSettings\n itemId={\n InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ??\n \"none\"\n }\n key={forceRefreshKey}\n >\n {entries.map((entry, index) => (\n <DockedToolSetting key={index}>\n <LockProvider>\n {entry.labelNode}\n {entry.editorNode}\n </LockProvider>\n </DockedToolSetting>\n ))}\n </DockedToolSettings>\n </ToolSettingsEditorsProvider>\n </ToolSettingsContext.Provider>\n </DockedBar>\n );\n}\n\n/** @internal */\nexport function useHorizontalToolSettingEntries() {\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.frontstages.activeToolInformation?.toolUiProvider?.reloadPropertiesFromTool();\n }, []);\n const [settings, setSettings] = React.useState(\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes\n );\n React.useEffect(() => {\n return UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes;\n setSettings(nodes);\n });\n }, []);\n\n React.useEffect(() => {\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider\n ?.horizontalToolSettingNodes;\n setSettings(nodes);\n });\n }, []);\n\n return settings;\n}\n\n/** @internal */\nexport function useToolSettingsNode() {\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.frontstages.activeToolInformation?.toolUiProvider?.reloadPropertiesFromTool();\n }, []);\n const [settings, setSettings] = React.useState(\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode\n );\n React.useEffect(() => {\n return UiFramework.frontstages.onToolActivatedEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode;\n setSettings(nodes);\n });\n }, [setSettings]);\n\n React.useEffect(() => {\n return UiFramework.frontstages.onToolSettingsReloadEvent.addListener(() => {\n const nodes =\n InternalFrontstageManager.activeToolSettingsProvider?.toolSettingsNode;\n setSettings(nodes);\n });\n }, [setSettings]);\n return settings;\n}\n\n/** @internal */\nexport function ToolSettingsContent() {\n const toolSettingsType = useLayout((state) => state.toolSettings?.type);\n // This is needed to remount underlying components tree when going into widget state.\n if (!toolSettingsType || toolSettingsType === \"docked\") return null;\n return <ToolSettingsWidgetContent />;\n}\n\n/** @internal */\nexport function ToolSettingsWidgetContent() {\n const floatingToolSettingsContainerRef = React.useRef<HTMLDivElement>(null);\n const node = useToolSettingsNode();\n const activeToolId = useActiveToolId();\n const forceRefreshKey = useRefreshKey(node);\n const frontstageDef = useActiveFrontstageDef();\n\n const providerId =\n InternalFrontstageManager.activeToolSettingsProvider?.uniqueId ?? \"none\";\n return (\n <div\n data-toolsettings-provider={providerId}\n className=\"uifw-floating-toolSettings-container\"\n ref={floatingToolSettingsContainerRef}\n key={forceRefreshKey}\n >\n <ScrollableWidgetContent>\n <ToolSettingsContext.Provider value={true}>\n <ToolSettingsEditorsProvider>\n {node ?? frontstageDef?.activeToolEmptyNode ?? (\n <EmptyToolSettingsLabel toolId={activeToolId} />\n )}\n </ToolSettingsEditorsProvider>\n </ToolSettingsContext.Provider>\n </ScrollableWidgetContent>\n </div>\n );\n}\n\n/**\n * Hook that returns a key that can be used to force refresh the tool settings.\n * @param toolSettingNodes Nodes that are used to determine if the tool settings should be refreshed.\n * @returns a new key if the dependency changes.\n */\nfunction useRefreshKey(toolSettingNodes: any) {\n const [forceRefreshKey, setForceRefreshKey] = React.useState(Date.now());\n React.useEffect(() => {\n // We cant work with the content of the settings, but we can force refresh when\n // the array is different.\n setForceRefreshKey(Date.now());\n }, [toolSettingNodes]);\n return forceRefreshKey;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/appui-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.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",
|
|
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.8.0",
|
|
49
|
+
"@itwin/core-react": "5.8.0",
|
|
50
|
+
"@itwin/imodel-components-react": "5.8.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@itwin/appui-abstract": "rc",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
"typescript": "~5.6.2",
|
|
92
92
|
"upath": "^2.0.1",
|
|
93
93
|
"vitest": "^3.0.6",
|
|
94
|
-
"@itwin/
|
|
95
|
-
"@itwin/
|
|
96
|
-
"@itwin/imodel-components-react": "5.
|
|
94
|
+
"@itwin/core-react": "5.8.0",
|
|
95
|
+
"@itwin/components-react": "5.8.0",
|
|
96
|
+
"@itwin/imodel-components-react": "5.8.0"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@itwin/itwinui-icons-react": "^2.8.0",
|