ucbuilder
Version:
For Developing Applications with multiple form/usercontrols etc.. In Single BrowserWindow...
92 lines (90 loc) • 3.31 kB
JavaScript
;
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.winManager = exports.winContiner = void 0;
const common_1 = require("ucbuilder/build/common");
const focusManage_1 = require("ucbuilder/global/focusManage");
//import { winFrame } from '../../uccontrols/controls/winFrame.uc';
class winContiner {
}
exports.winContiner = winContiner;
winContiner.source = [];
winContiner.randomName = 'w' + common_1.uniqOpt.randomNo();
class winManager {
}
exports.winManager = winManager;
_a = winManager;
//mainNode: HTMLElement;
winManager.curIndex = 0;
winManager.pages = [];
winManager.focusMng = new focusManage_1.FocusManager();
winManager.transperency = document.createElement("tbck" + common_1.uniqOpt.randomNo()); //undefined;
// constructor(/*mainNode: HTMLElement, */frame: winFrame) {
// // this.mainNode = mainNode;
// frame.ucExtends.passElement(this.transperency);
// }
winManager.push = (form) => {
let _this = _a;
if (_this.CURRENT_WIN != undefined) {
_a.setfreez(true, _this.CURRENT_WIN.ucExtends.self);
}
_this.CURRENT_WIN = form;
_this.pages.push(_this.CURRENT_WIN);
_this.curIndex = _this.pages.length - 1;
//console.log(form.ucExtends.wrapperHT.isConnected);
/*form.ucExtends.Events.loaded.on(() => {
form.ucExtends.wrapperHT.before(this.transperency);
})*/
};
winManager.pop = () => {
_a.curIndex = _a.pages.length - 1;
//
if (_a.curIndex >= 0) {
_a.pages.pop();
_a.curIndex--;
_a.CURRENT_WIN = _a.pages[_a.curIndex];
if (_a.CURRENT_WIN != undefined) {
let _wrapperHT = _a.CURRENT_WIN.ucExtends.self;
_wrapperHT.before(_a.transperency);
_a.setfreez(false, _wrapperHT);
return;
}
}
_a.transperency.remove();
_a.CURRENT_WIN = undefined;
};
winManager.ATTR = {
DISABLE: {
NEW_VALUE: "disnval" + common_1.uniqOpt.randomNo(),
OLD_VALUE: "disoval" + common_1.uniqOpt.randomNo(),
}
};
winManager.setfreez = (freez, element) => {
if (freez) {
_a.focusMng.fetch();
element.setAttribute('active', '0');
let eles = element.querySelectorAll(common_1.controlOpt.ATTR.editableControls);
eles.forEach((e) => {
let disableAttr = e.getAttribute("disabled");
if (disableAttr != null)
e.data(winManager.ATTR.DISABLE.OLD_VALUE, disableAttr);
e.setAttribute('disabled', 'true');
e.setAttribute(winManager.ATTR.DISABLE.NEW_VALUE, 'true');
});
}
else {
element.setAttribute('active', '1');
let eles = element.querySelectorAll(`[${winManager.ATTR.DISABLE.NEW_VALUE}]`);
eles.forEach((e) => {
let disableAttr = e.data(winManager.ATTR.DISABLE.OLD_VALUE);
// console.log(element);
// console.log(disableAttr);
if (disableAttr != undefined)
e.setAttribute('disabled', disableAttr);
else
e.removeAttribute('disabled');
// e.removeAttribute('disabled', winManager.ATTR.DISABLE.NEW_VALUE);
});
_a.focusMng.focus(element);
}
};