bootstrap-italia 2.8.8-rc1 → 2.8.8-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
const enableDismissTrigger=(e,t="hide")=>{const s=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;EventHandler$1.on(document,s,`[data-bs-dismiss="${i}"]`,(function(s){if(["A","AREA"].includes(this.tagName)&&s.preventDefault(),isDisabled$1(this))return;const n=getElementFromSelector(this)||this.closest(`.${i}`);e.getOrCreateInstance(n)[t]();}));};
|
|
65
65
|
|
|
66
|
-
const NAME$A="notification",DATA_KEY$b="bs.notification",EVENT_KEY$d=`.${DATA_KEY$b}`,EVENT_CLICK_DATA_API$e=`click${EVENT_KEY$d}.data-api`,EVENT_HIDDEN$7=`hidden${EVENT_KEY$d}`,EVENT_SHOW$7=`show${EVENT_KEY$d}`,Default$m={timeout:0},SELECTOR_DATA_TOGGLE$b='[data-bs-toggle="notification"]';class Notification extends BaseComponent{constructor(t,i){super(t),this._config=this._getConfig(i),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1,this._toId=null;}static get NAME(){return NAME$A}show(t,i){if(this._isShown||this._isTransitioning)return;const e=t||this._getElementTimeout(i);this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement(e);}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,t);}toggle(t){this._isShown?this.hide():this.show(null,t);}_isAnimated(){return this._element.classList.contains("fade")}_showElement(t){const i=this._isAnimated();this._element.style.display="block",this._element.removeAttribute("aria-hidden"),i&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1,t&&this._setTimeout(t,(()=>this.hide()));}),this._element,i);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1;}_getConfig(t){return t={...Default$m,...Manipulator.getDataAttributes(this._element),..."object"==typeof t?t:{}}}_getElementTimeout(t){const i=t?parseInt(t.getAttribute("data-bs-timeout")):null;return i>0?i:this._config.timeout}_setTimeout(t,i){this._clearTimeout(),setTimeout(i,t);}_clearTimeout(){this._toId&&(clearTimeout(this._toId),this._toId=null);}}"undefined"!=typeof window&&"undefined"!=typeof document&&EventHandler$1.on(document,EVENT_CLICK_DATA_API$e,SELECTOR_DATA_TOGGLE$b,(function(t){const i=getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),EventHandler$1.one(i,EVENT_SHOW$7,(t=>{t.defaultPrevented||EventHandler$1.one(i,EVENT_HIDDEN$7,(()=>{isVisible(this)&&this.focus();}));}));Notification.getOrCreateInstance(i).toggle(this);})),enableDismissTrigger(Notification);const Notification$1 = Notification;
|
|
66
|
+
const NAME$A="notification",DATA_KEY$b="bs.notification",EVENT_KEY$d=`.${DATA_KEY$b}`,EVENT_CLICK_DATA_API$e=`click${EVENT_KEY$d}.data-api`,EVENT_HIDDEN$7=`hidden${EVENT_KEY$d}`,EVENT_SHOW$7=`show${EVENT_KEY$d}`,Default$m={timeout:0},SELECTOR_DATA_TOGGLE$b='[data-bs-toggle="notification"]';class Notification extends BaseComponent{constructor(t,i){super(t),this._config=this._getConfig(i),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1,this._toId=null;}static get NAME(){return NAME$A}show(t,i){if(this._isShown||this._isTransitioning)return;const e=t||this._getElementTimeout(i);this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement(e);}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,t);}toggle(t){this._isShown?this.hide():this.show(null,t);}_isAnimated(){return this._element.classList.contains("fade")}_showElement(t){const i=this._isAnimated();this._element.style.display="block",this._element.removeAttribute("aria-hidden"),i&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1,t&&this._setTimeout(t,(()=>this.hide()));}),this._element,i);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1;}_getConfig(t){return t={...Default$m,...Manipulator.getDataAttributes(this._element),..."object"==typeof t?t:{}}}_getElementTimeout(t){const i=t?parseInt(t.getAttribute("data-bs-timeout")):null;return i>0?i:this._config.timeout}_setTimeout(t,i){this._clearTimeout(),setTimeout(i,t);}_clearTimeout(){this._toId&&(clearTimeout(this._toId),this._toId=null);}}"undefined"!=typeof window&&"undefined"!=typeof document&&(EventHandler$1.on(document,EVENT_CLICK_DATA_API$e,SELECTOR_DATA_TOGGLE$b,(function(t){const i=getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),EventHandler$1.one(i,EVENT_SHOW$7,(t=>{t.defaultPrevented||EventHandler$1.one(i,EVENT_HIDDEN$7,(()=>{isVisible(this)&&this.focus();}));}));Notification.getOrCreateInstance(i).toggle(this);})),enableDismissTrigger(Notification));const Notification$1 = Notification;
|
|
67
67
|
|
|
68
68
|
const NAME$z="cookiebar",DATA_KEY$a="bs.cookiebar",EVENT_KEY$c=`.${DATA_KEY$a}`,COOKIE_NAME="cookies_consent",SELECTOR_ACCEPT='[data-bs-accept="cookiebar"]',EVENT_CLOSE$1=`close${EVENT_KEY$c}`,EVENT_CLOSED$1=`closed${EVENT_KEY$c}`,EVENT_LOAD_DATA_API$3=`load${EVENT_KEY$c}.data-api`,EVENT_CLICK_DATA_API$d=`click${EVENT_KEY$c}.data-api`;class Cookiebar extends BaseComponent{constructor(e){super(e),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1;}static get NAME(){return NAME$z}static get VERSION(){return "5.0.0"}show(){this._isShown||this._isTransitioning||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement());}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const e=this._isAnimated();e&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,e);}accept(e){e=e||this._element;const t=this._getRootElement(e);this._triggerCloseEvent(t).defaultPrevented||(this._setCookieEU(),this.hide());}static clearCookie(){"undefined"!=typeof document&&(document.cookie=COOKIE_NAME+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;");}_isAnimated(){return this._element.classList.contains("fade")}_showElement(){const e=this._isAnimated();this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-live","polite"),e&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1;}),this._element,e);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-live"),this._isTransitioning=!1;}_setCookieEU(){var e=new Date;e.setDate(e.getDate()+30);var t=escape("true")+"; expires="+e.toUTCString();"undefined"!=typeof document&&(document.cookie=COOKIE_NAME+"="+t+"; path=/; SameSite=Strict");}_getRootElement(e){const t=getElementFromSelector(e);let i=null;return t&&(i=t),i||(i=e.closest(".cookiebar")),i}_triggerCloseEvent(e){return EventHandler$1.trigger(e,EVENT_CLOSE$1)}_removeElement(e){e.classList.remove("show"),e.setAttribute("aria-hidden","true"),e.setAttribute("aria-live","off"),EventHandler$1.trigger(e,EVENT_CLOSED$1),this.dispose();}static _handleAccept(e){return function(t){t&&t.preventDefault(),e.close(this);}}static _handleConsent(e){return function(t){t&&t.preventDefault(),e.close(this);}}static _getCookieEU(){if("undefined"!=typeof document){var e,t,i,s=document.cookie.split(";");for(e=0;e<s.length;e++)if(t=s[e].substring(0,s[e].indexOf("=")),i=s[e].substring(s[e].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))==COOKIE_NAME)return unescape(i)}}}"undefined"!=typeof window&&"undefined"!=typeof document&&(EventHandler$1.on(document,EVENT_CLICK_DATA_API$d,SELECTOR_ACCEPT,(function(e){if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),isDisabled$1(this))return;const t=getElementFromSelector(this)||this.closest(`.${NAME$z}`);Cookiebar.getOrCreateInstance(t).accept();})),EventHandler$1.on(window,EVENT_LOAD_DATA_API$3,(function(){if(!Cookiebar._getCookieEU()){if("undefined"==typeof document)return;document.querySelectorAll(".cookiebar").forEach((e=>{Cookiebar.getOrCreateInstance(e).show();}));}})));const Cookiebar$1 = Cookiebar;
|
|
69
69
|
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
|
|
84
84
|
const enableDismissTrigger=(e,t="hide")=>{const s=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;EventHandler$1.on(document,s,`[data-bs-dismiss="${i}"]`,(function(s){if(["A","AREA"].includes(this.tagName)&&s.preventDefault(),isDisabled(this))return;const n=getElementFromSelector(this)||this.closest(`.${i}`);e.getOrCreateInstance(n)[t]();}));};
|
|
85
85
|
|
|
86
|
-
const NAME$A="notification",DATA_KEY$b="bs.notification",EVENT_KEY$d=`.${DATA_KEY$b}`,EVENT_CLICK_DATA_API$e=`click${EVENT_KEY$d}.data-api`,EVENT_HIDDEN$7=`hidden${EVENT_KEY$d}`,EVENT_SHOW$7=`show${EVENT_KEY$d}`,Default$m={timeout:0},SELECTOR_DATA_TOGGLE$b='[data-bs-toggle="notification"]';class Notification extends BaseComponent{constructor(t,i){super(t),this._config=this._getConfig(i),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1,this._toId=null;}static get NAME(){return NAME$A}show(t,i){if(this._isShown||this._isTransitioning)return;const e=t||this._getElementTimeout(i);this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement(e);}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,t);}toggle(t){this._isShown?this.hide():this.show(null,t);}_isAnimated(){return this._element.classList.contains("fade")}_showElement(t){const i=this._isAnimated();this._element.style.display="block",this._element.removeAttribute("aria-hidden"),i&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1,t&&this._setTimeout(t,(()=>this.hide()));}),this._element,i);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1;}_getConfig(t){return t={...Default$m,...Manipulator.getDataAttributes(this._element),..."object"==typeof t?t:{}}}_getElementTimeout(t){const i=t?parseInt(t.getAttribute("data-bs-timeout")):null;return i>0?i:this._config.timeout}_setTimeout(t,i){this._clearTimeout(),setTimeout(i,t);}_clearTimeout(){this._toId&&(clearTimeout(this._toId),this._toId=null);}}"undefined"!=typeof window&&"undefined"!=typeof document&&EventHandler$1.on(document,EVENT_CLICK_DATA_API$e,SELECTOR_DATA_TOGGLE$b,(function(t){const i=getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),EventHandler$1.one(i,EVENT_SHOW$7,(t=>{t.defaultPrevented||EventHandler$1.one(i,EVENT_HIDDEN$7,(()=>{isVisible(this)&&this.focus();}));}));Notification.getOrCreateInstance(i).toggle(this);})),enableDismissTrigger(Notification);const Notification$1 = Notification;
|
|
86
|
+
const NAME$A="notification",DATA_KEY$b="bs.notification",EVENT_KEY$d=`.${DATA_KEY$b}`,EVENT_CLICK_DATA_API$e=`click${EVENT_KEY$d}.data-api`,EVENT_HIDDEN$7=`hidden${EVENT_KEY$d}`,EVENT_SHOW$7=`show${EVENT_KEY$d}`,Default$m={timeout:0},SELECTOR_DATA_TOGGLE$b='[data-bs-toggle="notification"]';class Notification extends BaseComponent{constructor(t,i){super(t),this._config=this._getConfig(i),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1,this._toId=null;}static get NAME(){return NAME$A}show(t,i){if(this._isShown||this._isTransitioning)return;const e=t||this._getElementTimeout(i);this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement(e);}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const t=this._isAnimated();t&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,t);}toggle(t){this._isShown?this.hide():this.show(null,t);}_isAnimated(){return this._element.classList.contains("fade")}_showElement(t){const i=this._isAnimated();this._element.style.display="block",this._element.removeAttribute("aria-hidden"),i&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1,t&&this._setTimeout(t,(()=>this.hide()));}),this._element,i);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._isTransitioning=!1;}_getConfig(t){return t={...Default$m,...Manipulator.getDataAttributes(this._element),..."object"==typeof t?t:{}}}_getElementTimeout(t){const i=t?parseInt(t.getAttribute("data-bs-timeout")):null;return i>0?i:this._config.timeout}_setTimeout(t,i){this._clearTimeout(),setTimeout(i,t);}_clearTimeout(){this._toId&&(clearTimeout(this._toId),this._toId=null);}}"undefined"!=typeof window&&"undefined"!=typeof document&&(EventHandler$1.on(document,EVENT_CLICK_DATA_API$e,SELECTOR_DATA_TOGGLE$b,(function(t){const i=getElementFromSelector(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),EventHandler$1.one(i,EVENT_SHOW$7,(t=>{t.defaultPrevented||EventHandler$1.one(i,EVENT_HIDDEN$7,(()=>{isVisible(this)&&this.focus();}));}));Notification.getOrCreateInstance(i).toggle(this);})),enableDismissTrigger(Notification));const Notification$1 = Notification;
|
|
87
87
|
|
|
88
88
|
const NAME$z="cookiebar",DATA_KEY$a="bs.cookiebar",EVENT_KEY$c=`.${DATA_KEY$a}`,COOKIE_NAME="cookies_consent",SELECTOR_ACCEPT='[data-bs-accept="cookiebar"]',EVENT_CLOSE$1=`close${EVENT_KEY$c}`,EVENT_CLOSED$1=`closed${EVENT_KEY$c}`,EVENT_LOAD_DATA_API$3=`load${EVENT_KEY$c}.data-api`,EVENT_CLICK_DATA_API$d=`click${EVENT_KEY$c}.data-api`;class Cookiebar extends BaseComponent{constructor(e){super(e),this._isShown=this._element.classList.contains("show"),this._isTransitioning=!1;}static get NAME(){return NAME$z}static get VERSION(){return "5.0.0"}show(){this._isShown||this._isTransitioning||(this._isShown=!0,this._isAnimated()&&(this._isTransitioning=!0),this._showElement());}hide(){if(!this._isShown||this._isTransitioning)return;this._isShown=!1;const e=this._isAnimated();e&&(this._isTransitioning=!0),this._element.classList.remove("show"),this._queueCallback((()=>this._hideElement()),this._element,e);}accept(e){e=e||this._element;const t=this._getRootElement(e);this._triggerCloseEvent(t).defaultPrevented||(this._setCookieEU(),this.hide());}static clearCookie(){"undefined"!=typeof document&&(document.cookie=COOKIE_NAME+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;");}_isAnimated(){return this._element.classList.contains("fade")}_showElement(){const e=this._isAnimated();this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-live","polite"),e&&reflow(this._element),this._element.classList.add("show");this._queueCallback((()=>{this._isTransitioning=!1;}),this._element,e);}_hideElement(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-live"),this._isTransitioning=!1;}_setCookieEU(){var e=new Date;e.setDate(e.getDate()+30);var t=escape("true")+"; expires="+e.toUTCString();"undefined"!=typeof document&&(document.cookie=COOKIE_NAME+"="+t+"; path=/; SameSite=Strict");}_getRootElement(e){const t=getElementFromSelector(e);let i=null;return t&&(i=t),i||(i=e.closest(".cookiebar")),i}_triggerCloseEvent(e){return EventHandler$1.trigger(e,EVENT_CLOSE$1)}_removeElement(e){e.classList.remove("show"),e.setAttribute("aria-hidden","true"),e.setAttribute("aria-live","off"),EventHandler$1.trigger(e,EVENT_CLOSED$1),this.dispose();}static _handleAccept(e){return function(t){t&&t.preventDefault(),e.close(this);}}static _handleConsent(e){return function(t){t&&t.preventDefault(),e.close(this);}}static _getCookieEU(){if("undefined"!=typeof document){var e,t,i,s=document.cookie.split(";");for(e=0;e<s.length;e++)if(t=s[e].substring(0,s[e].indexOf("=")),i=s[e].substring(s[e].indexOf("=")+1),(t=t.replace(/^\s+|\s+$/g,""))==COOKIE_NAME)return unescape(i)}}}"undefined"!=typeof window&&"undefined"!=typeof document&&(EventHandler$1.on(document,EVENT_CLICK_DATA_API$d,SELECTOR_ACCEPT,(function(e){if(["A","AREA"].includes(this.tagName)&&e.preventDefault(),isDisabled(this))return;const t=getElementFromSelector(this)||this.closest(`.${NAME$z}`);Cookiebar.getOrCreateInstance(t).accept();})),EventHandler$1.on(window,EVENT_LOAD_DATA_API$3,(function(){if(!Cookiebar._getCookieEU()){if("undefined"==typeof document)return;document.querySelectorAll(".cookiebar").forEach((e=>{Cookiebar.getOrCreateInstance(e).show();}));}})));const Cookiebar$1 = Cookiebar;
|
|
89
89
|
|
|
@@ -180,9 +180,10 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
|
180
180
|
|
|
181
181
|
data.toggle(this);
|
|
182
182
|
});
|
|
183
|
-
}
|
|
184
183
|
|
|
185
184
|
enableDismissTrigger(Notification);
|
|
186
185
|
|
|
186
|
+
}
|
|
187
|
+
|
|
187
188
|
export { Notification as default };
|
|
188
189
|
//# sourceMappingURL=notification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.js","sources":["../../src/js/plugins/notification.js"],"sourcesContent":["import BaseComponent from 'bootstrap/js/src/base-component.js'\nimport { getElementFromSelector, isVisible, reflow } from 'bootstrap/js/src/util'\nimport Manipulator from 'bootstrap/js/src/dom/manipulator'\nimport EventHandler from 'bootstrap/js/src/dom/event-handler'\nimport { enableDismissTrigger } from 'bootstrap/js/src/util/component-functions'\n\nconst NAME = 'notification'\nconst DATA_KEY = 'bs.notification'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\n\nconst Default = {\n timeout: 0,\n}\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\nconst ATTRIBUTE_TIMEOUT = 'data-bs-timeout'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"notification\"]'\n\n/**\n * toggle per attivazione\n * attrib per timeout (assegnabili al toggler o al componente, vince sempre il toggler)\n * gestione chiusura (dismissable)\n * la classe si riferisce all'elemento notification, con options, metodi open(timeout) e close (che deve gestire il timeout)\n **/\n\nclass Notification extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._config = this._getConfig(config)\n\n this._isShown = this._element.classList.contains(CLASS_NAME_SHOW)\n this._isTransitioning = false\n this._toId = null\n }\n\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n show(timeout, relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const timeoutVal = timeout || this._getElementTimeout(relatedTarget)\n\n this._isShown = true\n\n if (this._isAnimated()) {\n this._isTransitioning = true\n }\n\n this._showElement(timeoutVal)\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n this._isShown = false\n const isAnimated = this._isAnimated()\n\n if (isAnimated) {\n this._isTransitioning = true\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n this._queueCallback(() => this._hideElement(), this._element, isAnimated)\n }\n\n toggle(relatedTarget) {\n this._isShown ? this.hide() : this.show(null, relatedTarget)\n }\n\n //Private\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _showElement(timeout) {\n const isAnimated = this._isAnimated()\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n //this._element.setAttribute('aria-modal', true)\n //this._element.setAttribute('role', 'dialog')\n\n if (isAnimated) {\n reflow(this._element)\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n this._isTransitioning = false\n if (timeout) {\n this._setTimeout(timeout, () => this.hide())\n }\n }\n\n this._queueCallback(transitionComplete, this._element, isAnimated)\n }\n\n _hideElement() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._isTransitioning = false\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' ? config : {}),\n }\n return config\n }\n\n _getElementTimeout(relatedTarget) {\n const relTimeout = relatedTarget ? parseInt(relatedTarget.getAttribute(ATTRIBUTE_TIMEOUT)) : null\n return relTimeout > 0 ? relTimeout : this._config.timeout\n }\n\n _setTimeout(duration, callback) {\n this._clearTimeout()\n setTimeout(callback, duration)\n }\n _clearTimeout() {\n if (this._toId) {\n clearTimeout(this._toId)\n this._toId = null\n }\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, (showEvent) => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n const data = Notification.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n
|
|
1
|
+
{"version":3,"file":"notification.js","sources":["../../src/js/plugins/notification.js"],"sourcesContent":["import BaseComponent from 'bootstrap/js/src/base-component.js'\nimport { getElementFromSelector, isVisible, reflow } from 'bootstrap/js/src/util'\nimport Manipulator from 'bootstrap/js/src/dom/manipulator'\nimport EventHandler from 'bootstrap/js/src/dom/event-handler'\nimport { enableDismissTrigger } from 'bootstrap/js/src/util/component-functions'\n\nconst NAME = 'notification'\nconst DATA_KEY = 'bs.notification'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\n\nconst Default = {\n timeout: 0,\n}\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\nconst ATTRIBUTE_TIMEOUT = 'data-bs-timeout'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"notification\"]'\n\n/**\n * toggle per attivazione\n * attrib per timeout (assegnabili al toggler o al componente, vince sempre il toggler)\n * gestione chiusura (dismissable)\n * la classe si riferisce all'elemento notification, con options, metodi open(timeout) e close (che deve gestire il timeout)\n **/\n\nclass Notification extends BaseComponent {\n constructor(element, config) {\n super(element)\n\n this._config = this._getConfig(config)\n\n this._isShown = this._element.classList.contains(CLASS_NAME_SHOW)\n this._isTransitioning = false\n this._toId = null\n }\n\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n show(timeout, relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const timeoutVal = timeout || this._getElementTimeout(relatedTarget)\n\n this._isShown = true\n\n if (this._isAnimated()) {\n this._isTransitioning = true\n }\n\n this._showElement(timeoutVal)\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n this._isShown = false\n const isAnimated = this._isAnimated()\n\n if (isAnimated) {\n this._isTransitioning = true\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n this._queueCallback(() => this._hideElement(), this._element, isAnimated)\n }\n\n toggle(relatedTarget) {\n this._isShown ? this.hide() : this.show(null, relatedTarget)\n }\n\n //Private\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _showElement(timeout) {\n const isAnimated = this._isAnimated()\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n //this._element.setAttribute('aria-modal', true)\n //this._element.setAttribute('role', 'dialog')\n\n if (isAnimated) {\n reflow(this._element)\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n this._isTransitioning = false\n if (timeout) {\n this._setTimeout(timeout, () => this.hide())\n }\n }\n\n this._queueCallback(transitionComplete, this._element, isAnimated)\n }\n\n _hideElement() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._isTransitioning = false\n }\n\n _getConfig(config) {\n config = {\n ...Default,\n ...Manipulator.getDataAttributes(this._element),\n ...(typeof config === 'object' ? config : {}),\n }\n return config\n }\n\n _getElementTimeout(relatedTarget) {\n const relTimeout = relatedTarget ? parseInt(relatedTarget.getAttribute(ATTRIBUTE_TIMEOUT)) : null\n return relTimeout > 0 ? relTimeout : this._config.timeout\n }\n\n _setTimeout(duration, callback) {\n this._clearTimeout()\n setTimeout(callback, duration)\n }\n _clearTimeout() {\n if (this._toId) {\n clearTimeout(this._toId)\n this._toId = null\n }\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, (showEvent) => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n const data = Notification.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n\nenableDismissTrigger(Notification)\n\n}\n\nexport default Notification\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,IAAI,GAAG,eAAc;AAC3B,MAAM,QAAQ,GAAG,kBAAiB;AAClC,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAC;AAChC,MAAM,YAAY,GAAG,YAAW;AAChC;AACA,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,YAAY,CAAC,EAAC;AAC/D,MAAM,YAAY,GAAG,CA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