@tmagic/form 1.4.0-beta.1 → 1.4.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.
package/dist/style.css CHANGED
@@ -221,17 +221,12 @@ fieldset.m-fieldset .m-form-tip {
221
221
  .m-form-box {
222
222
  display: flex;
223
223
  flex-direction: column;
224
- padding: 16px;
225
- box-sizing: border-box;
226
224
  }
227
225
  .m-form-box .el-box__header {
228
226
  margin: 0;
229
227
  }
230
- .m-form-box .m-box-body {
231
- flex: 1;
232
- overflow-y: auto;
233
- overflow-x: hidden;
234
- }
235
228
  .m-form-box .dialog-footer {
236
- margin-top: 16px;
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: space-between;
237
232
  }
@@ -1,7 +1,7 @@
1
1
  import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, nextTick, resolveDirective, createSlots, withModifiers } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual, isEmpty } from 'lodash-es';
4
- import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer } from '@tmagic/design';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
5
5
  import Sortable from 'sortablejs';
6
6
  import { sleep, asyncLoadJs, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
7
7
 
@@ -166,8 +166,8 @@ const initValue = async (mForm, { initValues, config }) => {
166
166
  return valuesTmp || {};
167
167
  };
168
168
 
169
- const _hoisted_1$e = ["id", "data-magic-id"];
170
- const _hoisted_2$9 = ["innerHTML", "title"];
169
+ const _hoisted_1$d = ["id", "data-magic-id"];
170
+ const _hoisted_2$8 = ["innerHTML", "title"];
171
171
  const _hoisted_3$5 = ["innerHTML"];
172
172
  const _hoisted_4$4 = ["innerHTML"];
173
173
  const _hoisted_5$4 = ["innerHTML"];
@@ -373,7 +373,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
373
373
  createElementVNode("span", {
374
374
  innerHTML: type.value === "checkbox" ? "" : text.value,
375
375
  title: _ctx.config.labelTitle
376
- }, null, 8, _hoisted_2$9)
376
+ }, null, 8, _hoisted_2$8)
377
377
  ]),
378
378
  default: withCtx(() => [
379
379
  tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
@@ -604,13 +604,13 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
604
604
  _: 1
605
605
  })
606
606
  ])) : createCommentVNode("", true)
607
- ], 14, _hoisted_1$e)) : createCommentVNode("", true);
607
+ ], 14, _hoisted_1$d)) : createCommentVNode("", true);
608
608
  };
609
609
  }
610
610
  });
611
611
 
612
- const _hoisted_1$d = ["innerHTML"];
613
- const _hoisted_2$8 = ["innerHTML"];
612
+ const _hoisted_1$c = ["innerHTML"];
613
+ const _hoisted_2$7 = ["innerHTML"];
614
614
  const _hoisted_3$4 = { key: 1 };
615
615
  const _hoisted_4$3 = ["innerHTML"];
616
616
  const _hoisted_5$3 = ["innerHTML"];
@@ -674,18 +674,18 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
674
674
  change
675
675
  ],
676
676
  prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
677
- "true-label": 1,
678
- "false-label": 0
677
+ "true-value": 1,
678
+ "false-value": 0
679
679
  }, {
680
680
  default: withCtx(() => [
681
681
  createElementVNode("span", {
682
682
  innerHTML: _ctx.config.legend
683
- }, null, 8, _hoisted_1$d),
683
+ }, null, 8, _hoisted_1$c),
684
684
  _ctx.config.extra ? (openBlock(), createElementBlock("span", {
685
685
  key: 0,
686
686
  innerHTML: _ctx.config.extra,
687
687
  class: "m-form-tip"
688
- }, null, 8, _hoisted_2$8)) : createCommentVNode("", true)
688
+ }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
689
689
  ]),
690
690
  _: 1
691
691
  }, 8, ["modelValue", "prop"])
@@ -745,8 +745,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
745
745
  }
746
746
  });
747
747
 
748
- const _hoisted_1$c = { class: "m-fields-group-list-item" };
749
- const _hoisted_2$7 = ["innerHTML"];
748
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
749
+ const _hoisted_2$6 = ["innerHTML"];
750
750
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
751
751
  ...{
752
752
  name: "MFormGroupListItem"
@@ -813,7 +813,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
813
813
  };
814
814
  const onAddDiffCount = () => emit("addDiffCount");
