Skip to content

Commit

Permalink
fix(select-setting): listen closest root only for theme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sisha0 committed Aug 2, 2022
1 parent 2b19b39 commit 148987e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/plugins/header/options/option/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
}

&.uip-settings {
accent-color: @light-text;
.uip-select-setting .esl-select .esl-select-renderer::after {
color: @light-text;
}
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/settings/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {memoize} from '@exadel/esl/modules/esl-utils/decorators/memoize';
import {ChangeAttrConfig, UIPStateModel} from '../../core/base/model';
import {UIPSettings} from './settings';
import {WARNING_MSG} from '../../utils/warning-msg';
import {getAttr, setAttr} from '@exadel/esl/modules/esl-utils/dom/attr';

/**
* Custom element for manipulating with elements attributes.
Expand All @@ -19,7 +20,11 @@ export abstract class UIPSetting extends ESLBaseElement {
@attr() public attribute: string;
/** Target to which setting's changes are attached. */
public get target(): string {
return this.getAttribute('target') || this.$settings.target;
return getAttr(this, 'target', this.$settings.target);
}

public set target(target: string) {
setAttr(this, 'target', target);
}

@memoize()
Expand Down
1 change: 1 addition & 0 deletions src/plugins/settings/settings.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
max-width: 250px;
overflow: hidden;
transition: max-width 0.3s ease-in-out;
accent-color: @dark-text;
// grid-column-start: 2;
// grid-row-start: 2;
// grid-row-end: span 3;
Expand Down
2 changes: 1 addition & 1 deletion src/settings/select-setting/select-setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class UIPSelectSetting extends UIPSetting {
this.select.remove(this.settingOptions.indexOf(UIPSelectSetting.inconsistentValue));
}

@listen({event: 'uip:configchange', target: '.uip-root'})
@listen({event: 'uip:configchange', target: '::parent(.uip-root)'})
protected onRootThemeChange(e: CustomEvent): void {
if (e.detail.attribute !== 'dark-theme') return;
let dropdownClass = UIPSelectSetting.dropdownClass;
Expand Down

0 comments on commit 148987e

Please # to comment.