knt-shared 1.2.6 → 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 +10 -4
- package/dist/components/Form/BasicForm.vue.d.ts.map +1 -1
- package/dist/components/Form/types.d.ts +9 -3
- 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/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs.js +918 -125
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +918 -125
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +29 -8
- package/dist/types/global.d.ts +2 -2
- package/dist/types/global.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$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
|
|
@@ -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,7 @@ 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
1187
|
function useUpload(props) {
|
|
1188
1188
|
const uploadRef = vue.ref(null);
|
|
1189
1189
|
const fileListRef = vue.ref((props == null ? void 0 : props.defaultFileList) || []);
|
|
@@ -1353,7 +1353,7 @@ function getRules(component, label) {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
return [{ required: true, message: `请选择${label}` }];
|
|
1355
1355
|
}
|
|
1356
|
-
const _sfc_main$
|
|
1356
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
1357
1357
|
...{
|
|
1358
1358
|
name: "BasicForm",
|
|
1359
1359
|
inheritAttrs: false
|
|
@@ -1486,6 +1486,29 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1486
1486
|
const componentType = typeof schema.component === "string" ? schema.component : "";
|
|
1487
1487
|
return getPlaceholder(componentType, schema.label);
|
|
1488
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
|
+
};
|
|
1489
1512
|
const handleSubmit = async (data) => {
|
|
1490
1513
|
try {
|
|
1491
1514
|
submitLoading.value = true;
|
|
@@ -1649,6 +1672,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1649
1672
|
dynamicProps.value = {};
|
|
1650
1673
|
});
|
|
1651
1674
|
return (_ctx, _cache) => {
|
|
1675
|
+
const _component_a_tooltip = vue.resolveComponent("a-tooltip");
|
|
1652
1676
|
const _component_a_form_item = vue.resolveComponent("a-form-item");
|
|
1653
1677
|
const _component_a_col = vue.resolveComponent("a-col");
|
|
1654
1678
|
const _component_a_button = vue.resolveComponent("a-button");
|
|
@@ -1676,7 +1700,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1676
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({
|
|
1677
1701
|
key: 1,
|
|
1678
1702
|
ref_for: true
|
|
1679
|
-
}, getFormItemBindValue(schema)), {
|
|
1703
|
+
}, getFormItemBindValue(schema)), vue.createSlots({
|
|
1680
1704
|
default: vue.withCtx(() => [
|
|
1681
1705
|
schema.slotName ? vue.renderSlot(_ctx.$slots, schema.slotName, {
|
|
1682
1706
|
key: 0,
|
|
@@ -1690,7 +1714,28 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1690
1714
|
}, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
|
|
1691
1715
|
]),
|
|
1692
1716
|
_: 2
|
|
1693
|
-
},
|
|
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))
|
|
1694
1739
|
]),
|
|
1695
1740
|
_: 2
|
|
1696
1741
|
}, 1040, ["data-field"]);
|
|
@@ -2039,6 +2084,122 @@ function throttle(func, wait = 300) {
|
|
|
2039
2084
|
}
|
|
2040
2085
|
};
|
|
2041
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"]]);
|
|
2042
2203
|
function useLocalStorage(key, initialValue) {
|
|
2043
2204
|
let initialStoredValue;
|
|
2044
2205
|
try {
|
|
@@ -2071,6 +2232,456 @@ function useLocalStorage(key, initialValue) {
|
|
|
2071
2232
|
);
|
|
2072
2233
|
return [storedValue, setValue];
|
|
2073
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);
|
|
2595
|
+
}
|
|
2596
|
+
delete editingStateMap[recordKey];
|
|
2597
|
+
delete editValueMap[recordKey];
|
|
2598
|
+
delete originalDataMap[recordKey];
|
|
2599
|
+
delete validationErrorMap[recordKey];
|
|
2600
|
+
};
|
|
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;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
const index = dataSource.value.findIndex((item) => getRowKey(item) === recordKey);
|
|
2613
|
+
if (index > -1) {
|
|
2614
|
+
dataSource.value.splice(index, 1);
|
|
2615
|
+
}
|
|
2616
|
+
delete editingStateMap[recordKey];
|
|
2617
|
+
delete editValueMap[recordKey];
|
|
2618
|
+
delete originalDataMap[recordKey];
|
|
2619
|
+
delete validationErrorMap[recordKey];
|
|
2620
|
+
webVue.Message.success("删除成功");
|
|
2621
|
+
};
|
|
2622
|
+
const addRow = async () => {
|
|
2623
|
+
let newRecord = {};
|
|
2624
|
+
if (editConfig.value.onAdd) {
|
|
2625
|
+
try {
|
|
2626
|
+
newRecord = await editConfig.value.onAdd();
|
|
2627
|
+
} catch (error) {
|
|
2628
|
+
console.error("[useTableEdit] onAdd error:", error);
|
|
2629
|
+
webVue.Message.error("添加失败");
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
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
|
+
};
|
|
2684
|
+
}
|
|
2074
2685
|
const _hoisted_1$2 = { class: "basic-table-wrapper" };
|
|
2075
2686
|
const _hoisted_2$2 = {
|
|
2076
2687
|
key: 0,
|
|
@@ -2133,9 +2744,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2133
2744
|
autoHeight: { type: Boolean, default: false },
|
|
2134
2745
|
maxHeight: {},
|
|
2135
2746
|
tableClass: {},
|
|
2136
|
-
tableStyle: {}
|
|
2747
|
+
tableStyle: {},
|
|
2748
|
+
editConfig: {}
|
|
2137
2749
|
},
|
|
2138
|
-
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"],
|
|
2139
2751
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2140
2752
|
const DEBOUNCE_DELAY = {
|
|
2141
2753
|
REFRESH: 300,
|
|
@@ -2344,6 +2956,31 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2344
2956
|
}
|
|
2345
2957
|
return record[mergedProps.rowKey];
|
|
2346
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
|
+
});
|
|
2347
2984
|
const getViewColumns = vue.computed(() => {
|
|
2348
2985
|
const mergedProps = getMergedProps.value;
|
|
2349
2986
|
let columns = [...mergedProps.columns];
|
|
@@ -2381,6 +3018,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2381
3018
|
}
|
|
2382
3019
|
columns = columns.filter((col) => col.show !== false);
|
|
2383
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
|
+
}
|
|
2384
3028
|
if (!col.slotName && (col.customRender || col.format)) {
|
|
2385
3029
|
return { ...col, slotName: col.dataIndex };
|
|
2386
3030
|
}
|
|
@@ -2820,7 +3464,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2820
3464
|
expandAll,
|
|
2821
3465
|
collapseAll,
|
|
2822
3466
|
tableRef,
|
|
2823
|
-
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
|
|
2824
3481
|
});
|
|
2825
3482
|
vue.onMounted(async () => {
|
|
2826
3483
|
await vue.nextTick();
|
|
@@ -2850,7 +3507,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2850
3507
|
expandAll,
|
|
2851
3508
|
collapseAll,
|
|
2852
3509
|
tableRef,
|
|
2853
|
-
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
|
|
2854
3524
|
};
|
|
2855
3525
|
const formInstance = {
|
|
2856
3526
|
getFieldsValue: () => {
|
|
@@ -2952,7 +3622,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2952
3622
|
const _component_a_table = vue.resolveComponent("a-table");
|
|
2953
3623
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
2954
3624
|
getSearchConfig.value.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
2955
|
-
vue.createVNode(vue.unref(_sfc_main$
|
|
3625
|
+
vue.createVNode(vue.unref(_sfc_main$5), vue.mergeProps({
|
|
2956
3626
|
ref_key: "searchFormRef",
|
|
2957
3627
|
ref: searchFormRef
|
|
2958
3628
|
}, getSearchFormProps.value, {
|
|
@@ -3153,84 +3823,103 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3153
3823
|
vue.renderList(getViewColumns.value.filter((c) => c.slotName), (col) => {
|
|
3154
3824
|
return {
|
|
3155
3825
|
name: col.slotName,
|
|
3156
|
-
fn: vue.withCtx((slotProps) =>
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
key: 0,
|
|
3171
|
-
content: action.popConfirm.title,
|
|
3172
|
-
"ok-text": action.popConfirm.okText,
|
|
3173
|
-
"cancel-text": action.popConfirm.cancelText,
|
|
3174
|
-
onOk: ($event) => {
|
|
3175
|
-
var _a, _b;
|
|
3176
|
-
return (_b = (_a = action.popConfirm).onConfirm) == null ? void 0 : _b.call(_a, slotProps.record);
|
|
3177
|
-
},
|
|
3178
|
-
onCancel: action.popConfirm.onCancel
|
|
3179
|
-
}, {
|
|
3180
|
-
default: vue.withCtx(() => [
|
|
3181
|
-
vue.createVNode(_component_a_link, {
|
|
3182
|
-
status: action.color,
|
|
3183
|
-
disabled: getActionDisabled(action, slotProps.record),
|
|
3184
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3185
|
-
}, ["stop"]))
|
|
3186
|
-
}, vue.createSlots({
|
|
3187
|
-
default: vue.withCtx(() => [
|
|
3188
|
-
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3189
|
-
]),
|
|
3190
|
-
_: 2
|
|
3191
|
-
}, [
|
|
3192
|
-
action.icon ? {
|
|
3193
|
-
name: "icon",
|
|
3194
|
-
fn: vue.withCtx(() => [
|
|
3195
|
-
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.icon)))
|
|
3196
|
-
]),
|
|
3197
|
-
key: "0"
|
|
3198
|
-
} : void 0
|
|
3199
|
-
]), 1032, ["status", "disabled"])
|
|
3200
|
-
]),
|
|
3201
|
-
_: 2
|
|
3202
|
-
}, 1032, ["content", "ok-text", "cancel-text", "onOk", "onCancel"])) : (vue.openBlock(), vue.createBlock(_component_a_link, {
|
|
3203
|
-
key: 1,
|
|
3204
|
-
status: action.color,
|
|
3205
|
-
disabled: getActionDisabled(action, slotProps.record),
|
|
3206
|
-
onClick: ($event) => handleActionClick(action, slotProps.record)
|
|
3207
|
-
}, vue.createSlots({
|
|
3208
|
-
default: vue.withCtx(() => [
|
|
3209
|
-
vue.createTextVNode(" " + vue.toDisplayString(action.label), 1)
|
|
3210
|
-
]),
|
|
3211
|
-
_: 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
|
|
3212
3840
|
}, [
|
|
3213
|
-
action.
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
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"])
|
|
3217
3872
|
]),
|
|
3218
|
-
|
|
3219
|
-
} :
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
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
|
+
})
|
|
3234
3923
|
};
|
|
3235
3924
|
})
|
|
3236
3925
|
]), 1040, ["columns", "data", "loading", "pagination", "row-selection", "expandable", "scroll", "draggable", "bordered", "stripe", "show-header", "size", "row-key"])
|
|
@@ -3238,7 +3927,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3238
3927
|
};
|
|
3239
3928
|
}
|
|
3240
3929
|
});
|
|
3241
|
-
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3930
|
+
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-42280842"]]);
|
|
3242
3931
|
function useTable(options = {}) {
|
|
3243
3932
|
const tableRef = vue.ref(null);
|
|
3244
3933
|
const formRef = vue.ref(null);
|
|
@@ -3441,6 +4130,96 @@ function useTable(options = {}) {
|
|
|
3441
4130
|
}
|
|
3442
4131
|
return form;
|
|
3443
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
|
+
};
|
|
3444
4223
|
const tableMethods = {
|
|
3445
4224
|
getDataSource,
|
|
3446
4225
|
setDataSource,
|
|
@@ -3465,7 +4244,20 @@ function useTable(options = {}) {
|
|
|
3465
4244
|
collapseAll,
|
|
3466
4245
|
getForm,
|
|
3467
4246
|
tableRef,
|
|
3468
|
-
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
|
|
3469
4261
|
};
|
|
3470
4262
|
return [register, tableMethods];
|
|
3471
4263
|
}
|
|
@@ -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;
|