815
815
  return (_ctx, _cache) => {
816
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
816
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
817
817
  createElementVNode("div", null, [
818
818
  createVNode(unref(TMagicButton), {
819
819
  link: "",
@@ -879,7 +879,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
879
879
  key: 1,
880
880
  innerHTML: itemExtra.value,
881
881
  class: "m-form-tip"
882
- }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
882
+ }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
883
883
  ]),
884
884
  expand.value ? (openBlock(), createBlock(_sfc_main$z, {
885
885
  key: 0,
@@ -899,8 +899,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
899
899
  }
900
900
  });
901
901
 
902
- const _hoisted_1$b = { class: "m-fields-group-list" };
903
- const _hoisted_2$6 = ["innerHTML"];
902
+ const _hoisted_1$a = { class: "m-fields-group-list" };
903
+ const _hoisted_2$5 = ["innerHTML"];
904
904
  const _hoisted_3$3 = {
905
905
  key: 1,
906
906
  class: "el-table__empty-block"
@@ -993,12 +993,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
993
993
  const onAddDiffCount = () => emit("addDiffCount");
994
994
  const getLastValues = (item, index) => item?.[index] || {};
995
995
  return (_ctx, _cache) => {
996
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
996
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
997
997
  _ctx.config.extra ? (openBlock(), createElementBlock("div", {
998
998
  key: 0,
999
999
  innerHTML: _ctx.config.extra,
1000
1000
  style: { "color": "rgba(0, 0, 0, 0.45)" }
1001
- }, null, 8, _hoisted_2$6)) : createCommentVNode("", true),
1001
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
1002
1002
  !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
1003
1003
  return openBlock(), createBlock(_sfc_main$x, {
1004
1004
  key: index,
@@ -1045,8 +1045,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1045
1045
  }
1046
1046
  });
1047
1047
 
1048
- const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1049
- const _hoisted_2$5 = ["innerHTML"];
1048
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1049
+ const _hoisted_2$4 = ["innerHTML"];
1050
1050
  const _hoisted_3$2 = {
1051
1051
  key: 0,
1052
1052
  style: { "display": "flex" }
@@ -1086,7 +1086,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1086
1086
  "body-style": { display: expand.value ? "block" : "none" }
1087
1087
  }, {
1088
1088
  header: withCtx(() => [
1089
- createElementVNode("div", _hoisted_1$a, [
1089
+ createElementVNode("div", _hoisted_1$9, [
1090
1090
  createVNode(unref(TMagicButton), {
1091
1091
  style: { "padding": "0" },
1092
1092
  link: "",
@@ -1097,7 +1097,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1097
1097
  key: 0,
1098
1098
  innerHTML: _ctx.config.extra,
1099
1099
  class: "m-form-tip"
1100
- }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
1100
+ }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1101
1101
  renderSlot(_ctx.$slots, "header", {}, () => [
1102
1102
  createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
1103
1103
  ])
@@ -1331,8 +1331,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1331
1331
  }
1332
1332
  });
1333
1333
 
1334
- const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1335
- const _hoisted_2$4 = ["innerHTML"];
1334
+ const _hoisted_1$8 = { class: "m-fields-table-wrap" };
1335
+ const _hoisted_2$3 = ["innerHTML"];
1336
1336
  const _hoisted_3$1 = ["innerHTML"];
1337
1337
  const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1338
1338
  const _hoisted_5 = { style: { "display": "flex" } };
@@ -1701,7 +1701,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1701
1701
  toggleRowSelection
1702
1702
  });
1703
1703
  return (_ctx, _cache) => {
1704
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
1704
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1705
1705
  (openBlock(), createBlock(Teleport, {
1706
1706
  to: "body",
1707
1707
  disabled: !isFullscreen.value
@@ -1715,7 +1715,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1715
1715
  key: 0,
1716
1716
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1717
1717
  innerHTML: _ctx.config.extra
1718
- }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1718
+ }, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
1719
1719
  createVNode(unref(TMagicTooltip), {
1720
1720
  content: "拖拽可排序",
1721
1721
  placement: "left-start",
@@ -2633,7 +2633,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2633
2633
  }
2634
2634
  });
2635
2635
 
2636
- const _hoisted_1$8 = { key: 0 };
2636
+ const _hoisted_1$7 = { key: 0 };
2637
2637
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
2638
2638
  ...{
2639
2639
  name: "MFormDisplay"
@@ -2657,12 +2657,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2657
2657
  }
2658
2658
  useAddField(props.prop);
2659
2659
  return (_ctx, _cache) => {
2660
- return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
2660
+ return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$7, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
2661
2661
  };
2662
2662
  }
2663
2663
  });
2664
2664
 
2665
- const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
2665
+ const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2666
2666
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
2667
2667
  ...{
2668
2668
  name: "MFormDynamicField"
@@ -2729,7 +2729,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2729
2729
  emit("change", fieldMap.value[key], key);
2730
2730
  };
2731
2731
  return (_ctx, _cache) => {
2732
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
2732
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
2733
2733
  createVNode(unref(TMagicForm), { size: "small" }, {
2734
2734
  default: withCtx(() => [
2735
2735
  (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
@@ -2948,7 +2948,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2948
2948
  }
2949
2949
  });
2950
2950
 
2951
- const _hoisted_1$6 = { style: { "min-height": "1px" } };
2951
+ const _hoisted_1$5 = { style: { "min-height": "1px" } };
2952
2952
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
2953
2953
  ...{
2954
2954
  name: "MFormDialog"
@@ -3057,7 +3057,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3057
3057
  style: { "text-align": "left" }
3058
3058
  }, {
3059
3059
  default: withCtx(() => [
3060
- createElementVNode("div", _hoisted_1$6, [
3060
+ createElementVNode("div", _hoisted_1$5, [
3061
3061
  renderSlot(_ctx.$slots, "left")
3062
3062
  ])
3063
3063
  ]),
@@ -3147,8 +3147,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3147
3147
  }
3148
3148
  });
3149
3149
 
3150
- const _hoisted_1$5 = ["href"];
3151
- const _hoisted_2$3 = {
3150
+ const _hoisted_1$4 = ["href"];
3151
+ const _hoisted_2$2 = {
3152
3152
  key: 2,
3153
3153
  class: "m-fields-link"
3154
3154
  };
@@ -3221,10 +3221,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3221
3221
  target: "_blank",
3222
3222
  href: href.value,
3223
3223
  style: normalizeStyle(_ctx.config.css || {})
3224
- }, toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3224
+ }, toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3225
3225
  key: 1,
3226
3226
  style: normalizeStyle(_ctx.config.disabledCss || {})
3227
- }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
3227
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
3228
3228
  createVNode(unref(TMagicButton), {
3229
3229
  link: "",
3230
3230
  type: "primary",
@@ -3300,8 +3300,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3300
3300
  }
3301
3301
  });
3302
3302
 
3303
- const _hoisted_1$4 = { class: "m-fields-number-range" };
3304
- const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3303
+ const _hoisted_1$3 = { class: "m-fields-number-range" };
3304
+ const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3305
3305
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
3306
3306
  ...{
3307
3307
  name: "MFormNumberRange"
@@ -3333,7 +3333,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3333
3333
  emit("change", [props.model[props.name][0], Number(v)]);
3334
3334
  };
3335
3335
  return (_ctx, _cache) => {
3336
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
3336
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
3337
3337
  createVNode(unref(TMagicInput), {
3338
3338
  modelValue: _ctx.model[_ctx.name][0],
3339
3339
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
@@ -3342,7 +3342,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3342
3342
  disabled: _ctx.disabled,
3343
3343
  onChange: minChangeHandler
3344
3344
  }, null, 8, ["modelValue", "size", "disabled"]),
3345
- _hoisted_2$2,
3345
+ _hoisted_2$1,
3346
3346
  createVNode(unref(TMagicInput), {
3347
3347
  modelValue: _ctx.model[_ctx.name][1],
3348
3348
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3465,7 +3465,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3465
3465
  }
3466
3466
  });
3467
3467
 
3468
- const _hoisted_1$3 = { key: 2 };
3468
+ const _hoisted_1$2 = { key: 2 };
3469
3469
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3470
3470
  ...{
3471
3471
  name: "MFormSelect"
@@ -3814,7 +3814,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3814
3814
  key: 1,
3815
3815
  options: unref(itemOptions)
3816
3816
  }, null, 8, ["options"])),
