@finqu/cool 1.0.0

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.
Files changed (199) hide show
  1. package/README.md +1 -0
  2. package/build/.eslintrc.json +10 -0
  3. package/build/banner.js +14 -0
  4. package/build/build-plugins.js +92 -0
  5. package/build/rollup.config.js +78 -0
  6. package/dist/css/cool-grid.css +3672 -0
  7. package/dist/css/cool-grid.css.map +30 -0
  8. package/dist/css/cool-grid.min.css +7 -0
  9. package/dist/css/cool-grid.min.css.map +1 -0
  10. package/dist/css/cool-reboot.css +281 -0
  11. package/dist/css/cool-reboot.css.map +58 -0
  12. package/dist/css/cool-reboot.min.css +7 -0
  13. package/dist/css/cool-reboot.min.css.map +1 -0
  14. package/dist/css/cool.css +14841 -0
  15. package/dist/css/cool.css.map +144 -0
  16. package/dist/css/cool.min.css +7 -0
  17. package/dist/css/cool.min.css.map +1 -0
  18. package/dist/js/cool.bundle.js +15304 -0
  19. package/dist/js/cool.bundle.js.map +1 -0
  20. package/dist/js/cool.bundle.min.js +45 -0
  21. package/dist/js/cool.bundle.min.js.map +1 -0
  22. package/dist/js/cool.esm.js +4766 -0
  23. package/dist/js/cool.esm.js.map +1 -0
  24. package/dist/js/cool.esm.min.js +7 -0
  25. package/dist/js/cool.esm.min.js.map +1 -0
  26. package/dist/js/cool.js +4948 -0
  27. package/dist/js/cool.js.map +1 -0
  28. package/dist/js/cool.min.js +7 -0
  29. package/dist/js/cool.min.js.map +1 -0
  30. package/html/index.html +892 -0
  31. package/js/dist/collapse.js +321 -0
  32. package/js/dist/collapse.js.map +1 -0
  33. package/js/dist/common.js +1474 -0
  34. package/js/dist/common.js.map +1 -0
  35. package/js/dist/cooldropdown.js +467 -0
  36. package/js/dist/cooldropdown.js.map +1 -0
  37. package/js/dist/coolpopover.js +391 -0
  38. package/js/dist/coolpopover.js.map +1 -0
  39. package/js/dist/coolsectiontabs.js +256 -0
  40. package/js/dist/coolsectiontabs.js.map +1 -0
  41. package/js/dist/coolselect.js +796 -0
  42. package/js/dist/coolselect.js.map +1 -0
  43. package/js/dist/cooltooltip.js +360 -0
  44. package/js/dist/cooltooltip.js.map +1 -0
  45. package/js/dist/coolui.js +73 -0
  46. package/js/dist/coolui.js.map +1 -0
  47. package/js/dist/dropdown.js +1716 -0
  48. package/js/dist/dropdown.js.map +1 -0
  49. package/js/dist/popover.js +587 -0
  50. package/js/dist/popover.js.map +1 -0
  51. package/js/dist/sectiontabs.js +263 -0
  52. package/js/dist/sectiontabs.js.map +1 -0
  53. package/js/dist/select.js +2029 -0
  54. package/js/dist/select.js.map +1 -0
  55. package/js/dist/tooltip.js +555 -0
  56. package/js/dist/tooltip.js.map +1 -0
  57. package/js/index.esm.js +21 -0
  58. package/js/index.umd.js +21 -0
  59. package/js/src/abstract-ui-component.js +70 -0
  60. package/js/src/collapse.js +258 -0
  61. package/js/src/common.js +280 -0
  62. package/js/src/dialog.js +570 -0
  63. package/js/src/dropdown.js +443 -0
  64. package/js/src/popover.js +615 -0
  65. package/js/src/section-tabs.js +204 -0
  66. package/js/src/select.js +832 -0
  67. package/js/src/toast.js +581 -0
  68. package/js/src/tooltip.js +575 -0
  69. package/js/src/util/animate-css.js +22 -0
  70. package/js/src/util/index.js +112 -0
  71. package/js/src/util/perfect-scrollbar.js +1316 -0
  72. package/less/alert.less +345 -0
  73. package/less/badge.less +38 -0
  74. package/less/bootstrap-noconflict.less +23 -0
  75. package/less/bootstrap.less +23 -0
  76. package/less/button-group.less +153 -0
  77. package/less/buttons.less +287 -0
  78. package/less/dialog-noconflict.less +174 -0
  79. package/less/dialog.less +203 -0
  80. package/less/dropdown.less +209 -0
  81. package/less/forms.less +770 -0
  82. package/less/images.less +242 -0
  83. package/less/input-group.less +163 -0
  84. package/less/list-group.less +73 -0
  85. package/less/mixins/aspect-ratio.less +23 -0
  86. package/less/mixins/border-radius.less +24 -0
  87. package/less/mixins/box-shadow.less +4 -0
  88. package/less/mixins/buttons.less +17 -0
  89. package/less/mixins/caret.less +51 -0
  90. package/less/mixins/clearfix.less +10 -0
  91. package/less/mixins/gradients.less +34 -0
  92. package/less/mixins/nav-divider.less +7 -0
  93. package/less/mixins/object-fit.less +13 -0
  94. package/less/mixins/reset-text.less +16 -0
  95. package/less/mixins.less +11 -0
  96. package/less/package.json +11 -0
  97. package/less/pagination.less +69 -0
  98. package/less/popover.less +143 -0
  99. package/less/project.sublime-workspace +774 -0
  100. package/less/reboot.less +235 -0
  101. package/less/section.less +793 -0
  102. package/less/select.less +150 -0
  103. package/less/tables.less +737 -0
  104. package/less/tabs.less +162 -0
  105. package/less/tooltip.less +87 -0
  106. package/less/type.less +71 -0
  107. package/less/utilities/align.less +27 -0
  108. package/less/utilities/animate.less +3512 -0
  109. package/less/utilities/background.less +70 -0
  110. package/less/utilities/borders.less +16 -0
  111. package/less/utilities/color.less +70 -0
  112. package/less/utilities/cursor.less +8 -0
  113. package/less/utilities/display.less +38 -0
  114. package/less/utilities/embed.less +61 -0
  115. package/less/utilities/flex.less +76 -0
  116. package/less/utilities/jquery-ui.less +116 -0
  117. package/less/utilities/lazyload.less +29 -0
  118. package/less/utilities/overflow.less +11 -0
  119. package/less/utilities/pace.less +25 -0
  120. package/less/utilities/placeholder.less +60 -0
  121. package/less/utilities/position.less +42 -0
  122. package/less/utilities/scrollbar.less +152 -0
  123. package/less/utilities/spacing.less +197 -0
  124. package/less/utilities/text.less +68 -0
  125. package/less/utilities/transform.less +7 -0
  126. package/less/utilities.less +21 -0
  127. package/less/variables.less +343 -0
  128. package/package.json +71 -0
  129. package/scss/LISENCE +15 -0
  130. package/scss/_alert.scss +125 -0
  131. package/scss/_badge.scss +58 -0
  132. package/scss/_button-group.scss +124 -0
  133. package/scss/_buttons.scss +206 -0
  134. package/scss/_custom-forms.scss +423 -0
  135. package/scss/_dialog.scss +149 -0
  136. package/scss/_dropdown.scss +234 -0
  137. package/scss/_forms.scss +257 -0
  138. package/scss/_frame.scss +523 -0
  139. package/scss/_functions.scss +114 -0
  140. package/scss/_grid.scss +35 -0
  141. package/scss/_images.scss +312 -0
  142. package/scss/_input-group.scss +245 -0
  143. package/scss/_list-group.scss +82 -0
  144. package/scss/_mixins.scss +32 -0
  145. package/scss/_navbar.scss +214 -0
  146. package/scss/_pagination.scss +79 -0
  147. package/scss/_popover.scss +165 -0
  148. package/scss/_reboot.scss +279 -0
  149. package/scss/_root.scss +15 -0
  150. package/scss/_section.scss +851 -0
  151. package/scss/_select.scss +166 -0
  152. package/scss/_tables.scss +707 -0
  153. package/scss/_tabs.scss +175 -0
  154. package/scss/_toast.scss +182 -0
  155. package/scss/_tooltip.scss +101 -0
  156. package/scss/_type.scss +90 -0
  157. package/scss/_utilities.scss +21 -0
  158. package/scss/_variables.scss +697 -0
  159. package/scss/cool-grid.scss +29 -0
  160. package/scss/cool-reboot.scss +11 -0
  161. package/scss/cool.scss +36 -0
  162. package/scss/mixins/_alert-variant.scss +40 -0
  163. package/scss/mixins/_aspect-ratio.scss +29 -0
  164. package/scss/mixins/_background-variant.scss +25 -0
  165. package/scss/mixins/_badge-variant.scss +13 -0
  166. package/scss/mixins/_breakpoints.scss +102 -0
  167. package/scss/mixins/_buttons.scss +104 -0
  168. package/scss/mixins/_caret.scss +80 -0
  169. package/scss/mixins/_clearfix.scss +10 -0
  170. package/scss/mixins/_float.scss +14 -0
  171. package/scss/mixins/_forms.scss +51 -0
  172. package/scss/mixins/_gradients.scss +40 -0
  173. package/scss/mixins/_grid-framework.scss +72 -0
  174. package/scss/mixins/_grid.scss +60 -0
  175. package/scss/mixins/_nav-divider.scss +9 -0
  176. package/scss/mixins/_object-fit.scss +16 -0
  177. package/scss/mixins/_reset-text.scss +19 -0
  178. package/scss/mixins/_text-emphasis.scss +21 -0
  179. package/scss/mixins/_text-hide.scss +10 -0
  180. package/scss/mixins/_text-truncate.scss +8 -0
  181. package/scss/project.sublime-workspace +491 -0
  182. package/scss/utilities/_align.scss +41 -0
  183. package/scss/utilities/_animate.scss +3512 -0
  184. package/scss/utilities/_background.scss +14 -0
  185. package/scss/utilities/_borders.scss +146 -0
  186. package/scss/utilities/_clearfix.scss +6 -0
  187. package/scss/utilities/_collapse.scss +33 -0
  188. package/scss/utilities/_cursor.scss +10 -0
  189. package/scss/utilities/_display.scss +16 -0
  190. package/scss/utilities/_embed.scss +78 -0
  191. package/scss/utilities/_flex.scss +50 -0
  192. package/scss/utilities/_lazyload.scss +31 -0
  193. package/scss/utilities/_overflow.scss +6 -0
  194. package/scss/utilities/_perfect-scrollbar.scss +154 -0
  195. package/scss/utilities/_placeholder.scss +76 -0
  196. package/scss/utilities/_position.scss +30 -0
  197. package/scss/utilities/_sizing.scss +32 -0
  198. package/scss/utilities/_spacing.scss +92 -0
  199. package/scss/utilities/_text.scss +97 -0
