@tmagic/form 1.0.0-beta.1 → 1.0.0-beta.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.
Files changed (34) hide show
  1. package/dist/tmagic-form.es.js +19 -17
  2. package/dist/tmagic-form.es.js.map +1 -1
  3. package/dist/tmagic-form.umd.js +17 -15
  4. package/dist/tmagic-form.umd.js.map +1 -1
  5. package/dist/types/src/Form.vue.d.ts +10 -13
  6. package/dist/types/src/FormDialog.vue.d.ts +23 -26
  7. package/dist/types/src/containers/Container.vue.d.ts +1 -1
  8. package/dist/types/src/containers/Fieldset.vue.d.ts +1 -1
  9. package/dist/types/src/containers/GroupList.vue.d.ts +1 -1
  10. package/dist/types/src/containers/GroupListItem.vue.d.ts +1 -1
  11. package/dist/types/src/containers/Panel.vue.d.ts +1 -1
  12. package/dist/types/src/containers/Row.vue.d.ts +1 -1
  13. package/dist/types/src/containers/Step.vue.d.ts +1 -1
  14. package/dist/types/src/containers/Table.vue.d.ts +5 -5
  15. package/dist/types/src/containers/Tabs.vue.d.ts +2 -2
  16. package/dist/types/src/fields/Cascader.vue.d.ts +16 -16
  17. package/dist/types/src/fields/Checkbox.vue.d.ts +2 -2
  18. package/dist/types/src/fields/CheckboxGroup.vue.d.ts +2 -2
  19. package/dist/types/src/fields/Date.vue.d.ts +2 -2
  20. package/dist/types/src/fields/DateTime.vue.d.ts +2 -2
  21. package/dist/types/src/fields/Daterange.vue.d.ts +2 -2
  22. package/dist/types/src/fields/DynamicField.vue.d.ts +2 -2
  23. package/dist/types/src/fields/Link.vue.d.ts +47 -54
  24. package/dist/types/src/fields/Number.vue.d.ts +2 -2
  25. package/dist/types/src/fields/RadioGroup.vue.d.ts +2 -2
  26. package/dist/types/src/fields/Select.vue.d.ts +12 -12
  27. package/dist/types/src/fields/Switch.vue.d.ts +2 -2
  28. package/dist/types/src/fields/Text.vue.d.ts +2 -2
  29. package/dist/types/src/fields/Textarea.vue.d.ts +2 -2
  30. package/dist/types/src/fields/Time.vue.d.ts +2 -2
  31. package/package.json +6 -6
  32. package/src/Form.vue +33 -29
  33. package/src/FormDialog.vue +3 -0
  34. package/src/containers/Tabs.vue +4 -0
@@ -1818,6 +1818,7 @@
1818
1818
  };
1819
1819
  const tabClickHandler = (mForm, tab, props) => {
1820
1820
  const { config, model, prop } = props;
1821
+ tab.name = tab.paneName;
1821
1822
  if (typeof config.onTabClick === "function") {
1822
1823
  config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
1823
1824
  }
@@ -3358,7 +3359,6 @@
3358
3359
 
3359
3360
  const _sfc_main$1 = vue.defineComponent({
3360
3361
  name: "m-form",
3361
- components: { ElForm: elementPlus.ElForm, MContainer: Container },
3362
3362
  props: {
3363
3363
  initValues: {
3364
3364
  type: Object,
@@ -3391,8 +3391,7 @@
3391
3391
  default: () => 1
3392
3392
  },
3393
3393
  size: {
3394
- type: String,
3395
- default: "small"
3394
+ type: String
3396
3395
  },
3397
3396
  inline: {
3398
3397
  type: Boolean,
@@ -3435,8 +3434,10 @@
3435
3434
  }
3436
3435
  });
3437
3436
  vue.provide("mForm", formState);
3438
- vue.watchEffect(() => {
3439
- initialized.value = false;
3437
+ vue.watch([() => props.config, () => props.initValues], ([config], [preConfig]) => {
3438
+ if (!lodashEs.isEqual(vue.toRaw(config), vue.toRaw(preConfig))) {
3439
+ initialized.value = false;
3440
+ }
3440
3441
  initValue(formState, {
3441
3442
  initValues: props.initValues,
3442
3443
  config: props.config
@@ -3444,7 +3445,7 @@
3444
3445
  values.value = value;
3445
3446
  initialized.value = true;
3446
3447
  });
3447
- });
3448
+ }, { immediate: true });
3448
3449
  return {
3449
3450
  initialized,
3450
3451
  values,
@@ -3477,10 +3478,9 @@
3477
3478
  }
3478
3479
  });
3479
3480
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3480
- const _component_MContainer = vue.resolveComponent("MContainer");
3481
- const _component_ElForm = vue.resolveComponent("ElForm");
3482
- return _ctx.initialized && Array.isArray(_ctx.config) ? (vue.openBlock(), vue.createBlock(_component_ElForm, {
3483
- key: 0,
3481
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
3482
+ const _component_el_form = vue.resolveComponent("el-form");
3483
+ return vue.openBlock(), vue.createBlock(_component_el_form, {
3484
3484
  class: "m-form",
3485
3485
  ref: "elForm",
3486
3486
  model: _ctx.values,
@@ -3491,8 +3491,8 @@
3491
3491
  "label-position": _ctx.labelPosition
3492
3492
  }, {
3493
3493
  default: vue.withCtx(() => [
3494
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config, (item, index) => {
3495
- return vue.openBlock(), vue.createBlock(_component_MContainer, {
3494
+ _ctx.initialized && Array.isArray(_ctx.config) ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.config, (item, index) => {
3495
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
3496
3496
  key: item[_ctx.keyProp] ?? index,
3497
3497
  config: item,
3498
3498
  model: _ctx.values,
@@ -3501,10 +3501,10 @@
3501
3501
  size: _ctx.size,
3502
3502
  onChange: _ctx.changeHandler
3503
3503
  }, null, 8, ["config", "model", "label-width", "step-active", "size", "onChange"]);
3504
- }), 128))
3504
+ }), 128)) : vue.createCommentVNode("", true)
3505
3505
  ]),
3506
3506
  _: 1
3507
- }, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"])) : vue.createCommentVNode("", true);
3507
+ }, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"]);
3508
3508
  }
3509
3509
  var Form = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
3510
3510
 
@@ -3524,6 +3524,7 @@
3524
3524
  default: () => []
3525
3525
  },
3526
3526
  labelWidth: [Number, String],
3527
+ size: String,
3527
3528
  confirmText: {
3528
3529
  type: String,
3529
3530
  default: "\u786E\u5B9A"
@@ -3694,11 +3695,12 @@
3694
3695
  modelValue: _ctx.stepActive,
3695
3696
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3696
3697
  ref: "form",
3698
+ size: _ctx.size,
3697
3699
  config: _ctx.config,
3698
3700
  "init-values": _ctx.values,
3699
3701
  "label-width": _ctx.labelWidth,
3700
3702
  onChange: _ctx.changeHandler
3701
- }, null, 8, ["modelValue", "config", "init-values", "label-width", "onChange"]),
3703
+ }, null, 8, ["modelValue", "size", "config", "init-values", "label-width", "onChange"]),
3702
3704
  vue.renderSlot(_ctx.$slots, "default")
3703
3705
  ], 4)
3704
3706
  ]),