This commit is contained in:
antelle 2019-09-16 17:58:44 +02:00
parent 7730486f30
commit 6606fa8108
5 changed files with 22 additions and 13 deletions

View File

@ -30,7 +30,11 @@ class View extends EventEmitter {
return; return;
} }
this.debugLogger && this.debugLogger.debug('Render start'); let ts;
if (this.debugLogger) {
this.debugLogger.debug('Render start');
ts = this.debugLogger.ts();
}
if (this.el) { if (this.el) {
Tip.destroyTips(this.el); Tip.destroyTips(this.el);
@ -42,7 +46,7 @@ class View extends EventEmitter {
Tip.createTips(this.el); Tip.createTips(this.el);
this.debugLogger && this.debugLogger.debug('Render finished'); this.debugLogger && this.debugLogger.debug('Render finished', this.debugLogger.ts(ts));
return this; return this;
} }
@ -69,7 +73,9 @@ class View extends EventEmitter {
el.innerHTML = html; el.innerHTML = html;
const root = el.firstChild; const root = el.firstChild;
if (this.options.ownParent) { if (this.options.ownParent) {
parent.appendChild(root); if (root) {
parent.appendChild(root);
}
this.el = parent; this.el = parent;
} else { } else {
this.el = root; this.el = root;
@ -161,6 +167,7 @@ class View extends EventEmitter {
} }
toggle(visible) { toggle(visible) {
this.debugLogger && this.debugLogger.debug(visible ? 'Show' : 'Hide');
if (visible === undefined) { if (visible === undefined) {
visible = this.hidden; visible = this.hidden;
} }

View File

@ -45,9 +45,9 @@ class AppView extends View {
super(model); super(model);
this.views.menu = new MenuView(this.model.menu, { ownParent: true }); this.views.menu = new MenuView(this.model.menu, { ownParent: true });
this.views.menuDrag = new DragView('x', { parent: '.app__menu-drag' }); this.views.menuDrag = new DragView('x', { parent: '.app__menu-drag' });
this.views.footer = new FooterView(this.model); this.views.footer = new FooterView(this.model, { ownParent: true });
this.views.listWrap = new ListWrapView(this.model); this.views.listWrap = new ListWrapView(this.model, { ownParent: true });
this.views.list = new ListView(this.model); this.views.list = new ListView(this.model, { ownParent: true });
this.views.listDrag = new DragView('x', { parent: '.app__list-drag' }); this.views.listDrag = new DragView('x', { parent: '.app__list-drag' });
this.views.list.dragView = this.views.listDrag; this.views.list.dragView = this.views.listDrag;
this.views.details = new DetailsView(); this.views.details = new DetailsView();

View File

@ -20,8 +20,8 @@ class FooterView extends View {
'click .footer__btn-lock': 'lockWorkspace' 'click .footer__btn-lock': 'lockWorkspace'
}; };
constructor(model) { constructor(model, options) {
super(model); super(model, options);
this.onKey(Keys.DOM_VK_L, this.lockWorkspace, KeyHandler.SHORTCUT_ACTION, false, true); this.onKey(Keys.DOM_VK_L, this.lockWorkspace, KeyHandler.SHORTCUT_ACTION, false, true);
this.onKey(Keys.DOM_VK_G, this.genPass, KeyHandler.SHORTCUT_ACTION); this.onKey(Keys.DOM_VK_G, this.genPass, KeyHandler.SHORTCUT_ACTION);

View File

@ -44,8 +44,8 @@ class ListView extends View {
{ val: 'fileName', name: 'file', enabled: false } { val: 'fileName', name: 'file', enabled: false }
]; ];
constructor(model) { constructor(model, options) {
super(model); super(model, options);
this.initScroll(); this.initScroll();
this.views.search = new ListSearchView(this.model); this.views.search = new ListSearchView(this.model);

View File

@ -3,15 +3,17 @@ import { View } from 'view-engine/view';
class ListWrapView extends View { class ListWrapView extends View {
parent = '.app__list-wrap'; parent = '.app__list-wrap';
template = () => '';
events = {}; events = {};
constructor(model) { constructor(model, options) {
super(model); super(model, options);
this.listenTo(this.model.settings, 'change:tableView', this.setListLayout); this.listenTo(this.model.settings, 'change:tableView', this.setListLayout);
} }
render() { render() {
this.el = document.querySelector(this.parent); super.render();
this.setListLayout(); this.setListLayout();
} }