Skip to content

Commit

Permalink
Fix some attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Dec 6, 2024
1 parent 44a9f69 commit b36bd98
Show file tree
Hide file tree
Showing 40 changed files with 104 additions and 75 deletions.
3 changes: 2 additions & 1 deletion src/components/chart/ha-chart-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export class HaChartBase extends LitElement {

@property({ attribute: false, type: Number }) public paddingYAxis = 0;

@property({ attribute: false, type: Boolean }) public externalHidden = false;
@property({ attribute: "external-hidden", type: Boolean })
public externalHidden = false;

@state() private _chartHeight?: number;

Expand Down
12 changes: 7 additions & 5 deletions src/components/chart/state-history-chart-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ export class StateHistoryChartLine extends LitElement {

@property() public identifier?: string;

@property({ attribute: false, type: Boolean }) public showNames = true;
@property({ attribute: "show-names", type: Boolean })
public showNames = true;

@property({ attribute: false, type: Boolean }) public clickForMoreInfo = true;
@property({ attribute: "click-for-more-info", type: Boolean })
public clickForMoreInfo = true;

@property({ attribute: false }) public startTime!: Date;

Expand All @@ -44,14 +46,14 @@ export class StateHistoryChartLine extends LitElement {

@property({ attribute: false, type: Number }) public chartIndex?;

@property({ attribute: false, type: Boolean }) public logarithmicScale =
false;
@property({ attribute: "logarithmic-scale", type: Boolean })
public logarithmicScale = false;

@property({ attribute: false, type: Number }) public minYAxis?: number;

@property({ attribute: false, type: Number }) public maxYAxis?: number;

@property({ attribute: false, type: Boolean }) public fitYData = false;
@property({ attribute: "fit-y-data", type: Boolean }) public fitYData = false;

@state() private _chartData?: ChartData<"line">;

Expand Down
5 changes: 3 additions & 2 deletions src/components/chart/state-history-chart-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export class StateHistoryChartTimeline extends LitElement {

@property() public identifier?: string;

@property({ attribute: false, type: Boolean }) public showNames = true;
@property({ attribute: "show-names", type: Boolean }) public showNames = true;

@property({ attribute: false, type: Boolean }) public clickForMoreInfo = true;
@property({ attribute: "click-for-more-info", type: Boolean })
public clickForMoreInfo = true;

@property({ type: Boolean }) public chunked = false;

Expand Down
14 changes: 8 additions & 6 deletions src/components/chart/state-history-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,22 @@ export class StateHistoryCharts extends LitElement {

@property({ attribute: false, type: Number }) public hoursToShow?: number;

@property({ attribute: false, type: Boolean }) public showNames = true;
@property({ attribute: "show-names", type: Boolean }) public showNames = true;

@property({ attribute: false, type: Boolean }) public clickForMoreInfo = true;
@property({ attribute: "click-for-more-info", type: Boolean })
public clickForMoreInfo = true;

@property({ attribute: false, type: Boolean }) public isLoadingData = false;
@property({ attribute: "is-loading-data", type: Boolean })
public isLoadingData = false;

@property({ attribute: false, type: Boolean }) public logarithmicScale =
false;
@property({ attribute: "logarithmic-scale", type: Boolean })
public logarithmicScale = false;

@property({ attribute: false, type: Number }) public minYAxis?: number;

@property({ attribute: false, type: Number }) public maxYAxis?: number;

@property({ attribute: false, type: Boolean }) public fitYData = false;
@property({ attribute: "fit-y-data", type: Boolean }) public fitYData = false;

private _computedStartTime!: Date;

Expand Down
14 changes: 8 additions & 6 deletions src/components/chart/statistics-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,19 @@ export class StatisticsChart extends LitElement {

@property({ attribute: false, type: Number }) public maxYAxis?: number;

@property({ attribute: false, type: Boolean }) public fitYData = false;
@property({ attribute: "fit-y-data", type: Boolean }) public fitYData = false;

@property({ attribute: "hide-legend", type: Boolean }) public hideLegend =
false;

@property({ attribute: false, type: Boolean }) public logarithmicScale =
false;
@property({ attribute: "logarithmic-scale", type: Boolean })
public logarithmicScale = false;

@property({ attribute: false, type: Boolean }) public isLoadingData = false;
@property({ attribute: "is-loading-data", type: Boolean })
public isLoadingData = false;

@property({ attribute: false, type: Boolean }) public clickForMoreInfo = true;
@property({ attribute: "click-for-more-info", type: Boolean })
public clickForMoreInfo = true;

@property() public period?: string;

Expand Down Expand Up @@ -165,7 +167,7 @@ export class StatisticsChart extends LitElement {

return html`
<ha-chart-base
externalHidden
external-hidden
.hass=${this.hass}
.data=${this._chartData}
.extraData=${this._chartDatasetExtra}
Expand Down
2 changes: 1 addition & 1 deletion src/components/data-table/ha-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class HaDataTable extends LitElement {

@property({ type: Boolean }) public clickable = false;

@property({ attribute: false, type: Boolean }) public hasFab = false;
@property({ attribute: "has-fab", type: Boolean }) public hasFab = false;

/**
* Add an extra row at the bottom of the data table
Expand Down
3 changes: 2 additions & 1 deletion src/components/entity/ha-entity-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export class HaEntityPicker extends LitElement {
@property({ attribute: false })
public entityFilter?: HaEntityPickerEntityFilterFunc;

@property({ attribute: false, type: Boolean }) public hideClearIcon = false;
@property({ attribute: "hide-clear-icon", type: Boolean })
public hideClearIcon = false;

@property({ attribute: "item-label-path" }) public itemLabelPath =
"friendly_name";
Expand Down
2 changes: 1 addition & 1 deletion src/components/entity/ha-state-label-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class HaStateLabelBadge extends LitElement {

@property() public image?: string;

@property({ attribute: false, type: Boolean }) public showName = false;
@property({ attribute: "show-name", type: Boolean }) public showName = false;

@state() private _timerTimeRemaining?: number;

Expand Down
34 changes: 21 additions & 13 deletions src/components/ha-password-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class HaPasswordField extends LitElement {

@property({ type: Boolean }) public icon = false;

@property({ attribute: false, type: Boolean }) public iconTrailing = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) public iconTrailing = false;

@property() public autocomplete?: string;

Expand All @@ -42,32 +43,38 @@ export class HaPasswordField extends LitElement {

@property({ type: Boolean }) required = false;

@property({ attribute: false, type: Number }) minLength = -1;
// eslint-disable-next-line lit/attribute-names
@property({ type: Number }) minLength = -1;

@property({ attribute: false, type: Number }) maxLength = -1;
// eslint-disable-next-line lit/attribute-names
@property({ type: Number }) maxLength = -1;

@property({ type: Boolean, reflect: true }) outlined = false;

@property({ type: String }) helper = "";

@property({ attribute: false, type: Boolean }) validateOnInitialRender =
false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) validateOnInitialRender = false;

@property({ attribute: false, type: String }) validationMessage = "";
// eslint-disable-next-line lit/attribute-names
@property({ type: String }) validationMessage = "";

@property({ attribute: false, type: Boolean }) autoValidate = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) autoValidate = false;

@property({ type: String }) pattern = "";

@property({ type: Number }) size: number | null = null;

@property({ attribute: false, type: Boolean }) helperPersistent = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) helperPersistent = false;

@property({ attribute: false, type: Boolean }) charCounter:
| boolean
| TextAreaCharCounter = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) charCounter: boolean | TextAreaCharCounter =
false;

@property({ attribute: false, type: Boolean }) endAligned = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) endAligned = false;

@property({ type: String }) prefix = "";

Expand All @@ -78,7 +85,8 @@ export class HaPasswordField extends LitElement {
@property({ type: String, attribute: "input-mode" })
inputMode!: string;

@property({ attribute: false, type: Boolean }) readOnly = false;
// eslint-disable-next-line lit/attribute-names
@property({ type: Boolean }) readOnly = false;

// eslint-disable-next-line lit/no-native-attributes
@property({ attribute: false, type: String }) autocapitalize = "";
Expand Down
3 changes: 2 additions & 1 deletion src/components/ha-service-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export class HaServiceControl extends LitElement {
@property({ attribute: false, type: Boolean, reflect: true })
public hidePicker = false;

@property({ attribute: false, type: Boolean }) public hideDescription = false;
@property({ attribute: "hide-description", type: Boolean })
public hideDescription = false;

@state() private _value!: this["value"];

Expand Down
6 changes: 4 additions & 2 deletions src/components/ha-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ class HaSidebar extends SubscribeMixin(LitElement) {

@property({ attribute: false }) public route!: Route;

@property({ attribute: false, type: Boolean }) public alwaysExpand = false;
@property({ attribute: "always-expand", type: Boolean })
public alwaysExpand = false;

@property({ attribute: false, type: Boolean }) public editMode = false;
@property({ attribute: "edit-mode", type: Boolean })
public editMode = false;

@state() private _notifications?: PersistentNotification[];

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-target-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {

@property({ type: Boolean, reflect: true }) public disabled = false;

@property({ attribute: false, type: Boolean }) public addOnTop = false;
@property({ attribute: "add-on-top", type: Boolean }) public addOnTop = false;

@state() private _addMode?:
| "area_id"
Expand Down
3 changes: 2 additions & 1 deletion src/components/ha-theme-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export class HaThemePicker extends LitElement {

@property() public label?: string;

@property({ attribute: false, type: Boolean }) includeDefault = false;
@property({ attribute: "include-default", type: Boolean })
public includeDefault = false;

@property({ attribute: false }) public hass?: HomeAssistant;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-two-pane-top-app-bar-fixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class TopAppBarBaseBase extends BaseElement {

protected _scrollTarget!: HTMLElement | Window;

@property({ attribute: false, type: Boolean }) centerTitle = false;
@property({ attribute: "center-title", type: Boolean }) centerTitle = false;

@property({ type: Boolean, reflect: true }) prominent = false;

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/ha-locations-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class HaLocationsEditor extends LitElement {

@property() public helper?: string;

@property({ attribute: false, type: Boolean }) public autoFit = false;
@property({ attribute: "auto-fit", type: Boolean }) public autoFit = false;

@property({ type: Number }) public zoom = 16;

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/ha-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class HaMap extends ReactiveElement {
@property({ attribute: "interactive-zones", type: Boolean })
public interactiveZones = false;

@property({ attribute: false, type: Boolean }) public fitZones = false;
@property({ attribute: "fit-zones", type: Boolean }) public fitZones = false;

@property({ attribute: "theme-mode", type: String })
public themeMode: ThemeMode = "auto";
Expand Down
2 changes: 1 addition & 1 deletion src/components/trace/ha-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class HaTimeline extends LitElement {
@property({ attribute: false, reflect: true, type: Boolean }) notEnabled =
false;

@property({ attribute: false, type: Boolean }) public lastItem = false;
@property({ attribute: "last-item", type: Boolean }) public lastItem = false;

@property({ type: String }) public icon?: string;

Expand Down
2 changes: 1 addition & 1 deletion src/components/trace/hat-trace-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ export class HaAutomationTracer extends LitElement {

entries.push(html`
<ha-timeline
lastItem
last-item
.icon=${entry.icon}
class=${ifDefined(entry.className)}
>
Expand Down
3 changes: 1 addition & 2 deletions src/dialogs/more-info/controls/more-info-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ class MoreInfoScript extends LitElement {
${this.hass.localize("ui.card.script.run_script")}
</div>
<ha-service-control
hidePicker
hideDescription
hide-description
.hass=${this.hass}
.value=${this._scriptData}
.showAdvanced=${this.hass.userData?.showAdvanced}
Expand Down
7 changes: 4 additions & 3 deletions src/layouts/hass-tabs-subpage-data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ export class HaTabsSubpageDataTable extends LitElement {
* Show the filter menu.
* @type {Boolean}
*/
@property({ attribute: "has-filters", type: Boolean }) public hasFilters =
false;
@property({ attribute: "has-filters", type: Boolean })
public hasFilters = false;

@property({ attribute: false, type: Boolean }) public showFilters = false;
@property({ attribute: "show-filters", type: Boolean })
public showFilters = false;

@property({ attribute: false }) public initialSorting?: {
column: string;
Expand Down
4 changes: 2 additions & 2 deletions src/onboarding/integration-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class IntegrationBadge extends LitElement {
// eslint-disable-next-line lit/no-native-attributes
@property({ attribute: false }) public title!: string;

@property({ attribute: false, type: Boolean }) public darkOptimizedIcon =
false;
@property({ attribute: "dark-optimized-icon", type: Boolean })
public darkOptimizedIcon = false;

@property({ attribute: false, type: Boolean, reflect: true })
public clickable = false;
Expand Down
3 changes: 2 additions & 1 deletion src/onboarding/onboarding-welcome-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class OnboardingWelcomeLinks extends LitElement {

@property({ attribute: false }) public localize!: LocalizeFunc<any>;

@property({ attribute: false, type: Boolean }) public mobileApp = false;
@property({ attribute: "mobile-app", type: Boolean })
public mobileApp = false;

protected render(): TemplateResult {
return html`<a
Expand Down
2 changes: 1 addition & 1 deletion src/panels/calendar/ha-recurrence-rule-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class RecurrenceRuleEditor extends LitElement {

@property({ attribute: false }) public dtstart?: Date;

@property({ attribute: false, type: Boolean }) public allDay = false;
@property({ attribute: "all-day", type: Boolean }) public allDay = false;

@property({ attribute: false }) public locale!: HomeAssistant["locale"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class HaAutomationConditionEditor extends LitElement {

@property({ type: Boolean }) public disabled = false;

@property({ attribute: false, type: Boolean }) public yamlMode = false;
@property({ attribute: false }) public yamlMode = false;

private _processedCondition = memoizeOne((condition) =>
expandConditionWithShorthand(condition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export class HaDeviceEntitiesCard extends LitElement {

@property({ attribute: false }) public entities!: EntityRegistryStateEntry[];

@property({ attribute: false, type: Boolean }) public showHidden = false;
@property({ attribute: "show-hidden", type: Boolean })
public showHidden = false;

@state() private _extDisabledEntityEntries?: Record<
string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { classMap } from "lit/directives/class-map";
class MQTTDiscoveryPayload extends LitElement {
@property({ attribute: false }) public payload!: Record<string, unknown>;

@property({ attribute: false, type: Boolean }) public showAsYaml = false;
@property({ attribute: "show-as-yaml", type: Boolean })
public showAsYaml = false;

@property() public summary!: string;

Expand Down
Loading

0 comments on commit b36bd98

Please sign in to comment.