vxe-table 3.14.0-beta.2 → 3.14.0-beta.21
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/grid/src/grid.js +78 -48
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/edit/mixin.js +14 -9
- package/es/table/module/filter/panel.js +12 -2
- package/es/table/module/keyboard/mixin.js +86 -21
- package/es/table/module/validator/mixin.js +2 -2
- package/es/table/render/index.js +90 -59
- package/es/table/src/body.js +22 -17
- package/es/table/src/cell.js +25 -20
- package/es/table/src/footer.js +9 -4
- package/es/table/src/header.js +2 -2
- package/es/table/src/methods.js +942 -678
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +74 -32
- package/es/table/src/util.js +65 -7
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +85 -65
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1641 -1076
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +7 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +16 -11
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +8 -2
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +89 -25
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +3 -3
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +99 -64
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +27 -17
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +37 -21
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +9 -3
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1101 -798
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +79 -31
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +72 -7
- package/lib/table/src/util.min.js +1 -1
- 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/package.json +2 -2
- package/packages/grid/src/grid.ts +92 -57
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/edit/mixin.ts +17 -12
- package/packages/table/module/filter/panel.ts +12 -2
- package/packages/table/module/keyboard/mixin.ts +94 -27
- package/packages/table/module/validator/mixin.ts +2 -2
- package/packages/table/render/index.ts +89 -57
- package/packages/table/src/body.ts +21 -16
- package/packages/table/src/cell.ts +25 -20
- package/packages/table/src/footer.ts +9 -4
- package/packages/table/src/header.ts +2 -2
- package/packages/table/src/methods.ts +1035 -720
- package/packages/table/src/props.ts +16 -12
- package/packages/table/src/table.ts +87 -35
- package/packages/table/src/util.ts +73 -7
- /package/es/{iconfont.1741079977180.ttf → iconfont.1742437924038.ttf} +0 -0
- /package/es/{iconfont.1741079977180.woff → iconfont.1742437924038.woff} +0 -0
- /package/es/{iconfont.1741079977180.woff2 → iconfont.1742437924038.woff2} +0 -0
- /package/lib/{iconfont.1741079977180.ttf → iconfont.1742437924038.ttf} +0 -0
- /package/lib/{iconfont.1741079977180.woff → iconfont.1742437924038.woff} +0 -0
- /package/lib/{iconfont.1741079977180.woff2 → iconfont.1742437924038.woff2} +0 -0
|
@@ -54,14 +54,24 @@ export default {
|
|
|
54
54
|
if (filterSlot) {
|
|
55
55
|
return [
|
|
56
56
|
h('div', {
|
|
57
|
-
class: 'vxe-table--filter-template'
|
|
57
|
+
class: 'vxe-table--filter-template',
|
|
58
|
+
style: maxHeight
|
|
59
|
+
? {
|
|
60
|
+
maxHeight: `${maxHeight}px`
|
|
61
|
+
}
|
|
62
|
+
: {}
|
|
58
63
|
}, $xeTable.callSlot(filterSlot, params, h))
|
|
59
64
|
];
|
|
60
65
|
}
|
|
61
66
|
else if (rtFilter) {
|
|
62
67
|
return [
|
|
63
68
|
h('div', {
|
|
64
|
-
class: 'vxe-table--filter-template'
|
|
69
|
+
class: 'vxe-table--filter-template',
|
|
70
|
+
style: maxHeight
|
|
71
|
+
? {
|
|
72
|
+
maxHeight: `${maxHeight}px`
|
|
73
|
+
}
|
|
74
|
+
: {}
|
|
65
75
|
}, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))
|
|
66
76
|
];
|
|
67
77
|
}
|
|
@@ -99,13 +99,22 @@ export default {
|
|
|
99
99
|
methods: {
|
|
100
100
|
// 处理 Tab 键移动
|
|
101
101
|
moveTabSelected(args, isLeft, evnt) {
|
|
102
|
-
const
|
|
102
|
+
const $xeTable = this;
|
|
103
|
+
const props = $xeTable;
|
|
104
|
+
const internalData = $xeTable;
|
|
105
|
+
const { editConfig } = props;
|
|
106
|
+
const { afterFullData, visibleColumn } = internalData;
|
|
107
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
108
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
109
|
+
const currentRowOpts = $xeTable.computeCurrentRowOpts;
|
|
110
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
111
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
103
112
|
let targetRow;
|
|
104
113
|
let targetRowIndex;
|
|
105
114
|
let targetColumnIndex;
|
|
106
115
|
const params = Object.assign({}, args);
|
|
107
|
-
const _rowIndex =
|
|
108
|
-
const _columnIndex =
|
|
116
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
117
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
109
118
|
evnt.preventDefault();
|
|
110
119
|
if (isLeft) {
|
|
111
120
|
// 向左
|
|
@@ -145,30 +154,46 @@ export default {
|
|
|
145
154
|
}
|
|
146
155
|
params.columnIndex = targetColumnIndex;
|
|
147
156
|
params.column = targetColumn;
|
|
148
|
-
params.cell =
|
|
157
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
158
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
159
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
160
|
+
}
|
|
161
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
162
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
163
|
+
}
|
|
149
164
|
if (editConfig) {
|
|
150
165
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
151
166
|
if (editOpts.mode === 'row') {
|
|
152
|
-
|
|
167
|
+
$xeTable.handleEdit(params, evnt);
|
|
153
168
|
}
|
|
154
169
|
else {
|
|
155
|
-
|
|
156
|
-
.then(() =>
|
|
170
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
171
|
+
.then(() => {
|
|
172
|
+
$xeTable.handleSelected(params, evnt);
|
|
173
|
+
});
|
|
157
174
|
}
|
|
158
175
|
}
|
|
159
176
|
}
|
|
160
177
|
else {
|
|
161
|
-
|
|
162
|
-
.then(() =>
|
|
178
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
179
|
+
.then(() => {
|
|
180
|
+
$xeTable.handleSelected(params, evnt);
|
|
181
|
+
});
|
|
163
182
|
}
|
|
164
183
|
}
|
|
165
184
|
},
|
|
166
185
|
// 处理当前行方向键移动
|
|
167
186
|
moveCurrentRow(isUpArrow, isDwArrow, evnt) {
|
|
168
|
-
const
|
|
187
|
+
const $xeTable = this;
|
|
188
|
+
const props = $xeTable;
|
|
189
|
+
const reactData = $xeTable;
|
|
190
|
+
const internalData = $xeTable;
|
|
191
|
+
const { treeConfig } = props;
|
|
192
|
+
const { currentRow } = reactData;
|
|
193
|
+
const { afterFullData } = internalData;
|
|
194
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
169
195
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
170
196
|
let targetRow;
|
|
171
|
-
evnt.preventDefault();
|
|
172
197
|
if (currentRow) {
|
|
173
198
|
if (treeConfig) {
|
|
174
199
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
|
|
@@ -180,7 +205,7 @@ export default {
|
|
|
180
205
|
}
|
|
181
206
|
}
|
|
182
207
|
else {
|
|
183
|
-
const _rowIndex =
|
|
208
|
+
const _rowIndex = $xeTable.getVTRowIndex(currentRow);
|
|
184
209
|
if (isUpArrow && _rowIndex > 0) {
|
|
185
210
|
targetRow = afterFullData[_rowIndex - 1];
|
|
186
211
|
}
|
|
@@ -193,17 +218,57 @@ export default {
|
|
|
193
218
|
targetRow = afterFullData[0];
|
|
194
219
|
}
|
|
195
220
|
if (targetRow) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
221
|
+
evnt.preventDefault();
|
|
222
|
+
const params = {
|
|
223
|
+
$table: $xeTable,
|
|
224
|
+
row: targetRow,
|
|
225
|
+
rowIndex: $xeTable.getRowIndex(targetRow),
|
|
226
|
+
$rowIndex: $xeTable.getVMRowIndex(targetRow)
|
|
227
|
+
};
|
|
228
|
+
$xeTable.scrollToRow(targetRow)
|
|
229
|
+
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
// 处理当前列方向键移动
|
|
233
|
+
moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
|
|
234
|
+
const $xeTable = this;
|
|
235
|
+
const reactData = $xeTable;
|
|
236
|
+
const internalData = $xeTable;
|
|
237
|
+
const { currentColumn } = reactData;
|
|
238
|
+
const { visibleColumn } = internalData;
|
|
239
|
+
let targetCol = null;
|
|
240
|
+
if (currentColumn) {
|
|
241
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
|
|
242
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
243
|
+
targetCol = visibleColumn[_columnIndex - 1];
|
|
244
|
+
}
|
|
245
|
+
else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
246
|
+
targetCol = visibleColumn[_columnIndex + 1];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
targetCol = visibleColumn[0];
|
|
251
|
+
}
|
|
252
|
+
if (targetCol) {
|
|
253
|
+
evnt.preventDefault();
|
|
254
|
+
const params = {
|
|
255
|
+
$table: $xeTable,
|
|
256
|
+
column: targetCol,
|
|
257
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
258
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
259
|
+
};
|
|
260
|
+
$xeTable.scrollToColumn(targetCol)
|
|
261
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
|
|
199
262
|
}
|
|
200
263
|
},
|
|
201
264
|
// 处理可编辑方向键移动
|
|
202
265
|
moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
203
|
-
const
|
|
266
|
+
const $xeTable = this;
|
|
267
|
+
const internalData = $xeTable;
|
|
268
|
+
const { afterFullData, visibleColumn } = internalData;
|
|
204
269
|
const params = Object.assign({}, args);
|
|
205
|
-
const _rowIndex =
|
|
206
|
-
const _columnIndex =
|
|
270
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
271
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
207
272
|
evnt.preventDefault();
|
|
208
273
|
if (isUpArrow && _rowIndex > 0) {
|
|
209
274
|
// 移动到上一行
|
|
@@ -225,9 +290,9 @@ export default {
|
|
|
225
290
|
params.columnIndex = _columnIndex + 1;
|
|
226
291
|
params.column = visibleColumn[params.columnIndex];
|
|
227
292
|
}
|
|
228
|
-
|
|
229
|
-
params.cell =
|
|
230
|
-
|
|
293
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
294
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
295
|
+
$xeTable.handleSelected(params, evnt);
|
|
231
296
|
});
|
|
232
297
|
},
|
|
233
298
|
handleCellMousedownEvent(evnt, params) {
|
|
@@ -153,8 +153,8 @@ export default {
|
|
|
153
153
|
const internalData = $xeTable;
|
|
154
154
|
const validRest = {};
|
|
155
155
|
const { editRules, treeConfig } = props;
|
|
156
|
-
const { editStore
|
|
157
|
-
const { afterFullData } = internalData;
|
|
156
|
+
const { editStore } = reactData;
|
|
157
|
+
const { afterFullData, pendingRowMaps } = internalData;
|
|
158
158
|
const { removeMaps } = editStore;
|
|
159
159
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
160
160
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
package/es/table/render/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getCellValue, setCellValue } from '../src/util';
|
|
|
4
4
|
import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
|
|
5
5
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
|
|
6
6
|
import { errLog } from '../../ui/src/log';
|
|
7
|
-
const { getConfig, renderer, getI18n } = VxeUI;
|
|
7
|
+
const { getConfig, renderer, getI18n, getComponent } = VxeUI;
|
|
8
8
|
const componentDefaultModelProp = 'value';
|
|
9
9
|
const defaultCompProps = {};
|
|
10
10
|
function handleDefaultValue(value, defaultVal, initVal) {
|
|
@@ -35,7 +35,7 @@ function getOldComponent({ name }) {
|
|
|
35
35
|
return getOldComponentName(name);
|
|
36
36
|
}
|
|
37
37
|
function getDefaultComponent({ name }) {
|
|
38
|
-
return name;
|
|
38
|
+
return getComponent(name) || name;
|
|
39
39
|
}
|
|
40
40
|
function handleConfirmFilter(params, checked, option) {
|
|
41
41
|
const { $panel } = params;
|
|
@@ -556,6 +556,63 @@ function handleExportTreeSelectMethod(params) {
|
|
|
556
556
|
const { row, column, options } = params;
|
|
557
557
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params);
|
|
558
558
|
}
|
|
559
|
+
function handleNumberCell(h, renderOpts, params) {
|
|
560
|
+
const { props = {}, showNegativeStatus } = renderOpts;
|
|
561
|
+
const { row, column } = params;
|
|
562
|
+
const { type } = props;
|
|
563
|
+
let cellValue = XEUtils.get(row, column.field);
|
|
564
|
+
let isNegative = false;
|
|
565
|
+
if (!isEmptyValue(cellValue)) {
|
|
566
|
+
const numberInputConfig = getConfig().numberInput || {};
|
|
567
|
+
if (type === 'float') {
|
|
568
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
569
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
|
|
570
|
+
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
|
|
571
|
+
if (!autoFill) {
|
|
572
|
+
cellValue = XEUtils.toNumber(cellValue);
|
|
573
|
+
}
|
|
574
|
+
if (showNegativeStatus) {
|
|
575
|
+
if (cellValue < 0) {
|
|
576
|
+
isNegative = true;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
else if (type === 'amount') {
|
|
581
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
582
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
|
|
583
|
+
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
|
|
584
|
+
cellValue = XEUtils.toNumber(cellValue);
|
|
585
|
+
if (showNegativeStatus) {
|
|
586
|
+
if (cellValue < 0) {
|
|
587
|
+
isNegative = true;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
cellValue = XEUtils.commafy(cellValue, { digits });
|
|
591
|
+
if (!autoFill) {
|
|
592
|
+
const [iStr, dStr] = cellValue.split('.');
|
|
593
|
+
if (dStr) {
|
|
594
|
+
const dRest = dStr.replace(/0+$/, '');
|
|
595
|
+
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
if (showCurrency) {
|
|
599
|
+
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
if (showNegativeStatus) {
|
|
604
|
+
if (XEUtils.toNumber(cellValue) < 0) {
|
|
605
|
+
isNegative = true;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
|
|
611
|
+
? {
|
|
612
|
+
class: 'is--negative'
|
|
613
|
+
}
|
|
614
|
+
: {});
|
|
615
|
+
}
|
|
559
616
|
/**
|
|
560
617
|
* 表格 - 渲染器
|
|
561
618
|
*/
|
|
@@ -620,66 +677,19 @@ renderer.mixin({
|
|
|
620
677
|
renderTableFilter: defaultFilterRender,
|
|
621
678
|
tableFilterDefaultMethod: handleInputFilterMethod
|
|
622
679
|
},
|
|
680
|
+
FormatNumberInput: {
|
|
681
|
+
renderTableDefault: handleNumberCell,
|
|
682
|
+
tableFilterDefaultMethod: handleInputFilterMethod,
|
|
683
|
+
tableExportMethod(params) {
|
|
684
|
+
const { row, column } = params;
|
|
685
|
+
const cellValue = XEUtils.get(row, column.field);
|
|
686
|
+
return cellValue;
|
|
687
|
+
}
|
|
688
|
+
},
|
|
623
689
|
VxeNumberInput: {
|
|
624
690
|
tableAutoFocus: 'input',
|
|
625
691
|
renderTableEdit: defaultEditRender,
|
|
626
|
-
renderTableCell
|
|
627
|
-
const { props = {}, showNegativeStatus } = renderOpts;
|
|
628
|
-
const { row, column } = params;
|
|
629
|
-
const { type } = props;
|
|
630
|
-
let cellValue = XEUtils.get(row, column.field);
|
|
631
|
-
let isNegative = false;
|
|
632
|
-
if (!isEmptyValue(cellValue)) {
|
|
633
|
-
const numberInputConfig = getConfig().numberInput || {};
|
|
634
|
-
if (type === 'float') {
|
|
635
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
636
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1);
|
|
637
|
-
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits);
|
|
638
|
-
if (!autoFill) {
|
|
639
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
640
|
-
}
|
|
641
|
-
if (showNegativeStatus) {
|
|
642
|
-
if (cellValue < 0) {
|
|
643
|
-
isNegative = true;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
else if (type === 'amount') {
|
|
648
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true);
|
|
649
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2);
|
|
650
|
-
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false);
|
|
651
|
-
cellValue = XEUtils.toNumber(cellValue);
|
|
652
|
-
if (showNegativeStatus) {
|
|
653
|
-
if (cellValue < 0) {
|
|
654
|
-
isNegative = true;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
cellValue = XEUtils.commafy(cellValue, { digits });
|
|
658
|
-
if (!autoFill) {
|
|
659
|
-
const [iStr, dStr] = cellValue.split('.');
|
|
660
|
-
if (dStr) {
|
|
661
|
-
const dRest = dStr.replace(/0+$/, '');
|
|
662
|
-
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
if (showCurrency) {
|
|
666
|
-
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
if (showNegativeStatus) {
|
|
671
|
-
if (XEUtils.toNumber(cellValue) < 0) {
|
|
672
|
-
isNegative = true;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
return getCellLabelVNs(h, renderOpts, params, cellValue, isNegative
|
|
678
|
-
? {
|
|
679
|
-
class: 'is--negative'
|
|
680
|
-
}
|
|
681
|
-
: {});
|
|
682
|
-
},
|
|
692
|
+
renderTableCell: handleNumberCell,
|
|
683
693
|
renderTableFooter(h, renderOpts, params) {
|
|
684
694
|
const { props = {} } = renderOpts;
|
|
685
695
|
const { row, column, _columnIndex } = params;
|
|
@@ -784,11 +794,22 @@ renderer.mixin({
|
|
|
784
794
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
785
795
|
tableExportMethod: handleExportSelectMethod
|
|
786
796
|
},
|
|
797
|
+
/**
|
|
798
|
+
* 已废弃,被 FormatSelect 替换
|
|
799
|
+
* @deprecated
|
|
800
|
+
*/
|
|
787
801
|
formatOption: {
|
|
788
802
|
renderTableDefault(h, renderOpts, params) {
|
|
789
803
|
return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
790
804
|
}
|
|
791
805
|
},
|
|
806
|
+
FormatSelect: {
|
|
807
|
+
renderTableDefault(h, renderOpts, params) {
|
|
808
|
+
return getCellLabelVNs(h, renderOpts, params, getSelectCellValue(renderOpts, params));
|
|
809
|
+
},
|
|
810
|
+
tableFilterDefaultMethod: handleFilterMethod,
|
|
811
|
+
tableExportMethod: handleExportSelectMethod
|
|
812
|
+
},
|
|
792
813
|
VxeTreeSelect: {
|
|
793
814
|
tableAutoFocus: 'input',
|
|
794
815
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -805,11 +826,21 @@ renderer.mixin({
|
|
|
805
826
|
},
|
|
806
827
|
tableExportMethod: handleExportTreeSelectMethod
|
|
807
828
|
},
|
|
829
|
+
/**
|
|
830
|
+
* 已废弃,被 FormatTreeSelect 替换
|
|
831
|
+
* @deprecated
|
|
832
|
+
*/
|
|
808
833
|
formatTree: {
|
|
809
834
|
renderTableDefault(h, renderOpts, params) {
|
|
810
835
|
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
811
836
|
}
|
|
812
837
|
},
|
|
838
|
+
FormatTreeSelect: {
|
|
839
|
+
renderTableDefault(h, renderOpts, params) {
|
|
840
|
+
return getCellLabelVNs(h, renderOpts, params, getTreeSelectCellValue(renderOpts, params));
|
|
841
|
+
},
|
|
842
|
+
tableExportMethod: handleExportTreeSelectMethod
|
|
843
|
+
},
|
|
813
844
|
VxeColorPicker: {
|
|
814
845
|
tableAutoFocus: 'input',
|
|
815
846
|
renderTableEdit(h, renderOpts, params) {
|
package/es/table/src/body.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
import { VxeUI } from '../../ui';
|
|
3
3
|
import { isEnableConf, getClass } from '../../ui/src/utils';
|
|
4
|
-
import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid } from './util';
|
|
4
|
+
import { getOffsetSize, calcTreeLine, mergeBodyMethod, getRowid, createHandleGetRowId } from './util';
|
|
5
5
|
import { updateCellTitle } from '../../ui/src/dom';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
7
|
const { getI18n, renderer, renderEmptyElement } = VxeUI;
|
|
@@ -14,7 +14,7 @@ const isVMScrollProcess = ($xeTable) => {
|
|
|
14
14
|
const { lastScrollTime, isDragResize } = tableReactData;
|
|
15
15
|
return !!(isDragResize || (lastScrollTime && Date.now() < lastScrollTime + delayHover));
|
|
16
16
|
};
|
|
17
|
-
function renderLine(h, _vm, params, cellHeight) {
|
|
17
|
+
function renderLine(h, _vm, rowid, params, cellHeight) {
|
|
18
18
|
const $xeTable = _vm.$parent;
|
|
19
19
|
const tableProps = $xeTable;
|
|
20
20
|
const tableInternalData = $xeTable;
|
|
@@ -27,7 +27,6 @@ function renderLine(h, _vm, params, cellHeight) {
|
|
|
27
27
|
if (slots && slots.line) {
|
|
28
28
|
return $xeTable.callSlot(slots.line, params, h);
|
|
29
29
|
}
|
|
30
|
-
const rowid = getRowid($xeTable, row);
|
|
31
30
|
const rest = fullAllDataRowIdData[rowid];
|
|
32
31
|
let rLevel = 0;
|
|
33
32
|
let prevRow = null;
|
|
@@ -189,6 +188,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
189
188
|
tdOns.dblclick = (evnt) => {
|
|
190
189
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams);
|
|
191
190
|
};
|
|
191
|
+
let isMergeCell = false;
|
|
192
192
|
// 合并行或列
|
|
193
193
|
if (mergeList.length) {
|
|
194
194
|
const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex);
|
|
@@ -198,9 +198,11 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
198
198
|
return null;
|
|
199
199
|
}
|
|
200
200
|
if (rowspan > 1) {
|
|
201
|
+
isMergeCell = true;
|
|
201
202
|
tdAttrs.rowspan = rowspan;
|
|
202
203
|
}
|
|
203
204
|
if (colspan > 1) {
|
|
205
|
+
isMergeCell = true;
|
|
204
206
|
tdAttrs.colspan = colspan;
|
|
205
207
|
}
|
|
206
208
|
}
|
|
@@ -233,12 +235,14 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
233
235
|
const isLastColumn = $columnIndex === columns.length - 1;
|
|
234
236
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
235
237
|
let isVNPreEmptyStatus = false;
|
|
236
|
-
if (!
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
if (!isMergeCell) {
|
|
239
|
+
if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
|
|
240
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
|
|
241
|
+
isVNPreEmptyStatus = true;
|
|
242
|
+
}
|
|
243
|
+
else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
244
|
+
isVNPreEmptyStatus = true;
|
|
245
|
+
}
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
const tcStyle = {};
|
|
@@ -262,7 +266,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
262
266
|
}
|
|
263
267
|
else {
|
|
264
268
|
// 渲染单元格
|
|
265
|
-
tdVNs.push(...renderLine(h, _vm, cellParams, cellHeight), h('div', {
|
|
269
|
+
tdVNs.push(...renderLine(h, _vm, rowid, cellParams, cellHeight), h('div', {
|
|
266
270
|
key: 'tc',
|
|
267
271
|
class: ['vxe-cell', {
|
|
268
272
|
'c--title': showTitle,
|
|
@@ -383,8 +387,8 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
383
387
|
const tableReactData = $xeTable;
|
|
384
388
|
const tableInternalData = $xeTable;
|
|
385
389
|
const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
|
|
386
|
-
const { hasFixedColumn,
|
|
387
|
-
const { fullAllDataRowIdData } = tableInternalData;
|
|
390
|
+
const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData;
|
|
391
|
+
const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData;
|
|
388
392
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
389
393
|
const radioOpts = $xeTable.computeRadioOpts;
|
|
390
394
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
@@ -395,6 +399,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
395
399
|
const { transform, seqMode } = treeOpts;
|
|
396
400
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
397
401
|
const rows = [];
|
|
402
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
398
403
|
tableData.forEach((row, $rowIndex) => {
|
|
399
404
|
const trOn = {};
|
|
400
405
|
let rowIndex = $rowIndex;
|
|
@@ -415,7 +420,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
415
420
|
$xeTable.clearHoverRow();
|
|
416
421
|
};
|
|
417
422
|
}
|
|
418
|
-
const rowid =
|
|
423
|
+
const rowid = handleGetRowId(row);
|
|
419
424
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
420
425
|
let rowLevel = 0;
|
|
421
426
|
let seq = -1;
|
|
@@ -432,7 +437,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
432
437
|
}
|
|
433
438
|
const params = { $table: $xeTable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
|
|
434
439
|
// 行是否被展开
|
|
435
|
-
const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
|
|
440
|
+
const isExpandRow = expandColumn && !!rowExpandedFlag && !!rowExpandedMaps[rowid];
|
|
436
441
|
// 树节点是否被展开
|
|
437
442
|
let isExpandTree = false;
|
|
438
443
|
let rowChildren = [];
|
|
@@ -443,7 +448,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
443
448
|
}
|
|
444
449
|
if (treeConfig && !scrollYLoad && !transform) {
|
|
445
450
|
rowChildren = row[childrenField];
|
|
446
|
-
isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid];
|
|
451
|
+
isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid];
|
|
447
452
|
}
|
|
448
453
|
// 拖拽行事件
|
|
449
454
|
if (rowOpts.drag && (!treeConfig || transform)) {
|
|
@@ -462,7 +467,7 @@ function renderRows(h, _vm, fixedType, isOptimizeMode, tableData, tableColumn) {
|
|
|
462
467
|
'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
|
|
463
468
|
'row--radio': radioOpts.highlight && selectRadioRow === row,
|
|
464
469
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
465
|
-
'row--pending': !!pendingRowMaps[rowid]
|
|
470
|
+
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
|
|
466
471
|
},
|
|
467
472
|
rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
|
|
468
473
|
];
|
|
@@ -632,7 +637,7 @@ export default {
|
|
|
632
637
|
isOptimizeMode = true;
|
|
633
638
|
}
|
|
634
639
|
}
|
|
635
|
-
if (fixedType || !overflowX) {
|
|
640
|
+
if (!isColLoading && (fixedType || !overflowX)) {
|
|
636
641
|
renderColumnList = visibleColumn;
|
|
637
642
|
}
|
|
638
643
|
if (fixedType) {
|