@tmagic/form 1.3.0-alpha.2 → 1.3.0-alpha.20

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 (85) hide show
  1. package/dist/style.css +21 -0
  2. package/dist/tmagic-form.js +1400 -1187
  3. package/dist/tmagic-form.js.map +1 -1
  4. package/dist/tmagic-form.umd.cjs +1425 -1210
  5. package/dist/tmagic-form.umd.cjs.map +1 -1
  6. package/package.json +10 -11
  7. package/src/Form.vue +14 -2
  8. package/src/FormDialog.vue +20 -6
  9. package/src/FormDrawer.vue +134 -0
  10. package/src/containers/Col.vue +5 -1
  11. package/src/containers/Container.vue +16 -11
  12. package/src/containers/Fieldset.vue +5 -1
  13. package/src/containers/GroupList.vue +7 -2
  14. package/src/containers/GroupListItem.vue +15 -9
  15. package/src/containers/Panel.vue +5 -1
  16. package/src/containers/Row.vue +5 -1
  17. package/src/containers/Step.vue +5 -1
  18. package/src/containers/Table.vue +153 -151
  19. package/src/containers/Tabs.vue +14 -8
  20. package/src/fields/Cascader.vue +7 -13
  21. package/src/fields/Checkbox.vue +7 -13
  22. package/src/fields/CheckboxGroup.vue +9 -15
  23. package/src/fields/ColorPicker.vue +10 -14
  24. package/src/fields/Date.vue +11 -15
  25. package/src/fields/DateTime.vue +12 -16
  26. package/src/fields/Daterange.vue +7 -13
  27. package/src/fields/Display.vue +7 -11
  28. package/src/fields/DynamicField.vue +8 -14
  29. package/src/fields/Hidden.vue +7 -11
  30. package/src/fields/Link.vue +7 -13
  31. package/src/fields/Number.vue +12 -15
  32. package/src/fields/NumberRange.vue +50 -0
  33. package/src/fields/RadioGroup.vue +7 -13
  34. package/src/fields/Select.vue +28 -30
  35. package/src/fields/SelectOptionGroups.vue +7 -3
  36. package/src/fields/SelectOptions.vue +5 -1
  37. package/src/fields/Switch.vue +11 -15
  38. package/src/fields/Text.vue +12 -15
  39. package/src/fields/Textarea.vue +12 -15
  40. package/src/fields/Time.vue +10 -14
  41. package/src/index.ts +43 -37
  42. package/src/schema.ts +27 -5
  43. package/src/theme/form-drawer.scss +11 -0
  44. package/src/theme/index.scss +2 -0
  45. package/src/theme/number-range.scss +8 -0
  46. package/src/theme/panel.scss +6 -0
  47. package/src/utils/config.ts +1 -1
  48. package/src/utils/form.ts +2 -1
  49. package/types/Form.vue.d.ts +11 -6
  50. package/types/FormDialog.vue.d.ts +89 -125
  51. package/types/FormDrawer.vue.d.ts +338 -0
  52. package/types/containers/Col.vue.d.ts +1 -1
  53. package/types/containers/Container.vue.d.ts +6 -3
  54. package/types/containers/Fieldset.vue.d.ts +6 -3
  55. package/types/containers/GroupList.vue.d.ts +1 -1
  56. package/types/containers/GroupListItem.vue.d.ts +1 -1
  57. package/types/containers/Panel.vue.d.ts +3 -3
  58. package/types/containers/Row.vue.d.ts +1 -1
  59. package/types/containers/Step.vue.d.ts +6 -3
  60. package/types/containers/Table.vue.d.ts +9 -6
  61. package/types/containers/Tabs.vue.d.ts +6 -3
  62. package/types/fields/Cascader.vue.d.ts +3 -23
  63. package/types/fields/Checkbox.vue.d.ts +3 -23
  64. package/types/fields/CheckboxGroup.vue.d.ts +3 -23
  65. package/types/fields/ColorPicker.vue.d.ts +2 -24
  66. package/types/fields/Date.vue.d.ts +2 -24
  67. package/types/fields/DateTime.vue.d.ts +2 -24
  68. package/types/fields/Daterange.vue.d.ts +3 -23
  69. package/types/fields/Display.vue.d.ts +2 -18
  70. package/types/fields/DynamicField.vue.d.ts +3 -32
  71. package/types/fields/Hidden.vue.d.ts +2 -18
  72. package/types/fields/Link.vue.d.ts +3 -23
  73. package/types/fields/Number.vue.d.ts +2 -25
  74. package/types/fields/NumberRange.vue.d.ts +12 -0
  75. package/types/fields/RadioGroup.vue.d.ts +3 -23
  76. package/types/fields/Select.vue.d.ts +3 -23
  77. package/types/fields/SelectOptionGroups.vue.d.ts +2 -2
  78. package/types/fields/SelectOptions.vue.d.ts +2 -2
  79. package/types/fields/Switch.vue.d.ts +2 -24
  80. package/types/fields/Text.vue.d.ts +2 -25
  81. package/types/fields/Textarea.vue.d.ts +2 -25
  82. package/types/fields/Time.vue.d.ts +2 -24
  83. package/types/index.d.ts +6 -1
  84. package/types/schema.d.ts +25 -5
  85. package/types/utils/config.d.ts +1 -1
@@ -1,9 +1,9 @@
1
- import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, unref, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, resolveDirective, createSlots, withModifiers } from 'vue';
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
- import { asyncLoadJs, sleep, datetimeFormatter, isNumber } from '@tmagic/utils';
6
+ import { asyncLoadJs, sleep, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
7
7
  import cloneDeep$1 from 'lodash-es/cloneDeep';
8
8
 
9
9
  const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
@@ -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,36 +167,36 @@ const initValue = async (mForm, { initValues, config }) => {
166
167
  return valuesTmp || {};
167
168
  };
168
169
 
169
- const _hoisted_1$b = ["innerHTML"];
170
+ const _hoisted_1$d = ["innerHTML"];
170
171
  const _hoisted_2$7 = ["innerHTML"];
171
- const _hoisted_3$7 = ["innerHTML"];
172
- const _hoisted_4$6 = ["innerHTML"];
173
- const _hoisted_5$4 = ["innerHTML"];
174
- const _hoisted_6$3 = ["innerHTML"];
175
- const _hoisted_7$3 = ["innerHTML"];
176
- const _hoisted_8$2 = ["innerHTML"];
177
- const _hoisted_9$1 = ["innerHTML"];
178
- const _hoisted_10$1 = ["innerHTML"];
172
+ const _hoisted_3$4 = ["innerHTML"];
173
+ const _hoisted_4$3 = ["innerHTML"];
174
+ const _hoisted_5$3 = ["innerHTML"];
175
+ const _hoisted_6$1 = ["innerHTML"];
176
+ const _hoisted_7$1 = ["innerHTML"];
177
+ const _hoisted_8$1 = ["innerHTML"];
178
+ const _hoisted_9 = ["innerHTML"];
179
+ const _hoisted_10 = ["innerHTML"];
179
180
  const _hoisted_11 = ["innerHTML"];
180
181
  const _hoisted_12 = ["innerHTML"];
181
182
  const _hoisted_13 = {
182
183
  key: 5,
183
184
  style: { "text-align": "center" }
184
185
  };
185
- const __default__$v = defineComponent({
186
- name: "MFormContainer"
187
- });
188
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
189
- ...__default__$v,
186
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
187
+ ...{
188
+ name: "MFormContainer"
189
+ },
190
+ __name: "Container",
190
191
  props: {
191
- model: null,
192
+ model: {},
192
193
  lastValues: { default: () => ({}) },
193
- config: null,
194
+ config: {},
194
195
  prop: { default: "" },
195
196
  disabled: { type: Boolean },
196
- labelWidth: null,
197
+ labelWidth: {},
197
198
  expandMore: { type: Boolean, default: false },
198
- stepActive: null,
199
+ stepActive: {},
199
200
  size: { default: "small" },
200
201
  isCompare: { type: Boolean, default: false }
201
202
  },
@@ -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");
@@ -327,94 +329,94 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
327
329
  return (_ctx, _cache) => {
328
330
  const _component_m_fields_hidden = resolveComponent("m-fields-hidden");
329
331
  const _component_Container = resolveComponent("Container", true);
330
- return __props.config ? (openBlock(), createElementBlock("div", {
332
+ return _ctx.config ? (openBlock(), createElementBlock("div", {
331
333
  key: 0,
332
- style: normalizeStyle(__props.config.tip ? "display: flex;align-items: baseline;" : ""),
333
- class: normalizeClass([__props.config.className, "m-form-container"])
334
+ style: normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
335
+ class: normalizeClass(`m-form-container m-container-${type.value || ""} ${_ctx.config.className || ""}`)
334
336
  }, [
335
- unref(type) === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
337
+ type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
336
338
  key: 0,
337
- model: __props.model,
338
- config: __props.config,
339
- name: __props.config.name,
340
- disabled: unref(disabled),
341
- prop: unref(itemProp)
342
- }, null, 8, ["model", "config", "name", "disabled", "prop"])) : unref(items) && !__props.config.text && unref(type) && unref(display$1) ? (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
343
- key: key(__props.config),
344
- size: __props.size,
345
- model: __props.model,
346
- "last-values": __props.lastValues,
347
- "is-compare": __props.isCompare,
348
- config: __props.config,
349
- disabled: unref(disabled),
350
- name: unref(name),
351
- prop: unref(itemProp),
352
- "step-active": __props.stepActive,
339
+ model: _ctx.model,
340
+ config: _ctx.config,
341
+ name: _ctx.config.name,
342
+ disabled: disabled.value,
343
+ prop: itemProp.value
344
+ }, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
345
+ key: key(_ctx.config),
346
+ size: _ctx.size,
347
+ model: _ctx.model,
348
+ "last-values": _ctx.lastValues,
349
+ "is-compare": _ctx.isCompare,
350
+ config: _ctx.config,
351
+ disabled: disabled.value,
352
+ name: name.value,
353
+ prop: itemProp.value,
354
+ "step-active": _ctx.stepActive,
353
355
  "expand-more": expand.value,
354
- "label-width": unref(itemLabelWidth),
356
+ "label-width": itemLabelWidth.value,
355
357
  onChange: onChangeHandler,
356
358
  onAddDiffCount
357
- }, null, 40, ["size", "model", "last-values", "is-compare", "config", "disabled", "name", "prop", "step-active", "expand-more", "label-width"])) : unref(type) && unref(display$1) && !unref(showDiff) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
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
- style: normalizeStyle(__props.config.tip ? "flex: 1" : ""),
360
- class: normalizeClass({ hidden: `${unref(itemLabelWidth)}` === "0" || !__props.config.text }),
361
- prop: unref(itemProp),
362
- "label-width": unref(itemLabelWidth),
363
- rules: unref(rule)
361
+ style: normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
362
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
363
+ prop: itemProp.value,
364
+ "label-width": itemLabelWidth.value,
365
+ rules: rule.value
364
366
  }, {
365
367
  label: withCtx(() => [
366
368
  createElementVNode("span", {
367
- innerHTML: unref(type) === "checkbox" ? "" : __props.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
- unref(tooltip) ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
373
+ tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
372
374
  content: withCtx(() => [
373
- createElementVNode("div", { innerHTML: unref(tooltip) }, null, 8, _hoisted_2$7)
375
+ createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_2$7)
374
376
  ]),
375
377
  default: withCtx(() => [
376
- (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
377
- key: key(__props.config),
378
- size: __props.size,
379
- model: __props.model,
380
- "last-values": __props.lastValues,
381
- config: __props.config,
382
- name: unref(name),
383
- disabled: unref(disabled),
384
- prop: unref(itemProp),
378
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
379
+ key: key(_ctx.config),
380
+ size: _ctx.size,
381
+ model: _ctx.model,
382
+ "last-values": _ctx.lastValues,
383
+ config: _ctx.config,
384
+ name: name.value,
385
+ disabled: disabled.value,
386
+ prop: itemProp.value,
385
387
  onChange: onChangeHandler,
386
388
  onAddDiffCount
387
389
  }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"]))
388
390
  ]),
389
391
  _: 1
390
- })) : (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
391
- key: key(__props.config),
392
- size: __props.size,
393
- model: __props.model,
394
- "last-values": __props.lastValues,
395
- config: __props.config,
396
- name: unref(name),
397
- disabled: unref(disabled),
398
- prop: unref(itemProp),
392
+ })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
393
+ key: key(_ctx.config),
394
+ size: _ctx.size,
395
+ model: _ctx.model,
396
+ "last-values": _ctx.lastValues,
397
+ config: _ctx.config,
398
+ name: name.value,
399
+ disabled: disabled.value,
400
+ prop: itemProp.value,
399
401
  onChange: onChangeHandler,
400
402
  onAddDiffCount
401
403
  }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"])),
402
- unref(extra) && unref(type) !== "table" ? (openBlock(), createElementBlock("div", {
404
+ extra.value && type.value !== "table" ? (openBlock(), createElementBlock("div", {
403
405
  key: 2,
404
- innerHTML: unref(extra),
406
+ innerHTML: extra.value,
405
407
  class: "m-form-tip"
406
- }, null, 8, _hoisted_3$7)) : createCommentVNode("", true)
408
+ }, null, 8, _hoisted_3$4)) : createCommentVNode("", true)
407
409
  ]),
408
410
  _: 1
409
411
  }, 8, ["style", "class", "prop", "label-width", "rules"]),
410
- __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
412
+ _ctx.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
411
413
  key: 0,
412
414
  placement: "left"
413
415
  }, {
414
416
  content: withCtx(() => [
415
417
  createElementVNode("div", {
416
- innerHTML: __props.config.tip
417
- }, null, 8, _hoisted_4$6)
418
+ innerHTML: _ctx.config.tip
419
+ }, null, 8, _hoisted_4$3)
418
420
  ]),
419
421
  default: withCtx(() => [
420
422
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -426,63 +428,63 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
426
428
  ]),
427
429
  _: 1
428
430
  })) : createCommentVNode("", true)
429
- ], 64)) : unref(type) && unref(display$1) && unref(showDiff) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
431
+ ], 64)) : type.value && display$1.value && showDiff.value ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
430
432
  createVNode(unref(TMagicFormItem), {
431
- style: normalizeStyle([__props.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
432
- class: normalizeClass({ hidden: `${unref(itemLabelWidth)}` === "0" || !__props.config.text }),
433
- prop: unref(itemProp),
434
- "label-width": unref(itemLabelWidth),
435
- rules: unref(rule)
433
+ style: normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
434
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
435
+ prop: itemProp.value,
436
+ "label-width": itemLabelWidth.value,
437
+ rules: rule.value
436
438
  }, {
437
439
  label: withCtx(() => [
438
440
  createElementVNode("span", {
439
- innerHTML: unref(type) === "checkbox" ? "" : __props.config.text
440
- }, null, 8, _hoisted_5$4)
441
+ innerHTML: type.value === "checkbox" ? "" : text.value
442
+ }, null, 8, _hoisted_5$3)
441
443
  ]),
442
444
  default: withCtx(() => [
443
- unref(tooltip) ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
445
+ tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
444
446
  content: withCtx(() => [
445
- createElementVNode("div", { innerHTML: unref(tooltip) }, null, 8, _hoisted_6$3)
447
+ createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_6$1)
446
448
  ]),
447
449
  default: withCtx(() => [
448
- (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
449
- key: key(__props.config),
450
- size: __props.size,
451
- model: __props.lastValues,
452
- config: __props.config,
453
- name: unref(name),
454
- disabled: unref(disabled),
455
- prop: unref(itemProp),
450
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
451
+ key: key(_ctx.config),
452
+ size: _ctx.size,
453
+ model: _ctx.lastValues,
454
+ config: _ctx.config,
455
+ name: name.value,
456
+ disabled: disabled.value,
457
+ prop: itemProp.value,
456
458
  onChange: onChangeHandler
457
459
  }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
458
460
  ]),
459
461
  _: 1
460
- })) : (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
461
- key: key(__props.config),
462
- size: __props.size,
463
- model: __props.lastValues,
464
- config: __props.config,
465
- name: unref(name),
466
- disabled: unref(disabled),
467
- prop: unref(itemProp),
462
+ })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
463
+ key: key(_ctx.config),
464
+ size: _ctx.size,
465
+ model: _ctx.lastValues,
466
+ config: _ctx.config,
467
+ name: name.value,
468
+ disabled: disabled.value,
469
+ prop: itemProp.value,
468
470
  onChange: onChangeHandler
469
471
  }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
470
- unref(extra) ? (openBlock(), createElementBlock("div", {
472
+ extra.value ? (openBlock(), createElementBlock("div", {
471
473
  key: 2,
472
- innerHTML: unref(extra),
474
+ innerHTML: extra.value,
473
475
  class: "m-form-tip"
474
- }, null, 8, _hoisted_7$3)) : createCommentVNode("", true)
476
+ }, null, 8, _hoisted_7$1)) : createCommentVNode("", true)
475
477
  ]),
476
478
  _: 1
477
479
  }, 8, ["style", "class", "prop", "label-width", "rules"]),
478
- __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
480
+ _ctx.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
479
481
  key: 0,
480
482
  placement: "left"
481
483
  }, {
482
484
  content: withCtx(() => [
483
485
  createElementVNode("div", {
484
- innerHTML: __props.config.tip
485
- }, null, 8, _hoisted_8$2)
486
+ innerHTML: _ctx.config.tip
487
+ }, null, 8, _hoisted_8$1)
486
488
  ]),
