MCPcopy
hub / github.com/home-assistant/frontend / HaDataTable

Class HaDataTable

src/components/data-table/ha-data-table.ts:114–1523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113@customElement("ha-data-table")
114export class HaDataTable extends LitElement {
115 @state()
116 @consume({ context: internationalizationContext, subscribe: true })
117 private _i18n?: ContextType<typeof internationalizationContext>;
118
119 @property({ type: Boolean }) public narrow = false;
120
121 @property({ type: Object }) public columns: DataTableColumnContainer = {};
122
123 @property({ type: Array }) public data: DataTableRowData[] = [];
124
125 @property({ type: Boolean }) public selectable = false;
126
127 @property({ type: Boolean }) public clickable = false;
128
129 /**
130 * Add an extra row at the bottom of the data table
131 * @type {TemplateResult}
132 */
133 @property({ attribute: false }) public appendRow?;
134
135 @property({ type: Boolean, attribute: "auto-height" })
136 public autoHeight = false;
137
138 // eslint-disable-next-line lit/no-native-attributes
139 @property({ type: String }) public id = "id";
140
141 @property({ attribute: false }) public noDataText?: string;
142
143 @property({ attribute: false }) public searchLabel?: string;
144
145 @property({ type: String }) public filter = "";
146
147 @property({ attribute: false }) public groupColumn?: string;
148
149 @property({ attribute: false }) public groupOrder?: string[];
150
151 @property({ attribute: false }) public sortColumn?: string;
152
153 @property({ attribute: false }) public sortDirection: SortingDirection = null;
154
155 @property({ attribute: false }) public initialCollapsedGroups?: string[];
156
157 @property({ attribute: false }) public hiddenColumns?: string[];
158
159 @property({ attribute: false }) public columnOrder?: string[];
160
161 @state() private _filterable = false;
162
163 @state() private _filter = "";
164
165 @state() private _filteredData?: DataTableRowData[];
166
167 @state() private _headerHeight = 0;
168
169 @query("slot[name='header']") private _header!: HTMLSlotElement;
170
171 @query(".mdc-data-table__header-row") private _headerRow?: HTMLDivElement;

Callers

nothing calls this directly

Calls 12

_selectRangeMethod · 0.95
_checkedRowsChangedMethod · 0.95
restoreScrollFunction · 0.90
debounceFunction · 0.90
groupByFunction · 0.90
stringCompareFunction · 0.90
filterDataFunction · 0.90
fireEventFunction · 0.90
keysMethod · 0.80
entriesMethod · 0.80
stateFunction · 0.50
localizeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…