UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

56 lines 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.QuantityPropertyEditor = exports.QuantityPropertyEditorBase = exports.QuantityEditorName = void 0; const jsx_runtime_1 = require("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. *--------------------------------------------------------------------------------------------*/ const react_1 = require("react"); const components_react_1 = require("@itwin/components-react"); const QuantityPropertyEditorInput_js_1 = require("../inputs/QuantityPropertyEditorInput.js"); /** * Name for `QuantityPropertyEditor`. * @internal */ exports.QuantityEditorName = "presentation-quantity-editor"; /** * Editor for quantity properties. * @internal */ // eslint-disable-next-line @typescript-eslint/no-deprecated class QuantityPropertyEditorBase extends components_react_1.PropertyEditorBase { /* v8 ignore start -- @preserve */ get reactNode() { return (0, jsx_runtime_1.jsx)(QuantityPropertyEditor, {}); } } exports.QuantityPropertyEditorBase = QuantityPropertyEditorBase; /** * Component that renders quantity property value input * @internal */ // eslint-disable-next-line @typescript-eslint/no-deprecated class QuantityPropertyEditor extends react_1.PureComponent { _ref = (0, react_1.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 ? ((0, jsx_runtime_1.jsx)(QuantityPropertyEditorInput_js_1.QuantityPropertyEditorInput, { ref: this._ref, ...this.props, propertyRecord: this.props.propertyRecord })) : null; } } exports.QuantityPropertyEditor = QuantityPropertyEditor; //# sourceMappingURL=QuantityPropertyEditor.js.map