e.target.classList.remove('drag-over');
const target = e.target.classList.contains('item') ? e.target : dl.querySelector('.add-item');
dl.insertBefore(draggedItem, target);
+ this.dispatchCbiDynlistChange(dl, draggedItem.value);
});
dl.addEventListener('click', (e) => {
dl.insertBefore(draggedItem, placeholder);
draggedItem.classList.remove('dragging')
placeholder.parentNode.removeChild(placeholder);
+ this.dispatchCbiDynlistChange(dl, draggedItem.value);
placeholder = null;
draggedItem = null;
}
ai.parentNode.insertBefore(new_item, ai);
}
+ this.dispatchCbiDynlistChange(dl,value);
+ },
+
+ /** @private */
+ dispatchCbiDynlistChange(dl,value) {
dl.dispatchEvent(new CustomEvent('cbi-dynlist-change', {
bubbles: true,
detail: {
item.parentNode.removeChild(item);
- dl.dispatchEvent(new CustomEvent('cbi-dynlist-change', {
- bubbles: true,
- detail: {
- instance: this,
- element: dl,
- value: value,
- remove: true
- }
- }));
+ this.dispatchCbiDynlistChange(dl, value);
},
/** @private */