vxe-table 4.23.0-beta.0 → 4.23.0-beta.2
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/README.md +2 -2
- package/dist/all.esm.js +540 -103
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/fr-FR.js +29 -29
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/props.js +9 -1
- package/es/table/src/scrollbar.js +54 -0
- package/es/table/src/table.js +458 -89
- package/es/table/src/util.js +11 -2
- package/es/table/style.css +30 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -11
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +30 -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 +118 -38
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/fr-FR.js +29 -29
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +29 -29
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/props.js +9 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/scrollbar.js +63 -0
- package/lib/table/src/scrollbar.min.js +1 -0
- package/lib/table/src/table.js +33 -23
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +11 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +30 -0
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -11
- 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 +30 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/fr-FR.ts +903 -903
- package/packages/table/src/props.ts +9 -1
- package/packages/table/src/scrollbar.ts +57 -0
- package/packages/table/src/table.ts +494 -91
- package/packages/table/src/util.ts +15 -2
- package/packages/ui/index.ts +8 -10
- package/styles/components/table.scss +65 -0
- /package/es/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
- /package/es/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
- /package/es/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
- /package/lib/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
- /package/lib/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
- /package/lib/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -2,11 +2,12 @@ import { h, reactive, ref, provide, inject, nextTick, Teleport, onActivated, onD
|
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import XEUtils from 'xe-utils';
|
|
4
4
|
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom';
|
|
5
|
-
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf } from '../../ui/src/utils';
|
|
5
|
+
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf, getDefaultConfig } from '../../ui/src/utils';
|
|
6
6
|
import { VxeUI } from '../../ui';
|
|
7
7
|
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util';
|
|
8
8
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
9
9
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime';
|
|
10
|
+
import { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } from './scrollbar';
|
|
10
11
|
import { createComponentLog } from '../../ui/src/log';
|
|
11
12
|
import { getCrossTableDragRowInfo } from './store';
|
|
12
13
|
import Cell from './cell';
|
|
@@ -29,7 +30,7 @@ import '../module/validator/hook';
|
|
|
29
30
|
import '../module/custom/hook';
|
|
30
31
|
import '../render';
|
|
31
32
|
const { warnLog, errLog } = createComponentLog('table');
|
|
32
|
-
const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
|
|
33
|
+
const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, domUtils, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
|
|
33
34
|
const supportMaxRow = 5e6;
|
|
34
35
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
35
36
|
const maxYHeight = 5e6;
|
|
@@ -44,6 +45,7 @@ export default defineVxeComponent({
|
|
|
44
45
|
const { slots, emit } = context;
|
|
45
46
|
const xID = XEUtils.uniqueId();
|
|
46
47
|
const browseObj = XEUtils.browse();
|
|
48
|
+
const scrollDefaultConf = Object.assign({}, getConfig().scrollbar);
|
|
47
49
|
// 使用已安装的组件,如果未安装则不渲染
|
|
48
50
|
const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading');
|
|
49
51
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
@@ -103,6 +105,10 @@ export default defineVxeComponent({
|
|
|
103
105
|
const refScrollYBottomCornerElem = ref();
|
|
104
106
|
const refScrollXSpaceElem = ref();
|
|
105
107
|
const refScrollYSpaceElem = ref();
|
|
108
|
+
const refTrackXElem = ref();
|
|
109
|
+
const refTrackYElem = ref();
|
|
110
|
+
const refThumbXElem = ref();
|
|
111
|
+
const refThumbYElem = ref();
|
|
106
112
|
let $xeToolbar;
|
|
107
113
|
const computeTableId = computed(() => {
|
|
108
114
|
const { id } = props;
|
|
@@ -186,14 +192,42 @@ export default defineVxeComponent({
|
|
|
186
192
|
return Object.assign({}, getConfig().table.scrollbarConfig, props.scrollbarConfig);
|
|
187
193
|
});
|
|
188
194
|
const computeScrollbarXOpts = computed(() => {
|
|
189
|
-
var _a;
|
|
190
195
|
const scrollbarOpts = computeScrollbarOpts.value;
|
|
191
|
-
return Object.assign({}, scrollbarOpts.x,
|
|
196
|
+
return scrollbarOpts.x ? Object.assign({}, scrollbarOpts.x, scrollbarOpts.xConfig) : (scrollbarOpts.xConfig || {});
|
|
192
197
|
});
|
|
193
198
|
const computeScrollbarYOpts = computed(() => {
|
|
194
|
-
var _a;
|
|
195
199
|
const scrollbarOpts = computeScrollbarOpts.value;
|
|
196
|
-
return Object.assign({}, scrollbarOpts.y,
|
|
200
|
+
return scrollbarOpts.y ? Object.assign({}, scrollbarOpts.y, scrollbarOpts.yConfig) : (scrollbarOpts.yConfig || {});
|
|
201
|
+
});
|
|
202
|
+
const computeScrollXHeight = computed(() => {
|
|
203
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
204
|
+
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
205
|
+
return XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarXOpts.height, scrollbarOpts.height), scrollDefaultConf.height));
|
|
206
|
+
});
|
|
207
|
+
const computeScrollYWidth = computed(() => {
|
|
208
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
209
|
+
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
210
|
+
return XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarYOpts.width, scrollbarOpts.width), scrollDefaultConf.width));
|
|
211
|
+
});
|
|
212
|
+
const computeScrollXVisible = computed(() => {
|
|
213
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
214
|
+
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
215
|
+
return getDefaultConfig(scrollbarXOpts.visible, scrollbarOpts.visible);
|
|
216
|
+
});
|
|
217
|
+
const computeScrollYVisible = computed(() => {
|
|
218
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
219
|
+
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
220
|
+
return getDefaultConfig(scrollbarYOpts.visible, scrollbarOpts.visible);
|
|
221
|
+
});
|
|
222
|
+
const computeScrollXAutoHide = computed(() => {
|
|
223
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
224
|
+
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
225
|
+
return getDefaultConfig(getDefaultConfig(scrollbarXOpts.autoHide, scrollbarOpts.autoHide), scrollDefaultConf.autoHide);
|
|
226
|
+
});
|
|
227
|
+
const computeScrollYAutoHide = computed(() => {
|
|
228
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
229
|
+
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
230
|
+
return getDefaultConfig(getDefaultConfig(scrollbarYOpts.autoHide, scrollbarOpts.autoHide), scrollDefaultConf.autoHide);
|
|
197
231
|
});
|
|
198
232
|
const computeScrollbarXToTop = computed(() => {
|
|
199
233
|
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
@@ -203,6 +237,23 @@ export default defineVxeComponent({
|
|
|
203
237
|
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
204
238
|
return scrollbarYOpts.position === 'left';
|
|
205
239
|
});
|
|
240
|
+
const computeScrollbarWrapperClss = computed(() => {
|
|
241
|
+
const { yThumbHeight, xThumbWidth } = reactData;
|
|
242
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
243
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
244
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
245
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
246
|
+
return domUtils.buildClass([
|
|
247
|
+
'vxe-scrollbar is--virtual',
|
|
248
|
+
`ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`,
|
|
249
|
+
`ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`,
|
|
250
|
+
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
|
251
|
+
`sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`
|
|
252
|
+
], {
|
|
253
|
+
'overflow-y': yThumbHeight,
|
|
254
|
+
'overflow-x': xThumbWidth
|
|
255
|
+
});
|
|
256
|
+
});
|
|
206
257
|
const computeScrollYThreshold = computed(() => {
|
|
207
258
|
const virtualYOpts = computeVirtualYOpts.value;
|
|
208
259
|
const { threshold } = virtualYOpts;
|
|
@@ -232,6 +283,10 @@ export default defineVxeComponent({
|
|
|
232
283
|
}
|
|
233
284
|
return cellOpts;
|
|
234
285
|
});
|
|
286
|
+
const computeCellHeitht = computed(() => {
|
|
287
|
+
const cellOpts = computeCellOpts.value;
|
|
288
|
+
return cellOpts.height;
|
|
289
|
+
});
|
|
235
290
|
const computeHeaderCellOpts = computed(() => {
|
|
236
291
|
const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig);
|
|
237
292
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
@@ -539,16 +594,16 @@ export default defineVxeComponent({
|
|
|
539
594
|
return '';
|
|
540
595
|
});
|
|
541
596
|
const computeTableStyle = computed(() => {
|
|
542
|
-
const
|
|
543
|
-
const
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
546
|
-
|
|
597
|
+
const barWidth = computeScrollYWidth.value;
|
|
598
|
+
const barHeight = computeScrollXHeight.value;
|
|
599
|
+
const stys = {};
|
|
600
|
+
if (barWidth || barHeight) {
|
|
601
|
+
stys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(barWidth || barHeight);
|
|
602
|
+
stys['--vxe-ui-scrollbar-y-width'] = toCssUnit(barWidth || barHeight);
|
|
603
|
+
stys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(barHeight || barWidth);
|
|
604
|
+
stys['--vxe-ui-scrollbar-x-height'] = toCssUnit(barHeight || barWidth);
|
|
547
605
|
}
|
|
548
|
-
|
|
549
|
-
tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height);
|
|
550
|
-
}
|
|
551
|
-
return tStys;
|
|
606
|
+
return stys;
|
|
552
607
|
});
|
|
553
608
|
const computeTableRowExpandedList = computed(() => {
|
|
554
609
|
const { tableData, rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData;
|
|
@@ -739,8 +794,15 @@ export default defineVxeComponent({
|
|
|
739
794
|
computeScrollbarOpts,
|
|
740
795
|
computeScrollbarXOpts,
|
|
741
796
|
computeScrollbarYOpts,
|
|
797
|
+
computeScrollXHeight,
|
|
798
|
+
computeScrollYWidth,
|
|
799
|
+
computeScrollXVisible,
|
|
800
|
+
computeScrollYVisible,
|
|
801
|
+
computeScrollXAutoHide,
|
|
802
|
+
computeScrollYAutoHide,
|
|
742
803
|
computeScrollbarXToTop,
|
|
743
804
|
computeScrollbarYToLeft,
|
|
805
|
+
computeScrollbarWrapperClss,
|
|
744
806
|
computeColumnOpts,
|
|
745
807
|
computeCurrentColumnOpts,
|
|
746
808
|
computeScrollXThreshold,
|
|
@@ -1861,14 +1923,6 @@ export default defineVxeComponent({
|
|
|
1861
1923
|
if (!bodyWrapperElem) {
|
|
1862
1924
|
return;
|
|
1863
1925
|
}
|
|
1864
|
-
const yHandleEl = refScrollYHandleElem.value;
|
|
1865
|
-
if (!yHandleEl) {
|
|
1866
|
-
return;
|
|
1867
|
-
}
|
|
1868
|
-
const xHandleEl = refScrollXHandleElem.value;
|
|
1869
|
-
if (!xHandleEl) {
|
|
1870
|
-
return;
|
|
1871
|
-
}
|
|
1872
1926
|
const columnOpts = computeColumnOpts.value;
|
|
1873
1927
|
let tWidth = 0;
|
|
1874
1928
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
@@ -2461,7 +2515,6 @@ export default defineVxeComponent({
|
|
|
2461
2515
|
const isHeaderRenderOptimize = computeIsHeaderRenderOptimize.value;
|
|
2462
2516
|
const isBodyRenderOptimize = computeIsBodyRenderOptimize.value;
|
|
2463
2517
|
const isFooterRenderOptimize = computeIsFooterRenderOptimize.value;
|
|
2464
|
-
const scrollbarOpts = computeScrollbarOpts.value;
|
|
2465
2518
|
const mouseOpts = computeMouseOpts.value;
|
|
2466
2519
|
const bodyWrapperElem = getRefElem(elemStore['main-body-wrapper']);
|
|
2467
2520
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
@@ -2469,24 +2522,26 @@ export default defineVxeComponent({
|
|
|
2469
2522
|
emptyPlaceholderElem.style.top = `${tHeaderHeight}px`;
|
|
2470
2523
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
|
|
2471
2524
|
}
|
|
2472
|
-
const
|
|
2473
|
-
const
|
|
2525
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
2526
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
2474
2527
|
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
2475
2528
|
let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
|
|
2476
|
-
|
|
2529
|
+
const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden';
|
|
2530
|
+
if (scrollXVisible === 'visible' || $xeGanttView) {
|
|
2477
2531
|
osbHeight = scrollbarHeight;
|
|
2478
2532
|
xScrollbarVisible = 'visible';
|
|
2479
2533
|
}
|
|
2480
|
-
else if (
|
|
2534
|
+
else if (hideXScroll) {
|
|
2481
2535
|
osbHeight = 0;
|
|
2482
2536
|
xScrollbarVisible = 'hidden';
|
|
2483
2537
|
}
|
|
2484
2538
|
let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
|
|
2485
|
-
|
|
2539
|
+
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden';
|
|
2540
|
+
if (hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
|
|
2486
2541
|
osbWidth = 0;
|
|
2487
2542
|
yScrollbarVisible = 'hidden';
|
|
2488
2543
|
}
|
|
2489
|
-
else if (
|
|
2544
|
+
else if (scrollYVisible === 'visible') {
|
|
2490
2545
|
osbWidth = scrollbarWidth;
|
|
2491
2546
|
yScrollbarVisible = 'visible';
|
|
2492
2547
|
}
|
|
@@ -3294,7 +3349,6 @@ export default defineVxeComponent({
|
|
|
3294
3349
|
const calcScrollbar = () => {
|
|
3295
3350
|
const { scrollXWidth, scrollYHeight } = reactData;
|
|
3296
3351
|
const { elemStore } = internalData;
|
|
3297
|
-
const scrollbarOpts = computeScrollbarOpts.value;
|
|
3298
3352
|
const el = refElem.value;
|
|
3299
3353
|
if (!el || !el.clientWidth) {
|
|
3300
3354
|
return;
|
|
@@ -3304,17 +3358,30 @@ export default defineVxeComponent({
|
|
|
3304
3358
|
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
3305
3359
|
const xHandleEl = refScrollXHandleElem.value;
|
|
3306
3360
|
const yHandleEl = refScrollYHandleElem.value;
|
|
3361
|
+
const thumbXElem = refThumbXElem.value;
|
|
3362
|
+
const thumbYElem = refThumbYElem.value;
|
|
3307
3363
|
let overflowY = false;
|
|
3308
3364
|
let overflowX = false;
|
|
3309
3365
|
if (bodyWrapperElem) {
|
|
3366
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
3367
|
+
const barWidth = computeScrollYWidth.value;
|
|
3368
|
+
const barHeight = computeScrollXHeight.value;
|
|
3310
3369
|
overflowY = scrollYHeight > bodyWrapperElem.clientHeight;
|
|
3311
|
-
|
|
3312
|
-
|
|
3370
|
+
// 如果是虚拟滚动条
|
|
3371
|
+
if (thumbYElem) {
|
|
3372
|
+
reactData.scrollbarHeight = scrollbarOpts.padding ? thumbYElem.offsetWidth : 0;
|
|
3373
|
+
}
|
|
3374
|
+
else if (yHandleEl) {
|
|
3375
|
+
reactData.scrollbarWidth = (barWidth || barHeight) || (yHandleEl.offsetWidth - yHandleEl.clientWidth) || 14;
|
|
3313
3376
|
}
|
|
3314
3377
|
reactData.overflowY = overflowY;
|
|
3315
3378
|
overflowX = scrollXWidth > bodyWrapperElem.clientWidth;
|
|
3316
|
-
|
|
3317
|
-
|
|
3379
|
+
// 如果是虚拟滚动条
|
|
3380
|
+
if (thumbXElem) {
|
|
3381
|
+
reactData.scrollbarHeight = scrollbarOpts.padding ? thumbXElem.offsetHeight : 0;
|
|
3382
|
+
}
|
|
3383
|
+
else if (xHandleEl) {
|
|
3384
|
+
reactData.scrollbarHeight = (barHeight || barWidth) || (xHandleEl.offsetHeight - xHandleEl.clientHeight) || 14;
|
|
3318
3385
|
}
|
|
3319
3386
|
const hHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
3320
3387
|
const fHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
@@ -3380,6 +3447,10 @@ export default defineVxeComponent({
|
|
|
3380
3447
|
}
|
|
3381
3448
|
});
|
|
3382
3449
|
};
|
|
3450
|
+
const updateScrollbar = () => {
|
|
3451
|
+
updateThumbSize();
|
|
3452
|
+
updateThumbOffset();
|
|
3453
|
+
};
|
|
3383
3454
|
const defaultMinRunDelay = 50;
|
|
3384
3455
|
const handleLazyRecalculate = (reFull, reWidth, reHeight, options) => {
|
|
3385
3456
|
const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay;
|
|
@@ -3400,6 +3471,7 @@ export default defineVxeComponent({
|
|
|
3400
3471
|
const refreshDelay = resizeOpts.refreshDelay || 30;
|
|
3401
3472
|
const reDelay = rceDelay + refreshDelay;
|
|
3402
3473
|
const el = refElem.value;
|
|
3474
|
+
updateScrollbar();
|
|
3403
3475
|
if (el && el.clientWidth) {
|
|
3404
3476
|
autoCellWidth();
|
|
3405
3477
|
updateRowExpandStyle();
|
|
@@ -11415,6 +11487,18 @@ export default defineVxeComponent({
|
|
|
11415
11487
|
}
|
|
11416
11488
|
return nextTick();
|
|
11417
11489
|
},
|
|
11490
|
+
/**
|
|
11491
|
+
* @private
|
|
11492
|
+
*/
|
|
11493
|
+
updateScrollbar() {
|
|
11494
|
+
return updateScrollbar();
|
|
11495
|
+
},
|
|
11496
|
+
/**
|
|
11497
|
+
* @private
|
|
11498
|
+
*/
|
|
11499
|
+
updateThumbOffset() {
|
|
11500
|
+
return updateThumbOffset();
|
|
11501
|
+
},
|
|
11418
11502
|
/**
|
|
11419
11503
|
* 表头单元格按下事件
|
|
11420
11504
|
*/
|
|
@@ -12566,19 +12650,18 @@ export default defineVxeComponent({
|
|
|
12566
12650
|
},
|
|
12567
12651
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
12568
12652
|
const { highlightHoverRow } = props;
|
|
12569
|
-
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
12570
|
-
const
|
|
12571
|
-
|
|
12572
|
-
if (!xHandleEl || !yHandleEl) {
|
|
12653
|
+
const { elemStore, lastScrollLeft, lastScrollTop } = internalData;
|
|
12654
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
12655
|
+
if (!bodyScrollElem) {
|
|
12573
12656
|
return;
|
|
12574
12657
|
}
|
|
12575
12658
|
const rowOpts = computeRowOpts.value;
|
|
12576
12659
|
const validTip = refValidTooltip.value;
|
|
12577
12660
|
const tooltip = refTooltip.value;
|
|
12578
|
-
const bodyHeight =
|
|
12579
|
-
const bodyWidth =
|
|
12580
|
-
const scrollHeight =
|
|
12581
|
-
const scrollWidth =
|
|
12661
|
+
const bodyHeight = bodyScrollElem.clientHeight;
|
|
12662
|
+
const bodyWidth = bodyScrollElem.clientWidth;
|
|
12663
|
+
const scrollHeight = bodyScrollElem.scrollHeight;
|
|
12664
|
+
const scrollWidth = bodyScrollElem.scrollWidth;
|
|
12582
12665
|
let isTop = false;
|
|
12583
12666
|
let isBottom = false;
|
|
12584
12667
|
let isLeft = false;
|
|
@@ -12640,6 +12723,7 @@ export default defineVxeComponent({
|
|
|
12640
12723
|
isLeft,
|
|
12641
12724
|
isRight,
|
|
12642
12725
|
direction }, params);
|
|
12726
|
+
updateThumbOffset();
|
|
12643
12727
|
updateRowExpandStyle();
|
|
12644
12728
|
checkLastSyncScroll(isRollX, isRollY);
|
|
12645
12729
|
if (isRollX) {
|
|
@@ -12684,6 +12768,7 @@ export default defineVxeComponent({
|
|
|
12684
12768
|
}
|
|
12685
12769
|
},
|
|
12686
12770
|
triggerBodyScrollEvent(evnt, fixedType) {
|
|
12771
|
+
const { useScrollbar } = props;
|
|
12687
12772
|
const { scrollYLoad, scrollXLoad } = reactData;
|
|
12688
12773
|
const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData;
|
|
12689
12774
|
if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
|
|
@@ -12703,19 +12788,21 @@ export default defineVxeComponent({
|
|
|
12703
12788
|
if (!bodyScrollElem) {
|
|
12704
12789
|
return;
|
|
12705
12790
|
}
|
|
12706
|
-
if (!
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12791
|
+
if (!useScrollbar) {
|
|
12792
|
+
if (!xHandleEl) {
|
|
12793
|
+
return;
|
|
12794
|
+
}
|
|
12795
|
+
if (!yHandleEl) {
|
|
12796
|
+
return;
|
|
12797
|
+
}
|
|
12711
12798
|
}
|
|
12712
12799
|
if (inBodyScroll) {
|
|
12713
12800
|
if (scrollRenderType !== fixedType) {
|
|
12714
12801
|
return;
|
|
12715
12802
|
}
|
|
12716
12803
|
}
|
|
12717
|
-
let scrollTop =
|
|
12718
|
-
let scrollLeft =
|
|
12804
|
+
let scrollTop = 0;
|
|
12805
|
+
let scrollLeft = 0;
|
|
12719
12806
|
if (leftScrollElem && fixedType === 'left') {
|
|
12720
12807
|
scrollTop = leftScrollElem.scrollTop;
|
|
12721
12808
|
}
|
|
@@ -12856,8 +12943,8 @@ export default defineVxeComponent({
|
|
|
12856
12943
|
const rightFixedWidth = computeRightFixedWidth.value;
|
|
12857
12944
|
const { elemStore, lastScrollTop, lastScrollLeft } = internalData;
|
|
12858
12945
|
const rowOpts = computeRowOpts.value;
|
|
12859
|
-
const
|
|
12860
|
-
const
|
|
12946
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
12947
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
12861
12948
|
const xHandleEl = refScrollXHandleElem.value;
|
|
12862
12949
|
const yHandleEl = refScrollYHandleElem.value;
|
|
12863
12950
|
const leftScrollElem = getRefElem(elemStore['left-body-scroll']);
|
|
@@ -12880,14 +12967,14 @@ export default defineVxeComponent({
|
|
|
12880
12967
|
const isRollY = overflowY && scrollTop !== lastScrollTop;
|
|
12881
12968
|
if (isRollX) {
|
|
12882
12969
|
// 如果禁用滚动
|
|
12883
|
-
if (
|
|
12970
|
+
if (scrollXVisible === false || scrollXVisible === 'hidden') {
|
|
12884
12971
|
evnt.preventDefault();
|
|
12885
12972
|
return;
|
|
12886
12973
|
}
|
|
12887
12974
|
}
|
|
12888
12975
|
if (isRollY) {
|
|
12889
12976
|
// 如果禁用滚动
|
|
12890
|
-
if (
|
|
12977
|
+
if (scrollYVisible === false || scrollYVisible === 'hidden') {
|
|
12891
12978
|
evnt.preventDefault();
|
|
12892
12979
|
return;
|
|
12893
12980
|
}
|
|
@@ -13452,6 +13539,168 @@ export default defineVxeComponent({
|
|
|
13452
13539
|
return nextTick();
|
|
13453
13540
|
}
|
|
13454
13541
|
};
|
|
13542
|
+
const updateThumbSize = () => {
|
|
13543
|
+
const { elemStore } = internalData;
|
|
13544
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13545
|
+
if (!viewEl) {
|
|
13546
|
+
return;
|
|
13547
|
+
}
|
|
13548
|
+
if (!viewEl.clientHeight || !viewEl.clientHeight) {
|
|
13549
|
+
return;
|
|
13550
|
+
}
|
|
13551
|
+
const trackXEl = refTrackXElem.value;
|
|
13552
|
+
const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
|
|
13553
|
+
const thumbXElem = refThumbXElem.value;
|
|
13554
|
+
if (thumbXElem) {
|
|
13555
|
+
thumbXElem.style.width = xThumbWidth + 'px';
|
|
13556
|
+
}
|
|
13557
|
+
reactData.xThumbWidth = xThumbWidth;
|
|
13558
|
+
const trackYEl = refTrackYElem.value;
|
|
13559
|
+
const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
|
|
13560
|
+
const thumbYElem = refThumbYElem.value;
|
|
13561
|
+
if (thumbYElem) {
|
|
13562
|
+
thumbYElem.style.height = yThumbHeight + 'px';
|
|
13563
|
+
}
|
|
13564
|
+
reactData.yThumbHeight = yThumbHeight;
|
|
13565
|
+
};
|
|
13566
|
+
const updateThumbOffset = () => {
|
|
13567
|
+
const { elemStore } = internalData;
|
|
13568
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13569
|
+
if (!viewEl) {
|
|
13570
|
+
return;
|
|
13571
|
+
}
|
|
13572
|
+
if (!viewEl.clientHeight || !viewEl.clientHeight) {
|
|
13573
|
+
return;
|
|
13574
|
+
}
|
|
13575
|
+
const { xThumbWidth, yThumbHeight } = reactData;
|
|
13576
|
+
const trackXEl = refTrackXElem.value;
|
|
13577
|
+
const thumbXElem = refThumbXElem.value;
|
|
13578
|
+
const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
|
|
13579
|
+
internalData.xThumbLeft = xThumbLeft;
|
|
13580
|
+
if (thumbXElem && xThumbWidth) {
|
|
13581
|
+
thumbXElem.style.width = xThumbWidth + 'px';
|
|
13582
|
+
thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
|
|
13583
|
+
}
|
|
13584
|
+
const trackYEl = refTrackYElem.value;
|
|
13585
|
+
const thumbYElem = refThumbYElem.value;
|
|
13586
|
+
const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
|
|
13587
|
+
internalData.yThumbTop = yThumbTop;
|
|
13588
|
+
if (thumbYElem && yThumbHeight) {
|
|
13589
|
+
thumbYElem.style.height = yThumbHeight + 'px';
|
|
13590
|
+
thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
|
|
13591
|
+
}
|
|
13592
|
+
};
|
|
13593
|
+
const clickTrackXEvent = (evnt) => {
|
|
13594
|
+
const { elemStore } = internalData;
|
|
13595
|
+
const trackEl = evnt.currentTarget;
|
|
13596
|
+
if (trackEl !== evnt.target) {
|
|
13597
|
+
return;
|
|
13598
|
+
}
|
|
13599
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13600
|
+
if (!viewEl) {
|
|
13601
|
+
return;
|
|
13602
|
+
}
|
|
13603
|
+
const { xThumbWidth } = reactData;
|
|
13604
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13605
|
+
viewEl.scrollTo({
|
|
13606
|
+
left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
|
|
13607
|
+
behavior: 'auto'
|
|
13608
|
+
});
|
|
13609
|
+
};
|
|
13610
|
+
const clickTrackYEvent = (evnt) => {
|
|
13611
|
+
const { elemStore } = internalData;
|
|
13612
|
+
const trackEl = evnt.currentTarget;
|
|
13613
|
+
if (trackEl !== evnt.target) {
|
|
13614
|
+
return;
|
|
13615
|
+
}
|
|
13616
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13617
|
+
if (!viewEl) {
|
|
13618
|
+
return;
|
|
13619
|
+
}
|
|
13620
|
+
const { yThumbHeight } = reactData;
|
|
13621
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13622
|
+
viewEl.scrollTo({
|
|
13623
|
+
top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
|
|
13624
|
+
behavior: 'auto'
|
|
13625
|
+
});
|
|
13626
|
+
};
|
|
13627
|
+
const pointerdownThumbXEvent = (evnt) => {
|
|
13628
|
+
const { elemStore } = internalData;
|
|
13629
|
+
const thumbEl = evnt.currentTarget;
|
|
13630
|
+
internalData.isThumbDrag = true;
|
|
13631
|
+
thumbEl.setPointerCapture(evnt.pointerId);
|
|
13632
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13633
|
+
if (!viewEl) {
|
|
13634
|
+
return;
|
|
13635
|
+
}
|
|
13636
|
+
const { xThumbWidth } = reactData;
|
|
13637
|
+
const trackEl = thumbEl.parentElement;
|
|
13638
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13639
|
+
const pointerPosition = evnt.clientX - trackRect.left;
|
|
13640
|
+
// 记录 thumb 的偏移
|
|
13641
|
+
const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
|
|
13642
|
+
internalData.thumbDragOffset = pointerPosition - thumbOffset;
|
|
13643
|
+
};
|
|
13644
|
+
const pointermoveThumbXEvent = (evnt) => {
|
|
13645
|
+
const thumbEl = evnt.currentTarget;
|
|
13646
|
+
if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
|
|
13647
|
+
return;
|
|
13648
|
+
}
|
|
13649
|
+
const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
|
|
13650
|
+
if (isThumbDrag) {
|
|
13651
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13652
|
+
if (!viewEl) {
|
|
13653
|
+
return;
|
|
13654
|
+
}
|
|
13655
|
+
const { xThumbWidth } = reactData;
|
|
13656
|
+
const thumbEl = evnt.currentTarget;
|
|
13657
|
+
const trackEl = thumbEl.parentElement;
|
|
13658
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13659
|
+
// 更新偏移
|
|
13660
|
+
viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
|
|
13661
|
+
}
|
|
13662
|
+
};
|
|
13663
|
+
const cleatPointerThumbEvent = (evnt) => {
|
|
13664
|
+
const thumbEl = evnt.currentTarget;
|
|
13665
|
+
thumbEl.releasePointerCapture(evnt.pointerId);
|
|
13666
|
+
internalData.isThumbDrag = false;
|
|
13667
|
+
};
|
|
13668
|
+
const pointerdownThumbYEvent = (evnt) => {
|
|
13669
|
+
const { elemStore } = internalData;
|
|
13670
|
+
const thumbEl = evnt.currentTarget;
|
|
13671
|
+
internalData.isThumbDrag = true;
|
|
13672
|
+
thumbEl.setPointerCapture(evnt.pointerId);
|
|
13673
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13674
|
+
if (!viewEl) {
|
|
13675
|
+
return;
|
|
13676
|
+
}
|
|
13677
|
+
const { yThumbHeight } = reactData;
|
|
13678
|
+
const trackEl = thumbEl.parentElement;
|
|
13679
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13680
|
+
const pointerPosition = evnt.clientY - trackRect.top;
|
|
13681
|
+
// 记录 thumb 的偏移
|
|
13682
|
+
const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
|
|
13683
|
+
internalData.thumbDragOffset = pointerPosition - thumbOffset;
|
|
13684
|
+
};
|
|
13685
|
+
const pointermoveThumbYEvent = (evnt) => {
|
|
13686
|
+
const thumbEl = evnt.currentTarget;
|
|
13687
|
+
if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
|
|
13688
|
+
return;
|
|
13689
|
+
}
|
|
13690
|
+
const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
|
|
13691
|
+
if (isThumbDrag) {
|
|
13692
|
+
const viewEl = getRefElem(elemStore['main-body-scroll']);
|
|
13693
|
+
if (!viewEl) {
|
|
13694
|
+
return;
|
|
13695
|
+
}
|
|
13696
|
+
const { yThumbHeight } = reactData;
|
|
13697
|
+
const thumbEl = evnt.currentTarget;
|
|
13698
|
+
const trackEl = thumbEl.parentElement;
|
|
13699
|
+
const trackRect = trackEl.getBoundingClientRect();
|
|
13700
|
+
// 更新偏移
|
|
13701
|
+
viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
|
|
13702
|
+
}
|
|
13703
|
+
};
|
|
13455
13704
|
// 检测对应模块是否安装
|
|
13456
13705
|
// 'openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').forEach(name => {
|
|
13457
13706
|
// ($xeTable as any)[name] = function () {
|
|
@@ -13476,6 +13725,8 @@ export default defineVxeComponent({
|
|
|
13476
13725
|
const scrollbarOpts = computeScrollbarOpts.value;
|
|
13477
13726
|
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
13478
13727
|
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
13728
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
13729
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
13479
13730
|
const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts;
|
|
13480
13731
|
const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts;
|
|
13481
13732
|
const isFixedLeft = fixedType === 'left';
|
|
@@ -13484,10 +13735,15 @@ export default defineVxeComponent({
|
|
|
13484
13735
|
const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
|
|
13485
13736
|
return h('div', {
|
|
13486
13737
|
ref: isFixedLeft ? refLeftContainer : refRightContainer,
|
|
13487
|
-
class: [
|
|
13738
|
+
class: [
|
|
13739
|
+
`vxe-table--fixed-${fixedType}-wrapper`,
|
|
13740
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
13741
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
13742
|
+
{
|
|
13488
13743
|
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
13489
13744
|
[`y-ob--${osYBehavior}`]: osYBehavior
|
|
13490
|
-
}
|
|
13745
|
+
}
|
|
13746
|
+
]
|
|
13491
13747
|
}, [
|
|
13492
13748
|
showHeader
|
|
13493
13749
|
? h(TableHeaderComponent, {
|
|
@@ -13746,6 +14002,7 @@ export default defineVxeComponent({
|
|
|
13746
14002
|
};
|
|
13747
14003
|
const renderScrollY = () => {
|
|
13748
14004
|
return h('div', {
|
|
14005
|
+
key: 'vsy',
|
|
13749
14006
|
ref: refScrollYVirtualElem,
|
|
13750
14007
|
class: 'vxe-table--scroll-y-virtual'
|
|
13751
14008
|
}, [
|
|
@@ -13783,12 +14040,15 @@ export default defineVxeComponent({
|
|
|
13783
14040
|
const scrollbarOpts = computeScrollbarOpts.value;
|
|
13784
14041
|
const scrollbarXOpts = computeScrollbarXOpts.value;
|
|
13785
14042
|
const scrollbarYOpts = computeScrollbarYOpts.value;
|
|
14043
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
14044
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
13786
14045
|
const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts;
|
|
13787
14046
|
const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts;
|
|
13788
14047
|
const { leftList, rightList } = columnStore;
|
|
13789
14048
|
const osXBehavior = XEUtils.eqNull(overscrollXBehavior) ? scrollbarOpts.overscrollBehavior : overscrollXBehavior;
|
|
13790
14049
|
const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior;
|
|
13791
14050
|
return h('div', {
|
|
14051
|
+
key: 'tvw',
|
|
13792
14052
|
ref: refTableViewportElem,
|
|
13793
14053
|
class: ['vxe-table--viewport-wrapper', {
|
|
13794
14054
|
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
@@ -13796,7 +14056,11 @@ export default defineVxeComponent({
|
|
|
13796
14056
|
}]
|
|
13797
14057
|
}, [
|
|
13798
14058
|
h('div', {
|
|
13799
|
-
class: [
|
|
14059
|
+
class: [
|
|
14060
|
+
'vxe-table--main-wrapper',
|
|
14061
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
14062
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`
|
|
14063
|
+
]
|
|
13800
14064
|
}, [
|
|
13801
14065
|
/**
|
|
13802
14066
|
* 表头
|
|
@@ -13837,9 +14101,10 @@ export default defineVxeComponent({
|
|
|
13837
14101
|
renderRowExpandedVNs()
|
|
13838
14102
|
]);
|
|
13839
14103
|
};
|
|
13840
|
-
const
|
|
14104
|
+
const renderNativeBody = () => {
|
|
13841
14105
|
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
13842
14106
|
return h('div', {
|
|
14107
|
+
key: 'lnb',
|
|
13843
14108
|
class: 'vxe-table--layout-wrapper'
|
|
13844
14109
|
}, scrollbarYToLeft
|
|
13845
14110
|
? [
|
|
@@ -13851,8 +14116,74 @@ export default defineVxeComponent({
|
|
|
13851
14116
|
renderScrollY()
|
|
13852
14117
|
]);
|
|
13853
14118
|
};
|
|
14119
|
+
const renderVirtualBody = () => {
|
|
14120
|
+
const $xeGanttView = internalData.xeGanttView;
|
|
14121
|
+
const { useScrollbar } = props;
|
|
14122
|
+
const { xThumbWidth, yThumbHeight } = reactData;
|
|
14123
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
14124
|
+
const scrollXAutoHide = computeScrollXAutoHide.value;
|
|
14125
|
+
const scrollYAutoHide = computeScrollYAutoHide.value;
|
|
14126
|
+
const scrollXVisible = computeScrollXVisible.value;
|
|
14127
|
+
const scrollYVisible = computeScrollYVisible.value;
|
|
14128
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
14129
|
+
const scrollbarYToLeft = computeScrollbarYToLeft.value;
|
|
14130
|
+
const scrollbarWrapperClss = computeScrollbarWrapperClss.value;
|
|
14131
|
+
const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden';
|
|
14132
|
+
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden';
|
|
14133
|
+
return h('div', {
|
|
14134
|
+
key: 'lvb',
|
|
14135
|
+
class: ['vxe-table--layout-wrapper', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
14136
|
+
'is--virtual-scrollbar': useScrollbar,
|
|
14137
|
+
'ov-padding': useScrollbar && scrollbarOpts.padding,
|
|
14138
|
+
'ov-x--auto-hide': useScrollbar && scrollXAutoHide,
|
|
14139
|
+
'ov-y--auto-hide': useScrollbar && scrollYAutoHide,
|
|
14140
|
+
'overflow-y': yThumbHeight,
|
|
14141
|
+
'overflow-x': xThumbWidth
|
|
14142
|
+
}]
|
|
14143
|
+
}, [
|
|
14144
|
+
renderViewport(),
|
|
14145
|
+
h('div', {
|
|
14146
|
+
class: scrollbarWrapperClss
|
|
14147
|
+
}, [
|
|
14148
|
+
hideXScroll
|
|
14149
|
+
? renderEmptyElement($xeTable)
|
|
14150
|
+
: h('div', {
|
|
14151
|
+
ref: refTrackXElem,
|
|
14152
|
+
class: 'vxe-scrollbar--track-x',
|
|
14153
|
+
onClick: clickTrackXEvent
|
|
14154
|
+
}, [
|
|
14155
|
+
h('div', {
|
|
14156
|
+
ref: refThumbXElem,
|
|
14157
|
+
class: 'vxe-scrollbar--thumb-x',
|
|
14158
|
+
onPointerdown: pointerdownThumbXEvent,
|
|
14159
|
+
onPointermove: pointermoveThumbXEvent,
|
|
14160
|
+
onPointerup: cleatPointerThumbEvent,
|
|
14161
|
+
onPointercancel: cleatPointerThumbEvent,
|
|
14162
|
+
onLostpointercapture: cleatPointerThumbEvent
|
|
14163
|
+
})
|
|
14164
|
+
]),
|
|
14165
|
+
hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)
|
|
14166
|
+
? renderEmptyElement($xeTable)
|
|
14167
|
+
: h('div', {
|
|
14168
|
+
ref: refTrackYElem,
|
|
14169
|
+
class: 'vxe-scrollbar--track-y',
|
|
14170
|
+
onClick: clickTrackYEvent
|
|
14171
|
+
}, [
|
|
14172
|
+
h('div', {
|
|
14173
|
+
ref: refThumbYElem,
|
|
14174
|
+
class: 'vxe-scrollbar--thumb-y',
|
|
14175
|
+
onPointerdown: pointerdownThumbYEvent,
|
|
14176
|
+
onPointermove: pointermoveThumbYEvent,
|
|
14177
|
+
onPointerup: cleatPointerThumbEvent,
|
|
14178
|
+
onPointercancel: cleatPointerThumbEvent,
|
|
14179
|
+
onLostpointercapture: cleatPointerThumbEvent
|
|
14180
|
+
})
|
|
14181
|
+
])
|
|
14182
|
+
])
|
|
14183
|
+
]);
|
|
14184
|
+
};
|
|
13854
14185
|
const renderVN = () => {
|
|
13855
|
-
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props;
|
|
14186
|
+
const { loading, stripe, useScrollbar, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props;
|
|
13856
14187
|
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData;
|
|
13857
14188
|
const { teleportToWrapperElem, popupToWrapperElem, customPopupToElem } = internalData;
|
|
13858
14189
|
const { leftList, rightList } = columnStore;
|
|
@@ -13895,7 +14226,7 @@ export default defineVxeComponent({
|
|
|
13895
14226
|
if (isCrossTableDrag && !tableData.length) {
|
|
13896
14227
|
tbOns.onDragover = $xeTable.handleCrossTableRowDragoverEmptyEvent;
|
|
13897
14228
|
}
|
|
13898
|
-
return h('div', Object.assign({ ref: refElem, class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
14229
|
+
return h('div', Object.assign({ ref: refElem, class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, useScrollbar ? 'is--virtual-scrollbar' : 'is--native-scrollbar', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
13899
14230
|
[`size--${vSize}`]: vSize,
|
|
13900
14231
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
13901
14232
|
'vxe-editable': !!editConfig,
|
|
@@ -13956,15 +14287,17 @@ export default defineVxeComponent({
|
|
|
13956
14287
|
h('div', {
|
|
13957
14288
|
key: 'tw',
|
|
13958
14289
|
class: 'vxe-table--render-wrapper'
|
|
13959
|
-
},
|
|
13960
|
-
? [
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
14290
|
+
}, useScrollbar
|
|
14291
|
+
? [renderVirtualBody()]
|
|
14292
|
+
: (scrollbarXToTop
|
|
14293
|
+
? [
|
|
14294
|
+
renderScrollX(),
|
|
14295
|
+
renderNativeBody()
|
|
14296
|
+
]
|
|
14297
|
+
: [
|
|
14298
|
+
renderNativeBody(),
|
|
14299
|
+
renderScrollX()
|
|
14300
|
+
])),
|
|
13968
14301
|
/**
|
|
13969
14302
|
* 空数据
|
|
13970
14303
|
*/
|
|
@@ -14271,6 +14604,7 @@ export default defineVxeComponent({
|
|
|
14271
14604
|
$xeTable.refreshColumn();
|
|
14272
14605
|
});
|
|
14273
14606
|
});
|
|
14607
|
+
const reScrollFlag = ref(0);
|
|
14274
14608
|
const reLayoutFlag = ref(0);
|
|
14275
14609
|
watch(computeSize, () => {
|
|
14276
14610
|
reLayoutFlag.value++;
|
|
@@ -14303,36 +14637,47 @@ export default defineVxeComponent({
|
|
|
14303
14637
|
watch(() => props.maxHeight, () => {
|
|
14304
14638
|
reLayoutFlag.value++;
|
|
14305
14639
|
});
|
|
14640
|
+
watch(() => VxeUI.getLanguage(), () => {
|
|
14641
|
+
reLayoutFlag.value++;
|
|
14642
|
+
});
|
|
14306
14643
|
watch(computeScrollbarXToTop, () => {
|
|
14644
|
+
reScrollFlag.value++;
|
|
14307
14645
|
reLayoutFlag.value++;
|
|
14308
14646
|
});
|
|
14309
14647
|
watch(computeScrollbarYToLeft, () => {
|
|
14648
|
+
reScrollFlag.value++;
|
|
14310
14649
|
reLayoutFlag.value++;
|
|
14311
14650
|
});
|
|
14312
|
-
watch(
|
|
14651
|
+
watch(computeScrollXVisible, () => {
|
|
14652
|
+
reScrollFlag.value++;
|
|
14313
14653
|
reLayoutFlag.value++;
|
|
14314
14654
|
});
|
|
14315
|
-
watch(() => {
|
|
14316
|
-
|
|
14317
|
-
return scrollbarXOpts.visible;
|
|
14318
|
-
}, () => {
|
|
14655
|
+
watch(computeScrollYVisible, () => {
|
|
14656
|
+
reScrollFlag.value++;
|
|
14319
14657
|
reLayoutFlag.value++;
|
|
14320
14658
|
});
|
|
14321
|
-
watch(() => {
|
|
14322
|
-
|
|
14323
|
-
return scrollbarYOpts.visible;
|
|
14324
|
-
}, () => {
|
|
14659
|
+
watch(computeScrollXHeight, () => {
|
|
14660
|
+
reScrollFlag.value++;
|
|
14325
14661
|
reLayoutFlag.value++;
|
|
14326
14662
|
});
|
|
14327
|
-
watch(() => {
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
}
|
|
14663
|
+
watch(computeScrollYWidth, () => {
|
|
14664
|
+
reScrollFlag.value++;
|
|
14665
|
+
reLayoutFlag.value++;
|
|
14666
|
+
});
|
|
14667
|
+
watch(computeCellHeitht, () => {
|
|
14331
14668
|
reLayoutFlag.value++;
|
|
14332
14669
|
});
|
|
14333
14670
|
watch(reLayoutFlag, () => {
|
|
14334
14671
|
$xeTable.recalculate(true);
|
|
14335
14672
|
});
|
|
14673
|
+
watch(reScrollFlag, () => {
|
|
14674
|
+
nextTick(() => {
|
|
14675
|
+
$xeTable.updateScrollbar();
|
|
14676
|
+
nextTick(() => {
|
|
14677
|
+
$xeTable.updateScrollbar();
|
|
14678
|
+
});
|
|
14679
|
+
});
|
|
14680
|
+
});
|
|
14336
14681
|
const footFlag = ref(0);
|
|
14337
14682
|
watch(() => props.footerData ? props.footerData.length : -1, () => {
|
|
14338
14683
|
footFlag.value++;
|
|
@@ -14448,7 +14793,6 @@ export default defineVxeComponent({
|
|
|
14448
14793
|
}
|
|
14449
14794
|
});
|
|
14450
14795
|
$xeTable.preventEvent(null, 'created', { $table: $xeTable });
|
|
14451
|
-
let resizeObserver;
|
|
14452
14796
|
onActivated(() => {
|
|
14453
14797
|
$xeTable.recalculate().then(() => $xeTable.refreshScroll());
|
|
14454
14798
|
$xeTable.preventEvent(null, 'activated', { $table: $xeTable });
|
|
@@ -14464,7 +14808,7 @@ export default defineVxeComponent({
|
|
|
14464
14808
|
});
|
|
14465
14809
|
onMounted(() => {
|
|
14466
14810
|
const { editConfig, exportConfig, importConfig, treeConfig, minHeight, keepSource, areaConfig } = props;
|
|
14467
|
-
const { scrollXStore, scrollYStore } = internalData;
|
|
14811
|
+
const { elemStore, scrollXStore, scrollYStore } = internalData;
|
|
14468
14812
|
const columnOpts = computeColumnOpts.value;
|
|
14469
14813
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
14470
14814
|
const aggregateOpts = computeAggregateOpts.value;
|
|
@@ -14486,6 +14830,7 @@ export default defineVxeComponent({
|
|
|
14486
14830
|
const areaOpts = computeAreaOpts.value;
|
|
14487
14831
|
const sortOpts = computeSortOpts.value;
|
|
14488
14832
|
const filterOpts = computeFilterOpts.value;
|
|
14833
|
+
const scrollbarOpts = computeScrollbarOpts.value;
|
|
14489
14834
|
const { groupFields } = aggregateOpts;
|
|
14490
14835
|
if ($xeGantt) {
|
|
14491
14836
|
const { refClassifyWrapperElem } = $xeGantt.getRefMaps();
|
|
@@ -14717,6 +15062,12 @@ export default defineVxeComponent({
|
|
|
14717
15062
|
// if (hasEnableConf(printConfig, printOpts) || hasEnableConf(importConfig, importOpts) || hasEnableConf(exportConfig, exportOpts)) && !$xeTable.exportData) {
|
|
14718
15063
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
14719
15064
|
// }
|
|
15065
|
+
if (scrollbarOpts.x) {
|
|
15066
|
+
warnLog('vxe.error.delProp', ['scrollbar-config.x', 'scrollbar-config.xConfig']);
|
|
15067
|
+
}
|
|
15068
|
+
if (scrollbarOpts.y) {
|
|
15069
|
+
warnLog('vxe.error.delProp', ['scrollbar-config.y', 'scrollbar-config.yConfig']);
|
|
15070
|
+
}
|
|
14720
15071
|
Object.assign(scrollYStore, {
|
|
14721
15072
|
startIndex: 0,
|
|
14722
15073
|
endIndex: 0,
|
|
@@ -14730,12 +15081,26 @@ export default defineVxeComponent({
|
|
|
14730
15081
|
handleUpdateRowGroup(groupFields);
|
|
14731
15082
|
initData();
|
|
14732
15083
|
nextTick(() => {
|
|
14733
|
-
|
|
14734
|
-
|
|
15084
|
+
const { useScrollbar, autoResize } = props;
|
|
15085
|
+
const el = refElem.value;
|
|
15086
|
+
if (useScrollbar) {
|
|
15087
|
+
const viewInnerEl = getRefElem(elemStore['main-body-table']);
|
|
15088
|
+
const scrollObserver = globalResize.create(() => {
|
|
15089
|
+
reScrollFlag.value++;
|
|
15090
|
+
});
|
|
15091
|
+
if (el) {
|
|
15092
|
+
scrollObserver.observe(el);
|
|
15093
|
+
}
|
|
15094
|
+
if (viewInnerEl) {
|
|
15095
|
+
scrollObserver.observe(viewInnerEl);
|
|
15096
|
+
}
|
|
15097
|
+
internalData.scrollObserver = scrollObserver;
|
|
15098
|
+
}
|
|
15099
|
+
if (autoResize) {
|
|
14735
15100
|
const parentEl = $xeTable.getParentElem();
|
|
14736
|
-
resizeObserver = globalResize.create(() => {
|
|
15101
|
+
const resizeObserver = globalResize.create(() => {
|
|
14737
15102
|
if (props.autoResize) {
|
|
14738
|
-
|
|
15103
|
+
handleResizeEvent();
|
|
14739
15104
|
}
|
|
14740
15105
|
});
|
|
14741
15106
|
if (el) {
|
|
@@ -14744,6 +15109,7 @@ export default defineVxeComponent({
|
|
|
14744
15109
|
if (parentEl) {
|
|
14745
15110
|
resizeObserver.observe(parentEl);
|
|
14746
15111
|
}
|
|
15112
|
+
internalData.resizeObserver = resizeObserver;
|
|
14747
15113
|
}
|
|
14748
15114
|
});
|
|
14749
15115
|
if (virtualYOpts.mode !== 'scroll') {
|
|
@@ -14765,7 +15131,7 @@ export default defineVxeComponent({
|
|
|
14765
15131
|
$xeTable.preventEvent(null, 'mounted', { $table: $xeTable });
|
|
14766
15132
|
});
|
|
14767
15133
|
onBeforeUnmount(() => {
|
|
14768
|
-
const { _sToTime } = internalData;
|
|
15134
|
+
const { resizeObserver, scrollObserver, _sToTime } = internalData;
|
|
14769
15135
|
if (_sToTime) {
|
|
14770
15136
|
clearTimeout(_sToTime);
|
|
14771
15137
|
}
|
|
@@ -14776,6 +15142,9 @@ export default defineVxeComponent({
|
|
|
14776
15142
|
internalData.cvCacheMaps = {};
|
|
14777
15143
|
internalData.prevDragRow = null;
|
|
14778
15144
|
internalData.prevDragCol = null;
|
|
15145
|
+
if (scrollObserver) {
|
|
15146
|
+
scrollObserver.disconnect();
|
|
15147
|
+
}
|
|
14779
15148
|
if (resizeObserver) {
|
|
14780
15149
|
resizeObserver.disconnect();
|
|
14781
15150
|
}
|