vxe-table 4.21.2 → 4.21.3
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.
- package/dist/all.esm.js +126 -91
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/hook.js +4 -0
- package/es/table/module/export/export-panel.js +3 -2
- package/es/table/module/export/hook.js +13 -7
- package/es/table/module/filter/hook.js +97 -79
- package/es/table/src/table.js +5 -0
- package/es/table/src/util.js +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +140 -99
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +6 -0
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/export/export-panel.js +3 -2
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/hook.js +15 -7
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/filter/hook.js +111 -86
- package/lib/table/module/filter/hook.min.js +1 -1
- package/lib/table/src/table.js +1 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +1 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +1 -1
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/module/custom/hook.ts +4 -0
- package/packages/table/module/export/export-panel.ts +3 -2
- package/packages/table/module/export/hook.ts +12 -7
- package/packages/table/module/filter/hook.ts +94 -75
- package/packages/table/src/table.ts +5 -0
- package/packages/table/src/util.ts +1 -0
- package/packages/ui/src/dom.ts +1 -1
- /package/es/{iconfont.1787677402393.ttf → iconfont.1788176649939.ttf} +0 -0
- /package/es/{iconfont.1787677402393.woff → iconfont.1788176649939.woff} +0 -0
- /package/es/{iconfont.1787677402393.woff2 → iconfont.1788176649939.woff2} +0 -0
- /package/lib/{iconfont.1787677402393.ttf → iconfont.1788176649939.ttf} +0 -0
- /package/lib/{iconfont.1787677402393.woff → iconfont.1788176649939.woff} +0 -0
- /package/lib/{iconfont.1787677402393.woff2 → iconfont.1788176649939.woff2} +0 -0
|
@@ -471,6 +471,10 @@ VxeUI.hooks.add('tableCustomModule', {
|
|
|
471
471
|
handleUpdateCustomColumn,
|
|
472
472
|
handleCustomStyle() {
|
|
473
473
|
const reactData = $xeTable.reactData;
|
|
474
|
+
const { customStore } = reactData;
|
|
475
|
+
if (!customStore.visible) {
|
|
476
|
+
return nextTick();
|
|
477
|
+
}
|
|
474
478
|
reactData.isCustomDragStatus = false;
|
|
475
479
|
return updatePopupStyle();
|
|
476
480
|
}
|
|
@@ -117,9 +117,10 @@ export default defineVxeComponent({
|
|
|
117
117
|
const { hasMerge, columns } = storeData;
|
|
118
118
|
const checkedAll = computeCheckedAll.value;
|
|
119
119
|
const supportMerge = computeSupportMerge.value;
|
|
120
|
-
|
|
120
|
+
// 内部导出使用 _columns -> _children 为自定义子集
|
|
121
|
+
const expColumns = XEUtils.searchTree(columns, (column) => column.checked, { children: 'children', mapChildren: '_children', original: true });
|
|
121
122
|
return Object.assign({}, defaultOptions, {
|
|
122
|
-
|
|
123
|
+
_columns: expColumns,
|
|
123
124
|
isMerge: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false
|
|
124
125
|
});
|
|
125
126
|
};
|
|
@@ -257,7 +257,7 @@ const tableExportMethodKeys = ['exportData', 'importByFile', 'importData', 'save
|
|
|
257
257
|
hooks.add('tableExportModule', {
|
|
258
258
|
setupTable($xeTable) {
|
|
259
259
|
const { props, reactData, internalData } = $xeTable;
|
|
260
|
-
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts,
|
|
260
|
+
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts, computeAggregateOpts } = $xeTable.getComputeMaps();
|
|
261
261
|
const getSeq = (cellValue, row, $rowIndex, column, $columnIndex) => {
|
|
262
262
|
const seqOpts = computeSeqOpts.value;
|
|
263
263
|
const seqMd = seqOpts.seqMethod || column.seqMethod;
|
|
@@ -1214,9 +1214,9 @@ hooks.add('tableExportModule', {
|
|
|
1214
1214
|
const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData;
|
|
1215
1215
|
const { collectColumn, mergeBodyList, mergeFooterList } = internalData;
|
|
1216
1216
|
const exportOpts = computeExportOpts.value;
|
|
1217
|
+
const printOpts = computePrintOpts.value;
|
|
1217
1218
|
const hasTree = !!treeConfig;
|
|
1218
1219
|
const hasRowGroup = rowGroupList.length > 0;
|
|
1219
|
-
const customOpts = computeCustomOpts.value;
|
|
1220
1220
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
1221
1221
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
|
|
1222
1222
|
const hasFooter = !!footerTableData.length;
|
|
@@ -1237,9 +1237,9 @@ hooks.add('tableExportModule', {
|
|
|
1237
1237
|
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
|
|
1238
1238
|
defOpts.isTreeAllExpanded = defOpts.isAllExpand;
|
|
1239
1239
|
}
|
|
1240
|
-
const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps);
|
|
1240
|
+
const types = isPrint ? [] : (defOpts.types || XEUtils.keys(exportOpts._typeMaps));
|
|
1241
1241
|
const modes = defOpts.modes || [];
|
|
1242
|
-
const checkMethod =
|
|
1242
|
+
const checkMethod = (isPrint ? printOpts : exportOpts).checkMethod;
|
|
1243
1243
|
const exportColumns = collectColumn.slice(0);
|
|
1244
1244
|
const { columns, excludeFields, includeFields, extraFields } = defOpts;
|
|
1245
1245
|
// 处理类型
|
|
@@ -1346,10 +1346,10 @@ hooks.add('tableExportModule', {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
1348
|
if (!modeList.some(item => item.value === mode)) {
|
|
1349
|
-
exportParams.mode = modeList[0].value;
|
|
1349
|
+
exportParams.mode = modeList.length ? modeList[0].value : '';
|
|
1350
1350
|
}
|
|
1351
1351
|
if (!typeList.some(item => item.value === type)) {
|
|
1352
|
-
exportParams.type = typeList[0].value;
|
|
1352
|
+
exportParams.type = typeList.length ? typeList[0].value : '';
|
|
1353
1353
|
}
|
|
1354
1354
|
if (!exportParams.widthMode) {
|
|
1355
1355
|
exportParams.widthMode = '';
|
|
@@ -1438,7 +1438,13 @@ hooks.add('tableExportModule', {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
let isCustomCol = false;
|
|
1440
1440
|
let customCols = [];
|
|
1441
|
-
|
|
1441
|
+
const _columns = opts._columns;
|
|
1442
|
+
if (_columns) {
|
|
1443
|
+
// 内部导出使用 _columns -> _children 为自定义子集
|
|
1444
|
+
isCustomCol = true;
|
|
1445
|
+
customCols = XEUtils.searchTree(_columns, () => true, { children: '_children', mapChildren: 'childNodes', original: true });
|
|
1446
|
+
}
|
|
1447
|
+
else if (columns) {
|
|
1442
1448
|
isCustomCol = true;
|
|
1443
1449
|
customCols = XEUtils.searchTree(columns, () => true, { children: 'children', mapChildren: 'childNodes', original: true });
|
|
1444
1450
|
}
|
|
@@ -15,6 +15,92 @@ hooks.add('tableFilterModule', {
|
|
|
15
15
|
const { props, reactData, internalData } = $xeTable;
|
|
16
16
|
const { refElem, refTableFilter } = $xeTable.getRefMaps();
|
|
17
17
|
const { computeFilterOpts, computeMouseOpts } = $xeTable.getComputeMaps();
|
|
18
|
+
const updatePopupStyle = () => {
|
|
19
|
+
const { filterStore } = reactData;
|
|
20
|
+
const { elemStore } = internalData;
|
|
21
|
+
const { column, targetEl } = filterStore;
|
|
22
|
+
if (!column || !targetEl) {
|
|
23
|
+
return nextTick();
|
|
24
|
+
}
|
|
25
|
+
const tableEl = refElem.value;
|
|
26
|
+
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode();
|
|
27
|
+
const filterOpts = computeFilterOpts.value;
|
|
28
|
+
const { maxHeight: customMaxHeight, transfer, zIndex } = filterOpts;
|
|
29
|
+
const currEl = targetEl;
|
|
30
|
+
const tableRect = tableEl.getBoundingClientRect();
|
|
31
|
+
const filterRender = column ? column.filterRender : null;
|
|
32
|
+
const compConf = filterRender && isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
|
|
33
|
+
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
34
|
+
if (!headerScrollElem) {
|
|
35
|
+
return nextTick();
|
|
36
|
+
}
|
|
37
|
+
const tableFilter = refTableFilter.value;
|
|
38
|
+
const filterWrapperElem = tableFilter ? tableFilter.getRefMaps().refElem.value : null;
|
|
39
|
+
if (!filterWrapperElem) {
|
|
40
|
+
return nextTick();
|
|
41
|
+
}
|
|
42
|
+
const btnRect = currEl.getBoundingClientRect();
|
|
43
|
+
const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
|
|
44
|
+
const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
|
|
45
|
+
const filterWidth = filterWrapperElem.offsetWidth;
|
|
46
|
+
const centerWidth = currEl ? filterWidth / 2 : ((filterWidth - column.renderWidth) / 2);
|
|
47
|
+
let left = 0;
|
|
48
|
+
let top = 0;
|
|
49
|
+
let maxHeight = 0;
|
|
50
|
+
/**
|
|
51
|
+
* 是否显示筛选按钮图标
|
|
52
|
+
* 如果不存在图标,则相对单元格居中显示
|
|
53
|
+
*/
|
|
54
|
+
if (transfer) {
|
|
55
|
+
left = btnRect.left - centerWidth + scrollLeft;
|
|
56
|
+
top = btnRect.top + currEl.clientHeight + scrollTop;
|
|
57
|
+
maxHeight = Math.min(Math.max(tableRect.height, Math.floor(visibleHeight / 2)), Math.max(80, visibleHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 28));
|
|
58
|
+
if (left < 16) {
|
|
59
|
+
left = 16;
|
|
60
|
+
}
|
|
61
|
+
else if (left > (visibleWidth - filterWidth - 16)) {
|
|
62
|
+
left = visibleWidth - filterWidth - 16;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
left = btnRect.left - tableRect.left - centerWidth;
|
|
67
|
+
top = btnRect.top - tableRect.top + currEl.clientHeight;
|
|
68
|
+
maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
|
|
69
|
+
if (left < 1) {
|
|
70
|
+
left = 1;
|
|
71
|
+
}
|
|
72
|
+
else if (left > (tableEl.clientWidth - filterWidth - 1)) {
|
|
73
|
+
left = tableEl.clientWidth - filterWidth - 1;
|
|
74
|
+
}
|
|
75
|
+
if ($xeGGWrapper) {
|
|
76
|
+
const wrapperEl = $xeGGWrapper.getRefMaps().refElem.value;
|
|
77
|
+
if (wrapperEl) {
|
|
78
|
+
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
79
|
+
top += tableRect.top - wrapperRect.top;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const fStys = {
|
|
84
|
+
top: toCssUnit(top),
|
|
85
|
+
left: toCssUnit(left)
|
|
86
|
+
};
|
|
87
|
+
if (zIndex) {
|
|
88
|
+
fStys.zIndex = zIndex;
|
|
89
|
+
}
|
|
90
|
+
filterStore.style = fStys;
|
|
91
|
+
// 筛选面板是自适应表格高度
|
|
92
|
+
if (compConf ? !compConf.tableFilterAutoHeight : false) {
|
|
93
|
+
maxHeight = 0;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
if (customMaxHeight) {
|
|
97
|
+
maxHeight = customMaxHeight > maxHeight ? maxHeight : customMaxHeight;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// 判断面板不能大于表格高度
|
|
101
|
+
filterStore.maxHeight = maxHeight;
|
|
102
|
+
return nextTick();
|
|
103
|
+
};
|
|
18
104
|
const filterPrivateMethods = {
|
|
19
105
|
checkFilterOptions() {
|
|
20
106
|
const { filterStore } = reactData;
|
|
@@ -27,96 +113,21 @@ hooks.add('tableFilterModule', {
|
|
|
27
113
|
},
|
|
28
114
|
handleOpenFilterColumn(evnt, btnEl, colEl, column, params) {
|
|
29
115
|
const { initStore, filterStore } = reactData;
|
|
30
|
-
const { elemStore } = internalData;
|
|
31
116
|
if (filterStore.column === column && filterStore.visible) {
|
|
32
117
|
filterStore.visible = false;
|
|
33
118
|
}
|
|
34
119
|
else {
|
|
35
|
-
const tableEl = refElem.value;
|
|
36
|
-
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode();
|
|
37
|
-
const filterOpts = computeFilterOpts.value;
|
|
38
|
-
const { maxHeight: customMaxHeight, transfer, zIndex } = filterOpts;
|
|
39
120
|
const currEl = btnEl || colEl;
|
|
40
|
-
const tableRect = tableEl.getBoundingClientRect();
|
|
41
|
-
const filterRender = column ? column.filterRender : null;
|
|
42
|
-
const compConf = filterRender && isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
|
|
43
121
|
$xeTable.handleFilterOptions(column);
|
|
44
122
|
internalData._currFilterParams = params;
|
|
123
|
+
filterStore.targetEl = currEl;
|
|
45
124
|
filterStore.style = null;
|
|
46
125
|
filterStore.visible = true;
|
|
47
126
|
initStore.filter = true;
|
|
48
|
-
nextTick(() => {
|
|
49
|
-
const headerScrollElem = getRefElem(elemStore['main-header-scroll']);
|
|
50
|
-
if (!headerScrollElem) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const tableFilter = refTableFilter.value;
|
|
54
|
-
const filterWrapperElem = tableFilter ? tableFilter.getRefMaps().refElem.value : null;
|
|
55
|
-
if (!filterWrapperElem) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const btnRect = currEl.getBoundingClientRect();
|
|
59
|
-
const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
|
|
60
|
-
const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
|
|
61
|
-
const filterWidth = filterWrapperElem.offsetWidth;
|
|
62
|
-
const centerWidth = btnEl ? filterWidth / 2 : ((filterWidth - column.renderWidth) / 2);
|
|
63
|
-
let left = 0;
|
|
64
|
-
let top = 0;
|
|
65
|
-
let maxHeight = 0;
|
|
66
|
-
/**
|
|
67
|
-
* 是否显示筛选按钮图标
|
|
68
|
-
* 如果不存在图标,则相对单元格居中显示
|
|
69
|
-
*/
|
|
70
|
-
if (transfer) {
|
|
71
|
-
left = btnRect.left - centerWidth + scrollLeft;
|
|
72
|
-
top = btnRect.top + currEl.clientHeight + scrollTop;
|
|
73
|
-
maxHeight = Math.min(Math.max(tableRect.height, Math.floor(visibleHeight / 2)), Math.max(80, visibleHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 28));
|
|
74
|
-
if (left < 16) {
|
|
75
|
-
left = 16;
|
|
76
|
-
}
|
|
77
|
-
else if (left > (visibleWidth - filterWidth - 16)) {
|
|
78
|
-
left = visibleWidth - filterWidth - 16;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
left = btnRect.left - tableRect.left - centerWidth;
|
|
83
|
-
top = btnRect.top - tableRect.top + currEl.clientHeight;
|
|
84
|
-
maxHeight = Math.max(40, tableEl.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
|
|
85
|
-
if (left < 1) {
|
|
86
|
-
left = 1;
|
|
87
|
-
}
|
|
88
|
-
else if (left > (tableEl.clientWidth - filterWidth - 1)) {
|
|
89
|
-
left = tableEl.clientWidth - filterWidth - 1;
|
|
90
|
-
}
|
|
91
|
-
if ($xeGGWrapper) {
|
|
92
|
-
const wrapperEl = $xeGGWrapper.getRefMaps().refElem.value;
|
|
93
|
-
if (wrapperEl) {
|
|
94
|
-
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
95
|
-
top += tableRect.top - wrapperRect.top;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const fStys = {
|
|
100
|
-
top: toCssUnit(top),
|
|
101
|
-
left: toCssUnit(left)
|
|
102
|
-
};
|
|
103
|
-
if (zIndex) {
|
|
104
|
-
fStys.zIndex = zIndex;
|
|
105
|
-
}
|
|
106
|
-
filterStore.style = fStys;
|
|
107
|
-
// 筛选面板是自适应表格高度
|
|
108
|
-
if (compConf ? !compConf.tableFilterAutoHeight : false) {
|
|
109
|
-
maxHeight = 0;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
if (customMaxHeight) {
|
|
113
|
-
maxHeight = customMaxHeight > maxHeight ? maxHeight : customMaxHeight;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
// 判断面板不能大于表格高度
|
|
117
|
-
filterStore.maxHeight = maxHeight;
|
|
118
|
-
});
|
|
119
127
|
}
|
|
128
|
+
nextTick(() => {
|
|
129
|
+
updatePopupStyle();
|
|
130
|
+
});
|
|
120
131
|
$xeTable.dispatchEvent('filter-visible', { column, field: column.field, property: column.field, filterList: $xeTable.getCheckedFilters(), visible: filterStore.visible }, evnt);
|
|
121
132
|
},
|
|
122
133
|
/**
|
|
@@ -274,6 +285,13 @@ hooks.add('tableFilterModule', {
|
|
|
274
285
|
$xeTable.dispatchEvent('clear-filter', { filterList: [] }, evnt);
|
|
275
286
|
}
|
|
276
287
|
}
|
|
288
|
+
},
|
|
289
|
+
handleFilterStyle() {
|
|
290
|
+
const { filterStore } = reactData;
|
|
291
|
+
if (!filterStore.visible) {
|
|
292
|
+
return nextTick();
|
|
293
|
+
}
|
|
294
|
+
return updatePopupStyle();
|
|
277
295
|
}
|
|
278
296
|
};
|
|
279
297
|
const filterMethods = {
|
package/es/table/src/table.js
CHANGED
|
@@ -8414,6 +8414,11 @@ export default defineVxeComponent({
|
|
|
8414
8414
|
}
|
|
8415
8415
|
};
|
|
8416
8416
|
const handleGlobalScrollEvent = (evnt) => {
|
|
8417
|
+
const { filterStore } = reactData;
|
|
8418
|
+
const filterOpts = computeFilterOpts.value;
|
|
8419
|
+
if (filterStore.visible && filterOpts.transfer) {
|
|
8420
|
+
$xeTable.handleFilterStyle();
|
|
8421
|
+
}
|
|
8417
8422
|
reUpdateCustomStyleEvent(evnt);
|
|
8418
8423
|
};
|
|
8419
8424
|
/**
|
package/es/table/src/util.js
CHANGED
package/es/ui/index.js
CHANGED
package/es/ui/src/dom.js
CHANGED
|
@@ -15,7 +15,7 @@ export function getTpImg() {
|
|
|
15
15
|
return tpImgEl;
|
|
16
16
|
}
|
|
17
17
|
export function getPropClass(property, params) {
|
|
18
|
-
return property ? XEUtils.isFunction(property) ? property(params) : property : '';
|
|
18
|
+
return property ? (XEUtils.isFunction(property) ? property(params) : property) || '' : '';
|
|
19
19
|
}
|
|
20
20
|
function getClsRE(cls) {
|
|
21
21
|
if (!reClsMap[cls]) {
|
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.21.
|
|
3
|
+
const tableVersion = `table v${"4.21.3"}`;
|
|
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}` : '';
|