487
489
  default: withCtx(() => [
488
490
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -495,60 +497,60 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
495
497
  _: 1
496
498
  })) : createCommentVNode("", true),
497
499
  createVNode(unref(TMagicFormItem), {
498
- style: normalizeStyle([__props.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
499
- class: normalizeClass({ hidden: `${unref(itemLabelWidth)}` === "0" || !__props.config.text }),
500
- prop: unref(itemProp),
501
- "label-width": unref(itemLabelWidth),
502
- rules: unref(rule)
500
+ style: normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
501
+ class: normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
502
+ prop: itemProp.value,
503
+ "label-width": itemLabelWidth.value,
504
+ rules: rule.value
503
505
  }, {
504
506
  label: withCtx(() => [
505
507
  createElementVNode("span", {
506
- innerHTML: unref(type) === "checkbox" ? "" : __props.config.text
507
- }, null, 8, _hoisted_9$1)
508
+ innerHTML: type.value === "checkbox" ? "" : text.value
509
+ }, null, 8, _hoisted_9)
508
510
  ]),
509
511
  default: withCtx(() => [
510
- unref(tooltip) ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
512
+ tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
511
513
  content: withCtx(() => [
512
- createElementVNode("div", { innerHTML: unref(tooltip) }, null, 8, _hoisted_10$1)
514
+ createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_10)
513
515
  ]),
514
516
  default: withCtx(() => [
515
- (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
516
- key: key(__props.config),
517
- size: __props.size,
518
- model: __props.model,
519
- config: __props.config,
520
- name: unref(name),
521
- disabled: unref(disabled),
522
- prop: unref(itemProp),
517
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
518
+ key: key(_ctx.config),
519
+ size: _ctx.size,
520
+ model: _ctx.model,
521
+ config: _ctx.config,
522
+ name: name.value,
523
+ disabled: disabled.value,
524
+ prop: itemProp.value,
523
525
  onChange: onChangeHandler
524
526
  }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
525
527
  ]),
526
528
  _: 1
527
- })) : (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
528
- key: key(__props.config),
529
- size: __props.size,
530
- model: __props.model,
531
- config: __props.config,
532
- name: unref(name),
533
- disabled: unref(disabled),
534
- prop: unref(itemProp),
529
+ })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
530
+ key: key(_ctx.config),
531
+ size: _ctx.size,
532
+ model: _ctx.model,
533
+ config: _ctx.config,
534
+ name: name.value,
535
+ disabled: disabled.value,
536
+ prop: itemProp.value,
535
537
  onChange: onChangeHandler
536
538
  }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
537
- unref(extra) ? (openBlock(), createElementBlock("div", {
539
+ extra.value ? (openBlock(), createElementBlock("div", {
538
540
  key: 2,
539
- innerHTML: unref(extra),
541
+ innerHTML: extra.value,
540
542
  class: "m-form-tip"
541
543
  }, null, 8, _hoisted_11)) : createCommentVNode("", true)
542
544
  ]),
543
545
  _: 1
544
546
  }, 8, ["style", "class", "prop", "label-width", "rules"]),
545
- __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
547
+ _ctx.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
546
548
  key: 1,
547
549
  placement: "left"
548
550
  }, {
549
551
  content: withCtx(() => [
550
552
  createElementVNode("div", {
551
- innerHTML: __props.config.tip
553
+ innerHTML: _ctx.config.tip
552
554
  }, null, 8, _hoisted_12)
553
555
  ]),
554
556
  default: withCtx(() => [
@@ -561,26 +563,26 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
561
563
  ]),
562
564
  _: 1
563
565
  })) : createCommentVNode("", true)
564
- ], 64)) : unref(items) && unref(display$1) ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
565
- (unref(name) || unref(name) === 0 ? __props.model[unref(name)] : __props.model) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(items), (item) => {
566
+ ], 64)) : items.value && display$1.value ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
567
+ (name.value || name.value === 0 ? _ctx.model[name.value] : _ctx.model) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(items.value, (item) => {
566
568
  return openBlock(), createBlock(_component_Container, {
567
569
  key: key(item),
568
- model: unref(name) || unref(name) === 0 ? __props.model[unref(name)] : __props.model,
569
- "last-values": unref(name) || unref(name) === 0 ? __props.lastValues[unref(name)] || {} : __props.lastValues,
570
- "is-compare": __props.isCompare,
570
+ model: name.value || name.value === 0 ? _ctx.model[name.value] : _ctx.model,
571
+ "last-values": name.value || name.value === 0 ? _ctx.lastValues[name.value] || {} : _ctx.lastValues,
572
+ "is-compare": _ctx.isCompare,
571
573
  config: item,
572
- size: __props.size,
573
- disabled: unref(disabled),
574
- "step-active": __props.stepActive,
574
+ size: _ctx.size,
575
+ disabled: disabled.value,
576
+ "step-active": _ctx.stepActive,
575
577
  "expand-more": expand.value,
576
- "label-width": unref(itemLabelWidth),
577
- prop: unref(itemProp),
578
+ "label-width": itemLabelWidth.value,
579
+ prop: itemProp.value,
578
580
  onChange: onChangeHandler,
579
581
  onAddDiffCount
580
582
  }, null, 8, ["model", "last-values", "is-compare", "config", "size", "disabled", "step-active", "expand-more", "label-width", "prop"]);
581
583
  }), 128)) : createCommentVNode("", true)
582
584
  ], 64)) : createCommentVNode("", true),