3817
- moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$3, null, 512)), [
3817
+ moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
3818
3818
  [_directive_loading, true]
3819
3819
  ]) : createCommentVNode("", true)
3820
3820
  ]),
@@ -3884,8 +3884,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3884
3884
  }
3885
3885
  });
3886
3886
 
3887
- const _hoisted_1$2 = { class: "m-form-item__content" };
3888
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3887
+ const _hoisted_1$1 = { class: "m-form-item__content" };
3888
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3889
3889
  const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3890
3890
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3891
3891
  ...{
@@ -4041,8 +4041,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4041
4041
  ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4042
4042
  ]),
4043
4043
  default: withCtx(() => [
4044
- createElementVNode("div", _hoisted_1$2, [
4045
- _hoisted_2$1,
4044
+ createElementVNode("div", _hoisted_1$1, [
4045
+ _hoisted_2,
4046
4046
  createElementVNode("div", _hoisted_3, [
4047
4047
  createVNode(unref(TMagicButton), {
4048
4048
  link: "",
@@ -4236,7 +4236,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4236
4236
  }
4237
4237
  });
4238
4238
 
4239
- const _hoisted_1$1 = { style: { "min-height": "1px" } };
4239
+ const _hoisted_1 = { style: { "min-height": "1px" } };
4240
4240
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4241
4241
  ...{
4242
4242
  name: "MFormDialog"
@@ -4340,7 +4340,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4340
4340
  style: { "text-align": "left" }
4341
4341
  }, {
4342
4342
  default: withCtx(() => [
4343
- createElementVNode("div", _hoisted_1$1, [
4343
+ createElementVNode("div", _hoisted_1, [
4344
4344
  renderSlot(_ctx.$slots, "left")
4345
4345
  ])
4346
4346
  ]),
@@ -4403,11 +4403,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4403
4403
  }
4404
4404
  });
4405
4405
 
4406
- const _hoisted_1 = { class: "m-form-box" };
4407
- const _hoisted_2 = { style: { "min-height": "1px" } };
4406
+ const footerHeight = 60;
4408
4407
  const _sfc_main = /* @__PURE__ */ defineComponent({
4409
4408
  ...{
4410
- name: "MFormDialog"
4409
+ name: "MFormBox"
4411
4410
  },
4412
4411
  __name: "FormBox",
4413
4412
  props: {
@@ -4415,6 +4414,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4415
4414
  values: { default: () => ({}) },
4416
4415
  parentValues: {},
4417
4416
  width: {},
4417
+ height: {},
4418
4418
  labelWidth: {},
4419
4419
  disabled: { type: Boolean },
4420
4420
  size: {},
@@ -4424,15 +4424,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4424
4424
  },
4425
4425
  emits: ["submit", "change", "error"],
4426
4426
  setup(__props, { expose: __expose, emit: __emit }) {
4427
+ const props = __props;
4427
4428
  const emit = __emit;
4429
+ const style = computed(() => {
4430
+ const style2 = {};
4431
+ if (typeof props.width === "number") {
4432
+ style2.width = `${props.width}px`;
4433
+ }
4434
+ if (typeof props.height === "number") {
4435
+ style2.height = `${props.height}px`;
4436
+ }
4437
+ return style2;
4438
+ });
4428
4439
  const form = ref();
4429
- const boxBody = ref();
4430
4440
  const saveFetch = ref(false);
4431
4441
  const bodyHeight = ref(0);
4432
4442
  watchEffect(() => {
4433
- if (boxBody.value) {
4434
- bodyHeight.value = boxBody.value.clientHeight;
4443
+ if (!props.height) {
4444
+ return;
4435
4445
  }
4446
+ bodyHeight.value = props.height - footerHeight;
4436
4447
  });
4437
4448
  const submitHandler = async () => {
4438
4449
  try {
@@ -4452,67 +4463,63 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4452
4463
  __expose({
4453
4464
  form,
4454
4465
  saveFetch,
4455
- bodyHeight,
4456
4466
  show,
4457
4467
  hide
4458
4468
  });
4459
4469
  return (_ctx, _cache) => {
4460
- return openBlock(), createElementBlock("div", _hoisted_1, [
4470
+ return openBlock(), createElementBlock("div", {
4471
+ class: "m-form-box",
4472
+ style: normalizeStyle(style.value)
4473
+ }, [
4461
4474
  createElementVNode("div", {
4462
- ref_key: "boxBody",
4463
- ref: boxBody,
4464
- class: "m-box-body"
4475
+ class: "m-box-body",
4476
+ style: normalizeStyle(bodyHeight.value ? { height: `${bodyHeight.value}px` } : {})
4465
4477
  }, [
4466
- createVNode(_sfc_main$f, {
4467
- ref_key: "form",
4468
- ref: form,
4469
- size: _ctx.size,
4470
- disabled: _ctx.disabled,
4471
- config: _ctx.config,
4472
- "init-values": _ctx.values,
4473
- "parent-values": _ctx.parentValues,
4474
- "label-width": _ctx.labelWidth,
4475
- "label-position": _ctx.labelPosition,
4476
- inline: _ctx.inline,
4477
- onChange: changeHandler
4478
- }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4479
- renderSlot(_ctx.$slots, "default")
4480
- ], 512),
4481
- createVNode(unref(TMagicRow), { class: "dialog-footer" }, {
4482
- default: withCtx(() => [
4483
- createVNode(unref(TMagicCol), {
4484
- span: 12,
4485
- style: { "text-align": "left" }
4486
- }, {
4487
- default: withCtx(() => [
4488
- createElementVNode("div", _hoisted_2, [
4489
- renderSlot(_ctx.$slots, "left")
4490
- ])
4491
- ]),
4492
- _: 3
4493
- }),
4494
- createVNode(unref(TMagicCol), { span: 12 }, {
4495
- default: withCtx(() => [
4496
- renderSlot(_ctx.$slots, "footer", {}, () => [
4497
- createVNode(unref(TMagicButton), {
4498
- type: "primary",
4499
- disabled: _ctx.disabled,
4500
- loading: saveFetch.value,
4501
- onClick: submitHandler
4502
- }, {
4503
- default: withCtx(() => [
4504
- createTextVNode(toDisplayString(_ctx.confirmText), 1)
4505
- ]),
4506
- _: 1
4507
- }, 8, ["disabled", "loading"])
4508
- ])
4509
- ]),
4510
- _: 3
4511
- })
4478
+ createVNode(unref(TMagicScrollbar), null, {
4479
+ default: withCtx(() => [
4480
+ createVNode(_sfc_main$f, {
4481
+ ref_key: "form",
4482
+ ref: form,
4483
+ size: _ctx.size,
4484
+ disabled: _ctx.disabled,
4485
+ config: _ctx.config,
4486
+ "init-values": _ctx.values,
4487
+ "parent-values": _ctx.parentValues,
4488
+ "label-width": _ctx.labelWidth,
4489
+ "label-position": _ctx.labelPosition,
4490
+ inline: _ctx.inline,
4491
+ onChange: changeHandler
4492
+ }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4493
+ renderSlot(_ctx.$slots, "default")
4494
+ ]),
4495
+ _: 3
4496
+ })
4497
+ ], 4),
4498
+ createElementVNode("div", {
4499
+ class: "dialog-footer",
4500
+ style: normalizeStyle(`height: ${footerHeight}px`)
4501
+ }, [
4502
+ createElementVNode("div", null, [
4503
+ renderSlot(_ctx.$slots, "left")
4512
4504
  ]),
4513
- _: 3
4514
- })
4515
- ]);
4505
+ createElementVNode("div", null, [
4506
+ renderSlot(_ctx.$slots, "footer", {}, () => [
4507
+ createVNode(unref(TMagicButton), {
4508
+ type: "primary",
4509
+ size: _ctx.size,
4510
+ disabled: _ctx.disabled,
4511
+ loading: saveFetch.value,
4512
+ onClick: submitHandler
4513
+ }, {
4514
+ default: withCtx(() => [
4515
+ createTextVNode(toDisplayString(_ctx.confirmText), 1)
4516
+ ]),
4517
+ _: 1
4518
+ }, 8, ["size", "disabled", "loading"])
4519
+ ])
4520
+ ])
4521
+ ], 4)
4522
+ ], 4);
4516
4523
  };
4517
4524
  }
4518
4525
  });
@@ -165,8 +165,8 @@
165
165
  return valuesTmp || {};
166
166
  };
167
167
 
168
- const _hoisted_1$e = ["id", "data-magic-id"];
169
- const _hoisted_2$9 = ["innerHTML", "title"];
168
+ const _hoisted_1$d = ["id", "data-magic-id"];
169
+ const _hoisted_2$8 = ["innerHTML", "title"];
170
170
  const _hoisted_3$5 = ["innerHTML"];
171
171
  const _hoisted_4$4 = ["innerHTML"];
172
172
  const _hoisted_5$4 = ["innerHTML"];
@@ -372,7 +372,7 @@
372
372
  vue.createElementVNode("span", {
373
373
  innerHTML: type.value === "checkbox" ? "" : text.value,
374
374
  title: _ctx.config.labelTitle
375
- }, null, 8, _hoisted_2$9)
375
+ }, null, 8, _hoisted_2$8)
376
376
  ]),
377
377
  default: vue.withCtx(() => [
378
378
  tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
@@ -603,13 +603,13 @@
603
603
  _: 1
604
604
  })
605
605
  ])) : vue.createCommentVNode("", true)
606
- ], 14, _hoisted_1$e)) : vue.createCommentVNode("", true);
606
+ ], 14, _hoisted_1$d)) : vue.createCommentVNode("", true);
607
607
  };
