filter.value?.length
).length}
@@ -432,6 +482,104 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
.narrow=${this.narrow}
@expanded-changed=${this._filterExpanded}
>
+
+ ${!this.narrow
+ ? html`
+
+
+
+ ${categoryItems}
+
+ ${this.hass.dockedSidebar === "docked"
+ ? nothing
+ : html`
+
+
+
+ ${labelItems}
+ `}`
+ : nothing}
+ ${this.narrow || this.hass.dockedSidebar === "docked"
+ ? html`
+
+ ${
+ this.narrow
+ ? html`
+
+ `
+ : html``
+ }
+
+ ${
+ this.narrow
+ ? html`
+
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.picker.bulk_actions.move_category"
+ )}
+
+
+
+ ${categoryItems}
+ `
+ : nothing
+ }
+ ${
+ this.narrow || this.hass.dockedSidebar === "docked"
+ ? html`
+
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.picker.bulk_actions.add_label"
+ )}
+
+
+
+ ${labelItems}
+ `
+ : nothing
+ }
+ `
+ : nothing}
${!this.scripts.length
? html`
@@ -629,6 +777,38 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
});
}
+ private _handleSelectionChanged(
+ ev: HASSDomEvent
+ ): void {
+ this._selected = ev.detail.value;
+ }
+
+ private async _handleBulkCategory(ev) {
+ const category = ev.currentTarget.value;
+ const promises: Promise[] = [];
+ this._selected.forEach((entityId) => {
+ promises.push(
+ updateEntityRegistryEntry(this.hass, entityId, {
+ categories: { script: category },
+ })
+ );
+ });
+ await Promise.all(promises);
+ }
+
+ private async _handleBulkLabel(ev) {
+ const label = ev.currentTarget.value;
+ const promises: Promise[] = [];
+ this._selected.forEach((entityId) => {
+ promises.push(
+ updateEntityRegistryEntry(this.hass, entityId, {
+ labels: this.hass.entities[entityId].labels.concat(label),
+ })
+ );
+ });
+ await Promise.all(promises);
+ }
+
private _handleRowClicked(ev: HASSDomEvent) {
const entry = this.entityRegistry.find((e) => e.entity_id === ev.detail.id);
if (entry) {
@@ -782,6 +962,16 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
--mdc-icon-size: 80px;
max-width: 500px;
}
+ ha-assist-chip {
+ --ha-assist-chip-container-shape: 10px;
+ }
+ ha-button-menu-new ha-assist-chip {
+ --md-assist-chip-trailing-space: 8px;
+ }
+ ha-label {
+ --ha-label-background-color: var(--color, var(--grey-color));
+ --ha-label-background-opacity: 0.5;
+ }
`,
];
}