Comparing version 0.0.12 to 0.0.13
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
@@ -797,2 +799,348 @@ | ||
/* @vue/component */ | ||
var Returnable = { | ||
name: 'Returnable', | ||
props: { | ||
returnValue: null | ||
}, | ||
data: function data() { | ||
return { | ||
originalValue: this.returnValue, | ||
returnResovers: [] | ||
}; | ||
}, | ||
// watch: { | ||
// 'wrapper.isActive' (val) { | ||
// console.log('watch.isActive', val) | ||
// if (val) { | ||
// this.originalValue = this.returnValue | ||
// } else { | ||
// // console.log('emit', this.originalValue) | ||
// // this.$emit('submit', this.originalValue) | ||
// this.$emit('update:returnValue', this.originalValue) | ||
// } | ||
// } | ||
// }, | ||
methods: { | ||
return: function return$1(value) { | ||
this.originalValue = value; | ||
this.$root.$emit('submit', this.originalValue); | ||
this.$emit('submit', this.originalValue); | ||
} | ||
} | ||
}; | ||
var _Actionable = { | ||
name: 'Actionable', | ||
mixins: [Returnable], | ||
data: function data() { | ||
return { | ||
loadingAction: null | ||
}; | ||
}, | ||
props: { | ||
actions: { | ||
type: [Array, Object], | ||
default: function () { return []; } | ||
}, | ||
handle: Function, | ||
params: Object | ||
}, | ||
computed: { | ||
actionlist: function actionlist() { | ||
var this$1 = this; | ||
var actions = []; | ||
for (var key in this$1.actions) { | ||
var action = this$1.actions[key]; | ||
if (typeof action === 'string') { | ||
action = { | ||
text: action | ||
}; | ||
} | ||
if (!action.key) { | ||
action.key = isNaN(key) ? key : action.text || key; | ||
} | ||
if (['true', 'false'].indexOf(action.key) >= 0) { | ||
action.key = JSON.parse(action.key); | ||
} | ||
if (typeof action.icon === 'string') { | ||
action.icon = { | ||
text: action.icon | ||
}; | ||
} | ||
actions.push(action); | ||
} | ||
return actions; | ||
} | ||
}, | ||
methods: { | ||
trigger: function trigger(name) { | ||
var action = this.actionlist.find(function (action) { return action.key === name; }); | ||
if (action && !this.isActionDisabled(action) && this.isActionVisible(action)) { | ||
this.onActionClick(action); | ||
} | ||
}, | ||
setLoadingToInstance: function setLoadingToInstance(vm, value) { | ||
if (vm && vm.loading !== undefined) { | ||
vm.loading = value; | ||
} | ||
}, | ||
setLoadingState: function setLoadingState(value) { | ||
this.$emit('loading', value); | ||
!value && (this.loadingAction = null); | ||
this.setLoadingToInstance(this.$root, value); | ||
this.setLoadingToInstance(this.$root._dialogInstance, value); | ||
}, | ||
get: function get(param, def) { | ||
if (param === undefined) { | ||
return def; | ||
} | ||
if (typeof param === 'function') { | ||
return param(this.params); | ||
} | ||
return param; | ||
}, | ||
isActionDisabled: function isActionDisabled(action) { | ||
return this.get(action.disabled, false); | ||
}, | ||
isActionVisible: function isActionVisible(action) { | ||
return this.get(action.visible, true); | ||
}, | ||
isActionInLoading: function isActionInLoading(action) { | ||
return this.loadingAction === action.key || this.get(action.loading); | ||
}, | ||
onActionClick: function onActionClick(action) { | ||
return new Promise(function ($return, $error) { | ||
var closable, handle; | ||
closable = action.closable === undefined || action.closable === true; | ||
handle = action.handle || this.handle; | ||
if (typeof handle === 'function') { | ||
this.loadingAction = action.key; | ||
this.setLoadingState(true); | ||
var $Try_1_Post = function () { | ||
try { | ||
return $If_2.call(this); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this); | ||
var $Try_1_Catch = function (e) { | ||
try { | ||
this.setLoadingState(false); | ||
console.log('error', e); // TODO | ||
throw e; | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this); | ||
try { | ||
var ret; | ||
return Promise.resolve(handle(this.params)).then(function ($await_3) { | ||
try { | ||
ret = $await_3; | ||
this.setLoadingState(false); | ||
if (ret !== false && closable) { | ||
this.return(ret || action.key); | ||
} | ||
return $Try_1_Post(); | ||
} catch ($boundEx) { | ||
return $Try_1_Catch($boundEx); | ||
} | ||
}.bind(this), $Try_1_Catch); | ||
} catch (e) { | ||
$Try_1_Catch(e); | ||
} | ||
} else { | ||
closable && this.return(action.key); | ||
return $If_2.call(this); | ||
} | ||
function $If_2() { | ||
return $return(); | ||
} | ||
}.bind(this)); | ||
} | ||
} | ||
}; | ||
var _Confirmable = { | ||
name: 'Confirmable', | ||
props: { | ||
type: { | ||
type: String | ||
}, | ||
text: { | ||
type: String, | ||
reqiured: true | ||
}, | ||
title: { | ||
type: String | ||
}, | ||
actions: { | ||
type: [Array, Object] | ||
} | ||
} | ||
}; | ||
var notifications = []; | ||
var gap = 10; | ||
var insertNotification = function (vm) { | ||
var position = vm.position; | ||
var verticalOffset = gap; | ||
notifications.filter(function (item) { return item.position === position; }).forEach(function (item) { | ||
verticalOffset += item.$el.offsetHeight + gap; | ||
}); | ||
notifications.push(vm); | ||
vm.verticalOffset = verticalOffset; | ||
}; | ||
var deleteNotification = function (vm) { | ||
var index = notifications.findIndex(function (instance) { return instance === vm; }); | ||
if (index < 0) { | ||
return; | ||
} | ||
notifications.splice(index, 1); | ||
var len = notifications.length; | ||
var position = vm.position; | ||
if (!len) { return; } | ||
var verticalOffset = gap; | ||
notifications.filter(function (item) { return item.position === position; }).forEach(function (item) { | ||
item.verticalOffset = verticalOffset; | ||
verticalOffset += item.$el.offsetHeight + gap; | ||
}); | ||
}; | ||
var _Notifiable = { | ||
props: { | ||
verticalOffset: Number, | ||
showClose: { | ||
type: Boolean, | ||
default: function () { return true; } | ||
}, | ||
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 2000; } | ||
} | ||
}, | ||
computed: { | ||
horizontalClass: function horizontalClass() { | ||
return this.position.indexOf('right') > -1 ? 'right' : 'left'; | ||
}, | ||
verticalProperty: function verticalProperty() { | ||
return /^top-/.test(this.position) ? 'top' : 'bottom'; | ||
}, | ||
getStyle: function getStyle() { | ||
var obj; | ||
return ( obj = {}, obj[this.verticalProperty] = ((this.verticalOffset) + "px"), obj['max-width'] = ((this.width) + "px"), obj['z-index'] = this.zIndex, obj); | ||
} | ||
}, | ||
methods: { | ||
_destroy: function _destroy() { | ||
this.$el.addEventListener('transitionend', this.onTransitionEnd); | ||
}, | ||
onTransitionEnd: function onTransitionEnd() { | ||
this.$el.removeEventListener('transitionend', this.onTransitionEnd); | ||
this.$destroy(); | ||
}, | ||
clearTimer: function clearTimer() { | ||
clearTimeout(this.timer); | ||
}, | ||
startTimer: function startTimer() { | ||
if (this.timeout > 0) { | ||
this.timer = setTimeout(this.close, this.timeout); | ||
} | ||
}, | ||
keydown: function keydown(e) { | ||
if (e.keyCode === 46 || e.keyCode === 8) { | ||
this.clearTimer(); // detele key | ||
} else if (e.keyCode === 27) { | ||
// esc key | ||
this.close(); | ||
} else { | ||
this.startTimer(); // any key | ||
} | ||
}, | ||
close: function close() { | ||
this.isActive = false; | ||
} | ||
}, | ||
watch: { | ||
isActive: function isActive(val) { | ||
if (val) { | ||
insertNotification(this); | ||
} else { | ||
deleteNotification(this); | ||
} | ||
} | ||
}, | ||
mounted: function mounted() { | ||
this.startTimer(); | ||
document.addEventListener('keydown', this.keydown); | ||
}, | ||
beforeDestroy: function beforeDestroy() { | ||
document.removeEventListener('keydown', this.keydown); | ||
} | ||
}; | ||
/* | ||
@@ -806,57 +1154,41 @@ * vuedl | ||
*/ | ||
// import NotificationLayout from './components/NotificationLayout.vue' | ||
// import DialogOverlay from './components/DialogOverlay.vue' | ||
// import Confirm from './components/Confirm.vue' | ||
// import Actionable from './mixins/actionable' | ||
// import Activable from './mixins/activable' | ||
// import Confirmable from './mixins/confirmable' | ||
// import Notifiable from './mixins/notifiable' | ||
// import Recordable from './mixins/recordable' | ||
// import Returnable from './mixins/returnable' | ||
function install(Vue$$1, options) { | ||
if ( options === void 0 ) options = {}; | ||
var Plugin = { | ||
install: function install(Vue$$1, options) { | ||
if ( options === void 0 ) options = {}; | ||
var property = options.property || '$dialog'; | ||
var manager = new DialogManager(options); | ||
Object.defineProperty(Vue$$1.prototype, property, { | ||
get: function get() { | ||
return manager; | ||
} | ||
var property = options.property || '$dialog'; | ||
var manager = new DialogManager(options); | ||
Object.defineProperty(Vue$$1.prototype, property, { | ||
get: function get() { | ||
return manager; | ||
} | ||
}); | ||
} | ||
var Actionable = _Actionable; | ||
var Activable$1 = Activable; | ||
var Confirmable = _Confirmable; | ||
var Notifiable = _Notifiable; | ||
var Recordable$1 = Recordable; | ||
var Returnable$1 = Returnable; // Auto-install | ||
}); // Vue.prototype[property] = manager | ||
// manager.layout('default', DialogLayout) | ||
// manager.layout('notification', NotificationLayout) | ||
// manager.overlay('default', DialogOverlay) | ||
// manager.component('confirm', Confirm, { | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('warning', Confirm, { | ||
// type: 'warning', | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('error', Confirm, { | ||
// type: 'error', | ||
// waitForResult: true, | ||
// actions: [ | ||
// 'OK' | ||
// ] | ||
// }) | ||
} | ||
var GlobalVue = null; | ||
}; | ||
if (typeof window !== 'undefined') { | ||
GlobalVue = window.Vue; | ||
} else if (typeof global !== 'undefined') { | ||
GlobalVue = global.Vue; | ||
} | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(Plugin); | ||
if (GlobalVue) { | ||
GlobalVue.use({ | ||
install: install | ||
}); | ||
} | ||
module.exports = Plugin; | ||
exports.install = install; | ||
exports.Actionable = Actionable; | ||
exports.Activable = Activable$1; | ||
exports.Confirmable = Confirmable; | ||
exports.Notifiable = Notifiable; | ||
exports.Recordable = Recordable$1; | ||
exports.Returnable = Returnable$1; |
@@ -793,2 +793,348 @@ import Vue from 'vue'; | ||
/* @vue/component */ | ||
var Returnable = { | ||
name: 'Returnable', | ||
props: { | ||
returnValue: null | ||
}, | ||
data: function data() { | ||
return { | ||
originalValue: this.returnValue, | ||
returnResovers: [] | ||
}; | ||
}, | ||
// watch: { | ||
// 'wrapper.isActive' (val) { | ||
// console.log('watch.isActive', val) | ||
// if (val) { | ||
// this.originalValue = this.returnValue | ||
// } else { | ||
// // console.log('emit', this.originalValue) | ||
// // this.$emit('submit', this.originalValue) | ||
// this.$emit('update:returnValue', this.originalValue) | ||
// } | ||
// } | ||
// }, | ||
methods: { | ||
return: function return$1(value) { | ||
this.originalValue = value; | ||
this.$root.$emit('submit', this.originalValue); | ||
this.$emit('submit', this.originalValue); | ||
} | ||
} | ||
}; | ||
var _Actionable = { | ||
name: 'Actionable', | ||
mixins: [Returnable], | ||
data: function data() { | ||
return { | ||
loadingAction: null | ||
}; | ||
}, | ||
props: { | ||
actions: { | ||
type: [Array, Object], | ||
default: function () { return []; } | ||
}, | ||
handle: Function, | ||
params: Object | ||
}, | ||
computed: { | ||
actionlist: function actionlist() { | ||
var this$1 = this; | ||
var actions = []; | ||
for (var key in this$1.actions) { | ||
var action = this$1.actions[key]; | ||
if (typeof action === 'string') { | ||
action = { | ||
text: action | ||
}; | ||
} | ||
if (!action.key) { | ||
action.key = isNaN(key) ? key : action.text || key; | ||
} | ||
if (['true', 'false'].indexOf(action.key) >= 0) { | ||
action.key = JSON.parse(action.key); | ||
} | ||
if (typeof action.icon === 'string') { | ||
action.icon = { | ||
text: action.icon | ||
}; | ||
} | ||
actions.push(action); | ||
} | ||
return actions; | ||
} | ||
}, | ||
methods: { | ||
trigger: function trigger(name) { | ||
var action = this.actionlist.find(function (action) { return action.key === name; }); | ||
if (action && !this.isActionDisabled(action) && this.isActionVisible(action)) { | ||
this.onActionClick(action); | ||
} | ||
}, | ||
setLoadingToInstance: function setLoadingToInstance(vm, value) { | ||
if (vm && vm.loading !== undefined) { | ||
vm.loading = value; | ||
} | ||
}, | ||
setLoadingState: function setLoadingState(value) { | ||
this.$emit('loading', value); | ||
!value && (this.loadingAction = null); | ||
this.setLoadingToInstance(this.$root, value); | ||
this.setLoadingToInstance(this.$root._dialogInstance, value); | ||
}, | ||
get: function get(param, def) { | ||
if (param === undefined) { | ||
return def; | ||
} | ||
if (typeof param === 'function') { | ||
return param(this.params); | ||
} | ||
return param; | ||
}, | ||
isActionDisabled: function isActionDisabled(action) { | ||
return this.get(action.disabled, false); | ||
}, | ||
isActionVisible: function isActionVisible(action) { | ||
return this.get(action.visible, true); | ||
}, | ||
isActionInLoading: function isActionInLoading(action) { | ||
return this.loadingAction === action.key || this.get(action.loading); | ||
}, | ||
onActionClick: function onActionClick(action) { | ||
return new Promise(function ($return, $error) { | ||
var closable, handle; | ||
closable = action.closable === undefined || action.closable === true; | ||
handle = action.handle || this.handle; | ||
if (typeof handle === 'function') { | ||
this.loadingAction = action.key; | ||
this.setLoadingState(true); | ||
var $Try_1_Post = function () { | ||
try { | ||
return $If_2.call(this); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this); | ||
var $Try_1_Catch = function (e) { | ||
try { | ||
this.setLoadingState(false); | ||
console.log('error', e); // TODO | ||
throw e; | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this); | ||
try { | ||
var ret; | ||
return Promise.resolve(handle(this.params)).then(function ($await_3) { | ||
try { | ||
ret = $await_3; | ||
this.setLoadingState(false); | ||
if (ret !== false && closable) { | ||
this.return(ret || action.key); | ||
} | ||
return $Try_1_Post(); | ||
} catch ($boundEx) { | ||
return $Try_1_Catch($boundEx); | ||
} | ||
}.bind(this), $Try_1_Catch); | ||
} catch (e) { | ||
$Try_1_Catch(e); | ||
} | ||
} else { | ||
closable && this.return(action.key); | ||
return $If_2.call(this); | ||
} | ||
function $If_2() { | ||
return $return(); | ||
} | ||
}.bind(this)); | ||
} | ||
} | ||
}; | ||
var _Confirmable = { | ||
name: 'Confirmable', | ||
props: { | ||
type: { | ||
type: String | ||
}, | ||
text: { | ||
type: String, | ||
reqiured: true | ||
}, | ||
title: { | ||
type: String | ||
}, | ||
actions: { | ||
type: [Array, Object] | ||
} | ||
} | ||
}; | ||
var notifications = []; | ||
var gap = 10; | ||
var insertNotification = function (vm) { | ||
var position = vm.position; | ||
var verticalOffset = gap; | ||
notifications.filter(function (item) { return item.position === position; }).forEach(function (item) { | ||
verticalOffset += item.$el.offsetHeight + gap; | ||
}); | ||
notifications.push(vm); | ||
vm.verticalOffset = verticalOffset; | ||
}; | ||
var deleteNotification = function (vm) { | ||
var index = notifications.findIndex(function (instance) { return instance === vm; }); | ||
if (index < 0) { | ||
return; | ||
} | ||
notifications.splice(index, 1); | ||
var len = notifications.length; | ||
var position = vm.position; | ||
if (!len) { return; } | ||
var verticalOffset = gap; | ||
notifications.filter(function (item) { return item.position === position; }).forEach(function (item) { | ||
item.verticalOffset = verticalOffset; | ||
verticalOffset += item.$el.offsetHeight + gap; | ||
}); | ||
}; | ||
var _Notifiable = { | ||
props: { | ||
verticalOffset: Number, | ||
showClose: { | ||
type: Boolean, | ||
default: function () { return true; } | ||
}, | ||
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 2000; } | ||
} | ||
}, | ||
computed: { | ||
horizontalClass: function horizontalClass() { | ||
return this.position.indexOf('right') > -1 ? 'right' : 'left'; | ||
}, | ||
verticalProperty: function verticalProperty() { | ||
return /^top-/.test(this.position) ? 'top' : 'bottom'; | ||
}, | ||
getStyle: function getStyle() { | ||
var obj; | ||
return ( obj = {}, obj[this.verticalProperty] = ((this.verticalOffset) + "px"), obj['max-width'] = ((this.width) + "px"), obj['z-index'] = this.zIndex, obj); | ||
} | ||
}, | ||
methods: { | ||
_destroy: function _destroy() { | ||
this.$el.addEventListener('transitionend', this.onTransitionEnd); | ||
}, | ||
onTransitionEnd: function onTransitionEnd() { | ||
this.$el.removeEventListener('transitionend', this.onTransitionEnd); | ||
this.$destroy(); | ||
}, | ||
clearTimer: function clearTimer() { | ||
clearTimeout(this.timer); | ||
}, | ||
startTimer: function startTimer() { | ||
if (this.timeout > 0) { | ||
this.timer = setTimeout(this.close, this.timeout); | ||
} | ||
}, | ||
keydown: function keydown(e) { | ||
if (e.keyCode === 46 || e.keyCode === 8) { | ||
this.clearTimer(); // detele key | ||
} else if (e.keyCode === 27) { | ||
// esc key | ||
this.close(); | ||
} else { | ||
this.startTimer(); // any key | ||
} | ||
}, | ||
close: function close() { | ||
this.isActive = false; | ||
} | ||
}, | ||
watch: { | ||
isActive: function isActive(val) { | ||
if (val) { | ||
insertNotification(this); | ||
} else { | ||
deleteNotification(this); | ||
} | ||
} | ||
}, | ||
mounted: function mounted() { | ||
this.startTimer(); | ||
document.addEventListener('keydown', this.keydown); | ||
}, | ||
beforeDestroy: function beforeDestroy() { | ||
document.removeEventListener('keydown', this.keydown); | ||
} | ||
}; | ||
/* | ||
@@ -802,57 +1148,35 @@ * vuedl | ||
*/ | ||
// import NotificationLayout from './components/NotificationLayout.vue' | ||
// import DialogOverlay from './components/DialogOverlay.vue' | ||
// import Confirm from './components/Confirm.vue' | ||
// import Actionable from './mixins/actionable' | ||
// import Activable from './mixins/activable' | ||
// import Confirmable from './mixins/confirmable' | ||
// import Notifiable from './mixins/notifiable' | ||
// import Recordable from './mixins/recordable' | ||
// import Returnable from './mixins/returnable' | ||
function install(Vue$$1, options) { | ||
if ( options === void 0 ) options = {}; | ||
var Plugin = { | ||
install: function install(Vue$$1, options) { | ||
if ( options === void 0 ) options = {}; | ||
var property = options.property || '$dialog'; | ||
var manager = new DialogManager(options); | ||
Object.defineProperty(Vue$$1.prototype, property, { | ||
get: function get() { | ||
return manager; | ||
} | ||
var property = options.property || '$dialog'; | ||
var manager = new DialogManager(options); | ||
Object.defineProperty(Vue$$1.prototype, property, { | ||
get: function get() { | ||
return manager; | ||
} | ||
}); | ||
} | ||
var Actionable = _Actionable; | ||
var Activable$1 = Activable; | ||
var Confirmable = _Confirmable; | ||
var Notifiable = _Notifiable; | ||
var Recordable$1 = Recordable; | ||
var Returnable$1 = Returnable; // Auto-install | ||
}); // Vue.prototype[property] = manager | ||
// manager.layout('default', DialogLayout) | ||
// manager.layout('notification', NotificationLayout) | ||
// manager.overlay('default', DialogOverlay) | ||
// manager.component('confirm', Confirm, { | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('warning', Confirm, { | ||
// type: 'warning', | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('error', Confirm, { | ||
// type: 'error', | ||
// waitForResult: true, | ||
// actions: [ | ||
// 'OK' | ||
// ] | ||
// }) | ||
} | ||
var GlobalVue = null; | ||
}; | ||
if (typeof window !== 'undefined') { | ||
GlobalVue = window.Vue; | ||
} else if (typeof global !== 'undefined') { | ||
GlobalVue = global.Vue; | ||
} | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(Plugin); | ||
if (GlobalVue) { | ||
GlobalVue.use({ | ||
install: install | ||
}); | ||
} | ||
export default Plugin; | ||
export { install, Actionable, Activable$1 as Activable, Confirmable, Notifiable, Recordable$1 as Recordable, Returnable$1 as Returnable }; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):t.vuedl=e(t.Vue)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e={computed:{$parameters:function(){return this.$options.propsData},isNewRecord:function(){return!this.$options.primaryKey||!this.$options.propsData||!this.$options.propsData[this.$options.primaryKey]}}},n={name:"Layoutable",mixins:[{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}}}],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(){void 0!==this.$el.remove?this.$el.remove():this.$el.parentNode.removeChild(this.$el)}};var r=function(){this.__data__=[],this.size=0};var o=function(t,e){return t===e||t!=t&&e!=e};var i=function(t,e){for(var n=t.length;n--;)if(o(t[n][0],e))return n;return-1},s=Array.prototype.splice;var a=function(t){var e=this.__data__,n=i(e,t);return!(n<0||(n==e.length-1?e.pop():s.call(e,n,1),--this.size,0))};var c=function(t){var e=this.__data__,n=i(e,t);return n<0?void 0:e[n][1]};var u=function(t){return i(this.__data__,t)>-1};var f=function(t,e){var n=this.__data__,r=i(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function p(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}p.prototype.clear=r,p.prototype.delete=a,p.prototype.get=c,p.prototype.has=u,p.prototype.set=f;var h=p;var l=function(){this.__data__=new h,this.size=0};var v=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var y=function(t){return this.__data__.get(t)};var d=function(t){return this.__data__.has(t)},_="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(t,e){return t(e={exports:{}},e.exports),e.exports}var b="object"==typeof _&&_&&_.Object===Object&&_,g="object"==typeof self&&self&&self.Object===Object&&self,w=b||g||Function("return this")(),j=w.Symbol,O=Object.prototype,A=O.hasOwnProperty,$=O.toString,P=j?j.toStringTag:void 0;var x=function(t){var e=A.call(t,P),n=t[P];try{t[P]=void 0;var r=!0}catch(t){}var o=$.call(t);return r&&(e?t[P]=n:delete t[P]),o},D=Object.prototype.toString;var z=function(t){return D.call(t)},S="[object Null]",C="[object Undefined]",F=j?j.toStringTag:void 0;var R=function(t){return null==t?void 0===t?C:S:F&&F in Object(t)?x(t):z(t)};var E=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},I="[object AsyncFunction]",T="[object Function]",U="[object GeneratorFunction]",L="[object Proxy]";var k,B=function(t){if(!E(t))return!1;var e=R(t);return e==T||e==U||e==I||e==L},N=w["__core-js_shared__"],W=(k=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"";var q=function(t){return!!W&&W in t},M=Function.prototype.toString;var V=function(t){if(null!=t){try{return M.call(t)}catch(t){}try{return t+""}catch(t){}}return""},K=/^\[object .+?Constructor\]$/,G=Function.prototype,H=Object.prototype,J=G.toString,Q=H.hasOwnProperty,X=RegExp("^"+J.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Y=function(t){return!(!E(t)||q(t))&&(B(t)?X:K).test(V(t))};var Z=function(t,e){return null==t?void 0:t[e]};var tt=function(t,e){var n=Z(t,e);return Y(n)?n:void 0},et=tt(w,"Map"),nt=tt(Object,"create");var rt=function(){this.__data__=nt?nt(null):{},this.size=0};var ot=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},it="__lodash_hash_undefined__",st=Object.prototype.hasOwnProperty;var at=function(t){var e=this.__data__;if(nt){var n=e[t];return n===it?void 0:n}return st.call(e,t)?e[t]:void 0},ct=Object.prototype.hasOwnProperty;var ut=function(t){var e=this.__data__;return nt?void 0!==e[t]:ct.call(e,t)},ft="__lodash_hash_undefined__";var pt=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=nt&&void 0===e?ft:e,this};function ht(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ht.prototype.clear=rt,ht.prototype.delete=ot,ht.prototype.get=at,ht.prototype.has=ut,ht.prototype.set=pt;var lt=ht;var vt=function(){this.size=0,this.__data__={hash:new lt,map:new(et||h),string:new lt}};var yt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var dt=function(t,e){var n=t.__data__;return yt(e)?n["string"==typeof e?"string":"hash"]:n.map};var _t=function(t){var e=dt(this,t).delete(t);return this.size-=e?1:0,e};var mt=function(t){return dt(this,t).get(t)};var bt=function(t){return dt(this,t).has(t)};var gt=function(t,e){var n=dt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function wt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}wt.prototype.clear=vt,wt.prototype.delete=_t,wt.prototype.get=mt,wt.prototype.has=bt,wt.prototype.set=gt;var jt=wt,Ot=200;var At=function(t,e){var n=this.__data__;if(n instanceof h){var r=n.__data__;if(!et||r.length<Ot-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new jt(r)}return n.set(t,e),this.size=n.size,this};function $t(t){var e=this.__data__=new h(t);this.size=e.size}$t.prototype.clear=l,$t.prototype.delete=v,$t.prototype.get=y,$t.prototype.has=d,$t.prototype.set=At;var Pt=$t,xt=function(){try{var t=tt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Dt=function(t,e,n){"__proto__"==e&&xt?xt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n};var zt=function(t,e,n){(void 0===n||o(t[e],n))&&(void 0!==n||e in t)||Dt(t,e,n)};var St=function(t){return function(e,n,r){for(var o=-1,i=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++o];if(!1===n(i[c],c,i))break}return e}}(),Ct=m(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?w.Buffer:void 0,i=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=i?i(n):new t.constructor(n);return t.copy(r),r}}),Ft=w.Uint8Array;var Rt=function(t){var e=new t.constructor(t.byteLength);return new Ft(e).set(new Ft(t)),e};var Et=function(t,e){var n=e?Rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var It=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},Tt=Object.create,Ut=function(){function t(){}return function(e){if(!E(e))return{};if(Tt)return Tt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Lt=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),kt=Object.prototype;var Bt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||kt)};var Nt=function(t){return"function"!=typeof t.constructor||Bt(t)?{}:Ut(Lt(t))};var Wt=function(t){return null!=t&&"object"==typeof t},qt="[object Arguments]";var Mt=function(t){return Wt(t)&&R(t)==qt},Vt=Object.prototype,Kt=Vt.hasOwnProperty,Gt=Vt.propertyIsEnumerable,Ht=Mt(function(){return arguments}())?Mt:function(t){return Wt(t)&&Kt.call(t,"callee")&&!Gt.call(t,"callee")},Jt=Array.isArray,Qt=9007199254740991;var Xt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Qt};var Yt=function(t){return null!=t&&Xt(t.length)&&!B(t)};var Zt=function(t){return Wt(t)&&Yt(t)};var te=function(){return!1},ee=m(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?w.Buffer:void 0,i=(o?o.isBuffer:void 0)||te;t.exports=i}),ne="[object Object]",re=Function.prototype,oe=Object.prototype,ie=re.toString,se=oe.hasOwnProperty,ae=ie.call(Object);var ce=function(t){if(!Wt(t)||R(t)!=ne)return!1;var e=Lt(t);if(null===e)return!0;var n=se.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ie.call(n)==ae},ue={};ue["[object Float32Array]"]=ue["[object Float64Array]"]=ue["[object Int8Array]"]=ue["[object Int16Array]"]=ue["[object Int32Array]"]=ue["[object Uint8Array]"]=ue["[object Uint8ClampedArray]"]=ue["[object Uint16Array]"]=ue["[object Uint32Array]"]=!0,ue["[object Arguments]"]=ue["[object Array]"]=ue["[object ArrayBuffer]"]=ue["[object Boolean]"]=ue["[object DataView]"]=ue["[object Date]"]=ue["[object Error]"]=ue["[object Function]"]=ue["[object Map]"]=ue["[object Number]"]=ue["[object Object]"]=ue["[object RegExp]"]=ue["[object Set]"]=ue["[object String]"]=ue["[object WeakMap]"]=!1;var fe=function(t){return Wt(t)&&Xt(t.length)&&!!ue[R(t)]};var pe=function(t){return function(e){return t(e)}},he=m(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&b.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}),le=he&&he.isTypedArray,ve=le?pe(le):fe;var ye=function(t,e){return"__proto__"==e?void 0:t[e]},de=Object.prototype.hasOwnProperty;var _e=function(t,e,n){var r=t[e];de.call(t,e)&&o(r,n)&&(void 0!==n||e in t)||Dt(t,e,n)};var me=function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?Dt(n,a,c):_e(n,a,c)}return n};var be=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},ge=9007199254740991,we=/^(?:0|[1-9]\d*)$/;var je=function(t,e){var n=typeof t;return!!(e=null==e?ge:e)&&("number"==n||"symbol"!=n&&we.test(t))&&t>-1&&t%1==0&&t<e},Oe=Object.prototype.hasOwnProperty;var Ae=function(t,e){var n=Jt(t),r=!n&&Ht(t),o=!n&&!r&&ee(t),i=!n&&!r&&!o&&ve(t),s=n||r||o||i,a=s?be(t.length,String):[],c=a.length;for(var u in t)!e&&!Oe.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||je(u,c))||a.push(u);return a};var $e=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Pe=Object.prototype.hasOwnProperty;var xe=function(t){if(!E(t))return $e(t);var e=Bt(t),n=[];for(var r in t)("constructor"!=r||!e&&Pe.call(t,r))&&n.push(r);return n};var De=function(t){return Yt(t)?Ae(t,!0):xe(t)};var ze=function(t){return me(t,De(t))};var Se=function(t,e,n,r,o,i,s){var a=ye(t,n),c=ye(e,n),u=s.get(c);if(u)zt(t,n,u);else{var f=i?i(a,c,n+"",t,e,s):void 0,p=void 0===f;if(p){var h=Jt(c),l=!h&&ee(c),v=!h&&!l&&ve(c);f=c,h||l||v?Jt(a)?f=a:Zt(a)?f=It(a):l?(p=!1,f=Ct(c,!0)):v?(p=!1,f=Et(c,!0)):f=[]:ce(c)||Ht(c)?(f=a,Ht(a)?f=ze(a):(!E(a)||r&&B(a))&&(f=Nt(c))):p=!1}p&&(s.set(c,f),o(f,c,r,i,s),s.delete(c)),zt(t,n,f)}};var Ce=function t(e,n,r,o,i){e!==n&&St(n,function(s,a){if(E(s))i||(i=new Pt),Se(e,n,a,r,t,o,i);else{var c=o?o(ye(e,a),s,a+"",e,n,i):void 0;void 0===c&&(c=s),zt(e,a,c)}},De)};var Fe=function(t){return t};var Re=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ee=Math.max;var Ie=function(t,e,n){return e=Ee(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Ee(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),Re(t,this,a)}};var Te=function(t){return function(){return t}},Ue=xt?function(t,e){return xt(t,"toString",{configurable:!0,enumerable:!1,value:Te(e),writable:!0})}:Fe,Le=800,ke=16,Be=Date.now;var Ne=function(t){var e=0,n=0;return function(){var r=Be(),o=ke-(r-n);if(n=r,o>0){if(++e>=Le)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Ue);var We=function(t,e){return Ne(Ie(t,e,Fe),t+"")};var qe=function(t,e,n){if(!E(n))return!1;var r=typeof e;return!!("number"==r?Yt(n)&&je(e,n.length):"string"==r&&e in n)&&o(n[e],t)};var Me=function(t){return We(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,s&&qe(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++r<o;){var a=n[r];a&&t(e,a,r,i)}return e})}(function(t,e,n){Ce(t,e,n)}),Ve={},Ke=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"dialog-layout"},[this._t("default")],2)};Ke._withStripped=!0;var Ge,He,Je,Qe,Xe,Ye=(Ge={render:Ke,staticRenderFns:[]},Je=void 0,Qe=!1,(Xe=("function"==typeof(He=Ve)?He.options:He)||{}).__file="/Users/yarik/Projects/clones/vuedl/src/components/DefaultLayout.vue",Xe.render||(Xe.render=Ge.render,Xe.staticRenderFns=Ge.staticRenderFns,Xe._compiled=!0,Qe&&(Xe.functional=!0)),Xe._scopeId=Je,Xe),Ze=function(){return{}};function tn(t){t&&!t._isDestroyed&&"function"==typeof t.$destroy&&t.$destroy()}function en(t){var e;return(e="string"==typeof t?document.querySelector(t):t)||(e=document.body),e}function nn(t,e){return new Promise(function(n,r){if(!Array.isArray(t)){if(!t)return n(null);t=[t]}return n(Promise.all(t.map(function(t){var n=[];if(t.options.asyncData&&"function"==typeof t.options.asyncData){var r=function(t,e){var n;return(n=2===t.length?new Promise(function(n){t(e,function(t,r){t&&e.error(t),n(r=r||{})})}):t(e))&&(n instanceof Promise||"function"==typeof n.then)||(n=Promise.resolve(n)),n}(t.options.asyncData,e);r.then(function(e){return function(t,e){var n=t.options.data||Ze;!e&&t.options.hasAsyncData||(t.options.hasAsyncData=!0,t.options.data=function(){var r=n.call(this);return this.$ssrContext&&(e=this.$ssrContext.asyncData[t.cid]),Object.assign({},r,e)},t._Ctor&&t._Ctor.options&&(t._Ctor.options.data=t.options.data))}(t,e),e}),n.push(r)}else n.push(null);return t.options.fetch?n.push(t.options.fetch(e)):n.push(null),Promise.all(n)})))})}var rn=1,on=function(t,e){void 0===e&&(e={});var n=e.layout,r=e.container;if(!t)throw Error("Component was not setted");this._layout=n||{component:Ye,options:{}},this._component=t,this._vm=null,this._vmDialog=null,this._options={},this.id=++rn,this._resolvers=[],this.container=en(r)},sn={showed:{configurable:!0},element:{configurable:!0},hasAsyncPreload:{configurable:!0},vm:{configurable:!0},vmd:{configurable:!0}};on.prototype.show=function(r,o){return void 0===r&&(r={}),void 0===o&&(o={}),new Promise(function(i,s){var a,c,u,f;if(t.prototype.$isServer)return i();if(a=(a=t.extend({mixins:[n]})).extend(this._layout.component),c=new a(Me({propsData:Object.assign({},this._layout.options,r)},this.context,o)),u=t.extend(Object.assign({},this._component,{parent:c})),this._component.primaryKey&&(u=u.extend({mixins:[e]})),this.hasAsyncPreload)return Promise.resolve(nn(u,Object.assign({},this.context,{params:r}))).then(function(t){try{return p.call(this)}catch(t){return s(t)}}.bind(this),s);function p(){return(f=new u(Me({propsData:r},this.context,o))).$mount(),c.$slots.default=f._vnode,c.$mount(),c.$on("hook:destroyed",this._onDestroyed.bind(this)),c.$on("submit",this.onReturn.bind(this)),f.$on("submit",this.onReturn.bind(this)),this._vm=c,this._vm._dialogInstance=f,this._vmDialog=f,this.container=o.container?en(o.container):this.container,this.container.appendChild(this.element),i(this)}return p.call(this)}.bind(this))},on.prototype.wait=function(){var t=this;return new Promise(function(e){t._resolvers.push(e)})},on.prototype._onDestroyed=function(){this.remove()},on.prototype.remove=function(){this.onDestroyed&&this.onDestroyed(this),this._processResultPromises(),tn(this._vm),tn(this._vmDialog),this._vm=null,this._vmDialog=null},on.prototype._processResultPromises=function(t){this._resolvers.length&&(this._resolvers.forEach(function(e){return e(t)}),this._resolvers=[])},on.prototype.onReturn=function(t){this._processResultPromises(t),this.close()},sn.showed.get=function(){return!!this._vm&&!this._vm._isDestroyed},sn.element.get=function(){return this._vm&&this._vm.$el},sn.hasAsyncPreload.get=function(){return this._component&&(this._component.asyncData||this._component.fetch)},sn.vm.get=function(){return this._vm},sn.vmd.get=function(){return this._vmDialog},on.prototype.close=function(){this._vm.close()},Object.defineProperties(on.prototype,sn);var an=function(t){this._component=t,this._vm=null};an.prototype.show=function(){if(!this._vm){var e=t.extend(this._component);this._vm=new e,this._vm.$mount(),document.body.appendChild(this._vm.$el)}this._vm.visible=!0},an.prototype.hide=function(){this._vm.visible=!1};var cn={get:function(t,e){return"symbol"==typeof e||"inspect"===e?t[e]:t[e]?t[e]:t._components[e]?t.createFunctionWrapper(e):t[e]}},un=function(e){void 0===e&&(e={});var n=e.context,r=e.container;return this._context=n||{},on.prototype.context=n||{},this._components={},this._layouts={},this._overlays={},this._container=r,this._emitter=new t({}),this._instances=[],new Proxy(this,cn)},fn={context:{configurable:!0}};fn.context.get=function(){return this._context},un.prototype.layout=function(t,e,n){void 0===n&&(n={}),this._layouts[t]={component:e,options:n}},un.prototype.getLayout=function(t){if("function"==typeof t){var e=t.call(this._context);return t=this._layouts[e.name||"default"],Object.assign({},t,{options:e})}if("object"==typeof t&&"function"==typeof t.render)return{component:t};if(Array.isArray(t)){var n=t[0],r=t[1]||{},o="object"==typeof n&&"function"==typeof n.render?{component:n}:this._layouts[n];return o&&{component:o.component,options:Object.assign({},o.options,r)}}return this._layouts[t]},un.prototype.overlay=function(t,e){if(void 0===e){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 an(e)},un.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]},un.prototype.component=function(t,e,n){if(void 0===n&&(n={}),void 0===e)return this._components[t];this._components[t]={component:e,options:n}},un.prototype.create=function(t){if(!t)throw new Error("Component is incorrect");var e=this.getLayout(t.layout||"default"),n=new on(t,{layout:e,context:this._context,container:this._container});return this._emitter.$emit("created",{dialog:n}),n},un.prototype.show=function(t,e){return void 0===e&&(e={}),new Promise(function(n,r){var o,i,s;i=!!(o=this.create(t)).hasAsyncPreload&&(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(e)).then(function(t){try{return this._emitter.$emit("shown",{dialog:o}),s&&s.hide(),o.onDestroyed=this.onDialogDestroyed.bind(this),n(e.waitForResult?o.wait():o)}catch(t){return a(t)}}.bind(this),a)}catch(t){a(t)}}.bind(this))},un.prototype.createFunctionWrapper=function(t){var e=this,n=this.getComponent(t);return function(t){return e.show(n.component,Object.assign({},n.options,t))}},un.prototype.showAndWait=function(t,e){return new Promise(function(n,r){return Promise.resolve(this.show(t,e)).then(function(t){try{return n(t.wait())}catch(t){return r(t)}},r)}.bind(this))},un.prototype.on=function(t,e){this._emitter.$on(t,e)},un.prototype.off=function(t,e){this._emitter.$off(t,e)},un.prototype.once=function(t,e){this._emitter.$once(t,e)},un.prototype.onDialogDestroyed=function(t){this._emitter.$emit("destroyed",{dialog:t})},Object.defineProperties(un.prototype,fn);var pn={install:function(t,e){void 0===e&&(e={});var n=e.property||"$dialog",r=new un(e);Object.defineProperty(t.prototype,n,{get:function(){return r}})}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(pn),pn}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e(t.vuedl={},t.Vue)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n={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(){void 0!==this.$el.remove?this.$el.remove():this.$el.parentNode.removeChild(this.$el)}};var i=function(){this.__data__=[],this.size=0};var s=function(t,e){return t===e||t!=t&&e!=e};var a=function(t,e){for(var n=t.length;n--;)if(s(t[n][0],e))return n;return-1},c=Array.prototype.splice;var u=function(t){var e=this.__data__,n=a(e,t);return!(n<0||(n==e.length-1?e.pop():c.call(e,n,1),--this.size,0))};var f=function(t){var e=this.__data__,n=a(e,t);return n<0?void 0:e[n][1]};var h=function(t){return a(this.__data__,t)>-1};var l=function(t,e){var n=this.__data__,r=a(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function p(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}p.prototype.clear=i,p.prototype.delete=u,p.prototype.get=f,p.prototype.has=h,p.prototype.set=l;var v=p;var d=function(){this.__data__=new v,this.size=0};var y=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};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,e){return t(e={exports:{}},e.exports),e.exports}var w="object"==typeof b&&b&&b.Object===Object&&b,j="object"==typeof self&&self&&self.Object===Object&&self,O=w||j||Function("return this")(),A=O.Symbol,x=Object.prototype,$=x.hasOwnProperty,P=x.toString,D=A?A.toStringTag:void 0;var S=function(t){var e=$.call(t,D),n=t[D];try{t[D]=void 0;var r=!0}catch(t){}var o=P.call(t);return r&&(e?t[D]=n:delete t[D]),o},k=Object.prototype.toString;var C=function(t){return k.call(t)},z="[object Null]",T="[object Undefined]",E=A?A.toStringTag:void 0;var L=function(t){return null==t?void 0===t?T:z:E&&E in Object(t)?S(t):C(t)};var I=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},R="[object AsyncFunction]",F="[object Function]",N="[object GeneratorFunction]",V="[object Proxy]";var B,U=function(t){if(!I(t))return!1;var e=L(t);return e==F||e==N||e==R||e==V},q=O["__core-js_shared__"],M=(B=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"";var W=function(t){return!!M&&M in t},K=Function.prototype.toString;var H=function(t){if(null!=t){try{return K.call(t)}catch(t){}try{return t+""}catch(t){}}return""},G=/^\[object .+?Constructor\]$/,J=Function.prototype,Q=Object.prototype,X=J.toString,Y=Q.hasOwnProperty,Z=RegExp("^"+X.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var tt=function(t){return!(!I(t)||W(t))&&(U(t)?Z:G).test(H(t))};var et=function(t,e){return null==t?void 0:t[e]};var nt=function(t,e){var n=et(t,e);return tt(n)?n:void 0},rt=nt(O,"Map"),ot=nt(Object,"create");var it=function(){this.__data__=ot?ot(null):{},this.size=0};var st=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},at="__lodash_hash_undefined__",ct=Object.prototype.hasOwnProperty;var ut=function(t){var e=this.__data__;if(ot){var n=e[t];return n===at?void 0:n}return ct.call(e,t)?e[t]:void 0},ft=Object.prototype.hasOwnProperty;var ht=function(t){var e=this.__data__;return ot?void 0!==e[t]:ft.call(e,t)},lt="__lodash_hash_undefined__";var pt=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ot&&void 0===e?lt:e,this};function vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}vt.prototype.clear=it,vt.prototype.delete=st,vt.prototype.get=ut,vt.prototype.has=ht,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 e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var mt=function(t,e){var n=t.__data__;return _t(e)?n["string"==typeof e?"string":"hash"]:n.map};var bt=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e};var gt=function(t){return mt(this,t).get(t)};var wt=function(t){return mt(this,t).has(t)};var jt=function(t,e){var n=mt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Ot(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ot.prototype.clear=yt,Ot.prototype.delete=bt,Ot.prototype.get=gt,Ot.prototype.has=wt,Ot.prototype.set=jt;var At=Ot,xt=200;var $t=function(t,e){var n=this.__data__;if(n instanceof v){var r=n.__data__;if(!rt||r.length<xt-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new At(r)}return n.set(t,e),this.size=n.size,this};function Pt(t){var e=this.__data__=new v(t);this.size=e.size}Pt.prototype.clear=d,Pt.prototype.delete=y,Pt.prototype.get=_,Pt.prototype.has=m,Pt.prototype.set=$t;var Dt=Pt,St=function(){try{var t=nt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var kt=function(t,e,n){"__proto__"==e&&St?St(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n};var Ct=function(t,e,n){(void 0===n||s(t[e],n))&&(void 0!==n||e in t)||kt(t,e,n)};var zt=function(t){return function(e,n,r){for(var o=-1,i=Object(e),s=r(e),a=s.length;a--;){var c=s[t?a:++o];if(!1===n(i[c],c,i))break}return e}}(),Tt=g(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?O.Buffer:void 0,i=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=i?i(n):new t.constructor(n);return t.copy(r),r}}),Et=O.Uint8Array;var Lt=function(t){var e=new t.constructor(t.byteLength);return new Et(e).set(new Et(t)),e};var It=function(t,e){var n=e?Lt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var Rt=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},Ft=Object.create,Nt=function(){function t(){}return function(e){if(!I(e))return{};if(Ft)return Ft(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Vt=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),Bt=Object.prototype;var Ut=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Bt)};var qt=function(t){return"function"!=typeof t.constructor||Ut(t)?{}:Nt(Vt(t))};var Mt=function(t){return null!=t&&"object"==typeof t},Wt="[object Arguments]";var Kt=function(t){return Mt(t)&&L(t)==Wt},Ht=Object.prototype,Gt=Ht.hasOwnProperty,Jt=Ht.propertyIsEnumerable,Qt=Kt(function(){return arguments}())?Kt:function(t){return Mt(t)&&Gt.call(t,"callee")&&!Jt.call(t,"callee")},Xt=Array.isArray,Yt=9007199254740991;var Zt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Yt};var te=function(t){return null!=t&&Zt(t.length)&&!U(t)};var ee=function(t){return Mt(t)&&te(t)};var ne=function(){return!1},re=g(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?O.Buffer:void 0,i=(o?o.isBuffer:void 0)||ne;t.exports=i}),oe="[object Object]",ie=Function.prototype,se=Object.prototype,ae=ie.toString,ce=se.hasOwnProperty,ue=ae.call(Object);var fe=function(t){if(!Mt(t)||L(t)!=oe)return!1;var e=Vt(t);if(null===e)return!0;var n=ce.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ae.call(n)==ue},he={};he["[object Float32Array]"]=he["[object Float64Array]"]=he["[object Int8Array]"]=he["[object Int16Array]"]=he["[object Int32Array]"]=he["[object Uint8Array]"]=he["[object Uint8ClampedArray]"]=he["[object Uint16Array]"]=he["[object Uint32Array]"]=!0,he["[object Arguments]"]=he["[object Array]"]=he["[object ArrayBuffer]"]=he["[object Boolean]"]=he["[object DataView]"]=he["[object Date]"]=he["[object Error]"]=he["[object Function]"]=he["[object Map]"]=he["[object Number]"]=he["[object Object]"]=he["[object RegExp]"]=he["[object Set]"]=he["[object String]"]=he["[object WeakMap]"]=!1;var le=function(t){return Mt(t)&&Zt(t.length)&&!!he[L(t)]};var pe=function(t){return function(e){return t(e)}},ve=g(function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&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}),de=ve&&ve.isTypedArray,ye=de?pe(de):le;var _e=function(t,e){return"__proto__"==e?void 0:t[e]},me=Object.prototype.hasOwnProperty;var be=function(t,e,n){var r=t[e];me.call(t,e)&&s(r,n)&&(void 0!==n||e in t)||kt(t,e,n)};var ge=function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?kt(n,a,c):be(n,a,c)}return n};var we=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},je=9007199254740991,Oe=/^(?:0|[1-9]\d*)$/;var Ae=function(t,e){var n=typeof t;return!!(e=null==e?je:e)&&("number"==n||"symbol"!=n&&Oe.test(t))&&t>-1&&t%1==0&&t<e},xe=Object.prototype.hasOwnProperty;var $e=function(t,e){var n=Xt(t),r=!n&&Qt(t),o=!n&&!r&&re(t),i=!n&&!r&&!o&&ye(t),s=n||r||o||i,a=s?we(t.length,String):[],c=a.length;for(var u in t)!e&&!xe.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Ae(u,c))||a.push(u);return a};var Pe=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},De=Object.prototype.hasOwnProperty;var Se=function(t){if(!I(t))return Pe(t);var e=Ut(t),n=[];for(var r in t)("constructor"!=r||!e&&De.call(t,r))&&n.push(r);return n};var ke=function(t){return te(t)?$e(t,!0):Se(t)};var Ce=function(t){return ge(t,ke(t))};var ze=function(t,e,n,r,o,i,s){var a=_e(t,n),c=_e(e,n),u=s.get(c);if(u)Ct(t,n,u);else{var f=i?i(a,c,n+"",t,e,s):void 0,h=void 0===f;if(h){var l=Xt(c),p=!l&&re(c),v=!l&&!p&&ye(c);f=c,l||p||v?Xt(a)?f=a:ee(a)?f=Rt(a):p?(h=!1,f=Tt(c,!0)):v?(h=!1,f=It(c,!0)):f=[]:fe(c)||Qt(c)?(f=a,Qt(a)?f=Ce(a):(!I(a)||r&&U(a))&&(f=qt(c))):h=!1}h&&(s.set(c,f),o(f,c,r,i,s),s.delete(c)),Ct(t,n,f)}};var Te=function t(e,n,r,o,i){e!==n&&zt(n,function(s,a){if(I(s))i||(i=new Dt),ze(e,n,a,r,t,o,i);else{var c=o?o(_e(e,a),s,a+"",e,n,i):void 0;void 0===c&&(c=s),Ct(e,a,c)}},ke)};var Ee=function(t){return t};var Le=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},Ie=Math.max;var Re=function(t,e,n){return e=Ie(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Ie(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),Le(t,this,a)}};var Fe=function(t){return function(){return t}},Ne=St?function(t,e){return St(t,"toString",{configurable:!0,enumerable:!1,value:Fe(e),writable:!0})}:Ee,Ve=800,Be=16,Ue=Date.now;var qe=function(t){var e=0,n=0;return function(){var r=Ue(),o=Be-(r-n);if(n=r,o>0){if(++e>=Ve)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Ne);var Me=function(t,e){return qe(Re(t,e,Ee),t+"")};var We=function(t,e,n){if(!I(n))return!1;var r=typeof e;return!!("number"==r?te(n)&&Ae(e,n.length):"string"==r&&e in n)&&s(n[e],t)};var Ke=function(t){return Me(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,s&&We(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),e=Object(e);++r<o;){var a=n[r];a&&t(e,a,r,i)}return e})}(function(t,e,n){Te(t,e,n)}),He={},Ge=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"dialog-layout"},[this._t("default")],2)};Ge._withStripped=!0;var Je,Qe,Xe,Ye,Ze,tn=(Je={render:Ge,staticRenderFns:[]},Xe=void 0,Ye=!1,(Ze=("function"==typeof(Qe=He)?Qe.options:Qe)||{}).__file="/Users/yarik/Projects/clones/vuedl/src/components/DefaultLayout.vue",Ze.render||(Ze.render=Je.render,Ze.staticRenderFns=Je.staticRenderFns,Ze._compiled=!0,Ye&&(Ze.functional=!0)),Ze._scopeId=Xe,Ze),en=function(){return{}};function nn(t){t&&!t._isDestroyed&&"function"==typeof t.$destroy&&t.$destroy()}function rn(t){var e;return(e="string"==typeof t?document.querySelector(t):t)||(e=document.body),e}function on(t,e){return new Promise(function(n,r){if(!Array.isArray(t)){if(!t)return n(null);t=[t]}return n(Promise.all(t.map(function(t){var n=[];if(t.options.asyncData&&"function"==typeof t.options.asyncData){var r=function(t,e){var n;return(n=2===t.length?new Promise(function(n){t(e,function(t,r){t&&e.error(t),n(r=r||{})})}):t(e))&&(n instanceof Promise||"function"==typeof n.then)||(n=Promise.resolve(n)),n}(t.options.asyncData,e);r.then(function(e){return function(t,e){var n=t.options.data||en;!e&&t.options.hasAsyncData||(t.options.hasAsyncData=!0,t.options.data=function(){var r=n.call(this);return this.$ssrContext&&(e=this.$ssrContext.asyncData[t.cid]),Object.assign({},r,e)},t._Ctor&&t._Ctor.options&&(t._Ctor.options.data=t.options.data))}(t,e),e}),n.push(r)}else n.push(null);return t.options.fetch?n.push(t.options.fetch(e)):n.push(null),Promise.all(n)})))})}var sn=1,an=function(t,e){void 0===e&&(e={});var n=e.layout,r=e.container;if(!t)throw Error("Component was not setted");this._layout=n||{component:tn,options:{}},this._component=t,this._vm=null,this._vmDialog=null,this._options={},this.id=++sn,this._resolvers=[],this.container=rn(r)},cn={showed:{configurable:!0},element:{configurable:!0},hasAsyncPreload:{configurable:!0},vm:{configurable:!0},vmd:{configurable:!0}};an.prototype.show=function(t,r){return void 0===t&&(t={}),void 0===r&&(r={}),new Promise(function(i,s){var a,c,u,f;if(e.prototype.$isServer)return i();if(a=(a=e.extend({mixins:[o]})).extend(this._layout.component),c=new a(Ke({propsData:Object.assign({},this._layout.options,t)},this.context,r)),u=e.extend(Object.assign({},this._component,{parent:c})),this._component.primaryKey&&(u=u.extend({mixins:[n]})),this.hasAsyncPreload)return Promise.resolve(on(u,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 u(Ke({propsData:t},this.context,r))).$mount(),c.$slots.default=f._vnode,c.$mount(),c.$on("hook:destroyed",this._onDestroyed.bind(this)),c.$on("submit",this.onReturn.bind(this)),f.$on("submit",this.onReturn.bind(this)),this._vm=c,this._vm._dialogInstance=f,this._vmDialog=f,this.container=r.container?rn(r.container):this.container,this.container.appendChild(this.element),i(this)}return h.call(this)}.bind(this))},an.prototype.wait=function(){var t=this;return new Promise(function(e){t._resolvers.push(e)})},an.prototype._onDestroyed=function(){this.remove()},an.prototype.remove=function(){this.onDestroyed&&this.onDestroyed(this),this._processResultPromises(),nn(this._vm),nn(this._vmDialog),this._vm=null,this._vmDialog=null},an.prototype._processResultPromises=function(t){this._resolvers.length&&(this._resolvers.forEach(function(e){return e(t)}),this._resolvers=[])},an.prototype.onReturn=function(t){this._processResultPromises(t),this.close()},cn.showed.get=function(){return!!this._vm&&!this._vm._isDestroyed},cn.element.get=function(){return this._vm&&this._vm.$el},cn.hasAsyncPreload.get=function(){return this._component&&(this._component.asyncData||this._component.fetch)},cn.vm.get=function(){return this._vm},cn.vmd.get=function(){return this._vmDialog},an.prototype.close=function(){this._vm.close()},Object.defineProperties(an.prototype,cn);var un=function(t){this._component=t,this._vm=null};un.prototype.show=function(){if(!this._vm){var t=e.extend(this._component);this._vm=new t,this._vm.$mount(),document.body.appendChild(this._vm.$el)}this._vm.visible=!0},un.prototype.hide=function(){this._vm.visible=!1};var fn={get:function(t,e){return"symbol"==typeof e||"inspect"===e?t[e]:t[e]?t[e]:t._components[e]?t.createFunctionWrapper(e):t[e]}},hn=function(t){void 0===t&&(t={});var n=t.context,r=t.container;return this._context=n||{},an.prototype.context=n||{},this._components={},this._layouts={},this._overlays={},this._container=r,this._emitter=new e({}),this._instances=[],new Proxy(this,fn)},ln={context:{configurable:!0}};ln.context.get=function(){return this._context},hn.prototype.layout=function(t,e,n){void 0===n&&(n={}),this._layouts[t]={component:e,options:n}},hn.prototype.getLayout=function(t){if("function"==typeof t){var e=t.call(this._context);return t=this._layouts[e.name||"default"],Object.assign({},t,{options:e})}if("object"==typeof t&&"function"==typeof t.render)return{component:t};if(Array.isArray(t)){var n=t[0],r=t[1]||{},o="object"==typeof n&&"function"==typeof n.render?{component:n}:this._layouts[n];return o&&{component:o.component,options:Object.assign({},o.options,r)}}return this._layouts[t]},hn.prototype.overlay=function(t,e){if(void 0===e){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 un(e)},hn.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]},hn.prototype.component=function(t,e,n){if(void 0===n&&(n={}),void 0===e)return this._components[t];this._components[t]={component:e,options:n}},hn.prototype.create=function(t){if(!t)throw new Error("Component is incorrect");var e=this.getLayout(t.layout||"default"),n=new an(t,{layout:e,context:this._context,container:this._container});return this._emitter.$emit("created",{dialog:n}),n},hn.prototype.show=function(t,e){return void 0===e&&(e={}),new Promise(function(n,r){var o,i,s;i=!!(o=this.create(t)).hasAsyncPreload&&(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(e)).then(function(t){try{return this._emitter.$emit("shown",{dialog:o}),s&&s.hide(),o.onDestroyed=this.onDialogDestroyed.bind(this),n(e.waitForResult?o.wait():o)}catch(t){return a(t)}}.bind(this),a)}catch(t){a(t)}}.bind(this))},hn.prototype.createFunctionWrapper=function(t){var e=this,n=this.getComponent(t);return function(t){return e.show(n.component,Object.assign({},n.options,t))}},hn.prototype.showAndWait=function(t,e){return new Promise(function(n,r){return Promise.resolve(this.show(t,e)).then(function(t){try{return n(t.wait())}catch(t){return r(t)}},r)}.bind(this))},hn.prototype.on=function(t,e){this._emitter.$on(t,e)},hn.prototype.off=function(t,e){this._emitter.$off(t,e)},hn.prototype.once=function(t,e){this._emitter.$once(t,e)},hn.prototype.onDialogDestroyed=function(t){this._emitter.$emit("destroyed",{dialog:t})},Object.defineProperties(hn.prototype,ln);var pn={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)}}},vn=[];function dn(t,e){void 0===e&&(e={});var n=e.property||"$dialog",r=new hn(e);Object.defineProperty(t.prototype,n,{get:function(){return r}})}var yn={name:"Actionable",mixins:[pn],data:function(){return{loadingAction:null}},props:{actions:{type:[Array,Object],default:function(){return[]}},handle:Function,params:Object},computed:{actionlist:function(){var t=[];for(var e in this.actions){var n=this.actions[e];"string"==typeof n&&(n={text:n}),n.key||(n.key=isNaN(e)?e:n.text||e),["true","false"].indexOf(n.key)>=0&&(n.key=JSON.parse(n.key)),"string"==typeof n.icon&&(n.icon={text:n.icon}),t.push(n)}return t}},methods:{trigger:function(t){var e=this.actionlist.find(function(e){return e.key===t});e&&!this.isActionDisabled(e)&&this.isActionVisible(e)&&this.onActionClick(e)},setLoadingToInstance:function(t,e){t&&void 0!==t.loading&&(t.loading=e)},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,e){return void 0===t?e:"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(e,n){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),c.call(this);this.loadingAction=t.key,this.setLoadingState(!0);var i=function(){try{return c.call(this)}catch(t){return n(t)}}.bind(this),s=function(t){try{throw this.setLoadingState(!1),console.log("error",t),t}catch(t){return n(t)}}.bind(this);try{var a;return Promise.resolve(o(this.params)).then(function(e){try{return a=e,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 c(){return e()}}.bind(this))}}},_n=r,mn={name:"Confirmable",props:{type:{type:String},text:{type:String,reqiured:!0},title:{type:String},actions:{type:[Array,Object]}}},bn={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}}},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.timer)},startTimer:function(){this.timeout>0&&(this.timer=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 e,n,r;t?(n=(e=this).position,r=10,vn.filter(function(t){return t.position===n}).forEach(function(t){r+=t.$el.offsetHeight+10}),vn.push(e),e.verticalOffset=r):function(t){var e=vn.findIndex(function(e){return e===t});if(!(e<0)){vn.splice(e,1);var n=vn.length,r=t.position;if(n){var o=10;vn.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)}},gn=n,wn=pn,jn=null;"undefined"!=typeof window?jn=window.Vue:"undefined"!=typeof global&&(jn=global.Vue),jn&&jn.use({install:dn}),t.install=dn,t.Actionable=yn,t.Activable=_n,t.Confirmable=mn,t.Notifiable=bn,t.Recordable=gn,t.Returnable=wn,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vuedl.min.js.map |
{ | ||
"name": "vuedl", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Vue dialog helper", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -12,3 +12,10 @@ # Vuedl - vue dialog helper | ||
<!-- ## Demo page --> | ||
<!-- [See demo here](https://yariksav.github.io/demo_vuedl.html) --> | ||
<!-- [See demo here](https://yariksav.github.io/demo_vuedl.html) | ||
--> | ||
## Used in frameworks | ||
1. [vuetify](https://www.npmjs.com/package/vuetify-dialog) | ||
2. [bootstrap-vue](https://www.npmjs.com/package/bootstrap-vue-dialog) | ||
## Setup | ||
@@ -114,3 +121,3 @@ | ||
1. Returning a `Promise`. v-dialog will wait for the promise to be resolved before rendering the component. | ||
1. Returning a `Promise`. Vuedl will wait for the promise to be resolved before rendering the component. | ||
2. Using the [async/await proposal](https://github.com/lukehoban/ecmascript-asyncawait) ([learn more about it](https://zeit.co/blog/async-and-await)) | ||
@@ -117,0 +124,0 @@ 3. Define a callback as second argument. It has to be called like this: `callback(err, data)` |
@@ -11,60 +11,38 @@ /* | ||
import DialogManager from './manager' | ||
// import DialogLayout from './components/DialogLayout.vue' | ||
// import NotificationLayout from './components/NotificationLayout.vue' | ||
// import DialogOverlay from './components/DialogOverlay.vue' | ||
// import Confirm from './components/Confirm.vue' | ||
import _Actionable from './mixins/actionable' | ||
import _Activable from './mixins/activable' | ||
import _Confirmable from './mixins/confirmable' | ||
import _Notifiable from './mixins/notifiable' | ||
import _Recordable from './mixins/recordable' | ||
import _Returnable from './mixins/returnable' | ||
// import Actionable from './mixins/actionable' | ||
// import Activable from './mixins/activable' | ||
// import Confirmable from './mixins/confirmable' | ||
// import Notifiable from './mixins/notifiable' | ||
// import Recordable from './mixins/recordable' | ||
// import Returnable from './mixins/returnable' | ||
export function install (Vue, options = {}) { | ||
const property = options.property || '$dialog' | ||
const manager = new DialogManager(options) | ||
const Plugin = { | ||
install (Vue, options = {}) { | ||
const property = options.property || '$dialog' | ||
const manager = new DialogManager(options) | ||
Object.defineProperty(Vue.prototype, property, { | ||
get () { | ||
return manager | ||
} | ||
}) | ||
} | ||
Object.defineProperty(Vue.prototype, property, { | ||
get () { | ||
return manager | ||
} | ||
}) | ||
// Vue.prototype[property] = manager | ||
export const Actionable = _Actionable | ||
export const Activable = _Activable | ||
export const Confirmable = _Confirmable | ||
export const Notifiable = _Notifiable | ||
export const Recordable = _Recordable | ||
export const Returnable = _Returnable | ||
// manager.layout('default', DialogLayout) | ||
// manager.layout('notification', NotificationLayout) | ||
// manager.overlay('default', DialogOverlay) | ||
// manager.component('confirm', Confirm, { | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('warning', Confirm, { | ||
// type: 'warning', | ||
// waitForResult: true, | ||
// actions: { | ||
// 'false': 'Cancel', | ||
// 'true': 'OK' | ||
// } | ||
// }) | ||
// manager.component('error', Confirm, { | ||
// type: 'error', | ||
// waitForResult: true, | ||
// actions: [ | ||
// 'OK' | ||
// ] | ||
// }) | ||
} | ||
// Auto-install | ||
let GlobalVue = null | ||
if (typeof window !== 'undefined') { | ||
GlobalVue = window.Vue | ||
} else if (typeof global !== 'undefined') { | ||
GlobalVue = global.Vue | ||
} | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(Plugin) | ||
if (GlobalVue) { | ||
GlobalVue.use({ | ||
install | ||
}) | ||
} | ||
export default Plugin |
@@ -19,2 +19,3 @@ import Returnable from './returnable' | ||
}, | ||
handle: Function, | ||
params: Object | ||
@@ -86,7 +87,8 @@ }, | ||
const closable = action.closable === undefined || action.closable === true | ||
if (action.handle) { | ||
const handle = action.handle || this.handle | ||
if (typeof handle === 'function') { | ||
this.loadingAction = action.key | ||
this.setLoadingState(true) | ||
try { | ||
let ret = await action.handle(this.params) | ||
let ret = await handle(this.params) | ||
this.setLoadingState(false) | ||
@@ -93,0 +95,0 @@ if (ret !== false && closable) { |
Sorry, the diff of this file is too big to display
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
736049
67
6845
221