pro-design-vue 1.3.20 → 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.
- package/dist/index.css +1 -1
- package/dist/index.full.js +1203 -1588
- package/dist/index.full.min.js +7 -9
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +7 -9
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1204 -1589
- package/es/components/config-provider/src/typing.d.ts +3 -1
- package/es/components/table/src/components/Body/Body.vue.d.ts +270 -15
- package/es/components/table/src/components/Body/BodyCell.vue.d.ts +255 -0
- package/es/components/table/src/components/Body/BodyEditCell.d.ts +60 -0
- package/es/components/table/src/components/Body/BodyExtraCell.vue.d.ts +6 -1
- package/es/components/table/src/components/Body/BodyRow.vue.d.ts +270 -15
- package/es/components/table/src/components/Body/BodyRows.vue.d.ts +270 -15
- package/es/components/table/src/components/Body/{BodyCell.d.ts → BodyTextCell.d.ts} +1 -7
- package/es/components/table/src/components/ExpandIcon.vue.d.ts +3 -0
- package/es/components/table/src/components/InteralTable.vue.d.ts +332 -19
- package/es/components/table/src/components/Table.d.ts +60 -0
- package/es/components/table/src/components/context/TableContext.d.ts +6 -1
- package/es/components/table/src/components/interface.d.ts +308 -23
- package/es/components/table/src/hooks/useCellProps.d.ts +5 -1
- package/es/components/table/src/hooks/useEdit.d.ts +24 -7
- package/es/components/table/src/utils/form-model.d.ts +25 -0
- package/es/components/table/src/utils/util.d.ts +1 -0
- package/es/index.d.ts +291 -5
- package/es/packages/components/table/src/components/Body/BodyCell.vue.mjs +35 -0
- package/es/packages/components/table/src/components/Body/BodyCell.vue.mjs.map +1 -0
- package/es/packages/components/table/src/components/Body/BodyCell.vue2.mjs +129 -0
- package/es/packages/components/table/src/components/Body/BodyCell.vue2.mjs.map +1 -0
- package/es/packages/components/table/src/components/Body/BodyEditCell.mjs +256 -0
- package/es/packages/components/table/src/components/Body/BodyEditCell.mjs.map +1 -0
- package/es/packages/components/table/src/components/Body/BodyExtraCell.vue.mjs +2 -1
- package/es/packages/components/table/src/components/Body/BodyExtraCell.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyExtraCell.vue2.mjs +1 -0
- package/es/packages/components/table/src/components/Body/BodyExtraCell.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs +66 -9
- package/es/packages/components/table/src/components/Body/BodyRow.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/BodyRow.vue2.mjs +26 -18
- package/es/packages/components/table/src/components/Body/BodyRow.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/Body/{BodyCell.mjs → BodyTextCell.mjs} +25 -155
- package/es/packages/components/table/src/components/Body/BodyTextCell.mjs.map +1 -0
- package/es/packages/components/table/src/components/ExpandIcon.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/ExpandIcon.vue2.mjs +4 -2
- package/es/packages/components/table/src/components/ExpandIcon.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/InteralTable.vue.mjs +24 -25
- package/es/packages/components/table/src/components/InteralTable.vue.mjs.map +1 -1
- package/es/packages/components/table/src/components/InteralTable.vue2.mjs +43 -97
- package/es/packages/components/table/src/components/InteralTable.vue2.mjs.map +1 -1
- package/es/packages/components/table/src/components/Table.mjs +24 -20
- package/es/packages/components/table/src/components/Table.mjs.map +1 -1
- package/es/packages/components/table/src/components/context/TableContext.mjs.map +1 -1
- package/es/packages/components/table/src/components/interface.mjs +28 -0
- package/es/packages/components/table/src/components/interface.mjs.map +1 -1
- package/es/packages/components/table/src/hooks/useCellProps.mjs +8 -0
- package/es/packages/components/table/src/hooks/useCellProps.mjs.map +1 -1
- package/es/packages/components/table/src/hooks/useEdit.mjs +293 -18
- package/es/packages/components/table/src/hooks/useEdit.mjs.map +1 -1
- package/es/packages/components/table/src/utils/form-model.mjs +98 -0
- package/es/packages/components/table/src/utils/form-model.mjs.map +1 -0
- package/es/packages/components/table/src/utils/util.mjs +4 -1
- package/es/packages/components/table/src/utils/util.mjs.map +1 -1
- package/es/packages/utils/dom.mjs +15 -1
- package/es/packages/utils/dom.mjs.map +1 -1
- package/es/packages/utils/index.mjs +1 -1
- package/es/utils/dom.d.ts +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/config-provider/src/typing.d.ts +3 -1
- package/lib/components/table/src/components/Body/Body.vue.d.ts +270 -15
- package/lib/components/table/src/components/Body/BodyCell.vue.d.ts +255 -0
- package/lib/components/table/src/components/Body/BodyEditCell.d.ts +60 -0
- package/lib/components/table/src/components/Body/BodyExtraCell.vue.d.ts +6 -1
- package/lib/components/table/src/components/Body/BodyRow.vue.d.ts +270 -15
- package/lib/components/table/src/components/Body/BodyRows.vue.d.ts +270 -15
- package/lib/components/table/src/components/Body/{BodyCell.d.ts → BodyTextCell.d.ts} +1 -7
- package/lib/components/table/src/components/ExpandIcon.vue.d.ts +3 -0
- package/lib/components/table/src/components/InteralTable.vue.d.ts +332 -19
- package/lib/components/table/src/components/Table.d.ts +60 -0
- package/lib/components/table/src/components/context/TableContext.d.ts +6 -1
- package/lib/components/table/src/components/interface.d.ts +308 -23
- package/lib/components/table/src/hooks/useCellProps.d.ts +5 -1
- package/lib/components/table/src/hooks/useEdit.d.ts +24 -7
- package/lib/components/table/src/utils/form-model.d.ts +25 -0
- package/lib/components/table/src/utils/util.d.ts +1 -0
- package/lib/index.d.ts +291 -5
- package/lib/packages/components/table/src/components/Body/BodyCell.vue.js +39 -0
- package/lib/packages/components/table/src/components/Body/BodyCell.vue.js.map +1 -0
- package/lib/packages/components/table/src/components/Body/BodyCell.vue2.js +133 -0
- package/lib/packages/components/table/src/components/Body/BodyCell.vue2.js.map +1 -0
- package/lib/packages/components/table/src/components/Body/BodyEditCell.js +260 -0
- package/lib/packages/components/table/src/components/Body/BodyEditCell.js.map +1 -0
- package/lib/packages/components/table/src/components/Body/BodyExtraCell.vue.js +2 -1
- package/lib/packages/components/table/src/components/Body/BodyExtraCell.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyExtraCell.vue2.js +1 -0
- package/lib/packages/components/table/src/components/Body/BodyExtraCell.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyRow.vue.js +66 -9
- package/lib/packages/components/table/src/components/Body/BodyRow.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/BodyRow.vue2.js +24 -16
- package/lib/packages/components/table/src/components/Body/BodyRow.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/Body/{BodyCell.js → BodyTextCell.js} +24 -154
- package/lib/packages/components/table/src/components/Body/BodyTextCell.js.map +1 -0
- package/lib/packages/components/table/src/components/ExpandIcon.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/ExpandIcon.vue2.js +4 -2
- package/lib/packages/components/table/src/components/ExpandIcon.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/InteralTable.vue.js +24 -25
- package/lib/packages/components/table/src/components/InteralTable.vue.js.map +1 -1
- package/lib/packages/components/table/src/components/InteralTable.vue2.js +43 -97
- package/lib/packages/components/table/src/components/InteralTable.vue2.js.map +1 -1
- package/lib/packages/components/table/src/components/Table.js +24 -20
- package/lib/packages/components/table/src/components/Table.js.map +1 -1
- package/lib/packages/components/table/src/components/context/TableContext.js.map +1 -1
- package/lib/packages/components/table/src/components/interface.js +28 -0
- package/lib/packages/components/table/src/components/interface.js.map +1 -1
- package/lib/packages/components/table/src/hooks/useCellProps.js +8 -0
- package/lib/packages/components/table/src/hooks/useCellProps.js.map +1 -1
- package/lib/packages/components/table/src/hooks/useEdit.js +292 -17
- package/lib/packages/components/table/src/hooks/useEdit.js.map +1 -1
- package/lib/packages/components/table/src/utils/form-model.js +102 -0
- package/lib/packages/components/table/src/utils/form-model.js.map +1 -0
- package/lib/packages/components/table/src/utils/util.js +4 -0
- package/lib/packages/components/table/src/utils/util.js.map +1 -1
- package/lib/packages/utils/dom.js +16 -0
- package/lib/packages/utils/dom.js.map +1 -1
- package/lib/packages/utils/index.js +2 -0
- package/lib/packages/utils/index.js.map +1 -1
- package/lib/utils/dom.d.ts +2 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/table/table.less +78 -25
- package/es/components/table/src/components/Body/EditInput.vue.d.ts +0 -102
- package/es/packages/components/table/src/components/Body/BodyCell.mjs.map +0 -1
- package/es/packages/components/table/src/components/Body/EditInput.vue.mjs +0 -48
- package/es/packages/components/table/src/components/Body/EditInput.vue.mjs.map +0 -1
- package/es/packages/components/table/src/components/Body/EditInput.vue2.mjs +0 -151
- package/es/packages/components/table/src/components/Body/EditInput.vue2.mjs.map +0 -1
- package/lib/components/table/src/components/Body/EditInput.vue.d.ts +0 -102
- package/lib/packages/components/table/src/components/Body/BodyCell.js.map +0 -1
- package/lib/packages/components/table/src/components/Body/EditInput.vue.js +0 -52
- package/lib/packages/components/table/src/components/Body/EditInput.vue.js.map +0 -1
- package/lib/packages/components/table/src/components/Body/EditInput.vue2.js +0 -155
- package/lib/packages/components/table/src/components/Body/EditInput.vue2.js.map +0 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! Pro Design Vue v1.3.
|
|
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,
|
|
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.
|
|
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$
|
|
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$
|
|
777
|
+
_defineProperty$w(target, key, source[key]);
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
return target;
|
|
781
781
|
}
|
|
782
|
-
function _defineProperty$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
903
|
+
_defineProperty$v(target, key, source[key]);
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
return target;
|
|
907
907
|
}
|
|
908
|
-
function _defineProperty$
|
|
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$
|
|
928
|
+
return _objectSpread$u({}, twoToneColorPalette);
|
|
929
929
|
}
|
|
930
930
|
var IconBase = function IconBase2(props, context) {
|
|
931
|
-
var _props$context$attrs = _objectSpread$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
1100
|
+
_defineProperty$u(target, key, source[key]);
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
1103
|
return target;
|
|
1104
1104
|
}
|
|
1105
|
-
function _defineProperty$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
1192
|
+
_defineProperty$t(target, key, source[key]);
|
|
1193
1193
|
});
|
|
1194
1194
|
}
|
|
1195
1195
|
return target;
|
|
1196
1196
|
}
|
|
1197
|
-
function _defineProperty$
|
|
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$
|
|
1207
|
-
return createVNode(Icon$1, _objectSpread$
|
|
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$
|
|
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$
|
|
1226
|
+
_defineProperty$s(target, key, source[key]);
|
|
1227
1227
|
});
|
|
1228
1228
|
}
|
|
1229
1229
|
return target;
|
|
1230
1230
|
}
|
|
1231
|
-
function _defineProperty$
|
|
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$
|
|
1241
|
-
return createVNode(Icon$1, _objectSpread$
|
|
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
|
|
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":
|
|
1310
|
+
"icon": CloseCircleFilled$1
|
|
1277
1311
|
}), null);
|
|
1278
1312
|
};
|
|
1279
|
-
|
|
1280
|
-
|
|
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,10 +24109,18 @@ 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
|
|
24063
24119
|
},
|
|
24120
|
+
expandIconType: {
|
|
24121
|
+
type: String,
|
|
24122
|
+
default: void 0
|
|
24123
|
+
},
|
|
24064
24124
|
onExpand: {
|
|
24065
24125
|
type: Function,
|
|
24066
24126
|
default: void 0
|
|
@@ -24115,6 +24175,14 @@ const baseTableProps = () => ({
|
|
|
24115
24175
|
type: Function,
|
|
24116
24176
|
default: () => ({})
|
|
24117
24177
|
},
|
|
24178
|
+
editableKeys: {
|
|
24179
|
+
type: Array,
|
|
24180
|
+
default: void 0
|
|
24181
|
+
},
|
|
24182
|
+
rowEditable: {
|
|
24183
|
+
type: Object,
|
|
24184
|
+
default: void 0
|
|
24185
|
+
},
|
|
24118
24186
|
showHeader: {
|
|
24119
24187
|
type: Boolean,
|
|
24120
24188
|
default: true
|
|
@@ -24213,6 +24281,9 @@ const baseTableProps = () => ({
|
|
|
24213
24281
|
type: Boolean,
|
|
24214
24282
|
default: void 0
|
|
24215
24283
|
},
|
|
24284
|
+
editableCellState: {
|
|
24285
|
+
type: Function
|
|
24286
|
+
},
|
|
24216
24287
|
paginationSticky: {
|
|
24217
24288
|
type: [Boolean, Object],
|
|
24218
24289
|
default: true
|
|
@@ -24266,6 +24337,15 @@ const baseTableProps = () => ({
|
|
|
24266
24337
|
type: Function,
|
|
24267
24338
|
default: void 0
|
|
24268
24339
|
},
|
|
24340
|
+
onDataChange: {
|
|
24341
|
+
type: Function
|
|
24342
|
+
},
|
|
24343
|
+
onRowValidate: {
|
|
24344
|
+
type: Function
|
|
24345
|
+
},
|
|
24346
|
+
onValidate: {
|
|
24347
|
+
type: Function
|
|
24348
|
+
},
|
|
24269
24349
|
"onUpdate:pagination": {
|
|
24270
24350
|
type: Function
|
|
24271
24351
|
},
|
|
@@ -25018,41 +25098,305 @@ const ICON_TYPE_DOWN$1 = "ICON_TYPE_DOWN";
|
|
|
25018
25098
|
const ICON_TYPE_FORBID$1 = "ICON_TYPE_FORBID";
|
|
25019
25099
|
|
|
25020
25100
|
const EditKey = Symbol("edit");
|
|
25021
|
-
const useEditProvider = (
|
|
25101
|
+
const useEditProvider = (props, {
|
|
25102
|
+
rawData,
|
|
25103
|
+
getRowKey,
|
|
25104
|
+
getIndexsByKey,
|
|
25105
|
+
getRecordByKey
|
|
25106
|
+
}) => {
|
|
25107
|
+
var _a;
|
|
25022
25108
|
const editCellKeys = shallowRef([]);
|
|
25023
|
-
const
|
|
25024
|
-
const
|
|
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) => {
|
|
25025
25144
|
if (key) {
|
|
25145
|
+
const newKeys = [...editCellKeys.value];
|
|
25026
25146
|
if (Array.isArray(key)) {
|
|
25027
25147
|
editCellKeys.value = key;
|
|
25028
25148
|
} else {
|
|
25029
|
-
|
|
25149
|
+
newKeys.includes(key) || newKeys.push(key);
|
|
25030
25150
|
}
|
|
25031
|
-
|
|
25151
|
+
editCellKeys.value = newKeys;
|
|
25032
25152
|
}
|
|
25033
25153
|
};
|
|
25034
25154
|
const closeEditor = (key) => {
|
|
25035
|
-
|
|
25036
|
-
|
|
25037
|
-
|
|
25038
|
-
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];
|
|
25039
25183
|
}
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
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
|
+
}
|
|
25044
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);
|
|
25255
|
+
});
|
|
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);
|
|
25045
25377
|
};
|
|
25046
25378
|
provide(EditKey, {
|
|
25047
25379
|
editCellKeys,
|
|
25048
25380
|
openEditor,
|
|
25049
25381
|
closeEditor,
|
|
25050
|
-
oldValuesMap
|
|
25382
|
+
// oldValuesMap,
|
|
25383
|
+
editableType,
|
|
25384
|
+
mergedEditableKeys,
|
|
25385
|
+
isRowEdit,
|
|
25386
|
+
editRowsMap,
|
|
25387
|
+
setEditingCell
|
|
25051
25388
|
});
|
|
25052
25389
|
return {
|
|
25053
25390
|
editCellKeys,
|
|
25054
25391
|
openEditor,
|
|
25055
|
-
closeEditor
|
|
25392
|
+
closeEditor,
|
|
25393
|
+
cancelEditable,
|
|
25394
|
+
startEditable,
|
|
25395
|
+
saveEditable,
|
|
25396
|
+
isEditable,
|
|
25397
|
+
validateTableData,
|
|
25398
|
+
validateRowData,
|
|
25399
|
+
addEditRecord
|
|
25056
25400
|
};
|
|
25057
25401
|
};
|
|
25058
25402
|
const useEditInject = () => {
|
|
@@ -25062,7 +25406,13 @@ const useEditInject = () => {
|
|
|
25062
25406
|
},
|
|
25063
25407
|
closeEditor: () => {
|
|
25064
25408
|
},
|
|
25065
|
-
oldValuesMap: shallowRef({})
|
|
25409
|
+
// oldValuesMap: shallowRef({}),
|
|
25410
|
+
editRowsMap: shallowRef({}),
|
|
25411
|
+
editableType: computed(() => void 0),
|
|
25412
|
+
isRowEdit: computed(() => false),
|
|
25413
|
+
mergedEditableKeys: computed(() => []),
|
|
25414
|
+
setEditingCell: () => {
|
|
25415
|
+
}
|
|
25066
25416
|
});
|
|
25067
25417
|
};
|
|
25068
25418
|
|
|
@@ -25313,926 +25663,6 @@ const useInjectTable = () => {
|
|
|
25313
25663
|
return inject(TableContextKey, {});
|
|
25314
25664
|
};
|
|
25315
25665
|
|
|
25316
|
-
const KeyCode = {
|
|
25317
|
-
TAB: 9,
|
|
25318
|
-
ENTER: 13,
|
|
25319
|
-
ESC: 27,
|
|
25320
|
-
LEFT: 37,
|
|
25321
|
-
UP: 38,
|
|
25322
|
-
RIGHT: 39,
|
|
25323
|
-
DOWN: 40,
|
|
25324
|
-
A: 65,
|
|
25325
|
-
C: 67};
|
|
25326
|
-
|
|
25327
|
-
const useCellNavigation = (params) => {
|
|
25328
|
-
const {
|
|
25329
|
-
getDisplayedColBefore,
|
|
25330
|
-
getDisplayedColAfter,
|
|
25331
|
-
allDisplayedColumns,
|
|
25332
|
-
setRangeToCell,
|
|
25333
|
-
focusCell,
|
|
25334
|
-
flattenData,
|
|
25335
|
-
getRowByFlattenIndex,
|
|
25336
|
-
allCellProps,
|
|
25337
|
-
tabGuardTopRef,
|
|
25338
|
-
tabGuardBottomRef
|
|
25339
|
-
} = params;
|
|
25340
|
-
const endFlattenIndex = computed(
|
|
25341
|
-
() => {
|
|
25342
|
-
var _a;
|
|
25343
|
-
return (_a = flattenData.value[flattenData.value.length - 1]) == null ? void 0 : _a.flattenIndex;
|
|
25344
|
-
}
|
|
25345
|
-
);
|
|
25346
|
-
const startFlattenIndex = computed(() => {
|
|
25347
|
-
var _a;
|
|
25348
|
-
return (_a = flattenData.value[0]) == null ? void 0 : _a.flattenIndex;
|
|
25349
|
-
});
|
|
25350
|
-
const getNextCellToFocus = (keyCode, focusedCell, ctrlPressed = false) => ctrlPressed ? h2(keyCode, focusedCell) : m(keyCode, focusedCell);
|
|
25351
|
-
const h2 = (keyCode, focusedCell) => {
|
|
25352
|
-
const isUp = keyCode === KeyCode.UP;
|
|
25353
|
-
const isDown = keyCode === KeyCode.DOWN;
|
|
25354
|
-
const isLeft = keyCode === KeyCode.LEFT;
|
|
25355
|
-
let column, rowIndex;
|
|
25356
|
-
if (isUp || isDown) {
|
|
25357
|
-
rowIndex = isUp ? startFlattenIndex.value : endFlattenIndex.value;
|
|
25358
|
-
column = focusedCell.column;
|
|
25359
|
-
} else {
|
|
25360
|
-
rowIndex = focusedCell.rowIndex;
|
|
25361
|
-
column = isLeft !== false ? allDisplayedColumns.value[0] : allDisplayedColumns.value[allDisplayedColumns.value.length - 1];
|
|
25362
|
-
}
|
|
25363
|
-
return { rowIndex, rowPinned: null, column };
|
|
25364
|
-
};
|
|
25365
|
-
const m = (keyCode, focusedCell) => {
|
|
25366
|
-
let cell = focusedCell;
|
|
25367
|
-
let o2 = false;
|
|
25368
|
-
for (; !o2; ) {
|
|
25369
|
-
switch (keyCode) {
|
|
25370
|
-
case KeyCode.UP:
|
|
25371
|
-
cell = getCellAbove(cell);
|
|
25372
|
-
break;
|
|
25373
|
-
case KeyCode.DOWN:
|
|
25374
|
-
case KeyCode.ENTER:
|
|
25375
|
-
cell = x(cell);
|
|
25376
|
-
break;
|
|
25377
|
-
case KeyCode.RIGHT:
|
|
25378
|
-
cell = w(cell);
|
|
25379
|
-
break;
|
|
25380
|
-
case KeyCode.LEFT:
|
|
25381
|
-
cell = g(cell);
|
|
25382
|
-
break;
|
|
25383
|
-
default:
|
|
25384
|
-
cell = null;
|
|
25385
|
-
console.warn("Table: unknown key for navigation " + keyCode);
|
|
25386
|
-
}
|
|
25387
|
-
o2 = !cell || y(cell);
|
|
25388
|
-
}
|
|
25389
|
-
return cell;
|
|
25390
|
-
}, y = (e3) => {
|
|
25391
|
-
let t2;
|
|
25392
|
-
switch (e3.rowPinned) {
|
|
25393
|
-
case "top":
|
|
25394
|
-
case "bottom":
|
|
25395
|
-
break;
|
|
25396
|
-
default:
|
|
25397
|
-
t2 = getRowByFlattenIndex(e3.rowIndex);
|
|
25398
|
-
}
|
|
25399
|
-
return !!t2;
|
|
25400
|
-
}, g = (e3) => {
|
|
25401
|
-
if (!e3) return null;
|
|
25402
|
-
const n2 = getDisplayedColBefore(e3.column);
|
|
25403
|
-
return n2 ? { rowIndex: e3.rowIndex, column: n2, rowPinned: e3.rowPinned } : null;
|
|
25404
|
-
}, w = (e3) => {
|
|
25405
|
-
if (!e3) return null;
|
|
25406
|
-
const t2 = getDisplayedColAfter(e3.column);
|
|
25407
|
-
return t2 ? { rowIndex: e3.rowIndex, column: t2, rowPinned: e3.rowPinned } : null;
|
|
25408
|
-
}, x = (e3) => {
|
|
25409
|
-
if (!e3) return null;
|
|
25410
|
-
const t2 = getRowBelow(e3);
|
|
25411
|
-
return t2 ? { rowIndex: t2.rowIndex, column: e3.column, rowPinned: t2.rowPinned } : null;
|
|
25412
|
-
}, getRowBelow = (e3) => {
|
|
25413
|
-
const t2 = e3.rowIndex, n2 = e3.rowPinned;
|
|
25414
|
-
return C(e3) ? null : { rowIndex: t2 + 1, rowPinned: n2 };
|
|
25415
|
-
}, C = (e3) => {
|
|
25416
|
-
const t2 = e3.rowIndex;
|
|
25417
|
-
return endFlattenIndex.value <= t2;
|
|
25418
|
-
}, getRowAbove = (e3) => {
|
|
25419
|
-
const t2 = e3.rowIndex, n2 = e3.rowPinned;
|
|
25420
|
-
return (n2 ? 0 === t2 : t2 === startFlattenIndex.value) ? null : { rowIndex: t2 - 1, rowPinned: n2 };
|
|
25421
|
-
}, getCellAbove = (e3) => {
|
|
25422
|
-
if (!e3) return null;
|
|
25423
|
-
const t2 = getRowAbove({
|
|
25424
|
-
rowIndex: e3.rowIndex,
|
|
25425
|
-
rowPinned: e3.rowPinned
|
|
25426
|
-
});
|
|
25427
|
-
return t2 ? { rowIndex: t2.rowIndex, column: e3.column, rowPinned: t2.rowPinned } : null;
|
|
25428
|
-
}, k = (e3) => e3.rowIndex >= startFlattenIndex.value && e3.rowIndex <= endFlattenIndex.value, getNextTabbedCell = (e3, t2) => t2 ? K(e3) : _(e3), _ = (e3) => {
|
|
25429
|
-
const t2 = allDisplayedColumns.value;
|
|
25430
|
-
let l2 = e3.rowIndex, r2 = e3.rowPinned, a2 = getDisplayedColAfter(e3.column);
|
|
25431
|
-
if (!a2) {
|
|
25432
|
-
a2 = t2[0];
|
|
25433
|
-
const n2 = getRowBelow(e3);
|
|
25434
|
-
if (!n2) return null;
|
|
25435
|
-
if (!n2.rowPinned && !k(n2)) return null;
|
|
25436
|
-
l2 = n2 ? n2.rowIndex : null, r2 = n2 ? n2.rowPinned : null;
|
|
25437
|
-
}
|
|
25438
|
-
return { rowIndex: l2, column: a2, rowPinned: r2 };
|
|
25439
|
-
}, K = (e3) => {
|
|
25440
|
-
const n2 = allDisplayedColumns.value;
|
|
25441
|
-
let l2 = e3.rowIndex, r2 = e3.rowPinned, a2 = getDisplayedColBefore(e3.column);
|
|
25442
|
-
if (!a2) {
|
|
25443
|
-
a2 = n2[n2.length - 1];
|
|
25444
|
-
const t2 = getRowAbove({
|
|
25445
|
-
rowIndex: e3.rowIndex,
|
|
25446
|
-
rowPinned: e3.rowPinned
|
|
25447
|
-
});
|
|
25448
|
-
if (!t2) return null;
|
|
25449
|
-
if (!t2.rowPinned && !k(t2)) return null;
|
|
25450
|
-
l2 = t2 ? t2.rowIndex : null, r2 = t2 ? t2.rowPinned : null;
|
|
25451
|
-
}
|
|
25452
|
-
return { rowIndex: l2, column: a2, rowPinned: r2 };
|
|
25453
|
-
}, O = (e3) => {
|
|
25454
|
-
const t2 = ((e4) => {
|
|
25455
|
-
let t3, n2;
|
|
25456
|
-
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 = [];
|
|
25457
|
-
if (r2 > 1) {
|
|
25458
|
-
const t4 = allDisplayedColumns.value.findIndex(
|
|
25459
|
-
(t5) => t5.columnKey === e4.column.columnKey
|
|
25460
|
-
);
|
|
25461
|
-
for (let e5 = 0; e5 < r2; e5++) a2.push(allDisplayedColumns.value[t4 + e5]);
|
|
25462
|
-
} else a2.push(e4.column);
|
|
25463
|
-
return a2.filter((e5) => !!e5);
|
|
25464
|
-
})(e3);
|
|
25465
|
-
return 1 === t2.length ? e3 : {
|
|
25466
|
-
rowIndex: e3.rowIndex,
|
|
25467
|
-
column: t2[t2.length - 1],
|
|
25468
|
-
rowPinned: e3.rowPinned
|
|
25469
|
-
};
|
|
25470
|
-
}, P = (e3) => {
|
|
25471
|
-
let t2;
|
|
25472
|
-
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;
|
|
25473
|
-
return !!n2 && 0 !== l2 && !n2.isExpandRow;
|
|
25474
|
-
}, tabToNextCellCommon = (e3, t2) => $(e3, t2), $ = (e3, t2) => {
|
|
25475
|
-
const n2 = T(e3, t2);
|
|
25476
|
-
return n2 && focusCell(n2), !!n2;
|
|
25477
|
-
}, T = (t2, n2) => {
|
|
25478
|
-
let o2 = t2;
|
|
25479
|
-
for (; o2 && (o2 === t2 || !P(o2)); ) n2 || (o2 = O(o2)), o2 = getNextTabbedCell(o2, n2);
|
|
25480
|
-
return o2 ? o2.rowIndex < 0 ? null : (params.ensureCellVisible(o2), setRangeToCell(o2), o2) : null;
|
|
25481
|
-
};
|
|
25482
|
-
return {
|
|
25483
|
-
getNextCellToFocus,
|
|
25484
|
-
getNextTabbedCell,
|
|
25485
|
-
getLastBodyCell: () => ({ rowIndex: endFlattenIndex.value, rowPinned: null }),
|
|
25486
|
-
navigateToNextCell: (t2, n2) => {
|
|
25487
|
-
const o2 = t2.keyCode;
|
|
25488
|
-
let r2 = n2, a2 = false;
|
|
25489
|
-
for (; r2 && (r2 === n2 || !P(r2)); )
|
|
25490
|
-
o2 === KeyCode.RIGHT && (r2 = O(r2)), r2 = getNextCellToFocus(o2, r2), a2 = !r2;
|
|
25491
|
-
a2 && t2 && o2 === KeyCode.UP && (r2 = { rowIndex: -1, rowPinned: null, column: n2.column }), r2 && (r2.rowIndex < 0 || (params.ensureCellVisible(r2), setRangeToCell(r2)));
|
|
25492
|
-
},
|
|
25493
|
-
onTabKeyDown: (e3, t2) => {
|
|
25494
|
-
let n2, o2;
|
|
25495
|
-
const l2 = t2.shiftKey;
|
|
25496
|
-
tabToNextCellCommon(e3, l2) || (l2 ? null === (n2 = tabGuardTopRef.value) || void 0 === n2 || n2.focus() : null === (o2 = tabGuardBottomRef.value) || void 0 === o2 || o2.focus()), t2.preventDefault();
|
|
25497
|
-
},
|
|
25498
|
-
tabToNextCellCommon,
|
|
25499
|
-
getFirstCellToFocus: (t2) => {
|
|
25500
|
-
const n2 = (() => {
|
|
25501
|
-
const e3 = getRowByFlattenIndex(startFlattenIndex.value), t3 = allDisplayedColumns.value[0];
|
|
25502
|
-
return e3 && t3 ? { rowIndex: e3.rowIndex, rowPinned: null, column: t3 } : null;
|
|
25503
|
-
})();
|
|
25504
|
-
P(n2) ? (params.ensureCellVisible(n2), setRangeToCell(n2)) : n2 && tabToNextCellCommon(n2, t2);
|
|
25505
|
-
},
|
|
25506
|
-
getLastCellToFocus: (t2) => {
|
|
25507
|
-
const n2 = (() => {
|
|
25508
|
-
const e3 = getRowByFlattenIndex(endFlattenIndex.value), t3 = allDisplayedColumns.value[allDisplayedColumns.value.length - 1];
|
|
25509
|
-
return e3 && t3 ? { rowIndex: e3.rowIndex, rowPinned: null, column: t3 } : null;
|
|
25510
|
-
})();
|
|
25511
|
-
P(n2) ? (params.ensureCellVisible(n2), setRangeToCell(n2)) : n2 && tabToNextCellCommon(n2, t2);
|
|
25512
|
-
},
|
|
25513
|
-
getRowAbove,
|
|
25514
|
-
getCellAbove,
|
|
25515
|
-
getRowBelow
|
|
25516
|
-
};
|
|
25517
|
-
};
|
|
25518
|
-
|
|
25519
|
-
const useAutoScroll = (params) => {
|
|
25520
|
-
const {
|
|
25521
|
-
scrollContainer,
|
|
25522
|
-
scrollAxis,
|
|
25523
|
-
onScrollCallback = () => {
|
|
25524
|
-
},
|
|
25525
|
-
showVerticalScrollbar,
|
|
25526
|
-
showHorizontalScrollbar
|
|
25527
|
-
} = params;
|
|
25528
|
-
let timer = null;
|
|
25529
|
-
let i = 0;
|
|
25530
|
-
let hasLeft = false;
|
|
25531
|
-
let hasRight = false;
|
|
25532
|
-
let hasTop = false;
|
|
25533
|
-
let hasBottom = false;
|
|
25534
|
-
const isXAxis = -1 !== scrollAxis.indexOf("x");
|
|
25535
|
-
const isYAxis = -1 !== scrollAxis.indexOf("y");
|
|
25536
|
-
const scrollByTick = computed(() => {
|
|
25537
|
-
var _a, _b;
|
|
25538
|
-
return (_b = (_a = params.scrollByTick) == null ? void 0 : _a.value) != null ? _b : 20;
|
|
25539
|
-
});
|
|
25540
|
-
const exec = () => {
|
|
25541
|
-
if (null === timer) {
|
|
25542
|
-
timer = window.setInterval(handle, 100);
|
|
25543
|
-
i = 0;
|
|
25544
|
-
}
|
|
25545
|
-
};
|
|
25546
|
-
const handle = () => {
|
|
25547
|
-
i++;
|
|
25548
|
-
const boundary = i > 20 ? 200 : i > 10 ? 80 : 40;
|
|
25549
|
-
if (isYAxis) {
|
|
25550
|
-
const position = params.getVerticalPosition();
|
|
25551
|
-
hasTop && params.setVerticalPosition(position - boundary), hasBottom && params.setVerticalPosition(position + boundary);
|
|
25552
|
-
}
|
|
25553
|
-
if (isXAxis) {
|
|
25554
|
-
const position = params.getHorizontalPosition();
|
|
25555
|
-
hasLeft && params.setHorizontalPosition(position - boundary), hasRight && params.setHorizontalPosition(position + boundary);
|
|
25556
|
-
}
|
|
25557
|
-
onScrollCallback();
|
|
25558
|
-
};
|
|
25559
|
-
const clear = () => {
|
|
25560
|
-
if (timer) {
|
|
25561
|
-
window.clearInterval(timer);
|
|
25562
|
-
timer = null;
|
|
25563
|
-
}
|
|
25564
|
-
};
|
|
25565
|
-
return {
|
|
25566
|
-
check: (mouseEvent, forceSkipVerticalScroll = false) => {
|
|
25567
|
-
const hasVerticalScroll = forceSkipVerticalScroll || !showVerticalScrollbar.value;
|
|
25568
|
-
if (hasVerticalScroll && !showHorizontalScrollbar.value) return;
|
|
25569
|
-
const clientRect = scrollContainer.value.getBoundingClientRect();
|
|
25570
|
-
const tick = scrollByTick.value;
|
|
25571
|
-
hasLeft = mouseEvent.clientX < clientRect.left + tick;
|
|
25572
|
-
hasRight = mouseEvent.clientX > clientRect.right - tick;
|
|
25573
|
-
hasTop = mouseEvent.clientY < clientRect.top + tick && !hasVerticalScroll;
|
|
25574
|
-
hasBottom = mouseEvent.clientY > clientRect.bottom - tick && !hasVerticalScroll;
|
|
25575
|
-
return hasLeft || hasRight || hasTop || hasBottom ? exec() : clear();
|
|
25576
|
-
},
|
|
25577
|
-
ensureCleared: clear
|
|
25578
|
-
};
|
|
25579
|
-
};
|
|
25580
|
-
|
|
25581
|
-
const isOverFormFieldElement = (mouseEvent) => {
|
|
25582
|
-
var _a, _b;
|
|
25583
|
-
const tagName = (_b = (_a = mouseEvent.target) == null ? void 0 : _a.tagName) == null ? void 0 : _b.toLocaleLowerCase();
|
|
25584
|
-
return !!(tagName == null ? void 0 : tagName.match("^a$|textarea|input|select|button"));
|
|
25585
|
-
};
|
|
25586
|
-
const useDragSelection = (params) => {
|
|
25587
|
-
let dragging = false;
|
|
25588
|
-
let cacheStartTouch = null;
|
|
25589
|
-
let startTarget = null;
|
|
25590
|
-
let cacheTouch;
|
|
25591
|
-
const destroyHandlers = [];
|
|
25592
|
-
const batchEvent = (eventList) => {
|
|
25593
|
-
eventList.forEach((config) => {
|
|
25594
|
-
const { target, type, listener, options } = config;
|
|
25595
|
-
target.addEventListener(type, listener, options);
|
|
25596
|
-
});
|
|
25597
|
-
destroyHandlers.push(() => {
|
|
25598
|
-
eventList.forEach((config) => {
|
|
25599
|
-
const { target, type, listener, options } = config;
|
|
25600
|
-
target.removeEventListener(type, listener, options);
|
|
25601
|
-
});
|
|
25602
|
-
});
|
|
25603
|
-
};
|
|
25604
|
-
const getTouch = (touches) => {
|
|
25605
|
-
for (let i = 0; i < touches.length; i++) {
|
|
25606
|
-
if (touches[i].identifier === (cacheTouch == null ? void 0 : cacheTouch.identifier)) {
|
|
25607
|
-
return touches[i];
|
|
25608
|
-
}
|
|
25609
|
-
}
|
|
25610
|
-
return null;
|
|
25611
|
-
};
|
|
25612
|
-
const handleMouseMoveOrTouchMove = (event, cacheEvent) => {
|
|
25613
|
-
if (!dragging) {
|
|
25614
|
-
if (eventsClose(event, cacheEvent, DRAG_BUFF)) {
|
|
25615
|
-
return;
|
|
25616
|
-
}
|
|
25617
|
-
dragging = true;
|
|
25618
|
-
params.onDragStart(cacheEvent);
|
|
25619
|
-
}
|
|
25620
|
-
};
|
|
25621
|
-
const handleMouseUpOrToucheEnd = () => {
|
|
25622
|
-
if (dragging) {
|
|
25623
|
-
dragging = false;
|
|
25624
|
-
}
|
|
25625
|
-
cacheStartTouch = null;
|
|
25626
|
-
startTarget = null;
|
|
25627
|
-
cacheTouch = null;
|
|
25628
|
-
destroyHandlers.forEach((fn) => fn());
|
|
25629
|
-
destroyHandlers.length = 0;
|
|
25630
|
-
};
|
|
25631
|
-
const isOverForm = (event) => !isOverFormFieldElement(event);
|
|
25632
|
-
const mouseMoveHandler = (event) => {
|
|
25633
|
-
if (isOverForm(event)) {
|
|
25634
|
-
event.preventDefault();
|
|
25635
|
-
}
|
|
25636
|
-
handleMouseMoveOrTouchMove(event, cacheStartTouch);
|
|
25637
|
-
};
|
|
25638
|
-
const touchMoveHandler = (event) => {
|
|
25639
|
-
getTouch(event.touches) && handleMouseMoveOrTouchMove(event, cacheStartTouch);
|
|
25640
|
-
};
|
|
25641
|
-
const touchEndHandler = (event) => {
|
|
25642
|
-
getTouch(event.changedTouches) && handleMouseUpOrToucheEnd();
|
|
25643
|
-
};
|
|
25644
|
-
const onBodyMousedown = (e) => {
|
|
25645
|
-
var _a, _b;
|
|
25646
|
-
if (params.level !== ((_a = e.cellInfo) == null ? void 0 : _a.level)) return;
|
|
25647
|
-
if (isOverForm(e)) {
|
|
25648
|
-
e.preventDefault();
|
|
25649
|
-
}
|
|
25650
|
-
dragging = false;
|
|
25651
|
-
cacheStartTouch = e;
|
|
25652
|
-
startTarget = (_b = e.cellInfo) == null ? void 0 : _b.cellTarget;
|
|
25653
|
-
params.bodyElementRef.value;
|
|
25654
|
-
batchEvent([
|
|
25655
|
-
{
|
|
25656
|
-
target: document,
|
|
25657
|
-
type: "mousemove",
|
|
25658
|
-
listener: (e2) => mouseMoveHandler(e2)
|
|
25659
|
-
},
|
|
25660
|
-
{
|
|
25661
|
-
target: document,
|
|
25662
|
-
type: "mouseup",
|
|
25663
|
-
listener: () => {
|
|
25664
|
-
handleMouseUpOrToucheEnd();
|
|
25665
|
-
}
|
|
25666
|
-
},
|
|
25667
|
-
{
|
|
25668
|
-
target: document,
|
|
25669
|
-
type: "contextmenu",
|
|
25670
|
-
listener: (e2) => e2.preventDefault()
|
|
25671
|
-
}
|
|
25672
|
-
]);
|
|
25673
|
-
mouseMoveHandler(e);
|
|
25674
|
-
};
|
|
25675
|
-
let bodyTouchStartHandle;
|
|
25676
|
-
watch(
|
|
25677
|
-
[() => params.bodyElementRef.value, params.enableRangeSelection],
|
|
25678
|
-
([bodyEl], [oldBodyEl]) => {
|
|
25679
|
-
if (oldBodyEl) {
|
|
25680
|
-
oldBodyEl.removeEventListener("mousedown", onBodyMousedown);
|
|
25681
|
-
if (bodyTouchStartHandle) {
|
|
25682
|
-
oldBodyEl.removeEventListener("touchstart", bodyTouchStartHandle);
|
|
25683
|
-
bodyTouchStartHandle = null;
|
|
25684
|
-
destroyHandlers.forEach((fn) => fn());
|
|
25685
|
-
destroyHandlers.length = 0;
|
|
25686
|
-
}
|
|
25687
|
-
}
|
|
25688
|
-
if (bodyEl && params.enableRangeSelection.value) {
|
|
25689
|
-
bodyEl.addEventListener("mousedown", onBodyMousedown);
|
|
25690
|
-
bodyTouchStartHandle = (e3) => {
|
|
25691
|
-
e3.cancelable && (e3.preventDefault(), e3.stopPropagation());
|
|
25692
|
-
};
|
|
25693
|
-
}
|
|
25694
|
-
}
|
|
25695
|
-
);
|
|
25696
|
-
return {
|
|
25697
|
-
onBodyMousedown,
|
|
25698
|
-
onBodyTouchstart: (touchEvent) => {
|
|
25699
|
-
dragging = false;
|
|
25700
|
-
const touch = touchEvent.touches[0];
|
|
25701
|
-
cacheTouch = touch;
|
|
25702
|
-
params.bodyElementRef.value;
|
|
25703
|
-
const endHandle = (event) => touchEndHandler(event);
|
|
25704
|
-
const target = touchEvent.target;
|
|
25705
|
-
const body = document.body;
|
|
25706
|
-
batchEvent([
|
|
25707
|
-
{
|
|
25708
|
-
target: body,
|
|
25709
|
-
type: "touchmove",
|
|
25710
|
-
listener: (e) => {
|
|
25711
|
-
e.cancelable && e.preventDefault();
|
|
25712
|
-
},
|
|
25713
|
-
options: { passive: false }
|
|
25714
|
-
},
|
|
25715
|
-
{
|
|
25716
|
-
target,
|
|
25717
|
-
type: "touchmove",
|
|
25718
|
-
listener: (e) => touchMoveHandler(e),
|
|
25719
|
-
options: { passive: true }
|
|
25720
|
-
},
|
|
25721
|
-
{
|
|
25722
|
-
target,
|
|
25723
|
-
type: "touchend",
|
|
25724
|
-
listener: endHandle,
|
|
25725
|
-
options: { passive: true }
|
|
25726
|
-
},
|
|
25727
|
-
{
|
|
25728
|
-
target,
|
|
25729
|
-
type: "touchcancel",
|
|
25730
|
-
listener: endHandle,
|
|
25731
|
-
options: { passive: true }
|
|
25732
|
-
}
|
|
25733
|
-
]);
|
|
25734
|
-
},
|
|
25735
|
-
getStartTarget: () => startTarget
|
|
25736
|
-
};
|
|
25737
|
-
};
|
|
25738
|
-
|
|
25739
|
-
function classNames(...args) {
|
|
25740
|
-
const classes = [];
|
|
25741
|
-
for (let i = 0; i < args.length; i++) {
|
|
25742
|
-
const value = args[i];
|
|
25743
|
-
if (!value) continue;
|
|
25744
|
-
if (isString(value)) {
|
|
25745
|
-
classes.push(value);
|
|
25746
|
-
} else if (isArray(value)) {
|
|
25747
|
-
for (let i2 = 0; i2 < value.length; i2++) {
|
|
25748
|
-
const inner = classNames(value[i2]);
|
|
25749
|
-
if (inner) {
|
|
25750
|
-
classes.push(inner);
|
|
25751
|
-
}
|
|
25752
|
-
}
|
|
25753
|
-
} else if (isObject(value)) {
|
|
25754
|
-
for (const name in value) {
|
|
25755
|
-
if (value[name]) {
|
|
25756
|
-
classes.push(name);
|
|
25757
|
-
}
|
|
25758
|
-
}
|
|
25759
|
-
}
|
|
25760
|
-
}
|
|
25761
|
-
return classes.join(" ");
|
|
25762
|
-
}
|
|
25763
|
-
|
|
25764
|
-
const RangeSymbolKey = Symbol("rangeSymbolKey");
|
|
25765
|
-
const useProvideRangeStore = (parmas) => {
|
|
25766
|
-
const {
|
|
25767
|
-
allColumns,
|
|
25768
|
-
flattenData,
|
|
25769
|
-
prefixCls,
|
|
25770
|
-
rangeSelection,
|
|
25771
|
-
getRowByFlattenIndex,
|
|
25772
|
-
rootRef,
|
|
25773
|
-
bodyRef,
|
|
25774
|
-
latestRangeStartCell,
|
|
25775
|
-
scrollLeft,
|
|
25776
|
-
scrollTop,
|
|
25777
|
-
scrollTo,
|
|
25778
|
-
showVerticalScrollbar,
|
|
25779
|
-
showHorizontalScrollbar,
|
|
25780
|
-
getIndexsByKey,
|
|
25781
|
-
formatRangeCellText,
|
|
25782
|
-
copyDelimiter
|
|
25783
|
-
} = parmas;
|
|
25784
|
-
const level = useInjectLevel();
|
|
25785
|
-
useAutoScroll({
|
|
25786
|
-
scrollContainer: bodyRef,
|
|
25787
|
-
scrollAxis: "xy",
|
|
25788
|
-
getVerticalPosition: () => scrollTop.value,
|
|
25789
|
-
setVerticalPosition: (pos) => {
|
|
25790
|
-
scrollTo(pos);
|
|
25791
|
-
},
|
|
25792
|
-
getHorizontalPosition: () => scrollLeft.value,
|
|
25793
|
-
setHorizontalPosition: (pos) => scrollTo({ left: pos }),
|
|
25794
|
-
showVerticalScrollbar,
|
|
25795
|
-
showHorizontalScrollbar
|
|
25796
|
-
});
|
|
25797
|
-
const enableRangeSelection = computed(() => !!rangeSelection.value);
|
|
25798
|
-
const singleRangeSelection = computed(() => "single" === rangeSelection.value);
|
|
25799
|
-
const rangeCellClass = computed(() => `${prefixCls.value}-body-cell-range-selected`);
|
|
25800
|
-
const RangeSingleCellClass = computed(() => `${prefixCls.value}-body-cell-range-single-cell`);
|
|
25801
|
-
const RangeTopClass = computed(() => `${prefixCls.value}-body-cell-range-top`);
|
|
25802
|
-
const RangeRIghtClass = computed(() => `${prefixCls.value}-body-cell-range-right`);
|
|
25803
|
-
const RangeBottomClass = computed(() => `${prefixCls.value}-body-cell-range-bottom`);
|
|
25804
|
-
const RangeLeftClass = computed(() => `${prefixCls.value}-body-cell-range-left`);
|
|
25805
|
-
const cellRanges = shallowRef([]);
|
|
25806
|
-
const allDisplayedColumns = computed(
|
|
25807
|
-
() => allColumns.value.filter((col) => !col.__Internal__Column__)
|
|
25808
|
-
);
|
|
25809
|
-
watch(allDisplayedColumns, (newValue) => {
|
|
25810
|
-
cellRanges.value.forEach((cellRange) => {
|
|
25811
|
-
cellRange.columns = cellRange.columns.filter(
|
|
25812
|
-
(column) => newValue.find((item) => item.columnKey === column.columnKey)
|
|
25813
|
-
);
|
|
25814
|
-
});
|
|
25815
|
-
cellRanges.value = cellRanges.value.filter((cellRange) => cellRange.columns.length > 0);
|
|
25816
|
-
});
|
|
25817
|
-
watch(flattenData, () => {
|
|
25818
|
-
const lastIndex = flattenData.value.length - 1;
|
|
25819
|
-
cellRanges.value.forEach((cellRange) => {
|
|
25820
|
-
const { startRow, endRow } = cellRange;
|
|
25821
|
-
if (startRow.rowIndex > lastIndex) {
|
|
25822
|
-
cellRange.startRow = null;
|
|
25823
|
-
}
|
|
25824
|
-
if (endRow.rowIndex > lastIndex) {
|
|
25825
|
-
cellRange.endRow = null;
|
|
25826
|
-
}
|
|
25827
|
-
});
|
|
25828
|
-
cellRanges.value = cellRanges.value.filter(
|
|
25829
|
-
(cellRange) => cellRange.startRow && cellRange.endRow
|
|
25830
|
-
);
|
|
25831
|
-
});
|
|
25832
|
-
const onDragStart = (mouseEvent) => {
|
|
25833
|
-
var _a;
|
|
25834
|
-
(_a = mouseEvent.cellInfo) == null ? void 0 : _a.level;
|
|
25835
|
-
if (!enableRangeSelection.value) return;
|
|
25836
|
-
const { ctrlKey, metaKey, shiftKey } = mouseEvent;
|
|
25837
|
-
const ctrlOrMetaKey = ctrlKey || metaKey;
|
|
25838
|
-
const isMultiple = !singleRangeSelection.value && ctrlOrMetaKey;
|
|
25839
|
-
const rangeLength = cellRanges.value.length;
|
|
25840
|
-
const isRangeSelected = shiftKey && rangeLength > 0;
|
|
25841
|
-
if (!(isMultiple || isRangeSelected)) {
|
|
25842
|
-
clearAllSelectedRange();
|
|
25843
|
-
}
|
|
25844
|
-
mouseEvent.cellInfo.cellPosition;
|
|
25845
|
-
return;
|
|
25846
|
-
};
|
|
25847
|
-
const onDragging = (mouseEvent) => {
|
|
25848
|
-
return;
|
|
25849
|
-
};
|
|
25850
|
-
const onDragStop = () => {
|
|
25851
|
-
};
|
|
25852
|
-
const isSelectedEmpty = computed(() => 0 === cellRanges.value.length);
|
|
25853
|
-
const Y = computed(() => {
|
|
25854
|
-
const length = cellRanges.value.length;
|
|
25855
|
-
if (0 === length) return false;
|
|
25856
|
-
if (length > 1) return true;
|
|
25857
|
-
const first = cellRanges.value[0];
|
|
25858
|
-
const n = le(first);
|
|
25859
|
-
const o = re2(first);
|
|
25860
|
-
return n.rowPinned !== o.rowPinned || n.rowIndex !== o.rowIndex || 1 !== (first == null ? void 0 : first.columns.length);
|
|
25861
|
-
});
|
|
25862
|
-
useDragSelection({
|
|
25863
|
-
onDragStart,
|
|
25864
|
-
onDragging,
|
|
25865
|
-
onDragStop,
|
|
25866
|
-
rootElementRef: rootRef,
|
|
25867
|
-
bodyElementRef: bodyRef,
|
|
25868
|
-
level,
|
|
25869
|
-
enableRangeSelection
|
|
25870
|
-
});
|
|
25871
|
-
const X = (startRow, endRow) => {
|
|
25872
|
-
switch (startRow.rowPinned) {
|
|
25873
|
-
case "top":
|
|
25874
|
-
if ("top" !== endRow.rowPinned) return true;
|
|
25875
|
-
break;
|
|
25876
|
-
case "bottom":
|
|
25877
|
-
if ("bottom" !== endRow.rowPinned) return false;
|
|
25878
|
-
break;
|
|
25879
|
-
default:
|
|
25880
|
-
if (endRow.rowPinned) {
|
|
25881
|
-
return "top" !== endRow.rowPinned;
|
|
25882
|
-
}
|
|
25883
|
-
}
|
|
25884
|
-
return startRow.rowIndex < endRow.rowIndex;
|
|
25885
|
-
};
|
|
25886
|
-
const q = (e3) => {
|
|
25887
|
-
let t2;
|
|
25888
|
-
return e3.forEach((e4) => {
|
|
25889
|
-
(void 0 === t2 || X(t2, e4)) && (t2 = e4);
|
|
25890
|
-
}), t2;
|
|
25891
|
-
};
|
|
25892
|
-
const Q = (e3) => {
|
|
25893
|
-
let t2;
|
|
25894
|
-
return e3.forEach((e4) => {
|
|
25895
|
-
(void 0 === t2 || X(e4, t2)) && (t2 = e4);
|
|
25896
|
-
}), t2;
|
|
25897
|
-
};
|
|
25898
|
-
const Z = (e3, t2) => !e3 && !t2 || !(e3 && !t2 || !e3 && t2) && e3.rowIndex === t2.rowIndex && e3.rowPinned == t2.rowPinned;
|
|
25899
|
-
const J = (e3, t2) => {
|
|
25900
|
-
let n, o;
|
|
25901
|
-
const l2 = e3 === t2 || e3.columnKey === t2.columnKey, r2 = allDisplayedColumns.value.findIndex((t3) => t3.columnKey === e3.columnKey);
|
|
25902
|
-
if (r2 < 0)
|
|
25903
|
-
return void console.warn(
|
|
25904
|
-
`Table: column ${null !== (n = e3.originColumn.key) && void 0 !== n ? n : e3.originColumn.dataIndex} is not valid`
|
|
25905
|
-
);
|
|
25906
|
-
const a2 = l2 ? r2 : allDisplayedColumns.value.findIndex((e4) => e4.columnKey === t2.columnKey);
|
|
25907
|
-
if (a2 < 0)
|
|
25908
|
-
return void console.warn(
|
|
25909
|
-
`Table: column ${null !== (o = t2.originColumn.key) && void 0 !== o ? o : t2.originColumn.dataIndex} is not valid`
|
|
25910
|
-
);
|
|
25911
|
-
if (l2) return [e3];
|
|
25912
|
-
const i2 = Math.min(r2, a2), s2 = i2 === r2 ? a2 : r2, u2 = [];
|
|
25913
|
-
for (let e4 = i2; e4 <= s2; e4++) u2.push(allDisplayedColumns.value[e4]);
|
|
25914
|
-
return u2;
|
|
25915
|
-
};
|
|
25916
|
-
const setRangeToCell = (e3, t2 = false) => {
|
|
25917
|
-
if (!enableRangeSelection.value) return;
|
|
25918
|
-
const n = J(e3.column, e3.column);
|
|
25919
|
-
if (!n) return;
|
|
25920
|
-
if (latestRangeStartCell.value === e3) return;
|
|
25921
|
-
!singleRangeSelection.value && t2 || (cellRanges.value = []);
|
|
25922
|
-
const o = { rowIndex: e3.rowIndex, rowPinned: e3.rowPinned }, l2 = { startRow: o, endRow: o, columns: n, startColumn: e3.column };
|
|
25923
|
-
cellRanges.value.push(l2), latestRangeStartCell.value = e3, triggerRef(cellRanges);
|
|
25924
|
-
};
|
|
25925
|
-
const te = (e3, t2) => {
|
|
25926
|
-
const n = t2.column, o = J(e3.startColumn, n);
|
|
25927
|
-
o && !ne(e3, t2) && (e3.columns = o, e3.endRow = { rowIndex: t2.rowIndex, rowPinned: t2.rowPinned }, triggerRef(cellRanges));
|
|
25928
|
-
};
|
|
25929
|
-
const ne = (e3, t2) => {
|
|
25930
|
-
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;
|
|
25931
|
-
return t2.column === s2 && r2;
|
|
25932
|
-
};
|
|
25933
|
-
const oe = (e3, t2) => {
|
|
25934
|
-
const n = null !== t2.columns && t2.columns.find((t3) => t3.columnKey === e3.column.columnKey), o = ae2(e3.rowIndex, e3.rowPinned, t2);
|
|
25935
|
-
return n && o;
|
|
25936
|
-
};
|
|
25937
|
-
const le = (cellRange) => {
|
|
25938
|
-
var _a;
|
|
25939
|
-
if (cellRange.startRow && cellRange.endRow) {
|
|
25940
|
-
return X(cellRange.startRow, cellRange.endRow) ? cellRange.startRow : cellRange.endRow;
|
|
25941
|
-
}
|
|
25942
|
-
return { rowIndex: (_a = flattenData.value[0]) == null ? void 0 : _a.rowIndex, rowPinned: null };
|
|
25943
|
-
};
|
|
25944
|
-
const re2 = (e3) => {
|
|
25945
|
-
var _a;
|
|
25946
|
-
return e3.startRow && e3.endRow ? X(e3.startRow, e3.endRow) ? e3.endRow : e3.startRow : {
|
|
25947
|
-
rowIndex: (_a = flattenData.value[flattenData.value.length - 1]) == null ? void 0 : _a.rowIndex,
|
|
25948
|
-
rowPinned: null
|
|
25949
|
-
};
|
|
25950
|
-
};
|
|
25951
|
-
const ae2 = (e3, t2, n) => {
|
|
25952
|
-
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;
|
|
25953
|
-
if (a2 || i2) return true;
|
|
25954
|
-
const s2 = !X(r2, o), u2 = X(r2, l2);
|
|
25955
|
-
return s2 && u2;
|
|
25956
|
-
};
|
|
25957
|
-
const getCellRangeCount = (cell2) => isSelectedEmpty.value ? 0 : cellRanges.value.filter((cellRange) => oe(cell2, cellRange)).length;
|
|
25958
|
-
const getDisplayedColBefore = (e3) => {
|
|
25959
|
-
const t2 = allDisplayedColumns.value, n = t2.findIndex((t3) => t3.columnKey === e3.columnKey);
|
|
25960
|
-
return n > 0 ? t2[n - 1] : null;
|
|
25961
|
-
};
|
|
25962
|
-
const getDisplayedColAfter = (e3) => {
|
|
25963
|
-
const t2 = allDisplayedColumns.value, n = t2.findIndex((t3) => t3.columnKey === e3.columnKey);
|
|
25964
|
-
return n < t2.length - 1 ? t2[n + 1] : null;
|
|
25965
|
-
};
|
|
25966
|
-
const ce2 = (e3) => {
|
|
25967
|
-
if (null == e3) return null;
|
|
25968
|
-
const t2 = allDisplayedColumns.value.find((t3) => t3.columnKey === e3);
|
|
25969
|
-
return t2 || console.warn("Table: could not find column " + e3), t2;
|
|
25970
|
-
};
|
|
25971
|
-
const de2 = () => cellRanges.value;
|
|
25972
|
-
const clearAllSelectedRange = () => {
|
|
25973
|
-
cellRanges.value = [];
|
|
25974
|
-
};
|
|
25975
|
-
const appendCellToSelectedRange = (e3) => {
|
|
25976
|
-
if (!enableRangeSelection.value) return;
|
|
25977
|
-
const t2 = ((e4) => {
|
|
25978
|
-
let t3, n = false;
|
|
25979
|
-
if (e4.columnsKey) t3 = e4.columnsKey.map((e5) => ce2(e5)).filter((e5) => e5);
|
|
25980
|
-
else {
|
|
25981
|
-
const o = ce2(e4.columnStartKey), l2 = ce2(e4.columnEndKey);
|
|
25982
|
-
if (!o || !l2) return;
|
|
25983
|
-
t3 = J(o, l2), t3 && t3.length && (n = t3[0] !== o);
|
|
25984
|
-
}
|
|
25985
|
-
if (!t3) return;
|
|
25986
|
-
return {
|
|
25987
|
-
startRow: null != e4.rowStartIndex ? { rowIndex: e4.rowStartIndex, rowPinned: null } : void 0,
|
|
25988
|
-
endRow: null != e4.rowEndIndex ? { rowIndex: e4.rowEndIndex, rowPinned: null } : void 0,
|
|
25989
|
-
columns: t3,
|
|
25990
|
-
startColumn: n ? t3[t3.length - 1] : t3[0]
|
|
25991
|
-
};
|
|
25992
|
-
})(e3);
|
|
25993
|
-
t2 && (t2.startRow && (latestRangeStartCell.value = {
|
|
25994
|
-
rowIndex: t2.startRow.rowIndex,
|
|
25995
|
-
rowPinned: t2.startRow.rowPinned,
|
|
25996
|
-
column: t2.startColumn
|
|
25997
|
-
}), cellRanges.value.push(t2));
|
|
25998
|
-
};
|
|
25999
|
-
const fe2 = (e3) => {
|
|
26000
|
-
enableRangeSelection.value && (clearAllSelectedRange(), appendCellToSelectedRange(e3));
|
|
26001
|
-
};
|
|
26002
|
-
const focusCell = (e3) => {
|
|
26003
|
-
let t2, n;
|
|
26004
|
-
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;
|
|
26005
|
-
if (void 0 !== o && void 0 !== l2 && rootRef.value) {
|
|
26006
|
-
const e4 = rootRef.value.querySelector(
|
|
26007
|
-
`[data-row-key="${o}"] [data-column-key="${l2}"][data-level="${level}"]`
|
|
26008
|
-
);
|
|
26009
|
-
if (e4) {
|
|
26010
|
-
const t4 = e4.getElementsByTagName("input")[0];
|
|
26011
|
-
e4.focus();
|
|
26012
|
-
t4 && t4.focus();
|
|
26013
|
-
}
|
|
26014
|
-
}
|
|
26015
|
-
};
|
|
26016
|
-
const intersectLastRange = (fromMouseClick = false) => {
|
|
26017
|
-
if (singleRangeSelection.value) return;
|
|
26018
|
-
if (isSelectedEmpty.value) return;
|
|
26019
|
-
const lastCellRange2 = cellRanges.value[cellRanges.value.length - 1];
|
|
26020
|
-
const n = le(lastCellRange2);
|
|
26021
|
-
const o = re2(lastCellRange2);
|
|
26022
|
-
const l2 = [];
|
|
26023
|
-
cellRanges.value.slice(0, -1).forEach((e4) => {
|
|
26024
|
-
const r2 = le(e4), a2 = re2(e4), i2 = e4.columns, s2 = i2.filter((e5) => -1 === (lastCellRange2 == null ? void 0 : lastCellRange2.columns.indexOf(e5)));
|
|
26025
|
-
if (s2.length !== i2.length)
|
|
26026
|
-
if (X(o, r2) || X(a2, n)) l2.push(e4);
|
|
26027
|
-
else {
|
|
26028
|
-
if (X(r2, n)) {
|
|
26029
|
-
const e5 = {
|
|
26030
|
-
columns: [...i2],
|
|
26031
|
-
startColumn: lastCellRange2 == null ? void 0 : lastCellRange2.startColumn,
|
|
26032
|
-
startRow: Object.assign({}, r2),
|
|
26033
|
-
endRow: navigationService.getRowAbove(n)
|
|
26034
|
-
};
|
|
26035
|
-
l2.push(e5);
|
|
26036
|
-
}
|
|
26037
|
-
if (s2.length > 0) {
|
|
26038
|
-
const e5 = {
|
|
26039
|
-
columns: s2,
|
|
26040
|
-
startColumn: s2.find((e6) => e6.columnKey === (lastCellRange2 == null ? void 0 : lastCellRange2.startColumn.columnKey)) ? lastCellRange2 == null ? void 0 : lastCellRange2.startColumn : s2[0],
|
|
26041
|
-
startRow: q([Object.assign({}, n), Object.assign({}, r2)]),
|
|
26042
|
-
endRow: Q([Object.assign({}, o), Object.assign({}, a2)])
|
|
26043
|
-
};
|
|
26044
|
-
l2.push(e5);
|
|
26045
|
-
}
|
|
26046
|
-
X(o, a2) && l2.push({
|
|
26047
|
-
columns: [...i2],
|
|
26048
|
-
startColumn: lastCellRange2 == null ? void 0 : lastCellRange2.startColumn,
|
|
26049
|
-
startRow: navigationService.getRowBelow(o),
|
|
26050
|
-
endRow: Object.assign({}, a2)
|
|
26051
|
-
});
|
|
26052
|
-
}
|
|
26053
|
-
else l2.push(e4);
|
|
26054
|
-
}), cellRanges.value = l2;
|
|
26055
|
-
};
|
|
26056
|
-
watch(latestRangeStartCell, () => {
|
|
26057
|
-
latestRangeStartCell.value && focusCell(latestRangeStartCell.value);
|
|
26058
|
-
});
|
|
26059
|
-
const ensureCellVisible = (cell2) => {
|
|
26060
|
-
parmas.ensureCellRowVisible(cell2);
|
|
26061
|
-
parmas.ensureCellColumnVisible(cell2);
|
|
26062
|
-
};
|
|
26063
|
-
const navigationService = useCellNavigation({
|
|
26064
|
-
getDisplayedColBefore,
|
|
26065
|
-
getDisplayedColAfter,
|
|
26066
|
-
allDisplayedColumns,
|
|
26067
|
-
setRangeToCell,
|
|
26068
|
-
focusCell,
|
|
26069
|
-
ensureCellVisible,
|
|
26070
|
-
...parmas
|
|
26071
|
-
});
|
|
26072
|
-
provide(RangeSymbolKey, {
|
|
26073
|
-
cellRanges,
|
|
26074
|
-
extendLatestRangeToCell: (e3) => {
|
|
26075
|
-
if (isSelectedEmpty.value || !latestRangeStartCell.value) return;
|
|
26076
|
-
const t2 = cellRanges.value[cellRanges.value.length - 1];
|
|
26077
|
-
te(t2, e3);
|
|
26078
|
-
},
|
|
26079
|
-
setRangeToCell,
|
|
26080
|
-
onDragStart,
|
|
26081
|
-
onDragging,
|
|
26082
|
-
isCellInAnyRange: (cell2) => getCellRangeCount(cell2) > 0,
|
|
26083
|
-
getRangeCellClass: (e3) => {
|
|
26084
|
-
const t2 = getCellRangeCount(e3), n = ((e4) => {
|
|
26085
|
-
let t3 = false, n2 = false, o2 = false, l3 = false;
|
|
26086
|
-
const r3 = e4.column;
|
|
26087
|
-
let a3, i3;
|
|
26088
|
-
a3 = getDisplayedColBefore(r3), i3 = getDisplayedColAfter(r3);
|
|
26089
|
-
const s2 = cellRanges.value.filter((t4) => oe(e4, t4));
|
|
26090
|
-
a3 || (l3 = true), i3 || (n2 = true);
|
|
26091
|
-
for (let r4 = 0; r4 < s2.length && !(t3 && n2 && o2 && l3); r4++) {
|
|
26092
|
-
const u2 = s2[r4], c2 = le(u2), d = re2(u2);
|
|
26093
|
-
!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);
|
|
26094
|
-
}
|
|
26095
|
-
return { top: t3, right: n2, bottom: o2, left: l3 };
|
|
26096
|
-
})(e3), o = 1 === t2 && !Y.value, l2 = !o && n.top, r2 = !o && n.right, a2 = !o && n.bottom, i2 = !o && n.left;
|
|
26097
|
-
return classNames({
|
|
26098
|
-
[rangeCellClass.value]: 0 !== t2,
|
|
26099
|
-
[`${rangeCellClass.value}-1`]: 1 === t2,
|
|
26100
|
-
[`${rangeCellClass.value}-2`]: 2 === t2,
|
|
26101
|
-
[`${rangeCellClass.value}-3`]: 3 === t2,
|
|
26102
|
-
[`${rangeCellClass.value}-4`]: t2 >= 4,
|
|
26103
|
-
[RangeSingleCellClass.value]: o,
|
|
26104
|
-
[RangeTopClass.value]: l2,
|
|
26105
|
-
[RangeRIghtClass.value]: r2,
|
|
26106
|
-
[RangeBottomClass.value]: a2,
|
|
26107
|
-
[RangeLeftClass.value]: i2
|
|
26108
|
-
});
|
|
26109
|
-
},
|
|
26110
|
-
enableRangeSelection,
|
|
26111
|
-
singleRangeSelection,
|
|
26112
|
-
getDisplayedColBefore,
|
|
26113
|
-
getDisplayedColAfter,
|
|
26114
|
-
navigationService,
|
|
26115
|
-
extendLatestRangeInDirection: (e3) => {
|
|
26116
|
-
if (isSelectedEmpty.value || !latestRangeStartCell.value) return;
|
|
26117
|
-
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 = {
|
|
26118
|
-
column: l2.column === r2 ? a2 : r2,
|
|
26119
|
-
rowIndex: i2,
|
|
26120
|
-
rowPinned: s2
|
|
26121
|
-
}, d = navigationService.getNextCellToFocus(t2, u2, n);
|
|
26122
|
-
return d ? (fe2({
|
|
26123
|
-
rowStartIndex: l2.rowIndex,
|
|
26124
|
-
rowEndIndex: d.rowIndex,
|
|
26125
|
-
columnStartKey: l2.column.columnKey,
|
|
26126
|
-
columnEndKey: d.column.columnKey
|
|
26127
|
-
}), d) : void 0;
|
|
26128
|
-
},
|
|
26129
|
-
allDisplayedColumns,
|
|
26130
|
-
focusCell,
|
|
26131
|
-
ensureCellVisible,
|
|
26132
|
-
getCellRangeCount,
|
|
26133
|
-
intersectLastRange,
|
|
26134
|
-
level
|
|
26135
|
-
});
|
|
26136
|
-
const copySelectedRange = () => {
|
|
26137
|
-
const e3 = de2(), t2 = [];
|
|
26138
|
-
let n = "";
|
|
26139
|
-
e3.forEach((e4) => {
|
|
26140
|
-
const { startRow: n2, endRow: o, columns: r2 } = e4, [a2, i2] = [n2.rowIndex, o.rowIndex].sort((e5, t3) => e5 - t3);
|
|
26141
|
-
let s2 = allDisplayedColumns.value.findIndex((e5) => {
|
|
26142
|
-
var _a;
|
|
26143
|
-
return e5.columnKey === ((_a = r2[0]) == null ? void 0 : _a.columnKey);
|
|
26144
|
-
}), u2 = allDisplayedColumns.value.findIndex(
|
|
26145
|
-
(e5) => {
|
|
26146
|
-
var _a;
|
|
26147
|
-
return e5.columnKey === ((_a = r2[r2.length - 1]) == null ? void 0 : _a.columnKey);
|
|
26148
|
-
}
|
|
26149
|
-
);
|
|
26150
|
-
[s2, u2] = [s2, u2].sort((e5, t3) => e5 - t3);
|
|
26151
|
-
const c2 = [];
|
|
26152
|
-
for (let e5 = a2; e5 <= i2; e5++) {
|
|
26153
|
-
const t3 = flattenData.value[e5];
|
|
26154
|
-
if (t3 && !t3.isExpandRow) {
|
|
26155
|
-
const n3 = t3.rowKey, o2 = [], l2 = getIndexsByKey(n3);
|
|
26156
|
-
for (let r3 = s2; r3 <= u2; r3++) {
|
|
26157
|
-
const originColumn = allDisplayedColumns.value[r3].originColumn;
|
|
26158
|
-
const i3 = originColumn.dataIndex ? getPathValue(t3.record, originColumn.dataIndex) : void 0;
|
|
26159
|
-
if (originColumn) {
|
|
26160
|
-
const r4 = {
|
|
26161
|
-
record: t3.record,
|
|
26162
|
-
column: originColumn,
|
|
26163
|
-
index: e5,
|
|
26164
|
-
recordIndexs: l2,
|
|
26165
|
-
key: n3,
|
|
26166
|
-
value: i3
|
|
26167
|
-
};
|
|
26168
|
-
o2.push(formatRangeCellText(r4));
|
|
26169
|
-
}
|
|
26170
|
-
}
|
|
26171
|
-
c2.push(o2.join(copyDelimiter.value));
|
|
26172
|
-
}
|
|
26173
|
-
}
|
|
26174
|
-
t2.push(c2);
|
|
26175
|
-
}), n = t2.map((e4) => e4.join("prefixCls\n")).join("prefixCls\n"), ((e4) => {
|
|
26176
|
-
let t3, n2;
|
|
26177
|
-
const o = document.activeElement, l2 = document.createElement("textarea");
|
|
26178
|
-
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 }));
|
|
26179
|
-
})(n);
|
|
26180
|
-
};
|
|
26181
|
-
return {
|
|
26182
|
-
getSelectedRange: () => {
|
|
26183
|
-
const e3 = de2(), t2 = [];
|
|
26184
|
-
return e3.forEach((e4) => {
|
|
26185
|
-
const { startColumn: n, startRow: o, endRow: r2, columns: a2 } = e4, i2 = flattenData.value[o.rowIndex], s2 = flattenData.value[r2.rowIndex], u2 = {
|
|
26186
|
-
startColumn: n.originColumn,
|
|
26187
|
-
startRow: {
|
|
26188
|
-
rowIndex: i2.rowIndex,
|
|
26189
|
-
recordIndexs: getIndexsByKey(i2.rowKey)
|
|
26190
|
-
},
|
|
26191
|
-
endRow: {
|
|
26192
|
-
rowIndex: s2.rowIndex,
|
|
26193
|
-
recordIndexs: getIndexsByKey(s2.rowKey)
|
|
26194
|
-
},
|
|
26195
|
-
columns: a2.map((e5) => e5.originColumn),
|
|
26196
|
-
flattenData: flattenData.value
|
|
26197
|
-
};
|
|
26198
|
-
t2.push(u2);
|
|
26199
|
-
}), t2;
|
|
26200
|
-
},
|
|
26201
|
-
appendCellToSelectedRange,
|
|
26202
|
-
clearAllSelectedRange,
|
|
26203
|
-
setCellRanges: (e3) => {
|
|
26204
|
-
enableRangeSelection.value && (cellRanges.value = e3);
|
|
26205
|
-
},
|
|
26206
|
-
getCellRangeCount,
|
|
26207
|
-
navigationService,
|
|
26208
|
-
copySelectedRange,
|
|
26209
|
-
onBodyKeydown: (e3) => {
|
|
26210
|
-
if (!e3.ctrlKey && !e3.metaKey || !enableRangeSelection.value) return;
|
|
26211
|
-
if (isOverFormFieldElement(e3)) return;
|
|
26212
|
-
switch (e3.keyCode) {
|
|
26213
|
-
case KeyCode.C:
|
|
26214
|
-
copySelectedRange();
|
|
26215
|
-
break;
|
|
26216
|
-
case KeyCode.A:
|
|
26217
|
-
(() => {
|
|
26218
|
-
if (!enableRangeSelection.value) return;
|
|
26219
|
-
const e4 = allDisplayedColumns.value;
|
|
26220
|
-
0 !== e4.length && fe2({
|
|
26221
|
-
rowStartIndex: 0,
|
|
26222
|
-
rowEndIndex: flattenData.value.length - 1,
|
|
26223
|
-
columnStartKey: e4[0].columnKey,
|
|
26224
|
-
columnEndKey: e4[e4.length - 1].columnKey
|
|
26225
|
-
});
|
|
26226
|
-
})();
|
|
26227
|
-
}
|
|
26228
|
-
e3.preventDefault();
|
|
26229
|
-
}
|
|
26230
|
-
};
|
|
26231
|
-
};
|
|
26232
|
-
const useInjectRangeStore = () => {
|
|
26233
|
-
return inject(RangeSymbolKey, {});
|
|
26234
|
-
};
|
|
26235
|
-
|
|
26236
25666
|
var MapShim = (function() {
|
|
26237
25667
|
if (typeof Map !== "undefined") {
|
|
26238
25668
|
return Map;
|
|
@@ -28676,6 +28106,31 @@ function useData(_props, rowPosition, flattenData, startIndex, endIndex, draggin
|
|
|
28676
28106
|
return { data, pos };
|
|
28677
28107
|
}
|
|
28678
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
|
+
|
|
28679
28134
|
const useCellProps = ({
|
|
28680
28135
|
leftColumns,
|
|
28681
28136
|
rightColumns,
|
|
@@ -28688,6 +28143,10 @@ const useCellProps = ({
|
|
|
28688
28143
|
leftWidth,
|
|
28689
28144
|
centerWidth,
|
|
28690
28145
|
getRowHeight,
|
|
28146
|
+
cancelEditable,
|
|
28147
|
+
startEditable,
|
|
28148
|
+
saveEditable,
|
|
28149
|
+
isEditable,
|
|
28691
28150
|
customCell: contextCustomCell
|
|
28692
28151
|
}) => {
|
|
28693
28152
|
const allCellProps = shallowRef({});
|
|
@@ -28710,6 +28169,10 @@ const useCellProps = ({
|
|
|
28710
28169
|
value,
|
|
28711
28170
|
record,
|
|
28712
28171
|
index: rowIndex,
|
|
28172
|
+
cancelEditable,
|
|
28173
|
+
startEditable,
|
|
28174
|
+
saveEditable,
|
|
28175
|
+
isEditable,
|
|
28713
28176
|
column: originColumn
|
|
28714
28177
|
});
|
|
28715
28178
|
if (customCellRender && isObject$4(customCellRender) && !isArray$2(customCellRender) && !isVNode(customCellRender)) {
|
|
@@ -32187,114 +31650,6 @@ const useInjectBodyRow = () => {
|
|
|
32187
31650
|
return inject(BodyRowContextKey, {});
|
|
32188
31651
|
};
|
|
32189
31652
|
|
|
32190
|
-
const useCellSelection = () => {
|
|
32191
|
-
const {
|
|
32192
|
-
isCellInAnyRange,
|
|
32193
|
-
cellRanges,
|
|
32194
|
-
extendLatestRangeToCell,
|
|
32195
|
-
setRangeToCell,
|
|
32196
|
-
enableRangeSelection,
|
|
32197
|
-
getCellRangeCount,
|
|
32198
|
-
intersectLastRange,
|
|
32199
|
-
level
|
|
32200
|
-
} = useInjectRangeStore();
|
|
32201
|
-
return {
|
|
32202
|
-
onCellMousedown: (mouseEvent, cellPosition) => {
|
|
32203
|
-
const { ctrlKey, metaKey, shiftKey } = mouseEvent;
|
|
32204
|
-
if (!(!isCellInAnyRange(cellPosition) || 2 !== mouseEvent.button)) return;
|
|
32205
|
-
const isRanges = !cellRanges.value.length;
|
|
32206
|
-
if (shiftKey && isRanges) {
|
|
32207
|
-
mouseEvent.preventDefault();
|
|
32208
|
-
}
|
|
32209
|
-
if (shiftKey) {
|
|
32210
|
-
extendLatestRangeToCell(cellPosition);
|
|
32211
|
-
} else {
|
|
32212
|
-
setRangeToCell(cellPosition, ctrlKey || metaKey);
|
|
32213
|
-
}
|
|
32214
|
-
mouseEvent.cellInfo = {
|
|
32215
|
-
cellPosition,
|
|
32216
|
-
cellTarget: mouseEvent.currentTarget,
|
|
32217
|
-
level
|
|
32218
|
-
};
|
|
32219
|
-
},
|
|
32220
|
-
onCellMousemove: (mouseEvent, cellPosition) => {
|
|
32221
|
-
mouseEvent.cellInfo = {
|
|
32222
|
-
cellPosition,
|
|
32223
|
-
cellTarget: mouseEvent.currentTarget,
|
|
32224
|
-
level
|
|
32225
|
-
};
|
|
32226
|
-
},
|
|
32227
|
-
onCellClick: (mouseEvent, cellPosition) => {
|
|
32228
|
-
const mouseKey = mouseEvent.ctrlKey || mouseEvent.metaKey;
|
|
32229
|
-
enableRangeSelection.value && mouseKey && getCellRangeCount(cellPosition) > 1 && intersectLastRange(true);
|
|
32230
|
-
}
|
|
32231
|
-
};
|
|
32232
|
-
};
|
|
32233
|
-
|
|
32234
|
-
const useCellKeyboard = () => {
|
|
32235
|
-
const {
|
|
32236
|
-
enableRangeSelection,
|
|
32237
|
-
navigationService,
|
|
32238
|
-
extendLatestRangeInDirection,
|
|
32239
|
-
focusCell,
|
|
32240
|
-
ensureCellVisible
|
|
32241
|
-
} = useInjectRangeStore();
|
|
32242
|
-
const directionOrEnterHandle = (event, payload) => {
|
|
32243
|
-
if (!payload.isEditing) {
|
|
32244
|
-
event.shiftKey && enableRangeSelection.value ? selectRange(event) : navigationService.navigateToNextCell(event, payload.cellPosition);
|
|
32245
|
-
event.preventDefault();
|
|
32246
|
-
}
|
|
32247
|
-
};
|
|
32248
|
-
const { props } = useInjectTable();
|
|
32249
|
-
const selectRange = (event) => {
|
|
32250
|
-
const latestRange = extendLatestRangeInDirection(event);
|
|
32251
|
-
latestRange && ensureCellVisible(latestRange);
|
|
32252
|
-
};
|
|
32253
|
-
const escHandle = (_, payload) => {
|
|
32254
|
-
payload.isEditing && focusCell(payload.cellPosition);
|
|
32255
|
-
};
|
|
32256
|
-
const tabHandle = (event, payload) => {
|
|
32257
|
-
navigationService.onTabKeyDown(payload.cellPosition, event);
|
|
32258
|
-
};
|
|
32259
|
-
return {
|
|
32260
|
-
onCellKeydown: (event, payload) => {
|
|
32261
|
-
if (props.onCellKeydown && false === props.onCellKeydown(event, {
|
|
32262
|
-
isEditing: payload.isEditing,
|
|
32263
|
-
cellPosition: {
|
|
32264
|
-
column: payload.cellPosition.column.originColumn,
|
|
32265
|
-
rowIndex: payload.cellPosition.rowIndex
|
|
32266
|
-
}
|
|
32267
|
-
})) {
|
|
32268
|
-
return;
|
|
32269
|
-
}
|
|
32270
|
-
const { keyCode } = event;
|
|
32271
|
-
const target = event.target;
|
|
32272
|
-
switch (keyCode) {
|
|
32273
|
-
case KeyCode.RIGHT:
|
|
32274
|
-
case KeyCode.LEFT:
|
|
32275
|
-
if (!("INPUT" === (target == null ? void 0 : target.tagName) || "TEXTAREA" === (target == null ? void 0 : target.tagName) || (target == null ? void 0 : target.isContentEditable))) {
|
|
32276
|
-
directionOrEnterHandle(event, payload);
|
|
32277
|
-
}
|
|
32278
|
-
break;
|
|
32279
|
-
case KeyCode.DOWN:
|
|
32280
|
-
case KeyCode.UP:
|
|
32281
|
-
case KeyCode.ENTER:
|
|
32282
|
-
if (!((target2) => "TEXTAREA" === target2.tagName || target2.isContentEditable)(
|
|
32283
|
-
event.target
|
|
32284
|
-
)) {
|
|
32285
|
-
directionOrEnterHandle(event, payload);
|
|
32286
|
-
}
|
|
32287
|
-
break;
|
|
32288
|
-
case KeyCode.ESC:
|
|
32289
|
-
escHandle(event, payload);
|
|
32290
|
-
break;
|
|
32291
|
-
case KeyCode.TAB:
|
|
32292
|
-
tabHandle(event, payload);
|
|
32293
|
-
}
|
|
32294
|
-
}
|
|
32295
|
-
};
|
|
32296
|
-
};
|
|
32297
|
-
|
|
32298
31653
|
const eventCache = {};
|
|
32299
31654
|
const eventMap = {
|
|
32300
31655
|
select: "input",
|
|
@@ -32311,6 +31666,68 @@ const isEventSupported = (eventName) => {
|
|
|
32311
31666
|
return eventCache[eventName = "on" + eventName] = eventName in dom;
|
|
32312
31667
|
};
|
|
32313
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
|
+
|
|
32314
31731
|
var _sfc_main$o = defineComponent({
|
|
32315
31732
|
name: "RowDragHandler",
|
|
32316
31733
|
props: {
|
|
@@ -32834,188 +32251,6 @@ var BodyCellTooltip = /* @__PURE__ */ defineComponent({
|
|
|
32834
32251
|
}
|
|
32835
32252
|
});
|
|
32836
32253
|
|
|
32837
|
-
var _sfc_main$n = defineComponent({
|
|
32838
|
-
inheritAttrs: false,
|
|
32839
|
-
props: {
|
|
32840
|
-
prefixCls: { type: String },
|
|
32841
|
-
recordIndexs: { type: Array },
|
|
32842
|
-
rowKey: { type: [Number, String] },
|
|
32843
|
-
column: { type: Object, default: () => ({}) },
|
|
32844
|
-
record: { type: Object, default: () => ({}) },
|
|
32845
|
-
value: { validator: () => true },
|
|
32846
|
-
customEditable: { type: Boolean, default: false },
|
|
32847
|
-
multiple: { type: Boolean, default: false },
|
|
32848
|
-
autoHeight: { type: Boolean, default: false },
|
|
32849
|
-
cellKey: { type: String },
|
|
32850
|
-
getPopupContainer: Function,
|
|
32851
|
-
onCloseEditor: Function,
|
|
32852
|
-
onKeydown: Function
|
|
32853
|
-
},
|
|
32854
|
-
emits: ["closeEditor", "keydown"],
|
|
32855
|
-
setup(props, { expose, emit }) {
|
|
32856
|
-
var _a, _b, _c;
|
|
32857
|
-
const tableSlots = useInjectSlots();
|
|
32858
|
-
const popup = useInjectPopup();
|
|
32859
|
-
const oldValue = (_c = (_b = (_a = props.column) == null ? void 0 : _a.valueGetter) == null ? void 0 : _b.call(_a, {
|
|
32860
|
-
value: props.value,
|
|
32861
|
-
record: props.record,
|
|
32862
|
-
column: props.column,
|
|
32863
|
-
recordIndexs: props.recordIndexs
|
|
32864
|
-
})) != null ? _c : props.value;
|
|
32865
|
-
const modelValue = ref(oldValue);
|
|
32866
|
-
const inputRef = shallowRef(null);
|
|
32867
|
-
const tableContext = useInjectTable();
|
|
32868
|
-
onMounted(() => {
|
|
32869
|
-
nextTick(() => {
|
|
32870
|
-
var _a2, _b2, _c2, _d;
|
|
32871
|
-
if (inputRef.value && !props.multiple) {
|
|
32872
|
-
(_b2 = (_a2 = inputRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
|
|
32873
|
-
(_d = (_c2 = inputRef.value) == null ? void 0 : _c2.select) == null ? void 0 : _d.call(_c2);
|
|
32874
|
-
}
|
|
32875
|
-
});
|
|
32876
|
-
});
|
|
32877
|
-
expose({ value: modelValue, inputRef });
|
|
32878
|
-
const onInput = (e, val) => {
|
|
32879
|
-
var _a2, _b2;
|
|
32880
|
-
(_b2 = (_a2 = props.column).valueChange) == null ? void 0 : _b2.call(_a2, e, {
|
|
32881
|
-
column: props.column,
|
|
32882
|
-
record: props.record,
|
|
32883
|
-
recordIndexs: props.recordIndexs,
|
|
32884
|
-
newValue: val,
|
|
32885
|
-
oldValue
|
|
32886
|
-
});
|
|
32887
|
-
};
|
|
32888
|
-
const childrenColumnName = computed(() => tableContext.props.childrenColumnName || "children");
|
|
32889
|
-
const save = () => {
|
|
32890
|
-
var _a2, _b2, _c2;
|
|
32891
|
-
const recordIndexs = props.recordIndexs;
|
|
32892
|
-
let dataSource = tableContext.props.dataSource || [];
|
|
32893
|
-
let record = {};
|
|
32894
|
-
recordIndexs.forEach((index) => {
|
|
32895
|
-
record = dataSource[index];
|
|
32896
|
-
dataSource = record[childrenColumnName.value] || [];
|
|
32897
|
-
});
|
|
32898
|
-
const value = (_c2 = (_b2 = (_a2 = props.column).valueParser) == null ? void 0 : _b2.call(_a2, {
|
|
32899
|
-
column: props.column,
|
|
32900
|
-
record,
|
|
32901
|
-
recordIndexs,
|
|
32902
|
-
newValue: modelValue.value,
|
|
32903
|
-
oldValue
|
|
32904
|
-
})) != null ? _c2 : modelValue.value;
|
|
32905
|
-
const valueSetter = props.column.valueSetter;
|
|
32906
|
-
if (valueSetter) {
|
|
32907
|
-
const result = valueSetter({
|
|
32908
|
-
column: props.column,
|
|
32909
|
-
record,
|
|
32910
|
-
recordIndexs,
|
|
32911
|
-
newValue: modelValue.value,
|
|
32912
|
-
oldValue
|
|
32913
|
-
});
|
|
32914
|
-
if (isPromise(result)) {
|
|
32915
|
-
result.then((res) => {
|
|
32916
|
-
res && emit("closeEditor", [props.cellKey]);
|
|
32917
|
-
}).catch(() => {
|
|
32918
|
-
});
|
|
32919
|
-
return;
|
|
32920
|
-
}
|
|
32921
|
-
result && emit("closeEditor", [props.cellKey]);
|
|
32922
|
-
} else {
|
|
32923
|
-
devWarning(
|
|
32924
|
-
void 0 !== props.column.dataIndex || null !== props.column.dataIndex,
|
|
32925
|
-
"Editable",
|
|
32926
|
-
"If not have column dataIndex, you should to set valueSetter for editable columns, otherwise the value cannot be modified."
|
|
32927
|
-
);
|
|
32928
|
-
set(record, props.column.dataIndex, value);
|
|
32929
|
-
emit("closeEditor", [props.cellKey]);
|
|
32930
|
-
}
|
|
32931
|
-
};
|
|
32932
|
-
let isKeyDown = false;
|
|
32933
|
-
const closeEditor = (key) => {
|
|
32934
|
-
emit("closeEditor", key != null ? key : [props.cellKey]);
|
|
32935
|
-
};
|
|
32936
|
-
return {
|
|
32937
|
-
modelValue,
|
|
32938
|
-
inputRef,
|
|
32939
|
-
handleInput: (e) => {
|
|
32940
|
-
var _a2;
|
|
32941
|
-
onInput(e, (_a2 = e.target) == null ? void 0 : _a2.value);
|
|
32942
|
-
},
|
|
32943
|
-
handleKeyDown: (e) => {
|
|
32944
|
-
const { which } = e;
|
|
32945
|
-
if (which === KeyCode.ENTER) {
|
|
32946
|
-
save();
|
|
32947
|
-
} else {
|
|
32948
|
-
if (which === KeyCode.ESC) {
|
|
32949
|
-
isKeyDown = true;
|
|
32950
|
-
emit("closeEditor", null);
|
|
32951
|
-
}
|
|
32952
|
-
emit("keydown", e);
|
|
32953
|
-
}
|
|
32954
|
-
},
|
|
32955
|
-
handleBlur: () => {
|
|
32956
|
-
isKeyDown || props.multiple || save();
|
|
32957
|
-
},
|
|
32958
|
-
tableSlots,
|
|
32959
|
-
popup,
|
|
32960
|
-
save,
|
|
32961
|
-
closeEditor,
|
|
32962
|
-
getCustomEditorProps: () => ({
|
|
32963
|
-
modelValue,
|
|
32964
|
-
save,
|
|
32965
|
-
onInput,
|
|
32966
|
-
closeEditor,
|
|
32967
|
-
column: props.column.originColumn,
|
|
32968
|
-
editorRef: inputRef,
|
|
32969
|
-
getPopupContainer: props.getPopupContainer,
|
|
32970
|
-
record: props.record,
|
|
32971
|
-
recordIndexs: props.recordIndexs
|
|
32972
|
-
})
|
|
32973
|
-
};
|
|
32974
|
-
}
|
|
32975
|
-
});
|
|
32976
|
-
|
|
32977
|
-
const _hoisted_1$8 = ["data-cell-auto"];
|
|
32978
|
-
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
32979
|
-
return openBlock(), createElementBlock("div", {
|
|
32980
|
-
class: normalizeClass(`${_ctx.prefixCls}-cell-edit-inner`),
|
|
32981
|
-
"data-cell-auto": _ctx.autoHeight
|
|
32982
|
-
}, [
|
|
32983
|
-
_ctx.customEditable ? (openBlock(), createElementBlock(
|
|
32984
|
-
Fragment,
|
|
32985
|
-
{ key: 0 },
|
|
32986
|
-
[
|
|
32987
|
-
_ctx.tableSlots.cellEditor ? (openBlock(), createBlock(
|
|
32988
|
-
resolveDynamicComponent(_ctx.tableSlots.cellEditor),
|
|
32989
|
-
normalizeProps(mergeProps({ key: 0 }, _ctx.getCustomEditorProps())),
|
|
32990
|
-
null,
|
|
32991
|
-
16
|
|
32992
|
-
/* FULL_PROPS */
|
|
32993
|
-
)) : createCommentVNode("v-if", true)
|
|
32994
|
-
],
|
|
32995
|
-
64
|
|
32996
|
-
/* STABLE_FRAGMENT */
|
|
32997
|
-
)) : withDirectives((openBlock(), createElementBlock(
|
|
32998
|
-
"input",
|
|
32999
|
-
{
|
|
33000
|
-
key: 1,
|
|
33001
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
|
|
33002
|
-
ref: "inputRef",
|
|
33003
|
-
class: normalizeClass(`${_ctx.prefixCls}-cell-edit-input`),
|
|
33004
|
-
type: "text",
|
|
33005
|
-
onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleInput && _ctx.handleInput(...args)),
|
|
33006
|
-
onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
|
|
33007
|
-
onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args))
|
|
33008
|
-
},
|
|
33009
|
-
null,
|
|
33010
|
-
34
|
|
33011
|
-
/* CLASS, NEED_HYDRATION */
|
|
33012
|
-
)), [
|
|
33013
|
-
[vModelText, _ctx.modelValue]
|
|
33014
|
-
])
|
|
33015
|
-
], 10, _hoisted_1$8);
|
|
33016
|
-
}
|
|
33017
|
-
var EditInput = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$j]]);
|
|
33018
|
-
|
|
33019
32254
|
const cellProps = {
|
|
33020
32255
|
prefixCls: String,
|
|
33021
32256
|
rowIndex: { type: Number, required: true },
|
|
@@ -33032,41 +32267,30 @@ const cellProps = {
|
|
|
33032
32267
|
tooltipOpen: Boolean,
|
|
33033
32268
|
getPopupContainer: Function,
|
|
33034
32269
|
onCellLeave: Function,
|
|
33035
|
-
editCellKeys: Array,
|
|
33036
|
-
onOpenEditor: Function,
|
|
33037
|
-
onCloseEditor: Function,
|
|
33038
|
-
onMousedown: Function,
|
|
33039
|
-
onMousemove: Function,
|
|
33040
|
-
onKeydown: Function,
|
|
33041
32270
|
onClick: Function
|
|
33042
32271
|
};
|
|
33043
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
|
+
};
|
|
33044
32280
|
const ValueStatusEnum = {
|
|
33045
32281
|
success: "#03bf64",
|
|
33046
32282
|
processing: "#315efb",
|
|
33047
32283
|
error: "#e8353e",
|
|
33048
32284
|
warning: "#eb8903"
|
|
33049
32285
|
};
|
|
33050
|
-
const BodyCell = (props, { slots, emit }) => {
|
|
32286
|
+
const BodyCell$1 = (props, { slots, emit }) => {
|
|
33051
32287
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33052
32288
|
const { table } = useProConfigInject();
|
|
33053
32289
|
const tableSlotsContext = useInjectSlots();
|
|
33054
32290
|
const tableContext = useInjectTable();
|
|
33055
32291
|
const { onBodyCellContextmenu } = useInjectBody();
|
|
33056
|
-
const { getRangeCellClass } = useInjectRangeStore();
|
|
33057
32292
|
const level = useInjectLevel();
|
|
33058
|
-
const {
|
|
33059
|
-
const {
|
|
33060
|
-
prefixCls,
|
|
33061
|
-
column,
|
|
33062
|
-
wrapText,
|
|
33063
|
-
rowKey,
|
|
33064
|
-
item,
|
|
33065
|
-
rowIndex,
|
|
33066
|
-
hasAppendNode,
|
|
33067
|
-
tooltipOpen,
|
|
33068
|
-
editCellKeys
|
|
33069
|
-
} = props;
|
|
32293
|
+
const { prefixCls, column, wrapText, rowKey, item, rowIndex, hasAppendNode, tooltipOpen } = props;
|
|
33070
32294
|
const columnKey = column.columnKey;
|
|
33071
32295
|
const valueEnum = runFunction(column == null ? void 0 : column.valueEnum, props.item);
|
|
33072
32296
|
const rowDrag = typeof column.rowDrag == "function" ? column.rowDrag({ record: item, column: column.originColumn }) : !!column.rowDrag;
|
|
@@ -33076,22 +32300,8 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33076
32300
|
const sorterInfo = { sorterOrder };
|
|
33077
32301
|
const key = `${props.rowKey} ${columnKey}`;
|
|
33078
32302
|
const value = column.dataIndex ? column.renderText ? column.renderText(get(item, column.dataIndex), item, rowIndex) : get(item, column.dataIndex) : void 0;
|
|
33079
|
-
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]);
|
|
33080
32304
|
const recordIndexs = tableContext.getIndexsByKey(rowKey);
|
|
33081
|
-
let customEditable = false;
|
|
33082
|
-
let isEditing = editCellKeys == null ? void 0 : editCellKeys.includes(key);
|
|
33083
|
-
if (isEditing) {
|
|
33084
|
-
const editable = "function" == typeof column.editable && column.editable({
|
|
33085
|
-
record: item,
|
|
33086
|
-
column: column.originColumn,
|
|
33087
|
-
recordIndexs,
|
|
33088
|
-
value
|
|
33089
|
-
});
|
|
33090
|
-
customEditable = "cellEditorSlot" === column.editable || "cellEditorSlot" === editable;
|
|
33091
|
-
isEditing = isEditing && (customEditable && !!tableSlotsContext.cellEditor || true === column.editable || !!editable);
|
|
33092
|
-
}
|
|
33093
|
-
let { editableTrigger = ["dblClick"] } = column;
|
|
33094
|
-
editableTrigger = Array.isArray(editableTrigger) ? editableTrigger : [editableTrigger];
|
|
33095
32305
|
const cellInnerClass = { [`${prefixCls}-cell-inner`]: true };
|
|
33096
32306
|
const cellContentClass = {
|
|
33097
32307
|
[`${prefixCls}-cell-content`]: true,
|
|
@@ -33112,7 +32322,6 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33112
32322
|
const cellRender = ((_b = (_a = tableContext.allCellProps.value) == null ? void 0 : _a[rowKey]) == null ? void 0 : _b[column.columnKey]) || {};
|
|
33113
32323
|
const cellProps2 = cellRender.props || {};
|
|
33114
32324
|
const cellRowSpan = cellProps2.rowSpan;
|
|
33115
|
-
const cellPosition = { rowIndex: props.flattenRowIndex, rowPinned: null, column };
|
|
33116
32325
|
const cellClass = {
|
|
33117
32326
|
[`${prefixCls}-cell`]: true,
|
|
33118
32327
|
[`${prefixCls}-first-cell`]: column.columnIndex === 0,
|
|
@@ -33120,60 +32329,7 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33120
32329
|
[`${prefixCls}-cell-multi`]: cellRowSpan > 1,
|
|
33121
32330
|
[`${prefixCls}-cell-hidden`]: cellRowSpan === 0,
|
|
33122
32331
|
[`${prefixCls}-column-sort`]: sorterInfo.sorterOrder,
|
|
33123
|
-
[`${prefixCls}-with-append`]: hasAppendNode
|
|
33124
|
-
[`${prefixCls}-cell-inline-edit`]: isEditing,
|
|
33125
|
-
[getRangeCellClass(cellPosition)]: true
|
|
33126
|
-
};
|
|
33127
|
-
const openEditor = () => {
|
|
33128
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
33129
|
-
const oldValue = (_c2 = (_b2 = (_a2 = props.column) == null ? void 0 : _a2.valueGetter) == null ? void 0 : _b2.call(_a2, {
|
|
33130
|
-
value,
|
|
33131
|
-
record: item,
|
|
33132
|
-
column,
|
|
33133
|
-
recordIndexs
|
|
33134
|
-
})) != null ? _c2 : value;
|
|
33135
|
-
const beforeOpen = (_e2 = (_d2 = tableContext.props) == null ? void 0 : _d2.onBeforeOpenEditor) == null ? void 0 : _e2.call(_d2, cellRenderArgs);
|
|
33136
|
-
if (isPromise(beforeOpen)) {
|
|
33137
|
-
beforeOpen.then((res) => {
|
|
33138
|
-
var _a3, _b3;
|
|
33139
|
-
if (res) {
|
|
33140
|
-
emit("openEditor", key, { [key]: oldValue });
|
|
33141
|
-
(_b3 = (_a3 = tableContext.props) == null ? void 0 : _a3.onOpenEditor) == null ? void 0 : _b3.call(_a3, cellRenderArgs);
|
|
33142
|
-
}
|
|
33143
|
-
});
|
|
33144
|
-
} else {
|
|
33145
|
-
if (false !== beforeOpen) {
|
|
33146
|
-
emit("openEditor", key, { [key]: oldValue });
|
|
33147
|
-
(_g2 = (_f2 = tableContext.props) == null ? void 0 : _f2.onOpenEditor) == null ? void 0 : _g2.call(_f2, cellRenderArgs);
|
|
33148
|
-
}
|
|
33149
|
-
}
|
|
33150
|
-
};
|
|
33151
|
-
const closeEditor = (currentKey) => {
|
|
33152
|
-
var _a2, _b2, _c2, _d2;
|
|
33153
|
-
const beforeClose = (_b2 = (_a2 = tableContext.props) == null ? void 0 : _a2.onBeforeCloseEditor) == null ? void 0 : _b2.call(_a2, {
|
|
33154
|
-
...cellRenderArgs,
|
|
33155
|
-
oldValue: oldValuesMap.value[key]
|
|
33156
|
-
});
|
|
33157
|
-
if (isPromise(beforeClose)) {
|
|
33158
|
-
beforeClose.then((res) => {
|
|
33159
|
-
var _a3, _b3;
|
|
33160
|
-
if (res) {
|
|
33161
|
-
emit("closeEditor", currentKey != null ? currentKey : key);
|
|
33162
|
-
(_b3 = (_a3 = tableContext.props) == null ? void 0 : _a3.onCloseEditor) == null ? void 0 : _b3.call(_a3, {
|
|
33163
|
-
...cellRenderArgs,
|
|
33164
|
-
oldValue: oldValuesMap.value[key]
|
|
33165
|
-
});
|
|
33166
|
-
}
|
|
33167
|
-
});
|
|
33168
|
-
} else {
|
|
33169
|
-
if (false !== beforeClose) {
|
|
33170
|
-
emit("closeEditor", currentKey != null ? currentKey : key);
|
|
33171
|
-
(_d2 = (_c2 = tableContext.props) == null ? void 0 : _c2.onCloseEditor) == null ? void 0 : _d2.call(_c2, {
|
|
33172
|
-
...cellRenderArgs,
|
|
33173
|
-
oldValue: oldValuesMap.value[key]
|
|
33174
|
-
});
|
|
33175
|
-
}
|
|
33176
|
-
}
|
|
32332
|
+
[`${prefixCls}-with-append`]: hasAppendNode
|
|
33177
32333
|
};
|
|
33178
32334
|
const cellRenderArgs = {
|
|
33179
32335
|
record: item,
|
|
@@ -33184,8 +32340,10 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33184
32340
|
recordIndexs: tableContext.getIndexsByKey(rowKey),
|
|
33185
32341
|
key,
|
|
33186
32342
|
valueStatus,
|
|
33187
|
-
|
|
33188
|
-
|
|
32343
|
+
cancelEditable: tableContext.cancelEditable,
|
|
32344
|
+
startEditable: tableContext.startEditable,
|
|
32345
|
+
saveEditable: tableContext.saveEditable,
|
|
32346
|
+
isEditable: tableContext.isEditable
|
|
33189
32347
|
};
|
|
33190
32348
|
let bodyCell = recordIndexs && ((_c = tableSlotsContext.bodyCell) == null ? void 0 : _c.call(tableSlotsContext, cellRenderArgs)) || [];
|
|
33191
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 : "-" : "";
|
|
@@ -33304,27 +32462,6 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33304
32462
|
} else {
|
|
33305
32463
|
renderCellVNode = cellVNode;
|
|
33306
32464
|
}
|
|
33307
|
-
const onDblclick = () => {
|
|
33308
|
-
editableTrigger.includes("dblClick") && openEditor();
|
|
33309
|
-
};
|
|
33310
|
-
const editInputRender = isEditing ? createVNode(
|
|
33311
|
-
EditInput,
|
|
33312
|
-
{
|
|
33313
|
-
prefixCls,
|
|
33314
|
-
recordIndexs,
|
|
33315
|
-
rowKey,
|
|
33316
|
-
cellKey: key,
|
|
33317
|
-
column,
|
|
33318
|
-
record: item,
|
|
33319
|
-
onCloseEditor: closeEditor,
|
|
33320
|
-
value,
|
|
33321
|
-
customEditable,
|
|
33322
|
-
getPopupContainer: props.getPopupContainer,
|
|
33323
|
-
multiple: editCellKeys.length > 1,
|
|
33324
|
-
autoHeight
|
|
33325
|
-
},
|
|
33326
|
-
null
|
|
33327
|
-
) : null;
|
|
33328
32465
|
return createVNode(
|
|
33329
32466
|
"div",
|
|
33330
32467
|
mergeProps(cellProps2, {
|
|
@@ -33336,39 +32473,25 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33336
32473
|
"data-column-key": columnKey,
|
|
33337
32474
|
class: cellClass,
|
|
33338
32475
|
onContextmenu: (e) => {
|
|
33339
|
-
if (
|
|
32476
|
+
if (tableContext.props.hasContextmenuPopup && 0 === e.button && e.ctrlKey) {
|
|
33340
32477
|
e.preventDefault();
|
|
33341
32478
|
} else {
|
|
33342
32479
|
onBodyCellContextmenu(e, cellRenderArgs, props.type);
|
|
33343
|
-
|
|
32480
|
+
emit("contextmenu", e);
|
|
33344
32481
|
}
|
|
33345
32482
|
},
|
|
33346
|
-
onDblclick
|
|
32483
|
+
onDblclick: (e) => {
|
|
32484
|
+
emit("dblClick", e);
|
|
32485
|
+
},
|
|
33347
32486
|
onClick: (e) => {
|
|
33348
32487
|
var _a2, _b2;
|
|
33349
32488
|
(_b2 = (_a2 = tableContext.props) == null ? void 0 : _a2.onCellClick) == null ? void 0 : _b2.call(_a2, e, cellRenderArgs);
|
|
33350
|
-
if ((
|
|
33351
|
-
|
|
33352
|
-
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
33353
|
-
const is = now - lastClickTime < 200;
|
|
33354
|
-
lastClickTime = now;
|
|
33355
|
-
return is;
|
|
33356
|
-
})()) {
|
|
33357
|
-
onDblclick();
|
|
32489
|
+
if (hasSupportedDblclick()) {
|
|
32490
|
+
emit("dblclick", e);
|
|
33358
32491
|
e.preventDefault();
|
|
33359
32492
|
return;
|
|
33360
32493
|
}
|
|
33361
|
-
emit("click", e
|
|
33362
|
-
editableTrigger.includes("click") && openEditor();
|
|
33363
|
-
},
|
|
33364
|
-
onMousedown: (e) => {
|
|
33365
|
-
emit("mousedown", e, cellPosition);
|
|
33366
|
-
},
|
|
33367
|
-
onMousemove: (e) => {
|
|
33368
|
-
emit("mousemove", e, cellPosition);
|
|
33369
|
-
},
|
|
33370
|
-
onKeydown: (e) => {
|
|
33371
|
-
emit("keydown", e, { cellPosition, isEditing });
|
|
32494
|
+
emit("click", e);
|
|
33372
32495
|
},
|
|
33373
32496
|
"data-level": level,
|
|
33374
32497
|
"aria-selected": "true"
|
|
@@ -33383,26 +32506,497 @@ const BodyCell = (props, { slots, emit }) => {
|
|
|
33383
32506
|
},
|
|
33384
32507
|
{ label: () => bodyCell }
|
|
33385
32508
|
) : null,
|
|
33386
|
-
renderCellVNode
|
|
33387
|
-
autoHeight && editInputRender ? createVNode(
|
|
33388
|
-
"label",
|
|
33389
|
-
{
|
|
33390
|
-
class: `${prefixCls}-cell-edit-wrapper`,
|
|
33391
|
-
onMousedown: (e) => e.stopPropagation()
|
|
33392
|
-
},
|
|
33393
|
-
[withDirectives(editInputRender, [[cellResize, cellResizeValue]])]
|
|
33394
|
-
) : editInputRender ? createVNode(
|
|
33395
|
-
"label",
|
|
33396
|
-
{
|
|
33397
|
-
class: `${prefixCls}-cell-edit-wrapper`,
|
|
33398
|
-
onMousedown: (e) => e.stopPropagation()
|
|
33399
|
-
},
|
|
33400
|
-
[editInputRender]
|
|
33401
|
-
) : null
|
|
32509
|
+
renderCellVNode
|
|
33402
32510
|
]
|
|
33403
32511
|
);
|
|
33404
32512
|
};
|
|
33405
|
-
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]]);
|
|
33406
33000
|
|
|
33407
33001
|
var _sfc_main$m = defineComponent({
|
|
33408
33002
|
name: "TableExpandedRow",
|
|
@@ -33482,7 +33076,7 @@ var _sfc_main$m = defineComponent({
|
|
|
33482
33076
|
}
|
|
33483
33077
|
});
|
|
33484
33078
|
|
|
33485
|
-
const _hoisted_1$
|
|
33079
|
+
const _hoisted_1$8 = ["data-cell-auto"];
|
|
33486
33080
|
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
33487
33081
|
const _component_RenderVNode = resolveComponent("RenderVNode");
|
|
33488
33082
|
const _directive_cell_resize = resolveDirective("cell-resize");
|
|
@@ -33514,7 +33108,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
33514
33108
|
2
|
|
33515
33109
|
/* CLASS */
|
|
33516
33110
|
)
|
|
33517
|
-
], 10, _hoisted_1$
|
|
33111
|
+
], 10, _hoisted_1$8)), [
|
|
33518
33112
|
[_directive_cell_resize, _ctx.cellResizeBind]
|
|
33519
33113
|
])
|
|
33520
33114
|
],
|
|
@@ -33532,16 +33126,18 @@ var _sfc_main$l = defineComponent({
|
|
|
33532
33126
|
expanded: Boolean,
|
|
33533
33127
|
expandable: Boolean,
|
|
33534
33128
|
disabled: Boolean,
|
|
33535
|
-
onExpand: Function
|
|
33129
|
+
onExpand: Function,
|
|
33130
|
+
expandIconType: String
|
|
33536
33131
|
},
|
|
33537
33132
|
emits: ["expand"],
|
|
33538
33133
|
setup(props, { emit }) {
|
|
33539
33134
|
const tableContext = useInjectTable();
|
|
33540
33135
|
const className = computed(() => {
|
|
33541
|
-
const { prefixCls, expanded, expandable, disabled } = props;
|
|
33136
|
+
const { prefixCls, expanded, expandable, disabled, expandIconType } = props;
|
|
33542
33137
|
const expandIconClass = `${prefixCls}-row-expand-icon`;
|
|
33543
33138
|
return {
|
|
33544
33139
|
[expandIconClass]: true,
|
|
33140
|
+
[`${expandIconClass}-${expandIconType}`]: true,
|
|
33545
33141
|
[`${expandIconClass}-spaced`]: !expandable,
|
|
33546
33142
|
[`${expandIconClass}-expanded`]: expandable && expanded,
|
|
33547
33143
|
[`${expandIconClass}-collapsed`]: expandable && !expanded,
|
|
@@ -33565,7 +33161,7 @@ var _sfc_main$l = defineComponent({
|
|
|
33565
33161
|
}
|
|
33566
33162
|
});
|
|
33567
33163
|
|
|
33568
|
-
const _hoisted_1$
|
|
33164
|
+
const _hoisted_1$7 = ["aria-label"];
|
|
33569
33165
|
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
33570
33166
|
return _ctx.expandIcon ? (openBlock(), createElementBlock("span", {
|
|
33571
33167
|
key: 0,
|
|
@@ -33579,7 +33175,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
33579
33175
|
class: normalizeClass(_ctx.className),
|
|
33580
33176
|
"aria-label": _ctx.label,
|
|
33581
33177
|
onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"]))
|
|
33582
|
-
}, null, 10, _hoisted_1$
|
|
33178
|
+
}, null, 10, _hoisted_1$7));
|
|
33583
33179
|
}
|
|
33584
33180
|
var ExpandIcon = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$h]]);
|
|
33585
33181
|
|
|
@@ -33594,6 +33190,7 @@ var _sfc_main$k = defineComponent({
|
|
|
33594
33190
|
record: { type: Object },
|
|
33595
33191
|
rowKey: { type: [Number, String] },
|
|
33596
33192
|
expanded: Boolean,
|
|
33193
|
+
expandIconType: String,
|
|
33597
33194
|
supportExpand: Boolean
|
|
33598
33195
|
},
|
|
33599
33196
|
setup(props) {
|
|
@@ -33777,8 +33374,8 @@ var _sfc_main$k = defineComponent({
|
|
|
33777
33374
|
}
|
|
33778
33375
|
});
|
|
33779
33376
|
|
|
33780
|
-
const _hoisted_1$
|
|
33781
|
-
const _hoisted_2$
|
|
33377
|
+
const _hoisted_1$6 = ["data-level"];
|
|
33378
|
+
const _hoisted_2$2 = {
|
|
33782
33379
|
key: 2,
|
|
33783
33380
|
draggable: true
|
|
33784
33381
|
};
|
|
@@ -33831,16 +33428,17 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
33831
33428
|
key: 1,
|
|
33832
33429
|
"prefix-cls": _ctx.prefixCls,
|
|
33833
33430
|
expandable: "",
|
|
33431
|
+
expandIconType: _ctx.expandIconType,
|
|
33834
33432
|
expanded: _ctx.expanded,
|
|
33835
33433
|
record: _ctx.record,
|
|
33836
33434
|
disabled: !_ctx.supportExpand,
|
|
33837
33435
|
onExpand: _ctx.onInternalTriggerExpand
|
|
33838
|
-
}, null, 8, ["prefix-cls", "expanded", "record", "disabled", "onExpand"])) : _ctx.column.type === "draggable" ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
33436
|
+
}, null, 8, ["prefix-cls", "expandIconType", "expanded", "record", "disabled", "onExpand"])) : _ctx.column.type === "draggable" ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
33839
33437
|
renderSlot(_ctx.$slots, "draggable-handle", {}, () => [
|
|
33840
33438
|
createVNode(_component_MenuOutlined)
|
|
33841
33439
|
])
|
|
33842
33440
|
])) : createCommentVNode("v-if", true)
|
|
33843
|
-
], 16, _hoisted_1$
|
|
33441
|
+
], 16, _hoisted_1$6);
|
|
33844
33442
|
}
|
|
33845
33443
|
var BodyExtraCell = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$g]]);
|
|
33846
33444
|
|
|
@@ -33852,7 +33450,8 @@ var _sfc_main$j = defineComponent({
|
|
|
33852
33450
|
BodyCell,
|
|
33853
33451
|
ExpandedRow,
|
|
33854
33452
|
BodyExtraCell,
|
|
33855
|
-
RenderSlot
|
|
33453
|
+
RenderSlot,
|
|
33454
|
+
BodyTextCell: BodyCell$1
|
|
33856
33455
|
},
|
|
33857
33456
|
inheritAttrs: false,
|
|
33858
33457
|
props: {
|
|
@@ -33874,11 +33473,17 @@ var _sfc_main$j = defineComponent({
|
|
|
33874
33473
|
const tableContext = useInjectTable();
|
|
33875
33474
|
const rowInstance = getCurrentInstance();
|
|
33876
33475
|
const { table } = useProConfigInject();
|
|
33877
|
-
const { editCellKeys, closeEditor, openEditor } = useEditInject();
|
|
33476
|
+
const { editCellKeys, isRowEdit, mergedEditableKeys, editRowsMap, closeEditor, openEditor } = useEditInject();
|
|
33477
|
+
const editRow = computed(() => editRowsMap.value[props.rowKey]);
|
|
33878
33478
|
let isUnmount = false;
|
|
33879
33479
|
const bodyRow = ref();
|
|
33880
|
-
const
|
|
33881
|
-
|
|
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
|
+
});
|
|
33882
33487
|
const calMaxHeight = () => {
|
|
33883
33488
|
if (isUnmount) return;
|
|
33884
33489
|
let rowHeight = 0;
|
|
@@ -33948,6 +33553,7 @@ var _sfc_main$j = defineComponent({
|
|
|
33948
33553
|
});
|
|
33949
33554
|
const isExpanded = ref(false);
|
|
33950
33555
|
const expandedRowKeys = computed(() => tableContext.expandedRowKeys.value);
|
|
33556
|
+
const expandIconType = computed(() => tableContext.expandIconType.value);
|
|
33951
33557
|
const expanded = eagerComputed(() => {
|
|
33952
33558
|
var _a, _b;
|
|
33953
33559
|
return (_b = (_a = expandedRowKeys.value).has) == null ? void 0 : _b.call(_a, props.rowKey);
|
|
@@ -34079,6 +33685,7 @@ var _sfc_main$j = defineComponent({
|
|
|
34079
33685
|
rowStyle,
|
|
34080
33686
|
cellClass,
|
|
34081
33687
|
tableContext,
|
|
33688
|
+
isCurrentEditRow,
|
|
34082
33689
|
mergedRowHeights,
|
|
34083
33690
|
handleCellBlur,
|
|
34084
33691
|
handleCellHover,
|
|
@@ -34094,6 +33701,7 @@ var _sfc_main$j = defineComponent({
|
|
|
34094
33701
|
expandIconColumnIndex,
|
|
34095
33702
|
indentSize,
|
|
34096
33703
|
expanded,
|
|
33704
|
+
expandIconType,
|
|
34097
33705
|
onInternalTriggerExpand,
|
|
34098
33706
|
customRowProps,
|
|
34099
33707
|
expandColumnKey: ExpandColumnKey,
|
|
@@ -34105,29 +33713,29 @@ var _sfc_main$j = defineComponent({
|
|
|
34105
33713
|
resizeObserver,
|
|
34106
33714
|
calMaxHeight,
|
|
34107
33715
|
bodyRow,
|
|
33716
|
+
editCellKeys,
|
|
33717
|
+
isRowEdit,
|
|
33718
|
+
editRow,
|
|
33719
|
+
mergedEditableKeys,
|
|
33720
|
+
openEditor,
|
|
33721
|
+
closeEditor,
|
|
34108
33722
|
hoverRowKey,
|
|
34109
33723
|
hoverColumnKey,
|
|
34110
33724
|
xVirtual: eagerComputed(() => tableContext.xVirtual.value),
|
|
34111
33725
|
getPopupContainer: () => popupContainer.value,
|
|
34112
|
-
|
|
34113
|
-
closeEditor,
|
|
34114
|
-
openEditor,
|
|
34115
|
-
mergedTooltipOpen,
|
|
34116
|
-
onCellMousedown,
|
|
34117
|
-
onCellKeydown,
|
|
34118
|
-
onCellMousemove,
|
|
34119
|
-
onCellClick
|
|
33726
|
+
mergedTooltipOpen
|
|
34120
33727
|
};
|
|
34121
33728
|
}
|
|
34122
33729
|
});
|
|
34123
33730
|
|
|
34124
|
-
const _hoisted_1$
|
|
34125
|
-
const _hoisted_2 = ["data-row-key"];
|
|
33731
|
+
const _hoisted_1$5 = ["data-row-key"];
|
|
33732
|
+
const _hoisted_2$1 = ["data-row-key"];
|
|
34126
33733
|
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
34127
33734
|
const _component_ExpandedRow = resolveComponent("ExpandedRow");
|
|
34128
33735
|
const _component_BodyExtraCell = resolveComponent("BodyExtraCell");
|
|
34129
33736
|
const _component_ExpandIcon = resolveComponent("ExpandIcon");
|
|
34130
33737
|
const _component_BodyCell = resolveComponent("BodyCell");
|
|
33738
|
+
const _component_BodyTextCell = resolveComponent("BodyTextCell");
|
|
34131
33739
|
const _component_RenderSlot = resolveComponent("RenderSlot");
|
|
34132
33740
|
return _ctx.isExpandRow ? (openBlock(), createElementBlock(
|
|
34133
33741
|
Fragment,
|
|
@@ -34149,7 +33757,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34149
33757
|
"resize-observer": _ctx.resizeObserver,
|
|
34150
33758
|
"cal-max-height": _ctx.calMaxHeight
|
|
34151
33759
|
}, null, 8, ["prefix-cls", "item", "row-key", "row-index", "resize-observer", "cal-max-height"])
|
|
34152
|
-
], 14, _hoisted_1$
|
|
33760
|
+
], 14, _hoisted_1$5)) : createCommentVNode("v-if", true)
|
|
34153
33761
|
],
|
|
34154
33762
|
64
|
|
34155
33763
|
/* STABLE_FRAGMENT */
|
|
@@ -34167,7 +33775,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34167
33775
|
Fragment,
|
|
34168
33776
|
null,
|
|
34169
33777
|
renderList(_ctx.mergedColumns, (column, index) => {
|
|
34170
|
-
var _a;
|
|
33778
|
+
var _a, _b;
|
|
34171
33779
|
return openBlock(), createElementBlock(
|
|
34172
33780
|
Fragment,
|
|
34173
33781
|
{
|
|
@@ -34182,11 +33790,12 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34182
33790
|
type: _ctx.type,
|
|
34183
33791
|
column: (_a = _ctx.mergedColumns) == null ? void 0 : _a[index],
|
|
34184
33792
|
expanded: _ctx.expanded,
|
|
33793
|
+
expandIconType: _ctx.expandIconType,
|
|
34185
33794
|
"support-expand": _ctx.mergedExpandable,
|
|
34186
33795
|
record: _ctx.record,
|
|
34187
33796
|
onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
|
|
34188
33797
|
onMouseleave: _ctx.handleCellBlur
|
|
34189
|
-
}, null, 8, ["prefix-cls", "row-key", "row-index", "type", "column", "expanded", "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, {
|
|
34190
33799
|
key: 1,
|
|
34191
33800
|
"prefix-cls": _ctx.prefixCls,
|
|
34192
33801
|
item: _ctx.record,
|
|
@@ -34203,14 +33812,13 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34203
33812
|
"get-popup-container": _ctx.getPopupContainer,
|
|
34204
33813
|
"tooltip-open": _ctx.mergedTooltipOpen && _ctx.hoverColumnKey === column.columnKey,
|
|
34205
33814
|
"edit-cell-keys": _ctx.editCellKeys,
|
|
33815
|
+
"editable-keys": _ctx.mergedEditableKeys,
|
|
33816
|
+
"is-row-edit": _ctx.isRowEdit,
|
|
33817
|
+
"edit-row": _ctx.editRow,
|
|
34206
33818
|
onCloseEditor: _ctx.closeEditor,
|
|
34207
33819
|
onOpenEditor: _ctx.openEditor,
|
|
34208
33820
|
onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
|
|
34209
|
-
onCellLeave: _ctx.handleCellBlur
|
|
34210
|
-
onMousedown: _ctx.onCellMousedown,
|
|
34211
|
-
onMousemove: _ctx.onCellMousemove,
|
|
34212
|
-
onKeydown: _ctx.onCellKeydown,
|
|
34213
|
-
onClick: _ctx.onCellClick
|
|
33821
|
+
onCellLeave: _ctx.handleCellBlur
|
|
34214
33822
|
}, {
|
|
34215
33823
|
appendNode: withCtx(() => [
|
|
34216
33824
|
createElementVNode(
|
|
@@ -34231,12 +33839,13 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34231
33839
|
),
|
|
34232
33840
|
createVNode(_component_ExpandIcon, {
|
|
34233
33841
|
expanded: _ctx.expanded,
|
|
33842
|
+
expandIconType: _ctx.expandIconType,
|
|
34234
33843
|
"prefix-cls": _ctx.prefixCls,
|
|
34235
33844
|
expandable: _ctx.hasNestChildren,
|
|
34236
33845
|
record: _ctx.record,
|
|
34237
33846
|
disabled: !_ctx.mergedExpandable,
|
|
34238
33847
|
onExpand: _ctx.onInternalTriggerExpand
|
|
34239
|
-
}, null, 8, ["expanded", "prefix-cls", "expandable", "record", "disabled", "onExpand"])
|
|
33848
|
+
}, null, 8, ["expanded", "expandIconType", "prefix-cls", "expandable", "record", "disabled", "onExpand"])
|
|
34240
33849
|
],
|
|
34241
33850
|
2
|
|
34242
33851
|
/* CLASS */
|
|
@@ -34244,7 +33853,62 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34244
33853
|
]),
|
|
34245
33854
|
_: 1
|
|
34246
33855
|
/* STABLE */
|
|
34247
|
-
}, 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", "
|
|
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,
|
|
33873
|
+
onCloseEditor: _ctx.closeEditor,
|
|
33874
|
+
onOpenEditor: _ctx.openEditor,
|
|
33875
|
+
onMouseenter: ($event) => _ctx.handleCellHover(_ctx.rowKey, column.columnKey, _ctx.tableContext.draggingRowKey.value),
|
|
33876
|
+
onCellLeave: _ctx.handleCellBlur
|
|
33877
|
+
}, {
|
|
33878
|
+
appendNode: withCtx(() => [
|
|
33879
|
+
createElementVNode(
|
|
33880
|
+
"div",
|
|
33881
|
+
{
|
|
33882
|
+
class: normalizeClass(`${_ctx.prefixCls}-append-node`)
|
|
33883
|
+
},
|
|
33884
|
+
[
|
|
33885
|
+
createElementVNode(
|
|
33886
|
+
"span",
|
|
33887
|
+
{
|
|
33888
|
+
style: normalizeStyle(`padding-left: ${(_ctx.indent || 0) * _ctx.indentSize}px`),
|
|
33889
|
+
class: normalizeClass(`${_ctx.prefixCls}-row-indent indent-level-${_ctx.indent}`)
|
|
33890
|
+
},
|
|
33891
|
+
null,
|
|
33892
|
+
6
|
|
33893
|
+
/* CLASS, STYLE */
|
|
33894
|
+
),
|
|
33895
|
+
createVNode(_component_ExpandIcon, {
|
|
33896
|
+
expanded: _ctx.expanded,
|
|
33897
|
+
expandIconType: _ctx.expandIconType,
|
|
33898
|
+
"prefix-cls": _ctx.prefixCls,
|
|
33899
|
+
expandable: _ctx.hasNestChildren,
|
|
33900
|
+
record: _ctx.record,
|
|
33901
|
+
disabled: !_ctx.mergedExpandable,
|
|
33902
|
+
onExpand: _ctx.onInternalTriggerExpand
|
|
33903
|
+
}, null, 8, ["expanded", "expandIconType", "prefix-cls", "expandable", "record", "disabled", "onExpand"])
|
|
33904
|
+
],
|
|
33905
|
+
2
|
|
33906
|
+
/* CLASS */
|
|
33907
|
+
)
|
|
33908
|
+
]),
|
|
33909
|
+
_: 1
|
|
33910
|
+
/* STABLE */
|
|
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)
|
|
34248
33912
|
],
|
|
34249
33913
|
64
|
|
34250
33914
|
/* STABLE_FRAGMENT */
|
|
@@ -34267,7 +33931,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
34267
33931
|
2
|
|
34268
33932
|
/* CLASS */
|
|
34269
33933
|
)) : createCommentVNode("v-if", true)
|
|
34270
|
-
], 16, _hoisted_2));
|
|
33934
|
+
], 16, _hoisted_2$1));
|
|
34271
33935
|
}
|
|
34272
33936
|
var Row = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$f]]);
|
|
34273
33937
|
|
|
@@ -34910,7 +34574,7 @@ var _sfc_main$h = defineComponent({
|
|
|
34910
34574
|
}
|
|
34911
34575
|
});
|
|
34912
34576
|
|
|
34913
|
-
const _hoisted_1$
|
|
34577
|
+
const _hoisted_1$4 = { style: {
|
|
34914
34578
|
width: "100%",
|
|
34915
34579
|
overflow: "hidden",
|
|
34916
34580
|
position: "relative",
|
|
@@ -35022,7 +34686,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
35022
34686
|
onKeydown: _cache[9] || (_cache[9] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
|
|
35023
34687
|
},
|
|
35024
34688
|
[
|
|
35025
|
-
createElementVNode("div", _hoisted_1$
|
|
34689
|
+
createElementVNode("div", _hoisted_1$4, [
|
|
35026
34690
|
createElementVNode(
|
|
35027
34691
|
"div",
|
|
35028
34692
|
{
|
|
@@ -35494,7 +35158,8 @@ var _sfc_main$g = defineComponent({
|
|
|
35494
35158
|
"expandedRowsChange",
|
|
35495
35159
|
"resizeColumn",
|
|
35496
35160
|
"update:dataSource",
|
|
35497
|
-
"cellKeydown"
|
|
35161
|
+
"cellKeydown",
|
|
35162
|
+
"data-change"
|
|
35498
35163
|
],
|
|
35499
35164
|
slots: {},
|
|
35500
35165
|
setup(props, { expose, emit, slots }) {
|
|
@@ -35506,7 +35171,6 @@ var _sfc_main$g = defineComponent({
|
|
|
35506
35171
|
});
|
|
35507
35172
|
const popupContainer = shallowRef(null);
|
|
35508
35173
|
const customUiCls = usePrefixCls("custom-ui");
|
|
35509
|
-
const { editCellKeys, openEditor, closeEditor } = useEditProvider();
|
|
35510
35174
|
useProvidePopup();
|
|
35511
35175
|
const getPopupContainer = computed(() => props.getPopupContainer);
|
|
35512
35176
|
const { status, watermarkMsg } = useLicense();
|
|
@@ -35613,12 +35277,21 @@ var _sfc_main$g = defineComponent({
|
|
|
35613
35277
|
},
|
|
35614
35278
|
{ immediate: true, deep: !!props.deepWatchColumns }
|
|
35615
35279
|
);
|
|
35280
|
+
watch(rawData, (newData) => {
|
|
35281
|
+
emit("data-change", newData);
|
|
35282
|
+
});
|
|
35616
35283
|
const childrenColumnName = computed(
|
|
35617
35284
|
() => {
|
|
35618
35285
|
var _a, _b, _c;
|
|
35619
35286
|
return (_c = (_b = props.childrenColumnName) != null ? _b : (_a = table == null ? void 0 : table.value) == null ? void 0 : _a.childrenColumnName) != null ? _c : "children";
|
|
35620
35287
|
}
|
|
35621
35288
|
);
|
|
35289
|
+
const expandIconType = computed(
|
|
35290
|
+
() => {
|
|
35291
|
+
var _a, _b, _c;
|
|
35292
|
+
return (_c = (_b = props.expandIconType) != null ? _b : (_a = table == null ? void 0 : table.value) == null ? void 0 : _a.expandIconType) != null ? _c : "default";
|
|
35293
|
+
}
|
|
35294
|
+
);
|
|
35622
35295
|
const { getRecordByKey, getIndexsByKey, getKeyByIndexs, allDataRowKeys, allDataRootRowKeys } = useKVMap(rawData, childrenColumnName, getRowKey);
|
|
35623
35296
|
const defaultExpandedRowKeys = shallowRef([]);
|
|
35624
35297
|
watchEffect(() => {
|
|
@@ -35642,6 +35315,20 @@ var _sfc_main$g = defineComponent({
|
|
|
35642
35315
|
return { spinning: false };
|
|
35643
35316
|
}
|
|
35644
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
|
+
});
|
|
35645
35332
|
onActivated(() => {
|
|
35646
35333
|
scrollTo({ left: 0, top: 0 });
|
|
35647
35334
|
});
|
|
@@ -35951,7 +35638,11 @@ var _sfc_main$g = defineComponent({
|
|
|
35951
35638
|
leftWidth,
|
|
35952
35639
|
centerWidth,
|
|
35953
35640
|
getRowHeight: cal.getRowHeight,
|
|
35954
|
-
customCell: toRef$1(props, "customCell")
|
|
35641
|
+
customCell: toRef$1(props, "customCell"),
|
|
35642
|
+
cancelEditable,
|
|
35643
|
+
startEditable,
|
|
35644
|
+
saveEditable,
|
|
35645
|
+
isEditable
|
|
35955
35646
|
});
|
|
35956
35647
|
watch(
|
|
35957
35648
|
[realHeaderHeight, scrollLeft],
|
|
@@ -35965,6 +35656,10 @@ var _sfc_main$g = defineComponent({
|
|
|
35965
35656
|
...cal,
|
|
35966
35657
|
...columns,
|
|
35967
35658
|
...cellProps,
|
|
35659
|
+
cancelEditable,
|
|
35660
|
+
startEditable,
|
|
35661
|
+
saveEditable,
|
|
35662
|
+
isEditable,
|
|
35968
35663
|
rootRef,
|
|
35969
35664
|
rawData,
|
|
35970
35665
|
getRowFlattenIndexByKey,
|
|
@@ -35974,6 +35669,7 @@ var _sfc_main$g = defineComponent({
|
|
|
35974
35669
|
status,
|
|
35975
35670
|
useAnimate,
|
|
35976
35671
|
animateRows,
|
|
35672
|
+
expandIconType,
|
|
35977
35673
|
watermarkMsg,
|
|
35978
35674
|
onResizeColumn: (w, col, action) => {
|
|
35979
35675
|
var _a;
|
|
@@ -36181,99 +35877,22 @@ var _sfc_main$g = defineComponent({
|
|
|
36181
35877
|
});
|
|
36182
35878
|
const tabGuardTopRef = ref();
|
|
36183
35879
|
const tabGuardBottomRef = ref();
|
|
36184
|
-
const {
|
|
36185
|
-
navigationService,
|
|
36186
|
-
getSelectedRange,
|
|
36187
|
-
clearAllSelectedRange,
|
|
36188
|
-
copySelectedRange,
|
|
36189
|
-
appendCellToSelectedRange,
|
|
36190
|
-
onBodyKeydown
|
|
36191
|
-
} = useProvideRangeStore({
|
|
36192
|
-
allColumns: columns.allColumns,
|
|
36193
|
-
flattenData,
|
|
36194
|
-
rangeSelection: computed(() => props.rangeSelection),
|
|
36195
|
-
getRowByFlattenIndex,
|
|
36196
|
-
rootRef,
|
|
36197
|
-
prefixCls: computed(() => props.prefixCls),
|
|
36198
|
-
allCellProps: cellProps.allCellProps,
|
|
36199
|
-
tabGuardTopRef,
|
|
36200
|
-
tabGuardBottomRef,
|
|
36201
|
-
ensureCellColumnVisible: (cell) => {
|
|
36202
|
-
if (!cell.column || cell.column.fixed) return;
|
|
36203
|
-
const sl = scrollLeft.value;
|
|
36204
|
-
const pos2 = columns.getColumnPositionByKey(cell.column.columnKey);
|
|
36205
|
-
if (pos2) {
|
|
36206
|
-
const { width, left } = pos2;
|
|
36207
|
-
const lw = leftWidth.value;
|
|
36208
|
-
const rw = rightWidth.value;
|
|
36209
|
-
left - lw < sl ? scrollLeft.value = left - lw : left + width > sl + bodyWidth.value - rw && (scrollLeft.value = left + width - bodyWidth.value + rw);
|
|
36210
|
-
}
|
|
36211
|
-
},
|
|
36212
|
-
ensureCellRowVisible: (cell) => {
|
|
36213
|
-
var _a;
|
|
36214
|
-
const { rowIndex } = cell;
|
|
36215
|
-
const st = scrollTop.value;
|
|
36216
|
-
const row = getRowByFlattenIndex(rowIndex);
|
|
36217
|
-
const pos2 = cal.getRowPositionByKey(row.rowKey);
|
|
36218
|
-
const cprops = (((_a = cellProps.allCellProps.value[row.rowKey]) == null ? void 0 : _a[cell.column.columnKey]) || {}).props || {};
|
|
36219
|
-
const height = cal.getRowHeight(rowIndex, cprops.rowSpan);
|
|
36220
|
-
if (pos2 !== void 0) {
|
|
36221
|
-
updateAnimate();
|
|
36222
|
-
if (pos2 < st) {
|
|
36223
|
-
scrollTop.value = pos2;
|
|
36224
|
-
} else {
|
|
36225
|
-
if (pos2 + height > st + bodyHeight.value) {
|
|
36226
|
-
scrollTop.value = pos2 + height - bodyHeight.value;
|
|
36227
|
-
}
|
|
36228
|
-
}
|
|
36229
|
-
}
|
|
36230
|
-
},
|
|
36231
|
-
latestRangeStartCell,
|
|
36232
|
-
bodyRef: computed(() => {
|
|
36233
|
-
var _a;
|
|
36234
|
-
return (_a = bodyRef.value) == null ? void 0 : _a.bodyRef;
|
|
36235
|
-
}),
|
|
36236
|
-
scrollLeft,
|
|
36237
|
-
scrollTop,
|
|
36238
|
-
scrollTo,
|
|
36239
|
-
showVerticalScrollbar,
|
|
36240
|
-
showHorizontalScrollbar,
|
|
36241
|
-
getIndexsByKey,
|
|
36242
|
-
formatRangeCellText: (parmas) => {
|
|
36243
|
-
if (props.formatRangeCellText) {
|
|
36244
|
-
return props.formatRangeCellText(parmas);
|
|
36245
|
-
} else if (parmas.value) {
|
|
36246
|
-
return parmas.value;
|
|
36247
|
-
}
|
|
36248
|
-
return "";
|
|
36249
|
-
},
|
|
36250
|
-
editCellKeys,
|
|
36251
|
-
copyDelimiter: computed(() => props.copyDelimiter)
|
|
36252
|
-
});
|
|
36253
35880
|
expose({
|
|
36254
35881
|
scrollTo,
|
|
36255
35882
|
scrollLeft,
|
|
36256
35883
|
scrollTop,
|
|
36257
35884
|
rootRef,
|
|
36258
35885
|
paginationRef,
|
|
35886
|
+
validateRowData,
|
|
35887
|
+
addEditRecord,
|
|
35888
|
+
cancelEditable,
|
|
35889
|
+
startEditable,
|
|
35890
|
+
saveEditable,
|
|
35891
|
+
validateTableData,
|
|
36259
35892
|
bodyRef: computed(() => {
|
|
36260
35893
|
var _a;
|
|
36261
35894
|
return (_a = bodyRef.value) == null ? void 0 : _a.bodyRef;
|
|
36262
|
-
})
|
|
36263
|
-
getSelectedRange,
|
|
36264
|
-
clearAllSelectedRange,
|
|
36265
|
-
copySelectedRange,
|
|
36266
|
-
appendCellToSelectedRange,
|
|
36267
|
-
openEditor: (cellInfos) => {
|
|
36268
|
-
openEditor(cellInfos.map((info) => `${info.rowKey} ${info.columnKey}`));
|
|
36269
|
-
},
|
|
36270
|
-
closeEditor: (cellInfos) => {
|
|
36271
|
-
if (cellInfos) {
|
|
36272
|
-
closeEditor(cellInfos.map((info) => `${info.rowKey} ${info.columnKey}`));
|
|
36273
|
-
} else {
|
|
36274
|
-
closeEditor();
|
|
36275
|
-
}
|
|
36276
|
-
}
|
|
35895
|
+
})
|
|
36277
35896
|
});
|
|
36278
35897
|
return {
|
|
36279
35898
|
bodyRef,
|
|
@@ -36285,7 +35904,6 @@ var _sfc_main$g = defineComponent({
|
|
|
36285
35904
|
watermarkMsg,
|
|
36286
35905
|
rootStyle,
|
|
36287
35906
|
rootClass,
|
|
36288
|
-
onBodyKeydown,
|
|
36289
35907
|
watermarkStyle: computed(() => ({
|
|
36290
35908
|
minWidth: "100px!important",
|
|
36291
35909
|
minHeight: "40px!important",
|
|
@@ -36330,12 +35948,6 @@ var _sfc_main$g = defineComponent({
|
|
|
36330
35948
|
bottomPaginationHeight.value = e.detail.height;
|
|
36331
35949
|
},
|
|
36332
35950
|
popupContainer,
|
|
36333
|
-
handleGuardTopKeydown: (e) => {
|
|
36334
|
-
e.keyCode !== KeyCode.TAB || e.shiftKey || (navigationService.getFirstCellToFocus(e.shiftKey), e.preventDefault());
|
|
36335
|
-
},
|
|
36336
|
-
handleGuardBottomKeydown: (e) => {
|
|
36337
|
-
e.keyCode === KeyCode.TAB && e.shiftKey && (navigationService.getLastCellToFocus(e.shiftKey), e.preventDefault());
|
|
36338
|
-
},
|
|
36339
35951
|
tabGuardTopRef,
|
|
36340
35952
|
tabGuardBottomRef,
|
|
36341
35953
|
onShowSizeChange,
|
|
@@ -36346,6 +35958,18 @@ var _sfc_main$g = defineComponent({
|
|
|
36346
35958
|
}
|
|
36347
35959
|
});
|
|
36348
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
|
+
};
|
|
36349
35973
|
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
36350
35974
|
const _component_Pagination = resolveComponent("Pagination");
|
|
36351
35975
|
const _component_AutoHeightHeader = resolveComponent("AutoHeightHeader");
|
|
@@ -36375,16 +35999,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
36375
35999
|
}), null, 16, ["class", "onChange", "onShowSizeChange"])) : createCommentVNode("v-if", true),
|
|
36376
36000
|
createElementVNode(
|
|
36377
36001
|
"div",
|
|
36378
|
-
|
|
36379
|
-
ref: "tabGuardTopRef",
|
|
36380
|
-
role: "presentation",
|
|
36381
|
-
tabindex: "0",
|
|
36382
|
-
style: { position: "absolute", width: "0", height: "0" },
|
|
36383
|
-
onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleGuardTopKeydown && _ctx.handleGuardTopKeydown(...args))
|
|
36384
|
-
},
|
|
36002
|
+
_hoisted_1$3,
|
|
36385
36003
|
null,
|
|
36386
|
-
|
|
36387
|
-
/*
|
|
36004
|
+
512
|
|
36005
|
+
/* NEED_PATCH */
|
|
36388
36006
|
),
|
|
36389
36007
|
createElementVNode(
|
|
36390
36008
|
"div",
|
|
@@ -36417,20 +36035,19 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
36417
36035
|
createVNode(_component_ProBody, {
|
|
36418
36036
|
ref: "bodyRef",
|
|
36419
36037
|
bodyScrollWidth: _ctx.bodyScrollWidth,
|
|
36420
|
-
"onUpdate:bodyScrollWidth": _cache[
|
|
36038
|
+
"onUpdate:bodyScrollWidth": _cache[0] || (_cache[0] = ($event) => _ctx.bodyScrollWidth = $event),
|
|
36421
36039
|
bodyWidth: _ctx.bodyWidth,
|
|
36422
|
-
"onUpdate:bodyWidth": _cache[
|
|
36040
|
+
"onUpdate:bodyWidth": _cache[1] || (_cache[1] = ($event) => _ctx.bodyWidth = $event),
|
|
36423
36041
|
bodyHeight: _ctx.bodyHeight,
|
|
36424
|
-
"onUpdate:bodyHeight": _cache[
|
|
36042
|
+
"onUpdate:bodyHeight": _cache[2] || (_cache[2] = ($event) => _ctx.bodyHeight = $event),
|
|
36425
36043
|
"prefix-cls": _ctx.prefixCls,
|
|
36426
36044
|
"wrap-text": _ctx.wrapText,
|
|
36427
36045
|
"scroll-x": _ctx.mergedScrollX,
|
|
36428
36046
|
height: _ctx.mergedScrollY,
|
|
36429
36047
|
"summary-fixed": _ctx.mergedSummaryFixed,
|
|
36430
36048
|
summary: _ctx.$slots.summary,
|
|
36431
|
-
"empty-text": _ctx.$slots.emptyText
|
|
36432
|
-
|
|
36433
|
-
}, 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"])
|
|
36434
36051
|
],
|
|
36435
36052
|
6
|
|
36436
36053
|
/* CLASS, STYLE */
|
|
@@ -36438,16 +36055,10 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
36438
36055
|
createVNode(_component_HorizontalScroll),
|
|
36439
36056
|
createElementVNode(
|
|
36440
36057
|
"div",
|
|
36441
|
-
|
|
36442
|
-
ref: "tabGuardBottomRef",
|
|
36443
|
-
role: "presentation",
|
|
36444
|
-
tabindex: "0",
|
|
36445
|
-
style: { position: "absolute", width: "0", height: "0" },
|
|
36446
|
-
onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.handleGuardBottomKeydown && _ctx.handleGuardBottomKeydown(...args))
|
|
36447
|
-
},
|
|
36058
|
+
_hoisted_2,
|
|
36448
36059
|
null,
|
|
36449
|
-
|
|
36450
|
-
/*
|
|
36060
|
+
512
|
|
36061
|
+
/* NEED_PATCH */
|
|
36451
36062
|
),
|
|
36452
36063
|
_ctx.$slots.footer ? (openBlock(), createElementBlock(
|
|
36453
36064
|
"div",
|
|
@@ -36472,7 +36083,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
36472
36083
|
ref: "paginationRef",
|
|
36473
36084
|
style: normalizeStyle(_ctx.bottomPaginationStyle),
|
|
36474
36085
|
class: normalizeClass(`${_ctx.prefixCls}-pagination-wrap ${_ctx.prefixCls}-pagination-wrap-${_ctx.size}`),
|
|
36475
|
-
onResizeheight: _cache[
|
|
36086
|
+
onResizeheight: _cache[3] || (_cache[3] = (...args) => _ctx.handlePaginationResize && _ctx.handlePaginationResize(...args))
|
|
36476
36087
|
},
|
|
36477
36088
|
[
|
|
36478
36089
|
createVNode(_component_Pagination, mergeProps({ class: _ctx.paginationClass }, _ctx.paginationProps, {
|
|
@@ -38257,6 +37868,30 @@ var Table = /* @__PURE__ */ defineComponent({
|
|
|
38257
37868
|
var _a2;
|
|
38258
37869
|
(_a2 = tableRef.value) == null ? void 0 : _a2.scrollTo(pos, behavior);
|
|
38259
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
|
+
},
|
|
38260
37895
|
scrollLeft: computed(() => {
|
|
38261
37896
|
var _a2;
|
|
38262
37897
|
return unref((_a2 = tableRef.value) == null ? void 0 : _a2.scrollLeft);
|
|
@@ -38277,18 +37912,6 @@ var Table = /* @__PURE__ */ defineComponent({
|
|
|
38277
37912
|
var _a2;
|
|
38278
37913
|
return unref((_a2 = tableRef.value) == null ? void 0 : _a2.paginationRef);
|
|
38279
37914
|
}),
|
|
38280
|
-
copySelectedRange: () => {
|
|
38281
|
-
var _a2;
|
|
38282
|
-
return (_a2 = tableRef.value) == null ? void 0 : _a2.copySelectedRange();
|
|
38283
|
-
},
|
|
38284
|
-
getSelectedRange: () => {
|
|
38285
|
-
var _a2;
|
|
38286
|
-
return (_a2 = tableRef.value) == null ? void 0 : _a2.getSelectedRange();
|
|
38287
|
-
},
|
|
38288
|
-
clearAllSelectedRange: () => {
|
|
38289
|
-
var _a2;
|
|
38290
|
-
return (_a2 = tableRef.value) == null ? void 0 : _a2.clearAllSelectedRange();
|
|
38291
|
-
},
|
|
38292
37915
|
clearDataSource: () => {
|
|
38293
37916
|
dataSource.value = [];
|
|
38294
37917
|
},
|
|
@@ -38298,14 +37921,6 @@ var Table = /* @__PURE__ */ defineComponent({
|
|
|
38298
37921
|
var _a2;
|
|
38299
37922
|
return (_a2 = tableRef.value) == null ? void 0 : _a2.appendCellToSelectedRange(params);
|
|
38300
37923
|
},
|
|
38301
|
-
openEditor: (cellInfos) => {
|
|
38302
|
-
var _a2;
|
|
38303
|
-
return (_a2 = tableRef.value) == null ? void 0 : _a2.openEditor(cellInfos);
|
|
38304
|
-
},
|
|
38305
|
-
closeEditor: (cellInfos) => {
|
|
38306
|
-
var _a2;
|
|
38307
|
-
return (_a2 = tableRef.value) == null ? void 0 : _a2.closeEditor(cellInfos);
|
|
38308
|
-
},
|
|
38309
37924
|
reload,
|
|
38310
37925
|
reset,
|
|
38311
37926
|
calcTableHeight,
|