knt-shared 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Description/types.d.ts +2 -2
- package/dist/components/Description/types.d.ts.map +1 -1
- package/dist/components/Form/BasicForm.vue.d.ts +173 -0
- package/dist/components/Form/BasicForm.vue.d.ts.map +1 -0
- package/dist/components/Form/componentMap.d.ts +3 -8
- package/dist/components/Form/componentMap.d.ts.map +1 -1
- package/dist/components/Form/index.d.ts +5 -7
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/types.d.ts +11 -4
- package/dist/components/Form/types.d.ts.map +1 -1
- package/dist/components/Table/BasicTable.vue.d.ts +20 -0
- package/dist/components/Table/BasicTable.vue.d.ts.map +1 -1
- package/dist/components/Table/components/EditCell.vue.d.ts +45 -0
- package/dist/components/Table/components/EditCell.vue.d.ts.map +1 -0
- package/dist/components/Table/components/componentMap.d.ts +1299 -0
- package/dist/components/Table/components/componentMap.d.ts.map +1 -0
- package/dist/components/Table/hooks/useEditValidation.d.ts +18 -0
- package/dist/components/Table/hooks/useEditValidation.d.ts.map +1 -0
- package/dist/components/Table/hooks/useTableEdit.d.ts +27 -0
- package/dist/components/Table/hooks/useTableEdit.d.ts.map +1 -0
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/types.d.ts +120 -6
- package/dist/components/Table/types.d.ts.map +1 -1
- package/dist/components/Table/useTable.d.ts.map +1 -1
- package/dist/components/TextEllipsis/BasicTextEllipsis.vue.d.ts +43 -0
- package/dist/components/TextEllipsis/BasicTextEllipsis.vue.d.ts.map +1 -0
- package/dist/components/TextEllipsis/index.d.ts +6 -0
- package/dist/components/TextEllipsis/index.d.ts.map +1 -0
- package/dist/components/TextEllipsis/types.d.ts +18 -0
- package/dist/components/TextEllipsis/types.d.ts.map +1 -0
- package/dist/components/Upload/BasicUpload.vue.d.ts +1 -1
- package/dist/components/Upload/types.d.ts +3 -3
- package/dist/components/Upload/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 +1072 -279
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1072 -279
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +52 -31
- package/dist/types/global.d.ts +2 -2
- package/dist/types/global.d.ts.map +1 -1
- package/package.json +2 -2
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$e = vue.defineComponent({
|
|
28
28
|
name: "IconPlus",
|
|
29
29
|
props: {
|
|
30
30
|
size: {
|
|
@@ -77,7 +77,7 @@ const _sfc_main$c = vue.defineComponent({
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
|
-
const _hoisted_1$
|
|
80
|
+
const _hoisted_1$d = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
81
81
|
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
82
82
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
83
83
|
viewBox: "0 0 48 48",
|
|
@@ -92,9 +92,9 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
92
92
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
93
93
|
}, _cache[1] || (_cache[1] = [
|
|
94
94
|
vue.createElementVNode("path", { d: "M5 24h38M24 5v38" }, null, -1)
|
|
95
|
-
]), 14, _hoisted_1$
|
|
95
|
+
]), 14, _hoisted_1$d);
|
|
96
96
|
}
|
|
97
|
-
var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
97
|
+
var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$7]]);
|
|
98
98
|
const IconPlus = Object.assign(_IconPlus, {
|
|
99
99
|
install: (app, options) => {
|
|
100
100
|
var _a;
|
|
@@ -102,7 +102,7 @@ const IconPlus = Object.assign(_IconPlus, {
|
|
|
102
102
|
app.component(iconPrefix + _IconPlus.name, _IconPlus);
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
const _sfc_main$
|
|
105
|
+
const _sfc_main$d = vue.defineComponent({
|
|
106
106
|
name: "IconQuestionCircle",
|
|
107
107
|
props: {
|
|
108
108
|
size: {
|
|
@@ -155,7 +155,7 @@ const _sfc_main$b = vue.defineComponent({
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
const _hoisted_1$
|
|
158
|
+
const _hoisted_1$c = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
159
159
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
160
160
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
161
161
|
viewBox: "0 0 48 48",
|
|
@@ -171,9 +171,9 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
171
171
|
}, _cache[1] || (_cache[1] = [
|
|
172
172
|
vue.createElementVNode("path", { d: "M42 24c0 9.941-8.059 18-18 18S6 33.941 6 24 14.059 6 24 6s18 8.059 18 18Z" }, null, -1),
|
|
173
173
|
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)
|
|
174
|
-
]), 14, _hoisted_1$
|
|
174
|
+
]), 14, _hoisted_1$c);
|
|
175
175
|
}
|
|
176
|
-
var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
176
|
+
var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$6]]);
|
|
177
177
|
const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
|
|
178
178
|
install: (app, options) => {
|
|
179
179
|
var _a;
|
|
@@ -181,7 +181,7 @@ const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
|
|
|
181
181
|
app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
-
const _sfc_main$
|
|
184
|
+
const _sfc_main$c = vue.defineComponent({
|
|
185
185
|
name: "IconRefresh",
|
|
186
186
|
props: {
|
|
187
187
|
size: {
|
|
@@ -234,7 +234,7 @@ const _sfc_main$a = vue.defineComponent({
|
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
});
|
|
237
|
-
const _hoisted_1$
|
|
237
|
+
const _hoisted_1$b = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
238
238
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
239
239
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
240
240
|
viewBox: "0 0 48 48",
|
|
@@ -249,9 +249,9 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
249
249
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
250
250
|
}, _cache[1] || (_cache[1] = [
|
|
251
251
|
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)
|
|
252
|
-
]), 14, _hoisted_1$
|
|
252
|
+
]), 14, _hoisted_1$b);
|
|
253
253
|
}
|
|
254
|
-
var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
254
|
+
var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$5]]);
|
|
255
255
|
const IconRefresh = Object.assign(_IconRefresh, {
|
|
256
256
|
install: (app, options) => {
|
|
257
257
|
var _a;
|
|
@@ -259,7 +259,7 @@ const IconRefresh = Object.assign(_IconRefresh, {
|
|
|
259
259
|
app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
|
-
const _sfc_main$
|
|
262
|
+
const _sfc_main$b = vue.defineComponent({
|
|
263
263
|
name: "IconSettings",
|
|
264
264
|
props: {
|
|
265
265
|
size: {
|
|
@@ -312,7 +312,7 @@ const _sfc_main$9 = vue.defineComponent({
|
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
|
-
const _hoisted_1$
|
|
315
|
+
const _hoisted_1$a = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
316
316
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
317
317
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
318
318
|
viewBox: "0 0 48 48",
|
|
@@ -328,9 +328,9 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
328
328
|
}, _cache[1] || (_cache[1] = [
|
|
329
329
|
vue.createElementVNode("path", { d: "M18.797 6.732A1 1 0 0 1 19.76 6h8.48a1 1 0 0 1 .964.732l1.285 4.628a1 1 0 0 0 1.213.7l4.651-1.2a1 1 0 0 1 1.116.468l4.24 7.344a1 1 0 0 1-.153 1.2L38.193 23.3a1 1 0 0 0 0 1.402l3.364 3.427a1 1 0 0 1 .153 1.2l-4.24 7.344a1 1 0 0 1-1.116.468l-4.65-1.2a1 1 0 0 0-1.214.7l-1.285 4.628a1 1 0 0 1-.964.732h-8.48a1 1 0 0 1-.963-.732L17.51 36.64a1 1 0 0 0-1.213-.7l-4.65 1.2a1 1 0 0 1-1.116-.468l-4.24-7.344a1 1 0 0 1 .153-1.2L9.809 24.7a1 1 0 0 0 0-1.402l-3.364-3.427a1 1 0 0 1-.153-1.2l4.24-7.344a1 1 0 0 1 1.116-.468l4.65 1.2a1 1 0 0 0 1.213-.7l1.286-4.628Z" }, null, -1),
|
|
330
330
|
vue.createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
|
|
331
|
-
]), 14, _hoisted_1$
|
|
331
|
+
]), 14, _hoisted_1$a);
|
|
332
332
|
}
|
|
333
|
-
var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
333
|
+
var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$4]]);
|
|
334
334
|
const IconSettings = Object.assign(_IconSettings, {
|
|
335
335
|
install: (app, options) => {
|
|
336
336
|
var _a;
|
|
@@ -338,7 +338,7 @@ const IconSettings = Object.assign(_IconSettings, {
|
|
|
338
338
|
app.component(iconPrefix + _IconSettings.name, _IconSettings);
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
|
-
const _sfc_main$
|
|
341
|
+
const _sfc_main$a = vue.defineComponent({
|
|
342
342
|
name: "IconUpload",
|
|
343
343
|
props: {
|
|
344
344
|
size: {
|
|
@@ -391,7 +391,7 @@ const _sfc_main$8 = vue.defineComponent({
|
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
393
|
});
|
|
394
|
-
const _hoisted_1$
|
|
394
|
+
const _hoisted_1$9 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
395
395
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
396
396
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
397
397
|
viewBox: "0 0 48 48",
|
|
@@ -406,9 +406,9 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
406
406
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
407
407
|
}, _cache[1] || (_cache[1] = [
|
|
408
408
|
vue.createElementVNode("path", { d: "M14.93 17.071 24.001 8l9.071 9.071m-9.07 16.071v-25M40 35v6H8v-6" }, null, -1)
|
|
409
|
-
]), 14, _hoisted_1$
|
|
409
|
+
]), 14, _hoisted_1$9);
|
|
410
410
|
}
|
|
411
|
-
var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
411
|
+
var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$3]]);
|
|
412
412
|
const IconUpload = Object.assign(_IconUpload, {
|
|
413
413
|
install: (app, options) => {
|
|
414
414
|
var _a;
|
|
@@ -416,7 +416,7 @@ const IconUpload = Object.assign(_IconUpload, {
|
|
|
416
416
|
app.component(iconPrefix + _IconUpload.name, _IconUpload);
|
|
417
417
|
}
|
|
418
418
|
});
|
|
419
|
-
const _sfc_main$
|
|
419
|
+
const _sfc_main$9 = vue.defineComponent({
|
|
420
420
|
name: "IconLineHeight",
|
|
421
421
|
props: {
|
|
422
422
|
size: {
|
|
@@ -469,7 +469,7 @@ const _sfc_main$7 = vue.defineComponent({
|
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
|
-
const _hoisted_1$
|
|
472
|
+
const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
473
473
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
474
474
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
475
475
|
viewBox: "0 0 48 48",
|
|
@@ -490,9 +490,9 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
490
490
|
stroke: "none"
|
|
491
491
|
}, null, -1),
|
|
492
492
|
vue.createElementVNode("path", { d: "M39 13h2l-2-3.5-2 3.5h2Zm0 0v22m0 0h2l-2 3.5-2-3.5h2Z" }, null, -1)
|
|
493
|
-
]), 14, _hoisted_1$
|
|
493
|
+
]), 14, _hoisted_1$8);
|
|
494
494
|
}
|
|
495
|
-
var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
495
|
+
var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$2]]);
|
|
496
496
|
const IconLineHeight = Object.assign(_IconLineHeight, {
|
|
497
497
|
install: (app, options) => {
|
|
498
498
|
var _a;
|
|
@@ -500,7 +500,7 @@ const IconLineHeight = Object.assign(_IconLineHeight, {
|
|
|
500
500
|
app.component(iconPrefix + _IconLineHeight.name, _IconLineHeight);
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
|
-
const _sfc_main$
|
|
503
|
+
const _sfc_main$8 = vue.defineComponent({
|
|
504
504
|
name: "IconFullscreenExit",
|
|
505
505
|
props: {
|
|
506
506
|
size: {
|
|
@@ -553,7 +553,7 @@ const _sfc_main$6 = vue.defineComponent({
|
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
|
-
const _hoisted_1$
|
|
556
|
+
const _hoisted_1$7 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
557
557
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
558
558
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
559
559
|
viewBox: "0 0 48 48",
|
|
@@ -568,9 +568,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
568
568
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
569
569
|
}, _cache[1] || (_cache[1] = [
|
|
570
570
|
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)
|
|
571
|
-
]), 14, _hoisted_1$
|
|
571
|
+
]), 14, _hoisted_1$7);
|
|
572
572
|
}
|
|
573
|
-
var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
573
|
+
var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$1]]);
|
|
574
574
|
const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
|
|
575
575
|
install: (app, options) => {
|
|
576
576
|
var _a;
|
|
@@ -578,7 +578,7 @@ const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
|
|
|
578
578
|
app.component(iconPrefix + _IconFullscreenExit.name, _IconFullscreenExit);
|
|
579
579
|
}
|
|
580
580
|
});
|
|
581
|
-
const _sfc_main$
|
|
581
|
+
const _sfc_main$7 = vue.defineComponent({
|
|
582
582
|
name: "IconFullscreen",
|
|
583
583
|
props: {
|
|
584
584
|
size: {
|
|
@@ -631,7 +631,7 @@ const _sfc_main$5 = vue.defineComponent({
|
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
|
-
const _hoisted_1$
|
|
634
|
+
const _hoisted_1$6 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
635
635
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
636
636
|
return vue.openBlock(), vue.createElementBlock("svg", {
|
|
637
637
|
viewBox: "0 0 48 48",
|
|
@@ -646,9 +646,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
646
646
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
647
647
|
}, _cache[1] || (_cache[1] = [
|
|
648
648
|
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)
|
|
649
|
-
]), 14, _hoisted_1$
|
|
649
|
+
]), 14, _hoisted_1$6);
|
|
650
650
|
}
|
|
651
|
-
var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$
|
|
651
|
+
var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render]]);
|
|
652
652
|
const IconFullscreen = Object.assign(_IconFullscreen, {
|
|
653
653
|
install: (app, options) => {
|
|
654
654
|
var _a;
|
|
@@ -656,13 +656,13 @@ const IconFullscreen = Object.assign(_IconFullscreen, {
|
|
|
656
656
|
app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
|
|
657
657
|
}
|
|
658
658
|
});
|
|
659
|
-
const _hoisted_1$
|
|
660
|
-
const _hoisted_2$
|
|
659
|
+
const _hoisted_1$5 = { class: "basic-upload" };
|
|
660
|
+
const _hoisted_2$4 = {
|
|
661
661
|
key: 0,
|
|
662
662
|
class: "upload-text"
|
|
663
663
|
};
|
|
664
664
|
const _hoisted_3$2 = { class: "upload-tip" };
|
|
665
|
-
const _sfc_main$
|
|
665
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
666
666
|
...{
|
|
667
667
|
name: "BasicUpload",
|
|
668
668
|
inheritAttrs: false
|
|
@@ -711,7 +711,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
711
711
|
emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
|
|
712
712
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
713
713
|
vue.useCssVars((_ctx) => ({
|
|
714
|
-
"
|
|
714
|
+
"f530bac6": cardSizeValue.value
|
|
715
715
|
}));
|
|
716
716
|
const props = __props;
|
|
717
717
|
const emit = __emit;
|
|
@@ -943,7 +943,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
943
943
|
fileListRef.value = fileList;
|
|
944
944
|
emit("change", fileList);
|
|
945
945
|
const isRemove = newLength < oldLength;
|
|
946
|
-
const fileKey = currentFile.uid
|
|
946
|
+
const fileKey = currentFile.uid || `file-${Date.now()}-${Math.random()}`;
|
|
947
947
|
const lastStatus = processedFiles.value.get(fileKey);
|
|
948
948
|
if (currentFile.status === "done" && lastStatus !== "done" && !isRemove) {
|
|
949
949
|
processedFiles.value.set(fileKey, "done");
|
|
@@ -1106,7 +1106,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1106
1106
|
return (_ctx, _cache) => {
|
|
1107
1107
|
const _component_a_button = vue.resolveComponent("a-button");
|
|
1108
1108
|
const _component_a_upload = vue.resolveComponent("a-upload");
|
|
1109
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1109
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
1110
1110
|
vue.createVNode(_component_a_upload, vue.mergeProps({
|
|
1111
1111
|
ref_key: "uploadRef",
|
|
1112
1112
|
ref: uploadRef
|
|
@@ -1131,7 +1131,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1131
1131
|
})
|
|
1132
1132
|
}, [
|
|
1133
1133
|
vue.createVNode(vue.unref(IconPlus), { size: 16 }),
|
|
1134
|
-
getProps.value.uploadButtonText ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
1134
|
+
getProps.value.uploadButtonText ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, vue.toDisplayString(getProps.value.uploadButtonText), 1)) : vue.createCommentVNode("", true)
|
|
1135
1135
|
], 4)) : (vue.openBlock(), vue.createBlock(_component_a_button, {
|
|
1136
1136
|
key: 1,
|
|
1137
1137
|
type: getProps.value.uploadButtonType || "primary"
|
|
@@ -1183,7 +1183,103 @@ const _export_sfc = (sfc, props) => {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
return target;
|
|
1185
1185
|
};
|
|
1186
|
-
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1186
|
+
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-03d56780"]]);
|
|
1187
|
+
function useUpload(props) {
|
|
1188
|
+
const uploadRef = vue.ref(null);
|
|
1189
|
+
const fileListRef = vue.ref((props == null ? void 0 : props.defaultFileList) || []);
|
|
1190
|
+
const register = (uploadInstance) => {
|
|
1191
|
+
uploadRef.value = uploadInstance;
|
|
1192
|
+
if ((props == null ? void 0 : props.defaultFileList) && props.defaultFileList.length > 0) {
|
|
1193
|
+
uploadInstance.setFileList(props.defaultFileList);
|
|
1194
|
+
}
|
|
1195
|
+
if (props && Object.keys(props).length > 0) {
|
|
1196
|
+
const { defaultFileList, ...restProps } = props;
|
|
1197
|
+
if (Object.keys(restProps).length > 0) {
|
|
1198
|
+
setProps(restProps);
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
const getUpload = () => {
|
|
1203
|
+
const upload2 = vue.unref(uploadRef);
|
|
1204
|
+
if (!upload2) {
|
|
1205
|
+
throw new Error('Upload 实例未注册,请确保在组件上使用 @register="register"');
|
|
1206
|
+
}
|
|
1207
|
+
return upload2;
|
|
1208
|
+
};
|
|
1209
|
+
const submit = () => {
|
|
1210
|
+
getUpload().submit();
|
|
1211
|
+
};
|
|
1212
|
+
const abort = (fileItem) => {
|
|
1213
|
+
getUpload().abort(fileItem);
|
|
1214
|
+
};
|
|
1215
|
+
const clearFiles = () => {
|
|
1216
|
+
getUpload().clearFiles();
|
|
1217
|
+
fileListRef.value = [];
|
|
1218
|
+
};
|
|
1219
|
+
const getFileList = () => {
|
|
1220
|
+
return getUpload().getFileList();
|
|
1221
|
+
};
|
|
1222
|
+
const upload = (fileItem) => {
|
|
1223
|
+
getUpload().upload(fileItem);
|
|
1224
|
+
};
|
|
1225
|
+
const setFileList = (files) => {
|
|
1226
|
+
fileListRef.value = files;
|
|
1227
|
+
const upload2 = getUpload();
|
|
1228
|
+
if (upload2.setFileList) {
|
|
1229
|
+
upload2.setFileList(files);
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
const addFile = (file) => {
|
|
1233
|
+
fileListRef.value.push(file);
|
|
1234
|
+
const upload2 = getUpload();
|
|
1235
|
+
if (upload2.addFile) {
|
|
1236
|
+
upload2.addFile(file);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
const removeFile = (fileItem) => {
|
|
1240
|
+
const index = fileListRef.value.findIndex(
|
|
1241
|
+
(item) => item.uid === fileItem.uid
|
|
1242
|
+
);
|
|
1243
|
+
if (index !== -1) {
|
|
1244
|
+
fileListRef.value.splice(index, 1);
|
|
1245
|
+
}
|
|
1246
|
+
const upload2 = getUpload();
|
|
1247
|
+
if (upload2.removeFile) {
|
|
1248
|
+
upload2.removeFile(fileItem);
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
const updateFile = (fileItem) => {
|
|
1252
|
+
const index = fileListRef.value.findIndex(
|
|
1253
|
+
(item) => item.uid === fileItem.uid
|
|
1254
|
+
);
|
|
1255
|
+
if (index !== -1) {
|
|
1256
|
+
fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
|
|
1257
|
+
}
|
|
1258
|
+
const upload2 = getUpload();
|
|
1259
|
+
if (upload2.updateFile) {
|
|
1260
|
+
upload2.updateFile(fileItem);
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
const setProps = (uploadProps) => {
|
|
1264
|
+
getUpload().setProps(uploadProps);
|
|
1265
|
+
};
|
|
1266
|
+
const methods = {
|
|
1267
|
+
get fileList() {
|
|
1268
|
+
return fileListRef.value;
|
|
1269
|
+
},
|
|
1270
|
+
submit,
|
|
1271
|
+
abort,
|
|
1272
|
+
upload,
|
|
1273
|
+
clearFiles,
|
|
1274
|
+
getFileList,
|
|
1275
|
+
setFileList,
|
|
1276
|
+
addFile,
|
|
1277
|
+
removeFile,
|
|
1278
|
+
updateFile,
|
|
1279
|
+
setProps
|
|
1280
|
+
};
|
|
1281
|
+
return [register, methods];
|
|
1282
|
+
}
|
|
1187
1283
|
const componentMap = {
|
|
1188
1284
|
Input: webVue.Input,
|
|
1189
1285
|
InputNumber: webVue.InputNumber,
|
|
@@ -1257,7 +1353,7 @@ function getRules(component, label) {
|
|
|
1257
1353
|
}
|
|
1258
1354
|
return [{ required: true, message: `请选择${label}` }];
|
|
1259
1355
|
}
|
|
1260
|
-
const _sfc_main$
|
|
1356
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
1261
1357
|
...{
|
|
1262
1358
|
name: "BasicForm",
|
|
1263
1359
|
inheritAttrs: false
|
|
@@ -1390,6 +1486,29 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1390
1486
|
const componentType = typeof schema.component === "string" ? schema.component : "";
|
|
1391
1487
|
return getPlaceholder(componentType, schema.label);
|
|
1392
1488
|
};
|
|
1489
|
+
const shouldRenderCustomLabel = (schema) => {
|
|
1490
|
+
return !!(schema.labelEllipsis || schema.labelTooltip);
|
|
1491
|
+
};
|
|
1492
|
+
const getLabelStyle = (schema) => {
|
|
1493
|
+
if (!schema.labelEllipsis) {
|
|
1494
|
+
return {};
|
|
1495
|
+
}
|
|
1496
|
+
const maxWidth = schema.labelMaxWidth || "150px";
|
|
1497
|
+
return {
|
|
1498
|
+
display: "inline-block",
|
|
1499
|
+
maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth,
|
|
1500
|
+
overflow: "hidden",
|
|
1501
|
+
textOverflow: "ellipsis",
|
|
1502
|
+
whiteSpace: "nowrap",
|
|
1503
|
+
verticalAlign: "middle"
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
const getLabelTooltipContent = (schema) => {
|
|
1507
|
+
if (typeof schema.labelTooltip === "string") {
|
|
1508
|
+
return schema.labelTooltip;
|
|
1509
|
+
}
|
|
1510
|
+
return schema.label;
|
|
1511
|
+
};
|
|
1393
1512
|
const handleSubmit = async (data) => {
|
|
1394
1513
|
try {
|
|
1395
1514
|
submitLoading.value = true;
|
|
@@ -1553,6 +1672,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1553
1672
|
dynamicProps.value = {};
|
|
1554
1673
|
});
|
|
1555
1674
|
return (_ctx, _cache) => {
|
|
1675
|
+
const _component_a_tooltip = vue.resolveComponent("a-tooltip");
|
|
1556
1676
|
const _component_a_form_item = vue.resolveComponent("a-form-item");
|
|
1557
1677
|
const _component_a_col = vue.resolveComponent("a-col");
|
|
1558
1678
|
const _component_a_button = vue.resolveComponent("a-button");
|
|
@@ -1580,7 +1700,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1580
1700
|
schema.render ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(schema.render(schema, formModel)), { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_a_form_item, vue.mergeProps({
|
|
1581
1701
|
key: 1,
|
|
1582
1702
|
ref_for: true
|
|
1583
|
-
}, getFormItemBindValue(schema)), {
|
|
1703
|
+
}, getFormItemBindValue(schema)), vue.createSlots({
|
|
1584
1704
|
default: vue.withCtx(() => [
|
|
1585
1705
|
schema.slotName ? vue.renderSlot(_ctx.$slots, schema.slotName, {
|
|
1586
1706
|
key: 0,
|
|
@@ -1594,7 +1714,28 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1594
1714
|
}, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
|
|
1595
1715
|
]),
|
|
1596
1716
|
_: 2
|
|
1597
|
-
},
|
|
1717
|
+
}, [
|
|
1718
|
+
shouldRenderCustomLabel(schema) ? {
|
|
1719
|
+
name: "label",
|
|
1720
|
+
fn: vue.withCtx(() => [
|
|
1721
|
+
schema.labelTooltip ? (vue.openBlock(), vue.createBlock(_component_a_tooltip, {
|
|
1722
|
+
key: 0,
|
|
1723
|
+
content: getLabelTooltipContent(schema)
|
|
1724
|
+
}, {
|
|
1725
|
+
default: vue.withCtx(() => [
|
|
1726
|
+
vue.createElementVNode("span", {
|
|
1727
|
+
style: vue.normalizeStyle(getLabelStyle(schema))
|
|
1728
|
+
}, vue.toDisplayString(schema.label), 5)
|
|
1729
|
+
]),
|
|
1730
|
+
_: 2
|
|
1731
|
+
}, 1032, ["content"])) : (vue.openBlock(), vue.createElementBlock("span", {
|
|
1732
|
+
key: 1,
|
|
1733
|
+
style: vue.normalizeStyle(getLabelStyle(schema))
|
|
1734
|
+
}, vue.toDisplayString(schema.label), 5))
|
|
1735
|
+
]),
|
|
1736
|
+
key: "0"
|
|
1737
|
+
} : void 0
|
|
1738
|
+
]), 1040))
|
|
1598
1739
|
]),
|
|
1599
1740
|
_: 2
|
|
1600
1741
|
}, 1040, ["data-field"]);
|
|
@@ -1911,69 +2052,635 @@ function debounce(func, wait = 300, immediate = false) {
|
|
|
1911
2052
|
if (callNow) {
|
|
1912
2053
|
func.apply(context, args);
|
|
1913
2054
|
}
|
|
1914
|
-
};
|
|
1915
|
-
debounced.cancel = () => {
|
|
1916
|
-
if (timeout) {
|
|
1917
|
-
clearTimeout(timeout);
|
|
1918
|
-
timeout = null;
|
|
2055
|
+
};
|
|
2056
|
+
debounced.cancel = () => {
|
|
2057
|
+
if (timeout) {
|
|
2058
|
+
clearTimeout(timeout);
|
|
2059
|
+
timeout = null;
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
return debounced;
|
|
2063
|
+
}
|
|
2064
|
+
function throttle(func, wait = 300) {
|
|
2065
|
+
let timeout = null;
|
|
2066
|
+
let previous = 0;
|
|
2067
|
+
return function(...args) {
|
|
2068
|
+
const context = this;
|
|
2069
|
+
const now = Date.now();
|
|
2070
|
+
const remaining = wait - (now - previous);
|
|
2071
|
+
if (remaining <= 0 || remaining > wait) {
|
|
2072
|
+
if (timeout) {
|
|
2073
|
+
clearTimeout(timeout);
|
|
2074
|
+
timeout = null;
|
|
2075
|
+
}
|
|
2076
|
+
previous = now;
|
|
2077
|
+
func.apply(context, args);
|
|
2078
|
+
} else if (!timeout) {
|
|
2079
|
+
timeout = setTimeout(() => {
|
|
2080
|
+
previous = Date.now();
|
|
2081
|
+
timeout = null;
|
|
2082
|
+
func.apply(context, args);
|
|
2083
|
+
}, remaining);
|
|
2084
|
+
}
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
const _hoisted_1$4 = { class: "basic-text-ellipsis" };
|
|
2088
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
2089
|
+
__name: "BasicTextEllipsis",
|
|
2090
|
+
props: {
|
|
2091
|
+
text: { default: "" },
|
|
2092
|
+
lines: { default: 1 },
|
|
2093
|
+
tooltip: { type: Boolean, default: true },
|
|
2094
|
+
tooltipTrigger: { default: "hover" },
|
|
2095
|
+
tooltipProps: { default: () => ({}) },
|
|
2096
|
+
alwaysShowTooltip: { type: Boolean, default: false }
|
|
2097
|
+
},
|
|
2098
|
+
setup(__props) {
|
|
2099
|
+
const props = __props;
|
|
2100
|
+
const textRef = vue.ref();
|
|
2101
|
+
const isTruncated = vue.ref(false);
|
|
2102
|
+
let resizeObserver = null;
|
|
2103
|
+
const ellipsisStyle = vue.computed(() => {
|
|
2104
|
+
if (props.lines === 1) {
|
|
2105
|
+
return {
|
|
2106
|
+
overflow: "hidden",
|
|
2107
|
+
textOverflow: "ellipsis",
|
|
2108
|
+
whiteSpace: "nowrap"
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
return {
|
|
2112
|
+
display: "-webkit-box",
|
|
2113
|
+
"-webkit-box-orient": "vertical",
|
|
2114
|
+
"-webkit-line-clamp": props.lines,
|
|
2115
|
+
overflow: "hidden",
|
|
2116
|
+
textOverflow: "ellipsis",
|
|
2117
|
+
wordBreak: "break-word"
|
|
2118
|
+
};
|
|
2119
|
+
});
|
|
2120
|
+
const showTooltip = vue.computed(() => {
|
|
2121
|
+
if (!props.tooltip) {
|
|
2122
|
+
return false;
|
|
2123
|
+
}
|
|
2124
|
+
if (props.alwaysShowTooltip) {
|
|
2125
|
+
return true;
|
|
2126
|
+
}
|
|
2127
|
+
return isTruncated.value;
|
|
2128
|
+
});
|
|
2129
|
+
const checkTruncation = () => {
|
|
2130
|
+
if (!textRef.value) {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
const element = textRef.value;
|
|
2134
|
+
if (props.lines === 1) {
|
|
2135
|
+
isTruncated.value = element.scrollWidth > element.clientWidth;
|
|
2136
|
+
} else {
|
|
2137
|
+
isTruncated.value = element.scrollHeight > element.clientHeight;
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
const debouncedCheck = debounce(checkTruncation, 100);
|
|
2141
|
+
const initResizeObserver = () => {
|
|
2142
|
+
if (!textRef.value) {
|
|
2143
|
+
return;
|
|
2144
|
+
}
|
|
2145
|
+
resizeObserver = new ResizeObserver(() => {
|
|
2146
|
+
debouncedCheck();
|
|
2147
|
+
});
|
|
2148
|
+
resizeObserver.observe(textRef.value);
|
|
2149
|
+
};
|
|
2150
|
+
const cleanupResizeObserver = () => {
|
|
2151
|
+
if (resizeObserver) {
|
|
2152
|
+
resizeObserver.disconnect();
|
|
2153
|
+
resizeObserver = null;
|
|
2154
|
+
}
|
|
2155
|
+
debouncedCheck.cancel();
|
|
2156
|
+
};
|
|
2157
|
+
vue.onMounted(() => {
|
|
2158
|
+
vue.nextTick(() => {
|
|
2159
|
+
checkTruncation();
|
|
2160
|
+
initResizeObserver();
|
|
2161
|
+
});
|
|
2162
|
+
});
|
|
2163
|
+
vue.onBeforeUnmount(() => {
|
|
2164
|
+
cleanupResizeObserver();
|
|
2165
|
+
});
|
|
2166
|
+
vue.watch(
|
|
2167
|
+
() => [props.text, props.lines],
|
|
2168
|
+
() => {
|
|
2169
|
+
vue.nextTick(() => {
|
|
2170
|
+
checkTruncation();
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
);
|
|
2174
|
+
return (_ctx, _cache) => {
|
|
2175
|
+
const _component_a_tooltip = vue.resolveComponent("a-tooltip");
|
|
2176
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
2177
|
+
showTooltip.value ? (vue.openBlock(), vue.createBlock(_component_a_tooltip, vue.mergeProps({
|
|
2178
|
+
key: 0,
|
|
2179
|
+
content: __props.text,
|
|
2180
|
+
trigger: __props.tooltipTrigger
|
|
2181
|
+
}, __props.tooltipProps), {
|
|
2182
|
+
default: vue.withCtx(() => [
|
|
2183
|
+
vue.createElementVNode("div", {
|
|
2184
|
+
ref_key: "textRef",
|
|
2185
|
+
ref: textRef,
|
|
2186
|
+
class: "text-ellipsis-content",
|
|
2187
|
+
style: vue.normalizeStyle(ellipsisStyle.value)
|
|
2188
|
+
}, vue.toDisplayString(__props.text), 5)
|
|
2189
|
+
]),
|
|
2190
|
+
_: 1
|
|
2191
|
+
}, 16, ["content", "trigger"])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
2192
|
+
key: 1,
|
|
2193
|
+
ref_key: "textRef",
|
|
2194
|
+
ref: textRef,
|
|
2195
|
+
class: "text-ellipsis-content",
|
|
2196
|
+
style: vue.normalizeStyle(ellipsisStyle.value)
|
|
2197
|
+
}, vue.toDisplayString(__props.text), 5))
|
|
2198
|
+
]);
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
const BasicTextEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-05b93f77"]]);
|
|
2203
|
+
function useLocalStorage(key, initialValue) {
|
|
2204
|
+
let initialStoredValue;
|
|
2205
|
+
try {
|
|
2206
|
+
const item = window.localStorage.getItem(key);
|
|
2207
|
+
initialStoredValue = item ? JSON.parse(item) : initialValue;
|
|
2208
|
+
} catch (error) {
|
|
2209
|
+
console.error(`Error reading localStorage key "${key}":`, error);
|
|
2210
|
+
initialStoredValue = initialValue;
|
|
2211
|
+
}
|
|
2212
|
+
const storedValue = vue.ref(initialStoredValue);
|
|
2213
|
+
const setValue = (value) => {
|
|
2214
|
+
try {
|
|
2215
|
+
const valueToStore = value instanceof Function ? value(storedValue.value) : value;
|
|
2216
|
+
storedValue.value = valueToStore;
|
|
2217
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
2218
|
+
} catch (error) {
|
|
2219
|
+
console.error(`Error setting localStorage key "${key}":`, error);
|
|
2220
|
+
}
|
|
2221
|
+
};
|
|
2222
|
+
vue.watch(
|
|
2223
|
+
storedValue,
|
|
2224
|
+
(newValue) => {
|
|
2225
|
+
try {
|
|
2226
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
2227
|
+
} catch (error) {
|
|
2228
|
+
console.error(`Error syncing localStorage key "${key}":`, error);
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2231
|
+
{ deep: true }
|
|
2232
|
+
);
|
|
2233
|
+
return [storedValue, setValue];
|
|
2234
|
+
}
|
|
2235
|
+
const editComponentMap = {
|
|
2236
|
+
...componentMap
|
|
2237
|
+
// 可以添加 Table 专用的编辑组件
|
|
2238
|
+
};
|
|
2239
|
+
function getEditComponent(name) {
|
|
2240
|
+
if (typeof name === "string") {
|
|
2241
|
+
return editComponentMap[name];
|
|
2242
|
+
}
|
|
2243
|
+
return name;
|
|
2244
|
+
}
|
|
2245
|
+
const _hoisted_1$3 = { class: "edit-cell" };
|
|
2246
|
+
const _hoisted_2$3 = {
|
|
2247
|
+
key: 0,
|
|
2248
|
+
class: "edit-cell-error"
|
|
2249
|
+
};
|
|
2250
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
2251
|
+
...{
|
|
2252
|
+
name: "EditCell"
|
|
2253
|
+
},
|
|
2254
|
+
__name: "EditCell",
|
|
2255
|
+
props: {
|
|
2256
|
+
column: {},
|
|
2257
|
+
record: {},
|
|
2258
|
+
value: {},
|
|
2259
|
+
size: { default: "small" },
|
|
2260
|
+
error: {}
|
|
2261
|
+
},
|
|
2262
|
+
emits: ["change"],
|
|
2263
|
+
setup(__props, { emit: __emit }) {
|
|
2264
|
+
const props = __props;
|
|
2265
|
+
const emit = __emit;
|
|
2266
|
+
const editComponent = vue.computed(() => {
|
|
2267
|
+
if (!props.column.editComponent) {
|
|
2268
|
+
return getEditComponent("Input");
|
|
2269
|
+
}
|
|
2270
|
+
return getEditComponent(props.column.editComponent);
|
|
2271
|
+
});
|
|
2272
|
+
const componentProps = vue.computed(() => {
|
|
2273
|
+
let baseProps = {
|
|
2274
|
+
placeholder: `请输入${props.column.title || ""}`
|
|
2275
|
+
};
|
|
2276
|
+
if (props.column.editComponentProps) {
|
|
2277
|
+
if (typeof props.column.editComponentProps === "function") {
|
|
2278
|
+
const dynamicProps = props.column.editComponentProps(props.record);
|
|
2279
|
+
baseProps = { ...baseProps, ...dynamicProps };
|
|
2280
|
+
} else {
|
|
2281
|
+
baseProps = { ...baseProps, ...props.column.editComponentProps };
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
return baseProps;
|
|
2285
|
+
});
|
|
2286
|
+
const handleChange = (value) => {
|
|
2287
|
+
emit("change", value);
|
|
2288
|
+
};
|
|
2289
|
+
return (_ctx, _cache) => {
|
|
2290
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
2291
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(editComponent.value), vue.mergeProps(componentProps.value, {
|
|
2292
|
+
"model-value": __props.value,
|
|
2293
|
+
"onUpdate:modelValue": handleChange,
|
|
2294
|
+
size: __props.size,
|
|
2295
|
+
status: __props.error ? "error" : void 0,
|
|
2296
|
+
class: "edit-cell-input"
|
|
2297
|
+
}), null, 16, ["model-value", "size", "status"])),
|
|
2298
|
+
__props.error ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, vue.toDisplayString(__props.error), 1)) : vue.createCommentVNode("", true)
|
|
2299
|
+
]);
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2303
|
+
const EditCell = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-3dab69d1"]]);
|
|
2304
|
+
function useEditValidation() {
|
|
2305
|
+
const validateField = async (value, column, record) => {
|
|
2306
|
+
if (!column.editRule) {
|
|
2307
|
+
return { valid: true };
|
|
2308
|
+
}
|
|
2309
|
+
const rules = Array.isArray(column.editRule) ? column.editRule : [column.editRule];
|
|
2310
|
+
for (const rule of rules) {
|
|
2311
|
+
const result = await validateSingleRule(value, rule, column, record);
|
|
2312
|
+
if (!result.valid) {
|
|
2313
|
+
return result;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return { valid: true };
|
|
2317
|
+
};
|
|
2318
|
+
const validateSingleRule = async (value, rule, column, record) => {
|
|
2319
|
+
const label = column.title || column.dataIndex || "字段";
|
|
2320
|
+
if (rule.required) {
|
|
2321
|
+
if (value === null || value === void 0 || value === "") {
|
|
2322
|
+
return {
|
|
2323
|
+
valid: false,
|
|
2324
|
+
message: rule.message || `请输入${label}`
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
if (value === null || value === void 0 || value === "") {
|
|
2329
|
+
return { valid: true };
|
|
2330
|
+
}
|
|
2331
|
+
if (rule.pattern) {
|
|
2332
|
+
if (!rule.pattern.test(String(value))) {
|
|
2333
|
+
return {
|
|
2334
|
+
valid: false,
|
|
2335
|
+
message: rule.message || `${label}格式不正确`
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
if (typeof value === "number") {
|
|
2340
|
+
if (rule.min !== void 0 && value < rule.min) {
|
|
2341
|
+
return {
|
|
2342
|
+
valid: false,
|
|
2343
|
+
message: rule.message || `${label}不能小于${rule.min}`
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
if (rule.max !== void 0 && value > rule.max) {
|
|
2347
|
+
return {
|
|
2348
|
+
valid: false,
|
|
2349
|
+
message: rule.message || `${label}不能大于${rule.max}`
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
if (typeof value === "string") {
|
|
2354
|
+
if (rule.minLength !== void 0 && value.length < rule.minLength) {
|
|
2355
|
+
return {
|
|
2356
|
+
valid: false,
|
|
2357
|
+
message: rule.message || `${label}长度不能小于${rule.minLength}个字符`
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
if (rule.maxLength !== void 0 && value.length > rule.maxLength) {
|
|
2361
|
+
return {
|
|
2362
|
+
valid: false,
|
|
2363
|
+
message: rule.message || `${label}长度不能大于${rule.maxLength}个字符`
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
if (rule.validator) {
|
|
2368
|
+
try {
|
|
2369
|
+
const result = await rule.validator(value, record);
|
|
2370
|
+
if (result === false) {
|
|
2371
|
+
return {
|
|
2372
|
+
valid: false,
|
|
2373
|
+
message: rule.message || `${label}验证失败`
|
|
2374
|
+
};
|
|
2375
|
+
}
|
|
2376
|
+
if (typeof result === "string") {
|
|
2377
|
+
return {
|
|
2378
|
+
valid: false,
|
|
2379
|
+
message: result
|
|
2380
|
+
};
|
|
2381
|
+
}
|
|
2382
|
+
return { valid: true };
|
|
2383
|
+
} catch (error) {
|
|
2384
|
+
console.error("[useEditValidation] validator error:", error);
|
|
2385
|
+
return {
|
|
2386
|
+
valid: false,
|
|
2387
|
+
message: rule.message || `${label}验证失败`
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
return { valid: true };
|
|
2392
|
+
};
|
|
2393
|
+
const validateRow = async (editValues, columns, record) => {
|
|
2394
|
+
const errors = {};
|
|
2395
|
+
for (const column of columns) {
|
|
2396
|
+
if (!column.dataIndex || !column.editRule) {
|
|
2397
|
+
continue;
|
|
2398
|
+
}
|
|
2399
|
+
const value = editValues[column.dataIndex];
|
|
2400
|
+
const result = await validateField(value, column, record);
|
|
2401
|
+
if (!result.valid && result.message) {
|
|
2402
|
+
errors[column.dataIndex] = result.message;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
return {
|
|
2406
|
+
valid: Object.keys(errors).length === 0,
|
|
2407
|
+
errors
|
|
2408
|
+
};
|
|
2409
|
+
};
|
|
2410
|
+
return {
|
|
2411
|
+
validateField,
|
|
2412
|
+
validateRow
|
|
2413
|
+
};
|
|
2414
|
+
}
|
|
2415
|
+
function useTableEdit(props, dataSource, getRowKey) {
|
|
2416
|
+
const editingStateMap = vue.reactive({});
|
|
2417
|
+
const editValueMap = vue.reactive({});
|
|
2418
|
+
const originalDataMap = vue.reactive({});
|
|
2419
|
+
const validationErrorMap = vue.reactive({});
|
|
2420
|
+
const { validateRow } = useEditValidation();
|
|
2421
|
+
const editConfig = vue.computed(() => {
|
|
2422
|
+
return {
|
|
2423
|
+
mode: "row",
|
|
2424
|
+
enabled: true,
|
|
2425
|
+
allowAdd: true,
|
|
2426
|
+
allowDelete: true,
|
|
2427
|
+
...props.value.editConfig
|
|
2428
|
+
};
|
|
2429
|
+
});
|
|
2430
|
+
const getEditableColumns = (columns) => {
|
|
2431
|
+
return columns.filter((col) => col.edit || col.editable);
|
|
2432
|
+
};
|
|
2433
|
+
const isEditing = (record, column) => {
|
|
2434
|
+
const recordKey = String(getRowKey(record));
|
|
2435
|
+
if (!editingStateMap[recordKey]) {
|
|
2436
|
+
return false;
|
|
2437
|
+
}
|
|
2438
|
+
if (column && column.dataIndex) {
|
|
2439
|
+
return !!editingStateMap[recordKey][column.dataIndex];
|
|
2440
|
+
}
|
|
2441
|
+
return Object.values(editingStateMap[recordKey]).some(Boolean);
|
|
2442
|
+
};
|
|
2443
|
+
const getEditValue = (record, column) => {
|
|
2444
|
+
const recordKey = String(getRowKey(record));
|
|
2445
|
+
const columnKey = column.dataIndex;
|
|
2446
|
+
if (editValueMap[recordKey] && columnKey in editValueMap[recordKey]) {
|
|
2447
|
+
return editValueMap[recordKey][columnKey];
|
|
2448
|
+
}
|
|
2449
|
+
if (column.editValueGetter) {
|
|
2450
|
+
return column.editValueGetter(record);
|
|
2451
|
+
}
|
|
2452
|
+
return record[columnKey];
|
|
2453
|
+
};
|
|
2454
|
+
const setEditValue = (record, column, value) => {
|
|
2455
|
+
const recordKey = String(getRowKey(record));
|
|
2456
|
+
const columnKey = column.dataIndex;
|
|
2457
|
+
if (!editValueMap[recordKey]) {
|
|
2458
|
+
editValueMap[recordKey] = {};
|
|
2459
|
+
}
|
|
2460
|
+
editValueMap[recordKey][columnKey] = value;
|
|
2461
|
+
if (validationErrorMap[recordKey] && validationErrorMap[recordKey][columnKey]) {
|
|
2462
|
+
delete validationErrorMap[recordKey][columnKey];
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
const getValidationError = (record, column) => {
|
|
2466
|
+
const recordKey = String(getRowKey(record));
|
|
2467
|
+
const columnKey = column.dataIndex;
|
|
2468
|
+
if (validationErrorMap[recordKey]) {
|
|
2469
|
+
return validationErrorMap[recordKey][columnKey];
|
|
2470
|
+
}
|
|
2471
|
+
return void 0;
|
|
2472
|
+
};
|
|
2473
|
+
const startEdit = (record, column) => {
|
|
2474
|
+
const recordKey = String(getRowKey(record));
|
|
2475
|
+
const mode = editConfig.value.mode || "row";
|
|
2476
|
+
if (!originalDataMap[recordKey]) {
|
|
2477
|
+
originalDataMap[recordKey] = { ...record };
|
|
2478
|
+
}
|
|
2479
|
+
if (!editingStateMap[recordKey]) {
|
|
2480
|
+
editingStateMap[recordKey] = {};
|
|
2481
|
+
}
|
|
2482
|
+
if (!editValueMap[recordKey]) {
|
|
2483
|
+
editValueMap[recordKey] = {};
|
|
2484
|
+
}
|
|
2485
|
+
if (mode === "row") {
|
|
2486
|
+
const editableColumns = getEditableColumns(props.value.columns || []);
|
|
2487
|
+
editableColumns.forEach((col) => {
|
|
2488
|
+
if (col.dataIndex) {
|
|
2489
|
+
editingStateMap[recordKey][col.dataIndex] = true;
|
|
2490
|
+
if (!(col.dataIndex in editValueMap[recordKey])) {
|
|
2491
|
+
editValueMap[recordKey][col.dataIndex] = getEditValue(record, col);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
});
|
|
2495
|
+
} else if (mode === "cell" && column && column.dataIndex) {
|
|
2496
|
+
editingStateMap[recordKey][column.dataIndex] = true;
|
|
2497
|
+
if (!(column.dataIndex in editValueMap[recordKey])) {
|
|
2498
|
+
editValueMap[recordKey][column.dataIndex] = getEditValue(record, column);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
const getChangedValues = (record) => {
|
|
2503
|
+
const recordKey = String(getRowKey(record));
|
|
2504
|
+
const changedValues = {};
|
|
2505
|
+
if (!editValueMap[recordKey]) {
|
|
2506
|
+
return changedValues;
|
|
2507
|
+
}
|
|
2508
|
+
Object.keys(editValueMap[recordKey]).forEach((columnKey) => {
|
|
2509
|
+
var _a;
|
|
2510
|
+
const editValue = editValueMap[recordKey][columnKey];
|
|
2511
|
+
const originalValue = (_a = originalDataMap[recordKey]) == null ? void 0 : _a[columnKey];
|
|
2512
|
+
if (editValue !== originalValue) {
|
|
2513
|
+
changedValues[columnKey] = editValue;
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
return changedValues;
|
|
2517
|
+
};
|
|
2518
|
+
const saveEdit = async (record) => {
|
|
2519
|
+
const recordKey = String(getRowKey(record));
|
|
2520
|
+
if (!isEditing(record)) {
|
|
2521
|
+
return true;
|
|
2522
|
+
}
|
|
2523
|
+
const editableColumns = getEditableColumns(props.value.columns || []);
|
|
2524
|
+
let columnsToValidate;
|
|
2525
|
+
if (editConfig.value.mode === "cell") {
|
|
2526
|
+
const editingColumns = editingStateMap[recordKey] || {};
|
|
2527
|
+
columnsToValidate = editableColumns.filter(
|
|
2528
|
+
(col) => col.dataIndex && editingColumns[col.dataIndex]
|
|
2529
|
+
);
|
|
2530
|
+
} else {
|
|
2531
|
+
columnsToValidate = editableColumns;
|
|
2532
|
+
}
|
|
2533
|
+
const validationResult = await validateRow(
|
|
2534
|
+
editValueMap[recordKey] || {},
|
|
2535
|
+
columnsToValidate,
|
|
2536
|
+
record
|
|
2537
|
+
);
|
|
2538
|
+
if (!validationResult.valid) {
|
|
2539
|
+
validationErrorMap[recordKey] = validationResult.errors;
|
|
2540
|
+
const firstError = Object.values(validationResult.errors)[0];
|
|
2541
|
+
if (firstError) {
|
|
2542
|
+
webVue.Message.error(firstError);
|
|
2543
|
+
}
|
|
2544
|
+
return false;
|
|
2545
|
+
}
|
|
2546
|
+
const changedValues = getChangedValues(record);
|
|
2547
|
+
if (editConfig.value.beforeSave) {
|
|
2548
|
+
try {
|
|
2549
|
+
const result = await editConfig.value.beforeSave(record, changedValues);
|
|
2550
|
+
if (result === false) {
|
|
2551
|
+
return false;
|
|
2552
|
+
}
|
|
2553
|
+
} catch (error) {
|
|
2554
|
+
console.error("[useTableEdit] beforeSave error:", error);
|
|
2555
|
+
webVue.Message.error("保存前验证失败");
|
|
2556
|
+
return false;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
if (editValueMap[recordKey]) {
|
|
2560
|
+
Object.keys(editValueMap[recordKey]).forEach((columnKey) => {
|
|
2561
|
+
const column = editableColumns.find((col) => col.dataIndex === columnKey);
|
|
2562
|
+
let value = editValueMap[recordKey][columnKey];
|
|
2563
|
+
if (column == null ? void 0 : column.editValueSetter) {
|
|
2564
|
+
value = column.editValueSetter(value, record);
|
|
2565
|
+
}
|
|
2566
|
+
record[columnKey] = value;
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
if (editConfig.value.onSave) {
|
|
2570
|
+
try {
|
|
2571
|
+
await editConfig.value.onSave(record, changedValues);
|
|
2572
|
+
} catch (error) {
|
|
2573
|
+
console.error("[useTableEdit] onSave error:", error);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
delete editingStateMap[recordKey];
|
|
2577
|
+
delete editValueMap[recordKey];
|
|
2578
|
+
delete originalDataMap[recordKey];
|
|
2579
|
+
delete validationErrorMap[recordKey];
|
|
2580
|
+
webVue.Message.success("保存成功");
|
|
2581
|
+
return true;
|
|
2582
|
+
};
|
|
2583
|
+
const cancelEdit = (record) => {
|
|
2584
|
+
const recordKey = String(getRowKey(record));
|
|
2585
|
+
if (!isEditing(record)) {
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
if (originalDataMap[recordKey]) {
|
|
2589
|
+
Object.keys(originalDataMap[recordKey]).forEach((key) => {
|
|
2590
|
+
record[key] = originalDataMap[recordKey][key];
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
if (editConfig.value.onCancel) {
|
|
2594
|
+
editConfig.value.onCancel(record);
|
|
1919
2595
|
}
|
|
2596
|
+
delete editingStateMap[recordKey];
|
|
2597
|
+
delete editValueMap[recordKey];
|
|
2598
|
+
delete originalDataMap[recordKey];
|
|
2599
|
+
delete validationErrorMap[recordKey];
|
|
1920
2600
|
};
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
if (remaining <= 0 || remaining > wait) {
|
|
1931
|
-
if (timeout) {
|
|
1932
|
-
clearTimeout(timeout);
|
|
1933
|
-
timeout = null;
|
|
2601
|
+
const deleteRow = async (record) => {
|
|
2602
|
+
const recordKey = String(getRowKey(record));
|
|
2603
|
+
if (editConfig.value.onDelete) {
|
|
2604
|
+
try {
|
|
2605
|
+
await editConfig.value.onDelete(record);
|
|
2606
|
+
} catch (error) {
|
|
2607
|
+
console.error("[useTableEdit] onDelete error:", error);
|
|
2608
|
+
webVue.Message.error("删除失败");
|
|
2609
|
+
return;
|
|
1934
2610
|
}
|
|
1935
|
-
previous = now;
|
|
1936
|
-
func.apply(context, args);
|
|
1937
|
-
} else if (!timeout) {
|
|
1938
|
-
timeout = setTimeout(() => {
|
|
1939
|
-
previous = Date.now();
|
|
1940
|
-
timeout = null;
|
|
1941
|
-
func.apply(context, args);
|
|
1942
|
-
}, remaining);
|
|
1943
2611
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
let initialStoredValue;
|
|
1948
|
-
try {
|
|
1949
|
-
const item = window.localStorage.getItem(key);
|
|
1950
|
-
initialStoredValue = item ? JSON.parse(item) : initialValue;
|
|
1951
|
-
} catch (error) {
|
|
1952
|
-
console.error(`Error reading localStorage key "${key}":`, error);
|
|
1953
|
-
initialStoredValue = initialValue;
|
|
1954
|
-
}
|
|
1955
|
-
const storedValue = vue.ref(initialStoredValue);
|
|
1956
|
-
const setValue = (value) => {
|
|
1957
|
-
try {
|
|
1958
|
-
const valueToStore = value instanceof Function ? value(storedValue.value) : value;
|
|
1959
|
-
storedValue.value = valueToStore;
|
|
1960
|
-
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
1961
|
-
} catch (error) {
|
|
1962
|
-
console.error(`Error setting localStorage key "${key}":`, error);
|
|
2612
|
+
const index = dataSource.value.findIndex((item) => getRowKey(item) === recordKey);
|
|
2613
|
+
if (index > -1) {
|
|
2614
|
+
dataSource.value.splice(index, 1);
|
|
1963
2615
|
}
|
|
2616
|
+
delete editingStateMap[recordKey];
|
|
2617
|
+
delete editValueMap[recordKey];
|
|
2618
|
+
delete originalDataMap[recordKey];
|
|
2619
|
+
delete validationErrorMap[recordKey];
|
|
2620
|
+
webVue.Message.success("删除成功");
|
|
1964
2621
|
};
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
(
|
|
2622
|
+
const addRow = async () => {
|
|
2623
|
+
let newRecord = {};
|
|
2624
|
+
if (editConfig.value.onAdd) {
|
|
1968
2625
|
try {
|
|
1969
|
-
|
|
2626
|
+
newRecord = await editConfig.value.onAdd();
|
|
1970
2627
|
} catch (error) {
|
|
1971
|
-
console.error(
|
|
2628
|
+
console.error("[useTableEdit] onAdd error:", error);
|
|
2629
|
+
webVue.Message.error("添加失败");
|
|
2630
|
+
return;
|
|
1972
2631
|
}
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2632
|
+
}
|
|
2633
|
+
const rowKey = props.value.rowKey || "id";
|
|
2634
|
+
if (typeof rowKey === "string" && !newRecord[rowKey]) {
|
|
2635
|
+
newRecord[rowKey] = `temp_${Date.now()}_${Math.random()}`;
|
|
2636
|
+
}
|
|
2637
|
+
dataSource.value.unshift(newRecord);
|
|
2638
|
+
startEdit(newRecord);
|
|
2639
|
+
};
|
|
2640
|
+
const getEditingRows = () => {
|
|
2641
|
+
const editingKeys = Object.keys(editingStateMap);
|
|
2642
|
+
return dataSource.value.filter((record) => {
|
|
2643
|
+
const recordKey = String(getRowKey(record));
|
|
2644
|
+
return editingKeys.includes(recordKey);
|
|
2645
|
+
});
|
|
2646
|
+
};
|
|
2647
|
+
const saveAllEdits = async () => {
|
|
2648
|
+
const editingRows = getEditingRows();
|
|
2649
|
+
if (editingRows.length === 0) {
|
|
2650
|
+
return true;
|
|
2651
|
+
}
|
|
2652
|
+
for (const record of editingRows) {
|
|
2653
|
+
const success = await saveEdit(record);
|
|
2654
|
+
if (!success) {
|
|
2655
|
+
return false;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
return true;
|
|
2659
|
+
};
|
|
2660
|
+
const cancelAllEdits = () => {
|
|
2661
|
+
const editingRows = getEditingRows();
|
|
2662
|
+
editingRows.forEach((record) => {
|
|
2663
|
+
cancelEdit(record);
|
|
2664
|
+
});
|
|
2665
|
+
};
|
|
2666
|
+
return {
|
|
2667
|
+
editingStateMap,
|
|
2668
|
+
editValueMap,
|
|
2669
|
+
validationErrorMap,
|
|
2670
|
+
isEditing,
|
|
2671
|
+
getEditValue,
|
|
2672
|
+
setEditValue,
|
|
2673
|
+
getValidationError,
|
|
2674
|
+
startEdit,
|
|
2675
|
+
saveEdit,
|
|
2676
|
+
cancelEdit,
|
|
2677
|
+
deleteRow,
|
|
2678
|
+
addRow,
|
|
2679
|
+
getEditingRows,
|
|
2680
|
+
saveAllEdits,
|
|
2681
|
+
cancelAllEdits,
|
|
2682
|
+
getChangedValues
|
|
2683
|
+
};
|
|
1977
2684
|
}
|
|
1978
2685
|
const _hoisted_1$2 = { class: "basic-table-wrapper" };
|
|
1979
2686
|
const _hoisted_2$2 = {
|
|
@@ -2037,9 +2744,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2037
2744
|
autoHeight: { type: Boolean, default: false },
|
|
2038
2745
|
maxHeight: {},
|
|
2039
2746
|
tableClass: {},
|
|
2040
|
-
tableStyle: {}
|
|
2747
|
+
tableStyle: {},
|
|
2748
|
+
editConfig: {}
|
|
2041
2749
|
},
|
|
2042
|
-
emits: ["register", "change", "select", "selectAll", "expand", "row-click", "row-dblclick", "cell-click", "search", "reset", "fetch-success", "fetch-error"],
|
|
2750
|
+
emits: ["register", "change", "select", "selectAll", "expand", "row-click", "row-dblclick", "cell-click", "search", "reset", "fetch-success", "fetch-error", "edit-save", "edit-cancel", "edit-delete", "edit-add"],
|
|
2043
2751
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2044
2752
|
const DEBOUNCE_DELAY = {
|
|
2045
2753
|
REFRESH: 300,
|
|
@@ -2248,6 +2956,31 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2248
2956
|
}
|
|
2249
2957
|
return record[mergedProps.rowKey];
|
|
2250
2958
|
};
|
|
2959
|
+
const {
|
|
2960
|
+
isEditing,
|
|
2961
|
+
getEditValue,
|
|
2962
|
+
setEditValue,
|
|
2963
|
+
getValidationError,
|
|
2964
|
+
startEdit,
|
|
2965
|
+
saveEdit,
|
|
2966
|
+
cancelEdit,
|
|
2967
|
+
deleteRow,
|
|
2968
|
+
addRow,
|
|
2969
|
+
getEditingRows,
|
|
2970
|
+
saveAllEdits,
|
|
2971
|
+
cancelAllEdits,
|
|
2972
|
+
getChangedValues
|
|
2973
|
+
} = useTableEdit(getMergedProps, dataSource, getRowKey);
|
|
2974
|
+
const originalColumnsMap = vue.computed(() => {
|
|
2975
|
+
const mergedProps = getMergedProps.value;
|
|
2976
|
+
const map = /* @__PURE__ */ new Map();
|
|
2977
|
+
mergedProps.columns.forEach((col) => {
|
|
2978
|
+
if (col.dataIndex) {
|
|
2979
|
+
map.set(col.dataIndex, col);
|
|
2980
|
+
}
|
|
2981
|
+
});
|
|
2982
|
+
return map;
|
|
2983
|
+
});
|
|
2251
2984
|
const getViewColumns = vue.computed(() => {
|
|
2252
2985
|
const mergedProps = getMergedProps.value;
|
|
2253
2986
|
let columns = [...mergedProps.columns];
|
|
@@ -2285,6 +3018,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2285
3018
|
}
|
|
2286
3019
|
columns = columns.filter((col) => col.show !== false);
|
|
2287
3020
|
columns = columns.map((col) => {
|
|
3021
|
+
if ((col.edit || col.editable) && !col.slotName) {
|
|
3022
|
+
return { ...col, slotName: col.dataIndex };
|
|
3023
|
+
}
|
|
3024
|
+
if (!col.slotName && col.ellipsis && typeof col.ellipsis === "object") {
|
|
3025
|
+
const { ellipsis, ...restCol } = col;
|
|
3026
|
+
return { ...restCol, slotName: col.dataIndex };
|
|
3027
|
+
}
|
|
2288
3028
|
if (!col.slotName && (col.customRender || col.format)) {
|
|
2289
3029
|
return { ...col, slotName: col.dataIndex };
|
|
2290
3030
|
}
|
|
@@ -2724,7 +3464,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2724
3464
|
expandAll,
|
|
2725
3465
|
collapseAll,
|
|
2726
3466
|
tableRef,
|
|
2727
|
-
searchFormRef
|
|
3467
|
+
searchFormRef,
|
|
3468
|
+
// 编辑相关方法
|
|
3469
|
+
startEdit,
|
|
3470
|
+
saveEdit,
|
|
3471
|
+
cancelEdit,
|
|
3472
|
+
deleteRow,
|
|
3473
|
+
addRow,
|
|
3474
|
+
getEditingRows,
|
|
3475
|
+
saveAllEdits,
|
|
3476
|
+
cancelAllEdits,
|
|
3477
|
+
isEditing,
|
|
3478
|
+
getEditValue,
|
|
3479
|
+
setEditValue,
|
|
3480
|
+
getChangedValues
|
|
2728
3481
|
});
|
|
2729
3482
|
vue.onMounted(async () => {
|
|
2730
3483
|
await vue.nextTick();
|
|
@@ -2754,7 +3507,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2754
3507
|
expandAll,
|
|
2755
3508
|
collapseAll,
|
|
2756
3509
|
tableRef,
|
|
2757
|
-
searchFormRef
|
|
3510
|
+
searchFormRef,
|
|
3511
|
+
// 编辑相关方法
|
|
3512
|
+
startEdit,
|
|
3513
|
+
saveEdit,
|
|
3514
|
+
cancelEdit,
|
|
3515
|
+
deleteRow,
|
|
3516
|
+
addRow,
|
|
3517
|
+
getEditingRows,
|
|
3518
|
+
saveAllEdits,
|
|
3519
|
+
cancelAllEdits,
|
|
3520
|
+
isEditing,
|
|
3521
|
+
getEditValue,
|
|
3522
|
+
setEditValue,
|
|
3523
|
+
getChangedValues
|
|
2758
3524
|
};
|
|
2759
3525
|
const formInstance = {
|
|
2760
3526
|
getFieldsValue: () => {
|
|
@@ -2856,7 +3622,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2856
3622
|
const _component_a_table = vue.resolveComponent("a-table");
|
|
2857
3623
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
2858
3624
|
getSearchConfig.value.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
2859
|
-
vue.createVNode(vue.unref(_sfc_main$
|
|
3625
|
+
vue.createVNode(vue.unref(_sfc_main$5), vue.mergeProps({
|
|
2860
3626
|
ref_key: "searchFormRef",
|
|
2861
3627
|
ref: searchFormRef
|
|
2862
3628
|
}, getSearchFormProps.value, {
|
|
@@ -3057,84 +3823,103 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3057
3823
|
vue.renderList(getViewColumns.value.filter((c) => c.slotName), (col) => {
|
|
3058
3824
|
return {
|
|
3059
3825
|
name: col.slotName,
|
|
3060
|
-
fn: vue.withCtx((slotProps) =>
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
key: 0,
|
|
3075
|
-
content: action.popConfirm.title,
|
|
3076
|
-
"ok-text": action.popConfirm.okText,
|
|
3077
|
-
"cancel-text": action.popConfirm.cancelText,
|
|
3078
|
-
onOk: ($event) => {
|
|
3079
|
-
var _a, _b;
|
|
3080
|
-
return (_b = (_a = action.popConfirm).onConfirm) == null ? void 0 : _b.call(_a, slotProps.record);
|
|
3081
|
-
},
|
|
3082
|
-
onCancel: action.popConfirm.onCancel
|
|
3083
|
-
}, {
|
|
3084
|
-
default: vue.withCtx(() => [
|
|
3085
|
-
vue.createVNode(_component_a_link, {
|
|
3086
|
-
status: action.color,
|
|
3087
|
-
disabled: getActionDisabled(action, slotProps.record),
|
|
3088
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3089
|
-
}, ["stop"]))
|
|
3090
|
-
}, vue.createSlots({
|
|
3091
|
-
default: vue.withCtx(() => [
|
|
3092
|
-
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3093
|
-
]),
|
|
3094
|
-
_: 2
|
|
3095
|
-
}, [
|
|
3096
|
-
action.icon ? {
|
|
3097
|
-
name: "icon",
|
|
3098
|
-
fn: vue.withCtx(() => [
|
|
3099
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.icon)))
|
|
3100
|
-
]),
|
|
3101
|
-
key: "0"
|
|
3102
|
-
} : void 0
|
|
3103
|
-
]), 1032, ["status", "disabled"])
|
|
3104
|
-
]),
|
|
3105
|
-
_: 2
|
|
3106
|
-
}, 1032, ["content", "ok-text", "cancel-text", "onOk", "onCancel"])) : (vue.openBlock(), vue.createBlock(_component_a_link, {
|
|
3107
|
-
key: 1,
|
|
3108
|
-
status: action.color,
|
|
3109
|
-
disabled: getActionDisabled(action, slotProps.record),
|
|
3110
|
-
onClick: ($event) => handleActionClick(action, slotProps.record)
|
|
3111
|
-
}, vue.createSlots({
|
|
3112
|
-
default: vue.withCtx(() => [
|
|
3113
|
-
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3114
|
-
]),
|
|
3115
|
-
_: 2
|
|
3826
|
+
fn: vue.withCtx((slotProps) => {
|
|
3827
|
+
var _a, _b;
|
|
3828
|
+
return [
|
|
3829
|
+
col.slotName === "__index__" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
3830
|
+
vue.createTextVNode(vue.toDisplayString(getIndexNumber(slotProps.rowIndex)), 1)
|
|
3831
|
+
], 64)) : col.slotName === "action" ? vue.renderSlot(_ctx.$slots, "action", {
|
|
3832
|
+
key: 1,
|
|
3833
|
+
record: slotProps.record
|
|
3834
|
+
}, () => [
|
|
3835
|
+
vue.createVNode(_component_a_space, null, {
|
|
3836
|
+
default: vue.withCtx(() => [
|
|
3837
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getActionButtons(slotProps.record), (action) => {
|
|
3838
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
3839
|
+
key: action.label
|
|
3116
3840
|
}, [
|
|
3117
|
-
action.
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3841
|
+
action.popConfirm ? (vue.openBlock(), vue.createBlock(_component_a_popconfirm, {
|
|
3842
|
+
key: 0,
|
|
3843
|
+
content: action.popConfirm.title,
|
|
3844
|
+
"ok-text": action.popConfirm.okText,
|
|
3845
|
+
"cancel-text": action.popConfirm.cancelText,
|
|
3846
|
+
onOk: ($event) => {
|
|
3847
|
+
var _a2, _b2;
|
|
3848
|
+
return (_b2 = (_a2 = action.popConfirm).onConfirm) == null ? void 0 : _b2.call(_a2, slotProps.record);
|
|
3849
|
+
},
|
|
3850
|
+
onCancel: action.popConfirm.onCancel
|
|
3851
|
+
}, {
|
|
3852
|
+
default: vue.withCtx(() => [
|
|
3853
|
+
vue.createVNode(_component_a_link, {
|
|
3854
|
+
status: action.color,
|
|
3855
|
+
disabled: getActionDisabled(action, slotProps.record),
|
|
3856
|
+
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3857
|
+
}, ["stop"]))
|
|
3858
|
+
}, vue.createSlots({
|
|
3859
|
+
default: vue.withCtx(() => [
|
|
3860
|
+
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3861
|
+
]),
|
|
3862
|
+
_: 2
|
|
3863
|
+
}, [
|
|
3864
|
+
action.icon ? {
|
|
3865
|
+
name: "icon",
|
|
3866
|
+
fn: vue.withCtx(() => [
|
|
3867
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.icon)))
|
|
3868
|
+
]),
|
|
3869
|
+
key: "0"
|
|
3870
|
+
} : void 0
|
|
3871
|
+
]), 1032, ["status", "disabled"])
|
|
3121
3872
|
]),
|
|
3122
|
-
|
|
3123
|
-
} :
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3873
|
+
_: 2
|
|
3874
|
+
}, 1032, ["content", "ok-text", "cancel-text", "onOk", "onCancel"])) : (vue.openBlock(), vue.createBlock(_component_a_link, {
|
|
3875
|
+
key: 1,
|
|
3876
|
+
status: action.color,
|
|
3877
|
+
disabled: getActionDisabled(action, slotProps.record),
|
|
3878
|
+
onClick: ($event) => handleActionClick(action, slotProps.record)
|
|
3879
|
+
}, vue.createSlots({
|
|
3880
|
+
default: vue.withCtx(() => [
|
|
3881
|
+
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3882
|
+
]),
|
|
3883
|
+
_: 2
|
|
3884
|
+
}, [
|
|
3885
|
+
action.icon ? {
|
|
3886
|
+
name: "icon",
|
|
3887
|
+
fn: vue.withCtx(() => [
|
|
3888
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.icon)))
|
|
3889
|
+
]),
|
|
3890
|
+
key: "0"
|
|
3891
|
+
} : void 0
|
|
3892
|
+
]), 1032, ["status", "disabled", "onClick"]))
|
|
3893
|
+
], 64);
|
|
3894
|
+
}), 128))
|
|
3895
|
+
]),
|
|
3896
|
+
_: 2
|
|
3897
|
+
}, 1024)
|
|
3898
|
+
], true) : (col.edit || col.editable) && vue.unref(isEditing)(slotProps.record, col) ? (vue.openBlock(), vue.createBlock(EditCell, {
|
|
3899
|
+
key: 2,
|
|
3900
|
+
column: col,
|
|
3901
|
+
record: slotProps.record,
|
|
3902
|
+
value: vue.unref(getEditValue)(slotProps.record, col),
|
|
3903
|
+
error: vue.unref(getValidationError)(slotProps.record, col),
|
|
3904
|
+
onChange: (val) => vue.unref(setEditValue)(slotProps.record, col, val)
|
|
3905
|
+
}, 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 }, [
|
|
3906
|
+
vue.createTextVNode(vue.toDisplayString(col.format(
|
|
3907
|
+
slotProps.record[col.dataIndex],
|
|
3908
|
+
slotProps.record,
|
|
3909
|
+
slotProps.rowIndex
|
|
3910
|
+
)), 1)
|
|
3911
|
+
], 64)) : col.dataIndex && ((_a = originalColumnsMap.value.get(col.dataIndex)) == null ? void 0 : _a.ellipsis) && typeof ((_b = originalColumnsMap.value.get(col.dataIndex)) == null ? void 0 : _b.ellipsis) === "object" ? (vue.openBlock(), vue.createBlock(vue.unref(BasicTextEllipsis), {
|
|
3912
|
+
key: 6,
|
|
3913
|
+
text: String(slotProps.record[col.dataIndex] ?? ""),
|
|
3914
|
+
lines: originalColumnsMap.value.get(col.dataIndex).ellipsis.lines ?? 1,
|
|
3915
|
+
tooltip: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltip ?? true,
|
|
3916
|
+
tooltipTrigger: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltipTrigger ?? "hover",
|
|
3917
|
+
tooltipProps: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltipProps
|
|
3918
|
+
}, null, 8, ["text", "lines", "tooltip", "tooltipTrigger", "tooltipProps"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 7 }, [
|
|
3919
|
+
vue.createTextVNode(vue.toDisplayString(slotProps.record[col.dataIndex]), 1)
|
|
3920
|
+
], 64))
|
|
3921
|
+
];
|
|
3922
|
+
})
|
|
3138
3923
|
};
|
|
3139
3924
|
})
|
|
3140
3925
|
]), 1040, ["columns", "data", "loading", "pagination", "row-selection", "expandable", "scroll", "draggable", "bordered", "stripe", "show-header", "size", "row-key"])
|
|
@@ -3142,7 +3927,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3142
3927
|
};
|
|
3143
3928
|
}
|
|
3144
3929
|
});
|
|
3145
|
-
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3930
|
+
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-42280842"]]);
|
|
3146
3931
|
function useTable(options = {}) {
|
|
3147
3932
|
const tableRef = vue.ref(null);
|
|
3148
3933
|
const formRef = vue.ref(null);
|
|
@@ -3345,6 +4130,96 @@ function useTable(options = {}) {
|
|
|
3345
4130
|
}
|
|
3346
4131
|
return form;
|
|
3347
4132
|
};
|
|
4133
|
+
const startEdit = (record, column) => {
|
|
4134
|
+
const table = getTable();
|
|
4135
|
+
if (!table) return;
|
|
4136
|
+
if (table.startEdit) {
|
|
4137
|
+
table.startEdit(record, column);
|
|
4138
|
+
}
|
|
4139
|
+
};
|
|
4140
|
+
const saveEdit = async (record) => {
|
|
4141
|
+
const table = getTable();
|
|
4142
|
+
if (!table) return false;
|
|
4143
|
+
if (table.saveEdit) {
|
|
4144
|
+
return await table.saveEdit(record);
|
|
4145
|
+
}
|
|
4146
|
+
return false;
|
|
4147
|
+
};
|
|
4148
|
+
const cancelEdit = (record) => {
|
|
4149
|
+
const table = getTable();
|
|
4150
|
+
if (!table) return;
|
|
4151
|
+
if (table.cancelEdit) {
|
|
4152
|
+
table.cancelEdit(record);
|
|
4153
|
+
}
|
|
4154
|
+
};
|
|
4155
|
+
const deleteRow = async (record) => {
|
|
4156
|
+
const table = getTable();
|
|
4157
|
+
if (!table) return;
|
|
4158
|
+
if (table.deleteRow) {
|
|
4159
|
+
await table.deleteRow(record);
|
|
4160
|
+
}
|
|
4161
|
+
};
|
|
4162
|
+
const addRow = async () => {
|
|
4163
|
+
const table = getTable();
|
|
4164
|
+
if (!table) return;
|
|
4165
|
+
if (table.addRow) {
|
|
4166
|
+
await table.addRow();
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
const getEditingRows = () => {
|
|
4170
|
+
const table = getTable();
|
|
4171
|
+
if (!table) return [];
|
|
4172
|
+
if (table.getEditingRows) {
|
|
4173
|
+
return table.getEditingRows();
|
|
4174
|
+
}
|
|
4175
|
+
return [];
|
|
4176
|
+
};
|
|
4177
|
+
const saveAllEdits = async () => {
|
|
4178
|
+
const table = getTable();
|
|
4179
|
+
if (!table) return false;
|
|
4180
|
+
if (table.saveAllEdits) {
|
|
4181
|
+
return await table.saveAllEdits();
|
|
4182
|
+
}
|
|
4183
|
+
return false;
|
|
4184
|
+
};
|
|
4185
|
+
const cancelAllEdits = () => {
|
|
4186
|
+
const table = getTable();
|
|
4187
|
+
if (!table) return;
|
|
4188
|
+
if (table.cancelAllEdits) {
|
|
4189
|
+
table.cancelAllEdits();
|
|
4190
|
+
}
|
|
4191
|
+
};
|
|
4192
|
+
const isEditing = (record, column) => {
|
|
4193
|
+
const table = getTable();
|
|
4194
|
+
if (!table) return false;
|
|
4195
|
+
if (table.isEditing) {
|
|
4196
|
+
return table.isEditing(record, column);
|
|
4197
|
+
}
|
|
4198
|
+
return false;
|
|
4199
|
+
};
|
|
4200
|
+
const getEditValue = (record, column) => {
|
|
4201
|
+
const table = getTable();
|
|
4202
|
+
if (!table) return void 0;
|
|
4203
|
+
if (table.getEditValue) {
|
|
4204
|
+
return table.getEditValue(record, column);
|
|
4205
|
+
}
|
|
4206
|
+
return void 0;
|
|
4207
|
+
};
|
|
4208
|
+
const setEditValue = (record, column, value) => {
|
|
4209
|
+
const table = getTable();
|
|
4210
|
+
if (!table) return;
|
|
4211
|
+
if (table.setEditValue) {
|
|
4212
|
+
table.setEditValue(record, column, value);
|
|
4213
|
+
}
|
|
4214
|
+
};
|
|
4215
|
+
const getChangedValues = (record) => {
|
|
4216
|
+
const table = getTable();
|
|
4217
|
+
if (!table) return {};
|
|
4218
|
+
if (table.getChangedValues) {
|
|
4219
|
+
return table.getChangedValues(record);
|
|
4220
|
+
}
|
|
4221
|
+
return {};
|
|
4222
|
+
};
|
|
3348
4223
|
const tableMethods = {
|
|
3349
4224
|
getDataSource,
|
|
3350
4225
|
setDataSource,
|
|
@@ -3369,7 +4244,20 @@ function useTable(options = {}) {
|
|
|
3369
4244
|
collapseAll,
|
|
3370
4245
|
getForm,
|
|
3371
4246
|
tableRef,
|
|
3372
|
-
getTable
|
|
4247
|
+
getTable,
|
|
4248
|
+
// 编辑相关方法
|
|
4249
|
+
startEdit,
|
|
4250
|
+
saveEdit,
|
|
4251
|
+
cancelEdit,
|
|
4252
|
+
deleteRow,
|
|
4253
|
+
addRow,
|
|
4254
|
+
getEditingRows,
|
|
4255
|
+
saveAllEdits,
|
|
4256
|
+
cancelAllEdits,
|
|
4257
|
+
isEditing,
|
|
4258
|
+
getEditValue,
|
|
4259
|
+
setEditValue,
|
|
4260
|
+
getChangedValues
|
|
3373
4261
|
};
|
|
3374
4262
|
return [register, tableMethods];
|
|
3375
4263
|
}
|
|
@@ -3624,7 +4512,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3624
4512
|
vue.watch(
|
|
3625
4513
|
() => getProps.value.visible,
|
|
3626
4514
|
(val) => {
|
|
3627
|
-
visibleRef.value = val;
|
|
4515
|
+
visibleRef.value = val ?? false;
|
|
3628
4516
|
},
|
|
3629
4517
|
{ immediate: true }
|
|
3630
4518
|
);
|
|
@@ -3783,7 +4671,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3783
4671
|
};
|
|
3784
4672
|
}
|
|
3785
4673
|
});
|
|
3786
|
-
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4674
|
+
const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-68fed17a"]]);
|
|
3787
4675
|
function useModal(props) {
|
|
3788
4676
|
const modalRef = vue.ref(null);
|
|
3789
4677
|
const loadedRef = vue.ref(false);
|
|
@@ -4165,102 +5053,6 @@ function useDescription(props) {
|
|
|
4165
5053
|
}
|
|
4166
5054
|
];
|
|
4167
5055
|
}
|
|
4168
|
-
function useUpload(props) {
|
|
4169
|
-
const uploadRef = vue.ref(null);
|
|
4170
|
-
const fileListRef = vue.ref((props == null ? void 0 : props.defaultFileList) || []);
|
|
4171
|
-
const register = (uploadInstance) => {
|
|
4172
|
-
uploadRef.value = uploadInstance;
|
|
4173
|
-
if ((props == null ? void 0 : props.defaultFileList) && props.defaultFileList.length > 0) {
|
|
4174
|
-
uploadInstance.setFileList(props.defaultFileList);
|
|
4175
|
-
}
|
|
4176
|
-
if (props && Object.keys(props).length > 0) {
|
|
4177
|
-
const { defaultFileList, ...restProps } = props;
|
|
4178
|
-
if (Object.keys(restProps).length > 0) {
|
|
4179
|
-
setProps(restProps);
|
|
4180
|
-
}
|
|
4181
|
-
}
|
|
4182
|
-
};
|
|
4183
|
-
const getUpload = () => {
|
|
4184
|
-
const upload2 = vue.unref(uploadRef);
|
|
4185
|
-
if (!upload2) {
|
|
4186
|
-
throw new Error('Upload 实例未注册,请确保在组件上使用 @register="register"');
|
|
4187
|
-
}
|
|
4188
|
-
return upload2;
|
|
4189
|
-
};
|
|
4190
|
-
const submit = () => {
|
|
4191
|
-
getUpload().submit();
|
|
4192
|
-
};
|
|
4193
|
-
const abort = (fileItem) => {
|
|
4194
|
-
getUpload().abort(fileItem);
|
|
4195
|
-
};
|
|
4196
|
-
const clearFiles = () => {
|
|
4197
|
-
getUpload().clearFiles();
|
|
4198
|
-
fileListRef.value = [];
|
|
4199
|
-
};
|
|
4200
|
-
const getFileList = () => {
|
|
4201
|
-
return getUpload().getFileList();
|
|
4202
|
-
};
|
|
4203
|
-
const upload = (fileItem) => {
|
|
4204
|
-
getUpload().upload(fileItem);
|
|
4205
|
-
};
|
|
4206
|
-
const setFileList = (files) => {
|
|
4207
|
-
fileListRef.value = files;
|
|
4208
|
-
const upload2 = getUpload();
|
|
4209
|
-
if (upload2.setFileList) {
|
|
4210
|
-
upload2.setFileList(files);
|
|
4211
|
-
}
|
|
4212
|
-
};
|
|
4213
|
-
const addFile = (file) => {
|
|
4214
|
-
fileListRef.value.push(file);
|
|
4215
|
-
const upload2 = getUpload();
|
|
4216
|
-
if (upload2.addFile) {
|
|
4217
|
-
upload2.addFile(file);
|
|
4218
|
-
}
|
|
4219
|
-
};
|
|
4220
|
-
const removeFile = (fileItem) => {
|
|
4221
|
-
const index = fileListRef.value.findIndex(
|
|
4222
|
-
(item) => item.uid === fileItem.uid
|
|
4223
|
-
);
|
|
4224
|
-
if (index !== -1) {
|
|
4225
|
-
fileListRef.value.splice(index, 1);
|
|
4226
|
-
}
|
|
4227
|
-
const upload2 = getUpload();
|
|
4228
|
-
if (upload2.removeFile) {
|
|
4229
|
-
upload2.removeFile(fileItem);
|
|
4230
|
-
}
|
|
4231
|
-
};
|
|
4232
|
-
const updateFile = (fileItem) => {
|
|
4233
|
-
const index = fileListRef.value.findIndex(
|
|
4234
|
-
(item) => item.uid === fileItem.uid
|
|
4235
|
-
);
|
|
4236
|
-
if (index !== -1) {
|
|
4237
|
-
fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
|
|
4238
|
-
}
|
|
4239
|
-
const upload2 = getUpload();
|
|
4240
|
-
if (upload2.updateFile) {
|
|
4241
|
-
upload2.updateFile(fileItem);
|
|
4242
|
-
}
|
|
4243
|
-
};
|
|
4244
|
-
const setProps = (uploadProps) => {
|
|
4245
|
-
getUpload().setProps(uploadProps);
|
|
4246
|
-
};
|
|
4247
|
-
const methods = {
|
|
4248
|
-
get fileList() {
|
|
4249
|
-
return fileListRef.value;
|
|
4250
|
-
},
|
|
4251
|
-
submit,
|
|
4252
|
-
abort,
|
|
4253
|
-
upload,
|
|
4254
|
-
clearFiles,
|
|
4255
|
-
getFileList,
|
|
4256
|
-
setFileList,
|
|
4257
|
-
addFile,
|
|
4258
|
-
removeFile,
|
|
4259
|
-
updateFile,
|
|
4260
|
-
setProps
|
|
4261
|
-
};
|
|
4262
|
-
return [register, methods];
|
|
4263
|
-
}
|
|
4264
5056
|
function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
|
|
4265
5057
|
const d = typeof date === "number" ? new Date(date) : date;
|
|
4266
5058
|
const year = d.getFullYear();
|
|
@@ -4340,9 +5132,10 @@ function useToggle(initialValue = false) {
|
|
|
4340
5132
|
return [value, toggle, setTrue, setFalse];
|
|
4341
5133
|
}
|
|
4342
5134
|
exports.BasicDescription = BasicDescription;
|
|
4343
|
-
exports.BasicForm = _sfc_main$
|
|
5135
|
+
exports.BasicForm = _sfc_main$5;
|
|
4344
5136
|
exports.BasicModal = BasicModal;
|
|
4345
5137
|
exports.BasicTable = BasicTable;
|
|
5138
|
+
exports.BasicTextEllipsis = BasicTextEllipsis;
|
|
4346
5139
|
exports.BasicUpload = BasicUpload;
|
|
4347
5140
|
exports.componentMap = componentMap;
|
|
4348
5141
|
exports.createFormSchema = createFormSchema;
|