@itwin/components-react 5.29.0 → 5.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -0
- package/lib/components-react/editors/BooleanEditor.d.ts +2 -0
- package/lib/components-react/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/components-react/editors/BooleanEditor.js +2 -0
- package/lib/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.d.ts +2 -0
- package/lib/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.js +4 -6
- package/lib/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/components-react/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/components-react/editors/DateTimeEditor.js +1 -2
- package/lib/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/components-react/editors/EditorContainer.d.ts +5 -1
- package/lib/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/components-react/editors/EditorContainer.js +1 -1
- package/lib/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -0
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.js +2 -0
- package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/components-react/editors/EnumEditor.d.ts +2 -0
- package/lib/components-react/editors/EnumEditor.d.ts.map +1 -1
- package/lib/components-react/editors/EnumEditor.js +2 -0
- package/lib/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/editors/IconEditor.d.ts +2 -0
- package/lib/components-react/editors/IconEditor.d.ts.map +1 -1
- package/lib/components-react/editors/IconEditor.js +2 -0
- package/lib/components-react/editors/IconEditor.js.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -0
- package/lib/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.js +3 -3
- package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.d.ts +2 -0
- package/lib/components-react/editors/NumericInputEditor.d.ts.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.js +3 -3
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.d.ts +11 -2
- package/lib/components-react/editors/PropertyEditorManager.d.ts.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.js +6 -1
- package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/components-react/editors/SliderEditor.d.ts +4 -1
- package/lib/components-react/editors/SliderEditor.d.ts.map +1 -1
- package/lib/components-react/editors/SliderEditor.js +6 -7
- package/lib/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/components-react/editors/TextEditor.d.ts +1 -0
- package/lib/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextEditor.js +3 -6
- package/lib/components-react/editors/TextEditor.js.map +1 -1
- package/lib/components-react/editors/TextareaEditor.d.ts +2 -0
- package/lib/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextareaEditor.js +2 -0
- package/lib/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/components-react/editors/ToggleEditor.d.ts +2 -0
- package/lib/components-react/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/components-react/editors/ToggleEditor.js +2 -0
- package/lib/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/editors/registerEditors.d.ts.map +1 -1
- package/lib/components-react/editors/registerEditors.js +1 -0
- package/lib/components-react/editors/registerEditors.js.map +1 -1
- package/lib/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/components-react/favorite/FavoritePropertyList.js +4 -1
- package/lib/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRule.d.ts +1 -0
- package/lib/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRule.js +5 -3
- package/lib/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +1 -0
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js +5 -5
- package/lib/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts +45 -8
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.js +17 -8
- package/lib/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts +2 -2
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.js.map +1 -1
- package/lib/components-react/new-editors/interop/Metadata.d.ts +9 -6
- package/lib/components-react/new-editors/interop/Metadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/Metadata.js +6 -3
- package/lib/components-react/new-editors/interop/Metadata.js.map +1 -1
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts +28 -3
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js +7 -3
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Color.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/Color.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts +2 -2
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Enum.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/Enum.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/EnumButtonGroup.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts +2 -2
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Slider.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/Slider.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/TextArea.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/TextArea.js +2 -2
- package/lib/components-react/new-editors/interop/old-editors/TextArea.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts +8 -8
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEditorParams.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts +2 -2
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/UseEnumMetadata.js.map +1 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +4 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +45 -7
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.js +13 -5
- package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyList.d.ts +40 -10
- package/lib/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyList.js +7 -2
- package/lib/components-react/propertygrid/component/PropertyList.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +37 -33
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js +10 -4
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +41 -5
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +6 -4
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +3 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/components-react.d.ts +1 -0
- package/lib/components-react.d.ts.map +1 -1
- package/lib/components-react.js +1 -0
- package/lib/components-react.js.map +1 -1
- package/lib/internal.d.ts +0 -1
- package/lib/internal.d.ts.map +1 -1
- package/lib/internal.js +0 -1
- package/lib/internal.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericInput.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/NumericInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"NumericInput.js","s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B,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;YAC9D,IAAI,iBAAiB,KAAK,cAAc,EAAE,CAAC;gBACzC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;gBACrC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,GAAG;QACH,GAAG;QACH,IAAI;QACJ,KAAK,EAAE,cAAc;QACrB,QAAQ,EAAE,YAAY;QACtB,MAAM,EAAE,UAAU;KACnB,CAAC;AACJ,CAAC;AAED,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { StandardEditorNames } from \"@itwin/appui-abstract\";\nimport type { EditorProps, EditorSpec } from \"../../Types.js\";\nimport { createEditorSpec } from \"../../Types.js\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport { isPropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport type { NumericValue } from \"../../values/Values.js\";\nimport {\n useInputEditorSizeParams,\n useRangeEditorParams,\n} from \"./UseEditorParams.js\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { isNumeric } from \"../../values/ValueUtilities.js\";\nimport type { WithConstraints } from \"../../ConstraintUtils.js\";\nimport { getNumericConstraints } from \"../../ConstraintUtils.js\";\n\n/* v8 ignore start */\n\n/** @internal */\nexport const NumericInputEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"number\" &&\n metadata.preferredEditor === StandardEditorNames.NumericInput,\n isValueSupported: isNumeric,\n Editor: NumericInputEditor,\n});\n\n/** @internal */\nexport function NumericInputEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n id,\n}: EditorProps<WithConstraints<PropertyRecordEditorMetadata>, NumericValue>) {\n const sizeParams = useInputEditorSizeParams(metadata);\n const rangeParams = useRangeEditorParams(metadata);\n const { min: constraintMin, max: constraintMax } = getNumericConstraints(\n metadata.constraints\n );\n\n // Larger minimum value takes precedence\n const effectiveMin =\n rangeParams?.minimum !== undefined\n ? constraintMin !== undefined\n ? Math.max(rangeParams.minimum, constraintMin)\n : rangeParams.minimum\n : constraintMin;\n // Smaller maximum value takes precedence\n const effectiveMax =\n rangeParams?.maximum !== undefined\n ? constraintMax !== undefined\n ? Math.min(rangeParams.maximum, constraintMax)\n : rangeParams.maximum\n : constraintMax;\n\n const handleChange = (newValue: string) => {\n onChange({\n displayValue: newValue,\n rawValue: parseFloat(newValue),\n });\n };\n\n const style: React.CSSProperties | undefined =\n sizeParams?.size !== undefined\n ? {\n minWidth: `${sizeParams?.size * 0.75}em`,\n maxWidth:\n sizeParams?.maxSize !== undefined\n ? `${sizeParams?.maxSize * 0.75}em`\n : undefined,\n }\n : undefined;\n\n const inputProps = useNumericInput({\n min: effectiveMin,\n max: effectiveMax,\n precision: rangeParams?.precision,\n step: rangeParams?.step,\n maxLength: sizeParams?.maxLength,\n onChange: handleChange,\n value: value?.displayValue ?? \"\",\n });\n\n return (\n <Input\n id={id}\n style={style}\n size={size}\n disabled={disabled}\n {...inputProps}\n />\n );\n}\n\ninterface UseNumericInputProps {\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n maxLength?: number;\n value: string;\n onChange: (newValue: string) => void;\n}\n\nfunction useNumericInput({\n min,\n max,\n step,\n precision,\n maxLength,\n value,\n onChange,\n}: UseNumericInputProps) {\n const formatValue = (val: number) => {\n const appliedMin = min ?? Number.MIN_VALUE;\n const appliedMax = max ?? Number.MAX_VALUE;\n const valueInRange = Math.min(appliedMax, Math.max(appliedMin, val));\n\n return precision\n ? valueInRange.toFixed(precision)\n : valueInRange.toString();\n };\n\n const [formattedValue, setFormattedValue] = React.useState(() => {\n return value.length !== 0 ? formatValue(Number(value)) : value;\n });\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const currentValue = event.target.value;\n if (maxLength && currentValue.length > maxLength) {\n return;\n }\n setFormattedValue(currentValue);\n onChange(currentValue);\n };\n\n const handleBlur = () => {\n if (precision) {\n const newFormattedValue = formatValue(Number(formattedValue));\n if (newFormattedValue !== formattedValue) {\n setFormattedValue(newFormattedValue);\n onChange(newFormattedValue);\n }\n }\n };\n\n return {\n type: \"number\",\n min,\n max,\n step,\n value: formattedValue,\n onChange: handleChange,\n onBlur: handleBlur,\n };\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { createEditorSpec } from "../../Types.js";
|
|
7
|
-
import {
|
|
7
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
8
8
|
import { PropertyEditorParamTypes, StandardEditorNames, } from "@itwin/appui-abstract";
|
|
9
9
|
import { Button, Icon, Popover, Slider } from "@itwin/itwinui-react";
|
|
10
10
|
import { useSliderEditorParams } from "./UseEditorParams.js";
|
|
@@ -13,7 +13,7 @@ import { isNumeric } from "../../values/ValueUtilities.js";
|
|
|
13
13
|
/* v8 ignore start */
|
|
14
14
|
/** @internal */
|
|
15
15
|
export const SliderEditorSpec = createEditorSpec({
|
|
16
|
-
isMetadataSupported: (metadata) =>
|
|
16
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
17
17
|
metadata.type === "number" &&
|
|
18
18
|
!!metadata.params?.find((param) => param.type === PropertyEditorParamTypes.Slider.valueOf()) &&
|
|
19
19
|
metadata.preferredEditor === StandardEditorNames.Slider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Slider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Slider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,qBAAqB;AAErB,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;IAC/C,mBAAmB,EAAE,CAAC,QAAQ,EAA4C,EAAE,CAC1E,8BAA8B,CAAC,QAAQ,CAAC;QACxC,QAAQ,CAAC,IAAI,KAAK,QAAQ;QAC1B,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CACrB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,CAAC,MAAM,CAAC,OAAO,EAAE,CACpE;QACD,QAAQ,CAAC,eAAe,KAAK,mBAAmB,CAAC,MAAM;IACzD,g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CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,MAAM,SAAS,GAAG,CAAC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QACxE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAChD,eAAe,CAAC,CAAC,GAAG,SAAS,GAAG,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CACpE,CAAC;IACJ,CAAC;IACD,OAAO,YAAY;SAChB,aAAa,EAAE,EAAE;SACjB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,MAA0B;IAChE,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;AACzE,CAAC;AAED,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport type { EditorProps } from \"../../Types.js\";\nimport { createEditorSpec } from \"../../Types.js\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport { isPropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport type { NumericValue } from \"../../values/Values.js\";\nimport type { SliderEditorParams } from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n StandardEditorNames,\n} from \"@itwin/appui-abstract\";\nimport { Button, Icon, Popover, Slider } from \"@itwin/itwinui-react\";\nimport { useSliderEditorParams } from \"./UseEditorParams.js\";\nimport { findIcon } from \"../IconsRegistry.js\";\nimport { isNumeric } from \"../../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/** @internal */\nexport const SliderEditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"number\" &&\n !!metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.Slider.valueOf()\n ) &&\n metadata.preferredEditor === StandardEditorNames.Slider,\n isValueSupported: isNumeric,\n Editor: SliderEditor,\n});\n\nfunction SliderEditor({\n metadata,\n value,\n disabled,\n onChange,\n commit,\n size,\n id,\n}: EditorProps<PropertyRecordEditorMetadata, NumericValue>) {\n const sliderParams = useSliderEditorParams(metadata);\n if (!sliderParams) {\n return null;\n }\n\n const minLabel =\n sliderParams.showMinMax && sliderParams.minIconSpec ? (\n <Icon>{findIcon(sliderParams.minIconSpec)}</Icon>\n ) : undefined;\n const maxLabel =\n sliderParams.showMinMax && sliderParams.maxIconSpec ? (\n <Icon>{findIcon(sliderParams.maxIconSpec)}</Icon>\n ) : undefined;\n\n const handleChange = (values: ReadonlyArray<number>): void => {\n const newValue = values[0];\n onChange({ rawValue: newValue, displayValue: `${newValue}` });\n };\n\n const currentValue = value?.rawValue ?? sliderParams.minimum;\n const slider = (\n <Slider\n values={[currentValue]}\n min={sliderParams.minimum}\n max={sliderParams.maximum}\n step={sliderParams.step}\n thumbMode={\n 1 === sliderParams.mode ? \"allow-crossing\" : \"inhibit-crossing\"\n }\n trackDisplayMode={!sliderParams.reversed ? \"auto\" : \"odd-segments\"}\n minLabel={minLabel}\n maxLabel={maxLabel}\n tooltipProps={(_index, tooltipValue) => {\n return {\n placement: sliderParams.tooltipBelow ? \"bottom\" : \"top\",\n content: formatTickLabel(tooltipValue, sliderParams),\n visible: sliderParams.showTooltip,\n };\n }}\n tickLabels={getTickLabels(sliderParams)}\n onChange={handleChange}\n disabled={disabled}\n />\n );\n return (\n <Popover\n placement=\"bottom\"\n style={{ minWidth: \"300px\", padding: \"8px\" }}\n content={slider}\n onVisibleChange={(visible) => {\n if (!visible) {\n commit?.();\n }\n }}\n applyBackground={true}\n >\n <Button id={id} style={{ width: \"100%\" }} size={size} disabled={disabled}>\n {currentValue}\n </Button>\n </Popover>\n );\n}\n\nfunction getTickLabels(sliderParams: SliderEditorParams) {\n if (!sliderParams.showTicks || !sliderParams.showTickLabels) {\n return undefined;\n }\n const count = sliderParams.getTickCount ? sliderParams.getTickCount() : 0;\n if (count > 0) {\n const increment = (sliderParams.maximum - sliderParams.minimum) / count;\n return Array.from({ length: count + 1 }, (_, i) =>\n formatTickLabel(i * increment + sliderParams.minimum, sliderParams)\n );\n }\n return sliderParams\n .getTickValues?.()\n .map((val) => formatTickLabel(val, sliderParams));\n}\n\nfunction formatTickLabel(value: number, params: SliderEditorParams) {\n return params.formatTooltip ? params.formatTooltip(value) : `${value}`;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/TextArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/TextArea.tsx"],"names":[],"mappings":"AAgBA,gBAAgB;AAChB,eAAO,MAAM,mBAAmB,qCAO9B,CAAC"}
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Button, Popover, Textarea } from "@itwin/itwinui-react";
|
|
7
7
|
import { createEditorSpec } from "../../Types.js";
|
|
8
|
-
import {
|
|
8
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
9
9
|
import { StandardEditorNames } from "@itwin/appui-abstract";
|
|
10
10
|
import { isText } from "../../values/ValueUtilities.js";
|
|
11
11
|
/* v8 ignore start */
|
|
12
12
|
/** @internal */
|
|
13
13
|
export const MultilineEditorSpec = createEditorSpec({
|
|
14
|
-
isMetadataSupported: (metadata) =>
|
|
14
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
15
15
|
metadata.type === "string" &&
|
|
16
16
|
metadata.preferredEditor === StandardEditorNames.MultiLine,
|
|
17
17
|
isValueSupported: isText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/TextArea.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/TextArea.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,qBAAqB;AAErB,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;IAClD,mBAAmB,EAAE,CAAC,QAAQ,EAA4C,EAAE,CAC1E,8BAA8B,CAAC,QAAQ,CAAC;QACxC,QAAQ,CAAC,IAAI,KAAK,QAAQ;QAC1B,QAAQ,CAAC,eAAe,KAAK,mBAAmB,CAAC,SAAS;IAC5D,gBAAgB,EAAE,MAAM;IACxB,MAAM,EAAE,cAAc;CACvB,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,EAAE,GACmD;IACrD,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAE5C,OAAO,CACL,oBAAC,OAAO,IACN,SAAS,EAAC,QAAQ,EAClB,OAAO,EACL,oBAAC,QAAQ,IACP,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,MAAM,QAAQ,GAAG,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;gBACvC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YAChC,CAAC,GACD,EAEJ,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,EAAE,EAAE,CAAC;YACb,CAAC;QACH,CAAC;QAED,oBAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,IACrE,YAAY,CAAC,KAAK,CACZ,CACD,CACX,CAAC;AACJ,CAAC;AAED,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { Button, Popover, Textarea } from \"@itwin/itwinui-react\";\nimport { createEditorSpec, type EditorProps } from \"../../Types.js\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport { isPropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport { type TextValue } from \"../../values/Values.js\";\nimport { StandardEditorNames } from \"@itwin/appui-abstract\";\nimport { isText } from \"../../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/** @internal */\nexport const MultilineEditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"string\" &&\n metadata.preferredEditor === StandardEditorNames.MultiLine,\n isValueSupported: isText,\n Editor: TextAreaEditor,\n});\n\nfunction TextAreaEditor({\n value,\n onChange,\n commit,\n size,\n disabled,\n id,\n}: EditorProps<PropertyRecordEditorMetadata, TextValue>) {\n const currentValue = value ?? { value: \"\" };\n\n return (\n <Popover\n placement=\"bottom\"\n content={\n <Textarea\n value={currentValue.value}\n onChange={(e) => {\n const newValue = e.currentTarget.value;\n onChange({ value: newValue });\n }}\n />\n }\n onVisibleChange={(visible) => {\n if (!visible) {\n commit?.();\n }\n }}\n >\n <Button id={id} style={{ width: \"100%\" }} size={size} disabled={disabled}>\n {currentValue.value}\n </Button>\n </Popover>\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropertyRecordEditorMetadata } from "../Metadata.js";
|
|
2
2
|
import type { ButtonGroupEditorParams, ColorEditorParams, CustomFormattedNumberParams, IconEditorParams, InputEditorSizeParams, RangeEditorParams, SliderEditorParams } from "@itwin/appui-abstract";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export declare function useCustomFormattedNumberParams(metadata:
|
|
6
|
+
export declare function useCustomFormattedNumberParams(metadata: PropertyRecordEditorMetadata): CustomFormattedNumberParams | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
export declare function useInputEditorSizeParams(metadata:
|
|
10
|
+
export declare function useInputEditorSizeParams(metadata: PropertyRecordEditorMetadata): InputEditorSizeParams | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
14
|
-
export declare function useIconEditorParams(metadata:
|
|
14
|
+
export declare function useIconEditorParams(metadata: PropertyRecordEditorMetadata): IconEditorParams | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
|
-
export declare function useButtonGroupEditorParams(metadata:
|
|
18
|
+
export declare function useButtonGroupEditorParams(metadata: PropertyRecordEditorMetadata): ButtonGroupEditorParams | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
export declare function useColorEditorParams(metadata:
|
|
22
|
+
export declare function useColorEditorParams(metadata: PropertyRecordEditorMetadata): ColorEditorParams | undefined;
|
|
23
23
|
/**
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
|
-
export declare function useRangeEditorParams(metadata:
|
|
26
|
+
export declare function useRangeEditorParams(metadata: PropertyRecordEditorMetadata): RangeEditorParams | undefined;
|
|
27
27
|
/**
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
|
-
export declare function useSliderEditorParams(metadata:
|
|
30
|
+
export declare function useSliderEditorParams(metadata: PropertyRecordEditorMetadata): SliderEditorParams | undefined;
|
|
31
31
|
//# sourceMappingURL=UseEditorParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseEditorParams.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEditorParams.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"UseEditorParams.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEditorParams.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAK/B;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,4BAA4B,GACrC,2BAA2B,GAAG,SAAS,CAUzC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,4BAA4B,GACrC,qBAAqB,GAAG,SAAS,CASnC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,4BAA4B,GACrC,gBAAgB,GAAG,SAAS,CAQ9B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,4BAA4B,GACrC,uBAAuB,GAAG,SAAS,CASrC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,4BAA4B,GACrC,iBAAiB,GAAG,SAAS,CAQ/B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,4BAA4B,GACrC,iBAAiB,GAAG,SAAS,CAQ/B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,4BAA4B,GACrC,kBAAkB,GAAG,SAAS,CAQhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseEditorParams.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEditorParams.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,qBAAqB;AAErB;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,
|
|
1
|
+
{"version":3,"file":"UseEditorParams.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEditorParams.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE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AM,UAAU,oBAAoB,CAClC,QAAsC;IAEtC,OAAO,KAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CACH,QAAQ,CAAC,MAAM,EAAE,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,CAAC,SAAS,CAAC,OAAO,EAAE,CAClD,EACxB,CAAC,QAAQ,CAAC,CACX,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAsC;IAEtC,OAAO,KAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CACH,QAAQ,CAAC,MAAM,EAAE,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,CAC9C,EACxB,CAAC,QAAQ,CAAC,CACX,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAsC;IAEtC,OAAO,KAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CACH,QAAQ,CAAC,MAAM,EAAE,IAAI,CACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,CAAC,MAAM,CAAC,OAAO,EAAE,CAC9C,EACzB,CAAC,QAAQ,CAAC,CACX,CAAC;AACJ,CAAC;AAED,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport type {\n ButtonGroupEditorParams,\n ColorEditorParams,\n CustomFormattedNumberParams,\n IconEditorParams,\n InputEditorSizeParams,\n RangeEditorParams,\n SliderEditorParams,\n} from \"@itwin/appui-abstract\";\nimport { PropertyEditorParamTypes } from \"@itwin/appui-abstract\";\n\n/* v8 ignore start */\n\n/**\n * @internal\n */\nexport function useCustomFormattedNumberParams(\n metadata: PropertyRecordEditorMetadata\n): CustomFormattedNumberParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) =>\n param.type ===\n PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) as CustomFormattedNumberParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useInputEditorSizeParams(\n metadata: PropertyRecordEditorMetadata\n): InputEditorSizeParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useIconEditorParams(\n metadata: PropertyRecordEditorMetadata\n): IconEditorParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.Icon.valueOf()\n ) as IconEditorParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useButtonGroupEditorParams(\n metadata: PropertyRecordEditorMetadata\n): ButtonGroupEditorParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) =>\n param.type === PropertyEditorParamTypes.ButtonGroupData.valueOf()\n ) as ButtonGroupEditorParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useColorEditorParams(\n metadata: PropertyRecordEditorMetadata\n): ColorEditorParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.ColorData.valueOf()\n ) as ColorEditorParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useRangeEditorParams(\n metadata: PropertyRecordEditorMetadata\n): RangeEditorParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams,\n [metadata]\n );\n}\n\n/**\n * @internal\n */\nexport function useSliderEditorParams(\n metadata: PropertyRecordEditorMetadata\n): SliderEditorParams | undefined {\n return React.useMemo(\n () =>\n metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.Slider.valueOf()\n ) as SliderEditorParams,\n [metadata]\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PropertyRecordEditorMetadata } from "../Metadata.js";
|
|
2
2
|
import type { EnumValueMetadata } from "../../values/Metadata.js";
|
|
3
3
|
/**
|
|
4
4
|
* Converts old enum metadata definition into the new one. It takes care of lazy loaded choices.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare function useEnumMetadata(oldMetadata:
|
|
7
|
+
export declare function useEnumMetadata(oldMetadata: PropertyRecordEditorMetadata): EnumValueMetadata;
|
|
8
8
|
//# sourceMappingURL=UseEnumMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseEnumMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEnumMetadata.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"UseEnumMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEnumMetadata.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,4BAA4B,GACxC,iBAAiB,CAkCnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseEnumMetadata.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEnumMetadata.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,
|
|
1
|
+
{"version":3,"file":"UseEnumMetadata.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/UseEnumMetadata.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,qBAAqB;AAErB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,WAAyC;IAEzC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAoB,GAAG,EAAE,CAAC,CAAC;QACvE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;YAC7B,MAAM,aAAa,GACjB,WAAW,CAAC,IAAI,KAAK,SAAS;gBAC5B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,YAAY,OAAO;oBAC7C,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACvC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEpC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,WAAW,CAAC;oBACV,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,aAAa;oBACtB,QAAQ,EAAE,WAAW,CAAC,IAAI,EAAE,QAAQ,IAAI,KAAK;iBAC9C,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QAEF,KAAK,WAAW,EAAE,CAAC;QAEnB,OAAO,GAAG,EAAE;YACV,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport type { EnumValueMetadata } from \"../../values/Metadata.js\";\n\n/* v8 ignore start */\n\n/**\n * Converts old enum metadata definition into the new one. It takes care of lazy loaded choices.\n * @internal\n */\nexport function useEnumMetadata(\n oldMetadata: PropertyRecordEditorMetadata\n): EnumValueMetadata {\n const [metadata, setMetadata] = React.useState<EnumValueMetadata>(() => ({\n type: \"enum\",\n choices: [],\n isStrict: false,\n }));\n\n React.useEffect(() => {\n let disposed = false;\n const loadChoices = async () => {\n const loadedChoices =\n oldMetadata.enum === undefined\n ? []\n : oldMetadata.enum.choices instanceof Promise\n ? [...(await oldMetadata.enum.choices)]\n : [...oldMetadata.enum.choices];\n\n if (!disposed) {\n setMetadata({\n type: \"enum\",\n choices: loadedChoices,\n isStrict: oldMetadata.enum?.isStrict ?? false,\n });\n }\n };\n\n void loadChoices();\n\n return () => {\n disposed = true;\n };\n }, [oldMetadata]);\n\n return metadata;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonPrimitivePropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAI7E;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,sBAAsB;IAC9B,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,iEAAiE;AACjE,UAAU,iCAAiC;IACzC,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,KAAK,CAAC,SAAS,CAC/D,iCAAiC,EACjC,iCAAiC,CAClC;IACC,SAAyB,KAAK,EAAE,iCAAiC,CAI/D;gBAEU,KAAK,EAAE,iCAAiC;IAIpD,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAElB;IAEF,OAAO,CAAC,QAAQ;IAiChB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"NonPrimitivePropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAI7E;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,sBAAsB;IAC9B,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,iEAAiE;AACjE,UAAU,iCAAiC;IACzC,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,KAAK,CAAC,SAAS,CAC/D,iCAAiC,EACjC,iCAAiC,CAClC;IACC,SAAyB,KAAK,EAAE,iCAAiC,CAI/D;gBAEU,KAAK,EAAE,iCAAiC;IAIpD,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAElB;IAEF,OAAO,CAAC,QAAQ;IAiChB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,sBAAsB,CAyB5B;IAEc,MAAM;CAwBvB"}
|
|
@@ -52,7 +52,10 @@ export class NonPrimitivePropertyRenderer extends React.Component {
|
|
|
52
52
|
? this.props.uniqueKey
|
|
53
53
|
: this.props.propertyRecord.property.name;
|
|
54
54
|
const uniqueKey = `${prefix}_${item.property.name}`;
|
|
55
|
-
return (
|
|
55
|
+
return (
|
|
56
|
+
// does not use editing capabilities, so editorSystem is not needed --- IGNORE ---
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
58
|
+
React.createElement(PropertyRenderer, { key: uniqueKey, uniqueKey: uniqueKey, propertyRecord: item, indentation: this.props.indentation ? this.props.indentation + 1 : 1, orientation: this.props.orientation, columnRatio: this.props.columnRatio, actionButtonRenderers: this.props.actionButtonRenderers, onColumnRatioChanged: this.props.onColumnRatioChanged, width: this.props.width, isResizeHandleHovered: this.props.isResizeHandleHovered, onResizeHandleHoverChanged: this.props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: this.props.isResizeHandleBeingDragged, onResizeHandleDragChanged: this.props.onResizeHandleDragChanged, columnInfo: this.props.columnInfo }));
|
|
56
59
|
};
|
|
57
60
|
render() {
|
|
58
61
|
let items = this.props.propertyRecord.getChildrenRecords();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iCAAiC,EAAE,MAAM,8CAA8C,CAAC;AAEjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBA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,EAC1B,UAAU,EAAE,IAAI,CAAC,YAAY,EAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,KAAK,IAEjB,YAAY,CACqB,CACrC,CAAC;IACJ,CAAC;IAEO,0BAA0B,CAAC,KAAuB;QACxD,MAAM,kBAAkB,GAAqB,KAAK,CAAC,GAAG,CACpD,CAAC,IAAI,EAAE,KAAK,EAAkB,EAAE;YAC9B,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzC,WAAW,CAAC,YAAY,GAAG,IAAI,KAAK,GAAG,CAAC,GAAG,CAAC;YAC5C,WAAW,CAAC,IAAI,GAAG,GAAG,WAAW,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;YAClD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CACF,CAAC;QAEF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAEO,sBAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE;QACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS;YACjC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS;YACtB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC5C,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,sBA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I,CAAC,KAAK,CAAC,UAAU;gBACpB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC;gBACxC,CAAC,CAAC,SAAS,CACZ,CACJ,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/** @packageDocumentation\n * @module Properties\n */\n\nimport \"./NonPrimitivePropertyRenderer.scss\";\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer.js\";\nimport { NonPrimitivePropertyLabelRenderer } from \"./label/NonPrimitivePropertyLabelRenderer.js\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer.js\";\nimport { PropertyRenderer } from \"./PropertyRenderer.js\";\nimport { PropertyView } from \"./PropertyView.js\";\n\n/** Properties of [[NonPrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface NonPrimitivePropertyRendererProps\n extends PrimitiveRendererProps {\n /** Can struct/array property be collapsed */\n isCollapsible?: boolean;\n}\n\n/** State of [[NonPrimitivePropertyRenderer]] React component. */\ninterface NonPrimitivePropertyRendererState {\n /** Is struct/array property expanded */\n isExpanded?: boolean;\n}\n\n/** React Component that renders struct and array properties\n * @public\n */\nexport class NonPrimitivePropertyRenderer extends React.Component<\n NonPrimitivePropertyRendererProps,\n NonPrimitivePropertyRendererState\n> {\n public override readonly state: NonPrimitivePropertyRendererState = {\n /** If it's not collapsible, that means it's expanded by default and can't be collapsed */\n isExpanded:\n !this.props.isCollapsible || this.props.propertyRecord.autoExpand,\n };\n\n constructor(props: NonPrimitivePropertyRendererProps) {\n super(props);\n }\n\n private _onExpanded = () => {\n this.setState({ isExpanded: true });\n };\n\n private _onCollapsed = () => {\n this.setState({ isExpanded: false });\n };\n\n private getLabel(\n props: NonPrimitivePropertyRendererProps,\n state: NonPrimitivePropertyRendererState\n ): React.ReactNode {\n const { orientation, indentation, width, columnRatio, columnInfo } = props;\n const minLabelWidth = columnInfo?.minLabelWidth;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minLabelWidth\n );\n\n let displayLabel = props.propertyRecord.property.displayLabel;\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;\n\n return (\n <NonPrimitivePropertyLabelRenderer\n isExpanded={!!state.isExpanded}\n onExpand={this._onExpanded}\n onCollapse={this._onCollapsed}\n offset={offset}\n renderColon={false}\n >\n {displayLabel}\n </NonPrimitivePropertyLabelRenderer>\n );\n }\n\n private overrideArrayChildrenNames(items: PropertyRecord[]) {\n const modifiedProperties: PropertyRecord[] = items.map(\n (item, index): PropertyRecord => {\n const newProperty = { ...item.property };\n newProperty.displayLabel = `[${index + 1}]`;\n newProperty.name = `${newProperty.name}_${index}`;\n return new PropertyRecord(item.value, newProperty);\n }\n );\n\n return modifiedProperties;\n }\n\n private _renderPropertyForItem = (item: PropertyRecord) => {\n const prefix = this.props.uniqueKey\n ? this.props.uniqueKey\n : this.props.propertyRecord.property.name;\n const uniqueKey = `${prefix}_${item.property.name}`;\n return (\n // does not use editing capabilities, so editorSystem is not needed --- IGNORE ---\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <PropertyRenderer\n key={uniqueKey}\n uniqueKey={uniqueKey}\n propertyRecord={item}\n indentation={this.props.indentation ? this.props.indentation + 1 : 1}\n orientation={this.props.orientation}\n columnRatio={this.props.columnRatio}\n actionButtonRenderers={this.props.actionButtonRenderers}\n onColumnRatioChanged={this.props.onColumnRatioChanged}\n width={this.props.width}\n isResizeHandleHovered={this.props.isResizeHandleHovered}\n onResizeHandleHoverChanged={this.props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={this.props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={this.props.onResizeHandleDragChanged}\n columnInfo={this.props.columnInfo}\n />\n );\n };\n\n public override render() {\n let items: PropertyRecord[] =\n this.props.propertyRecord.getChildrenRecords();\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n )\n items = this.overrideArrayChildrenNames(items);\n\n const { indentation, ...props } = this.props;\n return (\n <>\n {this.props.isCollapsible ? (\n <PropertyView\n labelElement={this.getLabel(this.props, this.state)}\n {...props}\n />\n ) : undefined}\n\n {this.state.isExpanded\n ? items.map(this._renderPropertyForItem)\n : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -56,10 +56,8 @@ export interface SharedRendererProps {
|
|
|
56
56
|
/** Callback to determine which editors should be always visible */
|
|
57
57
|
alwaysShowEditor?: (property: PropertyRecord) => boolean;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
*/
|
|
62
|
-
export interface PropertyRendererProps extends SharedRendererProps {
|
|
59
|
+
/** @public */
|
|
60
|
+
interface PropertyRendererBaseProps extends SharedRendererProps {
|
|
63
61
|
/** Custom value renderer */
|
|
64
62
|
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
65
63
|
/** Multiplier of how much the property is indented to the right */
|
|
@@ -73,11 +71,51 @@ export interface PropertyRendererProps extends SharedRendererProps {
|
|
|
73
71
|
/** Props used for highlighting. */
|
|
74
72
|
highlight?: HighlightingComponentProps;
|
|
75
73
|
}
|
|
76
|
-
/**
|
|
74
|
+
/** @public */
|
|
75
|
+
interface PropertyRendererLegacyProps extends PropertyRendererBaseProps {
|
|
76
|
+
/**
|
|
77
|
+
* Specifies which editors system should be used: legacy or the new one.
|
|
78
|
+
* @default "legacy"
|
|
79
|
+
* @beta
|
|
80
|
+
* @deprecated in 5.30. Legacy editors system is deprecated. Use `editorSystem: "new"`.
|
|
81
|
+
*/
|
|
82
|
+
editorSystem?: "legacy";
|
|
83
|
+
}
|
|
84
|
+
/** @public */
|
|
85
|
+
interface PropertyRendererNewProps extends PropertyRendererBaseProps {
|
|
86
|
+
/**
|
|
87
|
+
* Specifies which editors system should be used: legacy or the new one.
|
|
88
|
+
* @default "legacy"
|
|
89
|
+
* @beta
|
|
90
|
+
*/
|
|
91
|
+
editorSystem: "new";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Properties of [[PropertyRenderer]] React component
|
|
77
95
|
* @public
|
|
96
|
+
* @deprecated in 5.30.0. Use `React.ComponentProps<typeof PropertyRenderer>` instead.
|
|
78
97
|
*/
|
|
79
|
-
export
|
|
98
|
+
export type PropertyRendererProps = PropertyRendererNewProps | PropertyRendererLegacyProps;
|
|
99
|
+
interface PropertyRendererComponent {
|
|
100
|
+
/**
|
|
101
|
+
* A React component that renders properties
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
(props: PropertyRendererNewProps): React.JSX.Element;
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated in 5.30. Use `PropertyRenderer` with `editorSystem="new"` instead.
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
(props: PropertyRendererLegacyProps): React.JSX.Element;
|
|
110
|
+
/** @public */
|
|
80
111
|
(props: PropertyRendererProps): React.JSX.Element;
|
|
112
|
+
/** @public */
|
|
81
113
|
getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number;
|
|
82
|
-
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A React component that renders properties
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare const PropertyRenderer: PropertyRendererComponent;
|
|
120
|
+
export {};
|
|
83
121
|
//# sourceMappingURL=PropertyRenderer.d.ts.map
|
|
@@ -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,OAA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,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACnD,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mCAAmC;IACnC,SAAS,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED,cAAc;AACd,UAAU,2BAA4B,SAAQ,yBAAyB;IACrE;;;;;OAKG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,eAAe;AACf,UAAU,wBAAyB,SAAQ,yBAAyB;IAClE;;;;OAIG;IACH,YAAY,EAAE,KAAK,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B,wBAAwB,GACxB,2BAA2B,CAAC;AAEhC,UAAU,yBAAyB;IACjC;;;OAGG;IACH,CAAC,KAAK,EAAE,wBAAwB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACrD;;;OAGG;IACH,CAAC,KAAK,EAAE,2BAA2B,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxD,cAAc;IAEd,CAAC,KAAK,EAAE,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IAClD,cAAc;IACd,cAAc,CACZ,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,WAAW,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,yBA6G9B,CAAC"}
|
|
@@ -7,18 +7,23 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
10
|
-
import { EditorContainer } from "../../editors/EditorContainer.js";
|
|
11
10
|
import { CommonPropertyRenderer } from "./CommonPropertyRenderer.js";
|
|
12
11
|
import { NonPrimitivePropertyRenderer } from "./NonPrimitivePropertyRenderer.js";
|
|
13
12
|
import { PrimitivePropertyRenderer } from "./PrimitivePropertyRenderer.js";
|
|
14
13
|
import { useTranslation } from "../../l10n/useTranslation.js";
|
|
15
|
-
|
|
14
|
+
import { PropertyRecordEditor } from "../../new-editors/interop/PropertyRecordEditor.js";
|
|
15
|
+
/**
|
|
16
|
+
* A React component that renders properties
|
|
16
17
|
* @public
|
|
17
18
|
*/
|
|
18
|
-
export const PropertyRenderer = (
|
|
19
|
+
export const PropertyRenderer = (
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
21
|
+
props) => {
|
|
19
22
|
const { translate } = useTranslation();
|
|
20
23
|
const [displayValue, setDisplayValue] = React.useState(() => translate("general.loading"));
|
|
21
|
-
const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, alwaysShowEditor, isPropertyEditingEnabled, onClick, uniqueKey,
|
|
24
|
+
const { isEditing, orientation, propertyRecord, indentation, propertyValueRendererManager, onEditCommit, onEditCancel, alwaysShowEditor, isPropertyEditingEnabled, onClick, uniqueKey,
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
26
|
+
editorSystem, ...restProps } = props;
|
|
22
27
|
const onCommit = React.useCallback((args) => {
|
|
23
28
|
if (onEditCommit)
|
|
24
29
|
onEditCommit(args);
|
|
@@ -32,7 +37,9 @@ export const PropertyRenderer = (props) => {
|
|
|
32
37
|
: false;
|
|
33
38
|
React.useEffect(() => {
|
|
34
39
|
if (isEditing || (alwaysShowsEditor && isPropertyEditingEnabled)) {
|
|
35
|
-
setDisplayValue(React.createElement(
|
|
40
|
+
setDisplayValue(React.createElement(PropertyRecordEditor, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, setFocus: isEditing, onClick: () => onClick?.(propertyRecord, uniqueKey),
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
42
|
+
editorSystem: editorSystem }));
|
|
36
43
|
return;
|
|
37
44
|
}
|
|
38
45
|
setDisplayValue(CommonPropertyRenderer.createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager));
|
|
@@ -48,6 +55,7 @@ export const PropertyRenderer = (props) => {
|
|
|
48
55
|
isPropertyEditingEnabled,
|
|
49
56
|
onClick,
|
|
50
57
|
uniqueKey,
|
|
58
|
+
editorSystem,
|
|
51
59
|
]);
|
|
52
60
|
const primitiveRendererProps = {
|
|
53
61
|
...restProps,
|
|
@@ -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,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,CAAC;AAoE9D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAkB,GAAG,EAAE,CAC3E,SAAS,CAAC,iBAAiB,CAAC,CAC7B,CAAC;IAEF,MAAM,EACJ,SAAS,EACT,WAAW,EACX,cAAc,EACd,WAAW,EACX,4BAA4B,EAC5B,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,OAAO,EACP,SAAS,EACT,GAAG,SAAS,EACb,GAAG,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AY,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 /** 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"]}
|
|
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;AAK5D,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,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAm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ACd,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 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\";\nimport { PropertyRecordEditor } from \"../../new-editors/interop/PropertyRecordEditor.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/** @public */\ninterface PropertyRendererBaseProps 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/** @public */\ninterface PropertyRendererLegacyProps extends PropertyRendererBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n * @deprecated in 5.30. Legacy editors system is deprecated. Use `editorSystem: \"new\"`.\n */\n editorSystem?: \"legacy\";\n}\n\n/** @public */\ninterface PropertyRendererNewProps extends PropertyRendererBaseProps {\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n */\n editorSystem: \"new\";\n}\n\n/**\n * Properties of [[PropertyRenderer]] React component\n * @public\n * @deprecated in 5.30.0. Use `React.ComponentProps<typeof PropertyRenderer>` instead.\n */\nexport type PropertyRendererProps =\n | PropertyRendererNewProps\n | PropertyRendererLegacyProps;\n\ninterface PropertyRendererComponent {\n /**\n * A React component that renders properties\n * @public\n */\n (props: PropertyRendererNewProps): React.JSX.Element;\n /**\n * @deprecated in 5.30. Use `PropertyRenderer` with `editorSystem=\"new\"` instead.\n * @public\n */\n (props: PropertyRendererLegacyProps): React.JSX.Element;\n /** @public */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n (props: PropertyRendererProps): React.JSX.Element;\n /** @public */\n getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number;\n}\n\n/**\n * A React component that renders properties\n * @public\n */\nexport const PropertyRenderer: PropertyRendererComponent = (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props: PropertyRendererProps\n) => {\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem,\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 <PropertyRecordEditor\n propertyRecord={propertyRecord}\n onCommit={onCommit}\n onCancel={onCancel}\n setFocus={isEditing}\n onClick={() => onClick?.(propertyRecord, uniqueKey)}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={editorSystem}\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 editorSystem,\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"]}
|
|
@@ -10,10 +10,7 @@ import type { PropertyGridColumnInfo } from "../../properties/renderers/Property
|
|
|
10
10
|
import type { PropertyValueRendererManager } from "../../properties/ValueRendererManager.js";
|
|
11
11
|
import type { PropertyCategory } from "../PropertyDataProvider.js";
|
|
12
12
|
import { Orientation } from "../../common/Orientation.js";
|
|
13
|
-
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export interface PropertyListProps extends CommonProps {
|
|
13
|
+
interface PropertyListBaseProps extends CommonProps {
|
|
17
14
|
orientation: Orientation;
|
|
18
15
|
width: number;
|
|
19
16
|
category?: PropertyCategory;
|
|
@@ -50,6 +47,43 @@ export interface PropertyListProps extends CommonProps {
|
|
|
50
47
|
/** Information for styling property grid columns */
|
|
51
48
|
columnInfo?: PropertyGridColumnInfo;
|
|
52
49
|
}
|
|
50
|
+
/** @public */
|
|
51
|
+
interface PropertyListLegacyProps extends PropertyListBaseProps {
|
|
52
|
+
/**
|
|
53
|
+
* Specifies which editors system should be used: legacy or the new one.
|
|
54
|
+
* @default "legacy"
|
|
55
|
+
* @beta
|
|
56
|
+
* @deprecated in 5.30. Legacy editors system is deprecated. Use `editorSystem: "new"`.
|
|
57
|
+
*/
|
|
58
|
+
editorSystem?: "legacy";
|
|
59
|
+
}
|
|
60
|
+
/** @public */
|
|
61
|
+
interface PropertyListNewProps extends PropertyListBaseProps {
|
|
62
|
+
/**
|
|
63
|
+
* Specifies which editors system should be used: legacy or the new one.
|
|
64
|
+
* @default "legacy"
|
|
65
|
+
* @beta
|
|
66
|
+
*/
|
|
67
|
+
editorSystem: "new";
|
|
68
|
+
}
|
|
69
|
+
/** Properties of [[PropertyList]] React component
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export type PropertyListProps = PropertyListLegacyProps | PropertyListNewProps;
|
|
73
|
+
interface PropertyListComponent {
|
|
74
|
+
/**
|
|
75
|
+
* React Component that renders struct and array properties
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
(props: PropertyListNewProps): React.JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated in 5.30. Use `PropertyList` with `editorSystem="new"` instead.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
(props: PropertyListLegacyProps): React.JSX.Element;
|
|
84
|
+
/** @public */
|
|
85
|
+
(props: PropertyListProps): React.JSX.Element;
|
|
86
|
+
}
|
|
53
87
|
/**
|
|
54
88
|
* Get unique key for property record
|
|
55
89
|
* @internal
|
|
@@ -58,10 +92,6 @@ export declare function getPropertyKey(propertyCategory: PropertyCategory, prope
|
|
|
58
92
|
/** A React component that renders multiple properties within a category as a list.
|
|
59
93
|
* @public
|
|
60
94
|
*/
|
|
61
|
-
export declare
|
|
62
|
-
|
|
63
|
-
private _listRef;
|
|
64
|
-
private _onEditCommit;
|
|
65
|
-
render(): React.JSX.Element;
|
|
66
|
-
}
|
|
95
|
+
export declare const PropertyList: PropertyListComponent;
|
|
96
|
+
export {};
|
|
67
97
|
//# sourceMappingURL=PropertyList.d.ts.map
|