@tmagic/form 1.3.0-alpha.9 → 1.3.0-beta.1

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 (67) hide show
  1. package/dist/style.css +21 -0
  2. package/dist/tmagic-form.js +716 -388
  3. package/dist/tmagic-form.js.map +1 -1
  4. package/dist/tmagic-form.umd.cjs +744 -413
  5. package/dist/tmagic-form.umd.cjs.map +1 -1
  6. package/package.json +4 -4
  7. package/src/Form.vue +12 -4
  8. package/src/FormDialog.vue +19 -5
  9. package/src/FormDrawer.vue +159 -0
  10. package/src/containers/Container.vue +11 -10
  11. package/src/containers/GroupList.vue +1 -0
  12. package/src/containers/GroupListItem.vue +8 -2
  13. package/src/containers/Table.vue +148 -150
  14. package/src/fields/Cascader.vue +2 -12
  15. package/src/fields/Checkbox.vue +2 -12
  16. package/src/fields/CheckboxGroup.vue +2 -12
  17. package/src/fields/ColorPicker.vue +5 -13
  18. package/src/fields/Date.vue +6 -14
  19. package/src/fields/DateTime.vue +7 -15
  20. package/src/fields/Daterange.vue +2 -12
  21. package/src/fields/Display.vue +2 -10
  22. package/src/fields/DynamicField.vue +3 -13
  23. package/src/fields/Hidden.vue +2 -10
  24. package/src/fields/Link.vue +2 -12
  25. package/src/fields/Number.vue +7 -14
  26. package/src/fields/NumberRange.vue +50 -0
  27. package/src/fields/RadioGroup.vue +2 -12
  28. package/src/fields/Select.vue +2 -12
  29. package/src/fields/Switch.vue +6 -14
  30. package/src/fields/Text.vue +7 -14
  31. package/src/fields/Textarea.vue +7 -14
  32. package/src/fields/Time.vue +5 -13
  33. package/src/fields/Timerange.vue +76 -0
  34. package/src/index.ts +7 -0
  35. package/src/schema.ts +23 -2
  36. package/src/theme/form-drawer.scss +11 -0
  37. package/src/theme/index.scss +2 -0
  38. package/src/theme/number-range.scss +8 -0
  39. package/src/theme/panel.scss +6 -0
  40. package/src/utils/config.ts +1 -1
  41. package/src/utils/form.ts +2 -1
  42. package/types/Form.vue.d.ts +13 -11
  43. package/types/FormDialog.vue.d.ts +30 -17
  44. package/types/FormDrawer.vue.d.ts +348 -0
  45. package/types/fields/Cascader.vue.d.ts +2 -22
  46. package/types/fields/Checkbox.vue.d.ts +2 -22
  47. package/types/fields/CheckboxGroup.vue.d.ts +2 -22
  48. package/types/fields/ColorPicker.vue.d.ts +2 -24
  49. package/types/fields/Date.vue.d.ts +2 -24
  50. package/types/fields/DateTime.vue.d.ts +2 -24
  51. package/types/fields/Daterange.vue.d.ts +2 -22
  52. package/types/fields/Display.vue.d.ts +2 -18
  53. package/types/fields/DynamicField.vue.d.ts +2 -22
  54. package/types/fields/Hidden.vue.d.ts +2 -18
  55. package/types/fields/Link.vue.d.ts +2 -22
  56. package/types/fields/Number.vue.d.ts +2 -25
  57. package/types/fields/NumberRange.vue.d.ts +12 -0
  58. package/types/fields/RadioGroup.vue.d.ts +2 -22
  59. package/types/fields/Select.vue.d.ts +2 -22
  60. package/types/fields/Switch.vue.d.ts +2 -24
  61. package/types/fields/Text.vue.d.ts +2 -25
  62. package/types/fields/Textarea.vue.d.ts +2 -25
  63. package/types/fields/Time.vue.d.ts +2 -24
  64. package/types/fields/Timerange.vue.d.ts +14 -0
  65. package/types/index.d.ts +3 -0
  66. package/types/schema.d.ts +21 -2
  67. package/types/utils/config.d.ts +1 -1
@@ -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, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, 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, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicTimePicker } from '@tmagic/design';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicTimePicker, TMagicDrawer } from '@tmagic/design';
5
5
  import Sortable from 'sortablejs';
6
6
  import { asyncLoadJs, sleep, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
7
7
  import cloneDeep$1 from 'lodash-es/cloneDeep';
@@ -92,7 +92,7 @@ const getDefaultValue = function(mForm, { defaultValue, type, filter, multiple }
92
92
  if (["switch", "checkbox"].includes(type)) {
93
93
  return false;
94
94
  }
95
- if (multiple) {
95
+ if (multiple || type === "number-range") {
96
96
  return [];
97
97
  }
98
98
  return "";
@@ -107,7 +107,8 @@ const filterFunction = (mForm, config, props) => {
107
107
  parent: mForm?.parentValues || {},
108
108
  formValue: mForm?.values || props.model,
109
109
  prop: props.prop,
110
- config: props.config
110
+ config: props.config,
111
+ index: props.index
111
112
  });
112
113
  };
113
114
  const display = function(mForm, config, props) {
@@ -166,10 +167,10 @@ const initValue = async (mForm, { initValues, config }) => {
166
167
  return valuesTmp || {};
167
168
  };
168
169
 
169
- const _hoisted_1$b = ["innerHTML"];
170
- const _hoisted_2$6 = ["innerHTML"];
170
+ const _hoisted_1$d = ["innerHTML"];
171
+ const _hoisted_2$7 = ["innerHTML"];
171
172
  const _hoisted_3$4 = ["innerHTML"];
172
- const _hoisted_4$4 = ["innerHTML"];
173
+ const _hoisted_4$3 = ["innerHTML"];
173
174
  const _hoisted_5$3 = ["innerHTML"];
174
175
  const _hoisted_6$1 = ["innerHTML"];
175
176
  const _hoisted_7$1 = ["innerHTML"];
@@ -182,7 +183,7 @@ const _hoisted_13 = {
182
183
  key: 5,
183
184
  style: { "text-align": "center" }
184
185
  };
185
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
186
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
186
187
  ...{
187
188
  name: "MFormContainer"
188
189
  },
@@ -232,6 +233,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
232
233
  return "m-fields-text";
233
234
  });
234
235
  const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
236
+ const text = computed(() => filterFunction(mForm, props.config.text, props));
235
237
  const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
236
238
  const extra = computed(() => filterFunction(mForm, props.config.extra, props));
237
239
  const rule = computed(() => getRules(mForm, props.config.rules, props));
@@ -262,7 +264,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
262
264
  (showDiff2) => {
263
265
  if (type.value === "hidden")
264
266
  return;
265
- if (items.value && !props.config.text && type.value && display$1.value)
267
+ if (items.value && !text.value && type.value && display$1.value)
266
268
  return;
267
269
  if (display$1.value && showDiff2 && type.value) {
268
270
  emit("addDiffCount");
@@ -330,7 +332,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
330
332
  return _ctx.config ? (openBlock(), createElementBlock("div", {
331
333
  key: 0,
332
334
  style: normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
333
- class: normalizeClass([_ctx.config.className, "m-form-container"])
335
+ class: normalizeClass(`m-form-container m-container-${type.value || ""} ${_ctx.config.className || ""}`)
334
336
  }, [
335
337
  type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
336
338
  key: 0,
@@ -339,7 +341,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
339
341
  name: _ctx.config.name,
340
342
  disabled: disabled.value,
341
343
  prop: itemProp.value
342
- }, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !_ctx.config.text && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
344
+ }, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
343
345
  key: key(_ctx.config),
344
346
  size: _ctx.size,
345
347
  model: _ctx.model,
@@ -357,20 +359,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
357
359
  }, null, 40, ["size", "model", "last-values", "is-compare", "config", "disabled", "name", "prop", "step-active", "expand-more", "label-width"])) : type.value && display$1.value && !showDiff.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
358
360
  createVNode(unref(TMagicFormItem), {
359
361
  style: normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
360
- class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !_ctx.config.text }),
362
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
361
363
  prop: itemProp.value,
362
364
  "label-width": itemLabelWidth.value,
363
365
  rules: rule.value
364
366
  }, {
365
367
  label: withCtx(() => [
366
368
  createElementVNode("span", {
367
- innerHTML: type.value === "checkbox" ? "" : _ctx.config.text
368
- }, null, 8, _hoisted_1$b)
369
+ innerHTML: type.value === "checkbox" ? "" : text.value
370
+ }, null, 8, _hoisted_1$d)
369
371
  ]),
370
372
  default: withCtx(() => [
371
373
  tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
372
374
  content: withCtx(() => [
373
- createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_2$6)
375
+ createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_2$7)
374
376
  ]),
375
377
  default: withCtx(() => [
376
378
  (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
@@ -414,7 +416,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
414
416
  content: withCtx(() => [
415
417
  createElementVNode("div", {
416
418
  innerHTML: _ctx.config.tip
417
- }, null, 8, _hoisted_4$4)
419
+ }, null, 8, _hoisted_4$3)
418
420
  ]),
419
421
  default: withCtx(() => [
420
422
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -429,14 +431,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
429
431
  ], 64)) : type.value && display$1.value && showDiff.value ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
