knt-shared 1.4.4 → 1.4.5

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 (51) hide show
  1. package/dist/components/Form/BasicForm.vue.d.ts +14 -0
  2. package/dist/components/Form/BasicForm.vue.d.ts.map +1 -1
  3. package/dist/components/Form/types.d.ts +15 -0
  4. package/dist/components/Form/types.d.ts.map +1 -1
  5. package/dist/components/ReadonlyField/BasicReadonlyField.vue.d.ts +31 -0
  6. package/dist/components/ReadonlyField/BasicReadonlyField.vue.d.ts.map +1 -0
  7. package/dist/components/ReadonlyField/index.d.ts +10 -0
  8. package/dist/components/ReadonlyField/index.d.ts.map +1 -0
  9. package/dist/components/ReadonlyField/renderers.d.ts +84 -0
  10. package/dist/components/ReadonlyField/renderers.d.ts.map +1 -0
  11. package/dist/components/ReadonlyField/types.d.ts +127 -0
  12. package/dist/components/ReadonlyField/types.d.ts.map +1 -0
  13. package/dist/components/ReadonlyField/useReadonlyField.d.ts +28 -0
  14. package/dist/components/ReadonlyField/useReadonlyField.d.ts.map +1 -0
  15. package/dist/components/ReadonlyField/utils.d.ts +91 -0
  16. package/dist/components/ReadonlyField/utils.d.ts.map +1 -0
  17. package/dist/components/Table/BasicTable.vue.d.ts +7 -0
  18. package/dist/components/Table/BasicTable.vue.d.ts.map +1 -1
  19. package/dist/components/Table/components/EditCell.vue.d.ts +9 -0
  20. package/dist/components/Table/components/EditCell.vue.d.ts.map +1 -1
  21. package/dist/components/Table/components/hooks/formatters.d.ts +62 -0
  22. package/dist/components/Table/components/hooks/formatters.d.ts.map +1 -0
  23. package/dist/components/Table/components/hooks/index.d.ts +11 -0
  24. package/dist/components/Table/components/hooks/index.d.ts.map +1 -0
  25. package/dist/components/Table/components/hooks/useComponentProps.d.ts +51 -0
  26. package/dist/components/Table/components/hooks/useComponentProps.d.ts.map +1 -0
  27. package/dist/components/Table/components/hooks/useEditCellValue.d.ts +46 -0
  28. package/dist/components/Table/components/hooks/useEditCellValue.d.ts.map +1 -0
  29. package/dist/components/Table/components/hooks/useEditFormat.d.ts +42 -0
  30. package/dist/components/Table/components/hooks/useEditFormat.d.ts.map +1 -0
  31. package/dist/components/Table/components/hooks/useEditHistory.d.ts +60 -0
  32. package/dist/components/Table/components/hooks/useEditHistory.d.ts.map +1 -0
  33. package/dist/components/Table/components/hooks/useTrim.d.ts +42 -0
  34. package/dist/components/Table/components/hooks/useTrim.d.ts.map +1 -0
  35. package/dist/components/Table/components/utils.d.ts +20 -0
  36. package/dist/components/Table/components/utils.d.ts.map +1 -0
  37. package/dist/components/Table/hooks/useEditValidation.d.ts.map +1 -1
  38. package/dist/components/Table/types.d.ts +66 -1
  39. package/dist/components/Table/types.d.ts.map +1 -1
  40. package/dist/components/index.d.ts +1 -0
  41. package/dist/components/index.d.ts.map +1 -1
  42. package/dist/index.cjs.js +1455 -84
  43. package/dist/index.cjs.js.map +1 -1
  44. package/dist/index.esm.js +1457 -86
  45. package/dist/index.esm.js.map +1 -1
  46. package/dist/style.css +131 -11
  47. package/dist/utils/diff.d.ts +263 -0
  48. package/dist/utils/diff.d.ts.map +1 -0
  49. package/dist/utils/index.d.ts +1 -0
  50. package/dist/utils/index.d.ts.map +1 -1
  51. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, resolveComponent, createCommentVNode, createVNode, createBlock, unref, reactive, Fragment, renderList, withModifiers, ref, watch, onMounted, onUnmounted, withDirectives, vModelText, vShow, toDisplayString, withCtx, createTextVNode, useCssVars, nextTick, mergeProps, createSlots, renderSlot, onBeforeUnmount, normalizeProps, guardReactiveProps, resolveDynamicComponent, useSlots, h } from "vue";
2
- import { Message, Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input } from "@arco-design/web-vue";
1
+ import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, resolveComponent, createCommentVNode, createVNode, createBlock, unref, reactive, Fragment, renderList, withModifiers, ref, watch, onMounted, onUnmounted, withDirectives, vModelText, vShow, toDisplayString, withCtx, createTextVNode, useCssVars, nextTick, mergeProps, createSlots, renderSlot, h, resolveDynamicComponent, onBeforeUnmount, normalizeProps, guardReactiveProps, useSlots } from "vue";
2
+ import { Message, Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input, ImagePreviewGroup, Image } from "@arco-design/web-vue";
3
3
  const configProviderInjectionKey = Symbol("ArcoConfigProvider");
4
4
  const CLASS_PREFIX = "arco";
5
5
  const GLOBAL_CONFIG_NAME = "$arco";
@@ -22,7 +22,7 @@ var _export_sfc$1 = (sfc, props) => {
22
22
  }
23
23
  return sfc;
24
24
  };
25
- const _sfc_main$p = defineComponent({
25
+ const _sfc_main$q = defineComponent({
26
26
  name: "IconExclamationCircle",
27
27
  props: {
28
28
  size: {
@@ -92,7 +92,7 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
92
92
  createElementVNode("path", { d: "M24 28V14m0 16v4M6 24c0-9.941 8.059-18 18-18s18 8.059 18 18-8.059 18-18 18S6 33.941 6 24Z" }, null, -1)
93
93
  ]), 14, _hoisted_1$o);
94
94
  }
95
- var _IconExclamationCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$e]]);
95
+ var _IconExclamationCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$e]]);
96
96
  const IconExclamationCircle = Object.assign(_IconExclamationCircle, {
97
97
  install: (app, options) => {
98
98
  var _a;
@@ -100,7 +100,7 @@ const IconExclamationCircle = Object.assign(_IconExclamationCircle, {
100
100
  app.component(iconPrefix + _IconExclamationCircle.name, _IconExclamationCircle);
101
101
  }
102
102
  });
103
- const _sfc_main$o = defineComponent({
103
+ const _sfc_main$p = defineComponent({
104
104
  name: "IconPlus",
105
105
  props: {
106
106
  size: {
@@ -170,7 +170,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
170
170
  createElementVNode("path", { d: "M5 24h38M24 5v38" }, null, -1)
171
171
  ]), 14, _hoisted_1$n);
172
172
  }
173
- var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$d]]);
173
+ var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$d]]);
174
174
  const IconPlus = Object.assign(_IconPlus, {
175
175
  install: (app, options) => {
176
176
  var _a;
@@ -178,7 +178,7 @@ const IconPlus = Object.assign(_IconPlus, {
178
178
  app.component(iconPrefix + _IconPlus.name, _IconPlus);
179
179
  }
180
180
  });
181
- const _sfc_main$n = defineComponent({
181
+ const _sfc_main$o = defineComponent({
182
182
  name: "IconQuestionCircle",
183
183
  props: {
184
184
  size: {
@@ -249,7 +249,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
249
249
  createElementVNode("path", { d: "M24.006 31v4.008m0-6.008L24 28c0-3 3-4 4.78-6.402C30.558 19.195 28.288 15 23.987 15c-4.014 0-5.382 2.548-5.388 4.514v.465" }, null, -1)
250
250
  ]), 14, _hoisted_1$m);
251
251
  }
252
- var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$c]]);
252
+ var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$c]]);
253
253
  const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
254
254
  install: (app, options) => {
255
255
  var _a;
@@ -257,7 +257,7 @@ const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
257
257
  app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
258
258
  }
259
259
  });
260
- const _sfc_main$m = defineComponent({
260
+ const _sfc_main$n = defineComponent({
261
261
  name: "IconEye",
262
262
  props: {
263
263
  size: {
@@ -331,7 +331,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
331
331
  createElementVNode("path", { d: "M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z" }, null, -1)
332
332
  ]), 14, _hoisted_1$l);
333
333
  }
334
- var _IconEye = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$b]]);
334
+ var _IconEye = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$b]]);
335
335
  const IconEye = Object.assign(_IconEye, {
336
336
  install: (app, options) => {
337
337
  var _a;
@@ -339,7 +339,7 @@ const IconEye = Object.assign(_IconEye, {
339
339
  app.component(iconPrefix + _IconEye.name, _IconEye);
340
340
  }
341
341
  });
342
- const _sfc_main$l = defineComponent({
342
+ const _sfc_main$m = defineComponent({
343
343
  name: "IconRefresh",
344
344
  props: {
345
345
  size: {
@@ -409,7 +409,7 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
409
409
  createElementVNode("path", { d: "M38.837 18C36.463 12.136 30.715 8 24 8 15.163 8 8 15.163 8 24s7.163 16 16 16c7.455 0 13.72-5.1 15.496-12M40 8v10H30" }, null, -1)
410
410
  ]), 14, _hoisted_1$k);
411
411
  }
412
- var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$a]]);
412
+ var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$a]]);
413
413
  const IconRefresh = Object.assign(_IconRefresh, {
414
414
  install: (app, options) => {
415
415
  var _a;
@@ -417,7 +417,7 @@ const IconRefresh = Object.assign(_IconRefresh, {
417
417
  app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
418
418
  }
419
419
  });
420
- const _sfc_main$k = defineComponent({
420
+ const _sfc_main$l = defineComponent({
421
421
  name: "IconSettings",
422
422
  props: {
423
423
  size: {
@@ -488,7 +488,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
488
488
  createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
489
489
  ]), 14, _hoisted_1$j);
490
490
  }
491
- var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$9]]);
491
+ var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$9]]);
492
492
  const IconSettings = Object.assign(_IconSettings, {
493
493
  install: (app, options) => {
494
494
  var _a;
@@ -496,7 +496,7 @@ const IconSettings = Object.assign(_IconSettings, {
496
496
  app.component(iconPrefix + _IconSettings.name, _IconSettings);
497
497
  }
498
498
  });
499
- const _sfc_main$j = defineComponent({
499
+ const _sfc_main$k = defineComponent({
500
500
  name: "IconUpload",
501
501
  props: {
502
502
  size: {
@@ -566,7 +566,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
566
566
  createElementVNode("path", { d: "M14.93 17.071 24.001 8l9.071 9.071m-9.07 16.071v-25M40 35v6H8v-6" }, null, -1)
567
567
  ]), 14, _hoisted_1$i);
568
568
  }
569
- var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["render", _sfc_render$8]]);
569
+ var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$8]]);
570
570
  const IconUpload = Object.assign(_IconUpload, {
571
571
  install: (app, options) => {
572
572
  var _a;
@@ -574,7 +574,7 @@ const IconUpload = Object.assign(_IconUpload, {
574
574
  app.component(iconPrefix + _IconUpload.name, _IconUpload);
575
575
  }
576
576
  });
577
- const _sfc_main$i = defineComponent({
577
+ const _sfc_main$j = defineComponent({
578
578
  name: "IconDelete",
579
579
  props: {
580
580
  size: {
@@ -644,7 +644,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
644
644
  createElementVNode("path", { d: "M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15" }, null, -1)
645
645
  ]), 14, _hoisted_1$h);
646
646
  }
647
- var _IconDelete = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$7]]);
647
+ var _IconDelete = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["render", _sfc_render$7]]);
648
648
  const IconDelete = Object.assign(_IconDelete, {
649
649
  install: (app, options) => {
650
650
  var _a;
@@ -652,7 +652,7 @@ const IconDelete = Object.assign(_IconDelete, {
652
652
  app.component(iconPrefix + _IconDelete.name, _IconDelete);
653
653
  }
654
654
  });
655
- const _sfc_main$h = defineComponent({
655
+ const _sfc_main$i = defineComponent({
656
656
  name: "IconLineHeight",
657
657
  props: {
658
658
  size: {
@@ -728,7 +728,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
728
728
  createElementVNode("path", { d: "M39 13h2l-2-3.5-2 3.5h2Zm0 0v22m0 0h2l-2 3.5-2-3.5h2Z" }, null, -1)
729
729
  ]), 14, _hoisted_1$g);
730
730
  }
731
- var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$6]]);
731
+ var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$6]]);
732
732
  const IconLineHeight = Object.assign(_IconLineHeight, {
733
733
  install: (app, options) => {
734
734
  var _a;
@@ -736,7 +736,7 @@ const IconLineHeight = Object.assign(_IconLineHeight, {
736
736
  app.component(iconPrefix + _IconLineHeight.name, _IconLineHeight);
737
737
  }
738
738
  });
739
- const _sfc_main$g = defineComponent({
739
+ const _sfc_main$h = defineComponent({
740
740
  name: "IconFullscreenExit",
741
741
  props: {
742
742
  size: {
@@ -806,7 +806,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
806
806
  createElementVNode("path", { d: "M35 6v8a1 1 0 0 0 1 1h8M13 6v8a1 1 0 0 1-1 1H4m31 27v-8a1 1 0 0 1 1-1h8m-31 9v-8a1 1 0 0 0-1-1H4" }, null, -1)
807
807
  ]), 14, _hoisted_1$f);
808
808
  }
809
- var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$5]]);
809
+ var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$5]]);
810
810
  const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
