webcimes-modal 1.0.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,353 @@
1
+ /**
2
+ * Copyright (c) 2023 WebCimes - RICHARD Florian (https://webcimes.com)
3
+ * MIT License - https://choosealicense.com/licenses/mit/
4
+ * Date: 2023-03-25
5
+ */
6
+ "use strict";
7
+ /**
8
+ * Class WebcimesModal
9
+ */
10
+ export class WebcimesModal {
11
+ /**
12
+ * Create modal
13
+ * @param {Object} options
14
+ * @param {string | null} options.setId - set a specific id on the modal. default "null"
15
+ * @param {string | null} options.setClass - set a specific class on the modal, default "null"
16
+ * @param {string} options.width - width (specify unit), default "auto"
17
+ * @param {string} options.height - height (specify unit), default "auto"
18
+ * @param {string | null} options.titleHtml - html for title, default "null"
19
+ * @param {string | null} options.bodyHtml - html for body, default "null"
20
+ * @param {string | null} options.buttonCancelHtml - html for cancel button, default "null"
21
+ * @param {string | null} options.buttonConfirmHtml - html for confirm button, default "null"
22
+ * @param {boolean} options.closeOnCancelButton - close modal after trigger cancel button, default "true"
23
+ * @param {boolean} options.closeOnConfirmButton - close modal after trigger confirm button, default "true"
24
+ * @param {boolean} options.showCloseButton - show close button, default "true"
25
+ * @param {boolean} options.allowCloseOutside - allow the modal to close when clicked outside, default "true"
26
+ * @param {boolean} options.allowMovement - ability to move modal, default "true"
27
+ * @param {boolean} options.moveFromHeader - if allowMovement is set to "true", ability to move modal from header, default "true"
28
+ * @param {boolean} options.moveFromBody - if allowMovement is set to "true", ability to move modal from body, default "false"
29
+ * @param {boolean} options.moveFromFooter - if allowMovement is set to "true", ability to move modal from footer, default "true"
30
+ * @param {boolean} options.stickyHeader - keep header sticky (visible) when scrolling, default "true"
31
+ * @param {boolean} options.stickyFooter - keep footer sticky (visible) when scrolling, default "true"
32
+ * @param {string | null} options.style - add extra css style to modal, default null
33
+ * @param {"animDropDown" | "animFadeIn"} options.animationOnShow - "animDropDown" or "animFadeIn" for show animation, default "animDropDown"
34
+ * @param {"animDropUp" | "animFadeOut"} options.animationOnDestroy - "animDropUp" or "animFadeOut" for destroy animation, default "animDropUp"
35
+ * @param {number} options.animationDuration - animation duration in ms, default "500"
36
+ * @param {() => void} options.beforeShow - callback before show modal
37
+ * @param {() => void} options.afterShow - callback after show modal
38
+ * @param {() => void} options.beforeDestroy - callback before destroy modal
39
+ * @param {() => void} options.afterDestroy - callback after destroy modal
40
+ * @param {() => void} options.onCancelButton - callback after triggering cancel button
41
+ * @param {() => void} options.onConfirmButton - callback after triggering confirm button
42
+ */
43
+ constructor(options) {
44
+ this.eventCancelButton = () => {
45
+ // Callback on cancel button
46
+ if (typeof this.options.onCancelButton === 'function') {
47
+ this.options.onCancelButton();
48
+ }
49
+ };
50
+ this.eventConfirmButton = () => {
51
+ // Callback on confirm button
52
+ if (typeof this.options.onConfirmButton === 'function') {
53
+ this.options.onConfirmButton();
54
+ }
55
+ };
56
+ this.eventClickOutside = (e) => {
57
+ if (e.target == this.webcimesModals) {
58
+ if (this.options.allowCloseOutside) {
59
+ // Destroy modal
60
+ this.destroy();
61
+ }
62
+ else {
63
+ // Add animation for show modal who can't be close
64
+ this.modal.classList.add("animGrowShrink");
65
+ // Delete animation after the animation delay
66
+ setTimeout(() => {
67
+ this.modal.classList.remove("animGrowShrink");
68
+ }, this.options.animationDuration);
69
+ }
70
+ }
71
+ };
72
+ this.eventClickCloseButton = () => {
73
+ // Destroy modal
74
+ this.destroy();
75
+ };
76
+ this.eventDragModalOnTop = (e) => {
77
+ // Only if target is not close button (for bug in chrome)
78
+ if (!e.target.closest(".close")) {
79
+ // If multiple modal, and modal not already on top (no next sibling), we place the current modal on the top
80
+ if (document.querySelectorAll(".modal").length > 1 && this.modal.nextElementSibling !== null) {
81
+ let oldScrollTop = this.modal.scrollTop;
82
+ this.webcimesModals.insertAdjacentElement("beforeend", this.modal);
83
+ this.modal.scrollTop = oldScrollTop;
84
+ }
85
+ }
86
+ };
87
+ this.isDragging = false;
88
+ this.moveFromElements = [];
89
+ this.eventDragStart = (e) => {
90
+ // Start drag only if it's not a button
91
+ if (!e.target.closest("button")) {
92
+ this.isDragging = true;
93
+ // Mouse
94
+ if (e.clientX) {
95
+ this.offset = {
96
+ x: this.modal.offsetLeft - e.clientX,
97
+ y: this.modal.offsetTop - e.clientY
98
+ };
99
+ }
100
+ // Touch device (use the first touch only)
101
+ else if (e.touches) {
102
+ this.offset = {
103
+ x: this.modal.offsetLeft - e.touches[0].clientX,
104
+ y: this.modal.offsetTop - e.touches[0].clientY
105
+ };
106
+ }
107
+ }
108
+ };
109
+ this.eventMove = (e) => {
110
+ if (this.isDragging) {
111
+ // Mouse
112
+ if (e.clientX) {
113
+ this.position = {
114
+ x: e.clientX,
115
+ y: e.clientY
116
+ };
117
+ }
118
+ // Touch device (use the first touch only)
119
+ else if (e.touches) {
120
+ this.position = {
121
+ x: e.touches[0].clientX,
122
+ y: e.touches[0].clientY
123
+ };
124
+ }
125
+ this.modal.style.left = (this.position.x + this.offset.x) + 'px';
126
+ this.modal.style.top = (this.position.y + this.offset.y) + 'px';
127
+ }
128
+ };
129
+ this.eventDragStop = () => {
130
+ this.isDragging = false;
131
+ };
132
+ this.eventPreventSelectText = (e) => {
133
+ if (this.isDragging) {
134
+ e.preventDefault();
135
+ }
136
+ };
137
+ // Defaults
138
+ const defaults = {
139
+ setId: null,
140
+ setClass: null,
141
+ width: 'auto',
142
+ height: 'auto',
143
+ titleHtml: null,
144
+ bodyHtml: null,
145
+ buttonCancelHtml: null,
146
+ buttonConfirmHtml: null,
147
+ closeOnCancelButton: true,
148
+ closeOnConfirmButton: true,
149
+ showCloseButton: true,
150
+ allowCloseOutside: true,
151
+ allowMovement: true,
152
+ moveFromHeader: true,
153
+ moveFromBody: false,
154
+ moveFromFooter: true,
155
+ stickyHeader: true,
156
+ stickyFooter: true,
157
+ style: null,
158
+ animationOnShow: 'animDropDown',
159
+ animationOnDestroy: 'animDropUp',
160
+ animationDuration: 500,
161
+ beforeShow: () => { },
162
+ afterShow: () => { },
163
+ beforeDestroy: () => { },
164
+ afterDestroy: () => { },
165
+ onCancelButton: () => { },
166
+ onConfirmButton: () => { },
167
+ };
168
+ this.options = Object.assign(Object.assign({}, defaults), options);
169
+ // Call init method
170
+ this.init();
171
+ }
172
+ /**
173
+ * Init modal
174
+ */
175
+ init() {
176
+ var _a, _b;
177
+ // Create webcimesModals
178
+ if (!document.querySelector(".webcimesModals")) {
179
+ // Create webcimesModals
180
+ document.body.insertAdjacentHTML("beforeend", '<div class="webcimesModals animFadeIn"></div>');
181
+ this.webcimesModals = document.querySelector(".webcimesModals");
182
+ // Set animation duration for webcimesModals
183
+ this.webcimesModals.style.setProperty("animation-duration", this.options.animationDuration + "ms");
184
+ // Delete enter animation after animation delay
185
+ setTimeout(() => {
186
+ this.webcimesModals.classList.remove("animFadeIn");
187
+ }, this.options.animationDuration);
188
+ }
189
+ else {
190
+ this.webcimesModals = document.querySelector(".webcimesModals");
191
+ }
192
+ // Callback before show modal
193
+ if (typeof this.options.beforeShow === 'function') {
194
+ this.options.beforeShow();
195
+ }
196
+ // Create modal
197
+ this.webcimesModals.insertAdjacentHTML("beforeend", `<div class="modal ` + (this.options.setClass ? this.options.setClass : '') + ` ` + this.options.animationOnShow + `" ` + (this.options.setClass ? 'id="' + this.options.setId + '"' : '') + `>
198
+ ` + (this.options.titleHtml || this.options.showCloseButton ?
199
+ `<div class="modalHeader ` + (this.options.stickyHeader ? 'sticky' : '') + ` ` + (this.options.moveFromHeader ? 'movable' : '') + `">
200
+ ` + (this.options.titleHtml ? '<div class="title">' + this.options.titleHtml + '</div>' : '') + `
201
+ ` + (this.options.showCloseButton ? '<button class="close"></button>' : '') + `
202
+ </div>`
203
+ : '') + `
204
+ ` + (this.options.bodyHtml ?
205
+ `<div class="modalBody ` + (this.options.moveFromBody ? 'movable' : '') + `">
206
+ ` + this.options.bodyHtml + `
207
+ </div>`
208
+ : '') + `
209
+ ` + (this.options.buttonCancelHtml || this.options.buttonConfirmHtml ?
210
+ `<div class="modalFooter ` + (this.options.stickyFooter ? 'sticky' : '') + ` ` + (this.options.moveFromFooter ? 'movable' : '') + `">
211
+ ` + (this.options.buttonCancelHtml ? '<button class="cancel ' + (this.options.closeOnCancelButton ? 'close' : '') + '">' + this.options.buttonCancelHtml + '</button>' : '') + `
212
+ ` + (this.options.buttonConfirmHtml ? '<button class="confirm ' + (this.options.closeOnConfirmButton ? 'close' : '') + '">' + this.options.buttonConfirmHtml + '</button>' : '') + `
213
+ </div>`
214
+ : '') + `
215
+ </div>`);
216
+ this.modal = this.webcimesModals.lastElementChild;
217
+ // Set animation duration for modal
218
+ this.modal.style.setProperty("animation-duration", this.options.animationDuration + "ms");
219
+ // Delete animation of enter after the animation delay
220
+ setTimeout(() => {
221
+ this.modal.classList.remove(this.options.animationOnShow);
222
+ // Callback after show modal
223
+ if (typeof this.options.afterShow === 'function') {
224
+ this.options.afterShow();
225
+ }
226
+ }, this.options.animationDuration);
227
+ // Width of modal
228
+ this.modal.style.setProperty("max-width", "90%");
229
+ if (this.options.width != "auto" && this.options.width) {
230
+ this.modal.style.setProperty("width", this.options.width);
231
+ }
232
+ else {
233
+ // "max-content" is for keep size in "auto" and for maximum to max-width
234
+ this.modal.style.setProperty("width", "max-content");
235
+ }
236
+ // Height of modal
237
+ this.modal.style.setProperty("max-height", "90%");
238
+ if (this.options.height != "auto" && this.options.height) {
239
+ this.modal.style.setProperty("height", this.options.height);
240
+ }
241
+ else {
242
+ // "max-content" is for keep size in "auto" and for maximum to max-height
243
+ this.modal.style.setProperty("height", "max-content");
244
+ }
245
+ // Style
246
+ if (this.options.style) {
247
+ let oldStyle = this.modal.getAttribute("style");
248
+ this.modal.setAttribute("style", oldStyle + this.options.style);
249
+ }
250
+ // Event on cancel button
251
+ if (this.options.buttonCancelHtml) {
252
+ (_a = this.modal.querySelector(".cancel")) === null || _a === void 0 ? void 0 : _a.addEventListener("click", this.eventCancelButton);
253
+ }
254
+ // Event on confirm button
255
+ if (this.options.buttonConfirmHtml) {
256
+ (_b = this.modal.querySelector(".confirm")) === null || _b === void 0 ? void 0 : _b.addEventListener("click", this.eventConfirmButton);
257
+ }
258
+ // Event click outside (on webcimesModals)
259
+ this.webcimesModals.addEventListener("click", this.eventClickOutside);
260
+ // Event close modal when click on close button
261
+ this.modal.querySelectorAll(".close").forEach((el) => {
262
+ el.addEventListener("click", this.eventClickCloseButton);
263
+ });
264
+ // Place selected modal on top
265
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
266
+ this.modal.addEventListener(typeEvent, this.eventDragModalOnTop);
267
+ });
268
+ // Move modal
269
+ if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
270
+ if (this.options.moveFromHeader && this.modal.querySelector(".modalHeader")) {
271
+ this.moveFromElements.push(this.modal.querySelector(".modalHeader"));
272
+ }
273
+ if (this.options.moveFromBody && this.modal.querySelector(".modalBody")) {
274
+ this.moveFromElements.push(this.modal.querySelector(".modalBody"));
275
+ }
276
+ if (this.options.moveFromFooter && this.modal.querySelector(".modalFooter")) {
277
+ this.moveFromElements.push(this.modal.querySelector(".modalFooter"));
278
+ }
279
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
280
+ this.moveFromElements.forEach((el) => {
281
+ el.addEventListener(typeEvent, this.eventDragStart);
282
+ });
283
+ });
284
+ ['mousemove', 'touchmove'].forEach((typeEvent) => {
285
+ document.addEventListener(typeEvent, this.eventMove);
286
+ });
287
+ ['mouseup', 'touchend'].forEach((typeEvent) => {
288
+ document.addEventListener(typeEvent, this.eventDragStop);
289
+ });
290
+ document.addEventListener("selectstart", this.eventPreventSelectText);
291
+ }
292
+ }
293
+ /**
294
+ * Destroy modal
295
+ */
296
+ destroy() {
297
+ // If modal is not already destroying
298
+ if (!this.modal.getAttribute("data-destroying")) {
299
+ // Callback before destroy modal
300
+ if (typeof this.options.beforeDestroy === 'function') {
301
+ this.options.beforeDestroy();
302
+ }
303
+ // Close webcimesModals (according the number of modal not already destroying)
304
+ if (document.querySelectorAll(".modal:not([data-destroying])").length == 1) {
305
+ this.webcimesModals.classList.add("animFadeOut");
306
+ }
307
+ // Close modal
308
+ this.modal.setAttribute("data-destroying", "1");
309
+ this.modal.classList.add(this.options.animationOnDestroy);
310
+ // Destroy all events from modal and remove webcimesModals or modal after animation duration
311
+ setTimeout(() => {
312
+ var _a, _b;
313
+ if (typeof this.modal !== 'undefined') {
314
+ // Destroy all events from modal
315
+ if (this.options.buttonCancelHtml) {
316
+ (_a = this.modal.querySelector(".cancel")) === null || _a === void 0 ? void 0 : _a.removeEventListener("click", this.eventCancelButton);
317
+ }
318
+ if (this.options.buttonConfirmHtml) {
319
+ (_b = this.modal.querySelector(".confirm")) === null || _b === void 0 ? void 0 : _b.removeEventListener("click", this.eventConfirmButton);
320
+ }
321
+ this.webcimesModals.removeEventListener("click", this.eventClickOutside);
322
+ this.modal.querySelectorAll(".close").forEach((el) => {
323
+ el.removeEventListener("click", this.eventClickCloseButton);
324
+ });
325
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
326
+ this.modal.removeEventListener(typeEvent, this.eventDragModalOnTop);
327
+ });
328
+ if (this.options.allowMovement && (this.options.moveFromHeader || this.options.moveFromBody || this.options.moveFromFooter)) {
329
+ ['mousedown', 'touchstart'].forEach((typeEvent) => {
330
+ this.moveFromElements.forEach((el) => {
331
+ el.removeEventListener(typeEvent, this.eventDragStart);
332
+ });
333
+ });
334
+ ['mousemove', 'touchmove'].forEach((typeEvent) => {
335
+ document.removeEventListener(typeEvent, this.eventMove);
336
+ });
337
+ ['mouseup', 'touchend'].forEach((typeEvent) => {
338
+ document.removeEventListener(typeEvent, this.eventDragStop);
339
+ });
340
+ document.removeEventListener("selectstart", this.eventPreventSelectText);
341
+ }
342
+ // Remove webcimesModals or modal according the number of modal
343
+ (document.querySelectorAll(".modal").length > 1 ? this.modal : this.webcimesModals).remove();
344
+ }
345
+ // Callback after destroy modal
346
+ if (typeof this.options.afterDestroy === 'function') {
347
+ this.options.afterDestroy();
348
+ }
349
+ }, this.options.animationDuration);
350
+ }
351
+ }
352
+ }
353
+ //# sourceMappingURL=webcimes-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webcimes-modal.js","sourceRoot":"","sources":["webcimes-modal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;AAgEb;;GAEG;AACH,MAAM,OAAO,aAAa;IAqHzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,OAAgB;QAhJpB,sBAAiB,GAAe,GAAG,EAAE;YAC5C,4BAA4B;YAC5B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,KAAK,UAAU,EACpD;gBACC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;aAC9B;QACF,CAAC,CAAC;QACM,uBAAkB,GAAe,GAAG,EAAE;YAC7C,6BAA6B;YAC7B,IAAG,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,KAAK,UAAU,EACrD;gBACC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;aAC/B;QACF,CAAC,CAAC;QACM,sBAAiB,GAAuB,CAAC,CAAC,EAAE,EAAE;YACrD,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,EAClC;gBACC,IAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EACjC;oBACC,gBAAgB;oBAChB,IAAI,CAAC,OAAO,EAAE,CAAC;iBACf;qBAED;oBACC,kDAAkD;oBAClD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;oBAE3C,6CAA6C;oBAC7C,UAAU,CAAC,GAAG,EAAE;wBACf,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;oBAC/C,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;iBACnC;aACD;QACF,CAAC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