430
432
  createVNode(unref(TMagicFormItem), {
431
433
  style: normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
432
- class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !_ctx.config.text }),
434
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
433
435
  prop: itemProp.value,
434
436
  "label-width": itemLabelWidth.value,
435
437
  rules: rule.value
436
438
  }, {
437
439
  label: withCtx(() => [
438
440
  createElementVNode("span", {
439
- innerHTML: type.value === "checkbox" ? "" : _ctx.config.text
441
+ innerHTML: type.value === "checkbox" ? "" : text.value
440
442
  }, null, 8, _hoisted_5$3)
441
443
  ]),
442
444
  default: withCtx(() => [
@@ -496,14 +498,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
496
498
  })) : createCommentVNode("", true),
497
499
  createVNode(unref(TMagicFormItem), {
498
500
  style: normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
499
- class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !_ctx.config.text }),
501
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
500
502
  prop: itemProp.value,
501
503
  "label-width": itemLabelWidth.value,
502
504
  rules: rule.value
503
505
  }, {
504
506
  label: withCtx(() => [
505
507
  createElementVNode("span", {
506
- innerHTML: type.value === "checkbox" ? "" : _ctx.config.text
508
+ innerHTML: type.value === "checkbox" ? "" : text.value
507
509
  }, null, 8, _hoisted_9)
508
510
  ]),
509
511
  default: withCtx(() => [
@@ -599,10 +601,10 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
599
601
  }
600
602
  });
601
603
 
602
- const _hoisted_1$a = ["innerHTML"];
603
- const _hoisted_2$5 = ["innerHTML"];
604
+ const _hoisted_1$c = ["innerHTML"];
605
+ const _hoisted_2$6 = ["innerHTML"];
604
606
  const _hoisted_3$3 = { key: 1 };
605
- const _hoisted_4$3 = ["innerHTML"];
607
+ const _hoisted_4$2 = ["innerHTML"];
606
608
  const _hoisted_5$2 = ["innerHTML"];
607
609
  const _hoisted_6 = {
608
610
  key: 2,
@@ -610,7 +612,7 @@ const _hoisted_6 = {
610
612
  };
611
613
  const _hoisted_7 = { style: { "flex": "1" } };
612
614
  const _hoisted_8 = ["src"];
613
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
615
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
614
616
  ...{
615
617
  name: "MFormFieldset"
616
618
  },
@@ -669,12 +671,12 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
669
671
  default: withCtx(() => [
670
672
  createElementVNode("span", {
671
673
  innerHTML: _ctx.config.legend
672
- }, null, 8, _hoisted_1$a),
674
+ }, null, 8, _hoisted_1$c),
673
675
  _ctx.config.extra ? (openBlock(), createElementBlock("span", {
674
676
  key: 0,
675
677
  innerHTML: _ctx.config.extra,
676
678
  class: "m-form-tip"
677
- }, null, 8, _hoisted_2$5)) : createCommentVNode("", true)
679
+ }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
678
680
  ]),
679
681
  _: 1
680
682
  }, 8, ["modelValue", "prop"])
