allow using apf elements in dialog.wizard

pull/297/merge
nightwing 2017-06-02 10:21:56 +04:00
rodzic 3cb30dc33d
commit 1cfd183e2d
1 zmienionych plików z 20 dodań i 10 usunięć

Wyświetl plik

@ -1,11 +1,12 @@
define(function(require, module, exports) { define(function(require, module, exports) {
main.consumes = ["Plugin", "ui", "Dialog"]; main.consumes = ["Plugin", "ui", "Dialog", "apf"];
main.provides = ["Wizard", "WizardPage"]; main.provides = ["Wizard", "WizardPage"];
return main; return main;
function main(options, imports, register) { function main(options, imports, register) {
var Plugin = imports.Plugin; var Plugin = imports.Plugin;
var Dialog = imports.Dialog; var Dialog = imports.Dialog;
var apf = imports.apf;
var ui = imports.ui; var ui = imports.ui;
/***** Initialization *****/ /***** Initialization *****/
@ -41,8 +42,10 @@ define(function(require, module, exports) {
if (drawn) return; if (drawn) return;
drawn = true; drawn = true;
body = { html: document.createElement("div") }; var aml = new ui.bar();
options.html.parentNode.replaceChild(body.html, options.html); options.aml.parentNode.insertBefore(aml, options.aml);
options.aml.removeNode();
body = { html: aml.$ext, aml: aml };
} }
/***** Methods *****/ /***** Methods *****/
@ -244,7 +247,7 @@ define(function(require, module, exports) {
var emit = plugin.getEmitter(); var emit = plugin.getEmitter();
var name = options.name; var name = options.name;
var container; var aml;
if (forPlugin) if (forPlugin)
forPlugin.addOther(function() { plugin.unload(); }); forPlugin.addOther(function() { plugin.unload(); });
@ -254,24 +257,26 @@ define(function(require, module, exports) {
if (drawn) return; if (drawn) return;
drawn = true; drawn = true;
container = document.createElement("div"); aml = new ui.bar();
plugin.addOther(function() { plugin.addOther(function() {
container.parentNode.removeChild(container); aml.removeNode();
}); });
apf.document.documentElement.appendChild(aml);
aml.removeNode();
emit.sticky("draw", { html: container }); emit.sticky("draw", { html: aml.$ext, aml: aml });
} }
/***** Methods *****/ /***** Methods *****/
function hide() { function hide() {
container.parentNode.removeChild(container); aml.parentNode.removeChild(aml);
emit("hide"); emit("hide");
} }
function show(options) { function show(options) {
draw(); draw();
options && options.html.appendChild(container); options && options.aml.appendChild(aml);
emit("show"); emit("show");
} }
@ -291,7 +296,12 @@ define(function(require, module, exports) {
/** /**
* *
*/ */
get container() { return container; }, get aml() { return aml; },
/**
*
*/
get container() { return aml && aml.$ext; },
_events: [ _events: [
/** /**