Adding afterStampDomManipulation

This commit is contained in:
Ferdinand Kuhl 2024-10-16 23:12:11 +02:00
parent 1aa62b036f
commit c4c25ae2d1
2 changed files with 6 additions and 1 deletions

View file

@ -15,6 +15,9 @@ export function formStamp(element, options = {})
const itemSelector = '.' + template.content.firstElementChild.className.replace(/ /g, '.');
const initialItemCount = container.querySelectorAll(itemSelector).length;
let created = 0;
const afterDomManipulation = () => {
element.dispatchEvent(new CustomEvent('afterStampDomManipulation'));
}
const removeRow = (removeItem) => () => {
const rowToDelete = removeItem.closest(itemSelector);
// Flow renders identity fields directly at the form tag, so we need to look
@ -33,6 +36,7 @@ export function formStamp(element, options = {})
}
))) {
rowToDelete.remove();
afterDomManipulation();
}
}
@ -55,6 +59,7 @@ export function formStamp(element, options = {})
}
))) {
element.before(clone);
afterDomManipulation();
created++;
}
});

View file

@ -1,6 +1,6 @@
{
"name": "@digicomp/form-stamp",
"version": "0.0.3",
"version": "0.0.4",
"description": "duplicates an entry form field group",
"main": "form-stamp.js",
"scripts": {