'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2019 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../../../widgets/livewidget/nls/StringResources', '../../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../api/SlotActionsProviderAPI'], function (stringResources, APIFactory, SlotActionsProviderAPI) { return function () { function RemoveShapeAction(_ref) { var content = _ref.content, features = _ref.features; _classCallCheck(this, RemoveShapeAction); this.content = content; if (features) { features.SlotActions.registerProvider('removeShapeAction', this.getAPI()); } } RemoveShapeAction.prototype.getSlotActionList = function getSlotActionList(dataSlotId, itemIndex) { if (this._supportAction()) { return [{ name: 'removeShapeAction', label: stringResources.get('toolbarActionRmvShape'), icon: 'dashboard-shapeOff', type: 'Button', removeThenApplyAction: true, actions: { apply: this.removeShape.bind(this, dataSlotId, itemIndex) } }]; } return []; }; RemoveShapeAction.prototype._supportAction = function _supportAction() { return this.content.getPropertyValue('value.graphic.content') && this.content.getPropertyNameList().indexOf('value.graphic.content') !== -1; }; RemoveShapeAction.prototype.removeShape = function removeShape() { this.content.setPropertyValue('value.graphic.content', null); }; RemoveShapeAction.prototype.getAPI = function getAPI() { if (!this._api) { this._api = APIFactory.createAPI(this, [SlotActionsProviderAPI]); } return this._api; }; return RemoveShapeAction; }(); }); //# sourceMappingURL=RemoveShapeAction.js.map