UNPKG

@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 3.9 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { ShapeHandlerData } from "./ShapeHandlerData"; import { HandlerFactoryByName } from "./HandlerFactoryByName"; var PlaceholderHandlerData = /** @class */ (function (_super) { __extends(PlaceholderHandlerData, _super); function PlaceholderHandlerData(handler) { var _this = this; var editing = handler["_editing"]; if (editing) handler["_editing"] = false; _this = _super.call(this, handler) || this; handler["_editing"] = editing; _this.__type = "PlaceholderHandlerData"; if (handler) { if (!handler.isEmptyContent()) { _this.CT = handler.getTypeName(); } else { _this.CT = null; } var topFrames = handler.topFrames; if (topFrames != null) { _this.TFCT = []; _this.TFCD = []; for (var i = 0; i < topFrames.length; i++) { _this.TFCD.push(topFrames[i].getData()); _this.TFCT.push(topFrames[i].getTypeName()); } } var bottomFrames = handler.bottomFrames; if (bottomFrames != null) { _this.BFCT = []; _this.BFCD = []; for (var i = 0; i < bottomFrames.length; i++) { _this.BFCD.push(bottomFrames[i].getData()); _this.BFCT.push(bottomFrames[i].getTypeName()); } } _this.SMC = handler.showMaskedContent; } return _this; } PlaceholderHandlerData.prototype.applyState = function (placeholderData, handler) { if (handler) { handler.beginUpdate(); //call endUpdate in base class if (placeholderData.TFCD != null && placeholderData.TFCD.length !== 0) { var topFrames = []; for (var i = 0; i < placeholderData.TFCD.length; i++) { if (placeholderData.TFCT[i] != null) { var topFrame = new HandlerFactoryByName().create(placeholderData.TFCT[i]); topFrame.setData(placeholderData.TFCD[i]); topFrames.push(topFrame); } } handler.topFrames = topFrames; } if (placeholderData.BFCD != null && placeholderData.BFCD.length !== 0) { var bottomFrames = []; for (var i = 0; i < placeholderData.BFCD.length; i++) { if (placeholderData.BFCT[i] != null) { var bottomFrame = new HandlerFactoryByName().create(placeholderData.BFCT[i]); bottomFrame.setData(placeholderData.BFCD[i]); bottomFrames.push(bottomFrame); } } handler.bottomFrames = bottomFrames; } handler.showMaskedContent = placeholderData.SMC; _super.prototype.applyState.call(this, placeholderData, handler); } }; ; return PlaceholderHandlerData; }(ShapeHandlerData)); export { PlaceholderHandlerData }; //# sourceMappingURL=PlaceholderHandlerData.js.map