@tmagic/form 1.6.1 → 1.7.0-beta.0

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 (42) hide show
  1. package/dist/style.css +23 -3
  2. package/dist/tmagic-form.js +1706 -1496
  3. package/dist/tmagic-form.umd.cjs +1739 -1525
  4. package/package.json +4 -4
  5. package/src/Form.vue +18 -5
  6. package/src/containers/Container.vue +109 -134
  7. package/src/containers/Fieldset.vue +31 -7
  8. package/src/containers/FlexLayout.vue +59 -0
  9. package/src/containers/Tabs.vue +11 -1
  10. package/src/fields/Cascader.vue +25 -16
  11. package/src/fields/Checkbox.vue +3 -3
  12. package/src/fields/CheckboxGroup.vue +1 -1
  13. package/src/fields/ColorPicker.vue +2 -2
  14. package/src/fields/Date.vue +2 -2
  15. package/src/fields/DateTime.vue +2 -2
  16. package/src/fields/Daterange.vue +2 -2
  17. package/src/fields/Number.vue +2 -2
  18. package/src/fields/NumberRange.vue +6 -6
  19. package/src/fields/RadioGroup.vue +7 -15
  20. package/src/fields/Select.vue +2 -2
  21. package/src/fields/Switch.vue +2 -2
  22. package/src/fields/Text.vue +20 -8
  23. package/src/fields/Textarea.vue +2 -2
  24. package/src/fields/Time.vue +2 -2
  25. package/src/fields/Timerange.vue +2 -2
  26. package/src/index.ts +5 -2
  27. package/src/table/ActionsColumn.vue +97 -0
  28. package/src/table/SortColumn.vue +101 -0
  29. package/src/table/Table.vue +170 -0
  30. package/src/table/type.ts +18 -0
  31. package/src/table/useAdd.ts +111 -0
  32. package/src/table/useFullscreen.ts +28 -0
  33. package/src/table/useImport.ts +68 -0
  34. package/src/table/usePagination.ts +30 -0
  35. package/src/table/useSelection.ts +34 -0
  36. package/src/table/useSortable.ts +48 -0
  37. package/src/table/useTableColumns.ts +194 -0
  38. package/src/theme/container.scss +17 -0
  39. package/src/theme/form.scss +15 -3
  40. package/src/utils/form.ts +56 -2
  41. package/types/index.d.ts +52 -36
  42. package/src/containers/Table.vue +0 -681
@@ -1,12 +1,12 @@
1
- import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, normalizeStyle, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, shallowRef, withModifiers, onBeforeMount, nextTick, resolveDirective, createSlots } from 'vue';
1
+ import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, createCommentVNode, mergeProps, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, readonly, withDirectives, vShow, renderSlot, getCurrentInstance, createSlots, reactive, onBeforeUnmount, vModelText, useTemplateRef, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, withModifiers, Teleport, h } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, DocumentCopy, CaretTop, Position, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual, isEmpty, debounce } from 'lodash-es';
4
- import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
5
- import { setValueByKeyPath, asyncLoadJs, getValueByKeyPath, isNumber } from '@tmagic/utils';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessage, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, useZIndex, TMagicTable, TMagicUpload, TMagicPagination, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
5
+ import { getValueByKeyPath, setValueByKeyPath, isNumber, asyncLoadJs } from '@tmagic/utils';
6
6
  import dayjs from 'dayjs';
7
7
  import utc from 'dayjs/plugin/utc';
8
- import Sortable from 'sortablejs';
9
8
  import { createPopper } from '@popperjs/core';
9
+ import Sortable from 'sortablejs';
10
10
  export * from '@tmagic/form-schema';
11
11
 
12
12
  const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
@@ -38,8 +38,10 @@ const setValue = (mForm, value, initValue2, item) => {
38
38
  value[name] = getDefaultValue(mForm, item);
39
39
  }
40
40
  if (type === "fieldset" && checkbox) {
41
- if (typeof value[name] === "object") {
42
- value[name].value = typeof initValue2[name] === "object" ? initValue2[name].value || 0 : 0;
41
+ const checkboxName = typeof checkbox === "object" && typeof checkbox.name === "string" ? checkbox.name : "value";
42
+ const checkboxFalseValue = typeof checkbox === "object" && typeof checkbox.falseValue !== "undefined" ? checkbox.falseValue : 0;
43
+ if (name && typeof value[name] === "object") {
44
+ value[name][checkboxName] = typeof initValue2[name] === "object" ? initValue2[name][checkboxName] || checkboxFalseValue : checkboxFalseValue;
43
45
  }
44
46
  }
45
47
  };
@@ -69,6 +71,16 @@ const initValueItem = function(mForm, item, initValue2, value) {
69
71
  return createValues(mForm, items, initValue2, value);
70
72
  }
71
73
  setValue(mForm, value, initValue2, item);
74
+ if (type === "table") {
75
+ if (item.defautSort) {
76
+ sortChange(value[name], item.defautSort);
77
+ } else if (item.defaultSort) {
78
+ sortChange(value[name], item.defaultSort);
79
+ }
80
+ if (item.sort && item.sortKey) {
81
+ value[name].sort((a, b) => b[item.sortKey] - a[item.sortKey]);
82
+ }
83
+ }
72
84
  return value;
73
85
  };
74
86
  const createValues = function(mForm, config = [], initValue2 = {}, value = {}) {
@@ -109,7 +121,8 @@ const filterFunction = (mForm, config, props) => {
109
121
  formValue: mForm?.values || props.model,
110
122
  prop: props.prop,
111
123
  config: props.config,
112
- index: props.index
124
+ index: props.index,
125
+ getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
113
126
  });
114
127
  }
115
128
  return config;
@@ -186,25 +199,47 @@ const datetimeFormatter = (v, defaultValue = "-", format = "YYYY-MM-DD HH:mm:ss"
186
199
  }
187
200
  return defaultValue;
188
201
  };
202
+ const getDataByPage = (data = [], pagecontext, pagesize) => data.filter(
203
+ (item, index) => index >= pagecontext * pagesize && index + 1 <= (pagecontext + 1) * pagesize
204
+ );
205
+ const sortArray = (data, newIndex, oldIndex, sortKey) => {
206
+ if (newIndex === oldIndex) {
207
+ return data;
208
+ }
209
+ if (newIndex < 0 || newIndex >= data.length || oldIndex < 0 || oldIndex >= data.length) {
210
+ return data;
211
+ }
212
+ const newData = data.toSpliced(newIndex, 0, ...data.splice(oldIndex, 1));
213
+ if (sortKey) {
214
+ for (let i = newData.length - 1, v = 0; i >= 0; i--, v++) {
215
+ newData[v][sortKey] = i;
216
+ }
217
+ }
218
+ return newData;
219
+ };
220
+ const sortChange = (data, { prop, order }) => {
221
+ if (order === "ascending") {
222
+ data = data.sort((a, b) => a[prop] - b[prop]);
223
+ } else if (order === "descending") {
224
+ data = data.sort((a, b) => b[prop] - a[prop]);
225
+ }
226
+ };
189
227
 
190
- const _hoisted_1$e = ["data-tmagic-id", "data-tmagic-form-item-prop"];
228
+ const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
191
229
  const _hoisted_2$7 = ["innerHTML", "title"];
192
- const _hoisted_3$5 = ["innerHTML"];
230
+ const _hoisted_3$6 = ["innerHTML"];
193
231
  const _hoisted_4$3 = ["innerHTML"];
194
- const _hoisted_5$3 = ["innerHTML"];
195
- const _hoisted_6$2 = ["innerHTML", "title"];
232
+ const _hoisted_5$3 = ["innerHTML", "title"];
233
+ const _hoisted_6$1 = ["innerHTML"];
196
234
  const _hoisted_7$1 = ["innerHTML"];
197
- const _hoisted_8$1 = ["innerHTML"];
235
+ const _hoisted_8$1 = ["innerHTML", "title"];
198
236
  const _hoisted_9 = ["innerHTML"];
199
- const _hoisted_10 = ["innerHTML", "title"];
200
- const _hoisted_11 = ["innerHTML"];
201
- const _hoisted_12 = ["innerHTML"];
202
- const _hoisted_13 = ["innerHTML"];
203
- const _hoisted_14 = {
237
+ const _hoisted_10 = ["innerHTML"];
238
+ const _hoisted_11 = {
204
239
  key: 5,
205
240
  style: { "text-align": "center" }
206
241
  };
207
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
242
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
208
243
  ...{
209
244
  name: "MFormContainer"
210
245
  },
@@ -258,8 +293,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
258
293
  });
259
294
  const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
260
295
  const text = computed(() => filterFunction(mForm, props.config.text, props));
261
- const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
262
- const extra = computed(() => filterFunction(mForm, props.config.extra, props));
296
+ const tooltip = computed(() => {
297
+ const config = filterFunction(mForm, props.config.tooltip, props);
298
+ if (typeof config === "string") {
299
+ return {
300
+ text: config,
301
+ placement: "top"
302
+ };
303
+ }
304
+ return {
305
+ text: config?.text,
306
+ placement: config?.placement || "top"
307
+ };
308
+ });
263
309
  const rule = computed(() => getRules(mForm, props.config.rules, props));
264
310
  const type = computed(() => {
265
311
  let { type: type2 } = props.config;
@@ -275,6 +321,22 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
275
321
  }
276
322
  return value;
277
323
  });
324
+ const fieldsProps = computed(() => ({
325
+ size: props.size,
326
+ config: props.config,
327
+ name: name.value,
328
+ disabled: disabled.value,
329
+ prop: itemProp.value,
330
+ key: props.config[mForm?.keyProps],
331
+ style: props.config.fieldStyle
332
+ }));
333
+ const formItemProps = computed(() => ({
334
+ prop: itemProp.value,
335
+ labelWidth: itemLabelWidth.value,
336
+ labelPosition: props.config.labelPosition,
337
+ rules: rule.value,
338
+ extra: filterFunction(mForm, props.config.extra, props)
339
+ }));
278
340
  const itemLabelWidth = computed(() => props.config.labelWidth ?? props.labelWidth);
279
341
  watchEffect(() => {
280
342
  expand.value = props.expandMore;
@@ -301,7 +363,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
301
363
  values: mForm?.initValues,
302
364
  formValue: mForm?.values,
303
365
  prop: itemProp.value,
304
- config: props.config
366
+ config: props.config,
367
+ getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
305
368
  });
306
369
  }
307
370
  if (filter === "number") {
@@ -329,27 +392,50 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
329
392
  }
330
393
  return true;
331
394
  };
395
+ const createModelProxy = (target, setModelFn, pathPrefix = "") => {
396
+ return new Proxy(target, {
397
+ get: (obj, key2) => {
398
+ const value = obj[key2];
399
+ if (value && typeof value === "object") {
400
+ const newPath = pathPrefix ? `${pathPrefix}.${key2}` : key2;
401
+ return createModelProxy(value, setModelFn, newPath);
402
+ }
403
+ return value;
404
+ },
405
+ set: (obj, key2, value) => {
406
+ setModelFn(pathPrefix ? `${pathPrefix}.${key2}` : key2, value);
407
+ return true;
408
+ }
409
+ });
410
+ };
332
411
  const onChangeHandler = async function(v, eventData = {}) {
333
- const { filter, onChange, trim, dynamicKey } = props.config;
412
+ const { filter, onChange, trim } = props.config;
334
413
  let value = toRaw(v);
335
414
  const changeRecords = eventData.changeRecords || [];
336
415
  const newChangeRecords = [...changeRecords];
337
416
  try {
338
417
  value = filterHandler(filter, v);
339
418
  if (typeof onChange === "function") {
419
+ const setModel = (key2, value2) => {
420
+ if (props.config.name) {
421
+ newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
422
+ } else {
423
+ newChangeRecords.push({ propPath: itemProp.value, value: value2 });
424
+ }
425
+ };
426
+ const setFormValue = (key2, value2) => {
427
+ newChangeRecords.push({ propPath: key2, value: value2 });
428
+ };
340
429
  value = await onChange(mForm, value, {
341
- model: props.model,
342
- values: mForm?.initValues,
343
- formValue: mForm?.values,
430
+ model: createModelProxy(props.model, setModel),
431
+ values: mForm ? readonly(mForm.initValues) : null,
432
+ formValue: createModelProxy(mForm?.values || {}, setFormValue),
344
433
  prop: itemProp.value,
345
434
  config: props.config,
346
435
  changeRecords: newChangeRecords,
347
- setModel: (key2, value2) => {
348
- setValueByKeyPath(key2, value2, props.model);
349
- if (props.config.name) {
350
- newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
351
- }
352
- }
436
+ setModel,
437
+ setFormValue,
438
+ getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
353
439
  }) ?? value;
354
440
  }
355
441
  value = trimHandler(trim, value) ?? value;
@@ -358,15 +444,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
358
444
  }
359
445
  let valueProp = itemProp.value;
360
446
  if (hasModifyKey(eventData)) {
361
- if (dynamicKey) {
362
- props.model[eventData.modifyKey] = value;
363
- } else if (isValidName()) {
364
- props.model[name.value][eventData.modifyKey] = value;
365
- }
366
447
  valueProp = valueProp ? `${valueProp}.${eventData.modifyKey}` : eventData.modifyKey;
367
448
  delete eventData.modifyKey;
368
- } else if (isValidName() && props.model !== value && (v !== value || props.model[name.value] !== value)) {
369
- props.model[name.value] = value;
370
449
  }
371
450
  if (changeRecords.length === 0) {
372
451
  newChangeRecords.push({
@@ -382,95 +461,65 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
382
461
  return (_ctx, _cache) => {
383
462
  const _component_m_fields_hidden = resolveComponent("m-fields-hidden");
384
463
  const _component_Container = resolveComponent("Container", true);
385
- return __props.config ? (openBlock(), createElementBlock("div", {
386
- key: 0,
464
+ return openBlock(), createElementBlock("div", {
387
465
  "data-tmagic-id": __props.config.id,
388
466
  "data-tmagic-form-item-prop": itemProp.value,
389
- style: normalizeStyle(__props.config.tip ? "display: flex;align-items: baseline;" : ""),
390
- class: normalizeClass(`m-form-container m-container-${type.value || ""} ${__props.config.className || ""}`)
467
+ class: normalizeClass(`m-form-container m-container-${type.value || ""} ${__props.config.className || ""}${__props.config.tip ? " has-tip" : ""}`),
468
+ style: normalizeStyle(__props.config.style)
391
469
  }, [
392
- type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
393
- key: 0,
394
- model: __props.model,
395
- config: __props.config,
396
- name: __props.config.name,
397
- disabled: disabled.value,
398
- prop: itemProp.value
399
- }, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
400
- key: key(__props.config),
401
- size: __props.size,
470
+ type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, mergeProps({ key: 0 }, fieldsProps.value, { model: __props.model }), null, 16, ["model"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
402
471
  model: __props.model,
403
472
  "last-values": __props.lastValues,
404
473
  "is-compare": __props.isCompare,
405
- config: __props.config,
406
- disabled: disabled.value,
407
- name: name.value,
408
- prop: itemProp.value,
409
474
  "step-active": __props.stepActive,
410
475
  "expand-more": expand.value,
411
476
  "label-width": itemLabelWidth.value,
477
+ style: __props.config.fieldStyle,
412
478
  onChange: onChangeHandler,
413
479
  onAddDiffCount
414
- }, 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(
480
+ }), null, 16, ["model", "last-values", "is-compare", "step-active", "expand-more", "label-width", "style"])) : type.value && display$1.value && !showDiff.value ? (openBlock(), createElementBlock(
415
481
  Fragment,
416
482
  { key: 2 },
417
483
  [
418
- createVNode(unref(TMagicFormItem), {
419
- style: normalizeStyle(__props.config.tip ? "flex: 1" : ""),
420
- class: normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
421
- prop: itemProp.value,
422
- "label-width": itemLabelWidth.value,
423
- "label-position": __props.config.labelPosition,
424
- rules: rule.value
425
- }, {
484
+ createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
485
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }
486
+ }), {
426
487
  label: withCtx(() => [
427
488
  createElementVNode("span", {
428
- innerHTML: type.value === "checkbox" ? "" : text.value,
489
+ innerHTML: type.value === "checkbox" && !__props.config.useLabel ? "" : text.value,
429
490
  title: __props.config.labelTitle
430
491
  }, null, 8, _hoisted_2$7)
431
492
  ]),
432
493
  default: withCtx(() => [
433
- tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
494
+ tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
495
+ key: 0,
496
+ placement: tooltip.value.placement
497
+ }, {
434
498
  content: withCtx(() => [
435
- createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
499
+ createElementVNode("div", {
500
+ innerHTML: tooltip.value.text
501
+ }, null, 8, _hoisted_3$6)
436
502
  ]),
437
503
  default: withCtx(() => [
438
- (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
439
- key: key(__props.config),
440
- size: __props.size,
504
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
441
505
  model: __props.model,
442
506
  "last-values": __props.lastValues,
443
- config: __props.config,
444
- name: name.value,
445
- disabled: disabled.value,
446
- prop: itemProp.value,
447
507
  onChange: onChangeHandler,
448
508
  onAddDiffCount
449
- }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"]))
509
+ }), null, 16, ["model", "last-values"]))
450
510
  ]),
451
511
  _: 1
452
512
  /* STABLE */
453
- })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
454
- key: key(__props.config),
455
- size: __props.size,
513
+ }, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
456
514
  model: __props.model,
457
515
  "last-values": __props.lastValues,
458
- config: __props.config,
459
- name: name.value,
460
- disabled: disabled.value,
461
- prop: itemProp.value,
462
516
  onChange: onChangeHandler,
463
517
  onAddDiffCount
464
- }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"])),
465
- extra.value && type.value !== "table" ? (openBlock(), createElementBlock("div", {
466
- key: 2,
467
- innerHTML: extra.value,
468
- class: "m-form-tip"
469
- }, null, 8, _hoisted_4$3)) : createCommentVNode("v-if", true)
518
+ }), null, 16, ["model", "last-values"]))
470
519
  ]),
471
520
  _: 1
472
521
  /* STABLE */
473
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
522
+ }, 16, ["class"]),
474
523
  __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
475
524
  key: 0,
476
525
  placement: "left"
@@ -478,7 +527,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
478
527
  content: withCtx(() => [
479
528
  createElementVNode("div", {
480
529
  innerHTML: __props.config.tip
481
- }, null, 8, _hoisted_5$3)
530
+ }, null, 8, _hoisted_4$3)
482
531
  ]),
483
532
  default: withCtx(() => [
484
533
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -501,58 +550,41 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
501
550
  [
502
551
  createCommentVNode(" 对比 "),
503
552
  createCommentVNode(" 上次内容 "),
504
- createVNode(unref(TMagicFormItem), {
505
- style: normalizeStyle([__props.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
506
- class: normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
507
- prop: itemProp.value,
508
- "label-width": itemLabelWidth.value,
509
- "label-position": __props.config.labelPosition,
510
- rules: rule.value
511
- }, {
553
+ createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
554
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
555
+ }), {
512
556
  label: withCtx(() => [
513
557
  createElementVNode("span", {
514
558
  innerHTML: type.value === "checkbox" ? "" : text.value,
515
559
  title: __props.config.labelTitle
516
- }, null, 8, _hoisted_6$2)
560
+ }, null, 8, _hoisted_5$3)
517
561
  ]),
518
562
  default: withCtx(() => [
519
- tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
563
+ tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
564
+ key: 0,
565
+ placement: tooltip.value.placement
566
+ }, {
520
567
  content: withCtx(() => [
521
- createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_7$1)
568
+ createElementVNode("div", {
569
+ innerHTML: tooltip.value.text
570
+ }, null, 8, _hoisted_6$1)
522
571
  ]),
523
572
  default: withCtx(() => [
524
- (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
525
- key: key(__props.config),
526
- size: __props.size,
573
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
527
574
  model: __props.lastValues,
528
- config: __props.config,
529
- name: name.value,
530
- disabled: disabled.value,
531
- prop: itemProp.value,
532
575
  onChange: onChangeHandler
533
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
576
+ }), null, 16, ["model"]))
534
577
  ]),
535
578
  _: 1
536
579
  /* STABLE */
537
- })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
538
- key: key(__props.config),
539
- size: __props.size,
580
+ }, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
540
581
  model: __props.lastValues,
541
- config: __props.config,
542
- name: name.value,
543
- disabled: disabled.value,
544
- prop: itemProp.value,
545
582
  onChange: onChangeHandler
