Browse Source

Fix update of layers. Closes #5607

pull/5622/head
Artur Arseniev 3 years ago
parent
commit
3e029b88e2
  1. 30
      src/navigator/view/ItemView.ts

30
src/navigator/view/ItemView.ts

@ -76,7 +76,7 @@ export default class ItemView extends View {
</div> </div>
</div> </div>
<div class="${pfx}layer-item-right"> <div class="${pfx}layer-item-right">
${count ? `<div class="${this.clsCount}" data-count>${count || ''}</div>` : ''} <div class="${this.clsCount}" data-count>${count || ''}</div>
<div class="${this.clsMove}" data-toggle-move>${move || ''}</div> <div class="${this.clsMove}" data-toggle-move>${move || ''}</div>
</div> </div>
</div> </div>
@ -115,10 +115,8 @@ export default class ItemView extends View {
clsEdit: string; clsEdit: string;
clsNoEdit: string; clsNoEdit: string;
_rendered?: boolean; _rendered?: boolean;
eyeEl?: JQuery<HTMLElement>;
caret?: JQuery<HTMLElement>; caret?: JQuery<HTMLElement>;
inputName?: HTMLElement; inputName?: HTMLElement;
cnt?: HTMLElement;
constructor(opt: ItemViewProps) { constructor(opt: ItemViewProps) {
super(opt); super(opt);
@ -174,11 +172,7 @@ export default class ItemView extends View {
} }
getVisibilityEl() { getVisibilityEl() {
if (!this.eyeEl) { return this.getItemContainer().find('[data-toggle-visible]');
this.eyeEl = this.$el.children('[data-toggle-select]').find('[data-toggle-visible]');
}
return this.eyeEl;
} }
updateVisibility() { updateVisibility() {
@ -346,30 +340,30 @@ export default class ItemView extends View {
]); ]);
} }
getItemContainer() {
return this.$el.children('[data-toggle-select]');
}
/** /**
* Update item aspect after children changes * Update item aspect after children changes
* *
* @return void * @return void
* */ * */
checkChildren() { checkChildren() {
const { model, clsNoChild, $el, module } = this; const { model, clsNoChild, module } = this;
const count = module.getComponents(model).length; const count = module.getComponents(model).length;
const title = $el.children(`.${this.clsTitleC}`).children(`.${this.clsTitle}`); const itemEl = this.getItemContainer();
let { cnt } = this; const title = itemEl.find(`.${this.clsTitle}`);
const countEl = itemEl.find('[data-count]');
if (!cnt) {
cnt = $el.children('[data-count]').get(0);
this.cnt = cnt;
}
title[count ? 'removeClass' : 'addClass'](clsNoChild); title[count ? 'removeClass' : 'addClass'](clsNoChild);
if (cnt) cnt.innerHTML = count || ''; countEl.html(count || '');
!count && module.setOpen(model, false); !count && module.setOpen(model, false);
} }
getCaret() { getCaret() {
if (!this.caret || !this.caret.length) { if (!this.caret || !this.caret.length) {
this.caret = this.$el.children(`.${this.clsTitleC}`).find(`.${this.clsCaret}`); this.caret = this.getItemContainer().find(`.${this.clsCaret}`);
} }
return this.caret; return this.caret;

Loading…
Cancel
Save