@itwin/components-react 5.0.0-dev.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -1
- package/lib/components-react/editors/EditorContainer.d.ts +2 -0
- package/lib/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/components-react/editors/EditorContainer.js +7 -3
- package/lib/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.js +3 -3
- package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +4 -0
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.js +12 -3
- package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +5 -3
- package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridCommons.d.ts +2 -0
- package/lib/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +2 -0
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js +3 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +3 -0
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +9 -5
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/package.json +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 16 Dec 2024 11:43:27 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.0.0
|
|
6
|
+
Mon, 16 Dec 2024 11:43:27 GMT
|
|
7
|
+
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- Add MergingPropertyDataProvider which combines multiple property data providers into a single one.
|
|
11
|
+
- Removed some references on @bentley/icons-generic
|
|
12
|
+
- Remove `@itwin/core-geometry` usage from `@itwin/components-react`
|
|
13
|
+
- Drop support for CommonJS modules.
|
|
14
|
+
- Drop support for iTwin.js 3.x.
|
|
15
|
+
- Drop support for React 17.x.
|
|
16
|
+
- Remove `@internal` API exports from the barrel file.
|
|
17
|
+
- Move @itwin/itwinui-react to peerDependencies.
|
|
18
|
+
- Added a callback to `VirtualizedPropertyGrid` which determines which editors should always be visible
|
|
19
|
+
- Update FilterBuilder UI according to UX team's new specs
|
|
20
|
+
- Provide file extension in import declarations.
|
|
21
|
+
- Add `exports` field to `package.json`.
|
|
22
|
+
- Replaced SCSS `@import` rules with `@use` rules.
|
|
23
|
+
- Replace buic variables with iTwinUI CSS variables.
|
|
24
|
+
|
|
25
|
+
## 4.17.6
|
|
26
|
+
Wed, 20 Nov 2024 14:27:46 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
29
|
+
|
|
30
|
+
## 4.17.5
|
|
31
|
+
Thu, 14 Nov 2024 08:22:04 GMT
|
|
32
|
+
|
|
33
|
+
_Version update only_
|
|
34
|
+
|
|
35
|
+
## 4.17.4
|
|
36
|
+
Fri, 08 Nov 2024 14:41:23 GMT
|
|
37
|
+
|
|
38
|
+
_Version update only_
|
|
39
|
+
|
|
40
|
+
## 4.17.3
|
|
41
|
+
Wed, 06 Nov 2024 09:04:20 GMT
|
|
42
|
+
|
|
43
|
+
_Version update only_
|
|
44
|
+
|
|
45
|
+
## 4.17.2
|
|
46
|
+
Wed, 30 Oct 2024 14:46:15 GMT
|
|
47
|
+
|
|
48
|
+
### Updates
|
|
49
|
+
|
|
50
|
+
- Fixed `pw:` links handling in property grid.
|
|
51
|
+
|
|
52
|
+
## 4.17.1
|
|
53
|
+
Wed, 09 Oct 2024 10:50:47 GMT
|
|
54
|
+
|
|
55
|
+
### Updates
|
|
56
|
+
|
|
57
|
+
- Update FilterBuilder UI according to UX team's new specs
|
|
4
58
|
|
|
5
59
|
## 4.17.0
|
|
6
60
|
Thu, 19 Sep 2024 12:50:53 GMT
|
|
@@ -49,6 +49,8 @@ export interface EditorContainerProps extends CommonProps {
|
|
|
49
49
|
onCancel: () => void;
|
|
50
50
|
/** Indicates whether the Property Editor should set focus */
|
|
51
51
|
setFocus?: boolean;
|
|
52
|
+
/** Handler for click */
|
|
53
|
+
onClick?: () => void;
|
|
52
54
|
/** @internal */
|
|
53
55
|
ignoreEditorBlur?: boolean;
|
|
54
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAA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AAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAwL1D"}
|
|
@@ -15,10 +15,14 @@ import { PropertyEditorManager } from "./PropertyEditorManager.js";
|
|
|
15
15
|
*/
|
|
16
16
|
// eslint-disable-next-line deprecation/deprecation
|
|
17
17
|
export function EditorContainer(props) {
|
|
18
|
-
const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, ...rest } = props;
|
|
18
|
+
const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, onClick, ...rest } = props;
|
|
19
19
|
const editorRef = React.useRef();
|
|
20
20
|
const propertyEditorRef = React.useRef();
|
|
21
|
-
const handleClick = (e) =>
|
|
21
|
+
const handleClick = (e) => {
|
|
22
|
+
onClick?.();
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
};
|
|
25
|
+
const handleContextMenu = (e) => e.stopPropagation();
|
|
22
26
|
const handleContainerBlur = (e) => e.stopPropagation();
|
|
23
27
|
const handleEditorCommit = (args) => void commit(args);
|
|
24
28
|
const handleContainerCommit = async () => {
|
|
@@ -134,7 +138,7 @@ export function EditorContainer(props) {
|
|
|
134
138
|
const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)
|
|
135
139
|
? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)
|
|
136
140
|
: undefined;
|
|
137
|
-
return (React.createElement("span", { className: "components-editor-container", onBlur: handleContainerBlur, onKeyDown: handleKeyDown, onClick: handleClick, onContextMenu:
|
|
141
|
+
return (React.createElement("span", { className: "components-editor-container", onBlur: handleContainerBlur, onKeyDown: handleKeyDown, onClick: handleClick, onContextMenu: handleContextMenu, title: title, "data-testid": "editor-container", role: "presentation" }, clonedNode));
|
|
138
142
|
}
|
|
139
143
|
function arePrimitiveValuesEqual(oldValue, newValue) {
|
|
140
144
|
if (typeof oldValue !== typeof newValue) {
|
|
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,KAAK,mBAAmB,CAAC,SAAS,EACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,iBAAiB,GAAG,QAA0B,CAAC;IACrD,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,CAAC,CAAC,iBAAiB,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;QAC5C,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager.js\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager.js\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA2EnE;;GAEG;AACH,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QA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OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager.js\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager.js\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /** Handler for click */\n onClick?: () => void;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n onClick,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => {\n onClick?.();\n e.stopPropagation();\n };\n const handleContextMenu = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumButtonGroupEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EAGd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE,gBAAgB;AAChB,UAAU,0BAA0B;IAClC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,qBACX,SAAQ,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,0BAA0B,CACvE,YAAW,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAiD;IACjE,OAAO,CAAC,WAAW,CAAqC;IAExD,SAAyB,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAIlE;IAEW,g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kB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IA0D/B,OAAO,CAAC,kBAAkB,CAoBxB;IAEF,OAAO,CAAC,SAAS;IA0CD,MAAM;CAkBvB;AAED;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kBAAkB;IACnE,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
|
|
@@ -11,7 +11,7 @@ import * as React from "react";
|
|
|
11
11
|
import { PropertyEditorParamTypes, PropertyValueFormat, } from "@itwin/appui-abstract";
|
|
12
12
|
import { Icon } from "@itwin/core-react";
|
|
13
13
|
import { PropertyEditorBase } from "./PropertyEditorManager.js";
|
|
14
|
-
import
|
|
14
|
+
import { SvgPlaceholder } from "@itwin/itwinui-icons-react";
|
|
15
15
|
/** EnumButtonGroupEditor React component that is a property editor with select input
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
@@ -95,7 +95,7 @@ export class EnumButtonGroupEditor extends React.Component {
|
|
|
95
95
|
}
|
|
96
96
|
const numChoices = choices.length;
|
|
97
97
|
const enumIcons = new Array(numChoices);
|
|
98
|
-
enumIcons.fill({ iconSpec:
|
|
98
|
+
enumIcons.fill({ iconSpec: "" });
|
|
99
99
|
if (propertyRecord.property.editor &&
|
|
100
100
|
propertyRecord.property.editor.params) {
|
|
101
101
|
if (propertyRecord.property.editor &&
|
|
@@ -125,7 +125,7 @@ export class EnumButtonGroupEditor extends React.Component {
|
|
|
125
125
|
}
|
|
126
126
|
const className = classnames("components-enumbuttongroup-button", isDisabled && "nz-is-disabled", isActive && "nz-is-active");
|
|
127
127
|
return (React.createElement("button", { ref: (ref) => ref && this._btnRefs.set(choiceValue, ref), "data-testid": choice.label, className: className, title: choice.label, key: choice.label, onClick: () => this._handleButtonClick(index) },
|
|
128
|
-
React.createElement(Icon, { iconSpec: this.state.enumIcons[index].iconSpec })));
|
|
128
|
+
React.createElement(Icon, { iconSpec: this.state.enumIcons[index].iconSpec === "" ? (React.createElement(SvgPlaceholder, null)) : (this.state.enumIcons[index].iconSpec) })));
|
|
129
129
|
}
|
|
130
130
|
render() {
|
|
131
131
|
return (React.createElement("div", { className: classnames("components-enumbuttongroup-editor", this.props.className), style: this.props.style, ref: this._divElement }, this.state.choices &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,cAAc,MAAM,8CAA8C,CAAC;AAW1E;;GAEG;AACH,MAAM,OAAO,qBACX,SAAQ,KAAK,CAAC,SAA0D;IAD1E;;QAIU,aAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;QACzD,gBAAW,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAE/B,UAAK,GAAyC;YACrE,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QAgGM,uBAAkB,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAgC,CAAC;YAEnE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;gBAEpD,IAAI,CA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------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ButtonGroupEditorParams,\n EnumerationChoice,\n IconDefinition,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport svgPlaceholder from \"@bentley/icons-generic/icons/placeholder.svg\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumButtonGroupEditor\n extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState>\n implements TypeEditor\n{\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n public override componentDidMount() {\n void this.setStateFromProps();\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n\n if (\n propertyRecord &&\n propertyRecord.property.enum &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n if (propertyRecord && propertyRecord.property.enum) {\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: svgPlaceholder });\n\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const bgParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf()\n ) as ButtonGroupEditorParams;\n if (bgParams) {\n bgParams.buttons.forEach(\n (iconDef: IconDefinition, index: number) => {\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n }\n );\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices\n ? this.state.choices[index].value\n : 0;\n const isActive = choiceValue === this.state.selectValue ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\"\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement | null) =>\n ref && this._btnRefs.set(choiceValue, ref)\n }\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={this.state.enumIcons[index].iconSpec} />\n </button>\n );\n }\n\n public override render() {\n return (\n <div\n className={classnames(\n \"components-enumbuttongroup-editor\",\n this.props.className\n )}\n style={this.props.style}\n ref={this._divElement}\n >\n {this.state.choices &&\n this.state.enumIcons.length &&\n this.state.choices.map((choice: EnumerationChoice, index: number) =>\n this.getButton(choice, index)\n )}\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @public\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EnumButtonGroupEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/EnumButtonGroupEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC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AK,CAAC;YAG7C,oBAAC,IAAI,IACH,QAAQ,EACN,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAC5C,oBAAC,cAAc,OAAG,CACnB,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,CACrC,GAEH,CACK,CACV,CAAC;IACJ,CAAC;IAEe,MAAM;QACpB,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CACnB,mCAAmC,EACnC,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,GAAG,EAAE,IAAI,CAAC,WAAW,IAEpB,IAAI,CAAC,KAAK,CAAC,OAAO;YACjB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM;YAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAyB,EAAE,KAAa,EAAE,EAAE,CAClE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAC9B,CACC,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,kBAAkB;IACnE,IAAW,SAAS;QAClB,OAAO,oBAAC,qBAAqB,OAAG,CAAC;IACnC,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/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EnumButtonGroupEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n ButtonGroupEditorParams,\n EnumerationChoice,\n IconDefinition,\n PropertyEditorParams,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport { SvgPlaceholder } from \"@itwin/itwinui-icons-react\";\n\n// cspell:ignore buttongroup enumbuttongroup\n\n/** @internal */\ninterface EnumButtonGroupEditorState {\n selectValue: string | number;\n enumIcons: IconDefinition[];\n choices: EnumerationChoice[];\n}\n\n/** EnumButtonGroupEditor React component that is a property editor with select input\n * @public\n */\nexport class EnumButtonGroupEditor\n extends React.Component<PropertyEditorProps, EnumButtonGroupEditorState>\n implements TypeEditor\n{\n private _btnRefs = new Map<string | number, HTMLButtonElement>();\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<EnumButtonGroupEditorState> = {\n selectValue: \"\",\n enumIcons: [],\n choices: [],\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.selectValue,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this._divElement.current)\n containsFocus = this._divElement.current.contains(document.activeElement);\n return containsFocus;\n }\n\n public override componentDidMount() {\n void this.setStateFromProps();\n }\n\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n\n if (\n propertyRecord &&\n propertyRecord.property.enum &&\n propertyRecord.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n const primitiveValue = propertyRecord.value.value;\n let selectValue: string | number;\n\n if (typeof primitiveValue === \"string\") {\n selectValue = primitiveValue;\n } else {\n selectValue = primitiveValue as number;\n }\n\n let choices: EnumerationChoice[] = [];\n if (propertyRecord && propertyRecord.property.enum) {\n if (propertyRecord.property.enum.choices instanceof Promise) {\n choices = await propertyRecord.property.enum.choices;\n } else {\n choices = propertyRecord.property.enum.choices;\n }\n }\n\n const numChoices = choices.length;\n const enumIcons = new Array<IconDefinition>(numChoices);\n enumIcons.fill({ iconSpec: \"\" });\n\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n if (\n propertyRecord.property.editor &&\n propertyRecord.property.editor.params\n ) {\n const bgParams = propertyRecord.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf()\n ) as ButtonGroupEditorParams;\n if (bgParams) {\n bgParams.buttons.forEach(\n (iconDef: IconDefinition, index: number) => {\n if (index < numChoices) {\n enumIcons[index] = iconDef;\n }\n }\n );\n }\n }\n }\n\n this.setState({ selectValue, enumIcons, choices });\n }\n }\n\n private _handleButtonClick = (index: number) => {\n const propertyRecord = this.props.propertyRecord as PropertyRecord;\n\n if (this.state.choices && this.state.choices.length > index) {\n const selectValue = this.state.choices[index].value;\n\n this.setState(\n {\n selectValue,\n },\n async () => {\n if (propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord, newValue: propertyValue });\n }\n }\n }\n );\n }\n };\n\n private getButton(choice: EnumerationChoice, index: number) {\n const choiceValue = this.state.choices\n ? this.state.choices[index].value\n : 0;\n const isActive = choiceValue === this.state.selectValue ? true : false;\n let isDisabled = false;\n const isEnabledFunction = this.state.enumIcons[index].isEnabledFunction;\n if (isEnabledFunction) {\n isDisabled = !isEnabledFunction();\n }\n\n const className = classnames(\n \"components-enumbuttongroup-button\",\n isDisabled && \"nz-is-disabled\",\n isActive && \"nz-is-active\"\n );\n\n return (\n <button\n ref={(ref: HTMLButtonElement | null) =>\n ref && this._btnRefs.set(choiceValue, ref)\n }\n data-testid={choice.label}\n className={className}\n title={choice.label}\n key={choice.label}\n onClick={() => this._handleButtonClick(index)}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon\n iconSpec={\n this.state.enumIcons[index].iconSpec === \"\" ? (\n <SvgPlaceholder />\n ) : (\n this.state.enumIcons[index].iconSpec\n )\n }\n />\n </button>\n );\n }\n\n public override render() {\n return (\n <div\n className={classnames(\n \"components-enumbuttongroup-editor\",\n this.props.className\n )}\n style={this.props.style}\n ref={this._divElement}\n >\n {this.state.choices &&\n this.state.enumIcons.length &&\n this.state.choices.map((choice: EnumerationChoice, index: number) =>\n this.getButton(choice, index)\n )}\n </div>\n );\n }\n}\n\n/** Enum Property Button Group Editor registered for the \"enum\" type name and the \"enum-buttongroup\" editor name.\n * It uses the [[EnumButtonGroupEditor]] React component.\n * @public\n */\nexport class EnumPropertyButtonGroupEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <EnumButtonGroupEditor />;\n }\n}\n"]}
|
|
@@ -43,6 +43,8 @@ export interface SharedRendererProps {
|
|
|
43
43
|
actionButtonRenderers?: ActionButtonRenderer[];
|
|
44
44
|
/** Is resize handle hovered */
|
|
45
45
|
isResizeHandleHovered?: boolean;
|
|
46
|
+
/** Enables/disables property editing */
|
|
47
|
+
isPropertyEditingEnabled?: boolean;
|
|
46
48
|
/** Callback to hover event change */
|
|
47
49
|
onResizeHandleHoverChanged?: (isHovered: boolean) => void;
|
|
48
50
|
/** Is resize handle being dragged */
|
|
@@ -51,6 +53,8 @@ export interface SharedRendererProps {
|
|
|
51
53
|
onResizeHandleDragChanged?: (isDragStarted: boolean) => void;
|
|
52
54
|
/** Information for styling property grid columns */
|
|
53
55
|
columnInfo?: PropertyGridColumnInfo;
|
|
56
|
+
/** Callback to determine which editors should be always visible */
|
|
57
|
+
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
54
58
|
}
|
|
55
59
|
/** Properties of [[PropertyRenderer]] React component
|
|
56
60
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.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,4CAA4C,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,qHAAqH;IACrH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,mDAAmD;IACnD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxE,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG;QAC/C,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC/C,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,oCAAoC;IACpC,yBAAyB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,oDAAoD;IACpD,UAAU,CAAC,EAAE,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.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,4CAA4C,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KA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AAC,EAAE,OAAO,CAAC;IACrC,oCAAoC;IACpC,yBAAyB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,oDAAoD;IACpD,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,OAAO,CAAC;CAC1D;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,4BAA4B;IAC5B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mCAAmC;IACnC,SAAS,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;YAAW,qBAAqB;iCAwG7C,MAAM,gBACN,WAAW,UACjB,MAAM,gBACA,MAAM,wBACE,MAAM;CAP7B,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { useTranslation } from "../../l10n/useTranslation.js";
|
|
|
18
18
|
export const PropertyRenderer = (props) => {
|
|
19
19
|
const { translate } = useTranslation();
|
|
20
20
|
const [displayValue, setDisplayValue] = React.useState(() => translate("general.loading"));
|
|
21
|
-
const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, ...restProps } = props;
|
|
21
|
+
const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, alwaysShowEditor, isPropertyEditingEnabled, onClick, uniqueKey, ...restProps } = props;
|
|
22
22
|
const onCommit = React.useCallback((args) => {
|
|
23
23
|
if (onEditCommit)
|
|
24
24
|
onEditCommit(args);
|
|
@@ -27,9 +27,12 @@ export const PropertyRenderer = (props) => {
|
|
|
27
27
|
if (onEditCancel)
|
|
28
28
|
onEditCancel();
|
|
29
29
|
}, [onEditCancel]);
|
|
30
|
+
const alwaysShowsEditor = props.alwaysShowEditor
|
|
31
|
+
? props.alwaysShowEditor(props.propertyRecord)
|
|
32
|
+
: false;
|
|
30
33
|
React.useEffect(() => {
|
|
31
|
-
if (isEditing) {
|
|
32
|
-
setDisplayValue(React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, setFocus:
|
|
34
|
+
if (isEditing || (alwaysShowsEditor && isPropertyEditingEnabled)) {
|
|
35
|
+
setDisplayValue(React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, setFocus: isEditing, onClick: () => onClick?.(propertyRecord, uniqueKey) }));
|
|
33
36
|
return;
|
|
34
37
|
}
|
|
35
38
|
setDisplayValue(CommonPropertyRenderer.createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager));
|
|
@@ -41,9 +44,15 @@ export const PropertyRenderer = (props) => {
|
|
|
41
44
|
onCommit,
|
|
42
45
|
onCancel,
|
|
43
46
|
isEditing,
|
|
47
|
+
alwaysShowsEditor,
|
|
48
|
+
isPropertyEditingEnabled,
|
|
49
|
+
onClick,
|
|
50
|
+
uniqueKey,
|
|
44
51
|
]);
|
|
45
52
|
const primitiveRendererProps = {
|
|
46
53
|
...restProps,
|
|
54
|
+
onClick,
|
|
55
|
+
uniqueKey,
|
|
47
56
|
propertyRecord,
|
|
48
57
|
orientation,
|
|
49
58
|
indentation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,E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,IAAI,GACd,CACH,CAAC;YACF,OAAO;QACT,CAAC;QAED,eAAe,CACb,sBAAsB,CAAC,qBAAqB,CAC1C,WAAW,EACX,cAAc,EACd,WAAW,EACX,4BAA4B,CAC7B,CACF,CAAC;IACJ,CAAC,EAAE;QACD,WAAW;QACX,cAAc;QACd,WAAW;QACX,4BAA4B;QAC5B,QAAQ;QACR,QAAQ;QACR,SAAS;KACV,CAAC,CAAC;IAEH,MAAM,sBAAsB,GAA2B;QACrD,GAAG,SAAS;QACZ,cAAc;QACd,WAAW;QACX,WAAW;QACX,YAAY,EAAE,YAAY;KAC3B,CAAC;IAEF,QAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC/C,KAAK,mBAAmB,CAAC,SAAS;YAChC,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;QACnE,KAAK,mBAAmB,CAAC,KAAK;YAC5B,uDAAuD;YACvD,IACE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK;gBACpE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBAE7C,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;QACrE,0CAA0C;QAC1C,KAAK,mBAAmB,CAAC,MAAM;YAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;IACN,CAAC;AACH,CAAC,CAAC;AAEF,gBAAgB,CAAC,cAAc,GAAG,CAChC,WAAoB,EACpB,WAAyB,EACzB,KAAc,EACd,WAAoB,EACpB,mBAA4B,EAC5B,EAAE;IACF,OAAO,sBAAsB,CAAC,cAAc,CAC1C,WAAW,EACX,WAAW,EACX,KAAK,EACL,WAAW,EACX,mBAAmB,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Properties\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 { EditorContainer } from \"../../editors/EditorContainer.js\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager.js\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer.js\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer.js\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer.js\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer.js\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer.js\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns.js\";\nimport type { Orientation } from \"../../common/Orientation.js\";\nimport { useTranslation } from \"../../l10n/useTranslation.js\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\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 /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport const PropertyRenderer = (props: PropertyRendererProps) => {\n const { translate } = useTranslation();\n const [displayValue, setDisplayValue] = React.useState<React.ReactNode>(() =>\n translate(\"general.loading\")\n );\n\n const {\n isEditing,\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onEditCommit,\n onEditCancel,\n ...restProps\n } = props;\n\n const onCommit = React.useCallback(\n (args: PropertyUpdatedArgs) => {\n if (onEditCommit) onEditCommit(args);\n },\n [onEditCommit]\n );\n\n const onCancel = React.useCallback(() => {\n if (onEditCancel) onEditCancel();\n }, [onEditCancel]);\n\n React.useEffect(() => {\n if (isEditing) {\n setDisplayValue(\n <EditorContainer\n propertyRecord={propertyRecord}\n onCommit={onCommit}\n onCancel={onCancel}\n setFocus={true}\n />\n );\n return;\n }\n\n setDisplayValue(\n CommonPropertyRenderer.createNewDisplayValue(\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager\n )\n );\n }, [\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onCommit,\n onCancel,\n isEditing,\n ]);\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...restProps,\n propertyRecord,\n orientation,\n indentation,\n valueElement: displayValue,\n };\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n props.propertyRecord.value.valueFormat === PropertyValueFormat.Array &&\n props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n};\n\nPropertyRenderer.getLabelOffset = (\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n) => {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.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,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAA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,WAAW,EACX,mBAAmB,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Properties\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 { EditorContainer } from \"../../editors/EditorContainer.js\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager.js\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer.js\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer.js\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer.js\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer.js\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer.js\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns.js\";\nimport type { Orientation } from \"../../common/Orientation.js\";\nimport { useTranslation } from \"../../l10n/useTranslation.js\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Enables/disables property editing */\n isPropertyEditingEnabled?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n /** Callback to determine which editors should be always visible */\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\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 /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport const PropertyRenderer = (props: PropertyRendererProps) => {\n const { translate } = useTranslation();\n const [displayValue, setDisplayValue] = React.useState<React.ReactNode>(() =>\n translate(\"general.loading\")\n );\n\n const {\n isEditing,\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onEditCommit,\n onEditCancel,\n alwaysShowEditor,\n isPropertyEditingEnabled,\n onClick,\n uniqueKey,\n ...restProps\n } = props;\n\n const onCommit = React.useCallback(\n (args: PropertyUpdatedArgs) => {\n if (onEditCommit) onEditCommit(args);\n },\n [onEditCommit]\n );\n\n const onCancel = React.useCallback(() => {\n if (onEditCancel) onEditCancel();\n }, [onEditCancel]);\n\n const alwaysShowsEditor = props.alwaysShowEditor\n ? props.alwaysShowEditor(props.propertyRecord)\n : false;\n\n React.useEffect(() => {\n if (isEditing || (alwaysShowsEditor && isPropertyEditingEnabled)) {\n setDisplayValue(\n <EditorContainer\n propertyRecord={propertyRecord}\n onCommit={onCommit}\n onCancel={onCancel}\n setFocus={isEditing}\n onClick={() => onClick?.(propertyRecord, uniqueKey)}\n />\n );\n return;\n }\n\n setDisplayValue(\n CommonPropertyRenderer.createNewDisplayValue(\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager\n )\n );\n }, [\n orientation,\n propertyRecord,\n indentation,\n propertyValueRendererManager,\n onCommit,\n onCancel,\n isEditing,\n alwaysShowsEditor,\n isPropertyEditingEnabled,\n onClick,\n uniqueKey,\n ]);\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...restProps,\n onClick,\n uniqueKey,\n propertyRecord,\n orientation,\n indentation,\n valueElement: displayValue,\n };\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n props.propertyRecord.value.valueFormat === PropertyValueFormat.Array &&\n props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n};\n\nPropertyRenderer.getLabelOffset = (\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n) => {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n};\n"]}
|
package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnResizingPropertyListPropsSupplier.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ColumnResizingPropertyListPropsSupplier.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAM1D,gBAAgB;AAChB,MAAM,MAAM,oCAAoC,GAAG,QAAQ,CACzD,IAAI,CACF,iBAAiB,EACf,iBAAiB,GACjB,aAAa,GACb,uBAAuB,GACvB,4BAA4B,GAC5B,4BAA4B,GAC5B,2BAA2B,GAC3B,YAAY,GACZ,aAAa,GACb,OAAO,CACV,CACF,CAAC;AAEF,gBAAgB;AAChB,MAAM,WAAW,4CAA4C;IAC3D,oCAAoC;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4GAA4G;IAC5G,QAAQ,EAAE,CAAC,KAAK,EAAE,oCAAoC,KAAK,KAAK,CAAC,SAAS,CAAC;CAC5E;AAED,gBAAgB;AAChB,MAAM,WAAW,4CAA4C;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,uCAAwC,SAAQ,KAAK,CAAC,SAAS,CAC1E,4CAA4C,EAC5C,4CAA4C,CAC7C;IACC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAO;IACxC,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,SAAS,CAAyB;IAE1B,KAAK,EAAE,4CAA4C,CAIjE;IAEF,OAAc,YAAY,EAAE,OAAO,CAAC,4CAA4C,CAAC,CAI7E;IAEJ,OAAO,CAAC,qBAAqB,CAM3B;IAEF,OAAO,CAAC,2BAA2B,CAEjC;IAEF,OAAO,CAAC,0BAA0B,CAEhC;IAEF,OAAO,CAAC,0BAA0B;IA6ClC,OAAO,CAAC,mBAAmB;IAIX,MAAM;CAmBvB"}
|
package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { Geometry } from "@itwin/core-geometry";
|
|
7
6
|
import { Orientation } from "../../common/Orientation.js";
|
|
8
7
|
const BORDER_WIDTH = 10;
|
|
9
8
|
const PROPERTY_PADDING = 16;
|
|
@@ -26,7 +25,7 @@ export class ColumnResizingPropertyListPropsSupplier extends React.Component {
|
|
|
26
25
|
isResizeHandleBeingDragged: false,
|
|
27
26
|
};
|
|
28
27
|
this._onColumnRatioChanged = (ratio) => {
|
|
29
|
-
ratio =
|
|
28
|
+
ratio = clamp(ratio, this._minRatio, this._maxRatio);
|
|
30
29
|
if (this.state.columnRatio === ratio)
|
|
31
30
|
return { ratio };
|
|
32
31
|
this.setState({ columnRatio: ratio });
|
|
@@ -81,7 +80,7 @@ export class ColumnResizingPropertyListPropsSupplier extends React.Component {
|
|
|
81
80
|
return true;
|
|
82
81
|
}
|
|
83
82
|
getValidColumnRatio() {
|
|
84
|
-
return
|
|
83
|
+
return clamp(this.state.columnRatio, this._minRatio, this._maxRatio);
|
|
85
84
|
}
|
|
86
85
|
render() {
|
|
87
86
|
const listProps = {
|
|
@@ -107,4 +106,7 @@ ColumnResizingPropertyListPropsSupplier.defaultProps = {
|
|
|
107
106
|
minLabelWidth: 100,
|
|
108
107
|
minValueWidth: 100,
|
|
109
108
|
};
|
|
109
|
+
function clamp(value, min, max) {
|
|
110
|
+
return Math.max(min, Math.min(max, value));
|
|
111
|
+
}
|
|
110
112
|
//# sourceMappingURL=ColumnResizingPropertyListPropsSupplier.js.map
|
package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnResizingPropertyListPropsSupplier.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ColumnResizingPropertyListPropsSupplier.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,eAAe,GAAG,EAAE,CAAC;AA2C3B;;;GAGG;AACH,MAAM,OAAO,uCAAwC,SAAQ,KAAK,CAAC,SAGlE;IAHD;;QAImB,kBAAa,GA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E,CAAC;IAEe,MAAM;QACpB,MAAM,SAAS,GAAyC;YACtD,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;YACnC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YACvB,eAAe,EAAE,IAAI,CAAC,qBAAqB;YAC3C,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE;YACvC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB;YACvD,0BAA0B,EAAE,IAAI,CAAC,2BAA2B;YAC5D,0BAA0B,EAAE,IAAI,CAAC,KAAK,CAAC,0BAA0B;YACjE,yBAAyB,EAAE,IAAI,CAAC,0BAA0B;YAC1D,UAAU,EAAE;gBACV,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAc;gBACxC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAc;gBACxC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAkB;gBAChD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B,EAAE;aAC9D;SACF,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;;AAzFa,oDAAY,GACxB;IACE,aAAa,EAAE,GAAG;IAClB,aAAa,EAAE,GAAG;CACnB,AAJuB,CAItB;AAwFN,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { PropertyListProps } from \"./PropertyList.js\";\nimport { Orientation } from \"../../common/Orientation.js\";\n\nconst BORDER_WIDTH = 10;\nconst PROPERTY_PADDING = 16;\nconst VALUE_MIN_WIDTH = 10;\n\n/** @internal */\nexport type ColumnResizeRelatedPropertyListProps = Required<\n Pick<\n PropertyListProps,\n | \"onColumnChanged\"\n | \"columnRatio\"\n | \"isResizeHandleHovered\"\n | \"onResizeHandleHoverChanged\"\n | \"isResizeHandleBeingDragged\"\n | \"onResizeHandleDragChanged\"\n | \"columnInfo\"\n | \"orientation\"\n | \"width\"\n >\n>;\n\n/** @internal */\nexport interface ColumnResizingPropertyListPropsSupplierProps {\n /** Orientation of the properties */\n orientation: Orientation;\n /** Width of the property list */\n width: number;\n /** Minimum allowed label column width, after which resizing stops */\n minLabelWidth?: number;\n /** Minimum allowed value column width, after which resizing stops */\n minValueWidth?: number;\n /** Fixed action button column width */\n actionButtonWidth?: number;\n /** Maximum depth of the properties shown */\n maxPropertyDepth?: number;\n /** A callback that receives the required column-resize-related props for the [[PropertyList]] component */\n children: (props: ColumnResizeRelatedPropertyListProps) => React.ReactNode;\n}\n\n/** @internal */\nexport interface ColumnResizingPropertyListPropsSupplierState {\n columnRatio: number;\n isResizeHandleHovered: boolean;\n isResizeHandleBeingDragged: boolean;\n}\n\n/**\n * Wrapped PropertyCategoryBlock React component with list of properties and render optimization\n * @internal\n */\nexport class ColumnResizingPropertyListPropsSupplier extends React.Component<\n ColumnResizingPropertyListPropsSupplierProps,\n ColumnResizingPropertyListPropsSupplierState\n> {\n private readonly _initialRatio = 0.25;\n private readonly _defaultMinRatio = 0.15;\n private readonly _defaultMaxRatio = 0.6;\n private _minRatio = this._defaultMinRatio;\n private _maxRatio = this._defaultMaxRatio;\n\n public override state: ColumnResizingPropertyListPropsSupplierState = {\n columnRatio: this._initialRatio,\n isResizeHandleHovered: false,\n isResizeHandleBeingDragged: false,\n };\n\n public static defaultProps: Partial<ColumnResizingPropertyListPropsSupplierProps> =\n {\n minLabelWidth: 100,\n minValueWidth: 100,\n };\n\n private _onColumnRatioChanged = (ratio: number) => {\n ratio = clamp(ratio, this._minRatio, this._maxRatio);\n if (this.state.columnRatio === ratio) return { ratio };\n\n this.setState({ columnRatio: ratio });\n return { ratio };\n };\n\n private _onResizeHandleHoverChanged = (isHovered: boolean) => {\n this.setState({ isResizeHandleHovered: isHovered });\n };\n\n private _onResizeHandleDragChanged = (isDragStarted: boolean) => {\n this.setState({ isResizeHandleBeingDragged: isDragStarted });\n };\n\n private isMinimumColumnSizeEnabled() {\n if (this.props.orientation !== Orientation.Horizontal) return false;\n\n // calculated how much width all the borders of nested properties takes up.\n const bordersWidth = this.props.maxPropertyDepth\n ? this.props.maxPropertyDepth * BORDER_WIDTH\n : 0;\n const actionButtonWidth = this.props.actionButtonWidth ?? 0;\n\n // minimum with required to render property. This consists of:\n // * minimum label width\n // * 1px resizer\n // * minimum value width\n // * actions buttons width\n // * all nested borders width\n // * padding\n const propertyWidth =\n this.props.minLabelWidth! +\n 1 +\n this.props.minValueWidth! +\n actionButtonWidth +\n bordersWidth +\n PROPERTY_PADDING;\n // default behavior for screens that are too small to have minimum column widths\n if (this.props.width < propertyWidth) {\n this._minRatio = this._defaultMinRatio;\n // if there are action buttons calculate maximum ratio for label. Otherwise use default.\n this._maxRatio = this.props.actionButtonWidth\n ? (this.props.width -\n this.props.actionButtonWidth -\n bordersWidth -\n PROPERTY_PADDING -\n VALUE_MIN_WIDTH) /\n this.props.width\n : this._defaultMaxRatio;\n return false;\n }\n\n this._minRatio = this.props.minLabelWidth! / this.props.width;\n this._maxRatio =\n (this.props.width - actionButtonWidth - this.props.minValueWidth!) /\n this.props.width;\n return true;\n }\n\n private getValidColumnRatio(): number {\n return clamp(this.state.columnRatio, this._minRatio, this._maxRatio);\n }\n\n public override render() {\n const listProps: ColumnResizeRelatedPropertyListProps = {\n orientation: this.props.orientation,\n width: this.props.width,\n onColumnChanged: this._onColumnRatioChanged,\n columnRatio: this.getValidColumnRatio(),\n isResizeHandleHovered: this.state.isResizeHandleHovered,\n onResizeHandleHoverChanged: this._onResizeHandleHoverChanged,\n isResizeHandleBeingDragged: this.state.isResizeHandleBeingDragged,\n onResizeHandleDragChanged: this._onResizeHandleDragChanged,\n columnInfo: {\n minLabelWidth: this.props.minLabelWidth!,\n minValueWidth: this.props.minValueWidth!,\n actionButtonWidth: this.props.actionButtonWidth!,\n isMinimumColumnSizeEnabled: this.isMinimumColumnSizeEnabled(),\n },\n };\n return this.props.children(listProps);\n }\n}\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.max(min, Math.min(max, value));\n}\n"]}
|
|
@@ -68,6 +68,8 @@ export interface CommonPropertyGridProps extends CommonProps {
|
|
|
68
68
|
* to render an action button for the property or not.
|
|
69
69
|
*/
|
|
70
70
|
actionButtonRenderers?: ActionButtonRenderer[];
|
|
71
|
+
/** Callback to determine which editors should be always visible */
|
|
72
|
+
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* Properties for highlighting text in property grid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridCommons.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CA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EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyGridCommons.d.ts","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,mCAAmC;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,sDAAsD;IACtD,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;CACzB;AAED;;;GAGG;AAEH,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,iGAAiG;IACjG,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,g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,qBAAa,mBAAmB;WAChB,qBAAqB,CACjC,KAAK,EAAE,MAAM,EACb,oBAAoB,CAAC,EAAE,WAAW,EAClC,kBAAkB,CAAC,EAAE,OAAO,EAC5B,6BAA6B,CAAC,EAAE,MAAM,GACrC,WAAW;IAWd;;;OAGG;WACW,eAAe,CAAC,IAAI,EAAE,MAAM;IAW1C;;;OAGG;IACH,OAAc,QAAQ,UACb,MAAM,KACZ,MAAM;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAMtC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridCommons.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyGridCommons.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AA8F1D,gBAAgB;AAChB,MAAM,OAAO,mBAAmB;IACvB,MAAM,CAAC,qBAAqB,CACjC,KAAa,EACb,oBAAkC,EAClC,kBAA4B,EAC5B,6BAAsC;QAEtC,MAAM,WAAW,GAAG,oBAAoB,IAAI,WAAW,CAAC,UAAU,CAAC;QACnE,IAAI,kBAAkB;YAAE,OAAO,WAAW,CAAC;QAE3C,6BAA6B,GAAG,6BAA6B,IAAI,GAAG,CAAC;QACrE,wCAAwC;QACxC,IAAI,KAAK,GAAG,6BAA6B;YAAE,OAAO,WAAW,CAAC,QAAQ,CAAC;QAEvE,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO;QACnC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;;AAED;;;GAGG;AACW,4BAAQ,GAAG,CACvB,KAAa,EAC0B,EAAE;IACzC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAC1B,CAAC,QAA8C,EAAE,EAAE;QACjD,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps.js\";\nimport { matchLinks, openLink } from \"../../common/Links.js\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer.js\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer.js\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager.js\";\nimport type { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase.js\";\nimport type { PropertyCategory } from \"../PropertyDataProvider.js\";\nimport { Orientation } from \"../../common/Orientation.js\";\n\n/** Arguments for the Property Editing event callback\n * @public\n */\nexport interface PropertyEditingArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** Unique key of currently edited property */\n propertyKey?: string;\n}\n\n/** Arguments for `PropertyGridProps.onPropertyContextMenu` callback\n * @public\n */\nexport interface PropertyGridContextMenuArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** An event which caused the context menu callback */\n event: React.MouseEvent;\n}\n\n/**\n * Common Property Grid Props to be used by Property Grid Variants\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface CommonPropertyGridProps extends CommonProps {\n /** Grid orientation. When not defined, it is chosen automatically based on width of the grid. */\n orientation?: Orientation;\n\n /** Enables/disables property hovering effect */\n isPropertyHoverEnabled?: boolean;\n\n /** Called to show a context menu when properties are right-clicked */\n onPropertyContextMenu?: (args: PropertyGridContextMenuArgs) => void;\n\n /** Enables/disables property selection */\n isPropertySelectionEnabled?: boolean;\n /** Enables/disables property selection with right click */\n isPropertySelectionOnRightClickEnabled?: boolean;\n /** Callback to property selection */\n onPropertySelectionChanged?: (property: PropertyRecord) => void;\n\n /** Enables/disables property editing */\n isPropertyEditingEnabled?: boolean;\n /** Callback for when properties are being edited */\n onPropertyEditing?: (\n args: PropertyEditingArgs,\n category: PropertyCategory\n ) => void;\n /** Callback for when properties are updated */\n onPropertyUpdated?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => Promise<boolean>;\n\n /** Custom property value renderer manager */\n propertyValueRendererManager?: PropertyValueRendererManager;\n\n /** Indicates whether the orientation is fixed and does not auto-switch to Vertical when the width is too narrow. Defaults to false. */\n isOrientationFixed?: boolean;\n /** The minimum width before the auto-switch to Vertical when the width is too narrow. Defaults to 300. */\n horizontalOrientationMinWidth?: number;\n\n /** Minimum allowed label column width, after which resizing stops */\n minLabelWidth?: number;\n /** Minimum allowed value column width, after which resizing stops */\n minValueWidth?: number;\n /** Fixed action button column width */\n actionButtonWidth?: number;\n\n /**\n * Array of action button renderers. Each renderer is called for each property and can decide\n * to render an action button for the property or not.\n */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Callback to determine which editors should be always visible */\n alwaysShowEditor?: (property: PropertyRecord) => boolean;\n}\n\n/**\n * Properties for highlighting text in property grid.\n * @public\n */\nexport interface PropertyGridContentHighlightProps\n extends HighlightingComponentProps {\n /**\n * Specifies what the highlighting should be applied on - category labels, property labels and / or property values.\n * Defaults to \"nowhere\".\n */\n filteredTypes?: FilteredType[];\n}\n\n/** @internal */\nexport class PropertyGridCommons {\n public static getCurrentOrientation(\n width: number,\n preferredOrientation?: Orientation,\n isOrientationFixed?: boolean,\n horizontalOrientationMinWidth?: number\n ): Orientation {\n const orientation = preferredOrientation ?? Orientation.Horizontal;\n if (isOrientationFixed) return orientation;\n\n horizontalOrientationMinWidth = horizontalOrientationMinWidth ?? 300;\n // Switch to Vertical if width too small\n if (width < horizontalOrientationMinWidth) return Orientation.Vertical;\n\n return orientation;\n }\n\n /**\n * Helper method to handle link clicks\n * @internal\n */\n public static handleLinkClick(text: string) {\n const linksArray = matchLinks(text);\n if (linksArray.length <= 0) return;\n const foundLink = linksArray[0];\n if (!foundLink || !foundLink.url) {\n return;\n }\n\n openLink(foundLink.url);\n }\n\n /**\n * A helper method to get links from string.\n * @internal\n */\n public static getLinks = (\n value: string\n ): Array<{ start: number; end: number }> => {\n return matchLinks(value).map(\n (linkInfo: { index: number; lastIndex: number }) => {\n return { start: linkInfo.index, end: linkInfo.lastIndex };\n }\n );\n };\n}\n"]}
|
package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type PropertyGridEventsRelatedProps = Pick<PropertyListProps, "onProperty
|
|
|
10
10
|
/** Properties for [[PropertyGridEventsRelatedPropsSupplier]] React component
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
export type PropertyGridEventsRelatedPropsSupplierProps = Pick<CommonPropertyGridProps, "onPropertyContextMenu" | "isPropertySelectionOnRightClickEnabled" | "
|
|
13
|
+
export type PropertyGridEventsRelatedPropsSupplierProps = Pick<CommonPropertyGridProps, "onPropertyContextMenu" | "isPropertySelectionOnRightClickEnabled" | "onPropertySelectionChanged" | "isPropertyEditingEnabled" | "onPropertyUpdated"> & Required<Pick<CommonPropertyGridProps, "isPropertyHoverEnabled" | "isPropertySelectionEnabled">> & {
|
|
14
14
|
children: (context: PropertyGridEventsRelatedProps) => React.ReactNode;
|
|
15
15
|
};
|
|
16
16
|
/** State of [[PropertyGridEventsRelatedPropsSupplier]] React component
|
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;AAI/B,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,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,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,2CAA2C,GAAG,IAAI,CAC5D,uBAAuB,EACrB,uBAAuB,GACvB,wCAAwC,GACxC,
|
|
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;AAI/B,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,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,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;CAC7B;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,CAQnB;IAEF,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,6BAA6B;IAgBrC,OAAO,CAAC,4BAA4B;IA8BpB,MAAM;CA0BvB"}
|
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;AA4D/B;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,KAAK,CAAC,SAGjE;IACC,YAAY,KAAkD;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;QAeP,4BAAuB,GAAG,CAChC,QAAwB,EACxB,GAAY,EACZ,EAAE;YACF,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC/B,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC,CAAC;QAEM,uBAAkB,GAAG,CAAC,QAAwB,EAAE,GAAY,EAAE,EAAE;YACtE,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAC1B,IAAI,CAAC,4BAA4B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACrD,CAAC,CAAC;QAEM,2BAAsB,GAAG,CAC/B,QAAwB,EACxB,CAAmB,EACnB,EAAE;YACF,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC;gBACrC,IAAI,CAAC,KA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D,mBAAmB,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB;YACnD,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACjD,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE;gBACzC,CAAC,CAAC,IAAI,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 | \"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 | \"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;AA2D/B;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,KAAK,CAAC,SAGjE;IACC,YAAY,KAAkD;QAC5D,KAAK,CAAC,KAAK,CAAC,CAAC;QAeP,4BAAuB,GAAG,CAChC,QAAwB,EACxB,GAAY,EACZ,EAAE;YACF,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC/B,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC,CAAC;QAEM,uBAAkB,GAAG,CAAC,QAAwB,EAAE,GAAY,EAAE,EAAE;YACtE,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBAC1B,IAAI,CAAC,4BAA4B,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACrD,CAAC,CAAC;QAEM,2BAAsB,GAAG,CAC/B,QAAwB,EACxB,CAAmB,EACnB,EAAE;YACF,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC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B,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB;YACnD,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACjD,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE;gBACzC,CAAC,CAAC,IAAI,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 | \"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"]}
|
|
@@ -68,6 +68,8 @@ export interface VirtualizedPropertyGridContext {
|
|
|
68
68
|
isPropertyHoverEnabled: boolean;
|
|
69
69
|
isPropertySelectionEnabled: boolean;
|
|
70
70
|
selectedPropertyKey?: string;
|
|
71
|
+
isPropertyEditingEnabled?: boolean;
|
|
72
|
+
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
71
73
|
onPropertyClicked?: (property: PropertyRecord, key?: string) => void;
|
|
72
74
|
onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;
|
|
73
75
|
onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;
|
|
@@ -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,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAA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AAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,8BAA8B,CAAC;IAC5C,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3E;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAElB,sBAAsB,EAAE,OAAO,CAAC;IAChC,0BAA0B,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,MAAM,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,uBA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S,CAAC,EAAE,iCAAiC,CAAC;CAC/C;AAeD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK,CAAC,SAAS,CAC1D,4BAA4B,EAC5B,4BAA4B,CAC7B;IACC,OAAO,CAAC,QAAQ,CAAuC;gBAE3C,KAAK,EAAE,4BAA4B;IAgB/B,kBAAkB,CAAC,SAAS,EAAE,4BAA4B;IAyC1E,gBAAgB;WACF,wBAAwB,CACpC,KAAK,EAAE,4BAA4B,EACnC,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI;IAOtC,OAAO,CAAC,iBAAiB;IAgBzB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,uBAAuB,CAqB7B;IAEF,OAAO,CAAC,2BAA2B,CAGjC;IAEF,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,WAAW,CAGjB;IAEF,OAAO,CAAC,gBAAgB,CAQtB;IAEc,MAAM;CA6GvB;AAsCD;;;;GAIG;AACH,wBAAgB,uCAAuC,CAAC,CAAC,SAAS,OAAO;;;;EAExE"}
|
|
@@ -165,6 +165,8 @@ export class VirtualizedPropertyGrid extends React.Component {
|
|
|
165
165
|
isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,
|
|
166
166
|
isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,
|
|
167
167
|
selectedPropertyKey: selectionContext.selectedPropertyKey,
|
|
168
|
+
isPropertyEditingEnabled: this.props.isPropertyEditingEnabled,
|
|
169
|
+
alwaysShowEditor: this.props.alwaysShowEditor,
|
|
168
170
|
onPropertyClicked: selectionContext.onPropertyClicked,
|
|
169
171
|
onPropertyRightClicked: selectionContext.onPropertyRightClicked,
|
|
170
172
|
onPropertyContextMenu: selectionContext.onPropertyContextMenu,
|
|
@@ -260,7 +262,7 @@ const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) =>
|
|
|
260
262
|
const selectionKey = node.selectionKey;
|
|
261
263
|
const parentCategoryItem = gridModel.getItem(node.parentCategorySelectionKey);
|
|
262
264
|
return (React.createElement(FlatItemNestedBorderWrapper, { borderCount: parentCategoryItem.depth + 1, bottomBorderCount: lastInNumberOfCategories, className: "virtualized-grid-node-content" },
|
|
263
|
-
React.createElement(FlatPropertyRenderer, { key: node.key, uniqueKey: selectionKey, propertyRecord: node.derivedRecord, orientation: gridContext.orientation, indentation: node.depth, width: gridContext.gridWidth, isHoverable: gridContext.isPropertyHoverEnabled, isSelectable: gridContext.isPropertySelectionEnabled, isSelected: selectionKey === gridContext.selectedPropertyKey, onClick: gridContext.onPropertyClicked, onRightClick: gridContext.onPropertyRightClicked, onContextMenu: gridContext.onPropertyContextMenu, category: parentCategoryItem.derivedCategory, isEditing: selectionKey === gridContext.editingPropertyKey, onEditCommit: gridContext.onEditCommit, onEditCancel: gridContext.onEditCancel, isExpanded: node.isExpanded, onExpansionToggled: onExpansionToggled, onHeightChanged: onHeightChanged, actionButtonRenderers: gridContext.actionButtonRenderers, propertyValueRendererManager: gridContext.propertyValueRendererManager, columnRatio: gridContext.columnRatio, columnInfo: gridContext.columnInfo, isResizeHandleBeingDragged: gridContext.isResizeHandleBeingDragged, isResizeHandleHovered: gridContext.isResizeHandleHovered, onColumnRatioChanged: gridContext.onColumnRatioChanged, onResizeHandleDragChanged: gridContext.onResizeHandleDragChanged, onResizeHandleHoverChanged: gridContext.onResizeHandleHoverChanged, highlight: gridContext.highlight
|
|
265
|
+
React.createElement(FlatPropertyRenderer, { key: node.key, uniqueKey: selectionKey, propertyRecord: node.derivedRecord, orientation: gridContext.orientation, indentation: node.depth, width: gridContext.gridWidth, isHoverable: gridContext.isPropertyHoverEnabled, isSelectable: gridContext.isPropertySelectionEnabled, isSelected: selectionKey === gridContext.selectedPropertyKey, onClick: gridContext.onPropertyClicked, onRightClick: gridContext.onPropertyRightClicked, onContextMenu: gridContext.onPropertyContextMenu, category: parentCategoryItem.derivedCategory, isEditing: selectionKey === gridContext.editingPropertyKey, isPropertyEditingEnabled: gridContext.isPropertyEditingEnabled, alwaysShowEditor: gridContext.alwaysShowEditor, onEditCommit: gridContext.onEditCommit, onEditCancel: gridContext.onEditCancel, isExpanded: node.isExpanded, onExpansionToggled: onExpansionToggled, onHeightChanged: onHeightChanged, actionButtonRenderers: gridContext.actionButtonRenderers, propertyValueRendererManager: gridContext.propertyValueRendererManager, columnRatio: gridContext.columnRatio, columnInfo: gridContext.columnInfo, isResizeHandleBeingDragged: gridContext.isResizeHandleBeingDragged, isResizeHandleHovered: gridContext.isResizeHandleHovered, onColumnRatioChanged: gridContext.onColumnRatioChanged, onResizeHandleDragChanged: gridContext.onResizeHandleDragChanged, onResizeHandleHoverChanged: gridContext.onResizeHandleHoverChanged, highlight: gridContext.highlight
|
|
264
266
|
? {
|
|
265
267
|
applyOnLabel: gridContext.highlight.filteredTypes?.includes(FilteredType.Label) ?? false,
|
|
266
268
|
applyOnValue: gridContext.highlight.filteredTypes?.includes(FilteredType.Value) ?? false,
|
|
@@ -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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jC,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/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps 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/** 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]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\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\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 class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\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 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 /** @internal */\n public static getDerivedStateFromProps(\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\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\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 function VirtualizedPropertyGridInternal(\n props: Omit<VariableSizeListProps, \"children\">,\n ref: React.ForwardedRef<VariableSizeList>\n ) {\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/**\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 onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\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;;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uCAAuC,EACjD,KAAK,EAAE;gBACL,SAAS,EAAE,GAAG,SAAS,IAAI;gBAC3B,OAAO,EAAE,MAAM;aAChB;YAED,6BACE,GAAG,EAAE,MAAM,EACX,SAAS,EAAC,4CAA4C,IAErD,cAAc,EAAE,CACb,CACF,CACF,CACP,CAAC;AACJ,CAAC,EACD,QAAQ,CACT,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AASlD,MAAM,qBAAqB,GAAyC,CAAC,KAAK,EAAE,EAAE;IAC5E,MAAM,EAAE,eAAe,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/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps 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/** 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]($components-react) 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\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 class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\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 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 /** @internal */\n public static getDerivedStateFromProps(\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\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 function VirtualizedPropertyGridInternal(\n props: Omit<VariableSizeListProps, \"children\">,\n ref: React.ForwardedRef<VariableSizeList>\n ) {\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/**\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 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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module PropertyGrid
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
+
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
5
6
|
import type { HighlightingComponentProps } from "../../../common/HighlightingComponentProps.js";
|
|
6
7
|
import type { PropertyUpdatedArgs } from "../../../editors/EditorContainer.js";
|
|
7
8
|
import type { SharedRendererProps } from "../../../properties/renderers/PropertyRenderer.js";
|
|
@@ -18,6 +19,8 @@ export interface FlatPropertyRendererProps extends SharedRendererProps {
|
|
|
18
19
|
indentation?: number;
|
|
19
20
|
/** Indicates property is being edited */
|
|
20
21
|
isEditing?: boolean;
|
|
22
|
+
/** Callback to determine which editors should be always visible */
|
|
23
|
+
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
21
24
|
/** Called when property edit is committed. */
|
|
22
25
|
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void;
|
|
23
26
|
/** Called when property edit is cancelled. */
|
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;
|
|
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;AAI/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;AAKtE;;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;IACV,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,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,CA6DpE,CAAC"}
|
|
@@ -17,8 +17,8 @@ import { Orientation } from "../../../common/Orientation.js";
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export const FlatPropertyRenderer = (props) => {
|
|
20
|
-
const {
|
|
21
|
-
const valueElementRenderer = () =>
|
|
20
|
+
const { propertyValueRendererManager, highlight, ...passthroughProps } = props;
|
|
21
|
+
const valueElementRenderer = () => React.createElement(DisplayValue, { ...props });
|
|
22
22
|
const primitiveRendererProps = {
|
|
23
23
|
...passthroughProps,
|
|
24
24
|
valueElementRenderer,
|
|
@@ -44,14 +44,18 @@ export const FlatPropertyRenderer = (props) => {
|
|
|
44
44
|
};
|
|
45
45
|
const DisplayValue = (props) => {
|
|
46
46
|
useResetHeightOnEdit(props.orientation, props.isEditing, props.onHeightChanged);
|
|
47
|
-
|
|
47
|
+
const alwaysShowsEditor = props.alwaysShowEditor
|
|
48
|
+
? props.alwaysShowEditor(props.propertyRecord)
|
|
49
|
+
: false;
|
|
50
|
+
if (props.isEditing ||
|
|
51
|
+
(alwaysShowsEditor && props.isPropertyEditingEnabled)) {
|
|
48
52
|
const _onEditCommit = (args) => {
|
|
49
53
|
if (props.category)
|
|
50
54
|
props.onEditCommit?.(args, props.category);
|
|
51
55
|
};
|
|
52
|
-
return (React.createElement(EditorContainer, { propertyRecord: props.propertyRecord, onCommit: _onEditCommit, onCancel: props.onEditCancel ?? (() => { }), setFocus:
|
|
56
|
+
return (React.createElement(EditorContainer, { propertyRecord: props.propertyRecord, onCommit: _onEditCommit, onCancel: props.onEditCancel ?? (() => { }), setFocus: props.isEditing, onClick: () => props.onClick?.(props.propertyRecord, props.uniqueKey) }));
|
|
53
57
|
}
|
|
54
|
-
return
|
|
58
|
+
return CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager, props.isExpanded, props.onExpansionToggled, props.onHeightChanged, props.highlight);
|
|
55
59
|
};
|
|
56
60
|
function useResetHeightOnEdit(orientation, isEditing, onHeightChanged) {
|
|
57
61
|
const previousEditingStatusRef = React.useRef(isEditing);
|
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,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAGjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,OAAO,EAAE,gCAAgC,EA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Y,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,OAAO,CACL,oBAAC,eAAe,IACd,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC1C,QAAQ,EAAE,IAAI,GACd,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,0CACG,sBAAsB,CAAC,qBAAqB,CAC3C,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,4BAA4B,EAClC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,SAAS,CAChB,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,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 { EditorContainer } 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\";\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 /** 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 /** 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 {\n category,\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n onHeightChanged,\n highlight,\n ...passthroughProps\n } = props;\n\n const valueElementRenderer = () => (\n <DisplayValue\n propertyRecord={passthroughProps.propertyRecord}\n orientation={passthroughProps.orientation}\n columnRatio={passthroughProps.columnRatio}\n width={passthroughProps.width}\n category={category}\n propertyValueRendererManager={propertyValueRendererManager}\n isEditing={isEditing}\n onEditCommit={onEditCommit}\n onEditCancel={onEditCancel}\n isExpanded={passthroughProps.isExpanded}\n onExpansionToggled={passthroughProps.onExpansionToggled}\n onHeightChanged={onHeightChanged}\n highlight={highlight}\n indentation={props.indentation}\n />\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 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\n category?: PropertyCategory;\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) => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n if (props.isEditing) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? (() => {})}\n setFocus={true}\n />\n );\n }\n\n return (\n <>\n {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\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,E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,eAAe,IACd,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,GACrE,CACH,CAAC;IACJ,CAAC;IAED,OAAO,sBAAsB,CAAC,qBAAqB,CACjD,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,4BAA4B,EAClC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,eAAe,EACrB,KAAK,CAAC,SAAS,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,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 { EditorContainer } 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\";\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 /** 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 = () => <DisplayValue {...props} />;\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 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) => {\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 <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? (() => {})}\n setFocus={props.isEditing}\n onClick={() => props.onClick?.(props.propertyRecord, props.uniqueKey)}\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/components-react",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@itwin/appui-abstract": "^4.0.0",
|
|
39
39
|
"@itwin/core-bentley": "^4.0.0",
|
|
40
|
-
"@itwin/core-react": "^5.0.0
|
|
40
|
+
"@itwin/core-react": "^5.0.0",
|
|
41
41
|
"@itwin/itwinui-react": "^3.15.0",
|
|
42
42
|
"react": "^18.0.0",
|
|
43
43
|
"react-dom": "^18.0.0"
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"@itwin/build-tools": "4.10.0-dev.31",
|
|
48
48
|
"@itwin/core-bentley": "^4.0.0",
|
|
49
49
|
"@itwin/core-common": "^4.0.0",
|
|
50
|
-
"@itwin/core-geometry": "^4.0.0",
|
|
51
50
|
"@itwin/core-i18n": "^4.0.0",
|
|
52
51
|
"@itwin/eslint-plugin": "^4.1.1",
|
|
53
52
|
"@itwin/itwinui-react": "^3.15.0",
|
|
@@ -78,10 +77,9 @@
|
|
|
78
77
|
"typescript": "~5.3.3",
|
|
79
78
|
"upath": "^2.0.1",
|
|
80
79
|
"vitest": "^1.6.0",
|
|
81
|
-
"@itwin/core-react": "5.0.0
|
|
80
|
+
"@itwin/core-react": "5.0.0"
|
|
82
81
|
},
|
|
83
82
|
"dependencies": {
|
|
84
|
-
"@bentley/icons-generic": "^1.0.34",
|
|
85
83
|
"@itwin/itwinui-icons-react": "^2.8.0",
|
|
86
84
|
"classnames": "2.5.1",
|
|
87
85
|
"immer": "^10.1.1",
|