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.
Files changed (37) hide show
  1. package/dist/components/Description/types.d.ts +2 -2
  2. package/dist/components/Description/types.d.ts.map +1 -1
  3. package/dist/components/Form/BasicForm.vue.d.ts +10 -4
  4. package/dist/components/Form/BasicForm.vue.d.ts.map +1 -1
  5. package/dist/components/Form/types.d.ts +9 -3
  6. package/dist/components/Form/types.d.ts.map +1 -1
  7. package/dist/components/Table/BasicTable.vue.d.ts +20 -0
  8. package/dist/components/Table/BasicTable.vue.d.ts.map +1 -1
  9. package/dist/components/Table/components/EditCell.vue.d.ts +45 -0
  10. package/dist/components/Table/components/EditCell.vue.d.ts.map +1 -0
  11. package/dist/components/Table/components/componentMap.d.ts +1299 -0
  12. package/dist/components/Table/components/componentMap.d.ts.map +1 -0
  13. package/dist/components/Table/hooks/useEditValidation.d.ts +18 -0
  14. package/dist/components/Table/hooks/useEditValidation.d.ts.map +1 -0
  15. package/dist/components/Table/hooks/useTableEdit.d.ts +27 -0
  16. package/dist/components/Table/hooks/useTableEdit.d.ts.map +1 -0
  17. package/dist/components/Table/index.d.ts +2 -2
  18. package/dist/components/Table/index.d.ts.map +1 -1
  19. package/dist/components/Table/types.d.ts +120 -6
  20. package/dist/components/Table/types.d.ts.map +1 -1
  21. package/dist/components/Table/useTable.d.ts.map +1 -1
  22. package/dist/components/TextEllipsis/BasicTextEllipsis.vue.d.ts +43 -0
  23. package/dist/components/TextEllipsis/BasicTextEllipsis.vue.d.ts.map +1 -0
  24. package/dist/components/TextEllipsis/index.d.ts +6 -0
  25. package/dist/components/TextEllipsis/index.d.ts.map +1 -0
  26. package/dist/components/TextEllipsis/types.d.ts +18 -0
  27. package/dist/components/TextEllipsis/types.d.ts.map +1 -0
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/components/index.d.ts.map +1 -1
  30. package/dist/index.cjs.js +918 -125
  31. package/dist/index.cjs.js.map +1 -1
  32. package/dist/index.esm.js +918 -125
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/style.css +29 -8
  35. package/dist/types/global.d.ts +2 -2
  36. package/dist/types/global.d.ts.map +1 -1
  37. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -22,7 +22,7 @@ var _export_sfc$1 = (sfc, props) => {
22
22
  }
23
23
  return sfc;
24
24
  };
25
- const _sfc_main$c = defineComponent({
25
+ const _sfc_main$e = defineComponent({
26
26
  name: "IconPlus",
27
27
  props: {
28
28
  size: {
@@ -75,7 +75,7 @@ const _sfc_main$c = defineComponent({
75
75
  };
76
76
  }
77
77
  });
78
- const _hoisted_1$b = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
78
+ const _hoisted_1$d = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
79
79
  function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
80
80
  return openBlock(), createElementBlock("svg", {
81
81
  viewBox: "0 0 48 48",
@@ -90,9 +90,9 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
90
90
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
91
91
  }, _cache[1] || (_cache[1] = [
92
92
  createElementVNode("path", { d: "M5 24h38M24 5v38" }, null, -1)
93
- ]), 14, _hoisted_1$b);
93
+ ]), 14, _hoisted_1$d);
94
94
  }
95
- var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$7]]);
95
+ var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$7]]);
96
96
  const IconPlus = Object.assign(_IconPlus, {
97
97
  install: (app, options) => {
98
98
  var _a;
@@ -100,7 +100,7 @@ const IconPlus = Object.assign(_IconPlus, {
100
100
  app.component(iconPrefix + _IconPlus.name, _IconPlus);
101
101
  }
102
102
  });
103
- const _sfc_main$b = defineComponent({
103
+ const _sfc_main$d = defineComponent({
104
104
  name: "IconQuestionCircle",
105
105
  props: {
106
106
  size: {
@@ -153,7 +153,7 @@ const _sfc_main$b = defineComponent({
153
153
  };
154
154
  }
155
155
  });
156
- const _hoisted_1$a = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
156
+ const _hoisted_1$c = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
157
157
  function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
158
158
  return openBlock(), createElementBlock("svg", {
159
159
  viewBox: "0 0 48 48",
@@ -169,9 +169,9 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
169
169
  }, _cache[1] || (_cache[1] = [
170
170
  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),
171
171
  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)
172
- ]), 14, _hoisted_1$a);
172
+ ]), 14, _hoisted_1$c);
173
173
  }
174
- var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$6]]);
174
+ var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$6]]);
175
175
  const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
176
176
  install: (app, options) => {
177
177
  var _a;
@@ -179,7 +179,7 @@ const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
179
179
  app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
180
180
  }
181
181
  });
182
- const _sfc_main$a = defineComponent({
182
+ const _sfc_main$c = defineComponent({
183
183
  name: "IconRefresh",
184
184
  props: {
185
185
  size: {
@@ -232,7 +232,7 @@ const _sfc_main$a = defineComponent({
232
232
  };
233
233
  }
234
234
  });
235
- const _hoisted_1$9 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
235
+ const _hoisted_1$b = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
236
236
  function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
237
237
  return openBlock(), createElementBlock("svg", {
238
238
  viewBox: "0 0 48 48",
@@ -247,9 +247,9 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
247
247
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
248
248
  }, _cache[1] || (_cache[1] = [
249
249
  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)
250
- ]), 14, _hoisted_1$9);
250
+ ]), 14, _hoisted_1$b);
251
251
  }