@@ -683,7 +685,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
683
685
  })) : (openBlock(), createElementBlock("legend", _hoisted_3$3, [
684
686
  createElementVNode("span", {
685
687
  innerHTML: _ctx.config.legend
686
- }, null, 8, _hoisted_4$3),
688
+ }, null, 8, _hoisted_4$2),
687
689
  _ctx.config.extra ? (openBlock(), createElementBlock("span", {
688
690
  key: 0,
689
691
  innerHTML: _ctx.config.extra,
@@ -693,7 +695,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
693
695
  _ctx.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
694
696
  createElementVNode("div", _hoisted_7, [
695
697
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (item, index) => {
696
- return openBlock(), createBlock(_sfc_main$v, {
698
+ return openBlock(), createBlock(_sfc_main$y, {
697
699
  key: key(item, index),
698
700
  model: name.value ? _ctx.model[name.value] : _ctx.model,
699
701
  lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
@@ -714,7 +716,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
714
716
  src: _ctx.config.schematic
715
717
  }, null, 8, _hoisted_8)
716
718
  ])) : show.value ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.config.items, (item, index) => {
717
- return openBlock(), createBlock(_sfc_main$v, {
719
+ return openBlock(), createBlock(_sfc_main$y, {
718
720
  key: key(item, index),
719
721
  model: name.value ? _ctx.model[name.value] : _ctx.model,
720
722
  lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
@@ -734,9 +736,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
734
736
  }
735
737
  });
736
738
 
737
- const _hoisted_1$9 = { class: "m-fields-group-list-item" };
738
- const _hoisted_2$4 = ["innerHTML"];
739
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
739
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
740
+ const _hoisted_2$5 = ["innerHTML"];
741
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
740
742
  ...{
741
743
  name: "MFormGroupListItem"
742
744
  },
@@ -769,7 +771,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
769
771
  if (props.config.titleKey && props.model[props.config.titleKey]) {
770
772
  return props.model[props.config.titleKey];
771
773
  }
772
- return `组 ${String(props.index)}`;
774
+ if (props.config.title) {
775
+ return filterFunction(mForm, props.config.title, props);
776
+ }
777
+ const titlePrefix = props.config.titlePrefix || "组";
778
+ return `${titlePrefix} ${String(props.index + 1)}`;
773
779
  });
774
780
  const length = computed(() => props.groupModel?.length || 0);
775
781
  const itemExtra = computed(() => filterFunction(mForm, props.config.itemExtra, props));
@@ -785,7 +791,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
785
791
  }
786
792
  return true;
787
793
  };
788
- const changeOrder = (offset = 0) => emit("swap-item", props.index, `${String(props.index)}${offset}`);
794
+ const changeOrder = (offset = 0) => emit("swap-item", props.index, props.index + offset);
789
795
  const movable = () => {
790
796
  const { movable: movable2 } = props.config;
791
797
  if (movable2 === void 0)
@@ -797,7 +803,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
797
803
  };
798
804
  const onAddDiffCount = () => emit("addDiffCount");
799
805
  return (_ctx, _cache) => {
800
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
806
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
801
807
  createElementVNode("div", null, [
802
808
  createVNode(unref(TMagicButton), {
803
809
  text: "",
@@ -863,9 +869,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
863
869
  key: 1,
864
870
  innerHTML: itemExtra.value,
865
871
  class: "m-form-tip"
866
- }, null, 8, _hoisted_2$4)) : createCommentVNode("", true)
872
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("", true)
867
873
  ]),
868
- expand.value ? (openBlock(), createBlock(_sfc_main$v, {
874
+ expand.value ? (openBlock(), createBlock(_sfc_main$y, {
869
875
  key: 0,
870
876
  config: rowConfig.value,
871
877
  model: _ctx.model,
@@ -883,17 +889,17 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
883
889
  }
884
890
  });
885
891
 
886
- const _hoisted_1$8 = { class: "m-fields-group-list" };
887
- const _hoisted_2$3 = ["innerHTML"];
892
+ const _hoisted_1$a = { class: "m-fields-group-list" };
893
+ const _hoisted_2$4 = ["innerHTML"];
888
894
  const _hoisted_3$2 = {
889
895
  key: 1,
890
896
  class: "el-table__empty-block"
891
897
  };
892
- const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
898
+ const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
893
899
  const _hoisted_5$1 = [
894
- _hoisted_4$2
900
+ _hoisted_4$1
895
901
  ];
896
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
902
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
897
903
  ...{
898
904
  name: "MFormGroupList"
899
905
  },
@@ -976,14 +982,14 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
976
982
  const onAddDiffCount = () => emit("addDiffCount");
977
983
  const getLastValues = (item, index) => item?.[index] || {};
978
984
  return (_ctx, _cache) => {
979
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
985
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
980
986
  _ctx.config.extra ? (openBlock(), createElementBlock("div", {
981
987
  key: 0,
982
988
  innerHTML: _ctx.config.extra,
983
989
  style: { "color": "rgba(0, 0, 0, 0.45)" }
984
- }, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
990
+ }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
985
991
  !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$2, _hoisted_5$1)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
986
- return openBlock(), createBlock(_sfc_main$t, {
992
+ return openBlock(), createBlock(_sfc_main$w, {
987
993
  key: index,
988
994
  model: item,
989
995
  lastValues: getLastValues(_ctx.lastValues[_ctx.name], index),
@@ -1028,15 +1034,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1028
1034
  }
1029
1035
  });
1030
1036
 
1031
- const _hoisted_1$7 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1032
- const _hoisted_2$2 = ["innerHTML"];
1037
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1038
+ const _hoisted_2$3 = ["innerHTML"];
1033
1039
  const _hoisted_3$1 = {
1034
1040
  key: 0,
1035
1041
  style: { "display": "flex" }
1036
1042
  };
1037
- const _hoisted_4$1 = { style: { "flex": "1" } };
1043
+ const _hoisted_4 = { style: { "flex": "1" } };
1038
1044
  const _hoisted_5 = ["src"];
1039
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1045
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1040
1046
  ...{
1041
1047
  name: "MFormPanel"
1042
1048
  },
@@ -1068,7 +1074,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1068
1074
  "body-style": { display: expand.value ? "block" : "none" }
1069
1075
  }, {
1070
1076
  header: withCtx(() => [
1071
- createElementVNode("div", _hoisted_1$7, [
1077
+ createElementVNode("div", _hoisted_1$9, [
1072
1078
  createVNode(unref(TMagicButton), {
1073
1079
  style: { "padding": "0" },
1074
1080
  text: "",
@@ -1079,7 +1085,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1079
1085
  key: 0,
1080
1086
  innerHTML: _ctx.config.extra,
1081
1087
  class: "m-form-tip"
1082
- }, null, 8, _hoisted_2$2)) : createCommentVNode("", true),
1088
+ }, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
1083
1089
  renderSlot(_ctx.$slots, "header", {}, () => [
1084
1090
  createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
1085
1091
  ])
@@ -1089,9 +1095,9 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1089
1095
  createElementVNode("div", null, [
1090
1096
  renderSlot(_ctx.$slots, "default"),
1091
1097
  _ctx.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
1092
- createElementVNode("div", _hoisted_4$1, [
1098
+ createElementVNode("div", _hoisted_4, [
1093
1099
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
1094
- return openBlock(), createBlock(_sfc_main$v, {
1100
+ return openBlock(), createBlock(_sfc_main$y, {
1095
1101
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1096
1102
  config: item,
1097
1103
  model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
@@ -1111,7 +1117,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1111
1117
  src: _ctx.config.schematic
1112
1118
  }, null, 8, _hoisted_5)
1113
1119
  ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(items.value, (item, index) => {
1114
- return openBlock(), createBlock(_sfc_main$v, {
1120
+ return openBlock(), createBlock(_sfc_main$y, {
1115
1121
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1116
1122
  config: item,
1117
1123
  model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
@@ -1133,7 +1139,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1133
1139
  }
1134
1140
  });
1135
1141
 
1136
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1142
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1137
1143
  ...{
1138
1144
  name: "MFormCol"
1139
1145
  },
@@ -1160,7 +1166,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1160
1166
  return (_ctx, _cache) => {
1161
1167
  return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: _ctx.span }, {
1162
1168
  default: withCtx(() => [
1163
- createVNode(_sfc_main$v, {
1169
+ createVNode(_sfc_main$y, {
1164
1170
  model: _ctx.model,
1165
1171
  lastValues: _ctx.lastValues,
1166
1172
  "is-compare": _ctx.isCompare,
@@ -1182,7 +1188,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1182
1188
  }
1183
1189
  });
1184
1190
 
1185
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
1191
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1186
1192
  ...{
1187
1193
  name: "MFormRow"
1188
1194
  },
@@ -1209,7 +1215,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1209
1215
  return openBlock(), createBlock(unref(TMagicRow), { gutter: 10 }, {
1210
1216
  default: withCtx(() => [
1211
1217
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (col, index) => {
1212
- return openBlock(), createBlock(_sfc_main$q, {
1218
+ return openBlock(), createBlock(_sfc_main$t, {
1213
1219
  key: col[unref(mForm)?.keyProp || "__key"] ?? index,
1214
1220
  span: col.span || _ctx.config.span || 24 / _ctx.config.items.length,
1215
1221
  config: col,
@@ -1232,7 +1238,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1232
1238
  }
1233
1239
  });
1234
1240
 
1235
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
1241
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1236
1242
  ...{
1237
1243
  name: "MFormStep"
1238
1244
  },
@@ -1286,7 +1292,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1286
1292
  return openBlock(), createElementBlock(Fragment, null, [
1287
1293
  (openBlock(true), createElementBlock(Fragment, null, renderList(step.items, (item) => {
1288
1294
  return openBlock(), createElementBlock(Fragment, null, [
1289
- item ? withDirectives((openBlock(), createBlock(_sfc_main$v, {
1295
+ item ? withDirectives((openBlock(), createBlock(_sfc_main$y, {
1290
1296
  key: item[unref(mForm)?.keyProp || "__key"],
1291
1297
  config: item,
1292
1298
  model: step.name ? _ctx.model[step.name] : _ctx.model,
@@ -1310,15 +1316,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1310
1316
  }
1311
1317
  });
1312
1318
 
1313
- const _hoisted_1$6 = ["innerHTML"];
1314
- const _hoisted_2$1 = { class: "el-form-item__content" };
1315
- const _hoisted_3 = ["innerHTML"];
1316
- const _hoisted_4 = {
1317
- key: 1,
1319
+ const _hoisted_1$8 = ["innerHTML"];
1320
+ const _hoisted_2$2 = ["innerHTML"];
1321
+ const _hoisted_3 = {
1322
+ key: 6,
1318
1323
  class: "bottom",
1319
1324
  style: { "text-align": "right" }
1320
1325
  };
1321
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
1326
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1322
1327
  ...{
1323
1328
  name: "MFormTable"
1324
1329
  },
@@ -1673,246 +1678,244 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1673
1678
  key: 0,
1674
1679
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1675
1680
  innerHTML: _ctx.config.extra
1676
- }, null, 8, _hoisted_1$6)) : createCommentVNode("", true),
1677
- createElementVNode("div", _hoisted_2$1, [
1678
- createVNode(unref(TMagicTooltip), {
1679
- content: "拖拽可排序",
1680
- placement: "left-start",
1681
- disabled: _ctx.config.dropSort !== true
1682
- }, {
1683
- default: withCtx(() => [
1684
- _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1685
- ref_key: "tMagicTable",
1686
- ref: tMagicTable,
1687
- style: { "width": "100%" },
1688
- "row-key": _ctx.config.rowKey || "id",
1689
- data: data.value,
1690
- lastData: lastData.value,
1691
- border: _ctx.config.border,
1692
- "max-height": _ctx.config.maxHeight,
1693
- "default-expand-all": true,
1694
- key: updateKey.value,
1695
- onSelect: selectHandle,
1696
- onSortChange: sortChange
1697
- }, {
1698
- default: withCtx(() => [
1699
- _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1700
- key: 0,
1701
- fixed: "left",
1702
- width: "30",
1703
- type: "expand"
1704
- }, {
1705
- default: withCtx((scope) => [
1706
- createElementVNode("span", {
1707
- innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1708
- class: "m-form-tip"
1709
- }, null, 8, _hoisted_3)
1710
- ]),
1711
- _: 1
1712
- })) : createCommentVNode("", true),
1713
- createVNode(unref(TMagicTableColumn), {
1714
- label: "操作",
1715
- width: _ctx.config.operateColWidth || 55,
1716
- align: "center",
1717
- fixed: _ctx.config.fixed === false ? void 0 : "left"
1718
- }, {
1719
- default: withCtx((scope) => [
1720
- renderSlot(_ctx.$slots, "operateCol", { scope }),
1721
- withDirectives(createVNode(unref(TMagicIcon), {
1722
- class: "m-table-delete-icon",
1723
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1724
- }, {
1725
- default: withCtx(() => [
1726
- createVNode(unref(Delete))
1727
- ]),
1728
- _: 2
1729
- }, 1032, ["onClick"]), [
1730
- [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1731
- ])
1732
- ]),
1733
- _: 3
1734
- }, 8, ["width", "fixed"]),
1735
- _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1736
- key: 1,
1737
- label: "排序",
1738
- width: "60"
1739
- }, {
1740
- default: withCtx((scope) => [
1741
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1742
- key: 0,
1743
- content: "点击上移,双击置顶",
1744
- placement: "top"
1745
- }, {
1746
- default: withCtx(() => [
1747
- createVNode(unref(TMagicButton), {
1748
- plain: "",
1749
- size: "small",
1750
- type: "primary",
1751
- icon: unref(ArrowUp),
1752
- disabled: _ctx.disabled,
1753
- text: "",
1754
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1755
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1756
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1757
- ]),
1758
- _: 2
1759
- }, 1024)) : createCommentVNode("", true),
1760
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1761
- key: 1,
1762
- content: "点击下移,双击置底",
1763
- placement: "top"
1764
- }, {
1765
- default: withCtx(() => [
1766
- createVNode(unref(TMagicButton), {
1767
- plain: "",
1768
- size: "small",
1769
- type: "primary",
1770
- icon: unref(ArrowDown),
1771
- disabled: _ctx.disabled,
1772
- text: "",
1773
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1774
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1775
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1776
- ]),
1777
- _: 2
1778
- }, 1024)) : createCommentVNode("", true)
1779
- ]),
1780
- _: 1
1781
- })) : createCommentVNode("", true),
1782
- selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1783
- key: 2,
1784
- align: "center",
1785
- "header-align": "center",
1786
- type: "selection",
1787
- width: "45"
1788
- })) : createCommentVNode("", true),
1789
- _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1790
- key: 3,
1791
- width: "60",
1792
- label: "序号"
1793
- }, {
1794
- default: withCtx((scope) => [
1795
- createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1796
- ]),
1797
- _: 1
1798
- })) : createCommentVNode("", true),
1799
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1800
- return openBlock(), createElementBlock(Fragment, null, [
1801
- column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1802
- prop: column.name,
1803
- width: column.width,
1804
- label: column.label,
1805
- sortable: column.sortable,
1806
- "sort-orders": ["ascending", "descending"],
1807
- key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1808
- "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1809
- }, {
1810
- default: withCtx((scope) => [
1811
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$v, {
1812
- key: 0,
1813
- labelWidth: "0",
1814
- disabled: _ctx.disabled,
1815
- prop: getProp(scope.$index),
1816
- rules: column.rules,
1817
- config: makeConfig(column, scope.row),
1818
- model: scope.row,
1819
- lastValues: lastData.value[scope.$index],
1820
- "is-compare": _ctx.isCompare,
1821
- size: _ctx.size,
1822
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1823
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1824
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1825
- ]),
1826
- _: 2
1827
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1828
- ], 64);
1829
- }), 256))
1830
- ]),
1831
- _: 3
1832
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1833
- ]),
1834
- _: 3
1835
- }, 8, ["disabled"]),
1836
- renderSlot(_ctx.$slots, "default"),
1837
- addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1838
- key: 0,
1839
- size: "small",
1840
- type: "primary",
1841
- disabled: _ctx.disabled,
1842
- plain: "",
1843
- onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1844
- }, {
1845
- default: withCtx(() => [
1846
- createTextVNode("新增一行")
1847
- ]),
1848
- _: 1
1849
- }, 8, ["disabled"])) : createCommentVNode("", true),
1850
- createTextVNode("   "),
1851
- _ctx.enableToggleMode && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1852
- key: 1,
1853
- icon: unref(Grid),
1854
- size: "small",
1855
- type: "primary",
1856
- onClick: toggleMode
1857
- }, {
1858
- default: withCtx(() => [
1859
- createTextVNode("展开配置")
1860
- ]),
1861
- _: 1
1862
- }, 8, ["icon"])) : createCommentVNode("", true),
1863
- _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1864
- key: 2,
1865
- icon: unref(FullScreen),
1866
- size: "small",
1867
- type: "primary",
1868
- onClick: toggleFullscreen
1869
- }, {
1870
- default: withCtx(() => [
1871
- createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1872
- ]),
1873
- _: 1
1874
- }, 8, ["icon"])) : createCommentVNode("", true),
1875
- importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1876
- key: 3,
1877
- style: { "display": "inline-block" },
1878
- ref_key: "excelBtn",
1879
- ref: excelBtn,
1880
- action: "/noop",
1881
- disabled: _ctx.disabled,
1882
- "on-change": excelHandler,
1883
- "auto-upload": false
1884
- }, {
1885
- default: withCtx(() => [
1886
- createVNode(unref(TMagicButton), {
1887
- size: "small",
1888
- type: "success",
1889
- disabled: _ctx.disabled,
1890
- plain: ""
1891
- }, {
1892
- default: withCtx(() => [
1893
- createTextVNode("导入EXCEL")
1894
- ]),
1895
- _: 1
1896
- }, 8, ["disabled"])
1897
- ]),
1898
- _: 1
1899
- }, 8, ["disabled"])) : createCommentVNode("", true),
1900
- createTextVNode("  "),
1901
- importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1902
- key: 4,
1903
- size: "small",
1904
- type: "warning",
1905
- disabled: _ctx.disabled,
1906
- plain: "",
1907
- onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1908
- }, {
1909
- default: withCtx(() => [
1910
- createTextVNode("清空")
1911
- ]),
1912
- _: 1
1913
- }, 8, ["disabled"])) : createCommentVNode("", true)
1914
- ]),
1915
- _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_4, [
1681
+ }, null, 8, _hoisted_1$8)) : createCommentVNode("", true),
1682
+ createVNode(unref(TMagicTooltip), {
1683
+ content: "拖拽可排序",
1684
+ placement: "left-start",
1685
+ disabled: _ctx.config.dropSort !== true
1686
+ }, {
1687
+ default: withCtx(() => [
1688
+ _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1689
+ ref_key: "tMagicTable",
1690
+ ref: tMagicTable,
1691
+ style: { "width": "100%" },
1692
+ "row-key": _ctx.config.rowKey || "id",
1693
+ data: data.value,
1694
+ lastData: lastData.value,
1695
+ border: _ctx.config.border,
1696
+ "max-height": _ctx.config.maxHeight,
1697
+ "default-expand-all": true,
1698
+ key: updateKey.value,
1699
+ onSelect: selectHandle,
1700
+ onSortChange: sortChange
1701
+ }, {
1702
+ default: withCtx(() => [
1703
+ _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1704
+ key: 0,
1705
+ fixed: "left",
1706
+ width: "30",
1707
+ type: "expand"
1708
+ }, {
1709
+ default: withCtx((scope) => [
1710
+ createElementVNode("span", {
1711
+ innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1712
+ class: "m-form-tip"
1713
+ }, null, 8, _hoisted_2$2)
1714
+ ]),
1715
+ _: 1
1716
+ })) : createCommentVNode("", true),
1717
+ createVNode(unref(TMagicTableColumn), {
1718
+ label: "操作",
1719
+ width: _ctx.config.operateColWidth || 55,
1720
+ align: "center",
1721
+ fixed: _ctx.config.fixed === false ? void 0 : "left"
1722
+ }, {
1723
+ default: withCtx((scope) => [
1724
+ renderSlot(_ctx.$slots, "operateCol", { scope }),
1725
+ withDirectives(createVNode(unref(TMagicIcon), {
1726
+ class: "m-table-delete-icon",
1727
+ onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1728
+ }, {
1729
+ default: withCtx(() => [
1730
+ createVNode(unref(Delete))
1731
+ ]),
1732
+ _: 2
1733
+ }, 1032, ["onClick"]), [
1734
+ [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1735
+ ])
1736
+ ]),
1737
+ _: 3
1738
+ }, 8, ["width", "fixed"]),
1739
+ _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1740
+ key: 1,
1741
+ label: "排序",
1742
+ width: "60"
1743
+ }, {
1744
+ default: withCtx((scope) => [
1745
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1746
+ key: 0,
1747
+ content: "点击上移,双击置顶",
1748
+ placement: "top"
1749
+ }, {
1750
+ default: withCtx(() => [
1751
+ createVNode(unref(TMagicButton), {
1752
+ plain: "",
1753
+ size: "small",
1754
+ type: "primary",
1755
+ icon: unref(ArrowUp),
1756
+ disabled: _ctx.disabled,
1757
+ text: "",
1758
+ onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1759
+ onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1760
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1761
+ ]),
1762
+ _: 2
1763
+ }, 1024)) : createCommentVNode("", true),
1764
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1765
+ key: 1,
1766
+ content: "点击下移,双击置底",
1767
+ placement: "top"
1768
+ }, {
1769
+ default: withCtx(() => [
1770
+ createVNode(unref(TMagicButton), {
1771
+ plain: "",
1772
+ size: "small",
1773
+ type: "primary",
1774
+ icon: unref(ArrowDown),
1775
+ disabled: _ctx.disabled,
1776
+ text: "",
1777
+ onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1778
+ onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1779
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1780
+ ]),
1781
+ _: 2
1782
+ }, 1024)) : createCommentVNode("", true)
1783
+ ]),
1784
+ _: 1
1785
+ })) : createCommentVNode("", true),
1786
+ selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1787
+ key: 2,
1788
+ align: "center",
1789
+ "header-align": "center",
1790
+ type: "selection",
1791
+ width: "45"
1792
+ })) : createCommentVNode("", true),
1793
+ _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1794
+ key: 3,
1795
+ width: "60",
1796
+ label: "序号"
1797
+ }, {
1798
+ default: withCtx((scope) => [
1799
+ createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1800
+ ]),
1801
+ _: 1
1802
+ })) : createCommentVNode("", true),
1803
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1804
+ return openBlock(), createElementBlock(Fragment, null, [
1805
+ column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1806
+ prop: column.name,
1807
+ width: column.width,
1808
+ label: column.label,
1809
+ sortable: column.sortable,
1810
+ "sort-orders": ["ascending", "descending"],
1811
+ key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1812
+ "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1813
+ }, {
1814
+ default: withCtx((scope) => [
1815
+ scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$y, {
1816
+ key: 0,
1817
+ labelWidth: "0",
1818
+ disabled: _ctx.disabled,
1819
+ prop: getProp(scope.$index),
1820
+ rules: column.rules,
1821
+ config: makeConfig(column, scope.row),
1822
+ model: scope.row,
1823
+ lastValues: lastData.value[scope.$index],
1824
+ "is-compare": _ctx.isCompare,
1825
+ size: _ctx.size,
1826
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1827
+ onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1828
+ }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1829
+ ]),
1830
+ _: 2
1831
+ }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1832
+ ], 64);
1833
+ }), 256))
1834
+ ]),
1835
+ _: 3
1836
+ }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1837
+ ]),
1838
+ _: 3
1839
+ }, 8, ["disabled"]),
1840
+ renderSlot(_ctx.$slots, "default"),
1841
+ addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1842
+ key: 1,
1843
+ size: "small",
1844
+ type: "primary",
1845
+ disabled: _ctx.disabled,
1846
+ plain: "",
1847
+ onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1848
+ }, {
1849
+ default: withCtx(() => [
1850
+ createTextVNode("新增一行")
1851
+ ]),
1852
+ _: 1
1853
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1854
+ createTextVNode("   "),
1855
+ _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1856
+ key: 2,
1857
+ icon: unref(Grid),
1858
+ size: "small",
1859
+ type: "primary",
1860
+ onClick: toggleMode
1861
+ }, {
1862
+ default: withCtx(() => [
1863
+ createTextVNode("展开配置")
1864
+ ]),
1865
+ _: 1
1866
+ }, 8, ["icon"])) : createCommentVNode("", true),
1867
+ _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1868
+ key: 3,
1869
+ icon: unref(FullScreen),
1870
+ size: "small",
1871
+ type: "primary",
1872
+ onClick: toggleFullscreen
1873
+ }, {
1874
+ default: withCtx(() => [
1875
+ createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1876
+ ]),
1877
+ _: 1
1878
+ }, 8, ["icon"])) : createCommentVNode("", true),
1879
+ importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1880
+ key: 4,
1881
+ style: { "display": "inline-block" },
1882
+ ref_key: "excelBtn",
1883
+ ref: excelBtn,
1884
+ action: "/noop",
1885
+ disabled: _ctx.disabled,
1886
+ "on-change": excelHandler,
1887
+ "auto-upload": false
1888
+ }, {
1889
+ default: withCtx(() => [
1890
+ createVNode(unref(TMagicButton), {
1891
+ size: "small",
1892
+ type: "success",
1893
+ disabled: _ctx.disabled,
1894
+ plain: ""
1895
+ }, {
1896
+ default: withCtx(() => [
1897
+ createTextVNode("导入EXCEL")
1898
+ ]),
1899
+ _: 1
1900
+ }, 8, ["disabled"])
1901
+ ]),
1902
+ _: 1
1903
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1904
+ createTextVNode("  "),
1905
+ importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1906
+ key: 5,
1907
+ size: "small",
1908
+ type: "warning",
1909
+ disabled: _ctx.disabled,
1910
+ plain: "",
1911
+ onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1912
+ }, {
1913
+ default: withCtx(() => [
1914
+ createTextVNode("清空")
1915
+ ]),
1916
+ _: 1
1917
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1918
+ _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_3, [
1916
1919
  createVNode(unref(TMagicPagination), {
1917
1920
  layout: "total, sizes, prev, pager, next, jumper",
1918
1921
  "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
@@ -1929,7 +1932,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1929
1932
  }
1930
1933
  });
1931
1934
 
1932
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
1935
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1933
1936
  ...{
1934
1937
  name: "MFormTabs"
1935
1938
  },
@@ -2083,7 +2086,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2083
2086
  ]),