811
811
  install: (app, options) => {
812
812
  var _a;
@@ -814,7 +814,7 @@ const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
814
814
  app.component(iconPrefix + _IconFullscreenExit.name, _IconFullscreenExit);
815
815
  }
816
816
  });
817
- const _sfc_main$f = defineComponent({
817
+ const _sfc_main$g = defineComponent({
818
818
  name: "IconFullscreen",
819
819
  props: {
820
820
  size: {
@@ -884,7 +884,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
884
884
  createElementVNode("path", { d: "M42 17V9a1 1 0 0 0-1-1h-8M6 17V9a1 1 0 0 1 1-1h8m27 23v8a1 1 0 0 1-1 1h-8M6 31v8a1 1 0 0 0 1 1h8" }, null, -1)
885
885
  ]), 14, _hoisted_1$e);
886
886
  }
887
- var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$4]]);
887
+ var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$4]]);
888
888
  const IconFullscreen = Object.assign(_IconFullscreen, {
889
889
  install: (app, options) => {
890
890
  var _a;
@@ -892,7 +892,7 @@ const IconFullscreen = Object.assign(_IconFullscreen, {
892
892
  app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
893
893
  }
894
894
  });
895
- const _sfc_main$e = defineComponent({
895
+ const _sfc_main$f = defineComponent({
896
896
  name: "IconMute",
897
897
  props: {
898
898
  size: {
@@ -962,7 +962,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
962
962
  createElementVNode("path", { d: "m19 11.5 4.833-4.35a.1.1 0 0 1 .167.075V17m-14-1H7.1a.1.1 0 0 0-.1.1v15.8a.1.1 0 0 0 .1.1H14l9.833 8.85a.1.1 0 0 0 .167-.075V31m6.071-14.071C32.535 19.393 34 23 32.799 26m2.929-14.728C41.508 17.052 42.5 25 39.123 32M6.5 6.5l35 35" }, null, -1)
963
963
  ]), 14, _hoisted_1$d);
964
964
  }
965
- var _IconMute = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$3]]);
965
+ var _IconMute = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$3]]);
966
966
  const IconMute = Object.assign(_IconMute, {
967
967
  install: (app, options) => {
968
968
  var _a;
@@ -970,7 +970,7 @@ const IconMute = Object.assign(_IconMute, {
970
970
  app.component(iconPrefix + _IconMute.name, _IconMute);
971
971
  }
972
972
  });
973
- const _sfc_main$d = defineComponent({
973
+ const _sfc_main$e = defineComponent({
974
974
  name: "IconPause",
975
975
  props: {
976
976
  size: {
@@ -1045,7 +1045,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1045
1045
  }, null, -1)
1046
1046
  ]), 14, _hoisted_1$c);
1047
1047
  }
1048
- var _IconPause = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$2]]);
1048
+ var _IconPause = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$2]]);
1049
1049
  const IconPause = Object.assign(_IconPause, {
1050
1050
  install: (app, options) => {
1051
1051
  var _a;
@@ -1053,7 +1053,7 @@ const IconPause = Object.assign(_IconPause, {
1053
1053
  app.component(iconPrefix + _IconPause.name, _IconPause);
1054
1054
  }
1055
1055
  });
1056
- const _sfc_main$c = defineComponent({
1056
+ const _sfc_main$d = defineComponent({
1057
1057
  name: "IconPlayArrow",
1058
1058
  props: {
1059
1059
  size: {
@@ -1123,7 +1123,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1123
1123
  createElementVNode("path", { d: "M12.533 7.965A1 1 0 0 0 11 8.81v30.377a1 1 0 0 0 1.533.846L36.656 24.84a1 1 0 0 0 0-1.692L12.533 7.965Z" }, null, -1)
1124
1124
  ]), 14, _hoisted_1$b);
1125
1125
  }
1126
- var _IconPlayArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$1]]);
1126
+ var _IconPlayArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$1]]);
1127
1127
  const IconPlayArrow = Object.assign(_IconPlayArrow, {
1128
1128
  install: (app, options) => {
1129
1129
  var _a;
@@ -1131,7 +1131,7 @@ const IconPlayArrow = Object.assign(_IconPlayArrow, {
1131
1131
  app.component(iconPrefix + _IconPlayArrow.name, _IconPlayArrow);
1132
1132
  }
1133
1133
  });
1134
- const _sfc_main$b = defineComponent({
1134
+ const _sfc_main$c = defineComponent({
1135
1135
  name: "IconSound",
1136
1136
  props: {
1137
1137
  size: {
@@ -1202,7 +1202,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1202
1202
  createElementVNode("path", { d: "M31.071 16.929c3.905 3.905 3.905 10.237 0 14.142M36.727 11.272c7.03 7.03 7.03 18.426 0 25.456" }, null, -1)
1203
1203
  ]), 14, _hoisted_1$a);
1204
1204
  }
1205
- var _IconSound = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render]]);
1205
+ var _IconSound = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render]]);
1206
1206
  const IconSound = Object.assign(_IconSound, {
1207
1207
  install: (app, options) => {
1208
1208
  var _a;
@@ -1225,7 +1225,7 @@ const _hoisted_6$3 = {
1225
1225
  key: 3,
1226
1226
  class: "error-tip"
1227
1227
  };
1228
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
1228
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1229
1229
  ...{
1230
1230
  name: "SortableFileItem"
1231
1231
  },
@@ -1323,9 +1323,9 @@ const _export_sfc = (sfc, props) => {
1323
1323
  }
1324
1324
  return target;
1325
1325
  };
1326
- const SortableFileItem = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-f3ec7e11"]]);
1326
+ const SortableFileItem = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-f3ec7e11"]]);
1327
1327
  const _hoisted_1$8 = { class: "sortable-file-list" };
1328
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1328
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1329
1329
  ...{
1330
1330
  name: "SortableFileList"
1331
1331
  },
@@ -1410,7 +1410,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1410
1410
  };
1411
1411
  }
1412
1412
  });
1413
- const SortableFileList = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-1ede8f45"]]);
1413
+ const SortableFileList = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-1ede8f45"]]);
1414
1414
  const _hoisted_1$7 = ["src", "autoplay", "loop", "muted", "preload"];
1415
1415
  const _hoisted_2$6 = {
1416
1416
  key: 0,
@@ -1428,7 +1428,7 @@ const _hoisted_8 = { class: "volume-slider-container" };
1428
1428
  const _hoisted_9 = { class: "time-display" };
1429
1429
  const _hoisted_10 = { class: "controls-right" };
1430
1430
  const _hoisted_11 = { class: "control-button" };
1431
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1431
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1432
1432
  ...{
1433
1433
  name: "VideoPreview"
1434
1434
  },
@@ -1777,11 +1777,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1777
1777
  };
1778
1778
  }
1779
1779
  });
1780
- const VideoPreview = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-e8cbf700"]]);
1780
+ const VideoPreview = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-e8cbf700"]]);
1781
1781
  const _hoisted_1$6 = { class: "video-modal-title" };
1782
1782
  const _hoisted_2$5 = { class: "file-name" };
1783
1783
  const _hoisted_3$3 = { class: "video-modal-content" };
1784
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1784
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1785
1785
  ...{
1786
1786
  name: "VideoPreviewModal"
1787
1787
  },
@@ -1853,7 +1853,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1853
1853
  };
1854
1854
  }
1855
1855
  });
1856
- const VideoPreviewModal = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-0ae4ec5c"]]);
1856
+ const VideoPreviewModal = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-0ae4ec5c"]]);
1857
1857
  const _hoisted_1$5 = { class: "basic-upload" };
1858
1858
  const _hoisted_2$4 = {
1859
1859
  key: 0,
@@ -1876,7 +1876,7 @@ const _hoisted_7$1 = {
1876
1876
  key: 4,
1877
1877
  class: "inline-video-preview"
1878
1878
  };
1879
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1879
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1880
1880
  ...{
1881
1881
  name: "BasicUpload",
1882
1882
  inheritAttrs: false
@@ -2546,7 +2546,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2546
2546
  };
2547
2547
  }