252
- var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$5]]);
252
+ var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$5]]);
253
253
  const IconRefresh = Object.assign(_IconRefresh, {
254
254
  install: (app, options) => {
255
255
  var _a;
@@ -257,7 +257,7 @@ const IconRefresh = Object.assign(_IconRefresh, {
257
257
  app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
258
258
  }
259
259
  });
260
- const _sfc_main$9 = defineComponent({
260
+ const _sfc_main$b = defineComponent({
261
261
  name: "IconSettings",
262
262
  props: {
263
263
  size: {
@@ -310,7 +310,7 @@ const _sfc_main$9 = defineComponent({
310
310
  };
311
311
  }
312
312
  });
313
- const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
313
+ const _hoisted_1$a = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
314
314
  function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
315
315
  return openBlock(), createElementBlock("svg", {
316
316
  viewBox: "0 0 48 48",
@@ -326,9 +326,9 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
326
326
  }, _cache[1] || (_cache[1] = [
327
327
  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),
328
328
  createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
329
- ]), 14, _hoisted_1$8);
329
+ ]), 14, _hoisted_1$a);
330
330
  }
331
- var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$4]]);
331
+ var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$4]]);
332
332
  const IconSettings = Object.assign(_IconSettings, {
333
333
  install: (app, options) => {
334
334
  var _a;
@@ -336,7 +336,7 @@ const IconSettings = Object.assign(_IconSettings, {
336
336
  app.component(iconPrefix + _IconSettings.name, _IconSettings);
337
337
  }
338
338
  });
339
- const _sfc_main$8 = defineComponent({
339
+ const _sfc_main$a = defineComponent({
340
340
  name: "IconUpload",
341
341
  props: {
342
342
  size: {
@@ -389,7 +389,7 @@ const _sfc_main$8 = defineComponent({
389
389
  };
390
390
  }
391
391
  });
392
- const _hoisted_1$7 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
392
+ const _hoisted_1$9 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
393
393
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
394
394
  return openBlock(), createElementBlock("svg", {
395
395
  viewBox: "0 0 48 48",
@@ -404,9 +404,9 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
404
404
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
405
405
  }, _cache[1] || (_cache[1] = [
406
406
  createElementVNode("path", { d: "M14.93 17.071 24.001 8l9.071 9.071m-9.07 16.071v-25M40 35v6H8v-6" }, null, -1)
407
- ]), 14, _hoisted_1$7);
407
+ ]), 14, _hoisted_1$9);
408
408
  }
409
- var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$3]]);
409
+ var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$3]]);
410
410
  const IconUpload = Object.assign(_IconUpload, {
411
411
  install: (app, options) => {
412
412
  var _a;
@@ -414,7 +414,7 @@ const IconUpload = Object.assign(_IconUpload, {
414
414
  app.component(iconPrefix + _IconUpload.name, _IconUpload);
415
415
  }
416
416
  });
417
- const _sfc_main$7 = defineComponent({
417
+ const _sfc_main$9 = defineComponent({
418
418
  name: "IconLineHeight",
419
419
  props: {
420
420
  size: {
@@ -467,7 +467,7 @@ const _sfc_main$7 = defineComponent({
467
467
  };
468
468
  }
469
469
  });
470
- const _hoisted_1$6 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
470
+ const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
471
471
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
472
472
  return openBlock(), createElementBlock("svg", {
473
473
  viewBox: "0 0 48 48",
@@ -488,9 +488,9 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
488
488
  stroke: "none"
489
489
  }, null, -1),
490
490
  createElementVNode("path", { d: "M39 13h2l-2-3.5-2 3.5h2Zm0 0v22m0 0h2l-2 3.5-2-3.5h2Z" }, null, -1)
491
- ]), 14, _hoisted_1$6);
491
+ ]), 14, _hoisted_1$8);
492
492
  }
493
- var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$2]]);
493
+ var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$2]]);
494
494
  const IconLineHeight = Object.assign(_IconLineHeight, {
495
495
  install: (app, options) => {
496
496
  var _a;
@@ -498,7 +498,7 @@ const IconLineHeight = Object.assign(_IconLineHeight, {
498
498
  app.component(iconPrefix + _IconLineHeight.name, _IconLineHeight);
499
499
  }
500
500
  });
501
- const _sfc_main$6 = defineComponent({
501
+ const _sfc_main$8 = defineComponent({
502
502
  name: "IconFullscreenExit",
503
503
  props: {
504
504
  size: {
@@ -551,7 +551,7 @@ const _sfc_main$6 = defineComponent({
551
551
  };
552
552
  }
553
553
  });
554
- const _hoisted_1$5 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
554
+ const _hoisted_1$7 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
555
555
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
556
556
  return openBlock(), createElementBlock("svg", {
557
557
  viewBox: "0 0 48 48",
@@ -566,9 +566,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
566
566
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
567
567
  }, _cache[1] || (_cache[1] = [
568
568
  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)
569
- ]), 14, _hoisted_1$5);
569
+ ]), 14, _hoisted_1$7);
570
570
  }
571
- var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$1]]);
571
+ var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$1]]);
572
572
  const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
573
573
  install: (app, options) => {
574
574
  var _a;
@@ -576,7 +576,7 @@ const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
576
576
  app.component(iconPrefix + _IconFullscreenExit.name, _IconFullscreenExit);
577
577
  }
578
578
  });
579
- const _sfc_main$5 = defineComponent({
579
+ const _sfc_main$7 = defineComponent({
580
580
  name: "IconFullscreen",
581
581
  props: {
582
582
  size: {
@@ -629,7 +629,7 @@ const _sfc_main$5 = defineComponent({
629
629
  };
630
630
  }
631
631
  });
632
- const _hoisted_1$4 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
632
+ const _hoisted_1$6 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
633
633
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
634
634
  return openBlock(), createElementBlock("svg", {
635
635
  viewBox: "0 0 48 48",
@@ -644,9 +644,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
644
644
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
645
645
  }, _cache[1] || (_cache[1] = [
646
646
  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)
647
- ]), 14, _hoisted_1$4);
647
+ ]), 14, _hoisted_1$6);
648
648
  }
