@bagelink/vue 1.8.76 → 1.8.78
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/form-flow/FormFlow.vue.d.ts +5 -2
- package/dist/form-flow/FormFlow.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +82 -74
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/form-flow/FormFlow.vue +22 -4
package/package.json
CHANGED
|
@@ -340,13 +340,31 @@ function validateAll(): boolean {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
// Submit handler for the slot
|
|
343
|
-
function handleSubmit() {
|
|
344
|
-
|
|
343
|
+
function handleSubmit(event?: Event): boolean {
|
|
344
|
+
// Prevent default form submission if event is provided
|
|
345
|
+
if (event) {
|
|
346
|
+
event.preventDefault()
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const isValid = validateAll()
|
|
350
|
+
|
|
351
|
+
// If validation fails, prevent further processing
|
|
352
|
+
if (!isValid) {
|
|
353
|
+
event?.stopPropagation()
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return isValid
|
|
345
357
|
}
|
|
358
|
+
|
|
359
|
+
// Expose methods for parent components (e.g., dialogs)
|
|
360
|
+
defineExpose({
|
|
361
|
+
validate: validateAll,
|
|
362
|
+
handleSubmit
|
|
363
|
+
})
|
|
346
364
|
</script>
|
|
347
365
|
|
|
348
366
|
<template>
|
|
349
|
-
<
|
|
367
|
+
<form :class="schema._class" @submit="handleSubmit">
|
|
350
368
|
<div v-for="{ key, field } in visibleFields" :key="key" :class="[field._class, field._config.class]">
|
|
351
369
|
<!-- Custom slot for specific field -->
|
|
352
370
|
<slot
|
|
@@ -395,7 +413,7 @@ function handleSubmit() {
|
|
|
395
413
|
name="submit" :submit="handleSubmit" :validate="validateAll" :form-data="formData"
|
|
396
414
|
:errors="mergedErrors"
|
|
397
415
|
/>
|
|
398
|
-
</
|
|
416
|
+
</form>
|
|
399
417
|
</template>
|
|
400
418
|
|
|
401
419
|
<style scoped>
|