546
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
547
- extra.value ? (openBlock(), createElementBlock("div", {
548
- key: 2,
549
- innerHTML: extra.value,
550
- class: "m-form-tip"
551
- }, null, 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
583
+ }), null, 16, ["model"]))
552
584
  ]),
553
585
  _: 1
554
586
  /* STABLE */
555
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
587
+ }, 16, ["class"]),
556
588
  __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
557
589
  key: 0,
558
590
  placement: "left"
@@ -560,7 +592,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
560
592
  content: withCtx(() => [
561
593
  createElementVNode("div", {
562
594
  innerHTML: __props.config.tip
563
- }, null, 8, _hoisted_9)
595
+ }, null, 8, _hoisted_7$1)
564
596
  ]),
565
597
  default: withCtx(() => [
566
598
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -575,58 +607,42 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
575
607
  /* STABLE */
576
608
  })) : createCommentVNode("v-if", true),
577
609
  createCommentVNode(" 当前内容 "),
578
- createVNode(unref(TMagicFormItem), {
579
- style: normalizeStyle([__props.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
580
- class: normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
581
- prop: itemProp.value,
582
- "label-width": itemLabelWidth.value,
583
- "label-position": __props.config.labelPosition,
584
- rules: rule.value
585
- }, {
610
+ createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
611
+ style: __props.config.tip ? "flex: 1" : "",
612
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
613
+ }), {
586
614
  label: withCtx(() => [
587
615
  createElementVNode("span", {
588
616
  innerHTML: type.value === "checkbox" ? "" : text.value,
589
617
  title: __props.config.labelTitle
590
- }, null, 8, _hoisted_10)
618
+ }, null, 8, _hoisted_8$1)
591
619
  ]),
592
620
  default: withCtx(() => [
593
- tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
621
+ tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
622
+ key: 0,
623
+ placement: tooltip.value.placement
624
+ }, {
594
625
  content: withCtx(() => [
595
- createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_11)
626
+ createElementVNode("div", {
627
+ innerHTML: tooltip.value.text
628
+ }, null, 8, _hoisted_9)
596
629
  ]),
597
630
  default: withCtx(() => [
598
- (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
599
- key: key(__props.config),
600
- size: __props.size,
631
+ (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
601
632
  model: __props.model,
602
- config: __props.config,
603
- name: name.value,
604
- disabled: disabled.value,
605
- prop: itemProp.value,
606
633
  onChange: onChangeHandler
607
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
634
+ }), null, 16, ["model"]))
608
635
  ]),
609
636
  _: 1
610
637
  /* STABLE */
611
- })) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
612
- key: key(__props.config),
613
- size: __props.size,
638
+ }, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
614
639
  model: __props.model,
615
- config: __props.config,
616
- name: name.value,
617
- disabled: disabled.value,
618
- prop: itemProp.value,
619
640
  onChange: onChangeHandler
620
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
621
- extra.value ? (openBlock(), createElementBlock("div", {
622
- key: 2,
623
- innerHTML: extra.value,
624
- class: "m-form-tip"
625
- }, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
641
+ }), null, 16, ["model"]))
626
642
  ]),
627
643
  _: 1
628
644
  /* STABLE */
629
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
645
+ }, 16, ["style", "class"]),
630
646
  __props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
631
647
  key: 1,
632
648
  placement: "left"
@@ -634,7 +650,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
634
650
  content: withCtx(() => [
635
651
  createElementVNode("div", {
636
652
  innerHTML: __props.config.tip
637
- }, null, 8, _hoisted_13)
653
+ }, null, 8, _hoisted_10)
638
654
  ]),
639
655
  default: withCtx(() => [
640
656
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -682,7 +698,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
682
698
  64
683
699
  /* STABLE_FRAGMENT */
684
700
  )) : createCommentVNode("v-if", true),
685
- __props.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_14, [
701
+ __props.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_11, [
686
702
  createVNode(unref(TMagicButton), {
687
703
  type: "primary",
688
704
  size: "small",
@@ -701,23 +717,23 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
701
717
  /* STABLE */
702
718
  })
703
719
  ])) : createCommentVNode("v-if", true)
704
- ], 14, _hoisted_1$e)) : createCommentVNode("v-if", true);
720
+ ], 14, _hoisted_1$d);
705
721
  };
706
722
  }
707
723
  });
708
724
 
709
- const _hoisted_1$d = ["innerHTML"];
725
+ const _hoisted_1$c = ["innerHTML"];
710
726
  const _hoisted_2$6 = ["innerHTML"];
711
- const _hoisted_3$4 = { key: 1 };
727
+ const _hoisted_3$5 = { key: 1 };
712
728
  const _hoisted_4$2 = ["innerHTML"];
713
729
  const _hoisted_5$2 = ["innerHTML"];
714
- const _hoisted_6$1 = {
730
+ const _hoisted_6 = {
715
731
  key: 2,
716
732
  style: { "display": "flex" }
717
733
  };
718
734
  const _hoisted_7 = { style: { "flex": "1" } };
719
735
  const _hoisted_8 = ["src"];
720
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
736
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
721
737
  ...{
722
738
  name: "MFormFieldset"
723
739
  },
@@ -739,9 +755,27 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
739
755
  const emit = __emit;
740
756
  const mForm = inject("mForm");
741
757
  const name = computed(() => props.config.name || "");
758
+ const checkboxName = computed(() => {
759
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.name === "string") {
760
+ return props.config.checkbox.name;
761
+ }
762
+ return "value";
763
+ });
764
+ const checkboxTrueValue = computed(() => {
765
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.trueValue !== "undefined") {
766
+ return props.config.checkbox.trueValue;
767
+ }
768
+ return 1;
769
+ });
770
+ const checkboxFalseValue = computed(() => {
771
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.falseValue !== "undefined") {
772
+ return props.config.checkbox.falseValue;
773
+ }
774
+ return 0;
775
+ });
742
776
  const show = computed(() => {
743
- if (props.config.expand && name.value) {
744
- return props.model[name.value]?.value;
777
+ if (props.config.expand && checkboxName.value) {
778
+ return (name.value ? props.model[name.value] : props.model)?.[checkboxName.value] === checkboxTrueValue.value;
745
779
  }
746
780
  return true;
747
781
  });
@@ -752,7 +786,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
752
786
  return props.config.labelWidth || props.labelWidth || (props.config.text ? void 0 : "0");
753
787
  });
754
788
  const valueChangeHandler = (value) => {
755
- emit("change", value, { modifyKey: "value" });
789
+ emit("change", value, { modifyKey: checkboxName.value });
756
790
  };
757
791
  const changeHandler = (v, eventData) => emit("change", v, eventData);
758
792
  const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
@@ -769,19 +803,16 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
769
803
  name.value && __props.config.checkbox ? (openBlock(), createBlock(resolveDynamicComponent(!show.value ? "div" : "legend"), { key: 0 }, {
770
804
  default: withCtx(() => [
771
805
  createVNode(unref(TMagicCheckbox), {
772
- modelValue: __props.model[name.value].value,
773
- "onUpdate:modelValue": [
774
- _cache[0] || (_cache[0] = ($event) => __props.model[name.value].value = $event),
775
- valueChangeHandler
776
- ],
777
- prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.value`,
778
- "true-value": 1,
779
- "false-value": 0
806
+ "model-value": (name.value ? __props.model[name.value] : __props.model)[checkboxName.value],
807
+ prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.${checkboxName.value}`,
808
+ "true-value": checkboxTrueValue.value,
809
+ "false-value": checkboxFalseValue.value,
810
+ "onUpdate:modelValue": valueChangeHandler
780
811
  }, {
781
812
  default: withCtx(() => [
782
813
  createElementVNode("span", {
783
814
  innerHTML: __props.config.legend
784
- }, null, 8, _hoisted_1$d),
815
+ }, null, 8, _hoisted_1$c),
785
816
  __props.config.extra ? (openBlock(), createElementBlock("span", {
786
817
  key: 0,
787
818
  innerHTML: __props.config.extra,
@@ -790,11 +821,11 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
790
821
  ]),
791
822
  _: 1
792
823
  /* STABLE */
793
- }, 8, ["modelValue", "prop"])
824
+ }, 8, ["model-value", "prop", "true-value", "false-value"])
794
825
  ]),
795
826
  _: 1
796
827
  /* STABLE */
797
- })) : (openBlock(), createElementBlock("legend", _hoisted_3$4, [
828
+ })) : (openBlock(), createElementBlock("legend", _hoisted_3$5, [
798
829
  createElementVNode("span", {
799
830
  innerHTML: __props.config.legend
800
831
  }, null, 8, _hoisted_4$2),
@@ -804,13 +835,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
804
835
  class: "m-form-tip"
805
836
  }, null, 8, _hoisted_5$2)) : createCommentVNode("v-if", true)
806
837
  ])),
