@tmagic/form 1.3.16 → 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.
Files changed (50) hide show
  1. package/dist/style.css +3 -8
  2. package/dist/tmagic-form.js +132 -123
  3. package/dist/tmagic-form.umd.cjs +131 -122
  4. package/package.json +12 -11
  5. package/src/FormBox.vue +48 -34
  6. package/src/containers/Container.vue +3 -3
  7. package/src/containers/Fieldset.vue +2 -2
  8. package/src/fields/Cascader.vue +1 -0
  9. package/src/fields/Checkbox.vue +2 -2
  10. package/src/fields/CheckboxGroup.vue +1 -6
  11. package/src/fields/RadioGroup.vue +3 -7
  12. package/src/schema.ts +6 -2
  13. package/src/theme/form-box.scss +3 -8
  14. package/types/Form.vue.d.ts +12 -12
  15. package/types/FormBox.vue.d.ts +195 -244
  16. package/types/FormDialog.vue.d.ts +191 -241
  17. package/types/FormDrawer.vue.d.ts +192 -242
  18. package/types/containers/Col.vue.d.ts +3 -3
  19. package/types/containers/Container.vue.d.ts +12 -12
  20. package/types/containers/Fieldset.vue.d.ts +11 -11
  21. package/types/containers/GroupList.vue.d.ts +3 -3
  22. package/types/containers/GroupListItem.vue.d.ts +3 -3
  23. package/types/containers/Panel.vue.d.ts +8 -8
  24. package/types/containers/Row.vue.d.ts +3 -3
  25. package/types/containers/Step.vue.d.ts +11 -11
  26. package/types/containers/Table.vue.d.ts +11 -11
  27. package/types/containers/Tabs.vue.d.ts +11 -11
  28. package/types/fields/Cascader.vue.d.ts +3 -3
  29. package/types/fields/Checkbox.vue.d.ts +3 -3
  30. package/types/fields/CheckboxGroup.vue.d.ts +3 -3
  31. package/types/fields/ColorPicker.vue.d.ts +3 -3
  32. package/types/fields/Date.vue.d.ts +3 -3
  33. package/types/fields/DateTime.vue.d.ts +3 -3
  34. package/types/fields/Daterange.vue.d.ts +3 -3
  35. package/types/fields/Display.vue.d.ts +2 -2
  36. package/types/fields/DynamicField.vue.d.ts +3 -3
  37. package/types/fields/Hidden.vue.d.ts +2 -2
  38. package/types/fields/Link.vue.d.ts +3 -3
  39. package/types/fields/Number.vue.d.ts +3 -3
  40. package/types/fields/NumberRange.vue.d.ts +3 -3
  41. package/types/fields/RadioGroup.vue.d.ts +3 -3
  42. package/types/fields/Select.vue.d.ts +3 -3
  43. package/types/fields/SelectOptionGroups.vue.d.ts +3 -3
  44. package/types/fields/SelectOptions.vue.d.ts +3 -3
  45. package/types/fields/Switch.vue.d.ts +3 -3
  46. package/types/fields/Text.vue.d.ts +3 -3
  47. package/types/fields/Textarea.vue.d.ts +3 -3
  48. package/types/fields/Time.vue.d.ts +3 -3
  49. package/types/fields/Timerange.vue.d.ts +3 -3
  50. package/types/schema.d.ts +6 -2
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
- width: 100%;
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,16 +166,16 @@ 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"];
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"];
174
- const _hoisted_6$2 = ["innerHTML"];
174
+ const _hoisted_6$2 = ["innerHTML", "title"];
175
175
  const _hoisted_7$1 = ["innerHTML"];
176
176
  const _hoisted_8$1 = ["innerHTML"];
177
177
  const _hoisted_9 = ["innerHTML"];
178
- const _hoisted_10 = ["innerHTML"];
178
+ const _hoisted_10 = ["innerHTML", "title"];
179
179
  const _hoisted_11 = ["innerHTML"];
180
180
  const _hoisted_12 = ["innerHTML"];
181
181
  const _hoisted_13 = ["innerHTML"];
