vxe-table 4.16.17 → 4.16.19
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/es/colgroup/style.css +0 -0
- package/es/colgroup/style.min.css +0 -0
- package/es/column/style.css +0 -0
- package/es/column/style.min.css +0 -0
- package/es/grid/style.css +86 -0
- package/es/grid/style.min.css +1 -0
- package/es/iconfont.1758609514163.ttf +0 -0
- package/es/iconfont.1758609514163.woff +0 -0
- package/es/iconfont.1758609514163.woff2 +0 -0
- package/es/index.esm.js +3 -0
- package/es/locale/lang/ar-EG.d.ts +2 -0
- package/es/locale/lang/de-DE.d.ts +2 -0
- package/es/locale/lang/en-US.d.ts +2 -0
- package/es/locale/lang/es-ES.d.ts +2 -0
- package/es/locale/lang/fr-FR.d.ts +2 -0
- package/es/locale/lang/hu-HU.d.ts +2 -0
- package/es/locale/lang/hy-AM.d.ts +2 -0
- package/es/locale/lang/id-ID.d.ts +2 -0
- package/es/locale/lang/it-IT.d.ts +2 -0
- package/es/locale/lang/ja-JP.d.ts +2 -0
- package/es/locale/lang/ko-KR.d.ts +2 -0
- package/es/locale/lang/ms-MY.d.ts +2 -0
- package/es/locale/lang/nb-NO.d.ts +2 -0
- package/es/locale/lang/pt-BR.d.ts +2 -0
- package/es/locale/lang/ru-RU.d.ts +2 -0
- package/es/locale/lang/th-TH.d.ts +2 -0
- package/es/locale/lang/ug-CN.d.ts +2 -0
- package/es/locale/lang/uk-UA.d.ts +2 -0
- package/es/locale/lang/uz-UZ.d.ts +2 -0
- package/es/locale/lang/vi-VN.d.ts +2 -0
- package/es/locale/lang/zh-CHT.d.ts +2 -0
- package/es/locale/lang/zh-CN.d.ts +2 -0
- package/es/locale/lang/zh-HK.d.ts +2 -0
- package/es/locale/lang/zh-MO.d.ts +2 -0
- package/es/locale/lang/zh-TW.d.ts +2 -0
- package/es/style.css +1 -1
- package/es/table/module/filter/hook.js +21 -5
- package/es/table/module/filter/panel.js +4 -4
- package/es/table/module/menu/panel.js +27 -14
- package/es/table/src/cell.js +10 -7
- package/es/table/src/table.js +22 -22
- package/es/table/style.css +3657 -0
- package/es/table/style.min.css +1 -0
- package/es/toolbar/style.css +90 -0
- package/es/toolbar/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/v-x-e-table/style.css +0 -0
- package/es/v-x-e-table/style.min.css +0 -0
- package/es/vxe-colgroup/style.css +0 -0
- package/es/vxe-colgroup/style.min.css +0 -0
- package/es/vxe-column/style.css +0 -0
- package/es/vxe-column/style.min.css +0 -0
- package/es/vxe-grid/style.css +86 -0
- package/es/vxe-grid/style.min.css +1 -0
- package/es/vxe-table/style.css +3657 -0
- package/es/vxe-table/style.min.css +1 -0
- package/es/vxe-toolbar/style.css +90 -0
- package/es/vxe-toolbar/style.min.css +1 -0
- package/es/vxe-ui/style.css +0 -0
- package/es/vxe-ui/style.min.css +0 -0
- package/es/vxe-v-x-e-table/style.css +0 -0
- package/es/vxe-v-x-e-table/style.min.css +0 -0
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/colgroup/style/index.js +1 -0
- package/lib/colgroup/style/style.css +0 -0
- package/lib/colgroup/style/style.min.css +0 -0
- package/lib/column/style/index.js +1 -0
- package/lib/column/style/style.css +0 -0
- package/lib/column/style/style.min.css +0 -0
- package/lib/grid/style/index.js +1 -0
- package/lib/grid/style/style.css +86 -0
- package/lib/grid/style/style.min.css +1 -0
- package/lib/iconfont.1758609514163.ttf +0 -0
- package/lib/iconfont.1758609514163.woff +0 -0
- package/lib/iconfont.1758609514163.woff2 +0 -0
- package/lib/index.common.js +22 -0
- package/lib/index.umd.js +73 -25
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.d.ts +2 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +806 -0
- package/lib/locale/lang/de-DE.d.ts +2 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +806 -0
- package/lib/locale/lang/en-US.d.ts +2 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +806 -0
- package/lib/locale/lang/es-ES.d.ts +2 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +806 -0
- package/lib/locale/lang/fr-FR.d.ts +2 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +806 -0
- package/lib/locale/lang/hu-HU.d.ts +2 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +806 -0
- package/lib/locale/lang/hy-AM.d.ts +2 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +806 -0
- package/lib/locale/lang/id-ID.d.ts +2 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +806 -0
- package/lib/locale/lang/it-IT.d.ts +2 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +806 -0
- package/lib/locale/lang/ja-JP.d.ts +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +806 -0
- package/lib/locale/lang/ko-KR.d.ts +2 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +806 -0
- package/lib/locale/lang/ms-MY.d.ts +2 -0
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +806 -0
- package/lib/locale/lang/nb-NO.d.ts +2 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +806 -0
- package/lib/locale/lang/pt-BR.d.ts +2 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +806 -0
- package/lib/locale/lang/ru-RU.d.ts +2 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +806 -0
- package/lib/locale/lang/th-TH.d.ts +2 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +806 -0
- package/lib/locale/lang/ug-CN.d.ts +2 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +806 -0
- package/lib/locale/lang/uk-UA.d.ts +2 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +806 -0
- package/lib/locale/lang/uz-UZ.d.ts +2 -0
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +806 -0
- package/lib/locale/lang/vi-VN.d.ts +2 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +806 -0
- package/lib/locale/lang/zh-CHT.d.ts +2 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +806 -0
- package/lib/locale/lang/zh-CN.d.ts +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +808 -0
- package/lib/locale/lang/zh-HK.d.ts +2 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +23 -0
- package/lib/locale/lang/zh-MO.d.ts +2 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +23 -0
- package/lib/locale/lang/zh-TW.d.ts +2 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +23 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +430 -0
- package/lib/table/module/custom/hook.min.js +1 -0
- package/lib/table/module/custom/panel.js +1193 -0
- package/lib/table/module/custom/panel.min.js +1 -0
- package/lib/table/module/edit/hook.js +1308 -0
- package/lib/table/module/edit/hook.min.js +1 -0
- package/lib/table/module/export/export-panel.js +467 -0
- package/lib/table/module/export/export-panel.min.js +1 -0
- package/lib/table/module/export/hook.js +1888 -0
- package/lib/table/module/export/hook.min.js +1 -0
- package/lib/table/module/export/import-panel.js +226 -0
- package/lib/table/module/export/import-panel.min.js +1 -0
- package/lib/table/module/export/util.js +20 -0
- package/lib/table/module/export/util.min.js +1 -0
- package/lib/table/module/filter/hook.js +458 -0
- package/lib/table/module/filter/hook.min.js +1 -0
- package/lib/table/module/filter/panel.js +265 -0
- package/lib/table/module/filter/panel.min.js +1 -0
- package/lib/table/module/keyboard/hook.js +579 -0
- package/lib/table/module/keyboard/hook.min.js +1 -0
- package/lib/table/module/menu/hook.js +392 -0
- package/lib/table/module/menu/hook.min.js +1 -0
- package/lib/table/module/menu/panel.js +150 -0
- package/lib/table/module/menu/panel.min.js +1 -0
- package/lib/table/module/validator/hook.js +681 -0
- package/lib/table/module/validator/hook.min.js +1 -0
- package/lib/table/src/cell.js +9 -4
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.min.js +1 -0
- package/lib/table/src/props.js +318 -0
- package/lib/table/src/props.min.js +1 -0
- package/lib/table/src/store.js +15 -0
- package/lib/table/src/store.min.js +1 -0
- package/lib/table/src/table.js +924 -0
- package/lib/table/src/table.min.js +1 -0
- package/lib/table/src/use/cell-view.js +57 -0
- package/lib/table/src/use/cell-view.min.js +1 -0
- package/lib/table/src/use/index.js +16 -0
- package/lib/table/src/use/index.min.js +1 -0
- package/lib/table/src/util.js +916 -0
- package/lib/table/src/util.min.js +1 -0
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/style.css +3657 -0
- package/lib/table/style/style.min.css +1 -0
- package/lib/toolbar/style/index.js +1 -0
- package/lib/toolbar/style/style.css +90 -0
- package/lib/toolbar/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/style/index.js +1 -0
- package/lib/ui/style/style.css +0 -0
- package/lib/ui/style/style.min.css +0 -0
- package/lib/v-x-e-table/style/index.js +1 -0
- package/lib/v-x-e-table/style/style.css +0 -0
- package/lib/v-x-e-table/style/style.min.css +0 -0
- package/lib/vxe-colgroup/style/index.js +1 -0
- package/lib/vxe-colgroup/style/style.css +0 -0
- package/lib/vxe-colgroup/style/style.min.css +0 -0
- package/lib/vxe-column/style/index.js +1 -0
- package/lib/vxe-column/style/style.css +0 -0
- package/lib/vxe-column/style/style.min.css +0 -0
- package/lib/vxe-grid/style/index.js +1 -0
- package/lib/vxe-grid/style/style.css +86 -0
- package/lib/vxe-grid/style/style.min.css +1 -0
- package/lib/vxe-table/style/index.js +1 -0
- package/lib/vxe-table/style/style.css +3657 -0
- package/lib/vxe-table/style/style.min.css +1 -0
- package/lib/vxe-toolbar/style/index.js +1 -0
- package/lib/vxe-toolbar/style/style.css +90 -0
- package/lib/vxe-toolbar/style/style.min.css +1 -0
- package/lib/vxe-ui/style/index.js +1 -0
- package/lib/vxe-ui/style/style.css +0 -0
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/lib/vxe-v-x-e-table/style/index.js +1 -0
- package/lib/vxe-v-x-e-table/style/style.css +0 -0
- package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
- package/package.json +1 -1
- package/packages/table/module/filter/hook.ts +23 -6
- package/packages/table/module/filter/panel.ts +4 -4
- package/packages/table/module/menu/panel.ts +29 -16
- package/packages/table/src/cell.ts +10 -7
- package/packages/table/src/table.ts +22 -22
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
4
|
+
var _ui = require("../../../ui");
|
|
5
|
+
var _util = require("../../src/util");
|
|
6
|
+
var _dom = require("../../../ui/src/dom");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
const {
|
|
9
|
+
hooks
|
|
10
|
+
} = _ui.VxeUI;
|
|
11
|
+
const browseObj = _xeUtils.default.browse();
|
|
12
|
+
function getTargetOffset(target, container) {
|
|
13
|
+
let offsetTop = 0;
|
|
14
|
+
let offsetLeft = 0;
|
|
15
|
+
const triggerCheckboxLabel = !browseObj.firefox && (0, _dom.hasClass)(target, 'vxe-checkbox--label');
|
|
16
|
+
if (triggerCheckboxLabel) {
|
|
17
|
+
const checkboxLabelStyle = getComputedStyle(target);
|
|
18
|
+
offsetTop -= _xeUtils.default.toNumber(checkboxLabelStyle.paddingTop);
|
|
19
|
+
offsetLeft -= _xeUtils.default.toNumber(checkboxLabelStyle.paddingLeft);
|
|
20
|
+
}
|
|
21
|
+
while (target && target !== container) {
|
|
22
|
+
offsetTop += target.offsetTop;
|
|
23
|
+
offsetLeft += target.offsetLeft;
|
|
24
|
+
target = target.offsetParent;
|
|
25
|
+
if (triggerCheckboxLabel) {
|
|
26
|
+
const checkboxStyle = getComputedStyle(target);
|
|
27
|
+
offsetTop -= _xeUtils.default.toNumber(checkboxStyle.paddingTop);
|
|
28
|
+
offsetLeft -= _xeUtils.default.toNumber(checkboxStyle.paddingLeft);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
offsetTop,
|
|
33
|
+
offsetLeft
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
hooks.add('tableKeyboardModule', {
|
|
37
|
+
setupTable($xeTable) {
|
|
38
|
+
const {
|
|
39
|
+
props,
|
|
40
|
+
reactData,
|
|
41
|
+
internalData
|
|
42
|
+
} = $xeTable;
|
|
43
|
+
const {
|
|
44
|
+
refElem
|
|
45
|
+
} = $xeTable.getRefMaps();
|
|
46
|
+
const {
|
|
47
|
+
computeEditOpts,
|
|
48
|
+
computeCheckboxOpts,
|
|
49
|
+
computeMouseOpts,
|
|
50
|
+
computeTreeOpts,
|
|
51
|
+
computeRowOpts,
|
|
52
|
+
computeColumnOpts,
|
|
53
|
+
computeCellOpts,
|
|
54
|
+
computeDefaultRowHeight,
|
|
55
|
+
computeCurrentRowOpts,
|
|
56
|
+
computeCurrentColumnOpts
|
|
57
|
+
} = $xeTable.getComputeMaps();
|
|
58
|
+
function getCheckboxRangeRows(evnt, params, targetTrElem, trRect, offsetClientTop, moveRange) {
|
|
59
|
+
const {
|
|
60
|
+
showOverflow
|
|
61
|
+
} = props;
|
|
62
|
+
const {
|
|
63
|
+
fullAllDataRowIdData,
|
|
64
|
+
isResizeCellHeight
|
|
65
|
+
} = internalData;
|
|
66
|
+
const rowOpts = computeRowOpts.value;
|
|
67
|
+
const cellOpts = computeCellOpts.value;
|
|
68
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
69
|
+
const {
|
|
70
|
+
row
|
|
71
|
+
} = params;
|
|
72
|
+
let countHeight = 0;
|
|
73
|
+
let rangeRows = [];
|
|
74
|
+
let moveSize = 0;
|
|
75
|
+
const isDown = moveRange > 0;
|
|
76
|
+
const {
|
|
77
|
+
scrollYLoad
|
|
78
|
+
} = reactData;
|
|
79
|
+
const {
|
|
80
|
+
afterFullData
|
|
81
|
+
} = internalData;
|
|
82
|
+
if (isDown) {
|
|
83
|
+
moveSize = offsetClientTop + moveRange;
|
|
84
|
+
} else {
|
|
85
|
+
moveSize = trRect.height - offsetClientTop + Math.abs(moveRange);
|
|
86
|
+
}
|
|
87
|
+
if (scrollYLoad) {
|
|
88
|
+
const _rowIndex = $xeTable.getVTRowIndex(row);
|
|
89
|
+
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
90
|
+
if (!isCustomCellHeight && showOverflow) {
|
|
91
|
+
if (isDown) {
|
|
92
|
+
rangeRows = afterFullData.slice(_rowIndex, _rowIndex + Math.ceil(moveSize / defaultRowHeight));
|
|
93
|
+
} else {
|
|
94
|
+
rangeRows = afterFullData.slice(_rowIndex - Math.floor(moveSize / defaultRowHeight), _rowIndex + 1);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
if (isDown) {
|
|
98
|
+
for (let i = _rowIndex; i < afterFullData.length; i++) {
|
|
99
|
+
const item = afterFullData[i];
|
|
100
|
+
const rowid = $xeTable.getRowid(item);
|
|
101
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
102
|
+
countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
103
|
+
rangeRows.push(item);
|
|
104
|
+
if (countHeight > moveSize) {
|
|
105
|
+
return rangeRows;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
for (let len = _rowIndex; len >= 0; len--) {
|
|
110
|
+
const item = afterFullData[len];
|
|
111
|
+
const rowid = $xeTable.getRowid(item);
|
|
112
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
113
|
+
countHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
114
|
+
rangeRows.push(item);
|
|
115
|
+
if (countHeight > moveSize) {
|
|
116
|
+
return rangeRows;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
const siblingProp = isDown ? 'next' : 'previous';
|
|
123
|
+
while (targetTrElem && countHeight < moveSize) {
|
|
124
|
+
const rowNodeRest = $xeTable.getRowNode(targetTrElem);
|
|
125
|
+
if (rowNodeRest) {
|
|
126
|
+
rangeRows.push(rowNodeRest.item);
|
|
127
|
+
countHeight += targetTrElem.offsetHeight;
|
|
128
|
+
targetTrElem = targetTrElem[`${siblingProp}ElementSibling`];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return rangeRows;
|
|
133
|
+
}
|
|
134
|
+
const handleCheckboxRangeEvent = (evnt, params) => {
|
|
135
|
+
const {
|
|
136
|
+
elemStore
|
|
137
|
+
} = internalData;
|
|
138
|
+
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
139
|
+
const leftScrollElem = (0, _util.getRefElem)(elemStore['left-body-scroll']);
|
|
140
|
+
const rightScrollElem = (0, _util.getRefElem)(elemStore['right-body-scroll']);
|
|
141
|
+
const {
|
|
142
|
+
column,
|
|
143
|
+
cell
|
|
144
|
+
} = params;
|
|
145
|
+
if (column.type === 'checkbox') {
|
|
146
|
+
let bodyWrapperElem = bodyScrollElem;
|
|
147
|
+
if (leftScrollElem && column.fixed === 'left') {
|
|
148
|
+
bodyWrapperElem = leftScrollElem;
|
|
149
|
+
} else if (rightScrollElem && column.fixed === 'right') {
|
|
150
|
+
bodyWrapperElem = rightScrollElem;
|
|
151
|
+
}
|
|
152
|
+
if (!bodyWrapperElem) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const el = refElem.value;
|
|
156
|
+
const disX = evnt.clientX;
|
|
157
|
+
const disY = evnt.clientY;
|
|
158
|
+
const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range');
|
|
159
|
+
const trElem = cell.parentElement;
|
|
160
|
+
const selectRecords = $xeTable.getCheckboxRecords();
|
|
161
|
+
let lastRangeRows = [];
|
|
162
|
+
const marginSize = 1;
|
|
163
|
+
const offsetRest = getTargetOffset(evnt.target, bodyWrapperElem);
|
|
164
|
+
const startTop = offsetRest.offsetTop + evnt.offsetY;
|
|
165
|
+
const startLeft = offsetRest.offsetLeft + evnt.offsetX;
|
|
166
|
+
const startScrollTop = bodyWrapperElem.scrollTop;
|
|
167
|
+
const rowHeight = trElem.offsetHeight;
|
|
168
|
+
const trRect = trElem.getBoundingClientRect();
|
|
169
|
+
const offsetClientTop = disY - trRect.y;
|
|
170
|
+
let mouseScrollTimeout = null;
|
|
171
|
+
let isMouseScrollDown = false;
|
|
172
|
+
let mouseScrollSpaceSize = 1;
|
|
173
|
+
const triggerEvent = (type, evnt) => {
|
|
174
|
+
$xeTable.dispatchEvent(`checkbox-range-${type}`, {
|
|
175
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
176
|
+
reserves: () => $xeTable.getCheckboxReserveRecords()
|
|
177
|
+
}, evnt);
|
|
178
|
+
};
|
|
179
|
+
const handleChecked = evnt => {
|
|
180
|
+
const {
|
|
181
|
+
clientX,
|
|
182
|
+
clientY
|
|
183
|
+
} = evnt;
|
|
184
|
+
const offsetLeft = clientX - disX;
|
|
185
|
+
const offsetTop = clientY - disY + (bodyWrapperElem.scrollTop - startScrollTop);
|
|
186
|
+
let rangeHeight = Math.abs(offsetTop);
|
|
187
|
+
let rangeWidth = Math.abs(offsetLeft);
|
|
188
|
+
let rangeTop = startTop;
|
|
189
|
+
let rangeLeft = startLeft;
|
|
190
|
+
if (offsetTop < marginSize) {
|
|
191
|
+
// 向上
|
|
192
|
+
rangeTop += offsetTop;
|
|
193
|
+
if (rangeTop < marginSize) {
|
|
194
|
+
rangeTop = marginSize;
|
|
195
|
+
rangeHeight = startTop;
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
// 向下
|
|
199
|
+
rangeHeight = Math.min(rangeHeight, bodyWrapperElem.scrollHeight - startTop - marginSize);
|
|
200
|
+
}
|
|
201
|
+
if (offsetLeft < marginSize) {
|
|
202
|
+
// 向左
|
|
203
|
+
rangeLeft += offsetLeft;
|
|
204
|
+
if (rangeWidth > startLeft) {
|
|
205
|
+
rangeLeft = marginSize;
|
|
206
|
+
rangeWidth = startLeft;
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
// 向右
|
|
210
|
+
rangeWidth = Math.min(rangeWidth, bodyWrapperElem.clientWidth - startLeft - marginSize);
|
|
211
|
+
}
|
|
212
|
+
checkboxRangeElem.style.height = `${rangeHeight}px`;
|
|
213
|
+
checkboxRangeElem.style.width = `${rangeWidth}px`;
|
|
214
|
+
checkboxRangeElem.style.left = `${rangeLeft}px`;
|
|
215
|
+
checkboxRangeElem.style.top = `${rangeTop}px`;
|
|
216
|
+
checkboxRangeElem.style.display = 'block';
|
|
217
|
+
const rangeRows = getCheckboxRangeRows(evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight);
|
|
218
|
+
// 至少滑动 10px 才能有效匹配
|
|
219
|
+
if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
|
|
220
|
+
const isControlKey = (0, _dom.hasControlKey)(evnt);
|
|
221
|
+
lastRangeRows = rangeRows;
|
|
222
|
+
if (isControlKey) {
|
|
223
|
+
rangeRows.forEach(row => {
|
|
224
|
+
$xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1);
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
$xeTable.setAllCheckboxRow(false);
|
|
228
|
+
$xeTable.handleCheckedCheckboxRow(rangeRows, true, false);
|
|
229
|
+
}
|
|
230
|
+
triggerEvent('change', evnt);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
// 停止鼠标滚动
|
|
234
|
+
const stopMouseScroll = () => {
|
|
235
|
+
clearTimeout(mouseScrollTimeout);
|
|
236
|
+
mouseScrollTimeout = null;
|
|
237
|
+
};
|
|
238
|
+
// 开始鼠标滚动
|
|
239
|
+
const startMouseScroll = evnt => {
|
|
240
|
+
stopMouseScroll();
|
|
241
|
+
mouseScrollTimeout = setTimeout(() => {
|
|
242
|
+
if (mouseScrollTimeout) {
|
|
243
|
+
const {
|
|
244
|
+
scrollLeft,
|
|
245
|
+
scrollTop,
|
|
246
|
+
clientHeight,
|
|
247
|
+
scrollHeight
|
|
248
|
+
} = bodyWrapperElem;
|
|
249
|
+
const topSize = Math.ceil(mouseScrollSpaceSize * 50 / rowHeight);
|
|
250
|
+
if (isMouseScrollDown) {
|
|
251
|
+
if (scrollTop + clientHeight < scrollHeight) {
|
|
252
|
+
$xeTable.scrollTo(scrollLeft, scrollTop + topSize);
|
|
253
|
+
startMouseScroll(evnt);
|
|
254
|
+
handleChecked(evnt);
|
|
255
|
+
} else {
|
|
256
|
+
stopMouseScroll();
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
if (scrollTop) {
|
|
260
|
+
$xeTable.scrollTo(scrollLeft, scrollTop - topSize);
|
|
261
|
+
startMouseScroll(evnt);
|
|
262
|
+
handleChecked(evnt);
|
|
263
|
+
} else {
|
|
264
|
+
stopMouseScroll();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}, 50);
|
|
269
|
+
};
|
|
270
|
+
(0, _dom.addClass)(el, 'drag--range');
|
|
271
|
+
document.onmousemove = evnt => {
|
|
272
|
+
evnt.preventDefault();
|
|
273
|
+
evnt.stopPropagation();
|
|
274
|
+
const {
|
|
275
|
+
clientY
|
|
276
|
+
} = evnt;
|
|
277
|
+
const {
|
|
278
|
+
boundingTop
|
|
279
|
+
} = (0, _dom.getAbsolutePos)(bodyWrapperElem);
|
|
280
|
+
// 如果超过可视区,触发滚动
|
|
281
|
+
if (clientY < boundingTop) {
|
|
282
|
+
isMouseScrollDown = false;
|
|
283
|
+
mouseScrollSpaceSize = boundingTop - clientY;
|
|
284
|
+
if (!mouseScrollTimeout) {
|
|
285
|
+
startMouseScroll(evnt);
|
|
286
|
+
}
|
|
287
|
+
} else if (clientY > boundingTop + bodyWrapperElem.clientHeight) {
|
|
288
|
+
isMouseScrollDown = true;
|
|
289
|
+
mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight;
|
|
290
|
+
if (!mouseScrollTimeout) {
|
|
291
|
+
startMouseScroll(evnt);
|
|
292
|
+
}
|
|
293
|
+
} else if (mouseScrollTimeout) {
|
|
294
|
+
stopMouseScroll();
|
|
295
|
+
}
|
|
296
|
+
handleChecked(evnt);
|
|
297
|
+
};
|
|
298
|
+
document.onmouseup = evnt => {
|
|
299
|
+
stopMouseScroll();
|
|
300
|
+
(0, _dom.removeClass)(el, 'drag--range');
|
|
301
|
+
checkboxRangeElem.removeAttribute('style');
|
|
302
|
+
document.onmousemove = null;
|
|
303
|
+
document.onmouseup = null;
|
|
304
|
+
triggerEvent('end', evnt);
|
|
305
|
+
};
|
|
306
|
+
triggerEvent('start', evnt);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const handleCellMousedownEvent = (evnt, params) => {
|
|
310
|
+
const {
|
|
311
|
+
editConfig,
|
|
312
|
+
checkboxConfig,
|
|
313
|
+
mouseConfig
|
|
314
|
+
} = props;
|
|
315
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
316
|
+
const mouseOpts = computeMouseOpts.value;
|
|
317
|
+
const editOpts = computeEditOpts.value;
|
|
318
|
+
if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
|
|
319
|
+
return $xeTable.triggerCellAreaModnEvent(evnt, params);
|
|
320
|
+
} else {
|
|
321
|
+
if (checkboxConfig && checkboxOpts.range) {
|
|
322
|
+
handleCheckboxRangeEvent(evnt, params);
|
|
323
|
+
}
|
|
324
|
+
if (mouseConfig && mouseOpts.selected) {
|
|
325
|
+
if (!editConfig || editOpts.mode === 'cell') {
|
|
326
|
+
$xeTable.handleSelected(params, evnt);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
const handleMoveSelected = (evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) => {
|
|
332
|
+
const {
|
|
333
|
+
afterFullData,
|
|
334
|
+
visibleColumn
|
|
335
|
+
} = internalData;
|
|
336
|
+
const params = Object.assign({}, args);
|
|
337
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
338
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
339
|
+
evnt.preventDefault();
|
|
340
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
341
|
+
// 移动到上一行
|
|
342
|
+
params.rowIndex = _rowIndex - 1;
|
|
343
|
+
params.row = afterFullData[params.rowIndex];
|
|
344
|
+
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
345
|
+
// 移动到下一行
|
|
346
|
+
params.rowIndex = _rowIndex + 1;
|
|
347
|
+
params.row = afterFullData[params.rowIndex];
|
|
348
|
+
} else if (isLeftArrow && _columnIndex) {
|
|
349
|
+
// 移动到左侧单元格
|
|
350
|
+
params.columnIndex = _columnIndex - 1;
|
|
351
|
+
params.column = visibleColumn[params.columnIndex];
|
|
352
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
353
|
+
// 移动到右侧单元格
|
|
354
|
+
params.columnIndex = _columnIndex + 1;
|
|
355
|
+
params.column = visibleColumn[params.columnIndex];
|
|
356
|
+
}
|
|
357
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
358
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
359
|
+
$xeTable.handleSelected(params, evnt);
|
|
360
|
+
});
|
|
361
|
+
return params;
|
|
362
|
+
};
|
|
363
|
+
const keyboardMethods = {
|
|
364
|
+
// 处理 Tab 键移动
|
|
365
|
+
moveTabSelected(args, isLeft, evnt) {
|
|
366
|
+
const {
|
|
367
|
+
editConfig
|
|
368
|
+
} = props;
|
|
369
|
+
const {
|
|
370
|
+
afterFullData,
|
|
371
|
+
visibleColumn
|
|
372
|
+
} = internalData;
|
|
373
|
+
const editOpts = computeEditOpts.value;
|
|
374
|
+
const rowOpts = computeRowOpts.value;
|
|
375
|
+
const currentRowOpts = computeCurrentRowOpts.value;
|
|
376
|
+
const columnOpts = computeColumnOpts.value;
|
|
377
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
378
|
+
let targetRow;
|
|
379
|
+
let targetRowIndex;
|
|
380
|
+
let targetColumnIndex;
|
|
381
|
+
const params = Object.assign({}, args);
|
|
382
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
383
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
384
|
+
evnt.preventDefault();
|
|
385
|
+
if (isLeft) {
|
|
386
|
+
// 向左
|
|
387
|
+
if (_columnIndex <= 0) {
|
|
388
|
+
// 如果已经是第一列,则移动到上一行
|
|
389
|
+
if (_rowIndex > 0) {
|
|
390
|
+
targetRowIndex = _rowIndex - 1;
|
|
391
|
+
targetRow = afterFullData[targetRowIndex];
|
|
392
|
+
targetColumnIndex = visibleColumn.length - 1;
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
targetColumnIndex = _columnIndex - 1;
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
if (_columnIndex >= visibleColumn.length - 1) {
|
|
399
|
+
// 如果已经是第一列,则移动到上一行
|
|
400
|
+
if (_rowIndex < afterFullData.length - 1) {
|
|
401
|
+
targetRowIndex = _rowIndex + 1;
|
|
402
|
+
targetRow = afterFullData[targetRowIndex];
|
|
403
|
+
targetColumnIndex = 0;
|
|
404
|
+
}
|
|
405
|
+
} else {
|
|
406
|
+
targetColumnIndex = _columnIndex + 1;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
const targetColumn = visibleColumn[targetColumnIndex];
|
|
410
|
+
if (targetColumn) {
|
|
411
|
+
if (targetRow) {
|
|
412
|
+
params.rowIndex = targetRowIndex;
|
|
413
|
+
params.row = targetRow;
|
|
414
|
+
} else {
|
|
415
|
+
params.rowIndex = _rowIndex;
|
|
416
|
+
}
|
|
417
|
+
params.columnIndex = targetColumnIndex;
|
|
418
|
+
params.column = targetColumn;
|
|
419
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
420
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
421
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
422
|
+
}
|
|
423
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
424
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
425
|
+
}
|
|
426
|
+
if (editConfig) {
|
|
427
|
+
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
428
|
+
if (editOpts.mode === 'row') {
|
|
429
|
+
$xeTable.handleEdit(params, evnt);
|
|
430
|
+
} else {
|
|
431
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
432
|
+
$xeTable.handleSelected(params, evnt);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
438
|
+
$xeTable.handleSelected(params, evnt);
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
// 处理当前行方向键移动
|
|
444
|
+
moveCurrentRow(isUpArrow, isDwArrow, evnt) {
|
|
445
|
+
const {
|
|
446
|
+
treeConfig
|
|
447
|
+
} = props;
|
|
448
|
+
const {
|
|
449
|
+
currentRow
|
|
450
|
+
} = reactData;
|
|
451
|
+
const {
|
|
452
|
+
afterFullData
|
|
453
|
+
} = internalData;
|
|
454
|
+
const treeOpts = computeTreeOpts.value;
|
|
455
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
456
|
+
let targetRow;
|
|
457
|
+
if (currentRow) {
|
|
458
|
+
if (treeConfig) {
|
|
459
|
+
const {
|
|
460
|
+
index,
|
|
461
|
+
items
|
|
462
|
+
} = _xeUtils.default.findTree(afterFullData, item => item === currentRow, {
|
|
463
|
+
children: childrenField
|
|
464
|
+
});
|
|
465
|
+
if (isUpArrow && index > 0) {
|
|
466
|
+
targetRow = items[index - 1];
|
|
467
|
+
} else if (isDwArrow && index < items.length - 1) {
|
|
468
|
+
targetRow = items[index + 1];
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
471
|
+
const _rowIndex = $xeTable.getVTRowIndex(currentRow);
|
|
472
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
473
|
+
targetRow = afterFullData[_rowIndex - 1];
|
|
474
|
+
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
475
|
+
targetRow = afterFullData[_rowIndex + 1];
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
targetRow = afterFullData[0];
|
|
480
|
+
}
|
|
481
|
+
if (targetRow) {
|
|
482
|
+
evnt.preventDefault();
|
|
483
|
+
const params = {
|
|
484
|
+
$table: $xeTable,
|
|
485
|
+
row: targetRow,
|
|
486
|
+
rowIndex: $xeTable.getRowIndex(targetRow),
|
|
487
|
+
$rowIndex: $xeTable.getVMRowIndex(targetRow)
|
|
488
|
+
};
|
|
489
|
+
$xeTable.scrollToRow(targetRow).then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
// 处理当前列方向键移动
|
|
493
|
+
moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
|
|
494
|
+
const {
|
|
495
|
+
currentColumn
|
|
496
|
+
} = reactData;
|
|
497
|
+
const {
|
|
498
|
+
visibleColumn
|
|
499
|
+
} = internalData;
|
|
500
|
+
let targetCol = null;
|
|
501
|
+
if (currentColumn) {
|
|
502
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
|
|
503
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
504
|
+
targetCol = visibleColumn[_columnIndex - 1];
|
|
505
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
506
|
+
targetCol = visibleColumn[_columnIndex + 1];
|
|
507
|
+
}
|
|
508
|
+
} else {
|
|
509
|
+
targetCol = visibleColumn[0];
|
|
510
|
+
}
|
|
511
|
+
if (targetCol) {
|
|
512
|
+
evnt.preventDefault();
|
|
513
|
+
const params = {
|
|
514
|
+
$table: $xeTable,
|
|
515
|
+
column: targetCol,
|
|
516
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
517
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
518
|
+
};
|
|
519
|
+
$xeTable.scrollToColumn(targetCol).then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
// 处理可编辑方向键移动
|
|
523
|
+
moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
524
|
+
const {
|
|
525
|
+
highlightCurrentRow,
|
|
526
|
+
highlightCurrentColumn
|
|
527
|
+
} = props;
|
|
528
|
+
const rowOpts = computeRowOpts.value;
|
|
529
|
+
const currentRowOpts = computeCurrentRowOpts.value;
|
|
530
|
+
const columnOpts = computeColumnOpts.value;
|
|
531
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
532
|
+
const params = handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
533
|
+
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
534
|
+
if (currentRowOpts.isFollowSelected) {
|
|
535
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
536
|
+
} else {
|
|
537
|
+
// 当前行按键上下移动
|
|
538
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
539
|
+
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (columnOpts.isCurrent || highlightCurrentColumn) {
|
|
544
|
+
if (currentColumnOpts.isFollowSelected) {
|
|
545
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
546
|
+
} else {
|
|
547
|
+
// 当前行按键左右移动
|
|
548
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
549
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
555
|
+
const {
|
|
556
|
+
highlightCurrentRow,
|
|
557
|
+
highlightCurrentColumn
|
|
558
|
+
} = props;
|
|
559
|
+
const rowOpts = computeRowOpts.value;
|
|
560
|
+
const currentRowOpts = computeCurrentRowOpts.value;
|
|
561
|
+
const columnOpts = computeColumnOpts.value;
|
|
562
|
+
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
563
|
+
const params = handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
564
|
+
if ((rowOpts.isCurrent || highlightCurrentRow) && currentRowOpts.isFollowSelected) {
|
|
565
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
566
|
+
}
|
|
567
|
+
if ((columnOpts.isCurrent || highlightCurrentColumn) && currentColumnOpts.isFollowSelected) {
|
|
568
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
// 已废弃,待删除
|
|
572
|
+
moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
573
|
+
handleMoveSelected(evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
574
|
+
},
|
|
575
|
+
handleCellMousedownEvent
|
|
576
|
+
};
|
|
577
|
+
return keyboardMethods;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../../ui"),_util=require("../../src/util"),_dom=require("../../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let hooks=_ui.VxeUI.hooks,browseObj=_xeUtils.default.browse();function getTargetOffset(e,t){let l=0,o=0;var r,n,u=!browseObj.firefox&&(0,_dom.hasClass)(e,"vxe-checkbox--label");for(u&&(r=getComputedStyle(e),l-=_xeUtils.default.toNumber(r.paddingTop),o-=_xeUtils.default.toNumber(r.paddingLeft));e&&e!==t;)l+=e.offsetTop,o+=e.offsetLeft,e=e.offsetParent,u&&(n=getComputedStyle(e),l-=_xeUtils.default.toNumber(n.paddingTop),o-=_xeUtils.default.toNumber(n.paddingLeft));return{offsetTop:l,offsetLeft:o}}hooks.add("tableKeyboardModule",{setupTable(k){let{props:M,reactData:y,internalData:O}=k,D=k.getRefMaps().refElem,{computeEditOpts:v,computeCheckboxOpts:a,computeMouseOpts:s,computeTreeOpts:c,computeRowOpts:F,computeColumnOpts:C,computeCellOpts:H,computeDefaultRowHeight:V,computeCurrentRowOpts:p,computeCurrentColumnOpts:w}=k.getComputeMaps();let d=(e,S)=>{var t=O.elemStore,l=(0,_util.getRefElem)(t["main-body-scroll"]),o=(0,_util.getRefElem)(t["left-body-scroll"]),t=(0,_util.getRefElem)(t["right-body-scroll"]),{column:r,cell:n}=S;if("checkbox"===r.type){let _=l;if(o&&"left"===r.fixed?_=o:t&&"right"===r.fixed&&(_=t),_){let t=D.value,i=e.clientX,a=e.clientY,s=_.querySelector(".vxe-table--checkbox-range"),c=n.parentElement,d=k.getCheckboxRecords(),g=[],h=1;l=getTargetOffset(e.target,_);let m=l.offsetTop+e.offsetY,f=l.offsetLeft+e.offsetX,v=_.scrollTop,u=c.offsetHeight,C=c.getBoundingClientRect(),p=a-C.y,w=null,x=!1,b=1,R=(e,t)=>{k.dispatchEvent("checkbox-range-"+e,{records:()=>k.getCheckboxRecords(),reserves:()=>k.getCheckboxReserveRecords()},t)},T=e=>{var{clientX:t,clientY:l}=e,t=t-i,l=l-a+(_.scrollTop-v);let o=Math.abs(l),r=Math.abs(t),n=m,u=f;l<h?(n+=l)<h&&(n=h,o=m):o=Math.min(o,_.scrollHeight-m-h),t<h?(u+=t,r>f&&(u=h,r=f)):r=Math.min(r,_.clientWidth-f-h),s.style.height=o+"px",s.style.width=r+"px",s.style.left=u+"px",s.style.top=n+"px",s.style.display="block";t=((e,t,l,o,r)=>{var n=M.showOverflow,{fullAllDataRowIdData:u,isResizeCellHeight:i}=O,a=F.value,s=H.value,c=V.value,e=e.row;let d=0,g=[],h=0;var m=0<r,f=y.scrollYLoad,v=O.afterFullData;if(h=m?o+r:l.height-o+Math.abs(r),f){l=k.getVTRowIndex(e);if(!(i||s.height||a.height)&&n)g=m?v.slice(l,l+Math.ceil(h/c)):v.slice(l-Math.floor(h/c),l+1);else if(m)for(let e=l;e<v.length;e++){var C=v[e],p=u[k.getRowid(C)]||{};if(d+=p.resizeHeight||s.height||a.height||p.height||c,g.push(C),d>h)return g}else for(let e=l;0<=e;e--){var w=v[e],x=u[k.getRowid(w)]||{};if(d+=x.resizeHeight||s.height||a.height||x.height||c,g.push(w),d>h)return g}}else for(var b=m?"next":"previous";t&&d<h;){var R=k.getRowNode(t);R&&(g.push(R.item),d+=t.offsetHeight,t=t[b+"ElementSibling"])}return g})(S,c,C,p,l<h?-o:o);10<o&&t.length!==g.length&&(l=(0,_dom.hasControlKey)(e),g=t,l?t.forEach(e=>{k.handleBatchSelectRows([e],-1===d.indexOf(e))}):(k.setAllCheckboxRow(!1),k.handleCheckedCheckboxRow(t,!0,!1)),R("change",e))},I=()=>{clearTimeout(w),w=null},E=n=>{I(),w=setTimeout(()=>{var e,t,l,o,r;w&&({scrollLeft:e,scrollTop:t,clientHeight:l,scrollHeight:o}=_,r=Math.ceil(50*b/u),x?t+l<o?(k.scrollTo(e,t+r),E(n),T(n)):I():t?(k.scrollTo(e,t-r),E(n),T(n)):I())},50)};(0,_dom.addClass)(t,"drag--range"),document.onmousemove=e=>{e.preventDefault(),e.stopPropagation();var t=e.clientY,l=(0,_dom.getAbsolutePos)(_).boundingTop;t<l?(x=!1,b=l-t,w||E(e)):t>l+_.clientHeight?(x=!0,b=t-l-_.clientHeight,w||E(e)):w&&I(),T(e)},document.onmouseup=e=>{I(),(0,_dom.removeClass)(t,"drag--range"),s.removeAttribute("style"),document.onmousemove=null,document.onmouseup=null,R("end",e)},R("start",e)}}};let g=(e,t,l,o,r,n)=>{var{afterFullData:u,visibleColumn:i}=O;let a=Object.assign({},t);var t=k.getVTRowIndex(a.row),s=k.getVTColumnIndex(a.column);return e.preventDefault(),o&&0<t?(a.rowIndex=t-1,a.row=u[a.rowIndex]):n&&t<u.length-1?(a.rowIndex=t+1,a.row=u[a.rowIndex]):l&&s?(a.columnIndex=s-1,a.column=i[a.columnIndex]):r&&s<i.length-1&&(a.columnIndex=s+1,a.column=i[a.columnIndex]),k.scrollToRow(a.row,a.column).then(()=>{a.cell=k.getCellElement(a.row,a.column),k.handleSelected(a,e)}),a};return{moveTabSelected(e,t,l){var o=M.editConfig,{afterFullData:r,visibleColumn:n}=O,u=v.value,i=F.value,a=p.value,s=C.value,c=w.value;let d,g,h,m=Object.assign({},e);var e=k.getVTRowIndex(m.row),f=k.getVTColumnIndex(m.column),t=(l.preventDefault(),t?f<=0?0<e&&(g=e-1,d=r[g],h=n.length-1):h=f-1:f>=n.length-1?e<r.length-1&&(g=e+1,d=r[g],h=0):h=f+1,n[h]);t&&(d?(m.rowIndex=g,m.row=d):m.rowIndex=e,m.columnIndex=h,m.column=t,m.cell=k.getCellElement(m.row,m.column),i.isCurrent&&a.isFollowSelected&&k.triggerCurrentRowEvent(l,m),s.isCurrent&&c.isFollowSelected&&k.triggerCurrentColumnEvent(l,m),o?"click"!==u.trigger&&"dblclick"!==u.trigger||("row"===u.mode?k.handleEdit(m,l):k.scrollToRow(m.row,m.column).then(()=>{k.handleSelected(m,l)})):k.scrollToRow(m.row,m.column).then(()=>{k.handleSelected(m,l)}))},moveCurrentRow(e,t,l){var o=M.treeConfig;let r=y.currentRow;var n=O.afterFullData,u=c.value,u=u.children||u.childrenField;let i;if(r?o?({index:o,items:u}=_xeUtils.default.findTree(n,e=>e===r,{children:u}),e&&0<o?i=u[o-1]:t&&o<u.length-1&&(i=u[o+1])):(u=k.getVTRowIndex(r),e&&0<u?i=n[u-1]:t&&u<n.length-1&&(i=n[u+1])):i=n[0],i){l.preventDefault();let e={$table:k,row:i,rowIndex:k.getRowIndex(i),$rowIndex:k.getVMRowIndex(i)};k.scrollToRow(i).then(()=>k.triggerCurrentRowEvent(l,e))}},moveCurrentColumn(e,t,l){var o=y.currentColumn,r=O.visibleColumn;let n=null;if(o?(o=k.getVTColumnIndex(o),e&&0<o?n=r[o-1]:t&&o<r.length-1&&(n=r[o+1])):n=r[0],n){l.preventDefault();let e={$table:k,column:n,columnIndex:k.getColumnIndex(n),$columnIndex:k.getVMColumnIndex(n)};k.scrollToColumn(n).then(()=>k.triggerCurrentColumnEvent(l,e))}},moveArrowSelected(e,t,l,o,r,n){var{highlightCurrentRow:u,highlightCurrentColumn:i}=M,a=F.value,s=p.value,c=C.value,d=w.value,e=g(n,e,t,l,o,r);(a.isCurrent||u)&&(s.isFollowSelected?k.triggerCurrentRowEvent(n,e):(l||r)&&(a.isCurrent||u)&&k.moveCurrentRow(l,r,n)),(c.isCurrent||i)&&(d.isFollowSelected?k.triggerCurrentColumnEvent(n,e):(t||o)&&(c.isCurrent||i)&&k.moveCurrentColumn(t,o,n))},moveEnterSelected(e,t,l,o,r,n){var{highlightCurrentRow:u,highlightCurrentColumn:i}=M,a=F.value,s=p.value,c=C.value,d=w.value,e=g(n,e,t,l,o,r);(a.isCurrent||u)&&s.isFollowSelected&&k.triggerCurrentRowEvent(n,e),(c.isCurrent||i)&&d.isFollowSelected&&k.triggerCurrentColumnEvent(n,e)},moveSelected(e,t,l,o,r,n){g(n,e,t,l,o,r)},handleCellMousedownEvent:(e,t)=>{var{editConfig:l,checkboxConfig:o,mouseConfig:r}=M,n=a.value,u=s.value,i=v.value;if(r&&u.area&&k.triggerCellAreaModnEvent)return k.triggerCellAreaModnEvent(e,t);o&&n.range&&d(e,t),r&&u.selected&&(l&&"cell"!==i.mode||k.handleSelected(t,e))}}}});
|