649
- var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render]]);
649
+ var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render]]);
650
650
  const IconFullscreen = Object.assign(_IconFullscreen, {
651
651
  install: (app, options) => {
652
652
  var _a;
@@ -654,13 +654,13 @@ const IconFullscreen = Object.assign(_IconFullscreen, {
654
654
  app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
655
655
  }
656
656
  });
657
- const _hoisted_1$3 = { class: "basic-upload" };
658
- const _hoisted_2$3 = {
657
+ const _hoisted_1$5 = { class: "basic-upload" };
658
+ const _hoisted_2$4 = {
659
659
  key: 0,
660
660
  class: "upload-text"
661
661
  };
662
662
  const _hoisted_3$2 = { class: "upload-tip" };
663
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
663
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
664
664
  ...{
665
665
  name: "BasicUpload",
666
666
  inheritAttrs: false
@@ -1104,7 +1104,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1104
1104
  return (_ctx, _cache) => {
1105
1105
  const _component_a_button = resolveComponent("a-button");
1106
1106
  const _component_a_upload = resolveComponent("a-upload");
1107
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
1107
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
1108
1108
  createVNode(_component_a_upload, mergeProps({
1109
1109
  ref_key: "uploadRef",
1110
1110
  ref: uploadRef
@@ -1129,7 +1129,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1129
1129
  })
1130
1130
  }, [
1131
1131
  createVNode(unref(IconPlus), { size: 16 }),
1132
- getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
1132
+ getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_2$4, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
1133
1133
  ], 4)) : (openBlock(), createBlock(_component_a_button, {
1134
1134
  key: 1,
1135
1135
  type: getProps.value.uploadButtonType || "primary"
@@ -1181,7 +1181,7 @@ const _export_sfc = (sfc, props) => {
1181
1181
  }
1182
1182
  return target;
1183
1183
  };
1184
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-03d56780"]]);
1184
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-03d56780"]]);
1185
1185
  function useUpload(props) {
1186
1186
  const uploadRef = ref(null);
1187
1187
  const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
@@ -1351,7 +1351,7 @@ function getRules(component, label) {
1351
1351
  }
1352
1352
  return [{ required: true, message: `请选择${label}` }];
1353
1353
  }
1354
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1354
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1355
1355
  ...{
1356
1356
  name: "BasicForm",
1357
1357
  inheritAttrs: false
@@ -1484,6 +1484,29 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1484
1484
  const componentType = typeof schema.component === "string" ? schema.component : "";
1485
1485
  return getPlaceholder(componentType, schema.label);
1486
1486
  };
1487
+ const shouldRenderCustomLabel = (schema) => {
1488
+ return !!(schema.labelEllipsis || schema.labelTooltip);
1489
+ };
1490
+ const getLabelStyle = (schema) => {
1491
+ if (!schema.labelEllipsis) {
1492
+ return {};
1493
+ }
1494
+ const maxWidth = schema.labelMaxWidth || "150px";
1495
+ return {
1496
+ display: "inline-block",
1497
+ maxWidth: typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth,
1498
+ overflow: "hidden",
1499
+ textOverflow: "ellipsis",
1500
+ whiteSpace: "nowrap",
1501
+ verticalAlign: "middle"
1502
+ };
1503
+ };
1504
+ const getLabelTooltipContent = (schema) => {
1505
+ if (typeof schema.labelTooltip === "string") {
1506
+ return schema.labelTooltip;
1507
+ }
1508
+ return schema.label;
1509
+ };
1487
1510
  const handleSubmit = async (data) => {
1488
1511
  try {
1489
1512
  submitLoading.value = true;
@@ -1647,6 +1670,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1647
1670
  dynamicProps.value = {};
1648
1671
  });
1649
1672
  return (_ctx, _cache) => {
1673
+ const _component_a_tooltip = resolveComponent("a-tooltip");
1650
1674
  const _component_a_form_item = resolveComponent("a-form-item");
1651
1675
  const _component_a_col = resolveComponent("a-col");
1652
1676
  const _component_a_button = resolveComponent("a-button");
@@ -1674,7 +1698,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1674
1698
  schema.render ? (openBlock(), createBlock(resolveDynamicComponent(schema.render(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(_component_a_form_item, mergeProps({
1675
1699
  key: 1,
1676
1700
  ref_for: true
1677
- }, getFormItemBindValue(schema)), {
1701
+ }, getFormItemBindValue(schema)), createSlots({
1678
1702
  default: withCtx(() => [
1679
1703
  schema.slotName ? renderSlot(_ctx.$slots, schema.slotName, {
1680
1704
  key: 0,
@@ -1688,7 +1712,28 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1688
1712
  }, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
1689
1713
  ]),
1690
1714
  _: 2
1691
- }, 1040))
1715
+ }, [
1716
+ shouldRenderCustomLabel(schema) ? {
1717
+ name: "label",
1718
+ fn: withCtx(() => [
1719
+ schema.labelTooltip ? (openBlock(), createBlock(_component_a_tooltip, {
1720
+ key: 0,
1721
+ content: getLabelTooltipContent(schema)
1722
+ }, {
1723
+ default: withCtx(() => [
1724
+ createElementVNode("span", {
1725
+ style: normalizeStyle(getLabelStyle(schema))
1726
+ }, toDisplayString(schema.label), 5)
1727
+ ]),
1728
+ _: 2
1729
+ }, 1032, ["content"])) : (openBlock(), createElementBlock("span", {
1730
+ key: 1,
1731
+ style: normalizeStyle(getLabelStyle(schema))
1732
+ }, toDisplayString(schema.label), 5))
1733
+ ]),
1734
+ key: "0"
1735
+ } : void 0
1736
+ ]), 1040))
1692
1737
  ]),
1693
1738
  _: 2
1694
1739
  }, 1040, ["data-field"]);
@@ -2037,6 +2082,122 @@ function throttle(func, wait = 300) {
2037
2082
  }
2038
2083
  };
2039
2084
  }