@@ -371,8 +371,9 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
371
371
  }, {
372
372
  label: withCtx(() => [
373
373
  createElementVNode("span", {
374
- innerHTML: type.value === "checkbox" ? "" : text.value
375
- }, null, 8, _hoisted_2$9)
374
+ innerHTML: type.value === "checkbox" ? "" : text.value,
375
+ title: _ctx.config.labelTitle
376
+ }, null, 8, _hoisted_2$8)
376
377
  ]),
377
378
  default: withCtx(() => [
378
379
  tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
@@ -443,7 +444,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
443
444
  }, {
444
445
  label: withCtx(() => [
445
446
  createElementVNode("span", {
446
- innerHTML: type.value === "checkbox" ? "" : text.value
447
+ innerHTML: type.value === "checkbox" ? "" : text.value,
448
+ title: _ctx.config.labelTitle
447
449
  }, null, 8, _hoisted_6$2)
448
450
  ]),
449
451
  default: withCtx(() => [
@@ -510,7 +512,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
510
512
  }, {
511
513
  label: withCtx(() => [
512
514
  createElementVNode("span", {
513
- innerHTML: type.value === "checkbox" ? "" : text.value
515
+ innerHTML: type.value === "checkbox" ? "" : text.value,
516
+ title: _ctx.config.labelTitle
514
517
  }, null, 8, _hoisted_10)
515
518
  ]),
516
519
  default: withCtx(() => [
@@ -601,13 +604,13 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
601
604
  _: 1
602
605
  })
603
606
  ])) : createCommentVNode("", true)
604
- ], 14, _hoisted_1$e)) : createCommentVNode("", true);
607
+ ], 14, _hoisted_1$d)) : createCommentVNode("", true);
605
608
  };
606
609
  }
607
610
  });
608
611
 
609
- const _hoisted_1$d = ["innerHTML"];
610
- const _hoisted_2$8 = ["innerHTML"];
612
+ const _hoisted_1$c = ["innerHTML"];
613
+ const _hoisted_2$7 = ["innerHTML"];
611
614
  const _hoisted_3$4 = { key: 1 };
612
615
  const _hoisted_4$3 = ["innerHTML"];
613
616
  const _hoisted_5$3 = ["innerHTML"];
@@ -671,18 +674,18 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
671
674
  change
672
675
  ],
673
676
  prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
674
- "true-label": 1,
675
- "false-label": 0
677
+ "true-value": 1,
678
+ "false-value": 0
676
679
  }, {
677
680
  default: withCtx(() => [
678
681
  createElementVNode("span", {
679
682
  innerHTML: _ctx.config.legend
680
- }, null, 8, _hoisted_1$d),
683
+ }, null, 8, _hoisted_1$c),
681
684
  _ctx.config.extra ? (openBlock(), createElementBlock("span", {
682
685
  key: 0,
683
686
  innerHTML: _ctx.config.extra,
684
687
  class: "m-form-tip"
685
- }, null, 8, _hoisted_2$8)) : createCommentVNode("", true)
688
+ }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
686
689
  ]),
687
690
  _: 1
688
691
  }, 8, ["modelValue", "prop"])
@@ -742,8 +745,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
742
745
  }
743
746
  });
744
747
 
745
- const _hoisted_1$c = { class: "m-fields-group-list-item" };
746
- const _hoisted_2$7 = ["innerHTML"];
748
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
749
+ const _hoisted_2$6 = ["innerHTML"];
747
750
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
748
751
  ...{
749
752
  name: "MFormGroupListItem"
@@ -810,7 +813,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
810
813
  };
811
814
  const onAddDiffCount = () => emit("addDiffCount");
