@optionfactory/ful 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ful.iife.js +12 -5
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +13 -6
- package/dist/ful.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ful.iife.js
CHANGED
|
@@ -1214,12 +1214,14 @@ var ful = (function (exports, ftl) {
|
|
|
1214
1214
|
/**
|
|
1215
1215
|
*
|
|
1216
1216
|
* @param {HTMLFormElement} form
|
|
1217
|
+
* @param {HTMLElement} [submitter]
|
|
1217
1218
|
* @returns
|
|
1218
1219
|
*/
|
|
1219
|
-
static extractFrom(form){
|
|
1220
|
+
static extractFrom(form, submitter){
|
|
1220
1221
|
let result = {};
|
|
1221
1222
|
for(const el of form.elements){
|
|
1222
|
-
|
|
1223
|
+
// we are assuming submitters are disabled during submit.
|
|
1224
|
+
if(!el.hasAttribute("name") || (el.matches(":disabled") && el !== submitter)){
|
|
1223
1225
|
continue;
|
|
1224
1226
|
}
|
|
1225
1227
|
result = Bindings.providePath(result, /** @type {string} */(el.getAttribute('name')), Bindings.extract(el));
|
|
@@ -1355,7 +1357,7 @@ var ful = (function (exports, ftl) {
|
|
|
1355
1357
|
form.addEventListener('submit', async (e) => {
|
|
1356
1358
|
e.preventDefault();
|
|
1357
1359
|
e.stopPropagation();
|
|
1358
|
-
await this.submit();
|
|
1360
|
+
await this.submit(e.submitter);
|
|
1359
1361
|
});
|
|
1360
1362
|
if (this.hasAttribute("clear-invalid-on-change")) {
|
|
1361
1363
|
this.addEventListener('change', (/** @type any */evt) => {
|
|
@@ -1364,11 +1366,16 @@ var ful = (function (exports, ftl) {
|
|
|
1364
1366
|
}
|
|
1365
1367
|
this.replaceChildren(form);
|
|
1366
1368
|
}
|
|
1367
|
-
|
|
1369
|
+
/**
|
|
1370
|
+
*
|
|
1371
|
+
* @param {HTMLElement} [submitter]
|
|
1372
|
+
* @returns
|
|
1373
|
+
*/
|
|
1374
|
+
async submit(submitter) {
|
|
1368
1375
|
this.spinner(true);
|
|
1369
1376
|
try {
|
|
1370
1377
|
const loader = ftl.registry.component(this.getAttribute("loader") ?? 'loaders:form').create(this);
|
|
1371
|
-
const values = this.
|
|
1378
|
+
const values = Bindings.extractFrom(this.form, submitter);
|
|
1372
1379
|
let request = await loader.prepare(values, this);
|
|
1373
1380
|
try {
|
|
1374
1381
|
const se = new CustomEvent('submit', { bubbles: true, cancelable: true, detail: { values, request } });
|