UNPKG

@itwin/appui-abstract

Version:
51 lines 1.81 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Properties */ import { PropertyEditorParamTypes } from "../properties/EditorParams"; import { StandardTypeNames } from "../properties/StandardTypeNames"; import { StandardEditorNames } from "../properties/StandardEditorNames"; /** * Base Quantity Property Description * @beta */ export class BaseQuantityDescription { name; displayLabel; typename; editor; kindOfQuantityName; constructor(name, displayLabel, iconSpec, kindOfQuantityName) { this.name = name; this.displayLabel = displayLabel; this.kindOfQuantityName = kindOfQuantityName; this.typename = StandardTypeNames.Number; const editorParams = [{ type: PropertyEditorParamTypes.CustomFormattedNumber, formatFunction: this.format, parseFunction: this.parse, }]; this.editor = { name: StandardEditorNames.NumberCustom, params: editorParams, }; // istanbul ignore else if (iconSpec) { const params = { type: PropertyEditorParamTypes.Icon, definition: { iconSpec }, }; editorParams.push(params); } } format = (numberValue) => { return this.formatValue(numberValue); }; parse = (userInput) => { return this.parseString(userInput); }; } //# sourceMappingURL=BaseQuantityDescription.js.map