812
815
  return (_ctx, _cache) => {
813
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
816
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
814
817
  createElementVNode("div", null, [
815
818
  createVNode(unref(TMagicButton), {
816
819
  link: "",
@@ -876,7 +879,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
876
879
  key: 1,
877
880
  innerHTML: itemExtra.value,
878
881
  class: "m-form-tip"
879
- }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
882
+ }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
880
883
  ]),
881
884
  expand.value ? (openBlock(), createBlock(_sfc_main$z, {
882
885
  key: 0,
@@ -896,8 +899,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
896
899
  }
897
900
  });
898
901
 
899
- const _hoisted_1$b = { class: "m-fields-group-list" };
900
- const _hoisted_2$6 = ["innerHTML"];
902
+ const _hoisted_1$a = { class: "m-fields-group-list" };
903
+ const _hoisted_2$5 = ["innerHTML"];
901
904
  const _hoisted_3$3 = {
902
905
  key: 1,
903
906
  class: "el-table__empty-block"
@@ -990,12 +993,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
990
993
  const onAddDiffCount = () => emit("addDiffCount");
991
994
  const getLastValues = (item, index) => item?.[index] || {};
992
995
  return (_ctx, _cache) => {
993
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
996
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
994
997
  _ctx.config.extra ? (openBlock(), createElementBlock("div", {
995
998
  key: 0,
996
999
  innerHTML: _ctx.config.extra,
997
1000
  style: { "color": "rgba(0, 0, 0, 0.45)" }
998
- }, null, 8, _hoisted_2$6)) : createCommentVNode("", true),
1001
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
999
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) => {
1000
1003
  return openBlock(), createBlock(_sfc_main$x, {
1001
1004
  key: index,
@@ -1042,8 +1045,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1042
1045
  }
1043
1046
  });
1044
1047
 
1045
- const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1046
- const _hoisted_2$5 = ["innerHTML"];
1048
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1049
+ const _hoisted_2$4 = ["innerHTML"];
1047
1050
  const _hoisted_3$2 = {
1048
1051
  key: 0,
1049
1052
  style: { "display": "flex" }
@@ -1083,7 +1086,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1083
1086
  "body-style": { display: expand.value ? "block" : "none" }
1084
1087
  }, {
1085
1088
  header: withCtx(() => [
1086
- createElementVNode("div", _hoisted_1$a, [
1089
+ createElementVNode("div", _hoisted_1$9, [
1087
1090
  createVNode(unref(TMagicButton), {
1088
1091
  style: { "padding": "0" },
1089
1092
  link: "",
@@ -1094,7 +1097,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1094
1097
  key: 0,
1095
1098
  innerHTML: _ctx.config.extra,
1096
1099
  class: "m-form-tip"
1097
- }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
1100
+ }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1098
1101
  renderSlot(_ctx.$slots, "header", {}, () => [
1099
1102
  createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
1100
1103
  ])
@@ -1328,8 +1331,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1328
1331
  }
1329
1332
  });
1330
1333
 
1331
- const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1332
- const _hoisted_2$4 = ["innerHTML"];
1334
+ const _hoisted_1$8 = { class: "m-fields-table-wrap" };
1335
+ const _hoisted_2$3 = ["innerHTML"];
1333
1336
  const _hoisted_3$1 = ["innerHTML"];
1334
1337
  const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1335
1338
  const _hoisted_5 = { style: { "display": "flex" } };
@@ -1698,7 +1701,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1698
1701
  toggleRowSelection
1699
1702
  });
1700
1703
  return (_ctx, _cache) => {
1701
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
1704
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1702
1705
  (openBlock(), createBlock(Teleport, {
1703
1706
  to: "body",
1704
1707
  disabled: !isFullscreen.value
@@ -1712,7 +1715,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1712
1715
  key: 0,
1713
1716
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1714
1717
  innerHTML: _ctx.config.extra
1715
- }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1718
+ }, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
1716
1719
  createVNode(unref(TMagicTooltip), {
1717
1720
  content: "拖拽可排序",
1718
1721
  placement: "left-start",
@@ -2263,13 +2266,14 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2263
2266
  placeholder: _ctx.config.placeholder,
2264
2267
  disabled: _ctx.disabled,
2265
2268
  options: options.value,
2269
+ "popper-class": _ctx.config.popperClass,
2266
2270
  props: {
2267
2271
  multiple: _ctx.config.multiple ?? false,
2268
2272
  emitPath: _ctx.config.emitPath ?? true,
2269
2273
  checkStrictly: _ctx.config.checkStrictly ?? false
2270
2274
  },
2271
2275
  onChange: changeHandler
2272
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "props"]);
2276
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
2273
2277
  };
2274
2278
  }
2275
2279
  });
@@ -2323,8 +2327,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2323
2327
  modelValue: _ctx.model[_ctx.name],
2324
2328
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2325
2329
  size: _ctx.size,
2326
- trueLabel: activeValue.value,
2327
- falseLabel: inactiveValue.value,
2330
+ trueValue: activeValue.value,
2331
+ falseValue: inactiveValue.value,
2328
2332
  disabled: _ctx.disabled,
2329
2333
  onChange: changeHandler
2330
2334
  }, {
@@ -2332,7 +2336,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2332
2336
  createTextVNode(toDisplayString(_ctx.config.text), 1)
2333
2337
  ]),