@@ -0,0 +1,570 @@
1
+ import 'jquery';
2
+ import { debounce } from './util/index';
3
+
4
+ const NAME = 'coolDialog';
5
+ const DATA_KEY = 'plugin_coolDialog';
6
+
7
+ class Dialog {
8
+
9
+ constructor(container, opts) {
10
+
11
+ this.settings = {};
12
+
13
+ if (window.Cool.settings.dialog) {
14
+
15
+ $.extend(true, this.settings, $.fn[NAME].defaults, window.Cool.settings.dialog, opts);
16
+
17
+ } else {
18
+
19
+ $.extend(true, this.settings, $.fn[NAME].defaults, opts);
20
+ }
21
+
22
+ this.container = container;
23
+ this.$container = $(this.container);
24
+ this.debug = this.settings.debug;
25
+ this.faPro = this.settings.faPro;
26
+ this.dialogs = [];
27
+ this.onInitialize = this.settings.onInitialize;
28
+ this.onDestroy = this.settings.onDestroy;
29
+ }
30
+
31
+ // Init dialog
32
+ init(opts) {
33
+
34
+ let settings = {};
35
+
36
+ $.extend(true, settings, this.settings, opts);
37
+
38
+ let dialog = this.buildDialog(settings);
39
+
40
+ this.show(dialog);
41
+ this.bindEvents(dialog);
42
+ this.onInit(dialog);
43
+
44
+ return dialog;
45
+ }
46
+
47
+ // Remove plugin instance completely
48
+ destroy() {
49
+
50
+ this.$container.removeData(DATA_KEY);
51
+ this.onDestroy();
52
+ }
53
+
54
+ // Build dialog
55
+ buildDialog(settings) {
56
+
57
+ let self = this;
58
+ let dialog = {
59
+ uuid: 'dialog-'+this.generateUUID(),
60
+ title: settings.title,
61
+ template: settings.template,
62
+ body: settings.body,
63
+ footer: settings.footer,
64
+ size: settings.size,
65
+ classes: settings.classes,
66
+ centered: settings.centered,
67
+ backdrop: settings.backdrop,
68
+ preventScroll: settings.preventScroll,
69
+ closeBtn: settings.closeBtn,
70
+ animation: settings.animation,
71
+ animationIn: settings.animationIn,
72
+ animationOut: settings.animationOut,
73
+ animationSpeed: settings.animationSpeed,
74
+ callbacks: settings.callbacks,
75
+ maxBodyHeight: settings.maxBodyHeight,
76
+ actions: settings.actions,
77
+ onInit: settings.onInit,
78
+ onShow: settings.onShow,
79
+ onClose: settings.onClose
80
+ };
81
+
82
+ if (typeof dialog.template === 'function') {
83
+
84
+ dialog.$el = $(dialog.template());
85
+
86
+ } else {
87
+
88
+ dialog.$el = $(this._renderTemplate(dialog));
89
+ }
90
+
91
+ dialog.show = function() {
92
+ self.show(dialog);
93
+ };
94
+
95
+ dialog.close = function() {
96
+ self.close(dialog);
97
+ };
98
+
99
+ this.log(dialog);
100
+ this.dialogs.push(dialog);
101
+
102
+ return dialog;
103
+ }
104
+
105
+ // Bind events that trigger methods
106
+ bindEvents(dialog) {
107
+
108
+ let self = this;
109
+
110
+ dialog.$el.on('click', '[data-dialog-close]', function (e) {
111
+
112
+ dialog.$el.trigger('dialog.close');
113
+
114
+ if (typeof dialog.callbacks.close === 'function') {
115
+
116
+ dialog.callbacks.close.call(self, function () {
117
+ self.close(dialog)
118
+ }, dialog);
119
+
120
+ } else {
121
+
122
+ self.close(dialog);
123
+ }
124
+ });
125
+
126
+ dialog.$el.on('click', '[data-dialog-remove]', function (e) {
127
+
128
+ dialog.$el.trigger('dialog.remove');
129
+
130
+ if (typeof dialog.callbacks.remove === 'function') {
131
+
132
+ dialog.callbacks.remove.call(self, function () {
133
+ self.close(dialog)
134
+ }, dialog);
135
+ }
136
+ });
137
+
138
+ dialog.$el.on('click', '[data-dialog-confirm]', debounce(function (e) {
139
+
140
+ dialog.$el.trigger('dialog.close');
141
+
142
+ if (typeof dialog.callbacks.confirm === 'function') {
143
+
144
+ dialog.callbacks.confirm.call(self, function () {
145
+ self.close(dialog)
146
+ }, dialog);
147
+
148
+ } else {
149
+
150
+ self.close(dialog);
151
+ }
152
+ }));
153
+ }
154
+
155
+ // Generate UUID
156
+ generateUUID() {
157
+
158
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
159
+ let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
160
+ return v.toString(16);
161
+ });
162
+ }
163
+
164
+ // Show
165
+ show(dialog) {
166
+
167
+ if (!this.$container.hasClass('has-dialogs')) {
168
+ this.$container.addClass('has-dialogs');
169
+ }
170
+
171
+ if (dialog.preventScroll && !this.$container.hasClass('dialog-prevent-scroll')) {
172
+ this.$container.addClass('dialog-prevent-scroll');
173
+ }
174
+
175
+ if (this.dialogs.length > 1) {
176
+
177
+ let $prevDialog = $(this.dialogs).eq(-2)[0].$el;
178
+ let zIndex = parseInt($prevDialog.css('z-index'), 10) + 1;
179
+
180
+ dialog.$el.css('z-index', zIndex);
181
+
182
+ $prevDialog.css({
183
+ 'transition': 'opacity 0.3s',
184
+ 'opacity': 0,
185
+ 'visibility': 'visible'
186
+ });
187
+ }
188
+
189
+ if (dialog.backdrop && $('.dialog-backdrop').length < 1) {
190
+
191
+ this.$container.append('<div class="dialog-backdrop"></div>');
192
+
193
+ let checkForBackdrop = setInterval(() => {
194
+
195
+ if (this.dialogs.length == 0 && $('.dialog-backdrop').length) {
196
+
197
+ $('.dialog-backdrop').remove();
198
+ clearInterval(checkForBackdrop);
199
+ }
200
+
201
+ }, 100);
202
+ }
203
+
204
+ this.$container.append(dialog.$el);
205
+
206
+ if (dialog.animation) {
207
+ dialog.$el.find('.dialog-content').addClass(dialog.animationSpeed).animateCss(dialog.animationIn);
208
+ }
209
+
210
+ this.onShow(dialog);
211
+ }
212
+
213
+ // Close
214
+ close(dialog) {
215
+
216
+ let $prevDialog = null;
217
+
218
+ if (this.dialogs.length > 1) {
219
+ $prevDialog = $(this.dialogs).eq(-2)[0].$el;
220
+ }
221
+
222
+ if ($('.dialog[data-dialog-backdrop="true"]').length === 0 && $('.dialog-backdrop').length) {
223
+ $('.dialog-backdrop').remove();
224
+ }
225
+
226
+ if (dialog.animation) {
227
+
228
+ dialog.$el.find('.dialog-content').animateCss(dialog.animationOut, () => {
229
+
230
+ dialog.$el.remove();
231
+
232
+ this.dialogs = $.grep(this.dialogs, function(item) {
233
+ return item.uuid != dialog.uuid;
234
+ });
235
+
236
+ if (this.dialogs.length == 0) {
237
+
238
+ this.$container.removeClass('has-dialogs');
239
+
240
+ if (this.$container.hasClass('dialog-prevent-scroll')) {
241
+ this.$container.removeClass('dialog-prevent-scroll');
242
+ }
243
+
244
+ } else {
245
+
246
+ if ($prevDialog) {
247
+ $prevDialog.css('opacity', 1);
248
+ }
249
+ }
250
+ });
251
+
252
+ } else {
253
+
254
+ dialog.$el.remove();
255
+
256
+ this.dialogs = $.grep(this.dialogs, function(item) {
257
+ return item.uuid != dialog.uuid;
258
+ });
259
+
260
+ if (this.dialogs.length == 0) {
261
+
262
+ this.$container.removeClass('has-dialogs');
263
+
264
+ if (this.$container.hasClass('dialog-prevent-scroll')) {
265
+ this.$container.removeClass('dialog-prevent-scroll');
266
+ }
267
+
268
+ } else {
269
+
270
+ if ($prevDialog) {
271
+ $prevDialog.css('opacity', 1);
272
+ }
273
+ }
274
+ }
275
+
276
+ this.onClose(dialog);
277
+ }
278
+
279
+ // Initialize callback
280
+ onInitialize() {
281
+
282
+ let onInitialize = this.onInitialize;
283
+
284
+ if (typeof onInitialize === 'function') {
285
+
286
+ onInitialize.call(this.container);
287
+ }
288
+ }
289
+
290
+ // Destroy callback
291
+ onDestroy() {
292
+
293
+ let onDestroy = this.onDestroy;
294
+
295
+ if (typeof onDestroy === 'function') {
296
+
297
+ onDestroy.call(this.container);
298
+ }
299
+ }
300
+
301
+ // Init callback
302
+ onInit(dialog) {
303
+
304
+ let onInit = dialog.onInit;
305
+
306
+ if (typeof onInit === 'function') {
307
+
308
+ onInit.call(dialog);
309
+ }
310
+ }
311
+
312
+ // Show callback
313
+ onShow(dialog) {
314
+
315
+ let onShow = dialog.onShow;
316
+
317
+ if (typeof onShow === 'function') {
318
+
319
+ onShow.call(dialog);
320
+ }
321
+ }
322
+
323
+ // Close callback
324
+ onClose(dialog) {
325
+
326
+ let onClose = dialog.onClose;
327
+
328
+ if (typeof onClose === 'function') {
329
+
330
+ onClose.call(dialog);
331
+ }
332
+ }
333
+
334
+ // Debug log
335
+ log(...args) {
336
+
337
+ if (this.debug) {
338
+
339
+ if (typeof this.debug === 'function') {
340
+ this.debug(...args);
341
+ } else {
342
+ console.log(...args);
343
+ }
344
+ }
345
+ }
346
+
347
+ // Render footer
348
+ _renderFooter(dialog) {
349
+
350
+ let footer = '';
351
+
352
+ if (typeof dialog.footer === 'function') {
353
+
354
+ footer = dialog.footer();
355
+
356
+ } else if (dialog.footer !== '' && dialog.footer !== false && dialog.footer !== true) {
357
+
358
+ footer = dialog.footer;
359
+
360
+ } else if (dialog.footer === true) {
361
+
362
+ let btnCancel = '';
363
+ let btnRemove = '';
364
+ let btnConfirm = '';
365
+ let btnStyle = '';
366
+ let btnClasses = '';
367
+ let btnAttrs = '';
368
+
369
+ if (dialog.actions.close.visible) {
370
+
371
+ btnStyle = dialog.actions.close.primary ? 'btn-primary' : 'btn-secondary';
372
+ btnClasses = dialog.actions.close.classes ? ' '+dialog.actions.close.classes : '';
373
+ btnAttrs = dialog.actions.close.attrs ? ' '+dialog.actions.close.attrs : '';
374
+ btnCancel = `
375
+ <button type="button" class="btn ${btnStyle}${btnClasses}"${btnAttrs} data-dialog-close>
376
+ ${dialog.actions.close.content}
377
+ </button>
378
+ `;
379
+ }
380
+
381
+ if (dialog.actions.remove.visible) {
382
+
383
+ btnStyle = dialog.actions.remove.primary ? 'btn-primary' : 'btn-secondary';
384
+ btnClasses = dialog.actions.remove.classes ? ' '+dialog.actions.remove.classes : '';
385
+ btnAttrs = dialog.actions.remove.attrs ? ' '+dialog.actions.remove.attrs : '';
386
+ btnRemove = `
387
+ <button type="button" class="btn ${btnStyle}${btnClasses}"${btnAttrs} data-dialog-remove>
388
+ ${dialog.actions.remove.content}
389
+ </button>
390
+ `;
391
+ }
392
+
393
+ if (dialog.actions.confirm.visible) {
394
+
395
+ btnStyle = dialog.actions.confirm.primary ? 'btn-primary' : 'btn-secondary';
396
+ btnClasses = dialog.actions.confirm.classes ? ' '+dialog.actions.confirm.classes : '';
397
+ btnAttrs = dialog.actions.confirm.attrs ? ' '+dialog.actions.confirm.attrs : '';
398
+ btnConfirm = `
399
+ <button type="button" class="btn ${btnStyle}${btnClasses}"${btnAttrs} data-dialog-confirm>
400
+ ${dialog.actions.confirm.content}
401
+ </button>
402
+ `;
403
+ }
404
+
405
+ footer = `
406
+ ${btnCancel}
407
+ ${btnRemove}
408
+ ${btnConfirm}
409
+ `;
410
+
411
+ } else {
412
+
413
+ return footer;
414
+ }
415
+
416
+ if (footer) {
417
+
418
+ return `
419
+ <div class="dialog-footer">
420
+ ${footer}
421
+ </div>
422
+ `;
423
+ }
424
+ }
425
+
426
+ // Render template
427
+ _renderTemplate(dialog) {
428
+
429
+ let faNameSpace = this.faPro ? 'far' : 'fas';
430
+ let classes = dialog.classes ? ' '+dialog.classes : '';
431
+ let centered = dialog.centered ? ' dialog-centered' : '';
432
+ let size = dialog.size ? ' dialog-'+dialog.size : '';
433
+ let uuid = ' data-dialog-uuid="'+dialog.uuid+'"';
434
+ let backdrop = dialog.backdrop ? ' data-dialog-backdrop="true"' : ' data-dialog-backdrop="false"';
435
+ let title = dialog.title;
436
+ let closeBtn = dialog.closeBtn ? `<button type="button" data-dialog-close><i class="${faNameSpace} fa-times icon"></i></button>` : '';
437
+ let maxBodyHeight = dialog.maxBodyHeight ? ' style="max-height: '+dialog.maxBodyHeight+'px"' : '';
438
+ let body = '';
439
+ let footer = this._renderFooter(dialog);
440
+
441
+ if (typeof dialog.body === 'function') {
442
+
443
+ body = dialog.body();
444
+
445
+ } else {
446
+
447
+ body = dialog.body;
448
+ }
449
+
450
+ return `
451
+ <div class="dialog${classes}${centered}${size}"${uuid}${backdrop}>
452
+
453
+ <div class="dialog-container">
454
+
455
+ <div class="dialog-content">
456
+
457
+ <div class="dialog-header">
458
+
459
+ <span class="dialog-title">
460
+ ${title}
461
+ </span>
462
+
463
+ ${closeBtn}
464
+
465
+ </div>
466
+
467
+ <div class="dialog-body"${maxBodyHeight}>
468
+
469
+ ${body}
470
+
471
+ </div>
472
+
473
+ ${footer}
474
+
475
+ </div>
476
+
477
+ </div>
478
+
479
+ </div>
480
+ `;
481
+ }
482
+
483
+ static _jQueryInterface(config) {
484
+
485
+ let data = $(this).data(DATA_KEY);
486
+ const _config = typeof config === 'object' && config;
487
+
488
+ if (!data) {
489
+ data = new Dialog(this, _config);
490
+ $(this).data(DATA_KEY, data);
491
+ }
492
+
493
+ if (typeof config === 'string') {
494
+
495
+ if (typeof data[config] === 'undefined') {
496
+ throw new TypeError(`No method named "${config}"`)
497
+ }
498
+
499
+ data[config]()
500
+ }
501
+ }
502
+ }
503
+
504
+ if (typeof $ !== 'undefined') {
505
+
506
+ // jQuery
507
+ const JQUERY_NO_CONFLICT = $.fn[NAME];
508
+
509
+ $.fn[NAME] = Dialog._jQueryInterface;
510
+ $.fn[NAME].Constructor = Dialog;
511
+
512
+ $.fn[NAME].noConflict = () => {
513
+
514
+ $.fn[NAME] = JQUERY_NO_CONFLICT
515
+
516
+ return Dialog._jQueryInterface
517
+ }
518
+
519
+ $.fn[NAME].defaults = {
520
+ title: '',
521
+ template: '',
522
+ body: '',
523
+ footer: true,
524
+ size: '', // sm/lg
525
+ classes: '',
526
+ centered: true,
527
+ backdrop: true,
528
+ preventScroll: true,
529
+ closeBtn: true,
530
+ animation: true,
531
+ animationIn: 'zoomIn',
532
+ animationOut: 'fadeOut',
533
+ animationSpeed: 'fastest',
534
+ callbacks: {},
535
+ maxBodyHeight: window.innerHeight - 200,
536
+ faPro: false,
537
+ debug: true,
538
+ onInitialize: null,
539
+ onDestroy: null,
540
+ onInit: null,
541
+ onDestroy: null,
542
+ onShow: null,
543
+ onClose: null,
544
+ actions: {
545
+ close: {
546
+ primary: false,
547
+ visible: true,
548
+ content: 'Close',
549
+ classes: '',
550
+ attrs: ''
551
+ },
552
+ remove: {
553
+ primary: false,
554
+ visible: true,
555
+ content: 'Remove',
556
+ classes: '',
557
+ attrs: ''
558
+ },
559
+ confirm: {
560
+ primary: true,
561
+ visible: true,
562
+ content: 'Confirm',
563
+ classes: '',
564
+ attrs: ''
565
+ }
566
+ }
567
+ }
568
+ }
569
+
570
+ export default Dialog;