807
- __props.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
838
+ __props.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
808
839
  createElementVNode("div", _hoisted_7, [
809
840
  (openBlock(true), createElementBlock(
810
841
  Fragment,
811
842
  null,
812
843
  renderList(__props.config.items, (item, index) => {
813
- return openBlock(), createBlock(_sfc_main$x, {
844
+ return openBlock(), createBlock(_sfc_main$A, {
814
845
  key: key(item, index),
815
846
  model: name.value ? __props.model[name.value] : __props.model,
816
847
  lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
@@ -822,7 +853,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
822
853
  labelWidth: lWidth.value,
823
854
  size: __props.size,
824
855
  onChange: changeHandler,
825
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
856
+ onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
826
857
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
827
858
  }),
828
859
  128
@@ -837,7 +868,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
837
868
  Fragment,
838
869
  { key: 3 },
839
870
  renderList(__props.config.items, (item, index) => {
840
- return openBlock(), createBlock(_sfc_main$x, {
871
+ return openBlock(), createBlock(_sfc_main$A, {
841
872
  key: key(item, index),
842
873
  model: name.value ? __props.model[name.value] : __props.model,
843
874
  lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
@@ -849,7 +880,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
849
880
  size: __props.size,
850
881
  disabled: __props.disabled,
851
882
  onChange: changeHandler,
852
- onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
883
+ onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
853
884
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
854
885
  }),
855
886
  128
@@ -863,10 +894,73 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
863
894
  }
864
895
  });
865
896
 
866
- const _hoisted_1$c = { class: "m-fields-group-list-item" };
897
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
898
+ ...{
899
+ name: "MFormFlexLayout"
900
+ },
901
+ __name: "FlexLayout",
902
+ props: {
903
+ model: {},
904
+ lastValues: {},
905
+ isCompare: { type: Boolean },
906
+ config: {},
907
+ name: {},
908
+ labelWidth: {},
909
+ prop: {},
910
+ size: {},
911
+ disabled: { type: Boolean }
912
+ },
913
+ emits: ["change", "addDiffCount"],
914
+ setup(__props, { emit: __emit }) {
915
+ const props = __props;
916
+ const emit = __emit;
917
+ const mForm = inject("mForm");
918
+ const gap = computed(() => props.config.gap || "16px");
919
+ const changeHandler = (v, eventData) => {
920
+ emit("change", props.model, eventData);
921
+ };
922
+ const onAddDiffCount = () => emit("addDiffCount");
923
+ return (_ctx, _cache) => {
924
+ return openBlock(), createElementBlock(
925
+ "div",
926
+ {
927
+ class: "m-form-flex-layout",
928
+ style: normalizeStyle({ display: "flex", flexWrap: "wrap", gap: gap.value })
929
+ },
930
+ [
931
+ (openBlock(true), createElementBlock(
932
+ Fragment,
933
+ null,
934
+ renderList(__props.config.items, (item, index) => {
935
+ return openBlock(), createBlock(_sfc_main$A, {
936
+ key: item[unref(mForm)?.keyProp || "__key"] ?? index,
937
+ config: item,
938
+ model: __props.name ? __props.model[__props.name] : __props.model,
939
+ lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
940
+ "is-compare": __props.isCompare,
941
+ prop: __props.prop,
942
+ size: __props.size,
943
+ disabled: __props.disabled,
944
+ "label-width": __props.config.labelWidth || __props.labelWidth,
945
+ onChange: changeHandler,
946
+ onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
947
+ }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
948
+ }),
949
+ 128
950
+ /* KEYED_FRAGMENT */
951
+ ))
952
+ ],
953
+ 4
954
+ /* STYLE */
955
+ );
956
+ };
957
+ }
958
+ });
959
+
960
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
867
961
  const _hoisted_2$5 = { style: { "text-align": "right", "margin-top": "20px" } };
868
- const _hoisted_3$3 = ["innerHTML"];
869
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
962
+ const _hoisted_3$4 = ["innerHTML"];
963
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
870
964
  ...{
871
965
  name: "MFormGroupListItem"
872
966
  },
@@ -944,7 +1038,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
944
1038
  emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
945
1039
  };
946
1040
  return (_ctx, _cache) => {
947
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
1041
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
948
1042
  createElementVNode("div", null, [
949
1043
  createVNode(unref(TMagicButton), {
950
1044
  link: "",
@@ -1133,9 +1227,9 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1133
1227
  key: 3,
1134
1228
  innerHTML: itemExtra.value,
1135
1229
  class: "m-form-tip"
1136
- }, null, 8, _hoisted_3$3)) : createCommentVNode("v-if", true)
1230
+ }, null, 8, _hoisted_3$4)) : createCommentVNode("v-if", true)
1137
1231
  ]),
1138
- expand.value ? (openBlock(), createBlock(_sfc_main$x, {
1232
+ expand.value ? (openBlock(), createBlock(_sfc_main$A, {
1139
1233
  key: 0,
1140
1234
  config: rowConfig.value,
1141
1235
  model: __props.model,
@@ -1153,13 +1247,13 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1153
1247
  }
1154
1248
  });
1155
1249
 
1156
- const _hoisted_1$b = { class: "m-fields-group-list" };
1250
+ const _hoisted_1$a = { class: "m-fields-group-list" };
1157
1251
  const _hoisted_2$4 = ["innerHTML"];
1158
- const _hoisted_3$2 = {
1252
+ const _hoisted_3$3 = {
1159
1253
  key: 1,
1160
1254
  class: "el-table__empty-block"
1161
1255
  };
1162
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
1256
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1163
1257
  ...{
1164
1258
  name: "MFormGroupList"
1165
1259
  },
@@ -1249,13 +1343,13 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1249
1343
  const onAddDiffCount = () => emit("addDiffCount");
1250
1344
  const getLastValues = (item, index) => item?.[index] || {};
1251
1345
  return (_ctx, _cache) => {
1252
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
1346
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
1253
1347
  __props.config.extra ? (openBlock(), createElementBlock("div", {
1254
1348
  key: 0,
1255
1349
  innerHTML: __props.config.extra,
1256
1350
  style: { "color": "rgba(0, 0, 0, 0.45)" }
1257
1351
  }, null, 8, _hoisted_2$4)) : createCommentVNode("v-if", true),
1258
- !__props.model[__props.name] || !__props.model[__props.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$2, [..._cache[1] || (_cache[1] = [
1352
+ !__props.model[__props.name] || !__props.model[__props.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, [..._cache[1] || (_cache[1] = [
1259
1353
  createElementVNode(
1260
1354
  "span",
1261
1355
  { class: "el-table__empty-text" },
@@ -1267,7 +1361,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1267
1361
  Fragment,
1268
1362
  { key: 2 },
1269
1363
  renderList(__props.model[__props.name], (item, index) => {
1270
- return openBlock(), createBlock(_sfc_main$v, {
1364
+ return openBlock(), createBlock(_sfc_main$x, {
1271
1365
  key: index,
1272
1366
  model: item,
1273
1367
  lastValues: getLastValues(__props.lastValues[__props.name], index),
@@ -1327,15 +1421,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1327
1421
  }
1328
1422
  });
1329
1423
 
1330
- const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1424
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1331
1425
  const _hoisted_2$3 = ["innerHTML"];
1332
- const _hoisted_3$1 = {
1426
+ const _hoisted_3$2 = {
1333
1427
  key: 0,
1334
1428
  style: { "display": "flex" }
1335
1429
  };
1336
1430
  const _hoisted_4$1 = { style: { "flex": "1" } };
1337
1431
  const _hoisted_5$1 = ["src"];
1338
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
1432
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1339
1433
  ...{
1340
1434
  name: "MFormPanel"
1341
1435
  },
@@ -1370,7 +1464,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1370
1464
  "body-style": { display: expand.value ? "block" : "none" }
1371
1465
  }, {
1372
1466
  header: withCtx(() => [
1373
- createElementVNode("div", _hoisted_1$a, [
1467
+ createElementVNode("div", _hoisted_1$9, [
1374
1468
  createVNode(unref(TMagicButton), {
1375
1469
  style: { "padding": "0" },
1376
1470
  link: "",
@@ -1394,13 +1488,13 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1394
1488
  default: withCtx(() => [
1395
1489
  createElementVNode("div", null, [
1396
1490
  renderSlot(_ctx.$slots, "default"),
1397
- __props.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
1491
+ __props.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
1398
1492
  createElementVNode("div", _hoisted_4$1, [
1399
1493
  (openBlock(true), createElementBlock(
1400
1494
  Fragment,
1401
1495
  null,
1402
1496
  renderList(items.value, (item, index) => {
1403
- return openBlock(), createBlock(_sfc_main$x, {
1497
+ return openBlock(), createBlock(_sfc_main$A, {
1404
1498
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1405
1499
  config: item,
1406
1500
  model: __props.name ? __props.model[__props.name] : __props.model,
@@ -1426,7 +1520,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1426
1520
  Fragment,
1427
1521
  { key: 1 },
1428
1522
  renderList(items.value, (item, index) => {
1429
- return openBlock(), createBlock(_sfc_main$x, {
1523
+ return openBlock(), createBlock(_sfc_main$A, {
1430
1524
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1431
1525
  config: item,
1432
1526
  model: __props.name ? __props.model[__props.name] : __props.model,
@@ -1452,7 +1546,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1452
1546
  }
1453
1547
  });
1454
1548
 
1455
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
1549
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1456
1550
  ...{
1457
1551
  name: "MFormCol"
1458
1552
  },
@@ -1480,7 +1574,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1480
1574
  return (_ctx, _cache) => {
1481
1575
  return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: __props.span }, {
1482
1576
  default: withCtx(() => [
1483
- createVNode(_sfc_main$x, {
1577
+ createVNode(_sfc_main$A, {
1484
1578
  model: __props.model,
1485
1579
  lastValues: __props.lastValues,
1486
1580
  "is-compare": __props.isCompare,
@@ -1503,7 +1597,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1503
1597
  }
1504
1598
  });
1505
1599
 
1506
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1600
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1507
1601
  ...{
1508
1602
  name: "MFormRow"
1509
1603
  },
@@ -1536,7 +1630,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1536
1630
  Fragment,
1537
1631
  null,
1538
1632
  renderList(__props.config.items, (col, index) => {
1539
- return openBlock(), createBlock(_sfc_main$s, {
1633
+ return openBlock(), createBlock(_sfc_main$u, {
1540
1634
  key: col[unref(mForm)?.keyProp || "__key"] ?? index,
1541
1635
  span: col.span || __props.config.span || 24 / __props.config.items.length,
1542
1636
  config: col,
@@ -1563,7 +1657,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1563
1657
  }
1564
1658
  });
1565
1659
 
1566
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1660
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1567
1661
  ...{
1568
1662
  name: "MFormStep"
1569
1663
  },
@@ -1638,7 +1732,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1638
1732
  Fragment,
1639
1733
  null,
1640
1734
  [
1641
- item ? withDirectives((openBlock(), createBlock(_sfc_main$x, {
1735
+ item ? withDirectives((openBlock(), createBlock(_sfc_main$A, {
1642
1736
  key: item[unref(mForm)?.keyProp || "__key"],
1643
1737
  config: item,
1644
1738
  model: step.name ? __props.model[step.name] : __props.model,
@@ -1674,1044 +1768,325 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1674
1768
  }
1675
1769
  });
1676
1770
 
1677
- const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1678
- const _hoisted_2$2 = ["innerHTML"];
1679
- const _hoisted_3 = ["innerHTML"];
1680
- const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1681
- const _hoisted_5 = { style: { "display": "flex" } };
1682
- const _hoisted_6 = {
1683
- key: 1,
1684
- class: "bottom",
1685
- style: { "text-align": "right" }
1686
- };
1687
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
1771
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1688
1772
  ...{
1689
- name: "MFormTable"
1773
+ name: "MFormTabs"
1690
1774
  },
1691
- __name: "Table",
1775
+ __name: "Tabs",
1692
1776
  props: {
1693
1777
  model: {},
1694
1778
  lastValues: { default: () => ({}) },
1695
1779
  isCompare: { type: Boolean, default: false },
1696
1780
  config: {},
1697
1781
  name: {},
1698
- prop: { default: "" },
1699
- labelWidth: {},
1700
- sort: { type: Boolean },
1701
- disabled: { type: Boolean },
1702
- sortKey: { default: "" },
1703
- text: {},
1704
1782
  size: {},
1705
- enableToggleMode: { type: Boolean, default: true },
1706
- showIndex: { type: Boolean, default: true }
1783
+ labelWidth: {},
1784
+ prop: {},
1785
+ expandMore: { type: Boolean },
1786
+ disabled: { type: Boolean }
1707
1787
  },
1708
- emits: ["change", "select", "addDiffCount"],
1709
- setup(__props, { expose: __expose, emit: __emit }) {
1710
- const props = __props;
1711
- const emit = __emit;
1712
- let timer = null;
1713
- const mForm = inject("mForm");
1714
- const { nextZIndex } = useZIndex();
1715
- const tMagicTable = ref();
1716
- const excelBtn = ref();
1717
- const mTable = ref();
1718
- const pagesize = ref(10);
1719
- const pagecontext = ref(0);
1720
- const updateKey = ref(1);
1721
- const isFullscreen = ref(false);
1722
- const modelName = computed(() => props.name || props.config.name || "");
1723
- const getDataByPage = (data2 = []) => data2.filter(
1724
- (item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value
1725
- );
1726
- const pageinationData = computed(() => getDataByPage(props.model[modelName.value]));
1727
- const data = computed(() => props.config.pagination ? pageinationData.value : props.model[modelName.value]);
1728
- const lastData = computed(
1729
- () => props.config.pagination ? getDataByPage(props.lastValues[modelName.value]) : props.lastValues[modelName.value] || []
1730
- );
1731
- const sortChange = ({ prop, order }) => {
1732
- if (order === "ascending") {
1733
- props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
1734
- } else if (order === "descending") {
1735
- props.model[modelName.value] = props.model[modelName.value].sort((a, b) => b[prop] - a[prop]);
1736
- }
1788
+ emits: ["change", "addDiffCount"],
1789
+ setup(__props, { emit: __emit }) {
1790
+ const tabPaneComponent = getDesignConfig("components")?.tabPane;
1791
+ const tabsComponent = getDesignConfig("components")?.tabs;
1792
+ const getActive = (mForm2, props2, activeTabName2) => {
1793
+ const { config, model, prop } = props2;
1794
+ const { active } = config;
1795
+ if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
1796
+ if (0 >= props2.config.items.length) return "0";
1797
+ if (typeof active !== "undefined") return active;
1798
+ return "0";
1737
1799
  };
1738
- const swapArray = (index1, index2) => {
1739
- props.model[modelName.value].splice(index1, 0, props.model[modelName.value].splice(index2, 1)[0]);
1740
- if (props.sortKey) {
1741
- for (let i = props.model[modelName.value].length - 1, v = 0; i >= 0; i--, v++) {
1742
- props.model[modelName.value][v][props.sortKey] = i;
1743
- }
1800
+ const tabClick = (mForm2, tab, props2) => {
1801
+ const { config, model, prop } = props2;
1802
+ tab.name = tab.paneName;
1803
+ if (typeof config.onTabClick === "function") {
1804
+ config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
1744
1805
  }
1745
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1746
- };
1747
- let sortable;
1748
- const rowDrop = () => {
1749
- sortable?.destroy();
1750
- const tableEl = tMagicTable.value?.instance.$el;
1751
- const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
1752
- if (!tBodyEl) {
1753
- return;
1806
+ const tabConfig = config.items.find((item) => tab.name === item.status);
1807
+ if (tabConfig && typeof tabConfig.onTabClick === "function") {
1808
+ tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
1754
1809
  }
1755
- sortable = Sortable.create(tBodyEl, {
1756
- draggable: ".tmagic-design-table-row",
1757
- filter: "input",
1758
- // 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
1759
- preventOnFilter: false,
1760
- // 允许选字
1761
- direction: "vertical",
1762
- onEnd: ({ newIndex, oldIndex }) => {
1763
- if (typeof newIndex === "undefined") return;
1764
- if (typeof oldIndex === "undefined") return;
1765
- swapArray(newIndex, oldIndex);
1766
- emit("change", props.model[modelName.value]);
1767
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1768
- }
1769
- });
1770
1810
  };
1771
- const newHandler = async (row) => {
1772
- if (props.config.max && props.model[modelName.value].length >= props.config.max) {
1773
- tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
1774
- return;
1811
+ const props = __props;
1812
+ const emit = __emit;
1813
+ const mForm = inject("mForm");
1814
+ const activeTabName = ref(getActive(mForm, props));
1815
+ const diffCount = ref({});
1816
+ const tabs = computed(() => {
1817
+ if (props.config.dynamic) {
1818
+ if (!props.config.name) throw new Error("dynamic tab 必须配置name");
1819
+ return props.model[props.config.name] || [];
1775
1820
  }
1776
- if (typeof props.config.beforeAddRow === "function") {
1777
- const beforeCheckRes = props.config.beforeAddRow(mForm, {
1778
- model: props.model[modelName.value],
1779
- formValue: mForm?.values,
1821
+ return props.config.items.filter((item) => display(mForm, item.display, props));
1822
+ });
1823
+ const filter = (config) => filterFunction(mForm, config, props);
1824
+ watchEffect(() => {
1825
+ if (typeof props.config.activeChange === "function") {
1826
+ props.config.activeChange(mForm, activeTabName.value, {
1827
+ model: props.model,
1780
1828
  prop: props.prop
1781
1829
  });
1782
- if (!beforeCheckRes) return;
1783
1830
  }
1784
- const columns = props.config.items;
1785
- const enumValues = props.config.enum || [];
1786
- let enumV = [];
1787
- const { length } = props.model[modelName.value];
1788
- const key = props.config.key || "id";
1789
- let inputs = {};
1790
- if (enumValues.length) {
1791
- if (length >= enumValues.length) {
1792
- return;
1793
- }
1794
- enumV = enumValues.filter((item) => {
1795
- let i = 0;
1796
- for (; i < length; i++) {
1797
- if (item[key] === props.model[modelName.value][i][key]) {
1798
- break;
1799
- }
1800
- }
1801
- return i === length;
1802
- });
1803
- if (enumV.length > 0) {
1804
- inputs = enumV[0];
1805
- }
1806
- } else if (Array.isArray(row)) {
1807
- columns.forEach((column, index) => {
1808
- column.name && (inputs[column.name] = row[index]);
1809
- });
1831
+ });
1832
+ const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
1833
+ const tabClickHandler = (tab) => {
1834
+ if (typeof tab === "object") {
1835
+ tabClick(mForm, tab, props);
1810
1836
  } else {
1811
- if (typeof props.config.defaultAdd === "function") {
1812
- inputs = await props.config.defaultAdd(mForm, {
1813
- model: props.model[modelName.value],
1814
- formValue: mForm?.values
1815
- });
1816
- } else if (props.config.defaultAdd) {
1817
- inputs = props.config.defaultAdd;
1837
+ let item = tabs.value.find((tab2) => tab2.status === tab2);
1838
+ if (!item) {
1839
+ item = tabs.value[tab];
1818
1840
  }
1819
- inputs = await initValue(mForm, {
1820
- config: columns,
1821
- initValues: inputs
1822
- });
1823
- }
1824
- if (props.sortKey && length) {
1825
- inputs[props.sortKey] = props.model[modelName.value][length - 1][props.sortKey] - 1;
1841
+ tabClick(mForm, item, props);
1826
1842
  }
1827
- props.model[modelName.value].push(inputs);
1828
- emit("change", props.model[modelName.value], {
1829
- changeRecords: [
1830
- {
1831
- propPath: `${props.prop}.${props.model[modelName.value].length - 1}`,
1832
- value: inputs
1833
- }
1834
- ]
1835
- });
1836
1843
  };
1837
- onMounted(() => {
1838
- if (props.config.defautSort) {
1839
- sortChange(props.config.defautSort);
1840
- } else if (props.config.defaultSort) {
1841
- sortChange(props.config.defaultSort);
1842
- }
1843
- if (props.sort && props.sortKey) {
1844
- props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
1845
- }
1846
- });
1847
- watchEffect(() => {
1848
- if (props.config.dropSort) {
1849
- rowDrop();
1850
- }
1851
- });
1852
- const addable = computed(() => {
1853
- if (!props.model[modelName.value].length) {
1854
- return true;
1855
- }
1856
- if (typeof props.config.addable === "function") {
1857
- return props.config.addable(mForm, {
1858
- model: props.model[modelName.value],
1859
- formValue: mForm?.values,
1860
- prop: props.prop
1844
+ const onTabAdd = async () => {
1845
+ if (!props.name) throw new Error("dynamic tab 必须配置name");
1846
+ if (typeof props.config.onTabAdd === "function") {
1847
+ props.config.onTabAdd(mForm, {
1848
+ model: props.model,
1849
+ prop: props.prop,
1850
+ config: props.config
1861
1851
  });
1862
- }
1863
- return typeof props.config.addable === "undefined" ? true : props.config.addable;
1864
- });
1865
- const selection = computed(() => {
1866
- if (typeof props.config.selection === "function") {
1867
- return props.config.selection(mForm, { model: props.model[modelName.value] });
1868
- }
1869
- return props.config.selection;
1870
- });
1871
- const importable = computed(() => {
1872
- if (typeof props.config.importable === "function") {
1873
- return props.config.importable(mForm, {
1874
- formValue: mForm?.values,
1875
- model: props.model[modelName.value]
1852
+ emit("change", props.model);
1853
+ } else {
1854
+ const newObj = await initValue(mForm, {
1855
+ config: props.config.items,
1856
+ initValues: {}
1857
+ });
1858
+ newObj.title = `标签${tabs.value.length + 1}`;
1859
+ props.model[props.name].push(newObj);
1860
+ emit("change", props.model[props.name], {
1861
+ changeRecords: [
1862
+ {
1863
+ propPath: `${props.prop}.${props.model[props.name].length - 1}`,
1864
+ value: newObj
1865
+ }
1866
+ ]
1876
1867
  });
1877
1868
  }
1878
- return typeof props.config.importable === "undefined" ? false : props.config.importable;
1879
- });
1880
- const display$1 = (fuc) => display(mForm, fuc, props);
1881
- const itemExtra = (fuc, index) => {
1882
- if (typeof fuc === "function") {
1883
- return fuc(mForm, {
1884
- values: mForm?.initValues,
1869
+ mForm?.$emit("field-change", props.prop, props.model[props.name]);
1870
+ };
1871
+ const onTabRemove = (tabName) => {
1872
+ if (!props.name) throw new Error("dynamic tab 必须配置name");
1873
+ if (typeof props.config.onTabRemove === "function") {
1874
+ props.config.onTabRemove(mForm, tabName, {
1885
1875
  model: props.model,
1886
- formValue: mForm ? mForm.values : props.model,
1887
1876
  prop: props.prop,
1888
- index
1877
+ config: props.config
1889
1878
  });
1879
+ } else {
1880
+ props.model[props.name].splice(+tabName, 1);
1881
+ if (tabName < activeTabName.value || activeTabName.value >= props.model[props.name].length) {
1882
+ activeTabName.value = (+activeTabName.value - 1).toString();
1883
+ tabClick(mForm, { name: activeTabName.value }, props);
1884
+ }
1890
1885
  }
1891
- return fuc;
1886
+ emit("change", props.model);
1887
+ mForm?.$emit("field-change", props.prop, props.model[props.name]);
1892
1888
  };
1893
- const removeHandler = (index) => {
1894
- if (props.disabled) return;
1895
- props.model[modelName.value].splice(index, 1);
1896
- emit("change", props.model[modelName.value]);
1889
+ const changeHandler = (v, eventData) => {
1890
+ emit("change", props.model, eventData);
1897
1891
  };
1898
- const selectHandle = (selection2, row) => {
1899
- if (typeof props.config.selection === "string" && props.config.selection === "single") {
1900
- tMagicTable.value?.clearSelection();
1901
- tMagicTable.value?.toggleRowSelection(row, true);
1902
- }
1903
- emit("select", selection2, row);
1904
- if (typeof props.config.onSelect === "function") {
1905
- props.config.onSelect(mForm, { selection: selection2, row, config: props.config });
1892
+ const onAddDiffCount = (tabIndex) => {
1893
+ if (!diffCount.value[tabIndex]) {
1894
+ diffCount.value[tabIndex] = 1;
1895
+ } else {
1896
+ diffCount.value[tabIndex] += 1;
1906
1897
  }
1898
+ emit("addDiffCount");
1907
1899
  };
1908
- const toggleRowSelection = (row, selected) => {
1909
- tMagicTable.value?.toggleRowSelection.call(tMagicTable.value, row, selected);
1910
- };
1911
- const makeConfig = (config, row) => {
1912
- const newConfig = cloneDeep(config);
1913
- if (typeof config.itemsFunction === "function") {
1914
- newConfig.items = config.itemsFunction(row);
1915
- }
1916
- delete newConfig.display;
1917
- return newConfig;
1900
+ return (_ctx, _cache) => {
1901
+ return openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent)?.component || "el-tabs"), mergeProps(
1902
+ {
1903
+ modelValue: activeTabName.value,
1904
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
1905
+ },
1906
+ unref(tabsComponent)?.props({
1907
+ type: __props.config.tabType,
1908
+ editable: __props.config.editable || false,
1909
+ tabPosition: __props.config.tabPosition || "top"
1910
+ }) || {},
1911
+ {
1912
+ class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
1913
+ onTabClick: tabClickHandler,
1914
+ onTabAdd,
1915
+ onTabRemove
1916
+ }
1917
+ ), {
1918
+ default: withCtx(() => [
1919
+ (openBlock(true), createElementBlock(
1920
+ Fragment,
1921
+ null,
1922
+ renderList(tabs.value, (tab, tabIndex) => {
1923
+ return openBlock(), createBlock(
1924
+ resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"),
1925
+ mergeProps(
1926
+ {
1927
+ key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex
1928
+ },
1929
+ { ref_for: true },
1930
+ unref(tabPaneComponent)?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
1931
+ ),
1932
+ {
1933
+ label: withCtx(() => [
1934
+ createElementVNode("span", null, [
1935
+ createTextVNode(
1936
+ toDisplayString(filter(tab.title)),
1937
+ 1
1938
+ /* TEXT */
1939
+ ),
1940
+ createVNode(unref(TMagicBadge), {
1941
+ hidden: !diffCount.value[tabIndex],
1942
+ value: diffCount.value[tabIndex],
1943
+ class: "diff-count-badge"
1944
+ }, null, 8, ["hidden", "value"])
1945
+ ])
1946
+ ]),
1947
+ default: withCtx(() => [
1948
+ (openBlock(true), createElementBlock(
1949
+ Fragment,
1950
+ null,
1951
+ renderList(tabItems(tab), (item) => {
1952
+ return openBlock(), createBlock(_sfc_main$A, {
1953
+ key: item[unref(mForm)?.keyProp || "__key"],
1954
+ config: item,
1955
+ disabled: __props.disabled,
1956
+ 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,
1957
+ "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,
1958
+ "is-compare": __props.isCompare,
1959
+ prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
1960
+ size: __props.size,
1961
+ "label-width": tab.labelWidth || __props.labelWidth,
1962
+ "expand-more": __props.expandMore,
1963
+ onChange: changeHandler,
1964
+ onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
1965
+ }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
1966
+ }),
1967
+ 128
1968
+ /* KEYED_FRAGMENT */
1969
+ ))
1970
+ ]),
1971
+ _: 2
1972
+ /* DYNAMIC */
1973
+ },
1974
+ 1040
1975
+ /* FULL_PROPS, DYNAMIC_SLOTS */
1976
+ );
1977
+ }),
1978
+ 128
1979
+ /* KEYED_FRAGMENT */
1980
+ ))
1981
+ ]),
1982
+ _: 1
1983
+ /* STABLE */
1984
+ }, 16, ["modelValue", "class"]);
1918
1985
  };
1919
- const upHandler = (index) => {
1920
- if (timer) {
1921
- clearTimeout(timer);
1986
+ }
1987
+ });
1988
+
1989
+ let $MAGIC_FORM = {};
1990
+ const setConfig = (option) => {
1991
+ $MAGIC_FORM = option;
1992
+ };
1993
+ const getConfig = (key) => $MAGIC_FORM[key];
1994
+
1995
+ const useAddField = (prop) => {
1996
+ if (!prop) return;
1997
+ const mForm = inject("mForm");
1998
+ const instance = getCurrentInstance();
1999
+ watch(
2000
+ () => instance?.proxy,
2001
+ (vm) => {
2002
+ if (vm) {
2003
+ mForm?.setField(prop, vm);
2004
+ } else {
2005
+ mForm?.deleteField(prop);
1922
2006
  }
1923
- timer = setTimeout(() => {
1924
- swapArray(index, index - 1);
1925
- timer = void 0;
1926
- }, 300);
1927
- };
1928
- const topHandler = (index) => {
1929
- if (timer) {
1930
- clearTimeout(timer);
2007
+ },
2008
+ {
2009
+ immediate: true
2010
+ }
2011
+ );
2012
+ };
2013
+
2014
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2015
+ ...{
2016
+ name: "MFormCascader"
2017
+ },
2018
+ __name: "Cascader",
2019
+ props: {
2020
+ config: {},
2021
+ model: {},
2022
+ initValues: {},
2023
+ values: {},
2024
+ name: {},
2025
+ prop: {},
2026
+ disabled: { type: Boolean },
2027
+ size: {},
2028
+ lastValues: {}
2029
+ },
2030
+ emits: ["change"],
2031
+ setup(__props, { emit: __emit }) {
2032
+ const props = __props;
2033
+ const emit = __emit;
2034
+ const mForm = inject("mForm");
2035
+ useAddField(props.prop);
2036
+ const requestFunc = getConfig("request");
2037
+ const tMagicCascader = ref();
2038
+ const options = ref([]);
2039
+ const remoteData = ref(null);
2040
+ const checkStrictly = computed(() => filterFunction(mForm, props.config.checkStrictly, props));
2041
+ const valueSeparator = computed(() => filterFunction(mForm, props.config.valueSeparator, props));
2042
+ const value = computed(() => {
2043
+ if (typeof props.model[props.name] === "string" && valueSeparator.value) {
2044
+ return props.model[props.name].split(valueSeparator.value);
1931
2045
  }
1932
- const moveNum = index;
1933
- for (let i = 0; i < moveNum; i++) {
1934
- swapArray(index, index - 1);
1935
- index -= 1;
2046
+ return props.model[props.name];
2047
+ });
2048
+ const updateModelValueHandler = (value2) => {
2049
+ let result = value2;
2050
+ if (valueSeparator.value) {
2051
+ result = value2.join(valueSeparator.value);
1936
2052
  }
1937
- };
1938
- const downHandler = (index) => {
1939
- if (timer) {
1940
- clearTimeout(timer);
2053
+ if (typeof result === "undefined") {
2054
+ if (Array.isArray(props.model[props.name])) {
2055
+ emit("change", []);
2056
+ } else if (typeof props.model[props.name] === "string") {
2057
+ emit("change", "");
2058
+ } else if (typeof props.model[props.name] === "object") {
2059
+ emit("change", null);
2060
+ }
1941
2061
  }
1942
- timer = setTimeout(() => {
1943
- swapArray(index, index + 1);
1944
- timer = void 0;
1945
- }, 300);
2062
+ emit("change", result);
1946
2063
  };
1947
- const bottomHandler = (index) => {
1948
- if (timer) {
1949
- clearTimeout(timer);
1950
- }
1951
- const moveNum = props.model[modelName.value].length - 1 - index;
1952
- for (let i = 0; i < moveNum; i++) {
1953
- swapArray(index, index + 1);
1954
- index += 1;
2064
+ const setRemoteOptions = async function() {
2065
+ const { config } = props;
2066
+ const { option } = config;
2067
+ if (!option) return;
2068
+ let { body } = option;
2069
+ const postOptions = {
2070
+ url: option.url,
2071
+ cache: option.cache,
2072
+ timeout: option.timeout,
2073
+ data: {}
2074
+ };
2075
+ if (body && mForm) {
2076
+ if (typeof body === "function" && props.model && mForm) {
2077
+ body = body(mForm, {
2078
+ model: props.model,
2079
+ formValue: mForm.values,
2080
+ formValues: mForm.values,
2081
+ config: props.config
2082
+ });
2083
+ }
2084
+ postOptions.data = body;
1955
2085
  }
1956
- };
1957
- const showDelete = (index) => {
1958
- const deleteFunc = props.config.delete;
1959
- if (deleteFunc && typeof deleteFunc === "function") {
1960
- return deleteFunc(props.model[modelName.value], index, mForm?.values);
1961
- }
1962
- return true;
1963
- };
1964
- const copyable = (index) => {
1965
- const copyableFunc = props.config.copyable;
1966
- if (copyableFunc && typeof copyableFunc === "function") {
1967
- return copyableFunc(mForm, {
1968
- values: mForm?.initValues || {},
1969
- model: props.model,
1970
- parent: mForm?.parentValues || {},
1971
- formValue: mForm?.values || props.model,
1972
- prop: props.prop,
1973
- config: props.config,
1974
- index
1975
- });
1976
- }
1977
- return true;
1978
- };
1979
- const clearHandler = () => {
1980
- const len = props.model[modelName.value].length;
1981
- props.model[modelName.value].splice(0, len);
1982
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1983
- };
1984
- const excelHandler = async (file) => {
1985
- if (!file?.raw) {
1986
- return false;
1987
- }
1988
- if (!globalThis.XLSX) {
1989
- await asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
1990
- }
1991
- const reader = new FileReader();
1992
- reader.onload = () => {
1993
- const data2 = reader.result;
1994
- const pdata = globalThis.XLSX.read(data2, { type: "array" });
1995
- pdata.SheetNames.forEach((sheetName) => {
1996
- const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
1997
- if (arr?.[0]) {
1998
- arr.forEach((row) => {
1999
- newHandler(row);
2000
- });
2001
- }
2002
- setTimeout(() => {
2003
- excelBtn.value?.clearFiles();
2004
- }, 300);
2005
- });
2006
- };
2007
- reader.readAsArrayBuffer(file.raw);
2008
- return false;
2009
- };
2010
- const handleSizeChange = (val) => {
2011
- pagesize.value = val;
2012
- };
2013
- const handleCurrentChange = (val) => {
2014
- pagecontext.value = val - 1;
2015
- };
2016
- const copyHandler = (index) => {
2017
- props.model[modelName.value].push(cloneDeep(props.model[modelName.value][index]));
2018
- };
2019
- const toggleMode = () => {
2020
- const calcLabelWidth = (label) => {
2021
- if (!label) return "0px";
2022
- const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
2023
- const chLength = label.length - zhLength;
2024
- return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
2025
- };
2026
- props.config.type = "groupList";
2027
- props.config.enableToggleMode = true;
2028
- props.config.tableItems = props.config.items;
2029
- props.config.items = props.config.groupItems || props.config.items.map((item) => {
2030
- const text = item.text || item.label;
2031
- const labelWidth = calcLabelWidth(text);
2032
- return {
2033
- ...item,
2034
- text,
2035
- labelWidth,
2036
- span: item.span || 12
2037
- };
2038
- });
2039
- };
2040
- const toggleFullscreen = () => {
2041
- if (!mTable.value) return;
2042
- if (isFullscreen.value) {
2043
- mTable.value.classList.remove("fixed");
2044
- isFullscreen.value = false;
2045
- } else {
2046
- mTable.value.classList.add("fixed");
2047
- mTable.value.style.zIndex = `${nextZIndex()}`;
2048
- isFullscreen.value = true;
2049
- }
2050
- };
2051
- const getProp = (index) => {
2052
- const { prop } = toRefs(props);
2053
- return `${prop.value}${prop.value ? "." : ""}${index + 1 + pagecontext.value * pagesize.value - 1}`;
2054
- };
2055
- const onAddDiffCount = () => emit("addDiffCount");
2056
- const changeHandler = (v, eventData) => {
2057
- emit("change", props.model, eventData);
2058
- };
2059
- __expose({
2060
- toggleRowSelection
2061
- });
2062
- return (_ctx, _cache) => {
2063
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
2064
- (openBlock(), createBlock(Teleport, {
2065
- to: "body",
2066
- disabled: !isFullscreen.value
2067
- }, [
2068
- createElementVNode(
2069
- "div",
2070
- {
2071
- ref_key: "mTable",
2072
- ref: mTable,
2073
- class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
2074
- },
2075
- [
2076
- __props.config.extra ? (openBlock(), createElementBlock("span", {
2077
- key: 0,
2078
- style: { "color": "rgba(0, 0, 0, 0.45)" },
2079
- innerHTML: __props.config.extra
2080
- }, null, 8, _hoisted_2$2)) : createCommentVNode("v-if", true),
2081
- createVNode(unref(TMagicTooltip), {
2082
- content: "拖拽可排序",
2083
- placement: "left-start",
2084
- disabled: __props.config.dropSort !== true
2085
- }, {
2086
- default: withCtx(() => [
2087
- __props.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
2088
- ref_key: "tMagicTable",
2089
- ref: tMagicTable,
2090
- style: { "width": "100%" },
2091
- "row-key": __props.config.rowKey || "id",
2092
- data: data.value,
2093
- lastData: lastData.value,
2094
- border: __props.config.border,
2095
- "max-height": __props.config.maxHeight,
2096
- "default-expand-all": true,
2097
- key: updateKey.value,
2098
- onSelect: selectHandle,
2099
- onSortChange: sortChange
2100
- }, {
2101
- default: withCtx(() => [
2102
- __props.config.itemExtra && !__props.config.dropSort ? (openBlock(), createBlock(unref(TMagicTableColumn), {
2103
- key: 0,
2104
- fixed: "left",
2105
- width: "30",
2106
- type: "expand"
2107
- }, {
2108
- default: withCtx((scope) => [
2109
- createElementVNode("span", {
2110
- innerHTML: itemExtra(__props.config.itemExtra, scope.$index),
2111
- class: "m-form-tip"
2112
- }, null, 8, _hoisted_3)
2113
- ]),
2114
- _: 1
2115
- /* STABLE */
2116
- })) : createCommentVNode("v-if", true),
2117
- createVNode(unref(TMagicTableColumn), {
2118
- label: "操作",
2119
- width: __props.config.operateColWidth || 100,
2120
- align: "center",
2121
- fixed: __props.config.fixed === false ? void 0 : "left"
2122
- }, {
2123
- default: withCtx((scope) => [
2124
- renderSlot(_ctx.$slots, "operateCol", { scope }),
2125
- withDirectives(createVNode(unref(TMagicButton), {
2126
- size: "small",
2127
- type: "danger",
2128
- link: "",
2129
- title: "删除",
2130
- icon: unref(Delete),
2131
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
2132
- }, null, 8, ["icon", "onClick"]), [
2133
- [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
2134
- ]),
2135
- copyable(scope.$index + 1 + pagecontext.value * pagesize.value - 1) ? (openBlock(), createBlock(unref(TMagicButton), {
2136
- key: 0,
2137
- link: "",
2138
- size: "small",
2139
- type: "primary",
2140
- title: "复制",
2141
- icon: unref(DocumentCopy),
2142
- disabled: __props.disabled,
2143
- onClick: ($event) => copyHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
2144
- }, null, 8, ["icon", "disabled", "onClick"])) : createCommentVNode("v-if", true)
2145
- ]),
2146
- _: 3
2147
- /* FORWARDED */
2148
- }, 8, ["width", "fixed"]),
2149
- __props.sort && __props.model[modelName.value] && __props.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
2150
- key: 1,
2151
- label: "排序",
2152
- width: "60"
2153
- }, {
2154
- default: withCtx((scope) => [
2155
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(
2156
- unref(TMagicTooltip),
2157
- {
2158
- key: 0,
2159
- content: "点击上移,双击置顶",
2160
- placement: "top"
2161
- },
2162
- {
2163
- default: withCtx(() => [
2164
- createVNode(unref(TMagicButton), {
2165
- plain: "",
2166
- size: "small",
2167
- type: "primary",
2168
- icon: unref(ArrowUp),
2169
- disabled: __props.disabled,
2170
- link: "",
2171
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
2172
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
2173
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
2174
- ]),
2175
- _: 2
2176
- /* DYNAMIC */
2177
- },
2178
- 1024
2179
- /* DYNAMIC_SLOTS */
2180
- )) : createCommentVNode("v-if", true),
2181
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== __props.model[modelName.value].length - 1 ? (openBlock(), createBlock(
2182
- unref(TMagicTooltip),
2183
- {
2184
- key: 1,
2185
- content: "点击下移,双击置底",
2186
- placement: "top"
2187
- },
2188
- {
2189
- default: withCtx(() => [
2190
- createVNode(unref(TMagicButton), {
2191
- plain: "",
2192
- size: "small",
2193
- type: "primary",
2194
- icon: unref(ArrowDown),
2195
- disabled: __props.disabled,
2196
- link: "",
2197
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
2198
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
2199
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
2200
- ]),
2201
- _: 2
2202
- /* DYNAMIC */
2203
- },
2204
- 1024
2205
- /* DYNAMIC_SLOTS */
2206
- )) : createCommentVNode("v-if", true)
2207
- ]),
2208
- _: 1
2209
- /* STABLE */
2210
- })) : createCommentVNode("v-if", true),
2211
- selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
2212
- key: 2,
2213
- align: "center",
2214
- "header-align": "center",
2215
- type: "selection",
2216
- width: "45"
2217
- })) : createCommentVNode("v-if", true),
2218
- __props.showIndex && __props.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
2219
- key: 3,
2220
- width: "60",
2221
- label: "序号"
2222
- }, {
2223
- default: withCtx((scope) => [
2224
- createTextVNode(
2225
- toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value),
2226
- 1
2227
- /* TEXT */
2228
- )
2229
- ]),
2230
- _: 1
2231
- /* STABLE */
2232
- })) : createCommentVNode("v-if", true),
2233
- (openBlock(true), createElementBlock(
2234
- Fragment,
2235
- null,
2236
- renderList(__props.config.items, (column, index) => {
2237
- return openBlock(), createElementBlock(
2238
- Fragment,
2239
- null,
2240
- [
2241
- column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
2242
- prop: column.name,
2243
- width: column.width,
2244
- label: column.label,
2245
- sortable: column.sortable,
2246
- "sort-orders": ["ascending", "descending"],
2247
- key: column[unref(mForm)?.keyProp || "__key"] ?? index,
2248
- "class-name": __props.config.dropSort === true ? "el-table__column--dropable" : ""
2249
- }, {
2250
- default: withCtx((scope) => [
2251
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$x, {
2252
- key: 0,
2253
- labelWidth: "0",
2254
- disabled: __props.disabled,
2255
- prop: getProp(scope.$index),
2256
- rules: column.rules,
2257
- config: makeConfig(column, scope.row),
2258
- model: scope.row,
2259
- lastValues: lastData.value[scope.$index],
2260
- "is-compare": __props.isCompare,
2261
- size: __props.size,
2262
- onChange: changeHandler,
2263
- onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
2264
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("v-if", true)
2265
- ]),
2266
- _: 2
2267
- /* DYNAMIC */
2268
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("v-if", true)
2269
- ],
2270
- 64
2271
- /* STABLE_FRAGMENT */
2272
- );
2273
- }),
2274
- 256
2275
- /* UNKEYED_FRAGMENT */
2276
- ))
2277
- ]),
2278
- _: 3
2279
- /* FORWARDED */
2280
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("v-if", true)
2281
- ]),
2282
- _: 3
2283
- /* FORWARDED */
2284
- }, 8, ["disabled"]),
2285
- renderSlot(_ctx.$slots, "default"),
2286
- createElementVNode("div", _hoisted_4, [
2287
- addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
2288
- key: 0,
2289
- size: "small",
2290
- type: "primary",
2291
- disabled: __props.disabled,
2292
- plain: "",
2293
- onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
2294
- }, {
2295
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
2296
- createTextVNode(
2297
- "新增一行",
2298
- -1
2299
- /* CACHED */
2300
- )
2301
- ])]),
2302
- _: 1
2303
- /* STABLE */
2304
- }, 8, ["disabled"])) : createCommentVNode("v-if", true),
2305
- createElementVNode("div", _hoisted_5, [
2306
- __props.enableToggleMode && __props.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
2307
- key: 0,
2308
- icon: unref(Grid),
2309
- size: "small",
2310
- type: "primary",
2311
- onClick: toggleMode
2312
- }, {
2313
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
2314
- createTextVNode(
2315
- "展开配置",
2316
- -1
2317
- /* CACHED */
2318
- )
2319
- ])]),
2320
- _: 1
2321
- /* STABLE */
2322
- }, 8, ["icon"])) : createCommentVNode("v-if", true),
2323
- __props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
2324
- key: 1,
2325
- icon: unref(FullScreen),
2326
- size: "small",
2327
- type: "primary",
2328
- onClick: toggleFullscreen
2329
- }, {
2330
- default: withCtx(() => [
2331
- createTextVNode(
2332
- toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"),
2333
- 1
2334
- /* TEXT */
2335
- )
2336
- ]),
2337
- _: 1
2338
- /* STABLE */
2339
- }, 8, ["icon"])) : createCommentVNode("v-if", true),
2340
- importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
2341
- key: 2,
2342
- style: { "display": "inline-block" },
2343
- ref_key: "excelBtn",
2344
- ref: excelBtn,
2345
- action: "/noop",
2346
- disabled: __props.disabled,
2347
- "on-change": excelHandler,
2348
- "auto-upload": false
2349
- }, {
2350
- default: withCtx(() => [
2351
- createVNode(unref(TMagicButton), {
2352
- size: "small",
2353
- type: "success",
2354
- disabled: __props.disabled,
2355
- plain: ""
2356
- }, {
2357
- default: withCtx(() => [..._cache[5] || (_cache[5] = [
2358
- createTextVNode(
2359
- "导入EXCEL",
2360
- -1
2361
- /* CACHED */
2362
- )
2363
- ])]),
2364
- _: 1
2365
- /* STABLE */
2366
- }, 8, ["disabled"])
2367
- ]),
2368
- _: 1
2369
- /* STABLE */
2370
- }, 8, ["disabled"])) : createCommentVNode("v-if", true),
2371
- importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
2372
- key: 3,
2373
- size: "small",
2374
- type: "warning",
2375
- disabled: __props.disabled,
2376
- plain: "",
2377
- onClick: _cache[2] || (_cache[2] = ($event) => clearHandler())
2378
- }, {
2379
- default: withCtx(() => [..._cache[6] || (_cache[6] = [
2380
- createTextVNode(
2381
- "清空",
2382
- -1
2383
- /* CACHED */
2384
- )
2385
- ])]),
2386
- _: 1
2387
- /* STABLE */
2388
- }, 8, ["disabled"])) : createCommentVNode("v-if", true)
2389
- ])
2390
- ]),
2391
- __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_6, [
2392
- createVNode(unref(TMagicPagination), {
2393
- layout: "total, sizes, prev, pager, next, jumper",
2394
- "hide-on-single-page": __props.model[modelName.value].length < pagesize.value,
2395
- "current-page": pagecontext.value + 1,
2396
- "page-sizes": [pagesize.value, 60, 120, 300],
2397
- "page-size": pagesize.value,
2398
- total: __props.model[modelName.value].length,
2399
- onSizeChange: handleSizeChange,
2400
- onCurrentChange: handleCurrentChange
2401
- }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
2402
- ])) : createCommentVNode("v-if", true)
2403
- ],
2404
- 2
2405
- /* CLASS */
2406
- )
2407
- ], 8, ["disabled"]))
2408
- ]);
2409
- };
2410
- }
2411
- });
2412
-
2413
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
2414
- ...{
2415
- name: "MFormTabs"
2416
- },
2417
- __name: "Tabs",
2418
- props: {
2419
- model: {},
2420
- lastValues: { default: () => ({}) },
2421
- isCompare: { type: Boolean, default: false },
2422
- config: {},
2423
- name: {},
2424
- size: {},
2425
- labelWidth: {},
2426
- prop: {},
2427
- expandMore: { type: Boolean },
2428
- disabled: { type: Boolean }
2429
- },
2430
- emits: ["change", "addDiffCount"],
2431
- setup(__props, { emit: __emit }) {
2432
- const tabPaneComponent = getDesignConfig("components")?.tabPane;
2433
- const tabsComponent = getDesignConfig("components")?.tabs;
2434
- const getActive = (mForm2, props2, activeTabName2) => {
2435
- const { config, model, prop } = props2;
2436
- const { active } = config;
2437
- if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
2438
- if (0 >= props2.config.items.length) return "0";
2439
- if (typeof active !== "undefined") return active;
2440
- return "0";
2441
- };
2442
- const tabClick = (mForm2, tab, props2) => {
2443
- const { config, model, prop } = props2;
2444
- tab.name = tab.paneName;
2445
- if (typeof config.onTabClick === "function") {
2446
- config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
2447
- }
2448
- const tabConfig = config.items.find((item) => tab.name === item.status);
2449
- if (tabConfig && typeof tabConfig.onTabClick === "function") {
2450
- tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
2451
- }
2452
- };
2453
- const props = __props;
2454
- const emit = __emit;
2455
- const mForm = inject("mForm");
2456
- const activeTabName = ref(getActive(mForm, props));
2457
- const diffCount = ref({});
2458
- const tabs = computed(() => {
2459
- if (props.config.dynamic) {
2460
- if (!props.config.name) throw new Error("dynamic tab 必须配置name");
2461
- return props.model[props.config.name] || [];
2462
- }
2463
- return props.config.items.filter((item) => display(mForm, item.display, props));
2464
- });
2465
- const filter = (config) => filterFunction(mForm, config, props);
2466
- watchEffect(() => {
2467
- if (typeof props.config.activeChange === "function") {
2468
- props.config.activeChange(mForm, activeTabName.value, {
2469
- model: props.model,
2470
- prop: props.prop
2471
- });
2472
- }
2473
- });
2474
- const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
2475
- const tabClickHandler = (tab) => tabClick(mForm, tab, props);
2476
- const onTabAdd = async () => {
2477
- if (!props.name) throw new Error("dynamic tab 必须配置name");
2478
- if (typeof props.config.onTabAdd === "function") {
2479
- props.config.onTabAdd(mForm, {
2480
- model: props.model,
2481
- prop: props.prop,
2482
- config: props.config
2483
- });
2484
- emit("change", props.model);
2485
- } else {
2486
- const newObj = await initValue(mForm, {
2487
- config: props.config.items,
2488
- initValues: {}
2489
- });
2490
- newObj.title = `标签${tabs.value.length + 1}`;
2491
- props.model[props.name].push(newObj);
2492
- emit("change", props.model[props.name], {
2493
- changeRecords: [
2494
- {
2495
- propPath: `${props.prop}.${props.model[props.name].length - 1}`,
2496
- value: newObj
2497
- }
2498
- ]
2499
- });
2500
- }
2501
- mForm?.$emit("field-change", props.prop, props.model[props.name]);
2502
- };
2503
- const onTabRemove = (tabName) => {
2504
- if (!props.name) throw new Error("dynamic tab 必须配置name");
2505
- if (typeof props.config.onTabRemove === "function") {
2506
- props.config.onTabRemove(mForm, tabName, {
2507
- model: props.model,
2508
- prop: props.prop,
2509
- config: props.config
2510
- });
2511
- } else {
2512
- props.model[props.name].splice(+tabName, 1);
2513
- if (tabName < activeTabName.value || activeTabName.value >= props.model[props.name].length) {
2514
- activeTabName.value = (+activeTabName.value - 1).toString();
2515
- tabClick(mForm, { name: activeTabName.value }, props);
2516
- }
2517
- }
2518
- emit("change", props.model);
2519
- mForm?.$emit("field-change", props.prop, props.model[props.name]);
2520
- };
2521
- const changeHandler = (v, eventData) => {
2522
- emit("change", props.model, eventData);
2523
- };
2524
- const onAddDiffCount = (tabIndex) => {
2525
- if (!diffCount.value[tabIndex]) {
2526
- diffCount.value[tabIndex] = 1;
2527
- } else {
2528
- diffCount.value[tabIndex] += 1;
2529
- }
2530
- emit("addDiffCount");
2531
- };
2532
- return (_ctx, _cache) => {
2533
- return openBlock(), createBlock(resolveDynamicComponent(unref(tabsComponent)?.component || "el-tabs"), mergeProps(
2534
- {
2535
- modelValue: activeTabName.value,
2536
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
2537
- },
2538
- unref(tabsComponent)?.props({
2539
- type: __props.config.tabType,
2540
- editable: __props.config.editable || false,
2541
- tabPosition: __props.config.tabPosition || "top"
2542
- }) || {},
2543
- {
2544
- class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
2545
- onTabClick: tabClickHandler,
2546
- onTabAdd,
2547
- onTabRemove
2548
- }
2549
- ), {
2550
- default: withCtx(() => [
2551
- (openBlock(true), createElementBlock(
2552
- Fragment,
2553
- null,
2554
- renderList(tabs.value, (tab, tabIndex) => {
2555
- return openBlock(), createBlock(
2556
- resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"),
2557
- mergeProps(
2558
- {
2559
- key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex
2560
- },
2561
- { ref_for: true },
2562
- unref(tabPaneComponent)?.props({ name: filter(tab.status) || tabIndex.toString(), lazy: tab.lazy || false }) || {}
2563
- ),
2564
- {
2565
- label: withCtx(() => [
2566
- createElementVNode("span", null, [
2567
- createTextVNode(
2568
- toDisplayString(filter(tab.title)),
2569
- 1
2570
- /* TEXT */
2571
- ),
2572
- createVNode(unref(TMagicBadge), {
2573
- hidden: !diffCount.value[tabIndex],
2574
- value: diffCount.value[tabIndex],
2575
- class: "diff-count-badge"
2576
- }, null, 8, ["hidden", "value"])
2577
- ])
2578
- ]),
2579
- default: withCtx(() => [
2580
- (openBlock(true), createElementBlock(
2581
- Fragment,
2582
- null,
2583
- renderList(tabItems(tab), (item) => {
2584
- return openBlock(), createBlock(_sfc_main$x, {
2585
- key: item[unref(mForm)?.keyProp || "__key"],
2586
- config: item,
2587
- disabled: __props.disabled,
2588
- 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,
2589
- "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,
2590
- "is-compare": __props.isCompare,
2591
- prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2592
- size: __props.size,
2593
- "label-width": tab.labelWidth || __props.labelWidth,
2594
- "expand-more": __props.expandMore,
2595
- onChange: changeHandler,
2596
- onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
2597
- }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
2598
- }),
2599
- 128
2600
- /* KEYED_FRAGMENT */
2601
- ))
2602
- ]),
2603
- _: 2
2604
- /* DYNAMIC */
2605
- },
2606
- 1040
2607
- /* FULL_PROPS, DYNAMIC_SLOTS */
2608
- );
2609
- }),
2610
- 128
2611
- /* KEYED_FRAGMENT */
2612
- ))
2613
- ]),
2614
- _: 1
2615
- /* STABLE */
2616
- }, 16, ["modelValue", "class"]);
2617
- };
2618
- }
2619
- });
2620
-
2621
- let $MAGIC_FORM = {};
2622
- const setConfig = (option) => {
2623
- $MAGIC_FORM = option;
2624
- };
2625
- const getConfig = (key) => $MAGIC_FORM[key];
2626
-
2627
- const useAddField = (prop) => {
2628
- if (!prop) return;
2629
- const mForm = inject("mForm");
2630
- const instance = getCurrentInstance();
2631
- watch(
2632
- () => instance?.proxy,
2633
- (vm) => {
2634
- if (vm) {
2635
- mForm?.setField(prop, vm);
2636
- } else {
2637
- mForm?.deleteField(prop);
2638
- }
2639
- },
2640
- {
2641
- immediate: true
2642
- }
2643
- );
2644
- };
2645
-
2646
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
2647
- ...{
2648
- name: "MFormCascader"
2649
- },
2650
- __name: "Cascader",
2651
- props: {
2652
- config: {},
2653
- model: {},
2654
- initValues: {},
2655
- values: {},
2656
- name: {},
2657
- prop: {},
2658
- disabled: { type: Boolean },
2659
- size: {},
2660
- lastValues: {}
2661
- },
2662
- emits: ["change"],
2663
- setup(__props, { emit: __emit }) {
2664
- const props = __props;
2665
- const emit = __emit;
2666
- const mForm = inject("mForm");
2667
- useAddField(props.prop);
2668
- const requestFunc = getConfig("request");
2669
- const tMagicCascader = ref();
2670
- const options = ref([]);
2671
- const remoteData = ref(null);
2672
- const checkStrictly = computed(() => filterFunction(mForm, props.config.checkStrictly, props));
2673
- const valueSeparator = computed(() => filterFunction(mForm, props.config.valueSeparator, props));
2674
- const value = computed({
2675
- get() {
2676
- if (typeof props.model[props.name] === "string" && valueSeparator.value) {
2677
- return props.model[props.name].split(valueSeparator.value);
2678
- }
2679
- return props.model[props.name];
2680
- },
2681
- set(value2) {
2682
- let result = value2;
2683
- if (valueSeparator.value) {
2684
- result = value2.join(valueSeparator.value);
2685
- }
2686
- props.model[props.name] = result;
2687
- }
2688
- });
2689
- const setRemoteOptions = async function() {
2690
- const { config } = props;
2691
- const { option } = config;
2692
- if (!option) return;
2693
- let { body } = option;
2694
- const postOptions = {
2695
- url: option.url,
2696
- cache: option.cache,
2697
- timeout: option.timeout,
2698
- data: {}
2699
- };
2700
- if (body && mForm) {
2701
- if (typeof body === "function" && props.model && mForm) {
2702
- body = body(mForm, {
2703
- model: props.model,
2704
- formValue: mForm.values,
2705
- formValues: mForm.values,
2706
- config: props.config
2707
- });
2708
- }
2709
- postOptions.data = body;
2710
- }
2711
- const res = await requestFunc(postOptions);
2712
- remoteData.value = res[option.root];
2713
- if (remoteData.value && typeof option?.item === "function") {
2714
- options.value = option.item(res[option.root]);
2086
+ const res = await requestFunc(postOptions);
2087
+ remoteData.value = res[option.root];
2088
+ if (remoteData.value && typeof option?.item === "function") {
2089
+ options.value = option.item(res[option.root]);
2715
2090
  }
2716
2091
  };
2717
2092
  if (typeof props.config.options === "function" && props.model && mForm) {
@@ -2737,12 +2112,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2737
2112
  if (!tMagicCascader.value) return;
2738
2113
  tMagicCascader.value.setQuery("");
2739
2114
  tMagicCascader.value.setPreviousQuery(null);
2740
- emit("change", props.model[props.name]);
2741
2115
  };
2742
2116
  return (_ctx, _cache) => {
2743
2117
  return openBlock(), createBlock(unref(TMagicCascader), {
2744
- modelValue: value.value,
2745
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2118
+ "model-value": value.value,
2746
2119
  ref_key: "tMagicCascader",
2747
2120
  ref: tMagicCascader,
2748
2121
  style: { "width": "100%" },
@@ -2758,13 +2131,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2758
2131
  emitPath: __props.config.emitPath ?? true,
2759
2132
  checkStrictly: checkStrictly.value ?? false
2760
2133
  },
2134
+ "onUpdate:modelValue": updateModelValueHandler,
2761
2135
  onChange: changeHandler
2762
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
2136
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
2763
2137
  };
2764
2138
  }
2765
2139
  });
2766
2140
 
2767
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2141
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2768
2142
  ...{
2769
2143
  name: "MFormCheckbox"
2770
2144
  },
@@ -2810,29 +2184,33 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2810
2184
  };
2811
2185
  return (_ctx, _cache) => {
2812
2186
  return openBlock(), createBlock(unref(TMagicCheckbox), {
2813
- modelValue: __props.model[__props.name],
2814
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2187
+ "model-value": __props.model[__props.name],
2815
2188
  size: __props.size,
2816
2189
  trueValue: activeValue.value,
2817
2190
  falseValue: inactiveValue.value,
2818
2191
  disabled: __props.disabled,
2819
- onChange: changeHandler
2820
- }, {
2821
- default: withCtx(() => [
2822
- createTextVNode(
2823
- toDisplayString(__props.config.text),
2824
- 1
2825
- /* TEXT */
2826
- )
2827
- ]),
2828
- _: 1
2829
- /* STABLE */
2830
- }, 8, ["modelValue", "size", "trueValue", "falseValue", "disabled"]);
2192
+ "onUpdate:modelValue": changeHandler
2193
+ }, createSlots({
2194
+ _: 2
2195
+ /* DYNAMIC */
2196
+ }, [
2197
+ !__props.config.useLabel ? {
2198
+ name: "default",
2199
+ fn: withCtx(() => [
2200
+ createTextVNode(
2201
+ toDisplayString(__props.config.text),
2202
+ 1
2203
+ /* TEXT */
2204
+ )
2205
+ ]),
2206
+ key: "0"
2207
+ } : void 0
2208
+ ]), 1032, ["model-value", "size", "trueValue", "falseValue", "disabled"]);
2831
2209
  };
2832
2210
  }
2833
2211
  });
2834
2212
 
2835
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2213
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2836
2214
  ...{
2837
2215
  name: "MFormCheckGroup"
2838
2216
  },
@@ -2868,11 +2246,10 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2868
2246
  });
2869
2247
  return (_ctx, _cache) => {
2870
2248
  return openBlock(), createBlock(unref(TMagicCheckboxGroup), {
2871
- modelValue: __props.model[__props.name],
2872
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2249
+ "model-value": __props.model[__props.name],
2873
2250
  size: __props.size,
2874
2251
  disabled: __props.disabled,
2875
- onChange: changeHandler
2252
+ "onUpdate:modelValue": changeHandler
2876
2253
  }, {
2877
2254
  default: withCtx(() => [
2878
2255
  (openBlock(true), createElementBlock(
@@ -2901,12 +2278,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2901
2278
  ]),
2902
2279
  _: 1
2903
2280
  /* STABLE */
2904
- }, 8, ["modelValue", "size", "disabled"]);
2281
+ }, 8, ["model-value", "size", "disabled"]);
2905
2282
  };
2906
2283
  }
2907
2284
  });
2908
2285
 
2909
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2286
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2910
2287
  ...{
2911
2288
  name: "MFormColorPicker"
2912
2289
  },
@@ -2930,18 +2307,17 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2930
2307
  const changeHandler = (value) => emit("change", value);
2931
2308
  return (_ctx, _cache) => {
2932
2309
  return openBlock(), createBlock(unref(TMagicColorPicker), {
2933
- modelValue: __props.model[__props.name],
2934
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2310
+ "model-value": __props.model[__props.name],
2935
2311
  size: __props.size,
2936
2312
  disabled: __props.disabled,
2937
2313
  showAlpha: true,
2938
- onChange: changeHandler
2939
- }, null, 8, ["modelValue", "size", "disabled"]);
2314
+ "onUpdate:modelValue": changeHandler
2315
+ }, null, 8, ["model-value", "size", "disabled"]);
2940
2316
  };
2941
2317
  }
2942
2318
  });
2943
2319
 
2944
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2320
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2945
2321
  ...{
2946
2322
  name: "MFormDate"
2947
2323
  },
@@ -2968,21 +2344,20 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2968
2344
  };
2969
2345
  return (_ctx, _cache) => {
2970
2346
  return openBlock(), createBlock(unref(TMagicDatePicker), {
2971
- modelValue: __props.model[__props.name],
2972
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2347
+ "model-value": __props.model[__props.name],
2973
2348
  type: "date",
2974
2349
  size: __props.size,
2975
2350
  placeholder: __props.config.placeholder,
2976
2351
  disabled: __props.disabled,
2977
2352
  format: __props.config.format || "YYYY/MM/DD",
2978
2353
  "value-format": __props.config.valueFormat || "YYYY/MM/DD",
2979
- onChange: changeHandler
2980
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
2354
+ "onUpdate:modelValue": changeHandler
2355
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format"]);
2981
2356
  };
2982
2357
  }
2983
2358
  });
2984
2359
 
2985
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2360
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2986
2361
  ...{
2987
2362
  name: "MFormDateRange"
2988
2363
  },
@@ -3063,8 +2438,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3063
2438
  };
3064
2439
  return (_ctx, _cache) => {
3065
2440
  return openBlock(), createBlock(unref(TMagicDatePicker), {
3066
- modelValue: value.value,
3067
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2441
+ "model-value": value.value,
3068
2442
  type: "datetimerange",
3069
2443
  "range-separator": "-",
3070
2444
  "start-placeholder": "开始日期",
@@ -3076,13 +2450,13 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3076
2450
  "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
3077
2451
  "date-format": __props.config.dateFormat || "YYYY/MM/DD",
3078
2452
  "time-format": __props.config.timeFormat || "HH:mm:ss",
3079
- onChange: changeHandler
3080
- }, null, 8, ["modelValue", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
2453
+ "onUpdate:modelValue": changeHandler
2454
+ }, null, 8, ["model-value", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
3081
2455
  };
3082
2456
  }
3083
2457
  });
3084
2458
 
3085
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
2459
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3086
2460
  ...{
3087
2461
  name: "MFormDateTime"
3088
2462
  },
@@ -3120,8 +2494,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3120
2494
  };
3121
2495
  return (_ctx, _cache) => {
3122
2496
  return openBlock(), createBlock(unref(TMagicDatePicker), {
3123
- modelValue: __props.model[__props.name],
3124
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2497
+ "model-value": __props.model[__props.name],
3125
2498
  "popper-class": "magic-datetime-picker-popper",
3126
2499
  type: "datetime",
3127
2500
  size: __props.size,
@@ -3130,14 +2503,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3130
2503
  format: __props.config.format || "YYYY/MM/DD HH:mm:ss",
3131
2504
  "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
3132
2505
  "default-time": __props.config.defaultTime,
3133
- onChange: changeHandler
3134
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
2506
+ "onUpdate:modelValue": changeHandler
2507
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
3135
2508
  };
3136
2509
  }
3137
2510
  });
3138
2511
 
3139
2512
  const _hoisted_1$8 = { key: 0 };
3140
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
2513
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3141
2514
  ...{
3142
2515
  name: "MFormDisplay"
3143
2516
  },
@@ -3172,7 +2545,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3172
2545
  });
3173
2546
 
3174
2547
  const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
3175
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2548
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3176
2549
  ...{
3177
2550
  name: "MFormDynamicField"
3178
2551
  },
@@ -3273,7 +2646,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3273
2646
  }
3274
2647
  });
3275
2648
 
3276
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
2649
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3277
2650
  ...{
3278
2651
  name: "MFormHidden"
3279
2652
  },
@@ -3310,7 +2683,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3310
2683
  }
3311
2684
  });
3312
2685
 
3313
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
2686
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3314
2687
  ...{
3315
2688
  name: "MForm"
3316
2689
  },
@@ -3337,7 +2710,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3337
2710
  setup(__props, { expose: __expose, emit: __emit }) {
3338
2711
  const props = __props;
3339
2712
  const emit = __emit;
3340
- const tMagicForm = ref();
2713
+ const tMagicFormRef = useTemplateRef("tMagicForm");
3341
2714
  const initialized = ref(false);
3342
2715
  const values = ref({});
3343
2716
  const lastValuesProcessed = ref({});
@@ -3414,7 +2787,17 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3414
2787
  );
3415
2788
  const changeHandler = (v, eventData) => {
3416
2789
  if (eventData.changeRecords?.length) {
3417
- changeRecords.value.push(...eventData.changeRecords);
2790
+ for (const record of eventData.changeRecords) {
2791
+ if (record.propPath) {
2792
+ const index = changeRecords.value.findIndex((item) => item.propPath === record.propPath);
2793
+ if (index > -1) {
2794
+ changeRecords.value[index] = record;
2795
+ } else {
2796
+ changeRecords.value.push(record);
2797
+ }
2798
+ setValueByKeyPath(record.propPath, record.value, values.value);
2799
+ }
2800
+ }
3418
2801
  }
3419
2802
  emit("change", values.value, eventData);
3420
2803
  };
@@ -3431,12 +2814,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3431
2814
  changeRecords,
3432
2815
  changeHandler,
3433
2816
  resetForm: () => {
3434
- tMagicForm.value?.resetFields();
2817
+ tMagicFormRef.value?.resetFields();
3435
2818
  changeRecords.value = [];
3436
2819
  },
3437
2820
  submitForm: async (native) => {
3438
2821
  try {
3439
- await tMagicForm.value?.validate();
2822
+ await tMagicFormRef.value?.validate();
2823
+ changeRecords.value = [];
3440
2824
  return native ? values.value : cloneDeep(toRaw(values.value));
3441
2825
  } catch (invalidFields) {
3442
2826
  emit("error", invalidFields);
@@ -3455,8 +2839,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3455
2839
  return (_ctx, _cache) => {
3456
2840
  return openBlock(), createBlock(unref(TMagicForm), {
3457
2841
  class: "m-form",
3458
- ref_key: "tMagicForm",
3459
- ref: tMagicForm,
2842
+ ref: "tMagicForm",
3460
2843
  model: values.value,
3461
2844
  "label-width": __props.labelWidth,
3462
2845
  style: normalizeStyle(`height: ${__props.height}`),
@@ -3469,7 +2852,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3469
2852
  Fragment,
3470
2853
  { key: 0 },
3471
2854
  renderList(__props.config, (item, index) => {
3472
- return openBlock(), createBlock(_sfc_main$x, {
2855
+ return openBlock(), createBlock(_sfc_main$A, {
3473
2856
  disabled: __props.disabled,
3474
2857
  key: item[__props.keyProp] ?? index,
3475
2858
  config: item,
@@ -3494,7 +2877,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3494
2877
  });
3495
2878
 
3496
2879
  const _hoisted_1$6 = { style: { "min-height": "1px" } };
3497
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
2880
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3498
2881
  ...{
3499
2882
  name: "MFormDialog"
3500
2883
  },
@@ -3695,7 +3078,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3695
3078
  style: normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
3696
3079
  },
3697
3080
  [
3698
- createVNode(_sfc_main$d, {
3081
+ createVNode(_sfc_main$g, {
3699
3082
  modelValue: stepActive.value,
3700
3083
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
3701
3084
  ref_key: "form",
@@ -3725,11 +3108,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3725
3108
  });
3726
3109
 
3727
3110
  const _hoisted_1$5 = ["href"];
3728
- const _hoisted_2$1 = {
3111
+ const _hoisted_2$2 = {
3729
3112
  key: 2,
3730
3113
  class: "m-fields-link"
3731
3114
  };
3732
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
3115
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3733
3116
  ...{
3734
3117
  name: "MFormLink"
3735
3118
  },
@@ -3807,7 +3190,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3807
3190
  toDisplayString(displayText.value),
3808
3191
  5
3809
3192
  /* TEXT, STYLE */
3810
- )) : (openBlock(), createElementBlock("div", _hoisted_2$1, [
3193
+ )) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
3811
3194
  createVNode(unref(TMagicButton), {
3812
3195
  link: "",
3813
3196
  type: "primary",
@@ -3823,7 +3206,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3823
3206
  _: 1
3824
3207
  /* STABLE */
3825
3208
  }),
3826
- createVNode(_sfc_main$c, {
3209
+ createVNode(_sfc_main$f, {
3827
3210
  ref_key: "editor",
3828
3211
  ref: editor,
3829
3212
  title: __props.config.formTitle || "编辑扩展配置",
@@ -3839,7 +3222,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3839
3222
  }
3840
3223
  });
3841
3224
 
3842
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
3225
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3843
3226
  ...{
3844
3227
  name: "MFormNumber"
3845
3228
  },
@@ -3871,8 +3254,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3871
3254
  return (_ctx, _cache) => {
3872
3255
  return __props.model ? (openBlock(), createBlock(unref(TMagicInputNumber), {
3873
3256
  key: 0,
3874
- modelValue: __props.model[__props.name],
3875
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3257
+ "model-value": __props.model[__props.name],
3876
3258
  clearable: "",
3877
3259
  "controls-position": "right",
3878
3260
  size: __props.size,
@@ -3881,15 +3263,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3881
3263
  step: __props.config.step,
3882
3264
  placeholder: __props.config.placeholder,
3883
3265
  disabled: __props.disabled,
3884
- onChange: changeHandler,
3266
+ "onUpdate:modelValue": changeHandler,
3885
3267
  onInput: inputHandler
3886
- }, null, 8, ["modelValue", "size", "max", "min", "step", "placeholder", "disabled"])) : createCommentVNode("v-if", true);
3268
+ }, null, 8, ["model-value", "size", "max", "min", "step", "placeholder", "disabled"])) : createCommentVNode("v-if", true);
3887
3269
  };
3888
3270
  }
3889
3271
  });
3890
3272
 
3891
3273
  const _hoisted_1$4 = { class: "m-fields-number-range" };
3892
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3274
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3893
3275
  ...{
3894
3276
  name: "MFormNumberRange"
3895
3277
  },
@@ -3922,14 +3304,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3922
3304
  return (_ctx, _cache) => {
3923
3305
  return openBlock(), createElementBlock("div", _hoisted_1$4, [
3924
3306
  createVNode(unref(TMagicInput), {
3925
- modelValue: __props.model[__props.name][0],
3926
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name][0] = $event),
3927
- clearable: "",
3307
+ "model-value": __props.model[__props.name][0],
3308
+ clearable: __props.config.clearable ?? true,
3928
3309
  size: __props.size,
3929
3310
  disabled: __props.disabled,
3930
- onChange: minChangeHandler
3931
- }, null, 8, ["modelValue", "size", "disabled"]),
3932
- _cache[2] || (_cache[2] = createElementVNode(
3311
+ "onUpdate:modelValue": minChangeHandler
3312
+ }, null, 8, ["model-value", "clearable", "size", "disabled"]),
3313
+ _cache[0] || (_cache[0] = createElementVNode(
3933
3314
  "span",
3934
3315
  { class: "split-tag" },
3935
3316
  "-",
@@ -3937,20 +3318,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3937
3318
  /* CACHED */
3938
3319
  )),
3939
3320
  createVNode(unref(TMagicInput), {
3940
- modelValue: __props.model[__props.name][1],
3941
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.model[__props.name][1] = $event),
3942
- clearable: "",
3321
+ "model-value": __props.model[__props.name][1],
3322
+ clearable: __props.config.clearable ?? true,
3943
3323
  size: __props.size,
3944
3324
  disabled: __props.disabled,
3945
- onChange: maxChangeHandler
3946
- }, null, 8, ["modelValue", "size", "disabled"])
3325
+ "onUpdate:modelValue": maxChangeHandler
3326
+ }, null, 8, ["model-value", "clearable", "size", "disabled"])
3947
3327
  ]);
3948
3328
  };
3949
3329
  }
3950
3330
  });
3951
3331
 
3952
- const _hoisted_1$3 = { key: 1 };
3953
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3332
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3954
3333
  ...{
3955
3334
  name: "MFormRadioGroup"
3956
3335
  },
@@ -3971,12 +3350,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3971
3350
  const props = __props;
3972
3351
  const itemComponent = computed(() => props.config.childType === "button" ? TMagicRadioButton : TMagicRadio);
3973
3352
  const emit = __emit;
3974
- const changeHandler = (value) => {
3975
- emit("change", value);
3976
- };
3977
3353
  const clickHandler = (item) => {
3978
- props.model[props.name] = props.model[props.name] === item ? "" : item;
3979
- changeHandler(props.model[props.name]);
3354
+ emit("change", props.model[props.name] === item ? "" : item);
3980
3355
  };
3981
3356
  useAddField(props.prop);
3982
3357
  const iconSize = computed(() => {
@@ -3991,8 +3366,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3991
3366
  return (_ctx, _cache) => {
3992
3367
  return __props.model ? (openBlock(), createBlock(unref(TMagicRadioGroup), {
3993
3368
  key: 0,
3994
- modelValue: __props.model[__props.name],
3995
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3369
+ "model-value": __props.model[__props.name],
3996
3370
  size: __props.size,
3997
3371
  disabled: __props.disabled
3998
3372
  }, {
@@ -4004,11 +3378,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4004
3378
  return openBlock(), createBlock(resolveDynamicComponent(itemComponent.value), {
4005
3379
  value: option.value,
4006
3380
  key: `${option.value}`,
4007
- onClick: withModifiers(($event) => clickHandler(option.value), ["prevent"])
3381
+ onClick: ($event) => clickHandler(option.value)
4008
3382
  }, {
4009
3383
  default: withCtx(() => [
4010
- option.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
4011
- key: 0,
3384
+ createVNode(unref(TMagicTooltip), {
3385
+ disabled: !Boolean(option.tooltip),
4012
3386
  placement: "top-start",
4013
3387
  content: option.tooltip
4014
3388
  }, {
@@ -4035,25 +3409,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4035
3409
  ]),
4036
3410
  _: 2
4037
3411
  /* DYNAMIC */
4038
- }, 1032, ["content"])) : (openBlock(), createElementBlock("div", _hoisted_1$3, [
4039
- option.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
4040
- key: 0,
4041
- size: iconSize.value
4042
- }, {
4043
- default: withCtx(() => [
4044
- (openBlock(), createBlock(resolveDynamicComponent(option.icon)))
4045
- ]),
4046
- _: 2
4047
- /* DYNAMIC */
4048
- }, 1032, ["size"])) : createCommentVNode("v-if", true),
4049
- createElementVNode(
4050
- "span",
4051
- null,
4052
- toDisplayString(option.text),
4053
- 1
4054
- /* TEXT */
4055
- )
4056
- ]))
3412
+ }, 1032, ["disabled", "content"])
4057
3413
  ]),
4058
3414
  _: 2
4059
3415
  /* DYNAMIC */
@@ -4065,13 +3421,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4065
3421
  ]),
4066
3422
  _: 1
4067
3423
  /* STABLE */
4068
- }, 8, ["modelValue", "size", "disabled"])) : createCommentVNode("v-if", true);
3424
+ }, 8, ["model-value", "size", "disabled"])) : createCommentVNode("v-if", true);
4069
3425
  };
4070
3426
  }
4071
3427
  });
4072
3428
 
4073
- const _hoisted_1$2 = { key: 2 };
4074
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3429
+ const _hoisted_1$3 = { key: 2 };
3430
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4075
3431
  ...{
4076
3432
  name: "MFormSelect"
4077
3433
  },
@@ -4398,8 +3754,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4398
3754
  const _directive_loading = resolveDirective("loading");
4399
3755
  return __props.model ? withDirectives((openBlock(), createBlock(unref(TMagicSelect), {
4400
3756
  key: 0,
4401
- modelValue: __props.model[__props.name],
4402
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3757
+ "model-value": __props.model[__props.name],
4403
3758
  class: "m-select",
4404
3759
  ref_key: "tMagicSelect",
4405
3760
  ref: tMagicSelect,
@@ -4414,7 +3769,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4414
3769
  "allow-create": __props.config.allowCreate,
4415
3770
  disabled: __props.disabled,
4416
3771
  "remote-method": __props.config.remote && remoteMethod,
4417
- onChange: changeHandler,
3772
+ "onUpdate:modelValue": changeHandler,
4418
3773
  onVisibleChange: visibleHandler
4419
3774
  }, {
4420
3775
  default: withCtx(() => [
@@ -4506,7 +3861,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4506
3861
  )),
4507
3862
  moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock(
4508
3863
  "div",
4509
- _hoisted_1$2,
3864
+ _hoisted_1$3,
4510
3865
  null,
4511
3866
  512
4512
3867
  /* NEED_PATCH */
@@ -4516,14 +3871,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4516
3871
  ]),
4517
3872
  _: 1
4518
3873
  /* STABLE */
4519
- }, 8, ["modelValue", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
3874
+ }, 8, ["model-value", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
4520
3875
  [_directive_loading, loading.value]
4521
3876
  ]) : createCommentVNode("v-if", true);
4522
3877
  };
4523
3878
  }
4524
3879
  });
4525
3880
 
4526
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3881
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4527
3882
  ...{
4528
3883
  name: "MFormSwitch"
4529
3884
  },
@@ -4569,21 +3924,21 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4569
3924
  });
4570
3925
  return (_ctx, _cache) => {
4571
3926
  return openBlock(), createBlock(unref(TMagicSwitch), {
4572
- modelValue: __props.model[__props.name],
4573
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3927
+ "model-value": __props.model[__props.name],
4574
3928
  size: __props.size,
4575
3929
  activeValue: activeValue.value,
4576
3930
  inactiveValue: inactiveValue.value,
4577
3931
  disabled: __props.disabled,
4578
- onChange: changeHandler
4579
- }, null, 8, ["modelValue", "size", "activeValue", "inactiveValue", "disabled"]);
3932
+ "onUpdate:modelValue": changeHandler
3933
+ }, null, 8, ["model-value", "size", "activeValue", "inactiveValue", "disabled"]);
4580
3934
  };
4581
3935
  }
4582
3936
  });
4583
3937
 
4584
- const _hoisted_1$1 = { class: "m-fields-text" };
4585
- const _hoisted_2 = { style: { "display": "flex", "justify-content": "flex-end" } };
4586
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3938
+ const _hoisted_1$2 = { class: "m-fields-text" };
3939
+ const _hoisted_2$1 = { key: 1 };
3940
+ const _hoisted_3$1 = { style: { "display": "flex", "justify-content": "flex-end" } };
3941
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4587
3942
  ...{
4588
3943
  name: "MFormText"
4589
3944
  },
@@ -4608,16 +3963,25 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4608
3963
  const appendConfig = computed(() => {
4609
3964
  if (typeof props.config.append === "string") {
4610
3965
  return {
3966
+ type: "text",
4611
3967
  text: props.config.append,
4612
- type: "button",
4613
3968
  handler: void 0
4614
3969
  };
4615
3970
  }
4616
- if (props.config.append && typeof props.config.append === "object") {
4617
- if (props.config.append.value === 0) {
4618
- return false;
3971
+ if (typeof props.config.append === "object") {
3972
+ if (typeof props.config.append?.handler === "function") {
3973
+ return {
3974
+ type: "button",
3975
+ text: props.config.append.text,
3976
+ handler: props.config.append.handler
3977
+ };
3978
+ }
3979
+ if (props.config.append) {
3980
+ if (props.config.append.value === 0) {
3981
+ return false;
3982
+ }
3983
+ return props.config.append;
4619
3984
  }
4620
- return props.config.append;
4621
3985
  }
4622
3986
  return false;
4623
3987
  });
@@ -4722,23 +4086,35 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4722
4086
  instanceRef.value = void 0;
4723
4087
  };
4724
4088
  return (_ctx, _cache) => {
4725
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
4089
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
4726
4090
  createVNode(unref(TMagicInput), {
4727
- modelValue: __props.model[__props.name],
4728
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
4091
+ "model-value": __props.model[__props.name],
4729
4092
  ref_key: "input",
4730
4093
  ref: input,
4731
4094
  clearable: "",
4732
4095
  size: __props.size,
4733
4096
  placeholder: __props.config.placeholder,
4734
4097
  disabled: __props.disabled,
4735
- onChange: changeHandler,
4098
+ "onUpdate:modelValue": changeHandler,
4736
4099
  onInput: inputHandler,
4737
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
4100
+ onKeyup: _cache[0] || (_cache[0] = ($event) => keyUpHandler($event))
4738
4101
  }, createSlots({
4739
4102
  _: 2
4740
4103
  /* DYNAMIC */
4741
4104
  }, [
4105
+ __props.config.prepend ? {
4106
+ name: "prepend",
4107
+ fn: withCtx(() => [
4108
+ createElementVNode(
4109
+ "span",
4110
+ null,
4111
+ toDisplayString(__props.config.prepend),
4112
+ 1
4113
+ /* TEXT */
4114
+ )
4115
+ ]),
4116
+ key: "0"
4117
+ } : void 0,
4742
4118
  appendConfig.value ? {
4743
4119
  name: "append",
4744
4120
  fn: withCtx(() => [
@@ -4757,11 +4133,17 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4757
4133
  ]),
4758
4134
  _: 1
4759
4135
  /* STABLE */
4760
- }, 8, ["size"])) : createCommentVNode("v-if", true)
4136
+ }, 8, ["size"])) : (openBlock(), createElementBlock(
4137
+ "span",
4138
+ _hoisted_2$1,
4139
+ toDisplayString(appendConfig.value.text),
4140
+ 1
4141
+ /* TEXT */
4142
+ ))
4761
4143
  ]),