2334
2338
  _: 1
2335
- }, 8, ["modelValue", "size", "trueLabel", "falseLabel", "disabled"]);
2339
+ }, 8, ["modelValue", "size", "trueValue", "falseValue", "disabled"]);
2336
2340
  };
2337
2341
  }
2338
2342
  });
@@ -2383,7 +2387,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2383
2387
  default: withCtx(() => [
2384
2388
  (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
2385
2389
  return openBlock(), createBlock(unref(TMagicCheckbox), {
2386
- label: option.value,
2387
2390
  value: option.value,
2388
2391
  key: option.value,
2389
2392
  disabled: option.disabled
@@ -2392,7 +2395,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2392
2395
  createTextVNode(toDisplayString(option.text), 1)
2393
2396
  ]),
2394
2397
  _: 2
2395
- }, 1032, ["label", "value", "disabled"]);
2398
+ }, 1032, ["value", "disabled"]);
2396
2399
  }), 128))
2397
2400
  ]),
2398
2401
  _: 1
@@ -2630,7 +2633,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2630
2633
  }
2631
2634
  });
2632
2635
 
2633
- const _hoisted_1$8 = { key: 0 };
2636
+ const _hoisted_1$7 = { key: 0 };
2634
2637
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
2635
2638
  ...{
2636
2639
  name: "MFormDisplay"
@@ -2654,12 +2657,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2654
2657
  }
2655
2658
  useAddField(props.prop);
2656
2659
  return (_ctx, _cache) => {
2657
- 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);
2658
2661
  };
2659
2662
  }
2660
2663
  });
2661
2664
 
2662
- const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
2665
+ const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2663
2666
  const _sfc_main$h = /* @__PURE__ */ defineComponent({
2664
2667
  ...{
2665
2668
  name: "MFormDynamicField"
@@ -2726,7 +2729,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2726
2729
  emit("change", fieldMap.value[key], key);
2727
2730
  };
2728
2731
  return (_ctx, _cache) => {
2729
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
2732
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
2730
2733
  createVNode(unref(TMagicForm), { size: "small" }, {
2731
2734
  default: withCtx(() => [
2732
2735
  (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
@@ -2945,7 +2948,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2945
2948
  }
2946
2949
  });
2947
2950
 
2948
- const _hoisted_1$6 = { style: { "min-height": "1px" } };
2951
+ const _hoisted_1$5 = { style: { "min-height": "1px" } };
2949
2952
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
2950
2953
  ...{
2951
2954
  name: "MFormDialog"
@@ -3054,7 +3057,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3054
3057
  style: { "text-align": "left" }
3055
3058
  }, {
3056
3059
  default: withCtx(() => [
3057
- createElementVNode("div", _hoisted_1$6, [
3060
+ createElementVNode("div", _hoisted_1$5, [
3058
3061
  renderSlot(_ctx.$slots, "left")
3059
3062
  ])
3060
3063
  ]),
@@ -3144,8 +3147,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3144
3147
  }
3145
3148
  });
3146
3149
 
3147
- const _hoisted_1$5 = ["href"];
3148
- const _hoisted_2$3 = {
3150
+ const _hoisted_1$4 = ["href"];
3151
+ const _hoisted_2$2 = {
3149
3152
  key: 2,
3150
3153
  class: "m-fields-link"
3151
3154
  };
@@ -3218,10 +3221,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3218
3221
  target: "_blank",
3219
3222
  href: href.value,
3220
3223
  style: normalizeStyle(_ctx.config.css || {})
3221
- }, 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", {
3222
3225
  key: 1,
3223
3226
  style: normalizeStyle(_ctx.config.disabledCss || {})
3224
- }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
3227
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
3225
3228
  createVNode(unref(TMagicButton), {
3226
3229
  link: "",
3227
3230
  type: "primary",
@@ -3297,8 +3300,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3297
3300
  }
3298
3301
  });
3299
3302
 
3300
- const _hoisted_1$4 = { class: "m-fields-number-range" };
3301
- 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);
3302
3305
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
3303
3306
  ...{
3304
3307
  name: "MFormNumberRange"
@@ -3330,7 +3333,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3330
3333
  emit("change", [props.model[props.name][0], Number(v)]);
3331
3334
  };
3332
3335
  return (_ctx, _cache) => {
3333
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
3336
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
3334
3337
  createVNode(unref(TMagicInput), {
3335
3338
  modelValue: _ctx.model[_ctx.name][0],
3336
3339
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
@@ -3339,7 +3342,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3339
3342
  disabled: _ctx.disabled,
3340
3343
  onChange: minChangeHandler
3341
3344
  }, null, 8, ["modelValue", "size", "disabled"]),
3342
- _hoisted_2$2,
3345
+ _hoisted_2$1,
3343
3346
  createVNode(unref(TMagicInput), {
3344
3347
  modelValue: _ctx.model[_ctx.name][1],
3345
3348
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3389,7 +3392,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3389
3392
  default: withCtx(() => [
3390
3393
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.options, (option) => {
3391
3394
  return openBlock(), createBlock(unref(TMagicRadio), {
3392
- label: option.value,
3393
3395
  value: option.value,
3394
3396
  key: `${option.value}`
3395
3397
  }, {
@@ -3397,7 +3399,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3397
3399
  createTextVNode(toDisplayString(option.text), 1)
3398
3400
  ]),
3399
3401
  _: 2
3400
- }, 1032, ["label", "value"]);
3402
+ }, 1032, ["value"]);
3401
3403
  }), 128))
