Skip to content

Commit

Permalink
fix(select-setting): refactor theme listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Sisha0 committed Aug 4, 2022
1 parent 148987e commit f840316
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/settings/select-setting/select-setting.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {attr, boolAttr, listen} from '@exadel/esl/modules/esl-base-element/core';
import type {ESLSelect} from '@exadel/esl/modules/esl-forms/esl-select/core';
import {randUID} from '@exadel/esl/modules/esl-utils/misc/uid';
import {bind} from '@exadel/esl/modules/esl-utils/decorators/bind';
import {memoize} from '@exadel/esl/modules/esl-utils/decorators/memoize';

import {UIPSetting} from '../../plugins/settings/setting';
Expand Down Expand Up @@ -65,11 +64,6 @@ export class UIPSelectSetting extends UIPSetting {
return select;
}

@memoize()
protected get root(): UIPRoot {
return this.closest(UIPRoot.is) as UIPRoot;
}

protected connectedCallback() {
super.connectedCallback();
this.$label.htmlFor = this.$field.$select.id;
Expand Down Expand Up @@ -167,12 +161,12 @@ export class UIPSelectSetting extends UIPSetting {
this.select.remove(this.settingOptions.indexOf(UIPSelectSetting.inconsistentValue));
}

@listen({event: 'uip:configchange', target: '::parent(.uip-root)'})
@listen({event: 'uip:configchange', target: `::parent(.${UIPRoot.is})`})
protected onRootThemeChange(e: CustomEvent): void {
if (e.detail.attribute !== 'dark-theme') return;
let dropdownClass = UIPSelectSetting.dropdownClass;
if (e.detail.value !== null) dropdownClass += ' uip-dark-dropdown';
this.$field.setAttribute('dropdown-class', dropdownClass);
this.$field.dropdownClass = dropdownClass
}

/** Reset [select]{@link $field} value. */
Expand Down

0 comments on commit f840316

Please sign in to comment.