2085
+ const _hoisted_1$4 = { class: "basic-text-ellipsis" };
2086
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2087
+ __name: "BasicTextEllipsis",
2088
+ props: {
2089
+ text: { default: "" },
2090
+ lines: { default: 1 },
2091
+ tooltip: { type: Boolean, default: true },
2092
+ tooltipTrigger: { default: "hover" },
2093
+ tooltipProps: { default: () => ({}) },
2094
+ alwaysShowTooltip: { type: Boolean, default: false }
2095
+ },
2096
+ setup(__props) {
2097
+ const props = __props;
2098
+ const textRef = ref();
2099
+ const isTruncated = ref(false);
2100
+ let resizeObserver = null;
2101
+ const ellipsisStyle = computed(() => {
2102
+ if (props.lines === 1) {
2103
+ return {
2104
+ overflow: "hidden",
2105
+ textOverflow: "ellipsis",
2106
+ whiteSpace: "nowrap"
2107
+ };
2108
+ }
2109
+ return {
2110
+ display: "-webkit-box",
2111
+ "-webkit-box-orient": "vertical",
2112
+ "-webkit-line-clamp": props.lines,
2113
+ overflow: "hidden",
2114
+ textOverflow: "ellipsis",
2115
+ wordBreak: "break-word"
2116
+ };
2117
+ });
2118
+ const showTooltip = computed(() => {
2119
+ if (!props.tooltip) {
2120
+ return false;
2121
+ }
2122
+ if (props.alwaysShowTooltip) {
2123
+ return true;
2124
+ }
2125
+ return isTruncated.value;
2126
+ });
2127
+ const checkTruncation = () => {
2128
+ if (!textRef.value) {
2129
+ return;
2130
+ }
2131
+ const element = textRef.value;
2132
+ if (props.lines === 1) {
2133
+ isTruncated.value = element.scrollWidth > element.clientWidth;
2134
+ } else {
2135
+ isTruncated.value = element.scrollHeight > element.clientHeight;
2136
+ }
2137
+ };
2138
+ const debouncedCheck = debounce(checkTruncation, 100);
2139
+ const initResizeObserver = () => {
2140
+ if (!textRef.value) {
2141
+ return;
2142
+ }
2143
+ resizeObserver = new ResizeObserver(() => {
2144
+ debouncedCheck();
2145
+ });
2146
+ resizeObserver.observe(textRef.value);
2147
+ };
2148
+ const cleanupResizeObserver = () => {
2149
+ if (resizeObserver) {
2150
+ resizeObserver.disconnect();
2151
+ resizeObserver = null;
2152
+ }
2153
+ debouncedCheck.cancel();
2154
+ };
2155
+ onMounted(() => {
2156
+ nextTick(() => {
2157
+ checkTruncation();
2158
+ initResizeObserver();
2159
+ });
2160
+ });
2161
+ onBeforeUnmount(() => {
2162
+ cleanupResizeObserver();
2163
+ });
2164
+ watch(
2165
+ () => [props.text, props.lines],
2166
+ () => {
2167
+ nextTick(() => {
2168
+ checkTruncation();
2169
+ });
2170
+ }
2171
+ );
2172
+ return (_ctx, _cache) => {
2173
+ const _component_a_tooltip = resolveComponent("a-tooltip");
2174
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
2175
+ showTooltip.value ? (openBlock(), createBlock(_component_a_tooltip, mergeProps({
2176
+ key: 0,
2177
+ content: __props.text,
2178
+ trigger: __props.tooltipTrigger
2179
+ }, __props.tooltipProps), {
2180
+ default: withCtx(() => [
2181
+ createElementVNode("div", {
2182
+ ref_key: "textRef",
2183
+ ref: textRef,
2184
+ class: "text-ellipsis-content",
2185
+ style: normalizeStyle(ellipsisStyle.value)
2186
+ }, toDisplayString(__props.text), 5)
2187
+ ]),
2188
+ _: 1
2189
+ }, 16, ["content", "trigger"])) : (openBlock(), createElementBlock("div", {
2190
+ key: 1,
2191
+ ref_key: "textRef",
2192
+ ref: textRef,
2193
+ class: "text-ellipsis-content",
2194
+ style: normalizeStyle(ellipsisStyle.value)
2195
+ }, toDisplayString(__props.text), 5))
2196
+ ]);
2197
+ };
2198
+ }
2199
+ });
2200
+ const BasicTextEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-05b93f77"]]);
2040
2201
  function useLocalStorage(key, initialValue) {
2041
2202
  let initialStoredValue;
2042
2203
  try {
@@ -2069,6 +2230,456 @@ function useLocalStorage(key, initialValue) {
2069
2230
  );
2070
2231
  return [storedValue, setValue];
2071
2232
  }
2233
+ const editComponentMap = {
2234
+ ...componentMap
2235
+ // 可以添加 Table 专用的编辑组件
2236
+ };
2237
+ function getEditComponent(name) {
2238
+ if (typeof name === "string") {
2239
+ return editComponentMap[name];
2240
+ }
2241
+ return name;
2242
+ }
2243
+ const _hoisted_1$3 = { class: "edit-cell" };
2244
+ const _hoisted_2$3 = {
2245
+ key: 0,
2246
+ class: "edit-cell-error"
2247
+ };
2248
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2249
+ ...{
2250
+ name: "EditCell"
2251
+ },
2252
+ __name: "EditCell",
2253
+ props: {
2254
+ column: {},
2255
+ record: {},
2256
+ value: {},
2257
+ size: { default: "small" },
2258
+ error: {}
2259
+ },
2260
+ emits: ["change"],
2261
+ setup(__props, { emit: __emit }) {
2262
+ const props = __props;
2263
+ const emit = __emit;
2264
+ const editComponent = computed(() => {
2265
+ if (!props.column.editComponent) {
2266
+ return getEditComponent("Input");
2267
+ }
2268
+ return getEditComponent(props.column.editComponent);
2269
+ });
2270
+ const componentProps = computed(() => {
2271
+ let baseProps = {
2272
+ placeholder: `请输入${props.column.title || ""}`
2273
+ };
2274
+ if (props.column.editComponentProps) {
2275
+ if (typeof props.column.editComponentProps === "function") {
2276
+ const dynamicProps = props.column.editComponentProps(props.record);
2277
+ baseProps = { ...baseProps, ...dynamicProps };
2278
+ } else {
2279
+ baseProps = { ...baseProps, ...props.column.editComponentProps };
2280
+ }
2281
+ }
2282
+ return baseProps;
2283
+ });
2284
+ const handleChange = (value) => {
2285
+ emit("change", value);
2286
+ };
2287
+ return (_ctx, _cache) => {
2288
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
2289
+ (openBlock(), createBlock(resolveDynamicComponent(editComponent.value), mergeProps(componentProps.value, {
2290
+ "model-value": __props.value,
2291
+ "onUpdate:modelValue": handleChange,
2292
+ size: __props.size,
2293
+ status: __props.error ? "error" : void 0,
2294
+ class: "edit-cell-input"
2295
+ }), null, 16, ["model-value", "size", "status"])),
2296
+ __props.error ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(__props.error), 1)) : createCommentVNode("", true)
2297
+ ]);
2298
+ };
2299
+ }
2300
+ });
2301
+ const EditCell = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-3dab69d1"]]);
2302
+ function useEditValidation() {
2303
+ const validateField = async (value, column, record) => {
2304
+ if (!column.editRule) {
2305
+ return { valid: true };
2306
+ }
2307
+ const rules = Array.isArray(column.editRule) ? column.editRule : [column.editRule];
2308
+ for (const rule of rules) {
2309
+ const result = await validateSingleRule(value, rule, column, record);
2310
+ if (!result.valid) {
2311
+ return result;
2312
+ }
2313
+ }
2314
+ return { valid: true };
2315
+ };
2316
+ const validateSingleRule = async (value, rule, column, record) => {
2317
+ const label = column.title || column.dataIndex || "字段";
2318
+ if (rule.required) {
2319
+ if (value === null || value === void 0 || value === "") {
2320
+ return {
2321
+ valid: false,
2322
+ message: rule.message || `请输入${label}`
2323
+ };
2324
+ }
2325
+ }
2326
+ if (value === null || value === void 0 || value === "") {
2327
+ return { valid: true };
2328
+ }
2329
+ if (rule.pattern) {
2330
+ if (!rule.pattern.test(String(value))) {
2331
+ return {
2332
+ valid: false,
2333
+ message: rule.message || `${label}格式不正确`
2334
+ };
2335
+ }
2336
+ }
2337
+ if (typeof value === "number") {
2338
+ if (rule.min !== void 0 && value < rule.min) {
2339
+ return {
2340
+ valid: false,
2341
+ message: rule.message || `${label}不能小于${rule.min}`
2342
+ };
2343
+ }
2344
+ if (rule.max !== void 0 && value > rule.max) {
2345
+ return {
2346
+ valid: false,
2347
+ message: rule.message || `${label}不能大于${rule.max}`
2348
+ };
2349
+ }
2350
+ }
2351
+ if (typeof value === "string") {
2352
+ if (rule.minLength !== void 0 && value.length < rule.minLength) {
2353
+ return {
2354
+ valid: false,
2355
+ message: rule.message || `${label}长度不能小于${rule.minLength}个字符`
2356
+ };
2357
+ }
2358
+ if (rule.maxLength !== void 0 && value.length > rule.maxLength) {
2359
+ return {
2360
+ valid: false,
2361
+ message: rule.message || `${label}长度不能大于${rule.maxLength}个字符`
2362
+ };
2363
+ }
2364
+ }
2365
+ if (rule.validator) {
2366
+ try {
2367
+ const result = await rule.validator(value, record);
2368
+ if (result === false) {
2369
+ return {
2370
+ valid: false,
2371
+ message: rule.message || `${label}验证失败`
2372
+ };
2373
+ }
2374
+ if (typeof result === "string") {
2375
+ return {
2376
+ valid: false,
2377
+ message: result
2378
+ };
2379
+ }
2380
+ return { valid: true };
2381
+ } catch (error) {
2382
+ console.error("[useEditValidation] validator error:", error);
2383
+ return {
2384
+ valid: false,
2385
+ message: rule.message || `${label}验证失败`
2386
+ };
2387
+ }
2388
+ }
2389
+ return { valid: true };
2390
+ };
2391
+ const validateRow = async (editValues, columns, record) => {
2392
+ const errors = {};
2393
+ for (const column of columns) {
2394
+ if (!column.dataIndex || !column.editRule) {
2395
+ continue;
2396
+ }
2397
+ const value = editValues[column.dataIndex];
2398
+ const result = await validateField(value, column, record);
2399
+ if (!result.valid && result.message) {
2400
+ errors[column.dataIndex] = result.message;
2401
+ }
2402
+ }
2403
+ return {
2404
+ valid: Object.keys(errors).length === 0,
2405
+ errors
2406
+ };
2407
+ };
2408
+ return {
2409
+ validateField,
2410
+ validateRow
2411
+ };
2412
+ }
2413
+ function useTableEdit(props, dataSource, getRowKey) {
2414
+ const editingStateMap = reactive({});
2415
+ const editValueMap = reactive({});
2416
+ const originalDataMap = reactive({});
2417
+ const validationErrorMap = reactive({});
2418
+ const { validateRow } = useEditValidation();
2419
+ const editConfig = computed(() => {
2420
+ return {
2421
+ mode: "row",
2422
+ enabled: true,
2423
+ allowAdd: true,
2424
+ allowDelete: true,
2425
+ ...props.value.editConfig
2426
+ };
2427
+ });
2428
+ const getEditableColumns = (columns) => {
2429
+ return columns.filter((col) => col.edit || col.editable);
2430
+ };
2431
+ const isEditing = (record, column) => {
2432
+ const recordKey = String(getRowKey(record));
2433
+ if (!editingStateMap[recordKey]) {
2434
+ return false;
2435
+ }
2436
+ if (column && column.dataIndex) {
2437
+ return !!editingStateMap[recordKey][column.dataIndex];
2438
+ }
2439
+ return Object.values(editingStateMap[recordKey]).some(Boolean);
2440
+ };
2441
+ const getEditValue = (record, column) => {
2442
+ const recordKey = String(getRowKey(record));
2443
+ const columnKey = column.dataIndex;
2444
+ if (editValueMap[recordKey] && columnKey in editValueMap[recordKey]) {
2445
+ return editValueMap[recordKey][columnKey];
2446
+ }
2447
+ if (column.editValueGetter) {
2448
+ return column.editValueGetter(record);
2449
+ }
2450
+ return record[columnKey];
2451
+ };
2452
+ const setEditValue = (record, column, value) => {
2453
+ const recordKey = String(getRowKey(record));
2454
+ const columnKey = column.dataIndex;
2455
+ if (!editValueMap[recordKey]) {
2456
+ editValueMap[recordKey] = {};
2457
+ }
2458
+ editValueMap[recordKey][columnKey] = value;
2459
+ if (validationErrorMap[recordKey] && validationErrorMap[recordKey][columnKey]) {
2460
+ delete validationErrorMap[recordKey][columnKey];
2461
+ }
2462
+ };
2463
+ const getValidationError = (record, column) => {
2464
+ const recordKey = String(getRowKey(record));
2465
+ const columnKey = column.dataIndex;
2466
+ if (validationErrorMap[recordKey]) {
2467
+ return validationErrorMap[recordKey][columnKey];
2468
+ }
2469
+ return void 0;
2470
+ };
2471
+ const startEdit = (record, column) => {
2472
+ const recordKey = String(getRowKey(record));
2473
+ const mode = editConfig.value.mode || "row";
2474
+ if (!originalDataMap[recordKey]) {
2475
+ originalDataMap[recordKey] = { ...record };
2476
+ }
2477
+ if (!editingStateMap[recordKey]) {
2478
+ editingStateMap[recordKey] = {};
2479
+ }
2480
+ if (!editValueMap[recordKey]) {
2481
+ editValueMap[recordKey] = {};
2482
+ }
2483
+ if (mode === "row") {
2484
+ const editableColumns = getEditableColumns(props.value.columns || []);
2485
+ editableColumns.forEach((col) => {
2486
+ if (col.dataIndex) {
2487
+ editingStateMap[recordKey][col.dataIndex] = true;
2488
+ if (!(col.dataIndex in editValueMap[recordKey])) {
2489
+ editValueMap[recordKey][col.dataIndex] = getEditValue(record, col);
2490
+ }
2491
+ }
2492
+ });
2493
+ } else if (mode === "cell" && column && column.dataIndex) {
2494
+ editingStateMap[recordKey][column.dataIndex] = true;
2495
+ if (!(column.dataIndex in editValueMap[recordKey])) {
2496
+ editValueMap[recordKey][column.dataIndex] = getEditValue(record, column);
2497
+ }
2498
+ }
2499
+ };
2500
+ const getChangedValues = (record) => {
2501
+ const recordKey = String(getRowKey(record));
2502
+ const changedValues = {};
2503
+ if (!editValueMap[recordKey]) {
2504
+ return changedValues;
2505
+ }
2506
+ Object.keys(editValueMap[recordKey]).forEach((columnKey) => {
2507
+ var _a;
2508
+ const editValue = editValueMap[recordKey][columnKey];
2509
+ const originalValue = (_a = originalDataMap[recordKey]) == null ? void 0 : _a[columnKey];
2510
+ if (editValue !== originalValue) {
2511
+ changedValues[columnKey] = editValue;
2512
+ }
2513
+ });
2514
+ return changedValues;
2515
+ };
2516
+ const saveEdit = async (record) => {
2517
+ const recordKey = String(getRowKey(record));
2518
+ if (!isEditing(record)) {
2519
+ return true;
2520
+ }
2521
+ const editableColumns = getEditableColumns(props.value.columns || []);
2522
+ let columnsToValidate;
2523
+ if (editConfig.value.mode === "cell") {
2524
+ const editingColumns = editingStateMap[recordKey] || {};
2525
+ columnsToValidate = editableColumns.filter(
2526
+ (col) => col.dataIndex && editingColumns[col.dataIndex]
2527
+ );
2528
+ } else {
2529
+ columnsToValidate = editableColumns;
2530
+ }
2531
+ const validationResult = await validateRow(
2532
+ editValueMap[recordKey] || {},
2533
+ columnsToValidate,
2534
+ record
2535
+ );
2536
+ if (!validationResult.valid) {
2537
+ validationErrorMap[recordKey] = validationResult.errors;
2538
+ const firstError = Object.values(validationResult.errors)[0];
2539
+ if (firstError) {
2540
+ Message.error(firstError);
2541
+ }
2542
+ return false;
2543
+ }
2544
+ const changedValues = getChangedValues(record);
2545
+ if (editConfig.value.beforeSave) {
2546
+ try {
2547
+ const result = await editConfig.value.beforeSave(record, changedValues);
2548
+ if (result === false) {
2549
+ return false;
2550
+ }
2551
+ } catch (error) {
2552
+ console.error("[useTableEdit] beforeSave error:", error);
2553
+ Message.error("保存前验证失败");
2554
+ return false;
2555
+ }
2556
+ }
2557
+ if (editValueMap[recordKey]) {
2558
+ Object.keys(editValueMap[recordKey]).forEach((columnKey) => {
2559
+ const column = editableColumns.find((col) => col.dataIndex === columnKey);
2560
+ let value = editValueMap[recordKey][columnKey];
2561
+ if (column == null ? void 0 : column.editValueSetter) {
2562
+ value = column.editValueSetter(value, record);
2563
+ }
2564
+ record[columnKey] = value;
2565
+ });
2566
+ }
2567
+ if (editConfig.value.onSave) {
2568
+ try {
2569
+ await editConfig.value.onSave(record, changedValues);
2570
+ } catch (error) {
2571
+ console.error("[useTableEdit] onSave error:", error);
2572
+ }
2573
+ }
2574
+ delete editingStateMap[recordKey];
2575
+ delete editValueMap[recordKey];
2576
+ delete originalDataMap[recordKey];
2577
+ delete validationErrorMap[recordKey];
2578
+ Message.success("保存成功");
2579
+ return true;
2580
+ };
2581
+ const cancelEdit = (record) => {
2582
+ const recordKey = String(getRowKey(record));
2583
+ if (!isEditing(record)) {
2584
+ return;
2585
+ }
2586
+ if (originalDataMap[recordKey]) {
2587
+ Object.keys(originalDataMap[recordKey]).forEach((key) => {
2588
+ record[key] = originalDataMap[recordKey][key];
2589
+ });
2590
+ }
2591
+ if (editConfig.value.onCancel) {
2592
+ editConfig.value.onCancel(record);
2593
+ }
2594
+ delete editingStateMap[recordKey];
2595
+ delete editValueMap[recordKey];
2596
+ delete originalDataMap[recordKey];
2597
+ delete validationErrorMap[recordKey];
2598
+ };
2599
+ const deleteRow = async (record) => {
2600
+ const recordKey = String(getRowKey(record));
2601
+ if (editConfig.value.onDelete) {
2602
+ try {
2603
+ await editConfig.value.onDelete(record);
2604
+ } catch (error) {
2605
+ console.error("[useTableEdit] onDelete error:", error);
2606
+ Message.error("删除失败");
2607
+ return;
2608
+ }
2609
+ }
2610
+ const index = dataSource.value.findIndex((item) => getRowKey(item) === recordKey);
2611
+ if (index > -1) {
2612
+ dataSource.value.splice(index, 1);
2613
+ }
2614
+ delete editingStateMap[recordKey];
2615
+ delete editValueMap[recordKey];
2616
+ delete originalDataMap[recordKey];
2617
+ delete validationErrorMap[recordKey];
2618
+ Message.success("删除成功");
2619
+ };
2620
+ const addRow = async () => {
2621
+ let newRecord = {};
2622
+ if (editConfig.value.onAdd) {
2623
+ try {
2624
+ newRecord = await editConfig.value.onAdd();
2625
+ } catch (error) {
2626
+ console.error("[useTableEdit] onAdd error:", error);
2627
+ Message.error("添加失败");
2628
+ return;
2629
+ }
2630
+ }
2631
+ const rowKey = props.value.rowKey || "id";
2632
+ if (typeof rowKey === "string" && !newRecord[rowKey]) {
2633
+ newRecord[rowKey] = `temp_${Date.now()}_${Math.random()}`;
2634
+ }
2635
+ dataSource.value.unshift(newRecord);
2636
+ startEdit(newRecord);
2637
+ };
2638
+ const getEditingRows = () => {
2639
+ const editingKeys = Object.keys(editingStateMap);
2640
+ return dataSource.value.filter((record) => {
2641
+ const recordKey = String(getRowKey(record));
2642
+ return editingKeys.includes(recordKey);
2643
+ });
2644
+ };
2645
+ const saveAllEdits = async () => {
2646
+ const editingRows = getEditingRows();
2647
+ if (editingRows.length === 0) {
2648
+ return true;
2649
+ }
2650
+ for (const record of editingRows) {
2651
+ const success = await saveEdit(record);
2652
+ if (!success) {
2653
+ return false;
2654
+ }
2655
+ }
2656
+ return true;
2657
+ };
2658
+ const cancelAllEdits = () => {
2659
+ const editingRows = getEditingRows();
2660
+ editingRows.forEach((record) => {
2661
+ cancelEdit(record);
2662
+ });
2663
+ };
2664
+ return {
2665
+ editingStateMap,
2666
+ editValueMap,
2667
+ validationErrorMap,
2668
+ isEditing,
2669
+ getEditValue,
2670
+ setEditValue,
2671
+ getValidationError,
2672
+ startEdit,
2673
+ saveEdit,
2674
+ cancelEdit,
2675
+ deleteRow,
2676
+ addRow,
2677
+ getEditingRows,
2678
+ saveAllEdits,
2679
+ cancelAllEdits,
2680
+ getChangedValues
2681
+ };
2682
+ }
2072
2683
  const _hoisted_1$2 = { class: "basic-table-wrapper" };
