@bagelink/vue 1.9.39 → 1.9.41

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.9.39",
4
+ "version": "1.9.41",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -350,17 +350,21 @@ function usesCustomComponent(field: FieldBuilder): boolean {
350
350
 
351
351
  // Validate all visible fields
352
352
  function validateAll(): boolean {
353
+ console.log('[FormFlow] validateAll started')
353
354
  let isValid = true
354
355
  const newErrors: Record<string, string> = {}
355
356
 
356
357
  for (const { key, field } of visibleFields.value) {
357
358
  const value = getFieldValue(key)
359
+ console.log(`[FormFlow] Validating field "${key}":`, { value, required: field._config.required, type: field._type })
358
360
 
359
361
  // Check required fields first
360
362
  if (field._config.required === true) {
361
363
  const isEmpty = value == null || value === '' || (Array.isArray(value) && value.length === 0)
362
364
  if (isEmpty) {
363
- newErrors[key] = field._config.requiredMessage || 'This field is required'
365
+ const errorMsg = field._config.requiredMessage || 'This field is required'
366
+ console.log(`[FormFlow] Field "${key}" is required but empty, error:`, errorMsg)
367
+ newErrors[key] = errorMsg
364
368
  isValid = false
365
369
  continue
366
370
  }
@@ -368,9 +372,11 @@ function validateAll(): boolean {
368
372
 
369
373
  // Run custom validations
370
374
  if (field._validations != null) {
375
+ console.log(`[FormFlow] Running ${field._validations.length} custom validations for "${key}"`)
371
376
  for (const validate of field._validations) {
372
377
  const result = validate(value)
373
378
  if (result !== true) {
379
+ console.log(`[FormFlow] Field "${key}" failed validation:`, result)
374
380
  newErrors[key] = result
375
381
  isValid = false
376
382
  break
@@ -379,19 +385,24 @@ function validateAll(): boolean {
379
385
  }
380
386
  }
381
387
 
388
+ console.log('[FormFlow] validateAll complete:', { isValid, newErrors })
382
389
  validationErrors.value = newErrors
383
390
  return isValid
384
391
  }
385
392
 
386
393
  // Submit handler for the slot
387
394
  function handleSubmit(event?: Event): boolean {
395
+ console.log('[FormFlow] handleSubmit called', { event, hasEvent: !!event })
396
+
388
397
  // Prevent default form submission if event is provided
389
398
  if (event) {
390
399
  event.preventDefault()
391
400
  }
392
401
 
393
402
  hasSubmitted.value = true
403
+ console.log('[FormFlow] Before validateAll, visibleFields count:', visibleFields.value.length)
394
404
  const isValid = validateAll()
405
+ console.log('[FormFlow] After validateAll, isValid:', isValid, 'validationErrors:', validationErrors.value)
395
406
 
396
407
  // If validation fails, scroll to first error
397
408
  if (!isValid) {
@@ -399,6 +410,7 @@ function handleSubmit(event?: Event): boolean {
399
410
 
400
411
  // Find the first field with an error
401
412
  const firstErrorKey = visibleFields.value.find(({ key }) => validationErrors.value[key])?.key
413
+ console.log('[FormFlow] Validation failed, firstErrorKey:', firstErrorKey)
402
414
 
403
415
  if (firstErrorKey && formElement.value) {
404
416
  // Find the input element - try multiple strategies
@@ -418,6 +430,7 @@ function handleSubmit(event?: Event): boolean {
418
430
  }
419
431
  }
420
432
  } else {
433
+ console.log('[FormFlow] Validation passed, emitting submit with formData:', formData.value)
421
434
  // Emit submit event with form data when validation passes
422
435
  emit('submit', formData.value)
423
436
  }
@@ -430,6 +443,14 @@ defineExpose({
430
443
  validate: validateAll,
431
444
  handleSubmit
432
445
  })
446
+
447
+ // Debug logging on mount
448
+ console.log('[FormFlow] Component mounted', {
449
+ version: '1.9.39-debug',
450
+ schemaFields: Object.keys(props.schema._fields).length,
451
+ handleSubmitDefined: !!handleSubmit,
452
+ validateAllDefined: !!validateAll
453
+ })
433
454
  </script>
434
455
 
435
456
  <template>
@@ -496,7 +517,7 @@ defineExpose({
496
517
  <!-- Submit slot -->
497
518
  <slot
498
519
  name="submit" :submit="handleSubmit" :validate="validateAll" :form-data="formData"
499
- :errors="mergedErrors"
520
+ :errors="mergedErrors" :debug-info="{ handleSubmitType: typeof handleSubmit, validateAllType: typeof validateAll }"
500
521
  />
501
522
  </form>
502
523
  </template>
package/vite.config.ts CHANGED
@@ -22,7 +22,7 @@ export default defineConfig(() => ({
22
22
  },
23
23
  // experimental: { enableNativePlugin: true },
24
24
  build: {
25
- minify: 'esbuild', // Changed from 'oxc' - oxc breaks Vue reactive closures
25
+ minify: false, // Disabled - minification breaks Vue reactive closures in production
26
26
  lib: {
27
27
  entry: resolve(indexDir, 'index.ts'),
28
28
  formats: ['es', 'cjs'],