'use strict'; /* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| IBM Cognos Products: BI Dashboard *| (C) Copyright IBM Corp. 2016, 2019 *| US Government Users Restricted Rights - Use, duplication or disclosure *| restricted by GSA ADP Schedule Contract with IBM Corp. *+------------------------------------------------------------------------+ */ define(['jquery', './DataSlotsView', '../../../lib/@waca/baglass/js/baglass/utils/Utils', '../../../lib/@waca/core-client/js/core-client/utils/Utils', '../../../widgets/livewidget/nls/StringResources'], function ($, SlotsView, Utils, UtilsClient, resources) { 'use strict'; var DataShapeSlotsView = SlotsView.extend({ init: function init() { DataShapeSlotsView.inherited('init', this, arguments); }, onDrop: function onDrop(dragObject, dropNode) { this._clearToolbar(); this._dismissCoachMark(); $(dropNode).removeClass('draggedOn'); if (dragObject.widgetType && dragObject.widgetType === 'shape') { this.widget.onAddShapeWidget({ shapeModel: dragObject.widgetSpec.model, dropNode: dropNode }); } else { DataShapeSlotsView.inherited('onDrop', this, arguments); } }, /** * trigger to close the coach mark popover. * The coach mark will be dismissed for the user. * Because click anywhere on the screen closes coachmark and dropping shape requires to click shape panel * the coachmark is the shape drop coachmark */ _dismissCoachMark: function _dismissCoachMark() { $('.coachMarkPopover .coachMarkClose').trigger('primaryaction'); }, _preserveData: function _preserveData(slot, mapping) { if (mapping && slot.mapping) { if (slot.mapping.graphic) { mapping.graphic = slot.mapping.graphic; } if (slot.mapping.shapeDropEnabled) { mapping.shapeDropEnabled = slot.mapping.shapeDropEnabled; } } }, /** * a helper method to render a coachmark for dropping shape and expand the content automatically */ _addDropShapeCoachMark: function _addDropShapeCoachMark() { var $target = this.$el.find('.listitem.columnName'); var options = { id: $target.attr('data-column-id'), $el: $target, title: resources.get('toolbarActionToggleShapeDropTitle'), contents: resources.get('toolbarActionToggleShapeDropText'), showPopover: true }; this.dashboardApi.prepareGlassOptions(options); Utils.addCoachmark(options); }, /** * a helper method to open the shape panel by searching glass plugin and trigger a click event */ _openShapePanel: function _openShapePanel() { var plugin = this.dashboardApi.findGlassPlugin('com.ibm.bi.dashboard.widgetsPanel'); if (plugin && !plugin.$el.hasClass('pushed')) { plugin.$el.trigger('click'); } } }); return DataShapeSlotsView; }); //# sourceMappingURL=DataShapeSlotsView.js.map