2548
2548
  });
2549
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-640a0bf9"]]);
2549
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-640a0bf9"]]);
2550
2550
  function useUpload(props) {
2551
2551
  const uploadRef = ref(null);
2552
2552
  const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
@@ -2686,7 +2686,7 @@ const componentsNeedPlaceholder = /* @__PURE__ */ new Set([
2686
2686
  "Textarea",
2687
2687
  "AutoComplete"
2688
2688
  ]);
2689
- const componentsNeedSelectPlaceholder = /* @__PURE__ */ new Set([
2689
+ const componentsNeedSelectPlaceholder$1 = /* @__PURE__ */ new Set([
2690
2690
  "Select",
2691
2691
  "DatePicker",
2692
2692
  "TimePicker",
@@ -2694,15 +2694,15 @@ const componentsNeedSelectPlaceholder = /* @__PURE__ */ new Set([
2694
2694
  "Cascader",
2695
2695
  "TreeSelect"
2696
2696
  ]);
2697
- const componentsNeedUploadPlaceholder = /* @__PURE__ */ new Set([
2697
+ const componentsNeedUploadPlaceholder$1 = /* @__PURE__ */ new Set([
2698
2698
  "Upload",
2699
2699
  "BasicUpload"
2700
2700
  ]);
2701
- function getPlaceholder(component, label) {
2701
+ function getPlaceholder$1(component, label) {
2702
2702
  if (componentsNeedPlaceholder.has(component)) {
2703
2703
  return `请输入${label}`;
2704
2704
  }
2705
- if (componentsNeedSelectPlaceholder.has(component)) {
2705
+ if (componentsNeedSelectPlaceholder$1.has(component)) {
2706
2706
  return `请选择${label}`;
2707
2707
  }
2708
2708
  return "";
@@ -2711,11 +2711,667 @@ function getRules(component, label) {
2711
2711
  if (componentsNeedPlaceholder.has(component)) {
2712
2712
  return [{ required: true, message: `请输入${label}` }];
2713
2713
  }
2714
- if (componentsNeedUploadPlaceholder.has(component)) {
2714
+ if (componentsNeedUploadPlaceholder$1.has(component)) {
2715
2715
  return [{ required: true, message: `请上传${label}` }];
2716
2716
  }
2717
2717
  return [{ required: true, message: `请选择${label}` }];
2718
2718
  }
2719
+ function getLabelFromOptions(value, options, config) {
2720
+ if (!options || !Array.isArray(options)) {
2721
+ return String(value || "-");
2722
+ }
2723
+ const labelKey = (config == null ? void 0 : config.labelKey) || "label";
2724
+ const valueKey = (config == null ? void 0 : config.valueKey) || "value";
2725
+ const option = options.find((opt2) => opt2[valueKey] === value);
2726
+ return (option == null ? void 0 : option[labelKey]) || String(value || "-");
2727
+ }
2728
+ function getLabelsFromOptions(values, options, config) {
2729
+ if (!values || !Array.isArray(values)) {
2730
+ return [];
2731
+ }
2732
+ return values.map((value) => getLabelFromOptions(value, options, config));
2733
+ }
2734
+ function getLabelFromTreeData(value, treeData, config) {
2735
+ if (!treeData || !Array.isArray(treeData)) {
2736
+ return String(value || "-");
2737
+ }
2738
+ const labelKey = (config == null ? void 0 : config.labelKey) || "label";
2739
+ const valueKey = (config == null ? void 0 : config.valueKey) || "value";
2740
+ const childrenKey = (config == null ? void 0 : config.childrenKey) || "children";
2741
+ function findLabel(nodes, targetValue) {
2742
+ for (const node of nodes) {
2743
+ if (node[valueKey] === targetValue) {
2744
+ return node[labelKey];
2745
+ }
2746
+ if (node[childrenKey] && Array.isArray(node[childrenKey])) {
2747
+ const result = findLabel(node[childrenKey], targetValue);
2748
+ if (result) return result;
2749
+ }
2750
+ }
2751
+ return null;
2752
+ }
2753
+ const label = findLabel(treeData, value);
2754
+ return label || String(value || "-");
2755
+ }
2756
+ function formatCascaderPath(value, separator = " / ") {
2757
+ if (!Array.isArray(value)) {
2758
+ return String(value || "-");
2759
+ }
2760
+ if (value.length === 0) {
2761
+ return "-";
2762
+ }
2763
+ return value.join(separator);
2764
+ }
2765
+ function getCascaderLabels(values, options, config) {
2766
+ if (!values || !Array.isArray(values) || values.length === 0) {
2767
+ return [];
2768
+ }
2769
+ const labelKey = (config == null ? void 0 : config.labelKey) || "label";
2770
+ const valueKey = (config == null ? void 0 : config.valueKey) || "value";
2771
+ const childrenKey = (config == null ? void 0 : config.childrenKey) || "children";
2772
+ const labels = [];
2773
+ let currentOptions = options;
2774
+ for (const value of values) {
2775
+ const option = currentOptions.find((opt2) => opt2[valueKey] === value);
2776
+ if (option) {
2777
+ labels.push(option[labelKey]);
2778
+ currentOptions = option[childrenKey] || [];
2779
+ } else {
2780
+ labels.push(String(value));
2781
+ break;
2782
+ }
2783
+ }
2784
+ return labels;
2785
+ }
2786
+ function isImageFile(file) {
2787
+ const imageExtensions = [
2788
+ ".jpg",
2789
+ ".jpeg",
2790
+ ".png",
2791
+ ".gif",
2792
+ ".webp",
2793
+ ".svg",
2794
+ ".bmp",
2795
+ ".ico"
2796
+ ];
2797
+ const imageMimeTypes = [
2798
+ "image/jpeg",
2799
+ "image/png",
2800
+ "image/gif",
2801
+ "image/webp",
2802
+ "image/svg+xml",
2803
+ "image/bmp"
2804
+ ];
2805
+ if (typeof file === "string") {
2806
+ const lowerUrl = file.toLowerCase();
2807
+ return imageExtensions.some((ext) => lowerUrl.endsWith(ext));
2808
+ }
2809
+ if (typeof file === "object" && file !== null) {
2810
+ if (file.type && imageMimeTypes.includes(file.type)) {
2811
+ return true;
2812
+ }
2813
+ if (file.url) {
2814
+ const lowerUrl = file.url.toLowerCase();
2815
+ if (imageExtensions.some((ext) => lowerUrl.endsWith(ext))) {
2816
+ return true;
2817
+ }
2818
+ }
2819
+ if (file.name) {
2820
+ const lowerName = file.name.toLowerCase();
2821
+ if (imageExtensions.some((ext) => lowerName.endsWith(ext))) {
2822
+ return true;
2823
+ }
2824
+ }
2825
+ }
2826
+ return false;
2827
+ }
2828
+ function getFileUrl(file) {
2829
+ if (typeof file === "string") {
2830
+ return file;
2831
+ }
2832
+ if (typeof file === "object" && file !== null) {
2833
+ return file.url || "";
2834
+ }
2835
+ return "";
2836
+ }
2837
+ function getFileName(file) {
2838
+ if (typeof file === "string") {
2839
+ const parts = file.split("/");
2840
+ return parts[parts.length - 1] || file;
2841
+ }
2842
+ if (typeof file === "object" && file !== null) {
2843
+ if (file.name) {
2844
+ return file.name;
2845
+ }
2846
+ if (file.url) {
2847
+ const parts = file.url.split("/");
2848
+ return parts[parts.length - 1] || file.url;
2849
+ }
2850
+ }
2851
+ return "";
2852
+ }
2853
+ function classifyFiles(files) {
2854
+ if (!files || !Array.isArray(files)) {
2855
+ return { imageFiles: [], otherFiles: [] };
2856
+ }
2857
+ const imageFiles = [];
2858
+ const otherFiles = [];
2859
+ files.forEach((file) => {
2860
+ if (isImageFile(file)) {
2861
+ imageFiles.push(file);
2862
+ } else {
2863
+ otherFiles.push(file);
2864
+ }
2865
+ });
2866
+ return { imageFiles, otherFiles };
2867
+ }
2868
+ function formatDate$1(value, format) {
2869
+ if (!value) return "-";
2870
+ try {
2871
+ if (typeof value === "string") {
2872
+ return value;
2873
+ }
2874
+ const date = new Date(value);
2875
+ if (isNaN(date.getTime())) {
2876
+ return String(value);
2877
+ }
2878
+ const year = date.getFullYear();
2879
+ const month = String(date.getMonth() + 1).padStart(2, "0");
2880
+ const day = String(date.getDate()).padStart(2, "0");
2881
+ const hours = String(date.getHours()).padStart(2, "0");
2882
+ const minutes = String(date.getMinutes()).padStart(2, "0");
2883
+ const seconds = String(date.getSeconds()).padStart(2, "0");
2884
+ if (format === "datetime") {
2885
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
2886
+ }
2887
+ return `${year}-${month}-${day}`;
2888
+ } catch (error) {
2889
+ console.error("[ReadonlyField] 日期格式化错误:", error);
2890
+ return String(value);
2891
+ }
2892
+ }
2893
+ function formatBoolean(value, trueText = "是", falseText = "否") {
2894
+ if (value === true || value === "true" || value === 1 || value === "1") {
2895
+ return trueText;
2896
+ }
2897
+ if (value === false || value === "false" || value === 0 || value === "0") {
2898
+ return falseText;
2899
+ }
2900
+ return "-";
2901
+ }
2902
+ function safeToString(value, emptyText = "-") {
2903
+ if (value === null || value === void 0 || value === "") {
2904
+ return emptyText;
2905
+ }
2906
+ if (typeof value === "object") {
2907
+ return JSON.stringify(value);
2908
+ }
2909
+ return String(value);
2910
+ }
2911
+ function renderText(value, config) {
2912
+ const emptyText = config.emptyText || "-";
2913
+ const text = safeToString(value, emptyText);
2914
+ return h(
2915
+ "div",
2916
+ {
2917
+ class: ["readonly-field-text", { "readonly-field-empty": !value }]
2918
+ },
2919
+ text
2920
+ );
2921
+ }
2922
+ function renderInputNumber(value, config) {
2923
+ const emptyText = config.emptyText || "-";
2924
+ if (value === null || value === void 0 || value === "") {
2925
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2926
+ }
2927
+ return h("div", { class: "readonly-field-number" }, String(value));
2928
+ }
2929
+ function renderSelect(value, config) {
2930
+ var _a;
2931
+ const emptyText = config.emptyText || "-";
2932
+ if (value === null || value === void 0 || value === "") {
2933
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2934
+ }
2935
+ if (config.labelMap && value in config.labelMap) {
2936
+ return h("div", { class: "readonly-field-select" }, config.labelMap[value]);
2937
+ }
2938
+ const options = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
2939
+ const label = getLabelFromOptions(value, options);
2940
+ return h("div", { class: "readonly-field-select" }, label);
2941
+ }
2942
+ function renderSelectMultiple(value, config) {
2943
+ var _a;
2944
+ const emptyText = config.emptyText || "-";
2945
+ if (!value || !Array.isArray(value) || value.length === 0) {
2946
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2947
+ }
2948
+ const options = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
2949
+ const labels = getLabelsFromOptions(value, options);
2950
+ return h(
2951
+ "div",
2952
+ { class: "readonly-field-select-multiple" },
2953
+ labels.join(", ")
2954
+ );
2955
+ }
2956
+ function renderTreeSelect(value, config) {
2957
+ var _a;
2958
+ const emptyText = config.emptyText || "-";
2959
+ if (value === null || value === void 0 || value === "") {
2960
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2961
+ }
2962
+ if (config.labelMap && value in config.labelMap) {
2963
+ return h(
2964
+ "div",
2965
+ { class: "readonly-field-tree-select" },
2966
+ config.labelMap[value]
2967
+ );
2968
+ }
2969
+ const treeData = ((_a = config.componentProps) == null ? void 0 : _a.data) || [];
2970
+ const label = getLabelFromTreeData(value, treeData);
2971
+ return h("div", { class: "readonly-field-tree-select" }, label);
2972
+ }
2973
+ function renderCascader(value, config) {
2974
+ var _a;
2975
+ const emptyText = config.emptyText || "-";
2976
+ if (!value) {
2977
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2978
+ }
2979
+ if (!Array.isArray(value)) {
2980
+ return h("div", { class: "readonly-field-cascader" }, String(value));
2981
+ }
2982
+ if (value.length === 0) {
2983
+ return h("div", { class: "readonly-field-empty" }, emptyText);
2984
+ }
2985
+ const options = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
2986
+ if (options.length > 0) {
2987
+ const labels = getCascaderLabels(value, options);
2988
+ if (labels.length > 0) {
2989
+ return h(
2990
+ "div",
2991
+ { class: "readonly-field-cascader" },
2992
+ formatCascaderPath(labels)
2993
+ );
2994
+ }
2995
+ }
2996
+ return h(
2997
+ "div",
2998
+ { class: "readonly-field-cascader" },
2999
+ formatCascaderPath(value)
3000
+ );
3001
+ }
3002
+ function renderDatePicker(value, config) {
3003
+ const emptyText = config.emptyText || "-";
3004
+ if (!value) {
3005
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3006
+ }
3007
+ const formatted = formatDate$1(value);
3008
+ return h("div", { class: "readonly-field-date" }, formatted);
3009
+ }
3010
+ function renderRangePicker(value, config) {
3011
+ const emptyText = config.emptyText || "-";
3012
+ if (!value || !Array.isArray(value) || value.length === 0) {
3013
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3014
+ }
3015
+ const startDate = formatDate$1(value[0]);
3016
+ const endDate = formatDate$1(value[1]);
3017
+ return h(
3018
+ "div",
3019
+ { class: "readonly-field-range" },
3020
+ `${startDate} ~ ${endDate}`
3021
+ );
3022
+ }
3023
+ function renderTimePicker(value, config) {
3024
+ const emptyText = config.emptyText || "-";
3025
+ if (!value) {
3026
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3027
+ }
3028
+ return h("div", { class: "readonly-field-time" }, String(value));
3029
+ }
3030
+ function renderSwitch(value, config) {
3031
+ var _a, _b, _c, _d;
3032
+ const emptyText = config.emptyText || "-";
3033
+ if (value === null || value === void 0) {
3034
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3035
+ }
3036
+ const trueText = ((_a = config.componentProps) == null ? void 0 : _a.checkedText) || ((_b = config.componentProps) == null ? void 0 : _b.trueText) || "是";
3037
+ const falseText = ((_c = config.componentProps) == null ? void 0 : _c.uncheckedText) || ((_d = config.componentProps) == null ? void 0 : _d.falseText) || "否";
3038
+ const text = formatBoolean(value, trueText, falseText);
3039
+ return h("div", { class: "readonly-field-switch" }, text);
3040
+ }
3041
+ function renderCheckbox(value, config) {
3042
+ return renderSwitch(value, config);
3043
+ }
3044
+ function renderCheckboxGroup(value, config) {
3045
+ return renderSelectMultiple(value, config);
3046
+ }
3047
+ function renderRadio(value, config) {
3048
+ return renderSelect(value, config);
3049
+ }
3050
+ function renderRate(value, config) {
3051
+ const emptyText = config.emptyText || "-";
3052
+ if (value === null || value === void 0) {
3053
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3054
+ }
3055
+ return h("div", { class: "readonly-field-rate" }, `${value} 分`);
3056
+ }
3057
+ function renderSlider(value, config) {
3058
+ const emptyText = config.emptyText || "-";
3059
+ if (value === null || value === void 0) {
3060
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3061
+ }
3062
+ if (Array.isArray(value)) {
3063
+ return h(
3064
+ "div",
3065
+ { class: "readonly-field-slider" },
3066
+ `${value[0]} ~ ${value[1]}`
3067
+ );
3068
+ }
3069
+ return h("div", { class: "readonly-field-slider" }, String(value));
3070
+ }
3071
+ function renderUpload(value, config) {
3072
+ const emptyText = config.emptyText || "-";
3073
+ if (!value || Array.isArray(value) && value.length === 0) {
3074
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3075
+ }
3076
+ const files = Array.isArray(value) ? value : [value];
3077
+ const { imageFiles, otherFiles } = classifyFiles(files);
3078
+ const children = [];
3079
+ if (imageFiles.length > 0) {
3080
+ children.push(
3081
+ h(
3082
+ ImagePreviewGroup,
3083
+ { infinite: true },
3084
+ {
3085
+ default: () => h(
3086
+ "div",
3087
+ { class: "readonly-image-list" },
3088
+ imageFiles.map(
3089
+ (file) => h(Image, {
3090
+ src: getFileUrl(file),
3091
+ width: 100,
3092
+ height: 100,
3093
+ fit: "cover",
3094
+ class: "readonly-image-item",
3095
+ alt: getFileName(file)
3096
+ })
3097
+ )
3098
+ )
3099
+ }
3100
+ )
3101
+ );
3102
+ }
3103
+ if (otherFiles.length > 0) {
3104
+ children.push(
3105
+ h(
3106
+ "div",
3107
+ { class: "readonly-file-list" },
3108
+ otherFiles.map(
3109
+ (file) => h(
3110
+ "a",
3111
+ {
3112
+ href: getFileUrl(file),
3113
+ target: "_blank",
3114
+ class: "readonly-file-link",
3115
+ rel: "noopener noreferrer"
3116
+ },
3117
+ getFileName(file)
3118
+ )
3119
+ )
3120
+ )
3121
+ );
3122
+ }
3123
+ return h("div", { class: "readonly-upload-container" }, children);
3124
+ }
3125
+ function renderTextarea(value, config) {
3126
+ const emptyText = config.emptyText || "-";
3127
+ if (!value) {
3128
+ return h("div", { class: "readonly-field-empty" }, emptyText);
3129
+ }
3130
+ return h(
3131
+ "div",
3132
+ {
3133
+ class: "readonly-field-textarea",
3134
+ style: { whiteSpace: "pre-wrap" }
3135
+ },
3136
+ String(value)
3137
+ );
3138
+ }
3139
+ const rendererMap = {
3140
+ // 输入组件
3141
+ Input: renderText,
3142
+ InputPassword: renderText,
3143
+ InputNumber: renderInputNumber,
3144
+ Textarea: renderTextarea,
3145
+ AutoComplete: renderText,
3146
+ // 选择组件
3147
+ Select: renderSelect,
3148
+ TreeSelect: renderTreeSelect,
3149
+ Cascader: renderCascader,
3150
+ // 单选/多选
3151
+ Radio: renderRadio,
3152
+ RadioGroup: renderRadio,
3153
+ Checkbox: renderCheckbox,
3154
+ CheckboxGroup: renderCheckboxGroup,
3155
+ // 日期时间
3156
+ DatePicker: renderDatePicker,
3157
+ RangePicker: renderRangePicker,
3158
+ TimePicker: renderTimePicker,
3159
+ // 其他
3160
+ Switch: renderSwitch,
3161
+ Rate: renderRate,
3162
+ Slider: renderSlider,
3163
+ Upload: renderUpload,
3164
+ BasicUpload: renderUpload,
3165
+ // 默认
3166
+ default: renderText
3167
+ };
3168
+ function getRenderer(component = "Input") {
3169
+ return rendererMap[component] || rendererMap.default;
3170
+ }
3171
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3172
+ ...{
3173
+ name: "BasicReadonlyField",
3174
+ inheritAttrs: false
3175
+ },
3176
+ __name: "BasicReadonlyField",
3177
+ props: {
3178
+ value: {},
3179
+ component: { default: "Input" },
3180
+ componentProps: {},
3181
+ fetchOptions: {},
3182
+ labelMap: {},
3183
+ customRender: {},
3184
+ emptyText: { default: "-" },
3185
+ class: {},
3186
+ style: {}
3187
+ },
3188
+ setup(__props) {
3189
+ const props = __props;
3190
+ const loading = ref(false);
3191
+ const cachedOptions = ref([]);
3192
+ const wrapperClass = computed(() => {
3193
+ return [
3194
+ "readonly-field",
3195
+ props.class,
3196
+ {
3197
+ "readonly-field-loading": loading.value
3198
+ }
3199
+ ];
3200
+ });
3201
+ const customStyle = computed(() => {
3202
+ return props.style || {};
3203
+ });
3204
+ const renderConfig = computed(() => {
3205
+ return {
3206
+ component: props.component,
3207
+ componentProps: props.componentProps,
3208
+ labelMap: props.labelMap,
3209
+ fetchOptions: props.fetchOptions,
3210
+ emptyText: props.emptyText,
3211
+ customRender: props.customRender,
3212
+ value: props.value
3213
+ };
3214
+ });
3215
+ const enhancedRenderConfig = computed(() => {
3216
+ const config = { ...renderConfig.value };
3217
+ if (cachedOptions.value.length > 0) {
3218
+ config.componentProps = {
3219
+ ...config.componentProps,
3220
+ options: cachedOptions.value
3221
+ };
3222
+ }
3223
+ return config;
3224
+ });
3225
+ const renderedContent = computed(() => {
3226
+ try {
3227
+ if (props.customRender) {
3228
+ return props.customRender(props.value, enhancedRenderConfig.value);
3229
+ }
3230
+ const renderer = getRenderer(props.component || "Input");
3231
+ return renderer(props.value, enhancedRenderConfig.value);
3232
+ } catch (error) {
3233
+ console.error("[BasicReadonlyField] 渲染错误:", error);
3234
+ return props.emptyText || "-";
3235
+ }
3236
+ });
3237
+ const fetchOptionsAsync = async () => {
3238
+ if (!props.fetchOptions) return;
3239
+ try {
3240
+ loading.value = true;
3241
+ const options = await props.fetchOptions();
3242
+ cachedOptions.value = options || [];
3243
+ } catch (error) {
3244
+ console.error("[BasicReadonlyField] 获取 options 失败:", error);
3245
+ cachedOptions.value = [];
3246
+ } finally {
3247
+ loading.value = false;
3248
+ }
3249
+ };
3250
+ watch(
3251
+ () => props.fetchOptions,
3252
+ () => {
3253
+ if (props.fetchOptions) {
3254
+ fetchOptionsAsync();
3255
+ }
3256
+ },
3257
+ { immediate: true }
3258
+ );
3259
+ watch(
3260
+ () => props.value,
3261
+ (newValue, oldValue) => {
3262
+ }
3263
+ );
3264
+ onMounted(() => {
3265
+ if (props.fetchOptions && cachedOptions.value.length === 0) {
3266
+ fetchOptionsAsync();
3267
+ }
3268
+ });
3269
+ return (_ctx, _cache) => {
3270
+ return openBlock(), createElementBlock("div", {
3271
+ class: normalizeClass(wrapperClass.value),
3272
+ style: normalizeStyle(customStyle.value)
3273
+ }, [
3274
+ (openBlock(), createBlock(resolveDynamicComponent(renderedContent.value)))
3275
+ ], 6);
3276
+ };
3277
+ }
3278
+ });
3279
+ const BasicReadonlyField = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-a6d8ca62"]]);
3280
+ function useReadonlyField(options) {
3281
+ const defaultEmptyText = (options == null ? void 0 : options.defaultEmptyText) || "-";
3282
+ const globalLabelMap = (options == null ? void 0 : options.globalLabelMap) || {};
3283
+ const optionsCache = ref(/* @__PURE__ */ new Map());
3284
+ const render = (value, config) => {
3285
+ try {
3286
+ const mergedConfig = {
3287
+ emptyText: defaultEmptyText,
3288
+ ...config,
3289
+ labelMap: {
3290
+ ...globalLabelMap,
3291
+ ...config.labelMap || {}
3292
+ }
3293
+ };
3294
+ if (mergedConfig.customRender) {
3295
+ return mergedConfig.customRender(value, mergedConfig);
3296
+ }
3297
+ const renderer = getRenderer(mergedConfig.component || "Input");
3298
+ return renderer(value, mergedConfig);
3299
+ } catch (error) {
3300
+ console.error("[useReadonlyField] 渲染错误:", error);
3301
+ return defaultEmptyText;
3302
+ }
3303
+ };
3304
+ const getLabel = async (value, config) => {
3305
+ var _a, _b;
3306
+ if (value === null || value === void 0 || value === "") {
3307
+ return config.emptyText || defaultEmptyText;
3308
+ }
3309
+ const labelMap = {
3310
+ ...globalLabelMap,
3311
+ ...config.labelMap || {}
3312
+ };
3313
+ if (value in labelMap) {
3314
+ return labelMap[value];
3315
+ }
3316
+ if (config.fetchOptions) {
3317
+ try {
3318
+ const cacheKey = config.fetchOptions.toString();
3319
+ let options3 = optionsCache.value.get(cacheKey);
3320
+ if (!options3) {
3321
+ options3 = await config.fetchOptions();
3322
+ optionsCache.value.set(cacheKey, options3 || []);
3323
+ }
3324
+ return getLabelFromOptions(value, options3 || []);
3325
+ } catch (error) {
3326
+ console.error("[useReadonlyField] 获取 options 失败:", error);
3327
+ return String(value);
3328
+ }
3329
+ }
3330
+ const options2 = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
3331
+ if (options2.length > 0) {
3332
+ return getLabelFromOptions(value, options2);
3333
+ }
3334
+ const treeData = ((_b = config.componentProps) == null ? void 0 : _b.data) || [];
3335
+ if (treeData.length > 0) {
3336
+ return getLabelFromTreeData(value, treeData);
3337
+ }
3338
+ return String(value);
3339
+ };
3340
+ const getLabels = async (values, config) => {
3341
+ var _a;
3342
+ if (!values || !Array.isArray(values) || values.length === 0) {
3343
+ return [];
3344
+ }
3345
+ if (config.fetchOptions) {
3346
+ try {
3347
+ const cacheKey = config.fetchOptions.toString();
3348
+ let options3 = optionsCache.value.get(cacheKey);
3349
+ if (!options3) {
3350
+ options3 = await config.fetchOptions();
3351
+ optionsCache.value.set(cacheKey, options3 || []);
3352
+ }
3353
+ return getLabelsFromOptions(values, options3 || []);
3354
+ } catch (error) {
3355
+ console.error("[useReadonlyField] 获取 options 失败:", error);
3356
+ return values.map(String);
3357
+ }
3358
+ }
3359
+ const options2 = ((_a = config.componentProps) == null ? void 0 : _a.options) || [];
3360
+ if (options2.length > 0) {
3361
+ return getLabelsFromOptions(values, options2);
3362
+ }
3363
+ return values.map(String);
3364
+ };
3365
+ const clearCache = () => {
3366
+ optionsCache.value.clear();
3367
+ };
3368
+ return {
3369
+ render,
3370
+ getLabel,
3371
+ getLabels,
3372
+ clearCache
3373
+ };
3374
+ }
2719
3375
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2720
3376
  ...{
2721
3377
  name: "BasicForm",
@@ -2741,7 +3397,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2741
3397
  showResetButton: { type: Boolean, default: true },
2742
3398
  submitButtonText: { default: "提交" },
2743
3399
  resetButtonText: { default: "重置" },
2744
- showActionButtons: { type: Boolean, default: true }
3400
+ showActionButtons: { type: Boolean, default: true },
3401
+ readonly: { type: Boolean }
2745
3402
  },
2746
3403
  emits: ["register", "submit", "reset", "validate"],
2747
3404
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -2847,7 +3504,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2847
3504
  return "";
2848
3505
  }
2849
3506
  const componentType = typeof schema.component === "string" ? schema.component : "";
2850
- return getPlaceholder(componentType, schema.label);
3507
+ return getPlaceholder$1(componentType, schema.label);
2851
3508
  };
2852
3509
  const shouldRenderCustomLabel = (schema) => {
2853
3510
  return !!(schema.labelEllipsis || schema.labelTooltip);
@@ -2872,6 +3529,27 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2872
3529
  }
2873
3530
  return schema.label;
2874
3531
  };
3532
+ const isFieldReadonly = (schema) => {
3533
+ const propsData = unref(getProps);
3534
+ if (propsData.readonly) {
3535
+ return true;
3536
+ }
3537
+ if (schema.readonly !== void 0) {
3538
+ if (typeof schema.readonly === "boolean") {
3539
+ return schema.readonly;
3540
+ }
3541
+ if (typeof schema.readonly === "function") {
3542
+ return schema.readonly(formModel);
3543
+ }
3544
+ }
3545
+ return false;
3546
+ };
3547
+ const getComponentString = (component) => {
3548
+ if (typeof component === "string") {
3549
+ return component;
3550
+ }
3551
+ return (component == null ? void 0 : component.name) || "Input";
3552
+ };
2875
3553
  const handleSubmit = async (data) => {
2876
3554
  try {
2877
3555
  submitLoading.value = true;
@@ -3068,19 +3746,31 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3068
3746
  key: 1,
3069
3747
  ref_for: true
3070
3748
  }, getFormItemBindValue(schema)), createSlots({
3071
- default: withCtx(() => [
3072
- schema.slotName ? renderSlot(_ctx.$slots, schema.slotName, {
3073
- key: 0,
3074
- field: schema.field,
3075
- schema,
3076
- formModel
3077
- }) : schema.renderComponentContent ? (openBlock(), createBlock(resolveDynamicComponent(schema.renderComponentContent(schema, formModel)), { key: 1 })) : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(schema.component)), mergeProps({
3078
- key: 2,
3079
- modelValue: formModel[schema.field],
3080
- "onUpdate:modelValue": ($event) => formModel[schema.field] = $event,
3081
- placeholder: getPlaceholderText(schema)
3082
- }, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
3083
- ]),
3749
+ default: withCtx(() => {
3750
+ var _a, _b, _c, _d;
3751
+ return [
3752
+ schema.slotName ? renderSlot(_ctx.$slots, schema.slotName, {
3753
+ key: 0,
3754
+ field: schema.field,
3755
+ schema,
3756
+ formModel
3757
+ }) : schema.renderComponentContent ? (openBlock(), createBlock(resolveDynamicComponent(schema.renderComponentContent(schema, formModel)), { key: 1 })) : isFieldReadonly(schema) ? (openBlock(), createBlock(unref(BasicReadonlyField), {
3758
+ key: 2,
3759
+ value: formModel[schema.field],
3760
+ component: getComponentString(schema.component),
3761
+ componentProps: schema.componentProps,
3762
+ labelMap: (_a = schema.readonlyConfig) == null ? void 0 : _a.labelMap,
3763
+ fetchOptions: (_b = schema.readonlyConfig) == null ? void 0 : _b.fetchOptions,
3764
+ emptyText: (_c = schema.readonlyConfig) == null ? void 0 : _c.emptyText,
3765
+ customRender: ((_d = schema.readonlyConfig) == null ? void 0 : _d.customRender) ? (value) => schema.readonlyConfig.customRender(value, schema) : void 0
3766
+ }, null, 8, ["value", "component", "componentProps", "labelMap", "fetchOptions", "emptyText", "customRender"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(schema.component)), mergeProps({
3767
+ key: 3,
3768
+ modelValue: formModel[schema.field],
3769
+ "onUpdate:modelValue": ($event) => formModel[schema.field] = $event,
3770
+ placeholder: getPlaceholderText(schema)
3771
+ }, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
3772
+ ];
3773
+ }),
3084
3774
  _: 2
3085
3775
  }, [
3086
3776
  shouldRenderCustomLabel(schema) ? {
@@ -3616,9 +4306,376 @@ function getEditComponent(name) {
3616
4306
  }
3617
4307
  return name;
3618
4308
  }
4309
+ function useTrim(options) {
4310
+ const { column, editConfig } = options;
4311
+ const trimConfig = computed(() => {
4312
+ const columnConfig = column.autoTrim;
4313
+ const globalConfig = editConfig == null ? void 0 : editConfig.autoTrim;
4314
+ const defaultConfig = {
4315
+ enabled: true,
4316
+ overall: true,
4317
+ eachLine: false,
4318
+ trigger: "blur"
4319
+ };
4320
+ if (typeof columnConfig === "object" && columnConfig !== null) {
4321
+ return {
4322
+ enabled: true,
4323
+ overall: columnConfig.overall ?? defaultConfig.overall,
4324
+ eachLine: columnConfig.eachLine ?? defaultConfig.eachLine,
4325
+ trigger: columnConfig.trigger ?? defaultConfig.trigger
4326
+ };
4327
+ }
4328
+ if (typeof columnConfig === "boolean") {
4329
+ return { ...defaultConfig, enabled: columnConfig };
4330
+ }
4331
+ if (typeof globalConfig === "boolean") {
4332
+ return { ...defaultConfig, enabled: globalConfig };
4333
+ }
4334
+ return defaultConfig;
4335
+ });
4336
+ const applyTrim = (value) => {
4337
+ const config = trimConfig.value;
4338
+ if (typeof value !== "string") {
4339
+ return value;
4340
+ }
4341
+ let result = value;
4342
+ if (config.eachLine) {
4343
+ result = result.split("\n").map((line) => line.trim()).join("\n");
4344
+ }
4345
+ if (config.overall) {
4346
+ result = result.trim();
4347
+ }
4348
+ return result;
4349
+ };
4350
+ const wrapTrimListeners = (listeners, currentValue, onChange) => {
4351
+ const config = trimConfig.value;
4352
+ if (!config.enabled) {
4353
+ return {};
4354
+ }
4355
+ const wrappedListeners = {};
4356
+ if (config.trigger === "blur") {
4357
+ const originalOnBlur = listeners.onBlur;
4358
+ wrappedListeners.onBlur = (...args) => {
4359
+ originalOnBlur == null ? void 0 : originalOnBlur(...args);
4360
+ const value = currentValue();
4361
+ const trimmedValue = applyTrim(value);
4362
+ if (trimmedValue !== value) {
4363
+ onChange(trimmedValue);
4364
+ }
4365
+ };
4366
+ }
4367
+ return wrappedListeners;
4368
+ };
4369
+ return {
4370
+ trimConfig,
4371
+ applyTrim,
4372
+ wrapTrimListeners
4373
+ };
4374
+ }
4375
+ const componentsNeedInputPlaceholder = /* @__PURE__ */ new Set([
4376
+ "Input",
4377
+ "InputPassword",
4378
+ "Textarea",
4379
+ "AutoComplete",
4380
+ "InputNumber"
4381
+ ]);
4382
+ const componentsNeedSelectPlaceholder = /* @__PURE__ */ new Set([
4383
+ "Select",
4384
+ "DatePicker",
4385
+ "TimePicker",
4386
+ "RangePicker",
4387
+ "Cascader",
4388
+ "TreeSelect",
4389
+ "Radio",
4390
+ "RadioGroup",
4391
+ "Checkbox",
4392
+ "CheckboxGroup"
4393
+ ]);
4394
+ const componentsNeedUploadPlaceholder = /* @__PURE__ */ new Set([
4395
+ "Upload",
4396
+ "BasicUpload"
4397
+ ]);
4398
+ function getPlaceholder(component, label) {
4399
+ if (!label) {
4400
+ return "";
4401
+ }
4402
+ if (componentsNeedInputPlaceholder.has(component)) {
4403
+ return `请输入${label}`;
4404
+ }
4405
+ if (componentsNeedSelectPlaceholder.has(component)) {
4406
+ return `请选择${label}`;
4407
+ }
4408
+ if (componentsNeedUploadPlaceholder.has(component)) {
4409
+ return `请上传${label}`;
4410
+ }
4411
+ return "";
4412
+ }
4413
+ function useComponentProps(options) {
4414
+ const { column, record, size = "small", error, extraListeners = {} } = options;
4415
+ const componentType = computed(() => {
4416
+ if (typeof column.editComponent === "string") {
4417
+ return column.editComponent;
4418
+ }
4419
+ return "Input";
4420
+ });
4421
+ const userComponentProps = computed(() => {
4422
+ if (!column.editComponentProps) {
4423
+ return {};
4424
+ }
4425
+ if (typeof column.editComponentProps === "function") {
4426
+ return column.editComponentProps(record);
4427
+ }
4428
+ return column.editComponentProps;
4429
+ });
4430
+ const separatedProps = computed(() => {
4431
+ const userProps = userComponentProps.value;
4432
+ const attrs2 = {};
4433
+ const listeners2 = {};
4434
+ for (const key in userProps) {
4435
+ if (Object.prototype.hasOwnProperty.call(userProps, key)) {
4436
+ if (key.startsWith("on") && key.length > 2 && key.charCodeAt(2) >= 65 && key.charCodeAt(2) <= 90) {
4437
+ listeners2[key] = userProps[key];
4438
+ } else {
4439
+ attrs2[key] = userProps[key];
4440
+ }
4441
+ }
4442
+ }
4443
+ return { attrs: attrs2, listeners: listeners2 };
4444
+ });
4445
+ const attrs = computed(() => separatedProps.value.attrs);
4446
+ const listeners = computed(() => separatedProps.value.listeners);
4447
+ const mergedProps = computed(() => {
4448
+ const { attrs: userAttrs, listeners: userListeners } = separatedProps.value;
4449
+ const baseProps = {
4450
+ size,
4451
+ status: error ? "error" : void 0
4452
+ };
4453
+ if (!userAttrs.placeholder) {
4454
+ baseProps.placeholder = getPlaceholder(componentType.value, column.title || "");
4455
+ }
4456
+ return {
4457
+ ...baseProps,
4458
+ ...userAttrs,
4459
+ ...userListeners,
4460
+ ...extraListeners
4461
+ };
4462
+ });
4463
+ return {
4464
+ componentType,
4465
+ attrs,
4466
+ listeners,
4467
+ mergedProps
4468
+ };
4469
+ }
4470
+ function useEditCellValue(options) {
4471
+ const { value, onChange, debounce: debounce2 = 0, throttle: throttle2 = 0, deep = false } = options;
4472
+ const currentValue = ref(value);
4473
+ let debounceTimer = null;
4474
+ let throttleTimer = null;
4475
+ let lastThrottleTime = 0;
4476
+ watch(
4477
+ () => value,
4478
+ (newVal) => {
4479
+ currentValue.value = newVal;
4480
+ },
4481
+ {
4482
+ // 只对对象/数组使用深度监听
4483
+ deep: deep || typeof value === "object" && value !== null
4484
+ }
4485
+ );
4486
+ const clearTimers = () => {
4487
+ if (debounceTimer) {
4488
+ clearTimeout(debounceTimer);
4489
+ debounceTimer = null;
4490
+ }
4491
+ if (throttleTimer) {
4492
+ clearTimeout(throttleTimer);
4493
+ throttleTimer = null;
4494
+ }
4495
+ };
4496
+ const executeDebounce = (callback) => {
4497
+ if (debounceTimer) {
4498
+ clearTimeout(debounceTimer);
4499
+ }
4500
+ debounceTimer = setTimeout(() => {
4501
+ callback();
4502
+ debounceTimer = null;
4503
+ }, debounce2);
4504
+ };
4505
+ const executeThrottle = (callback) => {
4506
+ const now = Date.now();
4507
+ const timeSinceLastCall = now - lastThrottleTime;
4508
+ if (timeSinceLastCall >= throttle2) {
4509
+ callback();
4510
+ lastThrottleTime = now;
4511
+ } else {
4512
+ if (throttleTimer) {
4513
+ clearTimeout(throttleTimer);
4514
+ }
4515
+ const remainingTime = throttle2 - timeSinceLastCall;
4516
+ throttleTimer = setTimeout(() => {
4517
+ callback();
4518
+ lastThrottleTime = Date.now();
4519
+ throttleTimer = null;
4520
+ }, remainingTime);
4521
+ }
4522
+ };
4523
+ const handleChange = (newValue) => {
4524
+ currentValue.value = newValue;
4525
+ const executeCallback = () => {
4526
+ onChange(newValue);
4527
+ };
4528
+ if (debounce2 > 0 && throttle2 > 0) {
4529
+ console.warn("[useEditCellValue] 同时配置了防抖和节流,将使用防抖");
4530
+ executeDebounce(executeCallback);
4531
+ } else if (debounce2 > 0) {
4532
+ executeDebounce(executeCallback);
4533
+ } else if (throttle2 > 0) {
4534
+ executeThrottle(executeCallback);
4535
+ } else {
4536
+ executeCallback();
4537
+ }
4538
+ };
4539
+ const setValue = (newValue) => {
4540
+ currentValue.value = newValue;
4541
+ };
4542
+ onBeforeUnmount(() => {
4543
+ clearTimers();
4544
+ });
4545
+ return {
4546
+ currentValue,
4547
+ handleChange,
4548
+ setValue
4549
+ };
4550
+ }
4551
+ function trimFormatter(value) {
4552
+ if (typeof value !== "string") {
4553
+ return value;
4554
+ }
4555
+ return value.trim();
4556
+ }
4557
+ function uppercaseFormatter(value) {
4558
+ if (typeof value !== "string") {
4559
+ return value;
4560
+ }
4561
+ return value.toUpperCase();
4562
+ }
4563
+ function lowercaseFormatter(value) {
4564
+ if (typeof value !== "string") {
4565
+ return value;
4566
+ }
4567
+ return value.toLowerCase();
4568
+ }
4569
+ function numberFormatter(value) {
4570
+ const num = Number(value);
4571
+ return isNaN(num) ? value : num;
4572
+ }
4573
+ function capitalizeFormatter(value) {
4574
+ if (typeof value !== "string" || value.length === 0) {
4575
+ return value;
4576
+ }
4577
+ return value.charAt(0).toUpperCase() + value.slice(1);
4578
+ }
4579
+ function removeExtraSpacesFormatter(value) {
4580
+ if (typeof value !== "string") {
4581
+ return value;
4582
+ }
4583
+ return value.replace(/\s+/g, " ");
4584
+ }
4585
+ function removeAllSpacesFormatter(value) {
4586
+ if (typeof value !== "string") {
4587
+ return value;
4588
+ }
4589
+ return value.replace(/\s/g, "");
4590
+ }
4591
+ const formatters = {
4592
+ trim: trimFormatter,
4593
+ uppercase: uppercaseFormatter,
4594
+ lowercase: lowercaseFormatter,
4595
+ number: numberFormatter,
4596
+ capitalize: capitalizeFormatter,
4597
+ removeExtraSpaces: removeExtraSpacesFormatter,
4598
+ removeAllSpaces: removeAllSpacesFormatter
4599
+ };
4600
+ function getFormatter(type) {
4601
+ return formatters[type];
4602
+ }
4603
+ function useEditFormat(options) {
4604
+ const { column, editConfig } = options;
4605
+ const { trimConfig, applyTrim } = useTrim({ column, editConfig });
4606
+ const formatConfigs = computed(() => {
4607
+ const configs = [];
4608
+ if (column.editFormat) {
4609
+ if (Array.isArray(column.editFormat)) {
4610
+ configs.push(...column.editFormat);
4611
+ } else {
4612
+ configs.push(column.editFormat);
4613
+ }
4614
+ } else if (column.autoTrim !== void 0 || (editConfig == null ? void 0 : editConfig.autoTrim) !== void 0) {
4615
+ if (trimConfig.value.enabled) {
4616
+ configs.push({
4617
+ type: "trim",
4618
+ trigger: trimConfig.value.trigger
4619
+ });
4620
+ }
4621
+ }
4622
+ return configs;
4623
+ });
4624
+ const applySingleFormat = (value, formatConfig) => {
4625
+ const { type } = formatConfig;
4626
+ if (typeof type === "function") {
4627
+ return type(value);
4628
+ }
4629
+ if (type === "trim") {
4630
+ return applyTrim(value);
4631
+ }
4632
+ const formatter = getFormatter(type);
4633
+ if (formatter) {
4634
+ return formatter(value);
4635
+ }
4636
+ console.warn(`[useEditFormat] 未找到格式化器: ${type}`);
4637
+ return value;
4638
+ };
4639
+ const applyFormat = (value, trigger) => {
4640
+ let result = value;
4641
+ const configs = formatConfigs.value;
4642
+ for (const config of configs) {
4643
+ if (trigger && config.trigger && config.trigger !== trigger) {
4644
+ continue;
4645
+ }
4646
+ result = applySingleFormat(result, config);
4647
+ }
4648
+ return result;
4649
+ };
4650
+ const wrapFormatListeners = (listeners, currentValue, onChange) => {
4651
+ const configs = formatConfigs.value;
4652
+ if (configs.length === 0) {
4653
+ return {};
4654
+ }
4655
+ const wrappedListeners = {};
4656
+ const hasBlurFormat = configs.some((config) => !config.trigger || config.trigger === "blur");
4657
+ if (hasBlurFormat) {
4658
+ const originalOnBlur = listeners.onBlur;
4659
+ wrappedListeners.onBlur = (...args) => {
4660
+ originalOnBlur == null ? void 0 : originalOnBlur(...args);
4661
+ const value = currentValue();
4662
+ const formattedValue = applyFormat(value, "blur");
4663
+ if (formattedValue !== value) {
4664
+ onChange(formattedValue);
4665
+ }
4666
+ };
4667
+ }
4668
+ return wrappedListeners;
4669
+ };
4670
+ return {
4671
+ formatConfigs,
4672
+ applyFormat,
4673
+ wrapFormatListeners
4674
+ };
4675
+ }
3619
4676
  const _hoisted_1$3 = { class: "edit-cell" };
3620
4677
  const _hoisted_2$3 = {
3621
- key: 0,
4678
+ key: 2,
3622
4679
  class: "edit-cell-error"
3623
4680
  };
3624
4681
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
@@ -3631,50 +4688,95 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3631
4688
  record: {},
3632
4689
  value: {},
3633
4690
  size: { default: "small" },
3634
- error: {}
4691
+ error: {},
4692
+ rowIndex: { default: 0 },
4693
+ editConfig: {}
3635
4694
  },
3636
4695
  emits: ["change"],
3637
4696
  setup(__props, { emit: __emit }) {
3638
4697
  const props = __props;
3639
4698
  const emit = __emit;
4699
+ const { applyFormat, wrapFormatListeners } = useEditFormat({
4700
+ column: props.column,
4701
+ editConfig: props.editConfig
4702
+ });
4703
+ const { currentValue, handleChange: handleValueChange } = useEditCellValue({
4704
+ value: props.value,
4705
+ onChange: (value) => {
4706
+ const formattedValue = applyFormat(value, "change");
4707
+ emit("change", formattedValue);
4708
+ },
4709
+ debounce: props.column.editDebounce || 0,
4710
+ // 从 column 配置中获取防抖延迟
4711
+ throttle: props.column.editThrottle || 0,
4712
+ // 从 column 配置中获取节流延迟
4713
+ deep: false
4714
+ // 智能深度监听由 hook 内部处理
4715
+ });
3640
4716
  const editComponent = computed(() => {
3641
4717
  if (!props.column.editComponent) {
3642
4718
  return getEditComponent("Input");
3643
4719
  }
3644
- return getEditComponent(props.column.editComponent);
4720
+ const component = getEditComponent(props.column.editComponent);
4721
+ if (!component) {
4722
+ console.warn(`[EditCell] 未找到编辑组件: ${props.column.editComponent},将使用默认 Input 组件`);
4723
+ return getEditComponent("Input");
4724
+ }
4725
+ return component;
3645
4726
  });
3646
- const componentProps = computed(() => {
3647
- let baseProps = {
3648
- placeholder: `请输入${props.column.title || ""}`
3649
- };
3650
- if (props.column.editComponentProps) {
3651
- if (typeof props.column.editComponentProps === "function") {
3652
- const dynamicProps = props.column.editComponentProps(props.record);
3653
- baseProps = { ...baseProps, ...dynamicProps };
3654
- } else {
3655
- baseProps = { ...baseProps, ...props.column.editComponentProps };
4727
+ const { listeners, mergedProps: baseProps } = useComponentProps({
4728
+ column: props.column,
4729
+ record: props.record,
4730
+ size: props.size,
4731
+ error: props.error
4732
+ });
4733
+ const mergedProps = computed(() => {
4734
+ const formatListeners = wrapFormatListeners(
4735
+ listeners.value,
4736
+ () => currentValue.value,
4737
+ (value) => {
4738
+ currentValue.value = value;
4739
+ emit("change", value);
3656
4740
  }
3657
- }
3658
- return baseProps;
4741
+ );
4742
+ return {
4743
+ ...baseProps.value,
4744
+ ...formatListeners
4745
+ };
3659
4746
  });
3660
4747
  const handleChange = (value) => {
3661
- emit("change", value);
4748
+ handleValueChange(value);
3662
4749
  };
4750
+ const customRenderContent = computed(() => {
4751
+ if (!props.column.editRender) {
4752
+ return null;
4753
+ }
4754
+ try {
4755
+ return props.column.editRender({
4756
+ record: props.record,
4757
+ column: props.column,
4758
+ rowIndex: props.rowIndex,
4759
+ value: currentValue.value,
4760
+ onChange: handleChange
4761
+ });
4762
+ } catch (error) {
4763
+ console.error("[EditCell] 自定义渲染函数执行出错:", error);
4764
+ return h("div", { style: { color: "var(--color-danger)" } }, "渲染出错");
4765
+ }
4766
+ });
3663
4767
  return (_ctx, _cache) => {
3664
4768
  return openBlock(), createElementBlock("div", _hoisted_1$3, [
3665
- (openBlock(), createBlock(resolveDynamicComponent(editComponent.value), mergeProps(componentProps.value, {
3666
- "model-value": __props.value,
4769
+ props.column.editRender ? (openBlock(), createBlock(resolveDynamicComponent(customRenderContent.value), { key: 0 })) : (openBlock(), createBlock(resolveDynamicComponent(editComponent.value), mergeProps({ key: 1 }, mergedProps.value, {
4770
+ "model-value": unref(currentValue),
3667
4771
  "onUpdate:modelValue": handleChange,
3668
- size: __props.size,
3669
- status: __props.error ? "error" : void 0,
3670
4772
  class: "edit-cell-input"
3671
- }), null, 16, ["model-value", "size", "status"])),
4773
+ }), null, 16, ["model-value"])),
3672
4774
  __props.error ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
3673
4775
  ]);
3674
4776
  };
3675
4777
  }
3676
4778
  });
3677
- const EditCell = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-3dab69d1"]]);
4779
+ const EditCell = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-52761074"]]);
3678
4780
  function useEditValidation() {
3679
4781
  const validateField = async (value, column, record) => {
3680
4782
  if (!column.editRule) {
@@ -3762,6 +4864,30 @@ function useEditValidation() {
3762
4864
  };
3763
4865
  }
3764
4866
  }
4867
+ if (rule.asyncValidator) {
4868
+ try {
4869
+ const result = await rule.asyncValidator(value, record);
4870
+ if (result === false) {
4871
+ return {
4872
+ valid: false,
4873
+ message: rule.message || `${label}验证失败`
4874
+ };
4875
+ }
4876
+ if (typeof result === "string") {
4877
+ return {
4878
+ valid: false,
4879
+ message: result
4880
+ };
4881
+ }
4882
+ return { valid: true };
4883
+ } catch (error) {
4884
+ console.error("[useEditValidation] asyncValidator error:", error);
4885
+ return {
4886
+ valid: false,
4887
+ message: rule.message || `${label}异步验证失败`
4888
+ };
4889
+ }
4890
+ }
3765
4891
  return { valid: true };
3766
4892
  };
3767
4893
  const validateRow = async (editValues, columns, record) => {
@@ -5303,10 +6429,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5303
6429
  key: 2,
5304
6430
  column: col,
5305
6431
  record: slotProps.record,
6432
+ "row-index": slotProps.rowIndex,
5306
6433
  value: unref(getEditValue)(slotProps.record, col),
5307
6434
  error: unref(getValidationError)(slotProps.record, col),
5308
6435
  onChange: (val) => unref(setEditValue)(slotProps.record, col, val)
5309
- }, null, 8, ["column", "record", "value", "error", "onChange"])) : _ctx.$slots[col.dataIndex] ? renderSlot(_ctx.$slots, col.dataIndex, normalizeProps(mergeProps({ key: 3 }, slotProps)), void 0, true) : col.customRender ? (openBlock(), createBlock(resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 4 })) : col.format ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [
6436
+ }, null, 8, ["column", "record", "row-index", "value", "error", "onChange"])) : _ctx.$slots[col.dataIndex] ? renderSlot(_ctx.$slots, col.dataIndex, normalizeProps(mergeProps({ key: 3 }, slotProps)), void 0, true) : col.customRender ? (openBlock(), createBlock(resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 4 })) : col.format ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [
5310
6437
  createTextVNode(toDisplayString(col.format(
5311
6438
  slotProps.record[col.dataIndex],
5312
6439
  slotProps.record,
@@ -5331,7 +6458,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5331
6458
  };
5332
6459
  }
5333
6460
  });
5334
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-587bcc14"]]);
6461
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-efd7cfc7"]]);
5335
6462
  function useTable(options = {}) {
5336
6463
  const tableRef = ref(null);
5337
6464
  const formRef = ref(null);
@@ -6497,6 +7624,229 @@ function isValidIdCard(idCard) {
6497
7624
  const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
6498
7625
  return idCardRegex.test(idCard);
6499
7626
  }
7627
+ function cloneWithFlag(obj, flagKey, flagValue) {
7628
+ return {
7629
+ ...obj,
7630
+ [flagKey]: flagValue
7631
+ };
7632
+ }
7633
+ function buildDataMap(data, uniqueKey, warnPrefix) {
7634
+ const map = /* @__PURE__ */ new Map();
7635
+ for (const item of data) {
7636
+ const key = item[uniqueKey];
7637
+ if (key === void 0 || key === null) {
7638
+ if (process.env.NODE_ENV !== "production" && warnPrefix) {
7639
+ console.warn(`[${warnPrefix}] 数据项缺少唯一标识字段 "${uniqueKey}":`, item);
7640
+ }
7641
+ continue;
7642
+ }
7643
+ if (map.has(key)) {
7644
+ if (process.env.NODE_ENV !== "production" && warnPrefix) {
7645
+ console.warn(`[${warnPrefix}] 检测到重复的 ${uniqueKey}: "${key}",后者将覆盖前者`);
7646
+ }
7647
+ }
7648
+ map.set(key, item);
7649
+ }
7650
+ return map;
7651
+ }
7652
+ function deepEqual(val1, val2) {
7653
+ if (val1 === val2) {
7654
+ return true;
7655
+ }
7656
+ if (typeof val1 === "number" && typeof val2 === "number" && isNaN(val1) && isNaN(val2)) {
7657
+ return true;
7658
+ }
7659
+ if (val1 === null || val2 === null) {
7660
+ return false;
7661
+ }
7662
+ if (val1 === void 0 || val2 === void 0) {
7663
+ return false;
7664
+ }
7665
+ if (typeof val1 !== typeof val2) {
7666
+ return false;
7667
+ }
7668
+ if (val1 instanceof Date && val2 instanceof Date) {
7669
+ return val1.getTime() === val2.getTime();
7670
+ }
7671
+ if (val1 instanceof RegExp && val2 instanceof RegExp) {
7672
+ return val1.toString() === val2.toString();
7673
+ }
7674
+ if (Array.isArray(val1) && Array.isArray(val2)) {
7675
+ if (val1.length !== val2.length) {
7676
+ return false;
7677
+ }
7678
+ for (let i = 0; i < val1.length; i++) {
7679
+ if (!deepEqual(val1[i], val2[i])) {
7680
+ return false;
7681
+ }
7682
+ }
7683
+ return true;
7684
+ }
7685
+ if (typeof val1 === "object" && typeof val2 === "object") {
7686
+ const keys1 = Object.keys(val1);
7687
+ const keys2 = Object.keys(val2);
7688
+ if (keys1.length !== keys2.length) {
7689
+ return false;
7690
+ }
7691
+ for (const key of keys1) {
7692
+ if (!keys2.includes(key)) {
7693
+ return false;
7694
+ }
7695
+ if (!deepEqual(val1[key], val2[key])) {
7696
+ return false;
7697
+ }
7698
+ }
7699
+ return true;
7700
+ }
7701
+ return val1 === val2;
7702
+ }
7703
+ function isObjectEqual(obj1, obj2, options) {
7704
+ const { depth, fields, excludeKeys = [] } = options;
7705
+ let keysToCompare;
7706
+ if (fields && fields.length > 0) {
7707
+ keysToCompare = fields;
7708
+ } else {
7709
+ const allKeys = /* @__PURE__ */ new Set([
7710
+ ...Object.keys(obj1),
7711
+ ...Object.keys(obj2)
7712
+ ]);
7713
+ keysToCompare = Array.from(allKeys).filter(
7714
+ (key) => !excludeKeys.includes(key)
7715
+ );
7716
+ }
7717
+ for (const key of keysToCompare) {
7718
+ const val1 = obj1[key];
7719
+ const val2 = obj2[key];
7720
+ if (val1 === val2) {
7721
+ continue;
7722
+ }
7723
+ if (val1 === null || val1 === void 0 || val2 === null || val2 === void 0) {
7724
+ return false;
7725
+ }
7726
+ const type1 = typeof val1;
7727
+ const type2 = typeof val2;
7728
+ if (type1 !== type2) {
7729
+ return false;
7730
+ }
7731
+ if (type1 === "object") {
7732
+ if (depth === "shallow") {
7733
+ if (val1 instanceof Date && val2 instanceof Date) {
7734
+ if (val1.getTime() !== val2.getTime()) {
7735
+ return false;
7736
+ }
7737
+ } else if (val1 instanceof RegExp && val2 instanceof RegExp) {
7738
+ if (val1.toString() !== val2.toString()) {
7739
+ return false;
7740
+ }
7741
+ } else if (Array.isArray(val1) && Array.isArray(val2)) {
7742
+ if (val1.length !== val2.length) {
7743
+ return false;
7744
+ }
7745
+ for (let i = 0; i < val1.length; i++) {
7746
+ if (val1[i] !== val2[i]) {
7747
+ return false;
7748
+ }
7749
+ }
7750
+ } else if (val1 !== val2) {
7751
+ return false;
7752
+ }
7753
+ } else {
7754
+ if (!deepEqual(val1, val2)) {
7755
+ return false;
7756
+ }
7757
+ }
7758
+ } else {
7759
+ if (val1 !== val2) {
7760
+ return false;
7761
+ }
7762
+ }
7763
+ }
7764
+ return true;
7765
+ }
7766
+ function compareObjects(obj1, obj2, options) {
7767
+ const { depth = "shallow", compareFields, excludeKeys = [] } = options || {};
7768
+ return isObjectEqual(obj1, obj2, {
7769
+ depth,
7770
+ fields: compareFields,
7771
+ excludeKeys
7772
+ });
7773
+ }
7774
+ function diffArrays(original, current, options) {
7775
+ return {
7776
+ deleted: findDeleted(original, current, options),
7777
+ modified: findModified(original, current, options),
7778
+ added: findAdded(original, current, options)
7779
+ };
7780
+ }
7781
+ function findDeleted(original, current, options) {
7782
+ const {
7783
+ uniqueKey = "id",
7784
+ deletedFlag = "delFlag",
7785
+ deletedFlagValue = 1
7786
+ } = options || {};
7787
+ if (!original || !Array.isArray(original)) {
7788
+ return [];
7789
+ }
7790
+ if (!current || !Array.isArray(current)) {
7791
+ return original.map((item) => cloneWithFlag(item, deletedFlag, deletedFlagValue));
7792
+ }
7793
+ const currentMap = buildDataMap(current, uniqueKey);
7794
+ const deleted = [];
7795
+ const originalMap = buildDataMap(original, uniqueKey, "findDeleted");
7796
+ for (const [key, item] of originalMap) {
7797
+ if (!currentMap.has(key)) {
7798
+ deleted.push(cloneWithFlag(item, deletedFlag, deletedFlagValue));
7799
+ }
7800
+ }
7801
+ return deleted;
7802
+ }
7803
+ function findModified(original, current, options) {
7804
+ const {
7805
+ uniqueKey = "id",
7806
+ compareDepth = "shallow",
7807
+ compareFields,
7808
+ excludeKeys = []
7809
+ } = options || {};
7810
+ if (!original || !Array.isArray(original) || !current || !Array.isArray(current)) {
7811
+ return [];
7812
+ }
7813
+ const excludeKeysWithUnique = [...excludeKeys, uniqueKey];
7814
+ const originalMap = buildDataMap(original, uniqueKey);
7815
+ const currentMap = buildDataMap(current, uniqueKey);
7816
+ const modified = [];
7817
+ for (const [key, originalItem] of originalMap) {
7818
+ const currentItem = currentMap.get(key);
7819
+ if (currentItem) {
7820
+ const isEqual = isObjectEqual(originalItem, currentItem, {
7821
+ depth: compareDepth,
7822
+ fields: compareFields,
7823
+ excludeKeys: excludeKeysWithUnique
7824
+ });
7825
+ if (!isEqual) {
7826
+ modified.push(currentItem);
7827
+ }
7828
+ }
7829
+ }
7830
+ return modified;
7831
+ }
7832
+ function findAdded(original, current, options) {
7833
+ const { uniqueKey = "id" } = options || {};
7834
+ if (!current || !Array.isArray(current)) {
7835
+ return [];
7836
+ }
7837
+ if (!original || !Array.isArray(original)) {
7838
+ return [...current];
7839
+ }
7840
+ const originalMap = buildDataMap(original, uniqueKey);
7841
+ const currentMap = buildDataMap(current, uniqueKey, "findAdded");
7842
+ const added = [];
7843
+ for (const [key, item] of currentMap) {
7844
+ if (!originalMap.has(key)) {
7845
+ added.push(item);
7846
+ }
7847
+ }
7848
+ return added;
7849
+ }
6500
7850
  function useDebounce(value, delay = 300) {
6501
7851
  const debouncedValue = ref(value.value);
6502
7852
  let timer = null;
@@ -6539,19 +7889,37 @@ export {
6539
7889
  BasicDescription,
6540
7890
  _sfc_main$5 as BasicForm,
6541
7891
  BasicModal,
7892
+ BasicReadonlyField,
6542
7893
  BasicTable,
6543
7894
  BasicTextEllipsis,
6544
7895
  BasicUpload,
6545
7896
  VideoPreview,
6546
7897
  VideoPreviewModal,
7898
+ classifyFiles,
7899
+ compareObjects,
6547
7900
  componentMap,
6548
7901
  createFormSchema,
6549
7902
  createTableColumns,
6550
7903
  debounce,
7904
+ diffArrays,
7905
+ findAdded,
7906
+ findDeleted,
7907
+ findModified,
7908
+ formatBoolean,
7909
+ formatCascaderPath,
6551
7910
  formatDate,
6552
7911
  formatFileSize,
6553
7912
  formatNumber,
7913
+ formatDate$1 as formatReadonlyFieldDate,
7914
+ getCascaderLabels,
6554
7915
  getComponent,
7916
+ getFileName,
7917
+ getFileUrl,
7918
+ getLabelFromOptions,
7919
+ getLabelFromTreeData,
7920
+ getLabelsFromOptions,
7921
+ getRenderer,
7922
+ isImageFile,
6555
7923
  isValidEmail,
6556
7924
  isValidIdCard,
6557
7925
  isValidPhone,
@@ -6559,6 +7927,8 @@ export {
6559
7927
  mergeFormSchemas,
6560
7928
  mergeTableColumns,
6561
7929
  registerComponent,
7930
+ rendererMap,
7931
+ safeToString,
6562
7932
  throttle,
6563
7933
  useDebounce,
6564
7934
  useDescription,
@@ -6566,6 +7936,7 @@ export {
6566
7936
  useLocalStorage,
6567
7937
  useModal,
6568
7938
  useModalInner,
7939
+ useReadonlyField,
6569
7940
  useTable,
6570
7941
  useToggle,
6571
7942
  useUpload