@vuesimple/vs-modal 1.4.18 → 3.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.
- package/README.md +8 -13
- package/build/vite.config.js +33 -0
- package/dist/index.js +341 -0
- package/dist/index.min.js +1 -0
- package/dist/index.umd.js +1 -0
- package/package.json +8 -14
- package/src/index.js +4 -23
- package/src/vs-modal.vue +3 -3
- package/dist/vs-modal.esm.js +0 -811
- package/dist/vs-modal.min.js +0 -1
- package/dist/vs-modal.umd.js +0 -821
package/dist/vs-modal.esm.js
DELETED
|
@@ -1,811 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
var script = {
|
|
32
|
-
name: 'VsFocusContainer',
|
|
33
|
-
|
|
34
|
-
props: {
|
|
35
|
-
containFocus: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: true,
|
|
38
|
-
},
|
|
39
|
-
focusRedirector: Function,
|
|
40
|
-
disabled: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false,
|
|
43
|
-
},
|
|
44
|
-
tag: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: 'div',
|
|
47
|
-
},
|
|
48
|
-
lazy: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
computed: {
|
|
55
|
-
renderRedirector: function renderRedirector() {
|
|
56
|
-
if (this.disabled) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return this.lazy ? this.containFocus : true;
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
methods: {
|
|
64
|
-
focus: function focus() {
|
|
65
|
-
this.$refs.content.focus();
|
|
66
|
-
},
|
|
67
|
-
redirectFocus: function redirectFocus(e, options) {
|
|
68
|
-
if (!this.containFocus) {
|
|
69
|
-
this.$emit('focus-overflow', e, options);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
e.stopPropagation();
|
|
73
|
-
if (this.focusRedirector) {
|
|
74
|
-
this.focusRedirector(e, options);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (options.isTabbingForward) {
|
|
78
|
-
this.$refs.content.focus();
|
|
79
|
-
} else {
|
|
80
|
-
this.$refs.lastFocusable.focus();
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
|
87
|
-
if (typeof shadowMode !== 'boolean') {
|
|
88
|
-
createInjectorSSR = createInjector;
|
|
89
|
-
createInjector = shadowMode;
|
|
90
|
-
shadowMode = false;
|
|
91
|
-
}
|
|
92
|
-
// Vue.extend constructor export interop.
|
|
93
|
-
var options = typeof script === 'function' ? script.options : script;
|
|
94
|
-
// render functions
|
|
95
|
-
if (template && template.render) {
|
|
96
|
-
options.render = template.render;
|
|
97
|
-
options.staticRenderFns = template.staticRenderFns;
|
|
98
|
-
options._compiled = true;
|
|
99
|
-
// functional template
|
|
100
|
-
if (isFunctionalTemplate) {
|
|
101
|
-
options.functional = true;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// scopedId
|
|
105
|
-
if (scopeId) {
|
|
106
|
-
options._scopeId = scopeId;
|
|
107
|
-
}
|
|
108
|
-
var hook;
|
|
109
|
-
if (moduleIdentifier) {
|
|
110
|
-
// server build
|
|
111
|
-
hook = function (context) {
|
|
112
|
-
// 2.3 injection
|
|
113
|
-
context =
|
|
114
|
-
context || // cached call
|
|
115
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
116
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
|
|
117
|
-
// 2.2 with runInNewContext: true
|
|
118
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
119
|
-
context = __VUE_SSR_CONTEXT__;
|
|
120
|
-
}
|
|
121
|
-
// inject component styles
|
|
122
|
-
if (style) {
|
|
123
|
-
style.call(this, createInjectorSSR(context));
|
|
124
|
-
}
|
|
125
|
-
// register component module identifier for async chunk inference
|
|
126
|
-
if (context && context._registeredComponents) {
|
|
127
|
-
context._registeredComponents.add(moduleIdentifier);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
// used by ssr in case component is cached and beforeCreate
|
|
131
|
-
// never gets called
|
|
132
|
-
options._ssrRegister = hook;
|
|
133
|
-
}
|
|
134
|
-
else if (style) {
|
|
135
|
-
hook = shadowMode
|
|
136
|
-
? function (context) {
|
|
137
|
-
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
|
|
138
|
-
}
|
|
139
|
-
: function (context) {
|
|
140
|
-
style.call(this, createInjector(context));
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
if (hook) {
|
|
144
|
-
if (options.functional) {
|
|
145
|
-
// register for functional component in vue file
|
|
146
|
-
var originalRender = options.render;
|
|
147
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
148
|
-
hook.call(context);
|
|
149
|
-
return originalRender(h, context);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// inject component registration as beforeCreate hook
|
|
154
|
-
var existing = options.beforeCreate;
|
|
155
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return script;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var isOldIE = typeof navigator !== 'undefined' &&
|
|
162
|
-
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
|
|
163
|
-
function createInjector(context) {
|
|
164
|
-
return function (id, style) { return addStyle(id, style); };
|
|
165
|
-
}
|
|
166
|
-
var HEAD;
|
|
167
|
-
var styles = {};
|
|
168
|
-
function addStyle(id, css) {
|
|
169
|
-
var group = isOldIE ? css.media || 'default' : id;
|
|
170
|
-
var style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
|
|
171
|
-
if (!style.ids.has(id)) {
|
|
172
|
-
style.ids.add(id);
|
|
173
|
-
var code = css.source;
|
|
174
|
-
if (css.map) {
|
|
175
|
-
// https://developer.chrome.com/devtools/docs/javascript-debugging
|
|
176
|
-
// this makes source maps inside style tags work properly in Chrome
|
|
177
|
-
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
|
|
178
|
-
// http://stackoverflow.com/a/26603875
|
|
179
|
-
code +=
|
|
180
|
-
'\n/*# sourceMappingURL=data:application/json;base64,' +
|
|
181
|
-
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
|
|
182
|
-
' */';
|
|
183
|
-
}
|
|
184
|
-
if (!style.element) {
|
|
185
|
-
style.element = document.createElement('style');
|
|
186
|
-
style.element.type = 'text/css';
|
|
187
|
-
if (css.media)
|
|
188
|
-
{ style.element.setAttribute('media', css.media); }
|
|
189
|
-
if (HEAD === undefined) {
|
|
190
|
-
HEAD = document.head || document.getElementsByTagName('head')[0];
|
|
191
|
-
}
|
|
192
|
-
HEAD.appendChild(style.element);
|
|
193
|
-
}
|
|
194
|
-
if ('styleSheet' in style.element) {
|
|
195
|
-
style.styles.push(code);
|
|
196
|
-
style.element.styleSheet.cssText = style.styles
|
|
197
|
-
.filter(Boolean)
|
|
198
|
-
.join('\n');
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
var index = style.ids.size - 1;
|
|
202
|
-
var textNode = document.createTextNode(code);
|
|
203
|
-
var nodes = style.element.childNodes;
|
|
204
|
-
if (nodes[index])
|
|
205
|
-
{ style.element.removeChild(nodes[index]); }
|
|
206
|
-
if (nodes.length)
|
|
207
|
-
{ style.element.insertBefore(textNode, nodes[index]); }
|
|
208
|
-
else
|
|
209
|
-
{ style.element.appendChild(textNode); }
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/* script */
|
|
215
|
-
var __vue_script__ = script;
|
|
216
|
-
|
|
217
|
-
/* template */
|
|
218
|
-
var __vue_render__ = function() {
|
|
219
|
-
var _vm = this;
|
|
220
|
-
var _h = _vm.$createElement;
|
|
221
|
-
var _c = _vm._self._c || _h;
|
|
222
|
-
return _c(_vm.tag, { tag: "component", staticClass: "vs-focus-container" }, [
|
|
223
|
-
_vm.renderRedirector
|
|
224
|
-
? _c("span", {
|
|
225
|
-
staticClass: "vs-focus-container__focus-redirector",
|
|
226
|
-
attrs: { tabindex: "0" },
|
|
227
|
-
on: {
|
|
228
|
-
focus: function($event) {
|
|
229
|
-
return _vm.redirectFocus($event, { isTabbingForward: false })
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
})
|
|
233
|
-
: _vm._e(),
|
|
234
|
-
_vm._v(" "),
|
|
235
|
-
_c(
|
|
236
|
-
"div",
|
|
237
|
-
{
|
|
238
|
-
ref: "content",
|
|
239
|
-
staticClass: "vs-focus-container__content",
|
|
240
|
-
attrs: { tabindex: "-1" }
|
|
241
|
-
},
|
|
242
|
-
[_vm._t("default")],
|
|
243
|
-
2
|
|
244
|
-
),
|
|
245
|
-
_vm._v(" "),
|
|
246
|
-
!_vm.disabled && _vm.containFocus
|
|
247
|
-
? _c("span", {
|
|
248
|
-
ref: "lastFocusable",
|
|
249
|
-
staticClass: "vs-focus-container__last-focusable",
|
|
250
|
-
attrs: { tabindex: "-1" }
|
|
251
|
-
})
|
|
252
|
-
: _vm._e(),
|
|
253
|
-
_vm._v(" "),
|
|
254
|
-
_vm.renderRedirector
|
|
255
|
-
? _c("span", {
|
|
256
|
-
staticClass: "vs-focus-container__focus-redirector",
|
|
257
|
-
attrs: { tabindex: "0" },
|
|
258
|
-
on: {
|
|
259
|
-
focus: function($event) {
|
|
260
|
-
return _vm.redirectFocus($event, { isTabbingForward: true })
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
})
|
|
264
|
-
: _vm._e()
|
|
265
|
-
])
|
|
266
|
-
};
|
|
267
|
-
var __vue_staticRenderFns__ = [];
|
|
268
|
-
__vue_render__._withStripped = true;
|
|
269
|
-
|
|
270
|
-
/* style */
|
|
271
|
-
var __vue_inject_styles__ = function (inject) {
|
|
272
|
-
if (!inject) { return }
|
|
273
|
-
inject("data-v-798e8f34_0", { source: ".vs-focus-container__focus-redirector, .vs-focus-container__last-focusable {\n opacity: 0;\n position: absolute;\n}\n.vs-focus-container__content {\n outline: none;\n}", map: undefined, media: undefined });
|
|
274
|
-
|
|
275
|
-
};
|
|
276
|
-
/* scoped */
|
|
277
|
-
var __vue_scope_id__ = undefined;
|
|
278
|
-
/* module identifier */
|
|
279
|
-
var __vue_module_identifier__ = undefined;
|
|
280
|
-
/* functional template */
|
|
281
|
-
var __vue_is_functional_template__ = false;
|
|
282
|
-
/* style inject SSR */
|
|
283
|
-
|
|
284
|
-
/* style inject shadow dom */
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var __vue_component__ = /*#__PURE__*/normalizeComponent(
|
|
289
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
290
|
-
__vue_inject_styles__,
|
|
291
|
-
__vue_script__,
|
|
292
|
-
__vue_scope_id__,
|
|
293
|
-
__vue_is_functional_template__,
|
|
294
|
-
__vue_module_identifier__,
|
|
295
|
-
false,
|
|
296
|
-
createInjector,
|
|
297
|
-
undefined,
|
|
298
|
-
undefined
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Shamlessly adapted from dominus v6.0.1 :)
|
|
303
|
-
* https://github.com/bevacqua/dominus/blob/master/src/classes.js
|
|
304
|
-
*/
|
|
305
|
-
|
|
306
|
-
var trim = /^\s+|\s+$/g;
|
|
307
|
-
var whitespace = /\s+/g;
|
|
308
|
-
|
|
309
|
-
function isElementObject(o) {
|
|
310
|
-
return o && typeof o === 'object' && typeof o.nodeName === 'string' && o.nodeType === 1;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function isElement(o) {
|
|
314
|
-
var elementObjects = typeof HTMLElement === 'object';
|
|
315
|
-
return elementObjects ? o instanceof HTMLElement : isElementObject(o);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function classes(el) {
|
|
319
|
-
if (isElement(el)) {
|
|
320
|
-
return (el.getAttribute('class') || '').replace(trim, '').split(whitespace);
|
|
321
|
-
}
|
|
322
|
-
return [];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function interpret(input) {
|
|
326
|
-
return typeof input === 'string' ? input.replace(trim, '').split(whitespace) : input;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function set(el, input) {
|
|
330
|
-
if (isElement(el)) {
|
|
331
|
-
el.setAttribute('class', interpret(input).join(' '));
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function remove(el, input) {
|
|
336
|
-
var current = classes(el);
|
|
337
|
-
var values = interpret(input);
|
|
338
|
-
values.forEach(function (value) {
|
|
339
|
-
var i = current.indexOf(value);
|
|
340
|
-
if (i !== -1) {
|
|
341
|
-
current.splice(i, 1);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
set(el, current);
|
|
345
|
-
return current;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
function add(el, input) {
|
|
349
|
-
var current = remove(el, input);
|
|
350
|
-
var values = interpret(input);
|
|
351
|
-
current.push.apply(current, values);
|
|
352
|
-
set(el, current);
|
|
353
|
-
return current;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function contains(el, input) {
|
|
357
|
-
var current = classes(el);
|
|
358
|
-
var values = interpret(input);
|
|
359
|
-
return values.every(function (value) {
|
|
360
|
-
return current.indexOf(value) !== -1;
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
var classlist = {
|
|
365
|
-
add: add,
|
|
366
|
-
remove: remove,
|
|
367
|
-
contains: contains,
|
|
368
|
-
has: contains,
|
|
369
|
-
set: set,
|
|
370
|
-
get: classes,
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
//
|
|
374
|
-
|
|
375
|
-
var script$1 = {
|
|
376
|
-
name: 'VsModal',
|
|
377
|
-
|
|
378
|
-
components: {
|
|
379
|
-
VsFocusContainer: __vue_component__,
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
props: {
|
|
383
|
-
title: {
|
|
384
|
-
type: String,
|
|
385
|
-
default: 'Modal title',
|
|
386
|
-
},
|
|
387
|
-
alignTop: {
|
|
388
|
-
type: Boolean,
|
|
389
|
-
default: false,
|
|
390
|
-
},
|
|
391
|
-
alignTopMargin: {
|
|
392
|
-
type: Number,
|
|
393
|
-
default: 60,
|
|
394
|
-
},
|
|
395
|
-
size: {
|
|
396
|
-
type: String,
|
|
397
|
-
default: 'm',
|
|
398
|
-
},
|
|
399
|
-
role: {
|
|
400
|
-
type: String,
|
|
401
|
-
default: 'dialog',
|
|
402
|
-
},
|
|
403
|
-
transition: {
|
|
404
|
-
type: String,
|
|
405
|
-
default: 'slide-up',
|
|
406
|
-
},
|
|
407
|
-
removeHeader: {
|
|
408
|
-
type: Boolean,
|
|
409
|
-
default: false,
|
|
410
|
-
},
|
|
411
|
-
removeCloseButton: {
|
|
412
|
-
type: Boolean,
|
|
413
|
-
default: false,
|
|
414
|
-
},
|
|
415
|
-
preventShift: {
|
|
416
|
-
type: Boolean,
|
|
417
|
-
default: false,
|
|
418
|
-
},
|
|
419
|
-
dismissible: {
|
|
420
|
-
type: Boolean,
|
|
421
|
-
default: true,
|
|
422
|
-
},
|
|
423
|
-
dismissOn: {
|
|
424
|
-
type: String,
|
|
425
|
-
default: 'backdrop esc close-button',
|
|
426
|
-
},
|
|
427
|
-
backdropBlur: {
|
|
428
|
-
type: Boolean,
|
|
429
|
-
default: false,
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
|
|
433
|
-
data: function data() {
|
|
434
|
-
return {
|
|
435
|
-
isOpen: false,
|
|
436
|
-
lastFocusedElement: null,
|
|
437
|
-
};
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
computed: {
|
|
441
|
-
classes: function classes() {
|
|
442
|
-
return [
|
|
443
|
-
("vs-modal--size-" + (this.size)),
|
|
444
|
-
{ 'has-footer': this.hasFooter },
|
|
445
|
-
{ 'is-open': this.isOpen },
|
|
446
|
-
{ 'is-aligned-top': this.alignTop },
|
|
447
|
-
{ 'is-backdrop-blur': this.backdropBlur } ];
|
|
448
|
-
},
|
|
449
|
-
|
|
450
|
-
alignTopStyle: function alignTopStyle() {
|
|
451
|
-
if (this.alignTop) {
|
|
452
|
-
return { 'padding-top': ((this.alignTopMargin) + "px") };
|
|
453
|
-
}
|
|
454
|
-
return null;
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
toggleTransition: function toggleTransition() {
|
|
458
|
-
return ("vs-modal--transition-" + (this.transition));
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
hasFooter: function hasFooter() {
|
|
462
|
-
return Boolean(this.$slots.footer);
|
|
463
|
-
},
|
|
464
|
-
|
|
465
|
-
dismissOnBackdrop: function dismissOnBackdrop() {
|
|
466
|
-
return this.dismissOn.indexOf('backdrop') > -1;
|
|
467
|
-
},
|
|
468
|
-
|
|
469
|
-
dismissOnCloseButton: function dismissOnCloseButton() {
|
|
470
|
-
return this.dismissOn.indexOf('close-button') > -1;
|
|
471
|
-
},
|
|
472
|
-
|
|
473
|
-
dismissOnEsc: function dismissOnEsc() {
|
|
474
|
-
return this.dismissOn.indexOf('esc') > -1;
|
|
475
|
-
},
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
watch: {
|
|
479
|
-
isOpen: function isOpen() {
|
|
480
|
-
var this$1 = this;
|
|
481
|
-
|
|
482
|
-
this.$nextTick(function () {
|
|
483
|
-
this$1[this$1.isOpen ? 'onOpen' : 'onClose']();
|
|
484
|
-
});
|
|
485
|
-
},
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
beforeDestroy: function beforeDestroy() {
|
|
489
|
-
if (this.isOpen) {
|
|
490
|
-
this.returnFocus();
|
|
491
|
-
}
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
methods: {
|
|
495
|
-
open: function open() {
|
|
496
|
-
this.isOpen = true;
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
close: function close() {
|
|
500
|
-
if (!this.dismissible) {
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
this.isOpen = false;
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* ccessabiliy fix
|
|
508
|
-
*/
|
|
509
|
-
redirectFocus: function redirectFocus() {
|
|
510
|
-
this.$refs.focusContainer.focus();
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
returnFocus: function returnFocus() {
|
|
514
|
-
if (this.lastFocusedElement) {
|
|
515
|
-
this.lastFocusedElement.focus();
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Dismiss modal on backdrop click
|
|
521
|
-
*/
|
|
522
|
-
onBackdropClick: function onBackdropClick() {
|
|
523
|
-
if (this.dismissOnBackdrop) {
|
|
524
|
-
this.close();
|
|
525
|
-
} else {
|
|
526
|
-
this.redirectFocus();
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Dismiss modal on esc key
|
|
532
|
-
*/
|
|
533
|
-
onEsc: function onEsc() {
|
|
534
|
-
if (this.dismissOnEsc) {
|
|
535
|
-
this.close();
|
|
536
|
-
}
|
|
537
|
-
},
|
|
538
|
-
|
|
539
|
-
/*
|
|
540
|
-
* Add modal open class on body tag (good for future cases if modications are required)
|
|
541
|
-
*/
|
|
542
|
-
onOpen: function onOpen() {
|
|
543
|
-
this.lastFocusedElement = document.activeElement;
|
|
544
|
-
this.$refs.focusContainer.focus();
|
|
545
|
-
|
|
546
|
-
classlist.add(document.body, 'vs-modal--is-open');
|
|
547
|
-
this.incrementOpenModalCount();
|
|
548
|
-
|
|
549
|
-
this.$emit('open');
|
|
550
|
-
},
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Emitted when modal starts to close
|
|
554
|
-
*/
|
|
555
|
-
onClose: function onClose() {
|
|
556
|
-
this.$emit('close');
|
|
557
|
-
this.returnFocus();
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Emitted after transition is done and opened
|
|
562
|
-
*/
|
|
563
|
-
onEnter: function onEnter() {
|
|
564
|
-
this.$emit('reveal');
|
|
565
|
-
},
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Emitted after transition is done and closes
|
|
569
|
-
*/
|
|
570
|
-
onLeave: function onLeave() {
|
|
571
|
-
this.$emit('hide');
|
|
572
|
-
var newCount = this.decrementOpenModalCount();
|
|
573
|
-
|
|
574
|
-
// Remove modal open class on body tag
|
|
575
|
-
if (newCount === 0) {
|
|
576
|
-
classlist.remove(document.body, 'vs-modal--is-open');
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
getOpenModalCount: function getOpenModalCount() {
|
|
581
|
-
var count = document.body.getAttribute('data-open-modals');
|
|
582
|
-
return count === undefined ? 0 : Number(count);
|
|
583
|
-
},
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Set no. of modals open data attribute
|
|
587
|
-
*/
|
|
588
|
-
setOpenModalCount: function setOpenModalCount(count) {
|
|
589
|
-
var normalizedCount = Math.max(0, count);
|
|
590
|
-
if (normalizedCount === 0) {
|
|
591
|
-
document.body.removeAttribute('data-open-modals');
|
|
592
|
-
} else {
|
|
593
|
-
document.body.setAttribute('data-open-modals', normalizedCount);
|
|
594
|
-
}
|
|
595
|
-
return normalizedCount;
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Used if nested modals get activated
|
|
600
|
-
*/
|
|
601
|
-
incrementOpenModalCount: function incrementOpenModalCount() {
|
|
602
|
-
return this.setOpenModalCount(this.getOpenModalCount() + 1);
|
|
603
|
-
},
|
|
604
|
-
|
|
605
|
-
decrementOpenModalCount: function decrementOpenModalCount() {
|
|
606
|
-
return this.setOpenModalCount(this.getOpenModalCount() - 1);
|
|
607
|
-
},
|
|
608
|
-
},
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAGFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWNxwqAAAAB3RSTlMAJeTmmCIcbPbyAQAAAOtJREFUSMeF1ksKwjAURuE6cF50BY4cC4oLEHQquAVXYIVs3wiFn3C4nA76SG+/PpLc2+l9fk7lsr3dp0c71QH79p2ubZmr85t+sgshCHTh1UIQaJe+DkFgmddNBZyyLYGRIAACAAgA2SeAAwI5OowBu/WaEJ95AI4BQBD4N6xEgFyQFsSTYDgJAmgkkFYCIACAAABiAEgAABGgIAIURICCCFAQAEAQYIDewh9SX9M/lH5q7yztbh8wOuR80Oqw94mjU88nr05/TyCagjyJaRr0RKqp2JO5lgMvKFqStKhpWbTC6qVZi7v+HvwAcK2oz9BduqwAAAAASUVORK5CYII=";
|
|
612
|
-
|
|
613
|
-
/* script */
|
|
614
|
-
var __vue_script__$1 = script$1;
|
|
615
|
-
var __vue_render__$1 = function() {
|
|
616
|
-
var _vm = this;
|
|
617
|
-
var _h = _vm.$createElement;
|
|
618
|
-
var _c = _vm._self._c || _h;
|
|
619
|
-
return _c(
|
|
620
|
-
"transition",
|
|
621
|
-
{
|
|
622
|
-
attrs: { name: _vm.toggleTransition },
|
|
623
|
-
on: { "after-enter": _vm.onEnter, "after-leave": _vm.onLeave }
|
|
624
|
-
},
|
|
625
|
-
[
|
|
626
|
-
_c(
|
|
627
|
-
"div",
|
|
628
|
-
{
|
|
629
|
-
directives: [
|
|
630
|
-
{
|
|
631
|
-
name: "show",
|
|
632
|
-
rawName: "v-show",
|
|
633
|
-
value: _vm.isOpen,
|
|
634
|
-
expression: "isOpen"
|
|
635
|
-
}
|
|
636
|
-
],
|
|
637
|
-
staticClass: "vs-modal vs-modal__mask",
|
|
638
|
-
class: _vm.classes,
|
|
639
|
-
attrs: { role: _vm.role },
|
|
640
|
-
on: {
|
|
641
|
-
click: function($event) {
|
|
642
|
-
if ($event.target !== $event.currentTarget) {
|
|
643
|
-
return null
|
|
644
|
-
}
|
|
645
|
-
return _vm.onBackdropClick($event)
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
},
|
|
649
|
-
[
|
|
650
|
-
_c(
|
|
651
|
-
"div",
|
|
652
|
-
{
|
|
653
|
-
staticClass: "vs-modal__wrapper",
|
|
654
|
-
class: { "has-dummy-scrollbar": _vm.preventShift },
|
|
655
|
-
style: _vm.alignTopStyle,
|
|
656
|
-
on: {
|
|
657
|
-
click: function($event) {
|
|
658
|
-
if ($event.target !== $event.currentTarget) {
|
|
659
|
-
return null
|
|
660
|
-
}
|
|
661
|
-
return _vm.onBackdropClick($event)
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
[
|
|
666
|
-
_c(
|
|
667
|
-
"vs-focus-container",
|
|
668
|
-
{
|
|
669
|
-
ref: "focusContainer",
|
|
670
|
-
staticClass: "vs-modal__container",
|
|
671
|
-
attrs: { tabindex: "-1" },
|
|
672
|
-
nativeOn: {
|
|
673
|
-
keydown: function($event) {
|
|
674
|
-
if (
|
|
675
|
-
!$event.type.indexOf("key") &&
|
|
676
|
-
_vm._k($event.keyCode, "esc", 27, $event.key, [
|
|
677
|
-
"Esc",
|
|
678
|
-
"Escape"
|
|
679
|
-
])
|
|
680
|
-
) {
|
|
681
|
-
return null
|
|
682
|
-
}
|
|
683
|
-
$event.stopPropagation();
|
|
684
|
-
return _vm.onEsc($event)
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
[
|
|
689
|
-
!_vm.removeHeader
|
|
690
|
-
? _c(
|
|
691
|
-
"div",
|
|
692
|
-
{ staticClass: "vs-modal__header" },
|
|
693
|
-
[
|
|
694
|
-
_vm._t("header", [
|
|
695
|
-
_c("h2", { staticClass: "vs-modal__header-text" }, [
|
|
696
|
-
_vm._v(_vm._s(_vm.title))
|
|
697
|
-
])
|
|
698
|
-
])
|
|
699
|
-
],
|
|
700
|
-
2
|
|
701
|
-
)
|
|
702
|
-
: _vm._e(),
|
|
703
|
-
_vm._v(" "),
|
|
704
|
-
_c(
|
|
705
|
-
"div",
|
|
706
|
-
{ staticClass: "vs-modal__close-button" },
|
|
707
|
-
[
|
|
708
|
-
_vm._t("close", [
|
|
709
|
-
_vm.dismissOnCloseButton &&
|
|
710
|
-
!_vm.removeCloseButton &&
|
|
711
|
-
_vm.dismissible
|
|
712
|
-
? _c("button", { on: { click: _vm.close } }, [
|
|
713
|
-
_c("img", {
|
|
714
|
-
attrs: {
|
|
715
|
-
src: img,
|
|
716
|
-
alt: "close"
|
|
717
|
-
}
|
|
718
|
-
})
|
|
719
|
-
])
|
|
720
|
-
: _vm._e()
|
|
721
|
-
])
|
|
722
|
-
],
|
|
723
|
-
2
|
|
724
|
-
),
|
|
725
|
-
_vm._v(" "),
|
|
726
|
-
_c(
|
|
727
|
-
"div",
|
|
728
|
-
{ staticClass: "vs-modal__body" },
|
|
729
|
-
[_vm._t("default")],
|
|
730
|
-
2
|
|
731
|
-
),
|
|
732
|
-
_vm._v(" "),
|
|
733
|
-
_vm.hasFooter
|
|
734
|
-
? _c(
|
|
735
|
-
"div",
|
|
736
|
-
{ staticClass: "vs-modal__footer" },
|
|
737
|
-
[_vm._t("footer")],
|
|
738
|
-
2
|
|
739
|
-
)
|
|
740
|
-
: _vm._e()
|
|
741
|
-
]
|
|
742
|
-
)
|
|
743
|
-
],
|
|
744
|
-
1
|
|
745
|
-
)
|
|
746
|
-
]
|
|
747
|
-
)
|
|
748
|
-
]
|
|
749
|
-
)
|
|
750
|
-
};
|
|
751
|
-
var __vue_staticRenderFns__$1 = [];
|
|
752
|
-
__vue_render__$1._withStripped = true;
|
|
753
|
-
|
|
754
|
-
/* style */
|
|
755
|
-
var __vue_inject_styles__$1 = function (inject) {
|
|
756
|
-
if (!inject) { return }
|
|
757
|
-
inject("data-v-8b4650e6_0", { source: ".vs-modal {\n font-size: 0.875em;\n}\n.vs-modal.is-aligned-top .vs-modal__wrapper {\n vertical-align: initial;\n}\n.vs-modal.is-aligned-top.has-footer .vs-modal__body {\n max-height: calc(100vh - 125px);\n}\n.vs-modal.has-footer .vs-modal__body {\n max-height: calc(100vh - 125px);\n}\n.vs-modal:not(.has-footer) .vs-modal__body {\n padding: 21px 24px;\n}\n.vs-modal--is-open {\n overflow: hidden;\n}\n.vs-modal.is-backdrop-blur {\n backdrop-filter: blur(3px);\n}\n.vs-modal__mask {\n display: table;\n position: fixed;\n z-index: 800;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n transition: opacity 0.3s ease;\n background-color: rgba(51, 51, 51, 0.5);\n}\n.vs-modal__wrapper {\n display: table-cell;\n overflow-x: hidden;\n text-align: center;\n vertical-align: middle;\n}\n.vs-modal__wrapper.has-dummy-scrollbar {\n overflow-y: scroll;\n}\n.vs-modal__container {\n display: inline-block;\n position: relative;\n width: 530px;\n max-width: 100vw;\n max-height: 100vh;\n margin: 0 auto;\n padding: 0;\n overflow: hidden;\n transition: all 0.3s ease;\n border-radius: 3px;\n outline: none;\n background-color: #ffffff;\n box-shadow: 0 2px 8px rgba(51, 51, 51, 0.33);\n text-align: initial;\n}\n.vs-modal__header {\n display: flex;\n position: relative;\n z-index: 1;\n align-items: center;\n min-height: 55px;\n padding: 0 24px;\n}\n.vs-modal__header-text {\n display: flex;\n flex-grow: 1;\n align-items: center;\n margin: 0;\n font-size: 1.125em;\n font-weight: normal;\n}\n.vs-modal__close-button button {\n position: absolute;\n z-index: 100;\n top: 20px;\n right: 20px;\n background: none;\n border: none;\n text-align: right;\n margin: 0;\n padding: 0;\n cursor: pointer;\n}\n.vs-modal__close-button button img {\n width: 12px;\n height: 12px;\n}\n.vs-modal__body {\n max-height: calc(100vh - 55px);\n padding: 16px 24px;\n overflow-y: auto;\n}\n.vs-modal__footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n height: 70px;\n padding: 0 24px;\n}\n.vs-modal--size-s > .vs-modal__wrapper > .vs-modal__container {\n width: 320px;\n}\n.vs-modal--size-l > .vs-modal__wrapper > .vs-modal__container {\n width: 850px;\n}\n.vs-modal--size-fullscreen > .vs-modal__wrapper > .vs-modal__container {\n width: 100vw;\n border-radius: 0;\n}\n.vs-modal--size-fullscreen > .vs-modal__wrapper > .vs-modal__container .vs-modal__body {\n height: 100vh;\n max-height: 100vh;\n}\n.vs-modal--size-auto > .vs-modal__wrapper > .vs-modal__container {\n width: initial;\n}\n.vs-modal--transition-fade-enter, .vs-modal--transition-fade-leave-active {\n opacity: 0;\n}\n.vs-modal--transition-slide-up-enter, .vs-modal--transition-slide-up-leave-active {\n opacity: 0;\n}\n.vs-modal--transition-slide-up-enter .vs-modal__container, .vs-modal--transition-slide-up-leave-active .vs-modal__container {\n transform: translateY(20px);\n}\n.vs-modal--transition-slide-down-enter, .vs-modal--transition-slide-down-leave-active {\n opacity: 0;\n}\n.vs-modal--transition-slide-down-enter .vs-modal__container, .vs-modal--transition-slide-down-leave-active .vs-modal__container {\n transform: translateY(-20px);\n}", map: undefined, media: undefined });
|
|
758
|
-
|
|
759
|
-
};
|
|
760
|
-
/* scoped */
|
|
761
|
-
var __vue_scope_id__$1 = undefined;
|
|
762
|
-
/* module identifier */
|
|
763
|
-
var __vue_module_identifier__$1 = undefined;
|
|
764
|
-
/* functional template */
|
|
765
|
-
var __vue_is_functional_template__$1 = false;
|
|
766
|
-
/* style inject SSR */
|
|
767
|
-
|
|
768
|
-
/* style inject shadow dom */
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
var __vue_component__$1 = /*#__PURE__*/normalizeComponent(
|
|
773
|
-
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
|
|
774
|
-
__vue_inject_styles__$1,
|
|
775
|
-
__vue_script__$1,
|
|
776
|
-
__vue_scope_id__$1,
|
|
777
|
-
__vue_is_functional_template__$1,
|
|
778
|
-
__vue_module_identifier__$1,
|
|
779
|
-
false,
|
|
780
|
-
createInjector,
|
|
781
|
-
undefined,
|
|
782
|
-
undefined
|
|
783
|
-
);
|
|
784
|
-
|
|
785
|
-
// Import vue component
|
|
786
|
-
|
|
787
|
-
// Declare install function executed by Vue.use()
|
|
788
|
-
function install(Vue) {
|
|
789
|
-
if (install.installed) { return; }
|
|
790
|
-
install.installed = true;
|
|
791
|
-
Vue.component('VsModal', __vue_component__$1);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
// Create module definition for Vue.use()
|
|
795
|
-
var plugin = {
|
|
796
|
-
install: install,
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
// Auto-install when vue is found (eg. in browser via <script> tag)
|
|
800
|
-
var GlobalVue = null;
|
|
801
|
-
if (typeof window !== 'undefined') {
|
|
802
|
-
GlobalVue = window.Vue;
|
|
803
|
-
} else if (typeof global !== 'undefined') {
|
|
804
|
-
GlobalVue = global.Vue;
|
|
805
|
-
}
|
|
806
|
-
if (GlobalVue) {
|
|
807
|
-
GlobalVue.use(plugin);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
export default __vue_component__$1;
|
|
811
|
-
export { install };
|