@connect-soft/form-generator 1.0.0-alpha → 1.1.0-alpha2

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/index.js CHANGED
@@ -3462,86 +3462,89 @@ function getItemKey(item, index) {
3462
3462
  }
3463
3463
  return item.name;
3464
3464
  }
3465
- function FormGenerator(t0) {
3465
+ function hasSchema(props) {
3466
+ return props.schema !== undefined;
3467
+ }
3468
+ function FormGenerator(props) {
3466
3469
  const $ = compilerRuntime.c(20);
3467
3470
  const {
3468
3471
  fields,
3469
- onSubmit,
3470
3472
  defaultValues,
3471
- schema: userSchema,
3472
3473
  className,
3473
- submitText: t1,
3474
+ submitText: t0,
3474
3475
  disabled,
3475
- mode: t2
3476
- } = t0;
3477
- const submitText = t1 === undefined ? "Submit" : t1;
3478
- const mode = t2 === undefined ? "onChange" : t2;
3479
- let t3;
3476
+ mode: t1
3477
+ } = props;
3478
+ const submitText = t0 === undefined ? "Submit" : t0;
3479
+ const mode = t1 === undefined ? "onChange" : t1;
3480
+ const userSchema = hasSchema(props) ? props.schema : undefined;
3481
+ const onSubmit = props.onSubmit;
3482
+ let t2;
3480
3483
  bb0: {
3481
3484
  if (userSchema) {
3482
- t3 = userSchema;
3485
+ t2 = userSchema;
3483
3486
  break bb0;
3484
3487
  }
3485
- let t4;
3488
+ let t3;
3486
3489
  if ($[0] !== fields) {
3487
- t4 = buildSchema(fields);
3490
+ t3 = buildSchema(fields);
3488
3491
  $[0] = fields;
3489
- $[1] = t4;
3492
+ $[1] = t3;
3490
3493
  } else {
3491
- t4 = $[1];
3494
+ t3 = $[1];
3492
3495
  }
3493
- t3 = t4;
3496
+ t2 = t3;
3494
3497
  }
3495
- const schema = t3;
3496
- let t4;
3498
+ const schema = t2;
3499
+ let t3;
3497
3500
  if ($[2] !== defaultValues || $[3] !== fields) {
3498
3501
  const builtDefaults = buildDefaultValues(fields);
3499
- t4 = defaultValues ? deepMerge(builtDefaults, defaultValues) : builtDefaults;
3502
+ t3 = defaultValues ? deepMerge(builtDefaults, defaultValues) : builtDefaults;
3500
3503
  $[2] = defaultValues;
3501
3504
  $[3] = fields;
3502
- $[4] = t4;
3505
+ $[4] = t3;
3503
3506
  } else {
3504
- t4 = $[4];
3507
+ t3 = $[4];
3505
3508
  }
3506
- const mergedDefaultValues = t4;
3507
- let t5;
3509
+ const mergedDefaultValues = t3;
3510
+ let t4;
3508
3511
  if ($[5] !== schema) {
3509
- t5 = a(schema);
3512
+ t4 = a(schema);
3510
3513
  $[5] = schema;
3511
- $[6] = t5;
3514
+ $[6] = t4;
3512
3515
  } else {
3513
- t5 = $[6];
3516
+ t4 = $[6];
3514
3517
  }
3515
- let t6;
3516
- if ($[7] !== mergedDefaultValues || $[8] !== mode || $[9] !== t5) {
3517
- t6 = {
3518
- resolver: t5,
3518
+ let t5;
3519
+ if ($[7] !== mergedDefaultValues || $[8] !== mode || $[9] !== t4) {
3520
+ t5 = {
3521
+ resolver: t4,
3519
3522
  defaultValues: mergedDefaultValues,
3520
3523
  mode
3521
3524
  };
3522
3525
  $[7] = mergedDefaultValues;
3523
3526
  $[8] = mode;
3524
- $[9] = t5;
3525
- $[10] = t6;
3527
+ $[9] = t4;
3528
+ $[10] = t5;
3526
3529
  } else {
3527
- t6 = $[10];
3530
+ t5 = $[10];
3528
3531
  }
3529
- const form = useForm(t6);
3530
- let t7;
3532
+ const form = useForm(t5);
3533
+ let t6;
3531
3534
  if ($[11] !== className || $[12] !== disabled || $[13] !== fields || $[14] !== form || $[15] !== onSubmit || $[16] !== submitText) {
3532
- let t8;
3535
+ let t7;
3533
3536
  if ($[18] !== onSubmit) {
3534
- t8 = async data => {
3537
+ t7 = async data => {
3535
3538
  await onSubmit(data);
3536
3539
  };
3537
3540
  $[18] = onSubmit;
3538
- $[19] = t8;
3541
+ $[19] = t7;
3539
3542
  } else {
3540
- t8 = $[19];
3543
+ t7 = $[19];
3541
3544
  }
3542
- const handleSubmit = form.handleSubmit(t8);
3545
+ const handleSubmit = form.handleSubmit(t7);
3543
3546
  const SubmitButton = getFormComponent("SubmitButton");
3544
- t7 = jsxRuntime.jsx(FormProvider, {
3547
+ t6 = jsxRuntime.jsx(FormProvider, {
3545
3548
  ...form,
3546
3549
  children: jsxRuntime.jsxs("form", {
3547
3550
  onSubmit: handleSubmit,
@@ -3559,11 +3562,11 @@ function FormGenerator(t0) {
3559
3562
  $[14] = form;
3560
3563
  $[15] = onSubmit;
3561
3564
  $[16] = submitText;
3562
- $[17] = t7;
3565
+ $[17] = t6;
3563
3566
  } else {
3564
- t7 = $[17];
3567
+ t6 = $[17];
3565
3568
  }
3566
- return t7;
3569
+ return t6;
3567
3570
  }
3568
3571
  function _temp(item, index) {
3569
3572
  return jsxRuntime.jsx(FormItemRenderer, {