vxe-table 3.12.10-beta.3 → 3.12.10-beta.4

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.
@@ -73,6 +73,8 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
73
73
  thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent;
74
74
  }
75
75
  }
76
+ const isLastColumn = $columnIndex === cols.length - 1;
77
+ const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
76
78
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
77
79
  let isPreLoadStatus = false;
78
80
  if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
@@ -82,7 +84,7 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
82
84
  class: ['vxe-header--column', colid, {
83
85
  [`col--${headAlign}`]: headAlign,
84
86
  [`col--${type}`]: type,
85
- 'col--last': $columnIndex === cols.length - 1,
87
+ 'col--last': isLastColumn,
86
88
  'col--fixed': column.fixed,
87
89
  'col--group': isColGroup,
88
90
  'col--ellipsis': hasEllipsis,
@@ -110,7 +112,7 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
110
112
  /**
111
113
  * 列宽拖动
112
114
  */
113
- !fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
115
+ !fixedHiddenColumn && showResizable
114
116
  ? h('div', {
115
117
  class: ['vxe-resizable', {
116
118
  'is--line': !border || border === 'none'
@@ -120,7 +122,7 @@ const renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) => {
120
122
  dblclick: (evnt) => $xeTable.handleResizeDblclickEvent(evnt, params)
121
123
  }
122
124
  })
123
- : null
125
+ : renderEmptyElement($xeTable)
124
126
  ]);
125
127
  });
126
128
  };
@@ -360,6 +362,12 @@ export default {
360
362
  const wrapperElem = this.$el;
361
363
  const { clientX: dragClientX } = evnt;
362
364
  const dragBtnElem = evnt.target;
365
+ let resizeColumn = column;
366
+ if (column.children && column.children.length) {
367
+ XEUtils.eachTree(column.children, childColumn => {
368
+ resizeColumn = childColumn;
369
+ });
370
+ }
363
371
  const cell = dragBtnElem.parentNode;
364
372
  const cellParams = Object.assign(params, { cell });
365
373
  const resizableOpts = $xeTable.computeResizableOpts;
@@ -417,7 +425,7 @@ export default {
417
425
  // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
418
426
  }
419
427
  dragLeft = Math.max(left, dragMinLeft);
420
- const resizeBarLeft = dragLeft - scrollLeft;
428
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
421
429
  resizeBarElem.style.left = `${resizeBarLeft}px`;
422
430
  if (resizableOpts.showDragTip && resizeTipElem) {
423
431
  const tableWidth = tableEl.clientWidth;
@@ -427,14 +435,14 @@ export default {
427
435
  const resizeTipHeight = resizeTipElem.clientHeight;
428
436
  let resizeTipLeft = -resizeTipWidth;
429
437
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
430
- resizeTipLeft = resizeTipWidth + resizeBarWidth - resizeBarLeft;
438
+ resizeTipLeft = 0;
431
439
  }
432
440
  else if (resizeBarLeft > tableWidth) {
433
441
  resizeTipLeft += tableWidth - resizeBarLeft;
434
442
  }
435
443
  resizeTipElem.style.left = `${resizeTipLeft}px`;
436
444
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
437
- resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
445
+ resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
438
446
  }
439
447
  };
440
448
  $xetable._isResize = true;
