@itwin/components-react 5.28.1 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -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 +3 -1
- 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 +2 -3
- 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 +3 -1
- 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 +3 -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 +3 -1
- 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 +4 -4
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/PopupButton.d.ts +2 -0
- package/lib/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/components-react/editors/PopupButton.js +1 -1
- package/lib/components-react/editors/PopupButton.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 +7 -8
- 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 +3 -1
- 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 +3 -1
- 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/ConstraintUtils.d.ts +62 -0
- package/lib/components-react/new-editors/ConstraintUtils.d.ts.map +1 -0
- package/lib/components-react/new-editors/ConstraintUtils.js +49 -0
- package/lib/components-react/new-editors/ConstraintUtils.js.map +1 -0
- package/lib/components-react/new-editors/Types.d.ts +6 -0
- package/lib/components-react/new-editors/Types.d.ts.map +1 -1
- package/lib/components-react/new-editors/Types.js.map +1 -1
- package/lib/components-react/new-editors/UseCommittableValue.d.ts +2 -5
- package/lib/components-react/new-editors/UseCommittableValue.d.ts.map +1 -1
- package/lib/components-react/new-editors/UseCommittableValue.js +4 -1
- package/lib/components-react/new-editors/UseCommittableValue.js.map +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/BooleanEditor.js +2 -2
- package/lib/components-react/new-editors/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateEditor.js +2 -2
- package/lib/components-react/new-editors/editors/DateEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateInput.d.ts +2 -1
- package/lib/components-react/new-editors/editors/DateInput.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateInput.js +2 -2
- package/lib/components-react/new-editors/editors/DateInput.js.map +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/DateTimeEditor.js +2 -2
- package/lib/components-react/new-editors/editors/DateTimeEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/EnumEditor.js +2 -2
- package/lib/components-react/new-editors/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/FallbackEditor.js +2 -2
- package/lib/components-react/new-editors/editors/FallbackEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/NumericEditor.d.ts +2 -2
- package/lib/components-react/new-editors/editors/NumericEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/NumericEditor.js +7 -3
- package/lib/components-react/new-editors/editors/NumericEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.d.ts +2 -2
- package/lib/components-react/new-editors/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/TextEditor.js +4 -2
- package/lib/components-react/new-editors/editors/TextEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.d.ts +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/ToggleEditor.js +2 -2
- package/lib/components-react/new-editors/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/new-editors/editors-registry/DefaultEditors.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors-registry/DefaultEditors.js.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts +5 -4
- package/lib/components-react/new-editors/interop/EditorInterop.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/EditorInterop.js +1 -0
- 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 +42 -3
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js +11 -6
- package/lib/components-react/new-editors/interop/PropertyRecordEditor.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/Color.js +4 -4
- 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 +4 -3
- 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 +11 -5
- 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 +4 -4
- 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 +7 -1
- 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 +21 -6
- 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 +4 -4
- 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 +4 -4
- 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/new-editors/values/Metadata.d.ts +22 -0
- package/lib/components-react/new-editors/values/Metadata.d.ts.map +1 -1
- package/lib/components-react/new-editors/values/Metadata.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 +2 -1
- 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 +1 -1
- package/lib/internal.d.ts.map +1 -1
- package/lib/internal.js +1 -1
- package/lib/internal.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAe5D;;GAEG;AACH,MA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,EACtB,IAAI,EAAC,OAAO,GACZ;QACD,UAAU,CACU,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type {\n InternalInputEditorProps,\n PropertyEditorProps,\n TypeEditor,\n} from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport { InputWithDecorations } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n size?: number;\n maxSize?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement | null> =\n React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : 0;\n\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let maxSize: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n if (editorSizeParams.size) size = editorSizeParams.size;\n if (editorSizeParams.maxSize) maxSize = editorSizeParams.maxSize;\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n size,\n maxSize,\n maxLength,\n min,\n max,\n step,\n precision,\n });\n }\n\n public override render(): React.ReactNode {\n const { decoration } = this.props as InternalInputEditorProps;\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n maxWidth: this.state.maxSize\n ? `${this.state.maxSize * 0.75}em`\n : undefined,\n };\n\n return (\n <NumericEditor\n ref={this._inputElement}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.props.propertyRecord?.isReadonly}\n disabled={this.props.propertyRecord?.isDisabled}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={\n this.props.setFocus && !this.props.propertyRecord?.isDisabled\n }\n isControlled={this.props.shouldCommitOnChange}\n decoration={decoration}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ntype NumberInputProps = React.ComponentProps<typeof NumberInput>;\n\ninterface NumericEditorProps extends Omit<NumberInputProps, \"step\"> {\n decoration?: React.ReactNode;\n step?: number;\n}\n\nconst NumericEditor = React.forwardRef<HTMLInputElement, NumericEditorProps>(\n function NumericEditor(props, forwardedRef) {\n const { decoration, ...rest } = props;\n if (decoration) {\n return (\n <LockNumericEditor\n {...rest}\n ref={forwardedRef}\n decoration={decoration}\n />\n );\n }\n\n return (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <NumberInput ref={forwardedRef} {...rest} />\n );\n }\n);\n\ninterface LockNumericEditorProps extends NumericEditorProps {\n decoration: React.ReactNode;\n}\n\nconst LockNumericEditor = React.forwardRef<\n HTMLInputElement,\n LockNumericEditorProps\n>(function LockNumericEditor(props, forwardedRef) {\n const { decoration, precision, onChange, isControlled, ...rest } = props;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n onChange?.(Number(value), value);\n };\n return (\n <InputWithDecorations size=\"small\">\n <InputWithDecorations.Input\n {...rest}\n ref={forwardedRef}\n type=\"number\"\n onChange={handleChange}\n size=\"small\"\n />\n {decoration}\n </InputWithDecorations>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"file":"NumericInputEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/NumericInputEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,2BAA2B,CAAC;AACnC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAkB5D;;;GAGG;AACH,MAAM,OAAO,kBACX,SAAQ,KAAK,CAAC,aAA2D;IAGjE,UAAU,GAAG,KAAK,CAAC;IACnB,aAAa,GACnB,KAAK,CAAC,SAAS,EAAE,CAAC;IACb,QAAQ,GAAG,KAAK,CAAC,CAAC,gDAAgD;IAEhD,KAAK,GAAsC;QAClE,KAAK,EAAE,CAAC;KACT,CAAC;IAEK,KAAK,CAAC,gBAAgB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QACzC,IAAI,aAAwC,CA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a,GAAG,KAAK,CAAC,UAAU,CACpC,SAAS,aAAa,CAAC,KAAK,EAAE,YAAY;IACxC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtC,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CACL,oBAAC,iBAAiB,OACZ,IAAI,EACR,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,UAAU,GACtB,CACH,CAAC;IACJ,CAAC;IAED,OAAO,oBAAC,WAAW,IAAC,GAAG,EAAE,YAAY,KAAM,IAAI,GAAI,CAAC;AACtD,CAAC,CACF,CAAC;AAMF,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAGxC,SAAS,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAC9C,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,YAAY,GAAG,CAAC,KAA0C,EAAE,EAAE;QAClE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QACjC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC;IACF,OAAO,CACL,oBAAC,oBAAoB,IAAC,IAAI,EAAC,OAAO;QAChC,oBAAC,oBAAoB,CAAC,KAAK,OACrB,IAAI,EACR,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAC,OAAO,GACZ;QACD,UAAU,CACU,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./NumericInputEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n InputEditorSizeParams,\n PropertyEditorParams,\n PropertyValue,\n RangeEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { NumberInput } from \"@itwin/core-react\";\nimport type {\n InternalInputEditorProps,\n PropertyEditorProps,\n TypeEditor,\n} from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport { InputWithDecorations } from \"@itwin/itwinui-react\";\nimport { EditorRenderer } from \"../new-editors/EditorRenderer.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** @internal */\ninterface NumericInputEditorState {\n value: number;\n size?: number;\n maxSize?: number;\n maxLength?: number;\n\n min?: number;\n max?: number;\n step?: number;\n precision?: number;\n}\n\n/** NumericInputEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class NumericInputEditor\n extends React.PureComponent<PropertyEditorProps, NumericInputEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _inputElement: React.RefObject<HTMLInputElement | null> =\n React.createRef();\n public hasFocus = false; // hot used since containerHandlesEnter is false\n\n public override readonly state: Readonly<NumericInputEditorState> = {\n value: 0,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private _updateValue = (\n value: number | undefined,\n _stringValue: string\n ): void => {\n const newValue = value !== undefined ? value : 0;\n\n if (this._isMounted)\n this.setState(\n {\n value: newValue,\n },\n async () => {\n await this._handleCommit();\n }\n );\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let maxSize: number | undefined;\n let maxLength: number | undefined;\n let min: number | undefined;\n let max: number | undefined;\n let step: number | undefined;\n let precision: number | undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const editorSizeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.InputEditorSize.valueOf()\n ) as InputEditorSizeParams;\n if (editorSizeParams) {\n if (editorSizeParams.size) size = editorSizeParams.size;\n if (editorSizeParams.maxSize) maxSize = editorSizeParams.maxSize;\n if (editorSizeParams.maxLength) maxLength = editorSizeParams.maxLength;\n }\n\n const rangeParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Range.valueOf()\n ) as RangeEditorParams;\n if (rangeParams) {\n min = rangeParams.minimum;\n max = rangeParams.maximum;\n step = rangeParams.step;\n precision = rangeParams.precision;\n }\n }\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n size,\n maxSize,\n maxLength,\n min,\n max,\n step,\n precision,\n });\n }\n\n public override render(): React.ReactNode {\n const { decoration } = this.props as InternalInputEditorProps;\n const className = classnames(\n \"components-cell-editor\",\n \"components-numeric-input-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 8;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize * 0.75}em`,\n maxWidth: this.state.maxSize\n ? `${this.state.maxSize * 0.75}em`\n : undefined,\n };\n\n return (\n <NumericEditor\n ref={this._inputElement}\n id={this.props.propertyRecord?.property.name}\n className={className}\n style={style}\n value={this.state.value}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n precision={this.state.precision}\n readOnly={this.props.propertyRecord?.isReadonly}\n disabled={this.props.propertyRecord?.isDisabled}\n maxLength={this.state.maxLength}\n onBlur={this.props.onBlur}\n onChange={this._updateValue}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={\n this.props.setFocus && !this.props.propertyRecord?.isDisabled\n }\n isControlled={this.props.shouldCommitOnChange}\n decoration={decoration}\n />\n );\n }\n}\n\n/** Numeric Input Property Editor registered for the \"number\" type name and \"numeric-input\" editor name.\n * It uses the [[NumericInputEditor]] React component.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class NumericInputPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <NumericInputEditor />;\n }\n public override get containerHandlesEnter(): boolean {\n // let input editor process enter key\n return false;\n }\n}\n\ntype NumberInputProps = React.ComponentProps<typeof NumberInput>;\n\ninterface NumericEditorProps extends Omit<NumberInputProps, \"step\"> {\n decoration?: React.ReactNode;\n step?: number;\n}\n\nconst NumericEditor = React.forwardRef<HTMLInputElement, NumericEditorProps>(\n function NumericEditor(props, forwardedRef) {\n const { decoration, ...rest } = props;\n if (decoration) {\n return (\n <LockNumericEditor\n {...rest}\n ref={forwardedRef}\n decoration={decoration}\n />\n );\n }\n\n return <NumberInput ref={forwardedRef} {...rest} />;\n }\n);\n\ninterface LockNumericEditorProps extends NumericEditorProps {\n decoration: React.ReactNode;\n}\n\nconst LockNumericEditor = React.forwardRef<\n HTMLInputElement,\n LockNumericEditorProps\n>(function LockNumericEditor(props, forwardedRef) {\n const { decoration, precision, onChange, isControlled, ...rest } = props;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n onChange?.(Number(value), value);\n };\n return (\n <InputWithDecorations size=\"small\">\n <InputWithDecorations.Input\n {...rest}\n ref={forwardedRef}\n type=\"number\"\n onChange={handleChange}\n size=\"small\"\n />\n {decoration}\n </InputWithDecorations>\n );\n});\n"]}
|
|
@@ -37,6 +37,8 @@ export interface PopupButtonProps extends CommonProps {
|
|
|
37
37
|
onClose?: () => void;
|
|
38
38
|
/** Listens for Enter key in popup */
|
|
39
39
|
onEnter?: () => void;
|
|
40
|
+
/** Identifier applied to the focusable button element so a `<label htmlFor>` can reference it. */
|
|
41
|
+
id?: string;
|
|
40
42
|
}
|
|
41
43
|
/** @internal */
|
|
42
44
|
interface PopupButtonState {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupButton.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrE;;GAEG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAEjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wKAAwK;IACxK,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,MAAM,CAA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,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,qBA+BxD"}
|
|
@@ -59,7 +59,7 @@ export class PopupButton extends React.PureComponent {
|
|
|
59
59
|
const classNames = classnames("components-popup-button", this.state.showPopup && "components-popup-expanded", this.props.readonly && "components-readonly", this.props.disabled && "components-disabled");
|
|
60
60
|
const valueClassNames = classnames("components-popup-button-value", showPlaceholder && "components-popup-button-placeholder");
|
|
61
61
|
return (React.createElement("div", { className: this.props.className },
|
|
62
|
-
React.createElement("div", { className: classNames, onClick: this._togglePopup, onKeyDown: this._handleKeyDown, "data-testid": "components-popup-button", tabIndex: 0, ref: this._buttonRef, title: this.props.title, "aria-disabled": this.props.disabled, role: "button" },
|
|
62
|
+
React.createElement("div", { className: classNames, onClick: this._togglePopup, onKeyDown: this._handleKeyDown, "data-testid": "components-popup-button", tabIndex: 0, ref: this._buttonRef, title: this.props.title, "aria-disabled": this.props.disabled, role: "button", id: this.props.id },
|
|
63
63
|
React.createElement("div", { className: valueClassNames }, this.props.label || this.props.placeholder),
|
|
64
64
|
React.createElement("div", { className: "components-popup-button-arrow" },
|
|
65
65
|
React.createElement("div", { className: classnames("components-popup-button-arrow-icon", "icon") },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL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AO,oBAAC,GAAG,OAAK,KAAK,EAAE,aAAa,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAWD;;GAEG;AACH,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,EAC7B,OAAO,EAAE,KAAK,CAAC,IAAI;YAGnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,YAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAGvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,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 \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../l10n/useTranslation.js\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement | null> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n if (this.props.readonly || this.props.disabled) return;\n\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\",\n this.props.readonly && \"components-readonly\",\n this.props.disabled && \"components-disabled\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n aria-disabled={this.props.disabled}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n portalTarget={\n this._buttonRef.current?.ownerDocument.querySelector(\n \".uifw-configurableui-portalContainer\"\n ) ?? undefined\n }\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof PopupOkCancelButtons>`\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAA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nC,YAAY,EACV,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAClD,sCAAsC,CACvC,IAAI,SAAS,IAGf,IAAI,CAAC,KAAK,CAAC,QAAQ,CACd,CACJ,CACP,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,4DAA4D;AAC5D,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,4DAA4D;IAC5D,OAAO,oBAAC,GAAG,OAAK,KAAK,EAAE,aAAa,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAWD;;GAEG;AACH,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,EAC7B,OAAO,EAAE,KAAK,CAAC,IAAI;YAGnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,YAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAGvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,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 \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../l10n/useTranslation.js\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement | null> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n /** Identifier applied to the focusable button element so a `<label htmlFor>` can reference it. */\n id?: string;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n if (this.props.readonly || this.props.disabled) return;\n\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\",\n this.props.readonly && \"components-readonly\",\n this.props.disabled && \"components-disabled\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n aria-disabled={this.props.disabled}\n role=\"button\"\n id={this.props.id}\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n portalTarget={\n this._buttonRef.current?.ownerDocument.querySelector(\n \".uifw-configurableui-portalContainer\"\n ) ?? undefined\n }\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof PopupOkCancelButtons>`\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n {/* eslint-disable-next-line @typescript-eslint/no-deprecated */}\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
|
|
@@ -5,6 +5,7 @@ import * as React from "react";
|
|
|
5
5
|
import type { DisplayMessageType, MessageSeverity, PropertyDescription, PropertyRecord, PropertyValue } from "@itwin/appui-abstract";
|
|
6
6
|
/** Asynchronous Error Message returned as part of [[AsyncValueProcessingResult]]
|
|
7
7
|
* @public
|
|
8
|
+
* @deprecated in 5.30. This is part of the old editor system and is not used anymore.
|
|
8
9
|
*/
|
|
9
10
|
export interface AsyncErrorMessage {
|
|
10
11
|
severity: MessageSeverity;
|
|
@@ -14,14 +15,17 @@ export interface AsyncErrorMessage {
|
|
|
14
15
|
}
|
|
15
16
|
/** Asynchronous Value Process Result
|
|
16
17
|
* @public
|
|
18
|
+
* @deprecated in 5.30. This is part of the old editor system and is not used anymore.
|
|
17
19
|
*/
|
|
18
20
|
export interface AsyncValueProcessingResult {
|
|
19
21
|
encounteredError: boolean;
|
|
20
22
|
returnValue?: PropertyValue;
|
|
21
23
|
errorMessage?: AsyncErrorMessage;
|
|
22
24
|
}
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* DataControllers can be implemented per typename to validate and commit values.
|
|
24
27
|
* @public
|
|
28
|
+
* @deprecated in 5.30. This is part of the old editor system and is not used anymore.
|
|
25
29
|
*/
|
|
26
30
|
export interface DataController {
|
|
27
31
|
validateValue(newValue: PropertyValue, record: PropertyRecord): Promise<AsyncValueProcessingResult>;
|
|
@@ -29,6 +33,7 @@ export interface DataController {
|
|
|
29
33
|
}
|
|
30
34
|
/** PropertyEditor is the base class for all property editors.
|
|
31
35
|
* @public
|
|
36
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
32
37
|
*/
|
|
33
38
|
export declare abstract class PropertyEditorBase implements DataController {
|
|
34
39
|
get containerHandlesBlur(): boolean;
|
|
@@ -42,8 +47,10 @@ export declare abstract class PropertyEditorBase implements DataController {
|
|
|
42
47
|
commitValue(newValue: PropertyValue, record: PropertyRecord): Promise<AsyncValueProcessingResult>;
|
|
43
48
|
validateValue(newValue: PropertyValue, record: PropertyRecord): Promise<AsyncValueProcessingResult>;
|
|
44
49
|
}
|
|
45
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* DataControllerBase is the base class for all Data Controllers.
|
|
46
52
|
* @public
|
|
53
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
47
54
|
*/
|
|
48
55
|
export declare abstract class DataControllerBase implements DataController {
|
|
49
56
|
commitValue(_newValue: PropertyValue, _record: PropertyRecord): Promise<AsyncValueProcessingResult>;
|
|
@@ -51,6 +58,7 @@ export declare abstract class DataControllerBase implements DataController {
|
|
|
51
58
|
}
|
|
52
59
|
/** Manages Property Editors. Property Editors are registered with and created by the manager.
|
|
53
60
|
* @public
|
|
61
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to register custom editors. Use {@link EditorsRegistryProvider} instead.
|
|
54
62
|
*/
|
|
55
63
|
export declare class PropertyEditorManager {
|
|
56
64
|
private static _dataControllers;
|
|
@@ -64,6 +72,7 @@ export declare class PropertyEditorManager {
|
|
|
64
72
|
/** Basic Property Editor registered for the "text" and "string" type names.
|
|
65
73
|
* It uses the [[TextEditor]] React component.
|
|
66
74
|
* @public
|
|
75
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
67
76
|
*/
|
|
68
77
|
export declare class BasicPropertyEditor extends PropertyEditorBase {
|
|
69
78
|
get reactNode(): React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyEditorManager.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/PropertyEditorManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyEditorManager.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/PropertyEditorManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,CACX,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvC,WAAW,CACT,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,8BAAsB,kBAAmB,YAAW,cAAc;IAChE,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IACD,IAAW,sBAAsB,IAAI,OAAO,CAE3C;IACD,IAAW,qBAAqB,IAAI,OAAO,CAE1C;IACD,IAAW,mBAAmB,IAAI,OAAO,CAExC;IACD,IAAW,gCAAgC,IAAI,OAAO,CAErD;IAEM,oBAAoB,EAAE,cAAc,GAAG,SAAS,CAAa;IAEpE,aAAoB,SA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C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,UAAU,kBAAkB,EACpC,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,UAAQ,QAQjB"}
|
|
@@ -9,6 +9,7 @@ import * as React from "react";
|
|
|
9
9
|
import { TextEditor } from "./TextEditor.js";
|
|
10
10
|
/** PropertyEditor is the base class for all property editors.
|
|
11
11
|
* @public
|
|
12
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
12
13
|
*/
|
|
13
14
|
export class PropertyEditorBase {
|
|
14
15
|
get containerHandlesBlur() {
|
|
@@ -39,8 +40,10 @@ export class PropertyEditorBase {
|
|
|
39
40
|
return { encounteredError: false };
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* DataControllerBase is the base class for all Data Controllers.
|
|
43
45
|
* @public
|
|
46
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.
|
|
44
47
|
*/
|
|
45
48
|
export class DataControllerBase {
|
|
46
49
|
async commitValue(_newValue, _record) {
|
|
@@ -53,6 +56,7 @@ export class DataControllerBase {
|
|
|
53
56
|
const editors = {};
|
|
54
57
|
/** Manages Property Editors. Property Editors are registered with and created by the manager.
|
|
55
58
|
* @public
|
|
59
|
+
* @deprecated in 5.30. This is part of the old editor system and was used to register custom editors. Use {@link EditorsRegistryProvider} instead.
|
|
56
60
|
*/
|
|
57
61
|
export class PropertyEditorManager {
|
|
58
62
|
static _dataControllers = {};
|
|
@@ -103,6 +107,7 @@ export class PropertyEditorManager {
|
|
|
103
107
|
/** Basic Property Editor registered for the "text" and "string" type names.
|
|
104
108
|
* It uses the [[TextEditor]] React component.
|
|
105
109
|
* @public
|
|
110
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
106
111
|
*/
|
|
107
112
|
export class BasicPropertyEditor extends PropertyEditorBase {
|
|
108
113
|
get reactNode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyEditorManager.js","sourceRoot":"","sources":["../../../src/components-react/editors/PropertyEditorManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0C7C;;GAEG;AACH,MAAM,OAAgB,kBAAkB;IACtC,IAAW,oBAAoB;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,gCAAgC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,oBAAoB,GAA+B,SAAS,CAAC;IAI7D,iBAAiB,CACtB,SAA8B,EAC9B,OAAuB,IAChB,CAAC;IAEH,KAAK,CAAC,WAAW,CACtB,QAAuB,EACvB,MAAsB;QAEtB,IAAI,IAAI,CAAC,oBAAoB;YAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEjE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,QAAuB,EACvB,MAAsB;QAEtB,IAAI,IAAI,CAAC,oBAAoB;YAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEnE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAgB,kBAAkB;IAC/B,KAAK,CAAC,WAA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U;QAAE,cAAc,IAAI,IAAI,UAAU,EAAE,CAAC;IACnD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAAgB,EAChB,MAAoC,EACpC,UAAmB,EACnB,QAAQ,GAAG,KAAK;IAEhB,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAE/D,yDAAyD;IACzD,IAAI,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEhE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;AACnC,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 { TextEditor } from \"./TextEditor.js\";\nimport type {\n DisplayMessageType,\n MessageSeverity,\n PropertyDescription,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\n\n/** Asynchronous Error Message returned as part of [[AsyncValueProcessingResult]]\n * @public\n */\nexport interface AsyncErrorMessage {\n severity: MessageSeverity;\n briefMessage: string;\n detailedMessage?: string;\n messageType?: DisplayMessageType;\n}\n\n/** Asynchronous Value Process Result\n * @public\n */\nexport interface AsyncValueProcessingResult {\n encounteredError: boolean;\n returnValue?: PropertyValue;\n errorMessage?: AsyncErrorMessage;\n}\n\n/** DataControllers can be implemented per typename to validate and commit values.\n * @public\n */\nexport interface DataController {\n validateValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult>;\n commitValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult>;\n}\n\n/** PropertyEditor is the base class for all property editors.\n * @public\n */\nexport abstract class PropertyEditorBase implements DataController {\n public get containerHandlesBlur(): boolean {\n return true;\n }\n public get containerHandlesEscape(): boolean {\n return true;\n }\n public get containerHandlesEnter(): boolean {\n return true;\n }\n public get containerHandlesTab(): boolean {\n return true;\n }\n public get containerStopsKeydownPropagation(): boolean {\n return true;\n }\n\n public customDataController: DataController | undefined = undefined;\n\n public abstract get reactNode(): React.ReactNode;\n\n public applyEditorParams(\n _property: PropertyDescription,\n _record: PropertyRecord\n ): void {}\n\n public async commitValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n if (this.customDataController)\n return this.customDataController.commitValue(newValue, record);\n\n return { encounteredError: false };\n }\n\n public async validateValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n if (this.customDataController)\n return this.customDataController.validateValue(newValue, record);\n\n return { encounteredError: false };\n }\n}\n\n/** DataControllerBase is the base class for all Data Controllers.\n * @public\n */\nexport abstract class DataControllerBase implements DataController {\n public async commitValue(\n _newValue: PropertyValue,\n _record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n return { encounteredError: false };\n }\n\n public async validateValue(\n _newValue: PropertyValue,\n _record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n return { encounteredError: false };\n }\n}\n\nconst editors: { [index: string]: new () => PropertyEditorBase } = {};\n\n/** Manages Property Editors. Property Editors are registered with and created by the manager.\n * @public\n */\nexport class PropertyEditorManager {\n private static _dataControllers: {\n [index: string]: new () => DataControllerBase;\n } = {};\n\n public static registerEditor(\n editType: string,\n editor: new () => PropertyEditorBase,\n editorName?: string\n ): void {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n if (editors.hasOwnProperty(fullEditorName)) {\n const nameOfEditor = editors[fullEditorName].name;\n throw Error(\n `PropertyEditorManager.registerEditor error: type '${fullEditorName}' already registered to '${nameOfEditor}'`\n );\n }\n editors[fullEditorName] = editor;\n }\n\n public static registerDataController(\n controllerName: string,\n controller: new () => DataControllerBase\n ): void {\n if (PropertyEditorManager._dataControllers.hasOwnProperty(controllerName)) {\n throw Error(\n `PropertyEditorManager.registerDataController error: type '${controllerName}' already registered to '${(typeof PropertyEditorManager\n ._dataControllers[controllerName]).toString()}'`\n );\n }\n PropertyEditorManager._dataControllers[controllerName] = controller;\n }\n\n /** @internal */\n public static deregisterDataController(controllerName: string): void {\n if (PropertyEditorManager._dataControllers.hasOwnProperty(controllerName)) {\n delete PropertyEditorManager._dataControllers[controllerName];\n }\n }\n\n public static createEditor(\n editType: string,\n editorName?: string,\n dataControllerName?: string\n ): PropertyEditorBase {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n let editor: PropertyEditorBase;\n if (editors.hasOwnProperty(fullEditorName))\n editor = new editors[fullEditorName]();\n else if (editors.hasOwnProperty(editType)) editor = new editors[editType]();\n else editor = new BasicPropertyEditor();\n\n if (dataControllerName) {\n if (\n PropertyEditorManager._dataControllers.hasOwnProperty(\n dataControllerName\n )\n )\n editor.customDataController =\n new PropertyEditorManager._dataControllers[dataControllerName]();\n else\n throw Error(\n `PropertyEditorManager.createEditor error: data controller '${dataControllerName}' is not registered`\n );\n }\n\n return editor;\n }\n\n public static hasCustomEditor(editType: string, editorName: string): boolean {\n const fullEditorName = getFullEditorName(editType, editorName);\n return editors.hasOwnProperty(fullEditorName);\n }\n}\n\n/** Basic Property Editor registered for the \"text\" and \"string\" type names.\n * It uses the [[TextEditor]] React component.\n * @public\n */\nexport class BasicPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <TextEditor />;\n }\n}\n\nfunction getFullEditorName(editType: string, editorName?: string) {\n let fullEditorName = editType;\n if (editorName) fullEditorName += `:${editorName}`;\n return fullEditorName;\n}\n\n/** Used to override the default property editors from the `appui-react` package.\n * @internal\n */\nexport function registerDefaultPropertyEditor(\n editType: string,\n editor: new () => PropertyEditorBase,\n editorName?: string,\n override = false\n) {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n // Ignore if already registered and override is disabled.\n if (editors.hasOwnProperty(fullEditorName) && !override) return;\n\n editors[fullEditorName] = editor;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyEditorManager.js","sourceRoot":"","sources":["../../../src/components-react/editors/PropertyEditorManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAmD7C;;;GAGG;AACH,MAAM,OAAgB,kBAAkB;IACtC,IAAW,oBAAoB;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,sBAAsB;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,mBAAmB;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAW,gCAAgC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,oBAAoB,GAA+B,SAAS,CAAC;IAI7D,iBAAiB,CACtB,SAA8B,EAC9B,OAAuB,IAChB,CAAC;IAEH,KAAK,CAAC,WAAW,CACtB,QAAuB,EACvB,MAAsB;QAEtB,IAAI,IAAI,CAAC,oBAAoB;YAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEjE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,QAAuB,EACvB,MAAsB;QAEtB,IAAI,IAAI,CAAC,oBAAoB;YAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEnE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IACrC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAgB,kBAAkB;IAC/B,KAAK,CAAC,WAAW,CACtB,SAAwB,EACxB,OAAuB;QAEvB,OAAO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CAAC;IACnD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,QAAgB,EAChB,MAAoC,EACpC,UAAmB,EACnB,QAAQ,GAAG,KAAK;IAEhB,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAE/D,yDAAyD;IACzD,IAAI,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEhE,OAAO,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;AACnC,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 { TextEditor } from \"./TextEditor.js\";\nimport type {\n DisplayMessageType,\n MessageSeverity,\n PropertyDescription,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { createEditorSpec, EditorSpec } from \"../new-editors/Types.js\";\nimport { EditorRenderer } from \"../new-editors/EditorRenderer.js\";\nimport { EditorsRegistryProvider } from \"../new-editors/editors-registry/EditorsRegistryProvider.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\n/** Asynchronous Error Message returned as part of [[AsyncValueProcessingResult]]\n * @public\n * @deprecated in 5.30. This is part of the old editor system and is not used anymore.\n */\nexport interface AsyncErrorMessage {\n severity: MessageSeverity;\n briefMessage: string;\n detailedMessage?: string;\n messageType?: DisplayMessageType;\n}\n\n/** Asynchronous Value Process Result\n * @public\n * @deprecated in 5.30. This is part of the old editor system and is not used anymore.\n */\nexport interface AsyncValueProcessingResult {\n encounteredError: boolean;\n returnValue?: PropertyValue;\n errorMessage?: AsyncErrorMessage;\n}\n\n/**\n * DataControllers can be implemented per typename to validate and commit values.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and is not used anymore.\n */\nexport interface DataController {\n validateValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult>;\n commitValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult>;\n}\n\n/** PropertyEditor is the base class for all property editors.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.\n */\nexport abstract class PropertyEditorBase implements DataController {\n public get containerHandlesBlur(): boolean {\n return true;\n }\n public get containerHandlesEscape(): boolean {\n return true;\n }\n public get containerHandlesEnter(): boolean {\n return true;\n }\n public get containerHandlesTab(): boolean {\n return true;\n }\n public get containerStopsKeydownPropagation(): boolean {\n return true;\n }\n\n public customDataController: DataController | undefined = undefined;\n\n public abstract get reactNode(): React.ReactNode;\n\n public applyEditorParams(\n _property: PropertyDescription,\n _record: PropertyRecord\n ): void {}\n\n public async commitValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n if (this.customDataController)\n return this.customDataController.commitValue(newValue, record);\n\n return { encounteredError: false };\n }\n\n public async validateValue(\n newValue: PropertyValue,\n record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n if (this.customDataController)\n return this.customDataController.validateValue(newValue, record);\n\n return { encounteredError: false };\n }\n}\n\n/**\n * DataControllerBase is the base class for all Data Controllers.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and was used to defined custom editor. Use {@link EditorSpec} and {@link createEditorSpec} instead.\n */\nexport abstract class DataControllerBase implements DataController {\n public async commitValue(\n _newValue: PropertyValue,\n _record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n return { encounteredError: false };\n }\n\n public async validateValue(\n _newValue: PropertyValue,\n _record: PropertyRecord\n ): Promise<AsyncValueProcessingResult> {\n return { encounteredError: false };\n }\n}\n\nconst editors: { [index: string]: new () => PropertyEditorBase } = {};\n\n/** Manages Property Editors. Property Editors are registered with and created by the manager.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and was used to register custom editors. Use {@link EditorsRegistryProvider} instead.\n */\nexport class PropertyEditorManager {\n private static _dataControllers: {\n [index: string]: new () => DataControllerBase;\n } = {};\n\n public static registerEditor(\n editType: string,\n editor: new () => PropertyEditorBase,\n editorName?: string\n ): void {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n if (editors.hasOwnProperty(fullEditorName)) {\n const nameOfEditor = editors[fullEditorName].name;\n throw Error(\n `PropertyEditorManager.registerEditor error: type '${fullEditorName}' already registered to '${nameOfEditor}'`\n );\n }\n editors[fullEditorName] = editor;\n }\n\n public static registerDataController(\n controllerName: string,\n controller: new () => DataControllerBase\n ): void {\n if (PropertyEditorManager._dataControllers.hasOwnProperty(controllerName)) {\n throw Error(\n `PropertyEditorManager.registerDataController error: type '${controllerName}' already registered to '${(typeof PropertyEditorManager\n ._dataControllers[controllerName]).toString()}'`\n );\n }\n PropertyEditorManager._dataControllers[controllerName] = controller;\n }\n\n /** @internal */\n public static deregisterDataController(controllerName: string): void {\n if (PropertyEditorManager._dataControllers.hasOwnProperty(controllerName)) {\n delete PropertyEditorManager._dataControllers[controllerName];\n }\n }\n\n public static createEditor(\n editType: string,\n editorName?: string,\n dataControllerName?: string\n ): PropertyEditorBase {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n let editor: PropertyEditorBase;\n if (editors.hasOwnProperty(fullEditorName))\n editor = new editors[fullEditorName]();\n else if (editors.hasOwnProperty(editType)) editor = new editors[editType]();\n else editor = new BasicPropertyEditor();\n\n if (dataControllerName) {\n if (\n PropertyEditorManager._dataControllers.hasOwnProperty(\n dataControllerName\n )\n )\n editor.customDataController =\n new PropertyEditorManager._dataControllers[dataControllerName]();\n else\n throw Error(\n `PropertyEditorManager.createEditor error: data controller '${dataControllerName}' is not registered`\n );\n }\n\n return editor;\n }\n\n public static hasCustomEditor(editType: string, editorName: string): boolean {\n const fullEditorName = getFullEditorName(editType, editorName);\n return editors.hasOwnProperty(fullEditorName);\n }\n}\n\n/** Basic Property Editor registered for the \"text\" and \"string\" type names.\n * It uses the [[TextEditor]] React component.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class BasicPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <TextEditor />;\n }\n}\n\nfunction getFullEditorName(editType: string, editorName?: string) {\n let fullEditorName = editType;\n if (editorName) fullEditorName += `:${editorName}`;\n return fullEditorName;\n}\n\n/** Used to override the default property editors from the `appui-react` package.\n * @internal\n */\nexport function registerDefaultPropertyEditor(\n editType: string,\n editor: new () => PropertyEditorBase,\n editorName?: string,\n override = false\n) {\n const fullEditorName = getFullEditorName(editType, editorName);\n\n // Ignore if already registered and override is disabled.\n if (editors.hasOwnProperty(fullEditorName) && !override) return;\n\n editors[fullEditorName] = editor;\n}\n"]}
|
|
@@ -22,8 +22,10 @@ interface SliderEditorState {
|
|
|
22
22
|
maxLabel?: React.ReactNode;
|
|
23
23
|
tickLabels?: React.ReactNode;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* SliderEditor React component that is a property editor with numeric input & up/down buttons
|
|
26
27
|
* @public
|
|
28
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
27
29
|
*/
|
|
28
30
|
export declare class SliderEditor extends React.PureComponent<PropertyEditorProps, SliderEditorState> implements TypeEditor {
|
|
29
31
|
private _isMounted;
|
|
@@ -51,6 +53,7 @@ export declare class SliderEditor extends React.PureComponent<PropertyEditorProp
|
|
|
51
53
|
/** Slider Property Editor registered for the "number" type name and "slider" editor name.
|
|
52
54
|
* It uses the [[SliderEditor]] React component.
|
|
53
55
|
* @public
|
|
56
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
54
57
|
*/
|
|
55
58
|
export declare class SliderPropertyEditor extends PropertyEditorBase {
|
|
56
59
|
get reactNode(): React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"SliderEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAEV,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAYhE,gBAAgB;AAChB,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C,SAAS,CAAC,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,GAAG,eAAe,CAAC;IACtE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,YACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,iBAAiB,CAClE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAqC;IAExD,SAAyB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAIzD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAK7B;IAED,OAAO,CAAC,aAAa,CAOnB;IAEc,iBAAiB;IAKjB,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjE,OAAO,CAAC,qBAAqB,CAO3B;YAEY,iBAAiB;IA4G/B,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,YAAY,CAMlB;IAEF,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,aAAa,CAInB;IAEF,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,YAAY,CASlB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAyD1C;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;IAC1D,IAAW,SAAS,IAAI,KAAK,CAAC,SAAS,CAEtC;CACF"}
|
|
@@ -13,8 +13,10 @@ import { Icon } from "@itwin/core-react";
|
|
|
13
13
|
import { Slider } from "@itwin/itwinui-react";
|
|
14
14
|
import { PropertyEditorBase } from "./PropertyEditorManager.js";
|
|
15
15
|
import { PopupButton, PopupContent, PopupOkCancelButtons, } from "./PopupButton.js";
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* SliderEditor React component that is a property editor with numeric input & up/down buttons
|
|
17
18
|
* @public
|
|
19
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
18
20
|
*/
|
|
19
21
|
export class SliderEditor extends React.PureComponent {
|
|
20
22
|
_isMounted = false;
|
|
@@ -108,12 +110,8 @@ export class SliderEditor extends React.PureComponent {
|
|
|
108
110
|
showTooltip = sliderParams.showTooltip;
|
|
109
111
|
tooltipBelow = sliderParams.tooltipBelow;
|
|
110
112
|
formatTooltip = sliderParams.formatTooltip;
|
|
111
|
-
minLabel = !sliderParams.showMinMax ? ("") : sliderParams.minIconSpec ? (
|
|
112
|
-
|
|
113
|
-
React.createElement(Icon, { iconSpec: sliderParams.minIconSpec })) : undefined;
|
|
114
|
-
maxLabel = !sliderParams.showMinMax ? ("") : sliderParams.maxIconSpec ? (
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
116
|
-
React.createElement(Icon, { iconSpec: sliderParams.maxIconSpec })) : undefined;
|
|
113
|
+
minLabel = !sliderParams.showMinMax ? ("") : sliderParams.minIconSpec ? (React.createElement(Icon, { iconSpec: sliderParams.minIconSpec })) : undefined;
|
|
114
|
+
maxLabel = !sliderParams.showMinMax ? ("") : sliderParams.maxIconSpec ? (React.createElement(Icon, { iconSpec: sliderParams.maxIconSpec })) : undefined;
|
|
117
115
|
if (sliderParams.showTicks) {
|
|
118
116
|
const count = sliderParams.getTickCount
|
|
119
117
|
? sliderParams.getTickCount()
|
|
@@ -215,7 +213,7 @@ export class SliderEditor extends React.PureComponent {
|
|
|
215
213
|
};
|
|
216
214
|
const popupContent = (React.createElement(Slider, { className: "components-slider-editor-slider", style: style, values: [this.state.value], min: this.state.min, max: this.state.max, step: this.state.step, thumbMode: this.state.thumbMode, trackDisplayMode: this.state.trackDisplayMode, disabled: this.props.propertyRecord?.isDisabled, minLabel: this.state.minLabel, maxLabel: this.state.maxLabel, tooltipProps: this.tooltipProps, tickLabels: this.state.tickLabels, tickProps: tickProps, onChange: this._handleChange }));
|
|
217
215
|
return (React.createElement("div", { className: className, ref: this._divElement },
|
|
218
|
-
React.createElement(PopupButton, { label: this.state.value, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus, disabled: this.props.propertyRecord?.isDisabled, readonly: this.props.propertyRecord?.isReadonly },
|
|
216
|
+
React.createElement(PopupButton, { id: this.props.propertyRecord?.property.name, label: this.state.value, onClose: this._handleClose, onEnter: this._handleEnter, setFocus: this.props.setFocus, disabled: this.props.propertyRecord?.isDisabled, readonly: this.props.propertyRecord?.isReadonly },
|
|
219
217
|
React.createElement(PopupContent, null,
|
|
220
218
|
popupContent,
|
|
221
219
|
React.createElement(PopupOkCancelButtons, { onOk: this._handleOk, onCancel: this._handleCancel })))));
|
|
@@ -224,6 +222,7 @@ export class SliderEditor extends React.PureComponent {
|
|
|
224
222
|
/** Slider Property Editor registered for the "number" type name and "slider" editor name.
|
|
225
223
|
* It uses the [[SliderEditor]] React component.
|
|
226
224
|
* @public
|
|
225
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
227
226
|
*/
|
|
228
227
|
export class SliderPropertyEditor extends PropertyEditorBase {
|
|
229
228
|
get reactNode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC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AI,CAAC,KAAK,CAAC,QAAQ,EAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,EAC/C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU;gBAE/C,oBAAC,YAAY;oBACV,YAAY;oBACb,oBAAC,oBAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAC1D,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./SliderEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n PropertyEditorParams,\n PropertyValue,\n SliderEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { Tooltip } from \"@itwin/itwinui-react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport {\n PopupButton,\n PopupContent,\n PopupOkCancelButtons,\n} from \"./PopupButton.js\";\n\ntype TooltipProps = React.ComponentPropsWithoutRef<typeof Tooltip>;\n\n/** @internal */\ninterface SliderEditorState {\n value: number;\n min: number;\n max: number;\n size?: number;\n step?: number;\n showTooltip?: boolean;\n tooltipBelow?: boolean;\n formatTooltip?: (value: number) => string;\n thumbMode?: \"allow-crossing\" | \"inhibit-crossing\";\n trackDisplayMode?: \"auto\" | \"none\" | \"odd-segments\" | \"even-segments\";\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n tickLabels?: React.ReactNode;\n}\n\n/** SliderEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n */\nexport class SliderEditor\n extends React.PureComponent<PropertyEditorProps, SliderEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<SliderEditorState> = {\n value: 0,\n min: 0,\n max: 100,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n private _handleChange = (values: readonly number[]): void => {\n const newValue = values[0];\n\n if (this._isMounted)\n this.setState({\n value: newValue,\n });\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private internalFormatTooltip = (value: number, step = 1) => {\n if (Number.isInteger(step)) return value.toFixed(0);\n\n const stepString = step.toString();\n const decimalIndex = stepString.indexOf(\".\");\n const numDecimals = step.toString().length - (decimalIndex + 1);\n return value.toFixed(numDecimals);\n };\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let min = 0;\n let max = 100;\n let step: number | undefined;\n let showTooltip: boolean | undefined;\n let tooltipBelow: boolean | undefined;\n let formatTooltip: ((value: number) => string) | undefined;\n let tickLabels: string[] | undefined;\n let minLabel: React.ReactNode | undefined;\n let maxLabel: React.ReactNode | undefined;\n let trackDisplayMode:\n | \"auto\"\n | \"none\"\n | \"odd-segments\"\n | \"even-segments\"\n | undefined;\n let thumbMode: \"allow-crossing\" | \"inhibit-crossing\" | undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const sliderParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Slider.valueOf()\n ) as SliderEditorParams;\n if (sliderParams) {\n min = sliderParams.minimum;\n max = sliderParams.maximum;\n size = sliderParams.size;\n step = sliderParams.step;\n thumbMode =\n 1 === sliderParams.mode ? \"allow-crossing\" : \"inhibit-crossing\";\n trackDisplayMode = !sliderParams.reversed ? \"auto\" : \"odd-segments\";\n showTooltip = sliderParams.showTooltip;\n tooltipBelow = sliderParams.tooltipBelow;\n formatTooltip = sliderParams.formatTooltip;\n\n minLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.minIconSpec ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={sliderParams.minIconSpec} />\n ) : undefined;\n maxLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.maxIconSpec ? (\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n <Icon iconSpec={sliderParams.maxIconSpec} />\n ) : undefined;\n\n if (sliderParams.showTicks) {\n const count = sliderParams.getTickCount\n ? sliderParams.getTickCount()\n : 0;\n if (count) {\n tickLabels = [];\n const increment = (max - min) / count;\n for (let i = 0; i <= count; i++) {\n const value = i * increment + min;\n if (sliderParams.showTickLabels) {\n const label = sliderParams.formatTick\n ? sliderParams.formatTick(value)\n : this.internalFormatTooltip(value, step);\n tickLabels.push(label);\n } else {\n tickLabels.push(\"\");\n }\n }\n } else if (sliderParams.getTickValues) {\n tickLabels = sliderParams\n .getTickValues()\n .map((val: number) =>\n sliderParams.formatTick\n ? sliderParams.formatTick(val)\n : this.internalFormatTooltip(val, step)\n );\n }\n }\n }\n }\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n size,\n min,\n max,\n step,\n trackDisplayMode,\n showTooltip,\n tooltipBelow,\n formatTooltip,\n minLabel,\n maxLabel,\n tickLabels,\n thumbMode,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private tooltipProps = (_index: number, val: number) => {\n const content = this.state.formatTooltip\n ? this.state.formatTooltip(val)\n : this.internalFormatTooltip(val, this.state.step);\n return {\n placement: this.state.tooltipBelow ? \"bottom\" : \"top\",\n content,\n visible: this.state.showTooltip,\n } as Partial<Omit<TooltipProps, \"children\">>;\n };\n\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-slider-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 100;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize}px`,\n };\n\n const tickProps = {\n \"data-testid\": \"components-tick\",\n } as React.ComponentProps<\"span\">;\n const popupContent = (\n <Slider\n className=\"components-slider-editor-slider\"\n style={style}\n values={[this.state.value]}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n thumbMode={this.state.thumbMode}\n trackDisplayMode={this.state.trackDisplayMode}\n disabled={this.props.propertyRecord?.isDisabled}\n minLabel={this.state.minLabel}\n maxLabel={this.state.maxLabel}\n tooltipProps={this.tooltipProps}\n tickLabels={this.state.tickLabels}\n tickProps={tickProps}\n onChange={this._handleChange}\n />\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n label={this.state.value}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n disabled={this.props.propertyRecord?.isDisabled}\n readonly={this.props.propertyRecord?.isReadonly}\n >\n <PopupContent>\n {popupContent}\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Slider Property Editor registered for the \"number\" type name and \"slider\" editor name.\n * It uses the [[SliderEditor]] React component.\n * @public\n */\nexport class SliderPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <SliderEditor />;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SliderEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/SliderEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAwB1B;;;;GAIG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AU;gBAE/C,oBAAC,YAAY;oBACV,YAAY;oBACb,oBAAC,oBAAoB,IACnB,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,QAAQ,EAAE,IAAI,CAAC,aAAa,GAC5B,CACW,CACH,CACV,CACP,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAC1D,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./SliderEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type {\n PropertyEditorParams,\n PropertyValue,\n SliderEditorParams,\n} from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorParamTypes,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport { Icon } from \"@itwin/core-react\";\nimport type { Tooltip } from \"@itwin/itwinui-react\";\nimport { Slider } from \"@itwin/itwinui-react\";\nimport type { PropertyEditorProps, TypeEditor } from \"./EditorContainer.js\";\nimport { PropertyEditorBase } from \"./PropertyEditorManager.js\";\nimport {\n PopupButton,\n PopupContent,\n PopupOkCancelButtons,\n} from \"./PopupButton.js\";\nimport { EditorRenderer } from \"../new-editors/EditorRenderer.js\";\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\ntype TooltipProps = React.ComponentPropsWithoutRef<typeof Tooltip>;\n\n/** @internal */\ninterface SliderEditorState {\n value: number;\n min: number;\n max: number;\n size?: number;\n step?: number;\n showTooltip?: boolean;\n tooltipBelow?: boolean;\n formatTooltip?: (value: number) => string;\n thumbMode?: \"allow-crossing\" | \"inhibit-crossing\";\n trackDisplayMode?: \"auto\" | \"none\" | \"odd-segments\" | \"even-segments\";\n minLabel?: React.ReactNode;\n maxLabel?: React.ReactNode;\n tickLabels?: React.ReactNode;\n}\n\n/**\n * SliderEditor React component that is a property editor with numeric input & up/down buttons\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class SliderEditor\n extends React.PureComponent<PropertyEditorProps, SliderEditorState>\n implements TypeEditor\n{\n private _isMounted = false;\n private _enterKey = false;\n private _divElement = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<SliderEditorState> = {\n value: 0,\n min: 0,\n max: 100,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.value,\n displayValue: \"\",\n };\n }\n\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._divElement.current;\n }\n\n public get hasFocus(): boolean {\n let containsFocus = false;\n if (this.htmlElement)\n containsFocus = this.htmlElement.contains(document.activeElement);\n return containsFocus;\n }\n\n private _handleChange = (values: readonly number[]): void => {\n const newValue = values[0];\n\n if (this._isMounted)\n this.setState({\n value: newValue,\n });\n };\n\n public override componentDidMount() {\n this._isMounted = true;\n void this.setStateFromProps();\n }\n\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n void this.setStateFromProps();\n }\n }\n\n private internalFormatTooltip = (value: number, step = 1) => {\n if (Number.isInteger(step)) return value.toFixed(0);\n\n const stepString = step.toString();\n const decimalIndex = stepString.indexOf(\".\");\n const numDecimals = step.toString().length - (decimalIndex + 1);\n return value.toFixed(numDecimals);\n };\n\n private async setStateFromProps() {\n const record = this.props.propertyRecord;\n let initialValue = 0;\n\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n initialValue = record.value.value as number;\n }\n\n let size: number | undefined;\n let min = 0;\n let max = 100;\n let step: number | undefined;\n let showTooltip: boolean | undefined;\n let tooltipBelow: boolean | undefined;\n let formatTooltip: ((value: number) => string) | undefined;\n let tickLabels: string[] | undefined;\n let minLabel: React.ReactNode | undefined;\n let maxLabel: React.ReactNode | undefined;\n let trackDisplayMode:\n | \"auto\"\n | \"none\"\n | \"odd-segments\"\n | \"even-segments\"\n | undefined;\n let thumbMode: \"allow-crossing\" | \"inhibit-crossing\" | undefined;\n\n if (\n record &&\n record.property &&\n record.property.editor &&\n record.property.editor.params\n ) {\n const sliderParams = record.property.editor.params.find(\n (param: PropertyEditorParams) =>\n param.type === PropertyEditorParamTypes.Slider.valueOf()\n ) as SliderEditorParams;\n if (sliderParams) {\n min = sliderParams.minimum;\n max = sliderParams.maximum;\n size = sliderParams.size;\n step = sliderParams.step;\n thumbMode =\n 1 === sliderParams.mode ? \"allow-crossing\" : \"inhibit-crossing\";\n trackDisplayMode = !sliderParams.reversed ? \"auto\" : \"odd-segments\";\n showTooltip = sliderParams.showTooltip;\n tooltipBelow = sliderParams.tooltipBelow;\n formatTooltip = sliderParams.formatTooltip;\n\n minLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.minIconSpec ? (\n <Icon iconSpec={sliderParams.minIconSpec} />\n ) : undefined;\n maxLabel = !sliderParams.showMinMax ? (\n \"\"\n ) : sliderParams.maxIconSpec ? (\n <Icon iconSpec={sliderParams.maxIconSpec} />\n ) : undefined;\n\n if (sliderParams.showTicks) {\n const count = sliderParams.getTickCount\n ? sliderParams.getTickCount()\n : 0;\n if (count) {\n tickLabels = [];\n const increment = (max - min) / count;\n for (let i = 0; i <= count; i++) {\n const value = i * increment + min;\n if (sliderParams.showTickLabels) {\n const label = sliderParams.formatTick\n ? sliderParams.formatTick(value)\n : this.internalFormatTooltip(value, step);\n tickLabels.push(label);\n } else {\n tickLabels.push(\"\");\n }\n }\n } else if (sliderParams.getTickValues) {\n tickLabels = sliderParams\n .getTickValues()\n .map((val: number) =>\n sliderParams.formatTick\n ? sliderParams.formatTick(val)\n : this.internalFormatTooltip(val, step)\n );\n }\n }\n }\n }\n\n if (this._isMounted)\n this.setState({\n value: initialValue,\n size,\n min,\n max,\n step,\n trackDisplayMode,\n showTooltip,\n tooltipBelow,\n formatTooltip,\n minLabel,\n maxLabel,\n tickLabels,\n thumbMode,\n });\n }\n\n private _handleEnter = async (): Promise<void> => {\n this._enterKey = true;\n await this._handleCommit();\n };\n\n private _handleClose = async (): Promise<void> => {\n if (this._enterKey) {\n this._enterKey = false;\n } else {\n if (this.props.onCancel) this.props.onCancel();\n }\n };\n\n private _handleOk = async (_event: React.MouseEvent): Promise<void> => {\n await this._handleCommit();\n };\n\n private _handleCancel = (_event: React.MouseEvent): void => {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n };\n\n private _handleCommit = async (): Promise<void> => {\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n if (propertyValue !== undefined) {\n this.props.onCommit({\n propertyRecord: this.props.propertyRecord,\n newValue: propertyValue,\n });\n }\n }\n };\n\n private tooltipProps = (_index: number, val: number) => {\n const content = this.state.formatTooltip\n ? this.state.formatTooltip(val)\n : this.internalFormatTooltip(val, this.state.step);\n return {\n placement: this.state.tooltipBelow ? \"bottom\" : \"top\",\n content,\n visible: this.state.showTooltip,\n } as Partial<Omit<TooltipProps, \"children\">>;\n };\n\n public override render(): React.ReactNode {\n const className = classnames(\n \"components-cell-editor\",\n \"components-slider-editor\",\n this.props.className\n );\n const minSize = this.state.size ? this.state.size : 100;\n const style: React.CSSProperties = {\n ...this.props.style,\n minWidth: `${minSize}px`,\n };\n\n const tickProps = {\n \"data-testid\": \"components-tick\",\n } as React.ComponentProps<\"span\">;\n const popupContent = (\n <Slider\n className=\"components-slider-editor-slider\"\n style={style}\n values={[this.state.value]}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n thumbMode={this.state.thumbMode}\n trackDisplayMode={this.state.trackDisplayMode}\n disabled={this.props.propertyRecord?.isDisabled}\n minLabel={this.state.minLabel}\n maxLabel={this.state.maxLabel}\n tooltipProps={this.tooltipProps}\n tickLabels={this.state.tickLabels}\n tickProps={tickProps}\n onChange={this._handleChange}\n />\n );\n\n return (\n <div className={className} ref={this._divElement}>\n <PopupButton\n id={this.props.propertyRecord?.property.name}\n label={this.state.value}\n onClose={this._handleClose}\n onEnter={this._handleEnter}\n setFocus={this.props.setFocus}\n disabled={this.props.propertyRecord?.isDisabled}\n readonly={this.props.propertyRecord?.isReadonly}\n >\n <PopupContent>\n {popupContent}\n <PopupOkCancelButtons\n onOk={this._handleOk}\n onCancel={this._handleCancel}\n />\n </PopupContent>\n </PopupButton>\n </div>\n );\n }\n}\n\n/** Slider Property Editor registered for the \"number\" type name and \"slider\" editor name.\n * It uses the [[SliderEditor]] React component.\n * @public\n * @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.\n */\nexport class SliderPropertyEditor extends PropertyEditorBase {\n public get reactNode(): React.ReactNode {\n return <SliderEditor />;\n }\n}\n"]}
|
|
@@ -16,6 +16,7 @@ interface TextEditorState {
|
|
|
16
16
|
}
|
|
17
17
|
/** TextEditor React component that is a property editor with text input
|
|
18
18
|
* @public
|
|
19
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
19
20
|
*/
|
|
20
21
|
export declare class TextEditor extends React.PureComponent<PropertyEditorProps, TextEditorState> implements TypeEditor {
|
|
21
22
|
private _isMounted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/components-react/editors/TextEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAKV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,sBAAsB,CAAC;AAQ9B,gBAAgB;AAChB,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,UACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,eAAe,CAChE,YAAW,UAAU;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAuC;IAE5D,SAAyB,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAGvD;IAEW,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAenE,IAAW,WAAW,IAAI,WAAW,GAAG,IAAI,CAE3C;IAED,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,QAAQ,CAOd;IAEF,OAAO,CAAC,iBAAiB,CAqBvB;IAEc,iBAAiB;IAKjB,oBAAoB;IAIpC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;YAMnD,iBAAiB;IAqDf,MAAM,IAAI,KAAK,CAAC,SAAS;CA0C1C"}
|
|
@@ -15,6 +15,7 @@ import { TypeConverterManager } from "../converters/TypeConverterManager.js";
|
|
|
15
15
|
import { UiComponents } from "../UiComponents.js";
|
|
16
16
|
/** TextEditor React component that is a property editor with text input
|
|
17
17
|
* @public
|
|
18
|
+
* @deprecated in 5.30. This is part of the old editor system and should not be used directly. Use {@link EditorRenderer} instead.
|
|
18
19
|
*/
|
|
19
20
|
export class TextEditor extends React.PureComponent {
|
|
20
21
|
_isMounted = false;
|
|
@@ -139,9 +140,7 @@ export class TextEditor extends React.PureComponent {
|
|
|
139
140
|
autoFocus: this.props.setFocus && !this.props.propertyRecord?.isDisabled,
|
|
140
141
|
"aria-label": UiComponents.translate("editor.text"),
|
|
141
142
|
};
|
|
142
|
-
const icon = this.state.iconSpec ? (
|
|
143
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
144
|
-
React.createElement(Icon, { iconSpec: this.state.iconSpec })) : undefined;
|
|
143
|
+
const icon = this.state.iconSpec ? (React.createElement(Icon, { iconSpec: this.state.iconSpec })) : undefined;
|
|
145
144
|
return (React.createElement(LockTextEditor, { ...inputProps, ref: this._inputElement, id: this.props.propertyRecord?.property.name, icon: icon, decoration: decoration }));
|
|
146
145
|
}
|
|
147
146
|
}
|
|
@@ -154,9 +153,7 @@ const LockTextEditor = React.forwardRef(function LockTextEditor(props, forwarded
|
|
|
154
153
|
decoration));
|
|
155
154
|
}
|
|
156
155
|
if (icon) {
|
|
157
|
-
return (
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
159
|
-
React.createElement(IconInput, { ...rest, ref: forwardedRef, icon: icon, "data-testid": "components-text-editor" }));
|
|
156
|
+
return (React.createElement(IconInput, { ...rest, ref: forwardedRef, icon: icon, "data-testid": "components-text-editor" }));
|
|
160
157
|
}
|
|
161
158
|
return (React.createElement(Input, { ...rest, ref: forwardedRef, "data-testid": "components-text-editor", size: "small" }));
|
|
162
159
|
});
|