Skip to content

Commit

Permalink
Add grid support to number card
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Mar 5, 2024
1 parent 425f16b commit fd478cc
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/cards/number-card/number-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ registerCustomCard({
});

@customElement(NUMBER_CARD_NAME)
export class NumberCard extends MushroomBaseCard implements LovelaceCard {
export class NumberCard extends MushroomBaseCard<NumberCardConfig> implements LovelaceCard {
public static async getConfigElement(): Promise<LovelaceCardEditor> {
await import("./number-card-editor");
return document.createElement(NUMBER_CARD_EDITOR_NAME) as LovelaceCardEditor;
Expand All @@ -57,25 +57,11 @@ export class NumberCard extends MushroomBaseCard implements LovelaceCard {
};
}

@state() private _config?: NumberCardConfig;

@state() private value?: number;

getCardSize(): number | Promise<number> {
return 1;
protected get hasControls(): boolean {
return true;
}

setConfig(config: NumberCardConfig): void {
this._config = {
tap_action: {
action: "more-info",
},
hold_action: {
action: "more-info",
},
...config,
};
}
@state() private value?: number;

private _handleAction(ev: ActionHandlerEvent) {
handleAction(this, this.hass!, this._config!, ev.detail.action!);
Expand Down

0 comments on commit fd478cc

Please sign in to comment.