@massimo-cassandro/minimo 1.29.2 → 1.29.4
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.
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@ function closeDialog(el) {
|
|
|
40
40
|
*
|
|
41
41
|
* @param {Object} params
|
|
42
42
|
* @param {string | null} [params.dialogExtraClassName=null] - Extra class added to the dialog element. (default: null)
|
|
43
|
-
* @param {string | DomBuilderItem[] | null} [params.content=null] - Plain text, HTML, or a domBuilder array. (default: null)
|
|
43
|
+
* @param {string | DomBuilderItem | DomBuilderItem[] | null} [params.content=null] - Plain text, HTML, a domBuilder object, or a domBuilder array. (default: null)
|
|
44
44
|
* @param {string | null} [params.contentExtraClassName=null] - Extra class added to the content wrapper. (default: null)
|
|
45
45
|
* @param {HTMLElement | null} [params.triggerElement=null] - Optional element that triggered the popup; when set, `aria-haspopup`, `aria-controls` and `aria-expanded` are managed on it. (default: null)
|
|
46
46
|
* @param {boolean} [params.addFocus=true] - if true, dialog receives focus after opening (default: true)
|
|
@@ -58,8 +58,8 @@ function closeDialog(el) {
|
|
|
58
58
|
* @param {((el: HTMLDialogElement) => void) | null} [params.closeCallback=null] - Called with the dialog element just before it is removed, receives the dialog element (`closeCallback(dialogEl)`). NB: `dialogEl` is removed immediately after closing. (default: null)
|
|
59
59
|
* @param {((data: *, el: Element) => void) | null} [params.ajaxCallback=null] - Called with the Ajax response and the content element. (default: null)
|
|
60
60
|
* @param {boolean} [params.addScrollbarPadding=false] - Adds right padding to compensate for the scrollbar. (default: false)
|
|
61
|
-
* @param {string | DomBuilderItem[] | null} [params.headerContent=null] - Header content: plain text, HTML, or a domBuilder array. (default: null)
|
|
62
|
-
* @param {string | DomBuilderItem[] | null} [params.footerContent=null] - Footer content: plain text, HTML, or a domBuilder array. (default: null)
|
|
61
|
+
* @param {string | DomBuilderItem | DomBuilderItem[] | null} [params.headerContent=null] - Header content: plain text, HTML, a domBuilder object, or a domBuilder array. (default: null)
|
|
62
|
+
* @param {string | DomBuilderItem | DomBuilderItem[] | null} [params.footerContent=null] - Footer content: plain text, HTML, a domBuilder object, or a domBuilder array. (default: null)
|
|
63
63
|
* @returns {HTMLDialogElement} The dialog element.
|
|
64
64
|
*/
|
|
65
65
|
|
|
@@ -84,7 +84,7 @@ export function modalPopup({
|
|
|
84
84
|
/** iframe url */
|
|
85
85
|
iframeUrl = null,
|
|
86
86
|
|
|
87
|
-
/** content: plain text, html or domBuilder array */
|
|
87
|
+
/** content: plain text, html, domBuilder object or domBuilder array */
|
|
88
88
|
content = null,
|
|
89
89
|
|
|
90
90
|
/** Ajax url and callback.
|
|
@@ -98,13 +98,13 @@ export function modalPopup({
|
|
|
98
98
|
closeCallback = null,
|
|
99
99
|
addScrollbarPadding = false, // adds extra right padding to compensate for the scrollbar
|
|
100
100
|
|
|
101
|
-
/** header content: plain text, HTML or domBuilder array */
|
|
101
|
+
/** header content: plain text, HTML, domBuilder object or domBuilder array */
|
|
102
102
|
headerContent = null,
|
|
103
103
|
|
|
104
104
|
/** extra classname added to header */
|
|
105
105
|
headerExtraClassName = null,
|
|
106
106
|
|
|
107
|
-
/** footer content: plain text, HTML or domBuilder array */
|
|
107
|
+
/** footer content: plain text, HTML, domBuilder object or domBuilder array */
|
|
108
108
|
footerContent = null,
|
|
109
109
|
|
|
110
110
|
/** extra classname added to footer */
|
|
@@ -120,6 +120,17 @@ export function modalPopup({
|
|
|
120
120
|
throw '[modalContent] parametri `content`, `ajaxUrl`/ `ajaxCallback` e `iframeUrl` mancanti';
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
// allow a single domBuilder object (in addition to a domBuilder array) by wrapping it in an array
|
|
124
|
+
if(content != null && typeof content === 'object' && !Array.isArray(content)) {
|
|
125
|
+
content = [content];
|
|
126
|
+
}
|
|
127
|
+
if(headerContent != null && typeof headerContent === 'object' && !Array.isArray(headerContent)) {
|
|
128
|
+
headerContent = [headerContent];
|
|
129
|
+
}
|
|
130
|
+
if(footerContent != null && typeof footerContent === 'object' && !Array.isArray(footerContent)) {
|
|
131
|
+
footerContent = [footerContent];
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
let mode;
|
|
124
135
|
if(content != null && Array.isArray(content)) {
|
|
125
136
|
mode = 'domBuilder';
|