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