vxe-table 3.15.28 → 3.15.29
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/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/filter/mixin.js +1 -0
- package/es/table/src/methods.js +98 -53
- package/es/table/style.css +6 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +6 -0
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +112 -61
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/filter/mixin.js +1 -0
- package/lib/table/src/methods.js +109 -59
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/style/style.css +6 -0
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +6 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/table/module/filter/mixin.ts +1 -0
- package/packages/table/src/methods.ts +103 -54
- package/styles/components/table.scss +14 -0
- /package/es/{iconfont.1747176212818.ttf → iconfont.1747286367921.ttf} +0 -0
- /package/es/{iconfont.1747176212818.woff → iconfont.1747286367921.woff} +0 -0
- /package/es/{iconfont.1747176212818.woff2 → iconfont.1747286367921.woff2} +0 -0
- /package/lib/{iconfont.1747176212818.ttf → iconfont.1747286367921.ttf} +0 -0
- /package/lib/{iconfont.1747176212818.woff → iconfont.1747286367921.woff} +0 -0
- /package/lib/{iconfont.1747176212818.woff2 → iconfont.1747286367921.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTarge
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
6
|
-
import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem } from './util';
|
|
6
|
+
import { getRowUniqueId, clearTableAllStatus, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem } from './util';
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
9
9
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
|
|
@@ -23,8 +23,9 @@ function eqCellValue(row1, row2, field) {
|
|
|
23
23
|
}
|
|
24
24
|
return XEUtils.isEqual(val1, val2);
|
|
25
25
|
}
|
|
26
|
-
function getNextSortOrder(
|
|
27
|
-
const
|
|
26
|
+
function getNextSortOrder($xeTable, column) {
|
|
27
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
28
|
+
const { orders = [] } = sortOpts;
|
|
28
29
|
const currOrder = column.order || null;
|
|
29
30
|
const oIndex = orders.indexOf(currOrder) + 1;
|
|
30
31
|
return orders[oIndex < orders.length ? oIndex : 0];
|
|
@@ -1949,8 +1950,57 @@ function removeFooterMerges($xeTable, merges) {
|
|
|
1949
1950
|
}
|
|
1950
1951
|
return rest;
|
|
1951
1952
|
}
|
|
1952
|
-
function
|
|
1953
|
-
|
|
1953
|
+
function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
|
|
1954
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
1955
|
+
const { multiple, remote, orders } = sortOpts;
|
|
1956
|
+
if (!XEUtils.isArray(sortConfs)) {
|
|
1957
|
+
sortConfs = [sortConfs];
|
|
1958
|
+
}
|
|
1959
|
+
if (sortConfs && sortConfs.length) {
|
|
1960
|
+
if (!multiple) {
|
|
1961
|
+
sortConfs = [sortConfs[0]];
|
|
1962
|
+
clearAllSort($xeTable);
|
|
1963
|
+
}
|
|
1964
|
+
let firstColumn = null;
|
|
1965
|
+
sortConfs.forEach((confs, index) => {
|
|
1966
|
+
let { field, order } = confs;
|
|
1967
|
+
let column = field;
|
|
1968
|
+
if (XEUtils.isString(field)) {
|
|
1969
|
+
column = $xeTable.getColumnByField(field);
|
|
1970
|
+
}
|
|
1971
|
+
if (!firstColumn) {
|
|
1972
|
+
firstColumn = column;
|
|
1973
|
+
}
|
|
1974
|
+
if (column && column.sortable) {
|
|
1975
|
+
if (orders && orders.indexOf(order) === -1) {
|
|
1976
|
+
order = getNextSortOrder($xeTable, column);
|
|
1977
|
+
}
|
|
1978
|
+
if (column.order !== order) {
|
|
1979
|
+
column.order = order;
|
|
1980
|
+
}
|
|
1981
|
+
column.sortTime = Date.now() + index;
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
if (isUpdate) {
|
|
1985
|
+
if (!remote) {
|
|
1986
|
+
$xeTable.handleTableData(true);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
if (evnt) {
|
|
1990
|
+
$xeTable.handleColumnSortEvent(evnt, firstColumn);
|
|
1991
|
+
}
|
|
1992
|
+
return $xeTable.$nextTick().then(() => {
|
|
1993
|
+
updateRowOffsetTop($xeTable);
|
|
1994
|
+
$xeTable.updateCellAreas();
|
|
1995
|
+
return updateStyle($xeTable);
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
return $xeTable.$nextTick();
|
|
1999
|
+
}
|
|
2000
|
+
function clearAllSort($xeTable) {
|
|
2001
|
+
const internalData = $xeTable;
|
|
2002
|
+
const { tableFullColumn } = internalData;
|
|
2003
|
+
tableFullColumn.forEach((column) => {
|
|
1954
2004
|
column.order = null;
|
|
1955
2005
|
});
|
|
1956
2006
|
}
|
|
@@ -3162,7 +3212,7 @@ function lazyScrollYData($xeTable) {
|
|
|
3162
3212
|
function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
3163
3213
|
const reactData = $xeTable;
|
|
3164
3214
|
const internalData = $xeTable;
|
|
3165
|
-
const { scrollXLoad, scrollYLoad } = reactData;
|
|
3215
|
+
const { scrollXLoad, scrollYLoad, isAllOverflow } = reactData;
|
|
3166
3216
|
const { lcsTimeout } = internalData;
|
|
3167
3217
|
if (lcsTimeout) {
|
|
3168
3218
|
clearTimeout(lcsTimeout);
|
|
@@ -3177,13 +3227,19 @@ function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
|
3177
3227
|
internalData.inBodyScroll = false;
|
|
3178
3228
|
internalData.inFooterScroll = false;
|
|
3179
3229
|
internalData.scrollRenderType = '';
|
|
3180
|
-
|
|
3230
|
+
if (!isAllOverflow) {
|
|
3231
|
+
calcCellHeight($xeTable);
|
|
3232
|
+
updateRowOffsetTop($xeTable);
|
|
3233
|
+
}
|
|
3181
3234
|
if (isRollX && scrollXLoad) {
|
|
3182
3235
|
$xeTable.updateScrollXData();
|
|
3183
3236
|
}
|
|
3184
3237
|
if (isRollY && scrollYLoad) {
|
|
3185
3238
|
$xeTable.updateScrollYData().then(() => {
|
|
3186
|
-
|
|
3239
|
+
if (!isAllOverflow) {
|
|
3240
|
+
calcCellHeight($xeTable);
|
|
3241
|
+
updateRowOffsetTop($xeTable);
|
|
3242
|
+
}
|
|
3187
3243
|
$xeTable.updateScrollYSpace();
|
|
3188
3244
|
});
|
|
3189
3245
|
}
|
|
@@ -4624,6 +4680,7 @@ const Methods = {
|
|
|
4624
4680
|
}
|
|
4625
4681
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
4626
4682
|
column.fixed = fixed;
|
|
4683
|
+
column.renderFixed = fixed;
|
|
4627
4684
|
});
|
|
4628
4685
|
$xeTable.saveCustomStore('update:fixed');
|
|
4629
4686
|
if (!status) {
|
|
@@ -4649,6 +4706,7 @@ const Methods = {
|
|
|
4649
4706
|
if (targetColumn && targetColumn.fixed) {
|
|
4650
4707
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
4651
4708
|
column.fixed = null;
|
|
4709
|
+
column.renderFixed = null;
|
|
4652
4710
|
});
|
|
4653
4711
|
$xeTable.saveCustomStore('update:fixed');
|
|
4654
4712
|
if (!status) {
|
|
@@ -6233,10 +6291,14 @@ const Methods = {
|
|
|
6233
6291
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
6234
6292
|
const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
|
|
6235
6293
|
let ovEl = null;
|
|
6294
|
+
let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
|
|
6236
6295
|
if (column.treeNode) {
|
|
6237
6296
|
ovEl = tdEl.querySelector('.vxe-tree-cell');
|
|
6238
6297
|
}
|
|
6239
|
-
|
|
6298
|
+
if (!tipEl) {
|
|
6299
|
+
tipEl = ctEl;
|
|
6300
|
+
}
|
|
6301
|
+
handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
|
|
6240
6302
|
}
|
|
6241
6303
|
},
|
|
6242
6304
|
/**
|
|
@@ -6250,7 +6312,16 @@ const Methods = {
|
|
|
6250
6312
|
const tdEl = evnt.currentTarget;
|
|
6251
6313
|
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
|
|
6252
6314
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6253
|
-
|
|
6315
|
+
const ctEl = tdEl.querySelector('.vxe-cell--wrapper');
|
|
6316
|
+
let ovEl = null;
|
|
6317
|
+
let tipEl = tdEl.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label');
|
|
6318
|
+
if (column.type === 'html') {
|
|
6319
|
+
ovEl = tdEl.querySelector('.vxe-cell--html');
|
|
6320
|
+
}
|
|
6321
|
+
if (!tipEl) {
|
|
6322
|
+
tipEl = ctEl;
|
|
6323
|
+
}
|
|
6324
|
+
handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
|
|
6254
6325
|
}
|
|
6255
6326
|
},
|
|
6256
6327
|
openTooltip(target, content) {
|
|
@@ -8267,49 +8338,12 @@ const Methods = {
|
|
|
8267
8338
|
},
|
|
8268
8339
|
setSort(sortConfs, isUpdate) {
|
|
8269
8340
|
const $xeTable = this;
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
if (!multiple) {
|
|
8277
|
-
sortConfs = [sortConfs[0]];
|
|
8278
|
-
clearAllSort($xeTable);
|
|
8279
|
-
}
|
|
8280
|
-
let firstColumn = null;
|
|
8281
|
-
sortConfs.forEach((confs, index) => {
|
|
8282
|
-
let { field, order } = confs;
|
|
8283
|
-
let column = field;
|
|
8284
|
-
if (XEUtils.isString(field)) {
|
|
8285
|
-
column = $xeTable.getColumnByField(field);
|
|
8286
|
-
}
|
|
8287
|
-
if (!firstColumn) {
|
|
8288
|
-
firstColumn = column;
|
|
8289
|
-
}
|
|
8290
|
-
if (column && column.sortable) {
|
|
8291
|
-
if (orders && orders.indexOf(order) === -1) {
|
|
8292
|
-
order = getNextSortOrder($xeTable, column);
|
|
8293
|
-
}
|
|
8294
|
-
if (column.order !== order) {
|
|
8295
|
-
column.order = order;
|
|
8296
|
-
}
|
|
8297
|
-
column.sortTime = Date.now() + index;
|
|
8298
|
-
}
|
|
8299
|
-
});
|
|
8300
|
-
if (isUpdate) {
|
|
8301
|
-
if (!remote) {
|
|
8302
|
-
$xeTable.handleTableData(true);
|
|
8303
|
-
}
|
|
8304
|
-
$xeTable.handleColumnSortEvent(new Event('click'), firstColumn);
|
|
8305
|
-
}
|
|
8306
|
-
return $xeTable.$nextTick().then(() => {
|
|
8307
|
-
updateRowOffsetTop($xeTable);
|
|
8308
|
-
$xeTable.updateCellAreas();
|
|
8309
|
-
return updateStyle($xeTable);
|
|
8310
|
-
});
|
|
8311
|
-
}
|
|
8312
|
-
return $xeTable.$nextTick();
|
|
8341
|
+
// 已废弃,即将去掉事件触发 new Event('click') -> null
|
|
8342
|
+
return handleSortEvent($xeTable, new Event('click'), sortConfs, isUpdate);
|
|
8343
|
+
},
|
|
8344
|
+
setSortByEvent(evnt, sortConfs, isUpdate) {
|
|
8345
|
+
const $xeTable = this;
|
|
8346
|
+
return handleSortEvent($xeTable, evnt, sortConfs, isUpdate);
|
|
8313
8347
|
},
|
|
8314
8348
|
/**
|
|
8315
8349
|
* 清空指定列的排序条件
|
|
@@ -8402,6 +8436,17 @@ const Methods = {
|
|
|
8402
8436
|
}
|
|
8403
8437
|
return sortList;
|
|
8404
8438
|
},
|
|
8439
|
+
setFilterByEvent(evnt, fieldOrColumn, options, isUpdate) {
|
|
8440
|
+
const $xeTable = this;
|
|
8441
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
8442
|
+
if (column && column.filters) {
|
|
8443
|
+
column.filters = toFilters(options || []);
|
|
8444
|
+
if (isUpdate) {
|
|
8445
|
+
return $xeTable.handleColumnConfirmFilter(column, evnt);
|
|
8446
|
+
}
|
|
8447
|
+
}
|
|
8448
|
+
return $xeTable.$nextTick();
|
|
8449
|
+
},
|
|
8405
8450
|
/**
|
|
8406
8451
|
* 关闭筛选
|
|
8407
8452
|
* @param {Event} evnt 事件
|
package/es/table/style.css
CHANGED
|
@@ -2550,6 +2550,12 @@
|
|
|
2550
2550
|
.vxe-table--render-default .vxe-footer--column.col--right > .vxe-cell {
|
|
2551
2551
|
justify-content: right;
|
|
2552
2552
|
}
|
|
2553
|
+
.vxe-table--render-default .vxe-header--column.col--ellipsis.col--center .vxe-cell--wrapper {
|
|
2554
|
+
justify-content: center;
|
|
2555
|
+
}
|
|
2556
|
+
.vxe-table--render-default .vxe-header--column.col--ellipsis.col--right .vxe-cell--wrapper {
|
|
2557
|
+
justify-content: right;
|
|
2558
|
+
}
|
|
2553
2559
|
.vxe-table--render-default .vxe-header--column.col--ellipsis.col--center .vxe-cell,
|
|
2554
2560
|
.vxe-table--render-default .vxe-footer--column.col--ellipsis.col--center .vxe-cell {
|
|
2555
2561
|
justify-content: center;
|