608
608
  }
609
609
  });
610
610
 
611
- const _hoisted_1$d = ["innerHTML"];
612
- const _hoisted_2$8 = ["innerHTML"];
611
+ const _hoisted_1$c = ["innerHTML"];
612
+ const _hoisted_2$7 = ["innerHTML"];
613
613
  const _hoisted_3$4 = { key: 1 };
614
614
  const _hoisted_4$3 = ["innerHTML"];
615
615
  const _hoisted_5$3 = ["innerHTML"];
@@ -673,18 +673,18 @@
673
673
  change
674
674
  ],
675
675
  prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
676
- "true-label": 1,
677
- "false-label": 0
676
+ "true-value": 1,
677
+ "false-value": 0
678
678
  }, {
679
679
  default: vue.withCtx(() => [
680
680
  vue.createElementVNode("span", {
681
681
  innerHTML: _ctx.config.legend
682
- }, null, 8, _hoisted_1$d),
682
+ }, null, 8, _hoisted_1$c),
683
683
  _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
684
684
  key: 0,
685
685
  innerHTML: _ctx.config.extra,
686
686
  class: "m-form-tip"
687
- }, null, 8, _hoisted_2$8)) : vue.createCommentVNode("", true)
687
+ }, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
688
688
  ]),
689
689
  _: 1
690
690
  }, 8, ["modelValue", "prop"])
@@ -744,8 +744,8 @@
744
744
  }
745
745
  });
746
746
 
747
- const _hoisted_1$c = { class: "m-fields-group-list-item" };
748
- const _hoisted_2$7 = ["innerHTML"];
747
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
748
+ const _hoisted_2$6 = ["innerHTML"];
749
749
  const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
750
750
  ...{
751
751
  name: "MFormGroupListItem"
@@ -812,7 +812,7 @@
812
812
  };
813
813
  const onAddDiffCount = () => emit("addDiffCount");
