@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":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,IAAI,EA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B,EAAE,KAAK,GAC3B,CACQ;QACZ,oBAAC,IAAI,QAAE,SAAS,CAAC,6BAA6B,CAAC,CAAC,WAAW,EAAE,CAAQ;QACrE,oBAAC,IAAI,CAAC,IAAI;YACR,oBAAC,eAAe,IACd,cAAc,EAAE,EAAE,EAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAClB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,KAAK,EACf,oBAAoB,EAAE,KAAK,GAC3B,CACQ,CACP,CACR,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAmB,EAAE,EAAiB;IACrE,OAAO,mCAAmC,CAAC,SAAS,CAAC;QACnD,IAAI,EACF,IAAI,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAChD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,CAAC,SAAS,EAAE;QACpD,EAAE,EACA,EAAE,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC9C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,CAAC,SAAS,EAAE;KACrD,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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../editors/EditorContainer.js\";\nimport { EditorContainer } from \"../editors/EditorContainer.js\";\nimport { Flex, Text } from \"@itwin/itwinui-react\";\nimport { PropertyFilterBuilderRuleRangeValue } from \"./FilterBuilderRangeValue.js\";\nimport type { PropertyFilterBuilderRuleOperator } from \"./Operators.js\";\nimport { useTranslation } from \"../l10n/useTranslation.js\";\nimport { PropertyRecordEditor } from \"../new-editors/interop/PropertyRecordEditor.js\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleValue]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleValueProps {\n /** Currently entered value. */\n value?: PropertyValue;\n /** Property used in rule to which this value will be compared to. */\n property: PropertyDescription;\n /** Callback that is invoked when value changes. */\n onChange: (value: PropertyValue) => void;\n /**\n * Specifies which editors system should be used: legacy or the new one.\n * @default \"legacy\"\n * @beta\n */\n editorSystem?: \"legacy\" | \"new\";\n}\n\n/**\n * Props for custom [[PropertyFilterBuilderRuleValue]] renderer.\n * @beta\n */\nexport interface PropertyFilterBuilderRuleValueRendererProps\n extends PropertyFilterBuilderRuleValueProps {\n /** Current operator. */\n operator: PropertyFilterBuilderRuleOperator;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @beta\n */\nexport function PropertyFilterBuilderRuleValue(\n props: PropertyFilterBuilderRuleValueRendererProps\n) {\n const { operator, ...restProps } = props;\n\n return operator === \"between\" || operator === \"not-between\" ? (\n <FilterBuilderRuleRangeValueRenderer {...restProps} />\n ) : (\n <FilterBuilderRulePrimitiveValueRenderer {...restProps} />\n );\n}\n\nfunction FilterBuilderRulePrimitiveValueRenderer({\n property,\n value,\n onChange,\n editorSystem,\n}: PropertyFilterBuilderRuleValueProps) {\n const propertyRecord = React.useMemo(() => {\n return new PropertyRecord(\n value ?? { valueFormat: PropertyValueFormat.Primitive },\n property\n );\n }, [value, property]);\n\n const onValueChange = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <PropertyRecordEditor\n propertyRecord={propertyRecord}\n onCancel={() => {}}\n onCommit={onValueChange}\n size=\"small\"\n editorSystem={editorSystem}\n />\n );\n}\n\nfunction FilterBuilderRuleRangeValueRenderer({\n property,\n value,\n onChange,\n}: PropertyFilterBuilderRuleValueProps) {\n const { translate } = useTranslation();\n const { from, to } = React.useMemo(() => {\n const rangeValue = PropertyFilterBuilderRuleRangeValue.parse(value);\n return {\n from: new PropertyRecord(rangeValue.from, property),\n to: new PropertyRecord(rangeValue.to, property),\n };\n }, [property, value]);\n\n const handleFromValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(newValue, to.value));\n },\n [onChange, to]\n );\n\n const handleToValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(from.value, newValue));\n },\n [onChange, from]\n );\n\n return (\n <Flex\n className=\"rule-value-range\"\n display=\"inline-flex\"\n flexDirection=\"row\"\n >\n <Flex.Item>\n <EditorContainer\n propertyRecord={from}\n onCancel={() => {}}\n onCommit={handleFromValue}\n setFocus={false}\n shouldCommitOnChange={false}\n />\n </Flex.Item>\n <Text>{translate(\"filterBuilder.operators.and\").toLowerCase()}</Text>\n <Flex.Item>\n <EditorContainer\n propertyRecord={to}\n onCancel={() => {}}\n onCommit={handleToValue}\n setFocus={false}\n shouldCommitOnChange={false}\n />\n </Flex.Item>\n </Flex>\n );\n}\n\nfunction getSerializedRangeValue(from: PropertyValue, to: PropertyValue) {\n return PropertyFilterBuilderRuleRangeValue.serialize({\n from:\n from.valueFormat === PropertyValueFormat.Primitive\n ? from\n : { valueFormat: PropertyValueFormat.Primitive },\n to:\n to.valueFormat === PropertyValueFormat.Primitive\n ? to\n : { valueFormat: PropertyValueFormat.Primitive },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilterBuilderRuleValue.js","sourceRoot":"","sources":["../../../src/components-react/filter-builder/FilterBuilderRuleValue.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM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GAAE,CAAC,EAClB,QAAQ,EAAE,eAAe;gBACzB,4DAA4D;gBAC5D,YAAY,EAAE,YAAY,GAC1B,CACQ;QACZ,oBAAC,IAAI,QAAE,SAAS,CAAC,6BAA6B,CAAC,CAAC,WAAW,EAAE,CAAQ;QACrE,oBAAC,IAAI,CAAC,IAAI;YACR,oBAAC,oBAAoB,IACnB,cAAc,EAAE,EAAE,EAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,EAClB,QAAQ,EAAE,aAAa;gBACvB,4DAA4D;gBAC5D,YAAY,EAAE,YAAY,GAC1B,CACQ,CACP,CACR,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAmB,EAAE,EAAiB;IACrE,OAAO,mCAAmC,CAAC,SAAS,CAAC;QACnD,IAAI,EACF,IAAI,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAChD,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,CAAC,SAAS,EAAE;QACpD,EAAE,EACA,EAAE,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC9C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,CAAC,SAAS,EAAE;KACrD,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 PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyUpdatedArgs } from \"../editors/EditorContainer.js\";\nimport { Flex, Text } from \"@itwin/itwinui-react\";\nimport { PropertyFilterBuilderRuleRangeValue } from \"./FilterBuilderRangeValue.js\";\nimport type { PropertyFilterBuilderRuleOperator } from \"./Operators.js\";\nimport { useTranslation } from \"../l10n/useTranslation.js\";\nimport { PropertyRecordEditor } from \"../new-editors/interop/PropertyRecordEditor.js\";\n\n/** @beta */\ninterface PropertyFilterBuilderRuleValueBaseProps {\n /** Currently entered value. */\n value?: PropertyValue;\n /** Property used in rule to which this value will be compared to. */\n property: PropertyDescription;\n /** Callback that is invoked when value changes. */\n onChange: (value: PropertyValue) => void;\n}\n\n/** @beta */\ninterface PropertyFilterBuilderRuleValueLegacyProps\n extends PropertyFilterBuilderRuleValueBaseProps {\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/** @beta */\ninterface PropertyFilterBuilderRuleValueNewProps\n extends PropertyFilterBuilderRuleValueBaseProps {\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 * Props for [[PropertyFilterBuilderRuleValue]] component.\n * @beta\n * @deprecated in 5.30.0. Use `React.ComponentProps<typeof PropertyFilterBuilderRuleValue>` instead.\n */\nexport type PropertyFilterBuilderRuleValueProps =\n | PropertyFilterBuilderRuleValueLegacyProps\n | PropertyFilterBuilderRuleValueNewProps;\n\n/**\n * Props for custom [[PropertyFilterBuilderRuleValue]] renderer.\n * @beta\n */\nexport type PropertyFilterBuilderRuleValueRendererProps =\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n PropertyFilterBuilderRuleValueProps & {\n /** Current operator. */\n operator: PropertyFilterBuilderRuleOperator;\n };\n\ninterface PropertyFilterBuilderRuleValueComponent {\n /**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @beta\n */\n (\n props: PropertyFilterBuilderRuleValueNewProps & {\n /** Current operator. */\n operator: PropertyFilterBuilderRuleOperator;\n }\n ): React.JSX.Element;\n /**\n * @deprecated in 5.30. Use `PropertyFilterBuilderRuleValue` with `editorSystem=\"new\"` instead.\n * @beta\n */\n (\n props: PropertyFilterBuilderRuleValueLegacyProps & {\n /** Current operator. */\n operator: PropertyFilterBuilderRuleOperator;\n }\n ): React.JSX.Element;\n /** @beta */\n (props: PropertyFilterBuilderRuleValueRendererProps): React.JSX.Element;\n}\n\n/**\n * Component that renders [[PropertyFilterBuilderRuleRenderer]] value input.\n * @beta\n */\nexport const PropertyFilterBuilderRuleValue: PropertyFilterBuilderRuleValueComponent =\n (props: PropertyFilterBuilderRuleValueRendererProps) => {\n const { operator, ...restProps } = props;\n\n return operator === \"between\" || operator === \"not-between\" ? (\n <FilterBuilderRuleRangeValueRenderer {...restProps} />\n ) : (\n <FilterBuilderRulePrimitiveValueRenderer {...restProps} />\n );\n };\n\nfunction FilterBuilderRulePrimitiveValueRenderer({\n property,\n value,\n onChange,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem,\n}: // eslint-disable-next-line @typescript-eslint/no-deprecated\nPropertyFilterBuilderRuleValueProps) {\n const propertyRecord = React.useMemo(() => {\n return new PropertyRecord(\n value ?? { valueFormat: PropertyValueFormat.Primitive },\n property\n );\n }, [value, property]);\n\n const onValueChange = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <PropertyRecordEditor\n propertyRecord={propertyRecord}\n onCancel={() => {}}\n onCommit={onValueChange}\n size=\"small\"\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={editorSystem}\n />\n );\n}\n\nfunction FilterBuilderRuleRangeValueRenderer({\n property,\n value,\n onChange,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem,\n}: // eslint-disable-next-line @typescript-eslint/no-deprecated\nPropertyFilterBuilderRuleValueProps) {\n const { translate } = useTranslation();\n const { from, to } = React.useMemo(() => {\n const rangeValue = PropertyFilterBuilderRuleRangeValue.parse(value);\n return {\n from: new PropertyRecord(rangeValue.from, property),\n to: new PropertyRecord(rangeValue.to, property),\n };\n }, [property, value]);\n\n const handleFromValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(newValue, to.value));\n },\n [onChange, to]\n );\n\n const handleToValue = React.useCallback(\n ({ newValue }: PropertyUpdatedArgs) => {\n onChange(getSerializedRangeValue(from.value, newValue));\n },\n [onChange, from]\n );\n\n return (\n <Flex\n className=\"rule-value-range\"\n display=\"inline-flex\"\n flexDirection=\"row\"\n >\n <Flex.Item>\n <PropertyRecordEditor\n propertyRecord={from}\n onCancel={() => {}}\n onCommit={handleFromValue}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={editorSystem}\n />\n </Flex.Item>\n <Text>{translate(\"filterBuilder.operators.and\").toLowerCase()}</Text>\n <Flex.Item>\n <PropertyRecordEditor\n propertyRecord={to}\n onCancel={() => {}}\n onCommit={handleToValue}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem={editorSystem}\n />\n </Flex.Item>\n </Flex>\n );\n}\n\nfunction getSerializedRangeValue(from: PropertyValue, to: PropertyValue) {\n return PropertyFilterBuilderRuleRangeValue.serialize({\n from:\n from.valueFormat === PropertyValueFormat.Primitive\n ? from\n : { valueFormat: PropertyValueFormat.Primitive },\n to:\n to.valueFormat === PropertyValueFormat.Primitive\n ? to\n : { valueFormat: PropertyValueFormat.Primitive },\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrimitiveValue } from "@itwin/appui-abstract";
|
|
2
2
|
import type { Value as NewEditorValue } from "../values/Values.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PropertyRecordEditorMetadata } from "./Metadata.js";
|
|
4
4
|
import type { PropertyRecordWithConstraints, WithConstraints } from "../ConstraintUtils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Interop utilities for converting between old and new editor values.
|
|
@@ -9,7 +9,7 @@ import type { PropertyRecordWithConstraints, WithConstraints } from "../Constrai
|
|
|
9
9
|
export declare namespace EditorInterop {
|
|
10
10
|
/** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */
|
|
11
11
|
function getMetadataAndValue(propertyRecord: PropertyRecordWithConstraints): {
|
|
12
|
-
metadata: WithConstraints<
|
|
12
|
+
metadata: WithConstraints<PropertyRecordEditorMetadata> | undefined;
|
|
13
13
|
value: NewEditorValue | undefined;
|
|
14
14
|
};
|
|
15
15
|
/** Converts new editors system `Value` into old `PrimitiveValue` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUxE,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"EditorInterop.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUxE,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAQlE,OAAO,KAAK,EACV,6BAA6B,EAC7B,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,yBAAiB,aAAa,CAAC;IAC7B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAAc,EAAE,6BAA6B,GAC5C;QACD,QAAQ,EAAE,eAAe,CAAC,4BAA4B,CAAC,GAAG,SAAS,CAAC;QACpE,KAAK,EAAE,cAAc,GAAG,SAAS,CAAC;KACnC,CAoGA;IAED,oEAAoE;IACpE,SAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,GACvB,cAAc,CAuChB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,KAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"EditorInterop.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/EditorInterop.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAW5D,OAAO,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,KAAW,aAAa,CAwJ7B;AAxJD,WAAiB,aAAa;IAC5B,6EAA6E;IAC7E,SAAgB,mBAAmB,CACjC,cAA6C;QAK7C,MAAM,YAAY,GAGd;YACF,eAAe,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI;YACrD,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM;YAC9C,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI;YAClC,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ;YAC1C,4DAA4D;YAC5D,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,YAAY;YAClD,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC,WAAW;SACjD,CAAC;QAEF,MAAM,cAAc,GAAG,cAAc,CAAC,KAAuB,CAAC;QAC9D,QAAQ,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAA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J,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,SAAS;gBAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;aACxC,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,SAAS;gBAC1C,KAAK,EAAE,QAAQ,CAAC,MAAM;aACvB,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAzCe,qCAAuB,0BAyCtC,CAAA;AACH,CAAC,EAxJgB,aAAa,KAAb,aAAa,QAwJ7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { Primitives, PrimitiveValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n BooleanValue,\n DateValue,\n EnumValue,\n InstanceKeyValue,\n NumericValue,\n TextValue,\n} from \"../values/Values.js\";\nimport type { Value as NewEditorValue } from \"../values/Values.js\";\nimport type { PropertyRecordEditorMetadata } from \"./Metadata.js\";\nimport {\n isBoolean,\n isDate,\n isEnum,\n isNumeric,\n isText,\n} from \"../values/ValueUtilities.js\";\nimport type {\n PropertyRecordWithConstraints,\n WithConstraints,\n} from \"../ConstraintUtils.js\";\n\n/**\n * Interop utilities for converting between old and new editor values.\n * @internal\n */\nexport namespace EditorInterop {\n /** Attempts to convert `PropertyRecord` into `ValueMetadata` and `Value`. */\n export function getMetadataAndValue(\n propertyRecord: PropertyRecordWithConstraints\n ): {\n metadata: WithConstraints<PropertyRecordEditorMetadata> | undefined;\n value: NewEditorValue | undefined;\n } {\n const baseMetadata: Omit<\n WithConstraints<PropertyRecordEditorMetadata>,\n \"type\"\n > = {\n preferredEditor: propertyRecord.property.editor?.name,\n params: propertyRecord.property.editor?.params,\n extendedData: propertyRecord.extendedData,\n enum: propertyRecord.property.enum,\n typename: propertyRecord.property.typename,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n quantityType: propertyRecord.property.quantityType,\n constraints: propertyRecord.property.constraints,\n };\n\n const primitiveValue = propertyRecord.value as PrimitiveValue;\n switch (propertyRecord.property.typename) {\n case \"text\":\n case \"string\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"string\",\n },\n value: {\n value: (primitiveValue.value as string) ?? \"\",\n } satisfies TextValue,\n };\n case \"dateTime\":\n case \"shortdate\":\n return {\n metadata: {\n ...baseMetadata,\n type:\n propertyRecord.property.typename === \"shortdate\"\n ? \"date\"\n : \"dateTime\",\n },\n value: {\n value: (primitiveValue.value as Date) ?? new Date(),\n } satisfies DateValue,\n };\n case \"boolean\":\n case \"bool\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"bool\",\n },\n value: {\n value: (primitiveValue.value as boolean) ?? false,\n } satisfies BooleanValue,\n };\n case \"float\":\n case \"double\":\n case \"int\":\n case \"integer\":\n case \"number\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"number\",\n },\n value: {\n rawValue: primitiveValue.value as number,\n displayValue: primitiveValue.displayValue\n ? primitiveValue.displayValue\n : primitiveValue.value !== undefined\n ? `${primitiveValue.value as number}`\n : \"\",\n roundingError: primitiveValue.roundingError,\n } satisfies NumericValue,\n };\n case \"enum\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"enum\",\n },\n value: {\n choice: primitiveValue.value as number | string,\n } satisfies EnumValue,\n };\n case \"navigation\":\n return {\n metadata: {\n ...baseMetadata,\n type: \"instanceKey\",\n },\n value: {\n key: primitiveValue.value as Primitives.InstanceKey,\n label: primitiveValue.displayValue ?? \"\",\n } satisfies InstanceKeyValue,\n };\n }\n\n return {\n metadata: undefined,\n value: undefined,\n };\n }\n\n /** Converts new editors system `Value` into old `PrimitiveValue` */\n export function convertToPrimitiveValue(\n newValue: NewEditorValue\n ): PrimitiveValue {\n if (isText(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value,\n };\n }\n if (isNumeric(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.rawValue,\n displayValue: newValue.displayValue,\n roundingError: newValue.roundingError,\n };\n }\n if (isBoolean(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n if (isDate(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.value,\n displayValue: newValue.value.toString(),\n };\n }\n\n if (isEnum(newValue)) {\n return {\n valueFormat: PropertyValueFormat.Primitive,\n value: newValue.choice,\n };\n }\n\n throw new Error(\"Unsupported value type\");\n }\n}\n"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyEditors
|
|
3
|
+
*/
|
|
1
4
|
import type { EnumerationChoicesInfo, PropertyEditorParams } from "@itwin/appui-abstract";
|
|
2
5
|
import type { ValueMetadata } from "../values/Metadata.js";
|
|
3
6
|
/**
|
|
4
|
-
* Metadata that is created by mapping `PropertyRecord`
|
|
5
|
-
* @
|
|
7
|
+
* Metadata that is created by mapping `PropertyRecord` into the editor metadata.
|
|
8
|
+
* @beta
|
|
6
9
|
*/
|
|
7
|
-
export interface
|
|
10
|
+
export interface PropertyRecordEditorMetadata extends ValueMetadata {
|
|
8
11
|
params?: PropertyEditorParams[];
|
|
9
12
|
extendedData?: {
|
|
10
13
|
[key: string]: unknown;
|
|
@@ -14,8 +17,8 @@ export interface OldEditorMetadata extends ValueMetadata {
|
|
|
14
17
|
typename: string;
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
|
-
* Type guard for `
|
|
18
|
-
* @
|
|
20
|
+
* Type guard for `PropertyRecordEditorMetadata`.
|
|
21
|
+
* @beta
|
|
19
22
|
*/
|
|
20
|
-
export declare function
|
|
23
|
+
export declare function isPropertyRecordEditorMetadata(metadata: ValueMetadata): metadata is PropertyRecordEditorMetadata;
|
|
21
24
|
//# sourceMappingURL=Metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,aAAa;IACjE,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,aAAa,GACtB,QAAQ,IAAI,4BAA4B,CAE1C"}
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyEditors
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
|
-
* Type guard for `
|
|
7
|
-
* @
|
|
9
|
+
* Type guard for `PropertyRecordEditorMetadata`.
|
|
10
|
+
* @beta
|
|
8
11
|
*/
|
|
9
|
-
export function
|
|
12
|
+
export function isPropertyRecordEditorMetadata(metadata) {
|
|
10
13
|
return metadata.typename !== undefined;
|
|
11
14
|
}
|
|
12
15
|
/* v8 ignore stop */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/Metadata.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAsBH;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAAuB;IAEvB,OAAQ,QAAyC,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC3E,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/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport type {\n EnumerationChoicesInfo,\n PropertyEditorParams,\n} from \"@itwin/appui-abstract\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\n\n/* v8 ignore start */\n\n/**\n * Metadata that is created by mapping `PropertyRecord` into the editor metadata.\n * @beta\n */\nexport interface PropertyRecordEditorMetadata extends ValueMetadata {\n params?: PropertyEditorParams[];\n extendedData?: { [key: string]: unknown };\n enum?: EnumerationChoicesInfo;\n quantityType?: string;\n typename: string;\n}\n\n/**\n * Type guard for `PropertyRecordEditorMetadata`.\n * @beta\n */\nexport function isPropertyRecordEditorMetadata(\n metadata: ValueMetadata\n): metadata is PropertyRecordEditorMetadata {\n return (metadata as PropertyRecordEditorMetadata).typename !== undefined;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -7,20 +7,45 @@ import { type PropertyUpdatedArgs } from "../../editors/EditorContainer.js";
|
|
|
7
7
|
import type { ValueMetadata } from "../values/Metadata.js";
|
|
8
8
|
import type { Value } from "../values/Values.js";
|
|
9
9
|
import type { WithConstraints } from "../ConstraintUtils.js";
|
|
10
|
-
interface
|
|
10
|
+
interface PropertyRecordEditorBaseProps {
|
|
11
11
|
propertyRecord: PropertyRecord;
|
|
12
12
|
onCommit: (args: PropertyUpdatedArgs) => void;
|
|
13
13
|
onCancel: () => void;
|
|
14
14
|
onClick?: () => void;
|
|
15
15
|
setFocus?: boolean;
|
|
16
16
|
size?: "small" | "large";
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
interface PropertyRecordEditorLegacyProps extends PropertyRecordEditorBaseProps {
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem="new"` instead. This is provided only in case
|
|
21
|
+
* there is a need to switch back to the legacy editor system.
|
|
22
|
+
*/
|
|
23
|
+
editorSystem?: "legacy";
|
|
24
|
+
}
|
|
25
|
+
interface PropertyRecordEditorNewProps extends PropertyRecordEditorBaseProps {
|
|
26
|
+
editorSystem: "new";
|
|
27
|
+
}
|
|
28
|
+
type PropertyRecordEditorProps = PropertyRecordEditorLegacyProps | PropertyRecordEditorNewProps;
|
|
29
|
+
interface PropertyRecordEditorComponent {
|
|
30
|
+
/**
|
|
31
|
+
* Editor component for editing property values represented by `PropertyRecord`.
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
(props: PropertyRecordEditorNewProps): React.JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem="new"` instead. This is provided only in case
|
|
37
|
+
* there is a need to switch back to the legacy editor system.
|
|
38
|
+
* @beta
|
|
39
|
+
*/
|
|
40
|
+
(props: PropertyRecordEditorLegacyProps): React.JSX.Element;
|
|
41
|
+
/** @beta */
|
|
42
|
+
(props: PropertyRecordEditorProps): React.JSX.Element;
|
|
18
43
|
}
|
|
19
44
|
/**
|
|
20
45
|
* Editor component for editing property values represented by `PropertyRecord`.
|
|
21
46
|
* @beta
|
|
22
47
|
*/
|
|
23
|
-
export declare
|
|
48
|
+
export declare const PropertyRecordEditor: PropertyRecordEditorComponent;
|
|
24
49
|
/** @internal */
|
|
25
50
|
export declare function CommittingEditor({ metadata, initialValue, onCancel, onCommit, onClick, disabled, size, id, }: {
|
|
26
51
|
metadata: WithConstraints<ValueMetadata>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRecordEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,UAAU,
|
|
1
|
+
{"version":3,"file":"PropertyRecordEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC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,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,qBA0BA"}
|
|
@@ -15,7 +15,9 @@ import { EditorRenderer } from "../EditorRenderer.js";
|
|
|
15
15
|
* Editor component for editing property values represented by `PropertyRecord`.
|
|
16
16
|
* @beta
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export const PropertyRecordEditor = ({ propertyRecord, onCommit, onCancel, onClick, setFocus, size,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
20
|
+
editorSystem, }) => {
|
|
19
21
|
const { metadata, value } = EditorInterop.getMetadataAndValue(propertyRecord);
|
|
20
22
|
if (editorSystem === "new" && metadata && value) {
|
|
21
23
|
return (React.createElement(CommittingEditor, { metadata: metadata, initialValue: value, onCommit: (newValue) => {
|
|
@@ -27,8 +29,10 @@ export function PropertyRecordEditor({ propertyRecord, onCommit, onCancel, onCli
|
|
|
27
29
|
});
|
|
28
30
|
}, onCancel: onCancel, onClick: onClick, disabled: propertyRecord.isDisabled || propertyRecord.isReadonly, size: size, id: propertyRecord.property.name }));
|
|
29
31
|
}
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
+
return (
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
34
|
+
React.createElement(EditorContainer, { propertyRecord: propertyRecord, onCommit: onCommit, onCancel: onCancel, onClick: onClick, setFocus: setFocus }));
|
|
35
|
+
};
|
|
32
36
|
/** @internal */
|
|
33
37
|
export function CommittingEditor({ metadata, initialValue, onCancel, onCommit, onClick, disabled, size, id, }) {
|
|
34
38
|
const { value, onChange, onKeydown, commit, cancel } = useCommittableValue({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRecordEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,eAAe,GAEhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyRecordEditor.js","sourceRoot":"","sources":["../../../../src/components-react/new-editors/interop/PropertyRecordEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,eAAe,GAEhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA+CtD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkC,CAAC,EAClE,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,IAAI;AACJ,4DAA4D;AAC5D,YAAY,GACc,EAAE,EAAE;IAC9B,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAC9E,IAAI,YAAY,KAAK,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;QAChD,OAAO,CACL,oBAAC,gBAAgB,IACf,QAAQ,EAAE,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,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,GACN,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport * as React from \"react\";\nimport {\n type PropertyRecord,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { EditorInterop } from \"./EditorInterop.js\";\nimport {\n EditorContainer,\n type PropertyUpdatedArgs,\n} from \"../../editors/EditorContainer.js\";\nimport { useCommittableValue } from \"../UseCommittableValue.js\";\nimport { EditorRenderer } from \"../EditorRenderer.js\";\nimport type { ValueMetadata } from \"../values/Metadata.js\";\nimport type { Value } from \"../values/Values.js\";\nimport type { WithConstraints } from \"../ConstraintUtils.js\";\n\ninterface PropertyRecordEditorBaseProps {\n propertyRecord: PropertyRecord;\n onCommit: (args: PropertyUpdatedArgs) => void;\n onCancel: () => void;\n onClick?: () => void;\n setFocus?: boolean;\n size?: \"small\" | \"large\";\n}\n\ninterface PropertyRecordEditorLegacyProps\n extends PropertyRecordEditorBaseProps {\n /**\n * @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem=\"new\"` instead. This is provided only in case\n * there is a need to switch back to the legacy editor system.\n */\n editorSystem?: \"legacy\";\n}\n\ninterface PropertyRecordEditorNewProps extends PropertyRecordEditorBaseProps {\n editorSystem: \"new\";\n}\n\ntype PropertyRecordEditorProps =\n | PropertyRecordEditorLegacyProps\n | PropertyRecordEditorNewProps;\n\ninterface PropertyRecordEditorComponent {\n /**\n * Editor component for editing property values represented by `PropertyRecord`.\n * @beta\n */\n (props: PropertyRecordEditorNewProps): React.JSX.Element;\n /**\n * @deprecated in 5.30. Use `PropertyRecordEditor` with `editorSystem=\"new\"` instead. This is provided only in case\n * there is a need to switch back to the legacy editor system.\n * @beta\n */\n (props: PropertyRecordEditorLegacyProps): React.JSX.Element;\n /** @beta */\n (props: PropertyRecordEditorProps): React.JSX.Element;\n}\n\n/**\n * Editor component for editing property values represented by `PropertyRecord`.\n * @beta\n */\nexport const PropertyRecordEditor: PropertyRecordEditorComponent = ({\n propertyRecord,\n onCommit,\n onCancel,\n onClick,\n setFocus,\n size,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n editorSystem,\n}: PropertyRecordEditorProps) => {\n const { metadata, value } = EditorInterop.getMetadataAndValue(propertyRecord);\n if (editorSystem === \"new\" && metadata && value) {\n return (\n <CommittingEditor\n metadata={metadata}\n initialValue={value}\n onCommit={(newValue) => {\n onCommit({\n propertyRecord,\n newValue:\n newValue === undefined\n ? { valueFormat: PropertyValueFormat.Primitive }\n : EditorInterop.convertToPrimitiveValue(newValue),\n });\n }}\n onCancel={onCancel}\n onClick={onClick}\n disabled={propertyRecord.isDisabled || propertyRecord.isReadonly}\n size={size}\n id={propertyRecord.property.name}\n />\n );\n }\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <EditorContainer\n propertyRecord={propertyRecord}\n onCommit={onCommit}\n onCancel={onCancel}\n onClick={onClick}\n setFocus={setFocus}\n />\n );\n};\n\n/** @internal */\nexport function CommittingEditor({\n metadata,\n initialValue,\n onCancel,\n onCommit,\n onClick,\n disabled,\n size,\n id,\n}: {\n metadata: WithConstraints<ValueMetadata>;\n initialValue?: Value;\n onCommit: (value?: Value) => void;\n onCancel: () => void;\n onClick?: () => void;\n disabled?: boolean;\n size?: \"small\" | \"large\";\n id?: string;\n}) {\n const { value, onChange, onKeydown, commit, cancel } = useCommittableValue({\n initialValue,\n onCommit,\n onCancel,\n });\n\n return (\n <div\n onKeyDown={onKeydown}\n onBlur={commit}\n onClick={onClick}\n role=\"presentation\"\n >\n <EditorRenderer\n metadata={metadata}\n value={value}\n onChange={onChange}\n commit={commit}\n cancel={cancel}\n disabled={disabled}\n size={size}\n id={id}\n />\n </div>\n );\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import { PropertyEditorParamTypes, StandardEditorNames, } from "@itwin/appui-abstract";
|
|
7
7
|
import { ColorPalette, ColorPicker, ColorSwatch, ColorValue, IconButton, Popover, } from "@itwin/itwinui-react";
|
|
8
8
|
import { createEditorSpec } from "../../Types.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
10
10
|
import { useColorEditorParams } from "./UseEditorParams.js";
|
|
11
11
|
import { isNumeric } from "../../values/ValueUtilities.js";
|
|
12
12
|
/* v8 ignore start */
|
|
@@ -15,7 +15,7 @@ import { isNumeric } from "../../values/ValueUtilities.js";
|
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export const ColorEditorSpec = createEditorSpec({
|
|
18
|
-
isMetadataSupported: (metadata) =>
|
|
18
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
19
19
|
metadata.type === "number" &&
|
|
20
20
|
!!metadata.params?.find((param) => param.type === PropertyEditorParamTypes.ColorData.valueOf()) &&
|
|
21
21
|
metadata.preferredEditor === StandardEditorNames.ColorPicker,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Color.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Color.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,qBAAqB;AAErB;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAe,gBAAgB,CAAC;IAC1D,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,SAAS,CAAC,OAAO,EAAE,CACvE;QACD,QAAQ,CAAC,eAAe,KAAK,mBAAmB,CAAC,WAAW;IAC9D,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,EACnB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,EAAE,GACsD;IACxD,MAAM,WAAW,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,WAAW,EAAE,WAAW,IAAI,EAAE,CAAC;IAE9C,MAAM,YAAY,GAAG,KAAK;QACxB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,MAAM,WAAW,GACf,YAAY,CAAC,QAAQ,KAAK,SAAS;QACjC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;QAC5C,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEpB,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAE,EAAE;QAC3C,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,OAAO,IACN,OAAO,EACL,oBAAC,WAAW,IACV,aAAa,EAAE,WAAW,EAC1B,gBAAgB,EAAE,cAAc;YAEhC,oBAAC,YAAY,IAAC,MAAM,EAAE,UAAU,GAAI,CACxB,EAEhB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,EAAE,EAAE,CAAC;YACb,CAAC;QACH,CAAC;QAED,oBAAC,UAAU,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI;YAC5B,oBAAC,WAAW,IAAC,KAAK,EAAE,WAAW,GAAI,CACxB,CACL,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 {\n PropertyEditorParamTypes,\n StandardEditorNames,\n} from \"@itwin/appui-abstract\";\nimport {\n ColorPalette,\n ColorPicker,\n ColorSwatch,\n ColorValue,\n IconButton,\n Popover,\n} from \"@itwin/itwinui-react\";\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 { useColorEditorParams } from \"./UseEditorParams.js\";\nimport { isNumeric } from \"../../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/**\n * Editor specification for color editor.\n * @internal\n */\nexport const ColorEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"number\" &&\n !!metadata.params?.find(\n (param) => param.type === PropertyEditorParamTypes.ColorData.valueOf()\n ) &&\n metadata.preferredEditor === StandardEditorNames.ColorPicker,\n isValueSupported: isNumeric,\n Editor: ColorEditor,\n});\n\nfunction ColorEditor({\n value,\n metadata,\n onChange,\n commit,\n size,\n id,\n}: EditorProps<PropertyRecordEditorMetadata, NumericValue>) {\n const colorParams = useColorEditorParams(metadata);\n const colors = colorParams?.colorValues ?? [];\n\n const currentValue = value\n ? value\n : { rawValue: colors[0], displayValue: \"\" };\n const colorsList = colors.map((color) => ColorValue.fromTbgr(color));\n const activeColor =\n currentValue.rawValue !== undefined\n ? ColorValue.fromTbgr(currentValue.rawValue)\n : colorsList[0];\n\n const onColorChanged = (color: ColorValue) => {\n onChange({ rawValue: color.toTbgr(), displayValue: \"\" });\n };\n\n return (\n <Popover\n content={\n <ColorPicker\n selectedColor={activeColor}\n onChangeComplete={onColorChanged}\n >\n <ColorPalette colors={colorsList} />\n </ColorPicker>\n }\n onVisibleChange={(visible) => {\n if (!visible) {\n commit?.();\n }\n }}\n >\n <IconButton id={id} size={size}>\n <ColorSwatch color={activeColor} />\n </IconButton>\n </Popover>\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { EditorProps } from "../../Types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PropertyRecordEditorMetadata } from "../Metadata.js";
|
|
4
4
|
import type { NumericValue } from "../../values/Values.js";
|
|
5
5
|
import type { WithConstraints } from "../../ConstraintUtils.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare const CustomNumberEditorSpec: import("../../Types.js").EditorSpec;
|
|
8
|
-
interface CustomNumberEditorProps extends EditorProps<WithConstraints<
|
|
8
|
+
interface CustomNumberEditorProps extends EditorProps<WithConstraints<PropertyRecordEditorMetadata>, NumericValue> {
|
|
9
9
|
decoration?: React.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumber.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/CustomNumber.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CustomNumber.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/CustomNumber.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQ3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOhE,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,qCAWjC,CAAC;AAEH,UAAU,uBACR,SAAQ,WAAW,CACjB,eAAe,CAAC,4BAA4B,CAAC,EAC7C,YAAY,CACb;IACD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,EAAE,GACH,EAAE,uBAAuB,4BAiEzB"}
|
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
import { PropertyEditorParamTypes, StandardEditorNames, } from "@itwin/appui-abstract";
|
|
7
7
|
import { InputWithDecorations } from "@itwin/itwinui-react";
|
|
8
8
|
import { createEditorSpec } from "../../Types.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
10
10
|
import { useCustomFormattedNumberParams, useIconEditorParams, useInputEditorSizeParams, } from "./UseEditorParams.js";
|
|
11
11
|
import { findIcon } from "../IconsRegistry.js";
|
|
12
12
|
import { isNumeric } from "../../values/ValueUtilities.js";
|
|
@@ -14,7 +14,7 @@ import { applyNumericConstraints, getNumericConstraints, } from "../../Constrain
|
|
|
14
14
|
/* v8 ignore start */
|
|
15
15
|
/** @internal */
|
|
16
16
|
export const CustomNumberEditorSpec = createEditorSpec({
|
|
17
|
-
isMetadataSupported: (metadata) =>
|
|
17
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
18
18
|
metadata.type === "number" &&
|
|
19
19
|
!!metadata.params?.find((param) => param.type === PropertyEditorParamTypes.CustomFormattedNumber.valueOf()) &&
|
|
20
20
|
metadata.preferredEditor === StandardEditorNames.NumberCustom,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomNumber.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/CustomNumber.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CustomNumber.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/CustomNumber.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,qBAAqB;AAErB,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;IACrD,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,CACR,KAAK,CAAC,IAAI,KAAK,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,QAAQ,KAAK,SAAS;QAC5C,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,YAAY,GAAG,CAAC,CAAsC,EAAE,EAAE;QAC9D,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QACpC,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QACxD,MAAM,WAAW,GACf,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;YAC9B,CAAC,CAAC,uBAAuB,CAAC;gBACtB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC9C,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC;YACJ,CAAC,CAAC,SAAS,CAAC;QAEhB,aAAa,CAAC,YAAY,CAAC,CAAC;QAE5B,QAAQ,CAAC;YACP,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE,YAAY;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,oBAAoB,IAAC,IAAI,EAAE,IAAI;QAC7B,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CACpB,oBAAC,oBAAoB,CAAC,IAAI,QAAE,IAAI,CAA6B,CAC9D,CAAC,CAAC,CAAC,IAAI;QACR,oBAAC,oBAAoB,CAAC,KAAK,IACzB,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,UAAU,GACjB;QACD,UAAU,CACU,CACxB,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 {\n PropertyEditorParamTypes,\n StandardEditorNames,\n} from \"@itwin/appui-abstract\";\nimport { InputWithDecorations } from \"@itwin/itwinui-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 {\n useCustomFormattedNumberParams,\n useIconEditorParams,\n useInputEditorSizeParams,\n} from \"./UseEditorParams.js\";\nimport { findIcon } from \"../IconsRegistry.js\";\nimport { isNumeric } from \"../../values/ValueUtilities.js\";\nimport type { WithConstraints } from \"../../ConstraintUtils.js\";\nimport {\n applyNumericConstraints,\n getNumericConstraints,\n} from \"../../ConstraintUtils.js\";\n/* v8 ignore start */\n\n/** @internal */\nexport const CustomNumberEditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"number\" &&\n !!metadata.params?.find(\n (param) =>\n param.type === PropertyEditorParamTypes.CustomFormattedNumber.valueOf()\n ) &&\n metadata.preferredEditor === StandardEditorNames.NumberCustom,\n isValueSupported: isNumeric,\n Editor: CustomNumberEditor,\n});\n\ninterface CustomNumberEditorProps\n extends EditorProps<\n WithConstraints<PropertyRecordEditorMetadata>,\n NumericValue\n > {\n decoration?: React.ReactNode;\n}\n\n/** @internal */\nexport function CustomNumberEditor({\n metadata,\n value,\n onChange,\n size,\n disabled,\n decoration,\n id,\n}: CustomNumberEditorProps) {\n const formatParams = useCustomFormattedNumberParams(metadata);\n const sizeParams = useInputEditorSizeParams(metadata);\n const iconParams = useIconEditorParams(metadata);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const [inputValue, setInputValue] = React.useState(() => {\n return value?.rawValue !== undefined && formatParams\n ? formatParams.formatFunction(value.rawValue)\n : \"\";\n });\n\n if (!formatParams) {\n return null;\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 const icon =\n iconParams?.definition?.iconSpec !== undefined\n ? findIcon(iconParams.definition.iconSpec)\n : undefined;\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const currentValue = e.target.value;\n const result = formatParams.parseFunction(currentValue);\n const parsedValue =\n typeof result.value === \"number\"\n ? applyNumericConstraints({\n ...getNumericConstraints(metadata.constraints),\n value: result.value,\n })\n : undefined;\n\n setInputValue(currentValue);\n\n onChange({\n rawValue: parsedValue,\n displayValue: currentValue,\n });\n };\n\n return (\n <InputWithDecorations size={size}>\n {icon !== undefined ? (\n <InputWithDecorations.Icon>{icon}</InputWithDecorations.Icon>\n ) : null}\n <InputWithDecorations.Input\n id={id}\n ref={inputRef}\n style={style}\n disabled={disabled}\n onChange={handleChange}\n value={inputValue}\n />\n {decoration}\n </InputWithDecorations>\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { createEditorSpec, } from "../../Types.js";
|
|
7
7
|
import { EnumEditor as NewEnumEditor } from "../../editors/EnumEditor.js";
|
|
8
|
-
import {
|
|
8
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
9
9
|
import { useEnumMetadata } from "./UseEnumMetadata.js";
|
|
10
10
|
import { isEnum } from "../../values/ValueUtilities.js";
|
|
11
11
|
/* v8 ignore start */
|
|
12
12
|
/** @internal */
|
|
13
13
|
export const EnumEditorSpec = createEditorSpec({
|
|
14
|
-
isMetadataSupported: (metadata) =>
|
|
14
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) && metadata.type === "enum",
|
|
15
15
|
isValueSupported: isEnum,
|
|
16
16
|
Editor: EnumEditor,
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Enum.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Enum.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,gBAAgB,GAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Enum.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/Enum.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,gBAAgB,GAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,qBAAqB;AAErB,gBAAgB;AAChB,MAAM,CAAC,MAAM,cAAc,GAAe,gBAAgB,CAAC;IACzD,mBAAmB,EAAE,CAAC,QAAQ,EAA4C,EAAE,CAC1E,8BAA8B,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM;IACtE,gBAAgB,EAAE,MAAM;IACxB,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC;AAEH,SAAS,UAAU,CACjB,KAA2D;IAE3D,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpD,OAAO,oBAAC,aAAa,OAAK,KAAK,EAAE,QAAQ,EAAE,WAAW,GAAI,CAAC;AAC7D,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 {\n createEditorSpec,\n type EditorProps,\n type EditorSpec,\n} from \"../../Types.js\";\nimport { EnumEditor as NewEnumEditor } from \"../../editors/EnumEditor.js\";\nimport type { PropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport { isPropertyRecordEditorMetadata } from \"../Metadata.js\";\nimport type { EnumValue } from \"../../values/Values.js\";\nimport { useEnumMetadata } from \"./UseEnumMetadata.js\";\nimport { isEnum } from \"../../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/** @internal */\nexport const EnumEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) && metadata.type === \"enum\",\n isValueSupported: isEnum,\n Editor: EnumEditor,\n});\n\nfunction EnumEditor(\n props: EditorProps<PropertyRecordEditorMetadata, EnumValue>\n) {\n const newMetadata = useEnumMetadata(props.metadata);\n return <NewEnumEditor {...props} metadata={newMetadata} />;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { StandardEditorNames, } from "@itwin/appui-abstract";
|
|
7
7
|
import { createEditorSpec } from "../../Types.js";
|
|
8
|
-
import {
|
|
8
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
9
9
|
import { useEnumMetadata } from "./UseEnumMetadata.js";
|
|
10
10
|
import { useButtonGroupEditorParams } from "./UseEditorParams.js";
|
|
11
11
|
import { ButtonGroup, IconButton } from "@itwin/itwinui-react";
|
|
@@ -14,7 +14,7 @@ import { isEnum } from "../../values/ValueUtilities.js";
|
|
|
14
14
|
/* v8 ignore start */
|
|
15
15
|
/** @internal */
|
|
16
16
|
export const EnumButtonGroupEditorSpec = createEditorSpec({
|
|
17
|
-
isMetadataSupported: (metadata) =>
|
|
17
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
18
18
|
metadata.type === "enum" &&
|
|
19
19
|
metadata.preferredEditor === StandardEditorNames.EnumButtonGroup,
|
|
20
20
|
isValueSupported: isEnum,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumButtonGroup.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/EnumButtonGroup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"EnumButtonGroup.js","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/EnumButtonGroup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,qBAAqB;AAErB,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAe,gBAAgB,CAAC;IACpE,mBAAmB,EAAE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G,EAAE;gBACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBACnC,MAAM,EAAE,EAAE,CAAC;YACb,CAAC,EACD,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,QAAQ,EAAE,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,MAAM,EAC9C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,IAEjB,IAAI,CACM,CACd,CAAC;IACJ,CAAC,CAAC,CACU,CACf,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,OAA4B,EAC5B,MAA+B;IAE/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { ButtonGroupEditorParams } from \"@itwin/appui-abstract\";\nimport {\n type EnumerationChoice,\n StandardEditorNames,\n} 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 { EnumValue } from \"../../values/Values.js\";\nimport { useEnumMetadata } from \"./UseEnumMetadata.js\";\nimport { useButtonGroupEditorParams } from \"./UseEditorParams.js\";\nimport { ButtonGroup, IconButton } from \"@itwin/itwinui-react\";\nimport { findIcon } from \"../IconsRegistry.js\";\nimport { isEnum } from \"../../values/ValueUtilities.js\";\n\n/* v8 ignore start */\n\n/** @internal */\nexport const EnumButtonGroupEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is PropertyRecordEditorMetadata =>\n isPropertyRecordEditorMetadata(metadata) &&\n metadata.type === \"enum\" &&\n metadata.preferredEditor === StandardEditorNames.EnumButtonGroup,\n isValueSupported: isEnum,\n Editor: EnumButtonGroupEditor,\n});\n\nfunction EnumButtonGroupEditor({\n value,\n onChange,\n commit,\n size,\n disabled,\n metadata,\n id,\n}: EditorProps<PropertyRecordEditorMetadata, EnumValue>) {\n const enumMetadata = useEnumMetadata(metadata);\n const buttonGroupParams = useButtonGroupEditorParams(metadata);\n\n const enumIcons = React.useMemo(() => {\n return buttonGroupParams\n ? createIconsMap(enumMetadata.choices, buttonGroupParams)\n : undefined;\n }, [enumMetadata, buttonGroupParams]);\n\n const firstChoice = enumMetadata.choices[0] as EnumerationChoice | undefined;\n const currentValue = value ? value : { choice: firstChoice?.value ?? \"\" };\n\n return (\n <ButtonGroup id={id} orientation=\"horizontal\">\n {enumMetadata.choices.map((choice) => {\n const icon = findIcon(enumIcons?.get(choice.value));\n return (\n <IconButton\n key={choice.value}\n onClick={() => {\n onChange({ choice: choice.value });\n commit?.();\n }}\n label={choice.label}\n isActive={choice.value === currentValue.choice}\n size={size}\n disabled={disabled}\n >\n {icon}\n </IconButton>\n );\n })}\n </ButtonGroup>\n );\n}\n\nfunction createIconsMap(\n choices: EnumerationChoice[],\n params: ButtonGroupEditorParams\n) {\n const icons = new Map<string | number, string>();\n for (let i = 0; i < choices.length; i++) {\n const iconDef = params.buttons[i];\n icons.set(choices[i].value, iconDef.iconSpec);\n }\n return icons;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { EditorProps, EditorSpec } from "../../Types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PropertyRecordEditorMetadata } from "../Metadata.js";
|
|
4
4
|
import type { NumericValue } from "../../values/Values.js";
|
|
5
5
|
import type { WithConstraints } from "../../ConstraintUtils.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare const NumericInputEditorSpec: EditorSpec;
|
|
8
8
|
/** @internal */
|
|
9
|
-
export declare function NumericInputEditor({ metadata, value, onChange, size, disabled, id, }: EditorProps<WithConstraints<
|
|
9
|
+
export declare function NumericInputEditor({ metadata, value, onChange, size, disabled, id, }: EditorProps<WithConstraints<PropertyRecordEditorMetadata>, NumericValue>): React.JSX.Element;
|
|
10
10
|
//# sourceMappingURL=NumericInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericInput.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/NumericInput.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"NumericInput.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/new-editors/interop/old-editors/NumericInput.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAKhE,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,EAAE,UAOnC,CAAC;AAEH,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,EAAE,GACH,EAAE,WAAW,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE,YAAY,CAAC,qBA2D1E"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { StandardEditorNames } from "@itwin/appui-abstract";
|
|
7
7
|
import { createEditorSpec } from "../../Types.js";
|
|
8
|
-
import {
|
|
8
|
+
import { isPropertyRecordEditorMetadata } from "../Metadata.js";
|
|
9
9
|
import { useInputEditorSizeParams, useRangeEditorParams, } from "./UseEditorParams.js";
|
|
10
10
|
import { Input } from "@itwin/itwinui-react";
|
|
11
11
|
import { isNumeric } from "../../values/ValueUtilities.js";
|
|
@@ -13,7 +13,7 @@ import { getNumericConstraints } from "../../ConstraintUtils.js";
|
|
|
13
13
|
/* v8 ignore start */
|
|
14
14
|
/** @internal */
|
|
15
15
|
export const NumericInputEditorSpec = createEditorSpec({
|
|
16
|
-
isMetadataSupported: (metadata) =>
|
|
16
|
+
isMetadataSupported: (metadata) => isPropertyRecordEditorMetadata(metadata) &&
|
|
17
17
|
metadata.type === "number" &&
|
|
18
18
|
metadata.preferredEditor === StandardEditorNames.NumericInput,
|
|
19
19
|
isValueSupported: isNumeric,
|