|
|
@ -314,6 +314,7 @@ |
|
|
|
var first = options.initState, |
|
|
|
var first = options.initState, |
|
|
|
current, |
|
|
|
current, |
|
|
|
rootLayer, |
|
|
|
rootLayer, |
|
|
|
|
|
|
|
interactive, |
|
|
|
stack = name, |
|
|
|
stack = name, |
|
|
|
dialogs = {}, |
|
|
|
dialogs = {}, |
|
|
|
|
|
|
|
|
|
|
@ -332,7 +333,8 @@ |
|
|
|
// Клонирование данных |
|
|
|
// Клонирование данных |
|
|
|
var data = JSON.parse(JSON.stringify(spec.data)); |
|
|
|
var data = JSON.parse(JSON.stringify(spec.data)); |
|
|
|
|
|
|
|
|
|
|
|
current = spec; |
|
|
|
current = spec; // текущий диалог |
|
|
|
|
|
|
|
interactive = true; // идет анимация |
|
|
|
(spec.prepare || noop)(data, dialogs); |
|
|
|
(spec.prepare || noop)(data, dialogs); |
|
|
|
|
|
|
|
|
|
|
|
Ply.create(spec.ui || 'alert', spec.options || {}, data).then((layer) => { |
|
|
|
Ply.create(spec.ui || 'alert', spec.options || {}, data).then((layer) => { |
|
|
@ -341,12 +343,13 @@ |
|
|
|
if (rootLayer) { |
|
|
|
if (rootLayer) { |
|
|
|
promise = rootLayer[/^inner/.test(effect) ? 'innerSwap' : 'swap'](layer, effect); |
|
|
|
promise = rootLayer[/^inner/.test(effect) ? 'innerSwap' : 'swap'](layer, effect); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
promise = layer.open(); |
|
|
|
|
|
|
|
rootLayer = layer; |
|
|
|
rootLayer = layer; |
|
|
|
|
|
|
|
promise = rootLayer.open(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
promise.then(() => { |
|
|
|
promise.then(() => { |
|
|
|
dialogs[spec.$name].el = rootLayer.layerEl; |
|
|
|
dialogs[spec.$name].el = rootLayer.layerEl; |
|
|
|
|
|
|
|
interactive = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
callback(layer); |
|
|
|
callback(layer); |
|
|
@ -371,10 +374,16 @@ |
|
|
|
|
|
|
|
|
|
|
|
//noinspection FunctionWithInconsistentReturnsJS |
|
|
|
//noinspection FunctionWithInconsistentReturnsJS |
|
|
|
rootLayer.options.callback = (ui) => { |
|
|
|
rootLayer.options.callback = (ui) => { |
|
|
|
|
|
|
|
if (interactive) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var isNext = ui.state || (current.back === 'next'), |
|
|
|
var isNext = ui.state || (current.back === 'next'), |
|
|
|
swap = isNext ? stack[current.next] : stack[current.back] |
|
|
|
swap = stack[current[isNext ? 'next' : 'back']] |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(current.$name, stack[current[isNext ? 'next' : 'back']]); |
|
|
|
|
|
|
|
|
|
|
|
if (swap) { |
|
|
|
if (swap) { |
|
|
|
changeLayer(swap, current[isNext ? 'nextEffect' : 'backEffect'], (layer) => { |
|
|
|
changeLayer(swap, current[isNext ? 'nextEffect' : 'backEffect'], (layer) => { |
|
|
|
_progress(ui, layer); |
|
|
|
_progress(ui, layer); |
|
|
|