pro-design-vue 1.3.21 → 1.3.22

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 (127) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.full.js +1181 -1585
  3. package/dist/index.full.min.js +7 -9
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +7 -9
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +1182 -1586
  8. package/es/components/config-provider/src/typing.d.ts +1 -0
  9. package/es/components/table/src/components/Body/Body.vue.d.ts +261 -15
  10. package/es/components/table/src/components/Body/BodyCell.vue.d.ts +255 -0
  11. package/es/components/table/src/components/Body/BodyEditCell.d.ts +60 -0
  12. package/es/components/table/src/components/Body/BodyRow.vue.d.ts +261 -15
  13. package/es/components/table/src/components/Body/BodyRows.vue.d.ts +261 -15
  14. package/es/components/table/src/components/Body/{BodyCell.d.ts → BodyTextCell.d.ts} +1 -7
  15. package/es/components/table/src/components/InteralTable.vue.d.ts +314 -19
  16. package/es/components/table/src/components/Table.d.ts +51 -0
  17. package/es/components/table/src/components/context/TableContext.d.ts +4 -0
  18. package/es/components/table/src/components/interface.d.ts +295 -23
  19. package/es/components/table/src/hooks/useCellProps.d.ts +5 -1
  20. package/es/components/table/src/hooks/useEdit.d.ts +24 -7
  21. package/es/components/table/src/utils/form-model.d.ts +25 -0
  22. package/es/components/table/src/utils/util.d.ts +1 -0
  23. package/es/index.d.ts +276 -5
  24. package/es/packages/components/table/src/components/Body/BodyCell.vue.mjs +35 -0
  25. package/es/packages/components/table/src/components/Body/BodyCell.vue.mjs.map +1 -0
  26. package/es/packages/components/table/src/components/Body/BodyCell.vue2.mjs +129 -0
  27. package/es/packages/components/table/src/components/Body/BodyCell.vue2.mjs.map +1 -0
  28. package/es/packages/components/table/src/components/Body/BodyEditCell.mjs +256 -0
  29. package/es/packages/components/table/src/components/Body/BodyEditCell.mjs.map +1 -0
  30. package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs +63 -8
  31. package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs.map +1 -1
  32. package/es/packages/components/table/src/components/Body/BodyRow.vue2.mjs +24 -18
  33. package/es/packages/components/table/src/components/Body/BodyRow.vue2.mjs.map +1 -1
  34. package/es/packages/components/table/src/components/Body/{BodyCell.mjs → BodyTextCell.mjs} +25 -155
  35. package/es/packages/components/table/src/components/Body/BodyTextCell.mjs.map +1 -0
  36. package/es/packages/components/table/src/components/InteralTable.vue.mjs +24 -25
  37. package/es/packages/components/table/src/components/InteralTable.vue.mjs.map +1 -1
  38. package/es/packages/components/table/src/components/InteralTable.vue2.mjs +36 -97
  39. package/es/packages/components/table/src/components/InteralTable.vue2.mjs.map +1 -1
  40. package/es/packages/components/table/src/components/Table.mjs +24 -20
  41. package/es/packages/components/table/src/components/Table.mjs.map +1 -1
  42. package/es/packages/components/table/src/components/context/TableContext.mjs.map +1 -1
  43. package/es/packages/components/table/src/components/interface.mjs +24 -0
  44. package/es/packages/components/table/src/components/interface.mjs.map +1 -1
  45. package/es/packages/components/table/src/hooks/useCellProps.mjs +8 -0
  46. package/es/packages/components/table/src/hooks/useCellProps.mjs.map +1 -1
  47. package/es/packages/components/table/src/hooks/useEdit.mjs +293 -18
  48. package/es/packages/components/table/src/hooks/useEdit.mjs.map +1 -1
  49. package/es/packages/components/table/src/utils/form-model.mjs +98 -0
  50. package/es/packages/components/table/src/utils/form-model.mjs.map +1 -0
  51. package/es/packages/components/table/src/utils/util.mjs +4 -1
  52. package/es/packages/components/table/src/utils/util.mjs.map +1 -1
  53. package/es/packages/utils/dom.mjs +15 -1
  54. package/es/packages/utils/dom.mjs.map +1 -1
  55. package/es/packages/utils/index.mjs +1 -1
  56. package/es/utils/dom.d.ts +2 -0
  57. package/es/version.d.ts +1 -1
  58. package/es/version.mjs +1 -1
  59. package/es/version.mjs.map +1 -1
  60. package/lib/components/config-provider/src/typing.d.ts +1 -0
  61. package/lib/components/table/src/components/Body/Body.vue.d.ts +261 -15
  62. package/lib/components/table/src/components/Body/BodyCell.vue.d.ts +255 -0
  63. package/lib/components/table/src/components/Body/BodyEditCell.d.ts +60 -0
  64. package/lib/components/table/src/components/Body/BodyRow.vue.d.ts +261 -15
  65. package/lib/components/table/src/components/Body/BodyRows.vue.d.ts +261 -15
  66. package/lib/components/table/src/components/Body/{BodyCell.d.ts → BodyTextCell.d.ts} +1 -7
  67. package/lib/components/table/src/components/InteralTable.vue.d.ts +314 -19
  68. package/lib/components/table/src/components/Table.d.ts +51 -0
  69. package/lib/components/table/src/components/context/TableContext.d.ts +4 -0
  70. package/lib/components/table/src/components/interface.d.ts +295 -23
  71. package/lib/components/table/src/hooks/useCellProps.d.ts +5 -1
  72. package/lib/components/table/src/hooks/useEdit.d.ts +24 -7
  73. package/lib/components/table/src/utils/form-model.d.ts +25 -0
  74. package/lib/components/table/src/utils/util.d.ts +1 -0
  75. package/lib/index.d.ts +276 -5
  76. package/lib/packages/components/table/src/components/Body/BodyCell.vue.js +39 -0
  77. package/lib/packages/components/table/src/components/Body/BodyCell.vue.js.map +1 -0
  78. package/lib/packages/components/table/src/components/Body/BodyCell.vue2.js +133 -0
  79. package/lib/packages/components/table/src/components/Body/BodyCell.vue2.js.map +1 -0
  80. package/lib/packages/components/table/src/components/Body/BodyEditCell.js +260 -0
  81. package/lib/packages/components/table/src/components/Body/BodyEditCell.js.map +1 -0
  82. package/lib/packages/components/table/src/components/Body/BodyRow.vue.js +63 -8
  83. package/lib/packages/components/table/src/components/Body/BodyRow.vue.js.map +1 -1
  84. package/lib/packages/components/table/src/components/Body/BodyRow.vue2.js +22 -16
  85. package/lib/packages/components/table/src/components/Body/BodyRow.vue2.js.map +1 -1
  86. package/lib/packages/components/table/src/components/Body/{BodyCell.js → BodyTextCell.js} +24 -154
  87. package/lib/packages/components/table/src/components/Body/BodyTextCell.js.map +1 -0
  88. package/lib/packages/components/table/src/components/InteralTable.vue.js +24 -25
  89. package/lib/packages/components/table/src/components/InteralTable.vue.js.map +1 -1
  90. package/lib/packages/components/table/src/components/InteralTable.vue2.js +36 -97
  91. package/lib/packages/components/table/src/components/InteralTable.vue2.js.map +1 -1
  92. package/lib/packages/components/table/src/components/Table.js +24 -20
  93. package/lib/packages/components/table/src/components/Table.js.map +1 -1
  94. package/lib/packages/components/table/src/components/context/TableContext.js.map +1 -1
  95. package/lib/packages/components/table/src/components/interface.js +24 -0
  96. package/lib/packages/components/table/src/components/interface.js.map +1 -1
  97. package/lib/packages/components/table/src/hooks/useCellProps.js +8 -0
  98. package/lib/packages/components/table/src/hooks/useCellProps.js.map +1 -1
  99. package/lib/packages/components/table/src/hooks/useEdit.js +292 -17
  100. package/lib/packages/components/table/src/hooks/useEdit.js.map +1 -1
  101. package/lib/packages/components/table/src/utils/form-model.js +102 -0
  102. package/lib/packages/components/table/src/utils/form-model.js.map +1 -0
  103. package/lib/packages/components/table/src/utils/util.js +4 -0
  104. package/lib/packages/components/table/src/utils/util.js.map +1 -1
  105. package/lib/packages/utils/dom.js +16 -0
  106. package/lib/packages/utils/dom.js.map +1 -1
  107. package/lib/packages/utils/index.js +2 -0
  108. package/lib/packages/utils/index.js.map +1 -1
  109. package/lib/utils/dom.d.ts +2 -0
  110. package/lib/version.d.ts +1 -1
  111. package/lib/version.js +1 -1
  112. package/lib/version.js.map +1 -1
  113. package/package.json +1 -1
  114. package/theme-chalk/index.css +1 -1
  115. package/theme-chalk/src/table/table.less +29 -2
  116. package/es/components/table/src/components/Body/EditInput.vue.d.ts +0 -102
  117. package/es/packages/components/table/src/components/Body/BodyCell.mjs.map +0 -1
  118. package/es/packages/components/table/src/components/Body/EditInput.vue.mjs +0 -48
  119. package/es/packages/components/table/src/components/Body/EditInput.vue.mjs.map +0 -1
  120. package/es/packages/components/table/src/components/Body/EditInput.vue2.mjs +0 -151
  121. package/es/packages/components/table/src/components/Body/EditInput.vue2.mjs.map +0 -1
  122. package/lib/components/table/src/components/Body/EditInput.vue.d.ts +0 -102
  123. package/lib/packages/components/table/src/components/Body/BodyCell.js.map +0 -1
  124. package/lib/packages/components/table/src/components/Body/EditInput.vue.js +0 -52
  125. package/lib/packages/components/table/src/components/Body/EditInput.vue.js.map +0 -1
  126. package/lib/packages/components/table/src/components/Body/EditInput.vue2.js +0 -155
  127. package/lib/packages/components/table/src/components/Body/EditInput.vue2.js.map +0 -1
@@ -1,7 +1,7 @@
1
- /*! Pro Design Vue v1.3.21 */
1
+ /*! Pro Design Vue v1.3.22 */
2
2
 
3
3
  import { Modal, theme as theme$1, ConfigProvider, App, Button as Button$1, Tooltip, Popconfirm, Dropdown, Menu, Slider, Drawer, Input, InputNumber, Form as Form$1, Space, Textarea, Select, TreeSelect, Checkbox as Checkbox$1, CheckboxGroup, RadioGroup, Radio as Radio$1, Cascader, Switch, Rate, DatePicker, RangePicker, TimePicker, TimeRangePicker, Upload, FormItemRest, Spin, message, Row as Row$1, Col, FormItem as FormItem$1, Steps, Popover, MenuItem, SubMenu, Empty, Badge, Tag, Pagination, InputSearch, Tree, Card, Tabs, TabPane } from 'ant-design-vue';
4
- import { inject, ref, getCurrentInstance, nextTick, h, reactive, defineComponent, createVNode, isVNode, Fragment, cloneVNode, provide, watch, computed, renderSlot, createPropsRestProxy, createBlock, openBlock, unref, mergeProps, withCtx, normalizeProps, guardReactiveProps, shallowRef, shallowReadonly, toValue, getCurrentScope, onScopeDispose, onMounted, hasInjectionContext, isRef, toRefs as toRefs$1, customRef, toRef as toRef$1, readonly, watchEffect, toRaw, createElementBlock, createCommentVNode, resolveDynamicComponent, createElementVNode, normalizeStyle, toDisplayString, normalizeClass, createSlots, createTextVNode, useAttrs, useTemplateRef, Teleport, onUnmounted, Comment as Comment$1, useSlots, useModel, withModifiers, mergeModels, renderList, camelize, isReactive, onActivated, onDeactivated, onBeforeUnmount, triggerRef, resolveDirective, withDirectives, vShow, render as render$1, resolveComponent, vModelText } from 'vue';
4
+ import { inject, ref, getCurrentInstance, nextTick, h, reactive, defineComponent, createVNode, isVNode, Fragment, cloneVNode, provide, watch, computed, renderSlot, createPropsRestProxy, createBlock, openBlock, unref, mergeProps, withCtx, normalizeProps, guardReactiveProps, shallowRef, shallowReadonly, toValue, getCurrentScope, onScopeDispose, onMounted, hasInjectionContext, isRef, toRefs as toRefs$1, customRef, toRef as toRef$1, readonly, watchEffect, toRaw, createElementBlock, createCommentVNode, resolveDynamicComponent, createElementVNode, normalizeStyle, toDisplayString, normalizeClass, createSlots, createTextVNode, useAttrs, useTemplateRef, Teleport, onUnmounted, Comment as Comment$1, useSlots, useModel, withModifiers, mergeModels, renderList, camelize, isReactive, onActivated, onDeactivated, triggerRef, onBeforeUnmount, resolveDirective, withDirectives, vShow, render as render$1, resolveComponent } from 'vue';
5
5
  import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN.js';
6
6
 