2084
2087
  default: withCtx(() => [
2085
2088
  (openBlock(true), createElementBlock(Fragment, null, renderList(tabItems(tab), (item) => {
2086
- return openBlock(), createBlock(_sfc_main$v, {
2089
+ return openBlock(), createBlock(_sfc_main$y, {
2087
2090
  key: item[unref(mForm)?.keyProp || "__key"],
2088
2091
  config: item,
2089
2092
  disabled: _ctx.disabled,
@@ -2135,7 +2138,7 @@ const useAddField = (prop) => {
2135
2138
  );
2136
2139
  };
2137
2140
 
2138
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2141
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2139
2142
  ...{
2140
2143
  name: "MFormCascader"
2141
2144
  },
@@ -2223,7 +2226,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2223
2226
  }
2224
2227
  });
2225
2228
 
2226
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2229
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2227
2230
  ...{
2228
2231
  name: "MFormCheckbox"
2229
2232
  },
@@ -2285,7 +2288,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2285
2288
  }
2286
2289
  });
2287
2290
 
2288
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2291
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2289
2292
  ...{
2290
2293
  name: "MFormCheckGroup"
2291
2294
  },
@@ -2348,7 +2351,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2348
2351
  }
2349
2352
  });
2350
2353
 
2351
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2354
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2352
2355
  ...{
2353
2356
  name: "MFormColorPicker"
2354
2357
  },