814
814
  return (_ctx, _cache) => {
815
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
815
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
816
816
  vue.createElementVNode("div", null, [
817
817
  vue.createVNode(vue.unref(design.TMagicButton), {
818
818
  link: "",
@@ -878,7 +878,7 @@
878
878
  key: 1,
879
879
  innerHTML: itemExtra.value,
880
880
  class: "m-form-tip"
881
- }, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
881
+ }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
882
882
  ]),
883
883
  expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$z, {
884
884
  key: 0,
@@ -898,8 +898,8 @@
898
898
  }
899
899
  });
900
900
 
901
- const _hoisted_1$b = { class: "m-fields-group-list" };
902
- const _hoisted_2$6 = ["innerHTML"];
901
+ const _hoisted_1$a = { class: "m-fields-group-list" };
902
+ const _hoisted_2$5 = ["innerHTML"];
903
903
  const _hoisted_3$3 = {
904
904
  key: 1,
905
905
  class: "el-table__empty-block"
@@ -992,12 +992,12 @@
992
992
  const onAddDiffCount = () => emit("addDiffCount");
993
993
  const getLastValues = (item, index) => item?.[index] || {};
994
994
  return (_ctx, _cache) => {
995
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
995
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
996
996
  _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
997
997
  key: 0,
998
998
  innerHTML: _ctx.config.extra,
999
999
  style: { "color": "rgba(0, 0, 0, 0.45)" }
1000
- }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true),
1000
+ }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
1001
1001
  !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
1002
1002
  return vue.openBlock(), vue.createBlock(_sfc_main$x, {
1003
1003
  key: index,
@@ -1044,8 +1044,8 @@
1044
1044
  }
1045
1045
  });
1046
1046
 
1047
- const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1048
- const _hoisted_2$5 = ["innerHTML"];
1047
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1048
+ const _hoisted_2$4 = ["innerHTML"];
1049
1049
  const _hoisted_3$2 = {
1050
1050
  key: 0,
1051
1051
  style: { "display": "flex" }
@@ -1085,7 +1085,7 @@
1085
1085
  "body-style": { display: expand.value ? "block" : "none" }
1086
1086
  }, {
1087
1087
  header: vue.withCtx(() => [
1088
- vue.createElementVNode("div", _hoisted_1$a, [
1088
+ vue.createElementVNode("div", _hoisted_1$9, [
1089
1089
  vue.createVNode(vue.unref(design.TMagicButton), {
1090
1090
  style: { "padding": "0" },
1091
1091
  link: "",
@@ -1096,7 +1096,7 @@
1096
1096
  key: 0,
1097
1097
  innerHTML: _ctx.config.extra,
1098
1098
  class: "m-form-tip"
1099
- }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
1099
+ }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1100
1100
  vue.renderSlot(_ctx.$slots, "header", {}, () => [
1101
1101
  vue.createTextVNode(vue.toDisplayString(filter(_ctx.config.title)), 1)
1102
1102
  ])
@@ -1330,8 +1330,8 @@
1330
1330
  }
1331
1331
  });
1332
1332
 
1333
- const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1334
- const _hoisted_2$4 = ["innerHTML"];
1333
+ const _hoisted_1$8 = { class: "m-fields-table-wrap" };
1334
+ const _hoisted_2$3 = ["innerHTML"];
1335
1335
  const _hoisted_3$1 = ["innerHTML"];
1336
1336
  const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1337
1337
  const _hoisted_5 = { style: { "display": "flex" } };
@@ -1700,7 +1700,7 @@
1700
1700
  toggleRowSelection
1701
1701
  });
1702
1702
  return (_ctx, _cache) => {
1703
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
1703
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
1704
1704
  (vue.openBlock(), vue.createBlock(vue.Teleport, {
1705
1705
  to: "body",
1706
1706
  disabled: !isFullscreen.value
@@ -1714,7 +1714,7 @@
1714
1714
  key: 0,
1715
1715
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1716
1716
  innerHTML: _ctx.config.extra
1717
- }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1717
+ }, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true),
1718
1718
  vue.createVNode(vue.unref(design.TMagicTooltip), {
1719
1719
  content: "拖拽可排序",
1720
1720
  placement: "left-start",
@@ -2632,7 +2632,7 @@
2632
2632
  }
2633
2633
  });
2634
2634
 
2635
- const _hoisted_1$8 = { key: 0 };
2635
+ const _hoisted_1$7 = { key: 0 };
2636
2636
  const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
2637
2637
  ...{
2638
2638
  name: "MFormDisplay"
@@ -2656,12 +2656,12 @@
2656
2656
  }
2657
2657
  useAddField(props.prop);
2658
2658
  return (_ctx, _cache) => {
2659
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, vue.toDisplayString(_ctx.model[_ctx.name]), 1)) : vue.createCommentVNode("", true);
2659
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$7, vue.toDisplayString(_ctx.model[_ctx.name]), 1)) : vue.createCommentVNode("", true);
2660
2660
  };
2661
2661
  }
2662
2662
  });
2663
2663
 
2664
- const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
2664
+ const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2665
2665
  const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
2666
2666
  ...{
2667
2667
  name: "MFormDynamicField"
@@ -2728,7 +2728,7 @@
2728
2728
  emit("change", fieldMap.value[key], key);
2729
2729
  };
2730
2730
  return (_ctx, _cache) => {
2731
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
2731
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
2732
2732
  vue.createVNode(vue.unref(design.TMagicForm), { size: "small" }, {
2733
2733
  default: vue.withCtx(() => [
2734
2734
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Object.keys(fieldMap.value), (key) => {
@@ -2947,7 +2947,7 @@
2947
2947
  }
2948
2948
  });
2949
2949
 
2950
- const _hoisted_1$6 = { style: { "min-height": "1px" } };
2950
+ const _hoisted_1$5 = { style: { "min-height": "1px" } };
2951
2951
  const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
2952
2952
  ...{
2953
2953
  name: "MFormDialog"
@@ -3056,7 +3056,7 @@
3056
3056
  style: { "text-align": "left" }
3057
3057
  }, {
3058
3058
  default: vue.withCtx(() => [
3059
- vue.createElementVNode("div", _hoisted_1$6, [
3059
+ vue.createElementVNode("div", _hoisted_1$5, [
3060
3060
  vue.renderSlot(_ctx.$slots, "left")
3061
3061
  ])
3062
3062
  ]),
@@ -3146,8 +3146,8 @@
3146
3146
  }
3147
3147
  });
3148
3148
 
3149
- const _hoisted_1$5 = ["href"];
3150
- const _hoisted_2$3 = {
3149
+ const _hoisted_1$4 = ["href"];
3150
+ const _hoisted_2$2 = {
3151
3151
  key: 2,
3152
3152
  class: "m-fields-link"
3153
3153
  };
@@ -3220,10 +3220,10 @@
3220
3220
  target: "_blank",
3221
3221
  href: href.value,
3222
3222
  style: vue.normalizeStyle(_ctx.config.css || {})
3223
- }, vue.toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
3223
+ }, vue.toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
3224
3224
  key: 1,
3225
3225
  style: vue.normalizeStyle(_ctx.config.disabledCss || {})
3226
- }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
3226
+ }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
3227
3227
  vue.createVNode(vue.unref(design.TMagicButton), {
3228
3228
  link: "",
3229
3229
  type: "primary",
@@ -3299,8 +3299,8 @@
3299
3299
  }
3300
3300
  });
