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.

49 lines 2.12 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 { BaseCommand } from "../BaseCommand"; import { SelectionCommand } from "@aurigma/design-atoms-interfaces"; var SelectAllItemsCommand = /** @class */ (function (_super) { __extends(SelectAllItemsCommand, _super); function SelectAllItemsCommand(_viewer, _cm) { var _this = _super.call(this) || this; _this._viewer = _viewer; _this._cm = _cm; return _this; } SelectAllItemsCommand.prototype.execute = function () { if (this._viewer == null) return; var selectedItem = this._viewer.selectedItems[0]; if (selectedItem != null && selectedItem.parentGroupItem != null) { var groupItems = this._filterItems(selectedItem.parentGroupItem.items); return this._cm.execute(SelectionCommand.selectItems, { items: groupItems }); } else { var items = this._filterItems(this._viewer.userEditContainer.items); return this._cm.execute(SelectionCommand.selectItems, { items: items }); } }; SelectAllItemsCommand.prototype._filterItems = function (items) { var _this = this; return items.toArray().filter(function (item) { var itemHandler = _this._viewer.getHandler(item); return itemHandler.isVisible() && !itemHandler.isLocked(); }); ; }; return SelectAllItemsCommand; }(BaseCommand)); export { SelectAllItemsCommand }; //# sourceMappingURL=SelectAllCommand.js.map