@@ -444,11 +452,11 @@ export default {
444
452
  document.onmouseup = function (evnt) {
445
453
  document.onmousemove = domMousemove;
446
454
  document.onmouseup = domMouseup;
447
- const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
448
- column.resizeWidth = resizeWidth;
455
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
456
+ resizeColumn.resizeWidth = resizeWidth;
449
457
  if (resizableOpts.dragMode === 'fixed') {
450
458
  visibleColumn.forEach((item) => {
451
- if (item.id !== column.id) {
459
+ if (item.id !== resizeColumn.id) {
452
460
  if (!item.resizeWidth) {
453
461
  item.resizeWidth = item.renderWidth;
454
462
  }
@@ -196,7 +196,7 @@ function cacheColumnMap($xeTable) {
196
196
  fullColumnFieldData[field] = rest;
197
197
  }
198
198
  else {
199
- if (storage || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
199
+ if ((storage && !type) || (columnOpts.drag && (isCrossDrag || isSelfToChildDrag))) {
200
200
  errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
201
201
  }
202
202
  }
@@ -3437,17 +3437,23 @@ const Methods = {
3437
3437
  if (isDblclickAutoWidth && el) {
3438
3438
  const { fullColumnIdData } = internalData;
3439
3439
  const { column } = params;
3440
- const colid = column.id;
3440
+ let resizeColumn = column;
3441
+ if (column.children && column.children.length) {
3442
+ XEUtils.eachTree(column.children, childColumn => {
3443
+ resizeColumn = childColumn;
3444
+ });
3445
+ }
3446
+ const colid = resizeColumn.id;
3441
3447
  const colRest = fullColumnIdData[colid];
3442
3448
  const dragBtnElem = evnt.target;
3443
3449
  const cell = dragBtnElem.parentNode;
3444
3450
  const cellParams = Object.assign(params, { cell });
3445
3451
  const colMinWidth = getColReMinWidth(cellParams);
3446
- let resizeWidth = calcColumnAutoWidth(column, el);
3452
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
3447
3453
  if (colRest) {
3448
3454
  resizeWidth = Math.max(resizeWidth, colRest.width);
3449
3455
  }
3450
- column.resizeWidth = Math.max(colMinWidth, resizeWidth);
3456
+ resizeColumn.resizeWidth = Math.max(colMinWidth, resizeWidth);
3451
3457
  reactData._isResize = false;
3452
3458
  internalData._lastResizeTime = Date.now();
3453
3459
  $xeTable.analyColumnWidth();
@@ -4852,7 +4858,7 @@ const Methods = {
4852
4858
  }
4853
4859
  vLen++;
4854
4860
  });
4855
- const isSelected = rootList.length > 0 && sLen >= vLen;
4861
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
4856
4862
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
4857
4863
  reactData.isAllSelected = isSelected;
4858
4864
  reactData.isIndeterminate = halfSelect;
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 = "3.12.10-beta.3";
3
+ export const version = "3.12.10-beta.4";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.12.10-beta.3"}`;
3
+ const version = `table v${"3.12.10-beta.4"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.12.10-beta.3";
2223
+ const version = "3.12.10-beta.4";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2824,7 +2824,7 @@ function isNodeElement(elem) {
2824
2824
  const {
2825
2825
  log: log_log
2826
2826
  } = core_.VxeUI;
2827
- const log_version = `table v${"3.12.10-beta.3"}`;
2827
+ const log_version = `table v${"3.12.10-beta.4"}`;
2828
2828
  const warnLog = log_log.create('warn', log_version);
2829
2829
  const errLog = log_log.create('error', log_version);
2830
2830
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5291,7 +5291,7 @@ function cacheColumnMap($xeTable) {
5291
5291
  }
5292
5292
  fullColumnFieldData[field] = rest;
5293
5293
  } else {
5294
- if (storage || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
5294
+ if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
5295
5295
  errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
5296
5296
  }
5297
5297
  }
@@ -9030,7 +9030,13 @@ const Methods = {
9030
9030
  const {
9031
9031
  column
9032
9032
  } = params;
9033
- const colid = column.id;
9033
+ let resizeColumn = column;
9034
+ if (column.children && column.children.length) {
9035
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children, childColumn => {
9036
+ resizeColumn = childColumn;
9037
+ });
9038
+ }
9039
+ const colid = resizeColumn.id;
9034
9040
  const colRest = fullColumnIdData[colid];
9035
9041
  const dragBtnElem = evnt.target;
9036
9042
  const cell = dragBtnElem.parentNode;
@@ -9038,11 +9044,11 @@ const Methods = {
9038
9044
  cell
9039
9045
  });
9040
9046
  const colMinWidth = getColReMinWidth(cellParams);
9041
- let resizeWidth = calcColumnAutoWidth(column, el);
9047
+ let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
9042
9048
  if (colRest) {
9043
9049
  resizeWidth = Math.max(resizeWidth, colRest.width);
9044
9050
  }
9045
- column.resizeWidth = Math.max(colMinWidth, resizeWidth);
9051
+ resizeColumn.resizeWidth = Math.max(colMinWidth, resizeWidth);
9046
9052
  reactData._isResize = false;
9047
9053
  internalData._lastResizeTime = Date.now();
9048
9054
  $xeTable.analyColumnWidth();
@@ -10681,7 +10687,7 @@ const Methods = {
10681
10687
  }
10682
10688
  vLen++;
10683
10689
  });
10684
- const isSelected = rootList.length > 0 && sLen >= vLen;
10690
+ const isSelected = vLen > 0 ? sLen >= vLen : sLen >= rootList.length;
10685
10691
  const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
10686
10692
  reactData.isAllSelected = isSelected;
10687
10693
  reactData.isIndeterminate = halfSelect;
@@ -14863,6 +14869,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
14863
14869
  }));
14864
14870
  }
14865
14871
  }
14872
+ const isLastColumn = $columnIndex === columns.length - 1;
14866
14873
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
14867
14874
  let isPreLoadStatus = false;
14868
14875
  if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex || _rowIndex > scrollYStore.visibleEndIndex)) {
@@ -14875,7 +14882,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
14875
14882
  [`col--${cellAlign}`]: cellAlign,
14876
14883
  [`col--vertical-${verticalAlign}`]: verticalAlign,
14877
14884
  [`col--${type}`]: type,
14878
- 'col--last': $columnIndex === columns.length - 1,
14885
+ 'col--last': isLastColumn,
14879
14886
  'col--tree-node': treeNode,
14880
14887
  'col--edit': isEdit,
14881
14888
  'col--ellipsis': hasEllipsis,
@@ -15495,6 +15502,8 @@ const header_renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) =>
15495
15502
  thOns.mouseup = $xeTable.handleHeaderCellDragMouseupEvent;
15496
15503
  }
15497
15504
  }
15505
+ const isLastColumn = $columnIndex === cols.length - 1;
15506
+ const showResizable = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable;
15498
15507
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
15499
15508
  let isPreLoadStatus = false;
15500
15509
  if (scrollXLoad && !isGroup && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
@@ -15504,7 +15513,7 @@ const header_renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) =>
15504
15513
  class: ['vxe-header--column', colid, {
15505
15514
  [`col--${headAlign}`]: headAlign,
15506
15515
  [`col--${type}`]: type,
15507
- 'col--last': $columnIndex === cols.length - 1,
15516
+ 'col--last': isLastColumn,
15508
15517
  'col--fixed': column.fixed,
15509
15518
  'col--group': isColGroup,
15510
15519
  'col--ellipsis': hasEllipsis,
@@ -15531,7 +15540,7 @@ const header_renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) =>
15531
15540
  /**
15532
15541
  * 列宽拖动
15533
15542
  */
15534
- !fixedHiddenColumn && !isColGroup && (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? h('div', {
15543
+ !fixedHiddenColumn && showResizable ? h('div', {
15535
15544
  class: ['vxe-resizable', {
15536
15545
  'is--line': !border || border === 'none'
15537
15546
  }],
@@ -15539,7 +15548,7 @@ const header_renderRows = (h, _vm, isGroup, isOptimizeMode, cols, $rowIndex) =>
15539
15548
  mousedown: evnt => _vm.resizeMousedownEvent(evnt, params),
15540
15549
  dblclick: evnt => $xeTable.handleResizeDblclickEvent(evnt, params)
15541
15550
  }
15542
- }) : null]);
15551
+ }) : header_renderEmptyElement($xeTable)]);
15543
15552
  });
15544
15553
  };
15545
15554
  function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
@@ -15816,6 +15825,12 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
15816
15825
  clientX: dragClientX
15817
15826
  } = evnt;
15818
15827
  const dragBtnElem = evnt.target;
15828
+ let resizeColumn = column;
15829
+ if (column.children && column.children.length) {
15830
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children, childColumn => {
15831
+ resizeColumn = childColumn;
15832
+ });
15833
+ }
15819
15834
  const cell = dragBtnElem.parentNode;
15820
15835
  const cellParams = Object.assign(params, {
15821
15836
  cell
@@ -15872,7 +15887,7 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
15872
15887
  // left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
15873
15888
  }
15874
15889
  dragLeft = Math.max(left, dragMinLeft);
15875
- const resizeBarLeft = dragLeft - scrollLeft;
15890
+ const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
15876
15891
  resizeBarElem.style.left = `${resizeBarLeft}px`;
15877
15892
  if (resizableOpts.showDragTip && resizeTipElem) {
15878
15893
  const tableWidth = tableEl.clientWidth;
@@ -15882,13 +15897,13 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
15882
15897
  const resizeTipHeight = resizeTipElem.clientHeight;
15883
15898
  let resizeTipLeft = -resizeTipWidth;
15884
15899
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
15885
- resizeTipLeft = resizeTipWidth + resizeBarWidth - resizeBarLeft;
15900
+ resizeTipLeft = 0;
15886
15901
  } else if (resizeBarLeft > tableWidth) {
15887
15902
  resizeTipLeft += tableWidth - resizeBarLeft;
15888
15903
  }
15889
15904
  resizeTipElem.style.left = `${resizeTipLeft}px`;
15890
15905
  resizeTipElem.style.top = `${Math.min(tableEl.clientHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
15891
- resizeTipElem.textContent = header_getI18n('vxe.table.resizeColTip', [column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
15906
+ resizeTipElem.textContent = header_getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
15892
15907
  }
15893
15908
  };
15894
15909
  $xetable._isResize = true;
@@ -15898,11 +15913,11 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups) {
15898
15913
  document.onmouseup = function (evnt) {
15899
15914
  document.onmousemove = domMousemove;
15900
15915
  document.onmouseup = domMouseup;
15901
- const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
15902
- column.resizeWidth = resizeWidth;
15916
+ const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
15917
+ resizeColumn.resizeWidth = resizeWidth;
15903
15918
  if (resizableOpts.dragMode === 'fixed') {
15904
15919
  visibleColumn.forEach(item => {
15905
- if (item.id !== column.id) {
15920
+ if (item.id !== resizeColumn.id) {
15906
15921
  if (!item.resizeWidth) {
15907
15922
  item.resizeWidth = item.renderWidth;
15908
15923
  }
@@ -16102,6 +16117,7 @@ function footer_renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex,
16102
16117
  attrs.colspan = colspan;
16103
16118
  }
16104
16119
  }
16120
+ const isLastColumn = $columnIndex === tableColumn.length - 1;
16105
16121
  const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
16106
16122
  let isPreLoadStatus = false;
16107
16123
  if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
@@ -16111,7 +16127,7 @@ function footer_renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex,
16111
16127
  class: ['vxe-footer--column', column.id, {
16112
16128
  [`col--${footAlign}`]: footAlign,
16113
16129
  [`col--${type}`]: type,
16114
- 'col--last': $columnIndex === tableColumn.length - 1,
16130
+ 'col--last': isLastColumn,
16115
16131
  'fixed--width': !isAutoCellWidth,
16116
16132
  'fixed--hidden': fixedHiddenColumn,
16117
16133
  'col--ellipsis': hasEllipsis,