3301
3301
 
3302
- const _hoisted_1$4 = { class: "m-fields-number-range" };
3303
- const _hoisted_2$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3302
+ const _hoisted_1$3 = { class: "m-fields-number-range" };
3303
+ const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3304
3304
  const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
3305
3305
  ...{
3306
3306
  name: "MFormNumberRange"
@@ -3332,7 +3332,7 @@
3332
3332
  emit("change", [props.model[props.name][0], Number(v)]);
3333
3333
  };
3334
3334
  return (_ctx, _cache) => {
3335
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
3335
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
3336
3336
  vue.createVNode(vue.unref(design.TMagicInput), {
3337
3337
  modelValue: _ctx.model[_ctx.name][0],
3338
3338
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
@@ -3341,7 +3341,7 @@
3341
3341
  disabled: _ctx.disabled,
3342
3342
  onChange: minChangeHandler
3343
3343
  }, null, 8, ["modelValue", "size", "disabled"]),
3344
- _hoisted_2$2,
3344
+ _hoisted_2$1,
3345
3345
  vue.createVNode(vue.unref(design.TMagicInput), {
3346
3346
  modelValue: _ctx.model[_ctx.name][1],
3347
3347
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3464,7 +3464,7 @@
3464
3464
  }
3465
3465
  });
3466
3466
 
3467
- const _hoisted_1$3 = { key: 2 };
3467
+ const _hoisted_1$2 = { key: 2 };
3468
3468
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
3469
3469
  ...{
3470
3470
  name: "MFormSelect"
@@ -3813,7 +3813,7 @@
3813
3813
  key: 1,
3814
3814
  options: vue.unref(itemOptions)
3815
3815
  }, null, 8, ["options"])),
3816
- moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, null, 512)), [
3816
+ moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, null, 512)), [
3817
3817
  [_directive_loading, true]
3818
3818
  ]) : vue.createCommentVNode("", true)
3819
3819
  ]),
@@ -3883,8 +3883,8 @@
3883
3883
  }
3884
3884
  });
3885
3885
 
3886
- const _hoisted_1$2 = { class: "m-form-item__content" };
3887
- const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3886
+ const _hoisted_1$1 = { class: "m-form-item__content" };
3887
+ const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3888
3888
  const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3889
3889
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
3890
3890
  ...{
@@ -4040,8 +4040,8 @@
4040
4040
  ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4041
4041
  ]),