3402
3404
  ]),
3403
3405
  _: 1
@@ -3463,7 +3465,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3463
3465
  }
3464
3466
  });
3465
3467
 
3466
- const _hoisted_1$3 = { key: 2 };
3468
+ const _hoisted_1$2 = { key: 2 };
3467
3469
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3468
3470
  ...{
3469
3471
  name: "MFormSelect"
@@ -3812,7 +3814,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3812
3814
  key: 1,
3813
3815
  options: unref(itemOptions)
3814
3816
  }, null, 8, ["options"])),
3815
- moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$3, null, 512)), [
3817
+ moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
3816
3818
  [_directive_loading, true]
3817
3819
  ]) : createCommentVNode("", true)
3818
3820
  ]),
@@ -3882,8 +3884,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3882
3884
  }
3883
3885
  });
3884
3886
 
3885
- const _hoisted_1$2 = { class: "m-form-item__content" };
3886
- 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);
3887
3889
  const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3888
3890
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3889
3891
  ...{
@@ -4032,15 +4034,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4032
4034
  createTextVNode(toDisplayString(appendConfig.value.text), 1)
4033
4035
  ]),
4034
4036
  _: 1
4035
- }, 8, ["size", "onClick"])) : createCommentVNode("", true)
4037
+ }, 8, ["size"])) : createCommentVNode("", true)
4036
4038
  ]),
4037
4039
  key: "0"
4038
4040
  } : void 0
4039
4041
  ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4040
4042
  ]),
