v0.14.12
This commit is contained in:
+14
-1
@@ -43,6 +43,18 @@ function customSelectLabel(select) {
|
||||
return labelSpan?.textContent?.trim() || select.name || select.id || '';
|
||||
}
|
||||
|
||||
function customSelectMenuHost(select) {
|
||||
// A modal <dialog> makes everything outside its DOM subtree inert. Keep
|
||||
// the popover menu inside the same dialog so pointer hover/click continues
|
||||
// to work while the dialog is shown with showModal().
|
||||
return select.closest('dialog') || document.body;
|
||||
}
|
||||
|
||||
function ensureCustomSelectMenuHost(select, state) {
|
||||
const host = customSelectMenuHost(select);
|
||||
if (state.menu.parentElement !== host) host.appendChild(state.menu);
|
||||
}
|
||||
|
||||
function customSelectOptionRows(select) {
|
||||
const rows = [];
|
||||
[...select.children].forEach(child => {
|
||||
@@ -198,6 +210,7 @@ function closeCustomSelect(state = customSelectOpenState) {
|
||||
function openCustomSelect(select) {
|
||||
const state = customSelectRegistry.get(select);
|
||||
if (!state || select.disabled) return;
|
||||
ensureCustomSelectMenuHost(select, state);
|
||||
if (customSelectOpenState === state && state.open) {
|
||||
closeCustomSelect(state);
|
||||
return;
|
||||
@@ -280,7 +293,7 @@ function enhanceCustomSelect(select) {
|
||||
menu.setAttribute('role', 'listbox');
|
||||
menu.setAttribute('popover', 'manual');
|
||||
menu.hidden = true;
|
||||
document.body.appendChild(menu);
|
||||
customSelectMenuHost(select).appendChild(menu);
|
||||
|
||||
let wrapper = null;
|
||||
let trigger = toolbarHost;
|
||||
|
||||
@@ -341,9 +341,14 @@ function renderHomeAssistantSettings() {
|
||||
if (!app.settings) return;
|
||||
const form = $('#homeAssistantForm');
|
||||
if (!form) return;
|
||||
const supervisorManaged = app.settings.home_assistant?.auth_mode === 'supervisor';
|
||||
form.ha_url.value = app.settings.home_assistant?.url || '';
|
||||
form.ha_url.readOnly = supervisorManaged;
|
||||
form.ha_token.value = '';
|
||||
form.ha_token.placeholder = app.settings.home_assistant?.token_configured ? tr('settings.haTokenSaved') : tr('settings.haLongLivedToken');
|
||||
form.ha_token.readOnly = supervisorManaged;
|
||||
form.ha_token.placeholder = supervisorManaged
|
||||
? tr('settings.haSupervisorToken')
|
||||
: (app.settings.home_assistant?.token_configured ? tr('settings.haTokenSaved') : tr('settings.haLongLivedToken'));
|
||||
form.ha_outdoor_entity_id.value = app.settings.home_assistant?.outdoor_entity_id || '';
|
||||
form.ha_sensor_stale_after_minutes.value = String(Math.max(1, Math.round(Number(app.settings.home_assistant?.sensor_stale_after_seconds || 300) / 60)));
|
||||
form.ha_allow_invalid_tls.checked = !!app.settings.home_assistant?.allow_invalid_tls;
|
||||
|
||||
Reference in New Issue
Block a user