fix: select native variables by datatype and explain rejected links

This commit is contained in:
jhartworks committed 2026-11-12 10:14:19 +01:00
1 parent 4967dd7950
commit 8c6b23bd22
29 files changed
+2031 -1790

No files matched your search

@@ -51,7 +51,7 @@ function favorites(host: EditorHost): TemplateResult {
return html`<summary>${host.t("favorites")}${list.length > 0 ? html` <span class="nf-lib-count">${list.length}</span>` : nothing}</summary>
${hint(host.t("favorites_hint"))} ${list.map(row)}
${list.length < MAX_FAVORITES
? html`<div class="nf-form">${entityField(host, host.t("favorites_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]))}</div>`
? html`<div class="nf-form">${entityField(host, host.t("favorites_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]), { excluded: (id) => list.includes(id) ? "Diese Variable ist bereits als Favorit verknüpft." : undefined })}</div>`
: nothing}`;
}
@@ -66,7 +66,7 @@ function outsideHidden(host: EditorHost, paneView?: () => StartView | null): Tem
<h4>${host.t("outside_hidden")}${list.length > 0 ? html` <span class="nf-lib-count">${list.length}</span>` : nothing}</h4>
${hint(host.t("outside_hidden_hint"))}
${list.map((id, i) => html`<div class="nf-row nf-dev-row"><span class="nf-dev-name"><span>${entityName(host.hass, id)}</span></span>${iconButton(host.t("delete"), "✕", () => store(removeAt(list, i)))}</div>`)}
<div class="nf-form">${entityField(host, host.t("outside_hidden_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]))}</div>`;
<div class="nf-form">${entityField(host, host.t("outside_hidden_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]), { excluded: (id) => list.includes(id) ? "Diese Variable ist hier bereits eingetragen." : undefined })}</div>`;
}
/** The camera Outside opens with: the editor's 3D pane as it stands now (#83). */
@@ -134,7 +134,7 @@ function calendars(host: EditorHost): TemplateResult {
const days = host.doc.settings.today_days ?? 1;
return html`<h4>📅 ${t("today_calendars")}</h4>
${hint(t("today_calendars_hint"))} ${list.map(row)}
${list.length < 12 ? html`<div class="nf-form">${entityField(host, t("favorites_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]))}</div>` : nothing}
${list.length < 12 ? html`<div class="nf-form">${entityField(host, t("favorites_add"), null, undefined, options, (v) => v && v !== "none" && !list.includes(v) && store([...list, v]), { unsupported: "Dieses Feld benötigt eine Kalenderquelle mit Terminen. Eine Symcon-Variable ist kein Kalender; Kalenderquellen werden vom Symcon-Modul derzeit nicht bereitgestellt." })}</div>` : nothing}
${list.length
? html`<div class="nf-form">
${selectField(host, t("today_days"), String(days), [1, 2, 3, 5, 7].map((n): [string, string] => [String(n), t(n === 1 ? "today_days_one" : "today_days_n", { n })]), (v) => host.change((d) => (d.settings.today_days = Number(v) > 1 ? Number(v) : undefined)))}