4041
4043
  default: withCtx(() => [
4042
- createElementVNode("div", _hoisted_1$2, [
4043
- _hoisted_2$1,
4044
+ createElementVNode("div", _hoisted_1$1, [
4045
+ _hoisted_2,
4044
4046
  createElementVNode("div", _hoisted_3, [
4045
4047
  createVNode(unref(TMagicButton), {
4046
4048
  link: "",
@@ -4234,7 +4236,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4234
4236
  }
4235
4237
  });
4236
4238
 
4237
- const _hoisted_1$1 = { style: { "min-height": "1px" } };
4239
+ const _hoisted_1 = { style: { "min-height": "1px" } };
4238
4240
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4239
4241
  ...{
4240
4242
  name: "MFormDialog"
@@ -4338,7 +4340,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4338
4340
  style: { "text-align": "left" }
4339
4341
  }, {
4340
4342
  default: withCtx(() => [
4341
- createElementVNode("div", _hoisted_1$1, [
4343
+ createElementVNode("div", _hoisted_1, [
4342
4344
  renderSlot(_ctx.$slots, "left")
4343
4345
  ])
4344
4346
  ]),
@@ -4401,11 +4403,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4401
4403
  }
4402
4404
  });
4403
4405
 
4404
- const _hoisted_1 = { class: "m-form-box" };
4405
- const _hoisted_2 = { style: { "min-height": "1px" } };
4406
+ const footerHeight = 60;
4406
4407
  const _sfc_main = /* @__PURE__ */ defineComponent({
4407
4408
  ...{
4408
- name: "MFormDialog"
4409
+ name: "MFormBox"
4409
4410
  },
4410
4411
  __name: "FormBox",
4411
4412
  props: {
@@ -4413,6 +4414,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4413
4414
  values: { default: () => ({}) },
4414
4415
  parentValues: {},
4415
4416
  width: {},
4417
+ height: {},
4416
4418
  labelWidth: {},
4417
4419
  disabled: { type: Boolean },
4418
4420
  size: {},
@@ -4422,15 +4424,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4422
4424
  },
4423
4425
  emits: ["submit", "change", "error"],
4424
4426
  setup(__props, { expose: __expose, emit: __emit }) {
4427
+ const props = __props;
4425
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
+ });
4426
4439
  const form = ref();
4427
- const boxBody = ref();
4428
4440
  const saveFetch = ref(false);
4429
4441
  const bodyHeight = ref(0);
4430
4442
  watchEffect(() => {
4431
- if (boxBody.value) {
4432
- bodyHeight.value = boxBody.value.clientHeight;
4443
+ if (!props.height) {
4444
+ return;
4433
4445
  }
4446
+ bodyHeight.value = props.height - footerHeight;
4434
4447
  });
4435
4448
  const submitHandler = async () => {
4436
4449
  try {
@@ -4450,67 +4463,63 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4450
4463
  __expose({
4451
4464
  form,
4452
4465
  saveFetch,
4453
- bodyHeight,
4454
4466
  show,
4455
4467
  hide
4456
4468
  });
4457
4469
  return (_ctx, _cache) => {
4458
- return openBlock(), createElementBlock("div", _hoisted_1, [
4470
+ return openBlock(), createElementBlock("div", {
4471
+ class: "m-form-box",
4472
+ style: normalizeStyle(style.value)
4473
+ }, [
4459
4474
  createElementVNode("div", {
4460
- ref_key: "boxBody",
4461
- ref: boxBody,
4462
- class: "m-box-body"
4475
+ class: "m-box-body",
4476
+ style: normalizeStyle(bodyHeight.value ? { height: `${bodyHeight.value}px` } : {})
4463
4477
  }, [
4464
- createVNode(_sfc_main$f, {
4465
- ref_key: "form",
4466
- ref: form,
4467
- size: _ctx.size,
4468
- disabled: _ctx.disabled,
4469
- config: _ctx.config,
4470
- "init-values": _ctx.values,
4471
- "parent-values": _ctx.parentValues,
4472
- "label-width": _ctx.labelWidth,
4473
- "label-position": _ctx.labelPosition,
4474
- inline: _ctx.inline,
4475
- onChange: changeHandler
4476
- }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4477
- renderSlot(_ctx.$slots, "default")
4478
- ], 512),
4479
- createVNode(unref(TMagicRow), { class: "dialog-footer" }, {
4480
- default: withCtx(() => [
4481
- createVNode(unref(TMagicCol), {
4482
- span: 12,
4483
- style: { "text-align": "left" }
4484
- }, {
4485
- default: withCtx(() => [
4486
- createElementVNode("div", _hoisted_2, [
4487
- renderSlot(_ctx.$slots, "left")
4488
- ])
4489
- ]),
4490
- _: 3
4491
- }),
4492
- createVNode(unref(TMagicCol), { span: 12 }, {
4493
- default: withCtx(() => [
4494
- renderSlot(_ctx.$slots, "footer", {}, () => [
4495
- createVNode(unref(TMagicButton), {
4496
- type: "primary",
4497
- disabled: _ctx.disabled,
4498
- loading: saveFetch.value,
4499
- onClick: submitHandler
4500
- }, {
4501
- default: withCtx(() => [
4502
- createTextVNode(toDisplayString(_ctx.confirmText), 1)
4503
- ]),
4504
- _: 1
4505
- }, 8, ["disabled", "loading"])
4506
- ])
4507
- ]),
4508
- _: 3
4509
- })
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")
4510
4504
  ]),
4511
- _: 3
4512
- })
4513
- ]);
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);
4514
4523
  };
4515
4524
  }
4516
4525
  });