Improved AbstractScreen properties

Improved settings screens
Views:
* sDefaultScope & sCurrentScope to sub-class keyScope
* drop viewModelVisible
* rename viewModelTemplateID to templateID
* rename viewModelPosition to viewType
This commit is contained in:
djmaze 2021-09-22 20:17:44 +02:00
parent 11f69ef9e4
commit 8be4c384bb
27 changed files with 136 additions and 196 deletions

View file

@ -8,32 +8,32 @@ import { ViewType } from 'Knoin/Knoin';
class AbstractView {
constructor(name, templateID, type)
{
this.viewModelTemplateID = templateID;
this.viewModelPosition = type;
// Object.defineProperty(this, 'templateId', { value: templateID });
this.templateId = templateID;
this.viewType = type;
this.viewModelDom = null;
this.sDefaultScope = Scope.None;
this.sCurrentScope = Scope.None;
this.viewModelVisible = false;
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
this.viewModelDom = null;
this.keyScope = {
scope: Scope.None,
previous: Scope.None,
set: function() {
this.previous = keyScope();
keyScope(this.scope);
},
unset: function() {
keyScope(this.previous);
}
};
}
/**
* @returns {void}
*/
storeAndSetScope() {
this.sCurrentScope = keyScope();
keyScope(this.sDefaultScope);
}
/**
* @returns {void}
*/
restoreScope() {
keyScope(this.sCurrentScope);
}
/*
onBuild() {}
onBeforeShow() {}
onShow() {}
onHide() {}
*/
querySelector(selectors) {
return this.viewModelDom.querySelector(selectors);
@ -59,11 +59,14 @@ export class AbstractViewPopup extends AbstractView
{
super('Popup/' + name, 'Popups' + name, ViewType.Popup);
if (name in Scope) {
this.sDefaultScope = Scope[name];
this.keyScope.scope = Scope[name];
}
this.bDisabeCloseOnEsc = false;
}
/*
onShowWithDelay() {}
onHideWithDelay() {}
cancelCommand() {}
closeCommand() {}
*/
@ -109,3 +112,14 @@ export class AbstractViewRight extends AbstractView
super(name, templateID, ViewType.Right);
}
}
/*
export class AbstractViewSettings
{
onBuild(viewModelDom) {}
onBeforeShow() {}
onShow() {}
onHide() {}
viewModelDom
}
*/