UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

51 lines 1.97 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 { QuantityPropertyEditorInput } from "../inputs/QuantityPropertyEditorInput.js"; /** * Name for `QuantityPropertyEditor`. * @internal */ export const QuantityEditorName = "presentation-quantity-editor"; /** * Editor for quantity properties. * @internal */ // eslint-disable-next-line @typescript-eslint/no-deprecated export class QuantityPropertyEditorBase extends PropertyEditorBase { /* v8 ignore start -- @preserve */ get reactNode() { return _jsx(QuantityPropertyEditor, {}); } } /** * Component that renders quantity property value input * @internal */ // eslint-disable-next-line @typescript-eslint/no-deprecated export class QuantityPropertyEditor extends PureComponent { _ref = createRef(); /* v8 ignore start -- @preserve */ 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); } /* v8 ignore stop -- @preserve */ /** @internal */ render() { return this.props.propertyRecord ? (_jsx(QuantityPropertyEditorInput, { ref: this._ref, ...this.props, propertyRecord: this.props.propertyRecord })) : null; } } //# sourceMappingURL=QuantityPropertyEditor.js.map