@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.8.76",
4
+ "version": "1.8.78",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -340,13 +340,31 @@ function validateAll(): boolean {
340
340
  }
341
341
 
342
342
  // Submit handler for the slot
343
- function handleSubmit() {
344
- return validateAll()
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
- <div :class="schema._class">
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
- </div>
416
+ </form>
399
417
  </template>
400
418
 
401
419
  <style scoped>