@itwin/appui-abstract
Version:
iTwin.js UI abstractions
51 lines • 1.81 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
*/
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;
this.editor = {
name: StandardEditorNames.NumberCustom,
params: [{
type: PropertyEditorParamTypes.CustomFormattedNumber,
formatFunction: this.format,
parseFunction: this.parse,
},
],
};
// istanbul ignore else
if (iconSpec) {
const params = {
type: PropertyEditorParamTypes.Icon,
definition: { iconSpec },
};
this.editor.params.push(params);
}
}
format = (numberValue) => {
return this.formatValue(numberValue);
};
parse = (userInput) => {
return this.parseString(userInput);
};
}
//# sourceMappingURL=BaseQuantityDescription.js.map