@tmagic/form 1.1.6 → 1.2.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.
@@ -1,4 +1,4 @@
1
- import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, watch, unref, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, withModifiers, provide, Teleport } from 'vue';
1
+ import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, watch, unref, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, withModifiers, provide } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, CaretTop, Delete, Grid, ArrowDown, ArrowUp, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual } from 'lodash-es';
4
4
  import { ElMessage } from 'element-plus';
@@ -320,7 +320,7 @@ const _hoisted_1$c = ["innerHTML"];
320
320
  const _hoisted_2$7 = ["innerHTML"];
321
321
  const _hoisted_3$7 = ["innerHTML"];
322
322
  const _hoisted_4$6 = ["innerHTML"];
323
- const _hoisted_5$5 = {
323
+ const _hoisted_5$4 = {
324
324
  key: 4,
325
325
  style: { "text-align": "center" }
326
326
  };
@@ -438,7 +438,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
438
438
  }, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop", "onChange"]);
439
439
  }), 128)) : createCommentVNode("", true)
440
440
  ], 64)) : createCommentVNode("", true),
441
- _ctx.config.expand && _ctx.type !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_5$5, [
441
+ _ctx.config.expand && _ctx.type !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
442
442
  createVNode(_component_el_button, {
443
443
  text: "",
444
444
  onClick: _ctx.expandHandler
@@ -457,7 +457,7 @@ const _hoisted_1$b = ["innerHTML"];
457
457
  const _hoisted_2$6 = ["innerHTML"];
458
458
  const _hoisted_3$6 = { key: 1 };
459
459
  const _hoisted_4$5 = ["innerHTML"];
460
- const _hoisted_5$4 = ["innerHTML"];
460
+ const _hoisted_5$3 = ["innerHTML"];
461
461
  const _hoisted_6$2 = {
462
462
  key: 2,
463
463
  style: { "display": "flex" }
@@ -542,7 +542,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
542
542
  key: 0,
543
543
  innerHTML: __props.config.extra,
544
544
  class: "m-form-tip"
545
- }, null, 8, _hoisted_5$4)) : createCommentVNode("", true)
545
+ }, null, 8, _hoisted_5$3)) : createCommentVNode("", true)
546
546
  ])),
547
547
  __props.config.schematic && unref(show) ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
548
548
  createElementVNode("div", _hoisted_7$2, [
@@ -866,7 +866,7 @@ const _hoisted_3$4 = {
866
866
  class: "el-table__empty-block"
867
867
  };
868
868
  const _hoisted_4$3 = /* @__PURE__ */ createElementVNode("span", { class: "el-table__empty-text" }, "\u6682\u65E0\u6570\u636E", -1);
869
- const _hoisted_5$3 = [
869
+ const _hoisted_5$2 = [
870
870
  _hoisted_4$3
871
871
  ];
872
872
  const _hoisted_6$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u7EC4");
@@ -880,7 +880,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
880
880
  innerHTML: _ctx.config.extra,
881
881
  style: { "color": "rgba(0, 0, 0, 0.45)" }
882
882
  }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
883
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$4, _hoisted_5$3)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
883
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$4, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
884
884
  return openBlock(), createBlock(_component_m_fields_group_list_item, {
885
885
  key: index,
886
886
  model: item,
@@ -961,7 +961,7 @@ const _hoisted_3$3 = {
961
961
  style: { "display": "flex" }
962
962
  };
963
963
  const _hoisted_4$2 = { style: { "flex": "1" } };
964
- const _hoisted_5$2 = ["src"];
964
+ const _hoisted_5$1 = ["src"];
965
965
  function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
966
966
  const _component_caret_bottom = resolveComponent("caret-bottom");
967
967
  const _component_caret_right = resolveComponent("caret-right");
@@ -1015,7 +1015,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
1015
1015
  createElementVNode("img", {
1016
1016
  class: "m-form-schematic",
1017
1017
  src: _ctx.config.schematic
1018
- }, null, 8, _hoisted_5$2)
1018
+ }, null, 8, _hoisted_5$1)
1019
1019
  ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.items, (item, index) => {
1020
1020
  return openBlock(), createBlock(_component_m_form_container, {
1021
1021
  key: item[_ctx.mForm?.keyProp || "__key"] ?? index,
@@ -1601,7 +1601,7 @@ const _hoisted_1$7 = ["innerHTML"];
1601
1601
  const _hoisted_2$2 = { class: "el-form-item__content" };
1602
1602
  const _hoisted_3$2 = ["innerHTML"];
1603
1603
  const _hoisted_4$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0");
1604
- const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \xA0 ");
1604
+ const _hoisted_5 = /* @__PURE__ */ createTextVNode(" \xA0 ");
1605
1605
  const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u5C55\u5F00\u914D\u7F6E");
1606
1606
  const _hoisted_7 = /* @__PURE__ */ createTextVNode("\u5BFC\u5165EXCEL");
1607
1607
  const _hoisted_8 = /* @__PURE__ */ createTextVNode("\xA0 ");
@@ -1791,7 +1791,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1791
1791
  ]),
1792
1792
  _: 1
1793
1793
  })) : createCommentVNode("", true),
