UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

102 lines 4.34 kB
import { EventObject } from "../../EventObject"; import { ItemToolbarPermissions } from "./ItemToolbarPermissions"; import { equals } from "../../Utils/Utils"; var ItemPermissions = /** @class */ (function () { function ItemPermissions(defaultValue) { var _this = this; this._allowZOrderChange = true; this._allowOpacityChange = true; this._allowRemoveOnLayoutChange = true; this._firePropertyChanged = function () { return _this.propertyChanged.fire(); }; this.propertyChanged = new EventObject(); if (defaultValue == null) defaultValue = true; this.allowZOrderChange = defaultValue; this.allowOpacityChange = defaultValue; this.allowRemoveOnLayoutChange = defaultValue; this.itemToolbarPermissions = new ItemToolbarPermissions(defaultValue); } Object.defineProperty(ItemPermissions.prototype, "allowZOrderChange", { get: function () { return this._allowZOrderChange; }, set: function (value) { if (this._allowZOrderChange === value) return; this._allowZOrderChange = value; this.propertyChanged.notify(); }, enumerable: true, configurable: true }); Object.defineProperty(ItemPermissions.prototype, "allowOpacityChange", { get: function () { return this._allowOpacityChange; }, set: function (value) { if (this._allowOpacityChange === value) return; this._allowOpacityChange = value; this.propertyChanged.notify(); }, enumerable: true, configurable: true }); Object.defineProperty(ItemPermissions.prototype, "allowRemoveOnLayoutChange", { get: function () { return this._allowRemoveOnLayoutChange; }, set: function (value) { if (this._allowRemoveOnLayoutChange === value) return; this._allowRemoveOnLayoutChange = value; this.propertyChanged.notify(); }, enumerable: true, configurable: true }); Object.defineProperty(ItemPermissions.prototype, "itemToolbarPermissions", { get: function () { return this._itemToolbarPermissions; }, set: function (value) { if (equals(this, value)) return; if (this.itemToolbarPermissions != null && this.itemToolbarPermissions.propertyChanged != null) { this.itemToolbarPermissions.propertyChanged.remove(this._firePropertyChanged); } this._itemToolbarPermissions = value; if (this.itemToolbarPermissions.propertyChanged != null) { this.itemToolbarPermissions.propertyChanged.add(this._firePropertyChanged); } this.propertyChanged.fire(); }, enumerable: true, configurable: true }); ItemPermissions.prototype.getSimplifiedObject = function () { var result = {}; result["allowZOrderChange"] = this.allowZOrderChange; result["allowOpacityChange"] = this.allowOpacityChange; result["allowRemoveOnLayoutChange"] = this.allowRemoveOnLayoutChange; result["itemToolbarPermissions"] = this.itemToolbarPermissions.getSimplifiedObject(); return result; }; ItemPermissions.prototype.clone = function () { var clone = new ItemPermissions(); clone.allowZOrderChange = this.allowZOrderChange; clone.allowOpacityChange = this.allowOpacityChange; clone.allowRemoveOnLayoutChange = this.allowRemoveOnLayoutChange; clone.itemToolbarPermissions = this.itemToolbarPermissions.clone(); return clone; }; ItemPermissions.prototype.equals = function (p) { return this.allowZOrderChange === p.allowZOrderChange && this.allowOpacityChange === p.allowOpacityChange && this.allowRemoveOnLayoutChange === p.allowRemoveOnLayoutChange && equals(this.itemToolbarPermissions, p.itemToolbarPermissions); }; return ItemPermissions; }()); export { ItemPermissions }; //# sourceMappingURL=ItemPermissions.js.map