2073
2684
  const _hoisted_2$2 = {
2074
2685
  key: 0,
@@ -2131,9 +2742,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2131
2742
  autoHeight: { type: Boolean, default: false },
2132
2743
  maxHeight: {},
2133
2744
  tableClass: {},
2134
- tableStyle: {}
2745
+ tableStyle: {},
2746
+ editConfig: {}
2135
2747
  },
2136
- emits: ["register", "change", "select", "selectAll", "expand", "row-click", "row-dblclick", "cell-click", "search", "reset", "fetch-success", "fetch-error"],
2748
+ 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"],
2137
2749
  setup(__props, { expose: __expose, emit: __emit }) {
2138
2750
  const DEBOUNCE_DELAY = {
2139
2751
  REFRESH: 300,
@@ -2342,6 +2954,31 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2342
2954
  }
2343
2955
  return record[mergedProps.rowKey];
2344
2956
  };
2957
+ const {
2958
+ isEditing,
2959
+ getEditValue,
2960
+ setEditValue,
2961
+ getValidationError,
2962
+ startEdit,
2963
+ saveEdit,
2964
+ cancelEdit,
2965
+ deleteRow,
2966
+ addRow,
2967
+ getEditingRows,
2968
+ saveAllEdits,
2969
+ cancelAllEdits,
2970
+ getChangedValues
2971
+ } = useTableEdit(getMergedProps, dataSource, getRowKey);
2972
+ const originalColumnsMap = computed(() => {
2973
+ const mergedProps = getMergedProps.value;
2974
+ const map = /* @__PURE__ */ new Map();
2975
+ mergedProps.columns.forEach((col) => {
2976
+ if (col.dataIndex) {
2977
+ map.set(col.dataIndex, col);
2978
+ }
2979
+ });
2980
+ return map;
2981
+ });
2345
2982
  const getViewColumns = computed(() => {
2346
2983
  const mergedProps = getMergedProps.value;
2347
2984
  let columns = [...mergedProps.columns];
@@ -2379,6 +3016,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2379
3016
  }
2380
3017
  columns = columns.filter((col) => col.show !== false);
2381
3018
  columns = columns.map((col) => {
3019
+ if ((col.edit || col.editable) && !col.slotName) {
3020
+ return { ...col, slotName: col.dataIndex };
3021
+ }
3022
+ if (!col.slotName && col.ellipsis && typeof col.ellipsis === "object") {
3023
+ const { ellipsis, ...restCol } = col;
3024
+ return { ...restCol, slotName: col.dataIndex };
3025
+ }
2382
3026
  if (!col.slotName && (col.customRender || col.format)) {
2383
3027
  return { ...col, slotName: col.dataIndex };
2384
3028
  }
@@ -2818,7 +3462,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2818
3462
  expandAll,
2819
3463
  collapseAll,
2820
3464
  tableRef,
2821
- searchFormRef
3465
+ searchFormRef,
3466
+ // 编辑相关方法
3467
+ startEdit,
3468
+ saveEdit,
3469
+ cancelEdit,
3470
+ deleteRow,
3471
+ addRow,
3472
+ getEditingRows,
3473
+ saveAllEdits,
3474
+ cancelAllEdits,
3475
+ isEditing,
3476
+ getEditValue,
3477
+ setEditValue,
3478
+ getChangedValues
2822
3479
  });
2823
3480
  onMounted(async () => {
2824
3481
  await nextTick();
@@ -2848,7 +3505,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2848
3505
  expandAll,
2849
3506
  collapseAll,
2850
3507
  tableRef,
2851
- searchFormRef
3508
+ searchFormRef,
3509
+ // 编辑相关方法
3510
+ startEdit,
3511
+ saveEdit,
3512
+ cancelEdit,
3513
+ deleteRow,
3514
+ addRow,
3515
+ getEditingRows,
3516
+ saveAllEdits,
3517
+ cancelAllEdits,
3518
+ isEditing,
3519
+ getEditValue,
3520
+ setEditValue,
3521
+ getChangedValues
2852
3522
  };
2853
3523
  const formInstance = {
2854
3524
  getFieldsValue: () => {
@@ -2950,7 +3620,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2950
3620
  const _component_a_table = resolveComponent("a-table");
2951
3621
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
2952
3622
  getSearchConfig.value.show ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
2953
- createVNode(unref(_sfc_main$3), mergeProps({
3623
+ createVNode(unref(_sfc_main$5), mergeProps({
2954
3624
  ref_key: "searchFormRef",
2955
3625
  ref: searchFormRef
2956
3626
  }, getSearchFormProps.value, {
@@ -3151,84 +3821,103 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3151
3821
  renderList(getViewColumns.value.filter((c) => c.slotName), (col) => {
3152
3822
  return {
3153
3823
  name: col.slotName,
3154
- fn: withCtx((slotProps) => [
3155
- col.slotName === "__index__" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3156
- createTextVNode(toDisplayString(getIndexNumber(slotProps.rowIndex)), 1)
3157
- ], 64)) : col.slotName === "action" ? renderSlot(_ctx.$slots, "action", {
3158
- key: 1,
3159
- record: slotProps.record
3160
- }, () => [
3161
- createVNode(_component_a_space, null, {
3162
- default: withCtx(() => [
3163
- (openBlock(true), createElementBlock(Fragment, null, renderList(getActionButtons(slotProps.record), (action) => {
3164
- return openBlock(), createElementBlock(Fragment, {
3165
- key: action.label
3166
- }, [
3167
- action.popConfirm ? (openBlock(), createBlock(_component_a_popconfirm, {
3168
- key: 0,
3169
- content: action.popConfirm.title,
3170
- "ok-text": action.popConfirm.okText,
3171
- "cancel-text": action.popConfirm.cancelText,
3172
- onOk: ($event) => {
3173
- var _a, _b;
3174
- return (_b = (_a = action.popConfirm).onConfirm) == null ? void 0 : _b.call(_a, slotProps.record);
3175
- },
3176
- onCancel: action.popConfirm.onCancel
3177
- }, {
3178
- default: withCtx(() => [
3179
- createVNode(_component_a_link, {
3180
- status: action.color,
3181
- disabled: getActionDisabled(action, slotProps.record),
3182
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
3183
- }, ["stop"]))
3184
- }, createSlots({
3185
- default: withCtx(() => [
3186
- createTextVNode(" " + toDisplayString(action.label), 1)
3187
- ]),
3188
- _: 2
3189
- }, [
3190
- action.icon ? {
3191
- name: "icon",
3192
- fn: withCtx(() => [
3193
- (openBlock(), createBlock(resolveDynamicComponent(action.icon)))
3194
- ]),
3195
- key: "0"
3196
- } : void 0
3197
- ]), 1032, ["status", "disabled"])
3198
- ]),
3199
- _: 2
3200
- }, 1032, ["content", "ok-text", "cancel-text", "onOk", "onCancel"])) : (openBlock(), createBlock(_component_a_link, {
3201
- key: 1,
3202
- status: action.color,
3203
- disabled: getActionDisabled(action, slotProps.record),
3204
- onClick: ($event) => handleActionClick(action, slotProps.record)
3205
- }, createSlots({
3206
- default: withCtx(() => [
3207
- createTextVNode(" " + toDisplayString(action.label), 1)
3208
- ]),
3209
- _: 2
3824
+ fn: withCtx((slotProps) => {
3825
+ var _a, _b;
3826
+ return [
3827
+ col.slotName === "__index__" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3828
+ createTextVNode(toDisplayString(getIndexNumber(slotProps.rowIndex)), 1)
3829
+ ], 64)) : col.slotName === "action" ? renderSlot(_ctx.$slots, "action", {
3830
+ key: 1,
3831
+ record: slotProps.record
3832
+ }, () => [
3833
+ createVNode(_component_a_space, null, {
3834
+ default: withCtx(() => [
3835
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getActionButtons(slotProps.record), (action) => {
3836
+ return openBlock(), createElementBlock(Fragment, {
3837
+ key: action.label
3210
3838
  }, [
3211
- action.icon ? {
3212
- name: "icon",
3213
- fn: withCtx(() => [
3214
- (openBlock(), createBlock(resolveDynamicComponent(action.icon)))
3839
+ action.popConfirm ? (openBlock(), createBlock(_component_a_popconfirm, {
3840
+ key: 0,
3841
+ content: action.popConfirm.title,
3842
+ "ok-text": action.popConfirm.okText,
3843
+ "cancel-text": action.popConfirm.cancelText,
3844
+ onOk: ($event) => {
3845
+ var _a2, _b2;
3846
+ return (_b2 = (_a2 = action.popConfirm).onConfirm) == null ? void 0 : _b2.call(_a2, slotProps.record);
3847
+ },
3848
+ onCancel: action.popConfirm.onCancel
3849
+ }, {
3850
+ default: withCtx(() => [
3851
+ createVNode(_component_a_link, {
3852
+ status: action.color,
3853
+ disabled: getActionDisabled(action, slotProps.record),
3854
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
3855
+ }, ["stop"]))
3856
+ }, createSlots({
3857
+ default: withCtx(() => [
3858
+ createTextVNode(" " + toDisplayString(action.label), 1)
3859
+ ]),
3860
+ _: 2
3861
+ }, [
3862
+ action.icon ? {
3863
+ name: "icon",
3864
+ fn: withCtx(() => [
3865
+ (openBlock(), createBlock(resolveDynamicComponent(action.icon)))
3866
+ ]),
3867
+ key: "0"
3868
+ } : void 0
3869
+ ]), 1032, ["status", "disabled"])
3215
3870
  ]),
3216
- key: "0"
3217
- } : void 0
3218
- ]), 1032, ["status", "disabled", "onClick"]))
3219
- ], 64);
3220
- }), 128))
3221
- ]),
3222
- _: 2
3223
- }, 1024)
3224
- ], true) : _ctx.$slots[col.dataIndex] ? renderSlot(_ctx.$slots, col.dataIndex, normalizeProps(mergeProps({ key: 2 }, slotProps)), void 0, true) : col.customRender ? (openBlock(), createBlock(resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 3 })) : col.format ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
3225
- createTextVNode(toDisplayString(col.format(
3226
- slotProps.record[col.dataIndex],
3227
- slotProps.record,
3228
- slotProps.rowIndex
3229
- )), 1)
3230
- ], 64)) : createCommentVNode("", true)
3231
- ])
3871
+ _: 2
3872
+ }, 1032, ["content", "ok-text", "cancel-text", "onOk", "onCancel"])) : (openBlock(), createBlock(_component_a_link, {
3873
+ key: 1,
3874
+ status: action.color,
3875
+ disabled: getActionDisabled(action, slotProps.record),
3876
+ onClick: ($event) => handleActionClick(action, slotProps.record)
3877
+ }, createSlots({
3878
+ default: withCtx(() => [
3879
+ createTextVNode(" " + toDisplayString(action.label), 1)
3880
+ ]),
3881
+ _: 2
3882
+ }, [
3883
+ action.icon ? {
3884
+ name: "icon",
3885
+ fn: withCtx(() => [
3886
+ (openBlock(), createBlock(resolveDynamicComponent(action.icon)))
3887
+ ]),
3888
+ key: "0"
3889
+ } : void 0
3890
+ ]), 1032, ["status", "disabled", "onClick"]))
3891
+ ], 64);
3892
+ }), 128))
3893
+ ]),
3894
+ _: 2
3895
+ }, 1024)
3896
+ ], true) : (col.edit || col.editable) && unref(isEditing)(slotProps.record, col) ? (openBlock(), createBlock(EditCell, {
3897
+ key: 2,
3898
+ column: col,
3899
+ record: slotProps.record,
3900
+ value: unref(getEditValue)(slotProps.record, col),
3901
+ error: unref(getValidationError)(slotProps.record, col),
3902
+ onChange: (val) => unref(setEditValue)(slotProps.record, col, val)
3903
+ }, null, 8, ["column", "record", "value", "error", "onChange"])) : _ctx.$slots[col.dataIndex] ? renderSlot(_ctx.$slots, col.dataIndex, normalizeProps(mergeProps({ key: 3 }, slotProps)), void 0, true) : col.customRender ? (openBlock(), createBlock(resolveDynamicComponent(renderCustomCell(col, slotProps)), { key: 4 })) : col.format ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [
3904
+ createTextVNode(toDisplayString(col.format(
3905
+ slotProps.record[col.dataIndex],
3906
+ slotProps.record,
3907
+ slotProps.rowIndex
3908
+ )), 1)
3909
+ ], 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" ? (openBlock(), createBlock(unref(BasicTextEllipsis), {
3910
+ key: 6,
3911
+ text: String(slotProps.record[col.dataIndex] ?? ""),
3912
+ lines: originalColumnsMap.value.get(col.dataIndex).ellipsis.lines ?? 1,
3913
+ tooltip: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltip ?? true,
3914
+ tooltipTrigger: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltipTrigger ?? "hover",
3915
+ tooltipProps: originalColumnsMap.value.get(col.dataIndex).ellipsis.tooltipProps
3916
+ }, null, 8, ["text", "lines", "tooltip", "tooltipTrigger", "tooltipProps"])) : (openBlock(), createElementBlock(Fragment, { key: 7 }, [
3917
+ createTextVNode(toDisplayString(slotProps.record[col.dataIndex]), 1)
3918
+ ], 64))
3919
+ ];
3920
+ })
3232
3921
  };
