vxe-table 4.8.8 → 4.8.9
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/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/body.js +4 -8
- package/es/table/src/footer.js +2 -4
- package/es/table/src/table.js +137 -56
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +140 -67
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +4 -8
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +2 -4
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/table.js +134 -55
- package/lib/table/src/table.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/table/src/body.ts +4 -8
- package/packages/table/src/footer.ts +2 -4
- package/packages/table/src/table.ts +133 -54
- /package/es/{iconfont.1731060581842.ttf → iconfont.1731144197614.ttf} +0 -0
- /package/es/{iconfont.1731060581842.woff → iconfont.1731144197614.woff} +0 -0
- /package/es/{iconfont.1731060581842.woff2 → iconfont.1731144197614.woff2} +0 -0
- /package/lib/{iconfont.1731060581842.ttf → iconfont.1731144197614.ttf} +0 -0
- /package/lib/{iconfont.1731060581842.woff → iconfont.1731144197614.woff} +0 -0
- /package/lib/{iconfont.1731060581842.woff2 → iconfont.1731144197614.woff2} +0 -0
package/lib/table/src/table.js
CHANGED
|
@@ -3360,11 +3360,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3360
3360
|
reactData.lastScrollTime = Date.now();
|
|
3361
3361
|
handleSyncScrollX(scrollLeft);
|
|
3362
3362
|
$xeTable.triggerScrollXEvent(evnt);
|
|
3363
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
3363
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3364
3364
|
type: 'table',
|
|
3365
|
-
fixed: ''
|
|
3366
|
-
scrollTop,
|
|
3367
|
-
scrollLeft
|
|
3365
|
+
fixed: ''
|
|
3368
3366
|
});
|
|
3369
3367
|
};
|
|
3370
3368
|
const debounceScrollYCalculate = _xeUtils.default.debounce(function () {
|
|
@@ -3396,11 +3394,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
3396
3394
|
reactData.lastScrollTime = Date.now();
|
|
3397
3395
|
handleSyncScrollY(scrollTop);
|
|
3398
3396
|
$xeTable.triggerScrollYEvent(evnt);
|
|
3399
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
3397
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
3400
3398
|
type: 'table',
|
|
3401
|
-
fixed: ''
|
|
3402
|
-
scrollTop,
|
|
3403
|
-
scrollLeft
|
|
3399
|
+
fixed: ''
|
|
3404
3400
|
});
|
|
3405
3401
|
};
|
|
3406
3402
|
let keyCtxTimeout;
|
|
@@ -4151,25 +4147,35 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4151
4147
|
* 设置为固定列
|
|
4152
4148
|
*/
|
|
4153
4149
|
setColumnFixed(fieldOrColumn, fixed) {
|
|
4154
|
-
|
|
4155
|
-
const
|
|
4156
|
-
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
4150
|
+
let status = false;
|
|
4151
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4157
4152
|
const columnOpts = computeColumnOpts.value;
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4153
|
+
const isMaxFixedColumn = computeIsMaxFixedColumn.value;
|
|
4154
|
+
for (let i = 0; i < cols.length; i++) {
|
|
4155
|
+
const item = cols[i];
|
|
4156
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4157
|
+
const targetColumn = (0, _util.getRootColumn)($xeTable, column);
|
|
4158
|
+
if (targetColumn && targetColumn.fixed !== fixed) {
|
|
4159
|
+
// 是否超过最大固定列数量
|
|
4160
|
+
if (!targetColumn.fixed && isMaxFixedColumn) {
|
|
4161
|
+
if (_ui.VxeUI.modal) {
|
|
4162
|
+
_ui.VxeUI.modal.message({
|
|
4163
|
+
status: 'error',
|
|
4164
|
+
content: getI18n('vxe.table.maxFixedCol', [columnOpts.maxFixedSize])
|
|
4165
|
+
});
|
|
4166
|
+
}
|
|
4167
|
+
return (0, _vue.nextTick)();
|
|
4168
|
+
}
|
|
4169
|
+
_xeUtils.default.eachTree([targetColumn], column => {
|
|
4170
|
+
column.fixed = fixed;
|
|
4171
|
+
});
|
|
4172
|
+
tablePrivateMethods.saveCustomStore('update:fixed');
|
|
4173
|
+
if (!status) {
|
|
4174
|
+
status = true;
|
|
4166
4175
|
}
|
|
4167
|
-
return (0, _vue.nextTick)();
|
|
4168
4176
|
}
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
});
|
|
4172
|
-
tablePrivateMethods.saveCustomStore('update:fixed');
|
|
4177
|
+
}
|
|
4178
|
+
if (status) {
|
|
4173
4179
|
return tableMethods.refreshColumn();
|
|
4174
4180
|
}
|
|
4175
4181
|
return (0, _vue.nextTick)();
|
|
@@ -4178,13 +4184,22 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4178
4184
|
* 取消指定固定列
|
|
4179
4185
|
*/
|
|
4180
4186
|
clearColumnFixed(fieldOrColumn) {
|
|
4181
|
-
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4187
|
+
let status = false;
|
|
4188
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4189
|
+
cols.forEach(item => {
|
|
4190
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4191
|
+
const targetColumn = (0, _util.getRootColumn)($xeTable, column);
|
|
4192
|
+
if (targetColumn && targetColumn.fixed) {
|
|
4193
|
+
_xeUtils.default.eachTree([targetColumn], column => {
|
|
4194
|
+
column.fixed = null;
|
|
4195
|
+
});
|
|
4196
|
+
tablePrivateMethods.saveCustomStore('update:fixed');
|
|
4197
|
+
if (!status) {
|
|
4198
|
+
status = true;
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
});
|
|
4202
|
+
if (status) {
|
|
4188
4203
|
return tableMethods.refreshColumn();
|
|
4189
4204
|
}
|
|
4190
4205
|
return (0, _vue.nextTick)();
|
|
@@ -4193,9 +4208,18 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4193
4208
|
* 隐藏指定列
|
|
4194
4209
|
*/
|
|
4195
4210
|
hideColumn(fieldOrColumn) {
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4211
|
+
let status = false;
|
|
4212
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4213
|
+
cols.forEach(item => {
|
|
4214
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4215
|
+
if (column && column.visible) {
|
|
4216
|
+
column.visible = false;
|
|
4217
|
+
if (!status) {
|
|
4218
|
+
status = true;
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
});
|
|
4222
|
+
if (status) {
|
|
4199
4223
|
return tablePrivateMethods.handleCustom();
|
|
4200
4224
|
}
|
|
4201
4225
|
return (0, _vue.nextTick)();
|
|
@@ -4204,25 +4228,43 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
4204
4228
|
* 显示指定列
|
|
4205
4229
|
*/
|
|
4206
4230
|
showColumn(fieldOrColumn) {
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4231
|
+
let status = false;
|
|
4232
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4233
|
+
cols.forEach(item => {
|
|
4234
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4235
|
+
if (column && !column.visible) {
|
|
4236
|
+
column.visible = true;
|
|
4237
|
+
if (!status) {
|
|
4238
|
+
status = true;
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
});
|
|
4242
|
+
if (status) {
|
|
4210
4243
|
return tablePrivateMethods.handleCustom();
|
|
4211
4244
|
}
|
|
4212
4245
|
return (0, _vue.nextTick)();
|
|
4213
4246
|
},
|
|
4214
4247
|
setColumnWidth(fieldOrColumn, width) {
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
if (
|
|
4220
|
-
const
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4248
|
+
let status = false;
|
|
4249
|
+
const cols = _xeUtils.default.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn];
|
|
4250
|
+
cols.forEach(item => {
|
|
4251
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, item);
|
|
4252
|
+
if (column) {
|
|
4253
|
+
const colWidth = _xeUtils.default.toInteger(width);
|
|
4254
|
+
let rdWidth = colWidth;
|
|
4255
|
+
if ((0, _dom.isScale)(width)) {
|
|
4256
|
+
const tableBody = refTableBody.value;
|
|
4257
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
4258
|
+
const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0;
|
|
4259
|
+
rdWidth = Math.floor(colWidth * bodyWidth);
|
|
4260
|
+
}
|
|
4261
|
+
column.resizeWidth = rdWidth;
|
|
4262
|
+
if (!status) {
|
|
4263
|
+
status = true;
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
});
|
|
4267
|
+
if (status) {
|
|
4226
4268
|
return tableMethods.refreshColumn();
|
|
4227
4269
|
}
|
|
4228
4270
|
return (0, _vue.nextTick)();
|
|
@@ -5344,16 +5386,34 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
5344
5386
|
*/
|
|
5345
5387
|
scrollTo(scrollLeft, scrollTop) {
|
|
5346
5388
|
const tableBody = refTableBody.value;
|
|
5389
|
+
const tableHeader = refTableHeader.value;
|
|
5347
5390
|
const tableFooter = refTableFooter.value;
|
|
5391
|
+
const leftBody = refTableLeftBody.value;
|
|
5348
5392
|
const rightBody = refTableRightBody.value;
|
|
5349
5393
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
5394
|
+
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
5350
5395
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
5396
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
5351
5397
|
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
5352
5398
|
if (_xeUtils.default.isNumber(scrollLeft)) {
|
|
5353
|
-
|
|
5399
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
5400
|
+
if (xHandleEl) {
|
|
5401
|
+
(0, _dom.setScrollLeft)(xHandleEl, scrollLeft);
|
|
5402
|
+
} else {
|
|
5403
|
+
(0, _dom.setScrollLeft)(tableBodyElem, scrollLeft);
|
|
5404
|
+
(0, _dom.setScrollLeft)(tableHeaderElem, scrollLeft);
|
|
5405
|
+
(0, _dom.setScrollLeft)(tableFooterElem, scrollLeft);
|
|
5406
|
+
}
|
|
5354
5407
|
}
|
|
5355
5408
|
if (_xeUtils.default.isNumber(scrollTop)) {
|
|
5356
|
-
|
|
5409
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
5410
|
+
if (yHandleEl) {
|
|
5411
|
+
(0, _dom.setScrollTop)(yHandleEl, scrollTop);
|
|
5412
|
+
} else {
|
|
5413
|
+
(0, _dom.setScrollTop)(tableBodyElem, scrollTop);
|
|
5414
|
+
(0, _dom.setScrollTop)(leftBodyElem, scrollTop);
|
|
5415
|
+
(0, _dom.setScrollTop)(rightBodyElem, scrollTop);
|
|
5416
|
+
}
|
|
5357
5417
|
}
|
|
5358
5418
|
if (reactData.scrollXLoad || reactData.scrollYLoad) {
|
|
5359
5419
|
return new Promise(resolve => {
|
|
@@ -7864,7 +7924,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7864
7924
|
triggerScrollXEvent() {
|
|
7865
7925
|
loadScrollXData();
|
|
7866
7926
|
},
|
|
7867
|
-
handleScrollEvent(evnt, isRollY, isRollX, params) {
|
|
7927
|
+
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
7868
7928
|
const {
|
|
7869
7929
|
highlightHoverRow
|
|
7870
7930
|
} = props;
|
|
@@ -7882,20 +7942,39 @@ var _default = exports.default = (0, _vue.defineComponent)({
|
|
|
7882
7942
|
if (tooltip && tooltip.reactData.visible) {
|
|
7883
7943
|
tooltip.close();
|
|
7884
7944
|
}
|
|
7885
|
-
if (isRollX) {
|
|
7886
|
-
tablePrivateMethods.checkScrolling();
|
|
7887
|
-
}
|
|
7888
7945
|
const bodyHeight = bodyElem ? bodyElem.clientHeight : 0;
|
|
7889
7946
|
const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
|
|
7890
7947
|
const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
|
|
7891
7948
|
const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0;
|
|
7949
|
+
let isTop = false;
|
|
7950
|
+
let isBottom = false;
|
|
7951
|
+
let isLeft = false;
|
|
7952
|
+
let isRight = false;
|
|
7953
|
+
if (isRollX) {
|
|
7954
|
+
isLeft = scrollLeft <= 0;
|
|
7955
|
+
if (!isTop) {
|
|
7956
|
+
isRight = scrollLeft + bodyWidth >= scrollWidth;
|
|
7957
|
+
}
|
|
7958
|
+
tablePrivateMethods.checkScrolling();
|
|
7959
|
+
} else {
|
|
7960
|
+
isTop = scrollTop <= 0;
|
|
7961
|
+
if (!isTop) {
|
|
7962
|
+
isBottom = scrollTop + bodyHeight >= scrollHeight;
|
|
7963
|
+
}
|
|
7964
|
+
}
|
|
7892
7965
|
const evntParams = Object.assign({
|
|
7966
|
+
scrollTop,
|
|
7967
|
+
scrollLeft,
|
|
7893
7968
|
bodyHeight,
|
|
7894
7969
|
bodyWidth,
|
|
7895
7970
|
scrollHeight,
|
|
7896
7971
|
scrollWidth,
|
|
7897
7972
|
isX: isRollX,
|
|
7898
|
-
isY: isRollY
|
|
7973
|
+
isY: isRollY,
|
|
7974
|
+
isTop,
|
|
7975
|
+
isBottom,
|
|
7976
|
+
isLeft,
|
|
7977
|
+
isRight
|
|
7899
7978
|
}, params);
|
|
7900
7979
|
dispatchEvent('scroll', evntParams, evnt);
|
|
7901
7980
|
},
|