Skip to content

Commit

Permalink
Merge pull request #1336 from umbraco/bugfix/correct-to-lit-3-props-f…
Browse files Browse the repository at this point in the history
…or-less-warnings

append getters for less lit 3 warnings
  • Loading branch information
nielslyngsoe authored Mar 1, 2024
2 parents 9c68c33 + 52c30b4 commit b9103d5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
12 changes: 12 additions & 0 deletions src/packages/core/property/property/property.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,21 @@ export class UmbPropertyContext<ValueType = any> extends UmbControllerBase {
public setAlias(alias: string | undefined): void {
this.#alias.setValue(alias);
}
public getAlias(): string | undefined {
return this.#alias.getValue();
}
public setLabel(label: string | undefined): void {
this.#label.setValue(label);
}
public getLabel(): string | undefined {
return this.#label.getValue();
}
public setDescription(description: string | undefined): void {
this.#description.setValue(description);
}
public getDescription(): string | undefined {
return this.#description.getValue();
}
/**
* Set the value of this property.
* @param value {ValueType} the whole value to be set
Expand All @@ -136,6 +145,9 @@ export class UmbPropertyContext<ValueType = any> extends UmbControllerBase {
public setConfig(config: Array<UmbPropertyEditorConfigProperty> | undefined): void {
this.#configValues.setValue(config ?? []);
}
public getConfig(): Array<UmbPropertyEditorConfigProperty> | undefined {
return this.#configValues.getValue();
}
public setVariantId(variantId: UmbVariantId | undefined): void {
this.#variantId.setValue(variantId);
}
Expand Down
40 changes: 28 additions & 12 deletions src/packages/core/property/property/property.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export class UmbPropertyElement extends UmbLitElement {
* @default ''
*/
@property({ type: String })
public set label(label: string) {
public set label(label: string | undefined) {
this.#propertyContext.setLabel(label);
}
public get label() {
return this.#propertyContext.getLabel();
}

/**
* Description: render a description underneath the label.
Expand All @@ -38,9 +41,12 @@ export class UmbPropertyElement extends UmbLitElement {
* @default ''
*/
@property({ type: String })
public set description(description: string) {
public set description(description: string | undefined) {
this.#propertyContext.setDescription(description);
}
public get description() {
return this.#propertyContext.getDescription();
}

/**
* Alias
Expand All @@ -53,6 +59,9 @@ export class UmbPropertyElement extends UmbLitElement {
public set alias(alias: string) {
this.#propertyContext.setAlias(alias);
}
public get alias() {
return this.#propertyContext.getAlias() ?? '';
}

/**
* Property Editor UI Alias. Render the Property Editor UI registered for this alias.
Expand All @@ -62,12 +71,14 @@ export class UmbPropertyElement extends UmbLitElement {
* @default ''
*/
@property({ type: String, attribute: 'property-editor-ui-alias' })
public set propertyEditorUiAlias(value: string) {
if (this._propertyEditorUiAlias === value) return;
public set propertyEditorUiAlias(value: string | undefined) {
this._propertyEditorUiAlias = value;
this._observePropertyEditorUI();
}
private _propertyEditorUiAlias = '';
public get propertyEditorUiAlias(): string {
return this._propertyEditorUiAlias ?? '';
}
private _propertyEditorUiAlias?: string;

/**
* Config. Configuration to pass to the Property Editor UI. This is also the configuration data stored on the Data Type.
Expand All @@ -80,6 +91,9 @@ export class UmbPropertyElement extends UmbLitElement {
public set config(value: UmbPropertyEditorConfig | undefined) {
this.#propertyContext.setConfig(value);
}
public get config(): UmbPropertyEditorConfig | undefined {
return this.#propertyContext.getConfig();
}

@state()
private _variantDifference?: string;
Expand Down Expand Up @@ -130,13 +144,15 @@ export class UmbPropertyElement extends UmbLitElement {
};

private _observePropertyEditorUI(): void {
this.observe(
umbExtensionsRegistry.byTypeAndAlias('propertyEditorUi', this._propertyEditorUiAlias),
(manifest) => {
this._gotEditorUI(manifest);
},
'_observePropertyEditorUI',
);
if (this._propertyEditorUiAlias) {
this.observe(
umbExtensionsRegistry.byTypeAndAlias('propertyEditorUi', this._propertyEditorUiAlias),
(manifest) => {
this._gotEditorUI(manifest);
},
'_observePropertyEditorUI',
);
}
}

private async _gotEditorUI(manifest?: ManifestPropertyEditorUi | null): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export class UmbWorkspaceSplitViewElement extends UmbLitElement {
public set splitViewIndex(index: number) {
this.splitViewContext.setSplitViewIndex(index);
}
public get splitViewIndex(): number {
return this.splitViewContext.getSplitViewIndex()!;
}

splitViewContext = new UmbWorkspaceSplitViewContext(this);

Expand Down

0 comments on commit b9103d5

Please sign in to comment.