1794
- _hoisted_5$1,
1794
+ _hoisted_5,
1795
1795
  _ctx.enableToggleMode && !_ctx.isFullscreen ? (openBlock(), createBlock(_component_el_button, {
1796
1796
  key: 1,
1797
1797
  icon: _ctx.Grid,
@@ -3113,34 +3113,23 @@ const _sfc_main$6 = defineComponent({
3113
3113
  return options2;
3114
3114
  };
3115
3115
  if (typeof props.config.options === "function") {
3116
- watch(
3117
- () => mForm?.values,
3118
- () => {
3119
- typeof props.config.options === "function" && Promise.resolve(
3120
- props.config.options(mForm, {
3121
- model: props.model,
3122
- prop: props.prop,
3123
- formValues: mForm?.values,
3124
- formValue: mForm?.values,
3125
- config: props.config
3126
- })
3127
- ).then((data) => {
3128
- options.value = data;
3129
- });
3130
- },
3131
- {
3132
- deep: true,
3133
- immediate: true
3134
- }
3135
- );
3116
+ watchEffect(() => {
3117
+ typeof props.config.options === "function" && Promise.resolve(
3118
+ props.config.options(mForm, {
3119
+ model: props.model,
3120
+ prop: props.prop,
3121
+ formValues: mForm?.values,
3122
+ formValue: mForm?.values,
3123
+ config: props.config
3124
+ })
3125
+ ).then((data) => {
3126
+ options.value = data;
3127
+ });
3128
+ });
3136
3129
  } else if (Array.isArray(props.config.options)) {
3137
- watch(
3138
- () => props.config.options,
3139
- () => {
3140
- options.value = props.config.options;
3141
- },
3142
- { immediate: true }
3143
- );
3130
+ watchEffect(() => {
3131
+ options.value = props.config.options;
3132
+ });
3144
3133
  } else if (props.config.option) {
3145
3134
  onBeforeMount(() => {
3146
3135
  if (!props.model)
@@ -3778,121 +3767,117 @@ const _sfc_main = defineComponent({
3778
3767
  }
3779
3768
  });
3780
3769
 
3781
- const _hoisted_1 = { class: "m-form-dialog" };
3782
- const _hoisted_2 = { style: { "min-height": "1px" } };
3783
- const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u53D6 \u6D88");
3784
- const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u4E0A\u4E00\u6B65");
3785
- const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u4E0B\u4E00\u6B65");
3770
+ const _hoisted_1 = { style: { "min-height": "1px" } };
3771
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u53D6 \u6D88");
3772
+ const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u4E0A\u4E00\u6B65");
3773
+ const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u4E0B\u4E00\u6B65");
3786
3774
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3787
3775
  const _component_m_form = resolveComponent("m-form");
3788
3776
  const _component_el_col = resolveComponent("el-col");
3789
3777
  const _component_el_button = resolveComponent("el-button");
3790
3778
  const _component_el_row = resolveComponent("el-row");
3791
3779
  const _component_el_dialog = resolveComponent("el-dialog");
3792
- return openBlock(), createBlock(Teleport, { to: "body" }, [
3793
- withDirectives(createElementVNode("div", _hoisted_1, [
3794
- createVNode(_component_el_dialog, {
3795
- modelValue: _ctx.dialogVisible,
3796
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dialogVisible = $event),
3797
- top: "20px",
3798
- title: _ctx.title,
3799
- width: _ctx.width,
3800
- fullscreen: _ctx.fullscreen,
3801
- "close-on-click-modal": false,
3802
- onClose: _ctx.closeHandler
3803
- }, {
3804
- footer: withCtx(() => [
3805
- createVNode(_component_el_row, { class: "dialog-footer" }, {
3780
+ return openBlock(), createBlock(_component_el_dialog, {
3781
+ modelValue: _ctx.dialogVisible,
3782
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dialogVisible = $event),
3783
+ class: "m-form-dialog",
3784
+ top: "20px",
3785
+ "append-to-body": "",
3786
+ title: _ctx.title,
3787
+ width: _ctx.width,
3788
+ fullscreen: _ctx.fullscreen,
3789
+ "close-on-click-modal": false,
3790
+ onClose: _ctx.closeHandler
3791
+ }, {
3792
+ footer: withCtx(() => [
3793
+ createVNode(_component_el_row, { class: "dialog-footer" }, {
3794
+ default: withCtx(() => [
3795
+ createVNode(_component_el_col, {
3796
+ span: 12,
3797
+ style: { "text-align": "left" }
3798
+ }, {
3806
3799
  default: withCtx(() => [
3807
- createVNode(_component_el_col, {
3808
- span: 12,
3809
- style: { "text-align": "left" }
3810
- }, {
3811
- default: withCtx(() => [
3812
- createElementVNode("div", _hoisted_2, [
3813
- renderSlot(_ctx.$slots, "left")
3814
- ])
3815
- ]),
3816
- _: 3
3817
- }),
3818
- createVNode(_component_el_col, { span: 12 }, {
3819
- default: withCtx(() => [
3820
- renderSlot(_ctx.$slots, "footer", {}, () => [
3821
- createVNode(_component_el_button, {
3822
- onClick: _ctx.cancel,
3823
- size: "small"
3824
- }, {
3825
- default: withCtx(() => [
3826
- _hoisted_3
3827
- ]),
3828
- _: 1
3829
- }, 8, ["onClick"]),
3830
- _ctx.hasStep && _ctx.stepActive > 1 ? (openBlock(), createBlock(_component_el_button, {
3831
- key: 0,
3832
- type: "info",
3833
- size: "small",
3834
- onClick: _ctx.preStep
3835
- }, {
3836
- default: withCtx(() => [
3837
- _hoisted_4
3838
- ]),
3839
- _: 1
3840
- }, 8, ["onClick"])) : createCommentVNode("", true),
3841
- _ctx.hasStep && _ctx.stepCount > _ctx.stepActive ? (openBlock(), createBlock(_component_el_button, {
3842
- key: 1,
3843
- type: "info",
3844
- size: "small",
3845
- onClick: _ctx.nextStep
3846
- }, {
3847
- default: withCtx(() => [
3848
- _hoisted_5
3849
- ]),
3850
- _: 1
3851
- }, 8, ["onClick"])) : (openBlock(), createBlock(_component_el_button, {
3852
- key: 2,
3853
- type: "primary",
3854
- size: "small",
3855
- loading: _ctx.saveFetch,
3856
- onClick: _ctx.save
3857
- }, {
3858
- default: withCtx(() => [
3859
- createTextVNode(toDisplayString(_ctx.confirmText), 1)
3860
- ]),
3861
- _: 1
3862
- }, 8, ["loading", "onClick"]))
3863
- ])
3864
- ]),
3865
- _: 3
3866
- })
3800
+ createElementVNode("div", _hoisted_1, [
3801
+ renderSlot(_ctx.$slots, "left")
3802
+ ])
3803
+ ]),
3804
+ _: 3
3805
+ }),
3806
+ createVNode(_component_el_col, { span: 12 }, {
3807
+ default: withCtx(() => [
3808
+ renderSlot(_ctx.$slots, "footer", {}, () => [
3809
+ createVNode(_component_el_button, {
3810
+ onClick: _ctx.cancel,
3811
+ size: "small"
3812
+ }, {
3813
+ default: withCtx(() => [
3814
+ _hoisted_2
3815
+ ]),
3816
+ _: 1
3817
+ }, 8, ["onClick"]),
3818
+ _ctx.hasStep && _ctx.stepActive > 1 ? (openBlock(), createBlock(_component_el_button, {
3819
+ key: 0,
3820
+ type: "info",
3821
+ size: "small",
3822
+ onClick: _ctx.preStep
3823
+ }, {
3824
+ default: withCtx(() => [
3825
+ _hoisted_3
3826
+ ]),
3827
+ _: 1
3828
+ }, 8, ["onClick"])) : createCommentVNode("", true),
3829
+ _ctx.hasStep && _ctx.stepCount > _ctx.stepActive ? (openBlock(), createBlock(_component_el_button, {
3830
+ key: 1,
3831
+ type: "info",
3832
+ size: "small",
3833
+ onClick: _ctx.nextStep
3834
+ }, {
3835
+ default: withCtx(() => [
3836
+ _hoisted_4
3837
+ ]),
3838
+ _: 1
3839
+ }, 8, ["onClick"])) : (openBlock(), createBlock(_component_el_button, {
3840
+ key: 2,
3841
+ type: "primary",
3842
+ size: "small",
3843
+ loading: _ctx.saveFetch,
3844
+ onClick: _ctx.save
3845
+ }, {
3846
+ default: withCtx(() => [
3847
+ createTextVNode(toDisplayString(_ctx.confirmText), 1)
3848
+ ]),
3849
+ _: 1
3850
+ }, 8, ["loading", "onClick"]))
3851
+ ])
3867
3852
  ]),
3868
3853
  _: 3
3869
3854
  })
3870
3855
  ]),
3871
- default: withCtx(() => [
3872
- createElementVNode("div", {
3873
- class: "m-dialog-body",
3874
- style: normalizeStyle(`max-height: ${_ctx.bodyHeight}; overflow-y: auto; overflow-x: hidden;`)
3875
- }, [
3876
- createVNode(_component_m_form, {
3877
- modelValue: _ctx.stepActive,
3878
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3879
- ref: "form",
3880
- size: _ctx.size,
3881
- config: _ctx.config,
3882
- "init-values": _ctx.values,
3883
- "parent-values": _ctx.parentValues,
3884
- "label-width": _ctx.labelWidth,
3885
- onChange: _ctx.changeHandler
3886
- }, null, 8, ["modelValue", "size", "config", "init-values", "parent-values", "label-width", "onChange"]),
3887
- renderSlot(_ctx.$slots, "default")
3888
- ], 4)
3889
- ]),
3890
3856
  _: 3
3891
- }, 8, ["modelValue", "title", "width", "fullscreen", "onClose"])
3892
- ], 512), [
3893
- [vShow, _ctx.dialogVisible]
3894
- ])
3895
- ]);
3857
+ })
3858
+ ]),
3859
+ default: withCtx(() => [
3860
+ _ctx.dialogVisible ? (openBlock(), createElementBlock("div", {
3861
+ key: 0,
3862
+ class: "m-dialog-body",
3863
+ style: normalizeStyle(`max-height: ${_ctx.bodyHeight}; overflow-y: auto; overflow-x: hidden;`)
3864
+ }, [
3865
+ createVNode(_component_m_form, {
3866
+ modelValue: _ctx.stepActive,
3867
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3868
+ ref: "form",
3869
+ size: _ctx.size,
3870
+ config: _ctx.config,
3871
+ "init-values": _ctx.values,
3872
+ "parent-values": _ctx.parentValues,
3873
+ "label-width": _ctx.labelWidth,
3874
+ onChange: _ctx.changeHandler
3875
+ }, null, 8, ["modelValue", "size", "config", "init-values", "parent-values", "label-width", "onChange"]),
3876
+ renderSlot(_ctx.$slots, "default")
3877
+ ], 4)) : createCommentVNode("", true)
3878
+ ]),
3879
+ _: 3
3880
+ }, 8, ["modelValue", "title", "width", "fullscreen", "onClose"]);
3896
3881
  }
3897
3882
  const FormDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
3898
3883