7
7
  function _mergeNamespaces(n, m) {
@@ -30,7 +30,7 @@ const SCROLL_FIXED_CLASS = `_scroll__fixed_`;
30
30
  const DEFAULT_NAMESPACE = "pro";
31
31
  const DEFAULT_LOCALE = "zh-CN";
32
32
 
33
- const version$1 = "1.3.21";
33
+ const version$1 = "1.3.22";
34
34
 
35
35
  const makeInstaller = (components = []) => {
36
36
  const install = (app) => {
@@ -764,7 +764,7 @@ function updateCSS(css, key) {
764
764
  return newNode;
765
765
  }
766
766
 
767
- function _objectSpread$u(target) {
767
+ function _objectSpread$v(target) {
768
768
  for (var i = 1; i < arguments.length; i++) {
769
769
  var source = arguments[i] != null ? Object(arguments[i]) : {};
770
770
  var ownKeys = Object.keys(source);
@@ -774,12 +774,12 @@ function _objectSpread$u(target) {
774
774
  }));
775
775
  }
776
776
  ownKeys.forEach(function(key) {
777
- _defineProperty$v(target, key, source[key]);
777
+ _defineProperty$w(target, key, source[key]);
778
778
  });
779
779
  }
780
780
  return target;
781
781
  }
782
- function _defineProperty$v(obj, key, value) {
782
+ function _defineProperty$w(obj, key, value) {
783
783
  if (key in obj) {
784
784
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
785
785
  } else {
@@ -800,13 +800,13 @@ function isIconDefinition(target) {
800
800
  }
801
801
  function generate(node, key, rootProps) {
802
802
  if (!rootProps) {
803
- return h(node.tag, _objectSpread$u({
803
+ return h(node.tag, _objectSpread$v({
804
804
  key
805
805
  }, node.attrs), (node.children || []).map(function(child, index) {
806
806
  return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
807
807
  }));
808
808
  }
809
- return h(node.tag, _objectSpread$u({
809
+ return h(node.tag, _objectSpread$v({
810
810
  key
811
811
  }, rootProps, node.attrs), (node.children || []).map(function(child, index) {
812
812
  return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
@@ -890,7 +890,7 @@ function _objectWithoutPropertiesLoose$2(source, excluded) {
890
890
  }
891
891
  return target;
892
892
  }
893
- function _objectSpread$t(target) {
893
+ function _objectSpread$u(target) {
894
894
  for (var i = 1; i < arguments.length; i++) {
895
895
  var source = arguments[i] != null ? Object(arguments[i]) : {};
896
896
  var ownKeys = Object.keys(source);
@@ -900,12 +900,12 @@ function _objectSpread$t(target) {
900
900
  }));
901
901
  }
902
902
  ownKeys.forEach(function(key) {
903
- _defineProperty$u(target, key, source[key]);
903
+ _defineProperty$v(target, key, source[key]);
904
904
  });
905
905
  }
906
906
  return target;
907
907
  }
908
- function _defineProperty$u(obj, key, value) {
908
+ function _defineProperty$v(obj, key, value) {
909
909
  if (key in obj) {
910
910
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
911
911
  } else {
@@ -925,10 +925,10 @@ function setTwoToneColors(_ref) {
925
925
  twoToneColorPalette.calculated = !!secondaryColor;
926
926
  }
927
927
  function getTwoToneColors() {
928
- return _objectSpread$t({}, twoToneColorPalette);
928
+ return _objectSpread$u({}, twoToneColorPalette);
929
929
  }
930
930
  var IconBase = function IconBase2(props, context) {
931
- var _props$context$attrs = _objectSpread$t({}, props, context.attrs), icon = _props$context$attrs.icon, primaryColor = _props$context$attrs.primaryColor, secondaryColor = _props$context$attrs.secondaryColor, restProps = _objectWithoutProperties$2(_props$context$attrs, _excluded$2);
931
+ var _props$context$attrs = _objectSpread$u({}, props, context.attrs), icon = _props$context$attrs.icon, primaryColor = _props$context$attrs.primaryColor, secondaryColor = _props$context$attrs.secondaryColor, restProps = _objectWithoutProperties$2(_props$context$attrs, _excluded$2);
932
932
  var colors = twoToneColorPalette;
933
933
  if (primaryColor) {
934
934
  colors = {
@@ -942,11 +942,11 @@ var IconBase = function IconBase2(props, context) {
942
942
  }
943
943
  var target = icon;
944
944
  if (target && typeof target.icon === "function") {
945
- target = _objectSpread$t({}, target, {
945
+ target = _objectSpread$u({}, target, {
946
946
  icon: target.icon(colors.primaryColor, colors.secondaryColor)
947
947
  });
948
948
  }
949
- return generate(target.icon, "svg-".concat(target.name), _objectSpread$t({}, restProps, {
949
+ return generate(target.icon, "svg-".concat(target.name), _objectSpread$u({}, restProps, {
950
950
  "data-icon": target.name,
951
951
  width: "1em",
952
952
  height: "1em",
@@ -1087,7 +1087,7 @@ function _iterableToArrayLimit(arr, i) {
1087
1087
  function _arrayWithHoles(arr) {
1088
1088
  if (Array.isArray(arr)) return arr;
1089
1089
  }
1090
- function _objectSpread$s(target) {
1090
+ function _objectSpread$t(target) {
1091
1091
  for (var i = 1; i < arguments.length; i++) {
1092
1092
  var source = arguments[i] != null ? Object(arguments[i]) : {};
1093
1093
  var ownKeys = Object.keys(source);
@@ -1097,12 +1097,12 @@ function _objectSpread$s(target) {
1097
1097
  }));
1098
1098
  }
1099
1099
  ownKeys.forEach(function(key) {
1100
- _defineProperty$t(target, key, source[key]);
1100
+ _defineProperty$u(target, key, source[key]);
1101
1101
  });
1102
1102
  }
1103
1103
  return target;
1104
1104
  }
1105
- function _defineProperty$t(obj, key, value) {
1105
+ function _defineProperty$u(obj, key, value) {
1106
1106
  if (key in obj) {
1107
1107
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1108
1108
  } else {
@@ -1140,9 +1140,9 @@ function _objectWithoutPropertiesLoose$1(source, excluded) {
1140
1140
  setTwoToneColor(blue.primary);
1141
1141
  var Icon$1 = function Icon2(props, context) {
1142
1142
  var _classObj;
1143
- var _props$context$attrs = _objectSpread$s({}, props, context.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick = _props$context$attrs.onClick, restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$1);
1143
+ var _props$context$attrs = _objectSpread$t({}, props, context.attrs), cls = _props$context$attrs["class"], icon = _props$context$attrs.icon, spin = _props$context$attrs.spin, rotate = _props$context$attrs.rotate, tabindex = _props$context$attrs.tabindex, twoToneColor = _props$context$attrs.twoToneColor, onClick = _props$context$attrs.onClick, restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$1);
1144
1144
  var _useInjectIconContext = useInjectIconContext(), prefixCls = _useInjectIconContext.prefixCls, rootClassName = _useInjectIconContext.rootClassName;
1145
- var classObj = (_classObj = {}, _defineProperty$t(_classObj, rootClassName.value, !!rootClassName.value), _defineProperty$t(_classObj, prefixCls.value, true), _defineProperty$t(_classObj, "".concat(prefixCls.value, "-").concat(icon.name), Boolean(icon.name)), _defineProperty$t(_classObj, "".concat(prefixCls.value, "-spin"), !!spin || icon.name === "loading"), _classObj);
1145
+ var classObj = (_classObj = {}, _defineProperty$u(_classObj, rootClassName.value, !!rootClassName.value), _defineProperty$u(_classObj, prefixCls.value, true), _defineProperty$u(_classObj, "".concat(prefixCls.value, "-").concat(icon.name), Boolean(icon.name)), _defineProperty$u(_classObj, "".concat(prefixCls.value, "-spin"), !!spin || icon.name === "loading"), _classObj);
1146
1146
  var iconTabIndex = tabindex;
1147
1147
  if (iconTabIndex === void 0 && onClick) {
1148
1148
  iconTabIndex = -1;
@@ -1152,7 +1152,7 @@ var Icon$1 = function Icon2(props, context) {
1152
1152
  transform: "rotate(".concat(rotate, "deg)")
1153
1153
  } : void 0;
1154
1154
  var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
1155
- return createVNode("span", _objectSpread$s({
1155
+ return createVNode("span", _objectSpread$t({
1156
1156
  "role": "img",
1157
1157
  "aria-label": icon.name
1158
1158
  }, restProps, {
@@ -1179,7 +1179,7 @@ Icon$1.setTwoToneColor = setTwoToneColor;
1179
1179
 
1180
1180
  var CaretDownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "outlined" };
1181
1181
 
1182
- function _objectSpread$r(target) {
1182
+ function _objectSpread$s(target) {
1183
1183
  for (var i = 1; i < arguments.length; i++) {
1184
1184
  var source = arguments[i] != null ? Object(arguments[i]) : {};
1185
1185
  var ownKeys = Object.keys(source);
@@ -1189,12 +1189,12 @@ function _objectSpread$r(target) {
1189
1189
  }));
1190
1190
  }
1191
1191
  ownKeys.forEach(function(key) {
1192
- _defineProperty$s(target, key, source[key]);
1192
+ _defineProperty$t(target, key, source[key]);
1193
1193
  });
1194
1194
  }
1195
1195
  return target;
1196
1196
  }
1197
- function _defineProperty$s(obj, key, value) {
1197
+ function _defineProperty$t(obj, key, value) {
1198
1198
  if (key in obj) {
1199
1199
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1200
1200
  } else {
@@ -1203,8 +1203,8 @@ function _defineProperty$s(obj, key, value) {
1203
1203
  return obj;
1204
1204
  }
1205
1205
  var CaretDownOutlined = function CaretDownOutlined2(props, context) {
1206
- var p = _objectSpread$r({}, props, context.attrs);
1207
- return createVNode(Icon$1, _objectSpread$r({}, p, {
1206
+ var p = _objectSpread$s({}, props, context.attrs);
1207
+ return createVNode(Icon$1, _objectSpread$s({}, p, {
1208
1208
  "icon": CaretDownOutlined$1
1209
1209
  }), null);
1210
1210
  };
@@ -1213,7 +1213,7 @@ CaretDownOutlined.inheritAttrs = false;
1213
1213
 
1214
1214
  var CaretUpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" } }] }, "name": "caret-up", "theme": "outlined" };
1215
1215
 
1216
- function _objectSpread$q(target) {
1216
+ function _objectSpread$r(target) {
1217
1217
  for (var i = 1; i < arguments.length; i++) {
1218
1218
  var source = arguments[i] != null ? Object(arguments[i]) : {};
1219
1219
  var ownKeys = Object.keys(source);
@@ -1223,12 +1223,12 @@ function _objectSpread$q(target) {
1223
1223
  }));
1224
1224
  }
1225
1225
  ownKeys.forEach(function(key) {
1226
- _defineProperty$r(target, key, source[key]);
1226
+ _defineProperty$s(target, key, source[key]);
1227
1227
  });
1228
1228
  }
1229
1229
  return target;
1230
1230
  }
1231
- function _defineProperty$r(obj, key, value) {
1231
+ function _defineProperty$s(obj, key, value) {
1232
1232
  if (key in obj) {
1233
1233
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1234
1234
  } else {
@@ -1237,8 +1237,8 @@ function _defineProperty$r(obj, key, value) {
1237
1237
  return obj;
1238
1238
  }
1239
1239
  var CaretUpOutlined = function CaretUpOutlined2(props, context) {
1240
- var p = _objectSpread$q({}, props, context.attrs);
1241
- return createVNode(Icon$1, _objectSpread$q({}, p, {
1240
+ var p = _objectSpread$r({}, props, context.attrs);
1241
+ return createVNode(Icon$1, _objectSpread$r({}, p, {
1242
1242
  "icon": CaretUpOutlined$1
1243
1243
  }), null);
1244
1244
  };
@@ -1247,6 +1247,40 @@ CaretUpOutlined.inheritAttrs = false;
1247
1247
 
1248
1248
  var CheckCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
1249
1249
 
1250
+ function _objectSpread$q(target) {
1251
+ for (var i = 1; i < arguments.length; i++) {
1252
+ var source = arguments[i] != null ? Object(arguments[i]) : {};
1253
+ var ownKeys = Object.keys(source);
1254
+ if (typeof Object.getOwnPropertySymbols === "function") {
1255
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1256
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1257
+ }));
1258
+ }
1259
+ ownKeys.forEach(function(key) {
1260
+ _defineProperty$r(target, key, source[key]);
1261
+ });
1262
+ }
1263
+ return target;
1264
+ }
1265
+ function _defineProperty$r(obj, key, value) {
1266
+ if (key in obj) {
1267
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1268
+ } else {
1269
+ obj[key] = value;
1270
+ }
1271
+ return obj;
1272
+ }
1273
+ var CheckCircleFilled = function CheckCircleFilled2(props, context) {
1274
+ var p = _objectSpread$q({}, props, context.attrs);
1275
+ return createVNode(Icon$1, _objectSpread$q({}, p, {
1276
+ "icon": CheckCircleFilled$1
1277
+ }), null);
1278
+ };
1279
+ CheckCircleFilled.displayName = "CheckCircleFilled";
1280
+ CheckCircleFilled.inheritAttrs = false;
1281
+
1282
+ var CloseCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" } }] }, "name": "close-circle", "theme": "filled" };
1283
+
1250
1284
  function _objectSpread$p(target) {
1251
1285
  for (var i = 1; i < arguments.length; i++) {
1252
1286
  var source = arguments[i] != null ? Object(arguments[i]) : {};
@@ -1270,14 +1304,14 @@ function _defineProperty$q(obj, key, value) {
1270
1304
  }
1271
1305
  return obj;
1272
1306
  }
1273
- var CheckCircleFilled = function CheckCircleFilled2(props, context) {
1307
+ var CloseCircleFilled = function CloseCircleFilled2(props, context) {
1274
1308
  var p = _objectSpread$p({}, props, context.attrs);
1275
1309
  return createVNode(Icon$1, _objectSpread$p({}, p, {
1276
- "icon": CheckCircleFilled$1
1310
+ "icon": CloseCircleFilled$1
1277
1311
  }), null);
1278
1312
  };
1279
- CheckCircleFilled.displayName = "CheckCircleFilled";
1280
- CheckCircleFilled.inheritAttrs = false;
1313
+ CloseCircleFilled.displayName = "CloseCircleFilled";
1314
+ CloseCircleFilled.inheritAttrs = false;
1281
1315
 
1282
1316
  var CloseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
1283
1317
 
@@ -2216,6 +2250,18 @@ function is$1(val, type) {
2216
2250
  function isObject$4(val) {
2217
2251
  return val !== null && is$1(val, "Object");
2218
2252
  }
2253
+ function isEmpty(val) {
2254
+ if (isArray$2(val) || isString$1(val)) {
2255
+ return val.length === 0;
2256
+ }
2257
+ if (val instanceof Map || val instanceof Set) {
2258
+ return val.size === 0;
2259
+ }
2260
+ if (isObject$4(val)) {
2261
+ return Object.keys(val).length === 0;
2262
+ }
2263
+ return false;
2264
+ }
2219
2265
  const isNil = (value) => value === null || value === void 0;
2220
2266
  function isNumber$2(val) {
2221
2267
  return is$1(val, "Number");
@@ -2229,6 +2275,9 @@ function isString$1(val) {
2229
2275
  function isFunction$2(val) {
2230
2276
  return typeof val === "function";
2231
2277
  }
2278
+ function isBoolean(val) {
2279
+ return is$1(val, "Boolean");
2280
+ }
2232
2281
  function isArray$2(val) {
2233
2282
  return val && Array.isArray(val);
2234
2283
  }
@@ -23737,6 +23786,9 @@ const genColumnKey = (key, index) => {
23737
23786
  function getColumnPos(index, pos) {
23738
23787
  return pos ? `${pos}-${index}` : `${index}`;
23739
23788
  }
23789
+ function getCellKey(rowKey, colKey) {
23790
+ return [rowKey, colKey].join("_");
23791
+ }
23740
23792
  function objectToEmpty(obj) {
23741
23793
  for (const key in obj) Object.prototype.hasOwnProperty.call(obj, key) && delete obj[key];
23742
23794
  }
@@ -24057,6 +24109,10 @@ const baseTableProps = () => ({
24057
24109
  type: Boolean,
24058
24110
  default: void 0
24059
24111
  },
24112
+ selectRowByClick: {
24113
+ type: Boolean,
24114
+ default: void 0
24115
+ },
24060
24116
  expandIcon: {
24061
24117
  type: Function,
24062
24118
  default: void 0
@@ -24119,6 +24175,14 @@ const baseTableProps = () => ({
24119
24175
  type: Function,
24120
24176
  default: () => ({})
24121
24177
  },
24178
+ editableKeys: {
24179
+ type: Array,
24180
+ default: void 0
24181
+ },
24182
+ rowEditable: {
24183
+ type: Object,
24184
+ default: void 0
24185
+ },
24122
24186
  showHeader: {
24123
24187
  type: Boolean,
24124
24188
  default: true
@@ -24217,6 +24281,9 @@ const baseTableProps = () => ({
24217
24281
  type: Boolean,
24218
24282
  default: void 0
24219
24283
  },
24284
+ editableCellState: {
24285
+ type: Function
24286
+ },
24220
24287
  paginationSticky: {
24221
24288
  type: [Boolean, Object],
24222
24289
  default: true
@@ -24270,6 +24337,15 @@ const baseTableProps = () => ({
24270
24337
  type: Function,
24271
24338
  default: void 0
24272
24339
  },
24340
+ onDataChange: {
24341
+ type: Function
24342
+ },
24343
+ onRowValidate: {
24344
+ type: Function
24345
+ },
24346
+ onValidate: {
24347
+ type: Function
24348
+ },
24273
24349
  "onUpdate:pagination": {
24274
24350
  type: Function
24275
24351
  },
@@ -25022,41 +25098,305 @@ const ICON_TYPE_DOWN$1 = "ICON_TYPE_DOWN";
25022
25098
  const ICON_TYPE_FORBID$1 = "ICON_TYPE_FORBID";
25023
25099
 
25024
25100
  const EditKey = Symbol("edit");
25025
- const useEditProvider = () => {
25101
+ const useEditProvider = (props, {
25102
+ rawData,
25103
+ getRowKey,
25104
+ getIndexsByKey,
25105
+ getRecordByKey
25106
+ }) => {
25107
+ var _a;
25026
25108
  const editCellKeys = shallowRef([]);
25027
- const oldValuesMap = shallowRef({});
25028
- const openEditor = (key, values) => {
25109
+ const editRowsMap = shallowRef({});
25110
+ const intl = useIntl();
25111
+ const editableType = computed(() => {
25112
+ var _a2;
25113
+ return (_a2 = props.rowEditable) == null ? void 0 : _a2.type;
25114
+ });
25115
+ const [mergedEditableKeys, setMergedEditableKeys] = useMergedState$1([], {
25116
+ value: computed(() => {
25117
+ var _a2;
25118
+ return props.editableKeys || ((_a2 = props.rowEditable) == null ? void 0 : _a2.editableKeys);
25119
+ }),
25120
+ onChange: ((_a = props.rowEditable) == null ? void 0 : _a.onChange) ? (keys) => {
25121
+ var _a2, _b, _c;
25122
+ (_c = (_a2 = props.rowEditable) == null ? void 0 : _a2.onChange) == null ? void 0 : _c.call(
25123
+ _a2,
25124
+ // 计算编辑的key
25125
+ keys != null ? keys : [],
25126
+ (_b = keys == null ? void 0 : keys.map((key) => editRowsMap.value[key])) != null ? _b : []
25127
+ );
25128
+ } : void 0
25129
+ });
25130
+ const editingCells = ref({});
25131
+ const newLineRecordCache = shallowRef({});
25132
+ const editableKeysSet = computed(() => {
25133
+ var _a2;
25134
+ const keys = editableType.value === "single" ? (_a2 = mergedEditableKeys.value) == null ? void 0 : _a2.slice(0, 1) : mergedEditableKeys.value;
25135
+ return new Set(keys);
25136
+ });
25137
+ const isEditable = (recordKey) => {
25138
+ var _a2;
25139
+ if ((_a2 = mergedEditableKeys.value) == null ? void 0 : _a2.includes(recordKey)) return true;
25140
+ return false;
25141
+ };
25142
+ const isRowEdit = computed(() => !!editableType.value);
25143
+ const openEditor = (key) => {
25029
25144
  if (key) {
25145
+ const newKeys = [...editCellKeys.value];
25030
25146
  if (Array.isArray(key)) {
25031
25147
  editCellKeys.value = key;
25032
25148
  } else {
25033
- editCellKeys.value.includes(key) || (editCellKeys.value = [key]);
25149
+ newKeys.includes(key) || newKeys.push(key);
25034
25150
  }
25035
- Object.assign(oldValuesMap.value, values || {});
25151
+ editCellKeys.value = newKeys;
25036
25152
  }
25037
25153
  };
25038
25154
  const closeEditor = (key) => {
25039
- if (typeof key === "undefined") {
25040
- editCellKeys.value = [];
25041
- oldValuesMap.value = {};
25042
- return;
25155
+ const closeKeys = editCellKeys.value.filter((cellKey) => cellKey !== key);
25156
+ const closeCells = closeKeys.map((key2) => editingCells.value[key2]).filter((cell) => {
25157
+ var _a2, _b;
25158
+ return !((_b = (_a2 = cell.column) == null ? void 0 : _a2.edit) == null ? void 0 : _b.keepEditMode);
25159
+ });
25160
+ const list = closeCells.map(
25161
+ (cell) => new Promise((resolve) => {
25162
+ cell == null ? void 0 : cell.validateEdit().then((r) => {
25163
+ if (r === true) {
25164
+ const cellKey = getCellKey(cell.rowKey, cell.columnKey);
25165
+ resolve(cellKey);
25166
+ } else {
25167
+ resolve(null);
25168
+ }
25169
+ });
25170
+ })
25171
+ );
25172
+ Promise.all(list).then((keys) => {
25173
+ const closeKeys2 = keys.filter((key2) => !!key2);
25174
+ editCellKeys.value = editCellKeys.value.filter((key2) => !closeKeys2.includes(key2));
25175
+ });
25176
+ };
25177
+ const setEditingCell = (params, isEdit) => {
25178
+ const cellKey = getCellKey(params.rowKey, params.columnKey);
25179
+ if (isEdit) {
25180
+ editingCells.value[cellKey] = params;
25181
+ } else {
25182
+ delete editingCells.value[cellKey];
25043
25183
  }
25044
- const keys = Array.isArray(key) ? key : [key];
25045
- editCellKeys.value = editCellKeys.value.filter((key2) => !keys.includes(key2));
25046
- keys.forEach((key2) => {
25047
- delete oldValuesMap.value[key2];
25184
+ };
25185
+ const getErrorListMapByErrors = (errors) => {
25186
+ const errorMap = {};
25187
+ errors.forEach(({ rowKey, columnKey, errorList }) => {
25188
+ const key = [rowKey, columnKey].join("__");
25189
+ if (errorList == null ? void 0 : errorList.length) {
25190
+ errorMap[key] = errorList;
25191
+ } else {
25192
+ delete errorMap[key];
25193
+ }
25194
+ });
25195
+ return errorMap;
25196
+ };
25197
+ const validateOneRowData = (recordKey) => {
25198
+ const cellKeys = Object.keys(editingCells.value);
25199
+ const rowCellKeys = cellKeys.filter((cellKey) => cellKey.startsWith(`${recordKey}_`));
25200
+ const list = rowCellKeys.map(
25201
+ (cellKey) => new Promise((resolve) => {
25202
+ const cell = editingCells.value[cellKey];
25203
+ cell == null ? void 0 : cell.validateEdit().then((r) => {
25204
+ if (r === true) {
25205
+ resolve({ ...cell, errorList: [] });
25206
+ } else {
25207
+ resolve({ ...cell, errorList: r });
25208
+ }
25209
+ });
25210
+ })
25211
+ );
25212
+ return new Promise((resolve, reject) => {
25213
+ Promise.all(list).then((errors) => {
25214
+ resolve({
25215
+ errors: errors.filter((t) => {
25216
+ var _a2;
25217
+ return (_a2 = t.errorList) == null ? void 0 : _a2.length;
25218
+ }),
25219
+ errorMap: getErrorListMapByErrors(errors)
25220
+ });
25221
+ }, reject);
25222
+ });
25223
+ };
25224
+ const validateRowData = (recordKey) => new Promise((resolve, reject) => {
25225
+ validateOneRowData(recordKey).then(({ errors, errorMap }) => {
25226
+ var _a2;
25227
+ (_a2 = props.onRowValidate) == null ? void 0 : _a2.call(props, { errors, errorMap });
25228
+ resolve({ errors, errorMap });
25229
+ }, reject);
25230
+ });
25231
+ const validateTableCellData = () => {
25232
+ const cellKeys = Object.keys(editingCells.value);
25233
+ const list = cellKeys.map(
25234
+ (cellKey) => new Promise((resolve) => {
25235
+ const cell = editingCells.value[cellKey];
25236
+ cell == null ? void 0 : cell.validateEdit().then((r) => {
25237
+ if (r === true) {
25238
+ resolve({ ...cell, errorList: [] });
25239
+ } else {
25240
+ resolve({ ...cell, errorList: r });
25241
+ }
25242
+ });
25243
+ })
25244
+ );
25245
+ return new Promise((resolve, reject) => {
25246
+ Promise.all(list).then((errors) => {
25247
+ resolve({
25248
+ errors: errors.filter((t) => {
25249
+ var _a2;
25250
+ return (_a2 = t.errorList) == null ? void 0 : _a2.length;
25251
+ }),
25252
+ errorMap: getErrorListMapByErrors(errors)
25253
+ });
25254
+ }, reject);
25048
25255
  });
25049
25256
  };
25257
+ const validateTableData = () => new Promise((resolve, reject) => {
25258
+ validateTableCellData().then(({ errors, errorMap }) => {
25259
+ var _a2;
25260
+ (_a2 = props.onValidate) == null ? void 0 : _a2.call(props, { errors, errorMap });
25261
+ resolve({ errors, errorMap, data: (errors == null ? void 0 : errors.length) ? void 0 : rawData.value });
25262
+ }, reject);
25263
+ });
25264
+ const addEditRecord = (recordValue, options) => {
25265
+ var _a2, _b, _c, _d;
25266
+ if (isRowEdit.value && ((_a2 = Object.keys(newLineRecordCache.value)) == null ? void 0 : _a2.length) && ((_b = props.rowEditable) == null ? void 0 : _b.onlyAddOneLineAlertMessage) !== false) {
25267
+ message.warning(
25268
+ ((_c = props.rowEditable) == null ? void 0 : _c.onlyAddOneLineAlertMessage) || intl.getMessage("editableTable.onlyAddOneLine", "\u53EA\u80FD\u65B0\u589E\u4E00\u884C")
25269
+ );
25270
+ return false;
25271
+ }
25272
+ if (isRowEdit.value && editableKeysSet.value.size > 0 && editableType.value === "single") {
25273
+ message.warning(
25274
+ ((_d = props.rowEditable) == null ? void 0 : _d.onlyOneLineEditorAlertMessage) || intl.getMessage("editableTable.onlyOneLineEditor", "\u53EA\u80FD\u540C\u65F6\u7F16\u8F91\u4E00\u884C")
25275
+ );
25276
+ return false;
25277
+ }
25278
+ const recordKey = getRowKey.value(recordValue, -1);
25279
+ if (!recordKey) {
25280
+ throw new Error("\u8BF7\u8BBE\u7F6E recordCreatorProps.record \u5E76\u8FD4\u56DE\u4E00\u4E2A\u552F\u4E00\u7684key");
25281
+ }
25282
+ if (isRowEdit.value) {
25283
+ editableKeysSet.value.add(recordKey);
25284
+ editRowsMap.value[recordKey] = cloneDeep(recordValue);
25285
+ setMergedEditableKeys(Array.from(editableKeysSet.value));
25286
+ triggerRef(editRowsMap);
25287
+ }
25288
+ if ((options == null ? void 0 : options.position) === "top") {
25289
+ rawData.value.unshift(recordValue);
25290
+ } else {
25291
+ rawData.value.push(recordValue);
25292
+ }
25293
+ newLineRecordCache.value[recordKey] = {
25294
+ defaultValue: recordValue,
25295
+ options
25296
+ };
25297
+ triggerRef(rawData);
25298
+ return true;
25299
+ };
25300
+ const startEditable = (recordKey, recordValue) => {
25301
+ var _a2;
25302
+ if (!isRowEdit.value) {
25303
+ return false;
25304
+ }
25305
+ if (editableKeysSet.value.size > 0 && editableType.value === "single") {
25306
+ message.warning(
25307
+ ((_a2 = props.rowEditable) == null ? void 0 : _a2.onlyOneLineEditorAlertMessage) || intl.getMessage("editableTable.onlyOneLineEditor", "\u53EA\u80FD\u540C\u65F6\u7F16\u8F91\u4E00\u884C")
25308
+ );
25309
+ return false;
25310
+ }
25311
+ editableKeysSet.value.add(recordKey);
25312
+ editRowsMap.value[recordKey] = cloneDeep(recordValue != null ? recordValue : getRecordByKey(recordKey));
25313
+ setMergedEditableKeys(Array.from(editableKeysSet.value));
25314
+ triggerRef(editRowsMap);
25315
+ return true;
25316
+ };
25317
+ const cancelEditable = (recordKey) => {
25318
+ if (!isRowEdit.value) {
25319
+ return false;
25320
+ }
25321
+ const newLineRecord = newLineRecordCache.value[recordKey];
25322
+ if (newLineRecord) {
25323
+ delete newLineRecordCache.value[recordKey];
25324
+ const rowIndex = rawData.value.findIndex((item) => getRowKey.value(item, -1) === recordKey);
25325
+ rawData.value.splice(rowIndex, 1);
25326
+ triggerRef(rawData);
25327
+ }
25328
+ editableKeysSet.value.delete(recordKey);
25329
+ delete editRowsMap.value[recordKey];
25330
+ setMergedEditableKeys(Array.from(editableKeysSet.value));
25331
+ return true;
25332
+ };
25333
+ const saveEditable = async (recordKey) => {
25334
+ var _a2, _b;
25335
+ if (!isRowEdit.value) {
25336
+ return false;
25337
+ }
25338
+ const { errors } = await validateRowData(recordKey);
25339
+ if (!!errors.length) {
25340
+ return false;
25341
+ }
25342
+ const editRow = editRowsMap.value[recordKey];
25343
+ const originRow = getRecordByKey(recordKey);
25344
+ const success = await ((_b = (_a2 = props.rowEditable) == null ? void 0 : _a2.onSave) == null ? void 0 : _b.call(_a2, recordKey, editRow, originRow));
25345
+ if (success === false) {
25346
+ return false;
25347
+ }
25348
+ upadteRowData(recordKey, editRow);
25349
+ const newLineRecord = newLineRecordCache.value[recordKey];
25350
+ if (newLineRecord) {
25351
+ delete newLineRecordCache.value[recordKey];
25352
+ }
25353
+ await cancelEditable(recordKey);
25354
+ return true;
25355
+ };
25356
+ const upadteRowData = (recordKey, editRow) => {
25357
+ const recordIndexs = getIndexsByKey(recordKey);
25358
+ const indexsLen = recordIndexs.length;
25359
+ if (indexsLen === 1) {
25360
+ rawData.value.splice(recordIndexs[0], 1, editRow);
25361
+ }
25362
+ if (indexsLen > 1) {
25363
+ let copyData = rawData.value;
25364
+ let item;
25365
+ const childrenColumnName = props.childrenColumnName || "children";
25366
+ for (let i = 0; i < indexsLen; i++) {
25367
+ item = copyData[recordIndexs[i]];
25368
+ if (i === indexsLen - 2) {
25369
+ const currentData = (item == null ? void 0 : item[childrenColumnName]) || [];
25370
+ currentData.splice(recordIndexs[indexsLen - 1], 1, editRow);
25371
+ break;
25372
+ }
25373
+ copyData = (item == null ? void 0 : item[childrenColumnName]) || [];
25374
+ }
25375
+ }
25376
+ triggerRef(rawData);
25377
+ };
25050
25378
  provide(EditKey, {
25051
25379
  editCellKeys,
25052
25380
  openEditor,
25053
25381
  closeEditor,
25054
- oldValuesMap
25382
+ // oldValuesMap,
25383
+ editableType,
25384
+ mergedEditableKeys,
25385
+ isRowEdit,
25386
+ editRowsMap,
25387
+ setEditingCell
25055
25388
  });
25056
25389
  return {
25057
25390
  editCellKeys,
25058
25391
  openEditor,
25059
- closeEditor
25392
+ closeEditor,
25393
+ cancelEditable,
25394
+ startEditable,
25395
+ saveEditable,
25396
+ isEditable,
25397
+ validateTableData,
25398
+ validateRowData,
25399
+ addEditRecord
25060
25400
  };
25061
25401
  };
25062
25402
  const useEditInject = () => {
@@ -25066,7 +25406,13 @@ const useEditInject = () => {
25066
25406
  },
25067
25407
  closeEditor: () => {
25068
25408
  },
25069
- oldValuesMap: shallowRef({})
25409
+ // oldValuesMap: shallowRef({}),
25410
+ editRowsMap: shallowRef({}),
25411
+ editableType: computed(() => void 0),
25412
+ isRowEdit: computed(() => false),
25413
+ mergedEditableKeys: computed(() => []),
25414
+ setEditingCell: () => {
25415
+ }
25070
25416
  });
25071
25417
  };
25072
25418
 
@@ -25317,926 +25663,6 @@ const useInjectTable = () => {
25317
25663
  return inject(TableContextKey, {});
25318
25664
  };
25319
25665
 
25320
- const KeyCode = {
25321
- TAB: 9,
25322
- ENTER: 13,
25323
- ESC: 27,
25324
- LEFT: 37,
25325
- UP: 38,
25326
- RIGHT: 39,
25327
- DOWN: 40,
25328
- A: 65,
25329
- C: 67};
25330
-
25331
- const useCellNavigation = (params) => {
25332
- const {
25333
- getDisplayedColBefore,
25334
- getDisplayedColAfter,
25335
- allDisplayedColumns,
25336
- setRangeToCell,
25337
- focusCell,
25338
- flattenData,
25339
- getRowByFlattenIndex,
25340
- allCellProps,
25341
- tabGuardTopRef,
25342
- tabGuardBottomRef
25343
- } = params;
25344
- const endFlattenIndex = computed(
25345
- () => {
25346
- var _a;
25347
- return (_a = flattenData.value[flattenData.value.length - 1]) == null ? void 0 : _a.flattenIndex;
25348
- }
25349
- );
25350
- const startFlattenIndex = computed(() => {
25351
- var _a;
25352
- return (_a = flattenData.value[0]) == null ? void 0 : _a.flattenIndex;
25353
- });
25354
- const getNextCellToFocus = (keyCode, focusedCell, ctrlPressed = false) => ctrlPressed ? h2(keyCode, focusedCell) : m(keyCode, focusedCell);
25355
- const h2 = (keyCode, focusedCell) => {
25356
- const isUp = keyCode === KeyCode.UP;
25357
- const isDown = keyCode === KeyCode.DOWN;
25358
- const isLeft = keyCode === KeyCode.LEFT;
25359
- let column, rowIndex;
25360
- if (isUp || isDown) {
25361
- rowIndex = isUp ? startFlattenIndex.value : endFlattenIndex.value;
25362
- column = focusedCell.column;
25363
- } else {
25364
- rowIndex = focusedCell.rowIndex;
25365
- column = isLeft !== false ? allDisplayedColumns.value[0] : allDisplayedColumns.value[allDisplayedColumns.value.length - 1];
25366
- }
25367
- return { rowIndex, rowPinned: null, column };
25368
- };
25369
- const m = (keyCode, focusedCell) => {
25370
- let cell = focusedCell;
25371
- let o2 = false;
25372
- for (; !o2; ) {
25373
- switch (keyCode) {
25374
- case KeyCode.UP:
25375
- cell = getCellAbove(cell);
25376
- break;
25377
- case KeyCode.DOWN:
25378
- case KeyCode.ENTER:
25379
- cell = x(cell);
25380
- break;
25381
- case KeyCode.RIGHT:
25382
- cell = w(cell);
25383
- break;
25384
- case KeyCode.LEFT:
25385
- cell = g(cell);
25386
- break;
25387
- default:
25388
- cell = null;
25389
- console.warn("Table: unknown key for navigation " + keyCode);
25390
- }
25391
- o2 = !cell || y(cell);
25392
- }
25393
- return cell;
25394
- }, y = (e3) => {
25395
- let t2;
25396
- switch (e3.rowPinned) {
25397
- case "top":
25398
- case "bottom":
25399
- break;
25400
- default:
25401
- t2 = getRowByFlattenIndex(e3.rowIndex);
25402
- }
25403
- return !!t2;
25404
- }, g = (e3) => {
25405
- if (!e3) return null;
25406
- const n2 = getDisplayedColBefore(e3.column);
25407
- return n2 ? { rowIndex: e3.rowIndex, column: n2, rowPinned: e3.rowPinned } : null;
25408
- }, w = (e3) => {
25409
- if (!e3) return null;
25410
- const t2 = getDisplayedColAfter(e3.column);
25411
- return t2 ? { rowIndex: e3.rowIndex, column: t2, rowPinned: e3.rowPinned } : null;
25412
- }, x = (e3) => {
25413
- if (!e3) return null;
25414
- const t2 = getRowBelow(e3);
25415
- return t2 ? { rowIndex: t2.rowIndex, column: e3.column, rowPinned: t2.rowPinned } : null;
25416
- }, getRowBelow = (e3) => {
25417
- const t2 = e3.rowIndex, n2 = e3.rowPinned;
25418
- return C(e3) ? null : { rowIndex: t2 + 1, rowPinned: n2 };
25419
- }, C = (e3) => {
25420
- const t2 = e3.rowIndex;
25421
- return endFlattenIndex.value <= t2;
25422
- }, getRowAbove = (e3) => {
25423
- const t2 = e3.rowIndex, n2 = e3.rowPinned;
25424
- return (n2 ? 0 === t2 : t2 === startFlattenIndex.value) ? null : { rowIndex: t2 - 1, rowPinned: n2 };
25425
- }, getCellAbove = (e3) => {
25426
- if (!e3) return null;
25427
- const t2 = getRowAbove({
25428
- rowIndex: e3.rowIndex,
25429
- rowPinned: e3.rowPinned
25430
- });
25431
- return t2 ? { rowIndex: t2.rowIndex, column: e3.column, rowPinned: t2.rowPinned } : null;
25432
- }, k = (e3) => e3.rowIndex >= startFlattenIndex.value && e3.rowIndex <= endFlattenIndex.value, getNextTabbedCell = (e3, t2) => t2 ? K(e3) : _(e3), _ = (e3) => {
25433
- const t2 = allDisplayedColumns.value;
25434
- let l2 = e3.rowIndex, r2 = e3.rowPinned, a2 = getDisplayedColAfter(e3.column);
25435
- if (!a2) {
25436
- a2 = t2[0];
25437
- const n2 = getRowBelow(e3);
25438
- if (!n2) return null;
25439
- if (!n2.rowPinned && !k(n2)) return null;
25440
- l2 = n2 ? n2.rowIndex : null, r2 = n2 ? n2.rowPinned : null;
25441
- }
25442
- return { rowIndex: l2, column: a2, rowPinned: r2 };
25443
- }, K = (e3) => {
25444
- const n2 = allDisplayedColumns.value;
25445
- let l2 = e3.rowIndex, r2 = e3.rowPinned, a2 = getDisplayedColBefore(e3.column);
25446
- if (!a2) {
25447
- a2 = n2[n2.length - 1];
25448
- const t2 = getRowAbove({
25449
- rowIndex: e3.rowIndex,
25450
- rowPinned: e3.rowPinned
25451
- });
25452
- if (!t2) return null;
25453
- if (!t2.rowPinned && !k(t2)) return null;
25454
- l2 = t2 ? t2.rowIndex : null, r2 = t2 ? t2.rowPinned : null;
25455
- }
25456
- return { rowIndex: l2, column: a2, rowPinned: r2 };
25457
- }, O = (e3) => {
25458
- const t2 = ((e4) => {
25459
- let t3, n2;
25460
- const l2 = null === (t3 = getRowByFlattenIndex(e4.rowIndex)) || void 0 === t3 ? void 0 : t3.rowKey, r2 = (((null === (n2 = allCellProps.value[l2]) || void 0 === n2 ? void 0 : n2[e4.column.columnKey]) || {}).props || {}).colSpan, a2 = [];
25461
- if (r2 > 1) {
25462
- const t4 = allDisplayedColumns.value.findIndex(
25463
- (t5) => t5.columnKey === e4.column.columnKey
25464
- );
25465
- for (let e5 = 0; e5 < r2; e5++) a2.push(allDisplayedColumns.value[t4 + e5]);
25466
- } else a2.push(e4.column);
25467
- return a2.filter((e5) => !!e5);
25468
- })(e3);
25469
- return 1 === t2.length ? e3 : {
25470
- rowIndex: e3.rowIndex,
25471
- column: t2[t2.length - 1],
25472
- rowPinned: e3.rowPinned
25473
- };
25474
- }, P = (e3) => {
25475
- let t2;
25476
- const n2 = getRowByFlattenIndex(e3.rowIndex), o2 = null == n2 ? void 0 : n2.rowKey, l2 = (((null === (t2 = allCellProps.value[o2]) || void 0 === t2 ? void 0 : t2[e3.column.columnKey]) || {}).props || {}).rowSpan;
25477
- return !!n2 && 0 !== l2 && !n2.isExpandRow;
25478
- }, tabToNextCellCommon = (e3, t2) => $(e3, t2), $ = (e3, t2) => {
25479
- const n2 = T(e3, t2);
25480
- return n2 && focusCell(n2), !!n2;
25481
- }, T = (t2, n2) => {
25482
- let o2 = t2;
25483
- for (; o2 && (o2 === t2 || !P(o2)); ) n2 || (o2 = O(o2)), o2 = getNextTabbedCell(o2, n2);
25484
- return o2 ? o2.rowIndex < 0 ? null : (params.ensureCellVisible(o2), setRangeToCell(o2), o2) : null;
25485
- };
25486
- return {
25487
- getNextCellToFocus,
25488
- getNextTabbedCell,
25489
- getLastBodyCell: () => ({ rowIndex: endFlattenIndex.value, rowPinned: null }),
25490
- navigateToNextCell: (t2, n2) => {
25491
- const o2 = t2.keyCode;
25492
- let r2 = n2, a2 = false;
25493
- for (; r2 && (r2 === n2 || !P(r2)); )
25494
- o2 === KeyCode.RIGHT && (r2 = O(r2)), r2 = getNextCellToFocus(o2, r2), a2 = !r2;
25495
- a2 && t2 && o2 === KeyCode.UP && (r2 = { rowIndex: -1, rowPinned: null, column: n2.column }), r2 && (r2.rowIndex < 0 || (params.ensureCellVisible(r2), setRangeToCell(r2)));
25496
- },
25497
- onTabKeyDown: (e3, t2) => {
25498
- let n2, o2;
25499
- const l2 = t2.shiftKey;
25500
- tabToNextCellCommon(e3, l2) || (l2 ? null === (n2 = tabGuardTopRef.value) || void 0 === n2 || n2.focus() : null === (o2 = tabGuardBottomRef.value) || void 0 === o2 || o2.focus()), t2.preventDefault();
25501
- },
25502
- tabToNextCellCommon,
25503
- getFirstCellToFocus: (t2) => {
25504
- const n2 = (() => {
25505
- const e3 = getRowByFlattenIndex(startFlattenIndex.value), t3 = allDisplayedColumns.value[0];
25506
- return e3 && t3 ? { rowIndex: e3.rowIndex, rowPinned: null, column: t3 } : null;
25507
- })();
25508
- P(n2) ? (params.ensureCellVisible(n2), setRangeToCell(n2)) : n2 && tabToNextCellCommon(n2, t2);
25509
- },
25510
- getLastCellToFocus: (t2) => {
25511
- const n2 = (() => {
25512
- const e3 = getRowByFlattenIndex(endFlattenIndex.value), t3 = allDisplayedColumns.value[allDisplayedColumns.value.length - 1];
25513
- return e3 && t3 ? { rowIndex: e3.rowIndex, rowPinned: null, column: t3 } : null;
25514
- })();
25515
- P(n2) ? (params.ensureCellVisible(n2), setRangeToCell(n2)) : n2 && tabToNextCellCommon(n2, t2);
25516
- },
25517
- getRowAbove,
25518
- getCellAbove,
25519
- getRowBelow
25520
- };
25521
- };
25522
-
25523
- const useAutoScroll = (params) => {
25524
- const {
25525
- scrollContainer,
25526
- scrollAxis,
25527
- onScrollCallback = () => {
25528
- },
25529
- showVerticalScrollbar,
25530
- showHorizontalScrollbar
25531
- } = params;
25532
- let timer = null;
25533
- let i = 0;
25534
- let hasLeft = false;
25535
- let hasRight = false;
25536
- let hasTop = false;
25537
- let hasBottom = false;
25538
- const isXAxis = -1 !== scrollAxis.indexOf("x");
25539
- const isYAxis = -1 !== scrollAxis.indexOf("y");
25540
- const scrollByTick = computed(() => {
25541
- var _a, _b;
25542
- return (_b = (_a = params.scrollByTick) == null ? void 0 : _a.value) != null ? _b : 20;
25543
- });
25544
- const exec = () => {
25545
- if (null === timer) {
25546
- timer = window.setInterval(handle, 100);
25547
- i = 0;
25548
- }
25549
- };
25550
- const handle = () => {
25551
- i++;
25552
- const boundary = i > 20 ? 200 : i > 10 ? 80 : 40;
25553
- if (isYAxis) {
25554
- const position = params.getVerticalPosition();
25555
- hasTop && params.setVerticalPosition(position - boundary), hasBottom && params.setVerticalPosition(position + boundary);
25556
- }
25557
- if (isXAxis) {
25558
- const position = params.getHorizontalPosition();
25559
- hasLeft && params.setHorizontalPosition(position - boundary), hasRight && params.setHorizontalPosition(position + boundary);
25560
- }
25561
- onScrollCallback();
25562
- };
25563
- const clear = () => {
25564
- if (timer) {
25565
- window.clearInterval(timer);
25566
- timer = null;
25567
- }
25568
- };
25569
- return {
25570
- check: (mouseEvent, forceSkipVerticalScroll = false) => {
25571
- const hasVerticalScroll = forceSkipVerticalScroll || !showVerticalScrollbar.value;
25572
- if (hasVerticalScroll && !showHorizontalScrollbar.value) return;
25573
- const clientRect = scrollContainer.value.getBoundingClientRect();
25574
- const tick = scrollByTick.value;
25575
- hasLeft = mouseEvent.clientX < clientRect.left + tick;
25576
- hasRight = mouseEvent.clientX > clientRect.right - tick;
25577
- hasTop = mouseEvent.clientY < clientRect.top + tick && !hasVerticalScroll;
25578
- hasBottom = mouseEvent.clientY > clientRect.bottom - tick && !hasVerticalScroll;
25579
- return hasLeft || hasRight || hasTop || hasBottom ? exec() : clear();
25580
- },
25581
- ensureCleared: clear
25582
- };
25583
- };
25584
-
25585
- const isOverFormFieldElement = (mouseEvent) => {
25586
- var _a, _b;
25587
- const tagName = (_b = (_a = mouseEvent.target) == null ? void 0 : _a.tagName) == null ? void 0 : _b.toLocaleLowerCase();
25588
- return !!(tagName == null ? void 0 : tagName.match("^a$|textarea|input|select|button"));
25589
- };
25590
- const useDragSelection = (params) => {
25591
- let dragging = false;
25592
- let cacheStartTouch = null;
25593
- let startTarget = null;
25594
- let cacheTouch;
25595
- const destroyHandlers = [];
25596
- const batchEvent = (eventList) => {
25597
- eventList.forEach((config) => {
25598
- const { target, type, listener, options } = config;
25599
- target.addEventListener(type, listener, options);
25600
- });
25601
- destroyHandlers.push(() => {
25602
- eventList.forEach((config) => {
25603
- const { target, type, listener, options } = config;
25604
- target.removeEventListener(type, listener, options);
25605
- });
25606
- });
25607
- };
25608
- const getTouch = (touches) => {
25609
- for (let i = 0; i < touches.length; i++) {
25610
- if (touches[i].identifier === (cacheTouch == null ? void 0 : cacheTouch.identifier)) {
25611
- return touches[i];
25612
- }
25613
- }
25614
- return null;
25615
- };
25616
- const handleMouseMoveOrTouchMove = (event, cacheEvent) => {
25617
- if (!dragging) {
25618
- if (eventsClose(event, cacheEvent, DRAG_BUFF)) {
25619
- return;
25620
- }
25621
- dragging = true;
25622
- params.onDragStart(cacheEvent);
25623
- }
25624
- };
25625
- const handleMouseUpOrToucheEnd = () => {
25626
- if (dragging) {
25627
- dragging = false;
25628
- }
25629
- cacheStartTouch = null;
25630
- startTarget = null;
25631
- cacheTouch = null;
25632
- destroyHandlers.forEach((fn) => fn());
25633
- destroyHandlers.length = 0;
25634
- };
25635
- const isOverForm = (event) => !isOverFormFieldElement(event);
25636
- const mouseMoveHandler = (event) => {
25637
- if (isOverForm(event)) {
25638
- event.preventDefault();
25639
- }
25640
- handleMouseMoveOrTouchMove(event, cacheStartTouch);
25641
- };
25642
- const touchMoveHandler = (event) => {
25643
- getTouch(event.touches) && handleMouseMoveOrTouchMove(event, cacheStartTouch);
25644
- };
25645
- const touchEndHandler = (event) => {
25646
- getTouch(event.changedTouches) && handleMouseUpOrToucheEnd();
25647
- };
25648
- const onBodyMousedown = (e) => {
25649
- var _a, _b;
25650
- if (params.level !== ((_a = e.cellInfo) == null ? void 0 : _a.level)) return;
25651
- if (isOverForm(e)) {
25652
- e.preventDefault();
25653
- }
25654
- dragging = false;
25655
- cacheStartTouch = e;
25656
- startTarget = (_b = e.cellInfo) == null ? void 0 : _b.cellTarget;
25657
- params.bodyElementRef.value;
25658
- batchEvent([
25659
- {
25660
- target: document,
25661
- type: "mousemove",
25662
- listener: (e2) => mouseMoveHandler(e2)
25663
- },
25664
- {
25665
- target: document,
25666
- type: "mouseup",
25667
- listener: () => {
25668
- handleMouseUpOrToucheEnd();
25669
- }
25670
- },
25671
- {
25672
- target: document,
25673
- type: "contextmenu",
25674
- listener: (e2) => e2.preventDefault()
25675
- }
25676
- ]);
25677
- mouseMoveHandler(e);
25678
- };
25679
- let bodyTouchStartHandle;
25680
- watch(
25681
- [() => params.bodyElementRef.value, params.enableRangeSelection],
25682
- ([bodyEl], [oldBodyEl]) => {
25683
- if (oldBodyEl) {
25684
- oldBodyEl.removeEventListener("mousedown", onBodyMousedown);
25685
- if (bodyTouchStartHandle) {
25686
- oldBodyEl.removeEventListener("touchstart", bodyTouchStartHandle);
25687
- bodyTouchStartHandle = null;
25688
- destroyHandlers.forEach((fn) => fn());
25689
- destroyHandlers.length = 0;
25690
- }
25691
- }
25692
- if (bodyEl && params.enableRangeSelection.value) {
25693
- bodyEl.addEventListener("mousedown", onBodyMousedown);
25694
- bodyTouchStartHandle = (e3) => {
25695
- e3.cancelable && (e3.preventDefault(), e3.stopPropagation());
25696
- };
25697
- }
25698
- }
25699
- );
25700
- return {
25701
- onBodyMousedown,
25702
- onBodyTouchstart: (touchEvent) => {
25703
- dragging = false;
25704
- const touch = touchEvent.touches[0];
25705
- cacheTouch = touch;
25706
- params.bodyElementRef.value;
25707
- const endHandle = (event) => touchEndHandler(event);
25708
- const target = touchEvent.target;
25709
- const body = document.body;
25710
- batchEvent([
25711
- {
25712
- target: body,
25713
- type: "touchmove",
25714
- listener: (e) => {
25715
- e.cancelable && e.preventDefault();
25716
- },
25717
- options: { passive: false }
25718
- },
25719
- {
25720
- target,
25721
- type: "touchmove",
25722
- listener: (e) => touchMoveHandler(e),
25723
- options: { passive: true }
25724
- },
25725
- {
25726
- target,
25727
- type: "touchend",
25728
- listener: endHandle,
25729
- options: { passive: true }
25730
- },
25731
- {
25732
- target,
25733
- type: "touchcancel",
25734
- listener: endHandle,
25735
- options: { passive: true }
25736
- }
25737
- ]);
25738
- },
25739
- getStartTarget: () => startTarget
25740
- };
25741
- };
25742
-
25743
- function classNames(...args) {
25744
- const classes = [];
25745
- for (let i = 0; i < args.length; i++) {
25746
- const value = args[i];
25747
- if (!value) continue;
25748
- if (isString(value)) {
25749
- classes.push(value);
25750
- } else if (isArray(value)) {
25751
- for (let i2 = 0; i2 < value.length; i2++) {
25752
- const inner = classNames(value[i2]);
25753
- if (inner) {
25754
- classes.push(inner);
25755
- }
25756
- }
25757
- } else if (isObject(value)) {
25758
- for (const name in value) {
25759
- if (value[name]) {
25760
- classes.push(name);
25761
- }
25762
- }
25763
- }
25764
- }
25765
- return classes.join(" ");
25766
- }
25767
-
25768
- const RangeSymbolKey = Symbol("rangeSymbolKey");
25769
- const useProvideRangeStore = (parmas) => {
25770
- const {
25771
- allColumns,
25772
- flattenData,
25773
- prefixCls,
25774
- rangeSelection,
25775
- getRowByFlattenIndex,
25776
- rootRef,
25777
- bodyRef,
25778
- latestRangeStartCell,
25779
- scrollLeft,
25780
- scrollTop,
25781
- scrollTo,
25782
- showVerticalScrollbar,
25783
- showHorizontalScrollbar,
25784
- getIndexsByKey,
25785
- formatRangeCellText,
25786
- copyDelimiter
25787
- } = parmas;
25788
- const level = useInjectLevel();
25789
- useAutoScroll({
25790
- scrollContainer: bodyRef,
25791
- scrollAxis: "xy",
25792
- getVerticalPosition: () => scrollTop.value,
25793
- setVerticalPosition: (pos) => {
25794
- scrollTo(pos);
25795
- },
25796
- getHorizontalPosition: () => scrollLeft.value,
25797
- setHorizontalPosition: (pos) => scrollTo({ left: pos }),
25798
- showVerticalScrollbar,
25799
- showHorizontalScrollbar
25800
- });
25801
- const enableRangeSelection = computed(() => !!rangeSelection.value);
25802
- const singleRangeSelection = computed(() => "single" === rangeSelection.value);
25803
- const rangeCellClass = computed(() => `${prefixCls.value}-body-cell-range-selected`);
25804
- const RangeSingleCellClass = computed(() => `${prefixCls.value}-body-cell-range-single-cell`);
25805
- const RangeTopClass = computed(() => `${prefixCls.value}-body-cell-range-top`);
25806
- const RangeRIghtClass = computed(() => `${prefixCls.value}-body-cell-range-right`);
25807
- const RangeBottomClass = computed(() => `${prefixCls.value}-body-cell-range-bottom`);
25808
- const RangeLeftClass = computed(() => `${prefixCls.value}-body-cell-range-left`);
25809
- const cellRanges = shallowRef([]);
25810
- const allDisplayedColumns = computed(
25811
- () => allColumns.value.filter((col) => !col.__Internal__Column__)
25812
- );
25813
- watch(allDisplayedColumns, (newValue) => {
25814
- cellRanges.value.forEach((cellRange) => {
25815
- cellRange.columns = cellRange.columns.filter(
25816
- (column) => newValue.find((item) => item.columnKey === column.columnKey)
25817
- );
25818
- });
25819
- cellRanges.value = cellRanges.value.filter((cellRange) => cellRange.columns.length > 0);
25820
- });
25821
- watch(flattenData, () => {
25822
- const lastIndex = flattenData.value.length - 1;
25823
- cellRanges.value.forEach((cellRange) => {
25824
- const { startRow, endRow } = cellRange;
25825
- if (startRow.rowIndex > lastIndex) {
25826
- cellRange.startRow = null;
25827
- }
25828
- if (endRow.rowIndex > lastIndex) {
25829
- cellRange.endRow = null;
25830
- }
25831
- });
25832
- cellRanges.value = cellRanges.value.filter(
25833
- (cellRange) => cellRange.startRow && cellRange.endRow
25834
- );
25835
- });
25836
- const onDragStart = (mouseEvent) => {
25837
- var _a;
25838
- (_a = mouseEvent.cellInfo) == null ? void 0 : _a.level;
25839
- if (!enableRangeSelection.value) return;
25840
- const { ctrlKey, metaKey, shiftKey } = mouseEvent;
25841
- const ctrlOrMetaKey = ctrlKey || metaKey;
25842
- const isMultiple = !singleRangeSelection.value && ctrlOrMetaKey;
25843
- const rangeLength = cellRanges.value.length;
25844
- const isRangeSelected = shiftKey && rangeLength > 0;
25845
- if (!(isMultiple || isRangeSelected)) {
25846
- clearAllSelectedRange();
25847
- }
25848
- mouseEvent.cellInfo.cellPosition;
25849
- return;
25850
- };
25851
- const onDragging = (mouseEvent) => {
25852
- return;
25853
- };
25854
- const onDragStop = () => {
25855
- };
25856
- const isSelectedEmpty = computed(() => 0 === cellRanges.value.length);
25857
- const Y = computed(() => {
25858
- const length = cellRanges.value.length;
25859
- if (0 === length) return false;
25860
- if (length > 1) return true;
25861
- const first = cellRanges.value[0];
25862
- const n = le(first);
25863
- const o = re2(first);
25864
- return n.rowPinned !== o.rowPinned || n.rowIndex !== o.rowIndex || 1 !== (first == null ? void 0 : first.columns.length);
25865
- });
25866
- useDragSelection({
25867
- onDragStart,
25868
- onDragging,
25869
- onDragStop,
25870
- rootElementRef: rootRef,
25871
- bodyElementRef: bodyRef,
25872
- level,
25873
- enableRangeSelection
25874
- });
25875
- const X = (startRow, endRow) => {
25876
- switch (startRow.rowPinned) {
25877
- case "top":
25878
- if ("top" !== endRow.rowPinned) return true;
25879
- break;
25880
- case "bottom":
25881
- if ("bottom" !== endRow.rowPinned) return false;
25882
- break;
25883
- default:
25884
- if (endRow.rowPinned) {
25885
- return "top" !== endRow.rowPinned;
25886
- }
25887
- }
25888
- return startRow.rowIndex < endRow.rowIndex;
25889
- };
25890
- const q = (e3) => {
25891
- let t2;
25892
- return e3.forEach((e4) => {
25893
- (void 0 === t2 || X(t2, e4)) && (t2 = e4);
25894
- }), t2;
25895
- };
25896
- const Q = (e3) => {
25897
- let t2;
25898
- return e3.forEach((e4) => {
25899
- (void 0 === t2 || X(e4, t2)) && (t2 = e4);
25900
- }), t2;
25901
- };
25902
- const Z = (e3, t2) => !e3 && !t2 || !(e3 && !t2 || !e3 && t2) && e3.rowIndex === t2.rowIndex && e3.rowPinned == t2.rowPinned;
25903
- const J = (e3, t2) => {
25904
- let n, o;
25905
- const l2 = e3 === t2 || e3.columnKey === t2.columnKey, r2 = allDisplayedColumns.value.findIndex((t3) => t3.columnKey === e3.columnKey);
25906
- if (r2 < 0)
25907
- return void console.warn(
25908
- `Table: column ${null !== (n = e3.originColumn.key) && void 0 !== n ? n : e3.originColumn.dataIndex} is not valid`
25909
- );
25910
- const a2 = l2 ? r2 : allDisplayedColumns.value.findIndex((e4) => e4.columnKey === t2.columnKey);
25911
- if (a2 < 0)
25912
- return void console.warn(
25913
- `Table: column ${null !== (o = t2.originColumn.key) && void 0 !== o ? o : t2.originColumn.dataIndex} is not valid`
25914
- );
25915
- if (l2) return [e3];
25916
- const i2 = Math.min(r2, a2), s2 = i2 === r2 ? a2 : r2, u2 = [];
25917
- for (let e4 = i2; e4 <= s2; e4++) u2.push(allDisplayedColumns.value[e4]);
25918
- return u2;
25919
- };
25920
- const setRangeToCell = (e3, t2 = false) => {
25921
- if (!enableRangeSelection.value) return;
25922
- const n = J(e3.column, e3.column);
25923
- if (!n) return;
25924
- if (latestRangeStartCell.value === e3) return;
25925
- !singleRangeSelection.value && t2 || (cellRanges.value = []);
25926
- const o = { rowIndex: e3.rowIndex, rowPinned: e3.rowPinned }, l2 = { startRow: o, endRow: o, columns: n, startColumn: e3.column };
25927
- cellRanges.value.push(l2), latestRangeStartCell.value = e3, triggerRef(cellRanges);
25928
- };
25929
- const te = (e3, t2) => {
25930
- const n = t2.column, o = J(e3.startColumn, n);
25931
- o && !ne(e3, t2) && (e3.columns = o, e3.endRow = { rowIndex: t2.rowIndex, rowPinned: t2.rowPinned }, triggerRef(cellRanges));
25932
- };
25933
- const ne = (e3, t2) => {
25934
- const { startRow: n, endRow: o } = e3, l2 = X(n, o) ? o : n, r2 = t2.rowIndex === l2.rowIndex && t2.rowPinned === l2.rowPinned, a2 = e3.columns[0], i2 = e3.columns[e3.columns.length - 1], s2 = e3.startColumn === a2 ? i2 : a2;
25935
- return t2.column === s2 && r2;
25936
- };
25937
- const oe = (e3, t2) => {
25938
- const n = null !== t2.columns && t2.columns.find((t3) => t3.columnKey === e3.column.columnKey), o = ae2(e3.rowIndex, e3.rowPinned, t2);
25939
- return n && o;
25940
- };
25941
- const le = (cellRange) => {
25942
- var _a;
25943
- if (cellRange.startRow && cellRange.endRow) {
25944
- return X(cellRange.startRow, cellRange.endRow) ? cellRange.startRow : cellRange.endRow;
25945
- }
25946
- return { rowIndex: (_a = flattenData.value[0]) == null ? void 0 : _a.rowIndex, rowPinned: null };
25947
- };
25948
- const re2 = (e3) => {
25949
- var _a;
25950
- return e3.startRow && e3.endRow ? X(e3.startRow, e3.endRow) ? e3.endRow : e3.startRow : {
25951
- rowIndex: (_a = flattenData.value[flattenData.value.length - 1]) == null ? void 0 : _a.rowIndex,
25952
- rowPinned: null
25953
- };
25954
- };
25955
- const ae2 = (e3, t2, n) => {
25956
- const o = le(n), l2 = re2(n), r2 = { rowIndex: e3, rowPinned: t2 }, a2 = r2.rowIndex === o.rowIndex && r2.rowPinned == o.rowPinned, i2 = r2.rowIndex === l2.rowIndex && r2.rowPinned == l2.rowPinned;
25957
- if (a2 || i2) return true;
25958
- const s2 = !X(r2, o), u2 = X(r2, l2);
25959
- return s2 && u2;
25960
- };
25961
- const getCellRangeCount = (cell2) => isSelectedEmpty.value ? 0 : cellRanges.value.filter((cellRange) => oe(cell2, cellRange)).length;
25962
- const getDisplayedColBefore = (e3) => {
25963
- const t2 = allDisplayedColumns.value, n = t2.findIndex((t3) => t3.columnKey === e3.columnKey);
25964
- return n > 0 ? t2[n - 1] : null;
25965
- };
25966
- const getDisplayedColAfter = (e3) => {
25967
- const t2 = allDisplayedColumns.value, n = t2.findIndex((t3) => t3.columnKey === e3.columnKey);
25968
- return n < t2.length - 1 ? t2[n + 1] : null;
25969
- };
25970
- const ce2 = (e3) => {
25971
- if (null == e3) return null;
25972
- const t2 = allDisplayedColumns.value.find((t3) => t3.columnKey === e3);
25973
- return t2 || console.warn("Table: could not find column " + e3), t2;
25974
- };
25975
- const de2 = () => cellRanges.value;
25976
- const clearAllSelectedRange = () => {
25977
- cellRanges.value = [];
25978
- };
25979
- const appendCellToSelectedRange = (e3) => {
25980
- if (!enableRangeSelection.value) return;
25981
- const t2 = ((e4) => {
25982
- let t3, n = false;
25983
- if (e4.columnsKey) t3 = e4.columnsKey.map((e5) => ce2(e5)).filter((e5) => e5);
25984
- else {
25985
- const o = ce2(e4.columnStartKey), l2 = ce2(e4.columnEndKey);
25986
- if (!o || !l2) return;
25987
- t3 = J(o, l2), t3 && t3.length && (n = t3[0] !== o);
25988
- }
25989
- if (!t3) return;
25990
- return {
25991
- startRow: null != e4.rowStartIndex ? { rowIndex: e4.rowStartIndex, rowPinned: null } : void 0,
25992
- endRow: null != e4.rowEndIndex ? { rowIndex: e4.rowEndIndex, rowPinned: null } : void 0,
25993
- columns: t3,
25994
- startColumn: n ? t3[t3.length - 1] : t3[0]
25995
- };
25996
- })(e3);
25997
- t2 && (t2.startRow && (latestRangeStartCell.value = {
25998
- rowIndex: t2.startRow.rowIndex,
25999
- rowPinned: t2.startRow.rowPinned,
26000
- column: t2.startColumn
26001
- }), cellRanges.value.push(t2));
26002
- };
26003
- const fe2 = (e3) => {
26004
- enableRangeSelection.value && (clearAllSelectedRange(), appendCellToSelectedRange(e3));
26005
- };
26006
- const focusCell = (e3) => {
26007
- let t2, n;
26008
- const o = null === (t2 = getRowByFlattenIndex(e3.rowIndex)) || void 0 === t2 ? void 0 : t2.rowKey, l2 = null === (n = e3.column) || void 0 === n ? void 0 : n.columnKey;
26009
- if (void 0 !== o && void 0 !== l2 && rootRef.value) {
26010
- const e4 = rootRef.value.querySelector(
26011
- `[data-row-key="${o}"] [data-column-key="${l2}"][data-level="${level}"]`
26012
- );
26013
- if (e4) {
26014
- const t4 = e4.getElementsByTagName("input")[0];
26015
- e4.focus();
26016
- t4 && t4.focus();
26017
- }
26018
- }
26019
- };
26020
- const intersectLastRange = (fromMouseClick = false) => {
26021
- if (singleRangeSelection.value) return;
26022
- if (isSelectedEmpty.value) return;
26023
- const lastCellRange2 = cellRanges.value[cellRanges.value.length - 1];
26024
- const n = le(lastCellRange2);
26025
- const o = re2(lastCellRange2);
26026
- const l2 = [];
26027
- cellRanges.value.slice(0, -1).forEach((e4) => {
26028
- const r2 = le(e4), a2 = re2(e4), i2 = e4.columns, s2 = i2.filter((e5) => -1 === (lastCellRange2 == null ? void 0 : lastCellRange2.columns.indexOf(e5)));
26029
- if (s2.length !== i2.length)
26030
- if (X(o, r2) || X(a2, n)) l2.push(e4);
26031
- else {
26032
- if (X(r2, n)) {
26033
- const e5 = {
26034
- columns: [...i2],
26035
- startColumn: lastCellRange2 == null ? void 0 : lastCellRange2.startColumn,
26036
- startRow: Object.assign({}, r2),
26037
- endRow: navigationService.getRowAbove(n)
26038
- };
26039
- l2.push(e5);
26040
- }
26041
- if (s2.length > 0) {
26042
- const e5 = {
26043
- columns: s2,
26044
- startColumn: s2.find((e6) => e6.columnKey === (lastCellRange2 == null ? void 0 : lastCellRange2.startColumn.columnKey)) ? lastCellRange2 == null ? void 0 : lastCellRange2.startColumn : s2[0],
26045
- startRow: q([Object.assign({}, n), Object.assign({}, r2)]),
26046
- endRow: Q([Object.assign({}, o), Object.assign({}, a2)])
26047
- };
26048
- l2.push(e5);
26049
- }
26050
- X(o, a2) && l2.push({
26051
- columns: [...i2],
26052
- startColumn: lastCellRange2 == null ? void 0 : lastCellRange2.startColumn,
26053
- startRow: navigationService.getRowBelow(o),
26054
- endRow: Object.assign({}, a2)
26055
- });
26056
- }
26057
- else l2.push(e4);
26058
- }), cellRanges.value = l2;
26059
- };
26060
- watch(latestRangeStartCell, () => {
26061
- latestRangeStartCell.value && focusCell(latestRangeStartCell.value);
26062
- });
26063
- const ensureCellVisible = (cell2) => {
26064
- parmas.ensureCellRowVisible(cell2);
26065
- parmas.ensureCellColumnVisible(cell2);
26066
- };
26067
- const navigationService = useCellNavigation({
26068
- getDisplayedColBefore,
26069
- getDisplayedColAfter,
26070
- allDisplayedColumns,
26071
- setRangeToCell,
26072
- focusCell,
26073
- ensureCellVisible,
26074
- ...parmas
26075
- });
26076
- provide(RangeSymbolKey, {
26077
- cellRanges,
26078
- extendLatestRangeToCell: (e3) => {
26079
- if (isSelectedEmpty.value || !latestRangeStartCell.value) return;
26080
- const t2 = cellRanges.value[cellRanges.value.length - 1];
26081
- te(t2, e3);
26082
- },
26083
- setRangeToCell,
26084
- onDragStart,
26085
- onDragging,
26086
- isCellInAnyRange: (cell2) => getCellRangeCount(cell2) > 0,
26087
- getRangeCellClass: (e3) => {
26088
- const t2 = getCellRangeCount(e3), n = ((e4) => {
26089
- let t3 = false, n2 = false, o2 = false, l3 = false;
26090
- const r3 = e4.column;
26091
- let a3, i3;
26092
- a3 = getDisplayedColBefore(r3), i3 = getDisplayedColAfter(r3);
26093
- const s2 = cellRanges.value.filter((t4) => oe(e4, t4));
26094
- a3 || (l3 = true), i3 || (n2 = true);
26095
- for (let r4 = 0; r4 < s2.length && !(t3 && n2 && o2 && l3); r4++) {
26096
- const u2 = s2[r4], c2 = le(u2), d = re2(u2);
26097
- !t3 && Z(c2, e4) && (t3 = true), !o2 && Z(d, e4) && (o2 = true), !l3 && a3 && u2.columns.findIndex((e5) => e5.columnKey === a3.columnKey) < 0 && (l3 = true), !n2 && i3 && u2.columns.findIndex((e5) => e5.columnKey === i3.columnKey) < 0 && (n2 = true);
26098
- }
26099
- return { top: t3, right: n2, bottom: o2, left: l3 };
26100
- })(e3), o = 1 === t2 && !Y.value, l2 = !o && n.top, r2 = !o && n.right, a2 = !o && n.bottom, i2 = !o && n.left;
26101
- return classNames({
26102
- [rangeCellClass.value]: 0 !== t2,
26103
- [`${rangeCellClass.value}-1`]: 1 === t2,
26104
- [`${rangeCellClass.value}-2`]: 2 === t2,
26105
- [`${rangeCellClass.value}-3`]: 3 === t2,
26106
- [`${rangeCellClass.value}-4`]: t2 >= 4,
26107
- [RangeSingleCellClass.value]: o,
26108
- [RangeTopClass.value]: l2,
26109
- [RangeRIghtClass.value]: r2,
26110
- [RangeBottomClass.value]: a2,
26111
- [RangeLeftClass.value]: i2
26112
- });
26113
- },
26114
- enableRangeSelection,
26115
- singleRangeSelection,
26116
- getDisplayedColBefore,
26117
- getDisplayedColAfter,
26118
- navigationService,
26119
- extendLatestRangeInDirection: (e3) => {
26120
- if (isSelectedEmpty.value || !latestRangeStartCell.value) return;
26121
- const t2 = e3.keyCode, n = e3.ctrlKey || e3.metaKey, o = cellRanges.value[cellRanges.value.length - 1], l2 = latestRangeStartCell.value, r2 = o.columns[0], a2 = o.columns[o.columns.length - 1], i2 = o.endRow.rowIndex, s2 = o.endRow.rowPinned, u2 = {
26122
- column: l2.column === r2 ? a2 : r2,
26123
- rowIndex: i2,
26124
- rowPinned: s2
26125
- }, d = navigationService.getNextCellToFocus(t2, u2, n);
26126
- return d ? (fe2({
26127
- rowStartIndex: l2.rowIndex,
26128
- rowEndIndex: d.rowIndex,
26129
- columnStartKey: l2.column.columnKey,
26130
- columnEndKey: d.column.columnKey
26131
- }), d) : void 0;
26132
- },
26133
- allDisplayedColumns,
26134
- focusCell,
26135
- ensureCellVisible,
26136
- getCellRangeCount,
26137
- intersectLastRange,
26138
- level
26139
- });
26140
- const copySelectedRange = () => {
26141
- const e3 = de2(), t2 = [];
26142
- let n = "";
26143
- e3.forEach((e4) => {
26144
- const { startRow: n2, endRow: o, columns: r2 } = e4, [a2, i2] = [n2.rowIndex, o.rowIndex].sort((e5, t3) => e5 - t3);
26145
- let s2 = allDisplayedColumns.value.findIndex((e5) => {
26146
- var _a;
26147
- return e5.columnKey === ((_a = r2[0]) == null ? void 0 : _a.columnKey);
26148
- }), u2 = allDisplayedColumns.value.findIndex(
26149
- (e5) => {
26150
- var _a;
26151
- return e5.columnKey === ((_a = r2[r2.length - 1]) == null ? void 0 : _a.columnKey);
26152
- }
26153
- );
26154
- [s2, u2] = [s2, u2].sort((e5, t3) => e5 - t3);
26155
- const c2 = [];
26156
- for (let e5 = a2; e5 <= i2; e5++) {
26157
- const t3 = flattenData.value[e5];
26158
- if (t3 && !t3.isExpandRow) {
26159
- const n3 = t3.rowKey, o2 = [], l2 = getIndexsByKey(n3);
26160
- for (let r3 = s2; r3 <= u2; r3++) {
26161
- const originColumn = allDisplayedColumns.value[r3].originColumn;
26162
- const i3 = originColumn.dataIndex ? getPathValue(t3.record, originColumn.dataIndex) : void 0;
26163
- if (originColumn) {
26164
- const r4 = {
26165
- record: t3.record,
26166
- column: originColumn,
26167
- index: e5,
26168
- recordIndexs: l2,
26169
- key: n3,
26170
- value: i3
26171
- };
26172
- o2.push(formatRangeCellText(r4));
26173
- }
26174
- }
26175
- c2.push(o2.join(copyDelimiter.value));
26176
- }
26177
- }
26178
- t2.push(c2);
26179
- }), n = t2.map((e4) => e4.join("prefixCls\n")).join("prefixCls\n"), ((e4) => {
26180
- let t3, n2;
26181
- const o = document.activeElement, l2 = document.createElement("textarea");
26182
- l2.style.position = "absolute", l2.style.opacity = "0", l2.style.width = "1px", l2.style.height = "1px", l2.value = e4 || " ", document.body.appendChild(l2), l2.select(), l2.focus({ preventScroll: true }), document.execCommand("copy") || console.warn("Table: copy failed, Browser did not allow document.execCommand('copy')"), document.body.removeChild(l2), null !== o && (null === (n2 = (t3 = o).focus) || void 0 === n2 || n2.call(t3, { preventScroll: true }));
26183
- })(n);
26184
- };
26185
- return {
26186
- getSelectedRange: () => {
26187
- const e3 = de2(), t2 = [];
26188
- return e3.forEach((e4) => {
26189
- const { startColumn: n, startRow: o, endRow: r2, columns: a2 } = e4, i2 = flattenData.value[o.rowIndex], s2 = flattenData.value[r2.rowIndex], u2 = {
26190
- startColumn: n.originColumn,
26191
- startRow: {
26192
- rowIndex: i2.rowIndex,
26193
- recordIndexs: getIndexsByKey(i2.rowKey)
26194
- },
26195
- endRow: {
26196
- rowIndex: s2.rowIndex,
26197
- recordIndexs: getIndexsByKey(s2.rowKey)
26198
- },
26199
- columns: a2.map((e5) => e5.originColumn),
26200
- flattenData: flattenData.value
26201
- };
26202
- t2.push(u2);
26203
- }), t2;
26204
- },
26205
- appendCellToSelectedRange,
26206
- clearAllSelectedRange,
26207
- setCellRanges: (e3) => {
26208
- enableRangeSelection.value && (cellRanges.value = e3);
26209
- },
26210
- getCellRangeCount,
26211
- navigationService,
26212
- copySelectedRange,
26213
- onBodyKeydown: (e3) => {
26214
- if (!e3.ctrlKey && !e3.metaKey || !enableRangeSelection.value) return;
26215
- if (isOverFormFieldElement(e3)) return;
26216
- switch (e3.keyCode) {
26217
- case KeyCode.C:
26218
- copySelectedRange();
26219
- break;
26220
- case KeyCode.A:
26221
- (() => {
26222
- if (!enableRangeSelection.value) return;
26223
- const e4 = allDisplayedColumns.value;
26224
- 0 !== e4.length && fe2({
26225
- rowStartIndex: 0,
26226
- rowEndIndex: flattenData.value.length - 1,
26227
- columnStartKey: e4[0].columnKey,
26228
- columnEndKey: e4[e4.length - 1].columnKey
26229
- });
26230
- })();
26231
- }
26232
- e3.preventDefault();
26233
- }
26234
- };
26235
- };
26236
- const useInjectRangeStore = () => {
26237
- return inject(RangeSymbolKey, {});
26238
- };
26239
-
26240
25666
  var MapShim = (function() {
26241
25667
  if (typeof Map !== "undefined") {
26242
25668
  return Map;
@@ -28680,6 +28106,31 @@ function useData(_props, rowPosition, flattenData, startIndex, endIndex, draggin
28680
28106
  return { data, pos };
28681
28107
  }
28682
28108
 
28109
+ function classNames(...args) {
28110
+ const classes = [];
28111
+ for (let i = 0; i < args.length; i++) {
28112
+ const value = args[i];
28113
+ if (!value) continue;
28114
+ if (isString(value)) {
28115
+ classes.push(value);
28116
+ } else if (isArray(value)) {
28117
+ for (let i2 = 0; i2 < value.length; i2++) {
28118
+ const inner = classNames(value[i2]);
28119
+ if (inner) {
28120
+ classes.push(inner);
28121
+ }
28122
+ }
28123
+ } else if (isObject(value)) {
28124
+ for (const name in value) {
28125
+ if (value[name]) {
28126
+ classes.push(name);
28127
+ }
28128
+ }
28129
+ }
28130
+ }
28131
+ return classes.join(" ");
28132
+ }
28133
+
28683
28134
  const useCellProps = ({
28684
28135
  leftColumns,
28685
28136
  rightColumns,
@@ -28692,6 +28143,10 @@ const useCellProps = ({
28692
28143
  leftWidth,
28693
28144
  centerWidth,
28694
28145
  getRowHeight,
28146
+ cancelEditable,
28147
+ startEditable,
28148
+ saveEditable,
28149
+ isEditable,
28695
28150
  customCell: contextCustomCell
28696
28151
  }) => {
28697
28152
  const allCellProps = shallowRef({});
@@ -28714,6 +28169,10 @@ const useCellProps = ({
28714
28169
  value,
28715
28170
  record,
28716
28171
  index: rowIndex,
28172
+ cancelEditable,
28173
+ startEditable,
28174
+ saveEditable,
28175
+ isEditable,
28717
28176
  column: originColumn
28718
28177
  });
28719
28178
  if (customCellRender && isObject$4(customCellRender) && !isArray$2(customCellRender) && !isVNode(customCellRender)) {
@@ -32191,114 +31650,6 @@ const useInjectBodyRow = () => {
32191
31650
  return inject(BodyRowContextKey, {});
32192
31651
  };
32193
31652
 
32194
- const useCellSelection = () => {
32195
- const {
32196
- isCellInAnyRange,
32197
- cellRanges,
32198
- extendLatestRangeToCell,
32199
- setRangeToCell,
32200
- enableRangeSelection,
32201
- getCellRangeCount,
32202
- intersectLastRange,
32203
- level
32204
- } = useInjectRangeStore();
32205
- return {
32206
- onCellMousedown: (mouseEvent, cellPosition) => {
32207
- const { ctrlKey, metaKey, shiftKey } = mouseEvent;
32208
- if (!(!isCellInAnyRange(cellPosition) || 2 !== mouseEvent.button)) return;
32209
- const isRanges = !cellRanges.value.length;
32210
- if (shiftKey && isRanges) {
32211
- mouseEvent.preventDefault();
32212
- }
32213
- if (shiftKey) {
32214
- extendLatestRangeToCell(cellPosition);
32215
- } else {
32216
- setRangeToCell(cellPosition, ctrlKey || metaKey);
32217
- }
32218
- mouseEvent.cellInfo = {
32219
- cellPosition,
32220
- cellTarget: mouseEvent.currentTarget,
32221
- level
32222
- };
32223
- },
32224
- onCellMousemove: (mouseEvent, cellPosition) => {
32225
- mouseEvent.cellInfo = {
32226
- cellPosition,
32227
- cellTarget: mouseEvent.currentTarget,
32228
- level
32229
- };
32230
- },
32231
- onCellClick: (mouseEvent, cellPosition) => {
32232
- const mouseKey = mouseEvent.ctrlKey || mouseEvent.metaKey;
32233
- enableRangeSelection.value && mouseKey && getCellRangeCount(cellPosition) > 1 && intersectLastRange(true);
32234
- }
32235
- };
32236
- };
32237
-
32238
- const useCellKeyboard = () => {
32239
- const {
32240
- enableRangeSelection,
32241
- navigationService,
32242
- extendLatestRangeInDirection,
32243
- focusCell,
32244
- ensureCellVisible
32245
- } = useInjectRangeStore();
32246
- const directionOrEnterHandle = (event, payload) => {
32247
- if (!payload.isEditing) {
32248
- event.shiftKey && enableRangeSelection.value ? selectRange(event) : navigationService.navigateToNextCell(event, payload.cellPosition);
32249
- event.preventDefault();
32250
- }
32251
- };
32252
- const { props } = useInjectTable();
32253
- const selectRange = (event) => {
32254
- const latestRange = extendLatestRangeInDirection(event);
32255
- latestRange && ensureCellVisible(latestRange);
32256
- };
32257
- const escHandle = (_, payload) => {
32258
- payload.isEditing && focusCell(payload.cellPosition);
32259
- };
32260
- const tabHandle = (event, payload) => {
32261
- navigationService.onTabKeyDown(payload.cellPosition, event);
32262
- };
32263
- return {
32264
- onCellKeydown: (event, payload) => {
32265
- if (props.onCellKeydown && false === props.onCellKeydown(event, {
32266
- isEditing: payload.isEditing,
32267
- cellPosition: {
32268
- column: payload.cellPosition.column.originColumn,
32269
- rowIndex: payload.cellPosition.rowIndex
32270
- }
32271
- })) {
32272
- return;
32273
- }
32274
- const { keyCode } = event;
32275
- const target = event.target;
32276
- switch (keyCode) {
32277
- case KeyCode.RIGHT:
32278
- case KeyCode.LEFT:
32279
- if (!("INPUT" === (target == null ? void 0 : target.tagName) || "TEXTAREA" === (target == null ? void 0 : target.tagName) || (target == null ? void 0 : target.isContentEditable))) {
32280
- directionOrEnterHandle(event, payload);
32281
- }
32282
- break;
32283
- case KeyCode.DOWN:
32284
- case KeyCode.UP:
32285
- case KeyCode.ENTER:
32286
- if (!((target2) => "TEXTAREA" === target2.tagName || target2.isContentEditable)(
32287
- event.target
32288
- )) {
32289
- directionOrEnterHandle(event, payload);
32290
- }
32291
- break;
32292
- case KeyCode.ESC:
32293
- escHandle(event, payload);
32294
- break;
32295
- case KeyCode.TAB:
32296
- tabHandle(event, payload);
32297
- }
32298
- }
32299
- };
32300
- };
32301
-
32302
31653
  const eventCache = {};
32303
31654
  const eventMap = {
32304
31655
  select: "input",
@@ -32315,6 +31666,68 @@ const isEventSupported = (eventName) => {
32315
31666
  return eventCache[eventName = "on" + eventName] = eventName in dom;
32316
31667
  };
32317
31668
 
31669
+ const useAutoScroll = (params) => {
31670
+ const {
31671
+ scrollContainer,
31672
+ scrollAxis,
31673
+ onScrollCallback = () => {
31674
+ },
31675
+ showVerticalScrollbar,
31676
+ showHorizontalScrollbar
31677
+ } = params;
31678
+ let timer = null;
31679
+ let i = 0;
31680
+ let hasLeft = false;
31681
+ let hasRight = false;
31682
+ let hasTop = false;
31683
+ let hasBottom = false;
31684
+ const isXAxis = -1 !== scrollAxis.indexOf("x");
31685
+ const isYAxis = -1 !== scrollAxis.indexOf("y");
31686
+ const scrollByTick = computed(() => {
31687
+ var _a, _b;
31688
+ return (_b = (_a = params.scrollByTick) == null ? void 0 : _a.value) != null ? _b : 20;
31689
+ });
31690
+ const exec = () => {
31691
+ if (null === timer) {
31692
+ timer = window.setInterval(handle, 100);
31693
+ i = 0;
31694
+ }
31695
+ };
31696
+ const handle = () => {
31697
+ i++;
31698
+ const boundary = i > 20 ? 200 : i > 10 ? 80 : 40;
31699
+ if (isYAxis) {
31700
+ const position = params.getVerticalPosition();
31701
+ hasTop && params.setVerticalPosition(position - boundary), hasBottom && params.setVerticalPosition(position + boundary);
31702
+ }
31703
+ if (isXAxis) {
31704
+ const position = params.getHorizontalPosition();
31705
+ hasLeft && params.setHorizontalPosition(position - boundary), hasRight && params.setHorizontalPosition(position + boundary);
31706
+ }
31707
+ onScrollCallback();
31708
+ };
31709
+ const clear = () => {
31710
+ if (timer) {
31711
+ window.clearInterval(timer);
31712
+ timer = null;
31713
+ }
31714
+ };
31715
+ return {
31716
+ check: (mouseEvent, forceSkipVerticalScroll = false) => {
31717
+ const hasVerticalScroll = forceSkipVerticalScroll || !showVerticalScrollbar.value;
31718
+ if (hasVerticalScroll && !showHorizontalScrollbar.value) return;
31719
+ const clientRect = scrollContainer.value.getBoundingClientRect();
31720
+ const tick = scrollByTick.value;
31721
+ hasLeft = mouseEvent.clientX < clientRect.left + tick;
31722
+ hasRight = mouseEvent.clientX > clientRect.right - tick;
31723
+ hasTop = mouseEvent.clientY < clientRect.top + tick && !hasVerticalScroll;
31724
+ hasBottom = mouseEvent.clientY > clientRect.bottom - tick && !hasVerticalScroll;
31725
+ return hasLeft || hasRight || hasTop || hasBottom ? exec() : clear();
31726
+ },
31727
+ ensureCleared: clear
31728
+ };
31729
+ };
31730
+
32318
31731
  var _sfc_main$o = defineComponent({
32319
31732
  name: "RowDragHandler",
32320
31733
  props: {
@@ -32838,188 +32251,6 @@ var BodyCellTooltip = /* @__PURE__ */ defineComponent({
32838
32251
  }
32839
32252
  });
32840
32253
 
32841
- var _sfc_main$n = defineComponent({
32842
- inheritAttrs: false,
32843
- props: {
32844
- prefixCls: { type: String },
32845
- recordIndexs: { type: Array },
32846
- rowKey: { type: [Number, String] },
32847
- column: { type: Object, default: () => ({}) },
32848
- record: { type: Object, default: () => ({}) },
32849
- value: { validator: () => true },
32850
- customEditable: { type: Boolean, default: false },
32851
- multiple: { type: Boolean, default: false },
32852
- autoHeight: { type: Boolean, default: false },
32853
- cellKey: { type: String },
32854
- getPopupContainer: Function,
32855
- onCloseEditor: Function,
32856
- onKeydown: Function
32857
- },
32858
- emits: ["closeEditor", "keydown"],
32859
- setup(props, { expose, emit }) {
32860
- var _a, _b, _c;
32861
- const tableSlots = useInjectSlots();
32862
- const popup = useInjectPopup();
32863
- const oldValue = (_c = (_b = (_a = props.column) == null ? void 0 : _a.valueGetter) == null ? void 0 : _b.call(_a, {
32864
- value: props.value,
32865
- record: props.record,
32866
- column: props.column,
32867
- recordIndexs: props.recordIndexs
32868
- })) != null ? _c : props.value;
32869
- const modelValue = ref(oldValue);
32870
- const inputRef = shallowRef(null);
32871
- const tableContext = useInjectTable();
32872
- onMounted(() => {
32873
- nextTick(() => {
32874
- var _a2, _b2, _c2, _d;
32875
- if (inputRef.value && !props.multiple) {
32876
- (_b2 = (_a2 = inputRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
32877
- (_d = (_c2 = inputRef.value) == null ? void 0 : _c2.select) == null ? void 0 : _d.call(_c2);
32878
- }
32879
- });
32880
- });
32881
- expose({ value: modelValue, inputRef });
32882
- const onInput = (e, val) => {
32883
- var _a2, _b2;
32884
- (_b2 = (_a2 = props.column).valueChange) == null ? void 0 : _b2.call(_a2, e, {
32885
- column: props.column,
32886
- record: props.record,
32887
- recordIndexs: props.recordIndexs,
32888
- newValue: val,
32889
- oldValue
32890
- });
32891
- };
32892
- const childrenColumnName = computed(() => tableContext.props.childrenColumnName || "children");
32893
- const save = () => {
32894
- var _a2, _b2, _c2;
32895
- const recordIndexs = props.recordIndexs;
32896
- let dataSource = tableContext.props.dataSource || [];
32897
- let record = {};
32898
- recordIndexs.forEach((index) => {
32899
- record = dataSource[index];
32900
- dataSource = record[childrenColumnName.value] || [];
32901
- });
32902
- const value = (_c2 = (_b2 = (_a2 = props.column).valueParser) == null ? void 0 : _b2.call(_a2, {
32903
- column: props.column,
32904
- record,
32905
- recordIndexs,
32906
- newValue: modelValue.value,
32907
- oldValue
32908
- })) != null ? _c2 : modelValue.value;
32909
- const valueSetter = props.column.valueSetter;
32910
- if (valueSetter) {
32911
- const result = valueSetter({
32912
- column: props.column,
32913
- record,
32914
- recordIndexs,
32915
- newValue: modelValue.value,
32916
- oldValue
32917
- });
32918
- if (isPromise(result)) {
32919
- result.then((res) => {
32920
- res && emit("closeEditor", [props.cellKey]);
32921
- }).catch(() => {
32922
- });
32923
- return;
32924
- }
32925
- result && emit("closeEditor", [props.cellKey]);
32926
- } else {
32927
- devWarning(
32928
- void 0 !== props.column.dataIndex || null !== props.column.dataIndex,
32929
- "Editable",
32930
- "If not have column dataIndex, you should to set valueSetter for editable columns, otherwise the value cannot be modified."
32931
- );
32932
- set(record, props.column.dataIndex, value);
32933
- emit("closeEditor", [props.cellKey]);
32934
- }
32935
- };
32936
- let isKeyDown = false;
32937
- const closeEditor = (key) => {
32938
- emit("closeEditor", key != null ? key : [props.cellKey]);
32939
- };
32940
- return {
32941
- modelValue,
32942
- inputRef,
32943
- handleInput: (e) => {
32944
- var _a2;
32945
- onInput(e, (_a2 = e.target) == null ? void 0 : _a2.value);
32946
- },
32947
- handleKeyDown: (e) => {
32948
- const { which } = e;
32949
- if (which === KeyCode.ENTER) {
32950
- save();
32951
- } else {
32952
- if (which === KeyCode.ESC) {
32953
- isKeyDown = true;
32954
- emit("closeEditor", null);
32955
- }
32956
- emit("keydown", e);
32957
- }
32958
- },
32959
- handleBlur: () => {
32960
- isKeyDown || props.multiple || save();
32961
- },
32962
- tableSlots,
32963
- popup,
32964
- save,
32965
- closeEditor,
32966
- getCustomEditorProps: () => ({
32967
- modelValue,
32968
- save,
32969
- onInput,
32970
- closeEditor,
32971
- column: props.column.originColumn,
32972
- editorRef: inputRef,
32973
- getPopupContainer: props.getPopupContainer,
32974
- record: props.record,
32975
- recordIndexs: props.recordIndexs
32976
- })
32977
- };
32978
- }
32979
- });
32980
-
32981
- const _hoisted_1$8 = ["data-cell-auto"];
32982
- function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
32983
- return openBlock(), createElementBlock("div", {
32984
- class: normalizeClass(`${_ctx.prefixCls}-cell-edit-inner`),
32985
- "data-cell-auto": _ctx.autoHeight
32986
- }, [
32987
- _ctx.customEditable ? (openBlock(), createElementBlock(
32988
- Fragment,
32989
- { key: 0 },
32990
- [
32991
- _ctx.tableSlots.cellEditor ? (openBlock(), createBlock(
32992
- resolveDynamicComponent(_ctx.tableSlots.cellEditor),
32993
- normalizeProps(mergeProps({ key: 0 }, _ctx.getCustomEditorProps())),
32994
- null,
32995
- 16
32996
- /* FULL_PROPS */
32997
- )) : createCommentVNode("v-if", true)
32998
- ],
32999
- 64
33000
- /* STABLE_FRAGMENT */
33001
- )) : withDirectives((openBlock(), createElementBlock(
33002
- "input",
33003
- {
33004
- key: 1,
33005
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
33006
- ref: "inputRef",
33007
- class: normalizeClass(`${_ctx.prefixCls}-cell-edit-input`),
33008
- type: "text",
33009
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleInput && _ctx.handleInput(...args)),
33010
- onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
33011
- onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args))
33012
- },
33013
- null,
33014
- 34
33015
- /* CLASS, NEED_HYDRATION */
33016
- )), [
33017
- [vModelText, _ctx.modelValue]
33018
- ])
33019
- ], 10, _hoisted_1$8);
33020
- }
33021
- var EditInput = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$j]]);
33022
-
33023
32254
  const cellProps = {
33024
32255
  prefixCls: String,
33025
32256
  rowIndex: { type: Number, required: true },
@@ -33036,41 +32267,30 @@ const cellProps = {
33036
32267
  tooltipOpen: Boolean,
33037
32268
  getPopupContainer: Function,
33038
32269
  onCellLeave: Function,
33039
- editCellKeys: Array,
33040
- onOpenEditor: Function,
33041
- onCloseEditor: Function,
33042
- onMousedown: Function,
33043
- onMousemove: Function,
33044
- onKeydown: Function,
33045
32270
  onClick: Function
33046
32271
  };
33047
32272
  let lastClickTime = 0;
32273
+ const hasSupportedDblclick = () => {
32274
+ if (!isIOSUserAgent() || isEventSupported("dblclick")) return false;
32275
+ const now = (/* @__PURE__ */ new Date()).getTime();
32276
+ const is = now - lastClickTime < 200;
32277
+ lastClickTime = now;
32278
+ return is;
32279
+ };
33048
32280
  const ValueStatusEnum = {
33049
32281
  success: "#03bf64",
33050
32282
  processing: "#315efb",
33051
32283
  error: "#e8353e",
33052
32284
  warning: "#eb8903"
33053
32285
  };
33054
- const BodyCell = (props, { slots, emit }) => {
32286
+ const BodyCell$1 = (props, { slots, emit }) => {
33055
32287
  var _a, _b, _c, _d, _e, _f, _g, _h;
33056
32288
  const { table } = useProConfigInject();
33057
32289
  const tableSlotsContext = useInjectSlots();
33058
32290
  const tableContext = useInjectTable();
33059
32291
  const { onBodyCellContextmenu } = useInjectBody();
33060
- const { getRangeCellClass } = useInjectRangeStore();
33061
32292
  const level = useInjectLevel();
33062
- const { oldValuesMap } = useEditInject();
33063
- const {
33064
- prefixCls,
33065
- column,
33066
- wrapText,
33067
- rowKey,
33068
- item,
33069
- rowIndex,
33070
- hasAppendNode,
33071
- tooltipOpen,
33072
- editCellKeys
33073
- } = props;
32293
+ const { prefixCls, column, wrapText, rowKey, item, rowIndex, hasAppendNode, tooltipOpen } = props;
33074
32294
  const columnKey = column.columnKey;
33075
32295
  const valueEnum = runFunction(column == null ? void 0 : column.valueEnum, props.item);
33076
32296
  const rowDrag = typeof column.rowDrag == "function" ? column.rowDrag({ record: item, column: column.originColumn }) : !!column.rowDrag;
@@ -33080,22 +32300,8 @@ const BodyCell = (props, { slots, emit }) => {
33080
32300
  const sorterInfo = { sorterOrder };
33081
32301
  const key = `${props.rowKey} ${columnKey}`;
33082
32302
  const value = column.dataIndex ? column.renderText ? column.renderText(get(item, column.dataIndex), item, rowIndex) : get(item, column.dataIndex) : void 0;
33083
- const valueStatus = runFunction(column == null ? void 0 : column.valueStatus, value, props.item);
32303
+ const valueStatus = runFunction(column == null ? void 0 : column.valueStatus, value, props.item, valueEnum == null ? void 0 : valueEnum[value]);
33084
32304
  const recordIndexs = tableContext.getIndexsByKey(rowKey);
33085
- let customEditable = false;
33086
- let isEditing = editCellKeys == null ? void 0 : editCellKeys.includes(key);
33087
- if (isEditing) {
33088
- const editable = "function" == typeof column.editable && column.editable({
33089
- record: item,
33090
- column: column.originColumn,
33091
- recordIndexs,
33092
- value
33093
- });
33094
- customEditable = "cellEditorSlot" === column.editable || "cellEditorSlot" === editable;
33095
- isEditing = isEditing && (customEditable && !!tableSlotsContext.cellEditor || true === column.editable || !!editable);
33096
- }
33097
- let { editableTrigger = ["dblClick"] } = column;
33098
- editableTrigger = Array.isArray(editableTrigger) ? editableTrigger : [editableTrigger];
33099
32305
  const cellInnerClass = { [`${prefixCls}-cell-inner`]: true };
33100
32306
  const cellContentClass = {
33101
32307
  [`${prefixCls}-cell-content`]: true,
@@ -33116,7 +32322,6 @@ const BodyCell = (props, { slots, emit }) => {
33116
32322
  const cellRender = ((_b = (_a = tableContext.allCellProps.value) == null ? void 0 : _a[rowKey]) == null ? void 0 : _b[column.columnKey]) || {};
33117
32323
  const cellProps2 = cellRender.props || {};
33118
32324
  const cellRowSpan = cellProps2.rowSpan;
33119
- const cellPosition = { rowIndex: props.flattenRowIndex, rowPinned: null, column };
33120
32325
  const cellClass = {
33121
32326
  [`${prefixCls}-cell`]: true,
33122
32327
  [`${prefixCls}-first-cell`]: column.columnIndex === 0,
@@ -33124,60 +32329,7 @@ const BodyCell = (props, { slots, emit }) => {
33124
32329
  [`${prefixCls}-cell-multi`]: cellRowSpan > 1,
33125
32330
  [`${prefixCls}-cell-hidden`]: cellRowSpan === 0,
33126
32331
  [`${prefixCls}-column-sort`]: sorterInfo.sorterOrder,
33127
- [`${prefixCls}-with-append`]: hasAppendNode,
33128
- [`${prefixCls}-cell-inline-edit`]: isEditing,
33129
- [getRangeCellClass(cellPosition)]: true
33130
- };
33131
- const openEditor = () => {
33132
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
33133
- const oldValue = (_c2 = (_b2 = (_a2 = props.column) == null ? void 0 : _a2.valueGetter) == null ? void 0 : _b2.call(_a2, {
33134
- value,
33135
- record: item,
33136
- column,
33137
- recordIndexs
33138
- })) != null ? _c2 : value;
33139
- const beforeOpen = (_e2 = (_d2 = tableContext.props) == null ? void 0 : _d2.onBeforeOpenEditor) == null ? void 0 : _e2.call(_d2, cellRenderArgs);
33140
- if (isPromise(beforeOpen)) {
33141
- beforeOpen.then((res) => {
33142
- var _a3, _b3;
33143
- if (res) {
33144
- emit("openEditor", key, { [key]: oldValue });
33145
- (_b3 = (_a3 = tableContext.props) == null ? void 0 : _a3.onOpenEditor) == null ? void 0 : _b3.call(_a3, cellRenderArgs);
33146
- }
33147
- });
33148
- } else {
33149
- if (false !== beforeOpen) {
33150
- emit("openEditor", key, { [key]: oldValue });
33151
- (_g2 = (_f2 = tableContext.props) == null ? void 0 : _f2.onOpenEditor) == null ? void 0 : _g2.call(_f2, cellRenderArgs);
33152
- }
33153
- }
33154
- };
33155
- const closeEditor = (currentKey) => {
33156
- var _a2, _b2, _c2, _d2;
33157
- const beforeClose = (_b2 = (_a2 = tableContext.props) == null ? void 0 : _a2.onBeforeCloseEditor) == null ? void 0 : _b2.call(_a2, {
33158
- ...cellRenderArgs,
33159
- oldValue: oldValuesMap.value[key]
33160
- });
33161
- if (isPromise(beforeClose)) {
33162
- beforeClose.then((res) => {
33163
- var _a3, _b3;
33164
- if (res) {
33165
- emit("closeEditor", currentKey != null ? currentKey : key);
33166
- (_b3 = (_a3 = tableContext.props) == null ? void 0 : _a3.onCloseEditor) == null ? void 0 : _b3.call(_a3, {
33167
- ...cellRenderArgs,
33168
- oldValue: oldValuesMap.value[key]
33169
- });
33170
- }
33171
- });
33172
- } else {
33173
- if (false !== beforeClose) {
33174
- emit("closeEditor", currentKey != null ? currentKey : key);
33175
- (_d2 = (_c2 = tableContext.props) == null ? void 0 : _c2.onCloseEditor) == null ? void 0 : _d2.call(_c2, {
33176
- ...cellRenderArgs,
33177
- oldValue: oldValuesMap.value[key]
33178
- });
33179
- }
33180
- }
32332
+ [`${prefixCls}-with-append`]: hasAppendNode
33181
32333
  };
33182
32334
  const cellRenderArgs = {
33183
32335
  record: item,
@@ -33188,8 +32340,10 @@ const BodyCell = (props, { slots, emit }) => {
33188
32340
  recordIndexs: tableContext.getIndexsByKey(rowKey),
33189
32341
  key,
33190
32342
  valueStatus,
33191
- openEditor,
33192
- closeEditor
32343
+ cancelEditable: tableContext.cancelEditable,
32344
+ startEditable: tableContext.startEditable,
32345
+ saveEditable: tableContext.saveEditable,
32346
+ isEditable: tableContext.isEditable
33193
32347
  };
33194
32348
  let bodyCell = recordIndexs && ((_c = tableSlotsContext.bodyCell) == null ? void 0 : _c.call(tableSlotsContext, cellRenderArgs)) || [];
33195
32349
  const emptyText = tableContext.props.columnEmptyText !== false ? (_f = (_e = tableContext.props.columnEmptyText) != null ? _e : (_d = table == null ? void 0 : table.value) == null ? void 0 : _d.columnEmptyText) != null ? _f : "-" : "";
@@ -33308,27 +32462,6 @@ const BodyCell = (props, { slots, emit }) => {
33308
32462
  } else {
33309
32463
  renderCellVNode = cellVNode;
33310
32464
  }
33311
- const onDblclick = () => {
33312
- editableTrigger.includes("dblClick") && openEditor();
33313
- };
33314
- const editInputRender = isEditing ? createVNode(
33315
- EditInput,
33316
- {
33317
- prefixCls,
33318
- recordIndexs,
33319
- rowKey,
33320
- cellKey: key,
33321
- column,
33322
- record: item,
33323
- onCloseEditor: closeEditor,
33324
- value,
33325
- customEditable,
33326
- getPopupContainer: props.getPopupContainer,
33327
- multiple: editCellKeys.length > 1,
33328
- autoHeight
33329
- },
33330
- null
33331
- ) : null;
33332
32465
  return createVNode(
33333
32466
  "div",
33334
32467
  mergeProps(cellProps2, {
@@ -33340,39 +32473,25 @@ const BodyCell = (props, { slots, emit }) => {
33340
32473
  "data-column-key": columnKey,
33341
32474
  class: cellClass,
33342
32475
  onContextmenu: (e) => {
33343
- if ((tableContext.props.hasContextmenuPopup || tableContext.props.rangeSelection) && 0 === e.button && e.ctrlKey) {
32476
+ if (tableContext.props.hasContextmenuPopup && 0 === e.button && e.ctrlKey) {
33344
32477
  e.preventDefault();
33345
32478
  } else {
33346
32479
  onBodyCellContextmenu(e, cellRenderArgs, props.type);
33347
- editableTrigger.includes("contextmenu") && openEditor();
32480
+ emit("contextmenu", e);
33348
32481
  }
33349
32482
  },
33350
- onDblclick,
32483
+ onDblclick: (e) => {
32484
+ emit("dblClick", e);
32485
+ },
33351
32486
  onClick: (e) => {
33352
32487
  var _a2, _b2;
33353
32488
  (_b2 = (_a2 = tableContext.props) == null ? void 0 : _a2.onCellClick) == null ? void 0 : _b2.call(_a2, e, cellRenderArgs);
33354
- if ((() => {
33355
- if (!isIOSUserAgent() || isEventSupported("dblclick")) return false;
33356
- const now = (/* @__PURE__ */ new Date()).getTime();
33357
- const is = now - lastClickTime < 200;
33358
- lastClickTime = now;
33359
- return is;
33360
- })()) {
33361
- onDblclick();
32489
+ if (hasSupportedDblclick()) {
32490
+ emit("dblclick", e);
33362
32491
  e.preventDefault();
33363
32492
  return;
33364
32493
  }
33365
- emit("click", e, cellPosition);
33366
- editableTrigger.includes("click") && openEditor();
33367
- },
33368
- onMousedown: (e) => {
33369
- emit("mousedown", e, cellPosition);
33370
- },
33371
- onMousemove: (e) => {
33372
- emit("mousemove", e, cellPosition);
33373
- },
33374
- onKeydown: (e) => {
33375
- emit("keydown", e, { cellPosition, isEditing });
32494
+ emit("click", e);
33376
32495
  },
33377
32496
  "data-level": level,
33378
32497
  "aria-selected": "true"
@@ -33387,26 +32506,497 @@ const BodyCell = (props, { slots, emit }) => {
33387
32506
  },
33388
32507
  { label: () => bodyCell }
33389
32508
  ) : null,
33390
- renderCellVNode,
33391
- autoHeight && editInputRender ? createVNode(
33392
- "label",
33393
- {
33394
- class: `${prefixCls}-cell-edit-wrapper`,
33395
- onMousedown: (e) => e.stopPropagation()
33396
- },
33397
- [withDirectives(editInputRender, [[cellResize, cellResizeValue]])]
33398
- ) : editInputRender ? createVNode(
33399
- "label",
33400
- {
33401
- class: `${prefixCls}-cell-edit-wrapper`,
33402
- onMousedown: (e) => e.stopPropagation()
33403
- },
33404
- [editInputRender]
33405
- ) : null
32509
+ renderCellVNode
33406
32510
  ]
33407
32511
  );
33408
32512
  };
33409
- BodyCell.props = cellProps;
32513
+ BodyCell$1.props = cellProps;
32514
+
32515
+ function getCharacterLength(str, maxCharacter) {
32516
+ const hasMaxCharacter = isNumber$2(maxCharacter);
32517
+ if (!str || str.length === 0) {
32518
+ if (hasMaxCharacter) {
32519
+ return {
32520
+ length: 0,
32521
+ characters: str
32522
+ };
32523
+ }
32524
+ return 0;
32525
+ }
32526
+ let len = 0;
32527
+ for (let i = 0; i < str.length; i++) {
32528
+ let currentStringLength = 0;
32529
+ if (str.charCodeAt(i) > 127) {
32530
+ currentStringLength = 2;
32531
+ } else {
32532
+ currentStringLength = 1;
32533
+ }
32534
+ if (hasMaxCharacter && len + currentStringLength > maxCharacter) {
32535
+ return {
32536
+ length: len,
32537
+ characters: str.slice(0, i)
32538
+ };
32539
+ }
32540
+ len += currentStringLength;
32541
+ }
32542
+ if (hasMaxCharacter) {
32543
+ return {
32544
+ length: len,
32545
+ characters: str
32546
+ };
32547
+ }
32548
+ return len;
32549
+ }
32550
+ function isValueEmpty(val) {
32551
+ const type = Object.prototype.toString.call(val);
32552
+ const typeMap = {
32553
+ Date: "[object Date]"
32554
+ };
32555
+ if (type === typeMap.Date) {
32556
+ return false;
32557
+ }
32558
+ return isObject$4(val) ? isEmpty(val) : ["", void 0, null].includes(val);
32559
+ }
32560
+ const VALIDATE_MAP = {
32561
+ required: (val) => !isValueEmpty(val),
32562
+ whitespace: (val) => !(/^\s+$/.test(val) || val === ""),
32563
+ boolean: (val) => isBoolean(val),
32564
+ max: (val, num) => isNumber$2(val) ? val <= num : getCharacterLength(val) <= num,
32565
+ min: (val, num) => isNumber$2(val) ? val >= num : getCharacterLength(val) >= num,
32566
+ len: (val, num) => getCharacterLength(String(val)) === num,
32567
+ number: (val) => isNumber$2(val),
32568
+ enum: (val, strs) => strs.includes(val),
32569
+ idcard: (val) => /^(\d{18,18}|\d{15,15}|\d{17,17}x)$/i.test(val),
32570
+ telnumber: (val) => /^1[3-9]\d{9}$/.test(val),
32571
+ pattern: (val, regexp) => regexp.test(val),
32572
+ // 自定义校验规则,可能是异步校验
32573
+ validator: (val, validate2) => validate2(val)
32574
+ };
32575
+ async function validateOneRule(value, rule) {
32576
+ let validateResult = { result: true };
32577
+ const keys = Object.keys(rule);
32578
+ let vOptions;
32579
+ let vValidateFun;
32580
+ for (let i = 0; i < keys.length; i++) {
32581
+ const key = keys[i];
32582
+ if (!rule.required && isValueEmpty(value) && !rule.validator) {
32583
+ return validateResult;
32584
+ }
32585
+ const validateRule = VALIDATE_MAP[key];
32586
+ if (validateRule && (rule[key] || rule[key] === 0)) {
32587
+ vOptions = rule[key] === true ? void 0 : rule[key];
32588
+ vValidateFun = validateRule;
32589
+ break;
32590
+ }
32591
+ }
32592
+ if (vValidateFun) {
32593
+ validateResult = await vValidateFun(value, vOptions);
32594
+ if (isBoolean(validateResult)) {
32595
+ return { ...rule, result: validateResult };
32596
+ }
32597
+ if (isObject$4(validateResult)) {
32598
+ return validateResult;
32599
+ }
32600
+ }
32601
+ return validateResult;
32602
+ }
32603
+ async function validate(value, rules) {
32604
+ const all = rules.map((rule) => validateOneRule(value, rule));
32605
+ const r = await Promise.all(all);
32606
+ return r;
32607
+ }
32608
+
32609
+ var BodyEditCell = /* @__PURE__ */ defineComponent({
32610
+ inheritAttrs: false,
32611
+ props: {
32612
+ prefixCls: String,
32613
+ rowIndex: {
32614
+ type: Number,
32615
+ required: true
32616
+ },
32617
+ flattenRowIndex: {
32618
+ type: Number,
32619
+ required: true
32620
+ },
32621
+ rowKey: {
32622
+ type: [Number, String]
32623
+ },
32624
+ column: {
32625
+ type: Object,
32626
+ default: () => ({})
32627
+ },
32628
+ item: {
32629
+ type: Object,
32630
+ default: () => ({})
32631
+ },
32632
+ isRowEdit: Boolean,
32633
+ editRow: {
32634
+ type: Object
32635
+ }
32636
+ },
32637
+ emits: ["closeEditor", "keydown"],
32638
+ setup(props) {
32639
+ const tableContext = useInjectTable();
32640
+ const level = useInjectLevel();
32641
+ const columnKey = computed(() => props.column.columnKey);
32642
+ const recordIndexs = computed(() => tableContext.getIndexsByKey(props.rowKey));
32643
+ const childrenColumnName = computed(() => tableContext.props.childrenColumnName || "children");
32644
+ const errorList = ref();
32645
+ const {
32646
+ editRowsMap,
32647
+ setEditingCell
32648
+ } = useEditInject();
32649
+ const cellValue = computed(() => props.column.dataIndex ? get(!props.isRowEdit ? props.item : props.editRow, props.column.dataIndex) : void 0);
32650
+ const cellRender = computed(() => {
32651
+ var _a, _b;
32652
+ return ((_b = (_a = tableContext.allCellProps.value) == null ? void 0 : _a[props.rowKey]) == null ? void 0 : _b[props.column.columnKey]) || {};
32653
+ });
32654
+ const cellProps = computed(() => cellRender.value.props || {});
32655
+ const cellRowSpan = computed(() => cellProps.value.rowSpan);
32656
+ const sorterState = computed(() => tableContext.sorterStates.value.find(({
32657
+ key
32658
+ }) => key === columnKey.value));
32659
+ const sorterOrder = computed(() => {
32660
+ var _a;
32661
+ return sorterState.value ? (_a = sorterState.value) == null ? void 0 : _a.sortOrder : null;
32662
+ });
32663
+ const cellClass = computed(() => ({
32664
+ [`${props.prefixCls}-cell`]: true,
32665
+ [`${props.prefixCls}-first-cell`]: props.column.columnIndex === 0,
32666
+ [`${props.prefixCls}-body-cell`]: true,
32667
+ [`${props.prefixCls}-cell-multi`]: cellRowSpan.value > 1,
32668
+ [`${props.prefixCls}-cell-hidden`]: cellRowSpan.value === 0,
32669
+ [`${props.prefixCls}-column-sort`]: sorterOrder.value
32670
+ }));
32671
+ const rules = computed(() => {
32672
+ var _a, _b;
32673
+ return (_b = runFunction((_a = props.column.edit) == null ? void 0 : _a.rules, {
32674
+ column: props.column,
32675
+ record: props.isRowEdit ? props.editRow : props.item,
32676
+ recordIndexs: recordIndexs.value,
32677
+ newValue: cellValue.value
32678
+ })) != null ? _b : [];
32679
+ });
32680
+ const validateEnabled = computed(() => rules.value.length > 0);
32681
+ const editValue = ref();
32682
+ const cellParams = computed(() => ({
32683
+ column: props.column,
32684
+ record: !props.isRowEdit ? props.item : props.editRow,
32685
+ recordIndexs: recordIndexs.value,
32686
+ value: editValue.value
32687
+ }));
32688
+ const editOnListeners = computed(() => {
32689
+ var _a, _b;
32690
+ return ((_b = (_a = props.column.edit) == null ? void 0 : _a.on) == null ? void 0 : _b.call(_a, {
32691
+ ...cellParams.value
32692
+ })) || {};
32693
+ });
32694
+ const editProps = computed(() => {
32695
+ const {
32696
+ edit = {}
32697
+ } = props.column;
32698
+ return isFunction$2(edit.props) ? edit.props(cellParams.value) : {
32699
+ ...edit.props
32700
+ };
32701
+ });
32702
+ const componentProps = computed(() => {
32703
+ var _a;
32704
+ const {
32705
+ edit
32706
+ } = props.column;
32707
+ if (!edit) return {};
32708
+ const tmpProps = {
32709
+ ...editProps.value
32710
+ };
32711
+ delete tmpProps.onChange;
32712
+ delete tmpProps.value;
32713
+ (_a = edit.abortEditOnEvent) == null ? void 0 : _a.forEach((item) => {
32714
+ delete tmpProps[item];
32715
+ });
32716
+ return tmpProps;
32717
+ });
32718
+ const validateEdit = () => {
32719
+ return new Promise((resolve) => {
32720
+ if (!validateEnabled.value) {
32721
+ resolve(true);
32722
+ return true;
32723
+ }
32724
+ validate(editValue.value, rules.value).then((result) => {
32725
+ const list = result == null ? void 0 : result.filter((t) => !t.result);
32726
+ if (!list || !list.length) {
32727
+ errorList.value = [];
32728
+ resolve(true);
32729
+ } else {
32730
+ errorList.value = list;
32731
+ resolve(list);
32732
+ }
32733
+ });
32734
+ });
32735
+ };
32736
+ const onEditChange = (val, ...args) => {
32737
+ var _a, _b, _c, _d, _e, _f, _g, _h;
32738
+ const params = {
32739
+ column: props.column,
32740
+ record: props.isRowEdit ? props.editRow : props.item,
32741
+ recordIndexs: recordIndexs.value,
32742
+ newValue: cellValue.value
32743
+ };
32744
+ const value = (_c = (_b = (_a = props.column.edit) == null ? void 0 : _a.valueParser) == null ? void 0 : _b.call(_a, params)) != null ? _c : editValue.value;
32745
+ const valueSetter = (_d = props.column.edit) == null ? void 0 : _d.valueSetter;
32746
+ if (valueSetter) {
32747
+ valueSetter(params);
32748
+ } else {
32749
+ (_f = (_e = editProps.value) == null ? void 0 : _e.onChange) == null ? void 0 : _f.call(_e, val, ...args);
32750
+ (_h = (_g = editOnListeners.value) == null ? void 0 : _g.onChange) == null ? void 0 : _h.call(_g, params);
32751
+ if (props.isRowEdit) {
32752
+ const record = {
32753
+ ...props.editRow
32754
+ };
32755
+ set(record, props.column.dataIndex, value);
32756
+ editRowsMap.value[props.rowKey] = record;
32757
+ triggerRef(editRowsMap);
32758
+ } else {
32759
+ let record = {};
32760
+ let dataSource = tableContext.rawData.value || [];
32761
+ recordIndexs.value.forEach((index) => {
32762
+ record = dataSource[index];
32763
+ dataSource = record[childrenColumnName.value] || [];
32764
+ });
32765
+ set(record, props.column.dataIndex, value);
32766
+ triggerRef(tableContext.rawData);
32767
+ }
32768
+ }
32769
+ validateEdit();
32770
+ };
32771
+ watch(cellValue, (value) => {
32772
+ var _a, _b, _c;
32773
+ editValue.value = (_c = (_b = (_a = props.column.edit) == null ? void 0 : _a.valueGetter) == null ? void 0 : _b.call(_a, cellParams.value)) != null ? _c : value;
32774
+ }, {
32775
+ immediate: true
32776
+ });
32777
+ onMounted(() => {
32778
+ setEditingCell({
32779
+ recordIndexs: recordIndexs.value,
32780
+ column: props.column,
32781
+ rowKey: props.rowKey,
32782
+ originRecord: props.item,
32783
+ rowIndex: props.rowIndex,
32784
+ columnKey: props.column.columnKey,
32785
+ validateEdit
32786
+ }, true);
32787
+ });
32788
+ onUnmounted(() => {
32789
+ var _a, _b, _c;
32790
+ setEditingCell({
32791
+ recordIndexs: recordIndexs.value,
32792
+ column: props.column,
32793
+ rowKey: props.rowKey,
32794
+ originRecord: props.item,
32795
+ rowIndex: props.rowIndex,
32796
+ columnKey: props.column.columnKey,
32797
+ validateEdit
32798
+ }, false);
32799
+ (_c = (_b = (_a = props.column) == null ? void 0 : _a.edit) == null ? void 0 : _b.onEdited) == null ? void 0 : _c.call(_b, {
32800
+ column: props.column,
32801
+ record: props.isRowEdit ? props.editRow : props.item,
32802
+ recordIndexs: recordIndexs.value,
32803
+ value: cellValue.value
32804
+ });
32805
+ });
32806
+ return () => {
32807
+ var _a, _b, _c;
32808
+ const Component = (_a = props.column.edit) == null ? void 0 : _a.component;
32809
+ const errorMessage = (_c = (_b = errorList.value) == null ? void 0 : _b[0]) == null ? void 0 : _c.message;
32810
+ return createVNode("div", mergeProps(cellProps.value, {
32811
+ "class": cellClass.value,
32812
+ "tabindex": "-1",
32813
+ "role": "cell",
32814
+ "data-column-key": columnKey.value,
32815
+ "data-level": level,
32816
+ "aria-selected": "true",
32817
+ "onClick": (e) => {
32818
+ e.stopPropagation();
32819
+ }
32820
+ }), [createVNode("div", {
32821
+ "class": `${props.prefixCls}-cell-content`,
32822
+ "style": "width: 100%; position:relative"
32823
+ }, [createVNode(Component, mergeProps({
32824
+ "style": "width: 100%",
32825
+ "status": errorMessage ? "error" : void 0,
32826
+ "value": editValue.value,
32827
+ "onUpdate:value": ($event) => editValue.value = $event,
32828
+ "getPopupContainer": () => document.body
32829
+ }, componentProps.value, {
32830
+ "onChange": onEditChange
32831
+ }), null), errorMessage && createVNode(Popover, {
32832
+ "arrowPointAtCenter": true,
32833
+ "placement": "topRight",
32834
+ "getPopupContainer": () => document.body
32835
+ }, {
32836
+ default: () => [createVNode("span", {
32837
+ "class": `${props.prefixCls}-cell-content-error`
32838
+ }, [createVNode(CloseCircleFilled, null, null)])],
32839
+ content: () => {
32840
+ var _a2;
32841
+ return createVNode("div", {
32842
+ "class": `${props.prefixCls}-cell-content-error-message`
32843
+ }, [(_a2 = errorList.value) == null ? void 0 : _a2.map((error) => createVNode("div", {
32844
+ "key": error.message
32845
+ }, [error.message]))]);
32846
+ }
32847
+ })])]);
32848
+ };
32849
+ }
32850
+ });
32851
+
32852
+ var _sfc_main$n = defineComponent({
32853
+ inheritAttrs: false,
32854
+ props: {
32855
+ prefixCls: String,
32856
+ rowIndex: { type: Number, required: true },
32857
+ flattenRowIndex: { type: Number, required: true },
32858
+ rowKey: { type: [Number, String] },
32859
+ column: { type: Object, default: () => ({}) },
32860
+ item: { type: Object, default: () => ({}) },
32861
+ wrapText: { type: Boolean, default: false },
32862
+ type: { type: String },
32863
+ height: Number,
32864
+ hasAppendNode: Boolean,
32865
+ resizeObserver: { type: Object },
32866
+ editRow: { type: Object },
32867
+ calMaxHeight: Function,
32868
+ editCellKeys: Array,
32869
+ editableKeys: Array,
32870
+ isRowEdit: Boolean,
32871
+ tooltipOpen: Boolean,
32872
+ getPopupContainer: Function,
32873
+ onOpenEditor: Function,
32874
+ onCloseEditor: Function,
32875
+ onCellLeave: Function,
32876
+ onMouseenter: Function
32877
+ },
32878
+ emits: ["mouseenter", "cellLeave"],
32879
+ components: { BodyTextCell: BodyCell$1, BodyEditCell },
32880
+ setup(props) {
32881
+ const tableContext = useInjectTable();
32882
+ const isKeepEditMode = computed(() => {
32883
+ var _a;
32884
+ return (_a = props.column.edit) == null ? void 0 : _a.keepEditMode;
32885
+ });
32886
+ const cellValue = computed(
32887
+ () => props.column.dataIndex ? get(props.item, props.column.dataIndex) : void 0
32888
+ );
32889
+ const key = computed(() => getCellKey(props.rowKey, props.column.columnKey));
32890
+ const cellParams = computed(() => ({
32891
+ column: props.column,
32892
+ record: props.isRowEdit ? props.editRow : props.item,
32893
+ recordIndexs: tableContext.getIndexsByKey(props.rowKey),
32894
+ value: cellValue.value
32895
+ }));
32896
+ const editable = computed(() => {
32897
+ var _a, _b, _c, _d;
32898
+ if (!((_a = props.column.edit) == null ? void 0 : _a.component)) {
32899
+ return false;
32900
+ }
32901
+ if (props.isRowEdit && !((_b = props.editableKeys) == null ? void 0 : _b.includes(props.rowKey))) {
32902
+ return false;
32903
+ }
32904
+ if (!((_c = props.column.edit) == null ? void 0 : _c.editable)) {
32905
+ return true;
32906
+ }
32907
+ const cellEditable = (_d = props.column.edit) == null ? void 0 : _d.editable(cellParams.value);
32908
+ return cellEditable;
32909
+ });
32910
+ const isEditing = computed(() => {
32911
+ var _a, _b;
32912
+ if (props.isRowEdit) {
32913
+ return editable.value && ((_a = props.editableKeys) == null ? void 0 : _a.includes(props.rowKey));
32914
+ }
32915
+ if (!editable.value) {
32916
+ return false;
32917
+ }
32918
+ if (isKeepEditMode.value) {
32919
+ return true;
32920
+ }
32921
+ if ((_b = props.editCellKeys) == null ? void 0 : _b.includes(key.value)) {
32922
+ return true;
32923
+ }
32924
+ return false;
32925
+ });
32926
+ const editableTrigger = computed(() => {
32927
+ var _a;
32928
+ let { editableTrigger: editableTrigger2 = ["click"] } = (_a = props.column.edit) != null ? _a : {};
32929
+ editableTrigger2 = Array.isArray(editableTrigger2) ? editableTrigger2 : [editableTrigger2];
32930
+ return editableTrigger2;
32931
+ });
32932
+ const onCellEvent = (e, trigger) => {
32933
+ var _a;
32934
+ if (editable.value && ((_a = editableTrigger.value) == null ? void 0 : _a.includes(trigger)) && !props.isRowEdit) {
32935
+ openEditor();
32936
+ closeEditor();
32937
+ e.stopPropagation();
32938
+ e.preventDefault();
32939
+ }
32940
+ };
32941
+ const openEditor = () => {
32942
+ var _a, _b, _c, _d;
32943
+ const oldValue = (_c = (_b = (_a = props.column.edit) == null ? void 0 : _a.valueGetter) == null ? void 0 : _b.call(_a, cellParams.value)) != null ? _c : cellValue.value;
32944
+ (_d = props.onOpenEditor) == null ? void 0 : _d.call(props, key.value, { [key.value]: oldValue });
32945
+ };
32946
+ const closeEditor = () => {
32947
+ var _a;
32948
+ (_a = props.onCloseEditor) == null ? void 0 : _a.call(props, key.value);
32949
+ };
32950
+ watch(key, () => {
32951
+ var _a;
32952
+ if (((_a = props.column.edit) == null ? void 0 : _a.defaultEditable) && !props.isRowEdit) {
32953
+ openEditor();
32954
+ }
32955
+ });
32956
+ onMounted(() => {
32957
+ var _a;
32958
+ if (((_a = props.column.edit) == null ? void 0 : _a.defaultEditable) && !props.isRowEdit) {
32959
+ openEditor();
32960
+ }
32961
+ });
32962
+ return {
32963
+ props,
32964
+ key,
32965
+ isEditing,
32966
+ editable,
32967
+ onCellEvent
32968
+ };
32969
+ }
32970
+ });
32971
+
32972
+ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
32973
+ const _component_BodyEditCell = resolveComponent("BodyEditCell");
32974
+ const _component_BodyTextCell = resolveComponent("BodyTextCell");
32975
+ return _ctx.isEditing ? (openBlock(), createBlock(_component_BodyEditCell, {
32976
+ key: _ctx.key,
32977
+ prefixCls: _ctx.prefixCls,
32978
+ rowIndex: _ctx.rowIndex,
32979
+ flattenRowIndex: _ctx.flattenRowIndex,
32980
+ rowKey: _ctx.rowKey,
32981
+ column: _ctx.column,
32982
+ item: _ctx.item,
32983
+ "edit-row": _ctx.editRow,
32984
+ "editable-keys": _ctx.editableKeys,
32985
+ "is-row-edit": _ctx.isRowEdit
32986
+ }, null, 8, ["prefixCls", "rowIndex", "flattenRowIndex", "rowKey", "column", "item", "edit-row", "editable-keys", "is-row-edit"])) : (openBlock(), createBlock(_component_BodyTextCell, mergeProps({ key: 1 }, _ctx.props, {
32987
+ style: { cursor: _ctx.editable ? "poiner" : "" },
32988
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.onCellEvent($event, "click")),
32989
+ onDblClick: _cache[1] || (_cache[1] = ($event) => _ctx.onCellEvent($event, "dblClick")),
32990
+ onContextmenu: _cache[2] || (_cache[2] = ($event) => _ctx.onCellEvent($event, "contextmenu"))
32991
+ }), {
32992
+ appendNode: withCtx(() => [
32993
+ renderSlot(_ctx.$slots, "appendNode")
32994
+ ]),
32995
+ _: 3
32996
+ /* FORWARDED */
32997
+ }, 16, ["style"]));
32998
+ }
32999
+ var BodyCell = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$j]]);
33410
33000
 
33411
33001
  var _sfc_main$m = defineComponent({
33412
33002
  name: "TableExpandedRow",
@@ -33486,7 +33076,7 @@ var _sfc_main$m = defineComponent({
33486
33076
  }
33487
33077
  });
33488
33078
 
33489
- const _hoisted_1$7 = ["data-cell-auto"];
33079
+ const _hoisted_1$8 = ["data-cell-auto"];
33490
33080
  function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
33491
33081
  const _component_RenderVNode = resolveComponent("RenderVNode");
33492
33082
  const _directive_cell_resize = resolveDirective("cell-resize");
@@ -33518,7 +33108,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
33518
33108
  2
33519
33109
  /* CLASS */
33520
33110
  )
33521
- ], 10, _hoisted_1$7)), [
33111
+ ], 10, _hoisted_1$8)), [
33522
33112
  [_directive_cell_resize, _ctx.cellResizeBind]
33523
33113
  ])
33524
33114
  ],
@@ -33571,7 +33161,7 @@ var _sfc_main$l = defineComponent({
33571
33161
  }
33572
33162
  });
33573
33163
 
33574
- const _hoisted_1$6 = ["aria-label"];
33164
+ const _hoisted_1$7 = ["aria-label"];
33575
33165
  function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
33576
33166
  return _ctx.expandIcon ? (openBlock(), createElementBlock("span", {
33577
33167
  key: 0,
@@ -33585,7 +33175,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
33585
33175
  class: normalizeClass(_ctx.className),
33586
33176
  "aria-label": _ctx.label,
33587
33177
  onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"]))
33588
- }, null, 10, _hoisted_1$6));
33178
+ }, null, 10, _hoisted_1$7));
33589
33179
  }
33590
33180
  var ExpandIcon = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$h]]);
33591
33181
 
@@ -33784,8 +33374,8 @@ var _sfc_main$k = defineComponent({
33784
33374
  }
33785
33375
  });
33786
33376
 
33787
- const _hoisted_1$5 = ["data-level"];
33788
- const _hoisted_2$1 = {
33377
+ const _hoisted_1$6 = ["data-level"];
33378
+ const _hoisted_2$2 = {
33789
33379
  key: 2,
33790
33380
  draggable: true
33791
33381
  };
@@ -33843,12 +33433,12 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
33843
33433
  record: _ctx.record,
33844
33434
  disabled: !_ctx.supportExpand,
33845
33435
  onExpand: _ctx.onInternalTriggerExpand
33846
- }, null, 8, ["prefix-cls", "expandIconType", "expanded", "record", "disabled", "onExpand"])) : _ctx.column.type === "draggable" ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
33436
+ }, null, 8, ["prefix-cls", "expandIconType", "expanded", "record", "disabled", "onExpand"])) : _ctx.column.type === "draggable" ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
33847
33437
  renderSlot(_ctx.$slots, "draggable-handle", {}, () => [
33848
33438
  createVNode(_component_MenuOutlined)
33849
33439
  ])
33850
33440
  ])) : createCommentVNode("v-if", true)
33851
- ], 16, _hoisted_1$5);
33441
+ ], 16, _hoisted_1$6);
33852
33442
  }
33853
33443
  var BodyExtraCell = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$g]]);
33854
33444
 
@@ -33860,7 +33450,8 @@ var _sfc_main$j = defineComponent({
33860
33450
  BodyCell,
33861
33451
  ExpandedRow,
33862
33452
  BodyExtraCell,
33863
- RenderSlot
33453
+ RenderSlot,
33454
+ BodyTextCell: BodyCell$1
33864
33455
  },
33865
33456
  inheritAttrs: false,
33866
33457
  props: {
@@ -33882,11 +33473,17 @@ var _sfc_main$j = defineComponent({
33882
33473
  const tableContext = useInjectTable();
33883
33474
  const rowInstance = getCurrentInstance();
33884
33475
  const { table } = useProConfigInject();
33885
- const { editCellKeys, closeEditor, openEditor } = useEditInject();
33476
+ const { editCellKeys, isRowEdit, mergedEditableKeys, editRowsMap, closeEditor, openEditor } = useEditInject();
33477
+ const editRow = computed(() => editRowsMap.value[props.rowKey]);
33886
33478
  let isUnmount = false;
33887
33479
  const bodyRow = ref();
33888
- const { onCellMousedown, onCellMousemove, onCellClick } = useCellSelection();
33889
- const { onCellKeydown } = useCellKeyboard();
33480
+ const isCurrentEditRow = computed(() => {
33481
+ var _a;
33482
+ if (isRowEdit.value) {
33483
+ return (_a = mergedEditableKeys.value) == null ? void 0 : _a.includes(props.rowKey);
33484
+ }
33485
+ return true;
33486
+ });
33890
33487
  const calMaxHeight = () => {
33891
33488
  if (isUnmount) return;
33892
33489
  let rowHeight = 0;
@@ -34088,6 +33685,7 @@ var _sfc_main$j = defineComponent({
34088
33685
  rowStyle,
34089
33686
  cellClass,
34090
33687
  tableContext,
33688
+ isCurrentEditRow,
34091
33689
  mergedRowHeights,
34092
33690
  handleCellBlur,
34093
33691
  handleCellHover,
@@ -34115,29 +33713,29 @@ var _sfc_main$j = defineComponent({
34115
33713
  resizeObserver,
34116
33714
  calMaxHeight,
34117
33715
  bodyRow,
33716
+ editCellKeys,
33717
+ isRowEdit,
33718
+ editRow,
33719
+ mergedEditableKeys,
33720
+ openEditor,
33721
+ closeEditor,
34118
33722
  hoverRowKey,
34119
33723
  hoverColumnKey,
34120
33724
  xVirtual: eagerComputed(() => tableContext.xVirtual.value),
34121
33725
  getPopupContainer: () => popupContainer.value,
34122
- editCellKeys,
34123
- closeEditor,
34124
- openEditor,
34125
- mergedTooltipOpen,
34126
- onCellMousedown,
34127
- onCellKeydown,
34128
- onCellMousemove,
34129
- onCellClick
33726
+ mergedTooltipOpen
34130
33727
  };
34131
33728
  }
34132
33729
  });
34133
33730
 
34134
- const _hoisted_1$4 = ["data-row-key"];
34135
- const _hoisted_2 = ["data-row-key"];
33731
+ const _hoisted_1$5 = ["data-row-key"];
33732
+ const _hoisted_2$1 = ["data-row-key"];
34136
33733
  function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34137
33734
  const _component_ExpandedRow = resolveComponent("ExpandedRow");
34138
33735
  const _component_BodyExtraCell = resolveComponent("BodyExtraCell");
34139
33736
  const _component_ExpandIcon = resolveComponent("ExpandIcon");
34140
33737
  const _component_BodyCell = resolveComponent("BodyCell");
33738
+ const _component_BodyTextCell = resolveComponent("BodyTextCell");
34141
33739
  const _component_RenderSlot = resolveComponent("RenderSlot");
34142
33740
  return _ctx.isExpandRow ? (openBlock(), createElementBlock(
34143
33741
  Fragment,
@@ -34159,7 +33757,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34159
33757
  "resize-observer": _ctx.resizeObserver,
34160
33758
  "cal-max-height": _ctx.calMaxHeight
34161
33759
  }, null, 8, ["prefix-cls", "item", "row-key", "row-index", "resize-observer", "cal-max-height"])
34162
- ], 14, _hoisted_1$4)) : createCommentVNode("v-if", true)
33760
+ ], 14, _hoisted_1$5)) : createCommentVNode("v-if", true)
34163
33761
  ],
34164
33762
  64
34165
33763
  /* STABLE_FRAGMENT */
@@ -34177,7 +33775,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34177
33775
  Fragment,
34178
33776
  null,
34179
33777
  renderList(_ctx.mergedColumns, (column, index) => {
34180
- var _a;
33778
+ var _a, _b;
34181
33779
  return openBlock(), createElementBlock(
34182
33780
  Fragment,
34183
33781
  {
@@ -34197,7 +33795,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34197
33795
  record: _ctx.record,
34198
33796
  onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
34199
33797
  onMouseleave: _ctx.handleCellBlur
34200
- }, null, 8, ["prefix-cls", "row-key", "row-index", "type", "column", "expanded", "expandIconType", "support-expand", "record", "onMouseenter", "onMouseleave"])) : column ? (openBlock(), createBlock(_component_BodyCell, {
33798
+ }, null, 8, ["prefix-cls", "row-key", "row-index", "type", "column", "expanded", "expandIconType", "support-expand", "record", "onMouseenter", "onMouseleave"])) : column && ((_b = column.edit) == null ? void 0 : _b.component) && _ctx.isCurrentEditRow ? (openBlock(), createBlock(_component_BodyCell, {
34201
33799
  key: 1,
34202
33800
  "prefix-cls": _ctx.prefixCls,
34203
33801
  item: _ctx.record,
@@ -34214,14 +33812,68 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34214
33812
  "get-popup-container": _ctx.getPopupContainer,
34215
33813
  "tooltip-open": _ctx.mergedTooltipOpen && _ctx.hoverColumnKey === column.columnKey,
34216
33814
  "edit-cell-keys": _ctx.editCellKeys,
33815
+ "editable-keys": _ctx.mergedEditableKeys,
33816
+ "is-row-edit": _ctx.isRowEdit,
33817
+ "edit-row": _ctx.editRow,
33818
+ onCloseEditor: _ctx.closeEditor,
33819
+ onOpenEditor: _ctx.openEditor,
33820
+ onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
33821
+ onCellLeave: _ctx.handleCellBlur
33822
+ }, {
33823
+ appendNode: withCtx(() => [
33824
+ createElementVNode(
33825
+ "div",
33826
+ {
33827
+ class: normalizeClass(`${_ctx.prefixCls}-append-node`)
33828
+ },
33829
+ [
33830
+ createElementVNode(
33831
+ "span",
33832
+ {
33833
+ style: normalizeStyle(`padding-left: ${(_ctx.indent || 0) * _ctx.indentSize}px`),
33834
+ class: normalizeClass(`${_ctx.prefixCls}-row-indent indent-level-${_ctx.indent}`)
33835
+ },
33836
+ null,
33837
+ 6
33838
+ /* CLASS, STYLE */
33839
+ ),
33840
+ createVNode(_component_ExpandIcon, {
33841
+ expanded: _ctx.expanded,
33842
+ expandIconType: _ctx.expandIconType,
33843
+ "prefix-cls": _ctx.prefixCls,
33844
+ expandable: _ctx.hasNestChildren,
33845
+ record: _ctx.record,
33846
+ disabled: !_ctx.mergedExpandable,
33847
+ onExpand: _ctx.onInternalTriggerExpand
33848
+ }, null, 8, ["expanded", "expandIconType", "prefix-cls", "expandable", "record", "disabled", "onExpand"])
33849
+ ],
33850
+ 2
33851
+ /* CLASS */
33852
+ )
33853
+ ]),
33854
+ _: 1
33855
+ /* STABLE */
33856
+ }, 8, ["prefix-cls", "item", "row-key", "type", "row-index", "flatten-row-index", "wrap-text", "column", "resize-observer", "cal-max-height", "has-append-node", "height", "get-popup-container", "tooltip-open", "edit-cell-keys", "editable-keys", "is-row-edit", "edit-row", "onCloseEditor", "onOpenEditor", "onMouseenter", "onCellLeave"])) : column ? (openBlock(), createBlock(_component_BodyTextCell, {
33857
+ key: 2,
33858
+ "prefix-cls": _ctx.prefixCls,
33859
+ item: _ctx.record,
33860
+ "row-key": _ctx.rowKey,
33861
+ type: _ctx.type,
33862
+ "row-index": _ctx.rowIndex,
33863
+ "flatten-row-index": _ctx.flattenRowIndex,
33864
+ "wrap-text": _ctx.wrapText,
33865
+ column,
33866
+ "resize-observer": _ctx.resizeObserver,
33867
+ "cal-max-height": _ctx.calMaxHeight,
33868
+ "has-append-node": column.columnIndex === _ctx.expandIconColumnIndex && _ctx.nestExpandable,
33869
+ height: _ctx.cellHeight,
33870
+ "get-popup-container": _ctx.getPopupContainer,
33871
+ "tooltip-open": _ctx.mergedTooltipOpen && _ctx.hoverColumnKey === column.columnKey,
33872
+ "edit-cell-keys": _ctx.editCellKeys,
34217
33873
  onCloseEditor: _ctx.closeEditor,
34218
33874
  onOpenEditor: _ctx.openEditor,
34219
33875
  onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
34220
- onCellLeave: _ctx.handleCellBlur,
34221
- onMousedown: _ctx.onCellMousedown,
34222
- onMousemove: _ctx.onCellMousemove,
34223
- onKeydown: _ctx.onCellKeydown,
34224
- onClick: _ctx.onCellClick
33876
+ onCellLeave: _ctx.handleCellBlur
34225
33877
  }, {
34226
33878
  appendNode: withCtx(() => [
34227
33879
  createElementVNode(
@@ -34256,7 +33908,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34256
33908
  ]),
34257
33909
  _: 1
34258
33910
  /* STABLE */
34259
- }, 8, ["prefix-cls", "item", "row-key", "type", "row-index", "flatten-row-index", "wrap-text", "column", "resize-observer", "cal-max-height", "has-append-node", "height", "get-popup-container", "tooltip-open", "edit-cell-keys", "onCloseEditor", "onOpenEditor", "onMouseenter", "onCellLeave", "onMousedown", "onMousemove", "onKeydown", "onClick"])) : createCommentVNode("v-if", true)
33911
+ }, 8, ["prefix-cls", "item", "row-key", "type", "row-index", "flatten-row-index", "wrap-text", "column", "resize-observer", "cal-max-height", "has-append-node", "height", "get-popup-container", "tooltip-open", "edit-cell-keys", "onCloseEditor", "onOpenEditor", "onMouseenter", "onCellLeave"])) : createCommentVNode("v-if", true)
34260
33912
  ],
34261
33913
  64
34262
33914
  /* STABLE_FRAGMENT */
@@ -34279,7 +33931,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
34279
33931
  2
34280
33932
  /* CLASS */
34281
33933
  )) : createCommentVNode("v-if", true)
34282
- ], 16, _hoisted_2));
33934
+ ], 16, _hoisted_2$1));
34283
33935
  }
34284
33936
  var Row = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$f]]);
34285
33937
 
@@ -34922,7 +34574,7 @@ var _sfc_main$h = defineComponent({
34922
34574
  }
34923
34575
  });
34924
34576
 
34925
- const _hoisted_1$3 = { style: {
34577
+ const _hoisted_1$4 = { style: {
34926
34578
  width: "100%",
34927
34579
  overflow: "hidden",
34928
34580
  position: "relative",
@@ -35034,7 +34686,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
35034
34686
  onKeydown: _cache[9] || (_cache[9] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
35035
34687
  },
35036
34688
  [
35037
- createElementVNode("div", _hoisted_1$3, [
34689
+ createElementVNode("div", _hoisted_1$4, [
35038
34690
  createElementVNode(
35039
34691
  "div",
35040
34692
  {
@@ -35506,7 +35158,8 @@ var _sfc_main$g = defineComponent({
35506
35158
  "expandedRowsChange",
35507
35159
  "resizeColumn",
35508
35160
  "update:dataSource",
35509
- "cellKeydown"
35161
+ "cellKeydown",
35162
+ "data-change"
35510
35163
  ],
35511
35164
  slots: {},
35512
35165
  setup(props, { expose, emit, slots }) {
@@ -35518,7 +35171,6 @@ var _sfc_main$g = defineComponent({
35518
35171
  });
35519
35172
  const popupContainer = shallowRef(null);
35520
35173
  const customUiCls = usePrefixCls("custom-ui");
35521
- const { editCellKeys, openEditor, closeEditor } = useEditProvider();
35522
35174
  useProvidePopup();
35523
35175
  const getPopupContainer = computed(() => props.getPopupContainer);
35524
35176
  const { status, watermarkMsg } = useLicense();
@@ -35625,6 +35277,9 @@ var _sfc_main$g = defineComponent({
35625
35277
  },
35626
35278
  { immediate: true, deep: !!props.deepWatchColumns }
35627
35279
  );
35280
+ watch(rawData, (newData) => {
35281
+ emit("data-change", newData);
35282
+ });
35628
35283
  const childrenColumnName = computed(
35629
35284
  () => {
35630
35285
  var _a, _b, _c;
@@ -35660,6 +35315,20 @@ var _sfc_main$g = defineComponent({
35660
35315
  return { spinning: false };
35661
35316
  }
35662
35317
  });
35318
+ const {
35319
+ validateRowData,
35320
+ addEditRecord,
35321
+ cancelEditable,
35322
+ startEditable,
35323
+ saveEditable,
35324
+ isEditable,
35325
+ validateTableData
35326
+ } = useEditProvider(props, {
35327
+ getIndexsByKey,
35328
+ getRecordByKey,
35329
+ rawData,
35330
+ getRowKey
35331
+ });
35663
35332
  onActivated(() => {
35664
35333
  scrollTo({ left: 0, top: 0 });
35665
35334
  });
@@ -35969,7 +35638,11 @@ var _sfc_main$g = defineComponent({
35969
35638
  leftWidth,
35970
35639
  centerWidth,
35971
35640
  getRowHeight: cal.getRowHeight,
35972
- customCell: toRef$1(props, "customCell")
35641
+ customCell: toRef$1(props, "customCell"),
35642
+ cancelEditable,
35643
+ startEditable,
35644
+ saveEditable,
35645
+ isEditable
35973
35646
  });
35974
35647
  watch(
35975
35648
  [realHeaderHeight, scrollLeft],
@@ -35983,6 +35656,10 @@ var _sfc_main$g = defineComponent({
35983
35656
  ...cal,
35984
35657
  ...columns,
35985
35658
  ...cellProps,
35659
+ cancelEditable,
35660
+ startEditable,
35661
+ saveEditable,
35662
+ isEditable,
35986
35663
  rootRef,
35987
35664
  rawData,
35988
35665
  getRowFlattenIndexByKey,
@@ -36200,99 +35877,22 @@ var _sfc_main$g = defineComponent({
36200
35877
  });
36201
35878
  const tabGuardTopRef = ref();
36202
35879
  const tabGuardBottomRef = ref();
36203
- const {
36204
- navigationService,
36205
- getSelectedRange,
36206
- clearAllSelectedRange,
36207
- copySelectedRange,
36208
- appendCellToSelectedRange,
36209
- onBodyKeydown
36210
- } = useProvideRangeStore({
36211
- allColumns: columns.allColumns,
36212
- flattenData,
36213
- rangeSelection: computed(() => props.rangeSelection),
36214
- getRowByFlattenIndex,
36215
- rootRef,
36216
- prefixCls: computed(() => props.prefixCls),
36217
- allCellProps: cellProps.allCellProps,
36218
- tabGuardTopRef,
36219
- tabGuardBottomRef,
36220
- ensureCellColumnVisible: (cell) => {
36221
- if (!cell.column || cell.column.fixed) return;
36222
- const sl = scrollLeft.value;
36223
- const pos2 = columns.getColumnPositionByKey(cell.column.columnKey);
36224
- if (pos2) {
36225
- const { width, left } = pos2;
36226
- const lw = leftWidth.value;
36227
- const rw = rightWidth.value;
36228
- left - lw < sl ? scrollLeft.value = left - lw : left + width > sl + bodyWidth.value - rw && (scrollLeft.value = left + width - bodyWidth.value + rw);
36229
- }
36230
- },
36231
- ensureCellRowVisible: (cell) => {
36232
- var _a;
36233
- const { rowIndex } = cell;
36234
- const st = scrollTop.value;
36235
- const row = getRowByFlattenIndex(rowIndex);
36236
- const pos2 = cal.getRowPositionByKey(row.rowKey);
36237
- const cprops = (((_a = cellProps.allCellProps.value[row.rowKey]) == null ? void 0 : _a[cell.column.columnKey]) || {}).props || {};
36238
- const height = cal.getRowHeight(rowIndex, cprops.rowSpan);
36239
- if (pos2 !== void 0) {
36240
- updateAnimate();
36241
- if (pos2 < st) {
36242
- scrollTop.value = pos2;
36243
- } else {
36244
- if (pos2 + height > st + bodyHeight.value) {
36245
- scrollTop.value = pos2 + height - bodyHeight.value;
36246
- }
36247
- }
36248
- }
36249
- },
36250
- latestRangeStartCell,
36251
- bodyRef: computed(() => {
36252
- var _a;
36253
- return (_a = bodyRef.value) == null ? void 0 : _a.bodyRef;
36254
- }),
36255
- scrollLeft,
36256
- scrollTop,
36257
- scrollTo,
36258
- showVerticalScrollbar,
36259
- showHorizontalScrollbar,
36260
- getIndexsByKey,
36261
- formatRangeCellText: (parmas) => {
36262
- if (props.formatRangeCellText) {
36263
- return props.formatRangeCellText(parmas);
36264
- } else if (parmas.value) {
36265
- return parmas.value;
36266
- }
36267
- return "";
36268
- },
36269
- editCellKeys,
36270
- copyDelimiter: computed(() => props.copyDelimiter)
36271
- });
36272
35880
  expose({
36273
35881
  scrollTo,
36274
35882
  scrollLeft,
36275
35883
  scrollTop,
36276
35884
  rootRef,
36277
35885
  paginationRef,
35886
+ validateRowData,
35887
+ addEditRecord,
35888
+ cancelEditable,
35889
+ startEditable,
35890
+ saveEditable,
35891
+ validateTableData,
36278
35892
  bodyRef: computed(() => {
36279
35893
  var _a;
36280
35894
  return (_a = bodyRef.value) == null ? void 0 : _a.bodyRef;
36281
- }),
36282
- getSelectedRange,
36283
- clearAllSelectedRange,
36284
- copySelectedRange,
36285
- appendCellToSelectedRange,
36286
- openEditor: (cellInfos) => {
36287
- openEditor(cellInfos.map((info) => `${info.rowKey} ${info.columnKey}`));
36288
- },
36289
- closeEditor: (cellInfos) => {
36290
- if (cellInfos) {
36291
- closeEditor(cellInfos.map((info) => `${info.rowKey} ${info.columnKey}`));
36292
- } else {
36293
- closeEditor();
36294
- }
36295
- }
35895
+ })
36296
35896
  });
36297
35897
  return {
36298
35898
  bodyRef,
@@ -36304,7 +35904,6 @@ var _sfc_main$g = defineComponent({
36304
35904
  watermarkMsg,
36305
35905
  rootStyle,
36306
35906
  rootClass,
36307
- onBodyKeydown,
36308
35907
  watermarkStyle: computed(() => ({
36309
35908
  minWidth: "100px!important",
36310
35909
  minHeight: "40px!important",
@@ -36349,12 +35948,6 @@ var _sfc_main$g = defineComponent({
36349
35948
  bottomPaginationHeight.value = e.detail.height;
36350
35949
  },
36351
35950
  popupContainer,
36352
- handleGuardTopKeydown: (e) => {
36353
- e.keyCode !== KeyCode.TAB || e.shiftKey || (navigationService.getFirstCellToFocus(e.shiftKey), e.preventDefault());
36354
- },
36355
- handleGuardBottomKeydown: (e) => {
36356
- e.keyCode === KeyCode.TAB && e.shiftKey && (navigationService.getLastCellToFocus(e.shiftKey), e.preventDefault());
36357
- },
36358
35951
  tabGuardTopRef,
36359
35952
  tabGuardBottomRef,
36360
35953
  onShowSizeChange,
@@ -36365,6 +35958,18 @@ var _sfc_main$g = defineComponent({
36365
35958
  }
36366
35959
  });
36367
35960
 
35961
+ const _hoisted_1$3 = {
35962
+ ref: "tabGuardTopRef",
35963
+ role: "presentation",
35964
+ tabindex: "0",
35965
+ style: { position: "absolute", width: "0", height: "0" }
35966
+ };
35967
+ const _hoisted_2 = {
35968
+ ref: "tabGuardBottomRef",
35969
+ role: "presentation",
35970
+ tabindex: "0",
35971
+ style: { position: "absolute", width: "0", height: "0" }
35972
+ };
36368
35973
  function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
36369
35974
  const _component_Pagination = resolveComponent("Pagination");
36370
35975
  const _component_AutoHeightHeader = resolveComponent("AutoHeightHeader");
@@ -36394,16 +35999,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
36394
35999
  }), null, 16, ["class", "onChange", "onShowSizeChange"])) : createCommentVNode("v-if", true),
36395
36000
  createElementVNode(
36396
36001
  "div",
36397
- {
36398
- ref: "tabGuardTopRef",
36399
- role: "presentation",
36400
- tabindex: "0",
36401
- style: { position: "absolute", width: "0", height: "0" },
36402
- onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleGuardTopKeydown && _ctx.handleGuardTopKeydown(...args))
36403
- },
36002
+ _hoisted_1$3,
36404
36003
  null,
36405
- 544
36406
- /* NEED_HYDRATION, NEED_PATCH */
36004
+ 512
36005
+ /* NEED_PATCH */
36407
36006
  ),
36408
36007
  createElementVNode(
36409
36008
  "div",
@@ -36436,20 +36035,19 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
36436
36035
  createVNode(_component_ProBody, {
36437
36036
  ref: "bodyRef",
36438
36037
  bodyScrollWidth: _ctx.bodyScrollWidth,
36439
- "onUpdate:bodyScrollWidth": _cache[1] || (_cache[1] = ($event) => _ctx.bodyScrollWidth = $event),
36038
+ "onUpdate:bodyScrollWidth": _cache[0] || (_cache[0] = ($event) => _ctx.bodyScrollWidth = $event),
36440
36039
  bodyWidth: _ctx.bodyWidth,
36441
- "onUpdate:bodyWidth": _cache[2] || (_cache[2] = ($event) => _ctx.bodyWidth = $event),
36040
+ "onUpdate:bodyWidth": _cache[1] || (_cache[1] = ($event) => _ctx.bodyWidth = $event),
36442
36041
  bodyHeight: _ctx.bodyHeight,
36443
- "onUpdate:bodyHeight": _cache[3] || (_cache[3] = ($event) => _ctx.bodyHeight = $event),
36042
+ "onUpdate:bodyHeight": _cache[2] || (_cache[2] = ($event) => _ctx.bodyHeight = $event),
36444
36043
  "prefix-cls": _ctx.prefixCls,
36445
36044
  "wrap-text": _ctx.wrapText,
36446
36045
  "scroll-x": _ctx.mergedScrollX,
36447
36046
  height: _ctx.mergedScrollY,
36448
36047
  "summary-fixed": _ctx.mergedSummaryFixed,
36449
36048
  summary: _ctx.$slots.summary,
36450
- "empty-text": _ctx.$slots.emptyText,
36451
- onKeydown: _ctx.onBodyKeydown
36452
- }, null, 8, ["bodyScrollWidth", "bodyWidth", "bodyHeight", "prefix-cls", "wrap-text", "scroll-x", "height", "summary-fixed", "summary", "empty-text", "onKeydown"])
36049
+ "empty-text": _ctx.$slots.emptyText
36050
+ }, null, 8, ["bodyScrollWidth", "bodyWidth", "bodyHeight", "prefix-cls", "wrap-text", "scroll-x", "height", "summary-fixed", "summary", "empty-text"])
36453
36051
  ],
36454
36052
  6
36455
36053
  /* CLASS, STYLE */
@@ -36457,16 +36055,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
36457
36055
  createVNode(_component_HorizontalScroll),
36458
36056
  createElementVNode(
36459
36057
  "div",
36460
- {
36461
- ref: "tabGuardBottomRef",
36462
- role: "presentation",
36463
- tabindex: "0",
36464
- style: { position: "absolute", width: "0", height: "0" },
36465
- onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.handleGuardBottomKeydown && _ctx.handleGuardBottomKeydown(...args))
36466
- },
36058
+ _hoisted_2,
36467
36059
  null,
36468
- 544
36469
- /* NEED_HYDRATION, NEED_PATCH */
36060
+ 512
36061
+ /* NEED_PATCH */
36470
36062
  ),
36471
36063
  _ctx.$slots.footer ? (openBlock(), createElementBlock(
36472
36064
  "div",
@@ -36491,7 +36083,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
36491
36083
  ref: "paginationRef",
36492
36084
  style: normalizeStyle(_ctx.bottomPaginationStyle),
36493
36085
  class: normalizeClass(`${_ctx.prefixCls}-pagination-wrap ${_ctx.prefixCls}-pagination-wrap-${_ctx.size}`),
36494
- onResizeheight: _cache[5] || (_cache[5] = (...args) => _ctx.handlePaginationResize && _ctx.handlePaginationResize(...args))
36086
+ onResizeheight: _cache[3] || (_cache[3] = (...args) => _ctx.handlePaginationResize && _ctx.handlePaginationResize(...args))
36495
36087
  },
36496
36088
  [
36497
36089
  createVNode(_component_Pagination, mergeProps({ class: _ctx.paginationClass }, _ctx.paginationProps, {
@@ -38276,6 +37868,30 @@ var Table = /* @__PURE__ */ defineComponent({
38276
37868
  var _a2;
38277
37869
  (_a2 = tableRef.value) == null ? void 0 : _a2.scrollTo(pos, behavior);
38278
37870
  },
37871
+ validateRowData: (recordKey) => {
37872
+ var _a2;
37873
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.validateRowData(recordKey);
37874
+ },
37875
+ validateTableData: () => {
37876
+ var _a2;
37877
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.validateTableData();
37878
+ },
37879
+ addEditRecord: (recordValue, options) => {
37880
+ var _a2;
37881
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.addEditRecord(recordValue, options);
37882
+ },
37883
+ startEditable: (recordKey, recordValue) => {
37884
+ var _a2;
37885
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.startEditable(recordKey, recordValue);
37886
+ },
37887
+ cancelEditable: (recordValue, options) => {
37888
+ var _a2;
37889
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.cancelEditable(recordValue, options);
37890
+ },
37891
+ saveEditable: (recordKey) => {
37892
+ var _a2;
37893
+ return (_a2 = tableRef.value) == null ? void 0 : _a2.saveEditable(recordKey);
37894
+ },
38279
37895
  scrollLeft: computed(() => {
38280
37896
  var _a2;
38281
37897
  return unref((_a2 = tableRef.value) == null ? void 0 : _a2.scrollLeft);
@@ -38296,18 +37912,6 @@ var Table = /* @__PURE__ */ defineComponent({
38296
37912
  var _a2;
38297
37913
  return unref((_a2 = tableRef.value) == null ? void 0 : _a2.paginationRef);
38298
37914
  }),
38299
- copySelectedRange: () => {
38300
- var _a2;
38301
- return (_a2 = tableRef.value) == null ? void 0 : _a2.copySelectedRange();
38302
- },
38303
- getSelectedRange: () => {
38304
- var _a2;
38305
- return (_a2 = tableRef.value) == null ? void 0 : _a2.getSelectedRange();
38306
- },
38307
- clearAllSelectedRange: () => {
38308
- var _a2;
38309
- return (_a2 = tableRef.value) == null ? void 0 : _a2.clearAllSelectedRange();
38310
- },
38311
37915
  clearDataSource: () => {
38312
37916
  dataSource.value = [];
38313
37917
  },
@@ -38317,14 +37921,6 @@ var Table = /* @__PURE__ */ defineComponent({
38317
37921
  var _a2;
38318
37922
  return (_a2 = tableRef.value) == null ? void 0 : _a2.appendCellToSelectedRange(params);
38319
37923
  },
38320
- openEditor: (cellInfos) => {
38321
- var _a2;
38322
- return (_a2 = tableRef.value) == null ? void 0 : _a2.openEditor(cellInfos);
38323
- },
38324
- closeEditor: (cellInfos) => {
38325
- var _a2;
38326
- return (_a2 = tableRef.value) == null ? void 0 : _a2.closeEditor(cellInfos);
38327
- },
38328
37924
  reload,
38329
37925
  reset,
38330
37926
  calcTableHeight,