583
- __props.config.expand && unref(type) !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_13, [
585
+ _ctx.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_13, [
584
586
  createVNode(unref(TMagicButton), {
585
587
  type: "primary",
586
588
  size: "small",
@@ -599,30 +601,30 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
599
601
  }
600
602
  });
601
603
 
602
- const _hoisted_1$a = ["innerHTML"];
604
+ const _hoisted_1$c = ["innerHTML"];
603
605
  const _hoisted_2$6 = ["innerHTML"];
604
- const _hoisted_3$6 = { key: 1 };
605
- const _hoisted_4$5 = ["innerHTML"];
606
- const _hoisted_5$3 = ["innerHTML"];
607
- const _hoisted_6$2 = {
606
+ const _hoisted_3$3 = { key: 1 };
607
+ const _hoisted_4$2 = ["innerHTML"];
608
+ const _hoisted_5$2 = ["innerHTML"];
609
+ const _hoisted_6 = {
608
610
  key: 2,
609
611
  style: { "display": "flex" }
610
612
  };
611
- const _hoisted_7$2 = { style: { "flex": "1" } };
612
- const _hoisted_8$1 = ["src"];
613
- const __default__$u = defineComponent({
614
- name: "MFormFieldset"
615
- });
616
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
617
- ...__default__$u,
613
+ const _hoisted_7 = { style: { "flex": "1" } };
614
+ const _hoisted_8 = ["src"];
615
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
616
+ ...{
617
+ name: "MFormFieldset"
618
+ },
619
+ __name: "Fieldset",
618
620
  props: {
619
- labelWidth: null,
621
+ labelWidth: {},
620
622
  prop: { default: "" },
621
- size: null,
622
- model: null,
623
+ size: {},
624
+ model: {},
623
625
  lastValues: { default: () => ({}) },
624
626
  isCompare: { type: Boolean, default: false },
625
- config: null,
627
+ config: {},
626
628
  rules: { default: {} },
627
629
  disabled: { type: Boolean }
628
630
  },
@@ -649,30 +651,30 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
649
651
  const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
650
652
  const onAddDiffCount = () => emit("addDiffCount");
651
653
  return (_ctx, _cache) => {
652
- return (unref(name) ? __props.model[unref(name)] : __props.model) ? (openBlock(), createElementBlock("fieldset", {
654
+ return (name.value ? _ctx.model[name.value] : _ctx.model) ? (openBlock(), createElementBlock("fieldset", {
653
655
  key: 0,
654
656
  class: "m-fieldset",
655
- style: normalizeStyle(unref(show) ? "padding: 15px 15px 0 5px;" : "border: 0")
657
+ style: normalizeStyle(show.value ? "padding: 15px 15px 0 5px;" : "border: 0")
656
658
  }, [
657
- unref(name) && __props.config.checkbox ? (openBlock(), createBlock(resolveDynamicComponent(!unref(show) ? "div" : "legend"), { key: 0 }, {
659
+ name.value && _ctx.config.checkbox ? (openBlock(), createBlock(resolveDynamicComponent(!show.value ? "div" : "legend"), { key: 0 }, {
658
660
  default: withCtx(() => [
659
661
  createVNode(unref(TMagicCheckbox), {
660
- modelValue: __props.model[unref(name)].value,
662
+ modelValue: _ctx.model[name.value].value,
661
663
  "onUpdate:modelValue": [
662
- _cache[0] || (_cache[0] = ($event) => __props.model[unref(name)].value = $event),
664
+ _cache[0] || (_cache[0] = ($event) => _ctx.model[name.value].value = $event),
663
665
  change
664
666
  ],
665
- prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.value`,
667
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
666
668
  "true-label": 1,
667
669
  "false-label": 0
668
670
  }, {
669
671
  default: withCtx(() => [
670
672
  createElementVNode("span", {
671
- innerHTML: __props.config.legend
672
- }, null, 8, _hoisted_1$a),
673
- __props.config.extra ? (openBlock(), createElementBlock("span", {
673
+ innerHTML: _ctx.config.legend
674
+ }, null, 8, _hoisted_1$c),
675
+ _ctx.config.extra ? (openBlock(), createElementBlock("span", {
674
676
  key: 0,
675
- innerHTML: __props.config.extra,
677
+ innerHTML: _ctx.config.extra,
676
678
  class: "m-form-tip"
677
679
  }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
678
680
  ]),
@@ -680,30 +682,30 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
680
682
  }, 8, ["modelValue", "prop"])
681
683
  ]),
682
684
  _: 1
683
- })) : (openBlock(), createElementBlock("legend", _hoisted_3$6, [
685
+ })) : (openBlock(), createElementBlock("legend", _hoisted_3$3, [
684
686
  createElementVNode("span", {
685
- innerHTML: __props.config.legend
686
- }, null, 8, _hoisted_4$5),
687
- __props.config.extra ? (openBlock(), createElementBlock("span", {
687
+ innerHTML: _ctx.config.legend
688
+ }, null, 8, _hoisted_4$2),
689
+ _ctx.config.extra ? (openBlock(), createElementBlock("span", {
688
690
  key: 0,
689
- innerHTML: __props.config.extra,
691
+ innerHTML: _ctx.config.extra,
690
692
  class: "m-form-tip"
691
- }, null, 8, _hoisted_5$3)) : createCommentVNode("", true)
693
+ }, null, 8, _hoisted_5$2)) : createCommentVNode("", true)
692
694
  ])),
693
- __props.config.schematic && unref(show) ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
694
- createElementVNode("div", _hoisted_7$2, [
695
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.items, (item, index) => {
696
- return openBlock(), createBlock(_sfc_main$v, {
695
+ _ctx.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
696
+ createElementVNode("div", _hoisted_7, [
697
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (item, index) => {
698
+ return openBlock(), createBlock(_sfc_main$x, {
697
699
  key: key(item, index),
698
- model: unref(name) ? __props.model[unref(name)] : __props.model,
699
- lastValues: unref(name) ? __props.lastValues[unref(name)] : __props.lastValues,
700
- "is-compare": __props.isCompare,
701
- rules: unref(name) ? __props.rules[unref(name)] : [],
700
+ model: name.value ? _ctx.model[name.value] : _ctx.model,
701
+ lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
702
+ "is-compare": _ctx.isCompare,
703
+ rules: name.value ? _ctx.rules[name.value] : [],
702
704
  config: item,
703
- prop: __props.prop,
704
- disabled: __props.disabled,
705
- labelWidth: unref(lWidth),
706
- size: __props.size,
705
+ prop: _ctx.prop,
706
+ disabled: _ctx.disabled,
707
+ labelWidth: lWidth.value,
708
+ size: _ctx.size,
707
709
  onChange: change,
708
710
  onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
709
711
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
@@ -711,20 +713,20 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
711
713
  ]),
712
714
  createElementVNode("img", {
713
715
  class: "m-form-schematic",
714
- src: __props.config.schematic
715
- }, null, 8, _hoisted_8$1)
716
- ])) : unref(show) ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(__props.config.items, (item, index) => {
717
- return openBlock(), createBlock(_sfc_main$v, {
716
+ src: _ctx.config.schematic
717
+ }, null, 8, _hoisted_8)
718
+ ])) : show.value ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.config.items, (item, index) => {
719
+ return openBlock(), createBlock(_sfc_main$x, {
718
720
  key: key(item, index),
719
- model: unref(name) ? __props.model[unref(name)] : __props.model,
720
- lastValues: unref(name) ? __props.lastValues[unref(name)] : __props.lastValues,
721
- "is-compare": __props.isCompare,
722
- rules: unref(name) ? __props.rules[unref(name)] : [],
721
+ model: name.value ? _ctx.model[name.value] : _ctx.model,
722
+ lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
723
+ "is-compare": _ctx.isCompare,
724
+ rules: name.value ? _ctx.rules[name.value] : [],
723
725
  config: item,
724
- prop: __props.prop,
725
- labelWidth: unref(lWidth),
726
- size: __props.size,
727
- disabled: __props.disabled,
726
+ prop: _ctx.prop,
727
+ labelWidth: lWidth.value,
728
+ size: _ctx.size,
729
+ disabled: _ctx.disabled,
728
730
  onChange: change,
729
731
  onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
730
732
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
@@ -734,35 +736,30 @@ 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$5 = /* @__PURE__ */ createTextVNode("上移");
739
- const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("下移");
740
- const _hoisted_4$4 = ["innerHTML"];
741
- const __default__$t = defineComponent({
742
- name: "MFormGroupListItem"
743
- });
744
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
745
- ...__default__$t,
739
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
740
+ const _hoisted_2$5 = ["innerHTML"];
741
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
742
+ ...{
743
+ name: "MFormGroupListItem"
744
+ },
745
+ __name: "GroupListItem",
746
746
  props: {
747
- model: null,
748
- lastValues: null,
747
+ model: {},
748
+ lastValues: {},
749
749
  isCompare: { type: Boolean },
750
- groupModel: null,
751
- config: null,
752
- labelWidth: null,
753
- prop: null,
754
- size: null,
755
- index: null,
750
+ groupModel: {},
751
+ config: {},
752
+ labelWidth: {},
753
+ prop: {},
754
+ size: {},
755
+ index: {},
756
756
  disabled: { type: Boolean }
757
757
  },
758
758
  emits: ["swap-item", "remove-item", "change", "addDiffCount"],
759
759
  setup(__props, { emit }) {
760
760
  const props = __props;
761
761
  const mForm = inject("mForm");
762
- const expand = ref(false);
763
- watchEffect(() => {
764
- expand.value = !props.index;
765
- });
762
+ const expand = ref(props.config.expandAll || !props.index);
766
763
  const rowConfig = computed(() => ({
767
764
  type: "row",
768
765
  span: props.config.span || 24,
@@ -774,7 +771,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
774
771
  if (props.config.titleKey && props.model[props.config.titleKey]) {
775
772
  return props.model[props.config.titleKey];
776
773
  }
777
- 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)}`;
778
779
  });
779
780
  const length = computed(() => props.groupModel?.length || 0);
780
781
  const itemExtra = computed(() => filterFunction(mForm, props.config.itemExtra, props));
@@ -790,7 +791,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
790
791
  }
791
792
  return true;
792
793
  };
793
- 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);
794
795
  const movable = () => {
795
796
  const { movable: movable2 } = props.config;
796
797
  if (movable2 === void 0)
@@ -802,16 +803,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
802
803
  };
803
804
  const onAddDiffCount = () => emit("addDiffCount");
804
805
  return (_ctx, _cache) => {
805
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
806
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
806
807
  createElementVNode("div", null, [
807
808
  createVNode(unref(TMagicButton), {
808
809
  text: "",
809
- disabled: __props.disabled,
810
+ disabled: _ctx.disabled,
810
811
  icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
811
812
  onClick: expandHandler
812
813
  }, {
813
814
  default: withCtx(() => [
814
- createTextVNode(toDisplayString(unref(title)), 1)
815
+ createTextVNode(toDisplayString(title.value), 1)
815
816
  ]),
816
817
  _: 1
817
818
  }, 8, ["disabled", "icon"]),
@@ -819,20 +820,20 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
819
820
  style: { "color": "#f56c6c" },
820
821
  text: "",
821
822
  icon: unref(Delete),
822
- disabled: __props.disabled,
823
+ disabled: _ctx.disabled,
823
824
  onClick: removeHandler
824
825
  }, null, 8, ["icon", "disabled"]), [
825
- [vShow, showDelete(parseInt(String(__props.index)))]
826
+ [vShow, showDelete(parseInt(String(_ctx.index)))]
826
827
  ]),
827
828
  movable() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
828
829
  withDirectives(createVNode(unref(TMagicButton), {
829
830
  text: "",
830
- disabled: __props.disabled,
831
+ disabled: _ctx.disabled,
831
832
  size: "small",
832
833
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
833
834
  }, {
834
835
  default: withCtx(() => [
835
- _hoisted_2$5,
836
+ createTextVNode("上移"),
836
837
  createVNode(unref(TMagicIcon), null, {
837
838
  default: withCtx(() => [
838
839
  createVNode(unref(CaretTop))
@@ -842,16 +843,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
842
843
  ]),
843
844
  _: 1
844
845
  }, 8, ["disabled"]), [
845
- [vShow, __props.index !== 0]
846
+ [vShow, _ctx.index !== 0]
846
847
  ]),
847
848
  withDirectives(createVNode(unref(TMagicButton), {
848
- disabled: __props.disabled,
849
+ disabled: _ctx.disabled,
849
850
  text: "",
850
851
  size: "small",
851
852
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
852
853
  }, {
853
854
  default: withCtx(() => [
854
- _hoisted_3$5,
855
+ createTextVNode("下移"),
855
856
  createVNode(unref(TMagicIcon), null, {
856
857
  default: withCtx(() => [
857
858
  createVNode(unref(CaretBottom))
@@ -861,25 +862,25 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
861
862
  ]),
862
863
  _: 1
863
864
  }, 8, ["disabled"]), [
864
- [vShow, __props.index !== unref(length) - 1]
865
+ [vShow, _ctx.index !== length.value - 1]
865
866
  ])
866
867
  ], 64)) : createCommentVNode("", true),
867
- unref(itemExtra) ? (openBlock(), createElementBlock("span", {
868
+ itemExtra.value ? (openBlock(), createElementBlock("span", {
868
869
  key: 1,
869
- innerHTML: unref(itemExtra),
870
+ innerHTML: itemExtra.value,
870
871
  class: "m-form-tip"
871
- }, null, 8, _hoisted_4$4)) : createCommentVNode("", true)
872
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("", true)
872
873
  ]),
873
- expand.value ? (openBlock(), createBlock(_sfc_main$v, {
874
+ expand.value ? (openBlock(), createBlock(_sfc_main$x, {
874
875
  key: 0,
875
- config: unref(rowConfig),
876
- model: __props.model,
877
- lastValues: __props.lastValues,
878
- "is-compare": __props.isCompare,
879
- labelWidth: __props.labelWidth,
880
- prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
881
- size: __props.size,
882
- disabled: __props.disabled,
876
+ config: rowConfig.value,
877
+ model: _ctx.model,
878
+ lastValues: _ctx.lastValues,
879
+ "is-compare": _ctx.isCompare,
880
+ labelWidth: _ctx.labelWidth,
881
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${String(_ctx.index)}`,
882
+ size: _ctx.size,
883
+ disabled: _ctx.disabled,
883
884
  onChange: changeHandler,
884
885
  onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
885
886
  }, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("", true)
@@ -888,32 +889,30 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
888
889
  }
889
890
  });
890
891
 
891
- const _hoisted_1$8 = { class: "m-fields-group-list" };
892
+ const _hoisted_1$a = { class: "m-fields-group-list" };
892
893
  const _hoisted_2$4 = ["innerHTML"];
893
- const _hoisted_3$4 = {
894
+ const _hoisted_3$2 = {
894
895
  key: 1,
895
896
  class: "el-table__empty-block"
896
897
  };
897
- const _hoisted_4$3 = /* @__PURE__ */ createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
898
- const _hoisted_5$2 = [
899
- _hoisted_4$3
898
+ const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
899
+ const _hoisted_5$1 = [
900
+ _hoisted_4$1
900
901
  ];
901
- const _hoisted_6$1 = /* @__PURE__ */ createTextVNode("添加组");
902
- const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("切换为表格");
903
- const __default__$s = defineComponent({
904
- name: "MFormGroupList"
905
- });
906
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
907
- ...__default__$s,
902
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
903
+ ...{
904
+ name: "MFormGroupList"
905
+ },
906
+ __name: "GroupList",
908
907
  props: {
909
- model: null,
910
- lastValues: null,
908
+ model: {},
909
+ lastValues: {},
911
910
  isCompare: { type: Boolean },
912
- config: null,
913
- name: null,
914
- labelWidth: null,
915
- prop: null,
916
- size: null,
911
+ config: {},
912
+ name: {},
913
+ labelWidth: {},
914
+ prop: {},
915
+ size: {},
917
916
  disabled: { type: Boolean }
918
917
  },
919
918
  emits: ["change", "addDiffCount"],
@@ -983,50 +982,50 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
983
982
  const onAddDiffCount = () => emit("addDiffCount");
984
983
  const getLastValues = (item, index) => item?.[index] || {};
985
984
  return (_ctx, _cache) => {
986
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
987
- __props.config.extra ? (openBlock(), createElementBlock("div", {
985
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
986
+ _ctx.config.extra ? (openBlock(), createElementBlock("div", {
988
987
  key: 0,
989
- innerHTML: __props.config.extra,
988
+ innerHTML: _ctx.config.extra,
990
989
  style: { "color": "rgba(0, 0, 0, 0.45)" }
991
990
  }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
992
- !__props.model[__props.name] || !__props.model[__props.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$4, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(__props.model[__props.name], (item, index) => {
993
- return openBlock(), createBlock(_sfc_main$t, {
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) => {
992
+ return openBlock(), createBlock(_sfc_main$v, {
994
993
  key: index,
995
994
  model: item,
996
- lastValues: getLastValues(__props.lastValues[__props.name], index),
997
- "is-compare": __props.isCompare,
998
- config: __props.config,
999
- prop: __props.prop,
995
+ lastValues: getLastValues(_ctx.lastValues[_ctx.name], index),
996
+ "is-compare": _ctx.isCompare,
997
+ config: _ctx.config,
998
+ prop: _ctx.prop,
1000
999
  index,
1001
- "label-width": __props.labelWidth,
1002
- size: __props.size,
1003
- disabled: __props.disabled,
1004
- "group-model": __props.model[__props.name],
1000
+ "label-width": _ctx.labelWidth,
1001
+ size: _ctx.size,
1002
+ disabled: _ctx.disabled,
1003
+ "group-model": _ctx.model[_ctx.name],
1005
1004
  onRemoveItem: removeHandler,
1006
1005
  onSwapItem: swapHandler,
1007
1006
  onChange: changeHandler,
1008
1007
  onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
1009
1008
  }, null, 8, ["model", "lastValues", "is-compare", "config", "prop", "index", "label-width", "size", "disabled", "group-model"]);
1010
1009
  }), 128)),
1011
- unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
1010
+ addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1012
1011
  key: 3,
1013
1012
  onClick: addHandler,
1014
1013
  size: "small",
1015
- disabled: __props.disabled
1014
+ disabled: _ctx.disabled
1016
1015
  }, {
1017
1016
  default: withCtx(() => [
1018
- _hoisted_6$1
1017
+ createTextVNode("新增")
1019
1018
  ]),
1020
1019
  _: 1
1021
1020
  }, 8, ["disabled"])) : createCommentVNode("", true),
1022
- __props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
1021
+ _ctx.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
1023
1022
  key: 4,
1024
1023
  icon: unref(Grid),
1025
1024
  size: "small",
1026
1025
  onClick: toggleMode
1027
1026
  }, {
1028
1027
  default: withCtx(() => [
1029
- _hoisted_7$1
1028
+ createTextVNode("切换为表格")
1030
1029
  ]),
1031
1030
  _: 1
1032
1031
  }, 8, ["icon"])) : createCommentVNode("", true)
@@ -1035,28 +1034,28 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1035
1034
  }
1036
1035
  });
1037
1036
 
1038
- const _hoisted_1$7 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1037
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1039
1038
  const _hoisted_2$3 = ["innerHTML"];
1040
- const _hoisted_3$3 = {
1039
+ const _hoisted_3$1 = {
1041
1040
  key: 0,
1042
1041
  style: { "display": "flex" }
1043
1042
  };
1044
- const _hoisted_4$2 = { style: { "flex": "1" } };
1045
- const _hoisted_5$1 = ["src"];
1046
- const __default__$r = defineComponent({
1047
- name: "MFormPanel"
1048
- });
1049
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1050
- ...__default__$r,
1043
+ const _hoisted_4 = { style: { "flex": "1" } };
1044
+ const _hoisted_5 = ["src"];
1045
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1046
+ ...{
1047
+ name: "MFormPanel"
1048
+ },
1049
+ __name: "Panel",
1051
1050
  props: {
1052
- model: null,
1053
- lastValues: null,
1051
+ model: {},
1052
+ lastValues: {},
1054
1053
  isCompare: { type: Boolean },
1055
- config: null,
1056
- name: null,
1057
- labelWidth: null,
1058
- prop: null,
1059
- size: null,
1054
+ config: {},
1055
+ name: {},
1056
+ labelWidth: {},
1057
+ prop: {},
1058
+ size: {},
1060
1059
  disabled: { type: Boolean }
1061
1060
  },
1062
1061
  emits: ["change", "addDiffCount"],
@@ -1069,45 +1068,45 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1069
1068
  const changeHandler = () => emit("change", props.model);
1070
1069
  const onAddDiffCount = () => emit("addDiffCount");
1071
1070
  return (_ctx, _cache) => {
1072
- return unref(items) && unref(items).length ? (openBlock(), createBlock(unref(TMagicCard), {
1071
+ return items.value && items.value.length ? (openBlock(), createBlock(unref(TMagicCard), {
1073
1072
  key: 0,
1074
1073
  class: "box-card m-form-panel",
1075
1074
  "body-style": { display: expand.value ? "block" : "none" }
1076
1075
  }, {
1077
1076
  header: withCtx(() => [
1078
- createElementVNode("div", _hoisted_1$7, [
1077
+ createElementVNode("div", _hoisted_1$9, [
1079
1078
  createVNode(unref(TMagicButton), {
1080
1079
  style: { "padding": "0" },
1081
1080
  text: "",
1082
1081
  icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
1083
1082
  onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
1084
1083
  }, null, 8, ["icon"]),
1085
- __props.config && __props.config.extra ? (openBlock(), createElementBlock("span", {
1084
+ _ctx.config && _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1086
1085
  key: 0,
1087
- innerHTML: __props.config.extra,
1086
+ innerHTML: _ctx.config.extra,
1088
1087
  class: "m-form-tip"
1089
1088
  }, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
1090
1089
  renderSlot(_ctx.$slots, "header", {}, () => [
1091
- createTextVNode(toDisplayString(filter(__props.config.title)), 1)
1090
+ createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
1092
1091
  ])
1093
1092
  ])
1094
1093
  ]),
1095
1094
  default: withCtx(() => [
1096
1095
  createElementVNode("div", null, [
1097
1096
  renderSlot(_ctx.$slots, "default"),
1098
- __props.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
1099
- createElementVNode("div", _hoisted_4$2, [
1100
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
1101
- return openBlock(), createBlock(_sfc_main$v, {
1097
+ _ctx.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
1098
+ createElementVNode("div", _hoisted_4, [
1099
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
1100
+ return openBlock(), createBlock(_sfc_main$x, {
1102
1101
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1103
1102
  config: item,
1104
- model: __props.name ? __props.model[__props.name] : __props.model,
1105
- lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
1106
- "is-compare": __props.isCompare,
1107
- prop: __props.prop,
1108
- size: __props.size,
1109
- disabled: __props.disabled,
1110
- "label-width": __props.config.labelWidth || __props.labelWidth,
1103
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1104
+ lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
1105
+ "is-compare": _ctx.isCompare,
1106
+ prop: _ctx.prop,
1107
+ size: _ctx.size,
1108
+ disabled: _ctx.disabled,
1109
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1111
1110
  onChange: changeHandler,
1112
1111
  onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1113
1112
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
@@ -1115,19 +1114,19 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1115
1114
  ]),
1116
1115
  createElementVNode("img", {
1117
1116
  class: "m-form-schematic",
1118
- src: __props.config.schematic
1119
- }, null, 8, _hoisted_5$1)
1120
- ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(items), (item, index) => {
1121
- return openBlock(), createBlock(_sfc_main$v, {
1117
+ src: _ctx.config.schematic
1118
+ }, null, 8, _hoisted_5)
1119
+ ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(items.value, (item, index) => {
1120
+ return openBlock(), createBlock(_sfc_main$x, {
1122
1121
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1123
1122
  config: item,
1124
- model: __props.name ? __props.model[__props.name] : __props.model,
1125
- lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
1126
- "is-compare": __props.isCompare,
1127
- prop: __props.prop,
1128
- size: __props.size,
1129
- disabled: __props.disabled,
1130
- "label-width": __props.config.labelWidth || __props.labelWidth,
1123
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1124
+ lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
1125
+ "is-compare": _ctx.isCompare,
1126
+ prop: _ctx.prop,
1127
+ size: _ctx.size,
1128
+ disabled: _ctx.disabled,
1129
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1131
1130
  onChange: changeHandler,
1132
1131
  onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
1133
1132
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
@@ -1140,21 +1139,21 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1140
1139
  }
1141
1140
  });
1142
1141
 
1143
- const __default__$q = defineComponent({
1144
- name: "MFormCol"
1145
- });
1146
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1147
- ...__default__$q,
1142
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1143
+ ...{
1144
+ name: "MFormCol"
1145
+ },
1146
+ __name: "Col",
1148
1147
  props: {
1149
- model: null,
1150
- lastValues: null,
1148
+ model: {},
1149
+ lastValues: {},
1151
1150
  isCompare: { type: Boolean },
1152
- config: null,
1153
- labelWidth: null,
1151
+ config: {},
1152
+ labelWidth: {},
1154
1153
  expandMore: { type: Boolean },
1155
- span: null,
1156
- size: null,
1157
- prop: null,
1154
+ span: {},
1155
+ size: {},
1156
+ prop: {},
1158
1157
  disabled: { type: Boolean }
1159
1158
  },
1160
1159
  emits: ["change", "addDiffCount"],
@@ -1165,44 +1164,44 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1165
1164
  const changeHandler = () => emit("change", props.model);
1166
1165
  const onAddDiffCount = () => emit("addDiffCount");
1167
1166
  return (_ctx, _cache) => {
1168
- return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: __props.span }, {
1167
+ return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: _ctx.span }, {
1169
1168
  default: withCtx(() => [
1170
- createVNode(_sfc_main$v, {
1171
- model: __props.model,
1172
- lastValues: __props.lastValues,
1173
- "is-compare": __props.isCompare,
1174
- config: __props.config,
1175
- prop: __props.prop,
1176
- "label-width": __props.config.labelWidth || __props.labelWidth,
1177
- "expand-more": __props.expandMore,
1178
- size: __props.size,
1179
- disabled: __props.disabled,
1169
+ createVNode(_sfc_main$x, {
1170
+ model: _ctx.model,
1171
+ lastValues: _ctx.lastValues,
1172
+ "is-compare": _ctx.isCompare,
1173
+ config: _ctx.config,
1174
+ prop: _ctx.prop,
1175
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1176
+ "expand-more": _ctx.expandMore,
1177
+ size: _ctx.size,
1178
+ disabled: _ctx.disabled,
1180
1179
  onChange: changeHandler,
1181
1180
  onAddDiffCount
1182
1181
  }, null, 8, ["model", "lastValues", "is-compare", "config", "prop", "label-width", "expand-more", "size", "disabled"])
1183
1182
  ]),
1184
1183
  _: 1
1185
1184
  }, 8, ["span"])), [
1186
- [vShow, unref(display$1) && __props.config.type !== "hidden"]
1185
+ [vShow, display$1.value && _ctx.config.type !== "hidden"]
1187
1186
  ]);
1188
1187
  };
1189
1188
  }
1190
1189
  });
1191
1190
 
1192
- const __default__$p = defineComponent({
1193
- name: "MFormRow"
1194
- });
1195
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
1196
- ...__default__$p,
1191
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1192
+ ...{
1193
+ name: "MFormRow"
1194
+ },
1195
+ __name: "Row",
1197
1196
  props: {
1198
- model: null,
1199
- lastValues: null,
1197
+ model: {},
1198
+ lastValues: {},
1200
1199
  isCompare: { type: Boolean },
1201
- config: null,
1202
- name: null,
1203
- labelWidth: null,
1204
- prop: null,
1205
- size: null,
1200
+ config: {},
1201
+ name: {},
1202
+ labelWidth: {},
1203
+ prop: {},
1204
+ size: {},
1206
1205
  expandMore: { type: Boolean },
1207
1206
  disabled: { type: Boolean }
1208
1207
  },
@@ -1215,19 +1214,19 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1215
1214
  return (_ctx, _cache) => {
1216
1215
  return openBlock(), createBlock(unref(TMagicRow), { gutter: 10 }, {
1217
1216
  default: withCtx(() => [
1218
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.items, (col, index) => {
1219
- return openBlock(), createBlock(_sfc_main$q, {
1217
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (col, index) => {
1218
+ return openBlock(), createBlock(_sfc_main$s, {
1220
1219
  key: col[unref(mForm)?.keyProp || "__key"] ?? index,
1221
- span: col.span || __props.config.span || 24 / __props.config.items.length,
1220
+ span: col.span || _ctx.config.span || 24 / _ctx.config.items.length,
1222
1221
  config: col,
1223
- labelWidth: __props.config.labelWidth || __props.labelWidth,
1224
- expandMore: __props.expandMore,
1225
- model: __props.name ? __props.model[__props.name] : __props.model,
1226
- lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
1227
- "is-compare": __props.isCompare,
1228
- prop: __props.prop,
1229
- size: __props.size,
1230
- disabled: __props.disabled,
1222
+ labelWidth: _ctx.config.labelWidth || _ctx.labelWidth,
1223
+ expandMore: _ctx.expandMore,
1224
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1225
+ lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
1226
+ "is-compare": _ctx.isCompare,
1227
+ prop: _ctx.prop,
1228
+ size: _ctx.size,
1229
+ disabled: _ctx.disabled,
1231
1230
  onChange: changeHandler,
1232
1231
  onAddDiffCount
1233
1232
  }, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "lastValues", "is-compare", "prop", "size", "disabled"]);
@@ -1239,19 +1238,19 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1239
1238
  }
1240
1239
  });
1241
1240
 
1242
- const __default__$o = defineComponent({
1243
- name: "MFormStep"
1244
- });
1245
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
1246
- ...__default__$o,
1241
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1242
+ ...{
1243
+ name: "MFormStep"
1244
+ },
1245
+ __name: "Step",
1247
1246
  props: {
1248
- model: null,
1249
- lastValues: null,
1247
+ model: {},
1248
+ lastValues: {},
1250
1249
  isCompare: { type: Boolean },
1251
- config: null,
1250
+ config: {},
1252
1251
  stepActive: { default: 1 },
1253
- labelWidth: null,
1254
- size: null,
1252
+ labelWidth: {},
1253
+ size: {},
1255
1254
  disabled: { type: Boolean }
1256
1255
  },
1257
1256
  emits: ["change", "addDiffCount"],
@@ -1275,10 +1274,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1275
1274
  createVNode(unref(TMagicSteps), {
1276
1275
  active: active.value,
1277
1276
  "align-center": "",
1278
- space: __props.config.space
1277
+ space: _ctx.config.space
1279
1278
  }, {
1280
1279
  default: withCtx(() => [
1281
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.items, (item, index) => {
1280
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (item, index) => {
1282
1281
  return openBlock(), createBlock(unref(TMagicStep), {
1283
1282
  key: item.__key,
1284
1283
  title: item.title,
@@ -1289,20 +1288,20 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1289
1288
  ]),
1290
1289
  _: 1
1291
1290
  }, 8, ["active", "space"]),
1292
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.items, (step, index) => {
1291
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (step, index) => {
1293
1292
  return openBlock(), createElementBlock(Fragment, null, [
1294
1293
  (openBlock(true), createElementBlock(Fragment, null, renderList(step.items, (item) => {
1295
1294
  return openBlock(), createElementBlock(Fragment, null, [
1296
- item ? withDirectives((openBlock(), createBlock(_sfc_main$v, {
1295
+ item ? withDirectives((openBlock(), createBlock(_sfc_main$x, {
1297
1296
  key: item[unref(mForm)?.keyProp || "__key"],
1298
1297
  config: item,
1299
- model: step.name ? __props.model[step.name] : __props.model,
1300
- lastValues: step.name ? __props.lastValues[step.name] : __props.lastValues,
1301
- "is-compare": __props.isCompare,
1298
+ model: step.name ? _ctx.model[step.name] : _ctx.model,
1299
+ lastValues: step.name ? _ctx.lastValues[step.name] : _ctx.lastValues,
1300
+ "is-compare": _ctx.isCompare,
1302
1301
  prop: `${step.name}`,
1303
- size: __props.size,
1304
- disabled: __props.disabled,
1305
- "label-width": __props.config.labelWidth || __props.labelWidth,
1302
+ size: _ctx.size,
1303
+ disabled: _ctx.disabled,
1304
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1306
1305
  onChange: changeHandler,
1307
1306
  onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
1308
1307
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"])), [
@@ -1317,43 +1316,36 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1317
1316
  }
1318
1317
  });
1319
1318
 
1320
- const _hoisted_1$6 = ["innerHTML"];
1321
- const _hoisted_2$2 = { class: "el-form-item__content" };
1322
- const _hoisted_3$2 = ["innerHTML"];
1323
- const _hoisted_4$1 = /* @__PURE__ */ createTextVNode("添加");
1324
- const _hoisted_5 = /* @__PURE__ */ createTextVNode("   ");
1325
- const _hoisted_6 = /* @__PURE__ */ createTextVNode("展开配置");
1326
- const _hoisted_7 = /* @__PURE__ */ createTextVNode("导入EXCEL");
1327
- const _hoisted_8 = /* @__PURE__ */ createTextVNode("  ");
1328
- const _hoisted_9 = /* @__PURE__ */ createTextVNode("清空");
1329
- const _hoisted_10 = {
1330
- key: 1,
1319
+ const _hoisted_1$8 = ["innerHTML"];
1320
+ const _hoisted_2$2 = ["innerHTML"];
1321
+ const _hoisted_3 = {
1322
+ key: 6,
1331
1323
  class: "bottom",
1332
1324
  style: { "text-align": "right" }
1333
1325
  };
1334
- const __default__$n = defineComponent({
1335
- name: "MFormTable"
1336
- });
1337
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
1338
- ...__default__$n,
1326
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1327
+ ...{
1328
+ name: "MFormTable"
1329
+ },
1330
+ __name: "Table",
1339
1331
  props: {
1340
- model: null,
1332
+ model: {},
1341
1333
  lastValues: { default: () => ({}) },
1342
1334
  isCompare: { type: Boolean, default: false },
1343
- config: null,
1344
- name: null,
1335
+ config: {},
1336
+ name: {},
1345
1337
  prop: { default: "" },
1346
- labelWidth: null,
1338
+ labelWidth: {},
1347
1339
  sort: { type: Boolean },
1348
1340
  disabled: { type: Boolean },
1349
1341
  sortKey: { default: "" },
1350
- text: null,
1351
- size: null,
1342
+ text: {},
1343
+ size: {},
1352
1344
  enableToggleMode: { type: Boolean, default: true },
1353
1345
  showIndex: { type: Boolean, default: true }
1354
1346
  },
1355
1347
  emits: ["change", "select", "addDiffCount"],
1356
- setup(__props, { expose, emit }) {
1348
+ setup(__props, { expose: __expose, emit }) {
1357
1349
  const props = __props;
1358
1350
  let timer = null;
1359
1351
  const mForm = inject("mForm");
@@ -1673,266 +1665,264 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1673
1665
  return `${prop.value}${prop.value ? "." : ""}${index + 1 + pagecontext.value * pagesize.value - 1}`;
1674
1666
  };
1675
1667
  const onAddDiffCount = () => emit("addDiffCount");
1676
- expose({
1668
+ __expose({
1677
1669
  toggleRowSelection
1678
1670
  });
1679
1671
  return (_ctx, _cache) => {
1680
1672
  return openBlock(), createElementBlock("div", {
1681
1673
  ref_key: "mTable",
1682
1674
  ref: mTable,
1683
- class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
1675
+ class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1684
1676
  }, [
1685
- __props.config.extra ? (openBlock(), createElementBlock("span", {
1677
+ _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1686
1678
  key: 0,
1687
1679
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1688
- innerHTML: __props.config.extra
1689
- }, null, 8, _hoisted_1$6)) : createCommentVNode("", true),
1690
- createElementVNode("div", _hoisted_2$2, [
1691
- createVNode(unref(TMagicTooltip), {
1692
- content: "拖拽可排序",
1693
- placement: "left-start",
1694
- disabled: __props.config.dropSort !== true
1695
- }, {
1696
- default: withCtx(() => [
1697
- __props.model[unref(modelName)] ? (openBlock(), createBlock(unref(TMagicTable), {
1698
- ref_key: "tMagicTable",
1699
- ref: tMagicTable,
1700
- style: { "width": "100%" },
1701
- "row-key": __props.config.rowKey || "id",
1702
- data: unref(data),
1703
- lastData: unref(lastData),
1704
- border: __props.config.border,
1705
- "max-height": __props.config.maxHeight,
1706
- "default-expand-all": true,
1707
- key: updateKey.value,
1708
- onSelect: selectHandle,
1709
- onSortChange: sortChange
1710
- }, {
1711
- default: withCtx(() => [
1712
- __props.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1713
- key: 0,
1714
- fixed: "left",
1715
- width: "30",
1716
- type: "expand"
1717
- }, {
1718
- default: withCtx((scope) => [
1719
- createElementVNode("span", {
1720
- innerHTML: itemExtra(__props.config.itemExtra, scope.$index),
1721
- class: "m-form-tip"
1722
- }, null, 8, _hoisted_3$2)
1723
- ]),
1724
- _: 1
1725
- })) : createCommentVNode("", true),
1726
- createVNode(unref(TMagicTableColumn), {
1727
- label: "操作",
1728
- width: __props.config.operateColWidth || 55,
1729
- align: "center",
1730
- fixed: __props.config.fixed === false ? void 0 : "left"
1731
- }, {
1732
- default: withCtx((scope) => [
1733
- renderSlot(_ctx.$slots, "operateCol", { scope }),
1734
- withDirectives(createVNode(unref(TMagicIcon), {
1735
- class: "m-table-delete-icon",
1736
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1737
- }, {
1738
- default: withCtx(() => [
1739
- createVNode(unref(Delete))
1740
- ]),
1741
- _: 2
1742
- }, 1032, ["onClick"]), [
1743
- [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1744
- ])
1745
- ]),
1746
- _: 3
1747
- }, 8, ["width", "fixed"]),
1748
- __props.sort && __props.model[unref(modelName)] && __props.model[unref(modelName)].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1749
- key: 1,
1750
- label: "排序",
1751
- width: "60"
1752
- }, {
1753
- default: withCtx((scope) => [
1754
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1755
- key: 0,
1756
- content: "点击上移,双击置顶",
1757
- placement: "top"
1758
- }, {
1759
- default: withCtx(() => [
1760
- createVNode(unref(TMagicButton), {
1761
- plain: "",
1762
- size: "small",
1763
- type: "primary",
1764
- icon: unref(ArrowUp),
1765
- disabled: __props.disabled,
1766
- text: "",
1767
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1768
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1769
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1770
- ]),
1771
- _: 2
1772
- }, 1024)) : createCommentVNode("", true),
1773
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== __props.model[unref(modelName)].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1774
- key: 1,
1775
- content: "点击下移,双击置底",
1776
- placement: "top"
1777
- }, {
1778
- default: withCtx(() => [
1779
- createVNode(unref(TMagicButton), {
1780
- plain: "",
1781
- size: "small",
1782
- type: "primary",
1783
- icon: unref(ArrowDown),
1784
- disabled: __props.disabled,
1785
- text: "",
1786
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1787
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1788
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1789
- ]),
1790
- _: 2
1791
- }, 1024)) : createCommentVNode("", true)
1792
- ]),
1793
- _: 1
1794
- })) : createCommentVNode("", true),
1795
- unref(selection) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1796
- key: 2,
1797
- align: "center",
1798
- "header-align": "center",
1799
- type: "selection",
1800
- width: "45"
1801
- })) : createCommentVNode("", true),
1802
- __props.showIndex && __props.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1803
- key: 3,
1804
- width: "60",
1805
- label: "序号"
1806
- }, {
1807
- default: withCtx((scope) => [
1808
- createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1809
- ]),
1810
- _: 1
1811
- })) : createCommentVNode("", true),
1812
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.items, (column, index) => {
1813
- return openBlock(), createElementBlock(Fragment, null, [
1814
- column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1815
- prop: column.name,
1816
- width: column.width,
1817
- label: column.label,
1818
- sortable: column.sortable,
1819
- "sort-orders": ["ascending", "descending"],
1820
- key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1821
- "class-name": __props.config.dropSort === true ? "el-table__column--dropable" : ""
1822
- }, {
1823
- default: withCtx((scope) => [
1824
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$v, {
1825
- key: 0,
1826
- labelWidth: "0",
1827
- disabled: __props.disabled,
1828
- prop: getProp(scope.$index),
1829
- rules: column.rules,
1830
- config: makeConfig(column, scope.row),
1831
- model: scope.row,
1832
- lastValues: unref(lastData)[scope.$index],
1833
- "is-compare": __props.isCompare,
1834
- size: __props.size,
1835
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", __props.model[unref(modelName)])),
1836
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1837
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1838
- ]),
1839
- _: 2
1840
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1841
- ], 64);
1842
- }), 256))
1843
- ]),
1844
- _: 3
1845
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1846
- ]),
1847
- _: 3
1848
- }, 8, ["disabled"]),
1849
- renderSlot(_ctx.$slots, "default"),
1850
- unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
1851
- key: 0,
1852
- size: "small",
1853
- type: "primary",
1854
- disabled: __props.disabled,
1855
- plain: "",
1856
- onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1857
- }, {
1858
- default: withCtx(() => [
1859
- _hoisted_4$1
1860
- ]),
1861
- _: 1
1862
- }, 8, ["disabled"])) : createCommentVNode("", true),
1863
- _hoisted_5,
1864
- __props.enableToggleMode && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1865
- key: 1,
1866
- icon: unref(Grid),
1867
- size: "small",
1868
- type: "primary",
1869
- onClick: toggleMode
1870
- }, {
1871
- default: withCtx(() => [
1872
- _hoisted_6
1873
- ]),
1874
- _: 1
1875
- }, 8, ["icon"])) : createCommentVNode("", true),
1876
- __props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1877
- key: 2,
1878
- icon: unref(FullScreen),
1879
- size: "small",
1880
- type: "primary",
1881
- onClick: toggleFullscreen
1882
- }, {
1883
- default: withCtx(() => [
1884
- createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1885
- ]),
1886
- _: 1
1887
- }, 8, ["icon"])) : createCommentVNode("", true),
1888
- unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
1889
- key: 3,
1890
- style: { "display": "inline-block" },
1891
- ref_key: "excelBtn",
1892
- ref: excelBtn,
1893
- action: "/noop",
1894
- disabled: __props.disabled,
1895
- "on-change": excelHandler,
1896
- "auto-upload": false
1897
- }, {
1898
- default: withCtx(() => [
1899
- createVNode(unref(TMagicButton), {
1900
- size: "small",
1901
- type: "success",
1902
- disabled: __props.disabled,
1903
- plain: ""
1904
- }, {
1905
- default: withCtx(() => [
1906
- _hoisted_7
1907
- ]),
1908
- _: 1
1909
- }, 8, ["disabled"])
1910
- ]),
1911
- _: 1
1912
- }, 8, ["disabled"])) : createCommentVNode("", true),
1913
- _hoisted_8,
1914
- unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
1915
- key: 4,
1916
- size: "small",
1917
- type: "warning",
1918
- disabled: __props.disabled,
1919
- plain: "",
1920
- onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1921
- }, {
1922
- default: withCtx(() => [
1923
- _hoisted_9
1924
- ]),
1925
- _: 1
1926
- }, 8, ["disabled"])) : createCommentVNode("", true)
1927
- ]),
1928
- __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_10, [
1680
+ innerHTML: _ctx.config.extra
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$x, {
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, [
1929
1919
  createVNode(unref(TMagicPagination), {
1930
1920
  layout: "total, sizes, prev, pager, next, jumper",
1931
- "hide-on-single-page": __props.model[unref(modelName)].length < pagesize.value,
1921
+ "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
1932
1922
  "current-page": pagecontext.value + 1,
1933
1923
  "page-sizes": [pagesize.value, 60, 120, 300],
1934
1924
  "page-size": pagesize.value,
1935
- total: __props.model[unref(modelName)].length,
1925
+ total: _ctx.model[modelName.value].length,
1936
1926
  onSizeChange: handleSizeChange,
1937
1927
  onCurrentChange: handleCurrentChange
1938
1928
  }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
@@ -1942,28 +1932,28 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1942
1932
  }
1943
1933
  });
1944
1934
 
1945
- const __default__$m = defineComponent({
1946
- name: "MFormTabs"
1947
- });
1948
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
1949
- ...__default__$m,
1935
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1936
+ ...{
1937
+ name: "MFormTabs"
1938
+ },
1939
+ __name: "Tabs",
1950
1940
  props: {
1951
- model: null,
1941
+ model: {},
1952
1942
  lastValues: { default: () => ({}) },
1953
1943
  isCompare: { type: Boolean, default: false },
1954
- config: null,
1955
- name: null,
1956
- size: null,
1957
- labelWidth: null,
1958
- prop: null,
1944
+ config: {},
1945
+ name: {},
1946
+ size: {},
1947
+ labelWidth: {},
1948
+ prop: {},
1959
1949
  expandMore: { type: Boolean },
1960
1950
  disabled: { type: Boolean }
1961
1951
  },
1962
1952
  emits: ["change", "addDiffCount"],
1963
1953
  setup(__props, { emit }) {
1964
1954
  const props = __props;
1965
- const tabPaneComponent = getConfig$1("components").tabPane;
1966
- const tabsComponent = getConfig$1("components").tabs;
1955
+ const tabPaneComponent = getConfig$1("components")?.tabPane;
1956
+ const tabsComponent = getConfig$1("components")?.tabs;
1967
1957
  const getActive = (mForm2, props2, activeTabName2) => {
1968
1958
  const { config, model, prop } = props2;
1969
1959
  const { active } = config;
@@ -2059,28 +2049,31 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2059
2049
  emit("addDiffCount");
2060
2050
  };
2061
2051
  return (_ctx, _cache) => {
2062
- return openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent).component), mergeProps(
2052
+ return openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent)?.component || "el-tabs"), mergeProps(
2063
2053
  {
2064
2054
  modelValue: activeTabName.value,
2065
2055
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
2066
2056
  },
2067
- unref(tabsComponent).props({
2068
- type: __props.config.tabType,
2069
- editable: __props.config.editable || false,
2070
- tabPosition: __props.config.tabPosition || "top"
2071
- }),
2057
+ unref(tabsComponent)?.props({
2058
+ type: _ctx.config.tabType,
2059
+ editable: _ctx.config.editable || false,
2060
+ tabPosition: _ctx.config.tabPosition || "top"
2061
+ }) || {},
2072
2062
  {
2073
- class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
2063
+ class: `tmagic-design-tabs ${_ctx.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
2074
2064
  onTabClick: tabClickHandler,
2075
2065
  onTabAdd,
2076
2066
  onTabRemove
2077
2067
  }
2078
2068
  ), {
2079
2069
  default: withCtx(() => [
2080
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab, tabIndex) => {
2081
- return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent).component), mergeProps({
2082
- key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex
2083
- }, unref(tabPaneComponent).props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false })), {
2070
+ (openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab, tabIndex) => {
2071
+ return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), mergeProps(
2072
+ {
2073
+ key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex
2074
+ },
2075
+ unref(tabPaneComponent)?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
2076
+ ), {
2084
2077
  label: withCtx(() => [
2085
2078
  createElementVNode("span", null, [
2086
2079
  createTextVNode(toDisplayString(filter(tab.title)), 1),
@@ -2093,17 +2086,17 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2093
2086
  ]),
2094
2087
  default: withCtx(() => [
2095
2088
  (openBlock(true), createElementBlock(Fragment, null, renderList(tabItems(tab), (item) => {
2096
- return openBlock(), createBlock(_sfc_main$v, {
2089
+ return openBlock(), createBlock(_sfc_main$x, {
2097
2090
  key: item[unref(mForm)?.keyProp || "__key"],
2098
2091
  config: item,
2099
- disabled: __props.disabled,
2100
- model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
2101
- "last-values": unref(isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
2102
- "is-compare": __props.isCompare,
2103
- prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2104
- size: __props.size,
2105
- "label-width": tab.labelWidth || __props.labelWidth,
2106
- "expand-more": __props.expandMore,
2092
+ disabled: _ctx.disabled,
2093
+ model: _ctx.config.dynamic ? (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model)[tabIndex] : tab.name ? (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model)[tab.name] : _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
2094
+ "last-values": unref(isEmpty)(_ctx.lastValues) ? {} : _ctx.config.dynamic ? (_ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues)[tabIndex] : tab.name ? (_ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues)[tab.name] : _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
2095
+ "is-compare": _ctx.isCompare,
2096
+ prop: _ctx.config.dynamic ? `${_ctx.prop}${_ctx.prop ? "." : ""}${String(tabIndex)}` : _ctx.prop,
2097
+ size: _ctx.size,
2098
+ "label-width": tab.labelWidth || _ctx.labelWidth,
2099
+ "expand-more": _ctx.expandMore,
2107
2100
  onChange: changeHandler,
2108
2101
  onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
2109
2102
  }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
@@ -2145,21 +2138,21 @@ const useAddField = (prop) => {
2145
2138
  );
2146
2139
  };
2147
2140
 
2148
- const __default__$l = defineComponent({
2149
- name: "MFormCascader"
2150
- });
2151
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2152
- ...__default__$l,
2141
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2142
+ ...{
2143
+ name: "MFormCascader"
2144
+ },
2145
+ __name: "Cascader",
2153
2146
  props: {
2154
- config: null,
2155
- model: null,
2156
- initValues: null,
2157
- values: null,
2158
- name: null,
2159
- prop: null,
2147
+ config: {},
2148
+ model: {},
2149
+ initValues: {},
2150
+ values: {},
2151
+ name: {},
2152
+ prop: {},
2160
2153
  disabled: { type: Boolean },
2161
- size: null,
2162
- lastValues: null
2154
+ size: {},
2155
+ lastValues: {}
2163
2156
  },
2164
2157
  emits: ["change"],
2165
2158
  setup(__props, { emit }) {
@@ -2215,39 +2208,39 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2215
2208
  };
2216
2209
  return (_ctx, _cache) => {
2217
2210
  return openBlock(), createBlock(unref(TMagicCascader), {
2218
- modelValue: __props.model[__props.name],
2219
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2211
+ modelValue: _ctx.model[_ctx.name],
2212
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2220
2213
  ref_key: "tMagicCascader",
2221
2214
  ref: tMagicCascader,
2222
2215
  style: { "width": "100%" },
2223
2216
  clearable: "",
2224
2217
  filterable: "",
2225
- size: __props.size,
2226
- placeholder: __props.config.placeholder,
2227
- disabled: __props.disabled,
2218
+ size: _ctx.size,
2219
+ placeholder: _ctx.config.placeholder,
2220
+ disabled: _ctx.disabled,
2228
2221
  options: unref(options),
2229
- props: { multiple: __props.config.multiple },
2222
+ props: { multiple: _ctx.config.multiple },
2230
2223
  onChange: changeHandler
2231
2224
  }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "props"]);
2232
2225
  };
2233
2226
  }
2234
2227
  });
2235
2228
 
2236
- const __default__$k = defineComponent({
2237
- name: "MFormCheckbox"
2238
- });
2239
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2240
- ...__default__$k,
2229
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2230
+ ...{
2231
+ name: "MFormCheckbox"
2232
+ },
2233
+ __name: "Checkbox",
2241
2234
  props: {
2242
- config: null,
2243
- model: null,
2244
- initValues: null,
2245
- values: null,
2246
- name: null,
2247
- prop: null,
2235
+ config: {},
2236
+ model: {},
2237
+ initValues: {},
2238
+ values: {},
2239
+ name: {},
2240
+ prop: {},
2248
2241
  disabled: { type: Boolean },
2249
- size: null,
2250
- lastValues: null
2242
+ size: {},
2243
+ lastValues: {}
2251
2244
  },
2252
2245
  emits: ["change"],
2253
2246
  setup(__props, { emit }) {
@@ -2278,16 +2271,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2278
2271
  };
2279
2272
  return (_ctx, _cache) => {
2280
2273
  return openBlock(), createBlock(unref(TMagicCheckbox), {
2281
- modelValue: __props.model[__props.name],
2282
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2283
- size: __props.size,
2284
- trueLabel: unref(activeValue),
2285
- falseLabel: unref(inactiveValue),
2286
- disabled: __props.disabled,
2274
+ modelValue: _ctx.model[_ctx.name],
2275
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2276
+ size: _ctx.size,
2277
+ trueLabel: activeValue.value,
2278
+ falseLabel: inactiveValue.value,
2279
+ disabled: _ctx.disabled,
2287
2280
  onChange: changeHandler
2288
2281
  }, {
2289
2282
  default: withCtx(() => [
2290
- createTextVNode(toDisplayString(__props.config.text), 1)
2283
+ createTextVNode(toDisplayString(_ctx.config.text), 1)
2291
2284
  ]),
2292
2285
  _: 1
2293
2286
  }, 8, ["modelValue", "size", "trueLabel", "falseLabel", "disabled"]);
@@ -2295,21 +2288,21 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2295
2288
  }
2296
2289
  });
2297
2290
 
2298
- const __default__$j = defineComponent({
2299
- name: "MFormCheckGroup"
2300
- });
2301
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2302
- ...__default__$j,
2291
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2292
+ ...{
2293
+ name: "MFormCheckGroup"
2294
+ },
2295
+ __name: "CheckboxGroup",
2303
2296
  props: {
2304
- config: null,
2305
- model: null,
2306
- initValues: null,
2307
- values: null,
2308
- name: null,
2309
- prop: null,
2297
+ config: {},
2298
+ model: {},
2299
+ initValues: {},
2300
+ values: {},
2301
+ name: {},
2302
+ prop: {},
2310
2303
  disabled: { type: Boolean },
2311
- size: null,
2312
- lastValues: null
2304
+ size: {},
2305
+ lastValues: {}
2313
2306
  },
2314
2307
  emits: ["change"],
2315
2308
  setup(__props, { emit }) {
@@ -2331,14 +2324,14 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2331
2324
  });
2332
2325
  return (_ctx, _cache) => {
2333
2326
  return openBlock(), createBlock(unref(TMagicCheckboxGroup), {
2334
- modelValue: __props.model[__props.name],
2335
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2336
- size: __props.size,
2337
- disabled: __props.disabled,
2327
+ modelValue: _ctx.model[_ctx.name],
2328
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2329
+ size: _ctx.size,
2330
+ disabled: _ctx.disabled,
2338
2331
  onChange: changeHandler
2339
2332
  }, {
2340
2333
  default: withCtx(() => [
2341
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(options), (option) => {
2334
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option) => {
2342
2335
  return openBlock(), createBlock(unref(TMagicCheckbox), {
2343
2336
  label: option.value,
2344
2337
  value: option.value,
@@ -2358,21 +2351,21 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2358
2351
  }
2359
2352
  });
2360
2353
 
2361
- const __default__$i = defineComponent({
2362
- name: "MFormColorPicker"
2363
- });
2364
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2365
- ...__default__$i,
2354
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2355
+ ...{
2356
+ name: "MFormColorPicker"
2357
+ },
2358
+ __name: "ColorPicker",
2366
2359
  props: {
2367
- config: null,
2368
- model: null,
2369
- initValues: null,
2370
- values: null,
2371
- name: null,
2372
- prop: null,
2360
+ config: {},
2361
+ model: {},
2362
+ initValues: {},
2363
+ values: {},
2364
+ name: {},
2365
+ prop: {},
2373
2366
  disabled: { type: Boolean },
2374
- size: null,
2375
- lastValues: null
2367
+ size: {},
2368
+ lastValues: {}
2376
2369
  },
2377
2370
  emits: ["change"],
2378
2371
  setup(__props, { emit }) {
@@ -2381,10 +2374,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2381
2374
  const changeHandler = (value) => emit("change", value);
2382
2375
  return (_ctx, _cache) => {
2383
2376
  return openBlock(), createBlock(unref(TMagicColorPicker), {
2384
- modelValue: __props.model[__props.name],
2385
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2386
- size: __props.size,
2387
- disabled: __props.disabled,
2377
+ modelValue: _ctx.model[_ctx.name],
2378
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2379
+ size: _ctx.size,
2380
+ disabled: _ctx.disabled,
2388
2381
  showAlpha: true,
2389
2382
  onChange: changeHandler
2390
2383
  }, null, 8, ["modelValue", "size", "disabled"]);
@@ -2392,21 +2385,21 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2392
2385
  }
2393
2386
  });
2394
2387
 
2395
- const __default__$h = defineComponent({
2396
- name: "MFormDate"
2397
- });
2398
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
2399
- ...__default__$h,
2388
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2389
+ ...{
2390
+ name: "MFormDate"
2391
+ },
2392
+ __name: "Date",
2400
2393
  props: {
2401
- config: null,
2402
- model: null,
2403
- initValues: null,
2404
- values: null,
2405
- name: null,
2406
- prop: null,
2394
+ config: {},
2395
+ model: {},
2396
+ initValues: {},
2397
+ values: {},
2398
+ name: {},
2399
+ prop: {},
2407
2400
  disabled: { type: Boolean },
2408
- size: null,
2409
- lastValues: null
2401
+ size: {},
2402
+ lastValues: {}
2410
2403
  },
2411
2404
  emits: ["change"],
2412
2405
  setup(__props, { emit }) {
@@ -2418,35 +2411,35 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2418
2411
  };
2419
2412
  return (_ctx, _cache) => {
2420
2413
  return openBlock(), createBlock(unref(TMagicDatePicker), {
2421
- modelValue: __props.model[__props.name],
2422
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2414
+ modelValue: _ctx.model[_ctx.name],
2415
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2423
2416
  type: "date",
2424
- size: __props.size,
2425
- placeholder: __props.config.placeholder,
2426
- disabled: __props.disabled,
2427
- format: __props.config.format,
2428
- "value-format": __props.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
2417
+ size: _ctx.size,
2418
+ placeholder: _ctx.config.placeholder,
2419
+ disabled: _ctx.disabled,
2420
+ format: _ctx.config.format,
2421
+ "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
2429
2422
  onChange: changeHandler
2430
2423
  }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
2431
2424
  };
2432
2425
  }
2433
2426
  });
2434
2427
 
2435
- const __default__$g = defineComponent({
2436
- name: "MFormDateRange"
2437
- });
2438
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
2439
- ...__default__$g,
2428
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2429
+ ...{
2430
+ name: "MFormDateRange"
2431
+ },
2432
+ __name: "Daterange",
2440
2433
  props: {
2441
- config: null,
2442
- model: null,
2443
- initValues: null,
2444
- values: null,
2445
- name: null,
2446
- prop: null,
2434
+ config: {},
2435
+ model: {},
2436
+ initValues: {},
2437
+ values: {},
2438
+ name: {},
2439
+ prop: {},
2447
2440
  disabled: { type: Boolean },
2448
- size: null,
2449
- lastValues: null
2441
+ size: {},
2442
+ lastValues: {}
2450
2443
  },
2451
2444
  emits: ["change"],
2452
2445
  setup(__props, { emit }) {
@@ -2524,31 +2517,31 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2524
2517
  "range-separator": "-",
2525
2518
  "start-placeholder": "开始日期",
2526
2519
  "end-placeholder": "结束日期",
2527
- size: __props.size,
2520
+ size: _ctx.size,
2528
2521
  "unlink-panels": true,
2529
- disabled: __props.disabled,
2530
- "default-time": __props.config.defaultTime,
2522
+ disabled: _ctx.disabled,
2523
+ "default-time": _ctx.config.defaultTime,
2531
2524
  onChange: changeHandler
2532
2525
  }, null, 8, ["modelValue", "size", "disabled", "default-time"]);
2533
2526
  };
2534
2527
  }
2535
2528
  });
2536
2529
 
2537
- const __default__$f = defineComponent({
2538
- name: "MFormDateTime"
2539
- });
2540
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2541
- ...__default__$f,
2530
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2531
+ ...{
2532
+ name: "MFormDateTime"
2533
+ },
2534
+ __name: "DateTime",
2542
2535
  props: {
2543
- config: null,
2544
- model: null,
2545
- initValues: null,
2546
- values: null,
2547
- name: null,
2548
- prop: null,
2536
+ config: {},
2537
+ model: {},
2538
+ initValues: {},
2539
+ values: {},
2540
+ name: {},
2541
+ prop: {},
2549
2542
  disabled: { type: Boolean },
2550
- size: null,
2551
- lastValues: null
2543
+ size: {},
2544
+ lastValues: {}
2552
2545
  },
2553
2546
  emits: ["change"],
2554
2547
  setup(__props, { emit }) {
@@ -2567,36 +2560,38 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2567
2560
  };
2568
2561
  return (_ctx, _cache) => {
2569
2562
  return openBlock(), createBlock(unref(TMagicDatePicker), {
2570
- modelValue: __props.model[__props.name],
2571
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2563
+ modelValue: _ctx.model[_ctx.name],
2564
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2572
2565
  "popper-class": "magic-datetime-picker-popper",
2573
2566
  type: "datetime",
2574
- size: __props.size,
2575
- placeholder: __props.config.placeholder,
2576
- disabled: __props.disabled,
2577
- format: __props.config.format || "YYYY-MM-DD HH:mm:ss",
2578
- "value-format": __props.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
2579
- "default-time": __props.config.defaultTime,
2567
+ size: _ctx.size,
2568
+ placeholder: _ctx.config.placeholder,
2569
+ disabled: _ctx.disabled,
2570
+ format: _ctx.config.format || "YYYY/MM/DD HH:mm:ss",
2571
+ "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
2572
+ "default-time": _ctx.config.defaultTime,
2580
2573
  onChange: changeHandler
2581
2574
  }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
2582
2575
  };
2583
2576
  }
2584
2577
  });
2585
2578
 
2586
- const _hoisted_1$5 = { key: 0 };
2587
- const __default__$e = defineComponent({
2588
- name: "MFormDisplay"
2589
- });
2590
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
2591
- ...__default__$e,
2579
+ const _hoisted_1$7 = { key: 0 };
2580
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2581
+ ...{
2582
+ name: "MFormDisplay"
2583
+ },
2584
+ __name: "Display",
2592
2585
  props: {
2593
- config: null,
2594
- model: null,
2595
- initValues: null,
2596
- values: null,
2597
- name: null,
2598
- prop: null,
2599
- lastValues: null
2586
+ config: {},
2587
+ model: {},
2588
+ initValues: {},
2589
+ values: {},
2590
+ name: {},
2591
+ prop: {},
2592
+ disabled: { type: Boolean },
2593
+ size: {},
2594
+ lastValues: {}
2600
2595
  },
2601
2596
  setup(__props) {
2602
2597
  const props = __props;
@@ -2605,27 +2600,27 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2605
2600
  }
2606
2601
  useAddField(props.prop);
2607
2602
  return (_ctx, _cache) => {
2608
- return __props.model ? (openBlock(), createElementBlock("span", _hoisted_1$5, toDisplayString(__props.model[__props.name]), 1)) : createCommentVNode("", true);
2603
+ return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$7, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
2609
2604
  };
2610
2605
  }
2611
2606
  });
2612
2607
 
2613
- const _hoisted_1$4 = { class: "m-fields-dynamic-field" };
2614
- const __default__$d = defineComponent({
2615
- name: "MFormDynamicField"
2616
- });
2617
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
2618
- ...__default__$d,
2608
+ const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2609
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2610
+ ...{
2611
+ name: "MFormDynamicField"
2612
+ },
2613
+ __name: "DynamicField",
2619
2614
  props: {
2620
- config: null,
2621
- model: null,
2622
- initValues: null,
2623
- values: null,
2624
- name: null,
2625
- prop: null,
2615
+ config: {},
2616
+ model: {},
2617
+ initValues: {},
2618
+ values: {},
2619
+ name: {},
2620
+ prop: {},
2626
2621
  disabled: { type: Boolean },
2627
- size: null,
2628
- lastValues: null
2622
+ size: {},
2623
+ lastValues: {}
2629
2624
  },
2630
2625
  emits: ["change"],
2631
2626
  setup(__props, { emit }) {
@@ -2676,7 +2671,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2676
2671
  emit("change", fieldMap.value[key], key);
2677
2672
  };
2678
2673
  return (_ctx, _cache) => {
2679
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2674
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
2680
2675
  createVNode(unref(TMagicForm), { size: "small" }, {
2681
2676
  default: withCtx(() => [
2682
2677
  (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
@@ -2703,40 +2698,42 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2703
2698
  }
2704
2699
  });
2705
2700
 
2706
- const __default__$c = defineComponent({
2707
- name: "MFormHidden"
2708
- });
2709
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
2710
- ...__default__$c,
2701
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2702
+ ...{
2703
+ name: "MFormHidden"
2704
+ },
2705
+ __name: "Hidden",
2711
2706
  props: {
2712
- config: null,
2713
- model: null,
2714
- initValues: null,
2715
- values: null,
2716
- name: null,
2717
- prop: null,
2718
- lastValues: null
2707
+ config: {},
2708
+ model: {},
2709
+ initValues: {},
2710
+ values: {},
2711
+ name: {},
2712
+ prop: {},
2713
+ disabled: { type: Boolean },
2714
+ size: {},
2715
+ lastValues: {}
2719
2716
  },
2720
2717
  setup(__props) {
2721
2718
  const props = __props;
2722
2719
  useAddField(props.prop);
2723
2720
  return (_ctx, _cache) => {
2724
- return __props.model ? withDirectives((openBlock(), createElementBlock("input", {
2721
+ return _ctx.model ? withDirectives((openBlock(), createElementBlock("input", {
2725
2722
  key: 0,
2726
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2723
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2727
2724
  type: "hidden"
2728
2725
  }, null, 512)), [
2729
- [vModelText, __props.model[__props.name]]
2726
+ [vModelText, _ctx.model[_ctx.name]]
2730
2727
  ]) : createCommentVNode("", true);
2731
2728
  };
2732
2729
  }
2733
2730
  });
2734
2731
 
2735
- const __default__$b = defineComponent({
2736
- name: "MForm"
2737
- });
2738
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
2739
- ...__default__$b,
2732
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2733
+ ...{
2734
+ name: "MForm"
2735
+ },
2736
+ __name: "Form",
2740
2737
  props: {
2741
2738
  config: { default: () => [] },
2742
2739
  initValues: { default: () => ({}) },
@@ -2747,14 +2744,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2747
2744
  disabled: { type: Boolean, default: false },
2748
2745
  height: { default: "auto" },
2749
2746
  stepActive: { default: 1 },
2750
- size: null,
2747
+ size: {},
2751
2748
  inline: { type: Boolean, default: false },
2752
2749
  labelPosition: { default: "right" },
2753
2750
  keyProp: { default: "__key" },
2754
- popperClass: null
2751
+ popperClass: {},
2752
+ extendState: {}
2755
2753
  },
2756
2754
  emits: ["change", "field-input", "field-change"],
2757
- setup(__props, { expose, emit }) {
2755
+ setup(__props, { expose: __expose, emit }) {
2758
2756
  const props = __props;
2759
2757
  const tMagicForm = ref();
2760
2758
  const initialized = ref(false);
@@ -2786,7 +2784,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2786
2784
  }
2787
2785
  }
2788
2786
  });
2789
- watchEffect(() => {
2787
+ watchEffect(async () => {
2790
2788
  formState.initValues = props.initValues;
2791
2789
  formState.lastValues = props.lastValues;
2792
2790
  formState.isCompare = props.isCompare;
@@ -2794,6 +2792,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2794
2792
  formState.keyProp = props.keyProp;
2795
2793
  formState.popperClass = props.popperClass;
2796
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
+ }
2797
2801
  });
2798
2802
  provide("mForm", formState);
2799
2803
  watch(
@@ -2824,7 +2828,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2824
2828
  const changeHandler = () => {
2825
2829
  emit("change", values.value);
2826
2830
  };
2827
- expose({
2831
+ __expose({
2828
2832
  values,
2829
2833
  lastValuesProcessed,
2830
2834
  formState,
@@ -2857,23 +2861,23 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2857
2861
  ref_key: "tMagicForm",
2858
2862
  ref: tMagicForm,
2859
2863
  model: values.value,
2860
- "label-width": __props.labelWidth,
2861
- style: normalizeStyle(`height: ${__props.height}`),
2862
- inline: __props.inline,
2863
- "label-position": __props.labelPosition
2864
+ "label-width": _ctx.labelWidth,
2865
+ style: normalizeStyle(`height: ${_ctx.height}`),
2866
+ inline: _ctx.inline,
2867
+ "label-position": _ctx.labelPosition
2864
2868
  }, {
2865
2869
  default: withCtx(() => [
2866
- initialized.value && Array.isArray(__props.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.config, (item, index) => {
2867
- return openBlock(), createBlock(_sfc_main$v, {
2868
- disabled: __props.disabled,
2869
- key: item[__props.keyProp] ?? index,
2870
+ initialized.value && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
2871
+ return openBlock(), createBlock(_sfc_main$x, {
2872
+ disabled: _ctx.disabled,
2873
+ key: item[_ctx.keyProp] ?? index,
2870
2874
  config: item,
2871
2875
  model: values.value,
2872
2876
  "last-values": lastValuesProcessed.value,
2873
- "is-compare": __props.isCompare,
2874
- "label-width": item.labelWidth || __props.labelWidth,
2875
- "step-active": __props.stepActive,
2876
- size: __props.size,
2877
+ "is-compare": _ctx.isCompare,
2878
+ "label-width": item.labelWidth || _ctx.labelWidth,
2879
+ "step-active": _ctx.stepActive,
2880
+ size: _ctx.size,
2877
2881
  onChange: changeHandler
2878
2882
  }, null, 8, ["disabled", "config", "model", "last-values", "is-compare", "label-width", "step-active", "size"]);
2879
2883
  }), 128)) : createCommentVNode("", true)
@@ -2884,30 +2888,27 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
2884
2888
  }
2885
2889
  });
2886
2890
 
2887
- const _hoisted_1$3 = { style: { "min-height": "1px" } };
2888
- const _hoisted_2$1 = /* @__PURE__ */ createTextVNode("取 消");
2889
- const _hoisted_3$1 = /* @__PURE__ */ createTextVNode("上一步");
2890
- const _hoisted_4 = /* @__PURE__ */ createTextVNode("下一步");
2891
- const __default__$a = defineComponent({
2892
- name: "MFormDialog"
2893
- });
2894
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
2895
- ...__default__$a,
2891
+ const _hoisted_1$5 = { style: { "min-height": "1px" } };
2892
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2893
+ ...{
2894
+ name: "MFormDialog"
2895
+ },
2896
+ __name: "FormDialog",
2896
2897
  props: {
2897
2898
  config: { default: () => [] },
2898
2899
  values: { default: () => ({}) },
2899
- parentValues: null,
2900
- width: null,
2901
- labelWidth: null,
2900
+ parentValues: {},
2901
+ width: {},
2902
+ labelWidth: {},
2902
2903
  fullscreen: { type: Boolean },
2903
2904
  disabled: { type: Boolean },
2904
- title: null,
2905
- zIndex: null,
2906
- size: null,
2905
+ title: {},
2906
+ zIndex: {},
2907
+ size: {},
2907
2908
  confirmText: { default: "确定" }
2908
2909
  },
2909
2910
  emits: ["close", "submit", "error", "change"],
2910
- setup(__props, { expose, emit }) {
2911
+ setup(__props, { expose: __expose, emit }) {
2911
2912
  const props = __props;
2912
2913
  const form = ref();
2913
2914
  const dialogVisible = ref(false);
@@ -2932,9 +2933,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2932
2933
  }
2933
2934
  return false;
2934
2935
  });
2935
- const cancel = () => {
2936
- dialogVisible.value = false;
2937
- };
2938
2936
  const closeHandler = () => {
2939
2937
  stepActive.value = 1;
2940
2938
  emit("close");
@@ -2956,12 +2954,23 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2956
2954
  const changeHandler = (value) => {
2957
2955
  emit("change", value);
2958
2956
  };
2959
- expose({
2957
+ const show = () => {
2958
+ dialogVisible.value = true;
2959
+ };
2960
+ const hide = () => {
2961
+ dialogVisible.value = false;
2962
+ };
2963
+ const cancel = () => {
2964
+ hide();
2965
+ };
2966
+ __expose({
2960
2967
  form,
2961
2968
  saveFetch,
2962
2969
  dialogVisible,
2963
2970
  cancel,
2964
- save
2971
+ save,
2972
+ show,
2973
+ hide
2965
2974
  });
2966
2975
  return (_ctx, _cache) => {
2967
2976
  return openBlock(), createBlock(unref(TMagicDialog), {
@@ -2970,10 +2979,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2970
2979
  class: "m-form-dialog",
2971
2980
  top: "20px",
2972
2981
  "append-to-body": "",
2973
- title: __props.title,
2974
- width: __props.width,
2975
- zIndex: __props.zIndex,
2976
- fullscreen: __props.fullscreen,
2982
+ title: _ctx.title,
2983
+ width: _ctx.width,
2984
+ zIndex: _ctx.zIndex,
2985
+ fullscreen: _ctx.fullscreen,
2977
2986
  "close-on-click-modal": false,
2978
2987
  onClose: closeHandler
2979
2988
  }, {
@@ -2985,7 +2994,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2985
2994
  style: { "text-align": "left" }
2986
2995
  }, {
2987
2996
  default: withCtx(() => [
2988
- createElementVNode("div", _hoisted_1$3, [
2997
+ createElementVNode("div", _hoisted_1$5, [
2989
2998
  renderSlot(_ctx.$slots, "left")
2990
2999
  ])
2991
3000
  ]),
@@ -2999,43 +3008,44 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2999
3008
  size: "small"
3000
3009
  }, {
3001
3010
  default: withCtx(() => [
3002
- _hoisted_2$1
3011
+ createTextVNode("取 消")
3003
3012
  ]),
3004
3013
  _: 1
3005
3014
  }),
3006
- unref(hasStep) && stepActive.value > 1 ? (openBlock(), createBlock(unref(TMagicButton), {
3015
+ hasStep.value && stepActive.value > 1 ? (openBlock(), createBlock(unref(TMagicButton), {
3007
3016
  key: 0,
3008
3017
  type: "info",
3009
3018
  size: "small",
3010
3019
  onClick: preStep
3011
3020
  }, {
3012
3021
  default: withCtx(() => [
3013
- _hoisted_3$1
3022
+ createTextVNode("上一步")
3014
3023
  ]),
3015
3024
  _: 1
3016
3025
  })) : createCommentVNode("", true),
3017
- unref(hasStep) && unref(stepCount) > stepActive.value ? (openBlock(), createBlock(unref(TMagicButton), {
3026
+ hasStep.value && stepCount.value > stepActive.value ? (openBlock(), createBlock(unref(TMagicButton), {
3018
3027
  key: 1,
3019
3028
  type: "info",
3020
3029
  size: "small",
3021
3030
  onClick: nextStep
3022
3031
  }, {
3023
3032
  default: withCtx(() => [
3024
- _hoisted_4
3033
+ createTextVNode("下一步")
3025
3034
  ]),
3026
3035
  _: 1
3027
3036
  })) : (openBlock(), createBlock(unref(TMagicButton), {
3028
3037
  key: 2,
3029
3038
  type: "primary",
3030
3039
  size: "small",
3040
+ disabled: _ctx.disabled,
3031
3041
  loading: saveFetch.value,
3032
3042
  onClick: save
3033
3043
  }, {
3034
3044
  default: withCtx(() => [
3035
- createTextVNode(toDisplayString(__props.confirmText), 1)
3045
+ createTextVNode(toDisplayString(_ctx.confirmText), 1)
3036
3046
  ]),
3037
3047
  _: 1
3038
- }, 8, ["loading"]))
3048
+ }, 8, ["disabled", "loading"]))
3039
3049
  ])
3040
3050
  ]),
3041
3051
  _: 3
@@ -3050,17 +3060,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3050
3060
  class: "m-dialog-body",
3051
3061
  style: normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
3052
3062
  }, [
3053
- createVNode(_sfc_main$b, {
3063
+ createVNode(_sfc_main$d, {
3054
3064
  modelValue: stepActive.value,
3055
3065
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
3056
3066
  ref_key: "form",
3057
3067
  ref: form,
3058
- size: __props.size,
3059
- disabled: __props.disabled,
3060
- config: __props.config,
3061
- "init-values": __props.values,
3062
- "parent-values": __props.parentValues,
3063
- "label-width": __props.labelWidth,
3068
+ size: _ctx.size,
3069
+ disabled: _ctx.disabled,
3070
+ config: _ctx.config,
3071
+ "init-values": _ctx.values,
3072
+ "parent-values": _ctx.parentValues,
3073
+ "label-width": _ctx.labelWidth,
3064
3074
  onChange: changeHandler
3065
3075
  }, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width"]),
3066
3076
  renderSlot(_ctx.$slots, "default")
@@ -3072,27 +3082,26 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3072
3082
  }
3073
3083
  });
3074
3084
 
3075
- const _hoisted_1$2 = ["href"];
3076
- const _hoisted_2 = {
3085
+ const _hoisted_1$4 = ["href"];
3086
+ const _hoisted_2$1 = {
3077
3087
  key: 2,
3078
3088
  class: "m-fields-link"
3079
3089
  };
3080
- const _hoisted_3 = /* @__PURE__ */ createTextVNode("点击编辑");
3081
- const __default__$9 = defineComponent({
3082
- name: "MFormLink"
3083
- });
3084
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3085
- ...__default__$9,
3090
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3091
+ ...{
3092
+ name: "MFormLink"
3093
+ },
3094
+ __name: "Link",
3086
3095
  props: {
3087
- config: null,
3088
- model: null,
3089
- initValues: null,
3090
- values: null,
3091
- name: null,
3092
- prop: null,
3096
+ config: {},
3097
+ model: {},
3098
+ initValues: {},
3099
+ values: {},
3100
+ name: {},
3101
+ prop: {},
3093
3102
  disabled: { type: Boolean },
3094
- size: null,
3095
- lastValues: null
3103
+ size: {},
3104
+ lastValues: {}
3096
3105
  },
3097
3106
  emits: ["change"],
3098
3107
  setup(__props, { emit }) {
@@ -3141,34 +3150,34 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3141
3150
  editor.value && (editor.value.dialogVisible = false);
3142
3151
  };
3143
3152
  return (_ctx, _cache) => {
3144
- return __props.config.href && !__props.disabled ? (openBlock(), createElementBlock("a", {
3153
+ return _ctx.config.href && !_ctx.disabled ? (openBlock(), createElementBlock("a", {
3145
3154
  key: 0,
3146
3155
  target: "_blank",
3147
- href: unref(href),
3148
- style: normalizeStyle(__props.config.css || {})
3149
- }, toDisplayString(unref(displayText)), 13, _hoisted_1$2)) : __props.config.href && __props.disabled ? (openBlock(), createElementBlock("span", {
3156
+ href: href.value,
3157
+ style: normalizeStyle(_ctx.config.css || {})
3158
+ }, toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3150
3159
  key: 1,
3151
- style: normalizeStyle(__props.config.disabledCss || {})
3152
- }, toDisplayString(unref(displayText)), 5)) : (openBlock(), createElementBlock("div", _hoisted_2, [
3160
+ style: normalizeStyle(_ctx.config.disabledCss || {})
3161
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$1, [
3153
3162
  createVNode(unref(TMagicButton), {
3154
3163
  text: true,
3155
3164
  type: "primary",
3156
3165
  onClick: editHandler
3157
3166
  }, {
3158
3167
  default: withCtx(() => [
3159
- _hoisted_3
3168
+ createTextVNode("点击编辑")
3160
3169
  ]),
3161
3170
  _: 1
3162
3171
  }),
3163
- createVNode(_sfc_main$a, {
3172
+ createVNode(_sfc_main$c, {
3164
3173
  ref_key: "editor",
3165
3174
  ref: editor,
3166
- title: __props.config.formTitle || "编辑扩展配置",
3167
- width: __props.config.formWidth,
3175
+ title: _ctx.config.formTitle || "编辑扩展配置",
3176
+ width: _ctx.config.formWidth,
3168
3177
  values: formValue.value,
3169
- config: unref(formConfig),
3170
- parentValues: __props.values,
3171
- fullscreen: __props.config.fullscreen,
3178
+ config: formConfig.value,
3179
+ parentValues: _ctx.values,
3180
+ fullscreen: _ctx.config.fullscreen,
3172
3181
  onSubmit: action
3173
3182
  }, null, 8, ["title", "width", "values", "config", "parentValues", "fullscreen"])
3174
3183
  ]));
@@ -3176,21 +3185,21 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3176
3185
  }
3177
3186
  });
3178
3187
 
3179
- const __default__$8 = defineComponent({
3180
- name: "MFormNumber"
3181
- });
3182
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3183
- ...__default__$8,
3188
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3189
+ ...{
3190
+ name: "MFormNumber"
3191
+ },
3192
+ __name: "Number",
3184
3193
  props: {
3185
- config: null,
3186
- model: null,
3187
- initValues: null,
3188
- values: null,
3189
- name: null,
3190
- prop: null,
3194
+ config: {},
3195
+ model: {},
3196
+ initValues: {},
3197
+ values: {},
3198
+ name: {},
3199
+ prop: {},
3191
3200
  disabled: { type: Boolean },
3192
- size: null,
3193
- lastValues: null
3201
+ size: {},
3202
+ lastValues: {}
3194
3203
  },
3195
3204
  emits: ["change", "input"],
3196
3205
  setup(__props, { emit }) {
@@ -3205,18 +3214,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3205
3214
  mForm?.$emit("field-input", props.prop, v);
3206
3215
  };
3207
3216
  return (_ctx, _cache) => {
3208
- return __props.model ? (openBlock(), createBlock(unref(TMagicInputNumber), {
3217
+ return _ctx.model ? (openBlock(), createBlock(unref(TMagicInputNumber), {
3209
3218
  key: 0,
3210
- modelValue: __props.model[__props.name],
3211
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3219
+ modelValue: _ctx.model[_ctx.name],
3220
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3212
3221
  clearable: "",
3213
3222
  "controls-position": "right",
3214
- size: __props.size,
3215
- max: __props.config.max,
3216
- min: __props.config.min,
3217
- step: __props.config.step,
3218
- placeholder: __props.config.placeholder,
3219
- disabled: __props.disabled,
3223
+ size: _ctx.size,
3224
+ max: _ctx.config.max,
3225
+ min: _ctx.config.min,
3226
+ step: _ctx.config.step,
3227
+ placeholder: _ctx.config.placeholder,
3228
+ disabled: _ctx.disabled,
3220
3229
  onChange: changeHandler,
3221
3230
  onInput: inputHandler
3222
3231
  }, null, 8, ["modelValue", "size", "max", "min", "step", "placeholder", "disabled"])) : createCommentVNode("", true);
@@ -3224,21 +3233,76 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3224
3233
  }
3225
3234
  });
3226
3235
 
3227
- const __default__$7 = defineComponent({
3228
- name: "MFormRadioGroup"
3236
+ const _hoisted_1$3 = { class: "m-fields-number-range" };
3237
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3238
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3239
+ ...{
3240
+ name: "MFormNumberRange"
3241
+ },
3242
+ __name: "NumberRange",
3243
+ props: {
3244
+ config: {},
3245
+ model: {},
3246
+ initValues: {},
3247
+ values: {},
3248
+ name: {},
3249
+ prop: {},
3250
+ disabled: { type: Boolean },
3251
+ size: {},
3252
+ lastValues: {}
3253
+ },
3254
+ emits: ["change"],
3255
+ setup(__props, { emit }) {
3256
+ const props = __props;
3257
+ useAddField(props.prop);
3258
+ if (!Array.isArray(props.model[props.name])) {
3259
+ props.model[props.name] = [];
3260
+ }
3261
+ const minChangeHandler = (v) => {
3262
+ emit("change", [Number(v), props.model[props.name][1]]);
3263
+ };
3264
+ const maxChangeHandler = (v) => {
3265
+ emit("change", [props.model[props.name][0], Number(v)]);
3266
+ };
3267
+ return (_ctx, _cache) => {
3268
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
3269
+ createVNode(unref(TMagicInput), {
3270
+ modelValue: _ctx.model[_ctx.name][0],
3271
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
3272
+ clearable: "",
3273
+ size: _ctx.size,
3274
+ disabled: _ctx.disabled,
3275
+ onChange: minChangeHandler
3276
+ }, null, 8, ["modelValue", "size", "disabled"]),
3277
+ _hoisted_2,
3278
+ createVNode(unref(TMagicInput), {
3279
+ modelValue: _ctx.model[_ctx.name][1],
3280
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
3281
+ clearable: "",
3282
+ size: _ctx.size,
3283
+ disabled: _ctx.disabled,
3284
+ onChange: maxChangeHandler
3285
+ }, null, 8, ["modelValue", "size", "disabled"])
3286
+ ]);
3287
+ };
3288
+ }
3229
3289
  });
3230
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3231
- ...__default__$7,
3290
+
3291
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3292
+ ...{
3293
+ name: "MFormRadioGroup"
3294
+ },
3295
+ __name: "RadioGroup",
3232
3296
  props: {
3233
- config: null,
3234
- model: null,
3235
- initValues: null,
3236
- values: null,
3237
- name: null,
3238
- prop: null,
3297
+ config: {},
3298
+ model: {},
3299
+ initValues: {},
3300
+ values: {},
3301
+ name: {},
3302
+ prop: {},
3239
3303
  disabled: { type: Boolean },
3240
- size: null,
3241
- lastValues: null
3304
+ size: {},
3305
+ lastValues: {}
3242
3306
  },
3243
3307
  emits: ["change"],
3244
3308
  setup(__props, { emit }) {
@@ -3248,16 +3312,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3248
3312
  };
3249
3313
  useAddField(props.prop);
3250
3314
  return (_ctx, _cache) => {
3251
- return __props.model ? (openBlock(), createBlock(unref(TMagicRadioGroup), {
3315
+ return _ctx.model ? (openBlock(), createBlock(unref(TMagicRadioGroup), {
3252
3316
  key: 0,
3253
- modelValue: __props.model[__props.name],
3254
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3255
- size: __props.size,
3256
- disabled: __props.disabled,
3317
+ modelValue: _ctx.model[_ctx.name],
3318
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3319
+ size: _ctx.size,
3320
+ disabled: _ctx.disabled,
3257
3321
  onChange: changeHandler
3258
3322
  }, {
3259
3323
  default: withCtx(() => [
3260
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.options, (option) => {
3324
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.options, (option) => {
3261
3325
  return openBlock(), createBlock(unref(TMagicRadio), {
3262
3326
  label: option.value,
3263
3327
  value: option.value,
@@ -3276,18 +3340,18 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3276
3340
  }
3277
3341
  });
3278
3342
 
3279
- const __default__$6 = defineComponent({
3280
- name: "MFormSelectOptionGroups"
3281
- });
3282
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3283
- ...__default__$6,
3343
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3344
+ ...{
3345
+ name: "MFormSelectOptionGroups"
3346
+ },
3347
+ __name: "SelectOptionGroups",
3284
3348
  props: {
3285
- options: null
3349
+ options: {}
3286
3350
  },
3287
3351
  setup(__props) {
3288
- const uiComponent = getConfig$1("components").option;
3352
+ const uiComponent = getConfig$1("components")?.option.component || "el-option";
3289
3353
  return (_ctx, _cache) => {
3290
- return openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (group, index) => {
3354
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (group, index) => {
3291
3355
  return openBlock(), createBlock(unref(TMagicOptionGroup), {
3292
3356
  key: index,
3293
3357
  label: group.label,
@@ -3295,7 +3359,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3295
3359
  }, {
3296
3360
  default: withCtx(() => [
3297
3361
  (openBlock(true), createElementBlock(Fragment, null, renderList(group.options, (item, index2) => {
3298
- return openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
3362
+ return openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent)), {
3299
3363
  key: index2,
3300
3364
  label: item.label || item.text,
3301
3365
  value: item.value,
@@ -3310,22 +3374,22 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3310
3374
  }
3311
3375
  });
3312
3376
 
3313
- const __default__$5 = defineComponent({
3314
- name: "MFormSelectOptions"
3315
- });
3316
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3317
- ...__default__$5,
3377
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3378
+ ...{
3379
+ name: "MFormSelectOptions"
3380
+ },
3381
+ __name: "SelectOptions",
3318
3382
  props: {
3319
- options: null,
3320
- valueKey: null
3383
+ options: {},
3384
+ valueKey: {}
3321
3385
  },
3322
3386
  setup(__props) {
3323
3387
  return (_ctx, _cache) => {
3324
- return openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
3388
+ return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option) => {
3325
3389
  return openBlock(), createBlock(unref(TMagicOption), {
3326
3390
  label: option.text,
3327
3391
  value: option.value,
3328
- key: __props.valueKey ? option.value[__props.valueKey] : option.value,
3392
+ key: _ctx.valueKey ? option.value[_ctx.valueKey] : option.value,
3329
3393
  disabled: option.disabled
3330
3394
  }, null, 8, ["label", "value", "disabled"]);
3331
3395
  }), 128);
@@ -3333,22 +3397,22 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3333
3397
  }
3334
3398
  });
3335
3399
 
3336
- const _hoisted_1$1 = { key: 2 };
3337
- const __default__$4 = defineComponent({
3338
- name: "MFormSelect"
3339
- });
3340
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3341
- ...__default__$4,
3400
+ const _hoisted_1$2 = { key: 2 };
3401
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3402
+ ...{
3403
+ name: "MFormSelect"
3404
+ },
3405
+ __name: "Select",
3342
3406
  props: {
3343
- config: null,
3344
- model: null,
3345
- initValues: null,
3346
- values: null,
3347
- name: null,
3348
- prop: null,
3407
+ config: {},
3408
+ model: {},
3409
+ initValues: {},
3410
+ values: {},
3411
+ name: {},
3412
+ prop: {},
3349
3413
  disabled: { type: Boolean },
3350
- size: null,
3351
- lastValues: null
3414
+ size: {},
3415
+ lastValues: {}
3352
3416
  },
3353
3417
  emits: ["change"],
3354
3418
  setup(__props, { emit }) {
@@ -3376,12 +3440,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3376
3440
  return value === v;
3377
3441
  };
3378
3442
  const mapOptions = (data) => {
3379
- const { option } = props.config;
3380
- const { text } = option;
3381
- const { value } = option;
3443
+ const {
3444
+ option = {
3445
+ text: "text",
3446
+ value: "value"
3447
+ }
3448
+ } = props.config;
3449
+ const { text = "text", value = "value" } = option;
3382
3450
  return data.map((item) => ({
3383
- text: typeof text === "function" ? text(item) : item[text || "text"],
3384
- value: typeof value === "function" ? value(item) : item[value || "value"]
3451
+ text: typeof text === "function" ? text(item) : item[text],
3452
+ value: typeof value === "function" ? value(item) : item[value]
3385
3453
  }));
3386
3454
  };
3387
3455
  const getOptions = async () => {
@@ -3392,8 +3460,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3392
3460
  }
3393
3461
  loading.value = true;
3394
3462
  let items = [];
3395
- const { config } = props;
3396
- const { option } = config;
3463
+ const { option } = props.config;
3464
+ if (!option)
3465
+ return [];
3397
3466
  const { root = "", totalKey = "total" } = option;
3398
3467
  let { body = {}, url } = option;
3399
3468
  if (typeof url === "function") {
@@ -3440,11 +3509,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3440
3509
  postOptions
3441
3510
  });
3442
3511
  }
3443
- const optionsData = root.split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res);
3444
- const resTotal = globalThis.parseInt(
3445
- totalKey.split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res),
3446
- 10
3447
- );
3512
+ const optionsData = getValueByKeyPath(root, res);
3513
+ const resTotal = globalThis.parseInt(getValueByKeyPath(totalKey, res), 10);
3448
3514
  if (resTotal > 0) {
3449
3515
  total.value = resTotal;
3450
3516
  }
@@ -3493,8 +3559,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3493
3559
  const getInitOption = async () => {
3494
3560
  if (!props.model)
3495
3561
  return [];
3496
- const { config } = props;
3497
- const { option } = config;
3562
+ const { option } = props.config;
3563
+ if (!option)
3564
+ return [];
3498
3565
  const { root = "", initRoot = "" } = option;
3499
3566
  let { initBody = {} } = option;
3500
3567
  let options2 = [];
@@ -3544,7 +3611,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3544
3611
  postOptions
3545
3612
  });
3546
3613
  }
3547
- let initData = (initRoot || root).split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res);
3614
+ let initData = getValueByKeyPath(initRoot || root, res);
3548
3615
  if (initData) {
3549
3616
  if (!Array.isArray(initData)) {
3550
3617
  initData = [initData];
@@ -3649,36 +3716,36 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3649
3716
  const groupOptions = options;
3650
3717
  return (_ctx, _cache) => {
3651
3718
  const _directive_loading = resolveDirective("loading");
3652
- return __props.model ? withDirectives((openBlock(), createBlock(unref(TMagicSelect), {
3719
+ return _ctx.model ? withDirectives((openBlock(), createBlock(unref(TMagicSelect), {
3653
3720
  key: 0,
3654
- modelValue: __props.model[__props.name],
3655
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3721
+ modelValue: _ctx.model[_ctx.name],
3722
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3656
3723
  class: "m-select",
3657
3724
  ref_key: "tMagicSelect",
3658
3725
  ref: tMagicSelect,
3659
- clearable: typeof __props.config.clearable !== "undefined" ? __props.config.clearable : true,
3660
- filterable: typeof __props.config.filterable !== "undefined" ? __props.config.filterable : true,
3726
+ clearable: typeof _ctx.config.clearable !== "undefined" ? _ctx.config.clearable : true,
3727
+ filterable: typeof _ctx.config.filterable !== "undefined" ? _ctx.config.filterable : true,
3661
3728
  "popper-class": `m-select-popper ${unref(popperClass)}`,
3662
- size: __props.size,
3729
+ size: _ctx.size,
3663
3730
  remote: remote.value,
3664
- placeholder: __props.config.placeholder,
3665
- multiple: __props.config.multiple,
3666
- "value-key": __props.config.valueKey || "value",
3667
- "allow-create": __props.config.allowCreate,
3668
- disabled: __props.disabled,
3669
- "remote-method": __props.config.remote && remoteMethod,
3731
+ placeholder: _ctx.config.placeholder,
3732
+ multiple: _ctx.config.multiple,
3733
+ "value-key": _ctx.config.valueKey || "value",
3734
+ "allow-create": _ctx.config.allowCreate,
3735
+ disabled: _ctx.disabled,
3736
+ "remote-method": _ctx.config.remote && remoteMethod,
3670
3737
  onChange: changeHandler,
3671
3738
  onVisibleChange: visibleHandler
3672
3739
  }, {
3673
3740
  default: withCtx(() => [
3674
- __props.config.group ? (openBlock(), createBlock(_sfc_main$6, {
3741
+ _ctx.config.group ? (openBlock(), createBlock(_sfc_main$7, {
3675
3742
  key: 0,
3676
3743
  options: unref(groupOptions)
3677
- }, null, 8, ["options"])) : (openBlock(), createBlock(_sfc_main$5, {
3744
+ }, null, 8, ["options"])) : (openBlock(), createBlock(_sfc_main$6, {
3678
3745
  key: 1,
3679
3746
  options: unref(itemOptions)
3680
3747
  }, null, 8, ["options"])),
3681
- moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$1, null, 512)), [
3748
+ moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
3682
3749
  [_directive_loading, true]
3683
3750
  ]) : createCommentVNode("", true)
3684
3751
  ]),
@@ -3690,21 +3757,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3690
3757
  }
3691
3758
  });
3692
3759
 
3693
- const __default__$3 = defineComponent({
3694
- name: "MFormSwitch"
3695
- });
3696
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3697
- ...__default__$3,
3760
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3761
+ ...{
3762
+ name: "MFormSwitch"
3763
+ },
3764
+ __name: "Switch",
3698
3765
  props: {
3699
- config: null,
3700
- model: null,
3701
- initValues: null,
3702
- values: null,
3703
- name: null,
3704
- prop: null,
3766
+ config: {},
3767
+ model: {},
3768
+ initValues: {},
3769
+ values: {},
3770
+ name: {},
3771
+ prop: {},
3705
3772
  disabled: { type: Boolean },
3706
- size: null,
3707
- lastValues: null
3773
+ size: {},
3774
+ lastValues: {}
3708
3775
  },
3709
3776
  emits: ["change"],
3710
3777
  setup(__props, { emit }) {
@@ -3735,34 +3802,34 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3735
3802
  });
3736
3803
  return (_ctx, _cache) => {
3737
3804
  return openBlock(), createBlock(unref(TMagicSwitch), {
3738
- modelValue: __props.model[__props.name],
3739
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3740
- size: __props.size,
3741
- activeValue: unref(activeValue),
3742
- inactiveValue: unref(inactiveValue),
3743
- disabled: __props.disabled,
3805
+ modelValue: _ctx.model[_ctx.name],
3806
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3807
+ size: _ctx.size,
3808
+ activeValue: activeValue.value,
3809
+ inactiveValue: inactiveValue.value,
3810
+ disabled: _ctx.disabled,
3744
3811
  onChange: changeHandler
3745
3812
  }, null, 8, ["modelValue", "size", "activeValue", "inactiveValue", "disabled"]);
3746
3813
  };
3747
3814
  }
3748
3815
  });
3749
3816
 
3750
- const _hoisted_1 = { key: 0 };
3751
- const __default__$2 = defineComponent({
3752
- name: "MFormText"
3753
- });
3754
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3755
- ...__default__$2,
3817
+ const _hoisted_1$1 = { key: 0 };
3818
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3819
+ ...{
3820
+ name: "MFormText"
3821
+ },
3822
+ __name: "Text",
3756
3823
  props: {
3757
- config: null,
3758
- model: null,
3759
- initValues: null,
3760
- values: null,
3761
- name: null,
3762
- prop: null,
3824
+ config: {},
3825
+ model: {},
3826
+ initValues: {},
3827
+ values: {},
3828
+ name: {},
3829
+ prop: {},
3763
3830
  disabled: { type: Boolean },
3764
- size: null,
3765
- lastValues: null
3831
+ size: {},
3832
+ lastValues: {}
3766
3833
  },
3767
3834
  emits: ["change", "input"],
3768
3835
  setup(__props, { emit }) {
@@ -3839,53 +3906,54 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3839
3906
  };
3840
3907
  return (_ctx, _cache) => {
3841
3908
  return openBlock(), createBlock(unref(TMagicInput), {
3842
- modelValue: __props.model[__props.name],
3843
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3909
+ modelValue: _ctx.model[_ctx.name],
3910
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3844
3911
  clearable: "",
3845
- size: __props.size,
3846
- placeholder: __props.config.placeholder,
3847
- disabled: __props.disabled,
3912
+ size: _ctx.size,
3913
+ placeholder: _ctx.config.placeholder,
3914
+ disabled: _ctx.disabled,
3848
3915
  onChange: changeHandler,
3849
3916
  onInput: inputHandler,
3850
3917
  onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
3851
3918
  }, createSlots({ _: 2 }, [
3852
- __props.config.append ? {
3919
+ _ctx.config.append ? {
3853
3920
  name: "append",
3854
3921
  fn: withCtx(() => [
3855
- typeof __props.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.config.append), 1)) : createCommentVNode("", true),
3856
- typeof __props.config.append === "object" && __props.config.append.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
3922
+ typeof _ctx.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(_ctx.config.append), 1)) : createCommentVNode("", true),
3923
+ typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
3857
3924
  key: 1,
3858
3925
  style: { "color": "#409eff" },
3859
- size: __props.size,
3926
+ size: _ctx.size,
3860
3927
  onClick: withModifiers(buttonClickHandler, ["prevent"])
3861
3928
  }, {
3862
3929
  default: withCtx(() => [
3863
- createTextVNode(toDisplayString(__props.config.append.text), 1)
3930
+ createTextVNode(toDisplayString(_ctx.config.append.text), 1)
3864
3931
  ]),
3865
3932
  _: 1
3866
3933
  }, 8, ["size", "onClick"])) : createCommentVNode("", true)
3867
- ])
3934
+ ]),
3935
+ key: "0"
3868
3936
  } : void 0
3869
3937
  ]), 1032, ["modelValue", "size", "placeholder", "disabled"]);
3870
3938
  };
3871
3939
  }
3872
3940
  });
3873
3941
 
3874
- const __default__$1 = defineComponent({
3875
- name: "MFormTextarea"
3876
- });
3877
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3878
- ...__default__$1,
3942
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3943
+ ...{
3944
+ name: "MFormTextarea"
3945
+ },
3946
+ __name: "Textarea",
3879
3947
  props: {
3880
- config: null,
3881
- model: null,
3882
- initValues: null,
3883
- values: null,
3884
- name: null,
3885
- prop: null,
3948
+ config: {},
3949
+ model: {},
3950
+ initValues: {},
3951
+ values: {},
3952
+ name: {},
3953
+ prop: {},
3886
3954
  disabled: { type: Boolean },
3887
- size: null,
3888
- lastValues: null
3955
+ size: {},
3956
+ lastValues: {}
3889
3957
  },
3890
3958
  emits: ["change", "input"],
3891
3959
  setup(__props, { emit }) {
@@ -3901,13 +3969,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3901
3969
  };
3902
3970
  return (_ctx, _cache) => {
3903
3971
  return openBlock(), createBlock(unref(TMagicInput), {
3904
- modelValue: __props.model[__props.name],
3905
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3972
+ modelValue: _ctx.model[_ctx.name],
3973
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3906
3974
  type: "textarea",
3907
- size: __props.size,
3975
+ size: _ctx.size,
3908
3976
  clearable: "",
3909
- placeholder: __props.config.placeholder,
3910
- disabled: __props.disabled,
3977
+ placeholder: _ctx.config.placeholder,
3978
+ disabled: _ctx.disabled,
3911
3979
  onChange: changeHandler,
3912
3980
  onInput: inputHandler
3913
3981
  }, null, 8, ["modelValue", "size", "placeholder", "disabled"]);
@@ -3915,21 +3983,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3915
3983
  }
3916
3984
  });
3917
3985
 
3918
- const __default__ = defineComponent({
3919
- name: "MFormTime"
3920
- });
3921
- const _sfc_main = /* @__PURE__ */ defineComponent({
3922
- ...__default__,
3986
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3987
+ ...{
3988
+ name: "MFormTime"
3989
+ },
3990
+ __name: "Time",
3923
3991
  props: {
3924
- config: null,
3925
- model: null,
3926
- initValues: null,
3927
- values: null,
3928
- name: null,
3929
- prop: null,
3992
+ config: {},
3993
+ model: {},
3994
+ initValues: {},
3995
+ values: {},
3996
+ name: {},
3997
+ prop: {},
3930
3998
  disabled: { type: Boolean },
3931
- size: null,
3932
- lastValues: null
3999
+ size: {},
4000
+ lastValues: {}
3933
4001
  },
3934
4002
  emits: ["change"],
3935
4003
  setup(__props, { emit }) {
@@ -3940,13 +4008,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3940
4008
  };
3941
4009
  return (_ctx, _cache) => {
3942
4010
  return openBlock(), createBlock(unref(TMagicTimePicker), {
3943
- modelValue: __props.model[__props.name],
3944
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3945
- "value-format": __props.config.valueFormat || "HH:mm:ss",
3946
- format: __props.config.format || "HH:mm:ss",
3947
- size: __props.size,
3948
- placeholder: __props.config.placeholder,
3949
- disabled: __props.disabled,
4011
+ modelValue: _ctx.model[_ctx.name],
4012
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
4013
+ "value-format": _ctx.config.valueFormat || "HH:mm:ss",
4014
+ format: _ctx.config.format || "HH:mm:ss",
4015
+ size: _ctx.size,
4016
+ placeholder: _ctx.config.placeholder,
4017
+ disabled: _ctx.disabled,
3950
4018
  onChange: changeHandler
3951
4019
  }, null, 8, ["modelValue", "value-format", "format", "size", "placeholder", "disabled"]);
3952
4020
  };
@@ -3955,43 +4023,188 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3955
4023
 
3956
4024
  const index$1 = '';
3957
4025
 
4026
+ const _hoisted_1 = { style: { "min-height": "1px" } };
4027
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4028
+ ...{
4029
+ name: "MFormDialog"
4030
+ },
4031
+ __name: "FormDrawer",
4032
+ props: {
4033
+ config: { default: () => [] },
4034
+ values: { default: () => ({}) },
4035
+ parentValues: {},
4036
+ width: {},
4037
+ labelWidth: {},
4038
+ disabled: { type: Boolean },
4039
+ closeOnPressEscape: { type: Boolean, default: true },
4040
+ title: {},
4041
+ zIndex: {},
4042
+ size: {},
4043
+ confirmText: { default: "确定" }
4044
+ },
4045
+ emits: ["close", "submit", "error", "change", "open", "opened"],
4046
+ setup(__props, { expose: __expose, emit }) {
4047
+ const form = ref();
4048
+ const drawerBody = ref();
4049
+ const visible = ref(false);
4050
+ const saveFetch = ref(false);
4051
+ const bodyHeight = ref(0);
4052
+ watchEffect(() => {
4053
+ if (drawerBody.value) {
4054
+ bodyHeight.value = drawerBody.value.clientHeight;
4055
+ }
4056
+ });
4057
+ const submitHandler = async () => {
4058
+ try {
4059
+ const values = await form.value?.submitForm();
4060
+ emit("submit", values);
4061
+ } catch (e) {
4062
+ emit("error", e);
4063
+ }
4064
+ };
4065
+ const changeHandler = (value) => {
4066
+ emit("change", value);
4067
+ };
4068
+ const openHandler = (value) => {
4069
+ emit("open", value);
4070
+ };
4071
+ const openedHandler = (value) => {
4072
+ emit("opened", value);
4073
+ };
4074
+ const show = () => {
4075
+ visible.value = true;
4076
+ };
4077
+ const hide = () => {
4078
+ visible.value = false;
4079
+ };
4080
+ __expose({
4081
+ form,
4082
+ saveFetch,
4083
+ bodyHeight,
4084
+ show,
4085
+ hide
4086
+ });
4087
+ return (_ctx, _cache) => {
4088
+ return openBlock(), createBlock(unref(TMagicDrawer), {
4089
+ class: "m-form-drawer",
4090
+ modelValue: visible.value,
4091
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
4092
+ title: _ctx.title,
4093
+ "close-on-press-escape": _ctx.closeOnPressEscape,
4094
+ "append-to-body": true,
4095
+ "show-close": true,
4096
+ "close-on-click-modal": true,
4097
+ size: _ctx.width,
4098
+ zIndex: _ctx.zIndex,
4099
+ onOpen: openHandler,
4100
+ onOpened: openedHandler
4101
+ }, {
4102
+ footer: withCtx(() => [
4103
+ createVNode(unref(TMagicRow), { class: "dialog-footer" }, {
4104
+ default: withCtx(() => [
4105
+ createVNode(unref(TMagicCol), {
4106
+ span: 12,
4107
+ style: { "text-align": "left" }
4108
+ }, {
4109
+ default: withCtx(() => [
4110
+ createElementVNode("div", _hoisted_1, [
4111
+ renderSlot(_ctx.$slots, "left")
4112
+ ])
4113
+ ]),
4114
+ _: 3
4115
+ }),
4116
+ createVNode(unref(TMagicCol), { span: 12 }, {
4117
+ default: withCtx(() => [
4118
+ renderSlot(_ctx.$slots, "footer", {}, () => [
4119
+ createVNode(unref(TMagicButton), { onClick: hide }, {
4120
+ default: withCtx(() => [
4121
+ createTextVNode("关闭")
4122
+ ]),
4123
+ _: 1
4124
+ }),
4125
+ createVNode(unref(TMagicButton), {
4126
+ type: "primary",
4127
+ disabled: _ctx.disabled,
4128
+ loading: saveFetch.value,
4129
+ onClick: submitHandler
4130
+ }, {
4131
+ default: withCtx(() => [
4132
+ createTextVNode(toDisplayString(_ctx.confirmText), 1)
4133
+ ]),
4134
+ _: 1
4135
+ }, 8, ["disabled", "loading"])
4136
+ ])
4137
+ ]),
4138
+ _: 3
4139
+ })
4140
+ ]),
4141
+ _: 3
4142
+ })
4143
+ ]),
4144
+ default: withCtx(() => [
4145
+ visible.value ? (openBlock(), createElementBlock("div", {
4146
+ key: 0,
4147
+ ref_key: "drawerBody",
4148
+ ref: drawerBody,
4149
+ class: "m-drawer-body"
4150
+ }, [
4151
+ createVNode(_sfc_main$d, {
4152
+ ref_key: "form",
4153
+ ref: form,
4154
+ size: _ctx.size,
4155
+ disabled: _ctx.disabled,
4156
+ config: _ctx.config,
4157
+ "init-values": _ctx.values,
4158
+ "parent-values": _ctx.parentValues,
4159
+ "label-width": _ctx.labelWidth,
4160
+ onChange: changeHandler
4161
+ }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width"]),
4162
+ renderSlot(_ctx.$slots, "default")
4163
+ ], 512)) : createCommentVNode("", true)
4164
+ ]),
4165
+ _: 3
4166
+ }, 8, ["modelValue", "title", "close-on-press-escape", "size", "zIndex"]);
4167
+ };
4168
+ }
4169
+ });
4170
+
3958
4171
  const defaultInstallOpt = {};
3959
- const install = (app, opt) => {
3960
- const option = Object.assign(defaultInstallOpt, opt);
3961
- app.config.globalProperties.$MAGIC_FORM = option;
3962
- setConfig(option);
3963
- app.component("m-form", _sfc_main$b);
3964
- app.component("m-form-dialog", _sfc_main$a);
3965
- app.component("m-form-container", _sfc_main$v);
3966
- app.component("m-form-fieldset", _sfc_main$u);
3967
- app.component("m-form-group-list", _sfc_main$s);
3968
- app.component("m-form-panel", _sfc_main$r);
3969
- app.component("m-form-row", _sfc_main$p);
3970
- app.component("m-form-step", _sfc_main$o);
3971
- app.component("m-form-table", _sfc_main$n);
3972
- app.component("m-form-tab", _sfc_main$m);
3973
- app.component("m-fields-text", _sfc_main$2);
3974
- app.component("m-fields-number", _sfc_main$8);
3975
- app.component("m-fields-textarea", _sfc_main$1);
3976
- app.component("m-fields-hidden", _sfc_main$c);
3977
- app.component("m-fields-date", _sfc_main$h);
3978
- app.component("m-fields-datetime", _sfc_main$f);
3979
- app.component("m-fields-daterange", _sfc_main$g);
3980
- app.component("m-fields-time", _sfc_main);
3981
- app.component("m-fields-checkbox", _sfc_main$k);
3982
- app.component("m-fields-switch", _sfc_main$3);
3983
- app.component("m-fields-color-picker", _sfc_main$i);
3984
- app.component("m-fields-checkbox-group", _sfc_main$j);
3985
- app.component("m-fields-radio-group", _sfc_main$7);
3986
- app.component("m-fields-display", _sfc_main$e);
3987
- app.component("m-fields-link", _sfc_main$9);
3988
- app.component("m-fields-select", _sfc_main$4);
3989
- app.component("m-fields-cascader", _sfc_main$l);
3990
- app.component("m-fields-dynamic-field", _sfc_main$d);
3991
- };
3992
4172
  const index = {
3993
- install
4173
+ install(app, opt = {}) {
4174
+ const option = Object.assign(defaultInstallOpt, opt);
4175
+ app.config.globalProperties.$MAGIC_FORM = option;
4176
+ setConfig(option);
4177
+ app.component("m-form", _sfc_main$d);
4178
+ app.component("m-form-dialog", _sfc_main$c);
4179
+ app.component("m-form-container", _sfc_main$x);
4180
+ app.component("m-form-fieldset", _sfc_main$w);
4181
+ app.component("m-form-group-list", _sfc_main$u);
4182
+ app.component("m-form-panel", _sfc_main$t);
4183
+ app.component("m-form-row", _sfc_main$r);
4184
+ app.component("m-form-step", _sfc_main$q);
4185
+ app.component("m-form-table", _sfc_main$p);
4186
+ app.component("m-form-tab", _sfc_main$o);
4187
+ app.component("m-fields-text", _sfc_main$3);
4188
+ app.component("m-fields-number", _sfc_main$a);
4189
+ app.component("m-fields-number-range", _sfc_main$9);
4190
+ app.component("m-fields-textarea", _sfc_main$2);
4191
+ app.component("m-fields-hidden", _sfc_main$e);
4192
+ app.component("m-fields-date", _sfc_main$j);
4193
+ app.component("m-fields-datetime", _sfc_main$h);
4194
+ app.component("m-fields-daterange", _sfc_main$i);
4195
+ app.component("m-fields-time", _sfc_main$1);
4196
+ app.component("m-fields-checkbox", _sfc_main$m);
4197
+ app.component("m-fields-switch", _sfc_main$4);
4198
+ app.component("m-fields-color-picker", _sfc_main$k);
4199
+ app.component("m-fields-checkbox-group", _sfc_main$l);
4200
+ app.component("m-fields-radio-group", _sfc_main$8);
4201
+ app.component("m-fields-display", _sfc_main$g);
4202
+ app.component("m-fields-link", _sfc_main$b);
4203
+ app.component("m-fields-select", _sfc_main$5);
4204
+ app.component("m-fields-cascader", _sfc_main$n);
4205
+ app.component("m-fields-dynamic-field", _sfc_main$f);
4206
+ }
3994
4207
  };
3995
4208
 
3996
- 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 };
4209
+ export { _sfc_main$n as MCascader, _sfc_main$m as MCheckbox, _sfc_main$l as MCheckboxGroup, _sfc_main$k as MColorPicker, _sfc_main$x as MContainer, _sfc_main$j as MDate, _sfc_main$h as MDateTime, _sfc_main$i as MDaterange, _sfc_main$g as MDisplay, _sfc_main$f as MDynamicField, _sfc_main$w as MFieldset, _sfc_main$d as MForm, _sfc_main$c as MFormDialog, _sfc_main as MFormDrawer, _sfc_main$u as MGroupList, _sfc_main$e as MHidden, _sfc_main$b as MLink, _sfc_main$a as MNumber, _sfc_main$9 as MNumberRange, _sfc_main$t as MPanel, _sfc_main$8 as MRadioGroup, _sfc_main$r as MRow, _sfc_main$5 as MSelect, _sfc_main$4 as MSwitch, _sfc_main$p as MTable, _sfc_main$o as MTabs, _sfc_main$3 as MText, _sfc_main$2 as MTextarea, _sfc_main$1 as MTime, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
3997
4210
  //# sourceMappingURL=tmagic-form.js.map