vxe-table 4.10.6-beta.25 → 4.10.6-beta.27

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.
Files changed (69) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/en-US.js +2 -2
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/src/body.js +21 -19
  7. package/es/table/src/cell.js +25 -39
  8. package/es/table/src/column.js +10 -0
  9. package/es/table/src/columnInfo.js +2 -0
  10. package/es/table/src/footer.js +2 -1
  11. package/es/table/src/header.js +2 -2
  12. package/es/table/src/table.js +111 -81
  13. package/es/table/src/util.js +9 -3
  14. package/es/table/style.css +51 -26
  15. package/es/table/style.min.css +1 -1
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/log.js +1 -1
  18. package/es/vxe-table/style.css +51 -26
  19. package/es/vxe-table/style.min.css +1 -1
  20. package/lib/index.css +1 -1
  21. package/lib/index.min.css +1 -1
  22. package/lib/index.umd.js +189 -150
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/en-US.js +2 -2
  25. package/lib/locale/lang/en-US.min.js +1 -1
  26. package/lib/locale/lang/en-US.umd.js +2 -2
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table/src/body.js +17 -18
  30. package/lib/table/src/body.min.js +1 -1
  31. package/lib/table/src/cell.js +24 -33
  32. package/lib/table/src/cell.min.js +1 -1
  33. package/lib/table/src/column.js +10 -0
  34. package/lib/table/src/column.min.js +1 -1
  35. package/lib/table/src/columnInfo.js +2 -0
  36. package/lib/table/src/columnInfo.min.js +1 -1
  37. package/lib/table/src/footer.js +2 -1
  38. package/lib/table/src/footer.min.js +1 -1
  39. package/lib/table/src/header.js +1 -1
  40. package/lib/table/src/header.min.js +1 -1
  41. package/lib/table/src/table.js +122 -92
  42. package/lib/table/src/table.min.js +1 -1
  43. package/lib/table/src/util.js +10 -3
  44. package/lib/table/src/util.min.js +1 -1
  45. package/lib/table/style/style.css +51 -26
  46. package/lib/table/style/style.min.css +1 -1
  47. package/lib/ui/index.js +1 -1
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/log.js +1 -1
  50. package/lib/ui/src/log.min.js +1 -1
  51. package/lib/vxe-table/style/style.css +51 -26
  52. package/lib/vxe-table/style/style.min.css +1 -1
  53. package/package.json +2 -2
  54. package/packages/locale/lang/en-US.ts +2 -2
  55. package/packages/table/src/body.ts +21 -19
  56. package/packages/table/src/cell.ts +25 -47
  57. package/packages/table/src/column.ts +10 -0
  58. package/packages/table/src/columnInfo.ts +2 -0
  59. package/packages/table/src/footer.ts +2 -1
  60. package/packages/table/src/header.ts +2 -2
  61. package/packages/table/src/table.ts +116 -83
  62. package/packages/table/src/util.ts +10 -3
  63. package/styles/components/table.scss +63 -31
  64. /package/es/{iconfont.1737356819937.ttf → iconfont.1737446773545.ttf} +0 -0
  65. /package/es/{iconfont.1737356819937.woff → iconfont.1737446773545.woff} +0 -0
  66. /package/es/{iconfont.1737356819937.woff2 → iconfont.1737446773545.woff2} +0 -0
  67. /package/lib/{iconfont.1737356819937.ttf → iconfont.1737446773545.ttf} +0 -0
  68. /package/lib/{iconfont.1737356819937.woff → iconfont.1737446773545.woff} +0 -0
  69. /package/lib/{iconfont.1737356819937.woff2 → iconfont.1737446773545.woff2} +0 -0