4762
- key: "0"
4144
+ key: "1"
4763
4145
  } : void 0
4764
- ]), 1032, ["modelValue", "size", "placeholder", "disabled"]),
4146
+ ]), 1032, ["model-value", "size", "placeholder", "disabled"]),
4765
4147
  (openBlock(), createBlock(Teleport, { to: "body" }, [
4766
4148
  popoverVisible.value ? (openBlock(), createElementBlock(
4767
4149
  "div",
@@ -4772,20 +4154,20 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4772
4154
  ref: popoverEl
4773
4155
  },
4774
4156
  [
4775
- _cache[5] || (_cache[5] = createElementVNode(
4157
+ _cache[4] || (_cache[4] = createElementVNode(
4776
4158
  "div",
4777
4159
  { class: "m-form-validate__warning" },
4778
4160
  "输入内容前后有空格,是否移除空格?",
4779
4161
  -1
4780
4162
  /* CACHED */
4781
4163
  )),
4782
- createElementVNode("div", _hoisted_2, [
4164
+ createElementVNode("div", _hoisted_3$1, [
4783
4165
  createVNode(unref(TMagicButton), {
4784
4166
  link: "",
4785
4167
  size: "small",
4786
- onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
4168
+ onClick: _cache[1] || (_cache[1] = ($event) => popoverVisible.value = false)
4787
4169
  }, {
4788
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
4170
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
4789
4171
  createTextVNode(
4790
4172
  "保持原样",
4791
4173
  -1
@@ -4800,7 +4182,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4800
4182
  size: "small",
4801
4183
  onClick: confirmTrimHandler
4802
4184
  }, {
4803
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
4185
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
4804
4186
  createTextVNode(
4805
4187
  "移除空格",
4806
4188
  -1
@@ -4811,7 +4193,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4811
4193
  /* STABLE */
4812
4194
  })
4813
4195
  ]),
4814
- _cache[6] || (_cache[6] = createElementVNode(
4196
+ _cache[5] || (_cache[5] = createElementVNode(
4815
4197
  "span",
4816
4198
  {
4817
4199
  class: "tmagic-form-text-popper-arrow",
@@ -4831,162 +4213,989 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4831
4213
  }
4832
4214
  });
4833
4215
 
4216
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4217
+ ...{
4218
+ name: "MFormTextarea"
4219
+ },
4220
+ __name: "Textarea",
4221
+ props: {
4222
+ config: {},
4223
+ model: {},
4224
+ initValues: {},
4225
+ values: {},
4226
+ name: {},
4227
+ prop: {},
4228
+ disabled: { type: Boolean },
4229
+ size: {},
4230
+ lastValues: {}
4231
+ },
4232
+ emits: ["change", "input"],
4233
+ setup(__props, { emit: __emit }) {
4234
+ const props = __props;
4235
+ const emit = __emit;
4236
+ useAddField(props.prop);
4237
+ const mForm = inject("mForm");
4238
+ const changeHandler = (value) => {
4239
+ emit("change", value);
4240
+ };
4241
+ const inputHandler = (v) => {
4242
+ emit("input", v);
4243
+ mForm?.$emit("field-input", props.prop, v);
4244
+ };
4245
+ return (_ctx, _cache) => {
4246
+ return openBlock(), createBlock(unref(TMagicInput), {
4247
+ "model-value": __props.model[__props.name],
4248
+ type: "textarea",
4249
+ size: __props.size,
4250
+ clearable: "",
4251
+ placeholder: __props.config.placeholder,
4252
+ disabled: __props.disabled,
4253
+ "onUpdate:modelValue": changeHandler,
4254
+ onInput: inputHandler
4255
+ }, null, 8, ["model-value", "size", "placeholder", "disabled"]);
4256
+ };
4257
+ }
4258
+ });
4259
+
4260
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4261
+ ...{
4262
+ name: "MFormTime"
4263
+ },
4264
+ __name: "Time",
4265
+ props: {
4266
+ config: {},
4267
+ model: {},
4268
+ initValues: {},
4269
+ values: {},
4270
+ name: {},
4271
+ prop: {},
4272
+ disabled: { type: Boolean },
4273
+ size: {},
4274
+ lastValues: {}
4275
+ },
4276
+ emits: ["change"],
4277
+ setup(__props, { emit: __emit }) {
4278
+ const props = __props;
4279
+ const emit = __emit;
4280
+ useAddField(props.prop);
4281
+ const changeHandler = (v) => {
4282
+ emit("change", v);
4283
+ };
4284
+ return (_ctx, _cache) => {
4285
+ return openBlock(), createBlock(unref(TMagicTimePicker), {
4286
+ "model-value": __props.model[__props.name],
4287
+ "value-format": __props.config.valueFormat || "HH:mm:ss",
4288
+ format: __props.config.format || "HH:mm:ss",
4289
+ size: __props.size,
4290
+ placeholder: __props.config.placeholder,
4291
+ disabled: __props.disabled,
4292
+ "onUpdate:modelValue": changeHandler
4293
+ }, null, 8, ["model-value", "value-format", "format", "size", "placeholder", "disabled"]);
4294
+ };
4295
+ }
4296
+ });
4297
+
4298
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4299
+ ...{
4300
+ name: "MFormTimeRange"
4301
+ },
4302
+ __name: "Timerange",
4303
+ props: {
4304
+ config: {},
4305
+ model: {},
4306
+ initValues: {},
4307
+ values: {},
4308
+ name: {},
4309
+ prop: {},
4310
+ disabled: { type: Boolean },
4311
+ size: {},
4312
+ lastValues: {}
4313
+ },
4314
+ emits: ["change"],
4315
+ setup(__props, { emit: __emit }) {
4316
+ const props = __props;
4317
+ const emit = __emit;
4318
+ useAddField(props.prop);
4319
+ const { names } = props.config;
4320
+ const value = ref([]);
4321
+ if (props.model !== void 0 && names?.length) {
4322
+ watch(
4323
+ [() => props.model[names[0]], () => props.model[names[1]]],
4324
+ ([start, end], [preStart, preEnd]) => {
4325
+ if (!value.value) {
4326
+ value.value = [];
4327
+ }
4328
+ if (!start || !end) value.value = [];
4329
+ if (start !== preStart) value.value[0] = start;
4330
+ if (end !== preEnd) value.value[1] = end;
4331
+ },
4332
+ {
4333
+ immediate: true
4334
+ }
4335
+ );
4336
+ }
4337
+ const setValue = (v) => {
4338
+ names?.forEach((item, index) => {
4339
+ if (!props.model) {
4340
+ return;
4341
+ }
4342
+ if (Array.isArray(v)) {
4343
+ props.model[item] = v[index];
4344
+ } else {
4345
+ props.model[item] = void 0;
4346
+ }
4347
+ });
4348
+ };
4349
+ const changeHandler = (v) => {
4350
+ const value2 = v || [];
4351
+ if (names?.length) {
4352
+ setValue(value2);
4353
+ }
4354
+ emit("change", value2);
4355
+ };
4356
+ return (_ctx, _cache) => {
4357
+ return openBlock(), createBlock(unref(TMagicTimePicker), {
4358
+ "model-value": value.value,
4359
+ "is-range": "",
4360
+ "range-separator": "-",
4361
+ "start-placeholder": "开始时间",
4362
+ "end-placeholder": "结束时间",
4363
+ size: __props.size,
4364
+ "unlink-panels": true,
4365
+ disabled: __props.disabled,
4366
+ "default-time": __props.config.defaultTime,
4367
+ "onUpdate:modelValue": changeHandler
4368
+ }, null, 8, ["model-value", "size", "disabled", "default-time"]);
4369
+ };
4370
+ }
4371
+ });
4372
+
4373
+ const useAdd = (props, emit) => {
4374
+ const mForm = inject("mForm");
4375
+ const addable = computed(() => {
4376
+ const modelName = props.name || props.config.name || "";
4377
+ if (!props.model[modelName].length) {
4378
+ return true;
4379
+ }
4380
+ if (typeof props.config.addable === "function") {
4381
+ return props.config.addable(mForm, {
4382
+ model: props.model[modelName],
4383
+ formValue: mForm?.values,
4384
+ prop: props.prop
4385
+ });
4386
+ }
4387
+ return typeof props.config.addable === "undefined" ? true : props.config.addable;
4388
+ });
4389
+ const newHandler = async (row) => {
4390
+ const modelName = props.name || props.config.name || "";
4391
+ if (props.config.max && props.model[modelName].length >= props.config.max) {
4392
+ tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
4393
+ return;
4394
+ }
4395
+ if (typeof props.config.beforeAddRow === "function") {
4396
+ const beforeCheckRes = props.config.beforeAddRow(mForm, {
4397
+ model: props.model[modelName],
4398
+ formValue: mForm?.values,
4399
+ prop: props.prop
4400
+ });
4401
+ if (!beforeCheckRes) return;
4402
+ }
4403
+ const columns = props.config.items;
4404
+ const enumValues = props.config.enum || [];
4405
+ let enumV = [];
4406
+ const { length } = props.model[modelName];
4407
+ const key = props.config.key || "id";
4408
+ let inputs = {};
4409
+ if (enumValues.length) {
4410
+ if (length >= enumValues.length) {
4411
+ return;
4412
+ }
4413
+ enumV = enumValues.filter((item) => {
4414
+ let i = 0;
4415
+ for (; i < length; i++) {
4416
+ if (item[key] === props.model[modelName][i][key]) {
4417
+ break;
4418
+ }
4419
+ }
4420
+ return i === length;
4421
+ });
4422
+ if (enumV.length > 0) {
4423
+ inputs = enumV[0];
4424
+ }
4425
+ } else if (Array.isArray(row)) {
4426
+ columns.forEach((column, index) => {
4427
+ column.name && (inputs[column.name] = row[index]);
4428
+ });
4429
+ } else {
4430
+ if (typeof props.config.defaultAdd === "function") {
4431
+ inputs = await props.config.defaultAdd(mForm, {
4432
+ model: props.model[modelName],
4433
+ formValue: mForm?.values
4434
+ });
4435
+ } else if (props.config.defaultAdd) {
4436
+ inputs = props.config.defaultAdd;
4437
+ }
4438
+ inputs = await initValue(mForm, {
4439
+ config: columns,
4440
+ initValues: inputs
4441
+ });
4442
+ }
4443
+ if (props.sortKey && length) {
4444
+ inputs[props.sortKey] = props.model[modelName][length - 1][props.sortKey] - 1;
4445
+ }
4446
+ emit("change", [...props.model[modelName], inputs], {
4447
+ changeRecords: [
4448
+ {
4449
+ propPath: `${props.prop}.${props.model[modelName].length}`,
4450
+ value: inputs
4451
+ }
4452
+ ]
4453
+ });
4454
+ };
4455
+ return {
4456
+ addable,
4457
+ newHandler
4458
+ };
4459
+ };
4460
+
4461
+ const useFullscreen = () => {
4462
+ const isFullscreen = ref(false);
4463
+ const mTableEl = useTemplateRef("mTable");
4464
+ const { nextZIndex } = useZIndex();
4465
+ const toggleFullscreen = () => {
4466
+ if (!mTableEl.value) return;
4467
+ if (isFullscreen.value) {
4468
+ mTableEl.value.classList.remove("fixed");
4469
+ isFullscreen.value = false;
4470
+ } else {
4471
+ mTableEl.value.classList.add("fixed");
4472
+ mTableEl.value.style.zIndex = `${nextZIndex()}`;
4473
+ isFullscreen.value = true;
4474
+ }
4475
+ };
4476
+ return {
4477
+ isFullscreen,
4478
+ toggleFullscreen
4479
+ };
4480
+ };
4481
+
4482
+ const useImport = (props, emit, newHandler) => {
4483
+ const mForm = inject("mForm");
4484
+ const modelName = computed(() => props.name || props.config.name || "");
4485
+ const importable = computed(() => {
4486
+ if (typeof props.config.importable === "function") {
4487
+ return props.config.importable(mForm, {
4488
+ formValue: mForm?.values,
4489
+ model: props.model[modelName.value]
4490
+ });
4491
+ }
4492
+ return typeof props.config.importable === "undefined" ? false : props.config.importable;
4493
+ });
4494
+ const excelBtn = useTemplateRef("excelBtn");
4495
+ const excelHandler = async (file) => {
4496
+ if (!file?.raw) {
4497
+ return false;
4498
+ }
4499
+ if (!globalThis.XLSX) {
4500
+ await asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
4501
+ }
4502
+ const reader = new FileReader();
4503
+ reader.onload = () => {
4504
+ const data = reader.result;
4505
+ const pdata = globalThis.XLSX.read(data, { type: "array" });
4506
+ pdata.SheetNames.forEach((sheetName) => {
4507
+ const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
4508
+ if (arr?.[0]) {
4509
+ arr.forEach((row) => {
4510
+ newHandler(row);
4511
+ });
4512
+ }
4513
+ setTimeout(() => {
4514
+ excelBtn.value?.clearFiles();
4515
+ }, 300);
4516
+ });
4517
+ };
4518
+ reader.readAsArrayBuffer(file.raw);
4519
+ return false;
4520
+ };
4521
+ const clearHandler = () => {
4522
+ emit("change", []);
4523
+ mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
4524
+ };
4525
+ return {
4526
+ importable,
4527
+ excelHandler,
4528
+ clearHandler
4529
+ };
4530
+ };
4531
+
4532
+ const usePagination = (props, modelName) => {
4533
+ const pageSize = ref(10);
4534
+ const currentPage = ref(0);
4535
+ const paginationData = computed(() => getDataByPage(props.model[modelName.value], currentPage.value, pageSize.value));
4536
+ const handleSizeChange = (val) => {
4537
+ pageSize.value = val;
4538
+ };
4539
+ const handleCurrentChange = (val) => {
4540
+ currentPage.value = val - 1;
4541
+ };
4542
+ return {
4543
+ pageSize,
4544
+ currentPage,
4545
+ paginationData,
4546
+ handleSizeChange,
4547
+ handleCurrentChange
4548
+ };
4549
+ };
4550
+
4551
+ const useSelection = (props, emit, tMagicTableRef) => {
4552
+ const mForm = inject("mForm");
4553
+ const selectHandle = (selection, row) => {
4554
+ if (typeof props.config.selection === "string" && props.config.selection === "single") {
4555
+ tMagicTableRef.value?.clearSelection();
4556
+ tMagicTableRef.value?.toggleRowSelection(row, true);
4557
+ }
4558
+ emit("select", selection, row);
4559
+ if (typeof props.config.onSelect === "function") {
4560
+ props.config.onSelect(mForm, { selection, row, config: props.config });
4561
+ }
4562
+ };
4563
+ const toggleRowSelection = (row, selected) => {
4564
+ tMagicTableRef.value?.toggleRowSelection.call(tMagicTableRef.value?.getTableRef(), row, selected);
4565
+ };
4566
+ return {
4567
+ selectHandle,
4568
+ toggleRowSelection
4569
+ };
4570
+ };
4571
+
4572
+ const useSortable = (props, emit, tMagicTableRef, modelName) => {
4573
+ const mForm = inject("mForm");
4574
+ let sortable;
4575
+ const rowDrop = () => {
4576
+ sortable?.destroy();
4577
+ const tableEl = tMagicTableRef.value?.getEl();
4578
+ const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
4579
+ if (!tBodyEl) {
4580
+ return;
4581
+ }
4582
+ sortable = Sortable.create(tBodyEl, {
4583
+ draggable: ".tmagic-design-table-row",
4584
+ filter: "input",
4585
+ // 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
4586
+ preventOnFilter: false,
4587
+ // 允许选字
4588
+ direction: "vertical",
4589
+ onEnd: ({ newIndex, oldIndex }) => {
4590
+ if (typeof newIndex === "undefined") return;
4591
+ if (typeof oldIndex === "undefined") return;
4592
+ const newData = sortArray(props.model[modelName.value], newIndex, oldIndex, props.sortKey);
4593
+ emit("change", newData);
4594
+ mForm?.$emit("field-change", newData);
4595
+ }
4596
+ });
4597
+ };
4598
+ watchEffect(() => {
4599
+ if (props.config.dropSort) {
4600
+ rowDrop();
4601
+ }
4602
+ });
4603
+ };
4604
+
4834
4605
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4835
- ...{
4836
- name: "MFormTextarea"
4837
- },
4838
- __name: "Textarea",
4606
+ __name: "ActionsColumn",
4839
4607
  props: {
4840
4608
  config: {},
4841
4609
  model: {},
4842
- initValues: {},
4843
- values: {},
4844
4610
  name: {},
4845
- prop: {},
4846
4611
  disabled: { type: Boolean },
4847
- size: {},
4848
- lastValues: {}
4612
+ currentPage: {},
4613
+ pageSize: {},
4614
+ index: {},
4615
+ row: {},
4616
+ prop: {},
4617
+ sortKey: {}
4849
4618
  },
4850
- emits: ["change", "input"],
4619
+ emits: ["change"],
4851
4620
  setup(__props, { emit: __emit }) {
4852
- const props = __props;
4853
4621
  const emit = __emit;
4854
- useAddField(props.prop);
4622
+ const props = __props;
4855
4623
  const mForm = inject("mForm");
4856
- const changeHandler = (value) => {
4857
- emit("change", value);
4624
+ const removeHandler = (index) => {
4625
+ if (props.disabled) return;
4626
+ emit("change", props.model[props.name].toSpliced(index, 1));
4858
4627
  };
4859
- const inputHandler = (v) => {
4860
- emit("input", v);
4861
- mForm?.$emit("field-input", props.prop, v);
4628
+ const copyHandler = (index) => {
4629
+ const inputs = cloneDeep(props.model[props.name][index]);
4630
+ const { length } = props.model[props.name];
4631
+ if (props.sortKey && length) {
4632
+ inputs[props.sortKey] = props.model[props.name][length - 1][props.sortKey] - 1;
4633
+ }
4634
+ emit("change", [...props.model[props.name], inputs], {
4635
+ changeRecords: [
4636
+ {
4637
+ propPath: `${props.prop}.${props.model[props.name].length}`,
4638
+ value: inputs
4639
+ }
4640
+ ]
4641
+ });
4642
+ };
4643
+ const showDelete = (index) => {
4644
+ const deleteFunc = props.config.delete;
4645
+ if (deleteFunc && typeof deleteFunc === "function") {
4646
+ return deleteFunc(props.model[props.name], index, mForm?.values);
4647
+ }
4648
+ return props.config.delete ?? true;
4649
+ };
4650
+ const copyable = (index) => {
4651
+ const copyableFunc = props.config.copyable;
4652
+ if (copyableFunc && typeof copyableFunc === "function") {
4653
+ return copyableFunc(mForm, {
4654
+ values: mForm?.initValues || {},
4655
+ model: props.model,
4656
+ parent: mForm?.parentValues || {},
4657
+ formValue: mForm?.values || props.model,
4658
+ prop: props.prop,
4659
+ config: props.config,
4660
+ index
4661
+ });
4662
+ }
4663
+ return props.config.copyable ?? true;
4862
4664
  };
4863
4665
  return (_ctx, _cache) => {
4864
- return openBlock(), createBlock(unref(TMagicInput), {
4865
- modelValue: __props.model[__props.name],
4866
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
4867
- type: "textarea",
4868
- size: __props.size,
4869
- clearable: "",
4870
- placeholder: __props.config.placeholder,
4871
- disabled: __props.disabled,
4872
- onChange: changeHandler,
4873
- onInput: inputHandler
4874
- }, null, 8, ["modelValue", "size", "placeholder", "disabled"]);
4666
+ return openBlock(), createElementBlock(
4667
+ Fragment,
4668
+ null,
4669
+ [
4670
+ renderSlot(_ctx.$slots, "operateCol", {
4671
+ scope: { $index: __props.index, row: __props.row }
4672
+ }),
4673
+ withDirectives(createVNode(unref(TMagicButton), {
4674
+ size: "small",
4675
+ type: "danger",
4676
+ link: "",
4677
+ title: "删除",
4678
+ icon: unref(Delete),
4679
+ onClick: _cache[0] || (_cache[0] = ($event) => removeHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
4680
+ }, null, 8, ["icon"]), [
4681
+ [vShow, showDelete(__props.index + 1 + __props.currentPage * __props.pageSize - 1)]
4682
+ ]),
4683
+ copyable(__props.index + 1 + __props.currentPage * __props.pageSize - 1) ? (openBlock(), createBlock(unref(TMagicButton), {
4684
+ key: 0,
4685
+ link: "",
4686
+ size: "small",
4687
+ type: "primary",
4688
+ title: "复制",
4689
+ icon: unref(DocumentCopy),
4690
+ disabled: __props.disabled,
4691
+ onClick: _cache[1] || (_cache[1] = ($event) => copyHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
4692
+ }, null, 8, ["icon", "disabled"])) : createCommentVNode("v-if", true)
4693
+ ],
4694
+ 64
4695
+ /* STABLE_FRAGMENT */
4696
+ );
4875
4697
  };
4876
4698
  }
4877
4699
  });
4878
4700
 
4879
4701
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4880
- ...{
4881
- name: "MFormTime"
4882
- },
4883
- __name: "Time",
4702
+ __name: "SortColumn",
4884
4703
  props: {
4885
- config: {},
4886
- model: {},
4887
- initValues: {},
4888
- values: {},
4889
- name: {},
4890
- prop: {},
4704
+ index: {},
4891
4705
  disabled: { type: Boolean },
4892
- size: {},
4893
- lastValues: {}
4706
+ currentPage: {},
4707
+ pageSize: {},
4708
+ name: {},
4709
+ model: {}
4894
4710
  },
4895
- emits: ["change"],
4711
+ emits: ["swap"],
4896
4712
  setup(__props, { emit: __emit }) {
4897
4713
  const props = __props;
4898
4714
  const emit = __emit;
4899
- useAddField(props.prop);
4900
- const changeHandler = (v) => {
4901
- emit("change", v);
4715
+ let timer = null;
4716
+ const upHandler = (index) => {
4717
+ if (timer) {
4718
+ clearTimeout(timer);
4719
+ }
4720
+ timer = setTimeout(() => {
4721
+ emit("swap", index, index - 1);
4722
+ timer = null;
4723
+ }, 300);
4724
+ };
4725
+ const topHandler = (index) => {
4726
+ if (timer) {
4727
+ clearTimeout(timer);
4728
+ }
4729
+ const moveNum = index;
4730
+ for (let i = 0; i < moveNum; i++) {
4731
+ emit("swap", index, index - 1);
4732
+ index -= 1;
4733
+ }
4734
+ };
4735
+ const downHandler = (index) => {
4736
+ if (timer) {
4737
+ clearTimeout(timer);
4738
+ }
4739
+ timer = setTimeout(() => {
4740
+ emit("swap", index, index + 1);
4741
+ timer = null;
4742
+ }, 300);
4743
+ };
4744
+ const bottomHandler = (index) => {
4745
+ if (timer) {
4746
+ clearTimeout(timer);
4747
+ }
4748
+ const moveNum = props.model[props.name].length - 1 - index;
4749
+ for (let i = 0; i < moveNum; i++) {
4750
+ emit("swap", index, index + 1);
4751
+ index += 1;
4752
+ }
4902
4753
  };
4903
4754
  return (_ctx, _cache) => {
4904
- return openBlock(), createBlock(unref(TMagicTimePicker), {
4905
- modelValue: __props.model[__props.name],
4906
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
4907
- "value-format": __props.config.valueFormat || "HH:mm:ss",
4908
- format: __props.config.format || "HH:mm:ss",
4909
- size: __props.size,
4910
- placeholder: __props.config.placeholder,
4911
- disabled: __props.disabled,
4912
- onChange: changeHandler
4913
- }, null, 8, ["modelValue", "value-format", "format", "size", "placeholder", "disabled"]);
4755
+ return openBlock(), createElementBlock(
4756
+ Fragment,
4757
+ null,
4758
+ [
4759
+ __props.index + 1 + __props.currentPage * __props.pageSize - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
4760
+ key: 0,
4761
+ content: "点击上移,双击置顶",
4762
+ placement: "top"
4763
+ }, {
4764
+ default: withCtx(() => [
4765
+ createVNode(unref(TMagicButton), {
4766
+ plain: "",
4767
+ size: "small",
4768
+ type: "primary",
4769
+ icon: unref(ArrowUp),
4770
+ disabled: __props.disabled,
4771
+ link: "",
4772
+ onClick: _cache[0] || (_cache[0] = ($event) => upHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
4773
+ onDblclick: _cache[1] || (_cache[1] = ($event) => topHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
4774
+ }, null, 8, ["icon", "disabled"])
4775
+ ]),
4776
+ _: 1
4777
+ /* STABLE */
4778
+ })) : createCommentVNode("v-if", true),
4779
+ __props.index + 1 + __props.currentPage * __props.pageSize - 1 !== __props.model[__props.name].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
4780
+ key: 1,
4781
+ content: "点击下移,双击置底",
4782
+ placement: "top"
4783
+ }, {
4784
+ default: withCtx(() => [
4785
+ createVNode(unref(TMagicButton), {
4786
+ plain: "",
4787
+ size: "small",
4788
+ type: "primary",
4789
+ icon: unref(ArrowDown),
4790
+ disabled: __props.disabled,
4791
+ link: "",
4792
+ onClick: _cache[2] || (_cache[2] = ($event) => downHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
4793
+ onDblclick: _cache[3] || (_cache[3] = ($event) => bottomHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
4794
+ }, null, 8, ["icon", "disabled"])
4795
+ ]),
4796
+ _: 1
4797
+ /* STABLE */
4798
+ })) : createCommentVNode("v-if", true)
4799
+ ],
4800
+ 64
4801
+ /* STABLE_FRAGMENT */
4802
+ );
4914
4803
  };
4915
4804
  }
4916
4805
  });
4917
4806
 
4807
+ const useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
4808
+ const mForm = inject("mForm");
4809
+ const display$1 = (fuc) => display(mForm, fuc, props);
4810
+ const lastData = computed(
4811
+ () => props.config.pagination ? getDataByPage(props.lastValues[modelName.value], currentPage.value, pageSize.value) : props.lastValues[modelName.value] || []
4812
+ );
4813
+ const itemExtra = (fuc, index) => {
4814
+ if (typeof fuc === "function") {
4815
+ return fuc(mForm, {
4816
+ values: mForm?.initValues,
4817
+ model: props.model,
4818
+ formValue: mForm ? mForm.values : props.model,
4819
+ prop: props.prop,
4820
+ index
4821
+ });
4822
+ }
4823
+ return fuc;
4824
+ };
4825
+ const selection = computed(() => {
4826
+ if (typeof props.config.selection === "function") {
4827
+ return props.config.selection(mForm, { model: props.model[modelName.value] });
4828
+ }
4829
+ return props.config.selection;
4830
+ });
4831
+ const getProp = (index) => {
4832
+ return `${props.prop}${props.prop ? "." : ""}${index + 1 + currentPage.value * pageSize.value - 1}`;
4833
+ };
4834
+ const makeConfig = (config, row) => {
4835
+ const newConfig = cloneDeep(config);
4836
+ if (typeof config.itemsFunction === "function") {
4837
+ newConfig.items = config.itemsFunction(row);
4838
+ }
4839
+ delete newConfig.display;
4840
+ return newConfig;
4841
+ };
4842
+ const changeHandler = (v, eventData) => {
4843
+ emit("change", props.model, eventData);
4844
+ };
4845
+ const onAddDiffCount = () => emit("addDiffCount");
4846
+ const columns = computed(() => {
4847
+ const columns2 = [];
4848
+ if (props.config.itemExtra && !props.config.dropSort) {
4849
+ columns2.push({
4850
+ props: {
4851
+ fixed: "left",
4852
+ width: 30,
4853
+ type: "expand"
4854
+ },
4855
+ cell: ({ $index }) => h("span", {
4856
+ innerHTML: itemExtra(props.config.itemExtra, $index),
4857
+ class: "m-form-tip"
4858
+ })
4859
+ });
4860
+ }
4861
+ columns2.push({
4862
+ props: {
4863
+ label: "操作",
4864
+ fixed: props.config.fixed === false ? void 0 : "left",
4865
+ width: props.config.operateColWidth || 112,
4866
+ align: "center"
4867
+ },
4868
+ cell: ({ row, $index }) => h(_sfc_main$4, {
4869
+ row,
4870
+ index: $index,
4871
+ model: props.model,
4872
+ config: props.config,
4873
+ prop: props.prop,
4874
+ disabled: props.disabled,
4875
+ sortKey: props.sortKey,
4876
+ name: modelName.value,
4877
+ currentPage: currentPage.value,
4878
+ pageSize: pageSize.value,
4879
+ onChange: (v) => {
4880
+ emit("change", v);
4881
+ }
4882
+ })
4883
+ });
4884
+ if (props.sort && props.model[modelName.value] && props.model[modelName.value].length > 1) {
4885
+ columns2.push({
4886
+ props: {
4887
+ label: "排序",
4888
+ width: 80
4889
+ },
4890
+ cell: ({ $index }) => h(_sfc_main$3, {
4891
+ index: $index,
4892
+ model: props.model,
4893
+ disabled: props.disabled,
4894
+ name: modelName.value,
4895
+ currentPage: currentPage.value,
4896
+ pageSize: pageSize.value,
4897
+ onSwap: (index1, index2) => {
4898
+ const newData = sortArray(props.model[modelName.value], index1, index2, props.sortKey);
4899
+ emit("change", newData);
4900
+ mForm?.$emit("field-change", newData);
4901
+ }
4902
+ })
4903
+ });
4904
+ }
4905
+ if (selection.value) {
4906
+ columns2.push({
4907
+ props: {
4908
+ align: "center",
4909
+ headerAlign: "center",
4910
+ type: "selection",
4911
+ width: 45
4912
+ }
4913
+ });
4914
+ }
4915
+ if (props.showIndex && props.config.showIndex) {
4916
+ columns2.push({
4917
+ props: {
4918
+ label: "序号",
4919
+ width: 60
4920
+ },
4921
+ cell: ({ $index }) => h("span", $index + 1 + currentPage.value * pageSize.value)
4922
+ });
4923
+ }
4924
+ for (const column of props.config.items) {
4925
+ if (column.type !== "hidden" && display$1(column.display)) {
4926
+ columns2.push({
4927
+ props: {
4928
+ prop: column.name,
4929
+ label: column.label,
4930
+ width: column.width,
4931
+ sortable: column.sortable,
4932
+ sortOrders: ["ascending", "descending"],
4933
+ class: props.config.dropSort === true ? "el-table__column--dropable" : ""
4934
+ },
4935
+ cell: ({ row, $index }) => h(_sfc_main$A, {
4936
+ labelWidth: "0",
4937
+ disabled: props.disabled,
4938
+ prop: getProp($index),
4939
+ rules: column.rules,
4940
+ config: makeConfig(column, row),
4941
+ model: row,
4942
+ lastValues: lastData.value[$index],
4943
+ isCompare: props.isCompare,
4944
+ size: props.size,
4945
+ onChange: changeHandler,
4946
+ onAddDiffCount
4947
+ })
4948
+ });
4949
+ }
4950
+ }
4951
+ return columns2;
4952
+ });
4953
+ return {
4954
+ columns
4955
+ };
4956
+ };
4957
+
4958
+ const _hoisted_1$1 = { class: "m-fields-table-wrap" };
4959
+ const _hoisted_2 = ["innerHTML"];
4960
+ const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
4961
+ const _hoisted_4 = { style: { "display": "flex" } };
4962
+ const _hoisted_5 = {
4963
+ key: 1,
4964
+ class: "bottom",
4965
+ style: { "text-align": "right" }
4966
+ };
4918
4967
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4919
4968
  ...{
4920
- name: "MFormTimeRange"
4969
+ name: "MFormTable"
4921
4970
  },
4922
- __name: "Timerange",
4971
+ __name: "Table",
4923
4972
  props: {
4924
- config: {},
4925
4973
  model: {},
4926
- initValues: {},
4927
- values: {},
4974
+ lastValues: { default: () => ({}) },
4975
+ isCompare: { type: Boolean, default: false },
4976
+ config: {},
4928
4977
  name: {},
4929
- prop: {},
4978
+ prop: { default: "" },
4979
+ labelWidth: {},
4980
+ sort: { type: Boolean },
4930
4981
  disabled: { type: Boolean },
4982
+ sortKey: { default: "" },
4983
+ text: {},
4931
4984
  size: {},
4932
- lastValues: {}
4985
+ enableToggleMode: { type: Boolean, default: true },
4986
+ showIndex: { type: Boolean, default: true }
4933
4987
  },
4934
- emits: ["change"],
4935
- setup(__props, { emit: __emit }) {
4988
+ emits: ["change", "select", "addDiffCount"],
4989
+ setup(__props, { expose: __expose, emit: __emit }) {
4936
4990
  const props = __props;
4937
4991
  const emit = __emit;
4938
- useAddField(props.prop);
4939
- const { names } = props.config;
4940
- const value = ref([]);
4941
- if (props.model !== void 0 && names?.length) {
4942
- watch(
4943
- [() => props.model[names[0]], () => props.model[names[1]]],
4944
- ([start, end], [preStart, preEnd]) => {
4945
- if (!value.value) {
4946
- value.value = [];
4947
- }
4948
- if (!start || !end) value.value = [];
4949
- if (start !== preStart) value.value[0] = start;
4950
- if (end !== preEnd) value.value[1] = end;
4951
- },
4952
- {
4953
- immediate: true
4954
- }
4955
- );
4956
- }
4957
- const setValue = (v) => {
4958
- names?.forEach((item, index) => {
4959
- if (!props.model) {
4960
- return;
4961
- }
4962
- if (Array.isArray(v)) {
4963
- props.model[item] = v[index];
4964
- } else {
4965
- props.model[item] = void 0;
4966
- }
4992
+ const modelName = computed(() => props.name || props.config.name || "");
4993
+ const tMagicTableRef = useTemplateRef("tMagicTable");
4994
+ const { pageSize, currentPage, paginationData, handleSizeChange, handleCurrentChange } = usePagination(
4995
+ props,
4996
+ modelName
4997
+ );
4998
+ const { addable, newHandler } = useAdd(props, emit);
4999
+ const { columns } = useTableColumns(props, emit, currentPage, pageSize, modelName);
5000
+ useSortable(props, emit, tMagicTableRef, modelName);
5001
+ const { isFullscreen, toggleFullscreen } = useFullscreen();
5002
+ const { importable, excelHandler, clearHandler } = useImport(props, emit, newHandler);
5003
+ const { selectHandle, toggleRowSelection } = useSelection(props, emit, tMagicTableRef);
5004
+ const updateKey = ref(1);
5005
+ const data = computed(() => props.config.pagination ? paginationData.value : props.model[modelName.value]);
5006
+ const toggleMode = () => {
5007
+ const calcLabelWidth = (label) => {
5008
+ if (!label) return "0px";
5009
+ const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
5010
+ const chLength = label.length - zhLength;
5011
+ return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
5012
+ };
5013
+ props.config.type = "groupList";
5014
+ props.config.enableToggleMode = true;
5015
+ props.config.tableItems = props.config.items;
5016
+ props.config.items = props.config.groupItems || props.config.items.map((item) => {
5017
+ const text = item.text || item.label;
5018
+ const labelWidth = calcLabelWidth(text);
5019
+ return {
5020
+ ...item,
5021
+ text,
5022
+ labelWidth,
5023
+ span: item.span || 12
5024
+ };
4967
5025
  });
4968
5026
  };
4969
- const changeHandler = (v) => {
4970
- const value2 = v || [];
4971
- if (names?.length) {
4972
- setValue(value2);
4973
- }
4974
- emit("change", value2);
5027
+ const sortChangeHandler = (sortOptions) => {
5028
+ const modelName2 = props.name || props.config.name || "";
5029
+ sortChange(props.model[modelName2], sortOptions);
4975
5030
  };
5031
+ __expose({
5032
+ toggleRowSelection
5033
+ });
4976
5034
  return (_ctx, _cache) => {
4977
- return openBlock(), createBlock(unref(TMagicTimePicker), {
4978
- modelValue: value.value,
4979
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
4980
- "is-range": "",
4981
- "range-separator": "-",
4982
- "start-placeholder": "开始时间",
4983
- "end-placeholder": "结束时间",
4984
- size: __props.size,
4985
- "unlink-panels": true,
4986
- disabled: __props.disabled,
4987
- "default-time": __props.config.defaultTime,
4988
- onChange: changeHandler
4989
- }, null, 8, ["modelValue", "size", "disabled", "default-time"]);
5035
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
5036
+ (openBlock(), createBlock(Teleport, {
5037
+ to: "body",
5038
+ disabled: !unref(isFullscreen)
5039
+ }, [
5040
+ createElementVNode(
5041
+ "div",
5042
+ {
5043
+ ref: "mTable",
5044
+ class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
5045
+ },
5046
+ [
5047
+ __props.config.extra ? (openBlock(), createElementBlock("span", {
5048
+ key: 0,
5049
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
5050
+ innerHTML: __props.config.extra
5051
+ }, null, 8, _hoisted_2)) : createCommentVNode("v-if", true),
5052
+ createVNode(unref(TMagicTooltip), {
5053
+ content: "拖拽可排序",
5054
+ placement: "left-start",
5055
+ disabled: __props.config.dropSort !== true
5056
+ }, {
5057
+ default: withCtx(() => [
5058
+ __props.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
5059
+ ref: "tMagicTable",
5060
+ style: { "width": "100%" },
5061
+ "show-header": "",
5062
+ "row-key": __props.config.rowKey || "id",
5063
+ columns: unref(columns),
5064
+ data: data.value,
5065
+ border: __props.config.border,
5066
+ "max-height": __props.config.maxHeight,
5067
+ "default-expand-all": true,
5068
+ key: updateKey.value,
5069
+ onSelect: unref(selectHandle),
5070
+ onSortChange: sortChangeHandler
5071
+ }, null, 8, ["row-key", "columns", "data", "border", "max-height", "onSelect"])) : createCommentVNode("v-if", true)
5072
+ ]),
5073
+ _: 1
5074
+ /* STABLE */
5075
+ }, 8, ["disabled"]),
5076
+ renderSlot(_ctx.$slots, "default"),
5077
+ createElementVNode("div", _hoisted_3, [
5078
+ unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
5079
+ key: 0,
5080
+ size: "small",
5081
+ type: "primary",
5082
+ disabled: __props.disabled,
5083
+ plain: "",
5084
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
5085
+ }, {
5086
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
5087
+ createTextVNode(
5088
+ "新增一行",
5089
+ -1
5090
+ /* CACHED */
5091
+ )
5092
+ ])]),
5093
+ _: 1
5094
+ /* STABLE */
5095
+ }, 8, ["disabled"])) : createCommentVNode("v-if", true),
5096
+ createElementVNode("div", _hoisted_4, [
5097
+ __props.enableToggleMode && __props.config.enableToggleMode !== false && !unref(isFullscreen) ? (openBlock(), createBlock(unref(TMagicButton), {
5098
+ key: 0,
5099
+ icon: unref(Grid),
5100
+ size: "small",
5101
+ type: "primary",
5102
+ onClick: toggleMode
5103
+ }, {
5104
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
5105
+ createTextVNode(
5106
+ "展开配置",
5107
+ -1
5108
+ /* CACHED */
5109
+ )
5110
+ ])]),
5111
+ _: 1
5112
+ /* STABLE */
5113
+ }, 8, ["icon"])) : createCommentVNode("v-if", true),
5114
+ __props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
5115
+ key: 1,
5116
+ icon: unref(FullScreen),
5117
+ size: "small",
5118
+ type: "primary",
5119
+ onClick: unref(toggleFullscreen)
5120
+ }, {
5121
+ default: withCtx(() => [
5122
+ createTextVNode(
5123
+ toDisplayString(unref(isFullscreen) ? "退出全屏" : "全屏编辑"),
5124
+ 1
5125
+ /* TEXT */
5126
+ )
5127
+ ]),
5128
+ _: 1
5129
+ /* STABLE */
5130
+ }, 8, ["icon", "onClick"])) : createCommentVNode("v-if", true),
5131
+ unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
5132
+ key: 2,
5133
+ style: { "display": "inline-block" },
5134
+ ref: "excelBtn",
5135
+ action: "/noop",
5136
+ disabled: __props.disabled,
5137
+ "on-change": unref(excelHandler),
5138
+ "auto-upload": false
5139
+ }, {
5140
+ default: withCtx(() => [
5141
+ createVNode(unref(TMagicButton), {
5142
+ size: "small",
5143
+ type: "success",
5144
+ disabled: __props.disabled,
5145
+ plain: ""
5146
+ }, {
5147
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
5148
+ createTextVNode(
5149
+ "导入EXCEL",
5150
+ -1
5151
+ /* CACHED */
5152
+ )
5153
+ ])]),
5154
+ _: 1
5155
+ /* STABLE */
5156
+ }, 8, ["disabled"])
5157
+ ]),
5158
+ _: 1
5159
+ /* STABLE */
5160
+ }, 8, ["disabled", "on-change"])) : createCommentVNode("v-if", true),
5161
+ unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
5162
+ key: 3,
5163
+ size: "small",
5164
+ type: "warning",
5165
+ disabled: __props.disabled,
5166
+ plain: "",
5167
+ onClick: unref(clearHandler)
5168
+ }, {
5169
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
5170
+ createTextVNode(
5171
+ "清空",
5172
+ -1
5173
+ /* CACHED */
5174
+ )
5175
+ ])]),
5176
+ _: 1
5177
+ /* STABLE */
5178
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("v-if", true)
5179
+ ])
5180
+ ]),
5181
+ __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
5182
+ createVNode(unref(TMagicPagination), {
5183
+ layout: "total, sizes, prev, pager, next, jumper",
5184
+ "hide-on-single-page": __props.model[modelName.value].length < unref(pageSize),
5185
+ "current-page": unref(currentPage) + 1,
5186
+ "page-sizes": [unref(pageSize), 60, 120, 300],
5187
+ "page-size": unref(pageSize),
5188
+ total: __props.model[modelName.value].length,
5189
+ onSizeChange: unref(handleSizeChange),
5190
+ onCurrentChange: unref(handleCurrentChange)
5191
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
5192
+ ])) : createCommentVNode("v-if", true)
5193
+ ],
5194
+ 2
5195
+ /* CLASS */
5196
+ )
5197
+ ], 8, ["disabled"]))
5198
+ ]);
4990
5199
  };