@@ -2382,7 +2385,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2382
2385
  }
2383
2386
  });
2384
2387
 
2385
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
2388
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2386
2389
  ...{
2387
2390
  name: "MFormDate"
2388
2391
  },
@@ -2415,14 +2418,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2415
2418
  placeholder: _ctx.config.placeholder,
2416
2419
  disabled: _ctx.disabled,
2417
2420
  format: _ctx.config.format,
2418
- "value-format": _ctx.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
2421
+ "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
2419
2422
  onChange: changeHandler
2420
2423
  }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
2421
2424
  };
2422
2425
  }
2423
2426
  });
2424
2427
 
2425
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
2428
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2426
2429
  ...{
2427
2430
  name: "MFormDateRange"
2428
2431
  },
@@ -2524,7 +2527,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2524
2527
  }
2525
2528
  });
2526
2529
 
2527
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2530
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2528
2531
  ...{
2529
2532
  name: "MFormDateTime"
2530
2533
  },
@@ -2564,8 +2567,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2564
2567
  size: _ctx.size,
2565
2568
  placeholder: _ctx.config.placeholder,
2566
2569
  disabled: _ctx.disabled,
2567
- format: _ctx.config.format || "YYYY-MM-DD HH:mm:ss",
2568
- "value-format": _ctx.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
2570
+ format: _ctx.config.format || "YYYY/MM/DD HH:mm:ss",
2571
+ "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
2569
2572
  "default-time": _ctx.config.defaultTime,
2570
2573
  onChange: changeHandler
2571
2574
  }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
@@ -2573,8 +2576,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2573
2576
  }
2574
2577
  });
2575
2578
 
2576
- const _hoisted_1$5 = { key: 0 };
2577
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
2579
+ const _hoisted_1$7 = { key: 0 };
2580
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2578
2581
  ...{
2579
2582
  name: "MFormDisplay"
2580
2583
  },
@@ -2586,6 +2589,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2586
2589
  values: {},
2587
2590
  name: {},
2588
2591
  prop: {},
2592
+ disabled: { type: Boolean },
2593
+ size: {},
2589
2594
  lastValues: {}
2590
2595
  },
2591
2596
  setup(__props) {
@@ -2595,13 +2600,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2595
2600
  }
2596
2601
  useAddField(props.prop);
2597
2602
  return (_ctx, _cache) => {
2598
- return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$5, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
2603
+ return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$7, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
2599
2604
  };
2600
2605
  }
2601
2606
  });
2602
2607
 
2603
- const _hoisted_1$4 = { class: "m-fields-dynamic-field" };
2604
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
2608
+ const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2609
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2605
2610
  ...{
2606
2611
  name: "MFormDynamicField"
2607
2612
  },
@@ -2666,7 +2671,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2666
2671
  emit("change", fieldMap.value[key], key);
2667
2672
  };
2668
2673
  return (_ctx, _cache) => {
2669
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2674
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
2670
2675
  createVNode(unref(TMagicForm), { size: "small" }, {
2671
2676
  default: withCtx(() => [
2672
2677
  (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
@@ -2693,7 +2698,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2693
2698
  }
2694
2699
  });
2695
2700
 
2696
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
2701
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2697
2702
  ...{
2698
2703
  name: "MFormHidden"
2699
2704
  },
@@ -2705,6 +2710,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2705
2710
  values: {},
2706
2711
  name: {},
2707
2712
  prop: {},
2713
+ disabled: { type: Boolean },
2714
+ size: {},
2708
2715
  lastValues: {}
2709
2716
  },
2710
2717
  setup(__props) {
@@ -2722,7 +2729,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2722
2729
  }
2723
2730
  });
2724
2731
 
2725
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
2732
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2726
2733
  ...{
2727
2734
  name: "MForm"
2728
2735
  },
@@ -2741,7 +2748,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2741
2748
  inline: { type: Boolean, default: false },
2742
2749
  labelPosition: { default: "right" },
2743
2750
  keyProp: { default: "__key" },
2744
- popperClass: {}
2751
+ popperClass: {},
2752
+ extendState: {}
2745
2753
  },
2746
2754
  emits: ["change", "field-input", "field-change"],
2747
2755
  setup(__props, { expose: __expose, emit }) {
@@ -2776,7 +2784,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2776
2784
  }
2777
2785
  }
2778
2786
  });
2779
- watchEffect(() => {
2787
+ watchEffect(async () => {
2780
2788
  formState.initValues = props.initValues;
2781
2789
  formState.lastValues = props.lastValues;
2782
2790
  formState.isCompare = props.isCompare;
@@ -2784,6 +2792,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2784
2792
  formState.keyProp = props.keyProp;
2785
2793
  formState.popperClass = props.popperClass;
2786
2794
  formState.parentValues = props.parentValues;
2795
+ if (typeof props.extendState === "function") {
2796
+ const state = await props.extendState(formState) || {};
2797
+ Object.entries(state).forEach(([key, value]) => {
2798
+ formState[key] = value;
2799
+ });
2800
+ }
2787
2801
  });
2788
2802
  provide("mForm", formState);
2789
2803
  watch(
@@ -2854,7 +2868,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2854
2868
  }, {
2855
2869
  default: withCtx(() => [
2856
2870
  initialized.value && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
2857
- return openBlock(), createBlock(_sfc_main$v, {
2871
+ return openBlock(), createBlock(_sfc_main$y, {
2858
2872
  disabled: _ctx.disabled,
2859
2873
  key: item[_ctx.keyProp] ?? index,
2860
2874
  config: item,
@@ -2874,8 +2888,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2874
2888
  }
2875
2889
  });
2876
2890
 
2877
- const _hoisted_1$3 = { style: { "min-height": "1px" } };
2878
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2891
+ const _hoisted_1$5 = { style: { "min-height": "1px" } };
2892
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2879
2893
  ...{
2880
2894
  name: "MFormDialog"
2881
2895
  },
@@ -2889,6 +2903,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2889
2903
  fullscreen: { type: Boolean },
2890
2904
  disabled: { type: Boolean },
2891
2905
  title: {},
2906
+ inline: { type: Boolean },
2907
+ labelPosition: {},
2892
2908
  zIndex: {},
2893
2909
  size: {},
2894
2910
  confirmText: { default: "确定" }
@@ -2919,9 +2935,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2919
2935
  }
2920
2936
  return false;
2921
2937
  });
2922
- const cancel = () => {
2923
- dialogVisible.value = false;
2924
- };
2925
2938
  const closeHandler = () => {
2926
2939
  stepActive.value = 1;
2927
2940
  emit("close");
@@ -2943,12 +2956,23 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2943
2956
  const changeHandler = (value) => {
2944
2957
  emit("change", value);
2945
2958
  };
2959
+ const show = () => {
2960
+ dialogVisible.value = true;
2961
+ };
2962
+ const hide = () => {
2963
+ dialogVisible.value = false;
2964
+ };
2965
+ const cancel = () => {
2966
+ hide();
2967
+ };
2946
2968
  __expose({
2947
2969
  form,
2948
2970
  saveFetch,
2949
2971
  dialogVisible,
2950
2972
  cancel,
2951
- save
2973
+ save,
2974
+ show,
2975
+ hide
2952
2976
  });
2953
2977
  return (_ctx, _cache) => {
2954
2978
  return openBlock(), createBlock(unref(TMagicDialog), {
@@ -2972,7 +2996,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2972
2996
  style: { "text-align": "left" }
2973
2997
  }, {
2974
2998
  default: withCtx(() => [
2975
- createElementVNode("div", _hoisted_1$3, [
2999
+ createElementVNode("div", _hoisted_1$5, [
2976
3000
  renderSlot(_ctx.$slots, "left")
2977
3001
  ])
2978
3002
  ]),
@@ -3015,6 +3039,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3015
3039
  key: 2,
3016
3040
  type: "primary",
3017
3041
  size: "small",
3042
+ disabled: _ctx.disabled,
3018
3043
  loading: saveFetch.value,
3019
3044
  onClick: save
3020
3045
  }, {
@@ -3022,7 +3047,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3022
3047
  createTextVNode(toDisplayString(_ctx.confirmText), 1)
3023
3048
  ]),
3024
3049
  _: 1
3025
- }, 8, ["loading"]))
3050
+ }, 8, ["disabled", "loading"]))
3026
3051
  ])
3027
3052
  ]),
3028
3053
  _: 3
@@ -3037,7 +3062,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3037
3062
  class: "m-dialog-body",
3038
3063
  style: normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
3039
3064
  }, [
3040
- createVNode(_sfc_main$b, {
3065
+ createVNode(_sfc_main$e, {
3041
3066
  modelValue: stepActive.value,
3042
3067
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
3043
3068
  ref_key: "form",
@@ -3048,8 +3073,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3048
3073
  "init-values": _ctx.values,
3049
3074
  "parent-values": _ctx.parentValues,
3050
3075
  "label-width": _ctx.labelWidth,
3076
+ "label-position": _ctx.labelPosition,
3077
+ inline: _ctx.inline,
3051
3078
  onChange: changeHandler
3052
- }, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width"]),
3079
+ }, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
3053
3080
  renderSlot(_ctx.$slots, "default")
3054
3081
  ], 4)) : createCommentVNode("", true)
3055
3082
  ]),
@@ -3059,12 +3086,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3059
3086
  }
3060
3087
  });
3061
3088
 
3062
- const _hoisted_1$2 = ["href"];
3063
- const _hoisted_2 = {
3089
+ const _hoisted_1$4 = ["href"];
3090
+ const _hoisted_2$1 = {
3064
3091
  key: 2,
3065
3092
  class: "m-fields-link"
3066
3093
  };
3067
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3094
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3068
3095
  ...{
3069
3096
  name: "MFormLink"
3070
3097
  },
@@ -3132,10 +3159,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3132
3159
  target: "_blank",
3133
3160
  href: href.value,
3134
3161
  style: normalizeStyle(_ctx.config.css || {})
3135
- }, toDisplayString(displayText.value), 13, _hoisted_1$2)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3162
+ }, toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3136
3163
  key: 1,
3137
3164
  style: normalizeStyle(_ctx.config.disabledCss || {})
3138
- }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2, [
3165
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$1, [
3139
3166
  createVNode(unref(TMagicButton), {
3140
3167
  text: true,
3141
3168
  type: "primary",
@@ -3146,7 +3173,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3146
3173
  ]),
3147
3174
  _: 1
3148
3175
  }),
3149
- createVNode(_sfc_main$a, {
3176
+ createVNode(_sfc_main$d, {
3150
3177
  ref_key: "editor",
3151
3178
  ref: editor,
3152
3179
  title: _ctx.config.formTitle || "编辑扩展配置",
@@ -3162,7 +3189,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3162
3189
  }
3163
3190
  });
3164
3191
 
3165
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3192
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3166
3193
  ...{
3167
3194
  name: "MFormNumber"
3168
3195
  },
@@ -3210,7 +3237,62 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3210
3237
  }
3211
3238
  });
3212
3239
 
3213
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3240
+ const _hoisted_1$3 = { class: "m-fields-number-range" };
3241
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3242
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3243
+ ...{
3244
+ name: "MFormNumberRange"
3245
+ },
3246
+ __name: "NumberRange",
3247
+ props: {
3248
+ config: {},
3249
+ model: {},
3250
+ initValues: {},
3251
+ values: {},
3252
+ name: {},
3253
+ prop: {},
3254
+ disabled: { type: Boolean },
3255
+ size: {},
3256
+ lastValues: {}
3257
+ },
3258
+ emits: ["change"],
3259
+ setup(__props, { emit }) {
3260
+ const props = __props;
3261
+ useAddField(props.prop);
3262
+ if (!Array.isArray(props.model[props.name])) {
3263
+ props.model[props.name] = [];
3264
+ }
3265
+ const minChangeHandler = (v) => {
3266
+ emit("change", [Number(v), props.model[props.name][1]]);
3267
+ };
3268
+ const maxChangeHandler = (v) => {
3269
+ emit("change", [props.model[props.name][0], Number(v)]);
3270
+ };
3271
+ return (_ctx, _cache) => {
3272
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
3273
+ createVNode(unref(TMagicInput), {
3274
+ modelValue: _ctx.model[_ctx.name][0],
3275
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
3276
+ clearable: "",
3277
+ size: _ctx.size,
3278
+ disabled: _ctx.disabled,
3279
+ onChange: minChangeHandler
3280
+ }, null, 8, ["modelValue", "size", "disabled"]),
3281
+ _hoisted_2,
3282
+ createVNode(unref(TMagicInput), {
3283
+ modelValue: _ctx.model[_ctx.name][1],
3284
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
3285
+ clearable: "",
3286
+ size: _ctx.size,
3287
+ disabled: _ctx.disabled,
3288
+ onChange: maxChangeHandler
3289
+ }, null, 8, ["modelValue", "size", "disabled"])
3290
+ ]);
3291
+ };
3292
+ }
3293
+ });
3294
+
3295
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3214
3296
  ...{
3215
3297
  name: "MFormRadioGroup"
3216
3298
  },
@@ -3262,7 +3344,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3262
3344
  }
3263
3345
  });
3264
3346
 
3265
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3347
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3266
3348
  ...{
3267
3349
  name: "MFormSelectOptionGroups"
3268
3350
  },
@@ -3296,7 +3378,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3296
3378
  }
3297
3379
  });
3298
3380
 
3299
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3381
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3300
3382
  ...{
3301
3383
  name: "MFormSelectOptions"
3302
3384
  },
@@ -3319,8 +3401,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3319
3401
  }
3320
3402
  });
3321
3403
 
3322
- const _hoisted_1$1 = { key: 2 };
3323
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3404
+ const _hoisted_1$2 = { key: 2 };
3405
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3324
3406
  ...{
3325
3407
  name: "MFormSelect"
3326
3408
  },
@@ -3660,14 +3742,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3660
3742
  onVisibleChange: visibleHandler
3661
3743
  }, {
3662
3744
  default: withCtx(() => [
3663
- _ctx.config.group ? (openBlock(), createBlock(_sfc_main$6, {
3745
+ _ctx.config.group ? (openBlock(), createBlock(_sfc_main$8, {
3664
3746
  key: 0,
3665
3747
  options: unref(groupOptions)
3666
- }, null, 8, ["options"])) : (openBlock(), createBlock(_sfc_main$5, {
3748
+ }, null, 8, ["options"])) : (openBlock(), createBlock(_sfc_main$7, {
3667
3749
  key: 1,
3668
3750
  options: unref(itemOptions)
3669
3751
  }, null, 8, ["options"])),
3670
- moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$1, null, 512)), [
3752
+ moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
3671
3753
  [_directive_loading, true]
3672
3754
  ]) : createCommentVNode("", true)
3673
3755
  ]),
@@ -3679,7 +3761,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3679
3761
  }
3680
3762
  });
3681
3763
 
3682
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3764
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3683
3765
  ...{
3684
3766
  name: "MFormSwitch"
3685
3767
  },
@@ -3736,8 +3818,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3736
3818
  }
3737
3819
  });
3738
3820
 
3739
- const _hoisted_1 = { key: 0 };
3740
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3821
+ const _hoisted_1$1 = { key: 0 };
3822
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3741
3823
  ...{
3742
3824
  name: "MFormText"
3743
3825
  },
@@ -3841,7 +3923,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3841
3923
  _ctx.config.append ? {
3842
3924
  name: "append",
3843
3925
  fn: withCtx(() => [
3844
- typeof _ctx.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.config.append), 1)) : createCommentVNode("", true),
3926
+ typeof _ctx.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(_ctx.config.append), 1)) : createCommentVNode("", true),
3845
3927
  typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
3846
3928
  key: 1,
3847
3929
  style: { "color": "#409eff" },
@@ -3861,7 +3943,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3861
3943
  }
3862
3944
  });
3863
3945
 
3864
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3946
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3865
3947
  ...{
3866
3948
  name: "MFormTextarea"
3867
3949
  },
@@ -3905,7 +3987,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3905
3987
  }
3906
3988
  });
3907
3989
 
3908
- const _sfc_main = /* @__PURE__ */ defineComponent({
3990
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3909
3991
  ...{
3910
3992
  name: "MFormTime"
3911
3993
  },
@@ -3943,44 +4025,290 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3943
4025
  }
3944
4026
  });
3945
4027
 
4028
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4029
+ ...{
4030
+ name: "MFormTimeRange"
4031
+ },
4032
+ __name: "Timerange",
4033
+ props: {
4034
+ config: {},
4035
+ model: {},
4036
+ initValues: {},
4037
+ values: {},
4038
+ name: {},
4039
+ prop: {},
4040
+ disabled: { type: Boolean },
4041
+ size: {},
4042
+ lastValues: {}
4043
+ },
4044
+ emits: ["change"],
4045
+ setup(__props, { emit }) {
4046
+ const props = __props;
4047
+ useAddField(props.prop);
4048
+ const { names } = props.config;
4049
+ const value = ref([]);
4050
+ if (props.model !== void 0 && names?.length) {
4051
+ watch(
4052
+ [() => props.model[names[0]], () => props.model[names[1]]],
4053
+ ([start, end], [preStart, preEnd]) => {
4054
+ if (!value.value) {
4055
+ value.value = [];
4056
+ }
4057
+ if (!start || !end)
4058
+ value.value = [];
4059
+ if (start !== preStart)
4060
+ value.value[0] = start;
4061
+ if (end !== preEnd)
4062
+ value.value[1] = end;
4063
+ },
4064
+ {
4065
+ immediate: true
4066
+ }
4067
+ );
4068
+ }
4069
+ const setValue = (v) => {
4070
+ names?.forEach((item, index) => {
4071
+ if (!props.model) {
4072
+ return;
4073
+ }
4074
+ if (Array.isArray(v)) {
4075
+ props.model[item] = datetimeFormatter(v[index]?.toString(), "");
4076
+ } else {
4077
+ props.model[item] = void 0;
4078
+ }
4079
+ });
4080
+ };
4081
+ const changeHandler = (v) => {
4082
+ const value2 = v || [];
4083
+ if (names?.length) {
4084
+ setValue(value2);
4085
+ }
4086
+ emit("change", value2);
4087
+ };
4088
+ return (_ctx, _cache) => {
4089
+ return openBlock(), createBlock(unref(TMagicTimePicker), {
4090
+ modelValue: value.value,
4091
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
4092
+ "is-range": "",
4093
+ "range-separator": "-",
4094
+ "start-placeholder": "开始时间",
4095
+ "end-placeholder": "结束时间",
4096
+ size: _ctx.size,
4097
+ "unlink-panels": true,
4098
+ disabled: _ctx.disabled,
4099
+ "default-time": _ctx.config.defaultTime,
4100
+ onChange: changeHandler
4101
+ }, null, 8, ["modelValue", "size", "disabled", "default-time"]);
4102
+ };
4103
+ }
4104
+ });
4105
+
3946
4106
  const index$1 = '';
3947
4107
 
4108
+ const _hoisted_1 = { style: { "min-height": "1px" } };
4109
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4110
+ ...{
4111
+ name: "MFormDialog"
4112
+ },
4113
+ __name: "FormDrawer",
4114
+ props: {
4115
+ config: { default: () => [] },
4116
+ values: { default: () => ({}) },
4117
+ parentValues: {},
4118
+ width: {},
4119
+ labelWidth: {},
4120
+ disabled: { type: Boolean },
4121
+ closeOnPressEscape: { type: Boolean, default: true },
4122
+ title: {},
4123
+ zIndex: {},
4124
+ size: {},
4125
+ confirmText: { default: "确定" },
4126
+ inline: { type: Boolean },
4127
+ labelPosition: {},
4128
+ beforeClose: {}
4129
+ },
4130
+ emits: ["close", "closed", "submit", "error", "change", "open", "opened"],
4131
+ setup(__props, { expose: __expose, emit }) {
4132
+ const drawer = ref();
4133
+ const form = ref();
4134
+ const drawerBody = ref();
4135
+ const visible = ref(false);
4136
+ const saveFetch = ref(false);
4137
+ const bodyHeight = ref(0);
4138
+ watchEffect(() => {
4139
+ if (drawerBody.value) {
4140
+ bodyHeight.value = drawerBody.value.clientHeight;
4141
+ }
4142
+ });
4143
+ const submitHandler = async () => {
4144
+ try {
4145
+ const values = await form.value?.submitForm();
4146
+ emit("submit", values);
4147
+ } catch (e) {
4148
+ emit("error", e);
4149
+ }
4150
+ };
4151
+ const changeHandler = (value) => {
4152
+ emit("change", value);
4153
+ };
4154
+ const openHandler = () => {
4155
+ emit("open");
4156
+ };
4157
+ const openedHandler = () => {
4158
+ emit("opened");
4159
+ };
4160
+ const closeHandler = () => {
4161
+ emit("close");
4162
+ };
4163
+ const closedHandler = () => {
4164
+ emit("closed");
4165
+ };
4166
+ const show = () => {
4167
+ visible.value = true;
4168
+ };
4169
+ const hide = () => {
4170
+ visible.value = false;
4171
+ };
4172
+ const handleClose = () => {
4173
+ drawer.value?.handleClose();
4174
+ };
4175
+ __expose({
4176
+ form,
4177
+ saveFetch,
4178
+ bodyHeight,
4179
+ show,
4180
+ hide,
4181
+ handleClose
4182
+ });
4183
+ return (_ctx, _cache) => {
4184
+ return openBlock(), createBlock(unref(TMagicDrawer), {
4185
+ class: "m-form-drawer",
4186
+ ref_key: "drawer",
4187
+ ref: drawer,
4188
+ modelValue: visible.value,
4189
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
4190
+ title: _ctx.title,
4191
+ "close-on-press-escape": _ctx.closeOnPressEscape,
4192
+ "append-to-body": true,
4193
+ "show-close": true,
4194
+ "close-on-click-modal": true,
4195
+ size: _ctx.width,
4196
+ zIndex: _ctx.zIndex,
4197
+ "before-close": _ctx.beforeClose,
4198
+ onOpen: openHandler,
4199
+ onOpened: openedHandler,
4200
+ onClose: closeHandler,
4201
+ onClosed: closedHandler
4202
+ }, {
4203
+ footer: withCtx(() => [
4204
+ createVNode(unref(TMagicRow), { class: "dialog-footer" }, {
4205
+ default: withCtx(() => [
4206
+ createVNode(unref(TMagicCol), {
4207
+ span: 12,
4208
+ style: { "text-align": "left" }
4209
+ }, {
4210
+ default: withCtx(() => [
4211
+ createElementVNode("div", _hoisted_1, [
4212
+ renderSlot(_ctx.$slots, "left")
4213
+ ])
4214
+ ]),
4215
+ _: 3
4216
+ }),
4217
+ createVNode(unref(TMagicCol), { span: 12 }, {
4218
+ default: withCtx(() => [
4219
+ renderSlot(_ctx.$slots, "footer", {}, () => [
4220
+ createVNode(unref(TMagicButton), { onClick: handleClose }, {
4221
+ default: withCtx(() => [
4222
+ createTextVNode("关闭")
4223
+ ]),
4224
+ _: 1
4225
+ }),
4226
+ createVNode(unref(TMagicButton), {
4227
+ type: "primary",
4228
+ disabled: _ctx.disabled,
4229
+ loading: saveFetch.value,
4230
+ onClick: submitHandler
4231
+ }, {
4232
+ default: withCtx(() => [
4233
+ createTextVNode(toDisplayString(_ctx.confirmText), 1)
4234
+ ]),
4235
+ _: 1
4236
+ }, 8, ["disabled", "loading"])
4237
+ ])
4238
+ ]),
4239
+ _: 3
4240
+ })
4241
+ ]),
4242
+ _: 3
4243
+ })
4244
+ ]),
4245
+ default: withCtx(() => [
4246
+ visible.value ? (openBlock(), createElementBlock("div", {
4247
+ key: 0,
4248
+ ref_key: "drawerBody",
4249
+ ref: drawerBody,
4250
+ class: "m-drawer-body"
4251
+ }, [
4252
+ createVNode(_sfc_main$e, {
4253
+ ref_key: "form",
4254
+ ref: form,
4255
+ size: _ctx.size,
4256
+ disabled: _ctx.disabled,
4257
+ config: _ctx.config,
4258
+ "init-values": _ctx.values,
4259
+ "parent-values": _ctx.parentValues,
4260
+ "label-width": _ctx.labelWidth,
4261
+ "label-position": _ctx.labelPosition,
4262
+ inline: _ctx.inline,
4263
+ onChange: changeHandler
4264
+ }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
4265
+ renderSlot(_ctx.$slots, "default")
4266
+ ], 512)) : createCommentVNode("", true)
4267
+ ]),
4268
+ _: 3
4269
+ }, 8, ["modelValue", "title", "close-on-press-escape", "size", "zIndex", "before-close"]);
4270
+ };
4271
+ }
4272
+ });
4273
+
3948
4274
  const defaultInstallOpt = {};
3949
4275
  const index = {
3950
4276
  install(app, opt = {}) {
3951
4277
  const option = Object.assign(defaultInstallOpt, opt);
3952
4278
  app.config.globalProperties.$MAGIC_FORM = option;
3953
4279
  setConfig(option);
3954
- app.component("m-form", _sfc_main$b);
3955
- app.component("m-form-dialog", _sfc_main$a);
3956
- app.component("m-form-container", _sfc_main$v);
3957
- app.component("m-form-fieldset", _sfc_main$u);
3958
- app.component("m-form-group-list", _sfc_main$s);
3959
- app.component("m-form-panel", _sfc_main$r);
3960
- app.component("m-form-row", _sfc_main$p);
3961
- app.component("m-form-step", _sfc_main$o);
3962
- app.component("m-form-table", _sfc_main$n);
3963
- app.component("m-form-tab", _sfc_main$m);
3964
- app.component("m-fields-text", _sfc_main$2);
3965
- app.component("m-fields-number", _sfc_main$8);
3966
- app.component("m-fields-textarea", _sfc_main$1);
3967
- app.component("m-fields-hidden", _sfc_main$c);
3968
- app.component("m-fields-date", _sfc_main$h);
3969
- app.component("m-fields-datetime", _sfc_main$f);
3970
- app.component("m-fields-daterange", _sfc_main$g);
3971
- app.component("m-fields-time", _sfc_main);
3972
- app.component("m-fields-checkbox", _sfc_main$k);
3973
- app.component("m-fields-switch", _sfc_main$3);
3974
- app.component("m-fields-color-picker", _sfc_main$i);
3975
- app.component("m-fields-checkbox-group", _sfc_main$j);
3976
- app.component("m-fields-radio-group", _sfc_main$7);
3977
- app.component("m-fields-display", _sfc_main$e);
3978
- app.component("m-fields-link", _sfc_main$9);
3979
- app.component("m-fields-select", _sfc_main$4);
3980
- app.component("m-fields-cascader", _sfc_main$l);
3981
- app.component("m-fields-dynamic-field", _sfc_main$d);
4280
+ app.component("m-form", _sfc_main$e);
4281
+ app.component("m-form-dialog", _sfc_main$d);
4282
+ app.component("m-form-container", _sfc_main$y);
4283
+ app.component("m-form-fieldset", _sfc_main$x);
4284
+ app.component("m-form-group-list", _sfc_main$v);
4285
+ app.component("m-form-panel", _sfc_main$u);
4286
+ app.component("m-form-row", _sfc_main$s);
4287
+ app.component("m-form-step", _sfc_main$r);
4288
+ app.component("m-form-table", _sfc_main$q);
4289
+ app.component("m-form-tab", _sfc_main$p);
4290
+ app.component("m-fields-text", _sfc_main$4);
4291
+ app.component("m-fields-number", _sfc_main$b);
4292
+ app.component("m-fields-number-range", _sfc_main$a);
4293
+ app.component("m-fields-textarea", _sfc_main$3);
4294
+ app.component("m-fields-hidden", _sfc_main$f);
4295
+ app.component("m-fields-date", _sfc_main$k);
4296
+ app.component("m-fields-datetime", _sfc_main$i);
4297
+ app.component("m-fields-daterange", _sfc_main$j);
4298
+ app.component("m-fields-timerange", _sfc_main$1);
4299
+ app.component("m-fields-time", _sfc_main$2);
4300
+ app.component("m-fields-checkbox", _sfc_main$n);
4301
+ app.component("m-fields-switch", _sfc_main$5);
4302
+ app.component("m-fields-color-picker", _sfc_main$l);
4303
+ app.component("m-fields-checkbox-group", _sfc_main$m);
4304
+ app.component("m-fields-radio-group", _sfc_main$9);
4305
+ app.component("m-fields-display", _sfc_main$h);
4306
+ app.component("m-fields-link", _sfc_main$c);
4307
+ app.component("m-fields-select", _sfc_main$6);
4308
+ app.component("m-fields-cascader", _sfc_main$o);
4309
+ app.component("m-fields-dynamic-field", _sfc_main$g);
3982
4310
  }
3983
4311
  };
3984
4312
 
3985
- export { _sfc_main$l as MCascader, _sfc_main$k as MCheckbox, _sfc_main$j as MCheckboxGroup, _sfc_main$i as MColorPicker, _sfc_main$v as MContainer, _sfc_main$h as MDate, _sfc_main$f as MDateTime, _sfc_main$g as MDaterange, _sfc_main$e as MDisplay, _sfc_main$d as MDynamicField, _sfc_main$u as MFieldset, _sfc_main$b as MForm, _sfc_main$a as MFormDialog, _sfc_main$s as MGroupList, _sfc_main$c as MHidden, _sfc_main$9 as MLink, _sfc_main$8 as MNumber, _sfc_main$r as MPanel, _sfc_main$7 as MRadioGroup, _sfc_main$p as MRow, _sfc_main$4 as MSelect, _sfc_main$3 as MSwitch, _sfc_main$n as MTable, _sfc_main$m as MTabs, _sfc_main$2 as MText, _sfc_main$1 as MTextarea, _sfc_main as MTime, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
4313
+ export { _sfc_main$o as MCascader, _sfc_main$n as MCheckbox, _sfc_main$m as MCheckboxGroup, _sfc_main$l as MColorPicker, _sfc_main$y as MContainer, _sfc_main$k as MDate, _sfc_main$i as MDateTime, _sfc_main$j as MDaterange, _sfc_main$h as MDisplay, _sfc_main$g as MDynamicField, _sfc_main$x as MFieldset, _sfc_main$e as MForm, _sfc_main$d as MFormDialog, _sfc_main as MFormDrawer, _sfc_main$v as MGroupList, _sfc_main$f as MHidden, _sfc_main$c as MLink, _sfc_main$b as MNumber, _sfc_main$a as MNumberRange, _sfc_main$u as MPanel, _sfc_main$9 as MRadioGroup, _sfc_main$s as MRow, _sfc_main$6 as MSelect, _sfc_main$5 as MSwitch, _sfc_main$q as MTable, _sfc_main$p as MTabs, _sfc_main$4 as MText, _sfc_main$3 as MTextarea, _sfc_main$2 as MTime, _sfc_main$1 as MTimerange, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
3986
4314
  //# sourceMappingURL=tmagic-form.js.map