3233
3922
  })
3234
3923
  ]), 1040, ["columns", "data", "loading", "pagination", "row-selection", "expandable", "scroll", "draggable", "bordered", "stripe", "show-header", "size", "row-key"])
@@ -3236,7 +3925,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3236
3925
  };
3237
3926
  }
3238
3927
  });
3239
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7a27a6be"]]);
3928
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-42280842"]]);
3240
3929
  function useTable(options = {}) {
3241
3930
  const tableRef = ref(null);
3242
3931
  const formRef = ref(null);
@@ -3439,6 +4128,96 @@ function useTable(options = {}) {
3439
4128
  }
3440
4129
  return form;
3441
4130
  };
4131
+ const startEdit = (record, column) => {
4132
+ const table = getTable();
4133
+ if (!table) return;
4134
+ if (table.startEdit) {
4135
+ table.startEdit(record, column);
4136
+ }
4137
+ };
4138
+ const saveEdit = async (record) => {
4139
+ const table = getTable();
4140
+ if (!table) return false;
4141
+ if (table.saveEdit) {
4142
+ return await table.saveEdit(record);
4143
+ }
4144
+ return false;
4145
+ };
4146
+ const cancelEdit = (record) => {
4147
+ const table = getTable();
4148
+ if (!table) return;
4149
+ if (table.cancelEdit) {
4150
+ table.cancelEdit(record);
4151
+ }
4152
+ };
4153
+ const deleteRow = async (record) => {
4154
+ const table = getTable();
4155
+ if (!table) return;
4156
+ if (table.deleteRow) {
4157
+ await table.deleteRow(record);
4158
+ }
4159
+ };
4160
+ const addRow = async () => {
4161
+ const table = getTable();
4162
+ if (!table) return;
4163
+ if (table.addRow) {
4164
+ await table.addRow();
4165
+ }
4166
+ };
4167
+ const getEditingRows = () => {
4168
+ const table = getTable();
4169
+ if (!table) return [];
4170
+ if (table.getEditingRows) {
4171
+ return table.getEditingRows();
4172
+ }
4173
+ return [];
4174
+ };
4175
+ const saveAllEdits = async () => {
4176
+ const table = getTable();
4177
+ if (!table) return false;
4178
+ if (table.saveAllEdits) {
4179
+ return await table.saveAllEdits();
4180
+ }
4181
+ return false;
4182
+ };
4183
+ const cancelAllEdits = () => {
4184
+ const table = getTable();
4185
+ if (!table) return;
4186
+ if (table.cancelAllEdits) {
4187
+ table.cancelAllEdits();
4188
+ }
4189
+ };
4190
+ const isEditing = (record, column) => {
4191
+ const table = getTable();
4192
+ if (!table) return false;
4193
+ if (table.isEditing) {
4194
+ return table.isEditing(record, column);
4195
+ }
4196
+ return false;
4197
+ };
4198
+ const getEditValue = (record, column) => {
4199
+ const table = getTable();
4200
+ if (!table) return void 0;
4201
+ if (table.getEditValue) {
4202
+ return table.getEditValue(record, column);
4203
+ }
4204
+ return void 0;
4205
+ };
4206
+ const setEditValue = (record, column, value) => {
4207
+ const table = getTable();
4208
+ if (!table) return;
4209
+ if (table.setEditValue) {
4210
+ table.setEditValue(record, column, value);
4211
+ }
4212
+ };
4213
+ const getChangedValues = (record) => {
4214
+ const table = getTable();
4215
+ if (!table) return {};
4216
+ if (table.getChangedValues) {
4217
+ return table.getChangedValues(record);
4218
+ }
4219
+ return {};
4220
+ };
3442
4221
  const tableMethods = {
3443
4222
  getDataSource,
3444
4223
  setDataSource,
@@ -3463,7 +4242,20 @@ function useTable(options = {}) {
3463
4242
  collapseAll,
3464
4243
  getForm,
3465
4244
  tableRef,
3466
- getTable
4245
+ getTable,
4246
+ // 编辑相关方法
4247
+ startEdit,
4248
+ saveEdit,
4249
+ cancelEdit,
4250
+ deleteRow,
4251
+ addRow,
4252
+ getEditingRows,
4253
+ saveAllEdits,
4254
+ cancelAllEdits,
4255
+ isEditing,
4256
+ getEditValue,
4257
+ setEditValue,
4258
+ getChangedValues
3467
4259
  };
3468
4260
  return [register, tableMethods];
3469
4261
  }
@@ -4339,9 +5131,10 @@ function useToggle(initialValue = false) {
4339
5131
  }
4340
5132
  export {
4341
5133
  BasicDescription,
4342
- _sfc_main$3 as BasicForm,
5134
+ _sfc_main$5 as BasicForm,
4343
5135
  BasicModal,
4344
5136
  BasicTable,
5137
+ BasicTextEllipsis,
4345
5138
  BasicUpload,
4346
5139
  componentMap,
4347
5140
  createFormSchema,