Skip to content

Commit

Permalink
Fix update of layers. Closes #5607
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jan 11, 2024
1 parent 9a49452 commit 3e029b8
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/navigator/view/ItemView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class ItemView extends View {
</div>
</div>
<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>
</div>
Expand Down Expand Up @@ -115,10 +115,8 @@ export default class ItemView extends View {
clsEdit: string;
clsNoEdit: string;
_rendered?: boolean;
eyeEl?: JQuery<HTMLElement>;
caret?: JQuery<HTMLElement>;
inputName?: HTMLElement;
cnt?: HTMLElement;

constructor(opt: ItemViewProps) {
super(opt);
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3e029b8

Please sign in to comment.