@itwin/appui-abstract
Version:
iTwin.js UI abstractions
55 lines • 2.05 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseQuantityDescription = void 0;
const EditorParams_1 = require("../properties/EditorParams");
const StandardTypeNames_1 = require("../properties/StandardTypeNames");
const StandardEditorNames_1 = require("../properties/StandardEditorNames");
/**
* Base Quantity Property Description
* @beta
*/
class BaseQuantityDescription {
name;
displayLabel;
typename;
editor;
kindOfQuantityName;
constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
this.name = name;
this.displayLabel = displayLabel;
this.kindOfQuantityName = kindOfQuantityName;
this.typename = StandardTypeNames_1.StandardTypeNames.Number;
this.editor = {
name: StandardEditorNames_1.StandardEditorNames.NumberCustom,
params: [{
type: EditorParams_1.PropertyEditorParamTypes.CustomFormattedNumber,
formatFunction: this.format,
parseFunction: this.parse,
},
],
};
// istanbul ignore else
if (iconSpec) {
const params = {
type: EditorParams_1.PropertyEditorParamTypes.Icon,
definition: { iconSpec },
};
this.editor.params.push(params);
}
}
format = (numberValue) => {
return this.formatValue(numberValue);
};
parse = (userInput) => {
return this.parseString(userInput);
};
}
exports.BaseQuantityDescription = BaseQuantityDescription;
//# sourceMappingURL=BaseQuantityDescription.js.map