{"version":3,"sources":["../rollupPluginBabelHelpers","../src/popover.js","../src/confirmation.js"],"names":["_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_objectSpread","arguments","source","ownKeys","keys","getOwnPropertySymbols","concat","filter","sym","getOwnPropertyDescriptor","forEach","obj","value","fn","popover","$","Constructor","VERSION","split","shift","Error","activeConfirmation","Popover","NAME","DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","BTN_CLASS_DEFAULT","DefaultType","singleton","popout","copyAttributes","onConfirm","onCancel","btnOkClass","btnOkLabel","btnOkIconClass","btnOkIconContent","btnCancelClass","btnCancelLabel","btnCancelIconClass","btnCancelIconContent","buttons","Default","_attributes","_selector","placement","title","trigger","confirmationEvent","undefined","content","noop","template","ClassName","Selector","Keymap","13","27","39","40","Event","HIDE","HIDDEN","SHOW","SHOWN","INSERTED","CLICK","FOCUSIN","FOCUSOUT","MOUSEENTER","MOUSELEAVE","CONFIRMED","CANCELED","KEYUP","Confirmation","subClass","superClass","protoProps","staticProps","element","config","_this","_Popover","call","this","rootSelector","_isDelegate","selector","_copyAttributes","_setConfirmationListeners","prototype","create","constructor","__proto__","isWithContent","setContent","$tip","getTipElement","_getContent","setElementContent","find","getTitle","toggle","_setCustomButtons","_setStandardButtons","removeClass","_setupKeyupEvent","dispose","_cleanKeyupEvent","hide","callback","_this2","attr","self","on","e","ack","preventDefault","stopPropagation","stopImmediatePropagation","not","data","confirmation","eventBody","uid","id","getUID","is","off","btnApply","addClass","html","prepend","text","one","btnDismiss","$group","empty","button","btn","class","label","iconClass","iconContent","onClick","cancel","append","window","_onKeyup","bind","event","tip","$next","keyCode","which","$active","next","children","first","focus","prev","last","prefix","Math","random","document","getElementById","_jQueryInterface","each","_config","test","TypeError","noConflict"],"mappings":";;;;;;gOAEA,SAASA,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,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,GAAGU,GAAMP,YAAc2D,EACzB5D,EAAEF,GAAGU,GAAMsJ,WAAa,WAEtB,OADA9J,EAAEF,GAAGU,GAAQG,EACNiD,EAAa6F","sourcesContent":["export { _createClass as createClass, _defineProperty as defineProperty, _objectSpread as objectSpread, _inheritsLoose as inheritsLoose, _assertThisInitialized as assertThisInitialized };\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import $ from 'jquery';\nimport 'bootstrap';\n\nif (typeof $.fn.popover === 'undefined' || $.fn.popover.Constructor.VERSION.split('.').shift() !== '4') {\n throw new Error('Bootstrap Confirmation 4 requires Bootstrap Popover 4');\n}\n\nconst Popover = $.fn.popover.Constructor;\n\nexport default Popover;\n","import $ from 'jquery';\nimport Popover from 'bootstrap/js/src/popover';\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'confirmation';\nconst VERSION = '4.0.1';\nconst DATA_KEY = `bs.${NAME}`;\nconst EVENT_KEY = `.${DATA_KEY}`;\nconst JQUERY_NO_CONFLICT = $.fn[NAME];\nconst BTN_CLASS_DEFAULT = 'btn btn-sm h-100 d-flex align-items-center';\n\nconst DefaultType = {\n ...Popover.DefaultType,\n singleton : 'boolean',\n popout : 'boolean',\n copyAttributes : '(string|array)',\n onConfirm : 'function',\n onCancel : 'function',\n btnOkClass : 'string',\n btnOkLabel : 'string',\n btnOkIconClass : 'string',\n btnOkIconContent : 'string',\n btnCancelClass : 'string',\n btnCancelLabel : 'string',\n btnCancelIconClass : 'string',\n btnCancelIconContent: 'string',\n buttons : 'array',\n};\n\nconst Default = {\n ...Popover.Default,\n _attributes : {},\n _selector : null,\n placement : 'top',\n title : 'Are you sure?',\n trigger : 'click',\n confirmationEvent : undefined,\n content : '',\n singleton : false,\n popout : false,\n copyAttributes : 'href target',\n onConfirm : $.noop,\n onCancel : $.noop,\n btnOkClass : 'btn-primary',\n btnOkLabel : 'Yes',\n btnOkIconClass : '',\n btnOkIconContent : '',\n btnCancelClass : 'btn-secondary',\n btnCancelLabel : 'No',\n btnCancelIconClass : '',\n btnCancelIconContent: '',\n buttons : [],\n // @formatter:off\n // href=\"#\" allows the buttons to be focused\n template : `\n
\n
\n

\n
\n

\n
\n
\n \n \n
\n
\n
\n
`,\n // @formatter:on\n};\n\nconst ClassName = {\n FADE: 'fade',\n SHOW: 'show',\n};\n\nconst Selector = {\n TITLE : '.popover-header',\n CONTENT : '.confirmation-content',\n BUTTONS : '.confirmation-buttons .btn-group',\n BTN_APPLY : '[data-apply=confirmation]',\n BTN_DISMISS: '[data-dismiss=confirmation]',\n};\n\nconst Keymap = {\n 13: 'Enter',\n 27: 'Escape',\n 39: 'ArrowRight',\n 40: 'ArrowDown',\n};\n\nconst Event = {\n HIDE : `hide${EVENT_KEY}`,\n HIDDEN : `hidden${EVENT_KEY}`,\n SHOW : `show${EVENT_KEY}`,\n SHOWN : `shown${EVENT_KEY}`,\n INSERTED : `inserted${EVENT_KEY}`,\n CLICK : `click${EVENT_KEY}`,\n FOCUSIN : `focusin${EVENT_KEY}`,\n FOCUSOUT : `focusout${EVENT_KEY}`,\n MOUSEENTER: `mouseenter${EVENT_KEY}`,\n MOUSELEAVE: `mouseleave${EVENT_KEY}`,\n CONFIRMED : `confirmed${EVENT_KEY}`,\n CANCELED : `canceled${EVENT_KEY}`,\n KEYUP : `keyup${EVENT_KEY}`,\n};\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n// keep track of the last openned confirmation for keyboard navigation\nlet activeConfirmation;\n\nclass Confirmation extends Popover {\n // Getters\n\n static get VERSION() {\n return VERSION;\n }\n\n static get Default() {\n return Default;\n }\n\n static get NAME() {\n return NAME;\n }\n\n static get DATA_KEY() {\n return DATA_KEY;\n }\n\n static get Event() {\n return Event;\n }\n\n static get EVENT_KEY() {\n return EVENT_KEY;\n }\n\n static get DefaultType() {\n return DefaultType;\n }\n\n // Constructor\n\n constructor(element, config) {\n super(element, config);\n\n if ((this.config.popout || this.config.singleton) && !this.config.rootSelector) {\n throw new Error('The rootSelector option is required to use popout and singleton features since jQuery 3.');\n }\n\n // keep trace of selectors\n this._isDelegate = false;\n\n if (config.selector) { // container of buttons\n config._selector = `${config.rootSelector} ${config.selector}`;\n this.config._selector = config._selector;\n }\n else if (config._selector) { // children of container\n this.config._selector = config._selector;\n this._isDelegate = true;\n }\n else { // standalone\n this.config._selector = config.rootSelector;\n }\n\n if (this.config.confirmationEvent === undefined) {\n this.config.confirmationEvent = this.config.trigger;\n }\n\n if (!this.config.selector) {\n this._copyAttributes();\n }\n\n this._setConfirmationListeners();\n }\n\n // Overrides\n\n isWithContent() {\n return true;\n }\n\n setContent() {\n const $tip = $(this.getTipElement());\n let content = this._getContent();\n\n if (typeof content === 'function') {\n content = content.call(this.element);\n }\n\n this.setElementContent($tip.find(Selector.TITLE), this.getTitle());\n\n $tip.find(Selector.CONTENT).toggle(!!content);\n if (content) {\n this.setElementContent($tip.find(Selector.CONTENT), content);\n }\n\n if (this.config.buttons.length > 0) {\n this._setCustomButtons($tip);\n }\n else {\n this._setStandardButtons($tip);\n }\n\n $tip.removeClass(`${ClassName.FADE} ${ClassName.SHOW}`);\n\n this._setupKeyupEvent();\n }\n\n dispose() {\n this._cleanKeyupEvent();\n super.dispose();\n }\n\n hide(callback) {\n this._cleanKeyupEvent();\n super.hide(callback);\n }\n\n // Private\n\n /**\n * Copy the value of `copyAttributes` on the config object\n * @private\n */\n _copyAttributes() {\n this.config._attributes = {};\n if (this.config.copyAttributes) {\n if (typeof this.config.copyAttributes === 'string') {\n this.config.copyAttributes = this.config.copyAttributes.split(' ');\n }\n }\n else {\n this.config.copyAttributes = [];\n }\n\n this.config.copyAttributes.forEach((attr) => {\n this.config._attributes[attr] = $(this.element).attr(attr);\n });\n }\n\n /**\n * Custom event listeners for popouts and singletons\n * @private\n */\n _setConfirmationListeners() {\n const self = this;\n\n if (!this.config.selector) {\n // cancel original event\n $(this.element).on(this.config.trigger, (e, ack) => {\n if (!ack) {\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n });\n\n // manage singleton\n $(this.element).on(Event.SHOWN, function () {\n if (self.config.singleton) {\n // close all other popover already initialized\n $(self.config._selector).not($(this)).filter(function () {\n return $(this).data(DATA_KEY) !== undefined;\n }).confirmation('hide');\n }\n });\n }\n else {\n // cancel original event\n $(this.element).on(this.config.trigger, this.config.selector, (e, ack) => {\n if (!ack) {\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n });\n }\n\n if (!this._isDelegate) {\n // manage popout\n this.eventBody = false;\n this.uid = this.element.id || Confirmation.getUID(`${NAME}_group`);\n\n $(this.element).on(Event.SHOWN, () => {\n if (self.config.popout && !self.eventBody) {\n self.eventBody = $('body').on(`${Event.CLICK}.${self.uid}`, (e) => {\n if ($(self.config._selector).is(e.target)) {\n return;\n }\n // close all popover already initialized\n $(self.config._selector).filter(function () {\n return $(this).data(DATA_KEY) !== undefined;\n }).confirmation('hide');\n\n $('body').off(`${Event.SHOWN}.${self.uid}`);\n self.eventBody = false;\n });\n }\n });\n }\n }\n\n /**\n * Init the standard ok/cancel buttons\n * @param $tip\n * @private\n */\n _setStandardButtons($tip) {\n const self = this;\n\n const btnApply = $tip.find(Selector.BTN_APPLY)\n .addClass(this.config.btnOkClass)\n .html(this.config.btnOkLabel)\n .attr(this.config._attributes);\n\n if (this.config.btnOkIconClass || this.config.btnOkIconContent) {\n btnApply.prepend($('')\n .addClass(this.config.btnOkIconClass || '')\n .text(this.config.btnOkIconContent || ''));\n }\n\n btnApply.off('click')\n .one('click', function (e) {\n if ($(this).attr('href') === '#') {\n e.preventDefault();\n }\n\n self.config.onConfirm.call(self.element);\n $(self.element).trigger(Event.CONFIRMED);\n $(self.element).trigger(self.config.confirmationEvent, [true]);\n\n self.hide();\n });\n\n const btnDismiss = $tip.find(Selector.BTN_DISMISS)\n .addClass(this.config.btnCancelClass)\n .html(this.config.btnCancelLabel);\n\n if (this.config.btnCancelIconClass || this.config.btnCancelIconContent) {\n btnDismiss.prepend($('')\n .addClass(this.config.btnCancelIconClass || '')\n .text(this.config.btnCancelIconContent || ''));\n }\n\n btnDismiss.off('click')\n .one('click', (e) => {\n e.preventDefault();\n\n self.config.onCancel.call(self.element);\n $(self.element).trigger(Event.CANCELED);\n\n self.hide();\n });\n }\n\n /**\n * Init the custom buttons\n * @param $tip\n * @private\n */\n _setCustomButtons($tip) {\n const self = this;\n const $group = $tip.find(Selector.BUTTONS).empty();\n\n this.config.buttons.forEach((button) => {\n const btn = $('')\n .addClass(BTN_CLASS_DEFAULT)\n .addClass(button.class || 'btn btn-secondary')\n .html(button.label || '')\n .attr(button.attr || {});\n\n if (button.iconClass || button.iconContent) {\n btn.prepend($('')\n .addClass(button.iconClass || '')\n .text(button.iconContent || ''));\n }\n\n btn.one('click', function (e) {\n if ($(this).attr('href') === '#') {\n e.preventDefault();\n }\n\n if (button.onClick) {\n button.onClick.call($(self.element));\n }\n\n if (button.cancel) {\n self.config.onCancel.call(self.element, button.value);\n $(self.element).trigger(Event.CANCELED, [button.value]);\n }\n else {\n self.config.onConfirm.call(self.element, button.value);\n $(self.element).trigger(Event.CONFIRMED, [button.value]);\n }\n\n self.hide();\n });\n\n $group.append(btn);\n });\n }\n\n /**\n * Install the keyboatd event handler\n * @private\n */\n _setupKeyupEvent() {\n activeConfirmation = this;\n $(window)\n .off(Event.KEYUP)\n .on(Event.KEYUP, this._onKeyup.bind(this));\n }\n\n /**\n * Remove the keyboard event handler\n * @private\n */\n _cleanKeyupEvent() {\n if (activeConfirmation === this) {\n activeConfirmation = undefined;\n $(window).off(Event.KEYUP);\n }\n }\n\n /**\n * Event handler for keyboard navigation\n * @param event\n * @private\n */\n _onKeyup(event) {\n if (!this.tip) {\n this._cleanKeyupEvent();\n return;\n }\n\n const $tip = $(this.getTipElement());\n const key = event.key || Keymap[event.keyCode || event.which];\n\n const $group = $tip.find(Selector.BUTTONS);\n const $active = $group.find('.active');\n let $next;\n\n switch (key) {\n case 'Escape':\n this.hide();\n break;\n\n case 'ArrowRight':\n if ($active.length && $active.next().length) {\n $next = $active.next();\n }\n else {\n $next = $group.children().first();\n }\n $active.removeClass('active');\n $next.addClass('active').focus();\n break;\n\n case 'ArrowLeft':\n if ($active.length && $active.prev().length) {\n $next = $active.prev();\n }\n else {\n $next = $group.children().last();\n }\n $active.removeClass('active');\n $next.addClass('active').focus();\n break;\n\n default:\n break;\n }\n }\n\n // Static\n\n /**\n * Generates an uui, copied from Bootrap's utils\n * @param {string} prefix\n * @returns {string}\n */\n static getUID(prefix) {\n let uid = prefix;\n do {\n // eslint-disable-next-line no-bitwise\n uid += ~~(Math.random() * 1000000); // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(uid));\n return uid;\n }\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let data = $(this).data(DATA_KEY);\n\n const _config = typeof config === 'object' ? config : {};\n _config.rootSelector = $(this).selector || _config.rootSelector; // this.selector removed in jQuery > 3\n\n if (!data && /destroy|hide/.test(config)) {\n return;\n }\n\n if (!data) {\n data = new Confirmation(this, _config);\n $(this).data(DATA_KEY, data);\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`);\n }\n data[config]();\n }\n });\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Confirmation._jQueryInterface;\n$.fn[NAME].Constructor = Confirmation;\n$.fn[NAME].noConflict = function () {\n $.fn[NAME] = JQUERY_NO_CONFLICT;\n return Confirmation._jQueryInterface;\n};\n\nexport default Confirmation;\n"]}