vxe-table 3.12.1-beta.5 → 3.12.1-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.
@@ -3,7 +3,7 @@ import { browse, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEv
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
6
- import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn } from './util';
6
+ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth } from './util';
7
7
  import { getSlotVNs } from '../../ui/src/vn';
8
8
  import { warnLog, errLog } from '../../ui/src/log';
9
9
  const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
@@ -3010,11 +3010,15 @@ const Methods = {
3010
3010
  const { column } = params;
3011
3011
  const colid = column.id;
3012
3012
  const colRest = fullColumnIdData[colid];
3013
+ const dragBtnElem = evnt.target;
3014
+ const cell = dragBtnElem.parentNode;
3015
+ const cellParams = Object.assign(params, { cell });
3016
+ const colMinWidth = getColReMinWidth(cellParams);
3013
3017
  let resizeWidth = calcColumnAutoWidth(column, el);
3014
3018
  if (colRest) {
3015
3019
  resizeWidth = Math.max(resizeWidth, colRest.width);
3016
3020
  }
3017
- column.resizeWidth = resizeWidth;
3021
+ column.resizeWidth = Math.max(colMinWidth, resizeWidth);
3018
3022
  reactData._isResize = false;
3019
3023
  internalData._lastResizeTime = Date.now();
3020
3024
  $xeTable.analyColumnWidth();
@@ -5317,16 +5321,17 @@ const Methods = {
5317
5321
  const mouseOpts = $xeTable.computeMouseOpts;
5318
5322
  const columnOpts = $xeTable.computeColumnOpts;
5319
5323
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5320
- const { trigger, disabledMethod } = columnDragOpts;
5324
+ const { trigger, isCrossDrag, isPeerDrag, disabledMethod } = columnDragOpts;
5321
5325
  const cell = evnt.currentTarget;
5322
5326
  const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
5323
5327
  const triggerCheckbox = getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag;
5324
5328
  const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
5325
5329
  const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
5326
5330
  let triggerDrag = false;
5331
+ const isColDragCell = columnOpts.drag && trigger === 'cell';
5327
5332
  if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
5328
5333
  const { column } = params;
5329
- if (columnOpts.drag && !column.fixed && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
5334
+ if (isColDragCell && !column.fixed && (isCrossDrag || isPeerDrag || !column.parentId) && !(disabledMethod && disabledMethod(params))) {
5330
5335
  triggerDrag = true;
5331
5336
  $xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
5332
5337
  }
@@ -5351,7 +5356,7 @@ const Methods = {
5351
5356
  const isExpandType = type === 'expand';
5352
5357
  const rowOpts = $xeTable.computeRowOpts;
5353
5358
  const rowDragOpts = $xeTable.computeRowDragOpts;
5354
- const { trigger, disabledMethod } = rowDragOpts;
5359
+ const { trigger, isCrossDrag, isPeerDrag, disabledMethod } = rowDragOpts;
5355
5360
  const cell = evnt.currentTarget;
5356
5361
  params.cell = cell;
5357
5362
  const triggerInput = cell && cell.tagName && cell.tagName.toLowerCase() === 'input';
@@ -5365,7 +5370,7 @@ const Methods = {
5365
5370
  }
5366
5371
  let triggerDrag = false;
5367
5372
  if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
5368
- if (isColDragCell && !(disabledMethod && disabledMethod(params))) {
5373
+ if (isColDragCell && (isCrossDrag || isPeerDrag || !params.level) && !(disabledMethod && disabledMethod(params))) {
5369
5374
  triggerDrag = true;
5370
5375
  $xeTable.handleCellDragMousedownEvent(evnt, params);
5371
5376
  }
@@ -5442,7 +5447,7 @@ const Methods = {
5442
5447
  let isSelfToChildStatus = false;
5443
5448
  if (oldLevel && newLevel) {
5444
5449
  // 子到子
5445
- if (isPeerDrag) {
5450
+ if (isPeerDrag && !isCrossDrag) {
5446
5451
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
5447
5452
  // 非同级
5448
5453
  return;
@@ -5698,7 +5703,7 @@ const Methods = {
5698
5703
  let isSelfToChildStatus = false;
5699
5704
  if (oldColumn.parentId && newColumn.parentId) {
5700
5705
  // 子到子
5701
- if (isPeerDrag) {
5706
+ if (isPeerDrag && !isCrossDrag) {
5702
5707
  if (oldColumn.parentId !== newColumn.parentId) {
5703
5708
  // 非同级
5704
5709
  return;
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.1-beta.5";
3
+ export const version = "3.12.1-beta.6";
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.1-beta.5"}`;
3
+ const version = `table v${"3.12.1-beta.6"}`;
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.1-beta.5";
2223
+ const version = "3.12.1-beta.6";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2814,7 +2814,7 @@ function isNodeElement(elem) {
2814
2814
  const {
2815
2815
  log: log_log
2816
2816
  } = core_.VxeUI;
2817
- const log_version = `table v${"3.12.1-beta.5"}`;
2817
+ const log_version = `table v${"3.12.1-beta.6"}`;
2818
2818
  const warnLog = log_log.create('warn', log_version);
2819
2819
  const errLog = log_log.create('error', log_version);
2820
2820
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -4545,41 +4545,46 @@ const Cell = {
4545
4545
  $table,
4546
4546
  column
4547
4547
  } = params;
4548
+ const sortOpts = $table.computeSortOpts;
4548
4549
  const {
4549
4550
  showIcon,
4550
4551
  iconLayout,
4551
4552
  iconAsc,
4552
- iconDesc
4553
- } = $table.sortOpts;
4554
- return showIcon ? [h('span', {
4555
- class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
4556
- }, [h('i', {
4557
- class: ['vxe-sort--asc-btn', iconAsc || cell_getIcon().TABLE_SORT_ASC, {
4558
- 'sort--active': column.order === 'asc'
4559
- }],
4560
- attrs: {
4561
- title: cell_getI18n('vxe.table.sortAsc')
4562
- },
4563
- on: {
4564
- click(evnt) {
4565
- evnt.stopPropagation();
4566
- $table.triggerSortEvent(evnt, column, 'asc');
4553
+ iconDesc,
4554
+ iconVisibleMethod
4555
+ } = sortOpts;
4556
+ if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
4557
+ return [h('span', {
4558
+ class: ['vxe-cell--sort', `vxe-cell--sort-${iconLayout}-layout`]
4559
+ }, [h('i', {
4560
+ class: ['vxe-sort--asc-btn', iconAsc || cell_getIcon().TABLE_SORT_ASC, {
4561
+ 'sort--active': column.order === 'asc'
4562
+ }],
4563
+ attrs: {
4564
+ title: cell_getI18n('vxe.table.sortAsc')
4565
+ },
4566
+ on: {
4567
+ click(evnt) {
4568
+ evnt.stopPropagation();
4569
+ $table.triggerSortEvent(evnt, column, 'asc');
4570
+ }
4567
4571
  }
4568
- }
4569
- }), h('i', {
4570
- class: ['vxe-sort--desc-btn', iconDesc || cell_getIcon().TABLE_SORT_DESC, {
4571
- 'sort--active': column.order === 'desc'
4572
- }],
4573
- attrs: {
4574
- title: cell_getI18n('vxe.table.sortDesc')
4575
- },
4576
- on: {
4577
- click(evnt) {
4578
- evnt.stopPropagation();
4579
- $table.triggerSortEvent(evnt, column, 'desc');
4572
+ }), h('i', {
4573
+ class: ['vxe-sort--desc-btn', iconDesc || cell_getIcon().TABLE_SORT_DESC, {
4574
+ 'sort--active': column.order === 'desc'
4575
+ }],
4576
+ attrs: {
4577
+ title: cell_getI18n('vxe.table.sortDesc')
4578
+ },
4579
+ on: {
4580
+ click(evnt) {
4581
+ evnt.stopPropagation();
4582
+ $table.triggerSortEvent(evnt, column, 'desc');
4583
+ }
4580
4584
  }
4581
- }
4582
- })])] : [];
4585
+ })])];
4586
+ }
4587
+ return [];
4583
4588
  },
4584
4589
  /**
4585
4590
  * 筛选
@@ -4601,25 +4606,29 @@ const Cell = {
4601
4606
  const {
4602
4607
  showIcon,
4603
4608
  iconNone,
4604
- iconMatch
4609
+ iconMatch,
4610
+ iconVisibleMethod
4605
4611
  } = filterOpts;
4606
- return showIcon ? [h('span', {
4607
- class: ['vxe-cell--filter', {
4608
- 'is--active': filterStore.visible && filterStore.column === column
4609
- }]
4610
- }, [h('i', {
4611
- class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
4612
- attrs: {
4613
- title: cell_getI18n('vxe.table.filter')
4614
- },
4615
- on: {
4616
- click(evnt) {
4617
- if ($table.triggerFilterEvent) {
4618
- $table.triggerFilterEvent(evnt, params.column, params);
4612
+ if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
4613
+ return [h('span', {
4614
+ class: ['vxe-cell--filter', {
4615
+ 'is--active': filterStore.visible && filterStore.column === column
4616
+ }]
4617
+ }, [h('i', {
4618
+ class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
4619
+ attrs: {
4620
+ title: cell_getI18n('vxe.table.filter')
4621
+ },
4622
+ on: {
4623
+ click(evnt) {
4624
+ if ($table.triggerFilterEvent) {
4625
+ $table.triggerFilterEvent(evnt, params.column, params);
4626
+ }
4619
4627
  }
4620
4628
  }
4621
- }
4622
- })])] : [];
4629
+ })])];
4630
+ }
4631
+ return [];
4623
4632
  },
4624
4633
  /**
4625
4634
  * 可编辑
@@ -8527,11 +8536,17 @@ const Methods = {
8527
8536
  } = params;
8528
8537
  const colid = column.id;
8529
8538
  const colRest = fullColumnIdData[colid];
8539
+ const dragBtnElem = evnt.target;
8540
+ const cell = dragBtnElem.parentNode;
8541
+ const cellParams = Object.assign(params, {
8542
+ cell
8543
+ });
8544
+ const colMinWidth = getColReMinWidth(cellParams);
8530
8545
  let resizeWidth = calcColumnAutoWidth(column, el);
8531
8546
  if (colRest) {
8532
8547
  resizeWidth = Math.max(resizeWidth, colRest.width);
8533
8548
  }
8534
- column.resizeWidth = resizeWidth;
8549
+ column.resizeWidth = Math.max(colMinWidth, resizeWidth);
8535
8550
  reactData._isResize = false;
8536
8551
  internalData._lastResizeTime = Date.now();
8537
8552
  $xeTable.analyColumnWidth();
@@ -11279,6 +11294,8 @@ const Methods = {
11279
11294
  const columnDragOpts = $xeTable.computeColumnDragOpts;
11280
11295
  const {
11281
11296
  trigger,
11297
+ isCrossDrag,
11298
+ isPeerDrag,
11282
11299
  disabledMethod
11283
11300
  } = columnDragOpts;
11284
11301
  const cell = evnt.currentTarget;
@@ -11287,11 +11304,12 @@ const Methods = {
11287
11304
  const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag;
11288
11305
  const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
11289
11306
  let triggerDrag = false;
11307
+ const isColDragCell = columnOpts.drag && trigger === 'cell';
11290
11308
  if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
11291
11309
  const {
11292
11310
  column
11293
11311
  } = params;
11294
- if (columnOpts.drag && !column.fixed && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
11312
+ if (isColDragCell && !column.fixed && (isCrossDrag || isPeerDrag || !column.parentId) && !(disabledMethod && disabledMethod(params))) {
11295
11313
  triggerDrag = true;
11296
11314
  $xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
11297
11315
  }
@@ -11327,6 +11345,8 @@ const Methods = {
11327
11345
  const rowDragOpts = $xeTable.computeRowDragOpts;
11328
11346
  const {
11329
11347
  trigger,
11348
+ isCrossDrag,
11349
+ isPeerDrag,
11330
11350
  disabledMethod
11331
11351
  } = rowDragOpts;
11332
11352
  const cell = evnt.currentTarget;
@@ -11342,7 +11362,7 @@ const Methods = {
11342
11362
  }
11343
11363
  let triggerDrag = false;
11344
11364
  if (!(triggerInput || triggerRadio || triggerCheckbox || triggerTreeNode || triggerExpandNode)) {
11345
- if (isColDragCell && !(disabledMethod && disabledMethod(params))) {
11365
+ if (isColDragCell && (isCrossDrag || isPeerDrag || !params.level) && !(disabledMethod && disabledMethod(params))) {
11346
11366
  triggerDrag = true;
11347
11367
  $xeTable.handleCellDragMousedownEvent(evnt, params);
11348
11368
  }
@@ -11446,7 +11466,7 @@ const Methods = {
11446
11466
  let isSelfToChildStatus = false;
11447
11467
  if (oldLevel && newLevel) {
11448
11468
  // 子到子
11449
- if (isPeerDrag) {
11469
+ if (isPeerDrag && !isCrossDrag) {
11450
11470
  if (oldRest.row[parentField] !== newRest.row[parentField]) {
11451
11471
  // 非同级
11452
11472
  return;
@@ -11726,7 +11746,7 @@ const Methods = {
11726
11746
  let isSelfToChildStatus = false;
11727
11747
  if (oldColumn.parentId && newColumn.parentId) {
11728
11748
  // 子到子
11729
- if (isPeerDrag) {
11749
+ if (isPeerDrag && !isCrossDrag) {
11730
11750
  if (oldColumn.parentId !== newColumn.parentId) {
11731
11751
  // 非同级
11732
11752
  return;
@@ -14062,7 +14082,9 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
14062
14082
  } = $xeTable;
14063
14083
  const rowDragOpts = $xeTable.computeRowDragOpts;
14064
14084
  const {
14065
- disabledMethod: dragDisabledMethod
14085
+ disabledMethod: dragDisabledMethod,
14086
+ isCrossDrag,
14087
+ isPeerDrag
14066
14088
  } = rowDragOpts;
14067
14089
  const {
14068
14090
  selectCellToRow
@@ -14325,7 +14347,7 @@ function renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, ro
14325
14347
  'col--ellipsis': hasEllipsis,
14326
14348
  'fixed--width': !isAutoCellWidth,
14327
14349
  'fixed--hidden': fixedHiddenColumn,
14328
- 'is--drag-cell': isRowDragCell,
14350
+ 'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
14329
14351
  'is--drag-disabled': isDisabledDrag,
14330
14352
  'col--dirty': isDirty,
14331
14353
  'col--active': editConfig && isEdit && actived.row === row && (actived.column === column || editOpts.mode === 'row'),
@@ -15041,7 +15063,9 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15041
15063
  } = $xeTable;
15042
15064
  const columnDragOpts = $xeTable.computeColumnDragOpts;
15043
15065
  const {
15044
- disabledMethod: dragDisabledMethod
15066
+ disabledMethod: dragDisabledMethod,
15067
+ isCrossDrag,
15068
+ isPeerDrag
15045
15069
  } = columnDragOpts;
15046
15070
  return cols.map((column, $columnIndex) => {
15047
15071
  const {
@@ -15049,6 +15073,7 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15049
15073
  showHeaderOverflow,
15050
15074
  headerAlign,
15051
15075
  align,
15076
+ filters,
15052
15077
  headerClassName,
15053
15078
  editRender,
15054
15079
  cellRender
@@ -15065,7 +15090,12 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15065
15090
  const showTitle = headOverflow === 'title';
15066
15091
  const showTooltip = headOverflow === true || headOverflow === 'tooltip';
15067
15092
  let hasEllipsis = showTitle || showTooltip || showEllipsis;
15068
- const hasFilter = column.filters && column.filters.some(item => item.checked);
15093
+ let hasFilter = false;
15094
+ let firstFilterOption = null;
15095
+ if (filters) {
15096
+ firstFilterOption = filters[0];
15097
+ hasFilter = filters.some(item => item.checked);
15098
+ }
15069
15099
  const columnIndex = $xeTable.getColumnIndex(column);
15070
15100
  const _columnIndex = $xeTable.getVTColumnIndex(column);
15071
15101
  const params = {
@@ -15076,6 +15106,7 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15076
15106
  columnIndex,
15077
15107
  $columnIndex,
15078
15108
  _columnIndex,
15109
+ firstFilterOption,
15079
15110
  fixed: fixedType,
15080
15111
  type: cellType,
15081
15112
  isHidden: fixedHiddenColumn,
@@ -15124,9 +15155,9 @@ const header_renderRows = (h, _vm, cols, $rowIndex) => {
15124
15155
  'fixed--width': !isAutoCellWidth,
15125
15156
  'fixed--hidden': fixedHiddenColumn,
15126
15157
  'is--sortable': column.sortable,
15127
- 'col--filter': !!column.filters,
15158
+ 'col--filter': !!filters,
15128
15159
  'is--filter-active': hasFilter,
15129
- 'is--drag-active': !column.fixed && !isDisabledDrag,
15160
+ 'is--drag-active': !column.fixed && !isDisabledDrag && (isCrossDrag || isPeerDrag || !column.parentId),
15130
15161
  'is--drag-disabled': isDisabledDrag,
15131
15162
  'col--current': currentColumn === column
15132
15163
  }, getClass(headerClassName, params), getClass(headerCellClassName, params)],