Comparing version 0.1.6 to 0.2.0-alpha.0
@@ -129,7 +129,84 @@ 'use strict'; | ||
function normalizeComponent(compiledTemplate, injectStyle, defaultExport, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, isShadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof isShadowMode === 'function') { | ||
createInjectorSSR = createInjector; | ||
createInjector = isShadowMode; | ||
isShadowMode = false; | ||
} | ||
// Vue.extend constructor export interop | ||
const options = typeof defaultExport === 'function' ? defaultExport.options : defaultExport; | ||
// render functions | ||
if (compiledTemplate && compiledTemplate.render) { | ||
options.render = compiledTemplate.render; | ||
options.staticRenderFns = compiledTemplate.staticRenderFns; | ||
options._compiled = true; | ||
// functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} | ||
// scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
} | ||
let hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function (context) { | ||
// 2.3 injection | ||
context = | ||
context || // cached call | ||
(this.$vnode && this.$vnode.ssrContext) || // stateful | ||
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
// inject component styles | ||
if (injectStyle) { | ||
injectStyle.call(this, createInjectorSSR(context)); | ||
} | ||
// register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
// used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} | ||
else if (injectStyle) { | ||
hook = isShadowMode | ||
? function () { | ||
injectStyle.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); | ||
} | ||
: function (context) { | ||
injectStyle.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
const originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} | ||
else { | ||
// inject component registration as beforeCreate hook | ||
const existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return defaultExport; | ||
} | ||
/* script */ | ||
var __vue_script__ = script; | ||
var __vue_script__ = script; | ||
// For security concerns, we use only base name in production mode. See https://github.com/vuejs/rollup-plugin-vue/issues/258 | ||
script.__file = "DefaultLayout.vue"; | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"dialog-layout"},[_vm._t("default")],2)}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"dialog-layout"},[_c('div',{ref:"dialog-instance"})])}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -145,93 +222,4 @@ | ||
var __vue_is_functional_template__ = false; | ||
/* component normalizer */ | ||
function __vue_normalize__( | ||
template, style, script$$1, | ||
scope, functional, moduleIdentifier, | ||
createInjector, createInjectorSSR | ||
) { | ||
var component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {}; | ||
// For security concerns, we use only base name in production mode. | ||
component.__file = "DefaultLayout.vue"; | ||
if (!component.render) { | ||
component.render = template.render; | ||
component.staticRenderFns = template.staticRenderFns; | ||
component._compiled = true; | ||
if (functional) { component.functional = true; } | ||
} | ||
component._scopeId = scope; | ||
return component | ||
} | ||
/* style inject */ | ||
function __vue_create_injector__() { | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {}); | ||
var isOldIE = | ||
typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
return function addStyle(id, css) { | ||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) { return } // SSR styles are present. | ||
var group = isOldIE ? css.media || 'default' : id; | ||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined }); | ||
if (!style.ids.includes(id)) { | ||
var code = css.source; | ||
var index = style.ids.length; | ||
style.ids.push(id); | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (isOldIE) { | ||
style.element = style.element || document.querySelector('style[data-group=' + group + ']'); | ||
} | ||
if (!style.element) { | ||
var el = style.element = document.createElement('style'); | ||
el.type = 'text/css'; | ||
if (css.media) { el.setAttribute('media', css.media); } | ||
if (isOldIE) { | ||
el.setAttribute('data-group', group); | ||
el.setAttribute('data-next-index', '0'); | ||
} | ||
head.appendChild(el); | ||
} | ||
if (isOldIE) { | ||
index = parseInt(style.element.getAttribute('data-next-index')); | ||
style.element.setAttribute('data-next-index', index + 1); | ||
} | ||
if (style.element.styleSheet) { | ||
style.parts.push(code); | ||
style.element.styleSheet.cssText = style.parts | ||
.filter(Boolean) | ||
.join('\n'); | ||
} else { | ||
var textNode = document.createTextNode(code); | ||
var nodes = style.element.childNodes; | ||
if (nodes[index]) { style.element.removeChild(nodes[index]); } | ||
if (nodes.length) { style.element.insertBefore(textNode, nodes[index]); } | ||
else { style.element.appendChild(textNode); } | ||
} | ||
} | ||
} | ||
} | ||
/* style inject SSR */ | ||
@@ -241,3 +229,3 @@ | ||
var DefaultLayout = __vue_normalize__( | ||
var DefaultLayout = normalizeComponent( | ||
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, | ||
@@ -249,3 +237,3 @@ __vue_inject_styles__, | ||
__vue_module_identifier__, | ||
__vue_create_injector__, | ||
undefined, | ||
undefined | ||
@@ -331,3 +319,3 @@ ); | ||
return new Promise(function ($return, $error) { | ||
var LayoutCtor, layout, Component, dialog; | ||
var LayoutCtor, layout, Component, dialog, ref; | ||
if (Vue.prototype.$isServer) { return $return(); } // create layout | ||
@@ -376,5 +364,21 @@ | ||
// mounting | ||
dialog.$mount(); | ||
layout.$slots.default = dialog._vnode; | ||
dialog.$mount(); // layout.$slots.default = dialog._vnode | ||
// dialog.$on('hook:updated', () => { | ||
// layout.$slots.default = dialog._vnode | ||
// layout.$forceUpdate() | ||
// }) | ||
// } | ||
layout.$mount(); | ||
ref = layout.$refs['dialog-instance']; | ||
if (ref) { | ||
ref.$el ? ref.$el.appendChild(dialog.$el) : ref.appendChild(dialog.$el); | ||
} else { | ||
// if (process.env.NODE_ENV !== 'production') { | ||
// console.warn('Slot in layouts is deprecated. Please use <div ref="dialog-instance"/> instead') | ||
// } | ||
layout.$slots.default = dialog._vnode; | ||
} | ||
layout.$on('hook:destroyed', this._onDestroyed.bind(this)); | ||
@@ -760,3 +764,5 @@ layout.$on('submit', this.onReturn.bind(this)); | ||
/* script */ | ||
var __vue_script__$1 = script$1; | ||
var __vue_script__$1 = script$1; | ||
// For security concerns, we use only base name in production mode. See https://github.com/vuejs/rollup-plugin-vue/issues/258 | ||
script$1.__file = "DialogOverlay.vue"; | ||
/* template */ | ||
@@ -774,93 +780,4 @@ var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"opacity"}},[(_vm.visible)?_c('div',{staticClass:"dialog-overlay-loading",style:({zIndex: _vm.zIndex})},[_vm._v("\n Loading…\n ")]):_vm._e()])}; | ||
var __vue_is_functional_template__$1 = false; | ||
/* component normalizer */ | ||
function __vue_normalize__$1( | ||
template, style, script, | ||
scope, functional, moduleIdentifier, | ||
createInjector, createInjectorSSR | ||
) { | ||
var component = (typeof script === 'function' ? script.options : script) || {}; | ||
// For security concerns, we use only base name in production mode. | ||
component.__file = "DialogOverlay.vue"; | ||
if (!component.render) { | ||
component.render = template.render; | ||
component.staticRenderFns = template.staticRenderFns; | ||
component._compiled = true; | ||
if (functional) { component.functional = true; } | ||
} | ||
component._scopeId = scope; | ||
return component | ||
} | ||
/* style inject */ | ||
function __vue_create_injector__$1() { | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var styles = __vue_create_injector__$1.styles || (__vue_create_injector__$1.styles = {}); | ||
var isOldIE = | ||
typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
return function addStyle(id, css) { | ||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) { return } // SSR styles are present. | ||
var group = isOldIE ? css.media || 'default' : id; | ||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined }); | ||
if (!style.ids.includes(id)) { | ||
var code = css.source; | ||
var index = style.ids.length; | ||
style.ids.push(id); | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (isOldIE) { | ||
style.element = style.element || document.querySelector('style[data-group=' + group + ']'); | ||
} | ||
if (!style.element) { | ||
var el = style.element = document.createElement('style'); | ||
el.type = 'text/css'; | ||
if (css.media) { el.setAttribute('media', css.media); } | ||
if (isOldIE) { | ||
el.setAttribute('data-group', group); | ||
el.setAttribute('data-next-index', '0'); | ||
} | ||
head.appendChild(el); | ||
} | ||
if (isOldIE) { | ||
index = parseInt(style.element.getAttribute('data-next-index')); | ||
style.element.setAttribute('data-next-index', index + 1); | ||
} | ||
if (style.element.styleSheet) { | ||
style.parts.push(code); | ||
style.element.styleSheet.cssText = style.parts | ||
.filter(Boolean) | ||
.join('\n'); | ||
} else { | ||
var textNode = document.createTextNode(code); | ||
var nodes = style.element.childNodes; | ||
if (nodes[index]) { style.element.removeChild(nodes[index]); } | ||
if (nodes.length) { style.element.insertBefore(textNode, nodes[index]); } | ||
else { style.element.appendChild(textNode); } | ||
} | ||
} | ||
} | ||
} | ||
/* style inject SSR */ | ||
@@ -870,3 +787,3 @@ | ||
var Overlay$1 = __vue_normalize__$1( | ||
var Overlay$1 = normalizeComponent( | ||
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, | ||
@@ -878,3 +795,3 @@ __vue_inject_styles__$1, | ||
__vue_module_identifier__$1, | ||
__vue_create_injector__$1, | ||
undefined, | ||
undefined | ||
@@ -1078,3 +995,3 @@ ); | ||
text: { | ||
type: String, | ||
type: [String, Function], | ||
reqiured: true | ||
@@ -1081,0 +998,0 @@ }, |
@@ -123,7 +123,84 @@ import Vue from 'vue'; | ||
function normalizeComponent(compiledTemplate, injectStyle, defaultExport, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, isShadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof isShadowMode === 'function') { | ||
createInjectorSSR = createInjector; | ||
createInjector = isShadowMode; | ||
isShadowMode = false; | ||
} | ||
// Vue.extend constructor export interop | ||
const options = typeof defaultExport === 'function' ? defaultExport.options : defaultExport; | ||
// render functions | ||
if (compiledTemplate && compiledTemplate.render) { | ||
options.render = compiledTemplate.render; | ||
options.staticRenderFns = compiledTemplate.staticRenderFns; | ||
options._compiled = true; | ||
// functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} | ||
// scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
} | ||
let hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function (context) { | ||
// 2.3 injection | ||
context = | ||
context || // cached call | ||
(this.$vnode && this.$vnode.ssrContext) || // stateful | ||
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
// inject component styles | ||
if (injectStyle) { | ||
injectStyle.call(this, createInjectorSSR(context)); | ||
} | ||
// register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
// used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} | ||
else if (injectStyle) { | ||
hook = isShadowMode | ||
? function () { | ||
injectStyle.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); | ||
} | ||
: function (context) { | ||
injectStyle.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
const originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} | ||
else { | ||
// inject component registration as beforeCreate hook | ||
const existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return defaultExport; | ||
} | ||
/* script */ | ||
var __vue_script__ = script; | ||
var __vue_script__ = script; | ||
// For security concerns, we use only base name in production mode. See https://github.com/vuejs/rollup-plugin-vue/issues/258 | ||
script.__file = "DefaultLayout.vue"; | ||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"dialog-layout"},[_vm._t("default")],2)}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"dialog-layout"},[_c('div',{ref:"dialog-instance"})])}; | ||
var __vue_staticRenderFns__ = []; | ||
@@ -139,93 +216,4 @@ | ||
var __vue_is_functional_template__ = false; | ||
/* component normalizer */ | ||
function __vue_normalize__( | ||
template, style, script$$1, | ||
scope, functional, moduleIdentifier, | ||
createInjector, createInjectorSSR | ||
) { | ||
var component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {}; | ||
// For security concerns, we use only base name in production mode. | ||
component.__file = "DefaultLayout.vue"; | ||
if (!component.render) { | ||
component.render = template.render; | ||
component.staticRenderFns = template.staticRenderFns; | ||
component._compiled = true; | ||
if (functional) { component.functional = true; } | ||
} | ||
component._scopeId = scope; | ||
return component | ||
} | ||
/* style inject */ | ||
function __vue_create_injector__() { | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {}); | ||
var isOldIE = | ||
typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
return function addStyle(id, css) { | ||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) { return } // SSR styles are present. | ||
var group = isOldIE ? css.media || 'default' : id; | ||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined }); | ||
if (!style.ids.includes(id)) { | ||
var code = css.source; | ||
var index = style.ids.length; | ||
style.ids.push(id); | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (isOldIE) { | ||
style.element = style.element || document.querySelector('style[data-group=' + group + ']'); | ||
} | ||
if (!style.element) { | ||
var el = style.element = document.createElement('style'); | ||
el.type = 'text/css'; | ||
if (css.media) { el.setAttribute('media', css.media); } | ||
if (isOldIE) { | ||
el.setAttribute('data-group', group); | ||
el.setAttribute('data-next-index', '0'); | ||
} | ||
head.appendChild(el); | ||
} | ||
if (isOldIE) { | ||
index = parseInt(style.element.getAttribute('data-next-index')); | ||
style.element.setAttribute('data-next-index', index + 1); | ||
} | ||
if (style.element.styleSheet) { | ||
style.parts.push(code); | ||
style.element.styleSheet.cssText = style.parts | ||
.filter(Boolean) | ||
.join('\n'); | ||
} else { | ||
var textNode = document.createTextNode(code); | ||
var nodes = style.element.childNodes; | ||
if (nodes[index]) { style.element.removeChild(nodes[index]); } | ||
if (nodes.length) { style.element.insertBefore(textNode, nodes[index]); } | ||
else { style.element.appendChild(textNode); } | ||
} | ||
} | ||
} | ||
} | ||
/* style inject SSR */ | ||
@@ -235,3 +223,3 @@ | ||
var DefaultLayout = __vue_normalize__( | ||
var DefaultLayout = normalizeComponent( | ||
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, | ||
@@ -243,3 +231,3 @@ __vue_inject_styles__, | ||
__vue_module_identifier__, | ||
__vue_create_injector__, | ||
undefined, | ||
undefined | ||
@@ -325,3 +313,3 @@ ); | ||
return new Promise(function ($return, $error) { | ||
var LayoutCtor, layout, Component, dialog; | ||
var LayoutCtor, layout, Component, dialog, ref; | ||
if (Vue.prototype.$isServer) { return $return(); } // create layout | ||
@@ -370,5 +358,21 @@ | ||
// mounting | ||
dialog.$mount(); | ||
layout.$slots.default = dialog._vnode; | ||
dialog.$mount(); // layout.$slots.default = dialog._vnode | ||
// dialog.$on('hook:updated', () => { | ||
// layout.$slots.default = dialog._vnode | ||
// layout.$forceUpdate() | ||
// }) | ||
// } | ||
layout.$mount(); | ||
ref = layout.$refs['dialog-instance']; | ||
if (ref) { | ||
ref.$el ? ref.$el.appendChild(dialog.$el) : ref.appendChild(dialog.$el); | ||
} else { | ||
// if (process.env.NODE_ENV !== 'production') { | ||
// console.warn('Slot in layouts is deprecated. Please use <div ref="dialog-instance"/> instead') | ||
// } | ||
layout.$slots.default = dialog._vnode; | ||
} | ||
layout.$on('hook:destroyed', this._onDestroyed.bind(this)); | ||
@@ -754,3 +758,5 @@ layout.$on('submit', this.onReturn.bind(this)); | ||
/* script */ | ||
var __vue_script__$1 = script$1; | ||
var __vue_script__$1 = script$1; | ||
// For security concerns, we use only base name in production mode. See https://github.com/vuejs/rollup-plugin-vue/issues/258 | ||
script$1.__file = "DialogOverlay.vue"; | ||
/* template */ | ||
@@ -768,93 +774,4 @@ var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":"opacity"}},[(_vm.visible)?_c('div',{staticClass:"dialog-overlay-loading",style:({zIndex: _vm.zIndex})},[_vm._v("\n Loading…\n ")]):_vm._e()])}; | ||
var __vue_is_functional_template__$1 = false; | ||
/* component normalizer */ | ||
function __vue_normalize__$1( | ||
template, style, script, | ||
scope, functional, moduleIdentifier, | ||
createInjector, createInjectorSSR | ||
) { | ||
var component = (typeof script === 'function' ? script.options : script) || {}; | ||
// For security concerns, we use only base name in production mode. | ||
component.__file = "DialogOverlay.vue"; | ||
if (!component.render) { | ||
component.render = template.render; | ||
component.staticRenderFns = template.staticRenderFns; | ||
component._compiled = true; | ||
if (functional) { component.functional = true; } | ||
} | ||
component._scopeId = scope; | ||
return component | ||
} | ||
/* style inject */ | ||
function __vue_create_injector__$1() { | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var styles = __vue_create_injector__$1.styles || (__vue_create_injector__$1.styles = {}); | ||
var isOldIE = | ||
typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
return function addStyle(id, css) { | ||
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) { return } // SSR styles are present. | ||
var group = isOldIE ? css.media || 'default' : id; | ||
var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined }); | ||
if (!style.ids.includes(id)) { | ||
var code = css.source; | ||
var index = style.ids.length; | ||
style.ids.push(id); | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (isOldIE) { | ||
style.element = style.element || document.querySelector('style[data-group=' + group + ']'); | ||
} | ||
if (!style.element) { | ||
var el = style.element = document.createElement('style'); | ||
el.type = 'text/css'; | ||
if (css.media) { el.setAttribute('media', css.media); } | ||
if (isOldIE) { | ||
el.setAttribute('data-group', group); | ||
el.setAttribute('data-next-index', '0'); | ||
} | ||
head.appendChild(el); | ||
} | ||
if (isOldIE) { | ||
index = parseInt(style.element.getAttribute('data-next-index')); | ||
style.element.setAttribute('data-next-index', index + 1); | ||
} | ||
if (style.element.styleSheet) { | ||
style.parts.push(code); | ||
style.element.styleSheet.cssText = style.parts | ||
.filter(Boolean) | ||
.join('\n'); | ||
} else { | ||
var textNode = document.createTextNode(code); | ||
var nodes = style.element.childNodes; | ||
if (nodes[index]) { style.element.removeChild(nodes[index]); } | ||
if (nodes.length) { style.element.insertBefore(textNode, nodes[index]); } | ||
else { style.element.appendChild(textNode); } | ||
} | ||
} | ||
} | ||
} | ||
/* style inject SSR */ | ||
@@ -864,3 +781,3 @@ | ||
var Overlay$1 = __vue_normalize__$1( | ||
var Overlay$1 = normalizeComponent( | ||
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, | ||
@@ -872,3 +789,3 @@ __vue_inject_styles__$1, | ||
__vue_module_identifier__$1, | ||
__vue_create_injector__$1, | ||
undefined, | ||
undefined | ||
@@ -1072,3 +989,3 @@ ); | ||
text: { | ||
type: String, | ||
type: [String, Function], | ||
reqiured: true | ||
@@ -1075,0 +992,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n(t.vuedl={},t.Vue)}(this,function(t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var e={computed:{$parameters:function(){return this.$options.propsData},isNewRecord:function(){return!this.$options.primaryKey||!this.$options.propsData||!this.$options.propsData[this.$options.primaryKey]}}},r={name:"Activable",data:function(){return{isActive:!1}},watch:{isActive:function(t){this._dialogInstance?void 0!==this._dialogInstance.isActive&&(this._dialogInstance.isActive=t):this.$parent&&void 0!==this.$parent.isActive&&(this.$parent.isActive=t)}},methods:{close:function(){this.isActive=!1}}},o={name:"Layoutable",mixins:[r],props:{width:{type:[String,Number],default:function(){return 450}},persistent:Boolean},data:function(){return{loading:!1}},computed:{isLayout:function(){return!0},getWidth:function(){return"string"==typeof this.width?this.width:this.width+"px"}},watch:{isActive:function(t){t||this._destroy()}},mounted:function(){this.isActive=!0},methods:{_destroy:function(){this.$destroy()},dismiss:function(){this.persistent||this.loading||(this.isActive=!1)},close:function(){this.isActive=!1}},beforeDestroy:function(){"function"==typeof this.$el.remove?this.$el.remove():this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}};var i=function(){this.__data__=[],this.size=0};var s=function(t,n){return t===n||t!=t&&n!=n};var a=function(t,n){for(var e=t.length;e--;)if(s(t[e][0],n))return e;return-1},u=Array.prototype.splice;var c=function(t){var n=this.__data__,e=a(n,t);return!(e<0||(e==n.length-1?n.pop():u.call(n,e,1),--this.size,0))};var f=function(t){var n=this.__data__,e=a(n,t);return e<0?void 0:n[e][1]};var l=function(t){return a(this.__data__,t)>-1};var h=function(t,n){var e=this.__data__,r=a(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this};function p(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}p.prototype.clear=i,p.prototype.delete=c,p.prototype.get=f,p.prototype.has=l,p.prototype.set=h;var v=p;var d=function(){this.__data__=new v,this.size=0};var y=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e};var _=function(t){return this.__data__.get(t)};var m=function(t){return this.__data__.has(t)},b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(t,n){return t(n={exports:{}},n.exports),n.exports}var w="object"==typeof b&&b&&b.Object===Object&&b,j="object"==typeof self&&self&&self.Object===Object&&self,A=w||j||Function("return this")(),O=A.Symbol,$=Object.prototype,x=$.hasOwnProperty,P=$.toString,D=O?O.toStringTag:void 0;var C=function(t){var n=x.call(t,D),e=t[D];try{t[D]=void 0}catch(t){}var r=P.call(t);return n?t[D]=e:delete t[D],r},z=Object.prototype.toString;var S=function(t){return z.call(t)},T="[object Null]",E="[object Undefined]",R=O?O.toStringTag:void 0;var F=function(t){return null==t?void 0===t?E:T:R&&R in Object(t)?C(t):S(t)};var I=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)},L="[object AsyncFunction]",N="[object Function]",V="[object GeneratorFunction]",k="[object Proxy]";var B,W=function(t){if(!I(t))return!1;var n=F(t);return n==N||n==V||n==L||n==k},q=A["__core-js_shared__"],U=(B=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"";var K=function(t){return!!U&&U in t},G=Function.prototype.toString;var J=function(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""},H=/^\[object .+?Constructor\]$/,Q=Function.prototype,X=Object.prototype,Y=Q.toString,Z=X.hasOwnProperty,M=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var tt=function(t){return!(!I(t)||K(t))&&(W(t)?M:H).test(J(t))};var nt=function(t,n){return null==t?void 0:t[n]};var et=function(t,n){var e=nt(t,n);return tt(e)?e:void 0},rt=et(A,"Map"),ot=et(Object,"create");var it=function(){this.__data__=ot?ot(null):{},this.size=0};var st=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},at="__lodash_hash_undefined__",ut=Object.prototype.hasOwnProperty;var ct=function(t){var n=this.__data__;if(ot){var e=n[t];return e===at?void 0:e}return ut.call(n,t)?n[t]:void 0},ft=Object.prototype.hasOwnProperty;var lt=function(t){var n=this.__data__;return ot?void 0!==n[t]:ft.call(n,t)},ht="__lodash_hash_undefined__";var pt=function(t,n){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=ot&&void 0===n?ht:n,this};function vt(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}vt.prototype.clear=it,vt.prototype.delete=st,vt.prototype.get=ct,vt.prototype.has=lt,vt.prototype.set=pt;var dt=vt;var yt=function(){this.size=0,this.__data__={hash:new dt,map:new(rt||v),string:new dt}};var _t=function(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t};var mt=function(t,n){var e=t.__data__;return _t(n)?e["string"==typeof n?"string":"hash"]:e.map};var bt=function(t){var n=mt(this,t).delete(t);return this.size-=n?1:0,n};var gt=function(t){return mt(this,t).get(t)};var wt=function(t){return mt(this,t).has(t)};var jt=function(t,n){var e=mt(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this};function At(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}At.prototype.clear=yt,At.prototype.delete=bt,At.prototype.get=gt,At.prototype.has=wt,At.prototype.set=jt;var Ot=At,$t=200;var xt=function(t,n){var e=this.__data__;if(e instanceof v){var r=e.__data__;if(!rt||r.length<$t-1)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new Ot(r)}return e.set(t,n),this.size=e.size,this};function Pt(t){var n=this.__data__=new v(t);this.size=n.size}Pt.prototype.clear=d,Pt.prototype.delete=y,Pt.prototype.get=_,Pt.prototype.has=m,Pt.prototype.set=xt;var Dt=Pt,Ct=function(){try{var t=et(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var zt=function(t,n,e){"__proto__"==n&&Ct?Ct(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e};var St=function(t,n,e){(void 0===e||s(t[n],e))&&(void 0!==e||n in t)||zt(t,n,e)};var Tt=function(t){return function(n,e,r){for(var o=-1,i=Object(n),s=r(n),a=s.length;a--;){var u=s[t?a:++o];if(!1===e(i[u],u,i))break}return n}}(),Et=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e?A.Buffer:void 0,i=o?o.allocUnsafe:void 0;t.exports=function(t,n){if(n)return t.slice();var e=t.length,r=i?i(e):new t.constructor(e);return t.copy(r),r}}),Rt=A.Uint8Array;var Ft=function(t){var n=new t.constructor(t.byteLength);return new Rt(n).set(new Rt(t)),n};var It=function(t,n){var e=n?Ft(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)};var Lt=function(t,n){var e=-1,r=t.length;for(n||(n=Array(r));++e<r;)n[e]=t[e];return n},Nt=Object.create,Vt=function(){function t(){}return function(n){if(!I(n))return{};if(Nt)return Nt(n);t.prototype=n;var e=new t;return t.prototype=void 0,e}}();var kt=function(t,n){return function(e){return t(n(e))}}(Object.getPrototypeOf,Object),Bt=Object.prototype;var Wt=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||Bt)};var qt=function(t){return"function"!=typeof t.constructor||Wt(t)?{}:Vt(kt(t))};var Ut=function(t){return null!=t&&"object"==typeof t},Kt="[object Arguments]";var Gt=function(t){return Ut(t)&&F(t)==Kt},Jt=Object.prototype,Ht=Jt.hasOwnProperty,Qt=Jt.propertyIsEnumerable,Xt=Gt(function(){return arguments}())?Gt:function(t){return Ut(t)&&Ht.call(t,"callee")&&!Qt.call(t,"callee")},Yt=Array.isArray,Zt=9007199254740991;var Mt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Zt};var tn=function(t){return null!=t&&Mt(t.length)&&!W(t)};var nn=function(t){return Ut(t)&&tn(t)};var en=function(){return!1},rn=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e?A.Buffer:void 0,i=(o?o.isBuffer:void 0)||en;t.exports=i}),on="[object Object]",sn=Function.prototype,an=Object.prototype,un=sn.toString,cn=an.hasOwnProperty,fn=un.call(Object);var ln=function(t){if(!Ut(t)||F(t)!=on)return!1;var n=kt(t);if(null===n)return!0;var e=cn.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&un.call(e)==fn},hn={};hn["[object Float32Array]"]=hn["[object Float64Array]"]=hn["[object Int8Array]"]=hn["[object Int16Array]"]=hn["[object Int32Array]"]=hn["[object Uint8Array]"]=hn["[object Uint8ClampedArray]"]=hn["[object Uint16Array]"]=hn["[object Uint32Array]"]=!0,hn["[object Arguments]"]=hn["[object Array]"]=hn["[object ArrayBuffer]"]=hn["[object Boolean]"]=hn["[object DataView]"]=hn["[object Date]"]=hn["[object Error]"]=hn["[object Function]"]=hn["[object Map]"]=hn["[object Number]"]=hn["[object Object]"]=hn["[object RegExp]"]=hn["[object Set]"]=hn["[object String]"]=hn["[object WeakMap]"]=!1;var pn=function(t){return Ut(t)&&Mt(t.length)&&!!hn[F(t)]};var vn=function(t){return function(n){return t(n)}},dn=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e&&w.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i}),yn=dn&&dn.isTypedArray,_n=yn?vn(yn):pn;var mn=function(t,n){if("__proto__"!=n)return t[n]},bn=Object.prototype.hasOwnProperty;var gn=function(t,n,e){var r=t[n];bn.call(t,n)&&s(r,e)&&(void 0!==e||n in t)||zt(t,n,e)};var wn=function(t,n,e,r){var o=!e;e||(e={});for(var i=-1,s=n.length;++i<s;){var a=n[i],u=r?r(e[a],t[a],a,e,t):void 0;void 0===u&&(u=t[a]),o?zt(e,a,u):gn(e,a,u)}return e};var jn=function(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r},An=9007199254740991,On=/^(?:0|[1-9]\d*)$/;var $n=function(t,n){var e=typeof t;return!!(n=null==n?An:n)&&("number"==e||"symbol"!=e&&On.test(t))&&t>-1&&t%1==0&&t<n},xn=Object.prototype.hasOwnProperty;var Pn=function(t,n){var e=Yt(t),r=!e&&Xt(t),o=!e&&!r&&rn(t),i=!e&&!r&&!o&&_n(t),s=e||r||o||i,a=s?jn(t.length,String):[],u=a.length;for(var c in t)!n&&!xn.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||$n(c,u))||a.push(c);return a};var Dn=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n},Cn=Object.prototype.hasOwnProperty;var zn=function(t){if(!I(t))return Dn(t);var n=Wt(t),e=[];for(var r in t)("constructor"!=r||!n&&Cn.call(t,r))&&e.push(r);return e};var Sn=function(t){return tn(t)?Pn(t,!0):zn(t)};var Tn=function(t){return wn(t,Sn(t))};var En=function(t,n,e,r,o,i,s){var a=mn(t,e),u=mn(n,e),c=s.get(u);if(c)St(t,e,c);else{var f=i?i(a,u,e+"",t,n,s):void 0,l=void 0===f;if(l){var h=Yt(u),p=!h&&rn(u),v=!h&&!p&&_n(u);f=u,h||p||v?Yt(a)?f=a:nn(a)?f=Lt(a):p?(l=!1,f=Et(u,!0)):v?(l=!1,f=It(u,!0)):f=[]:ln(u)||Xt(u)?(f=a,Xt(a)?f=Tn(a):I(a)&&!W(a)||(f=qt(u))):l=!1}l&&(s.set(u,f),o(f,u,r,i,s),s.delete(u)),St(t,e,f)}};var Rn=function t(n,e,r,o,i){n!==e&&Tt(e,function(s,a){if(I(s))i||(i=new Dt),En(n,e,a,r,t,o,i);else{var u=o?o(mn(n,a),s,a+"",n,e,i):void 0;void 0===u&&(u=s),St(n,a,u)}},Sn)};var Fn=function(t){return t};var In=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)},Ln=Math.max;var Nn=function(t,n,e){return n=Ln(void 0===n?t.length-1:n,0),function(){for(var r=arguments,o=-1,i=Ln(r.length-n,0),s=Array(i);++o<i;)s[o]=r[n+o];o=-1;for(var a=Array(n+1);++o<n;)a[o]=r[o];return a[n]=e(s),In(t,this,a)}};var Vn=function(t){return function(){return t}},kn=Ct?function(t,n){return Ct(t,"toString",{configurable:!0,enumerable:!1,value:Vn(n),writable:!0})}:Fn,Bn=800,Wn=16,qn=Date.now;var Un=function(t){var n=0,e=0;return function(){var r=qn(),o=Wn-(r-e);if(e=r,o>0){if(++n>=Bn)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}(kn);var Kn=function(t,n){return Un(Nn(t,n,Fn),t+"")};var Gn=function(t,n,e){if(!I(e))return!1;var r=typeof n;return!!("number"==r?tn(e)&&$n(n,e.length):"string"==r&&n in e)&&s(e[n],t)};var Jn=function(t){return Kn(function(n,e){var r=-1,o=e.length,i=o>1?e[o-1]:void 0,s=o>2?e[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,s&&Gn(e[0],e[1],s)&&(i=o<3?void 0:i,o=1),n=Object(n);++r<o;){var a=e[r];a&&t(n,a,r,i)}return n})}(function(t,n,e){Rn(t,n,e)});var Hn,Qn,Xn,Yn,Zn,Mn=(Hn={render:function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"dialog-layout"},[this._t("default")],2)},staticRenderFns:[]},Xn=void 0,Yn=!1,(Zn=("function"==typeof(Qn={})?Qn.options:Qn)||{}).__file="DefaultLayout.vue",Zn.render||(Zn.render=Hn.render,Zn.staticRenderFns=Hn.staticRenderFns,Zn._compiled=!0,Yn&&(Zn.functional=!0)),Zn._scopeId=Xn,Zn),te=function(){return{}},ne=function(t){return"function"==typeof t},ee=function(t){return null==t},re=function(t){return t&&(t instanceof Promise||"function"==typeof t.then)};function oe(t,n){var e=this,r=[],o=this,i={};if("object"!=typeof t)return t;var s=function(s){var a=t[s];ne(a)&&(a=a.call(e,n)),re(a)?(a=a.then(function(t){if(!ee(t))return s.startsWith("...")?i=Object.assign({},i,t):i[s]=t,t}),n&&ne(n.error)&&(a=a.catch(function(e){n.error.call(o,{error:e,key:s,obj:t})})),r.push(a)):i[s]=a};for(var a in t)s(a);return Promise.all(r).then(function(){return Promise.resolve(i)})}var ie=function(t,n){var e=[];if(t.options.asyncData){var r=function(t,n){var e;if(e=ne(t)?t.call(this,n):t,!re(e)){if("object"==typeof e)return oe.call(this,e,n);e=Promise.resolve(e)}var r=this;return e.then(function(t){return oe.call(r,t)})}(t.options.asyncData,n);r.then(function(n){return function(t,n){var e=t.options.data||te;n&&!t.options.hasAsyncData&&(t.options.hasAsyncData=!0,t.options.data=function(){var t=e.call(this);return Object.assign({},t,n)},t._Ctor&&t._Ctor.options&&(t._Ctor.options.data=t.options.data))}(t,n),n}),e.push(r)}return t.options.fetch&&e.push(t.options.fetch(n)),Promise.all(e)};function se(t){t&&!t._isDestroyed&&"function"==typeof t.$destroy&&t.$destroy()}function ae(t){var n;return(n="string"==typeof t?document.querySelector(t):t)||(n=document.body),n}var ue=1,ce=function(t,n){void 0===n&&(n={});var e=n.layout,r=n.container;if(!t)throw Error("Component was not setted");this._layout=e||{component:Mn,options:{}},this._component=t,this._vm=null,this._vmDialog=null,this._options={},this.id=++ue,this._resolvers=[],this.container=ae(r)},fe={showed:{configurable:!0},element:{configurable:!0},hasAsyncPreload:{configurable:!0},vm:{configurable:!0},vmd:{configurable:!0}};ce.prototype.show=function(t,r){return void 0===t&&(t={}),void 0===r&&(r={}),new Promise(function(i,s){var a,u,c,f;if(n.prototype.$isServer)return i();if(a=(a=n.extend({mixins:[o]})).extend(this._layout.component),u=new a(Jn({propsData:Object.assign({},this._layout.options,t)},this.context,r)),"object"!=typeof(c=this._component)||c.options?c.options.parent=u:c=n.extend(Object.assign({},this._component,{parent:u})),c.options.primaryKey&&(c=c.extend({mixins:[e]})),this.hasAsyncPreload)return Promise.resolve(ie(c,Object.assign({},this.context,{params:t}))).then(function(t){try{return l.call(this)}catch(t){return s(t)}}.bind(this),s);function l(){return(f=new c(Jn({propsData:t},this.context,r))).$mount(),u.$slots.default=f._vnode,u.$mount(),u.$on("hook:destroyed",this._onDestroyed.bind(this)),u.$on("submit",this.onReturn.bind(this)),f.$on("submit",this.onReturn.bind(this)),this._vm=u,this._vm._dialogInstance=f,this._vmDialog=f,this.container=r.container?ae(r.container):this.container,this.container.appendChild(this.element),i(this)}return l.call(this)}.bind(this))},ce.prototype.wait=function(){var t=this;return new Promise(function(n){t._resolvers.push(n)})},ce.prototype._onDestroyed=function(){this.remove()},ce.prototype.remove=function(){this.onDestroyed&&this.onDestroyed(this),this._processResultPromises(),se(this._vm),se(this._vmDialog),this._vm=null,this._vmDialog=null},ce.prototype._processResultPromises=function(t){this._resolvers.length&&(this._resolvers.forEach(function(n){return n(t)}),this._resolvers=[])},ce.prototype.onReturn=function(t){this._processResultPromises(t),this.close()},fe.showed.get=function(){return!!this._vm&&!this._vm._isDestroyed},fe.element.get=function(){return this._vm&&this._vm.$el},fe.hasAsyncPreload.get=function(){return this._component&&(t=this._component.options||this._component,Boolean(!t.hasAsyncData&&(t.asyncData||t.fetch)));var t},fe.vm.get=function(){return this._vm},fe.vmd.get=function(){return this._vmDialog},ce.prototype.close=function(){this._vm&&this._vm.close()},Object.defineProperties(ce.prototype,fe);var le=function(t){this._component=t,this._vm=null};le.prototype.show=function(){if(!this._vm){var t=n.extend(this._component);this._vm=new t,this._vm.$mount(),document.body.appendChild(this._vm.$el)}this._vm.visible=!0},le.prototype.hide=function(){this._vm.visible=!1},le.prototype.destroy=function(){this._vm&&(this._vm.$el.parentNode.removeChild(this._vm.$el),this._vm.$destroy(),this._vm=null)};var he={get:function(t,n){return"symbol"==typeof n||"inspect"===n?t[n]:t[n]?t[n]:t._components[n]?t.createFunctionWrapper(n):t[n]}},pe=function(t){void 0===t&&(t={});var e=t.context,r=t.container;return this._context=e||{},ce.prototype.context=e||{},this._components={},this._layouts={},this._overlays={},this._container=r,this._emitter=new n({}),this._instances=[],new Proxy(this,he)},ve={context:{configurable:!0}};ve.context.get=function(){return this._context},pe.prototype.layout=function(t,n,e){void 0===e&&(e={}),this._layouts[t]={component:n,options:e}},pe.prototype.getLayout=function(t){if("function"==typeof t){var n=t.call(this._context);return t=this._layouts[n.name||"default"],Object.assign({},t,{options:n})}if("object"==typeof t&&"function"==typeof t.render)return{component:t};if(Array.isArray(t)){var e=t[0],r=t[1]||{},o="object"==typeof e&&"function"==typeof e.render?{component:e}:this._layouts[e];return o&&{component:o.component,options:Object.assign({},o.options,r)}}return this._layouts[t]},pe.prototype.overlay=function(t,n){if(void 0===n){if(this._overlays[t])return this._overlays[t];throw new Error('Overlay "'+t+" not found\n Please register it by calling dialog.overlay('"+t+"', component)")}this._overlays[t]=new le(n)},pe.prototype.getComponent=function(t){if(!this._components[t])throw new Error('Component "'+t+"\" was not found.\n Please register it by calling dialog.register('"+t+"', component)");return this._components[t]},pe.prototype.component=function(t,n,e){if(void 0===e&&(e={}),void 0===n)return this._components[t];this._components[t]={component:n,options:e}},pe.prototype.getComponentProperty=function(t,n){return t.options?t.options[n]:t[n]},pe.prototype.create=function(t){if(!t)throw new Error("Component is incorrect");var n=this.getLayout(this.getComponentProperty(t,"layout")||"default"),e=new ce(t,{layout:n,context:this._context,container:this._container});return this._emitter.$emit("created",{dialog:e}),e},pe.prototype.show=function(t,n){return void 0===n&&(n={}),new Promise(function(e,r){var o,i,s;i=!!(o=this.create(t)).hasAsyncPreload&&(this.getComponentProperty(t,"overlay")||"default"),(s=i&&this._overlays[i]&&this.overlay(i))&&s.show();var a=function(t){try{throw this._emitter.$emit("error",{error:t,dialog:o}),s&&s.hide(),t}catch(t){return r(t)}}.bind(this);try{return Promise.resolve(o.show(n)).then(function(t){try{return this._emitter.$emit("shown",{dialog:o}),s&&s.hide(),o.onDestroyed=this.onDialogDestroyed.bind(this),e(n.waitForResult?o.wait():o)}catch(t){return a(t)}}.bind(this),a)}catch(t){a(t)}}.bind(this))},pe.prototype.createFunctionWrapper=function(t){var n=this,e=this.getComponent(t);return function(t){return n.show(e.component,Object.assign({},e.options,t))}},pe.prototype.showAndWait=function(t,n){return new Promise(function(e,r){return Promise.resolve(this.show(t,n)).then(function(t){try{return e(t.wait())}catch(t){return r(t)}},r)}.bind(this))},pe.prototype.on=function(t,n){this._emitter.$on(t,n)},pe.prototype.off=function(t,n){this._emitter.$off(t,n)},pe.prototype.once=function(t,n){this._emitter.$once(t,n)},pe.prototype.onDialogDestroyed=function(t){this._emitter.$emit("destroyed",{dialog:t})},Object.defineProperties(pe.prototype,ve);var de=function(t,n,e,r,o,i,s,a){var u=("function"==typeof e?e.options:e)||{};return u.__file="DialogOverlay.vue",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,o&&(u.functional=!0)),u._scopeId=r,u}({render:function(){var t=this.$createElement,n=this._self._c||t;return n("transition",{attrs:{name:"opacity"}},[this.visible?n("div",{staticClass:"dialog-overlay-loading",style:{zIndex:this.zIndex}},[this._v("\n Loading…\n ")]):this._e()])},staticRenderFns:[]},0,{name:"VDialogOverlay",props:{zIndex:{type:Number,default:function(){return 1250}},visible:{type:Boolean,default:function(){return!1}}}},void 0,!1),ye={name:"Returnable",props:{returnValue:null},data:function(){return{originalValue:this.returnValue,returnResovers:[]}},methods:{return:function(t){this.originalValue=t,this.$root.$emit("submit",this.originalValue),this.$emit("submit",this.originalValue)}}},_e={name:"Actionable",mixins:[ye],data:function(){return{loadingAction:null}},props:{actions:{type:[Array,Object],default:function(){return[]}},handle:Function,params:Object},computed:{actionlist:function(){var t=[];for(var n in this.actions){var e=this.actions[n];"string"==typeof e&&(e={text:e}),e.key||(e.key=isNaN(n)?n:e.text||n),["true","false"].indexOf(e.key)>=0&&(e.key=JSON.parse(e.key)),this.isActionVisible(e)&&("string"==typeof e.icon&&(e.icon={text:e.icon}),t.push(e))}return t}},methods:{trigger:function(t){var n=this.actionlist.find(function(n){return n.key===t});n&&!this.isActionDisabled(n)&&this.isActionVisible(n)&&this.onActionClick(n)},setLoadingToInstance:function(t,n){t&&void 0!==t.loading&&(t.loading=n)},setLoadingState:function(t){this.$emit("loading",t),!t&&(this.loadingAction=null),this.setLoadingToInstance(this.$root,t),this.setLoadingToInstance(this.$root._dialogInstance,t)},get:function(t,n){return void 0===t?n:"function"==typeof t?t(this.params):t},isActionDisabled:function(t){return this.get(t.disabled,!1)},isActionVisible:function(t){return this.get(t.visible,!0)},isActionInLoading:function(t){return this.loadingAction===t.key||this.get(t.loading)},onActionClick:function(t){return new Promise(function(n,e){var r,o;if(r=void 0===t.closable||!0===t.closable,"function"!=typeof(o=t.handle||this.handle))return r&&this.return(t.key),u.call(this);this.loadingAction=t.key,this.setLoadingState(!0);var i=function(){try{return u.call(this)}catch(t){return e(t)}}.bind(this),s=function(t){try{throw this.setLoadingState(!1),console.log("error",t),t}catch(t){return e(t)}}.bind(this);try{var a;return Promise.resolve(o(this.params)).then(function(n){try{return a=n,this.setLoadingState(!1),!1!==a&&r&&this.return(a||t.key),i()}catch(t){return s(t)}}.bind(this),s)}catch(t){s(t)}function u(){return n()}}.bind(this))}}},me={name:"Confirmable",props:{type:{type:String},text:{type:String,reqiured:!0},title:{type:String},actions:{type:[Array,Object]}}},be=[],ge={props:{verticalOffset:Number,showClose:{type:Boolean,default:function(){return!0}},position:{type:String,default:function(){return"top-right"}},timeout:{type:[Number,Boolean],default:function(){return 4500}},width:{type:Number,default:function(){return 330}},zIndex:{type:Number,default:function(){return 2e3}}},data:function(){return{activeTimeout:null}},computed:{horizontalClass:function(){return this.position.indexOf("right")>-1?"right":"left"},verticalProperty:function(){return/^top-/.test(this.position)?"top":"bottom"},getStyle:function(){var t;return(t={})[this.verticalProperty]=this.verticalOffset+"px",t["max-width"]=this.width+"px",t["z-index"]=this.zIndex,t}},methods:{_destroy:function(){this.$el.addEventListener("transitionend",this.onTransitionEnd)},onTransitionEnd:function(){this.$el.removeEventListener("transitionend",this.onTransitionEnd),this.$destroy()},clearTimer:function(){clearTimeout(this.activeTimeout)},startTimer:function(){this.timeout>0&&(this.activeTimeout=setTimeout(this.close,this.timeout))},keydown:function(t){46===t.keyCode||8===t.keyCode?this.clearTimer():27===t.keyCode?this.close():this.startTimer()},close:function(){this.isActive=!1}},watch:{isActive:function(t){var n,e,r;t?(e=(n=this).position,r=10,be.filter(function(t){return t.position===e}).forEach(function(t){r+=t.$el.offsetHeight+10}),be.push(n),n.verticalOffset=r):function(t){var n=be.findIndex(function(n){return n===t});if(!(n<0)){be.splice(n,1);var e=be.length,r=t.position;if(e){var o=10;be.filter(function(t){return t.position===r}).forEach(function(t){t.verticalOffset=o,o+=t.$el.offsetHeight+10})}}}(this)}},mounted:function(){this.startTimer(),document.addEventListener("keydown",this.keydown)},beforeDestroy:function(){document.removeEventListener("keydown",this.keydown)}};var we={install:function t(n,e){if(void 0===e&&(e={}),!t.installed){t.installed=!0;var r=e.property||"$dialog",o=new pe(e);o.overlay("default",de),n.prototype[r]?console.warn("Property "+r+" is already defigned in Vue prototype"):Object.defineProperty(n.prototype,r,{get:function(){return o}})}}},je=null;"undefined"!=typeof window?je=window.Vue:"undefined"!=typeof global&&(je=global.Vue),je&&je.use(we),t.default=we,t.Actionable=_e,t.Activable=r,t.Confirmable=me,t.Notifiable=ge,t.Recordable=e,t.Returnable=ye,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n(t.vuedl={},t.Vue)}(this,function(t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var e={computed:{$parameters:function(){return this.$options.propsData},isNewRecord:function(){return!this.$options.primaryKey||!this.$options.propsData||!this.$options.propsData[this.$options.primaryKey]}}},r={name:"Activable",data:function(){return{isActive:!1}},watch:{isActive:function(t){this._dialogInstance?void 0!==this._dialogInstance.isActive&&(this._dialogInstance.isActive=t):this.$parent&&void 0!==this.$parent.isActive&&(this.$parent.isActive=t)}},methods:{close:function(){this.isActive=!1}}},o={name:"Layoutable",mixins:[r],props:{width:{type:[String,Number],default:function(){return 450}},persistent:Boolean},data:function(){return{loading:!1}},computed:{isLayout:function(){return!0},getWidth:function(){return"string"==typeof this.width?this.width:this.width+"px"}},watch:{isActive:function(t){t||this._destroy()}},mounted:function(){this.isActive=!0},methods:{_destroy:function(){this.$destroy()},dismiss:function(){this.persistent||this.loading||(this.isActive=!1)},close:function(){this.isActive=!1}},beforeDestroy:function(){"function"==typeof this.$el.remove?this.$el.remove():this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}};var i=function(){this.__data__=[],this.size=0};var s=function(t,n){return t===n||t!=t&&n!=n};var a=function(t,n){for(var e=t.length;e--;)if(s(t[e][0],n))return e;return-1},u=Array.prototype.splice;var c=function(t){var n=this.__data__,e=a(n,t);return!(e<0||(e==n.length-1?n.pop():u.call(n,e,1),--this.size,0))};var f=function(t){var n=this.__data__,e=a(n,t);return e<0?void 0:n[e][1]};var l=function(t){return a(this.__data__,t)>-1};var h=function(t,n){var e=this.__data__,r=a(e,t);return r<0?(++this.size,e.push([t,n])):e[r][1]=n,this};function p(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}p.prototype.clear=i,p.prototype.delete=c,p.prototype.get=f,p.prototype.has=l,p.prototype.set=h;var v=p;var d=function(){this.__data__=new v,this.size=0};var y=function(t){var n=this.__data__,e=n.delete(t);return this.size=n.size,e};var _=function(t){return this.__data__.get(t)};var m=function(t){return this.__data__.has(t)},b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(t,n){return t(n={exports:{}},n.exports),n.exports}var w="object"==typeof b&&b&&b.Object===Object&&b,j="object"==typeof self&&self&&self.Object===Object&&self,$=w||j||Function("return this")(),O=$.Symbol,A=Object.prototype,x=A.hasOwnProperty,P=A.toString,C=O?O.toStringTag:void 0;var D=function(t){var n=x.call(t,C),e=t[C];try{t[C]=void 0}catch(t){}var r=P.call(t);return n?t[C]=e:delete t[C],r},S=Object.prototype.toString;var T=function(t){return S.call(t)},z="[object Null]",E="[object Undefined]",L=O?O.toStringTag:void 0;var F=function(t){return null==t?void 0===t?E:z:L&&L in Object(t)?D(t):T(t)};var I=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)},R="[object AsyncFunction]",N="[object Function]",V="[object GeneratorFunction]",k="[object Proxy]";var B,U=function(t){if(!I(t))return!1;var n=F(t);return n==N||n==V||n==R||n==k},W=$["__core-js_shared__"],q=(B=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"";var K=function(t){return!!q&&q in t},X=Function.prototype.toString;var G=function(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""},J=/^\[object .+?Constructor\]$/,H=Function.prototype,Q=Object.prototype,Y=H.toString,Z=Q.hasOwnProperty,M=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var tt=function(t){return!(!I(t)||K(t))&&(U(t)?M:J).test(G(t))};var nt=function(t,n){return null==t?void 0:t[n]};var et=function(t,n){var e=nt(t,n);return tt(e)?e:void 0},rt=et($,"Map"),ot=et(Object,"create");var it=function(){this.__data__=ot?ot(null):{},this.size=0};var st=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},at="__lodash_hash_undefined__",ut=Object.prototype.hasOwnProperty;var ct=function(t){var n=this.__data__;if(ot){var e=n[t];return e===at?void 0:e}return ut.call(n,t)?n[t]:void 0},ft=Object.prototype.hasOwnProperty;var lt=function(t){var n=this.__data__;return ot?void 0!==n[t]:ft.call(n,t)},ht="__lodash_hash_undefined__";var pt=function(t,n){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=ot&&void 0===n?ht:n,this};function vt(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}vt.prototype.clear=it,vt.prototype.delete=st,vt.prototype.get=ct,vt.prototype.has=lt,vt.prototype.set=pt;var dt=vt;var yt=function(){this.size=0,this.__data__={hash:new dt,map:new(rt||v),string:new dt}};var _t=function(t){var n=typeof t;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==t:null===t};var mt=function(t,n){var e=t.__data__;return _t(n)?e["string"==typeof n?"string":"hash"]:e.map};var bt=function(t){var n=mt(this,t).delete(t);return this.size-=n?1:0,n};var gt=function(t){return mt(this,t).get(t)};var wt=function(t){return mt(this,t).has(t)};var jt=function(t,n){var e=mt(this,t),r=e.size;return e.set(t,n),this.size+=e.size==r?0:1,this};function $t(t){var n=-1,e=null==t?0:t.length;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}$t.prototype.clear=yt,$t.prototype.delete=bt,$t.prototype.get=gt,$t.prototype.has=wt,$t.prototype.set=jt;var Ot=$t,At=200;var xt=function(t,n){var e=this.__data__;if(e instanceof v){var r=e.__data__;if(!rt||r.length<At-1)return r.push([t,n]),this.size=++e.size,this;e=this.__data__=new Ot(r)}return e.set(t,n),this.size=e.size,this};function Pt(t){var n=this.__data__=new v(t);this.size=n.size}Pt.prototype.clear=d,Pt.prototype.delete=y,Pt.prototype.get=_,Pt.prototype.has=m,Pt.prototype.set=xt;var Ct=Pt,Dt=function(){try{var t=et(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var St=function(t,n,e){"__proto__"==n&&Dt?Dt(t,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[n]=e};var Tt=function(t,n,e){(void 0===e||s(t[n],e))&&(void 0!==e||n in t)||St(t,n,e)};var zt=function(t){return function(n,e,r){for(var o=-1,i=Object(n),s=r(n),a=s.length;a--;){var u=s[t?a:++o];if(!1===e(i[u],u,i))break}return n}}(),Et=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e?$.Buffer:void 0,i=o?o.allocUnsafe:void 0;t.exports=function(t,n){if(n)return t.slice();var e=t.length,r=i?i(e):new t.constructor(e);return t.copy(r),r}}),Lt=$.Uint8Array;var Ft=function(t){var n=new t.constructor(t.byteLength);return new Lt(n).set(new Lt(t)),n};var It=function(t,n){var e=n?Ft(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)};var Rt=function(t,n){var e=-1,r=t.length;for(n||(n=Array(r));++e<r;)n[e]=t[e];return n},Nt=Object.create,Vt=function(){function t(){}return function(n){if(!I(n))return{};if(Nt)return Nt(n);t.prototype=n;var e=new t;return t.prototype=void 0,e}}();var kt=function(t,n){return function(e){return t(n(e))}}(Object.getPrototypeOf,Object),Bt=Object.prototype;var Ut=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||Bt)};var Wt=function(t){return"function"!=typeof t.constructor||Ut(t)?{}:Vt(kt(t))};var qt=function(t){return null!=t&&"object"==typeof t},Kt="[object Arguments]";var Xt=function(t){return qt(t)&&F(t)==Kt},Gt=Object.prototype,Jt=Gt.hasOwnProperty,Ht=Gt.propertyIsEnumerable,Qt=Xt(function(){return arguments}())?Xt:function(t){return qt(t)&&Jt.call(t,"callee")&&!Ht.call(t,"callee")},Yt=Array.isArray,Zt=9007199254740991;var Mt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Zt};var tn=function(t){return null!=t&&Mt(t.length)&&!U(t)};var nn=function(t){return qt(t)&&tn(t)};var en=function(){return!1},rn=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e?$.Buffer:void 0,i=(o?o.isBuffer:void 0)||en;t.exports=i}),on="[object Object]",sn=Function.prototype,an=Object.prototype,un=sn.toString,cn=an.hasOwnProperty,fn=un.call(Object);var ln=function(t){if(!qt(t)||F(t)!=on)return!1;var n=kt(t);if(null===n)return!0;var e=cn.call(n,"constructor")&&n.constructor;return"function"==typeof e&&e instanceof e&&un.call(e)==fn},hn={};hn["[object Float32Array]"]=hn["[object Float64Array]"]=hn["[object Int8Array]"]=hn["[object Int16Array]"]=hn["[object Int32Array]"]=hn["[object Uint8Array]"]=hn["[object Uint8ClampedArray]"]=hn["[object Uint16Array]"]=hn["[object Uint32Array]"]=!0,hn["[object Arguments]"]=hn["[object Array]"]=hn["[object ArrayBuffer]"]=hn["[object Boolean]"]=hn["[object DataView]"]=hn["[object Date]"]=hn["[object Error]"]=hn["[object Function]"]=hn["[object Map]"]=hn["[object Number]"]=hn["[object Object]"]=hn["[object RegExp]"]=hn["[object Set]"]=hn["[object String]"]=hn["[object WeakMap]"]=!1;var pn=function(t){return qt(t)&&Mt(t.length)&&!!hn[F(t)]};var vn=function(t){return function(n){return t(n)}},dn=g(function(t,n){var e=n&&!n.nodeType&&n,r=e&&t&&!t.nodeType&&t,o=r&&r.exports===e&&w.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i}),yn=dn&&dn.isTypedArray,_n=yn?vn(yn):pn;var mn=function(t,n){if("__proto__"!=n)return t[n]},bn=Object.prototype.hasOwnProperty;var gn=function(t,n,e){var r=t[n];bn.call(t,n)&&s(r,e)&&(void 0!==e||n in t)||St(t,n,e)};var wn=function(t,n,e,r){var o=!e;e||(e={});for(var i=-1,s=n.length;++i<s;){var a=n[i],u=r?r(e[a],t[a],a,e,t):void 0;void 0===u&&(u=t[a]),o?St(e,a,u):gn(e,a,u)}return e};var jn=function(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r},$n=9007199254740991,On=/^(?:0|[1-9]\d*)$/;var An=function(t,n){var e=typeof t;return!!(n=null==n?$n:n)&&("number"==e||"symbol"!=e&&On.test(t))&&t>-1&&t%1==0&&t<n},xn=Object.prototype.hasOwnProperty;var Pn=function(t,n){var e=Yt(t),r=!e&&Qt(t),o=!e&&!r&&rn(t),i=!e&&!r&&!o&&_n(t),s=e||r||o||i,a=s?jn(t.length,String):[],u=a.length;for(var c in t)!n&&!xn.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||An(c,u))||a.push(c);return a};var Cn=function(t){var n=[];if(null!=t)for(var e in Object(t))n.push(e);return n},Dn=Object.prototype.hasOwnProperty;var Sn=function(t){if(!I(t))return Cn(t);var n=Ut(t),e=[];for(var r in t)("constructor"!=r||!n&&Dn.call(t,r))&&e.push(r);return e};var Tn=function(t){return tn(t)?Pn(t,!0):Sn(t)};var zn=function(t){return wn(t,Tn(t))};var En=function(t,n,e,r,o,i,s){var a=mn(t,e),u=mn(n,e),c=s.get(u);if(c)Tt(t,e,c);else{var f=i?i(a,u,e+"",t,n,s):void 0,l=void 0===f;if(l){var h=Yt(u),p=!h&&rn(u),v=!h&&!p&&_n(u);f=u,h||p||v?Yt(a)?f=a:nn(a)?f=Rt(a):p?(l=!1,f=Et(u,!0)):v?(l=!1,f=It(u,!0)):f=[]:ln(u)||Qt(u)?(f=a,Qt(a)?f=zn(a):I(a)&&!U(a)||(f=Wt(u))):l=!1}l&&(s.set(u,f),o(f,u,r,i,s),s.delete(u)),Tt(t,e,f)}};var Ln=function t(n,e,r,o,i){n!==e&&zt(e,function(s,a){if(I(s))i||(i=new Ct),En(n,e,a,r,t,o,i);else{var u=o?o(mn(n,a),s,a+"",n,e,i):void 0;void 0===u&&(u=s),Tt(n,a,u)}},Tn)};var Fn=function(t){return t};var In=function(t,n,e){switch(e.length){case 0:return t.call(n);case 1:return t.call(n,e[0]);case 2:return t.call(n,e[0],e[1]);case 3:return t.call(n,e[0],e[1],e[2])}return t.apply(n,e)},Rn=Math.max;var Nn=function(t,n,e){return n=Rn(void 0===n?t.length-1:n,0),function(){for(var r=arguments,o=-1,i=Rn(r.length-n,0),s=Array(i);++o<i;)s[o]=r[n+o];o=-1;for(var a=Array(n+1);++o<n;)a[o]=r[o];return a[n]=e(s),In(t,this,a)}};var Vn=function(t){return function(){return t}},kn=Dt?function(t,n){return Dt(t,"toString",{configurable:!0,enumerable:!1,value:Vn(n),writable:!0})}:Fn,Bn=800,Un=16,Wn=Date.now;var qn=function(t){var n=0,e=0;return function(){var r=Wn(),o=Un-(r-e);if(e=r,o>0){if(++n>=Bn)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}(kn);var Kn=function(t,n){return qn(Nn(t,n,Fn),t+"")};var Xn=function(t,n,e){if(!I(e))return!1;var r=typeof n;return!!("number"==r?tn(e)&&An(n,e.length):"string"==r&&n in e)&&s(e[n],t)};var Gn=function(t){return Kn(function(n,e){var r=-1,o=e.length,i=o>1?e[o-1]:void 0,s=o>2?e[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,s&&Xn(e[0],e[1],s)&&(i=o<3?void 0:i,o=1),n=Object(n);++r<o;){var a=e[r];a&&t(n,a,r,i)}return n})}(function(t,n,e){Ln(t,n,e)}),Jn={};function Hn(t,n,e,r,o,i,s,a,u,c){"function"==typeof s&&(u=a,a=s,s=!1);const f="function"==typeof e?e.options:e;let l;if(t&&t.render&&(f.render=t.render,f.staticRenderFns=t.staticRenderFns,f._compiled=!0,o&&(f.functional=!0)),r&&(f._scopeId=r),i?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,u(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},f._ssrRegister=l):n&&(l=s?function(){n.call(this,c(this.$root.$options.shadowRoot))}:function(t){n.call(this,a(t))}),l)if(f.functional){const t=f.render;f.render=function(n,e){return l.call(e),t(n,e)}}else{const t=f.beforeCreate;f.beforeCreate=t?[].concat(t,l):[l]}return e}var Qn=Jn;Jn.__file="DefaultLayout.vue";var Yn=Hn({render:function(){var t=this.$createElement,n=this._self._c||t;return n("div",{staticClass:"dialog-layout"},[n("div",{ref:"dialog-instance"})])},staticRenderFns:[]},void 0,Qn,void 0,!1,void 0,void 0,void 0),Zn=function(){return{}},Mn=function(t){return"function"==typeof t},te=function(t){return null==t},ne=function(t){return t&&(t instanceof Promise||"function"==typeof t.then)};function ee(t,n){var e=this,r=[],o=this,i={};if("object"!=typeof t)return t;var s=function(s){var a=t[s];Mn(a)&&(a=a.call(e,n)),ne(a)?(a=a.then(function(t){if(!te(t))return s.startsWith("...")?i=Object.assign({},i,t):i[s]=t,t}),n&&Mn(n.error)&&(a=a.catch(function(e){return n.error.call(o,e,{key:s,obj:t})})),r.push(a)):i[s]=a};for(var a in t)s(a);return Promise.all(r).then(function(){return Promise.resolve(i)})}var re=function(t,n){var e=[];if(t.options.asyncData){var r=function(t,n){var e;if(e=Mn(t)?t.call(this,n):t,!ne(e)){if("object"==typeof e)return ee.call(this,e,n);e=Promise.resolve(e)}var r=this;return e.then(function(t){return ee.call(r,t)})}(t.options.asyncData,n);r.then(function(n){return function(t,n){var e=t.options.data||Zn;n&&!t.options.hasAsyncData&&(t.options.hasAsyncData=!0,t.options.data=function(){var t=e.call(this);return Object.assign({},t,n)},t._Ctor&&t._Ctor.options&&(t._Ctor.options.data=t.options.data))}(t,n),n}),e.push(r)}return t.options.fetch&&e.push(t.options.fetch(n)),Promise.all(e)};function oe(t){t&&!t._isDestroyed&&"function"==typeof t.$destroy&&t.$destroy()}function ie(t){var n;return(n="string"==typeof t?document.querySelector(t):t)||(n=document.body),n}var se=1,ae=function(t,n){void 0===n&&(n={});var e=n.layout,r=n.container;if(!t)throw Error("Component was not setted");this._layout=e||{component:Yn,options:{}},this._component=t,this._vm=null,this._vmDialog=null,this._options={},this.id=++se,this._resolvers=[],this.container=ie(r)},ue={showed:{configurable:!0},element:{configurable:!0},hasAsyncPreload:{configurable:!0},vm:{configurable:!0},vmd:{configurable:!0}};ae.prototype.show=function(t,r){return void 0===t&&(t={}),void 0===r&&(r={}),new Promise(function(i,s){var a,u,c,f,l;if(n.prototype.$isServer)return i();if(a=(a=n.extend({mixins:[o]})).extend(this._layout.component),u=new a(Gn({propsData:Object.assign({},this._layout.options,t)},this.context,r)),"object"!=typeof(c=this._component)||c.options?c.options.parent=u:c=n.extend(Object.assign({},this._component,{parent:u})),c.options.primaryKey&&(c=c.extend({mixins:[e]})),this.hasAsyncPreload)return Promise.resolve(re(c,Object.assign({},this.context,{params:t}))).then(function(t){try{return h.call(this)}catch(t){return s(t)}}.bind(this),s);function h(){return(f=new c(Gn({propsData:t},this.context,r))).$mount(),u.$mount(),(l=u.$refs["dialog-instance"])?l.$el?l.$el.appendChild(f.$el):l.appendChild(f.$el):u.$slots.default=f._vnode,u.$on("hook:destroyed",this._onDestroyed.bind(this)),u.$on("submit",this.onReturn.bind(this)),f.$on("submit",this.onReturn.bind(this)),this._vm=u,this._vm._dialogInstance=f,this._vmDialog=f,this.container=r.container?ie(r.container):this.container,this.container.appendChild(this.element),i(this)}return h.call(this)}.bind(this))},ae.prototype.wait=function(){var t=this;return new Promise(function(n){t._resolvers.push(n)})},ae.prototype._onDestroyed=function(){this.remove()},ae.prototype.remove=function(){this.onDestroyed&&this.onDestroyed(this),this._processResultPromises(),oe(this._vm),oe(this._vmDialog),this._vm=null,this._vmDialog=null},ae.prototype._processResultPromises=function(t){this._resolvers.length&&(this._resolvers.forEach(function(n){return n(t)}),this._resolvers=[])},ae.prototype.onReturn=function(t){this._processResultPromises(t),this.close()},ue.showed.get=function(){return!!this._vm&&!this._vm._isDestroyed},ue.element.get=function(){return this._vm&&this._vm.$el},ue.hasAsyncPreload.get=function(){return this._component&&(t=this._component.options||this._component,Boolean(!t.hasAsyncData&&(t.asyncData||t.fetch)));var t},ue.vm.get=function(){return this._vm},ue.vmd.get=function(){return this._vmDialog},ae.prototype.close=function(){this._vm&&this._vm.close()},Object.defineProperties(ae.prototype,ue);var ce=function(t){this._component=t,this._vm=null};ce.prototype.show=function(){if(!this._vm){var t=n.extend(this._component);this._vm=new t,this._vm.$mount(),document.body.appendChild(this._vm.$el)}this._vm.visible=!0},ce.prototype.hide=function(){this._vm.visible=!1},ce.prototype.destroy=function(){this._vm&&(this._vm.$el.parentNode.removeChild(this._vm.$el),this._vm.$destroy(),this._vm=null)};var fe={get:function(t,n){return"symbol"==typeof n||"inspect"===n?t[n]:t[n]?t[n]:t._components[n]?t.createFunctionWrapper(n):t[n]}},le=function(t){void 0===t&&(t={});var e=t.context,r=t.container;return this._context=e||{},ae.prototype.context=e||{},this._components={},this._layouts={},this._overlays={},this._container=r,this._emitter=new n({}),this._instances=[],new Proxy(this,fe)},he={context:{configurable:!0}};he.context.get=function(){return this._context},le.prototype.layout=function(t,n,e){void 0===e&&(e={}),this._layouts[t]={component:n,options:e}},le.prototype.getLayout=function(t){if("function"==typeof t){var n=t.call(this._context);return t=this._layouts[n.name||"default"],Object.assign({},t,{options:n})}if("object"==typeof t&&"function"==typeof t.render)return{component:t};if(Array.isArray(t)){var e=t[0],r=t[1]||{},o="object"==typeof e&&"function"==typeof e.render?{component:e}:this._layouts[e];return o&&{component:o.component,options:Object.assign({},o.options,r)}}return this._layouts[t]},le.prototype.overlay=function(t,n){if(void 0===n){if(this._overlays[t])return this._overlays[t];throw new Error('Overlay "'+t+" not found\n Please register it by calling dialog.overlay('"+t+"', component)")}this._overlays[t]=new ce(n)},le.prototype.getComponent=function(t){if(!this._components[t])throw new Error('Component "'+t+"\" was not found.\n Please register it by calling dialog.register('"+t+"', component)");return this._components[t]},le.prototype.component=function(t,n,e){if(void 0===e&&(e={}),void 0===n)return this._components[t];this._components[t]={component:n,options:e}},le.prototype.getComponentProperty=function(t,n){return t.options?t.options[n]:t[n]},le.prototype.create=function(t){if(!t)throw new Error("Component is incorrect");var n=this.getLayout(this.getComponentProperty(t,"layout")||"default"),e=new ae(t,{layout:n,context:this._context,container:this._container});return this._emitter.$emit("created",{dialog:e}),e},le.prototype.show=function(t,n){return void 0===n&&(n={}),new Promise(function(e,r){var o,i,s;i=!!(o=this.create(t)).hasAsyncPreload&&(this.getComponentProperty(t,"overlay")||"default"),(s=i&&this._overlays[i]&&this.overlay(i))&&s.show();var a=function(t){try{throw this._emitter.$emit("error",{error:t,dialog:o}),s&&s.hide(),t}catch(t){return r(t)}}.bind(this);try{return Promise.resolve(o.show(n)).then(function(t){try{return this._emitter.$emit("shown",{dialog:o}),s&&s.hide(),o.onDestroyed=this.onDialogDestroyed.bind(this),e(n.waitForResult?o.wait():o)}catch(t){return a(t)}}.bind(this),a)}catch(t){a(t)}}.bind(this))},le.prototype.createFunctionWrapper=function(t){var n=this,e=this.getComponent(t);return function(t){return n.show(e.component,Object.assign({},e.options,t))}},le.prototype.showAndWait=function(t,n){return new Promise(function(e,r){return Promise.resolve(this.show(t,n)).then(function(t){try{return e(t.wait())}catch(t){return r(t)}},r)}.bind(this))},le.prototype.on=function(t,n){this._emitter.$on(t,n)},le.prototype.off=function(t,n){this._emitter.$off(t,n)},le.prototype.once=function(t,n){this._emitter.$once(t,n)},le.prototype.onDialogDestroyed=function(t){this._emitter.$emit("destroyed",{dialog:t})},Object.defineProperties(le.prototype,he);var pe={name:"VDialogOverlay",props:{zIndex:{type:Number,default:function(){return 1250}},visible:{type:Boolean,default:function(){return!1}}}},ve=pe;pe.__file="DialogOverlay.vue";var de=Hn({render:function(){var t=this.$createElement,n=this._self._c||t;return n("transition",{attrs:{name:"opacity"}},[this.visible?n("div",{staticClass:"dialog-overlay-loading",style:{zIndex:this.zIndex}},[this._v("\n Loading…\n ")]):this._e()])},staticRenderFns:[]},void 0,ve,void 0,!1,void 0,void 0,void 0),ye={name:"Returnable",props:{returnValue:null},data:function(){return{originalValue:this.returnValue,returnResovers:[]}},methods:{return:function(t){this.originalValue=t,this.$root.$emit("submit",this.originalValue),this.$emit("submit",this.originalValue)}}},_e={name:"Actionable",mixins:[ye],data:function(){return{loadingAction:null}},props:{actions:{type:[Array,Object],default:function(){return[]}},handle:Function,params:Object},computed:{actionlist:function(){var t=[];for(var n in this.actions){var e=this.actions[n];"string"==typeof e&&(e={text:e}),e.key||(e.key=isNaN(n)?n:e.text||n),["true","false"].indexOf(e.key)>=0&&(e.key=JSON.parse(e.key)),this.isActionVisible(e)&&("string"==typeof e.icon&&(e.icon={text:e.icon}),t.push(e))}return t}},methods:{trigger:function(t){var n=this.actionlist.find(function(n){return n.key===t});n&&!this.isActionDisabled(n)&&this.isActionVisible(n)&&this.onActionClick(n)},setLoadingToInstance:function(t,n){t&&void 0!==t.loading&&(t.loading=n)},setLoadingState:function(t){this.$emit("loading",t),!t&&(this.loadingAction=null),this.setLoadingToInstance(this.$root,t),this.setLoadingToInstance(this.$root._dialogInstance,t)},get:function(t,n){return void 0===t?n:"function"==typeof t?t(this.params):t},isActionDisabled:function(t){return this.get(t.disabled,!1)},isActionVisible:function(t){return this.get(t.visible,!0)},isActionInLoading:function(t){return this.loadingAction===t.key||this.get(t.loading)},onActionClick:function(t){return new Promise(function(n,e){var r,o;if(r=void 0===t.closable||!0===t.closable,"function"!=typeof(o=t.handle||this.handle))return r&&this.return(t.key),u.call(this);this.loadingAction=t.key,this.setLoadingState(!0);var i=function(){try{return u.call(this)}catch(t){return e(t)}}.bind(this),s=function(t){try{throw this.setLoadingState(!1),console.log("error",t),t}catch(t){return e(t)}}.bind(this);try{var a;return Promise.resolve(o(this.params)).then(function(n){try{return a=n,this.setLoadingState(!1),!1!==a&&r&&this.return(a||t.key),i()}catch(t){return s(t)}}.bind(this),s)}catch(t){s(t)}function u(){return n()}}.bind(this))}}},me={name:"Confirmable",props:{type:{type:String},text:{type:[String,Function],reqiured:!0},title:{type:String},actions:{type:[Array,Object]}}},be=[],ge={props:{verticalOffset:Number,showClose:{type:Boolean,default:function(){return!0}},position:{type:String,default:function(){return"top-right"}},timeout:{type:[Number,Boolean],default:function(){return 4500}},width:{type:Number,default:function(){return 330}},zIndex:{type:Number,default:function(){return 2e3}}},data:function(){return{activeTimeout:null}},computed:{horizontalClass:function(){return this.position.indexOf("right")>-1?"right":"left"},verticalProperty:function(){return/^top-/.test(this.position)?"top":"bottom"},getStyle:function(){var t;return(t={})[this.verticalProperty]=this.verticalOffset+"px",t["max-width"]=this.width+"px",t["z-index"]=this.zIndex,t}},methods:{_destroy:function(){this.$el.addEventListener("transitionend",this.onTransitionEnd)},onTransitionEnd:function(){this.$el.removeEventListener("transitionend",this.onTransitionEnd),this.$destroy()},clearTimer:function(){clearTimeout(this.activeTimeout)},startTimer:function(){this.timeout>0&&(this.activeTimeout=setTimeout(this.close,this.timeout))},keydown:function(t){46===t.keyCode||8===t.keyCode?this.clearTimer():27===t.keyCode?this.close():this.startTimer()},close:function(){this.isActive=!1}},watch:{isActive:function(t){var n,e,r;t?(e=(n=this).position,r=10,be.filter(function(t){return t.position===e}).forEach(function(t){r+=t.$el.offsetHeight+10}),be.push(n),n.verticalOffset=r):function(t){var n=be.findIndex(function(n){return n===t});if(!(n<0)){be.splice(n,1);var e=be.length,r=t.position;if(e){var o=10;be.filter(function(t){return t.position===r}).forEach(function(t){t.verticalOffset=o,o+=t.$el.offsetHeight+10})}}}(this)}},mounted:function(){this.startTimer(),document.addEventListener("keydown",this.keydown)},beforeDestroy:function(){document.removeEventListener("keydown",this.keydown)}};var we={install:function t(n,e){if(void 0===e&&(e={}),!t.installed){t.installed=!0;var r=e.property||"$dialog",o=new le(e);o.overlay("default",de),n.prototype[r]?console.warn("Property "+r+" is already defigned in Vue prototype"):Object.defineProperty(n.prototype,r,{get:function(){return o}})}}},je=null;"undefined"!=typeof window?je=window.Vue:"undefined"!=typeof global&&(je=global.Vue),je&&je.use(we),t.default=we,t.Actionable=_e,t.Activable=r,t.Confirmable=me,t.Notifiable=ge,t.Recordable=e,t.Returnable=ye,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vuedl.min.js.map |
{ | ||
"name": "vuedl", | ||
"version": "0.1.6", | ||
"version": "0.2.0-alpha.0", | ||
"description": "Vue dialog helper", | ||
@@ -26,3 +26,3 @@ "scripts": { | ||
"dependencies": { | ||
"vue-asyncable": "0.0.3" | ||
"vue-asyncable": "0.0.5" | ||
}, | ||
@@ -53,18 +53,17 @@ "repository": { | ||
"coveralls": "^3.0.2", | ||
"debug": "^4.1.0", | ||
"eslint": "^5.10.0", | ||
"eslint": "^5.12.1", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^22.1.2", | ||
"eslint-plugin-node": "^8.0.0", | ||
"eslint-plugin-jest": "^22.1.3", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"eslint-plugin-vue": "^5.0.0", | ||
"eslint-plugin-vue": "^5.1.0", | ||
"jest": "^23.6.0", | ||
"lodash": "^4.17.11", | ||
"merge": ">=1.2.1", | ||
"rollup-plugin-vue": "^4.3.2", | ||
"vue": "^2.5.21", | ||
"rollup-plugin-vue": "^4.6.1", | ||
"vue": "^2.5.22", | ||
"vue-jest": "^3.0.2", | ||
"vue-template-compiler": "^2.5.21", | ||
"vue-template-compiler": "^2.5.22", | ||
"vue-test-utils": "^1.0.0-beta.11" | ||
@@ -71,0 +70,0 @@ }, |
@@ -90,3 +90,3 @@ # Vuedl - vue dialog helper | ||
<v-dialog v-model="isActive" :max-width="width"> | ||
<slot/> | ||
<div ref="dialog-instance"/> | ||
</v-dialog> | ||
@@ -93,0 +93,0 @@ ``` |
@@ -69,5 +69,18 @@ /* | ||
dialog.$mount() | ||
layout.$slots.default = dialog._vnode | ||
// layout.$slots.default = dialog._vnode | ||
// dialog.$on('hook:updated', () => { | ||
// layout.$slots.default = dialog._vnode | ||
// layout.$forceUpdate() | ||
// }) | ||
// } | ||
layout.$mount() | ||
const ref = layout.$refs['dialog-instance'] | ||
if (ref) { | ||
ref.$el ? ref.$el.appendChild(dialog.$el) : ref.appendChild(dialog.$el) | ||
} else { | ||
// if (process.env.NODE_ENV !== 'production') { | ||
// console.warn('Slot in layouts is deprecated. Please use <div ref="dialog-instance"/> instead') | ||
// } | ||
layout.$slots.default = dialog._vnode | ||
} | ||
layout.$on('hook:destroyed', this._onDestroyed.bind(this)) | ||
@@ -74,0 +87,0 @@ layout.$on('submit', this.onReturn.bind(this)) |
@@ -9,3 +9,3 @@ export default { | ||
text: { | ||
type: String, | ||
type: [String, Function], | ||
reqiured: true | ||
@@ -12,0 +12,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24
367151
5969
+ Addedvue-asyncable@0.0.5(transitive)
- Removedvue-asyncable@0.0.3(transitive)
Updatedvue-asyncable@0.0.5