mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°8772 - Form dependencies manager implementation
- Form SDK implementation - Basic Forms - Dynamics Forms - Basic Blocks + Data Model Block - Form Compilation - Turbo integration
This commit is contained in:
39
js/forms/collection_element.js
Normal file
39
js/forms/collection_element.js
Normal file
@@ -0,0 +1,39 @@
|
||||
class CollectionElement extends HTMLElement {
|
||||
|
||||
#eBtnAdd;
|
||||
|
||||
// register the custom element
|
||||
static {
|
||||
customElements.define('collection-element', CollectionElement);
|
||||
}
|
||||
|
||||
addFormToCollection(e) {
|
||||
const collectionHolder = document.querySelector('.'+e.currentTarget.dataset.collectionHolderClass);
|
||||
const item = document.createElement('div');
|
||||
|
||||
const collectionHolderList = collectionHolder.querySelector('[role="list"]');
|
||||
|
||||
item.innerHTML = collectionHolder
|
||||
.dataset
|
||||
.prototype
|
||||
.replace(
|
||||
/__name__/g,
|
||||
collectionHolder.dataset.index
|
||||
);
|
||||
|
||||
collectionHolderList.appendChild(item.firstChild);
|
||||
collectionHolder.dataset.index++;
|
||||
|
||||
this.querySelectorAll('collection-entry-element').forEach((entry) => {
|
||||
console.log('test');
|
||||
entry.updateButtonStates();
|
||||
});
|
||||
}
|
||||
|
||||
/** connectedCallback **/
|
||||
connectedCallback() {
|
||||
this.#eBtnAdd = this.querySelector('.add_item_link');
|
||||
this.#eBtnAdd.addEventListener('click', this.addFormToCollection.bind(this));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user