4042
4042
  default: vue.withCtx(() => [
4043
- vue.createElementVNode("div", _hoisted_1$2, [
4044
- _hoisted_2$1,
4043
+ vue.createElementVNode("div", _hoisted_1$1, [
4044
+ _hoisted_2,
4045
4045
  vue.createElementVNode("div", _hoisted_3, [
4046
4046
  vue.createVNode(vue.unref(design.TMagicButton), {
4047
4047
  link: "",
@@ -4235,7 +4235,7 @@
4235
4235
  }
4236
4236
  });
4237
4237
 
4238
- const _hoisted_1$1 = { style: { "min-height": "1px" } };
4238
+ const _hoisted_1 = { style: { "min-height": "1px" } };
4239
4239
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
4240
4240
  ...{
4241
4241
  name: "MFormDialog"
@@ -4339,7 +4339,7 @@
4339
4339
  style: { "text-align": "left" }
4340
4340
  }, {
4341
4341
  default: vue.withCtx(() => [
4342
- vue.createElementVNode("div", _hoisted_1$1, [
4342
+ vue.createElementVNode("div", _hoisted_1, [
4343
4343
  vue.renderSlot(_ctx.$slots, "left")
4344
4344
  ])
4345
4345
  ]),
@@ -4402,11 +4402,10 @@
4402
4402
  }
4403
4403
  });
4404
4404
 
4405
- const _hoisted_1 = { class: "m-form-box" };
4406
- const _hoisted_2 = { style: { "min-height": "1px" } };
4405
+ const footerHeight = 60;
4407
4406
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4408
4407
  ...{
4409
- name: "MFormDialog"
4408
+ name: "MFormBox"
4410
4409
  },
4411
4410
  __name: "FormBox",
4412
4411
  props: {
@@ -4414,6 +4413,7 @@
4414
4413
  values: { default: () => ({}) },
4415
4414
  parentValues: {},
4416
4415
  width: {},
4416
+ height: {},
4417
4417
  labelWidth: {},
4418
4418
  disabled: { type: Boolean },
4419
4419
  size: {},
@@ -4423,15 +4423,26 @@
4423
4423
  },
4424
4424
  emits: ["submit", "change", "error"],
4425
4425
  setup(__props, { expose: __expose, emit: __emit }) {
4426
+ const props = __props;
4426
4427
  const emit = __emit;
4428
+ const style = vue.computed(() => {
4429
+ const style2 = {};
4430
+ if (typeof props.width === "number") {
4431
+ style2.width = `${props.width}px`;
4432
+ }
4433
+ if (typeof props.height === "number") {
4434
+ style2.height = `${props.height}px`;
4435
+ }
4436
+ return style2;
4437
+ });
4427
4438
  const form = vue.ref();
4428
- const boxBody = vue.ref();
4429
4439
  const saveFetch = vue.ref(false);
4430
4440
  const bodyHeight = vue.ref(0);
4431
4441
  vue.watchEffect(() => {
4432
- if (boxBody.value) {
4433
- bodyHeight.value = boxBody.value.clientHeight;
4442
+ if (!props.height) {
4443
+ return;
4434
4444
  }
4445
+ bodyHeight.value = props.height - footerHeight;
4435
4446
  });
4436
4447
  const submitHandler = async () => {
4437
4448
  try {
@@ -4451,67 +4462,63 @@
4451
4462
  __expose({
4452
4463
  form,
4453
4464
  saveFetch,
4454
- bodyHeight,
4455
4465
  show,
4456
4466
  hide
4457
4467
  });
4458
4468
  return (_ctx, _cache) => {
4459
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
4469
+ return vue.openBlock(), vue.createElementBlock("div", {
4470
+ class: "m-form-box",
4471
+ style: vue.normalizeStyle(style.value)
4472
+ }, [
4460
4473
  vue.createElementVNode("div", {
4461
- ref_key: "boxBody",
4462
- ref: boxBody,
4463
- class: "m-box-body"
4474
+ class: "m-box-body",
4475
+ style: vue.normalizeStyle(bodyHeight.value ? { height: `${bodyHeight.value}px` } : {})
4464
4476
  }, [
4465
- vue.createVNode(_sfc_main$f, {
4466
- ref_key: "form",
4467
- ref: form,
4468
- size: _ctx.size,
4469
- disabled: _ctx.disabled,
4470
- config: _ctx.config,
4471
- "init-values": _ctx.values,
4472
- "parent-values": _ctx.parentValues,
4473
- "label-width": _ctx.labelWidth,
4474
- "label-position": _ctx.labelPosition,
4475
- inline: _ctx.inline,
4476
- onChange: changeHandler
4477
- }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4478
- vue.renderSlot(_ctx.$slots, "default")
4479
- ], 512),
4480
- vue.createVNode(vue.unref(design.TMagicRow), { class: "dialog-footer" }, {
4481
- default: vue.withCtx(() => [
4482
- vue.createVNode(vue.unref(design.TMagicCol), {
4483
- span: 12,
4484
- style: { "text-align": "left" }
4485
- }, {
4486
- default: vue.withCtx(() => [
4487
- vue.createElementVNode("div", _hoisted_2, [
4488
- vue.renderSlot(_ctx.$slots, "left")
4489
- ])
4490
- ]),
4491
- _: 3
4492
- }),
4493
- vue.createVNode(vue.unref(design.TMagicCol), { span: 12 }, {
4494
- default: vue.withCtx(() => [
4495
- vue.renderSlot(_ctx.$slots, "footer", {}, () => [
4496
- vue.createVNode(vue.unref(design.TMagicButton), {
4497
- type: "primary",
4498
- disabled: _ctx.disabled,
4499
- loading: saveFetch.value,
4500
- onClick: submitHandler
4501
- }, {
4502
- default: vue.withCtx(() => [
4503
- vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
4504
- ]),
4505
- _: 1
4506
- }, 8, ["disabled", "loading"])
4507
- ])
4508
- ]),
4509
- _: 3
4510
- })
4477
+ vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
4478
+ default: vue.withCtx(() => [
4479
+ vue.createVNode(_sfc_main$f, {
4480
+ ref_key: "form",
4481
+ ref: form,
4482
+ size: _ctx.size,
4483
+ disabled: _ctx.disabled,
4484
+ config: _ctx.config,
4485
+ "init-values": _ctx.values,
4486
+ "parent-values": _ctx.parentValues,
4487
+ "label-width": _ctx.labelWidth,
4488
+ "label-position": _ctx.labelPosition,
4489
+ inline: _ctx.inline,
4490
+ onChange: changeHandler
4491
+ }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4492
+ vue.renderSlot(_ctx.$slots, "default")
4493
+ ]),
4494
+ _: 3
4495
+ })
4496
+ ], 4),
4497
+ vue.createElementVNode("div", {
4498
+ class: "dialog-footer",
4499
+ style: vue.normalizeStyle(`height: ${footerHeight}px`)
4500
+ }, [
4501
+ vue.createElementVNode("div", null, [
4502
+ vue.renderSlot(_ctx.$slots, "left")
4511
4503
  ]),
4512
- _: 3
4513
- })
4514
- ]);
4504
+ vue.createElementVNode("div", null, [
4505
+ vue.renderSlot(_ctx.$slots, "footer", {}, () => [
4506
+ vue.createVNode(vue.unref(design.TMagicButton), {
4507
+ type: "primary",
4508
+ size: _ctx.size,
4509
+ disabled: _ctx.disabled,
4510
+ loading: saveFetch.value,
4511
+ onClick: submitHandler
4512
+ }, {
4513
+ default: vue.withCtx(() => [
4514
+ vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
4515
+ ]),
4516
+ _: 1
4517
+ }, 8, ["size", "disabled", "loading"])
4518
+ ])
4519
+ ])
4520
+ ], 4)
4521
+ ], 4);
4515
4522
  };
4516
4523
  }
4517
4524
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.0-beta.1",
2
+ "version": "1.4.0-beta.2",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@element-plus/icons-vue": "^2.3.1",
35
- "@tmagic/design": "1.4.0-beta.1",
36
- "@tmagic/utils": "1.4.0-beta.1",
35
+ "@tmagic/design": "1.4.0-beta.2",
36
+ "@tmagic/utils": "1.4.0-beta.2",
37
37
  "lodash-es": "^4.17.21",
38
38
  "sortablejs": "^1.14.0",
39
39
  "vue": "^3.4.21"
package/src/FormBox.vue CHANGED
@@ -1,56 +1,57 @@
1
1
  <template>
2
- <div class="m-form-box">
3
- <div ref="boxBody" class="m-box-body">
4
- <Form
5
- ref="form"
6
- :size="size"
7
- :disabled="disabled"
8
- :config="config"
9
- :init-values="values"
10
- :parent-values="parentValues"
11
- :label-width="labelWidth"
12
- :label-position="labelPosition"
13
- :inline="inline"
14
- @change="changeHandler"
15
- ></Form>
16
- <slot></slot>
2
+ <div class="m-form-box" :style="style">
3
+ <div class="m-box-body" :style="bodyHeight ? { height: `${bodyHeight}px` } : {}">
4
+ <TMagicScrollbar>
5
+ <Form
6
+ ref="form"
7
+ :size="size"
8
+ :disabled="disabled"
9
+ :config="config"
10
+ :init-values="values"
11
+ :parent-values="parentValues"
12
+ :label-width="labelWidth"
13
+ :label-position="labelPosition"
14
+ :inline="inline"
15
+ @change="changeHandler"
16
+ ></Form>
17
+ <slot></slot>
18
+ </TMagicScrollbar>
17
19
  </div>
18
20
 
19
- <TMagicRow class="dialog-footer">
20
- <TMagicCol :span="12" style="text-align: left">
21
- <div style="min-height: 1px">
22
- <slot name="left"></slot>
23
- </div>
24
- </TMagicCol>
25
- <TMagicCol :span="12">
21
+ <div class="dialog-footer" :style="`height: ${footerHeight}px`">
22
+ <div>
23
+ <slot name="left"></slot>
24
+ </div>
25
+ <div>
26
26
  <slot name="footer">
27
- <TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
27
+ <TMagicButton type="primary" :size="size" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
28
28
  confirmText
29
29
  }}</TMagicButton>
30
30
  </slot>
31
- </TMagicCol>
32
- </TMagicRow>
31
+ </div>
32
+ </div>
33
33
  </div>
34
34
  </template>
35
35
 
36
36
  <script setup lang="ts">
37
- import { ref, watchEffect } from 'vue';
37
+ import { computed, ref, watchEffect } from 'vue';
38
38
 
39
- import { TMagicButton, TMagicCol, TMagicRow } from '@tmagic/design';
39
+ import { TMagicButton, TMagicScrollbar } from '@tmagic/design';
40
40
 
41
41
  import Form from './Form.vue';
42
42
  import type { FormConfig } from './schema';
43
43
 
44
44
  defineOptions({
45
- name: 'MFormDialog',
45
+ name: 'MFormBox',
46
46
  });
47
47
 
48
- withDefaults(
48
+ const props = withDefaults(
49
49
  defineProps<{
50
50
  config?: FormConfig;
51
51
  values?: Object;
52
52
  parentValues?: Object;
53
- width?: string | number;
53
+ width?: number;
54
+ height?: number;
54
55
  labelWidth?: string;
55
56
  disabled?: boolean;
56
57
  size?: 'small' | 'default' | 'large';
@@ -67,15 +68,29 @@ withDefaults(
67
68
 
68
69
  const emit = defineEmits(['submit', 'change', 'error']);
69
70
 
71
+ const footerHeight = 60;
72
+
73
+ const style = computed(() => {
74
+ const style: { width?: string; height?: string } = {};
75
+ if (typeof props.width === 'number') {
76
+ style.width = `${props.width}px`;
77
+ }
78
+ if (typeof props.height === 'number') {
79
+ style.height = `${props.height}px`;
80
+ }
81
+ return style;
82
+ });
83
+
70
84
  const form = ref<InstanceType<typeof Form>>();
71
- const boxBody = ref<HTMLDivElement>();
72
85
  const saveFetch = ref(false);
86
+
73
87
  const bodyHeight = ref(0);
74
88
 
75
89
  watchEffect(() => {
76
- if (boxBody.value) {
77
- bodyHeight.value = boxBody.value.clientHeight;
90
+ if (!props.height) {
91
+ return;
78
92
  }
93
+ bodyHeight.value = props.height - footerHeight;
79
94
  });
80
95
 
81
96
  const submitHandler = async () => {
@@ -98,7 +113,6 @@ const hide = () => {};
98
113
  defineExpose({
99
114
  form,
100
115
  saveFetch,
101
- bodyHeight,
102
116
 
103
117
  show,
104
118
  hide,
@@ -8,8 +8,8 @@
8
8
  <TMagicCheckbox
9
9
  v-model="model[name].value"
10
10
  :prop="`${prop}${prop ? '.' : ''}${config.name}.value`"
11
- :true-label="1"
12
- :false-label="0"
11
+ :true-value="1"
12
+ :false-value="0"
13
13
  @update:modelValue="change"
14
14
  ><span v-html="config.legend"></span><span v-if="config.extra" v-html="config.extra" class="m-form-tip"></span
15
15
  ></TMagicCheckbox>
@@ -1,18 +1,13 @@
1
1
  .m-form-box {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- padding: 16px;
5
- box-sizing: border-box;
6
4
  .el-box__header {
7
5
  margin: 0;
8
6
  }
9
7
 
10
- .m-box-body {
11
- flex: 1;
12
- overflow-y: auto;
13
- overflow-x: hidden;
14
- }
15
8
  .dialog-footer {
16
- margin-top: 16px;
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
17
12
  }
18
13
  }
@@ -3,7 +3,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
3
3
  config?: FormConfig | undefined;
4
4
  values?: Object | undefined;
5
5
  parentValues?: Object | undefined;
6
- width?: string | number | undefined;
6
+ width?: number | undefined;
7
+ height?: number | undefined;
7
8
  labelWidth?: string | undefined;
8
9
  disabled?: boolean | undefined;
9
10
  size?: "large" | "default" | "small" | undefined;
@@ -266,7 +267,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
266
267
  labelPosition: string;
267
268
  }> | undefined>;
268
269
  saveFetch: import("vue").Ref<boolean>;
269
- bodyHeight: import("vue").Ref<number>;
270
270
  show: () => void;
271
271
  hide: () => void;
272
272
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -277,7 +277,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
277
277
  config?: FormConfig | undefined;
278
278
  values?: Object | undefined;
279
279
  parentValues?: Object | undefined;
280
- width?: string | number | undefined;
280
+ width?: number | undefined;
281
+ height?: number | undefined;
281
282
  labelWidth?: string | undefined;
282
283
  disabled?: boolean | undefined;
283
284
  size?: "large" | "default" | "small" | undefined;