webcimes-modal 1.0.2 → 1.1.1

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.
@@ -0,0 +1,421 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else {
7
+ var a = factory();
8
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
+ }
10
+ })(self, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ // The require scope
14
+ /******/ var __webpack_require__ = {};
15
+ /******/
16
+ /************************************************************************/
17
+ /******/ /* webpack/runtime/define property getters */
18
+ /******/ (() => {
19
+ /******/ // define getter functions for harmony exports
20
+ /******/ __webpack_require__.d = (exports, definition) => {
21
+ /******/ for(var key in definition) {
22
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
23
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
24
+ /******/ }
25
+ /******/ }
26
+ /******/ };
27
+ /******/ })();
28
+ /******/
29
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
30
+ /******/ (() => {
31
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
32
+ /******/ })();
33
+ /******/
34
+ /******/ /* webpack/runtime/make namespace object */
35
+ /******/ (() => {
36
+ /******/ // define __esModule on exports
37
+ /******/ __webpack_require__.r = (exports) => {
38
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
39
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
40
+ /******/ }
41
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
42
+ /******/ };
43
+ /******/ })();
44
+ /******/
45
+ /************************************************************************/
46
+ var __webpack_exports__ = {};
47
+ __webpack_require__.r(__webpack_exports__);
48
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
49
+ /* harmony export */ WebcimesModal: () => (/* binding */ WebcimesModal)
50
+ /* harmony export */ });
51
+ /**
52
+ * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)
53
+ * MIT License - https://choosealicense.com/licenses/mit/
54
+ * Date: 2023-03-25
55
+ */
56
+
57
+ /**
58
+ * Class WebcimesModal
59
+ */
60
+ class WebcimesModal {
61
+ webcimesModals;
62
+ modal;
63
+ options;
64
+ eventCancelButton = () => {
65
+ // Callback on cancel button
66
+ if (typeof this.options.onCancelButton === 'function') {
67
+ this.options.onCancelButton();
68
+ }
69
+ };
70
+ eventConfirmButton = () => {
71
+ // Callback on confirm button
72
+ if (typeof this.options.onConfirmButton === 'function') {
73
+ this.options.onConfirmButton();
74
+ }
75
+ };
76
+ eventClickOutside = (e) => {
77
+ if (e.target == this.webcimesModals) {
78
+ if (this.options.allowCloseOutside) {
79
+ // Destroy modal
80
+ this.destroy();
81
+ }
82
+ else {
83
+ // Add animation for show modal who can't be close
84
+ this.modal.classList.add("animGrowShrink");
85
+ // Delete animation after the animation delay
86
+ setTimeout(() => {
87
+ this.modal.classList.remove("animGrowShrink");
88
+ }, this.options.animationDuration);
89
+ }
90
+ }
91
+ };
92
+ eventClickCloseButton = () => {
93
+ // Destroy modal
94
+ this.destroy();
95
+ };
96
+ eventDragModalOnTop = (e) => {
97
+ // Only if target is not close button (for bug in chrome)
98
+ if (!e.target.closest(".close")) {
99
+ // If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top
100
+ if (document.querySelectorAll(".modal").length > 1 && this.modal.nextElementSibling !== null) {
101
+ let oldScrollTop = this.modal.scrollTop;
102
+ this.webcimesModals.insertAdjacentElement("beforeend", this.modal);
103
+ this.modal.scrollTop = oldScrollTop;
104
+ }
105
+ }
106
+ };
107
+ position;
108
+ offset;
109
+ isDragging = false;
110
+ moveFromElements = [];
111
+ eventDragStart = (e) => {
112
+ // Start drag only if it's not a button
113
+ if (!e.target.closest("button")) {
114
+ this.isDragging = true;
115
+ // Mouse
116
+ if (e.clientX) {
117
+ this.offset = {
118
+ x: this.modal.offsetLeft - e.clientX,
119
+ y: this.modal.offsetTop - e.clientY
120
+ };
121
+ }
122
+ // Touch device (use the first touch only)
123
+ else if (e.touches) {
124
+ this.offset = {
125
+ x: this.modal.offsetLeft - e.touches[0].clientX,
126
+ y: this.modal.offsetTop - e.touches[0].clientY
127
+ };
128
+ }
129
+ }
130
+ };
131
+ eventMove = (e) => {
132
+ if (this.isDragging) {
133
+ // Mouse
134
+ if (e.clientX) {
135
+ this.position = {
136
+ x: e.clientX,
137
+ y: e.clientY
138
+ };
139
+ }
140
+ // Touch device (use the first touch only)
141
+ else if (e.touches) {
142
+ this.position = {
143
+ x: e.touches[0].clientX,
144
+ y: e.touches[0].clientY
145
+ };
146
+ }
147
+ this.modal.style.left = (this.position.x + this.offset.x) + 'px';
148
+ this.modal.style.top = (this.position.y + this.offset.y) + 'px';
149
+ }
150
+ };
151
+ eventDragStop = () => {
152
+ this.isDragging = false;
153
+ };
154
+ eventPreventSelectText = (e) => {
155
+ if (this.isDragging) {
156
+ e.preventDefault();
157
+ }
158
+ };
159
+ eventResize = () => {
160
+ this.modal.style.removeProperty("left");
161
+ this.modal.style.removeProperty("top");
162
+ };
163
+ /**
164
+ * Create modal
165
+ * @param {Object} options
166
+ * @param {string | null} options.setId - set a specific id on the modal. default "null"
167
+ * @param {string | null} options.setClass - set a specific class on the modal, default "null"
168
+ * @param {string} options.width - width (specify unit), default "auto"
169
+ * @param {string} options.height - height (specify unit), default "auto"
170
+ * @param {string | null} options.titleHtml - html for title, default "null"
171
+ * @param {string | null} options.bodyHtml - html for body, default "null"
172
+ * @param {string | null} options.buttonCancelHtml - html for cancel button, default "null"
173
+ * @param {string | null} options.buttonConfirmHtml - html for confirm button, default "null"
174
+ * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default "true"
175
+ * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default "true"
176
+ * @param {boolean} options.showCloseButton - show close button, default "true"
177
+ * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default "true"
178
+ * @param {boolean} options.allowMovement - ability to move modal, default "true"
179
+ * @param {boolean} options.moveFromHeader - if allowMovement is set to "true", ability to move modal from header, default "true"
180
+ * @param {boolean} options.moveFromBody - if allowMovement is set to "true", ability to move modal from body, default "false"
181
+ * @param {boolean} options.moveFromFooter - if allowMovement is set to "true", ability to move modal from footer, default "true"
182
+ * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default "true"
183
+ * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default "true"
184
+ * @param {string | null} options.style - add extra css style to modal, default null
185
+ * @param {"animDropDown" | "animFadeIn"} options.animationOnShow - "animDropDown" or "animFadeIn" for show animation, default "animDropDown"
186
+ * @param {"animDropUp" | "animFadeOut"} options.animationOnDestroy - "animDropUp" or "animFadeOut" for destroy animation, default "animDropUp"
187
+ * @param {number} options.animationDuration - animation duration in ms, default "500"
188
+ * @param {() => void} options.beforeShow - callback before show modal
189
+ * @param {() => void} options.afterShow - callback after show modal
190
+ * @param {() => void} options.beforeDestroy - callback before destroy modal
191
+ * @param {() => void} options.afterDestroy - callback after destroy modal
192
+ * @param {() => void} options.onCancelButton - callback after triggering cancel button
193
+ * @param {() => void} options.onConfirmButton - callback after triggering confirm button
194
+ */
195
+ constructor(options) {
196
+ // Defaults
197
+ const defaults = {
198
+ setId: null,
199
+ setClass: null,
200
+ width: 'auto',
201
+ height: 'auto',
202
+ titleHtml: null,
203
+ bodyHtml: null,
204
+ buttonCancelHtml: null,
205
+ buttonConfirmHtml: null,
206
+ closeOnCancelButton: true,
207
+ closeOnConfirmButton: true,
208
+ showCloseButton: true,
209
+ allowCloseOutside: true,
210
+ allowMovement: true,
211
+ moveFromHeader: true,
212
+ moveFromBody: false,
213
+ moveFromFooter: true,
214
+ stickyHeader: true,
215
+ stickyFooter: true,
216
+ style: null,
217
+ animationOnShow: 'animDropDown',
218
+ animationOnDestroy: 'animDropUp',
219
+ animationDuration: 500,
220
+ beforeShow: () => { },
221
+ afterShow: () => { },
222
+ beforeDestroy: () => { },
223
+ afterDestroy: () => { },
224
+ onCancelButton: () => { },
225
+ onConfirmButton: () => { },
226
+ };
227
+ this.options = { ...defaults, ...options };
228
+ // Call init method
229
+ this.init();
230
+ }
231
+ /**
232
+ * Init modal
233
+ */
234
+ init() {
235
+ // Create webcimesModals
236
+ if (!document.querySelector(".webcimesModals")) {
237
+ // Create webcimesModals
238
+ document.body.insertAdjacentHTML("beforeend", '<div class="webcimesModals animFadeIn"></div>');
239
+ this.webcimesModals = document.querySelector(".webcimesModals");
240
+ // Set animation duration for webcimesModals
241
+ this.webcimesModals.style.setProperty("animation-duration", this.options.animationDuration + "ms");
242
+ // Delete enter animation after animation delay
243
+ setTimeout(() => {
244
+ this.webcimesModals.classList.remove("animFadeIn");
245
+ }, this.options.animationDuration);
246
+ }
247
+ else {
248
+ this.webcimesModals = document.querySelector(".webcimesModals");
249
+ }
250
+ // Create modal
251
+ this.webcimesModals.insertAdjacentHTML("beforeend", `<div class="modal ` + (this.options.setClass ? this.options.setClass : '') + ` ` + this.options.animationOnShow + `" ` + (this.options.setId ? 'id="' + this.options.setId + '"' : '') + `>
252
+ ` + (this.options.titleHtml || this.options.showCloseButton ?
253
+ `<div class="modalHeader ` + (this.options.stickyHeader ? 'sticky' : '') + ` ` + (this.options.moveFromHeader ? 'movable' : '') + `">
254
+ ` + (this.options.titleHtml ? '<div class="title">' + this.options.titleHtml + '</div>' : '') + `
255
+ ` + (this.options.showCloseButton ? '<button class="close"></button>' : '') + `
256
+ </div>`
257
+ : '') + `
258
+ ` + (this.options.bodyHtml ?
259
+ `<div class="modalBody ` + (this.options.moveFromBody ? 'movable' : '') + `">
260
+ ` + this.options.bodyHtml + `
261
+ </div>`
262
+ : '') + `
263
+ ` + (this.options.buttonCancelHtml || this.options.buttonConfirmHtml ?
264
+ `<div class="modalFooter ` + (this.options.stickyFooter ? 'sticky' : '') + ` ` + (this.options.moveFromFooter ? 'movable' : '') + `">
265
+ ` + (this.options.buttonCancelHtml ? '<button class="cancel ' + (this.options.closeOnCancelButton ? 'close' : '') + '">' + this.options.buttonCancelHtml + '</button>' : '') + `
266
+ ` + (this.options.buttonConfirmHtml ? '<button class="confirm ' + (this.options.closeOnConfirmButton ? 'close' : '') + '">' + this.options.buttonConfirmHtml + '</button>' : '') + `
267
+ </div>`
268
+ : '') + `
269
+ </div>`);
270
+ this.modal = this.webcimesModals.lastElementChild;
271
+ // Callback before show modal
272
+ if (typeof this.options.beforeShow === 'function') {
273
+ // Set a timeout of zero, to wait for some dom to load
274
+ setTimeout(() => {
275
+ this.options.beforeShow();
276
+ }, 0);
277
+ }
278
+ // Set animation duration for modal
279
+ this.modal.style.setProperty("animation-duration", this.options.animationDuration + "ms");
280
+ // Delete animation of enter after the animation delay
281
+ setTimeout(() => {
282
+ this.modal.classList.remove(this.options.animationOnShow);
283
+ // Callback after show modal
284
+ if (typeof this.options.afterShow === 'function') {
285
+ this.options.afterShow();
286
+ }
287
+ }, this.options.animationDuration);
288
+ // Width of modal
289
+ this.modal.style.setProperty("max-width", "90%");
290
+ if (this.options.width != "auto" && this.options.width) {
291
+ this.modal.style.setProperty("width", this.options.width);
292
+ }
293
+ else {
294
+ // "max-content" is for keep size in "auto" and for maximum to max-width
295
+ this.modal.style.setProperty("width", "max-content");
296
+ }
297
+ // Height of modal
298
+ this.modal.style.setProperty("max-height", "90%");
299
+ if (this.options.height != "auto" && this.options.height) {
300
+ this.modal.style.setProperty("height", this.options.height);
301
+ }
302
+ else {
303
+ // "max-content" is for keep size in "auto" and for maximum to max-height
304
+ this.modal.style.setProperty("height", "max-content");
305
+ }
306
+ // Style
307
+ if (this.options.style) {
308
+ let oldStyle = this.modal.getAttribute("style");
309
+ this.modal.setAttribute("style", oldStyle + this.options.style);
310
+ }
311
+ // Event on cancel button
312
+ if (this.options.buttonCancelHtml) {
313
+ this.modal.querySelector(".cancel")?.addEventListener("click", this.eventCancelButton);
314
+ }
315
+ // Event on confirm button
316
+ if (this.options.buttonConfirmHtml) {
317
+ this.modal.querySelector(".confirm")?.addEventListener("click", this.eventConfirmButton);
318
+ }
319
+ // Event click outside (on webcimesModals)
320
+ this.webcimesModals.addEventListener("click", this.eventClickOutside);
321
+ // Event close modal when click on close button
322
+ this.modal.querySelectorAll(".close").forEach((el) => {
323
+ el.addEventListener("click", this.eventClickCloseButton);
324
+ });
325
+ // Place selected modal on top
326
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
327
+ this.modal.addEventListener(typeEvent, this.eventDragModalOnTop);
328
+ });
329
+ // Move modal
330
+ if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
331
+ if (this.options.moveFromHeader && this.modal.querySelector(".modalHeader")) {
332
+ this.moveFromElements.push(this.modal.querySelector(".modalHeader"));
333
+ }
334
+ if (this.options.moveFromBody && this.modal.querySelector(".modalBody")) {
335
+ this.moveFromElements.push(this.modal.querySelector(".modalBody"));
336
+ }
337
+ if (this.options.moveFromFooter && this.modal.querySelector(".modalFooter")) {
338
+ this.moveFromElements.push(this.modal.querySelector(".modalFooter"));
339
+ }
340
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
341
+ this.moveFromElements.forEach((el) => {
342
+ el.addEventListener(typeEvent, this.eventDragStart);
343
+ });
344
+ });
345
+ ['mousemove', 'touchmove'].forEach((typeEvent) => {
346
+ document.addEventListener(typeEvent, this.eventMove);
347
+ });
348
+ ['mouseup', 'touchend'].forEach((typeEvent) => {
349
+ document.addEventListener(typeEvent, this.eventDragStop);
350
+ });
351
+ document.addEventListener("selectstart", this.eventPreventSelectText);
352
+ }
353
+ // When resizing window, reset modal position to center
354
+ window.addEventListener("resize", this.eventResize);
355
+ }
356
+ /**
357
+ * Destroy modal
358
+ */
359
+ destroy() {
360
+ // If modal is not already destroying
361
+ if (!this.modal.getAttribute("data-destroying")) {
362
+ // Callback before destroy modal
363
+ if (typeof this.options.beforeDestroy === 'function') {
364
+ this.options.beforeDestroy();
365
+ }
366
+ // Close webcimesModals (according the number of modal not already destroying)
367
+ if (document.querySelectorAll(".modal:not([data-destroying])").length == 1) {
368
+ this.webcimesModals.classList.add("animFadeOut");
369
+ }
370
+ // Close modal
371
+ this.modal.setAttribute("data-destroying", "1");
372
+ this.modal.classList.add(this.options.animationOnDestroy);
373
+ // Destroy all events from modal and remove webcimesModals or modal after animation duration
374
+ setTimeout(() => {
375
+ if (typeof this.modal !== 'undefined') {
376
+ // Destroy all events from modal
377
+ if (this.options.buttonCancelHtml) {
378
+ this.modal.querySelector(".cancel")?.removeEventListener("click", this.eventCancelButton);
379
+ }
380
+ if (this.options.buttonConfirmHtml) {
381
+ this.modal.querySelector(".confirm")?.removeEventListener("click", this.eventConfirmButton);
382
+ }
383
+ this.webcimesModals.removeEventListener("click", this.eventClickOutside);
384
+ this.modal.querySelectorAll(".close").forEach((el) => {
385
+ el.removeEventListener("click", this.eventClickCloseButton);
386
+ });
387
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
388
+ this.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);
389
+ });
390
+ if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
391
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
392
+ this.moveFromElements.forEach((el) => {
393
+ el.removeEventListener(typeEvent, this.eventDragStart);
394
+ });
395
+ });
396
+ ['mousemove', 'touchmove'].forEach((typeEvent) => {
397
+ document.removeEventListener(typeEvent, this.eventMove);
398
+ });
399
+ ['mouseup', 'touchend'].forEach((typeEvent) => {
400
+ document.removeEventListener(typeEvent, this.eventDragStop);
401
+ });
402
+ document.removeEventListener("selectstart", this.eventPreventSelectText);
403
+ }
404
+ window.removeEventListener("resize", this.eventResize);
405
+ // Remove webcimesModals or modal according the number of modal
406
+ (document.querySelectorAll(".modal").length > 1 ? this.modal : this.webcimesModals).remove();
407
+ }
408
+ // Callback after destroy modal
409
+ if (typeof this.options.afterDestroy === 'function') {
410
+ this.options.afterDestroy();
411
+ }
412
+ }, this.options.animationDuration);
413
+ }
414
+ }
415
+ }
416
+
417
+ /******/ return __webpack_exports__;
418
+ /******/ })()
419
+ ;
420
+ });
421
+ //# sourceMappingURL=webcimes-modal.udm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/udm/webcimes-modal.udm.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;UCVA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;ACNA;;;;GAIG;AAEU;AAgEb;;GAEG;AACI,MAAM,aAAa;IAElB,cAAc,CAAc;IAC5B,KAAK,CAAc;IAClB,OAAO,CAAU;IACjB,iBAAiB,GAAe,GAAG,EAAE;QAC5C,4BAA4B;QAC5B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,UAAU,EACpD;YACC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;SAC9B;IACF,CAAC,CAAC;IACM,kBAAkB,GAAe,GAAG,EAAE;QAC7C,6BAA6B;QAC7B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,KAAK,UAAU,EACrD;YACC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;SAC/B;IACF,CAAC,CAAC;IACM,iBAAiB,GAAuB,CAAC,CAAC,EAAE,EAAE;QACrD,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,EAClC;YACC,IAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EACjC;gBACC,gBAAgB;gBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;aACf;iBAED;gBACC,kDAAkD;gBAClD,IAAI,C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CAAC,CAAC;oBAEvD,+DAA+D;oBAC/D,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAC,CAAC,EAAC,KAAI,CAAC,KAAK,EAAC,KAAI,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;iBACvF;gBAED,+BAA+B;gBAC/B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,UAAU,EAClD;oBACC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;iBAC5B;YACF,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;SACnC;IACF,CAAC;CACD","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 * 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\tpublic webcimesModals: HTMLElement;\r\n\tpublic modal: HTMLElement;\r\n\tprivate options: Options;\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\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\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\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\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\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\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\tprivate position: {x: number, y: number};\r\n\tprivate offset: {x: number, y: number};\r\n\tprivate isDragging: boolean = false;\r\n\tprivate moveFromElements: HTMLElement[] = [];\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\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\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\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\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 * @param {Object} options\r\n\t * @param {string | null} options.setId - set a specific id on the modal. default \"null\" \r\n\t * @param {string | null} options.setClass - set a specific class on the modal, default \"null\"\r\n\t * @param {string} options.width - width (specify unit), default \"auto\"\r\n\t * @param {string} options.height - height (specify unit), default \"auto\"\r\n\t * @param {string | null} options.titleHtml - html for title, default \"null\"\r\n\t * @param {string | null} options.bodyHtml - html for body, default \"null\"\r\n\t * @param {string | null} options.buttonCancelHtml - html for cancel button, default \"null\"\r\n\t * @param {string | null} options.buttonConfirmHtml - html for confirm button, default \"null\"\r\n\t * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default \"true\"\r\n\t * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default \"true\"\r\n\t * @param {boolean} options.showCloseButton - show close button, default \"true\"\r\n\t * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default \"true\"\r\n\t * @param {boolean} options.allowMovement - ability to move modal, default \"true\"\r\n\t * @param {boolean} options.moveFromHeader - if allowMovement is set to \"true\", ability to move modal from header, default \"true\"\r\n\t * @param {boolean} options.moveFromBody - if allowMovement is set to \"true\", ability to move modal from body, default \"false\"\r\n\t * @param {boolean} options.moveFromFooter - if allowMovement is set to \"true\", ability to move modal from footer, default \"true\"\r\n\t * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default \"true\"\r\n\t * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default \"true\"\r\n\t * @param {string | null} options.style - add extra css style to modal, default null\r\n\t * @param {\"animDropDown\" | \"animFadeIn\"} options.animationOnShow - \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\"\r\n\t * @param {\"animDropUp\" | \"animFadeOut\"} options.animationOnDestroy - \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\"\r\n\t * @param {number} options.animationDuration - animation duration in ms, default \"500\"\r\n\t * @param {() => void} options.beforeShow - callback before show modal\r\n\t * @param {() => void} options.afterShow - callback after show modal\r\n\t * @param {() => void} options.beforeDestroy - callback before destroy modal\r\n\t * @param {() => void} options.afterDestroy - callback after destroy modal\r\n\t * @param {() => void} options.onCancelButton - callback after triggering cancel button\r\n\t * @param {() => void} options.onConfirmButton - callback after triggering confirm button\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 * Init modal\r\n\t */\r\n 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\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\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\r\n\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t{\r\n\t\t\t// Set a timeout of zero, to wait for some dom to load\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}, 0);\r\n\t\t}\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\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 modal\r\n\t */\r\n\tdestroy()\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\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\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":[],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ !function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var e=o();for(var s in e)("object"==typeof exports?exports:t)[s]=e[s]}}(self,(()=>(()=>{"use strict";var t={d:(o,e)=>{for(var s in e)t.o(e,s)&&!t.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:e[s]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};t.r(o),t.d(o,{WebcimesModal:()=>e});class e{webcimesModals;modal;options;eventCancelButton=()=>{"function"==typeof this.options.onCancelButton&&this.options.onCancelButton()};eventConfirmButton=()=>{"function"==typeof this.options.onConfirmButton&&this.options.onConfirmButton()};eventClickOutside=t=>{t.target==this.webcimesModals&&(this.options.allowCloseOutside?this.destroy():(this.modal.classList.add("animGrowShrink"),setTimeout((()=>{this.modal.classList.remove("animGrowShrink")}),this.options.animationDuration)))};eventClickCloseButton=()=>{this.destroy()};eventDragModalOnTop=t=>{if(!t.target.closest(".close")&&document.querySelectorAll(".modal").length>1&&null!==this.modal.nextElementSibling){let t=this.modal.scrollTop;this.webcimesModals.insertAdjacentElement("beforeend",this.modal),this.modal.scrollTop=t}};position;offset;isDragging=!1;moveFromElements=[];eventDragStart=t=>{t.target.closest("button")||(this.isDragging=!0,t.clientX?this.offset={x:this.modal.offsetLeft-t.clientX,y:this.modal.offsetTop-t.clientY}:t.touches&&(this.offset={x:this.modal.offsetLeft-t.touches[0].clientX,y:this.modal.offsetTop-t.touches[0].clientY}))};eventMove=t=>{this.isDragging&&(t.clientX?this.position={x:t.clientX,y:t.clientY}:t.touches&&(this.position={x:t.touches[0].clientX,y:t.touches[0].clientY}),this.modal.style.left=this.position.x+this.offset.x+"px",this.modal.style.top=this.position.y+this.offset.y+"px")};eventDragStop=()=>{this.isDragging=!1};eventPreventSelectText=t=>{this.isDragging&&t.preventDefault()};eventResize=()=>{this.modal.style.removeProperty("left"),this.modal.style.removeProperty("top")};constructor(t){this.options={setId:null,setClass:null,width:"auto",height:"auto",titleHtml:null,bodyHtml:null,buttonCancelHtml:null,buttonConfirmHtml:null,closeOnCancelButton:!0,closeOnConfirmButton:!0,showCloseButton:!0,allowCloseOutside:!0,allowMovement:!0,moveFromHeader:!0,moveFromBody:!1,moveFromFooter:!0,stickyHeader:!0,stickyFooter:!0,style:null,animationOnShow:"animDropDown",animationOnDestroy:"animDropUp",animationDuration:500,beforeShow:()=>{},afterShow:()=>{},beforeDestroy:()=>{},afterDestroy:()=>{},onCancelButton:()=>{},onConfirmButton:()=>{},...t},this.init()}init(){if(document.querySelector(".webcimesModals")?this.webcimesModals=document.querySelector(".webcimesModals"):(document.body.insertAdjacentHTML("beforeend",'<div class="webcimesModals animFadeIn"></div>'),this.webcimesModals=document.querySelector(".webcimesModals"),this.webcimesModals.style.setProperty("animation-duration",this.options.animationDuration+"ms"),setTimeout((()=>{this.webcimesModals.classList.remove("animFadeIn")}),this.options.animationDuration)),this.webcimesModals.insertAdjacentHTML("beforeend",'<div class="modal '+(this.options.setClass?this.options.setClass:"")+" "+this.options.animationOnShow+'" '+(this.options.setId?'id="'+this.options.setId+'"':"")+">\n\t\t\t\t"+(this.options.titleHtml||this.options.showCloseButton?'<div class="modalHeader '+(this.options.stickyHeader?"sticky":"")+" "+(this.options.moveFromHeader?"movable":"")+'">\n\t\t\t\t\t\t'+(this.options.titleHtml?'<div class="title">'+this.options.titleHtml+"</div>":"")+"\n\t\t\t\t\t\t"+(this.options.showCloseButton?'<button class="close"></button>':"")+"\n\t\t\t\t\t</div>":"")+"\n\t\t\t\t"+(this.options.bodyHtml?'<div class="modalBody '+(this.options.moveFromBody?"movable":"")+'">\n\t\t\t\t\t\t'+this.options.bodyHtml+"\n\t\t\t\t\t</div>":"")+"\n\t\t\t\t"+(this.options.buttonCancelHtml||this.options.buttonConfirmHtml?'<div class="modalFooter '+(this.options.stickyFooter?"sticky":"")+" "+(this.options.moveFromFooter?"movable":"")+'">\n\t\t\t\t\t\t'+(this.options.buttonCancelHtml?'<button class="cancel '+(this.options.closeOnCancelButton?"close":"")+'">'+this.options.buttonCancelHtml+"</button>":"")+"\n\t\t\t\t\t\t"+(this.options.buttonConfirmHtml?'<button class="confirm '+(this.options.closeOnConfirmButton?"close":"")+'">'+this.options.buttonConfirmHtml+"</button>":"")+"\n\t\t\t\t\t</div>":"")+"\n\t\t\t</div>"),this.modal=this.webcimesModals.lastElementChild,"function"==typeof this.options.beforeShow&&setTimeout((()=>{this.options.beforeShow()}),0),this.modal.style.setProperty("animation-duration",this.options.animationDuration+"ms"),setTimeout((()=>{this.modal.classList.remove(this.options.animationOnShow),"function"==typeof this.options.afterShow&&this.options.afterShow()}),this.options.animationDuration),this.modal.style.setProperty("max-width","90%"),"auto"!=this.options.width&&this.options.width?this.modal.style.setProperty("width",this.options.width):this.modal.style.setProperty("width","max-content"),this.modal.style.setProperty("max-height","90%"),"auto"!=this.options.height&&this.options.height?this.modal.style.setProperty("height",this.options.height):this.modal.style.setProperty("height","max-content"),this.options.style){let t=this.modal.getAttribute("style");this.modal.setAttribute("style",t+this.options.style)}this.options.buttonCancelHtml&&this.modal.querySelector(".cancel")?.addEventListener("click",this.eventCancelButton),this.options.buttonConfirmHtml&&this.modal.querySelector(".confirm")?.addEventListener("click",this.eventConfirmButton),this.webcimesModals.addEventListener("click",this.eventClickOutside),this.modal.querySelectorAll(".close").forEach((t=>{t.addEventListener("click",this.eventClickCloseButton)})),["mousedown","touchstart"].forEach((t=>{this.modal.addEventListener(t,this.eventDragModalOnTop)})),this.options.allowMovement&&(this.options.moveFromHeader||this.options.moveFromBody||this.options.moveFromFooter)&&(this.options.moveFromHeader&&this.modal.querySelector(".modalHeader")&&this.moveFromElements.push(this.modal.querySelector(".modalHeader")),this.options.moveFromBody&&this.modal.querySelector(".modalBody")&&this.moveFromElements.push(this.modal.querySelector(".modalBody")),this.options.moveFromFooter&&this.modal.querySelector(".modalFooter")&&this.moveFromElements.push(this.modal.querySelector(".modalFooter")),["mousedown","touchstart"].forEach((t=>{this.moveFromElements.forEach((o=>{o.addEventListener(t,this.eventDragStart)}))})),["mousemove","touchmove"].forEach((t=>{document.addEventListener(t,this.eventMove)})),["mouseup","touchend"].forEach((t=>{document.addEventListener(t,this.eventDragStop)})),document.addEventListener("selectstart",this.eventPreventSelectText)),window.addEventListener("resize",this.eventResize)}destroy(){this.modal.getAttribute("data-destroying")||("function"==typeof this.options.beforeDestroy&&this.options.beforeDestroy(),1==document.querySelectorAll(".modal:not([data-destroying])").length&&this.webcimesModals.classList.add("animFadeOut"),this.modal.setAttribute("data-destroying","1"),this.modal.classList.add(this.options.animationOnDestroy),setTimeout((()=>{void 0!==this.modal&&(this.options.buttonCancelHtml&&this.modal.querySelector(".cancel")?.removeEventListener("click",this.eventCancelButton),this.options.buttonConfirmHtml&&this.modal.querySelector(".confirm")?.removeEventListener("click",this.eventConfirmButton),this.webcimesModals.removeEventListener("click",this.eventClickOutside),this.modal.querySelectorAll(".close").forEach((t=>{t.removeEventListener("click",this.eventClickCloseButton)})),["mousedown","touchstart"].forEach((t=>{this.modal.removeEventListener(t,this.eventDragModalOnTop)})),this.options.allowMovement&&(this.options.moveFromHeader||this.options.moveFromBody||this.options.moveFromFooter)&&(["mousedown","touchstart"].forEach((t=>{this.moveFromElements.forEach((o=>{o.removeEventListener(t,this.eventDragStart)}))})),["mousemove","touchmove"].forEach((t=>{document.removeEventListener(t,this.eventMove)})),["mouseup","touchend"].forEach((t=>{document.removeEventListener(t,this.eventDragStop)})),document.removeEventListener("selectstart",this.eventPreventSelectText)),window.removeEventListener("resize",this.eventResize),(document.querySelectorAll(".modal").length>1?this.modal:this.webcimesModals).remove()),"function"==typeof this.options.afterDestroy&&this.options.afterDestroy()}),this.options.animationDuration))}}return o})()));
2
+ //# sourceMappingURL=webcimes-modal.udm.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/udm/webcimes-modal.udm.min.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,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBP,IACH,oBAAXoB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeZ,EAASoB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeZ,EAAS,aAAc,CAAEsB,OAAO,GAAO,G,yCCoEvD,MAAMC,EAELC,eACAC,MACCC,QACAC,kBAAgC,KAEG,mBAAhCC,KAAKF,QAAQG,gBAEtBD,KAAKF,QAAQG,gB,EAGPC,mBAAiC,KAEG,mBAAjCF,KAAKF,QAAQK,iBAEtBH,KAAKF,QAAQK,iB,EAGPC,kBAAyCC,IAC7CA,EAAEC,QAAUN,KAAKJ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jF,KAAKe,oBAAoB,IAGjEf,KAAKF,QAAQ2D,gBAAkBzD,KAAKF,QAAQ4D,gBAAkB1D,KAAKF,QAAQ6D,cAAgB3D,KAAKF,QAAQ8D,kBAE1G,CAAC,YAAa,cAAcmB,SAASE,IACpCjF,KAAK2B,iBAAiBoD,SAASC,IAC9BA,EAAGI,oBAAoBH,EAAWjF,KAAK4B,eAAe,GACrD,IAGH,CAAC,YAAa,aAAamD,SAASE,IACnChE,SAASmE,oBAAoBH,EAAWjF,KAAKoC,UAAU,IAGxD,CAAC,UAAW,YAAY2C,SAASE,IAChChE,SAASmE,oBAAoBH,EAAWjF,KAAKwC,cAAc,IAG5DvB,SAASmE,oBAAoB,cAAepF,KAAKyC,yBAGlD0C,OAAOC,oBAAoB,SAAUpF,KAAK2C,cAGzC1B,SAASC,iBAAiB,UAAUC,OAAO,EAAEnB,KAAKH,MAAMG,KAAKJ,gBAAgBgB,UAIvC,mBAA9BZ,KAAKF,QAAQsE,cAEtBpE,KAAKF,QAAQsE,c,GAEZpE,KAAKF,QAAQe,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 * 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\tpublic webcimesModals: HTMLElement;\r\n\tpublic modal: HTMLElement;\r\n\tprivate options: Options;\r\n\tprivate eventCancelButton: () => void = () => {\r\n\t\t// Callback on cancel button\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\tprivate eventConfirmButton: () => void = () => {\r\n\t\t// Callback on confirm button\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\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\tprivate eventClickCloseButton: () => void = () => {\r\n\t\t// Destroy modal\r\n\t\tthis.destroy();\r\n\t};\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\tprivate position: {x: number, y: number};\r\n\tprivate offset: {x: number, y: number};\r\n\tprivate isDragging: boolean = false;\r\n\tprivate moveFromElements: HTMLElement[] = [];\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\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\tprivate eventDragStop: () => void = () => {\r\n\t\tthis.isDragging = false;\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\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 * @param {Object} options\r\n\t * @param {string | null} options.setId - set a specific id on the modal. default \"null\" \r\n\t * @param {string | null} options.setClass - set a specific class on the modal, default \"null\"\r\n\t * @param {string} options.width - width (specify unit), default \"auto\"\r\n\t * @param {string} options.height - height (specify unit), default \"auto\"\r\n\t * @param {string | null} options.titleHtml - html for title, default \"null\"\r\n\t * @param {string | null} options.bodyHtml - html for body, default \"null\"\r\n\t * @param {string | null} options.buttonCancelHtml - html for cancel button, default \"null\"\r\n\t * @param {string | null} options.buttonConfirmHtml - html for confirm button, default \"null\"\r\n\t * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default \"true\"\r\n\t * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default \"true\"\r\n\t * @param {boolean} options.showCloseButton - show close button, default \"true\"\r\n\t * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default \"true\"\r\n\t * @param {boolean} options.allowMovement - ability to move modal, default \"true\"\r\n\t * @param {boolean} options.moveFromHeader - if allowMovement is set to \"true\", ability to move modal from header, default \"true\"\r\n\t * @param {boolean} options.moveFromBody - if allowMovement is set to \"true\", ability to move modal from body, default \"false\"\r\n\t * @param {boolean} options.moveFromFooter - if allowMovement is set to \"true\", ability to move modal from footer, default \"true\"\r\n\t * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default \"true\"\r\n\t * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default \"true\"\r\n\t * @param {string | null} options.style - add extra css style to modal, default null\r\n\t * @param {\"animDropDown\" | \"animFadeIn\"} options.animationOnShow - \"animDropDown\" or \"animFadeIn\" for show animation, default \"animDropDown\"\r\n\t * @param {\"animDropUp\" | \"animFadeOut\"} options.animationOnDestroy - \"animDropUp\" or \"animFadeOut\" for destroy animation, default \"animDropUp\"\r\n\t * @param {number} options.animationDuration - animation duration in ms, default \"500\"\r\n\t * @param {() => void} options.beforeShow - callback before show modal\r\n\t * @param {() => void} options.afterShow - callback after show modal\r\n\t * @param {() => void} options.beforeDestroy - callback before destroy modal\r\n\t * @param {() => void} options.afterDestroy - callback after destroy modal\r\n\t * @param {() => void} options.onCancelButton - callback after triggering cancel button\r\n\t * @param {() => void} options.onConfirmButton - callback after triggering confirm button\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 * Init modal\r\n\t */\r\n 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\tthis.webcimesModals = <HTMLElement>document.querySelector(\".webcimesModals\");\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\r\n\t\tif(typeof this.options.beforeShow === 'function')\r\n\t\t{\r\n\t\t\t// Set a timeout of zero, to wait for some dom to load\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.options.beforeShow();\r\n\t\t\t}, 0);\r\n\t\t}\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\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 modal\r\n\t */\r\n\tdestroy()\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\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\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","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":""}