'use strict'; /** * Licensed Materials - Property of IBM * * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2020 * * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['jquery', 'doT', '../../../widgets/livewidget/nls/StringResources', '../../../lib/@waca/dashboard-common/dist/utils/FlyoutContentBase', '../../../data/models/ConditionalPalette', 'text!./templates/ConditionalFlyoutView.html'], function ($, dot, stringResources, FlyoutContentBase, ConditionalPalette, RemoveHandleTemplate) { 'use strict'; var removeHandleTemplate = dot.template(RemoveHandleTemplate); var ConditionalFlyoutView = FlyoutContentBase.extend({ init: function init() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; ConditionalFlyoutView.inherited('init', this, arguments); this.visModel = options.visModel || options.viewOptions.visModel; this.widget = options.widget || options.viewOptions.widget; this.palette = options.palette || options.viewOptions.palette; this.slider = options.slider || options.viewOptions.slider; this.icons = options.viewOptions.icons; this.handlePosition = options.handlePosition || options.viewOptions.handlePosition; this.isVisible = false; }, setFocus: function setFocus() { $('.conditionalFormattingIcon').parent().focus(); }, onPopupShown: function onPopupShown() { this.isVisible = true; }, onPopupClosed: function onPopupClosed() { this.isVisible = false; }, onDeleteClicked: function onDeleteClicked() { this.popupParent.close(); var options = ConditionalPalette.createUndoRedoTransactionOptionsId('removeStyle'); this.palette.removeStyle(this.handlePosition, options); this.visModel.updateConditionalPalette().then(function () { this.slider.removeHandle(this.handlePosition); }.bind(this)); }, getRenderedHtml: function getRenderedHtml() { var trashIcon = this.icons.getIcon('common-remove-trash'); var template = removeHandleTemplate({ remove_slider_handle: stringResources.get('remove_slider_handle'), trashIcon: trashIcon.id }); var $deleteButton = $(template).on('primaryaction', this.onDeleteClicked.bind(this)); var markup = '
'; var $markup = $(markup).append($deleteButton); return $markup[0]; } }); return ConditionalFlyoutView; }); //# sourceMappingURL=ConditionalFlyoutView.js.map