28 lines
958 B
JavaScript
28 lines
958 B
JavaScript
/**
|
|
* Scrollable device/group list with a fixed add row (dropdown + button) below.
|
|
* Used by group and zone edit modals.
|
|
*/
|
|
function prepareZoneDevicesPanel(containerEl) {
|
|
if (!containerEl) return null;
|
|
let listEl = containerEl.querySelector('.zone-devices-list');
|
|
let addSlot = containerEl.querySelector('.zone-devices-add-slot');
|
|
if (!listEl) {
|
|
containerEl.innerHTML = '';
|
|
containerEl.classList.add('zone-devices-panel');
|
|
listEl = document.createElement('div');
|
|
listEl.className = 'zone-devices-list';
|
|
addSlot = document.createElement('div');
|
|
addSlot.className = 'zone-devices-add-slot';
|
|
containerEl.appendChild(listEl);
|
|
containerEl.appendChild(addSlot);
|
|
} else {
|
|
listEl.innerHTML = '';
|
|
addSlot.innerHTML = '';
|
|
}
|
|
return { listEl, addSlot };
|
|
}
|
|
|
|
if (typeof window !== 'undefined') {
|
|
window.prepareZoneDevicesPanel = prepareZoneDevicesPanel;
|
|
}
|