@optionfactory/ful 6.0.1 → 6.0.2
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 +13 -4
- 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 +14 -5
- package/dist/ful.mjs.map +1 -1
- package/package.json +1 -1
package/dist/ful.iife.js
CHANGED
|
@@ -1214,14 +1214,18 @@ 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
|
if(!el.hasAttribute("name") || el.matches(":disabled")){
|
|
1223
1224
|
continue;
|
|
1224
1225
|
}
|
|
1226
|
+
if(submitter && (el.type==='submit' || el.type === 'reset') && el !== submitter){
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1225
1229
|
result = Bindings.providePath(result, /** @type {string} */(el.getAttribute('name')), Bindings.extract(el));
|
|
1226
1230
|
}
|
|
1227
1231
|
return result;
|
|
@@ -1355,7 +1359,7 @@ var ful = (function (exports, ftl) {
|
|
|
1355
1359
|
form.addEventListener('submit', async (e) => {
|
|
1356
1360
|
e.preventDefault();
|
|
1357
1361
|
e.stopPropagation();
|
|
1358
|
-
await this.submit();
|
|
1362
|
+
await this.submit(e.submitter);
|
|
1359
1363
|
});
|
|
1360
1364
|
if (this.hasAttribute("clear-invalid-on-change")) {
|
|
1361
1365
|
this.addEventListener('change', (/** @type any */evt) => {
|
|
@@ -1364,11 +1368,16 @@ var ful = (function (exports, ftl) {
|
|
|
1364
1368
|
}
|
|
1365
1369
|
this.replaceChildren(form);
|
|
1366
1370
|
}
|
|
1367
|
-
|
|
1371
|
+
/**
|
|
1372
|
+
*
|
|
1373
|
+
* @param {HTMLElement} [submitter]
|
|
1374
|
+
* @returns
|
|
1375
|
+
*/
|
|
1376
|
+
async submit(submitter) {
|
|
1368
1377
|
this.spinner(true);
|
|
1369
1378
|
try {
|
|
1370
1379
|
const loader = ftl.registry.component(this.getAttribute("loader") ?? 'loaders:form').create(this);
|
|
1371
|
-
const values = this.
|
|
1380
|
+
const values = Bindings.extractFrom(this.form, submitter);
|
|
1372
1381
|
let request = await loader.prepare(values, this);
|
|
1373
1382
|
try {
|
|
1374
1383
|
const se = new CustomEvent('submit', { bubbles: true, cancelable: true, detail: { values, request } });
|