UNPKG

@itwin/appui-abstract

Version:
72 lines 2.53 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Dialog */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DialogProperty = void 0; /** [[DialogProperty]] is a generic helper class that assists working with properties used by UiLayoutDataProvider implementations (i.e. Tool Settings and Dynamic Dialogs). * @public */ class DialogProperty { description; _value; _displayValue; _isDisabled; constructor(description, _value, _displayValue, _isDisabled) { this.description = description; this._value = _value; this._displayValue = _displayValue; this._isDisabled = _isDisabled; } get isDisabled() { return !!this._isDisabled; } set isDisabled(val) { this._isDisabled = val; } get value() { return this._value; } set value(val) { this._value = val; } get name() { return this.description.name; } set displayValue(val) { this._displayValue = val; } get displayValue() { return this._displayValue; } get dialogItemValue() { // istanbul ignore else if (typeof this._value === "string" || typeof this._value === "number" || typeof this._value === "undefined" || typeof this._value === "boolean" || this._value instanceof Date) return { value: this._value, displayValue: this._displayValue, }; // istanbul ignore next throw new Error("Not valid primitive type"); } set dialogItemValue(val) { this._value = val.value; this._displayValue = val.displayValue; } get syncItem() { const isDisabled = this._isDisabled; return { propertyName: this.name, value: this.dialogItemValue, isDisabled }; } get item() { return { propertyName: this.name, value: this.dialogItemValue }; } toDialogItem(editorPosition, lockProperty) { return { value: this.dialogItemValue, property: this.description, editorPosition, isDisabled: this._isDisabled, lockProperty }; } } exports.DialogProperty = DialogProperty; //# sourceMappingURL=DialogItem.js.map