4991
5200
  }
4992
5201
  });
@@ -5153,7 +5362,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5153
5362
  class: "m-drawer-body"
5154
5363
  },
5155
5364
  [
5156
- createVNode(_sfc_main$d, {
5365
+ createVNode(_sfc_main$g, {
5157
5366
  ref_key: "form",
5158
5367
  ref: form,
5159
5368
  size: __props.size,
@@ -5261,7 +5470,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5261
5470
  [
5262
5471
  createVNode(unref(TMagicScrollbar), null, {
5263
5472
  default: withCtx(() => [
5264
- createVNode(_sfc_main$d, {
5473
+ createVNode(_sfc_main$g, {
5265
5474
  ref_key: "form",
5266
5475
  ref: form,
5267
5476
  size: __props.size,
@@ -5334,38 +5543,39 @@ const index = {
5334
5543
  const option = Object.assign(defaultInstallOpt, opt);
5335
5544
  app.config.globalProperties.$MAGIC_FORM = option;
5336
5545
  setConfig(option);
5337
- app.component("m-form", _sfc_main$d);
5338
- app.component("m-form-dialog", _sfc_main$c);
5339
- app.component("m-form-container", _sfc_main$x);
5340
- app.component("m-form-fieldset", _sfc_main$w);
5341
- app.component("m-form-group-list", _sfc_main$u);
5342
- app.component("m-form-panel", _sfc_main$t);
5343
- app.component("m-form-row", _sfc_main$r);
5344
- app.component("m-form-step", _sfc_main$q);
5345
- app.component("m-form-table", _sfc_main$p);
5346
- app.component("m-form-tab", _sfc_main$o);
5347
- app.component("m-fields-text", _sfc_main$5);
5348
- app.component("m-fields-img-upload", _sfc_main$5);
5349
- app.component("m-fields-number", _sfc_main$a);
5350
- app.component("m-fields-number-range", _sfc_main$9);
5351
- app.component("m-fields-textarea", _sfc_main$4);
5352
- app.component("m-fields-hidden", _sfc_main$e);
5353
- app.component("m-fields-date", _sfc_main$j);
5354
- app.component("m-fields-datetime", _sfc_main$h);
5355
- app.component("m-fields-daterange", _sfc_main$i);
5356
- app.component("m-fields-timerange", _sfc_main$2);
5357
- app.component("m-fields-time", _sfc_main$3);
5358
- app.component("m-fields-checkbox", _sfc_main$m);
5359
- app.component("m-fields-switch", _sfc_main$6);
5360
- app.component("m-fields-color-picker", _sfc_main$k);
5361
- app.component("m-fields-checkbox-group", _sfc_main$l);
5362
- app.component("m-fields-radio-group", _sfc_main$8);
5363
- app.component("m-fields-display", _sfc_main$g);
5364
- app.component("m-fields-link", _sfc_main$b);
5365
- app.component("m-fields-select", _sfc_main$7);
5366
- app.component("m-fields-cascader", _sfc_main$n);
5367
- app.component("m-fields-dynamic-field", _sfc_main$f);
5546
+ app.component("m-form", _sfc_main$g);
5547
+ app.component("m-form-dialog", _sfc_main$f);
5548
+ app.component("m-form-container", _sfc_main$A);
5549
+ app.component("m-form-fieldset", _sfc_main$z);
5550
+ app.component("m-form-group-list", _sfc_main$w);
5551
+ app.component("m-form-panel", _sfc_main$v);
5552
+ app.component("m-form-row", _sfc_main$t);
5553
+ app.component("m-form-step", _sfc_main$s);
5554
+ app.component("m-form-table", _sfc_main$2);
5555
+ app.component("m-form-tab", _sfc_main$r);
5556
+ app.component("m-form-flex-layout", _sfc_main$y);
5557
+ app.component("m-fields-text", _sfc_main$8);
5558
+ app.component("m-fields-img-upload", _sfc_main$8);
5559
+ app.component("m-fields-number", _sfc_main$d);
5560
+ app.component("m-fields-number-range", _sfc_main$c);
5561
+ app.component("m-fields-textarea", _sfc_main$7);
5562
+ app.component("m-fields-hidden", _sfc_main$h);
5563
+ app.component("m-fields-date", _sfc_main$m);
5564
+ app.component("m-fields-datetime", _sfc_main$k);
5565
+ app.component("m-fields-daterange", _sfc_main$l);
5566
+ app.component("m-fields-timerange", _sfc_main$5);
5567
+ app.component("m-fields-time", _sfc_main$6);
5568
+ app.component("m-fields-checkbox", _sfc_main$p);
5569
+ app.component("m-fields-switch", _sfc_main$9);
5570
+ app.component("m-fields-color-picker", _sfc_main$n);
5571
+ app.component("m-fields-checkbox-group", _sfc_main$o);
5572
+ app.component("m-fields-radio-group", _sfc_main$b);
5573
+ app.component("m-fields-display", _sfc_main$j);
5574
+ app.component("m-fields-link", _sfc_main$e);
5575
+ app.component("m-fields-select", _sfc_main$a);
5576
+ app.component("m-fields-cascader", _sfc_main$q);
5577
+ app.component("m-fields-dynamic-field", _sfc_main$i);
5368
5578
  }
5369
5579
  };
5370
5580
 
5371
- 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 as MFormBox, _sfc_main$c as MFormDialog, _sfc_main$1 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$7 as MSelect, _sfc_main$6 as MSwitch, _sfc_main$p as MTable, _sfc_main$o as MTabs, _sfc_main$5 as MText, _sfc_main$4 as MTextarea, _sfc_main$3 as MTime, _sfc_main$2 as MTimerange, createForm, createValues, datetimeFormatter, index as default, display, filterFunction, getRules, initValue, useAddField };
5581
+ export { _sfc_main$q as MCascader, _sfc_main$p as MCheckbox, _sfc_main$o as MCheckboxGroup, _sfc_main$n as MColorPicker, _sfc_main$A as MContainer, _sfc_main$m as MDate, _sfc_main$k as MDateTime, _sfc_main$l as MDaterange, _sfc_main$j as MDisplay, _sfc_main$i as MDynamicField, _sfc_main$z as MFieldset, _sfc_main$y as MFlexLayout, _sfc_main$g as MForm, _sfc_main as MFormBox, _sfc_main$f as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$h as MHidden, _sfc_main$e as MLink, _sfc_main$d as MNumber, _sfc_main$c as MNumberRange, _sfc_main$v as MPanel, _sfc_main$b as MRadioGroup, _sfc_main$t as MRow, _sfc_main$a as MSelect, _sfc_main$9 as MSwitch, _sfc_main$2 as MTable, _sfc_main$r as MTabs, _sfc_main$8 as MText, _sfc_main$7 as MTextarea, _sfc_main$6 as MTime, _sfc_main$5 as MTimerange, createForm, createValues, datetimeFormatter, index as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };