vxe-table 4.7.25 → 4.7.26
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/table/module/edit/hook.js +4 -4
- package/es/table/module/export/hook.js +4 -4
- package/es/table/module/keyboard/hook.js +2 -2
- package/es/table/module/menu/hook.js +1 -1
- package/es/table/module/validator/hook.js +1 -1
- package/es/table/src/table.js +91 -69
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +114 -92
- package/lib/index.umd.min.js +1 -1
- package/lib/table/module/edit/hook.js +4 -4
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +4 -4
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -2
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/menu/hook.js +1 -1
- package/lib/table/module/menu/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +1 -1
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/src/table.js +99 -77
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +2 -2
- 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/table/module/edit/hook.ts +4 -4
- package/packages/table/module/export/hook.ts +6 -6
- package/packages/table/module/keyboard/hook.ts +2 -2
- package/packages/table/module/menu/hook.ts +1 -1
- package/packages/table/module/validator/hook.ts +1 -1
- package/packages/table/src/table.ts +88 -66
|
@@ -604,7 +604,7 @@ hooks.add('tableEditModule', {
|
|
|
604
604
|
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
605
605
|
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
606
606
|
return $xeTable.scrollToRow(row, column).then(() => {
|
|
607
|
-
const cell = $xeTable.
|
|
607
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
608
608
|
if (cell) {
|
|
609
609
|
editPrivateMethods.handleActived({
|
|
610
610
|
row,
|
|
@@ -631,7 +631,7 @@ hooks.add('tableEditModule', {
|
|
|
631
631
|
if (row && column && editOpts.trigger !== 'manual') {
|
|
632
632
|
const rowIndex = $xeTable.findRowIndexOf(tableData, row);
|
|
633
633
|
if (rowIndex > -1 && column) {
|
|
634
|
-
const cell = $xeTable.
|
|
634
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
635
635
|
const params = {
|
|
636
636
|
row,
|
|
637
637
|
rowIndex,
|
|
@@ -657,7 +657,7 @@ hooks.add('tableEditModule', {
|
|
|
657
657
|
const { actived, focused } = editStore;
|
|
658
658
|
const { row, column } = params;
|
|
659
659
|
const { editRender } = column;
|
|
660
|
-
const cell = (params.cell || $xeTable.
|
|
660
|
+
const cell = (params.cell || $xeTable.getCellElement(row, column));
|
|
661
661
|
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
662
662
|
params.cell = cell;
|
|
663
663
|
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
@@ -836,7 +836,7 @@ hooks.add('tableEditModule', {
|
|
|
836
836
|
const { row, column } = selected;
|
|
837
837
|
removeCellSelectedClass();
|
|
838
838
|
if (row && column) {
|
|
839
|
-
const cell = $xeTable.
|
|
839
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
840
840
|
if (cell) {
|
|
841
841
|
addClass(cell, 'col--selected');
|
|
842
842
|
}
|
|
@@ -349,13 +349,13 @@ hooks.add('tableExportModule', {
|
|
|
349
349
|
cellValue = getCellValue(row, column);
|
|
350
350
|
}
|
|
351
351
|
else {
|
|
352
|
-
cellValue = $xeTable.getCellLabel(row, column)
|
|
352
|
+
cellValue = `${$xeTable.getCellLabel(row, column)}`;
|
|
353
353
|
if (column.type === 'html') {
|
|
354
354
|
htmlCellElem.innerHTML = cellValue;
|
|
355
355
|
cellValue = htmlCellElem.innerText.trim();
|
|
356
356
|
}
|
|
357
357
|
else {
|
|
358
|
-
const cell = $xeTable.
|
|
358
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
359
359
|
if (cell) {
|
|
360
360
|
cellValue = cell.innerText.trim();
|
|
361
361
|
}
|
|
@@ -408,13 +408,13 @@ hooks.add('tableExportModule', {
|
|
|
408
408
|
cellValue = getCellValue(row, column);
|
|
409
409
|
}
|
|
410
410
|
else {
|
|
411
|
-
cellValue = $xeTable.getCellLabel(row, column)
|
|
411
|
+
cellValue = `${$xeTable.getCellLabel(row, column)}`;
|
|
412
412
|
if (column.type === 'html') {
|
|
413
413
|
htmlCellElem.innerHTML = cellValue;
|
|
414
414
|
cellValue = htmlCellElem.innerText.trim();
|
|
415
415
|
}
|
|
416
416
|
else {
|
|
417
|
-
const cell = $xeTable.
|
|
417
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
418
418
|
if (cell) {
|
|
419
419
|
cellValue = cell.innerText.trim();
|
|
420
420
|
}
|
|
@@ -282,7 +282,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
282
282
|
}
|
|
283
283
|
params.columnIndex = targetColumnIndex;
|
|
284
284
|
params.column = targetColumn;
|
|
285
|
-
params.cell = $xeTable.
|
|
285
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
286
286
|
if (editConfig) {
|
|
287
287
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
288
288
|
if (editOpts.mode === 'row') {
|
|
@@ -371,7 +371,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
371
371
|
params.column = visibleColumn[params.columnIndex];
|
|
372
372
|
}
|
|
373
373
|
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
374
|
-
params.cell = $xeTable.
|
|
374
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
375
375
|
$xeTable.handleSelected(params, evnt);
|
|
376
376
|
});
|
|
377
377
|
},
|
|
@@ -68,7 +68,7 @@ hooks.add('tableMenuModule', {
|
|
|
68
68
|
const { keyboard, row, column } = params;
|
|
69
69
|
if (keyboard && row && column) {
|
|
70
70
|
$xeTable.scrollToRow(row, column).then(() => {
|
|
71
|
-
const cell = $xeTable.
|
|
71
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
72
72
|
if (cell) {
|
|
73
73
|
const { boundingTop, boundingLeft } = getAbsolutePos(cell);
|
|
74
74
|
top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2);
|
|
@@ -190,7 +190,7 @@ hooks.add('tableValidatorModule', {
|
|
|
190
190
|
});
|
|
191
191
|
};
|
|
192
192
|
const posAndFinish = () => {
|
|
193
|
-
firstErrParams.cell = $xeTable.
|
|
193
|
+
firstErrParams.cell = $xeTable.getCellElement(firstErrParams.row, firstErrParams.column);
|
|
194
194
|
scrollToView(firstErrParams.cell);
|
|
195
195
|
handleValidError(firstErrParams).then(finish);
|
|
196
196
|
};
|
package/es/table/src/table.js
CHANGED
|
@@ -1145,7 +1145,7 @@ export default defineComponent({
|
|
|
1145
1145
|
cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy);
|
|
1146
1146
|
}
|
|
1147
1147
|
else {
|
|
1148
|
-
cellValue =
|
|
1148
|
+
cellValue = tableMethods.getCellLabel(row, column);
|
|
1149
1149
|
}
|
|
1150
1150
|
if (!sortType || sortType === 'auto') {
|
|
1151
1151
|
return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue);
|
|
@@ -2966,6 +2966,83 @@ export default defineComponent({
|
|
|
2966
2966
|
}
|
|
2967
2967
|
return nextTick();
|
|
2968
2968
|
},
|
|
2969
|
+
getCellElement(row, fieldOrColumn) {
|
|
2970
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
2971
|
+
if (!column) {
|
|
2972
|
+
return null;
|
|
2973
|
+
}
|
|
2974
|
+
const rowid = getRowid($xeTable, row);
|
|
2975
|
+
const tableBody = refTableBody.value;
|
|
2976
|
+
const leftBody = refTableLeftBody.value;
|
|
2977
|
+
const rightBody = refTableRightBody.value;
|
|
2978
|
+
let bodyElem;
|
|
2979
|
+
if (column) {
|
|
2980
|
+
if (column.fixed) {
|
|
2981
|
+
if (column.fixed === 'left') {
|
|
2982
|
+
if (leftBody) {
|
|
2983
|
+
bodyElem = leftBody.$el;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
else {
|
|
2987
|
+
if (rightBody) {
|
|
2988
|
+
bodyElem = rightBody.$el;
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
if (!bodyElem) {
|
|
2993
|
+
bodyElem = tableBody.$el;
|
|
2994
|
+
}
|
|
2995
|
+
if (bodyElem) {
|
|
2996
|
+
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
return null;
|
|
3000
|
+
},
|
|
3001
|
+
getCellLabel(row, fieldOrColumn) {
|
|
3002
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3003
|
+
if (!column) {
|
|
3004
|
+
return null;
|
|
3005
|
+
}
|
|
3006
|
+
const formatter = column.formatter;
|
|
3007
|
+
const cellValue = getCellValue(row, column);
|
|
3008
|
+
let cellLabel = cellValue;
|
|
3009
|
+
if (formatter) {
|
|
3010
|
+
let formatData;
|
|
3011
|
+
const { fullAllDataRowIdData } = internalData;
|
|
3012
|
+
const rowid = getRowid($xeTable, row);
|
|
3013
|
+
const colid = column.id;
|
|
3014
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
3015
|
+
if (rest) {
|
|
3016
|
+
formatData = rest.formatData;
|
|
3017
|
+
if (!formatData) {
|
|
3018
|
+
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
3019
|
+
}
|
|
3020
|
+
if (rest && formatData[colid]) {
|
|
3021
|
+
if (formatData[colid].value === cellValue) {
|
|
3022
|
+
return formatData[colid].label;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
const formatParams = { cellValue, row, rowIndex: tableMethods.getRowIndex(row), column, columnIndex: tableMethods.getColumnIndex(column) };
|
|
3027
|
+
if (XEUtils.isString(formatter)) {
|
|
3028
|
+
const gFormatOpts = formats.get(formatter);
|
|
3029
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
3030
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
3031
|
+
}
|
|
3032
|
+
else if (XEUtils.isArray(formatter)) {
|
|
3033
|
+
const gFormatOpts = formats.get(formatter[0]);
|
|
3034
|
+
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
3035
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
3036
|
+
}
|
|
3037
|
+
else {
|
|
3038
|
+
cellLabel = formatter(formatParams);
|
|
3039
|
+
}
|
|
3040
|
+
if (formatData) {
|
|
3041
|
+
formatData[colid] = { value: cellValue, label: cellLabel };
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
return cellLabel;
|
|
3045
|
+
},
|
|
2969
3046
|
/**
|
|
2970
3047
|
* 检查是否为临时行数据
|
|
2971
3048
|
* @param {Row} row 行对象
|
|
@@ -3021,6 +3098,13 @@ export default defineComponent({
|
|
|
3021
3098
|
const columns = internalData.visibleColumn;
|
|
3022
3099
|
return XEUtils.isUndefined(columnIndex) ? columns.slice(0) : columns[columnIndex];
|
|
3023
3100
|
},
|
|
3101
|
+
/**
|
|
3102
|
+
* 根据列获取列的唯一主键
|
|
3103
|
+
*/
|
|
3104
|
+
getColid(fieldOrColumn) {
|
|
3105
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
3106
|
+
return column ? column.id : null;
|
|
3107
|
+
},
|
|
3024
3108
|
/**
|
|
3025
3109
|
* 根据列的唯一主键获取列
|
|
3026
3110
|
* @param {String} colid 列主键
|
|
@@ -4313,7 +4397,7 @@ export default defineComponent({
|
|
|
4313
4397
|
const type = 'change';
|
|
4314
4398
|
if ($xeTable.hasCellRules) {
|
|
4315
4399
|
if ($xeTable.hasCellRules(type, row, column)) {
|
|
4316
|
-
const cell =
|
|
4400
|
+
const cell = tableMethods.getCellElement(row, column);
|
|
4317
4401
|
if (cell) {
|
|
4318
4402
|
return $xeTable.validCellRules(type, row, column, cellValue)
|
|
4319
4403
|
.then(() => {
|
|
@@ -6232,74 +6316,12 @@ export default defineComponent({
|
|
|
6232
6316
|
}
|
|
6233
6317
|
internalData.hoverRow = null;
|
|
6234
6318
|
},
|
|
6319
|
+
/**
|
|
6320
|
+
* 已废弃,被 getCellElement 替换
|
|
6321
|
+
* @deprecated
|
|
6322
|
+
*/
|
|
6235
6323
|
getCell(row, column) {
|
|
6236
|
-
|
|
6237
|
-
const tableBody = refTableBody.value;
|
|
6238
|
-
const leftBody = refTableLeftBody.value;
|
|
6239
|
-
const rightBody = refTableRightBody.value;
|
|
6240
|
-
let bodyElem;
|
|
6241
|
-
if (column) {
|
|
6242
|
-
if (column.fixed) {
|
|
6243
|
-
if (column.fixed === 'left') {
|
|
6244
|
-
if (leftBody) {
|
|
6245
|
-
bodyElem = leftBody.$el;
|
|
6246
|
-
}
|
|
6247
|
-
}
|
|
6248
|
-
else {
|
|
6249
|
-
if (rightBody) {
|
|
6250
|
-
bodyElem = rightBody.$el;
|
|
6251
|
-
}
|
|
6252
|
-
}
|
|
6253
|
-
}
|
|
6254
|
-
if (!bodyElem) {
|
|
6255
|
-
bodyElem = tableBody.$el;
|
|
6256
|
-
}
|
|
6257
|
-
if (bodyElem) {
|
|
6258
|
-
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
6259
|
-
}
|
|
6260
|
-
}
|
|
6261
|
-
return null;
|
|
6262
|
-
},
|
|
6263
|
-
getCellLabel(row, column) {
|
|
6264
|
-
const formatter = column.formatter;
|
|
6265
|
-
const cellValue = getCellValue(row, column);
|
|
6266
|
-
let cellLabel = cellValue;
|
|
6267
|
-
if (formatter) {
|
|
6268
|
-
let formatData;
|
|
6269
|
-
const { fullAllDataRowIdData } = internalData;
|
|
6270
|
-
const rowid = getRowid($xeTable, row);
|
|
6271
|
-
const colid = column.id;
|
|
6272
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
6273
|
-
if (rest) {
|
|
6274
|
-
formatData = rest.formatData;
|
|
6275
|
-
if (!formatData) {
|
|
6276
|
-
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
6277
|
-
}
|
|
6278
|
-
if (rest && formatData[colid]) {
|
|
6279
|
-
if (formatData[colid].value === cellValue) {
|
|
6280
|
-
return formatData[colid].label;
|
|
6281
|
-
}
|
|
6282
|
-
}
|
|
6283
|
-
}
|
|
6284
|
-
const formatParams = { cellValue, row, rowIndex: tableMethods.getRowIndex(row), column, columnIndex: tableMethods.getColumnIndex(column) };
|
|
6285
|
-
if (XEUtils.isString(formatter)) {
|
|
6286
|
-
const gFormatOpts = formats.get(formatter);
|
|
6287
|
-
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
6288
|
-
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
6289
|
-
}
|
|
6290
|
-
else if (XEUtils.isArray(formatter)) {
|
|
6291
|
-
const gFormatOpts = formats.get(formatter[0]);
|
|
6292
|
-
const tcFormatMethod = gFormatOpts ? (gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod) : null;
|
|
6293
|
-
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
6294
|
-
}
|
|
6295
|
-
else {
|
|
6296
|
-
cellLabel = formatter(formatParams);
|
|
6297
|
-
}
|
|
6298
|
-
if (formatData) {
|
|
6299
|
-
formatData[colid] = { value: cellValue, label: cellLabel };
|
|
6300
|
-
}
|
|
6301
|
-
}
|
|
6302
|
-
return cellLabel;
|
|
6324
|
+
return tableMethods.getCellElement(row, column);
|
|
6303
6325
|
},
|
|
6304
6326
|
findRowIndexOf(list, row) {
|
|
6305
6327
|
return row ? XEUtils.findIndexOf(list, item => $xeTable.eqRow(item, row)) : -1;
|
package/es/ui/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { getFuncText } from './src/utils';
|
|
3
|
-
export const version = "4.7.
|
|
3
|
+
export const version = "4.7.26";
|
|
4
4
|
VxeUI.version = version;
|
|
5
|
-
VxeUI.tableVersion = "4.7.
|
|
5
|
+
VxeUI.tableVersion = "4.7.26";
|
|
6
6
|
VxeUI.setConfig({
|
|
7
7
|
emptyCell: ' ',
|
|
8
8
|
table: {
|
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -1951,9 +1951,9 @@ function eqEmptyValue(cellValue) {
|
|
|
1951
1951
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
1952
1952
|
|
|
1953
1953
|
|
|
1954
|
-
const version = "4.7.
|
|
1954
|
+
const version = "4.7.26";
|
|
1955
1955
|
core_.VxeUI.version = version;
|
|
1956
|
-
core_.VxeUI.tableVersion = "4.7.
|
|
1956
|
+
core_.VxeUI.tableVersion = "4.7.26";
|
|
1957
1957
|
core_.VxeUI.setConfig({
|
|
1958
1958
|
emptyCell: ' ',
|
|
1959
1959
|
table: {
|
|
@@ -2258,7 +2258,7 @@ var es_array_push = __webpack_require__(4114);
|
|
|
2258
2258
|
const {
|
|
2259
2259
|
log: log_log
|
|
2260
2260
|
} = core_.VxeUI;
|
|
2261
|
-
const log_version = `table v${"4.7.
|
|
2261
|
+
const log_version = `table v${"4.7.26"}`;
|
|
2262
2262
|
const warnLog = log_log.create('warn', log_version);
|
|
2263
2263
|
const errLog = log_log.create('error', log_version);
|
|
2264
2264
|
;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
|
|
@@ -9305,7 +9305,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
|
9305
9305
|
column
|
|
9306
9306
|
}) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, sortBy);
|
|
9307
9307
|
} else {
|
|
9308
|
-
cellValue =
|
|
9308
|
+
cellValue = tableMethods.getCellLabel(row, column);
|
|
9309
9309
|
}
|
|
9310
9310
|
if (!sortType || sortType === 'auto') {
|
|
9311
9311
|
return isNaN(cellValue) ? cellValue : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellValue);
|
|
@@ -11528,6 +11528,91 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
|
11528
11528
|
}
|
|
11529
11529
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
11530
11530
|
},
|
|
11531
|
+
getCellElement(row, fieldOrColumn) {
|
|
11532
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
11533
|
+
if (!column) {
|
|
11534
|
+
return null;
|
|
11535
|
+
}
|
|
11536
|
+
const rowid = getRowid($xeTable, row);
|
|
11537
|
+
const tableBody = refTableBody.value;
|
|
11538
|
+
const leftBody = refTableLeftBody.value;
|
|
11539
|
+
const rightBody = refTableRightBody.value;
|
|
11540
|
+
let bodyElem;
|
|
11541
|
+
if (column) {
|
|
11542
|
+
if (column.fixed) {
|
|
11543
|
+
if (column.fixed === 'left') {
|
|
11544
|
+
if (leftBody) {
|
|
11545
|
+
bodyElem = leftBody.$el;
|
|
11546
|
+
}
|
|
11547
|
+
} else {
|
|
11548
|
+
if (rightBody) {
|
|
11549
|
+
bodyElem = rightBody.$el;
|
|
11550
|
+
}
|
|
11551
|
+
}
|
|
11552
|
+
}
|
|
11553
|
+
if (!bodyElem) {
|
|
11554
|
+
bodyElem = tableBody.$el;
|
|
11555
|
+
}
|
|
11556
|
+
if (bodyElem) {
|
|
11557
|
+
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
11558
|
+
}
|
|
11559
|
+
}
|
|
11560
|
+
return null;
|
|
11561
|
+
},
|
|
11562
|
+
getCellLabel(row, fieldOrColumn) {
|
|
11563
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
11564
|
+
if (!column) {
|
|
11565
|
+
return null;
|
|
11566
|
+
}
|
|
11567
|
+
const formatter = column.formatter;
|
|
11568
|
+
const cellValue = getCellValue(row, column);
|
|
11569
|
+
let cellLabel = cellValue;
|
|
11570
|
+
if (formatter) {
|
|
11571
|
+
let formatData;
|
|
11572
|
+
const {
|
|
11573
|
+
fullAllDataRowIdData
|
|
11574
|
+
} = internalData;
|
|
11575
|
+
const rowid = getRowid($xeTable, row);
|
|
11576
|
+
const colid = column.id;
|
|
11577
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
11578
|
+
if (rest) {
|
|
11579
|
+
formatData = rest.formatData;
|
|
11580
|
+
if (!formatData) {
|
|
11581
|
+
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
11582
|
+
}
|
|
11583
|
+
if (rest && formatData[colid]) {
|
|
11584
|
+
if (formatData[colid].value === cellValue) {
|
|
11585
|
+
return formatData[colid].label;
|
|
11586
|
+
}
|
|
11587
|
+
}
|
|
11588
|
+
}
|
|
11589
|
+
const formatParams = {
|
|
11590
|
+
cellValue,
|
|
11591
|
+
row,
|
|
11592
|
+
rowIndex: tableMethods.getRowIndex(row),
|
|
11593
|
+
column,
|
|
11594
|
+
columnIndex: tableMethods.getColumnIndex(column)
|
|
11595
|
+
};
|
|
11596
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
|
|
11597
|
+
const gFormatOpts = table_formats.get(formatter);
|
|
11598
|
+
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
11599
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
11600
|
+
} else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
|
|
11601
|
+
const gFormatOpts = table_formats.get(formatter[0]);
|
|
11602
|
+
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
11603
|
+
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
11604
|
+
} else {
|
|
11605
|
+
cellLabel = formatter(formatParams);
|
|
11606
|
+
}
|
|
11607
|
+
if (formatData) {
|
|
11608
|
+
formatData[colid] = {
|
|
11609
|
+
value: cellValue,
|
|
11610
|
+
label: cellLabel
|
|
11611
|
+
};
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
return cellLabel;
|
|
11615
|
+
},
|
|
11531
11616
|
/**
|
|
11532
11617
|
* 检查是否为临时行数据
|
|
11533
11618
|
* @param {Row} row 行对象
|
|
@@ -11593,6 +11678,13 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
|
11593
11678
|
const columns = internalData.visibleColumn;
|
|
11594
11679
|
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(columnIndex) ? columns.slice(0) : columns[columnIndex];
|
|
11595
11680
|
},
|
|
11681
|
+
/**
|
|
11682
|
+
* 根据列获取列的唯一主键
|
|
11683
|
+
*/
|
|
11684
|
+
getColid(fieldOrColumn) {
|
|
11685
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
11686
|
+
return column ? column.id : null;
|
|
11687
|
+
},
|
|
11596
11688
|
/**
|
|
11597
11689
|
* 根据列的唯一主键获取列
|
|
11598
11690
|
* @param {String} colid 列主键
|
|
@@ -13102,7 +13194,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
|
13102
13194
|
const type = 'change';
|
|
13103
13195
|
if ($xeTable.hasCellRules) {
|
|
13104
13196
|
if ($xeTable.hasCellRules(type, row, column)) {
|
|
13105
|
-
const cell =
|
|
13197
|
+
const cell = tableMethods.getCellElement(row, column);
|
|
13106
13198
|
if (cell) {
|
|
13107
13199
|
return $xeTable.validCellRules(type, row, column, cellValue).then(() => {
|
|
13108
13200
|
if (customVal && validStore.visible) {
|
|
@@ -15322,82 +15414,12 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
|
15322
15414
|
}
|
|
15323
15415
|
internalData.hoverRow = null;
|
|
15324
15416
|
},
|
|
15417
|
+
/**
|
|
15418
|
+
* 已废弃,被 getCellElement 替换
|
|
15419
|
+
* @deprecated
|
|
15420
|
+
*/
|
|
15325
15421
|
getCell(row, column) {
|
|
15326
|
-
|
|
15327
|
-
const tableBody = refTableBody.value;
|
|
15328
|
-
const leftBody = refTableLeftBody.value;
|
|
15329
|
-
const rightBody = refTableRightBody.value;
|
|
15330
|
-
let bodyElem;
|
|
15331
|
-
if (column) {
|
|
15332
|
-
if (column.fixed) {
|
|
15333
|
-
if (column.fixed === 'left') {
|
|
15334
|
-
if (leftBody) {
|
|
15335
|
-
bodyElem = leftBody.$el;
|
|
15336
|
-
}
|
|
15337
|
-
} else {
|
|
15338
|
-
if (rightBody) {
|
|
15339
|
-
bodyElem = rightBody.$el;
|
|
15340
|
-
}
|
|
15341
|
-
}
|
|
15342
|
-
}
|
|
15343
|
-
if (!bodyElem) {
|
|
15344
|
-
bodyElem = tableBody.$el;
|
|
15345
|
-
}
|
|
15346
|
-
if (bodyElem) {
|
|
15347
|
-
return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);
|
|
15348
|
-
}
|
|
15349
|
-
}
|
|
15350
|
-
return null;
|
|
15351
|
-
},
|
|
15352
|
-
getCellLabel(row, column) {
|
|
15353
|
-
const formatter = column.formatter;
|
|
15354
|
-
const cellValue = getCellValue(row, column);
|
|
15355
|
-
let cellLabel = cellValue;
|
|
15356
|
-
if (formatter) {
|
|
15357
|
-
let formatData;
|
|
15358
|
-
const {
|
|
15359
|
-
fullAllDataRowIdData
|
|
15360
|
-
} = internalData;
|
|
15361
|
-
const rowid = getRowid($xeTable, row);
|
|
15362
|
-
const colid = column.id;
|
|
15363
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
15364
|
-
if (rest) {
|
|
15365
|
-
formatData = rest.formatData;
|
|
15366
|
-
if (!formatData) {
|
|
15367
|
-
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
15368
|
-
}
|
|
15369
|
-
if (rest && formatData[colid]) {
|
|
15370
|
-
if (formatData[colid].value === cellValue) {
|
|
15371
|
-
return formatData[colid].label;
|
|
15372
|
-
}
|
|
15373
|
-
}
|
|
15374
|
-
}
|
|
15375
|
-
const formatParams = {
|
|
15376
|
-
cellValue,
|
|
15377
|
-
row,
|
|
15378
|
-
rowIndex: tableMethods.getRowIndex(row),
|
|
15379
|
-
column,
|
|
15380
|
-
columnIndex: tableMethods.getColumnIndex(column)
|
|
15381
|
-
};
|
|
15382
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)) {
|
|
15383
|
-
const gFormatOpts = table_formats.get(formatter);
|
|
15384
|
-
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
15385
|
-
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams) : '';
|
|
15386
|
-
} else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)) {
|
|
15387
|
-
const gFormatOpts = table_formats.get(formatter[0]);
|
|
15388
|
-
const tcFormatMethod = gFormatOpts ? gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod : null;
|
|
15389
|
-
cellLabel = tcFormatMethod ? tcFormatMethod(formatParams, ...formatter.slice(1)) : '';
|
|
15390
|
-
} else {
|
|
15391
|
-
cellLabel = formatter(formatParams);
|
|
15392
|
-
}
|
|
15393
|
-
if (formatData) {
|
|
15394
|
-
formatData[colid] = {
|
|
15395
|
-
value: cellValue,
|
|
15396
|
-
label: cellLabel
|
|
15397
|
-
};
|
|
15398
|
-
}
|
|
15399
|
-
}
|
|
15400
|
-
return cellLabel;
|
|
15422
|
+
return tableMethods.getCellElement(row, column);
|
|
15401
15423
|
},
|
|
15402
15424
|
findRowIndexOf(list, row) {
|
|
15403
15425
|
return row ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findIndexOf(list, item => $xeTable.eqRow(item, row)) : -1;
|
|
@@ -16582,7 +16604,7 @@ menu_hook_hooks.add('tableMenuModule', {
|
|
|
16582
16604
|
} = params;
|
|
16583
16605
|
if (keyboard && row && column) {
|
|
16584
16606
|
$xeTable.scrollToRow(row, column).then(() => {
|
|
16585
|
-
const cell = $xeTable.
|
|
16607
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
16586
16608
|
if (cell) {
|
|
16587
16609
|
const {
|
|
16588
16610
|
boundingTop,
|
|
@@ -17626,7 +17648,7 @@ edit_hook_hooks.add('tableEditModule', {
|
|
|
17626
17648
|
const column = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
17627
17649
|
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
17628
17650
|
return $xeTable.scrollToRow(row, column).then(() => {
|
|
17629
|
-
const cell = $xeTable.
|
|
17651
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
17630
17652
|
if (cell) {
|
|
17631
17653
|
editPrivateMethods.handleActived({
|
|
17632
17654
|
row,
|
|
@@ -17655,7 +17677,7 @@ edit_hook_hooks.add('tableEditModule', {
|
|
|
17655
17677
|
if (row && column && editOpts.trigger !== 'manual') {
|
|
17656
17678
|
const rowIndex = $xeTable.findRowIndexOf(tableData, row);
|
|
17657
17679
|
if (rowIndex > -1 && column) {
|
|
17658
|
-
const cell = $xeTable.
|
|
17680
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
17659
17681
|
const params = {
|
|
17660
17682
|
row,
|
|
17661
17683
|
rowIndex,
|
|
@@ -17697,7 +17719,7 @@ edit_hook_hooks.add('tableEditModule', {
|
|
|
17697
17719
|
const {
|
|
17698
17720
|
editRender
|
|
17699
17721
|
} = column;
|
|
17700
|
-
const cell = params.cell || $xeTable.
|
|
17722
|
+
const cell = params.cell || $xeTable.getCellElement(row, column);
|
|
17701
17723
|
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
17702
17724
|
params.cell = cell;
|
|
17703
17725
|
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
@@ -17909,7 +17931,7 @@ edit_hook_hooks.add('tableEditModule', {
|
|
|
17909
17931
|
} = selected;
|
|
17910
17932
|
removeCellSelectedClass();
|
|
17911
17933
|
if (row && column) {
|
|
17912
|
-
const cell = $xeTable.
|
|
17934
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
17913
17935
|
if (cell) {
|
|
17914
17936
|
addClass(cell, 'col--selected');
|
|
17915
17937
|
}
|
|
@@ -18338,12 +18360,12 @@ export_hook_hooks.add('tableExportModule', {
|
|
|
18338
18360
|
if (opts.original) {
|
|
18339
18361
|
cellValue = getCellValue(row, column);
|
|
18340
18362
|
} else {
|
|
18341
|
-
cellValue = $xeTable.getCellLabel(row, column)
|
|
18363
|
+
cellValue = `${$xeTable.getCellLabel(row, column)}`;
|
|
18342
18364
|
if (column.type === 'html') {
|
|
18343
18365
|
htmlCellElem.innerHTML = cellValue;
|
|
18344
18366
|
cellValue = htmlCellElem.innerText.trim();
|
|
18345
18367
|
} else {
|
|
18346
|
-
const cell = $xeTable.
|
|
18368
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
18347
18369
|
if (cell) {
|
|
18348
18370
|
cellValue = cell.innerText.trim();
|
|
18349
18371
|
}
|
|
@@ -18405,12 +18427,12 @@ export_hook_hooks.add('tableExportModule', {
|
|
|
18405
18427
|
if (opts.original) {
|
|
18406
18428
|
cellValue = getCellValue(row, column);
|
|
18407
18429
|
} else {
|
|
18408
|
-
cellValue = $xeTable.getCellLabel(row, column)
|
|
18430
|
+
cellValue = `${$xeTable.getCellLabel(row, column)}`;
|
|
18409
18431
|
if (column.type === 'html') {
|
|
18410
18432
|
htmlCellElem.innerHTML = cellValue;
|
|
18411
18433
|
cellValue = htmlCellElem.innerText.trim();
|
|
18412
18434
|
} else {
|
|
18413
|
-
const cell = $xeTable.
|
|
18435
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
18414
18436
|
if (cell) {
|
|
18415
18437
|
cellValue = cell.innerText.trim();
|
|
18416
18438
|
}
|
|
@@ -19839,7 +19861,7 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
|
|
|
19839
19861
|
}
|
|
19840
19862
|
params.columnIndex = targetColumnIndex;
|
|
19841
19863
|
params.column = targetColumn;
|
|
19842
|
-
params.cell = $xeTable.
|
|
19864
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
19843
19865
|
if (editConfig) {
|
|
19844
19866
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
19845
19867
|
if (editOpts.mode === 'row') {
|
|
@@ -19930,7 +19952,7 @@ keyboard_hook_hooks.add('tableKeyboardModule', {
|
|
|
19930
19952
|
params.column = visibleColumn[params.columnIndex];
|
|
19931
19953
|
}
|
|
19932
19954
|
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
19933
|
-
params.cell = $xeTable.
|
|
19955
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
19934
19956
|
$xeTable.handleSelected(params, evnt);
|
|
19935
19957
|
});
|
|
19936
19958
|
},
|
|
@@ -20188,7 +20210,7 @@ validator_hook_hooks.add('tableValidatorModule', {
|
|
|
20188
20210
|
});
|
|
20189
20211
|
};
|
|
20190
20212
|
const posAndFinish = () => {
|
|
20191
|
-
firstErrParams.cell = $xeTable.
|
|
20213
|
+
firstErrParams.cell = $xeTable.getCellElement(firstErrParams.row, firstErrParams.column);
|
|
20192
20214
|
scrollToView(firstErrParams.cell);
|
|
20193
20215
|
handleValidError(firstErrParams).then(finish);
|
|
20194
20216
|
};
|