vxe-table 4.7.77 → 4.7.78

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 (61) hide show
  1. package/README.en.md +1 -1
  2. package/README.ja-JP.md +1 -1
  3. package/README.md +1 -1
  4. package/README.zh-TW.md +1 -1
  5. package/es/grid/src/grid.js +45 -36
  6. package/es/style.css +1 -1
  7. package/es/table/module/custom/panel.js +5 -0
  8. package/es/table/src/body.js +26 -2
  9. package/es/table/src/cell.js +6 -6
  10. package/es/table/src/column.js +45 -18
  11. package/es/table/src/footer.js +16 -4
  12. package/es/table/src/group.js +18 -12
  13. package/es/table/src/header.js +4 -1
  14. package/es/table/src/props.js +96 -24
  15. package/es/table/src/table.js +2 -4
  16. package/es/table/src/util.js +1 -1
  17. package/es/toolbar/src/toolbar.js +89 -68
  18. package/es/ui/index.js +2 -2
  19. package/es/ui/src/log.js +1 -1
  20. package/lib/grid/src/grid.js +45 -39
  21. package/lib/grid/src/grid.min.js +1 -1
  22. package/lib/index.umd.js +252 -174
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/table/module/custom/panel.js +7 -0
  26. package/lib/table/module/custom/panel.min.js +1 -1
  27. package/lib/table/src/cell.js +3 -3
  28. package/lib/table/src/cell.min.js +1 -1
  29. package/lib/table/src/column.js +16 -10
  30. package/lib/table/src/column.min.js +1 -1
  31. package/lib/table/src/group.js +17 -11
  32. package/lib/table/src/group.min.js +1 -1
  33. package/lib/table/src/table.js +2 -4
  34. package/lib/table/src/table.min.js +1 -1
  35. package/lib/table/src/util.js +1 -1
  36. package/lib/table/src/util.min.js +1 -1
  37. package/lib/toolbar/src/toolbar.js +109 -76
  38. package/lib/toolbar/src/toolbar.min.js +1 -1
  39. package/lib/ui/index.js +2 -2
  40. package/lib/ui/index.min.js +1 -1
  41. package/lib/ui/src/log.js +1 -1
  42. package/lib/ui/src/log.min.js +1 -1
  43. package/package.json +2 -2
  44. package/packages/grid/src/grid.ts +54 -44
  45. package/packages/table/module/custom/panel.ts +5 -0
  46. package/packages/table/src/body.ts +26 -2
  47. package/packages/table/src/cell.ts +9 -8
  48. package/packages/table/src/column.ts +47 -20
  49. package/packages/table/src/footer.ts +16 -4
  50. package/packages/table/src/group.ts +19 -13
  51. package/packages/table/src/header.ts +4 -1
  52. package/packages/table/src/props.ts +97 -24
  53. package/packages/table/src/table.ts +2 -4
  54. package/packages/table/src/util.ts +2 -2
  55. package/packages/toolbar/src/toolbar.ts +97 -75
  56. /package/es/{iconfont.1725604498089.ttf → iconfont.1726051234125.ttf} +0 -0
  57. /package/es/{iconfont.1725604498089.woff → iconfont.1726051234125.woff} +0 -0
  58. /package/es/{iconfont.1725604498089.woff2 → iconfont.1726051234125.woff2} +0 -0
  59. /package/lib/{iconfont.1725604498089.ttf → iconfont.1726051234125.ttf} +0 -0
  60. /package/lib/{iconfont.1725604498089.woff → iconfont.1726051234125.woff} +0 -0
  61. /package/lib/{iconfont.1725604498089.woff2 → iconfont.1726051234125.woff2} +0 -0
