fix inheritance

This commit is contained in:
Jacob Overgaard
2023-08-01 09:53:26 +02:00
parent 95e1104e37
commit 75847699b3
2 changed files with 10 additions and 10 deletions

View File

@@ -6,7 +6,11 @@ import type { UmbController } from './controller.interface.js';
import { UmbLocalizeController } from '@umbraco-cms/backoffice/localization-api';
export declare class UmbControllerHostElement extends HTMLElement implements UmbControllerHost {
get localize(): UmbLocalizeController | undefined;
/**
* Use the UmbLocalizeController to localize your element.
* @see UmbLocalizeController
*/
localize: UmbLocalizeController;
hasController(controller: UmbController): boolean;
getControllers(filterMethod: (ctrl: UmbController) => boolean): UmbController[];
addController(controller: UmbController): void;

View File

@@ -10,6 +10,7 @@ import {
} from '@umbraco-cms/backoffice/context-api';
import { ObserverCallback, UmbObserverController } from '@umbraco-cms/backoffice/observable-api';
import { UmbLocalizeController } from '@umbraco-cms/backoffice/localization-api';
import { property } from '@umbraco-cms/backoffice/external/lit';
export declare class UmbElement extends UmbControllerHostElement {
/**
@@ -29,20 +30,15 @@ export declare class UmbElement extends UmbControllerHostElement {
alias: string | UmbContextToken<R>,
callback: UmbContextCallback<R>
): UmbContextConsumerController<R>;
get localize(): UmbLocalizeController;
}
export const UmbElementMixin = <T extends HTMLElementConstructor>(superClass: T) => {
class UmbElementMixinClass extends UmbControllerHostElementMixin(superClass) implements UmbElement {
#localizeController = new UmbLocalizeController(this);
// Make `dir` and `lang` reactive properties so they react to language changes:
@property() dir = '';
@property() lang = '';
/**
* Get the localize controller.
* @readonly
*/
get localize(): UmbLocalizeController {
return this.#localizeController;
}
localize: UmbLocalizeController = new UmbLocalizeController(this);
/**
* @description Observe a RxJS source of choice.