From 3e029b88e2dd6e4ddad5086f4303319024e1c60c Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 11 Jan 2024 23:46:15 +0400 Subject: [PATCH] Fix update of layers. Closes #5607 --- src/navigator/view/ItemView.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/navigator/view/ItemView.ts b/src/navigator/view/ItemView.ts index 772a67f890..32e05c7811 100644 --- a/src/navigator/view/ItemView.ts +++ b/src/navigator/view/ItemView.ts @@ -76,7 +76,7 @@ export default class ItemView extends View {
- ${count ? `
${count || ''}
` : ''} +
${count || ''}
${move || ''}
@@ -115,10 +115,8 @@ export default class ItemView extends View { clsEdit: string; clsNoEdit: string; _rendered?: boolean; - eyeEl?: JQuery; caret?: JQuery; inputName?: HTMLElement; - cnt?: HTMLElement; constructor(opt: ItemViewProps) { super(opt); @@ -174,11 +172,7 @@ export default class ItemView extends View { } getVisibilityEl() { - if (!this.eyeEl) { - this.eyeEl = this.$el.children('[data-toggle-select]').find('[data-toggle-visible]'); - } - - return this.eyeEl; + return this.getItemContainer().find('[data-toggle-visible]'); } 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 * * @return void * */ checkChildren() { - const { model, clsNoChild, $el, module } = this; + const { model, clsNoChild, module } = this; const count = module.getComponents(model).length; - const title = $el.children(`.${this.clsTitleC}`).children(`.${this.clsTitle}`); - let { cnt } = this; - - if (!cnt) { - cnt = $el.children('[data-count]').get(0); - this.cnt = cnt; - } + const itemEl = this.getItemContainer(); + const title = itemEl.find(`.${this.clsTitle}`); + const countEl = itemEl.find('[data-count]'); title[count ? 'removeClass' : 'addClass'](clsNoChild); - if (cnt) cnt.innerHTML = count || ''; + countEl.html(count || ''); !count && module.setOpen(model, false); } getCaret() { 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;