@@ -18,7 +18,10 @@ export default defineComponent({
18
18
  tableData: Array,
19
19
  tableColumn: Array,
20
20
  fixedColumn: Array,
21
- fixedType: { type: String, default: null }
21
+ fixedType: {
22
+ type: String,
23
+ default: null
24
+ }
22
25
  },
23
26
  setup(props) {
24
27
  const $xeTable = inject('$xeTable', {});
@@ -147,7 +150,28 @@ export default defineComponent({
147
150
  const errorValidItem = validErrorMaps[`${rowid}:${colid}`];
148
151
  const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline');
149
152
  const attrs = { colid };
150
- const params = { $table: $xeTable, $grid: $xeTable.xegrid, isEdit: false, seq, rowid, row, rowIndex, $rowIndex, _rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, level: rowLevel, visibleData: afterFullData, data: tableData, items };
153
+ const params = {
154
+ $table: $xeTable,
155
+ $grid: $xeTable.xegrid,
156
+ isEdit: false,
157
+ seq,
158
+ rowid,
159
+ row,
160
+ rowIndex,
161
+ $rowIndex,
162
+ _rowIndex,
163
+ column,
164
+ columnIndex,
165
+ $columnIndex,
166
+ _columnIndex,
167
+ fixed: fixedType,
168
+ type: renderType,
169
+ isHidden: fixedHiddenColumn,
170
+ level: rowLevel,
171
+ visibleData: afterFullData,
172
+ data: tableData,
173
+ items
174
+ };
151
175
  // 虚拟滚动不支持动态高度
152
176
  if (scrollYLoad && !hasEllipsis) {
153
177
  showEllipsis = hasEllipsis = true;
@@ -251,14 +251,14 @@ export const Cell = {
251
251
  return [
252
252
  h('span', {
253
253
  class: 'vxe-cell--label'
254
- }, editRender && eqEmptyValue(cellValue)
255
- ? [
256
- // 如果设置占位符
257
- h('span', {
254
+ }, [
255
+ // 如果设置占位符
256
+ editRender && eqEmptyValue(cellValue)
257
+ ? h('span', {
258
258
  class: 'vxe-cell--placeholder'
259
259
  }, formatText(getFuncText(cellPlaceholder), 1))
260
- ]
261
- : formatText(cellValue, 1))
260
+ : h('span', formatText(cellValue, 1))
261
+ ])
262
262
  ];
263
263
  },
264
264
  renderTreeCell(params) {
@@ -1,6 +1,6 @@
1
- import { defineComponent, h, onUnmounted, inject, ref, provide, onMounted } from 'vue';
2
- import { watchColumn, assembleColumn, destroyColumn } from '../../table/src/util';
3
- import Cell from '../../table/src/cell';
1
+ import { defineComponent, h, onUnmounted, inject, ref, provide, onMounted, createCommentVNode } from 'vue';
2
+ import { watchColumn, assembleColumn, destroyColumn } from './util';
3
+ import Cell from './cell';
4
4
  export const columnProps = {
5
5
  // 列唯一主键
6
6
  colId: [String, Number],
@@ -17,7 +17,10 @@ export const columnProps = {
17
17
  // 列最大宽度
18
18
  maxWidth: [Number, String],
19
19
  // 是否允许拖动列宽调整大小
20
- resizable: { type: Boolean, default: null },
20
+ resizable: {
21
+ type: Boolean,
22
+ default: null
23
+ },
21
24
  // 将列固定在左侧或者右侧
22
25
  fixed: String,
23
26
  // 列对其方式
@@ -27,11 +30,20 @@ export const columnProps = {
27
30
  // 表尾列的对齐方式
28
31
  footerAlign: String,
29
32
  // 当内容过长时显示为省略号
30
- showOverflow: { type: [Boolean, String], default: null },
33
+ showOverflow: {
34
+ type: [Boolean, String],
35
+ default: null
36
+ },
31
37
  // 当表头内容过长时显示为省略号
32
- showHeaderOverflow: { type: [Boolean, String], default: null },
38
+ showHeaderOverflow: {
39
+ type: [Boolean, String],
40
+ default: null
41
+ },
33
42
  // 当表尾内容过长时显示为省略号
34
- showFooterOverflow: { type: [Boolean, String], default: null },
43
+ showFooterOverflow: {
44
+ type: [Boolean, String],
45
+ default: null
46
+ },
35
47
  // 给单元格附加 className
36
48
  className: [String, Function],
37
49
  // 给表头单元格附加 className
@@ -49,9 +61,15 @@ export const columnProps = {
49
61
  // 排序的字段类型,比如字符串转数值等
50
62
  sortType: String,
51
63
  // 配置筛选条件数组
52
- filters: { type: Array, default: null },
64
+ filters: {
65
+ type: Array,
66
+ default: null
67
+ },
53
68
  // 筛选是否允许多选
54
- filterMultiple: { type: Boolean, default: true },
69
+ filterMultiple: {
70
+ type: Boolean,
71
+ default: true
72
+ },
55
73
  // 自定义筛选方法
56
74
  filterMethod: Function,
57
75
  // 筛选重置方法
@@ -63,7 +81,10 @@ export const columnProps = {
63
81
  // 指定为树节点
64
82
  treeNode: Boolean,
65
83
  // 是否可视
66
- visible: { type: Boolean, default: null },
84
+ visible: {
85
+ type: Boolean,
86
+ default: null
87
+ },
67
88
  // 表头单元格数据导出方法
68
89
  headerExportMethod: Function,
69
90
  // 单元格数据导出方法
@@ -92,25 +113,31 @@ export default defineComponent({
92
113
  props: columnProps,
93
114
  setup(props, { slots }) {
94
115
  const refElem = ref();
95
- const $xeTable = inject('$xeTable', {});
96
- const parentColgroup = inject('$xeColgroup', null);
97
- const column = Cell.createColumn($xeTable, props);
98
- column.slots = slots;
116
+ const $xeTable = inject('$xeTable', null);
117
+ const $xeColgroup = inject('$xeColgroup', null);
118
+ if (!$xeTable) {
119
+ return () => createCommentVNode();
120
+ }
121
+ const columnConfig = Cell.createColumn($xeTable, props);
122
+ columnConfig.slots = slots;
99
123
  const renderVN = () => {
100
124
  return h('div', {
101
125
  ref: refElem
102
126
  });
103
127
  };
104
128
  const $xeColumn = {
105
- column,
129
+ columnConfig,
106
130
  renderVN
107
131
  };
108
- watchColumn($xeTable, props, column);
132
+ watchColumn($xeTable, props, columnConfig);
109
133
  onMounted(() => {
110
- assembleColumn($xeTable, refElem.value, column, parentColgroup);
134
+ const elem = refElem.value;
135
+ if (elem) {
136
+ assembleColumn($xeTable, elem, columnConfig, $xeColgroup);
137
+ }
111
138
  });
112
139
  onUnmounted(() => {
113
- destroyColumn($xeTable, column);
140
+ destroyColumn($xeTable, columnConfig);
114
141
  });
115
142
  provide('$xeColumn', $xeColumn);
116
143
  provide('$xeGrid', null);
@@ -18,10 +18,22 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
18
18
  export default defineComponent({
19
19
  name: 'VxeTableFooter',
20
20
  props: {
21
- footerTableData: { type: Array, default: () => [] },
22
- tableColumn: { type: Array, default: () => [] },
23
- fixedColumn: { type: Array, default: () => [] },
24
- fixedType: { type: String, default: null }
21
+ footerTableData: {
22
+ type: Array,
23
+ default: () => []
24
+ },
25
+ tableColumn: {
26
+ type: Array,
27
+ default: () => []
28
+ },
29
+ fixedColumn: {
30
+ type: Array,
31
+ default: () => []
32
+ },
33
+ fixedType: {
34
+ type: String,
35
+ default: null
36
+ }
25
37
  },
26
38
  setup(props) {
27
39
  const $xeTable = inject('$xeTable', {});
@@ -1,34 +1,40 @@
1
- import { defineComponent, h, onUnmounted, provide, inject, ref, onMounted } from 'vue';
1
+ import { defineComponent, h, onUnmounted, provide, inject, ref, onMounted, createCommentVNode } from 'vue';
2
2
  import { columnProps } from './column';
3
- import { watchColumn, assembleColumn, destroyColumn } from '../../table/src/util';
4
- import Cell from '../../table/src/cell';
3
+ import { watchColumn, assembleColumn, destroyColumn } from './util';
4
+ import Cell from './cell';
5
5
  export default defineComponent({
6
6
  name: 'VxeColgroup',
7
7
  props: columnProps,
8
8
  setup(props, { slots }) {
9
9
  const refElem = ref();
10
- const $xeTable = inject('$xeTable', {});
11
- const parentColgroup = inject('$xeColgroup', null);
12
- const column = Cell.createColumn($xeTable, props);
10
+ const $xeTable = inject('$xeTable', null);
11
+ const $xeParentColgroup = inject('$xeColgroup', null);
12
+ if (!$xeTable) {
13
+ return () => createCommentVNode();
14
+ }
15
+ const columnConfig = Cell.createColumn($xeTable, props);
13
16
  const columnSlots = {};
14
17
  if (slots.header) {
15
18
  columnSlots.header = slots.header;
16
19
  }
17
- column.slots = columnSlots;
18
- column.children = [];
19
- watchColumn($xeTable, props, column);
20
+ columnConfig.slots = columnSlots;
21
+ columnConfig.children = [];
22
+ watchColumn($xeTable, props, columnConfig);
20
23
  onMounted(() => {
21
- assembleColumn($xeTable, refElem.value, column, parentColgroup);
24
+ const elem = refElem.value;
25
+ if (elem) {
26
+ assembleColumn($xeTable, elem, columnConfig, $xeParentColgroup);
27
+ }
22
28
  });
23
29
  onUnmounted(() => {
24
- destroyColumn($xeTable, column);
30
+ destroyColumn($xeTable, columnConfig);
25
31
  });
26
32
  const renderVN = () => {
27
33
  return h('div', {
28
34
  ref: refElem
29
35
  }, slots.default ? slots.default() : []);
30
36
  };
31
- const $xeColgroup = { column };
37
+ const $xeColgroup = { columnConfig };
32
38
  provide('$xeColgroup', $xeColgroup);
33
39
  provide('$xeGrid', null);
34
40
  return renderVN;
@@ -10,7 +10,10 @@ export default defineComponent({
10
10
  tableColumn: Array,
11
11
  tableGroupColumn: Array,
12
12
  fixedColumn: Array,
13
- fixedType: { type: String, default: null }
13
+ fixedType: {
14
+ type: String,
15
+ default: null
16
+ }
14
17
  },
15
18
  setup(props) {
16
19
  const $xeTable = inject('$xeTable', {});
@@ -8,39 +8,84 @@ export default {
8
8
  // 表格的高度
9
9
  height: [Number, String],
10
10
  // 表格的最小高度
11
- minHeight: { type: [Number, String], default: () => getConfig().table.minHeight },
11
+ minHeight: {
12
+ type: [Number, String],
13
+ default: () => getConfig().table.minHeight
14
+ },
12
15
  // 表格的最大高度
13
16
  maxHeight: [Number, String],
14
17
  // 已废弃,被 column-config.resizable 替换
15
- resizable: { type: Boolean, default: () => getConfig().table.resizable },
18
+ resizable: {
19
+ type: Boolean,
20
+ default: () => getConfig().table.resizable
21
+ },
16
22
  // 是否带有斑马纹
17
- stripe: { type: Boolean, default: () => getConfig().table.stripe },
23
+ stripe: {
24
+ type: Boolean,
25
+ default: () => getConfig().table.stripe
26
+ },
18
27
  // 是否带有边框
19
- border: { type: [Boolean, String], default: () => getConfig().table.border },
28
+ border: {
29
+ type: [Boolean, String],
30
+ default: () => getConfig().table.border
31
+ },
20
32
  // 是否圆角边框
21
- round: { type: Boolean, default: () => getConfig().table.round },
33
+ round: {
34
+ type: Boolean,
35
+ default: () => getConfig().table.round
36
+ },
22
37
  // 表格的尺寸
23
- size: { type: String, default: () => getConfig().table.size || getConfig().size },
38
+ size: {
39
+ type: String,
40
+ default: () => getConfig().table.size || getConfig().size
41
+ },
24
42
  // 列的宽度是否自撑开(可能会被废弃的参数,不要使用)
25
- fit: { type: Boolean, default: () => getConfig().table.fit },
43
+ fit: {
44
+ type: Boolean,
45
+ default: () => getConfig().table.fit
46
+ },
26
47
  // 表格是否加载中
27
48
  loading: Boolean,
28
49
  // 所有的列对其方式
29
- align: { type: String, default: () => getConfig().table.align },
50
+ align: {
51
+ type: String,
52
+ default: () => getConfig().table.align
53
+ },
30
54
  // 所有的表头列的对齐方式
31
- headerAlign: { type: String, default: () => getConfig().table.headerAlign },
55
+ headerAlign: {
56
+ type: String,
57
+ default: () => getConfig().table.headerAlign
58
+ },
32
59
  // 所有的表尾列的对齐方式
33
- footerAlign: { type: String, default: () => getConfig().table.footerAlign },
60
+ footerAlign: {
61
+ type: String,
62
+ default: () => getConfig().table.footerAlign
63
+ },
34
64
  // 是否显示表头
35
- showHeader: { type: Boolean, default: () => getConfig().table.showHeader },
65
+ showHeader: {
66
+ type: Boolean,
67
+ default: () => getConfig().table.showHeader
68
+ },
36
69
  // (即将废弃)是否要高亮当前选中行
37
- highlightCurrentRow: { type: Boolean, default: () => getConfig().table.highlightCurrentRow },
70
+ highlightCurrentRow: {
71
+ type: Boolean,
72
+ default: () => getConfig().table.highlightCurrentRow
73
+ },
38
74
  // (即将废弃)鼠标移到行是否要高亮显示
39
- highlightHoverRow: { type: Boolean, default: () => getConfig().table.highlightHoverRow },
75
+ highlightHoverRow: {
76
+ type: Boolean,
77
+ default: () => getConfig().table.highlightHoverRow
78
+ },
40
79
  // (即将废弃)是否要高亮当前选中列
41
- highlightCurrentColumn: { type: Boolean, default: () => getConfig().table.highlightCurrentColumn },
80
+ highlightCurrentColumn: {
81
+ type: Boolean,
82
+ default: () => getConfig().table.highlightCurrentColumn
83
+ },
42
84
  // (即将废弃)鼠标移到列是否要高亮显示
43
- highlightHoverColumn: { type: Boolean, default: () => getConfig().table.highlightHoverColumn },
85
+ highlightHoverColumn: {
86
+ type: Boolean,
87
+ default: () => getConfig().table.highlightHoverColumn
88
+ },
44
89
  // (即将废弃)激活单元格编辑时是否高亮显示
45
90
  highlightCell: Boolean,
46
91
  // 是否显示表尾合计
@@ -82,23 +127,44 @@ export default {
82
127
  // 表尾合并行或列
83
128
  footerSpanMethod: Function,
84
129
  // 设置所有内容过长时显示为省略号
85
- showOverflow: { type: [Boolean, String], default: () => getConfig().table.showOverflow },
130
+ showOverflow: {
131
+ type: [Boolean, String],
132
+ default: () => getConfig().table.showOverflow
133
+ },
86
134
  // 设置表头所有内容过长时显示为省略号
87
- showHeaderOverflow: { type: [Boolean, String], default: () => getConfig().table.showHeaderOverflow },
135
+ showHeaderOverflow: {
136
+ type: [Boolean, String],
137
+ default: () => getConfig().table.showHeaderOverflow
138
+ },
88
139
  // 设置表尾所有内容过长时显示为省略号
89
- showFooterOverflow: { type: [Boolean, String], default: () => getConfig().table.showFooterOverflow },
140
+ showFooterOverflow: {
141
+ type: [Boolean, String],
142
+ default: () => getConfig().table.showFooterOverflow
143
+ },
90
144
  /** 高级属性 */
91
145
  // (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
92
146
  columnKey: Boolean,
93
147
  // (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
94
148
  rowKey: Boolean,
95
149
  // (即将废弃)rowId 已废弃,被 row-config.keyField 替换
96
- rowId: { type: String, default: () => getConfig().table.rowId },
150
+ rowId: {
151
+ type: String,
152
+ default: () => getConfig().table.rowId
153
+ },
97
154
  zIndex: Number,
98
- emptyText: { type: String, default: () => getConfig().table.emptyText },
99
- keepSource: { type: Boolean, default: () => getConfig().table.keepSource },
155
+ emptyText: {
156
+ type: String,
157
+ default: () => getConfig().table.emptyText
158
+ },
159
+ keepSource: {
160
+ type: Boolean,
161
+ default: () => getConfig().table.keepSource
162
+ },
100
163
  // 是否自动监听父容器变化去更新响应式表格宽高
101
- autoResize: { type: Boolean, default: () => getConfig().table.autoResize },
164
+ autoResize: {
165
+ type: Boolean,
166
+ default: () => getConfig().table.autoResize
167
+ },
102
168
  // 是否自动根据状态属性去更新响应式表格宽高
103
169
  syncResize: [Boolean, String, Number],
104
170
  // 响应式布局配置项
@@ -160,9 +226,15 @@ export default {
160
226
  // 纵向虚拟滚动配置项
161
227
  scrollY: Object,
162
228
  // (即将废弃)优化相关
163
- animat: { type: Boolean, default: () => getConfig().table.animat },
229
+ animat: {
230
+ type: Boolean,
231
+ default: () => getConfig().table.animat
232
+ },
164
233
  // (可能会被废弃的参数,不要使用)
165
- delayHover: { type: Number, default: () => getConfig().table.delayHover },
234
+ delayHover: {
235
+ type: Number,
236
+ default: () => getConfig().table.delayHover
237
+ },
166
238
  // 额外的参数
167
239
  params: Object
168
240
  };
@@ -6930,9 +6930,7 @@ export default defineComponent({
6930
6930
  globalEvents.on($xeTable, 'mousewheel', handleGlobalMousewheelEvent);
6931
6931
  globalEvents.on($xeTable, 'keydown', handleGlobalKeydownEvent);
6932
6932
  globalEvents.on($xeTable, 'resize', handleGlobalResizeEvent);
6933
- if ($xeTable.handleGlobalContextmenuEvent) {
6934
- globalEvents.on($xeTable, 'contextmenu', $xeTable.handleGlobalContextmenuEvent);
6935
- }
6933
+ globalEvents.on($xeTable, 'contextmenu', $xeTable.handleGlobalContextmenuEvent);
6936
6934
  tablePrivateMethods.preventEvent(null, 'mounted', { $table: $xeTable });
6937
6935
  });
6938
6936
  onBeforeUnmount(() => {
@@ -7135,7 +7133,7 @@ export default defineComponent({
7135
7133
  })
7136
7134
  : createCommentVNode(),
7137
7135
  /**
7138
- * 导出/导出
7136
+ * 导出
7139
7137
  */
7140
7138
  initStore.export && (props.exportConfig || props.printConfig)
7141
7139
  ? h(TableExportPanelComponent, {
@@ -248,7 +248,7 @@ export function assembleColumn($xeTable, elem, column, colgroup) {
248
248
  const { reactData } = $xeTable;
249
249
  const { staticColumns } = reactData;
250
250
  const parentElem = elem.parentNode;
251
- const parentColumn = colgroup ? colgroup.column : null;
251
+ const parentColumn = colgroup ? colgroup.columnConfig : null;
252
252
  const parentCols = parentColumn ? parentColumn.children : staticColumns;
253
253
  if (parentElem && parentCols) {
254
254
  parentCols.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, column);