vxe-table 4.23.0-beta.4 → 4.23.0-beta.6

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.
@@ -29,8 +29,7 @@ import '../module/validator/hook';
29
29
  import '../module/custom/hook';
30
30
  import '../render';
31
31
  const { warnLog, errLog } = createComponentLog('table');
32
- const { getConfig, getIcon, getI18n, renderer, formats, scrollbarUtils, createEvent, globalResize, interceptor, hooks, domUtils, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
33
- const { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } = scrollbarUtils || {};
32
+ const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, domUtils, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
34
33
  const supportMaxRow = 5e6;
35
34
  const customStorageKey = 'VXE_CUSTOM_STORE';
36
35
  const maxYHeight = 5e6;
@@ -61,8 +60,6 @@ export default defineVxeComponent({
61
60
  const crossTableDragRowInfo = getCrossTableDragRowInfo();
62
61
  const reactData = reactive(createReactData());
63
62
  const internalData = createInternalData();
64
- let tableMethods = {};
65
- let tablePrivateMethods = {};
66
63
  const refElem = ref();
67
64
  const refVarElem = ref();
68
65
  const refTooltip = ref();
@@ -106,10 +103,6 @@ export default defineVxeComponent({
106
103
  const refScrollYBottomCornerElem = ref();
107
104
  const refScrollXSpaceElem = ref();
108
105
  const refScrollYSpaceElem = ref();
109
- const refTrackXElem = ref();
110
- const refTrackYElem = ref();
111
- const refThumbXElem = ref();
112
- const refThumbYElem = ref();
113
106
  let $xeToolbar;
114
107
  const computeTableId = computed(() => {
115
108
  const { id } = props;
@@ -791,6 +784,7 @@ export default defineVxeComponent({
791
784
  computeSize,
792
785
  computeIsVScrollbar,
793
786
  computeTableId,
787
+ computeTableStyle,
794
788
  computeValidOpts,
795
789
  computeRowField,
796
790
  computeVirtualXOpts,
@@ -891,6 +885,7 @@ export default defineVxeComponent({
891
885
  // 已废弃
892
886
  xegrid: $xeGrid
893
887
  };
888
+ const { refTrackXElem, refTrackYElem, refThumbXElem, refThumbYElem, updateThumbSize, updateThumbOffset, clickTrackXEvent, clickTrackYEvent, pointerdownThumbXEvent, pointermoveThumbXEvent, cleatPointerThumbEvent, pointerdownThumbYEvent, pointermoveThumbYEvent } = useFns.useInitVScrollbar($xeTable);
894
889
  const eqCellValue = (newRow, oldRow, field) => {
895
890
  const val1 = XEUtils.get(newRow, field);
896
891
  const val2 = XEUtils.get(oldRow, field);
@@ -4612,6 +4607,11 @@ export default defineVxeComponent({
4612
4607
  internalData.inFooterScroll = false;
4613
4608
  reactData.lazScrollLoading = false;
4614
4609
  internalData.scrollRenderType = '';
4610
+ const $xeGanttView = internalData.xeGanttView;
4611
+ if ($xeGanttView) {
4612
+ const ganttInternalData = $xeGanttView.internalData;
4613
+ ganttInternalData.isSyncTableScrollTop = false;
4614
+ }
4615
4615
  let xRest = null;
4616
4616
  let yRest = null;
4617
4617
  if (!isAllOverflow) {
@@ -4687,14 +4687,15 @@ export default defineVxeComponent({
4687
4687
  return multiple;
4688
4688
  };
4689
4689
  const syncGanttScrollTop = (scrollTop) => {
4690
+ const { isSyncGanttScrollTop } = internalData;
4691
+ if (isSyncGanttScrollTop) {
4692
+ return;
4693
+ }
4690
4694
  const $xeGanttView = internalData.xeGanttView;
4691
4695
  if ($xeGanttView) {
4692
4696
  const ganttInternalData = $xeGanttView.internalData;
4693
- const { elemStore: ganttElemStore } = ganttInternalData;
4694
- const ganttBodyScrollElem = getRefElem(ganttElemStore['main-body-scroll']);
4695
- if (ganttBodyScrollElem) {
4696
- ganttBodyScrollElem.scrollTop = scrollTop;
4697
- }
4697
+ ganttInternalData.isSyncTableScrollTop = true;
4698
+ $xeGanttView.handleSyncScrollTop({ scrollTop });
4698
4699
  }
4699
4700
  };
4700
4701
  const dispatchEvent = (type, params, evnt) => {
@@ -4973,11 +4974,16 @@ export default defineVxeComponent({
4973
4974
  return nextTick();
4974
4975
  };
4975
4976
  };
4976
- tableMethods = {
4977
+ const tableMethods = {
4977
4978
  dispatchEvent,
4978
4979
  getEl() {
4979
4980
  return refElem.value;
4980
4981
  },
4982
+ getScrollViewElem() {
4983
+ const { elemStore } = internalData;
4984
+ const viewEl = getRefElem(elemStore['main-body-scroll']);
4985
+ return viewEl;
4986
+ },
4981
4987
  /**
4982
4988
  * 重置表格的一切数据状态
4983
4989
  */
@@ -9557,7 +9563,13 @@ export default defineVxeComponent({
9557
9563
  /**
9558
9564
  * 内部方法
9559
9565
  */
9560
- tablePrivateMethods = {
9566
+ const tablePrivateMethods = {
9567
+ getReactData() {
9568
+ return reactData;
9569
+ },
9570
+ getInternalData() {
9571
+ return internalData;
9572
+ },
9561
9573
  getSetupOptions() {
9562
9574
  return getConfig();
9563
9575
  },
@@ -12734,7 +12746,10 @@ export default defineVxeComponent({
12734
12746
  isLeft,
12735
12747
  isRight,
12736
12748
  direction }, params);
12737
- updateThumbOffset();
12749
+ const isVScrollbar = computeIsVScrollbar.value;
12750
+ if (isVScrollbar) {
12751
+ updateThumbOffset();
12752
+ }
12738
12753
  updateRowExpandStyle();
12739
12754
  checkLastSyncScroll(isRollX, isRollY);
12740
12755
  if (isRollX) {
@@ -13403,6 +13418,14 @@ export default defineVxeComponent({
13403
13418
  $xeTable.updateScrollYSpace();
13404
13419
  });
13405
13420
  },
13421
+ handleSyncScrollTop(params) {
13422
+ const { scrollTop } = params;
13423
+ const { elemStore } = internalData;
13424
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
13425
+ if (bodyScrollElem) {
13426
+ bodyScrollElem.scrollTop = scrollTop;
13427
+ }
13428
+ },
13406
13429
  /**
13407
13430
  * 处理固定列的显示状态
13408
13431
  */
@@ -13568,168 +13591,6 @@ export default defineVxeComponent({
13568
13591
  internalData.scrollObserver = scrollObserver;
13569
13592
  }
13570
13593
  };
13571
- const updateThumbSize = () => {
13572
- const { elemStore } = internalData;
13573
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13574
- if (!viewEl) {
13575
- return;
13576
- }
13577
- if (!viewEl.clientHeight || !viewEl.clientHeight) {
13578
- return;
13579
- }
13580
- const trackXEl = refTrackXElem.value;
13581
- const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0;
13582
- const thumbXElem = refThumbXElem.value;
13583
- if (thumbXElem) {
13584
- thumbXElem.style.width = xThumbWidth + 'px';
13585
- }
13586
- reactData.xThumbWidth = xThumbWidth;
13587
- const trackYEl = refTrackYElem.value;
13588
- const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0;
13589
- const thumbYElem = refThumbYElem.value;
13590
- if (thumbYElem) {
13591
- thumbYElem.style.height = yThumbHeight + 'px';
13592
- }
13593
- reactData.yThumbHeight = yThumbHeight;
13594
- };
13595
- const updateThumbOffset = () => {
13596
- const { elemStore } = internalData;
13597
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13598
- if (!viewEl) {
13599
- return;
13600
- }
13601
- if (!viewEl.clientHeight || !viewEl.clientHeight) {
13602
- return;
13603
- }
13604
- const { xThumbWidth, yThumbHeight } = reactData;
13605
- const trackXEl = refTrackXElem.value;
13606
- const thumbXElem = refThumbXElem.value;
13607
- const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0;
13608
- internalData.xThumbLeft = xThumbLeft;
13609
- if (thumbXElem && xThumbWidth) {
13610
- thumbXElem.style.width = xThumbWidth + 'px';
13611
- thumbXElem.style.transform = `translateX(${xThumbLeft}px)`;
13612
- }
13613
- const trackYEl = refTrackYElem.value;
13614
- const thumbYElem = refThumbYElem.value;
13615
- const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0;
13616
- internalData.yThumbTop = yThumbTop;
13617
- if (thumbYElem && yThumbHeight) {
13618
- thumbYElem.style.height = yThumbHeight + 'px';
13619
- thumbYElem.style.transform = `translateY(${yThumbTop}px)`;
13620
- }
13621
- };
13622
- const clickTrackXEvent = (evnt) => {
13623
- const { elemStore } = internalData;
13624
- const trackEl = evnt.currentTarget;
13625
- if (trackEl !== evnt.target) {
13626
- return;
13627
- }
13628
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13629
- if (!viewEl) {
13630
- return;
13631
- }
13632
- const { xThumbWidth } = reactData;
13633
- const trackRect = trackEl.getBoundingClientRect();
13634
- viewEl.scrollTo({
13635
- left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
13636
- behavior: 'auto'
13637
- });
13638
- };
13639
- const clickTrackYEvent = (evnt) => {
13640
- const { elemStore } = internalData;
13641
- const trackEl = evnt.currentTarget;
13642
- if (trackEl !== evnt.target) {
13643
- return;
13644
- }
13645
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13646
- if (!viewEl) {
13647
- return;
13648
- }
13649
- const { yThumbHeight } = reactData;
13650
- const trackRect = trackEl.getBoundingClientRect();
13651
- viewEl.scrollTo({
13652
- top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
13653
- behavior: 'auto'
13654
- });
13655
- };
13656
- const pointerdownThumbXEvent = (evnt) => {
13657
- const { elemStore } = internalData;
13658
- const thumbEl = evnt.currentTarget;
13659
- internalData.isThumbDrag = true;
13660
- thumbEl.setPointerCapture(evnt.pointerId);
13661
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13662
- if (!viewEl) {
13663
- return;
13664
- }
13665
- const { xThumbWidth } = reactData;
13666
- const trackEl = thumbEl.parentElement;
13667
- const trackRect = trackEl.getBoundingClientRect();
13668
- const pointerPosition = evnt.clientX - trackRect.left;
13669
- // 记录 thumb 的偏移
13670
- const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
13671
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
13672
- };
13673
- const pointermoveThumbXEvent = (evnt) => {
13674
- const thumbEl = evnt.currentTarget;
13675
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
13676
- return;
13677
- }
13678
- const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
13679
- if (isThumbDrag) {
13680
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13681
- if (!viewEl) {
13682
- return;
13683
- }
13684
- const { xThumbWidth } = reactData;
13685
- const thumbEl = evnt.currentTarget;
13686
- const trackEl = thumbEl.parentElement;
13687
- const trackRect = trackEl.getBoundingClientRect();
13688
- // 更新偏移
13689
- viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth);
13690
- }
13691
- };
13692
- const cleatPointerThumbEvent = (evnt) => {
13693
- const thumbEl = evnt.currentTarget;
13694
- thumbEl.releasePointerCapture(evnt.pointerId);
13695
- internalData.isThumbDrag = false;
13696
- };
13697
- const pointerdownThumbYEvent = (evnt) => {
13698
- const { elemStore } = internalData;
13699
- const thumbEl = evnt.currentTarget;
13700
- internalData.isThumbDrag = true;
13701
- thumbEl.setPointerCapture(evnt.pointerId);
13702
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13703
- if (!viewEl) {
13704
- return;
13705
- }
13706
- const { yThumbHeight } = reactData;
13707
- const trackEl = thumbEl.parentElement;
13708
- const trackRect = trackEl.getBoundingClientRect();
13709
- const pointerPosition = evnt.clientY - trackRect.top;
13710
- // 记录 thumb 的偏移
13711
- const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
13712
- internalData.thumbDragOffset = pointerPosition - thumbOffset;
13713
- };
13714
- const pointermoveThumbYEvent = (evnt) => {
13715
- const thumbEl = evnt.currentTarget;
13716
- if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
13717
- return;
13718
- }
13719
- const { elemStore, isThumbDrag, thumbDragOffset } = internalData;
13720
- if (isThumbDrag) {
13721
- const viewEl = getRefElem(elemStore['main-body-scroll']);
13722
- if (!viewEl) {
13723
- return;
13724
- }
13725
- const { yThumbHeight } = reactData;
13726
- const thumbEl = evnt.currentTarget;
13727
- const trackEl = thumbEl.parentElement;
13728
- const trackRect = trackEl.getBoundingClientRect();
13729
- // 更新偏移
13730
- viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight);
13731
- }
13732
- };
13733
13594
  // 检测对应模块是否安装
13734
13595
  // 'openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').forEach(name => {
13735
13596
  // ($xeTable as any)[name] = function () {
@@ -154,9 +154,34 @@ export function createInternalData() {
154
154
  tooltipTimeout: null,
155
155
  initStatus: false,
156
156
  isActivated: false,
157
+ // keyCtxTimeout: undefined,
158
+ // 刷新布局
157
159
  // rceTimeout: undefined,
158
160
  // rceRunTime: undefined,
159
161
  rceDelay: 0
162
+ // rsePending: false,
163
+ // 滚动属性
164
+ // intoRunScroll: false,
165
+ // inVirtualScroll: false,
166
+ // inWheelScroll: false,
167
+ // inHeaderScroll: false,
168
+ // inBodyScroll: false,
169
+ // inFooterScroll: false,
170
+ // scrollRenderType?: '',
171
+ // isSyncGanttScrollTop: false,
172
+ // 同步滚动
173
+ // lcsTimeout: undefined,
174
+ // lcsRunTime: undefined,
175
+ // 横向虚拟
176
+ // lxRunTime: undefined,
177
+ // lxTimeout: undefined,
178
+ // 纵向虚拟
179
+ // lyRunTime: undefined,
180
+ // lyTimeout: undefined,
181
+ // 动态高度
182
+ // chRunTime: undefined,
183
+ // chTimeout: undefined,
184
+ // isResizeCellHeight: false,
160
185
  // _sToTime: null
161
186
  };
162
187
  }
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.23.0-beta.4";
3
+ export const version = "4.23.0-beta.6";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const tableVersion = `table v${"4.23.0-beta.4"}`;
3
+ const tableVersion = `table v${"4.23.0-beta.6"}`;
4
4
  export function createComponentLog(name) {
5
5
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
6
6
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';