@@ -79,7 +79,7 @@ export default defineComponent({
79
79
  */
80
80
  const renderTdColumn = (seq, rowid, fixedType, isOptimizeMode, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) => {
81
81
  const { fullAllDataRowIdData } = tableInternalData;
82
- const { columnKey, height, showOverflow: allColumnOverflow, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
82
+ const { columnKey, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
83
83
  const { tableData, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
84
84
  const { afterFullData, scrollXStore, scrollYStore } = tableInternalData;
85
85
  const cellOpts = computeCellOpts.value;
@@ -96,8 +96,8 @@ export default defineComponent({
96
96
  const mouseOpts = computeMouseOpts.value;
97
97
  const areaOpts = computeAreaOpts.value;
98
98
  const { selectCellToRow } = areaOpts;
99
- const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, slots } = column;
100
- const { verticalAlign } = cellOpts;
99
+ const { type, cellRender, editRender, align, showOverflow, className, treeNode, rowResize, padding, verticalAlign, slots } = column;
100
+ const { verticalAlign: allVerticalAlign } = cellOpts;
101
101
  const { actived } = editStore;
102
102
  const rowRest = fullAllDataRowIdData[rowid];
103
103
  const colid = column.id;
@@ -111,16 +111,17 @@ export default defineComponent({
111
111
  const isEdit = isEnableConf(editRender);
112
112
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
113
113
  let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
114
- const isPadding = allPadding === null ? cellOpts.padding : allPadding;
115
- const cellOverflow = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow;
114
+ const isCellPadding = XEUtils.eqNull(padding) ? (allPadding === null ? cellOpts.padding : allPadding) : padding;
115
+ const cellOverflow = XEUtils.eqNull(showOverflow) ? isAllOverflow : showOverflow;
116
116
  const showEllipsis = cellOverflow === 'ellipsis';
117
117
  const showTitle = cellOverflow === 'title';
118
118
  const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
119
- // 如果表格加上 showOverflow 则不再支持列单独设置
120
- const hasEllipsis = allColumnOverflow || showTitle || showTooltip || showEllipsis || resizeHeight > 0;
119
+ const hasEllipsis = isAllOverflow || showTitle || showTooltip || showEllipsis;
120
+ const isRsHeight = resizeHeight > 0;
121
121
  let isDirty;
122
122
  const tdOns = {};
123
123
  const cellAlign = align || (compConf ? compConf.tableCellAlign : '') || allAlign;
124
+ const cellVerticalAlign = XEUtils.eqNull(verticalAlign) ? allVerticalAlign : verticalAlign;
124
125
  const errorValidItem = validErrorMaps[`${rowid}:${colid}`];
125
126
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline');
126
127
  const tdAttrs = { colid };
@@ -262,14 +263,14 @@ export default defineComponent({
262
263
  isVNPreEmptyStatus = true;
263
264
  }
264
265
  const tcStyle = {};
265
- if (hasEllipsis) {
266
+ if (scrollYLoad || hasEllipsis || isRsHeight) {
266
267
  tcStyle.height = `${cellHeight}px`;
267
268
  }
268
269
  else {
269
270
  tcStyle.minHeight = `${cellHeight}px`;
270
271
  }
271
272
  const tdVNs = [];
272
- if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
273
+ if (fixedHiddenColumn && isAllOverflow) {
273
274
  tdVNs.push(h('div', {
274
275
  key: 'tc',
275
276
  class: ['vxe-cell', {
@@ -345,19 +346,20 @@ export default defineComponent({
345
346
  return h('td', Object.assign(Object.assign(Object.assign({ class: [
346
347
  'vxe-body--column',
347
348
  colid,
349
+ cellVerticalAlign ? `col--vertical-${cellVerticalAlign}` : '',
350
+ cellAlign ? `col--${cellAlign}` : '',
351
+ type ? `col--${type}` : '',
348
352
  {
349
- [`col--${cellAlign}`]: cellAlign,
350
- [`col--vertical-${verticalAlign}`]: verticalAlign,
351
- [`col--${type}`]: type,
352
353
  'col--last': isLastColumn,
353
354
  'col--tree-node': treeNode,
354
355
  'col--edit': isEdit,
355
356
  'col--ellipsis': hasEllipsis,
357
+ 'col--rs-height': isRsHeight,
356
358
  'col--to-row': showAreaRowStatus,
357
359
  'col--auto-height': isVNAutoHeight,
358
360
  'fixed--width': !isAutoCellWidth,
359
361
  'fixed--hidden': fixedHiddenColumn,
360
- 'is--padding': isPadding,
362
+ 'is--padding': isCellPadding,
361
363
  'is--drag-cell': isRowDragCell && (isCrossDrag || isPeerDrag || !rowLevel),
362
364
  'is--drag-disabled': isDisabledDrag,
363
365
  'col--dirty': isDirty,
@@ -371,8 +373,8 @@ export default defineComponent({
371
373
  ], key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? colid : $columnIndex }, tdAttrs), { style: Object.assign({}, XEUtils.isFunction(compCellStyle) ? compCellStyle(cellParams) : compCellStyle, XEUtils.isFunction(cellStyle) ? cellStyle(cellParams) : cellStyle) }), tdOns), isOptimizeMode && fixedHiddenColumn ? [] : tdVNs);
372
374
  };
373
375
  const renderRows = (fixedType, isOptimizeMode, tableData, tableColumn) => {
374
- const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, showOverflow: allColumnOverflow, editConfig, treeConfig } = tableProps;
375
- const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData;
376
+ const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps;
377
+ const { hasFixedColumn, treeExpandedMaps, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedMaps, expandColumn, selectRadioRow, pendingRowMaps, isDragColMove } = tableReactData;
376
378
  const { fullAllDataRowIdData } = tableInternalData;
377
379
  const checkboxOpts = computeCheckboxOpts.value;
378
380
  const radioOpts = computeRadioOpts.value;
@@ -474,7 +476,7 @@ export default defineComponent({
474
476
  cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`;
475
477
  }
476
478
  const { showOverflow } = expandColumn;
477
- const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? allColumnOverflow : showOverflow;
479
+ const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow;
478
480
  const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex };
479
481
  rows.push(h('tr', Object.assign({ class: ['vxe-body--expanded-row', {
480
482
  'is--padding': padding
@@ -537,7 +539,7 @@ export default defineComponent({
537
539
  const renderVN = () => {
538
540
  const { slots } = tableContext;
539
541
  const { fixedColumn, fixedType, tableColumn } = props;
540
- const { showOverflow: allColumnOverflow, spanMethod, footerSpanMethod, mouseConfig } = tableProps;
542
+ const { spanMethod, footerSpanMethod, mouseConfig } = tableProps;
541
543
  const { isGroup, tableData, scrollXLoad, scrollYLoad, isAllOverflow, isDragRowMove, expandColumn, dragRow, dragCol } = tableReactData;
542
544
  const { visibleColumn, fullAllDataRowIdData, fullColumnIdData } = tableInternalData;
543
545
  const rowOpts = computeRowOpts.value;
@@ -550,7 +552,7 @@ export default defineComponent({
550
552
  let renderColumnList = tableColumn;
551
553
  let isOptimizeMode = false;
552
554
  // 如果是使用优化模式
553
- if (scrollXLoad || scrollYLoad || (allColumnOverflow && isAllOverflow)) {
555
+ if (scrollXLoad || scrollYLoad || isAllOverflow) {
554
556
  if (expandColumn || spanMethod || footerSpanMethod) {
555
557
  // 如果不支持优化模式
556
558
  }
@@ -632,7 +634,7 @@ export default defineComponent({
632
634
  $xeTable.triggerBodyScrollEvent(evnt, fixedType);
633
635
  }
634
636
  };
635
- if (leftFixedWidth || rightFixedWidth) {
637
+ if (scrollYLoad || leftFixedWidth || rightFixedWidth) {
636
638
  ons.onWheel = $xeTable.triggerBodyWheelEvent;
637
639
  }
638
640
  return h('div', {
@@ -179,18 +179,6 @@ function renderTitleContent(params, content) {
179
179
  : h('span', Object.assign({ class: 'vxe-cell--title' }, ons), getSlotVNs(content))
180
180
  ];
181
181
  }
182
- function formatFooterLabel(footerFormatter, params) {
183
- if (XEUtils.isFunction(footerFormatter)) {
184
- return `${footerFormatter(params)}`;
185
- }
186
- const isArr = XEUtils.isArray(footerFormatter);
187
- const gFormatOpts = isArr ? formats.get(footerFormatter[0]) : formats.get(footerFormatter);
188
- const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
189
- if (footerFormatMethod) {
190
- return `${isArr ? footerFormatMethod(params, ...footerFormatter.slice(1)) : footerFormatMethod(params)}`;
191
- }
192
- return '';
193
- }
194
182
  function getFooterContent(params) {
195
183
  const { $table, column, _columnIndex, items, row } = params;
196
184
  const { slots, editRender, cellRender, footerFormatter } = column;
@@ -199,42 +187,40 @@ function getFooterContent(params) {
199
187
  if (footerSlot) {
200
188
  return $table.callSlot(footerSlot, params);
201
189
  }
190
+ let itemValue = '';
191
+ // 兼容老模式
192
+ if (XEUtils.isArray(items)) {
193
+ itemValue = items[_columnIndex];
194
+ }
195
+ else {
196
+ itemValue = XEUtils.get(row, column.field);
197
+ }
198
+ const footParams = Object.assign(params, {
199
+ itemValue
200
+ });
201
+ if (footerFormatter) {
202
+ if (XEUtils.isFunction(footerFormatter)) {
203
+ return `${footerFormatter(footParams)}`;
204
+ }
205
+ const isArr = XEUtils.isArray(footerFormatter);
206
+ const gFormatOpts = isArr ? formats.get(footerFormatter[0]) : formats.get(footerFormatter);
207
+ const footerFormatMethod = gFormatOpts ? gFormatOpts.tableFooterCellFormatMethod : null;
208
+ if (footerFormatMethod) {
209
+ return `${isArr ? footerFormatMethod(footParams, ...footerFormatter.slice(1)) : footerFormatMethod(footParams)}`;
210
+ }
211
+ return '';
212
+ }
202
213
  if (renderOpts) {
203
214
  const compConf = renderer.get(renderOpts.name);
204
215
  if (compConf) {
205
216
  const rtFooter = compConf.renderTableFooter || compConf.renderFooter;
206
217
  if (rtFooter) {
207
- return getSlotVNs(rtFooter(renderOpts, params));
218
+ return getSlotVNs(rtFooter(renderOpts, footParams));
208
219
  }
209
220
  }
210
221
  }
211
- let itemValue = '';
212
- // 兼容老模式
213
- if (XEUtils.isArray(items)) {
214
- itemValue = items[_columnIndex];
215
- return [
216
- footerFormatter
217
- ? formatFooterLabel(footerFormatter, {
218
- itemValue,
219
- column,
220
- row,
221
- items,
222
- _columnIndex
223
- })
224
- : formatText(itemValue, 1)
225
- ];
226
- }
227
- itemValue = XEUtils.get(row, column.field);
228
222
  return [
229
- footerFormatter
230
- ? formatFooterLabel(footerFormatter, {
231
- itemValue,
232
- column,
233
- row,
234
- items,
235
- _columnIndex
236
- })
237
- : formatText(itemValue, 1)
223
+ formatText(itemValue, 1)
238
224
  ];
239
225
  }
240
226
  function getDefaultCellLabel(params) {
@@ -54,6 +54,16 @@ export const columnProps = {
54
54
  formatter: [Function, Array, String],
55
55
  // 格式化表尾显示内容
56
56
  footerFormatter: [Function, Array, String],
57
+ // 是否显示间距
58
+ padding: {
59
+ type: Boolean,
60
+ default: null
61
+ },
62
+ // 垂直对齐方式
63
+ verticalAlign: {
64
+ type: String,
65
+ default: null
66
+ },
57
67
  // 是否允许排序
58
68
  sortable: Boolean,
59
69
  // 自定义排序的属性
@@ -70,6 +70,8 @@ export class ColumnInfo {
70
70
  footerClassName: _vm.footerClassName,
71
71
  formatter: formatter,
72
72
  footerFormatter: _vm.footerFormatter,
73
+ padding: _vm.padding,
74
+ verticalAlign: _vm.verticalAlign,
73
75
  sortable: _vm.sortable,
74
76
  sortBy: _vm.sortBy,
75
77
  sortType: _vm.sortType,
@@ -2,6 +2,7 @@ import { defineComponent, TransitionGroup, h, ref, inject, nextTick, onMounted,
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../ui';
4
4
  import { updateCellTitle, getPropClass } from '../../ui/src/dom';
5
+ import { getCellHeight } from './util';
5
6
  const { renderer, renderEmptyElement } = VxeUI;
6
7
  const renderType = 'footer';
7
8
  function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
@@ -57,7 +58,7 @@ export default defineComponent({
57
58
  const defaultRowHeight = computeDefaultRowHeight.value;
58
59
  const cellOpts = computeCellOpts.value;
59
60
  const footerCellOpts = computeFooterCellOpts.value;
60
- const currCellHeight = footerCellOpts.height || cellOpts.height || defaultRowHeight;
61
+ const currCellHeight = getCellHeight(footerCellOpts.height || cellOpts.height) || defaultRowHeight;
61
62
  return tableColumn.map((column, $columnIndex) => {
62
63
  const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
63
64
  const colid = column.id;
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, TransitionGroup, h, ref, inject, nextTick, watch, onMounted, onUnmounted } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../ui';
4
- import { convertHeaderColumnToRows } from './util';
4
+ import { getCellHeight, convertHeaderColumnToRows } from './util';
5
5
  const { renderer, renderEmptyElement } = VxeUI;
6
6
  const renderType = 'header';
7
7
  export default defineComponent({
@@ -42,7 +42,7 @@ export default defineComponent({
42
42
  const cellOpts = computeCellOpts.value;
43
43
  const defaultRowHeight = computeDefaultRowHeight.value;
44
44
  const headerCellOpts = computeHeaderCellOpts.value;
45
- const currCellHeight = headerCellOpts.height || cellOpts.height || defaultRowHeight;
45
+ const currCellHeight = getCellHeight(headerCellOpts.height || cellOpts.height) || defaultRowHeight;
46
46
  const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts;
47
47
  return cols.map((column, $columnIndex) => {
48
48
  const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column;