webcimes-modal 1.1.3 → 1.1.5
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/.eslintrc.json +0 -0
- package/.gitignore +0 -0
- package/LICENSE.md +0 -0
- package/README.md +32 -27
- package/demo/demo_esm.html +1 -56
- package/demo/demo_udm.html +1 -46
- package/demo/script_esm.js +47 -0
- package/demo/script_udm.js +45 -0
- package/dist/css/webcimes-modal.css +0 -0
- package/dist/css/webcimes-modal.css.map +0 -0
- package/dist/images/times.svg +0 -0
- package/dist/js/webcimes-modal.esm.d.ts +1 -1
- package/dist/js/webcimes-modal.esm.js +0 -0
- package/dist/js/webcimes-modal.esm.js.map +1 -1
- package/dist/js/webcimes-modal.udm.d.ts +1 -1
- package/dist/js/webcimes-modal.udm.js +0 -0
- package/dist/js/webcimes-modal.udm.js.map +1 -1
- package/package.json +2 -3
- package/src/css/webcimes-modal.css +0 -0
- package/src/images/times.svg +0 -0
- package/src/ts/webcimes-modal.d.ts +0 -0
- package/src/ts/webcimes-modal.d.ts.map +0 -0
- package/src/ts/webcimes-modal.ts +1 -1
- package/test/script.js +0 -0
- package/test/test.html +0 -7
- package/tsconfig.json +0 -0
- package/webpack.config.ts +42 -25
package/.eslintrc.json
CHANGED
|
File without changes
|
package/.gitignore
CHANGED
|
File without changes
|
package/LICENSE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -30,6 +30,11 @@ You can use an importmap to resolve the arbitrary module names to complete paths
|
|
|
30
30
|
...
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
Then import javascript module:
|
|
34
|
+
```javascript
|
|
35
|
+
import { WebcimesModal } from "webcimes-modal";
|
|
36
|
+
```
|
|
37
|
+
|
|
33
38
|
Or you can also set the full path directly in the import:
|
|
34
39
|
```html
|
|
35
40
|
<html>
|
|
@@ -37,14 +42,14 @@ Or you can also set the full path directly in the import:
|
|
|
37
42
|
...
|
|
38
43
|
<script type="module">
|
|
39
44
|
// Import webcimes-modal
|
|
40
|
-
import {WebcimesModal} from "./node_modules/webcimes-modal/dist/js/webcimes-modal.esm.js";
|
|
45
|
+
import { WebcimesModal } from "./node_modules/webcimes-modal/dist/js/webcimes-modal.esm.js";
|
|
41
46
|
...
|
|
42
47
|
</script>
|
|
43
48
|
</head>
|
|
44
49
|
...
|
|
45
50
|
```
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
Or with JS bundlers (like Webpack) you can call directly the module :
|
|
48
53
|
```javascript
|
|
49
54
|
import { WebcimesModal } from "webcimes-modal";
|
|
50
55
|
```
|
|
@@ -206,6 +211,31 @@ const myModal = new WebcimesModal({
|
|
|
206
211
|
});
|
|
207
212
|
```
|
|
208
213
|
|
|
214
|
+
### Get dom element
|
|
215
|
+
You can get the dom element of the current modal like this:
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
// Get the instance
|
|
219
|
+
const myModal = new WebcimesModal(...);
|
|
220
|
+
|
|
221
|
+
// Things
|
|
222
|
+
|
|
223
|
+
// Then get the dom element of the current modal
|
|
224
|
+
myModal.modal;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Or you can get the global container of all modals like this:
|
|
228
|
+
|
|
229
|
+
```javascript
|
|
230
|
+
// Get the instance
|
|
231
|
+
const myModal = new WebcimesModal(...);
|
|
232
|
+
|
|
233
|
+
// Things
|
|
234
|
+
|
|
235
|
+
// Then get the dom element containing all modals
|
|
236
|
+
myModal.webcimesModals;
|
|
237
|
+
```
|
|
238
|
+
|
|
209
239
|
### Events:
|
|
210
240
|
Multiple events exist, which allow to interact with the modal at each step. You can use all events below:
|
|
211
241
|
|
|
@@ -253,31 +283,6 @@ const myModal = new WebcimesModal(...);
|
|
|
253
283
|
myModal.destroy();
|
|
254
284
|
```
|
|
255
285
|
|
|
256
|
-
### Get dom element
|
|
257
|
-
You can get the dom element of the current modal like this:
|
|
258
|
-
|
|
259
|
-
```javascript
|
|
260
|
-
// Get the instance
|
|
261
|
-
const myModal = new WebcimesModal(...);
|
|
262
|
-
|
|
263
|
-
// Things
|
|
264
|
-
|
|
265
|
-
// Then get the dom element of the current modal
|
|
266
|
-
myModal.modal;
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Or you can get the global container of all modals like this:
|
|
270
|
-
|
|
271
|
-
```javascript
|
|
272
|
-
// Get the instance
|
|
273
|
-
const myModal = new WebcimesModal(...);
|
|
274
|
-
|
|
275
|
-
// Things
|
|
276
|
-
|
|
277
|
-
// Then get the dom element containing all modals
|
|
278
|
-
myModal.webcimesModals;
|
|
279
|
-
```
|
|
280
|
-
|
|
281
286
|
### Style modals:
|
|
282
287
|
You can style modal with the following field applying to the class of `.webcimesModals` (for background and z-index behind the modal) and `.webcimesModals > .modal` (for modal):
|
|
283
288
|
|
package/demo/demo_esm.html
CHANGED
|
@@ -7,62 +7,7 @@
|
|
|
7
7
|
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
8
8
|
<title>Demo webcimes-modal ESM</title>
|
|
9
9
|
<link rel="stylesheet" href="../dist/css/webcimes-modal.css">
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
"imports": {
|
|
13
|
-
"webcimes-modal": "../dist/js/webcimes-modal.esm.js"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
<script type="module">
|
|
18
|
-
// Import webcimes-modal
|
|
19
|
-
import {WebcimesModal} from "webcimes-modal";
|
|
20
|
-
|
|
21
|
-
// Wait for dom content loaded
|
|
22
|
-
document.addEventListener("DOMContentLoaded", function()
|
|
23
|
-
{
|
|
24
|
-
const myModal = new WebcimesModal({
|
|
25
|
-
setId: null, // set specific id to the modal, default "null"
|
|
26
|
-
setClass: null, // set specific class to the modal, default "null"
|
|
27
|
-
width: 'auto', // width (specify the unit), default "auto"
|
|
28
|
-
height: 'auto', // height (specify the unit), default "auto"
|
|
29
|
-
titleHtml: "My title", // html for title, default "null"
|
|
30
|
-
bodyHtml: "My Body", // html for body, default "null"
|
|
31
|
-
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
32
|
-
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
33
|
-
closeOnCancelButton: true, // close the modal after trigger cancel button, default "true"
|
|
34
|
-
closeOnConfirmButton: true, // close the modal after trigger confirm button, default "true"
|
|
35
|
-
showCloseButton: true, // show the close button, default "true"
|
|
36
|
-
allowCloseOutside: false, // allow to close modal when click outside, default "true"
|
|
37
|
-
allowMovement: true, // possibility to move the modal, default "true"
|
|
38
|
-
moveFromHeader: true, // if allowMovement is set to "true", ability to move modal from header, default "true"
|
|
39
|
-
moveFromBody: false, // if allowMovement is set to "true", ability to move modal from body, default "false"
|
|
40
|
-
moveFromFooter: true, // if allowMovement is set to "true", ability to move modal from footer, default "true"
|
|
41
|
-
stickyHeader: true, // keep sticky (visible) the header when scrolling, default "true"
|
|
42
|
-
stickyFooter: true, // keep sticky (visible) the footer when scrolling, default "true"
|
|
43
|
-
style: null, // add extra style css to the modal, default null
|
|
44
|
-
animationOnShow: 'animDropDown', // "animDropDown" or "animFadeIn" for enter animation, default "animDropDown"
|
|
45
|
-
animationOnDestroy: 'animDropUp', // "animDropUp" or "animFadeOut" for end animation, default "animDropUp"
|
|
46
|
-
animationDuration: 500, // anim duration in ms, default "500"
|
|
47
|
-
beforeShow: () => {console.log("before show");}, // callback before show modal
|
|
48
|
-
afterShow: () => {console.log("after show");}, // callback after destroy modal
|
|
49
|
-
beforeDestroy: () => {console.log("before destroy");}, // callback before destroy modal
|
|
50
|
-
afterDestroy: () => {console.log("after destroy");}, // callback after destroy modal
|
|
51
|
-
onCancelButton: () => {console.log("on cancel button");}, // callback after trigger cancel button
|
|
52
|
-
onConfirmButton: () => {console.log("on confirm button");}, // callback after trigger confirm button
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const myModal2 = new WebcimesModal({
|
|
56
|
-
titleHtml: "My title", // html for title, default "null"
|
|
57
|
-
bodyHtml: document.querySelector(".test").outerHTML, // html for body, default "null"
|
|
58
|
-
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
59
|
-
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
60
|
-
closeOnConfirmButton: false, // close the modal after trigger confirm button, default "true"
|
|
61
|
-
afterShow: () => {console.log(myModal2.webcimesModals); console.log(myModal2.modal);}, // callback before show modal
|
|
62
|
-
onConfirmButton: () => {myModal2.destroy();}, // callback after trigger confirm button
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
</script>
|
|
10
|
+
<script type="module" src="script_esm.js"></script>
|
|
66
11
|
</head>
|
|
67
12
|
<body>
|
|
68
13
|
<div style="display:none;">
|
package/demo/demo_udm.html
CHANGED
|
@@ -8,52 +8,7 @@
|
|
|
8
8
|
<title>Demo webcimes-modal UDM</title>
|
|
9
9
|
<link rel="stylesheet" href="../dist/css/webcimes-modal.css">
|
|
10
10
|
<script src="../dist/js/webcimes-modal.udm.js" type="text/javascript"></script>
|
|
11
|
-
<script>
|
|
12
|
-
// Wait for dom content loaded
|
|
13
|
-
document.addEventListener("DOMContentLoaded", function()
|
|
14
|
-
{
|
|
15
|
-
const myModal = new WebcimesModal({
|
|
16
|
-
setId: null, // set specific id to the modal, default "null"
|
|
17
|
-
setClass: null, // set specific class to the modal, default "null"
|
|
18
|
-
width: 'auto', // width (specify the unit), default "auto"
|
|
19
|
-
height: 'auto', // height (specify the unit), default "auto"
|
|
20
|
-
titleHtml: "My title", // html for title, default "null"
|
|
21
|
-
bodyHtml: "My Body", // html for body, default "null"
|
|
22
|
-
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
23
|
-
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
24
|
-
closeOnCancelButton: true, // close the modal after trigger cancel button, default "true"
|
|
25
|
-
closeOnConfirmButton: true, // close the modal after trigger confirm button, default "true"
|
|
26
|
-
showCloseButton: true, // show the close button, default "true"
|
|
27
|
-
allowCloseOutside: false, // allow to close modal when click outside, default "true"
|
|
28
|
-
allowMovement: true, // possibility to move the modal, default "true"
|
|
29
|
-
moveFromHeader: true, // if allowMovement is set to "true", ability to move modal from header, default "true"
|
|
30
|
-
moveFromBody: false, // if allowMovement is set to "true", ability to move modal from body, default "false"
|
|
31
|
-
moveFromFooter: true, // if allowMovement is set to "true", ability to move modal from footer, default "true"
|
|
32
|
-
stickyHeader: true, // keep sticky (visible) the header when scrolling, default "true"
|
|
33
|
-
stickyFooter: true, // keep sticky (visible) the footer when scrolling, default "true"
|
|
34
|
-
style: null, // add extra style css to the modal, default null
|
|
35
|
-
animationOnShow: 'animDropDown', // "animDropDown" or "animFadeIn" for enter animation, default "animDropDown"
|
|
36
|
-
animationOnDestroy: 'animDropUp', // "animDropUp" or "animFadeOut" for end animation, default "animDropUp"
|
|
37
|
-
animationDuration: 500, // anim duration in ms, default "500"
|
|
38
|
-
beforeShow: () => {console.log("before show");}, // callback before show modal
|
|
39
|
-
afterShow: () => {console.log("after show");}, // callback after destroy modal
|
|
40
|
-
beforeDestroy: () => {console.log("before destroy");}, // callback before destroy modal
|
|
41
|
-
afterDestroy: () => {console.log("after destroy");}, // callback after destroy modal
|
|
42
|
-
onCancelButton: () => {console.log("on cancel button");}, // callback after trigger cancel button
|
|
43
|
-
onConfirmButton: () => {console.log("on confirm button");}, // callback after trigger confirm button
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const myModal2 = new WebcimesModal({
|
|
47
|
-
titleHtml: "My title", // html for title, default "null"
|
|
48
|
-
bodyHtml: document.querySelector(".test").outerHTML, // html for body, default "null"
|
|
49
|
-
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
50
|
-
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
51
|
-
closeOnConfirmButton: false, // close the modal after trigger confirm button, default "true"
|
|
52
|
-
afterShow: () => {console.log(myModal2.webcimesModals); console.log(myModal2.modal);}, // callback before show modal
|
|
53
|
-
onConfirmButton: () => {myModal2.destroy();}, // callback after trigger confirm button
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
</script>
|
|
11
|
+
<script type="text/javascript" src="script_udm.js"></script>
|
|
57
12
|
</head>
|
|
58
13
|
<body>
|
|
59
14
|
<div style="display:none;">
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Import webcimes-modal
|
|
2
|
+
import { WebcimesModal } from "../dist/js/webcimes-modal.esm.js";
|
|
3
|
+
|
|
4
|
+
// Wait for dom content loaded
|
|
5
|
+
document.addEventListener("DOMContentLoaded", function()
|
|
6
|
+
{
|
|
7
|
+
const myModal = new WebcimesModal({
|
|
8
|
+
setId: null, // set specific id to the modal, default "null"
|
|
9
|
+
setClass: null, // set specific class to the modal, default "null"
|
|
10
|
+
width: 'auto', // width (specify the unit), default "auto"
|
|
11
|
+
height: 'auto', // height (specify the unit), default "auto"
|
|
12
|
+
titleHtml: "My title", // html for title, default "null"
|
|
13
|
+
bodyHtml: "My Body", // html for body, default "null"
|
|
14
|
+
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
15
|
+
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
16
|
+
closeOnCancelButton: true, // close the modal after trigger cancel button, default "true"
|
|
17
|
+
closeOnConfirmButton: true, // close the modal after trigger confirm button, default "true"
|
|
18
|
+
showCloseButton: true, // show the close button, default "true"
|
|
19
|
+
allowCloseOutside: false, // allow to close modal when click outside, default "true"
|
|
20
|
+
allowMovement: true, // possibility to move the modal, default "true"
|
|
21
|
+
moveFromHeader: true, // if allowMovement is set to "true", ability to move modal from header, default "true"
|
|
22
|
+
moveFromBody: false, // if allowMovement is set to "true", ability to move modal from body, default "false"
|
|
23
|
+
moveFromFooter: true, // if allowMovement is set to "true", ability to move modal from footer, default "true"
|
|
24
|
+
stickyHeader: true, // keep sticky (visible) the header when scrolling, default "true"
|
|
25
|
+
stickyFooter: true, // keep sticky (visible) the footer when scrolling, default "true"
|
|
26
|
+
style: null, // add extra style css to the modal, default null
|
|
27
|
+
animationOnShow: 'animDropDown', // "animDropDown" or "animFadeIn" for enter animation, default "animDropDown"
|
|
28
|
+
animationOnDestroy: 'animDropUp', // "animDropUp" or "animFadeOut" for end animation, default "animDropUp"
|
|
29
|
+
animationDuration: 500, // anim duration in ms, default "500"
|
|
30
|
+
beforeShow: () => {console.log("before show");}, // callback before show modal
|
|
31
|
+
afterShow: () => {console.log("after show");}, // callback after show modal
|
|
32
|
+
beforeDestroy: () => {console.log("before destroy");}, // callback before destroy modal
|
|
33
|
+
afterDestroy: () => {console.log("after destroy");}, // callback after destroy modal
|
|
34
|
+
onCancelButton: () => {console.log("on cancel button");}, // callback after trigger cancel button
|
|
35
|
+
onConfirmButton: () => {console.log("on confirm button");}, // callback after trigger confirm button
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const myModal2 = new WebcimesModal({
|
|
39
|
+
titleHtml: "My title", // html for title, default "null"
|
|
40
|
+
bodyHtml: document.querySelector(".test").outerHTML, // html for body, default "null"
|
|
41
|
+
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
42
|
+
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
43
|
+
closeOnConfirmButton: false, // close the modal after trigger confirm button, default "true"
|
|
44
|
+
afterShow: () => {console.log(myModal2.webcimesModals); console.log(myModal2.modal);}, // callback before show modal
|
|
45
|
+
onConfirmButton: () => {myModal2.destroy();}, // callback after trigger confirm button
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
// Wait for dom content loaded
|
|
3
|
+
document.addEventListener("DOMContentLoaded", function()
|
|
4
|
+
{
|
|
5
|
+
const myModal = new WebcimesModal({
|
|
6
|
+
setId: null, // set specific id to the modal, default "null"
|
|
7
|
+
setClass: null, // set specific class to the modal, default "null"
|
|
8
|
+
width: 'auto', // width (specify the unit), default "auto"
|
|
9
|
+
height: 'auto', // height (specify the unit), default "auto"
|
|
10
|
+
titleHtml: "My title", // html for title, default "null"
|
|
11
|
+
bodyHtml: "My Body", // html for body, default "null"
|
|
12
|
+
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
13
|
+
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
14
|
+
closeOnCancelButton: true, // close the modal after trigger cancel button, default "true"
|
|
15
|
+
closeOnConfirmButton: true, // close the modal after trigger confirm button, default "true"
|
|
16
|
+
showCloseButton: true, // show the close button, default "true"
|
|
17
|
+
allowCloseOutside: false, // allow to close modal when click outside, default "true"
|
|
18
|
+
allowMovement: true, // possibility to move the modal, default "true"
|
|
19
|
+
moveFromHeader: true, // if allowMovement is set to "true", ability to move modal from header, default "true"
|
|
20
|
+
moveFromBody: false, // if allowMovement is set to "true", ability to move modal from body, default "false"
|
|
21
|
+
moveFromFooter: true, // if allowMovement is set to "true", ability to move modal from footer, default "true"
|
|
22
|
+
stickyHeader: true, // keep sticky (visible) the header when scrolling, default "true"
|
|
23
|
+
stickyFooter: true, // keep sticky (visible) the footer when scrolling, default "true"
|
|
24
|
+
style: null, // add extra style css to the modal, default null
|
|
25
|
+
animationOnShow: 'animDropDown', // "animDropDown" or "animFadeIn" for enter animation, default "animDropDown"
|
|
26
|
+
animationOnDestroy: 'animDropUp', // "animDropUp" or "animFadeOut" for end animation, default "animDropUp"
|
|
27
|
+
animationDuration: 500, // anim duration in ms, default "500"
|
|
28
|
+
beforeShow: () => {console.log("before show");}, // callback before show modal
|
|
29
|
+
afterShow: () => {console.log("after show");}, // callback after show modal
|
|
30
|
+
beforeDestroy: () => {console.log("before destroy");}, // callback before destroy modal
|
|
31
|
+
afterDestroy: () => {console.log("after destroy");}, // callback after destroy modal
|
|
32
|
+
onCancelButton: () => {console.log("on cancel button");}, // callback after trigger cancel button
|
|
33
|
+
onConfirmButton: () => {console.log("on confirm button");}, // callback after trigger confirm button
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const myModal2 = new WebcimesModal({
|
|
37
|
+
titleHtml: "My title", // html for title, default "null"
|
|
38
|
+
bodyHtml: document.querySelector(".test").outerHTML, // html for body, default "null"
|
|
39
|
+
buttonCancelHtml: "Cancel", // html for cancel button, default "null"
|
|
40
|
+
buttonConfirmHtml: "Confirm", // html for confirm button, default "null"
|
|
41
|
+
closeOnConfirmButton: false, // close the modal after trigger confirm button, default "true"
|
|
42
|
+
afterShow: () => {console.log(myModal2.webcimesModals); console.log(myModal2.modal);}, // callback before show modal
|
|
43
|
+
onConfirmButton: () => {myModal2.destroy();}, // callback after trigger confirm button
|
|
44
|
+
});
|
|
45
|
+
});
|
|
File without changes
|
|
File without changes
|
package/dist/images/times.svg
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/webcimes-modal.esm.js","mappings":"AACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,sBCwF3E,MAAMI,EAGLC,eAGAC,MAGCC,QAEAC,kBAAgC,KAEvCC,KAAKH,MAAMI,cAAc,IAAIC,YAAY,mBACC,mBAAhCF,KAAKF,QAAQK,gBAEtBH,KAAKF,QAAQK,gB,EAIPC,mBAAiC,KAExCJ,KAAKH,MAAMI,cAAc,IAAIC,YAAY,oBACE,mBAAjCF,KAAKF,QAAQO,iBAEtBL,KAAKF,QAAQO,iB,EAIPC,kBAAyCC,IAC7CA,EAAEC,QAAUR,KAAKJ,iBAEhBI,KAAKF,QAAQW,kBAGfT,KAAKU,WAKLV,KAAKH,MAAMc,UAAUC,IAAI,kBAGzBC,YAAW,KACVb,KAAKH,MAAMc,UAAUG,OAAO,iBAAiB,GAC3Cd,KAAKF,QAAQ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EAAWnF,KAAKiB,oBAAoB,IAGjEjB,KAAKF,QAAQ6D,gBAAkB3D,KAAKF,QAAQ8D,gBAAkB5D,KAAKF,QAAQ+D,cAAgB7D,KAAKF,QAAQgE,kBAE1G,CAAC,YAAa,cAAcmB,SAASE,IACpCnF,KAAK6B,iBAAiBoD,SAASC,IAC9BA,EAAGI,oBAAoBH,EAAWnF,KAAK8B,eAAe,GACrD,IAGH,CAAC,YAAa,aAAamD,SAASE,IACnChE,SAASmE,oBAAoBH,EAAWnF,KAAKsC,UAAU,IAGxD,CAAC,UAAW,YAAY2C,SAASE,IAChChE,SAASmE,oBAAoBH,EAAWnF,KAAK0C,cAAc,IAG5DvB,SAASmE,oBAAoB,cAAetF,KAAK2C,yBAGlD0C,OAAOC,oBAAoB,SAAUtF,KAAK6C,cAGzC1B,SAASC,iBAAiB,UAAUC,OAAO,EAAErB,KAAKH,MAAMG,KAAKJ,gBAAgBkB,UAI/Ed,KAAKH,MAAMI,cAAc,IAAIC,YAAY,iBACD,mBAA9BF,KAAKF,QAAQwE,cAEtBtE,KAAKF,QAAQwE,c,GAEZtE,KAAKF,QAAQiB,mBAElB,E","sources":["webpack://webcimes-modal/webpack/bootstrap","webpack://webcimes-modal/webpack/runtime/define property getters","webpack://webcimes-modal/webpack/runtime/hasOwnProperty shorthand","webpack://webcimes-modal/./src/ts/webcimes-modal.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n\"use strict\";\r\n\r\n/**\r\n * Global\r\n */\r\ndeclare global {\r\n\t/** Events */\r\n\tinterface GlobalEventHandlersEventMap {\r\n\t\tbeforeShow: CustomEvent;\r\n\t\tafterShow: CustomEvent;\r\n\t\tbeforeDestroy: CustomEvent;\r\n\t\tafterDestroy: CustomEvent;\r\n\t\tonCancelButton: CustomEvent;\r\n\t\tonConfirmButton: CustomEvent;\r\n\t}\r\n}\r\n\r\n/**\r\n * Options\r\n */\r\ninterface Options {\r\n\t/** set a specific id on the modal. default \"null\" */\r\n\tsetId: string | null;\r\n\t/** set a specific class on the modal, default \"null\" */\r\n\tsetClass: string | null;\r\n\t/** width (specify unit), default \"auto\" */\r\n\twidth: string;\r\n\t/** height (specify unit), default \"auto\" */\r\n\theight: string;\r\n\t/** html for title, default \"null\" */\r\n\ttitleHtml: string | null;\r\n\t/** html for body, default \"null\" */\r\n\tbodyHtml: string | null;\r\n\t/** html for cancel button, default \"null\" */\r\n\tbuttonCancelHtml: string | null;\r\n\t/** html for confirm button, default \"null\" */\r\n\tbuttonConfirmHtml: string | null;\r\n\t/** close modal after trigger cancel button, default \"true\" */\r\n\tcloseOnCancelButton: boolean;\r\n\t/** close modal after trigger confirm button, default \"true\" */\r\n\tcloseOnConfirmButton: boolean;\r\n\t/** show close button, default \"true\" */\r\n\tshowCloseButton: boolean;\r\n\t/** allow the modal to close when clicked outside, default \"true\" */\r\n\tallowCloseOutside: boolean;\r\n\t/** ability to move modal, default \"true\" */\r\n\tallowMovement: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from header, default \"true\" */\r\n\tmoveFromHeader: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from body, default \"false\" */\r\n\tmoveFromBody: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from footer, default \"true\" */\r\n\tmoveFromFooter: boolean;\r\n\t/** keep header sticky (visible) when scrolling, default \"true\" */\r\n\tstickyHeader: boolean;\r\n\t/** keep footer sticky (visible) when scrolling, default \"true\" */\r\n\tstickyFooter: boolean;\r\n\t/** add extra css style to modal, default null */\r\n\tstyle: string | null;\r\n\t/** \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\" */\r\n\tanimationOnShow: \"animDropDown\" | \"animFadeIn\";\r\n\t/** \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\" */\r\n\tanimationOnDestroy: \"animDropUp\" | \"animFadeOut\";\r\n\t/** animation duration in ms, default \"500\" */\r\n\tanimationDuration: number;\r\n\t/** callback before show modal */\r\n\tbeforeShow: () => void;\r\n\t/** callback after show modal */\r\n\tafterShow: () => void;\r\n\t/** callback before destroy modal */\r\n\tbeforeDestroy: () => void;\r\n\t/** callback after destroy modal */\r\n\tafterDestroy: () => void;\r\n\t/** callback after triggering cancel button */\r\n\tonCancelButton: () => void;\r\n\t/** callback after triggering confirm button */\r\n\tonConfirmButton: () => void;\r\n}\r\n\r\n/**\r\n * Class WebcimesModal\r\n */\r\nexport class WebcimesModal\r\n{\r\n\t/** Get the dom element containing all modals */\r\n\tpublic webcimesModals: HTMLElement;\r\n\r\n\t/** Get the dom element of the current modal */\r\n\tpublic modal: HTMLElement;\r\n\r\n\t/** Options of the current modal */\r\n\tprivate options: Options;\r\n\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onCancelButton\"));\r\n\t\tif(typeof this.options.onCancelButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onCancelButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onConfirmButton\"));\r\n\t\tif(typeof this.options.onConfirmButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onConfirmButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickOutside: (e: Event) => void = (e) => {\r\n\t\tif(e.target == this.webcimesModals)\r\n\t\t{\r\n\t\t\tif(this.options.allowCloseOutside)\r\n\t\t\t{\r\n\t\t\t\t// Destroy modal\r\n\t\t\t\tthis.destroy();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Add animation for show modal who can't be close\r\n\t\t\t\tthis.modal.classList.add(\"animGrowShrink\");\r\n\r\n\t\t\t\t// Delete animation after the animation delay\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.modal.classList.remove(\"animGrowShrink\");\r\n\t\t\t\t}, this.options.animationDuration);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\r\n\r\n\tprivate eventDragModalOnTop: (e: Event) => void = (e) => {\r\n\t\t// Only if target is not close button (for bug in chrome)\r\n\t\tif(!(<HTMLElement>e.target).closest(\".close\"))\r\n\t\t{\r\n\t\t\t// If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top\r\n\t\t\tif(document.querySelectorAll(\".modal\").length > 1 && this.modal.nextElementSibling !== null)\r\n\t\t\t{\r\n\t\t\t\tlet oldScrollTop = this.modal.scrollTop;\r\n\t\t\t\tthis.webcimesModals.insertAdjacentElement(\"beforeend\", this.modal);\r\n\t\t\t\tthis.modal.scrollTop = oldScrollTop;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate position: {x: number, y: number};\r\n\r\n\tprivate offset: {x: number, y: number};\r\n\r\n\tprivate isDragging: boolean = false;\r\n\r\n\tprivate moveFromElements: HTMLElement[] = [];\r\n\r\n\tprivate eventDragStart: (e: Event) => void = (e) => {\r\n\t\t// Start drag only if it's not a button\r\n\t\tif(!(<HTMLElement>e.target).closest(\"button\"))\r\n\t\t{\r\n\t\t\tthis.isDragging = true;\r\n\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventMove: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis.modal.style.left = (this.position.x + this.offset.x)+'px';\r\n\t\t\tthis.modal.style.top = (this.position.y + this.offset.y)+'px';\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\r\n\t};\r\n\t\r\n\tprivate eventPreventSelectText: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventResize: () => void = () => {\r\n\t\tthis.modal.style.removeProperty(\"left\");\r\n\t\tthis.modal.style.removeProperty(\"top\");\r\n\t\t\r\n\t};\r\n\r\n\t/**\r\n\t * Create modal\r\n\t */\r\n\tconstructor(options: Options)\r\n\t{\r\n\t\t// Defaults\r\n\t\tconst defaults: Options = {\r\n\t\t\tsetId: null,\r\n\t\t\tsetClass: null,\r\n\t\t\twidth: 'auto',\r\n\t\t\theight: 'auto',\r\n\t\t\ttitleHtml: null,\r\n\t\t\tbodyHtml: null,\r\n\t\t\tbuttonCancelHtml: null,\r\n\t\t\tbuttonConfirmHtml: null,\r\n\t\t\tcloseOnCancelButton: true,\r\n\t\t\tcloseOnConfirmButton: true,\r\n\t\t\tshowCloseButton: true,\r\n\t\t\tallowCloseOutside: true,\r\n\t\t\tallowMovement: true,\r\n\t\t\tmoveFromHeader: true,\r\n\t\t\tmoveFromBody: false,\r\n\t\t\tmoveFromFooter: true,\r\n\t\t\tstickyHeader: true,\r\n\t\t\tstickyFooter: true,\r\n\t\t\tstyle: null,\r\n\t\t\tanimationOnShow: 'animDropDown',\r\n\t\t\tanimationOnDestroy: 'animDropUp',\r\n\t\t\tanimationDuration: 500,\r\n\t\t\tbeforeShow: () => {},\r\n\t\t\tafterShow: () => {},\r\n\t\t\tbeforeDestroy: () => {},\r\n\t\t\tafterDestroy: () => {},\r\n\t\t\tonCancelButton: () => {},\r\n\t\t\tonConfirmButton: () => {},\r\n\t\t}\r\n\t\tthis.options = {...defaults, ...options};\r\n\t\t\r\n\t\t// Call init method\r\n\t\tthis.init();\r\n\t}\r\n\r\n\t/**\r\n\t * Initialization of the current modal\r\n\t */\r\n private init()\r\n\t{\r\n\t\t// Create webcimesModals\r\n\t\tif(!document.querySelector(\".webcimesModals\"))\r\n\t\t{\r\n\t\t\t// Create webcimesModals\r\n\t\t\tdocument.body.insertAdjacentHTML(\"beforeend\", '<div class=\"webcimesModals animFadeIn\"></div>');\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t\t\r\n\t\t\t// Set animation duration for webcimesModals\r\n\t\t\tthis.webcimesModals.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\r\n\t\t\t// Delete enter animation after animation delay\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.webcimesModals.classList.remove(\"animFadeIn\");\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Get webcimesModals\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\r\n\t\t\t// Remove animFadeOut in case of create new modal after destroy the last one before (during animation duration)\r\n\t\t\tthis.webcimesModals.classList.remove(\"animFadeOut\");\r\n\t\t}\r\n\t\r\n\t\t// Create modal\r\n\t\tthis.webcimesModals.insertAdjacentHTML(\"beforeend\", \r\n\t\t\t`<div class=\"modal `+(this.options.setClass?this.options.setClass:'')+` `+this.options.animationOnShow+`\" `+(this.options.setId?'id=\"'+this.options.setId+'\"':'')+`>\r\n\t\t\t\t`+(this.options.titleHtml||this.options.showCloseButton?\r\n\t\t\t\t\t`<div class=\"modalHeader `+(this.options.stickyHeader?'sticky':'')+` `+(this.options.moveFromHeader?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.titleHtml?'<div class=\"title\">'+this.options.titleHtml+'</div>':'')+`\r\n\t\t\t\t\t\t`+(this.options.showCloseButton?'<button class=\"close\"></button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.bodyHtml?\r\n\t\t\t\t\t`<div class=\"modalBody `+(this.options.moveFromBody?'movable':'')+`\">\r\n\t\t\t\t\t\t`+this.options.bodyHtml+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?\r\n\t\t\t\t\t`<div class=\"modalFooter `+(this.options.stickyFooter?'sticky':'')+` `+(this.options.moveFromFooter?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.buttonCancelHtml?'<button class=\"cancel '+(this.options.closeOnCancelButton?'close':'')+'\">'+this.options.buttonCancelHtml+'</button>':'')+`\r\n\t\t\t\t\t\t`+(this.options.buttonConfirmHtml?'<button class=\"confirm '+(this.options.closeOnConfirmButton?'close':'')+'\">'+this.options.buttonConfirmHtml+'</button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t</div>`\r\n\t\t);\r\n\t\tthis.modal = <HTMLElement>this.webcimesModals.lastElementChild;\r\n\t\t\r\n\t\t// Callback before show modal (set a timeout of zero, to wait for some dom to load)\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeShow\"));\r\n\t\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t\t{\r\n\t\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}\r\n\t\t}, 0);\r\n\t\t\r\n\t\t// Set animation duration for modal\r\n\t\tthis.modal.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\t\r\n\t\t// Delete animation of enter after the animation delay\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.classList.remove(this.options.animationOnShow);\r\n\t\r\n\t\t\t// Callback after show modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterShow\"));\r\n\t\t\tif(typeof this.options.afterShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.afterShow();\r\n\t\t\t}\r\n\t\t}, this.options.animationDuration);\r\n\t\r\n\t\t// Width of modal\r\n\t\tthis.modal.style.setProperty(\"max-width\", \"90%\");\r\n\t\tif(this.options.width != \"auto\" && this.options.width)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"width\", this.options.width);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-width\r\n\t\t\tthis.modal.style.setProperty(\"width\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Height of modal\r\n\t\tthis.modal.style.setProperty(\"max-height\", \"90%\");\r\n\t\tif(this.options.height != \"auto\" && this.options.height)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"height\", this.options.height);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-height\r\n\t\t\tthis.modal.style.setProperty(\"height\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Style\r\n\t\tif(this.options.style)\r\n\t\t{\r\n\t\t\tlet oldStyle = this.modal.getAttribute(\"style\");\r\n\t\t\tthis.modal.setAttribute(\"style\", oldStyle+this.options.style);\r\n\t\t}\r\n\t\r\n\t\t// Event on cancel button\r\n\t\tif(this.options.buttonCancelHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".cancel\")?.addEventListener(\"click\", this.eventCancelButton);\r\n\t\t}\r\n\t\r\n\t\t// Event on confirm button\r\n\t\tif(this.options.buttonConfirmHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".confirm\")?.addEventListener(\"click\", this.eventConfirmButton);\r\n\t\t}\r\n\t\t\r\n\t\t// Event click outside (on webcimesModals)\r\n\t\tthis.webcimesModals.addEventListener(\"click\", this.eventClickOutside);\r\n\t\r\n\t\t// Event close modal when click on close button\r\n\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\tel.addEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t});\r\n\t\r\n\t\t// Place selected modal on top\r\n\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\tthis.modal.addEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t});\r\n\t\t\r\n\t\t// Move modal\r\n\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t{\r\n\t\t\tif(this.options.moveFromHeader && this.modal.querySelector(\".modalHeader\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalHeader\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromBody && this.modal.querySelector(\".modalBody\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalBody\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromFooter && this.modal.querySelector(\".modalFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalFooter\"));\r\n\t\t\t}\r\n\t\r\n\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\tel.addEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventMove);\r\n\t\t\t});\r\n\r\n\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t});\r\n\r\n\t\t\tdocument.addEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t}\r\n\r\n\t\t// When resizing window, reset modal position to center\r\n\t\twindow.addEventListener(\"resize\", this.eventResize);\r\n }\r\n\r\n\t/**\r\n\t * Destroy current modal\r\n\t */\r\n\tpublic destroy()\r\n\t{\r\n\t\t// If modal is not already destroying\r\n\t\tif(!this.modal.getAttribute(\"data-destroying\"))\r\n\t\t{\r\n\t\t\t// Callback before destroy modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeDestroy\"));\r\n\t\t\tif(typeof this.options.beforeDestroy === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeDestroy();\r\n\t\t\t}\r\n\r\n\t\t\t// Close webcimesModals (according the number of modal not already destroying)\r\n\t\t\tif(document.querySelectorAll(\".modal:not([data-destroying])\").length == 1)\r\n\t\t\t{\r\n\t\t\t\tthis.webcimesModals.classList.add(\"animFadeOut\");\r\n\t\t\t}\r\n\r\n\t\t\t// Close modal\r\n\t\t\tthis.modal.setAttribute(\"data-destroying\", \"1\");\r\n\t\t\tthis.modal.classList.add(this.options.animationOnDestroy);\r\n\r\n\t\t\t// Destroy all events from modal and remove webcimesModals or modal after animation duration\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif(typeof this.modal !== 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Destroy all events from modal\r\n\r\n\t\t\t\t\tif(this.options.buttonCancelHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".cancel\")?.removeEventListener(\"click\", this.eventCancelButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(this.options.buttonConfirmHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".confirm\")?.removeEventListener(\"click\", this.eventConfirmButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.webcimesModals.removeEventListener(\"click\", this.eventClickOutside);\r\n\r\n\t\t\t\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\t\t\t\tel.removeEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\tthis.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\t\t\t\tel.removeEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventMove);\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.removeEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\twindow.removeEventListener(\"resize\", this.eventResize);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Remove webcimesModals or modal according the number of modal\r\n\t\t\t\t\t(document.querySelectorAll(\".modal\").length>1?this.modal:this.webcimesModals).remove();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Callback after destroy modal\r\n\t\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterDestroy\"));\r\n\t\t\t\tif(typeof this.options.afterDestroy === 'function')\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.options.afterDestroy();\r\n\t\t\t\t}\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t}\r\n}"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","WebcimesModal","webcimesModals","modal","options","eventCancelButton","this","dispatchEvent","CustomEvent","onCancelButton","eventConfirmButton","onConfirmButton","eventClickOutside","e","target","allowCloseOutside","destroy","classList","add","setTimeout","remove","animationDuration","eventClickCloseButton","eventDragModalOnTop","closest","document","querySelectorAll","length","nextElementSibling","oldScrollTop","scrollTop","insertAdjacentElement","position","offset","isDragging","moveFromElements","eventDragStart","clientX","x","offsetLeft","y","offsetTop","clientY","touches","eventMove","style","left","top","eventDragStop","eventPreventSelectText","preventDefault","eventResize","removeProperty","constructor","setId","setClass","width","height","titleHtml","bodyHtml","buttonCancelHtml","buttonConfirmHtml","closeOnCancelButton","closeOnConfirmButton","showCloseButton","allowMovement","moveFromHeader","moveFromBody","moveFromFooter","stickyHeader","stickyFooter","animationOnShow","animationOnDestroy","beforeShow","afterShow","beforeDestroy","afterDestroy","init","querySelector","body","insertAdjacentHTML","setProperty","lastElementChild","oldStyle","getAttribute","setAttribute","addEventListener","forEach","el","typeEvent","push","window","removeEventListener"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"js/webcimes-modal.esm.js","mappings":"AACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,sBCwF3E,MAAMI,EAGLC,eAGAC,MAGCC,QAEAC,kBAAgC,KAEvCC,KAAKH,MAAMI,cAAc,IAAIC,YAAY,mBACC,mBAAhCF,KAAKF,QAAQK,gBAEtBH,KAAKF,QAAQK,gB,EAIPC,mBAAiC,KAExCJ,KAAKH,MAAMI,cAAc,IAAIC,YAAY,oBACE,mBAAjCF,KAAKF,QAAQO,iBAEtBL,KAAKF,QAAQO,iB,EAIPC,kBAAyCC,IAC7CA,EAAEC,QAAUR,KAAKJ,iBAEhBI,KAAKF,QAAQW,kBAGfT,KAAKU,WAKLV,KAAKH,MAAMc,UAAUC,IAAI,kBAGzBC,YAAW,KACVb,KAAKH,MAAMc,UAAUG,OAAO,iBAAiB,GAC3Cd,KAAKF,QAAQiB,oB,EAKXC,sBAAoC,KAE3ChB,KAAKU,SAAS,EAGPO,oBAA2CV,IAElD,IAAkBA,EAAEC,OAAQU,QAAQ,WAGhCC,SAASC,iBAAiB,UAAUC,OAAS,GAAuC,OAAlCrB,KAAKH,MAAMyB,mBAChE,CACC,IAAIC,EAAevB,KAAKH,MAAM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C9BA,EAAGI,oBAAoBH,EAAWnF,KAAK8B,eAAe,GACrD,IAGH,CAAC,YAAa,aAAamD,SAASE,IACnChE,SAASmE,oBAAoBH,EAAWnF,KAAKsC,UAAU,IAGxD,CAAC,UAAW,YAAY2C,SAASE,IAChChE,SAASmE,oBAAoBH,EAAWnF,KAAK0C,cAAc,IAG5DvB,SAASmE,oBAAoB,cAAetF,KAAK2C,yBAGlD0C,OAAOC,oBAAoB,SAAUtF,KAAK6C,cAGzC1B,SAASC,iBAAiB,UAAUC,OAAO,EAAErB,KAAKH,MAAMG,KAAKJ,gBAAgBkB,UAI/Ed,KAAKH,MAAMI,cAAc,IAAIC,YAAY,iBACD,mBAA9BF,KAAKF,QAAQwE,cAEtBtE,KAAKF,QAAQwE,c,GAEZtE,KAAKF,QAAQiB,mBAElB,E","sources":["webpack://webcimes-modal/webpack/bootstrap","webpack://webcimes-modal/webpack/runtime/define property getters","webpack://webcimes-modal/webpack/runtime/hasOwnProperty shorthand","webpack://webcimes-modal/./src/ts/webcimes-modal.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n\"use strict\";\r\n\r\n/**\r\n * Global\r\n */\r\ndeclare global {\r\n\t/** Events */\r\n\tinterface GlobalEventHandlersEventMap {\r\n\t\tbeforeShow: CustomEvent;\r\n\t\tafterShow: CustomEvent;\r\n\t\tbeforeDestroy: CustomEvent;\r\n\t\tafterDestroy: CustomEvent;\r\n\t\tonCancelButton: CustomEvent;\r\n\t\tonConfirmButton: CustomEvent;\r\n\t}\r\n}\r\n\r\n/**\r\n * Options\r\n */\r\ninterface Options {\r\n\t/** set a specific id on the modal. default \"null\" */\r\n\tsetId: string | null;\r\n\t/** set a specific class on the modal, default \"null\" */\r\n\tsetClass: string | null;\r\n\t/** width (specify unit), default \"auto\" */\r\n\twidth: string;\r\n\t/** height (specify unit), default \"auto\" */\r\n\theight: string;\r\n\t/** html for title, default \"null\" */\r\n\ttitleHtml: string | null;\r\n\t/** html for body, default \"null\" */\r\n\tbodyHtml: string | null;\r\n\t/** html for cancel button, default \"null\" */\r\n\tbuttonCancelHtml: string | null;\r\n\t/** html for confirm button, default \"null\" */\r\n\tbuttonConfirmHtml: string | null;\r\n\t/** close modal after trigger cancel button, default \"true\" */\r\n\tcloseOnCancelButton: boolean;\r\n\t/** close modal after trigger confirm button, default \"true\" */\r\n\tcloseOnConfirmButton: boolean;\r\n\t/** show close button, default \"true\" */\r\n\tshowCloseButton: boolean;\r\n\t/** allow the modal to close when clicked outside, default \"true\" */\r\n\tallowCloseOutside: boolean;\r\n\t/** ability to move modal, default \"true\" */\r\n\tallowMovement: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from header, default \"true\" */\r\n\tmoveFromHeader: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from body, default \"false\" */\r\n\tmoveFromBody: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from footer, default \"true\" */\r\n\tmoveFromFooter: boolean;\r\n\t/** keep header sticky (visible) when scrolling, default \"true\" */\r\n\tstickyHeader: boolean;\r\n\t/** keep footer sticky (visible) when scrolling, default \"true\" */\r\n\tstickyFooter: boolean;\r\n\t/** add extra css style to modal, default null */\r\n\tstyle: string | null;\r\n\t/** \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\" */\r\n\tanimationOnShow: \"animDropDown\" | \"animFadeIn\";\r\n\t/** \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\" */\r\n\tanimationOnDestroy: \"animDropUp\" | \"animFadeOut\";\r\n\t/** animation duration in ms, default \"500\" */\r\n\tanimationDuration: number;\r\n\t/** callback before show modal */\r\n\tbeforeShow: () => void;\r\n\t/** callback after show modal */\r\n\tafterShow: () => void;\r\n\t/** callback before destroy modal */\r\n\tbeforeDestroy: () => void;\r\n\t/** callback after destroy modal */\r\n\tafterDestroy: () => void;\r\n\t/** callback after triggering cancel button */\r\n\tonCancelButton: () => void;\r\n\t/** callback after triggering confirm button */\r\n\tonConfirmButton: () => void;\r\n}\r\n\r\n/**\r\n * Class WebcimesModal\r\n */\r\nexport class WebcimesModal\r\n{\r\n\t/** Get the dom element containing all modals */\r\n\tpublic webcimesModals: HTMLElement;\r\n\r\n\t/** Get the dom element of the current modal */\r\n\tpublic modal: HTMLElement;\r\n\r\n\t/** Options of the current modal */\r\n\tprivate options: Options;\r\n\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onCancelButton\"));\r\n\t\tif(typeof this.options.onCancelButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onCancelButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onConfirmButton\"));\r\n\t\tif(typeof this.options.onConfirmButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onConfirmButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickOutside: (e: Event) => void = (e) => {\r\n\t\tif(e.target == this.webcimesModals)\r\n\t\t{\r\n\t\t\tif(this.options.allowCloseOutside)\r\n\t\t\t{\r\n\t\t\t\t// Destroy modal\r\n\t\t\t\tthis.destroy();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Add animation for show modal who can't be close\r\n\t\t\t\tthis.modal.classList.add(\"animGrowShrink\");\r\n\r\n\t\t\t\t// Delete animation after the animation delay\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.modal.classList.remove(\"animGrowShrink\");\r\n\t\t\t\t}, this.options.animationDuration);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\r\n\r\n\tprivate eventDragModalOnTop: (e: Event) => void = (e) => {\r\n\t\t// Only if target is not close button (for bug in chrome)\r\n\t\tif(!(<HTMLElement>e.target).closest(\".close\"))\r\n\t\t{\r\n\t\t\t// If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top\r\n\t\t\tif(document.querySelectorAll(\".modal\").length > 1 && this.modal.nextElementSibling !== null)\r\n\t\t\t{\r\n\t\t\t\tlet oldScrollTop = this.modal.scrollTop;\r\n\t\t\t\tthis.webcimesModals.insertAdjacentElement(\"beforeend\", this.modal);\r\n\t\t\t\tthis.modal.scrollTop = oldScrollTop;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate position: {x: number, y: number};\r\n\r\n\tprivate offset: {x: number, y: number};\r\n\r\n\tprivate isDragging: boolean = false;\r\n\r\n\tprivate moveFromElements: HTMLElement[] = [];\r\n\r\n\tprivate eventDragStart: (e: Event) => void = (e) => {\r\n\t\t// Start drag only if it's not a button\r\n\t\tif(!(<HTMLElement>e.target).closest(\"button\"))\r\n\t\t{\r\n\t\t\tthis.isDragging = true;\r\n\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventMove: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis.modal.style.left = (this.position.x + this.offset.x)+'px';\r\n\t\t\tthis.modal.style.top = (this.position.y + this.offset.y)+'px';\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\r\n\t};\r\n\t\r\n\tprivate eventPreventSelectText: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventResize: () => void = () => {\r\n\t\tthis.modal.style.removeProperty(\"left\");\r\n\t\tthis.modal.style.removeProperty(\"top\");\r\n\t\t\r\n\t};\r\n\r\n\t/**\r\n\t * Create modal\r\n\t */\r\n\tconstructor(options: Options)\r\n\t{\r\n\t\t// Defaults\r\n\t\tconst defaults: Options = {\r\n\t\t\tsetId: null,\r\n\t\t\tsetClass: null,\r\n\t\t\twidth: 'auto',\r\n\t\t\theight: 'auto',\r\n\t\t\ttitleHtml: null,\r\n\t\t\tbodyHtml: null,\r\n\t\t\tbuttonCancelHtml: null,\r\n\t\t\tbuttonConfirmHtml: null,\r\n\t\t\tcloseOnCancelButton: true,\r\n\t\t\tcloseOnConfirmButton: true,\r\n\t\t\tshowCloseButton: true,\r\n\t\t\tallowCloseOutside: true,\r\n\t\t\tallowMovement: true,\r\n\t\t\tmoveFromHeader: true,\r\n\t\t\tmoveFromBody: false,\r\n\t\t\tmoveFromFooter: true,\r\n\t\t\tstickyHeader: true,\r\n\t\t\tstickyFooter: true,\r\n\t\t\tstyle: null,\r\n\t\t\tanimationOnShow: 'animDropDown',\r\n\t\t\tanimationOnDestroy: 'animDropUp',\r\n\t\t\tanimationDuration: 500,\r\n\t\t\tbeforeShow: () => {},\r\n\t\t\tafterShow: () => {},\r\n\t\t\tbeforeDestroy: () => {},\r\n\t\t\tafterDestroy: () => {},\r\n\t\t\tonCancelButton: () => {},\r\n\t\t\tonConfirmButton: () => {},\r\n\t\t}\r\n\t\tthis.options = {...defaults, ...options};\r\n\t\t\r\n\t\t// Call init method\r\n\t\tthis.init();\r\n\t}\r\n\r\n\t/**\r\n\t * Initialization of the current modal\r\n\t */\r\n private init()\r\n\t{\r\n\t\t// Create webcimesModals\r\n\t\tif(!document.querySelector(\".webcimesModals\"))\r\n\t\t{\r\n\t\t\t// Create webcimesModals\r\n\t\t\tdocument.body.insertAdjacentHTML(\"beforeend\", '<div class=\"webcimesModals animFadeIn\"></div>');\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t\t\r\n\t\t\t// Set animation duration for webcimesModals\r\n\t\t\tthis.webcimesModals.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\r\n\t\t\t// Delete enter animation after animation delay\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.webcimesModals.classList.remove(\"animFadeIn\");\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Get webcimesModals\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\r\n\t\t\t// Remove animFadeOut in case of create new modal after destroy the last one before (during animation duration)\r\n\t\t\tthis.webcimesModals.classList.remove(\"animFadeOut\");\r\n\t\t}\r\n\t\r\n\t\t// Create modal\r\n\t\tthis.webcimesModals.insertAdjacentHTML(\"beforeend\", \r\n\t\t\t`<div class=\"modal `+(this.options.setClass?this.options.setClass:'')+` `+this.options.animationOnShow+`\" `+(this.options.setId?'id=\"'+this.options.setId+'\"':'')+`>\r\n\t\t\t\t`+(this.options.titleHtml||this.options.showCloseButton?\r\n\t\t\t\t\t`<div class=\"modalHeader `+(this.options.stickyHeader?'sticky':'')+` `+(this.options.moveFromHeader?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.titleHtml?'<div class=\"title\">'+this.options.titleHtml+'</div>':'')+`\r\n\t\t\t\t\t\t`+(this.options.showCloseButton?'<button class=\"close\"></button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.bodyHtml?\r\n\t\t\t\t\t`<div class=\"modalBody `+(this.options.moveFromBody?'movable':'')+`\">\r\n\t\t\t\t\t\t`+this.options.bodyHtml+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?\r\n\t\t\t\t\t`<div class=\"modalFooter `+(this.options.stickyFooter?'sticky':'')+` `+(this.options.moveFromFooter?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.buttonCancelHtml?'<button class=\"cancel '+(this.options.closeOnCancelButton?'close':'')+'\">'+this.options.buttonCancelHtml+'</button>':'')+`\r\n\t\t\t\t\t\t`+(this.options.buttonConfirmHtml?'<button class=\"confirm '+(this.options.closeOnConfirmButton?'close':'')+'\">'+this.options.buttonConfirmHtml+'</button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t</div>`\r\n\t\t);\r\n\t\tthis.modal = <HTMLElement>this.webcimesModals.lastElementChild;\r\n\t\t\r\n\t\t// Callback before show modal (set a timeout of zero, to wait for some dom to load)\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeShow\"));\r\n\t\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}\r\n\t\t}, 0);\r\n\t\t\r\n\t\t// Set animation duration for modal\r\n\t\tthis.modal.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\t\r\n\t\t// Delete animation of enter after the animation delay\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.classList.remove(this.options.animationOnShow);\r\n\t\r\n\t\t\t// Callback after show modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterShow\"));\r\n\t\t\tif(typeof this.options.afterShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.afterShow();\r\n\t\t\t}\r\n\t\t}, this.options.animationDuration);\r\n\t\r\n\t\t// Width of modal\r\n\t\tthis.modal.style.setProperty(\"max-width\", \"90%\");\r\n\t\tif(this.options.width != \"auto\" && this.options.width)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"width\", this.options.width);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-width\r\n\t\t\tthis.modal.style.setProperty(\"width\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Height of modal\r\n\t\tthis.modal.style.setProperty(\"max-height\", \"90%\");\r\n\t\tif(this.options.height != \"auto\" && this.options.height)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"height\", this.options.height);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-height\r\n\t\t\tthis.modal.style.setProperty(\"height\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Style\r\n\t\tif(this.options.style)\r\n\t\t{\r\n\t\t\tlet oldStyle = this.modal.getAttribute(\"style\");\r\n\t\t\tthis.modal.setAttribute(\"style\", oldStyle+this.options.style);\r\n\t\t}\r\n\t\r\n\t\t// Event on cancel button\r\n\t\tif(this.options.buttonCancelHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".cancel\")?.addEventListener(\"click\", this.eventCancelButton);\r\n\t\t}\r\n\t\r\n\t\t// Event on confirm button\r\n\t\tif(this.options.buttonConfirmHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".confirm\")?.addEventListener(\"click\", this.eventConfirmButton);\r\n\t\t}\r\n\t\t\r\n\t\t// Event click outside (on webcimesModals)\r\n\t\tthis.webcimesModals.addEventListener(\"click\", this.eventClickOutside);\r\n\t\r\n\t\t// Event close modal when click on close button\r\n\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\tel.addEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t});\r\n\t\r\n\t\t// Place selected modal on top\r\n\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\tthis.modal.addEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t});\r\n\t\t\r\n\t\t// Move modal\r\n\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t{\r\n\t\t\tif(this.options.moveFromHeader && this.modal.querySelector(\".modalHeader\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalHeader\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromBody && this.modal.querySelector(\".modalBody\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalBody\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromFooter && this.modal.querySelector(\".modalFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalFooter\"));\r\n\t\t\t}\r\n\t\r\n\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\tel.addEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventMove);\r\n\t\t\t});\r\n\r\n\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t});\r\n\r\n\t\t\tdocument.addEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t}\r\n\r\n\t\t// When resizing window, reset modal position to center\r\n\t\twindow.addEventListener(\"resize\", this.eventResize);\r\n }\r\n\r\n\t/**\r\n\t * Destroy current modal\r\n\t */\r\n\tpublic destroy()\r\n\t{\r\n\t\t// If modal is not already destroying\r\n\t\tif(!this.modal.getAttribute(\"data-destroying\"))\r\n\t\t{\r\n\t\t\t// Callback before destroy modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeDestroy\"));\r\n\t\t\tif(typeof this.options.beforeDestroy === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeDestroy();\r\n\t\t\t}\r\n\r\n\t\t\t// Close webcimesModals (according the number of modal not already destroying)\r\n\t\t\tif(document.querySelectorAll(\".modal:not([data-destroying])\").length == 1)\r\n\t\t\t{\r\n\t\t\t\tthis.webcimesModals.classList.add(\"animFadeOut\");\r\n\t\t\t}\r\n\r\n\t\t\t// Close modal\r\n\t\t\tthis.modal.setAttribute(\"data-destroying\", \"1\");\r\n\t\t\tthis.modal.classList.add(this.options.animationOnDestroy);\r\n\r\n\t\t\t// Destroy all events from modal and remove webcimesModals or modal after animation duration\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif(typeof this.modal !== 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Destroy all events from modal\r\n\r\n\t\t\t\t\tif(this.options.buttonCancelHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".cancel\")?.removeEventListener(\"click\", this.eventCancelButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(this.options.buttonConfirmHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".confirm\")?.removeEventListener(\"click\", this.eventConfirmButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.webcimesModals.removeEventListener(\"click\", this.eventClickOutside);\r\n\r\n\t\t\t\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\t\t\t\tel.removeEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\tthis.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\t\t\t\tel.removeEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventMove);\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.removeEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\twindow.removeEventListener(\"resize\", this.eventResize);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Remove webcimesModals or modal according the number of modal\r\n\t\t\t\t\t(document.querySelectorAll(\".modal\").length>1?this.modal:this.webcimesModals).remove();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Callback after destroy modal\r\n\t\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterDestroy\"));\r\n\t\t\t\tif(typeof this.options.afterDestroy === 'function')\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.options.afterDestroy();\r\n\t\t\t\t}\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t}\r\n}"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","WebcimesModal","webcimesModals","modal","options","eventCancelButton","this","dispatchEvent","CustomEvent","onCancelButton","eventConfirmButton","onConfirmButton","eventClickOutside","e","target","allowCloseOutside","destroy","classList","add","setTimeout","remove","animationDuration","eventClickCloseButton","eventDragModalOnTop","closest","document","querySelectorAll","length","nextElementSibling","oldScrollTop","scrollTop","insertAdjacentElement","position","offset","isDragging","moveFromElements","eventDragStart","clientX","x","offsetLeft","y","offsetTop","clientY","touches","eventMove","style","left","top","eventDragStop","eventPreventSelectText","preventDefault","eventResize","removeProperty","constructor","setId","setClass","width","height","titleHtml","bodyHtml","buttonCancelHtml","buttonConfirmHtml","closeOnCancelButton","closeOnConfirmButton","showCloseButton","allowMovement","moveFromHeader","moveFromBody","moveFromFooter","stickyHeader","stickyFooter","animationOnShow","animationOnDestroy","beforeShow","afterShow","beforeDestroy","afterDestroy","init","querySelector","body","insertAdjacentHTML","setProperty","lastElementChild","oldStyle","getAttribute","setAttribute","addEventListener","forEach","el","typeEvent","push","window","removeE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,CAAC,YAAa,cAAciE,SAASE,IACpCnF,KAAKH,MAAMyF,oBAAoBH,EAAWnF,KAAKiB,oBAAoB,IAGjEjB,KAAKF,QAAQ6D,gBAAkB3D,KAAKF,QAAQ8D,gBAAkB5D,KAAKF,QAAQ+D,cAAgB7D,KAAKF,QAAQgE,kBAE1G,CAAC,YAAa,cAAcmB,SAASE,IACpCnF,KAAK6B,iBAAiBoD,SAASC,IAC9BA,EAAGI,oBAAoBH,EAAWnF,KAAK8B,eAAe,GACrD,IAGH,CAAC,YAAa,aAAamD,SAASE,IACnChE,SAASmE,oBAAoBH,EAAWnF,KAAKsC,UAAU,IAGxD,CAAC,UAAW,YAAY2C,SAASE,IAChChE,SAASmE,oBAAoBH,EAAWnF,KAAK0C,cAAc,IAG5DvB,SAASmE,oBAAoB,cAAetF,KAAK2C,yBAGlD0C,OAAOC,oBAAoB,SAAUtF,KAAK6C,cAGzC1B,SAASC,iBAAiB,UAAUC,OAAO,EAAErB,KAAKH,MAAMG,KAAKJ,gBAAgBkB,UAI/Ed,KAAKH,MAAMI,cAAc,IAAIC,YAAY,iBACD,mBAA9BF,KAAKF,QAAQwE,cAEtBtE,KAAKF,QAAQwE,c,GAEZtE,KAAKF,QAAQiB,mBAElB,E","sources":["webpack://webcimes-modal/webpack/universalModuleDefinition","webpack://webcimes-modal/webpack/bootstrap","webpack://webcimes-modal/webpack/runtime/define property getters","webpack://webcimes-modal/webpack/runtime/hasOwnProperty shorthand","webpack://webcimes-modal/webpack/runtime/make namespace object","webpack://webcimes-modal/./src/ts/webcimes-modal.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n\"use strict\";\r\n\r\n/**\r\n * Global\r\n */\r\ndeclare global {\r\n\t/** Events */\r\n\tinterface GlobalEventHandlersEventMap {\r\n\t\tbeforeShow: CustomEvent;\r\n\t\tafterShow: CustomEvent;\r\n\t\tbeforeDestroy: CustomEvent;\r\n\t\tafterDestroy: CustomEvent;\r\n\t\tonCancelButton: CustomEvent;\r\n\t\tonConfirmButton: CustomEvent;\r\n\t}\r\n}\r\n\r\n/**\r\n * Options\r\n */\r\ninterface Options {\r\n\t/** set a specific id on the modal. default \"null\" */\r\n\tsetId: string | null;\r\n\t/** set a specific class on the modal, default \"null\" */\r\n\tsetClass: string | null;\r\n\t/** width (specify unit), default \"auto\" */\r\n\twidth: string;\r\n\t/** height (specify unit), default \"auto\" */\r\n\theight: string;\r\n\t/** html for title, default \"null\" */\r\n\ttitleHtml: string | null;\r\n\t/** html for body, default \"null\" */\r\n\tbodyHtml: string | null;\r\n\t/** html for cancel button, default \"null\" */\r\n\tbuttonCancelHtml: string | null;\r\n\t/** html for confirm button, default \"null\" */\r\n\tbuttonConfirmHtml: string | null;\r\n\t/** close modal after trigger cancel button, default \"true\" */\r\n\tcloseOnCancelButton: boolean;\r\n\t/** close modal after trigger confirm button, default \"true\" */\r\n\tcloseOnConfirmButton: boolean;\r\n\t/** show close button, default \"true\" */\r\n\tshowCloseButton: boolean;\r\n\t/** allow the modal to close when clicked outside, default \"true\" */\r\n\tallowCloseOutside: boolean;\r\n\t/** ability to move modal, default \"true\" */\r\n\tallowMovement: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from header, default \"true\" */\r\n\tmoveFromHeader: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from body, default \"false\" */\r\n\tmoveFromBody: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from footer, default \"true\" */\r\n\tmoveFromFooter: boolean;\r\n\t/** keep header sticky (visible) when scrolling, default \"true\" */\r\n\tstickyHeader: boolean;\r\n\t/** keep footer sticky (visible) when scrolling, default \"true\" */\r\n\tstickyFooter: boolean;\r\n\t/** add extra css style to modal, default null */\r\n\tstyle: string | null;\r\n\t/** \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\" */\r\n\tanimationOnShow: \"animDropDown\" | \"animFadeIn\";\r\n\t/** \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\" */\r\n\tanimationOnDestroy: \"animDropUp\" | \"animFadeOut\";\r\n\t/** animation duration in ms, default \"500\" */\r\n\tanimationDuration: number;\r\n\t/** callback before show modal */\r\n\tbeforeShow: () => void;\r\n\t/** callback after show modal */\r\n\tafterShow: () => void;\r\n\t/** callback before destroy modal */\r\n\tbeforeDestroy: () => void;\r\n\t/** callback after destroy modal */\r\n\tafterDestroy: () => void;\r\n\t/** callback after triggering cancel button */\r\n\tonCancelButton: () => void;\r\n\t/** callback after triggering confirm button */\r\n\tonConfirmButton: () => void;\r\n}\r\n\r\n/**\r\n * Class WebcimesModal\r\n */\r\nexport class WebcimesModal\r\n{\r\n\t/** Get the dom element containing all modals */\r\n\tpublic webcimesModals: HTMLElement;\r\n\r\n\t/** Get the dom element of the current modal */\r\n\tpublic modal: HTMLElement;\r\n\r\n\t/** Options of the current modal */\r\n\tprivate options: Options;\r\n\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onCancelButton\"));\r\n\t\tif(typeof this.options.onCancelButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onCancelButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onConfirmButton\"));\r\n\t\tif(typeof this.options.onConfirmButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onConfirmButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickOutside: (e: Event) => void = (e) => {\r\n\t\tif(e.target == this.webcimesModals)\r\n\t\t{\r\n\t\t\tif(this.options.allowCloseOutside)\r\n\t\t\t{\r\n\t\t\t\t// Destroy modal\r\n\t\t\t\tthis.destroy();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Add animation for show modal who can't be close\r\n\t\t\t\tthis.modal.classList.add(\"animGrowShrink\");\r\n\r\n\t\t\t\t// Delete animation after the animation delay\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.modal.classList.remove(\"animGrowShrink\");\r\n\t\t\t\t}, this.options.animationDuration);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\r\n\r\n\tprivate eventDragModalOnTop: (e: Event) => void = (e) => {\r\n\t\t// Only if target is not close button (for bug in chrome)\r\n\t\tif(!(<HTMLElement>e.target).closest(\".close\"))\r\n\t\t{\r\n\t\t\t// If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top\r\n\t\t\tif(document.querySelectorAll(\".modal\").length > 1 && this.modal.nextElementSibling !== null)\r\n\t\t\t{\r\n\t\t\t\tlet oldScrollTop = this.modal.scrollTop;\r\n\t\t\t\tthis.webcimesModals.insertAdjacentElement(\"beforeend\", this.modal);\r\n\t\t\t\tthis.modal.scrollTop = oldScrollTop;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate position: {x: number, y: number};\r\n\r\n\tprivate offset: {x: number, y: number};\r\n\r\n\tprivate isDragging: boolean = false;\r\n\r\n\tprivate moveFromElements: HTMLElement[] = [];\r\n\r\n\tprivate eventDragStart: (e: Event) => void = (e) => {\r\n\t\t// Start drag only if it's not a button\r\n\t\tif(!(<HTMLElement>e.target).closest(\"button\"))\r\n\t\t{\r\n\t\t\tthis.isDragging = true;\r\n\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventMove: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis.modal.style.left = (this.position.x + this.offset.x)+'px';\r\n\t\t\tthis.modal.style.top = (this.position.y + this.offset.y)+'px';\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\r\n\t};\r\n\t\r\n\tprivate eventPreventSelectText: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventResize: () => void = () => {\r\n\t\tthis.modal.style.removeProperty(\"left\");\r\n\t\tthis.modal.style.removeProperty(\"top\");\r\n\t\t\r\n\t};\r\n\r\n\t/**\r\n\t * Create modal\r\n\t */\r\n\tconstructor(options: Options)\r\n\t{\r\n\t\t// Defaults\r\n\t\tconst defaults: Options = {\r\n\t\t\tsetId: null,\r\n\t\t\tsetClass: null,\r\n\t\t\twidth: 'auto',\r\n\t\t\theight: 'auto',\r\n\t\t\ttitleHtml: null,\r\n\t\t\tbodyHtml: null,\r\n\t\t\tbuttonCancelHtml: null,\r\n\t\t\tbuttonConfirmHtml: null,\r\n\t\t\tcloseOnCancelButton: true,\r\n\t\t\tcloseOnConfirmButton: true,\r\n\t\t\tshowCloseButton: true,\r\n\t\t\tallowCloseOutside: true,\r\n\t\t\tallowMovement: true,\r\n\t\t\tmoveFromHeader: true,\r\n\t\t\tmoveFromBody: false,\r\n\t\t\tmoveFromFooter: true,\r\n\t\t\tstickyHeader: true,\r\n\t\t\tstickyFooter: true,\r\n\t\t\tstyle: null,\r\n\t\t\tanimationOnShow: 'animDropDown',\r\n\t\t\tanimationOnDestroy: 'animDropUp',\r\n\t\t\tanimationDuration: 500,\r\n\t\t\tbeforeShow: () => {},\r\n\t\t\tafterShow: () => {},\r\n\t\t\tbeforeDestroy: () => {},\r\n\t\t\tafterDestroy: () => {},\r\n\t\t\tonCancelButton: () => {},\r\n\t\t\tonConfirmButton: () => {},\r\n\t\t}\r\n\t\tthis.options = {...defaults, ...options};\r\n\t\t\r\n\t\t// Call init method\r\n\t\tthis.init();\r\n\t}\r\n\r\n\t/**\r\n\t * Initialization of the current modal\r\n\t */\r\n private init()\r\n\t{\r\n\t\t// Create webcimesModals\r\n\t\tif(!document.querySelector(\".webcimesModals\"))\r\n\t\t{\r\n\t\t\t// Create webcimesModals\r\n\t\t\tdocument.body.insertAdjacentHTML(\"beforeend\", '<div class=\"webcimesModals animFadeIn\"></div>');\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t\t\r\n\t\t\t// Set animation duration for webcimesModals\r\n\t\t\tthis.webcimesModals.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\r\n\t\t\t// Delete enter animation after animation delay\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.webcimesModals.classList.remove(\"animFadeIn\");\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Get webcimesModals\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\r\n\t\t\t// Remove animFadeOut in case of create new modal after destroy the last one before (during animation duration)\r\n\t\t\tthis.webcimesModals.classList.remove(\"animFadeOut\");\r\n\t\t}\r\n\t\r\n\t\t// Create modal\r\n\t\tthis.webcimesModals.insertAdjacentHTML(\"beforeend\", \r\n\t\t\t`<div class=\"modal `+(this.options.setClass?this.options.setClass:'')+` `+this.options.animationOnShow+`\" `+(this.options.setId?'id=\"'+this.options.setId+'\"':'')+`>\r\n\t\t\t\t`+(this.options.titleHtml||this.options.showCloseButton?\r\n\t\t\t\t\t`<div class=\"modalHeader `+(this.options.stickyHeader?'sticky':'')+` `+(this.options.moveFromHeader?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.titleHtml?'<div class=\"title\">'+this.options.titleHtml+'</div>':'')+`\r\n\t\t\t\t\t\t`+(this.options.showCloseButton?'<button class=\"close\"></button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.bodyHtml?\r\n\t\t\t\t\t`<div class=\"modalBody `+(this.options.moveFromBody?'movable':'')+`\">\r\n\t\t\t\t\t\t`+this.options.bodyHtml+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?\r\n\t\t\t\t\t`<div class=\"modalFooter `+(this.options.stickyFooter?'sticky':'')+` `+(this.options.moveFromFooter?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.buttonCancelHtml?'<button class=\"cancel '+(this.options.closeOnCancelButton?'close':'')+'\">'+this.options.buttonCancelHtml+'</button>':'')+`\r\n\t\t\t\t\t\t`+(this.options.buttonConfirmHtml?'<button class=\"confirm '+(this.options.closeOnConfirmButton?'close':'')+'\">'+this.options.buttonConfirmHtml+'</button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t</div>`\r\n\t\t);\r\n\t\tthis.modal = <HTMLElement>this.webcimesModals.lastElementChild;\r\n\t\t\r\n\t\t// Callback before show modal (set a timeout of zero, to wait for some dom to load)\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeShow\"));\r\n\t\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t\t{\r\n\t\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}\r\n\t\t}, 0);\r\n\t\t\r\n\t\t// Set animation duration for modal\r\n\t\tthis.modal.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\t\r\n\t\t// Delete animation of enter after the animation delay\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.classList.remove(this.options.animationOnShow);\r\n\t\r\n\t\t\t// Callback after show modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterShow\"));\r\n\t\t\tif(typeof this.options.afterShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.afterShow();\r\n\t\t\t}\r\n\t\t}, this.options.animationDuration);\r\n\t\r\n\t\t// Width of modal\r\n\t\tthis.modal.style.setProperty(\"max-width\", \"90%\");\r\n\t\tif(this.options.width != \"auto\" && this.options.width)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"width\", this.options.width);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-width\r\n\t\t\tthis.modal.style.setProperty(\"width\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Height of modal\r\n\t\tthis.modal.style.setProperty(\"max-height\", \"90%\");\r\n\t\tif(this.options.height != \"auto\" && this.options.height)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"height\", this.options.height);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-height\r\n\t\t\tthis.modal.style.setProperty(\"height\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Style\r\n\t\tif(this.options.style)\r\n\t\t{\r\n\t\t\tlet oldStyle = this.modal.getAttribute(\"style\");\r\n\t\t\tthis.modal.setAttribute(\"style\", oldStyle+this.options.style);\r\n\t\t}\r\n\t\r\n\t\t// Event on cancel button\r\n\t\tif(this.options.buttonCancelHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".cancel\")?.addEventListener(\"click\", this.eventCancelButton);\r\n\t\t}\r\n\t\r\n\t\t// Event on confirm button\r\n\t\tif(this.options.buttonConfirmHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".confirm\")?.addEventListener(\"click\", this.eventConfirmButton);\r\n\t\t}\r\n\t\t\r\n\t\t// Event click outside (on webcimesModals)\r\n\t\tthis.webcimesModals.addEventListener(\"click\", this.eventClickOutside);\r\n\t\r\n\t\t// Event close modal when click on close button\r\n\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\tel.addEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t});\r\n\t\r\n\t\t// Place selected modal on top\r\n\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\tthis.modal.addEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t});\r\n\t\t\r\n\t\t// Move modal\r\n\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t{\r\n\t\t\tif(this.options.moveFromHeader && this.modal.querySelector(\".modalHeader\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalHeader\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromBody && this.modal.querySelector(\".modalBody\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalBody\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromFooter && this.modal.querySelector(\".modalFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalFooter\"));\r\n\t\t\t}\r\n\t\r\n\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\tel.addEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventMove);\r\n\t\t\t});\r\n\r\n\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t});\r\n\r\n\t\t\tdocument.addEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t}\r\n\r\n\t\t// When resizing window, reset modal position to center\r\n\t\twindow.addEventListener(\"resize\", this.eventResize);\r\n }\r\n\r\n\t/**\r\n\t * Destroy current modal\r\n\t */\r\n\tpublic destroy()\r\n\t{\r\n\t\t// If modal is not already destroying\r\n\t\tif(!this.modal.getAttribute(\"data-destroying\"))\r\n\t\t{\r\n\t\t\t// Callback before destroy modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeDestroy\"));\r\n\t\t\tif(typeof this.options.beforeDestroy === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeDestroy();\r\n\t\t\t}\r\n\r\n\t\t\t// Close webcimesModals (according the number of modal not already destroying)\r\n\t\t\tif(document.querySelectorAll(\".modal:not([data-destroying])\").length == 1)\r\n\t\t\t{\r\n\t\t\t\tthis.webcimesModals.classList.add(\"animFadeOut\");\r\n\t\t\t}\r\n\r\n\t\t\t// Close modal\r\n\t\t\tthis.modal.setAttribute(\"data-destroying\", \"1\");\r\n\t\t\tthis.modal.classList.add(this.options.animationOnDestroy);\r\n\r\n\t\t\t// Destroy all events from modal and remove webcimesModals or modal after animation duration\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif(typeof this.modal !== 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Destroy all events from modal\r\n\r\n\t\t\t\t\tif(this.options.buttonCancelHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".cancel\")?.removeEventListener(\"click\", this.eventCancelButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(this.options.buttonConfirmHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".confirm\")?.removeEventListener(\"click\", this.eventConfirmButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.webcimesModals.removeEventListener(\"click\", this.eventClickOutside);\r\n\r\n\t\t\t\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\t\t\t\tel.removeEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\tthis.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\t\t\t\tel.removeEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventMove);\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.removeEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\twindow.removeEventListener(\"resize\", this.eventResize);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Remove webcimesModals or modal according the number of modal\r\n\t\t\t\t\t(document.querySelectorAll(\".modal\").length>1?this.modal:this.webcimesModals).remove();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Callback after destroy modal\r\n\t\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterDestroy\"));\r\n\t\t\t\tif(typeof this.options.afterDestroy === 'function')\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.options.afterDestroy();\r\n\t\t\t\t}\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t}\r\n}"],"names":["root","factory","exports","module","define","amd","a","i","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","WebcimesModal","webcimesModals","modal","options","eventCancelButton","this","dispatchEvent","CustomEvent","onCancelButton","eventConfirmButton","onConfirmButton","eventClickOutside","e","target","allowCloseOutside","destroy","classList","add","setTimeout","remove","animationDuration","eventClickCloseButton","eventDragModalOnTop","closest","document","querySelectorAll","length","nextElementSibling","oldScrollTop","scrollTop","insertAdjacentElement","position","offset","isDragging","moveFromElements","eventDragStart","clientX","x","offsetLeft","y","offsetTop","clientY","touches","eventMove","style","left","top","eventDragStop","eventPreventSelectText","preventDefault","eventResize","removeProperty","constructor","setId","setClass","width","height","titleHtml","bodyHtml","buttonCancelHtml","buttonConfirmHtml","closeOnCancelButton","closeOnConfirmButton","showCloseButton","allowMovement","moveFromHeader","moveFromBody","moveFromFooter","stickyHeader","stickyFooter","animationOnShow","animationOnDestroy","beforeShow","afterShow","beforeDestroy","afterDestroy","init","querySelector","body","insertAdjacentHTML","setProperty","lastElementChild","oldStyle","getAttribute","setAttribute","addEventListener","forEach","el","typeEvent","push","window","removeEventListener"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"js/webcimes-modal.udm.js","mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,EACvE,CACA,CATD,CASGC,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACP,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAEV,EAASS,IAC5EE,OAA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BAGlD0C,OAAOC,oBAAoB,SAAUtF,KAAK6C,cAGzC1B,SAASC,iBAAiB,UAAUC,OAAO,EAAErB,KAAKH,MAAMG,KAAKJ,gBAAgBkB,UAI/Ed,KAAKH,MAAMI,cAAc,IAAIC,YAAY,iBACD,mBAA9BF,KAAKF,QAAQwE,cAEtBtE,KAAKF,QAAQwE,c,GAEZtE,KAAKF,QAAQiB,mBAElB,E","sources":["webpack://webcimes-modal/webpack/universalModuleDefinition","webpack://webcimes-modal/webpack/bootstrap","webpack://webcimes-modal/webpack/runtime/define property getters","webpack://webcimes-modal/webpack/runtime/hasOwnProperty shorthand","webpack://webcimes-modal/webpack/runtime/make namespace object","webpack://webcimes-modal/./src/ts/webcimes-modal.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\r\n * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)\r\n * MIT License - https://choosealicense.com/licenses/mit/\r\n * Date: 2023-03-25\r\n */\r\n\r\n\"use strict\";\r\n\r\n/**\r\n * Global\r\n */\r\ndeclare global {\r\n\t/** Events */\r\n\tinterface GlobalEventHandlersEventMap {\r\n\t\tbeforeShow: CustomEvent;\r\n\t\tafterShow: CustomEvent;\r\n\t\tbeforeDestroy: CustomEvent;\r\n\t\tafterDestroy: CustomEvent;\r\n\t\tonCancelButton: CustomEvent;\r\n\t\tonConfirmButton: CustomEvent;\r\n\t}\r\n}\r\n\r\n/**\r\n * Options\r\n */\r\ninterface Options {\r\n\t/** set a specific id on the modal. default \"null\" */\r\n\tsetId: string | null;\r\n\t/** set a specific class on the modal, default \"null\" */\r\n\tsetClass: string | null;\r\n\t/** width (specify unit), default \"auto\" */\r\n\twidth: string;\r\n\t/** height (specify unit), default \"auto\" */\r\n\theight: string;\r\n\t/** html for title, default \"null\" */\r\n\ttitleHtml: string | null;\r\n\t/** html for body, default \"null\" */\r\n\tbodyHtml: string | null;\r\n\t/** html for cancel button, default \"null\" */\r\n\tbuttonCancelHtml: string | null;\r\n\t/** html for confirm button, default \"null\" */\r\n\tbuttonConfirmHtml: string | null;\r\n\t/** close modal after trigger cancel button, default \"true\" */\r\n\tcloseOnCancelButton: boolean;\r\n\t/** close modal after trigger confirm button, default \"true\" */\r\n\tcloseOnConfirmButton: boolean;\r\n\t/** show close button, default \"true\" */\r\n\tshowCloseButton: boolean;\r\n\t/** allow the modal to close when clicked outside, default \"true\" */\r\n\tallowCloseOutside: boolean;\r\n\t/** ability to move modal, default \"true\" */\r\n\tallowMovement: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from header, default \"true\" */\r\n\tmoveFromHeader: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from body, default \"false\" */\r\n\tmoveFromBody: boolean;\r\n\t/** if allowMovement is set to \"true\", ability to move modal from footer, default \"true\" */\r\n\tmoveFromFooter: boolean;\r\n\t/** keep header sticky (visible) when scrolling, default \"true\" */\r\n\tstickyHeader: boolean;\r\n\t/** keep footer sticky (visible) when scrolling, default \"true\" */\r\n\tstickyFooter: boolean;\r\n\t/** add extra css style to modal, default null */\r\n\tstyle: string | null;\r\n\t/** \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\" */\r\n\tanimationOnShow: \"animDropDown\" | \"animFadeIn\";\r\n\t/** \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\" */\r\n\tanimationOnDestroy: \"animDropUp\" | \"animFadeOut\";\r\n\t/** animation duration in ms, default \"500\" */\r\n\tanimationDuration: number;\r\n\t/** callback before show modal */\r\n\tbeforeShow: () => void;\r\n\t/** callback after show modal */\r\n\tafterShow: () => void;\r\n\t/** callback before destroy modal */\r\n\tbeforeDestroy: () => void;\r\n\t/** callback after destroy modal */\r\n\tafterDestroy: () => void;\r\n\t/** callback after triggering cancel button */\r\n\tonCancelButton: () => void;\r\n\t/** callback after triggering confirm button */\r\n\tonConfirmButton: () => void;\r\n}\r\n\r\n/**\r\n * Class WebcimesModal\r\n */\r\nexport class WebcimesModal\r\n{\r\n\t/** Get the dom element containing all modals */\r\n\tpublic webcimesModals: HTMLElement;\r\n\r\n\t/** Get the dom element of the current modal */\r\n\tpublic modal: HTMLElement;\r\n\r\n\t/** Options of the current modal */\r\n\tprivate options: Options;\r\n\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onCancelButton\"));\r\n\t\tif(typeof this.options.onCancelButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onCancelButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\r\n\t\tthis.modal.dispatchEvent(new CustomEvent(\"onConfirmButton\"));\r\n\t\tif(typeof this.options.onConfirmButton === 'function')\r\n\t\t{\r\n\t\t\tthis.options.onConfirmButton();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickOutside: (e: Event) => void = (e) => {\r\n\t\tif(e.target == this.webcimesModals)\r\n\t\t{\r\n\t\t\tif(this.options.allowCloseOutside)\r\n\t\t\t{\r\n\t\t\t\t// Destroy modal\r\n\t\t\t\tthis.destroy();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Add animation for show modal who can't be close\r\n\t\t\t\tthis.modal.classList.add(\"animGrowShrink\");\r\n\r\n\t\t\t\t// Delete animation after the animation delay\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.modal.classList.remove(\"animGrowShrink\");\r\n\t\t\t\t}, this.options.animationDuration);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\r\n\r\n\tprivate eventDragModalOnTop: (e: Event) => void = (e) => {\r\n\t\t// Only if target is not close button (for bug in chrome)\r\n\t\tif(!(<HTMLElement>e.target).closest(\".close\"))\r\n\t\t{\r\n\t\t\t// If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top\r\n\t\t\tif(document.querySelectorAll(\".modal\").length > 1 && this.modal.nextElementSibling !== null)\r\n\t\t\t{\r\n\t\t\t\tlet oldScrollTop = this.modal.scrollTop;\r\n\t\t\t\tthis.webcimesModals.insertAdjacentElement(\"beforeend\", this.modal);\r\n\t\t\t\tthis.modal.scrollTop = oldScrollTop;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate position: {x: number, y: number};\r\n\r\n\tprivate offset: {x: number, y: number};\r\n\r\n\tprivate isDragging: boolean = false;\r\n\r\n\tprivate moveFromElements: HTMLElement[] = [];\r\n\r\n\tprivate eventDragStart: (e: Event) => void = (e) => {\r\n\t\t// Start drag only if it's not a button\r\n\t\tif(!(<HTMLElement>e.target).closest(\"button\"))\r\n\t\t{\r\n\t\t\tthis.isDragging = true;\r\n\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.offset = {\r\n\t\t\t\t\tx: this.modal.offsetLeft - (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: this.modal.offsetTop - (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventMove: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\t// Mouse\r\n\t\t\tif((<MouseEvent>e).clientX)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<MouseEvent>e).clientX,\r\n\t\t\t\t\ty: (<MouseEvent>e).clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t// Touch device (use the first touch only)\r\n\t\t\telse if((<TouchEvent>e).touches)\r\n\t\t\t{\r\n\t\t\t\tthis.position = {\r\n\t\t\t\t\tx: (<TouchEvent>e).touches[0].clientX,\r\n\t\t\t\t\ty: (<TouchEvent>e).touches[0].clientY\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tthis.modal.style.left = (this.position.x + this.offset.x)+'px';\r\n\t\t\tthis.modal.style.top = (this.position.y + this.offset.y)+'px';\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\r\n\t};\r\n\t\r\n\tprivate eventPreventSelectText: (e: Event) => void = (e) => {\r\n\t\tif(this.isDragging)\r\n\t\t{\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t};\r\n\r\n\tprivate eventResize: () => void = () => {\r\n\t\tthis.modal.style.removeProperty(\"left\");\r\n\t\tthis.modal.style.removeProperty(\"top\");\r\n\t\t\r\n\t};\r\n\r\n\t/**\r\n\t * Create modal\r\n\t */\r\n\tconstructor(options: Options)\r\n\t{\r\n\t\t// Defaults\r\n\t\tconst defaults: Options = {\r\n\t\t\tsetId: null,\r\n\t\t\tsetClass: null,\r\n\t\t\twidth: 'auto',\r\n\t\t\theight: 'auto',\r\n\t\t\ttitleHtml: null,\r\n\t\t\tbodyHtml: null,\r\n\t\t\tbuttonCancelHtml: null,\r\n\t\t\tbuttonConfirmHtml: null,\r\n\t\t\tcloseOnCancelButton: true,\r\n\t\t\tcloseOnConfirmButton: true,\r\n\t\t\tshowCloseButton: true,\r\n\t\t\tallowCloseOutside: true,\r\n\t\t\tallowMovement: true,\r\n\t\t\tmoveFromHeader: true,\r\n\t\t\tmoveFromBody: false,\r\n\t\t\tmoveFromFooter: true,\r\n\t\t\tstickyHeader: true,\r\n\t\t\tstickyFooter: true,\r\n\t\t\tstyle: null,\r\n\t\t\tanimationOnShow: 'animDropDown',\r\n\t\t\tanimationOnDestroy: 'animDropUp',\r\n\t\t\tanimationDuration: 500,\r\n\t\t\tbeforeShow: () => {},\r\n\t\t\tafterShow: () => {},\r\n\t\t\tbeforeDestroy: () => {},\r\n\t\t\tafterDestroy: () => {},\r\n\t\t\tonCancelButton: () => {},\r\n\t\t\tonConfirmButton: () => {},\r\n\t\t}\r\n\t\tthis.options = {...defaults, ...options};\r\n\t\t\r\n\t\t// Call init method\r\n\t\tthis.init();\r\n\t}\r\n\r\n\t/**\r\n\t * Initialization of the current modal\r\n\t */\r\n private init()\r\n\t{\r\n\t\t// Create webcimesModals\r\n\t\tif(!document.querySelector(\".webcimesModals\"))\r\n\t\t{\r\n\t\t\t// Create webcimesModals\r\n\t\t\tdocument.body.insertAdjacentHTML(\"beforeend\", '<div class=\"webcimesModals animFadeIn\"></div>');\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\t\t\t\r\n\t\t\t// Set animation duration for webcimesModals\r\n\t\t\tthis.webcimesModals.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\r\n\t\t\t// Delete enter animation after animation delay\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.webcimesModals.classList.remove(\"animFadeIn\");\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// Get webcimesModals\r\n\t\t\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\r\n\r\n\t\t\t// Remove animFadeOut in case of create new modal after destroy the last one before (during animation duration)\r\n\t\t\tthis.webcimesModals.classList.remove(\"animFadeOut\");\r\n\t\t}\r\n\t\r\n\t\t// Create modal\r\n\t\tthis.webcimesModals.insertAdjacentHTML(\"beforeend\", \r\n\t\t\t`<div class=\"modal `+(this.options.setClass?this.options.setClass:'')+` `+this.options.animationOnShow+`\" `+(this.options.setId?'id=\"'+this.options.setId+'\"':'')+`>\r\n\t\t\t\t`+(this.options.titleHtml||this.options.showCloseButton?\r\n\t\t\t\t\t`<div class=\"modalHeader `+(this.options.stickyHeader?'sticky':'')+` `+(this.options.moveFromHeader?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.titleHtml?'<div class=\"title\">'+this.options.titleHtml+'</div>':'')+`\r\n\t\t\t\t\t\t`+(this.options.showCloseButton?'<button class=\"close\"></button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.bodyHtml?\r\n\t\t\t\t\t`<div class=\"modalBody `+(this.options.moveFromBody?'movable':'')+`\">\r\n\t\t\t\t\t\t`+this.options.bodyHtml+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t\t`+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?\r\n\t\t\t\t\t`<div class=\"modalFooter `+(this.options.stickyFooter?'sticky':'')+` `+(this.options.moveFromFooter?'movable':'')+`\">\r\n\t\t\t\t\t\t`+(this.options.buttonCancelHtml?'<button class=\"cancel '+(this.options.closeOnCancelButton?'close':'')+'\">'+this.options.buttonCancelHtml+'</button>':'')+`\r\n\t\t\t\t\t\t`+(this.options.buttonConfirmHtml?'<button class=\"confirm '+(this.options.closeOnConfirmButton?'close':'')+'\">'+this.options.buttonConfirmHtml+'</button>':'')+`\r\n\t\t\t\t\t</div>`\r\n\t\t\t\t:'')+`\r\n\t\t\t</div>`\r\n\t\t);\r\n\t\tthis.modal = <HTMLElement>this.webcimesModals.lastElementChild;\r\n\t\t\r\n\t\t// Callback before show modal (set a timeout of zero, to wait for some dom to load)\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeShow\"));\r\n\t\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}\r\n\t\t}, 0);\r\n\t\t\r\n\t\t// Set animation duration for modal\r\n\t\tthis.modal.style.setProperty(\"animation-duration\", this.options.animationDuration+\"ms\");\r\n\t\t\r\n\t\t// Delete animation of enter after the animation delay\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.modal.classList.remove(this.options.animationOnShow);\r\n\t\r\n\t\t\t// Callback after show modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterShow\"));\r\n\t\t\tif(typeof this.options.afterShow === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.afterShow();\r\n\t\t\t}\r\n\t\t}, this.options.animationDuration);\r\n\t\r\n\t\t// Width of modal\r\n\t\tthis.modal.style.setProperty(\"max-width\", \"90%\");\r\n\t\tif(this.options.width != \"auto\" && this.options.width)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"width\", this.options.width);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-width\r\n\t\t\tthis.modal.style.setProperty(\"width\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Height of modal\r\n\t\tthis.modal.style.setProperty(\"max-height\", \"90%\");\r\n\t\tif(this.options.height != \"auto\" && this.options.height)\r\n\t\t{\r\n\t\t\tthis.modal.style.setProperty(\"height\", this.options.height);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t// \"max-content\" is for keep size in \"auto\" and for maximum to max-height\r\n\t\t\tthis.modal.style.setProperty(\"height\", \"max-content\");\r\n\t\t}\r\n\t\r\n\t\t// Style\r\n\t\tif(this.options.style)\r\n\t\t{\r\n\t\t\tlet oldStyle = this.modal.getAttribute(\"style\");\r\n\t\t\tthis.modal.setAttribute(\"style\", oldStyle+this.options.style);\r\n\t\t}\r\n\t\r\n\t\t// Event on cancel button\r\n\t\tif(this.options.buttonCancelHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".cancel\")?.addEventListener(\"click\", this.eventCancelButton);\r\n\t\t}\r\n\t\r\n\t\t// Event on confirm button\r\n\t\tif(this.options.buttonConfirmHtml)\r\n\t\t{\r\n\t\t\tthis.modal.querySelector(\".confirm\")?.addEventListener(\"click\", this.eventConfirmButton);\r\n\t\t}\r\n\t\t\r\n\t\t// Event click outside (on webcimesModals)\r\n\t\tthis.webcimesModals.addEventListener(\"click\", this.eventClickOutside);\r\n\t\r\n\t\t// Event close modal when click on close button\r\n\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\tel.addEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t});\r\n\t\r\n\t\t// Place selected modal on top\r\n\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\tthis.modal.addEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t});\r\n\t\t\r\n\t\t// Move modal\r\n\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t{\r\n\t\t\tif(this.options.moveFromHeader && this.modal.querySelector(\".modalHeader\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalHeader\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromBody && this.modal.querySelector(\".modalBody\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalBody\"));\r\n\t\t\t}\r\n\t\t\tif(this.options.moveFromFooter && this.modal.querySelector(\".modalFooter\"))\r\n\t\t\t{\r\n\t\t\t\tthis.moveFromElements.push(<HTMLElement>this.modal.querySelector(\".modalFooter\"));\r\n\t\t\t}\r\n\t\r\n\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\tel.addEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventMove);\r\n\t\t\t});\r\n\r\n\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\tdocument.addEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t});\r\n\r\n\t\t\tdocument.addEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t}\r\n\r\n\t\t// When resizing window, reset modal position to center\r\n\t\twindow.addEventListener(\"resize\", this.eventResize);\r\n }\r\n\r\n\t/**\r\n\t * Destroy current modal\r\n\t */\r\n\tpublic destroy()\r\n\t{\r\n\t\t// If modal is not already destroying\r\n\t\tif(!this.modal.getAttribute(\"data-destroying\"))\r\n\t\t{\r\n\t\t\t// Callback before destroy modal\r\n\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"beforeDestroy\"));\r\n\t\t\tif(typeof this.options.beforeDestroy === 'function')\r\n\t\t\t{\r\n\t\t\t\tthis.options.beforeDestroy();\r\n\t\t\t}\r\n\r\n\t\t\t// Close webcimesModals (according the number of modal not already destroying)\r\n\t\t\tif(document.querySelectorAll(\".modal:not([data-destroying])\").length == 1)\r\n\t\t\t{\r\n\t\t\t\tthis.webcimesModals.classList.add(\"animFadeOut\");\r\n\t\t\t}\r\n\r\n\t\t\t// Close modal\r\n\t\t\tthis.modal.setAttribute(\"data-destroying\", \"1\");\r\n\t\t\tthis.modal.classList.add(this.options.animationOnDestroy);\r\n\r\n\t\t\t// Destroy all events from modal and remove webcimesModals or modal after animation duration\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tif(typeof this.modal !== 'undefined')\r\n\t\t\t\t{\r\n\t\t\t\t\t// Destroy all events from modal\r\n\r\n\t\t\t\t\tif(this.options.buttonCancelHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".cancel\")?.removeEventListener(\"click\", this.eventCancelButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(this.options.buttonConfirmHtml)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.modal.querySelector(\".confirm\")?.removeEventListener(\"click\", this.eventConfirmButton);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.webcimesModals.removeEventListener(\"click\", this.eventClickOutside);\r\n\r\n\t\t\t\t\tthis.modal.querySelectorAll(\".close\").forEach((el) => {\r\n\t\t\t\t\t\tel.removeEventListener(\"click\", this.eventClickCloseButton);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\tthis.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tif(this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t['mousedown', 'touchstart'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tthis.moveFromElements.forEach((el) => {\r\n\t\t\t\t\t\t\t\tel.removeEventListener(typeEvent, this.eventDragStart);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mousemove', 'touchmove'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventMove);\r\n\t\t\t\t\t\t});\r\n\t\t\t\r\n\t\t\t\t\t\t['mouseup', 'touchend'].forEach((typeEvent) => {\r\n\t\t\t\t\t\t\tdocument.removeEventListener(typeEvent, this.eventDragStop);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdocument.removeEventListener(\"selectstart\", this.eventPreventSelectText);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\twindow.removeEventListener(\"resize\", this.eventResize);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Remove webcimesModals or modal according the number of modal\r\n\t\t\t\t\t(document.querySelectorAll(\".modal\").length>1?this.modal:this.webcimesModals).remove();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Callback after destroy modal\r\n\t\t\t\tthis.modal.dispatchEvent(new CustomEvent(\"afterDestroy\"));\r\n\t\t\t\tif(typeof this.options.afterDestroy === 'function')\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.options.afterDestroy();\r\n\t\t\t\t}\r\n\t\t\t}, this.options.animationDuration);\r\n\t\t}\r\n\t}\r\n}"],"names":["root","factory","exports","module","define","amd","a","i","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","WebcimesModal","webcimesModals","modal","options","eventCancelButton","this","dispatchEvent","CustomEvent","onCancelButton","eventConfirmButton","onConfirmButton","eventClickOutside","e","target","allowCloseOutside","destroy","classList","add","setTimeout","remove","animationDuration","eventClickCloseButton","eventDragModalOnTop","closest","document","querySelectorAll","length","nextElementSibling","oldScrollTop","scrollTop","insertAdjacentElement","position","offset","isDragging","moveFromElements","eventDragStart","clientX","x","offsetLeft","y","offsetTop","clientY","touches","eventMove","style","left","top","eventDragStop","eventPreventSelectText","preventDefault","eventResize","removeProperty","constructor","setId","setClass","width","height","titleHtml","bodyHtml","buttonCancelHtml","buttonConfirmHtml","closeOnCancelButton","closeOnConfirmButton","showCloseButton","allowMovement","moveFromHeader","moveFromBody","moveFromFooter","stickyHeader","stickyFooter","animationOnShow","animationOnDestroy","beforeShow","afterShow","beforeDestroy","afterDestroy","init","querySelector","body","insertAdjacentHTML","setProperty","lastElementChild","oldStyle","getAttribute","setAttribute","addEventListener","forEach","el","typeEvent","push","window","removeEventListener"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcimes-modal",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Simply create and animate modals. It works with vanilla javascript + html + css.",
|
|
5
5
|
"main": "./dist/js/webcimes-modal.udm.js",
|
|
6
6
|
"module": "./dist/js/webcimes-modal.esm.js",
|
|
@@ -31,12 +31,11 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"css-loader": "^6.8.1",
|
|
33
33
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
34
|
+
"filemanager-webpack-plugin": "^8.0.0",
|
|
34
35
|
"mini-css-extract-plugin": "^2.7.6",
|
|
35
|
-
"remove-files-webpack-plugin": "^1.5.0",
|
|
36
36
|
"ts-loader": "^9.4.4",
|
|
37
37
|
"ts-node": "^10.9.1",
|
|
38
38
|
"typescript": "^5.2.2",
|
|
39
|
-
"typescript-declaration-webpack-plugin": "^0.3.0",
|
|
40
39
|
"webpack": "^5.88.2",
|
|
41
40
|
"webpack-cli": "^5.1.4"
|
|
42
41
|
}
|
|
File without changes
|
package/src/images/times.svg
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/ts/webcimes-modal.ts
CHANGED
package/test/script.js
CHANGED
|
File without changes
|
package/test/test.html
CHANGED
|
@@ -7,13 +7,6 @@
|
|
|
7
7
|
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
8
8
|
<title>Demo webcimes-modal ESM</title>
|
|
9
9
|
<link rel="stylesheet" href="../dist/css/webcimes-modal.css">
|
|
10
|
-
<script type="importmap">
|
|
11
|
-
{
|
|
12
|
-
"imports": {
|
|
13
|
-
"webcimes-modal": "../dist/js/webcimes-modal.esm.js"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
10
|
<script type="module" src="script.js"></script>
|
|
18
11
|
</head>
|
|
19
12
|
<body>
|
package/tsconfig.json
CHANGED
|
File without changes
|
package/webpack.config.ts
CHANGED
|
@@ -3,8 +3,7 @@ import webpack from "webpack";
|
|
|
3
3
|
import TerserPlugin from "terser-webpack-plugin";
|
|
4
4
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
5
5
|
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
6
|
-
import
|
|
7
|
-
import TypescriptDeclarationPlugin from "typescript-declaration-webpack-plugin";
|
|
6
|
+
import FileManagerPlugin from "filemanager-webpack-plugin";
|
|
8
7
|
// const isProduction = process.env.NODE_ENV == "production";
|
|
9
8
|
|
|
10
9
|
// Config UDM
|
|
@@ -38,10 +37,20 @@ const configUDM: webpack.Configuration = {
|
|
|
38
37
|
],
|
|
39
38
|
},
|
|
40
39
|
plugins: [
|
|
41
|
-
new
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
new FileManagerPlugin({
|
|
41
|
+
events: {
|
|
42
|
+
onStart: {
|
|
43
|
+
delete: [
|
|
44
|
+
"./dist/js",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
onEnd: {
|
|
48
|
+
copy: [
|
|
49
|
+
{ source: "./src/ts/webcimes-modal.d.ts", destination: './dist/js/webcimes-modal.udm.d.ts' },
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
},
|
|
45
54
|
}),
|
|
46
55
|
],
|
|
47
56
|
};
|
|
@@ -80,10 +89,20 @@ const configESM: webpack.Configuration = {
|
|
|
80
89
|
],
|
|
81
90
|
},
|
|
82
91
|
plugins: [
|
|
83
|
-
new
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
new FileManagerPlugin({
|
|
93
|
+
events: {
|
|
94
|
+
onStart: {
|
|
95
|
+
delete: [
|
|
96
|
+
"./dist/js",
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
onEnd: {
|
|
100
|
+
copy: [
|
|
101
|
+
{ source: "./src/ts/webcimes-modal.d.ts", destination: './dist/js/webcimes-modal.esm.d.ts' },
|
|
102
|
+
],
|
|
103
|
+
|
|
104
|
+
},
|
|
105
|
+
},
|
|
87
106
|
}),
|
|
88
107
|
],
|
|
89
108
|
};
|
|
@@ -126,22 +145,20 @@ const configCSS: webpack.Configuration = {
|
|
|
126
145
|
},
|
|
127
146
|
plugins: [
|
|
128
147
|
new MiniCssExtractPlugin({filename: "css/[name].css"}),
|
|
129
|
-
new
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
148
|
+
new FileManagerPlugin({
|
|
149
|
+
events: {
|
|
150
|
+
onStart: {
|
|
151
|
+
delete: [
|
|
152
|
+
"./dist/css",
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
onEnd: {
|
|
156
|
+
delete: [
|
|
157
|
+
"./dist/css/webcimes-modal.js",
|
|
158
|
+
"./dist/css/webcimes-modal.js.map",
|
|
159
|
+
],
|
|
160
|
+
}
|
|
134
161
|
},
|
|
135
|
-
after: {
|
|
136
|
-
test: [
|
|
137
|
-
{
|
|
138
|
-
folder: './dist/css',
|
|
139
|
-
method: (absoluteItemPath) => {
|
|
140
|
-
return new RegExp(/(\.js|\.js\.map)$/, 'm').test(absoluteItemPath); // Delete extra empty js file (can't ouput directly css)
|
|
141
|
-
},
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
}
|
|
145
162
|
}),
|
|
146
163
|
],
|
|
147
164
|
};
|