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