mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Drop popupVisibilityNames/viewModelName in favor of the new visiblePopups Set
This commit is contained in:
parent
1d29a281b4
commit
11f69ef9e4
3 changed files with 17 additions and 21 deletions
|
|
@ -8,18 +8,15 @@ import { ViewType } from 'Knoin/Knoin';
|
||||||
class AbstractView {
|
class AbstractView {
|
||||||
constructor(name, templateID, type)
|
constructor(name, templateID, type)
|
||||||
{
|
{
|
||||||
this.viewModelName = 'View/' + name;
|
|
||||||
this.viewModelTemplateID = templateID;
|
this.viewModelTemplateID = templateID;
|
||||||
this.viewModelPosition = type;
|
this.viewModelPosition = type;
|
||||||
|
|
||||||
this.bDisabeCloseOnEsc = false;
|
|
||||||
this.sDefaultScope = Scope.None;
|
this.sDefaultScope = Scope.None;
|
||||||
this.sCurrentScope = Scope.None;
|
this.sCurrentScope = Scope.None;
|
||||||
|
|
||||||
this.viewModelVisible = false;
|
this.viewModelVisible = false;
|
||||||
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||||
|
|
||||||
this.viewModelName = '';
|
|
||||||
this.viewModelDom = null;
|
this.viewModelDom = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,6 +61,7 @@ export class AbstractViewPopup extends AbstractView
|
||||||
if (name in Scope) {
|
if (name in Scope) {
|
||||||
this.sDefaultScope = Scope[name];
|
this.sDefaultScope = Scope[name];
|
||||||
}
|
}
|
||||||
|
this.bDisabeCloseOnEsc = false;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
cancelCommand() {}
|
cancelCommand() {}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { doc, $htmlCL } from 'Common/Globals';
|
||||||
import { arrayLength, isFunction } from 'Common/Utils';
|
import { arrayLength, isFunction } from 'Common/Utils';
|
||||||
|
|
||||||
let currentScreen = null,
|
let currentScreen = null,
|
||||||
visiblePopups = new Set,
|
|
||||||
defaultScreenName = '';
|
defaultScreenName = '';
|
||||||
|
|
||||||
const SCREENS = {},
|
const SCREENS = {},
|
||||||
|
|
@ -13,6 +12,8 @@ const SCREENS = {},
|
||||||
af && af.focus();
|
af && af.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
visiblePopups = new Set,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} screenName
|
* @param {string} screenName
|
||||||
* @returns {?Object}
|
* @returns {?Object}
|
||||||
|
|
@ -62,10 +63,10 @@ const SCREENS = {},
|
||||||
vm.modalVisibility.subscribe(value => {
|
vm.modalVisibility.subscribe(value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
visiblePopups.add(vm);
|
visiblePopups.add(vm);
|
||||||
vmDom.style.zIndex = 3000 + popupVisibilityNames().length + 10;
|
vmDom.style.zIndex = 3000 + visiblePopups.size + 10;
|
||||||
vmDom.hidden = false;
|
vmDom.hidden = false;
|
||||||
vm.storeAndSetScope();
|
vm.storeAndSetScope();
|
||||||
popupVisibilityNames.push(vm.viewModelName);
|
arePopupsVisible(true);
|
||||||
requestAnimationFrame(() => { // wait just before the next paint
|
requestAnimationFrame(() => { // wait just before the next paint
|
||||||
vmDom.offsetHeight; // force a reflow
|
vmDom.offsetHeight; // force a reflow
|
||||||
vmDom.classList.add('show'); // trigger the transitions
|
vmDom.classList.add('show'); // trigger the transitions
|
||||||
|
|
@ -75,7 +76,7 @@ const SCREENS = {},
|
||||||
vm.onHide && vm.onHide();
|
vm.onHide && vm.onHide();
|
||||||
vmDom.classList.remove('show');
|
vmDom.classList.remove('show');
|
||||||
vm.restoreScope();
|
vm.restoreScope();
|
||||||
popupVisibilityNames(popupVisibilityNames.filter(v=>v!==vm.viewModelName));
|
arePopupsVisible(0 < visiblePopups.size);
|
||||||
}
|
}
|
||||||
vmDom.setAttribute('aria-hidden', !value);
|
vmDom.setAttribute('aria-hidden', !value);
|
||||||
});
|
});
|
||||||
|
|
@ -211,8 +212,6 @@ const SCREENS = {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const
|
export const
|
||||||
popupVisibilityNames = ko.observableArray(),
|
|
||||||
|
|
||||||
ViewType = {
|
ViewType = {
|
||||||
Popup: 'Popups',
|
Popup: 'Popups',
|
||||||
Left: 'Left',
|
Left: 'Left',
|
||||||
|
|
@ -276,7 +275,7 @@ export const
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
arePopupsVisible = () => 0 < visiblePopups.size,
|
arePopupsVisible = ko.observable(false),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToShow
|
* @param {Function} ViewModelClassToShow
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import { ThemeStore } from 'Stores/Theme';
|
||||||
|
|
||||||
import Remote from 'Remote/User/Fetch';
|
import Remote from 'Remote/User/Fetch';
|
||||||
|
|
||||||
import { decorateKoCommands, showScreenPopup, popupVisibilityNames } from 'Knoin/Knoin';
|
import { decorateKoCommands, showScreenPopup, arePopupsVisible } from 'Knoin/Knoin';
|
||||||
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
import { AbstractViewRight } from 'Knoin/AbstractViews';
|
||||||
|
|
||||||
import { FolderClearPopupView } from 'View/Popup/FolderClear';
|
import { FolderClearPopupView } from 'View/Popup/FolderClear';
|
||||||
|
|
@ -74,16 +74,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
this.messageListSearch = MessageUserStore.listSearch;
|
this.messageListSearch = MessageUserStore.listSearch;
|
||||||
this.messageListError = MessageUserStore.listError;
|
this.messageListError = MessageUserStore.listError;
|
||||||
|
|
||||||
this.addComputables({
|
this.popupVisibility = arePopupsVisible;
|
||||||
popupVisibility: () => 0 < popupVisibilityNames().length,
|
|
||||||
|
|
||||||
folderMenuForMove: () =>
|
|
||||||
folderListOptionsBuilder(
|
|
||||||
[FolderUserStore.currentFolderFullNameRaw()],
|
|
||||||
[],
|
|
||||||
item => item ? item.localName() : ''
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
|
this.useCheckboxesInList = SettingsUserStore.useCheckboxesInList;
|
||||||
|
|
||||||
|
|
@ -113,6 +104,14 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
this.sLastSearchValue = '';
|
this.sLastSearchValue = '';
|
||||||
|
|
||||||
this.addComputables({
|
this.addComputables({
|
||||||
|
|
||||||
|
folderMenuForMove: () =>
|
||||||
|
folderListOptionsBuilder(
|
||||||
|
[FolderUserStore.currentFolderFullNameRaw()],
|
||||||
|
[],
|
||||||
|
item => item ? item.localName() : ''
|
||||||
|
),
|
||||||
|
|
||||||
messageListSearchDesc: () => {
|
messageListSearchDesc: () => {
|
||||||
const value = MessageUserStore.listEndSearch();
|
const value = MessageUserStore.listEndSearch();
|
||||||
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { SEARCH: value }) : ''
|
return value ? i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', { SEARCH: value }) : ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue