@itwin/components-react 5.31.0 → 5.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/components-react/new-editors/editors/NumericEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/NumericEditor.js +4 -1
- package/lib/components-react/new-editors/editors/NumericEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.js +7 -1
- package/lib/components-react/new-editors/editors/TextEditor.js.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.js +5 -1
- package/lib/components-react/new-editors/interop/EditorInterop.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +9 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +17 -4
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +3 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +33 -4
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
+
## 5.32.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8579336: `Text` and `Numerical` editors now select the input value on focus. `Quantity` editor no longer clear merged values (`-- unit`) on focus.
|
|
8
|
+
- 6a8e093: `VirtualizedPropertyGrid` now resets the active editor back to its initial value when a commit is aborted by the consumer (`onPropertyUpdated` returns `false`). Cancelling an edit now also resets editor.
|
|
9
|
+
- @itwin/core-react@5.32.1
|
|
10
|
+
|
|
11
|
+
## 5.32.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- @itwin/core-react@5.32.0
|
|
16
|
+
|
|
3
17
|
## 5.31.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,oBAAoB,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"NumericEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,oBAAoB,EAAE,YAAY,CAAC,qBA4BjD"}
|
|
@@ -12,6 +12,9 @@ import { applyNumericConstraints, getNumericConstraints, } from "../ConstraintUt
|
|
|
12
12
|
*/
|
|
13
13
|
export function NumericEditor({ metadata, value, onChange, size, disabled, id, }) {
|
|
14
14
|
const currentValue = getNumericValue(value);
|
|
15
|
+
const handleFocus = (e) => {
|
|
16
|
+
e.target.select();
|
|
17
|
+
};
|
|
15
18
|
return (React.createElement(Input, { id: id, value: currentValue.displayValue, onChange: (e) => {
|
|
16
19
|
const parsedValue = parseFloat(e.target.value);
|
|
17
20
|
onChange({
|
|
@@ -23,7 +26,7 @@ export function NumericEditor({ metadata, value, onChange, size, disabled, id, }
|
|
|
23
26
|
}),
|
|
24
27
|
displayValue: e.target.value,
|
|
25
28
|
});
|
|
26
|
-
}, size: size, disabled: disabled }));
|
|
29
|
+
}, onFocus: handleFocus, size: size, disabled: disabled }));
|
|
27
30
|
}
|
|
28
31
|
function getNumericValue(value) {
|
|
29
32
|
return value ? value : { rawValue: undefined, displayValue: "" };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GAC8C;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"NumericEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/NumericEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GAC8C;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,WAAW,GAAG,CAAC,CAAqC,EAAE,EAAE;QAC5D,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,YAAY,EAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,QAAQ,CAAC;gBACP,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;oBACjC,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,uBAAuB,CAAC;wBACtB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,WAAW,CAAC;wBAC9C,KAAK,EAAE,WAAW;qBACnB,CAAC;gBACN,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;aAC7B,CAAC,CAAC;QACL,CAAC,EACD,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAA+B;IACtD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;AACnE,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { NumericValueMetadata } from \"../values/Metadata.js\";\nimport type { NumericValue } from \"../values/Values.js\";\nimport {\n applyNumericConstraints,\n getNumericConstraints,\n} from \"../ConstraintUtils.js\";\n\n/* v8 ignore start */\n\n/**\n * Numeric value editor that renders `Input` components for changing value.\n * @internal\n */\nexport function NumericEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n id,\n}: EditorProps<NumericValueMetadata, NumericValue>) {\n const currentValue = getNumericValue(value);\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n return (\n <Input\n id={id}\n value={currentValue.displayValue}\n onChange={(e) => {\n const parsedValue = parseFloat(e.target.value);\n onChange({\n rawValue: Number.isNaN(parsedValue)\n ? undefined\n : applyNumericConstraints({\n ...getNumericConstraints(metadata.constraints),\n value: parsedValue,\n }),\n displayValue: e.target.value,\n });\n }}\n onFocus={handleFocus}\n size={size}\n disabled={disabled}\n />\n );\n}\n\nfunction getNumericValue(value: NumericValue | undefined): NumericValue {\n return value ? value : { rawValue: undefined, displayValue: \"\" };\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,iBAAiB,EAAE,SAAS,CAAC,qBAwB3C"}
|
|
@@ -13,7 +13,13 @@ import { getStringConstraints } from "../ConstraintUtils.js";
|
|
|
13
13
|
export function TextEditor({ metadata, value, onChange, size, disabled, id, }) {
|
|
14
14
|
const currentValue = value ? value : { value: "" };
|
|
15
15
|
const { maxLength, minLength } = getStringConstraints(metadata.constraints);
|
|
16
|
-
|
|
16
|
+
const handleChange = (e) => {
|
|
17
|
+
onChange({ value: e.target.value });
|
|
18
|
+
};
|
|
19
|
+
const handleFocus = (e) => {
|
|
20
|
+
e.target.select();
|
|
21
|
+
};
|
|
22
|
+
return (React.createElement(Input, { id: id, value: currentValue.value, onChange: handleChange, onFocus: handleFocus, maxLength: maxLength, minLength: minLength, size: size, disabled: disabled }));
|
|
17
23
|
}
|
|
18
24
|
/* v8 ignore stop */
|
|
19
25
|
//# sourceMappingURL=TextEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACwC;IAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACnD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE5E,
|
|
1
|
+
{"version":3,"file":"TextEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/editors/TextEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACwC;IAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACnD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAE5E,MAAM,YAAY,GAAG,CAAC,CAAsC,EAAE,EAAE;QAC9D,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAqC,EAAE,EAAE;QAC5D,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,KAAK,IACJ,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { EditorProps } from \"../Types.js\";\nimport type { TextValueMetadata } from \"../values/Metadata.js\";\nimport type { TextValue } from \"../values/Values.js\";\nimport { getStringConstraints } from \"../ConstraintUtils.js\";\n\n/* v8 ignore start */\n\n/**\n * Text value editor that renders `Input` component for changing value.\n * @internal\n */\nexport function TextEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n id,\n}: EditorProps<TextValueMetadata, TextValue>) {\n const currentValue = value ? value : { value: \"\" };\n const { maxLength, minLength } = getStringConstraints(metadata.constraints);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange({ value: e.target.value });\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n e.target.select();\n };\n\n return (\n <Input\n id={id}\n value={currentValue.value}\n onChange={handleChange}\n onFocus={handleFocus}\n maxLength={maxLength}\n minLength={minLength}\n size={size}\n disabled={disabled}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUxE,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAQlE,OAAO,KAAK,EACV,6BAA6B,EAC7B,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAAc,EAAE,6BAA6B,GAC5C;QACD,QAAQ,EAAE,eAAe,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;QACpE,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;KACnC,
|
|
1
|
+
{"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUxE,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAQlE,OAAO,KAAK,EACV,6BAA6B,EAC7B,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAAc,EAAE,6BAA6B,GAC5C;QACD,QAAQ,EAAE,eAAe,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;QACpE,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;KACnC,CAyGA;IAED,oEAAoE;IACpE,SAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,GACvB,cAAc,CAuChB;CACF"}
|
|
@@ -32,7 +32,11 @@ export var EditorInterop;
|
|
|
32
32
|
type: "string",
|
|
33
33
|
},
|
|
34
34
|
value: {
|
|
35
|
-
value: primitiveValue.value
|
|
35
|
+
value: primitiveValue.value !== undefined
|
|
36
|
+
? primitiveValue.value
|
|
37
|
+
: primitiveValue.displayValue === "--"
|
|
38
|
+
? primitiveValue.displayValue
|
|
39
|
+
: "",
|
|
36
40
|
},
|
|
37
41
|
};
|
|
38
42
|
case "dateTime":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,KAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,KAAW,aAAa,CA6J7B;A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C,EA7JgB,aAAa,KAAb,aAAa,QA6J7B","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\nimport type { Primitives, PrimitiveValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n BooleanValue,\n DateValue,\n EnumValue,\n InstanceKeyValue,\n NumericValue,\n TextValue,\n} from \"../values/Values.js\";\nimport type { Value as NewEditorValue } from \"../values/Values.js\";\nimport type { PropertyRecordEditorMetadata } from \"./Metadata.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\nimport type {\n PropertyRecordWithConstraints,\n WithConstraints,\n} from \"../ConstraintUtils.js\";\n\n/**\n * Interop utilities for converting between old and new editor values.\n * @internal\n */\nexport namespace EditorInterop {\n /** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */\n export function getMetadataAndValue(\n propertyRecord: PropertyRecordWithConstraints\n ): {\n metadata: WithConstraints<PropertyRecordEditorMetadata> | undefined;\n value: NewEditorValue | undefined;\n } {\n const baseMetadata: Omit<\n WithConstraints<PropertyRecordEditorMetadata>,\n \"type\"\n > = {\n preferredEditor: propertyRecord.property.editor?.name,\n params: propertyRecord.property.editor?.params,\n extendedData: propertyRecord.extendedData,\n enum: propertyRecord.property.enum,\n typename: propertyRecord.property.typename,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n quantityType: propertyRecord.property.quantityType,\n constraints: propertyRecord.property.constraints,\n };\n\n const primitiveValue = propertyRecord.value as PrimitiveValue;\n switch (propertyRecord.property.typename) {\n case \"text\":\n case \"string\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"string\",\n },\n value: {\n value:\n primitiveValue.value !== undefined\n ? (primitiveValue.value as string)\n : primitiveValue.displayValue === \"--\"\n ? primitiveValue.displayValue\n : \"\",\n } satisfies TextValue,\n };\n case \"dateTime\":\n case \"shortdate\":\n return {\n metadata: {\n ...baseMetadata,\n type:\n propertyRecord.property.typename === \"shortdate\"\n ? \"date\"\n : \"dateTime\",\n },\n value: {\n value: (primitiveValue.value as Date) ?? new Date(),\n } satisfies DateValue,\n };\n case \"boolean\":\n case \"bool\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"bool\",\n },\n value: {\n value: (primitiveValue.value as boolean) ?? false,\n } satisfies BooleanValue,\n };\n case \"float\":\n case \"double\":\n case \"int\":\n case \"integer\":\n case \"number\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"number\",\n },\n value: {\n rawValue: primitiveValue.value as number,\n displayValue: primitiveValue.displayValue\n ? primitiveValue.displayValue\n : primitiveValue.value !== undefined\n ? `${primitiveValue.value as number}`\n : \"\",\n roundingError: primitiveValue.roundingError,\n } satisfies NumericValue,\n };\n case \"enum\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"enum\",\n },\n value: {\n choice: primitiveValue.value as number | string,\n } satisfies EnumValue,\n };\n case \"navigation\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"instanceKey\",\n },\n value: {\n key: primitiveValue.value as Primitives.InstanceKey,\n label: primitiveValue.displayValue ?? \"\",\n } satisfies InstanceKeyValue,\n };\n }\n\n return {\n metadata: undefined,\n value: undefined,\n };\n }\n\n /** Converts new editors system `Value` into old `PrimitiveValue` */\n export function convertToPrimitiveValue(\n newValue: NewEditorValue\n ): PrimitiveValue {\n if (isText(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value,\n };\n }\n if (isNumeric(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.rawValue,\n displayValue: newValue.displayValue,\n roundingError: newValue.roundingError,\n };\n }\n if (isBoolean(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n if (isDate(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n\n if (isEnum(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.choice,\n };\n }\n\n throw new Error(\"Unsupported value type\");\n }\n}\n"]}
|
package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import "./PropertyGrid.scss";
|
|
5
5
|
import * as React from "react";
|
|
6
|
+
import type { PropertyUpdatedArgs } from "../../editors/EditorContainer.js";
|
|
7
|
+
import type { PropertyCategory } from "../PropertyDataProvider.js";
|
|
6
8
|
import type { CommonPropertyGridProps } from "./PropertyGridCommons.js";
|
|
7
9
|
import type { PropertyListProps } from "./PropertyList.js";
|
|
8
10
|
/** @internal */
|
|
9
|
-
export type PropertyGridEventsRelatedProps = Pick<PropertyListProps, "onPropertyClicked" | "onPropertyRightClicked" | "onPropertyContextMenu" | "
|
|
11
|
+
export type PropertyGridEventsRelatedProps = Pick<PropertyListProps, "onPropertyClicked" | "onPropertyRightClicked" | "onPropertyContextMenu" | "onEditCancel" | "selectedPropertyKey" | "editingPropertyKey"> & Pick<CommonPropertyGridProps, "isPropertySelectionOnRightClickEnabled" | "isPropertyEditingEnabled"> & Required<Pick<CommonPropertyGridProps, "isPropertyHoverEnabled" | "isPropertySelectionEnabled">> & {
|
|
12
|
+
onEditCommit: (args: PropertyUpdatedArgs, category: PropertyCategory) => void | Promise<{
|
|
13
|
+
status: "success" | "cancel";
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
10
16
|
/** Properties for [[PropertyGridEventsRelatedPropsSupplier]] React component
|
|
11
17
|
* @internal
|
|
12
18
|
*/
|
|
@@ -21,6 +27,8 @@ interface PropertyGridEventsRelatedPropsSupplierState {
|
|
|
21
27
|
selectedPropertyKey?: string;
|
|
22
28
|
/** Unique key of currently edited property */
|
|
23
29
|
editingPropertyKey?: string;
|
|
30
|
+
/** Indicates if a property edit is currently being committed */
|
|
31
|
+
isCommitting: boolean;
|
|
24
32
|
}
|
|
25
33
|
/** PropertyGridEventsRelatedPropsSupplier React component.
|
|
26
34
|
* @internal
|
package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridEventsRelatedPropsSupplier.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyGridEventsRelatedPropsSupplier.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,gBAAgB;AAChB,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,iBAAiB,EACf,mBAAmB,GACnB,wBAAwB,GACxB,uBAAuB,GACvB,cAAc,GACd,qBAAqB,GACrB,oBAAoB,CACvB,GACC,IAAI,CACF,uBAAuB,EACvB,wCAAwC,GAAG,0BAA0B,CACtE,GACD,QAAQ,CACN,IAAI,CACF,uBAAuB,EACvB,wBAAwB,GAAG,4BAA4B,CACxD,CACF,GAAG;IACF,YAAY,EAAE,CACZ,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,KACvB,IAAI,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC,CAAC;CACvD,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,2CAA2C,GAAG,IAAI,CAC5D,uBAAuB,EACrB,uBAAuB,GACvB,wCAAwC,GACxC,4BAA4B,GAC5B,0BAA0B,GAC1B,mBAAmB,CACtB,GACC,QAAQ,CACN,IAAI,CACF,uBAAuB,EACvB,wBAAwB,GAAG,4BAA4B,CACxD,CACF,GAAG;IACF,QAAQ,EAAE,CAAC,OAAO,EAAE,8BAA8B,KAAK,KAAK,CAAC,SAAS,CAAC;CACxE,CAAC;AAEJ;;GAEG;AACH,UAAU,2CAA2C;IACnD,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gEAAgE;IAChE,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,KAAK,CAAC,SAAS,CACzE,2CAA2C,EAC3C,2CAA2C,CAC5C;gBACa,KAAK,EAAE,2CAA2C;IAK9D,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,uBAAuB,CAM7B;IAEF,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,sBAAsB,CAO5B;IAEF,OAAO,CAAC,aAAa,CAcnB;IAEF,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,6BAA6B;IAgBrC,OAAO,CAAC,4BAA4B;IA8BpB,MAAM;CA0BvB"}
|
package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js
CHANGED
|
@@ -13,7 +13,7 @@ import * as React from "react";
|
|
|
13
13
|
export class PropertyGridEventsRelatedPropsSupplier extends React.Component {
|
|
14
14
|
constructor(props) {
|
|
15
15
|
super(props);
|
|
16
|
-
this.state = {};
|
|
16
|
+
this.state = { isCommitting: false };
|
|
17
17
|
}
|
|
18
18
|
_isClickSupported() {
|
|
19
19
|
return (this.props.isPropertySelectionEnabled ||
|
|
@@ -37,12 +37,25 @@ export class PropertyGridEventsRelatedPropsSupplier extends React.Component {
|
|
|
37
37
|
};
|
|
38
38
|
_onEditCommit = async (args, category) => {
|
|
39
39
|
if (this.props.onPropertyUpdated) {
|
|
40
|
-
|
|
41
|
-
this.
|
|
40
|
+
this.setState({ isCommitting: true });
|
|
41
|
+
const result = await this.props.onPropertyUpdated(args, category);
|
|
42
|
+
this.setState({
|
|
43
|
+
editingPropertyKey: undefined,
|
|
44
|
+
isCommitting: false,
|
|
45
|
+
});
|
|
46
|
+
return { status: result === false ? "cancel" : "success" };
|
|
42
47
|
}
|
|
48
|
+
return { status: "success" };
|
|
43
49
|
};
|
|
44
50
|
_onEditCancel = () => {
|
|
45
|
-
this.setState(
|
|
51
|
+
this.setState((prev) =>
|
|
52
|
+
// do not reset editingPropertyKey if currently committing an edit, to prevent editor from being closed before commit finishes
|
|
53
|
+
prev.isCommitting
|
|
54
|
+
? prev
|
|
55
|
+
: {
|
|
56
|
+
editingPropertyKey: undefined,
|
|
57
|
+
isCommitting: false,
|
|
58
|
+
});
|
|
46
59
|
};
|
|
47
60
|
onEnabledPropertyRightClicked(property, key) {
|
|
48
61
|
let selectedPropertyKey = this.state.selectedPropertyKey;
|
package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridEventsRelatedPropsSupplier.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA2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AkB,CACtE,CAAC;IACJ,CAAC;CACF","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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./PropertyGrid.scss\";\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer.js\";\nimport type { PropertyCategory } from \"../PropertyDataProvider.js\";\nimport type { CommonPropertyGridProps } from \"./PropertyGridCommons.js\";\nimport type { PropertyListProps } from \"./PropertyList.js\";\n\n/** @internal */\nexport type PropertyGridEventsRelatedProps = Pick<\n PropertyListProps,\n | \"onPropertyClicked\"\n | \"onPropertyRightClicked\"\n | \"onPropertyContextMenu\"\n | \"onEditCommit\"\n | \"onEditCancel\"\n | \"selectedPropertyKey\"\n | \"editingPropertyKey\"\n> &\n Pick<\n CommonPropertyGridProps,\n \"isPropertySelectionOnRightClickEnabled\" | \"isPropertyEditingEnabled\"\n > &\n Required<\n Pick<\n CommonPropertyGridProps,\n \"isPropertyHoverEnabled\" | \"isPropertySelectionEnabled\"\n >\n >;\n\n/** Properties for [[PropertyGridEventsRelatedPropsSupplier]] React component\n * @internal\n */\nexport type PropertyGridEventsRelatedPropsSupplierProps = Pick<\n CommonPropertyGridProps,\n | \"onPropertyContextMenu\"\n | \"isPropertySelectionOnRightClickEnabled\"\n | \"onPropertySelectionChanged\"\n | \"isPropertyEditingEnabled\"\n | \"onPropertyUpdated\"\n> &\n Required<\n Pick<\n CommonPropertyGridProps,\n \"isPropertyHoverEnabled\" | \"isPropertySelectionEnabled\"\n >\n > & {\n children: (context: PropertyGridEventsRelatedProps) => React.ReactNode;\n };\n\n/** State of [[PropertyGridEventsRelatedPropsSupplier]] React component\n * @internal\n */\ninterface PropertyGridEventsRelatedPropsSupplierState {\n /** Unique key of currently selected property */\n selectedPropertyKey?: string;\n /** Unique key of currently edited property */\n editingPropertyKey?: string;\n}\n\n/** PropertyGridEventsRelatedPropsSupplier React component.\n * @internal\n */\nexport class PropertyGridEventsRelatedPropsSupplier extends React.Component<\n PropertyGridEventsRelatedPropsSupplierProps,\n PropertyGridEventsRelatedPropsSupplierState\n> {\n constructor(props: PropertyGridEventsRelatedPropsSupplierProps) {\n super(props);\n this.state = {};\n }\n\n private _isClickSupported() {\n return (\n this.props.isPropertySelectionEnabled ||\n this.props.isPropertyEditingEnabled\n );\n }\n\n private _isRightClickSupported() {\n return this.props.isPropertySelectionOnRightClickEnabled;\n }\n\n private _onPropertyRightClicked = (\n property: PropertyRecord,\n key?: string\n ) => {\n if (this._isRightClickSupported())\n this.onEnabledPropertyRightClicked(property, key);\n };\n\n private _onPropertyClicked = (property: PropertyRecord, key?: string) => {\n if (this._isClickSupported())\n this.onEnabledPropertyLeftClicked(property, key);\n };\n\n private _onPropertyContextMenu = (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => {\n if (this.props.onPropertyContextMenu) {\n this.props.onPropertyContextMenu({ propertyRecord: property, event: e });\n }\n };\n\n private _onEditCommit = async (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => {\n if (this.props.onPropertyUpdated) {\n await this.props.onPropertyUpdated(args, category);\n this.setState({ editingPropertyKey: undefined });\n }\n };\n\n private _onEditCancel = () => {\n this.setState({ editingPropertyKey: undefined });\n };\n\n private onEnabledPropertyRightClicked(\n property: PropertyRecord,\n key: string | undefined\n ) {\n let selectedPropertyKey = this.state.selectedPropertyKey;\n let editingPropertyKey = this.state.editingPropertyKey;\n\n editingPropertyKey = undefined;\n if (selectedPropertyKey !== key) selectedPropertyKey = key;\n\n if (this.props.onPropertySelectionChanged)\n this.props.onPropertySelectionChanged(property);\n\n this.setState({ selectedPropertyKey, editingPropertyKey });\n }\n\n private onEnabledPropertyLeftClicked(\n property: PropertyRecord,\n key: string | undefined\n ) {\n let selectedPropertyKey = this.state.selectedPropertyKey;\n let editingPropertyKey = this.state.editingPropertyKey;\n\n const isEditingEnabled = this.props.isPropertyEditingEnabled;\n const isSelectionEnabled = this.props.isPropertySelectionEnabled;\n\n if (isEditingEnabled) {\n // Deselect editing key only if another selection was made\n editingPropertyKey =\n isSelectionEnabled && selectedPropertyKey !== key ? undefined : key;\n }\n\n if (editingPropertyKey === key) {\n this.setState({ editingPropertyKey });\n return;\n }\n\n // Select/Deselect\n selectedPropertyKey = selectedPropertyKey !== key ? key : undefined;\n\n if (this.props.onPropertySelectionChanged)\n this.props.onPropertySelectionChanged(property);\n\n this.setState({ selectedPropertyKey, editingPropertyKey });\n }\n\n public override render() {\n const renderContext: PropertyGridEventsRelatedProps = {\n isPropertyHoverEnabled: this.props.isPropertyHoverEnabled,\n isPropertySelectionEnabled: this.props.isPropertySelectionEnabled,\n isPropertySelectionOnRightClickEnabled:\n this.props.isPropertySelectionOnRightClickEnabled,\n isPropertyEditingEnabled: this.props.isPropertyEditingEnabled,\n selectedPropertyKey: this.state.selectedPropertyKey,\n editingPropertyKey: this.state.editingPropertyKey,\n onEditCommit: this._onEditCommit,\n onEditCancel: this._onEditCancel,\n onPropertyClicked: this._isClickSupported()\n ? this._onPropertyClicked\n : undefined,\n onPropertyRightClicked: this._isRightClickSupported()\n ? this._onPropertyRightClicked\n : undefined,\n onPropertyContextMenu: this.props.onPropertyContextMenu\n ? this._onPropertyContextMenu\n : undefined,\n };\n\n return (\n <React.Fragment>{this.props.children(renderContext)}</React.Fragment>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyGridEventsRelatedPropsSupplier.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiE/B;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,KAAK,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CAAC,kBAAkB;gBACzB,CAAC,CAAC,SAAS;YACb,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,EAAE;gBACnD,CAAC,CAAC,IAAI,CAAC,uBAAuB;gBAC9B,CAAC,CAAC,SAAS;YACb,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB;gBACrD,CAAC,CAAC,IAAI,CAAC,sBAAsB;gBAC7B,CAAC,CAAC,SAAS;SACd,CAAC;QAEF,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,QAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAkB,CACtE,CAAC;IACJ,CAAC;CACF","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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./PropertyGrid.scss\";\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer.js\";\nimport type { PropertyCategory } from \"../PropertyDataProvider.js\";\nimport type { CommonPropertyGridProps } from \"./PropertyGridCommons.js\";\nimport type { PropertyListProps } from \"./PropertyList.js\";\n\n/** @internal */\nexport type PropertyGridEventsRelatedProps = Pick<\n PropertyListProps,\n | \"onPropertyClicked\"\n | \"onPropertyRightClicked\"\n | \"onPropertyContextMenu\"\n | \"onEditCancel\"\n | \"selectedPropertyKey\"\n | \"editingPropertyKey\"\n> &\n Pick<\n CommonPropertyGridProps,\n \"isPropertySelectionOnRightClickEnabled\" | \"isPropertyEditingEnabled\"\n > &\n Required<\n Pick<\n CommonPropertyGridProps,\n \"isPropertyHoverEnabled\" | \"isPropertySelectionEnabled\"\n >\n > & {\n onEditCommit: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void | Promise<{ status: \"success\" | \"cancel\" }>;\n };\n\n/** Properties for [[PropertyGridEventsRelatedPropsSupplier]] React component\n * @internal\n */\nexport type PropertyGridEventsRelatedPropsSupplierProps = Pick<\n CommonPropertyGridProps,\n | \"onPropertyContextMenu\"\n | \"isPropertySelectionOnRightClickEnabled\"\n | \"onPropertySelectionChanged\"\n | \"isPropertyEditingEnabled\"\n | \"onPropertyUpdated\"\n> &\n Required<\n Pick<\n CommonPropertyGridProps,\n \"isPropertyHoverEnabled\" | \"isPropertySelectionEnabled\"\n >\n > & {\n children: (context: PropertyGridEventsRelatedProps) => React.ReactNode;\n };\n\n/** State of [[PropertyGridEventsRelatedPropsSupplier]] React component\n * @internal\n */\ninterface PropertyGridEventsRelatedPropsSupplierState {\n /** Unique key of currently selected property */\n selectedPropertyKey?: string;\n /** Unique key of currently edited property */\n editingPropertyKey?: string;\n /** Indicates if a property edit is currently being committed */\n isCommitting: boolean;\n}\n\n/** PropertyGridEventsRelatedPropsSupplier React component.\n * @internal\n */\nexport class PropertyGridEventsRelatedPropsSupplier extends React.Component<\n PropertyGridEventsRelatedPropsSupplierProps,\n PropertyGridEventsRelatedPropsSupplierState\n> {\n constructor(props: PropertyGridEventsRelatedPropsSupplierProps) {\n super(props);\n this.state = { isCommitting: false };\n }\n\n private _isClickSupported() {\n return (\n this.props.isPropertySelectionEnabled ||\n this.props.isPropertyEditingEnabled\n );\n }\n\n private _isRightClickSupported() {\n return this.props.isPropertySelectionOnRightClickEnabled;\n }\n\n private _onPropertyRightClicked = (\n property: PropertyRecord,\n key?: string\n ) => {\n if (this._isRightClickSupported())\n this.onEnabledPropertyRightClicked(property, key);\n };\n\n private _onPropertyClicked = (property: PropertyRecord, key?: string) => {\n if (this._isClickSupported())\n this.onEnabledPropertyLeftClicked(property, key);\n };\n\n private _onPropertyContextMenu = (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => {\n if (this.props.onPropertyContextMenu) {\n this.props.onPropertyContextMenu({ propertyRecord: property, event: e });\n }\n };\n\n private _onEditCommit = async (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ): Promise<{ status: \"success\" | \"cancel\" }> => {\n if (this.props.onPropertyUpdated) {\n this.setState({ isCommitting: true });\n const result = await this.props.onPropertyUpdated(args, category);\n this.setState({\n editingPropertyKey: undefined,\n isCommitting: false,\n });\n return { status: result === false ? \"cancel\" : \"success\" };\n }\n return { status: \"success\" };\n };\n\n private _onEditCancel = () => {\n this.setState((prev) =>\n // do not reset editingPropertyKey if currently committing an edit, to prevent editor from being closed before commit finishes\n prev.isCommitting\n ? prev\n : {\n editingPropertyKey: undefined,\n isCommitting: false,\n }\n );\n };\n\n private onEnabledPropertyRightClicked(\n property: PropertyRecord,\n key: string | undefined\n ) {\n let selectedPropertyKey = this.state.selectedPropertyKey;\n let editingPropertyKey = this.state.editingPropertyKey;\n\n editingPropertyKey = undefined;\n if (selectedPropertyKey !== key) selectedPropertyKey = key;\n\n if (this.props.onPropertySelectionChanged)\n this.props.onPropertySelectionChanged(property);\n\n this.setState({ selectedPropertyKey, editingPropertyKey });\n }\n\n private onEnabledPropertyLeftClicked(\n property: PropertyRecord,\n key: string | undefined\n ) {\n let selectedPropertyKey = this.state.selectedPropertyKey;\n let editingPropertyKey = this.state.editingPropertyKey;\n\n const isEditingEnabled = this.props.isPropertyEditingEnabled;\n const isSelectionEnabled = this.props.isPropertySelectionEnabled;\n\n if (isEditingEnabled) {\n // Deselect editing key only if another selection was made\n editingPropertyKey =\n isSelectionEnabled && selectedPropertyKey !== key ? undefined : key;\n }\n\n if (editingPropertyKey === key) {\n this.setState({ editingPropertyKey });\n return;\n }\n\n // Select/Deselect\n selectedPropertyKey = selectedPropertyKey !== key ? key : undefined;\n\n if (this.props.onPropertySelectionChanged)\n this.props.onPropertySelectionChanged(property);\n\n this.setState({ selectedPropertyKey, editingPropertyKey });\n }\n\n public override render() {\n const renderContext: PropertyGridEventsRelatedProps = {\n isPropertyHoverEnabled: this.props.isPropertyHoverEnabled,\n isPropertySelectionEnabled: this.props.isPropertySelectionEnabled,\n isPropertySelectionOnRightClickEnabled:\n this.props.isPropertySelectionOnRightClickEnabled,\n isPropertyEditingEnabled: this.props.isPropertyEditingEnabled,\n selectedPropertyKey: this.state.selectedPropertyKey,\n editingPropertyKey: this.state.editingPropertyKey,\n onEditCommit: this._onEditCommit,\n onEditCancel: this._onEditCancel,\n onPropertyClicked: this._isClickSupported()\n ? this._onPropertyClicked\n : undefined,\n onPropertyRightClicked: this._isRightClickSupported()\n ? this._onPropertyRightClicked\n : undefined,\n onPropertyContextMenu: this.props.onPropertyContextMenu\n ? this._onPropertyContextMenu\n : undefined,\n };\n\n return (\n <React.Fragment>{this.props.children(renderContext)}</React.Fragment>\n );\n }\n}\n"]}
|
|
@@ -104,7 +104,9 @@ export interface VirtualizedPropertyGridContext {
|
|
|
104
104
|
onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;
|
|
105
105
|
onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;
|
|
106
106
|
editingPropertyKey?: string;
|
|
107
|
-
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void
|
|
107
|
+
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void | Promise<{
|
|
108
|
+
status: "success" | "cancel";
|
|
109
|
+
}>;
|
|
108
110
|
onEditCancel?: () => void;
|
|
109
111
|
editorSystem: "legacy" | "new";
|
|
110
112
|
eventHandler: IPropertyGridEventHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGrid.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE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AC,EAAE,CACtB,QAAQ,EAAE,cAAc,EACxB,CAAC,EAAE,KAAK,CAAC,UAAU,KAChB,IAAI,CAAC;IAEV,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,KACvB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGrid.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAE7F,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,wCAAwC,CAAC;AAMhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;GAEG;AACH,UAAU,gCAAiC,SAAQ,uBAAuB;IACxE,sEAAsE;IACtE,KAAK,EAAE,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,OAAO,CAAC;IACpC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG;QAC9C,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,yBAAyB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,0BAA0B,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAExD,SAAS,CAAC,EAAE,iCAAiC,CAAC;CAC/C;AAeD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gCAIrC,CAAC;AAiUF;;;;GAIG;AACH,wBAAgB,uCAAuC,CAAC,CAAC,SAAS,OAAO;;;;EAExE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,kCAAkC,EAAE,MAAM,iDAAiD,CAAC;AAKrG,OAAO,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAKtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,+DAA+D,CAAC;AACpH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAI3F,OAAO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,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,6BAAK,GAAG,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ListChildComponentProps,\n VariableSizeListProps,\n} from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider.js\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer.js\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer.js\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns.js\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager.js\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase.js\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem.js\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty.js\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory.js\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem.js\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory.js\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer.js\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler.js\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel.js\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager.js\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager.js\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider.js\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier.js\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper.js\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock.js\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons.js\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons.js\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier.js\";\nimport { useElementsScrollStorage } from \"../../common/UseElementsScrollStorage.js\";\nimport { Orientation } from \"../../common/Orientation.js\";\n\n/**\n * @public\n */\ninterface VirtualizedPropertyGridBaseProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** @public */\ninterface VirtualizedPropertyGridLegacyProps\n extends VirtualizedPropertyGridBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n * @deprecated in 5.30. Legacy editors system is deprecated. Use `editorSystem: \"new\"`.\n */\n editorSystem?: \"legacy\";\n}\n\n/**\n * @public\n */\ninterface VirtualizedPropertyGridNewProps\n extends VirtualizedPropertyGridBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n */\n editorSystem: \"new\";\n}\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n * @deprecated in 5.30.0. Use `React.ComponentProps<typeof VirtualizedPropertyGrid>` instead.\n */\nexport type VirtualizedPropertyGridProps =\n | VirtualizedPropertyGridLegacyProps\n | VirtualizedPropertyGridNewProps;\n\ninterface VirtualizedPropertyGridComponent {\n /**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for `IPropertyGridModelSource` and `IPropertyGridEventHandler`\n * @public\n */\n (props: VirtualizedPropertyGridNewProps): React.JSX.Element;\n /**\n * @deprecated in 5.30. Use `VirtualizedPropertyGrid` with `editorSystem=\"new\"` instead.\n * @public\n */\n (props: VirtualizedPropertyGridLegacyProps): React.JSX.Element;\n /** @public */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (props: VirtualizedPropertyGridProps): React.JSX.Element;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [[VirtualizedPropertyGrid]] component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n isPropertyEditingEnabled?: boolean;\n\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n onEditCancel?: () => void;\n editorSystem: \"legacy\" | \"new\";\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | {\n ratio: number;\n };\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\nconst CATEGORY_HEADER_HEIGHT = 42;\nconst CATEGORY_PROPERTY_HEIGHT = 28;\nconst VERTICAL_CATEGORY_PROPERTY_HEIGHT = 48;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport const VirtualizedPropertyGrid: VirtualizedPropertyGridComponent = (\n props\n) => {\n return <VirtualizedPropertyGridImpl {...props} />;\n};\n\nclass VirtualizedPropertyGridImpl extends React.Component<\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation:\n props.orientation ??\n PropertyGridCommons.getCurrentOrientation(\n props.width,\n undefined,\n props.isOrientationFixed,\n props.horizontalOrientationMinWidth\n ),\n dynamicNodeHeights: new Map(),\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public override componentDidUpdate(prevProps: VirtualizedPropertyGridProps) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n }\n\n public static getDerivedStateFromProps(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n return getPropertyHeight(this.state);\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return CATEGORY_HEADER_HEIGHT + (node.isExpanded ? dynamicHeight : 0);\n }\n\n return dynamicHeight;\n }\n\n if (node.type === FlatGridItemType.Category) {\n return CATEGORY_HEADER_HEIGHT;\n }\n\n return state.orientation === Orientation.Vertical\n ? VERTICAL_CATEGORY_PROPERTY_HEIGHT\n : CATEGORY_PROPERTY_HEIGHT;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState(\n (state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n };\n },\n () => this._listRef.current!.resetAfterIndex(index)\n );\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n isPropertyEditingEnabled: this.props.isPropertyEditingEnabled,\n\n alwaysShowEditor: this.props.alwaysShowEditor,\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem: this.props.editorSystem ?? \"legacy\",\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <VirtualizedPropertyGridInternal\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n />\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\nconst VirtualizedPropertyGridInternal = React.forwardRef<\n VariableSizeList,\n Omit<VariableSizeListProps, \"children\">\n>(function VirtualizedPropertyGridInternal(props, ref) {\n const { gridContext } = usePropertyGridInternalContext(FlatGridItemNode);\n\n React.useEffect(() => {\n return gridContext.dataProvider.onDataChanged.addListener(() => {\n gridContext.onEditCancel?.();\n });\n }, [gridContext]);\n\n return (\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n {...props}\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n props.className\n )}\n ref={ref}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n );\n});\n\n/**\n * Returns callbacks for persisting and restoring [[VirtualizedPropertyGrid]] layout state.\n * Returned `ref` should be set on container containing [[VirtualizedPropertyGrid]].\n * @public\n */\nexport function useVirtualizedPropertyGridLayoutStorage<T extends Element>() {\n return useElementsScrollStorage<T>(\"ReactWindow__VariableSizeList\");\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n const divRef = React.useRef<HTMLDivElement>(null);\n const previousHeightRef = React.useRef(0);\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n const minHeight = React.useMemo(() => {\n if (node.type === FlatGridItemType.Category)\n return CATEGORY_HEADER_HEIGHT;\n\n return gridContext.orientation === Orientation.Vertical\n ? VERTICAL_CATEGORY_PROPERTY_HEIGHT\n : CATEGORY_PROPERTY_HEIGHT;\n }, [gridContext.orientation, node.type]);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const refHeight = divRef.current.getBoundingClientRect().height;\n const currentHeight = Math.max(refHeight, minHeight);\n\n if (currentHeight !== previousHeightRef.current) {\n onHeightChanged(currentHeight);\n previousHeightRef.current = currentHeight;\n }\n });\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={gridContext.onPropertyClicked}\n onRightClick={gridContext.onPropertyRightClicked}\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n isPropertyEditingEnabled={gridContext.isPropertyEditingEnabled}\n alwaysShowEditor={gridContext.alwaysShowEditor}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n editorSystem={gridContext.editorSystem}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n <div\n className=\"virtualized-grid-node-content-wrapper\"\n style={{\n minHeight: `${minHeight}px`,\n display: \"grid\",\n }}\n >\n <div\n ref={divRef}\n className=\"virtualized-grid-node-content-wrapper-item\"\n >\n {getDisplayNode()}\n </div>\n </div>\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,kCAAkC,EAAE,MAAM,iDAAiD,CAAC;AAKrG,OAAO,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAKtF,OAAO,EAAE,mCAAmC,EAAE,MAAM,+DAA+D,CAAC;AACpH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAI3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAKxF,OAAO,EAAE,uCAAuC,EAAE,MAAM,8CAA8C,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE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,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,6BAAK,GAAG,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ListChildComponentProps,\n VariableSizeListProps,\n} from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider.js\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer.js\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer.js\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns.js\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager.js\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase.js\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem.js\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty.js\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory.js\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem.js\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory.js\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer.js\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler.js\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel.js\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager.js\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager.js\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider.js\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier.js\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper.js\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock.js\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons.js\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons.js\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier.js\";\nimport { useElementsScrollStorage } from \"../../common/UseElementsScrollStorage.js\";\nimport { Orientation } from \"../../common/Orientation.js\";\n\n/**\n * @public\n */\ninterface VirtualizedPropertyGridBaseProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** @public */\ninterface VirtualizedPropertyGridLegacyProps\n extends VirtualizedPropertyGridBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n * @deprecated in 5.30. Legacy editors system is deprecated. Use `editorSystem: \"new\"`.\n */\n editorSystem?: \"legacy\";\n}\n\n/**\n * @public\n */\ninterface VirtualizedPropertyGridNewProps\n extends VirtualizedPropertyGridBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n */\n editorSystem: \"new\";\n}\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n * @deprecated in 5.30.0. Use `React.ComponentProps<typeof VirtualizedPropertyGrid>` instead.\n */\nexport type VirtualizedPropertyGridProps =\n | VirtualizedPropertyGridLegacyProps\n | VirtualizedPropertyGridNewProps;\n\ninterface VirtualizedPropertyGridComponent {\n /**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for `IPropertyGridModelSource` and `IPropertyGridEventHandler`\n * @public\n */\n (props: VirtualizedPropertyGridNewProps): React.JSX.Element;\n /**\n * @deprecated in 5.30. Use `VirtualizedPropertyGrid` with `editorSystem=\"new\"` instead.\n * @public\n */\n (props: VirtualizedPropertyGridLegacyProps): React.JSX.Element;\n /** @public */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (props: VirtualizedPropertyGridProps): React.JSX.Element;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [[VirtualizedPropertyGrid]] component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n isPropertyEditingEnabled?: boolean;\n\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void | Promise<{ status: \"success\" | \"cancel\" }>;\n onEditCancel?: () => void;\n editorSystem: \"legacy\" | \"new\";\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | {\n ratio: number;\n };\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\nconst CATEGORY_HEADER_HEIGHT = 42;\nconst CATEGORY_PROPERTY_HEIGHT = 28;\nconst VERTICAL_CATEGORY_PROPERTY_HEIGHT = 48;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport const VirtualizedPropertyGrid: VirtualizedPropertyGridComponent = (\n props\n) => {\n return <VirtualizedPropertyGridImpl {...props} />;\n};\n\nclass VirtualizedPropertyGridImpl extends React.Component<\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation:\n props.orientation ??\n PropertyGridCommons.getCurrentOrientation(\n props.width,\n undefined,\n props.isOrientationFixed,\n props.horizontalOrientationMinWidth\n ),\n dynamicNodeHeights: new Map(),\n };\n }\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public override componentDidUpdate(prevProps: VirtualizedPropertyGridProps) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n }\n\n public static getDerivedStateFromProps(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n return getPropertyHeight(this.state);\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return CATEGORY_HEADER_HEIGHT + (node.isExpanded ? dynamicHeight : 0);\n }\n\n return dynamicHeight;\n }\n\n if (node.type === FlatGridItemType.Category) {\n return CATEGORY_HEADER_HEIGHT;\n }\n\n return state.orientation === Orientation.Vertical\n ? VERTICAL_CATEGORY_PROPERTY_HEIGHT\n : CATEGORY_PROPERTY_HEIGHT;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState(\n (state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n };\n },\n () => this._listRef.current!.resetAfterIndex(index)\n );\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n isPropertyEditingEnabled: this.props.isPropertyEditingEnabled,\n\n alwaysShowEditor: this.props.alwaysShowEditor,\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem: this.props.editorSystem ?? \"legacy\",\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <VirtualizedPropertyGridInternal\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n />\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\nconst VirtualizedPropertyGridInternal = React.forwardRef<\n VariableSizeList,\n Omit<VariableSizeListProps, \"children\">\n>(function VirtualizedPropertyGridInternal(props, ref) {\n const { gridContext } = usePropertyGridInternalContext(FlatGridItemNode);\n\n React.useEffect(() => {\n return gridContext.dataProvider.onDataChanged.addListener(() => {\n gridContext.onEditCancel?.();\n });\n }, [gridContext]);\n\n return (\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n {...props}\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n props.className\n )}\n ref={ref}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n );\n});\n\n/**\n * Returns callbacks for persisting and restoring [[VirtualizedPropertyGrid]] layout state.\n * Returned `ref` should be set on container containing [[VirtualizedPropertyGrid]].\n * @public\n */\nexport function useVirtualizedPropertyGridLayoutStorage<T extends Element>() {\n return useElementsScrollStorage<T>(\"ReactWindow__VariableSizeList\");\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n const divRef = React.useRef<HTMLDivElement>(null);\n const previousHeightRef = React.useRef(0);\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n const minHeight = React.useMemo(() => {\n if (node.type === FlatGridItemType.Category)\n return CATEGORY_HEADER_HEIGHT;\n\n return gridContext.orientation === Orientation.Vertical\n ? VERTICAL_CATEGORY_PROPERTY_HEIGHT\n : CATEGORY_PROPERTY_HEIGHT;\n }, [gridContext.orientation, node.type]);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const refHeight = divRef.current.getBoundingClientRect().height;\n const currentHeight = Math.max(refHeight, minHeight);\n\n if (currentHeight !== previousHeightRef.current) {\n onHeightChanged(currentHeight);\n previousHeightRef.current = currentHeight;\n }\n });\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={gridContext.onPropertyClicked}\n onRightClick={gridContext.onPropertyRightClicked}\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n isPropertyEditingEnabled={gridContext.isPropertyEditingEnabled}\n alwaysShowEditor={gridContext.alwaysShowEditor}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n editorSystem={gridContext.editorSystem}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n <div\n className=\"virtualized-grid-node-content-wrapper\"\n style={{\n minHeight: `${minHeight}px`,\n display: \"grid\",\n }}\n >\n <div\n ref={divRef}\n className=\"virtualized-grid-node-content-wrapper-item\"\n >\n {getDisplayNode()}\n </div>\n </div>\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
|
package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export interface FlatPropertyRendererProps extends SharedRendererProps {
|
|
|
22
22
|
/** Callback to determine which editors should be always visible */
|
|
23
23
|
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
24
24
|
/** Called when property edit is committed. */
|
|
25
|
-
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void
|
|
25
|
+
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void | Promise<{
|
|
26
|
+
status: "success" | "cancel";
|
|
27
|
+
}>;
|
|
26
28
|
/** Called when property edit is cancelled. */
|
|
27
29
|
onEditCancel?: () => void;
|
|
28
30
|
/** Used to switch between new and legacy editing system. */
|
package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatPropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMtE;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,4BAA4B;IAC5B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC;IACzD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,KACvB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"FlatPropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMtE;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,4BAA4B;IAC5B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC;IACzD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,gBAAgB,KACvB,IAAI,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC,CAAC;IACtD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAChC,6DAA6D;IAC7D,UAAU,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,uCAAuC;IACvC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C,SAAS,CAAC,EAAE,0BAA0B,GAAG;QACvC,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;IAEF,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA+DpE,CAAC"}
|
|
@@ -47,18 +47,47 @@ const DisplayValue = (props) => {
|
|
|
47
47
|
const alwaysShowsEditor = props.alwaysShowEditor
|
|
48
48
|
? props.alwaysShowEditor(props.propertyRecord)
|
|
49
49
|
: false;
|
|
50
|
+
const { editorKey, onCancel } = useEditorKey({
|
|
51
|
+
propertyRecord: props.propertyRecord,
|
|
52
|
+
});
|
|
50
53
|
if (props.isEditing ||
|
|
51
54
|
(alwaysShowsEditor && props.isPropertyEditingEnabled)) {
|
|
52
|
-
const _onEditCommit = (args) => {
|
|
53
|
-
if (props.category)
|
|
54
|
-
|
|
55
|
+
const _onEditCommit = async (args) => {
|
|
56
|
+
if (!props.category) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const result = await props.onEditCommit?.(args, props.category);
|
|
60
|
+
if (result?.status === "cancel") {
|
|
61
|
+
onCancel();
|
|
62
|
+
}
|
|
55
63
|
};
|
|
56
|
-
return (React.createElement(PropertyRecordEditor, { propertyRecord: props.propertyRecord, onCommit: _onEditCommit, onCancel:
|
|
64
|
+
return (React.createElement(PropertyRecordEditor, { key: editorKey, propertyRecord: props.propertyRecord, onCommit: _onEditCommit, onCancel: () => {
|
|
65
|
+
props.onEditCancel?.();
|
|
66
|
+
onCancel();
|
|
67
|
+
}, onClick: () => props.onClick?.(props.propertyRecord, props.uniqueKey), setFocus: props.isEditing,
|
|
57
68
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
58
69
|
editorSystem: props.editorSystem, size: "small" }));
|
|
59
70
|
}
|
|
60
71
|
return CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager, props.isExpanded, props.onExpansionToggled, props.onHeightChanged, props.highlight);
|
|
61
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Created key for editor component. Different key is produced to reset editor when:
|
|
75
|
+
* - property value changes
|
|
76
|
+
* - edit is cancelled (to reset editor internal state to initial value)
|
|
77
|
+
*/
|
|
78
|
+
function useEditorKey({ propertyRecord, }) {
|
|
79
|
+
const [internalKey, setInternalKey] = React.useState(1);
|
|
80
|
+
const onCancel = () => {
|
|
81
|
+
setInternalKey((prev) => prev + 1);
|
|
82
|
+
};
|
|
83
|
+
const key = React.useMemo(() => {
|
|
84
|
+
const serializedValue = propertyRecord.value.valueFormat === PropertyValueFormat.Primitive
|
|
85
|
+
? JSON.stringify(propertyRecord.value.value)
|
|
86
|
+
: "";
|
|
87
|
+
return `${serializedValue}-${internalKey}`;
|
|
88
|
+
}, [internalKey, propertyRecord]);
|
|
89
|
+
return { editorKey: key, onCancel };
|
|
90
|
+
}
|
|
62
91
|
function useResetHeightOnEdit(orientation, isEditing, onHeightChanged) {
|
|
63
92
|
const previousEditingStatusRef = React.useRef(isEditing);
|
|
64
93
|
React.useEffect(() => {
|
package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAGjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,+DAA+D,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAuC5F;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CACvE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,4BAA4B,EAAE,SAAS,EAAE,GAAG,gBAAgB,EAAE,GACpE,KAAK,CAAC;IAER,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CACjC,oBAAC,YAAY,OAAK,KAAK,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,QAAQ,GAAI,CAC1E,CAAC;IAEF,MAAM,sBAAsB,GAA2B;QACrD,GAAG,gBAAgB;QACnB,oBAAoB;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CAAC;IAEF,MAAM,eAAe,GACnB,4BAA4B,IAAI,4BAA4B,CAAC,cAAc,CAAC;IAC9E,MA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,MAAM,CAAC,SAAS,CAAC,CAAC;IACzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,wBAAwB,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACnD,eAAe,EAAE,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,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 PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps.js\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer.js\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer.js\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer.js\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer.js\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager.js\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer.js\";\nimport { CustomizablePropertyRenderer } from \"../../../properties/renderers/CustomizablePropertyRenderer.js\";\nimport { Orientation } from \"../../../common/Orientation.js\";\nimport { PropertyRecordEditor } from \"../../../new-editors/interop/PropertyRecordEditor.js\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Callback to determine which editors should be always visible */\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Used to switch between new and legacy editing system. */\n editorSystem?: \"legacy\" | \"new\";\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const { propertyValueRendererManager, highlight, ...passthroughProps } =\n props;\n\n const valueElementRenderer = () => (\n <DisplayValue {...props} editorSystem={props.editorSystem ?? \"legacy\"} />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n\n const rendererManager =\n propertyValueRendererManager ?? PropertyValueRendererManager.defaultManager;\n const hasCustomRenderer = rendererManager.hasCustomRenderer(\n passthroughProps.propertyRecord\n );\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty or has a custom renderer registered, render it as a customizable property\n if (props.propertyRecord.value.items.length === 0 || hasCustomRenderer)\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n // If a custom renderer is registered for the struct property, render it as a customizable property\n if (hasCustomRenderer) {\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n }\n\n return (\n <FlatNonPrimitivePropertyRenderer\n {...primitiveRendererProps}\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n valueElement={undefined}\n valueElementRenderer={undefined}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n isPropertyEditingEnabled?: boolean;\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n onClick?: (property: PropertyRecord, key?: string) => void;\n uniqueKey?: string;\n category?: PropertyCategory;\n editorSystem: \"legacy\" | \"new\";\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props): React.ReactNode => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n const alwaysShowsEditor = props.alwaysShowEditor\n ? props.alwaysShowEditor(props.propertyRecord)\n : false;\n\n if (\n props.isEditing ||\n (alwaysShowsEditor && props.isPropertyEditingEnabled)\n ) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <PropertyRecordEditor\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? (() => {})}\n onClick={() => props.onClick?.(props.propertyRecord, props.uniqueKey)}\n setFocus={props.isEditing}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={props.editorSystem}\n size=\"small\"\n />\n );\n }\n\n return CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n );\n};\n\nfunction useResetHeightOnEdit(\n orientation: Orientation,\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(orientation === Orientation.Vertical ? 48 : 28);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAGjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,+DAA+D,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAuC5F;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwC,CACvE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,4BAA4B,EAAE,SAAS,EAAE,GAAG,gBAAgB,EAAE,GACpE,KAAK,CAAC;IAER,MAAM,oBAA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AQ,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAC3B,WAAwB,EACxB,SAAmB,EACnB,eAA6C;IAE7C,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,wBAAwB,CAAC,OAAO,IAAI,SAAS,EAAE,CAAC;YACnD,eAAe,EAAE,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,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 PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps.js\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer.js\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer.js\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer.js\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer.js\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager.js\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer.js\";\nimport { CustomizablePropertyRenderer } from \"../../../properties/renderers/CustomizablePropertyRenderer.js\";\nimport { Orientation } from \"../../../common/Orientation.js\";\nimport { PropertyRecordEditor } from \"../../../new-editors/interop/PropertyRecordEditor.js\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Callback to determine which editors should be always visible */\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void | Promise<{ status: \"success\" | \"cancel\" }>;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Used to switch between new and legacy editing system. */\n editorSystem?: \"legacy\" | \"new\";\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const { propertyValueRendererManager, highlight, ...passthroughProps } =\n props;\n\n const valueElementRenderer = () => (\n <DisplayValue {...props} editorSystem={props.editorSystem ?? \"legacy\"} />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n\n const rendererManager =\n propertyValueRendererManager ?? PropertyValueRendererManager.defaultManager;\n const hasCustomRenderer = rendererManager.hasCustomRenderer(\n passthroughProps.propertyRecord\n );\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty or has a custom renderer registered, render it as a customizable property\n if (props.propertyRecord.value.items.length === 0 || hasCustomRenderer)\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n // If a custom renderer is registered for the struct property, render it as a customizable property\n if (hasCustomRenderer) {\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n }\n\n return (\n <FlatNonPrimitivePropertyRenderer\n {...primitiveRendererProps}\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n valueElement={undefined}\n valueElementRenderer={undefined}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n isPropertyEditingEnabled?: boolean;\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n onClick?: (property: PropertyRecord, key?: string) => void;\n uniqueKey?: string;\n category?: PropertyCategory;\n editorSystem: \"legacy\" | \"new\";\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void | Promise<{ status: \"success\" | \"cancel\" }>;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props): React.ReactNode => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n const alwaysShowsEditor = props.alwaysShowEditor\n ? props.alwaysShowEditor(props.propertyRecord)\n : false;\n\n const { editorKey, onCancel } = useEditorKey({\n propertyRecord: props.propertyRecord,\n });\n\n if (\n props.isEditing ||\n (alwaysShowsEditor && props.isPropertyEditingEnabled)\n ) {\n const _onEditCommit = async (args: PropertyUpdatedArgs) => {\n if (!props.category) {\n return;\n }\n const result = await props.onEditCommit?.(args, props.category);\n if (result?.status === \"cancel\") {\n onCancel();\n }\n };\n\n return (\n <PropertyRecordEditor\n key={editorKey}\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={() => {\n props.onEditCancel?.();\n onCancel();\n }}\n onClick={() => props.onClick?.(props.propertyRecord, props.uniqueKey)}\n setFocus={props.isEditing}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={props.editorSystem}\n size=\"small\"\n />\n );\n }\n\n return CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n );\n};\n\n/**\n * Created key for editor component. Different key is produced to reset editor when:\n * - property value changes\n * - edit is cancelled (to reset editor internal state to initial value)\n */\nfunction useEditorKey({\n propertyRecord,\n}: Pick<DisplayValueProps, \"propertyRecord\">) {\n const [internalKey, setInternalKey] = React.useState(1);\n\n const onCancel = () => {\n setInternalKey((prev) => prev + 1);\n };\n\n const key = React.useMemo(() => {\n const serializedValue =\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ? JSON.stringify(propertyRecord.value.value)\n : \"\";\n return `${serializedValue}-${internalKey}`;\n }, [internalKey, propertyRecord]);\n\n return { editorKey: key, onCancel };\n}\n\nfunction useResetHeightOnEdit(\n orientation: Orientation,\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(orientation === Orientation.Vertical ? 48 : 28);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/components-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.32.1",
|
|
4
4
|
"description": "A react component library of iTwin.js UI data-oriented components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./lib/components-react.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@itwin/itwinui-react": "^3.15.0",
|
|
41
41
|
"react": "^18.0.0 || ^19.0.0",
|
|
42
42
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
43
|
-
"@itwin/core-react": "5.
|
|
43
|
+
"@itwin/core-react": "5.32.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@itwin/appui-abstract": "^5.8.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typescript": "~5.6.3",
|
|
75
75
|
"upath": "^2.0.1",
|
|
76
76
|
"vitest": "^3.2.4",
|
|
77
|
-
"@itwin/core-react": "5.
|
|
77
|
+
"@itwin/core-react": "5.32.1"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@itwin/itwinui-icons-react": "^2.11.0",
|