@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
88 lines • 4.39 kB
JavaScript
import { ResizeGripsPermissions } from "@aurigma/design-atoms-model/Product/Items/ResizeGripsPermissions";
var Permission = /** @class */ (function () {
function Permission(options, defaultValue) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (options == null)
options = {};
if (defaultValue == null)
defaultValue = true;
this.noPrint = (_a = options.NoPrint) !== null && _a !== void 0 ? _a : defaultValue;
this.noShow = (_b = options.NoShow) !== null && _b !== void 0 ? _b : defaultValue;
this.allowDelete = (_c = options.AllowDelete) !== null && _c !== void 0 ? _c : defaultValue;
this.allowMoveHorizontal = (_d = options.AllowMoveHorizontal) !== null && _d !== void 0 ? _d : defaultValue;
this.allowMoveVertical = (_e = options.AllowMoveVertical) !== null && _e !== void 0 ? _e : defaultValue;
this.allowRotate = (_f = options.AllowRotate) !== null && _f !== void 0 ? _f : defaultValue;
this.resizeGrips = options.ResizeGrips == null
? new ResizeGripsPermissions(defaultValue, defaultValue)
: ResizeGripsPermissions._fromData(options.ResizeGrips);
this.allowEditContent = (_g = options.AllowEditContent) !== null && _g !== void 0 ? _g : defaultValue;
this.showSelectButton = (_h = options.ShowSelectButton) !== null && _h !== void 0 ? _h : defaultValue;
this.showHandleButton = (_j = options.ShowHandleButton) !== null && _j !== void 0 ? _j : defaultValue;
this.showDoneButton = (_k = options.ShowDoneButton) !== null && _k !== void 0 ? _k : defaultValue;
this.showDeleteToolbarButton = (_l = options.ShowDeleteToolbarButton) !== null && _l !== void 0 ? _l : defaultValue;
this.showEditToolbarButton = (_m = options.ShowEditToolbarButton) !== null && _m !== void 0 ? _m : defaultValue;
this.showSelectToolbarButton = (_o = options.ShowSelectToolbarButton) !== null && _o !== void 0 ? _o : defaultValue;
this.showHandleToolbarButton = (_p = options.ShowHandleToolbarButton) !== null && _p !== void 0 ? _p : defaultValue;
this.allowDragAndDrop = options.AllowDragAndDrop == null ? defaultValue : !!options.AllowDragAndDrop;
}
;
Permission.prototype.clone = function () {
var obj = new Permission();
for (var property in this) {
if (this.hasOwnProperty(property)) {
if (property !== "resizeGrips")
obj[property] = this[property];
else
obj.resizeGrips = this.resizeGrips != null ? this.resizeGrips.clone() : null;
}
}
return obj;
};
Object.defineProperty(Permission.prototype, "allowProportionalResize", {
get: function () {
return this.resizeGrips.getCornerProportional();
},
set: function (value) {
this.resizeGrips.setCornerProportional(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Permission.prototype, "allowArbitraryResize", {
get: function () {
if (!this.resizeGrips)
return false;
return this.resizeGrips.getCornerArbitrary() || this.resizeGrips.edge;
},
set: function (value) {
this.resizeGrips.setCornerArbitrary(value);
this.resizeGrips.edge = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Permission.prototype, "allowResize", {
get: function () {
return this.allowProportionalResize || this.allowArbitraryResize;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Permission.prototype, "allowFreeMove", {
get: function () {
return this.allowMoveHorizontal && this.allowMoveVertical;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Permission.prototype, "allowMove", {
get: function () {
return this.allowMoveHorizontal || this.allowMoveVertical;
},
enumerable: true,
configurable: true
});
return Permission;
}());
export { Permission };
//# sourceMappingURL=Permission.js.map