UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

55 lines 1.87 kB
import { jsx as _jsx } from "react/jsx-runtime"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ import { createRef, PureComponent } from "react"; import { PropertyEditorBase } from "@itwin/components-react"; import { NumericPropertyInput } from "../inputs/NumericPropertyInput.js"; /** * Name for `NumericPropertyEditor`. * * @internal */ export const NumericEditorName = "presentation-numeric-editor"; /** * Editor for numeric properties. * * @internal */ export class NumericPropertyEditorBase extends PropertyEditorBase { /* c8 ignore start */ get containerHandlesTab() { return false; } get reactNode() { return _jsx(NumericPropertyEditor, {}); } } /** * Component that renders numeric property target input for numeric value editing. * * @internal */ export class NumericPropertyEditor extends PureComponent { _ref = createRef(); /* c8 ignore start */ async getPropertyValue() { return this._ref.current?.getValue(); } get htmlElement() { return this._ref.current?.htmlElement ?? null; } get hasFocus() { if (!this._ref.current?.htmlElement || !document.activeElement) { return false; } return this._ref.current.htmlElement.contains(document.activeElement); } /* c8 ignore end */ /** @internal */ render() { return this.props.propertyRecord ? _jsx(NumericPropertyInput, { ref: this._ref, ...this.props, propertyRecord: this.props.propertyRecord }) : null; } } //# sourceMappingURL=NumericPropertyEditor.js.map