2019-07-05 03:19:24 +08:00
|
|
|
import { KeyState } from 'Common/Enums';
|
|
|
|
import { leftPanelDisabled } from 'Common/Globals';
|
|
|
|
import { settings, inbox } from 'Common/Links';
|
|
|
|
import { getFolderInboxName } from 'Common/Cache';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-09-17 02:35:29 +08:00
|
|
|
import { view, ViewType, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
2019-07-05 03:19:24 +08:00
|
|
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
2016-08-17 06:01:20 +08:00
|
|
|
|
|
|
|
@view({
|
|
|
|
name: 'View/User/Settings/Menu',
|
|
|
|
type: ViewType.Left,
|
|
|
|
templateID: 'SettingsMenu'
|
|
|
|
})
|
2019-07-05 03:19:24 +08:00
|
|
|
class MenuSettingsUserView extends AbstractViewNext {
|
2016-08-17 06:01:20 +08:00
|
|
|
/**
|
|
|
|
* @param {Object} screen
|
|
|
|
*/
|
|
|
|
constructor(screen) {
|
|
|
|
super();
|
2014-10-18 05:02:19 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.leftPanelDisabled = leftPanelDisabled;
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2020-09-04 18:05:17 +08:00
|
|
|
this.mobile = rl.settings.app('mobile');
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
this.menu = screen.menu;
|
|
|
|
}
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
onBuild(dom) {
|
2019-07-05 03:19:24 +08:00
|
|
|
if (this.mobile) {
|
2020-08-30 16:30:50 +08:00
|
|
|
dom.addEventListener('click', event =>
|
|
|
|
event.target.closestWithin('.b-settings-menu .e-item.selectable', dom) && leftPanelDisabled(true)
|
|
|
|
);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-05-01 09:07:10 +08:00
|
|
|
|
2020-09-26 16:20:24 +08:00
|
|
|
shortcuts.add('arrowup,arrowdown', '', KeyState.Settings,
|
2020-09-26 06:02:29 +08:00
|
|
|
settingsMenuKeysHandler(dom.querySelectorAll('.b-settings-menu .e-item')));
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-09-03 07:19:37 +08:00
|
|
|
link(route) {
|
|
|
|
return settings(route);
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2016-08-17 06:01:20 +08:00
|
|
|
backToMailBoxClick() {
|
2020-09-17 02:35:29 +08:00
|
|
|
rl.route.setHash(inbox(getFolderInboxName()));
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
}
|
2014-09-06 05:44:29 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
export { MenuSettingsUserView, MenuSettingsUserView as default };
|