vxe-table 4.14.0-beta.0 → 4.14.0-beta.2
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/README.en.md +2 -1
- package/README.ja-JP.md +2 -1
- package/README.md +4 -2
- package/README.zh-TW.md +2 -1
- package/es/grid/src/grid.js +127 -94
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/hook.js +0 -4
- package/es/table/module/custom/panel.js +0 -1
- package/es/table/module/keyboard/hook.js +2 -2
- package/es/table/src/anime.js +46 -0
- package/es/table/src/body.js +9 -24
- package/es/table/src/columnInfo.js +5 -0
- package/es/table/src/footer.js +5 -22
- package/es/table/src/header.js +4 -21
- package/es/table/src/table.js +562 -358
- package/es/table/src/util.js +1 -1
- package/es/table/style.css +8 -8
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +8 -8
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +143 -98
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +255 -208
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/hook.js +0 -4
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/custom/panel.js +0 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +2 -2
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/anime.js +56 -0
- package/lib/table/src/anime.min.js +1 -0
- package/lib/table/src/body.js +3 -26
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +5 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +2 -20
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -19
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +47 -34
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +2 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +8 -8
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +3 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +8 -8
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/grid/src/grid.ts +136 -101
- package/packages/table/module/custom/hook.ts +0 -4
- package/packages/table/module/custom/panel.ts +0 -1
- package/packages/table/module/keyboard/hook.ts +2 -2
- package/packages/table/src/anime.ts +52 -0
- package/packages/table/src/body.ts +15 -38
- package/packages/table/src/columnInfo.ts +5 -0
- package/packages/table/src/footer.ts +5 -22
- package/packages/table/src/header.ts +4 -21
- package/packages/table/src/table.ts +570 -361
- package/packages/table/src/util.ts +1 -1
- package/packages/ui/index.ts +2 -1
- package/styles/components/table.scss +9 -9
- /package/es/{iconfont.1750770364548.ttf → iconfont.1751195167653.ttf} +0 -0
- /package/es/{iconfont.1750770364548.woff → iconfont.1751195167653.woff} +0 -0
- /package/es/{iconfont.1750770364548.woff2 → iconfont.1751195167653.woff2} +0 -0
- /package/lib/{iconfont.1750770364548.ttf → iconfont.1751195167653.ttf} +0 -0
- /package/lib/{iconfont.1750770364548.woff → iconfont.1751195167653.woff} +0 -0
- /package/lib/{iconfont.1750770364548.woff2 → iconfont.1751195167653.woff2} +0 -0
package/README.en.md
CHANGED
|
@@ -63,7 +63,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
|
|
63
63
|
* [x] Virtual scroll
|
|
64
64
|
* [x] Virtual merger
|
|
65
65
|
* [x] CSS Variable Theme
|
|
66
|
-
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/))
|
|
66
|
+
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/)) Grouping summary
|
|
67
|
+
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/)) Aggregation
|
|
67
68
|
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/)) Cell area selection
|
|
68
69
|
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/)) Cell copy & paste
|
|
69
70
|
* [x] ([Enterprise](https://vxetable.cn/pluginDocs/)) Cell find and replace
|
package/README.ja-JP.md
CHANGED
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
* [x] 仮想スクロール
|
|
64
64
|
* [x] 仮想マージ
|
|
65
65
|
* [x] CSS変数テーマ
|
|
66
|
-
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/))
|
|
66
|
+
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/)) 数据汇总
|
|
67
|
+
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/)) 聚合函数
|
|
67
68
|
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/)) セル領域選択
|
|
68
69
|
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/)) セルのコピー&ペースト
|
|
69
70
|
* [x] ([エンタープライズ](https://vxetable.cn/pluginDocs/)) セルの検索と置換
|
package/README.md
CHANGED
|
@@ -30,12 +30,14 @@
|
|
|
30
30
|
* [x] v3.13 重构展开行功能,同时支持展开行与虚拟渲染和冻结列
|
|
31
31
|
* [x] v3.14 重构虚拟渲染,支持百万级数据渲染、渲染性能及流畅度大幅提升
|
|
32
32
|
* [x] v3.15 优化虚拟渲染,提升 Chrome、Safari、Firefox 流畅度极兼容性
|
|
33
|
+
* [x] v3.16 重构虚拟渲染,提高渲染与拖拽效果流畅度
|
|
33
34
|
* **V4**
|
|
34
35
|
* [x] ~~v4.0 基于 vue3.2+,只支持现代浏览器,不支持 IE(2020-03-01 ~ 2024-12-01 已停止维护)~~
|
|
35
36
|
* [x] v4.7 基于 vue3.2+,内部重构,拆分 Table 库和 UI 库,只支持现代浏览器,不支持 IE
|
|
36
37
|
* [x] v4.11 重构展开行功能,同时支持展开行与虚拟渲染和冻结列
|
|
37
38
|
* [x] v4.12 重构虚拟渲染,支持百万级数据渲染、渲染性能及流畅度大幅提升
|
|
38
39
|
* [x] v4.13 优化虚拟渲染,提升 Chrome、Safari、Firefox 流畅度极兼容性
|
|
40
|
+
* [x] v4.14 重构虚拟渲染,提高渲染与拖拽效果流畅度
|
|
39
41
|
* 版本计划
|
|
40
42
|
* [ ] 优化展开行与冻结列
|
|
41
43
|
* [ ] 优化虚拟渲染,支持千万级数据渲染
|
|
@@ -102,8 +104,8 @@
|
|
|
102
104
|
* [x] 虚拟滚动
|
|
103
105
|
* [x] 虚拟合并
|
|
104
106
|
* [x] CSS 变量主题
|
|
105
|
-
* [x] ([企业版](https://vxetable.cn/pluginDocs/))
|
|
106
|
-
* [x] ([企业版](https://vxetable.cn/pluginDocs/))
|
|
107
|
+
* [x] ([企业版](https://vxetable.cn/pluginDocs/)) 数据汇总
|
|
108
|
+
* [x] ([企业版](https://vxetable.cn/pluginDocs/)) 聚合函数
|
|
107
109
|
* [x] ([企业版](https://vxetable.cn/pluginDocs/)) 单元格区域选取
|
|
108
110
|
* [x] ([企业版](https://vxetable.cn/pluginDocs/)) 单元格复制/粘贴
|
|
109
111
|
* [x] ([企业版](https://vxetable.cn/pluginDocs/)) 单元格查找和替换
|
package/README.zh-TW.md
CHANGED
|
@@ -62,7 +62,8 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
|
|
|
62
62
|
* [x] 虛擬滾動
|
|
63
63
|
* [x] 虛擬合併
|
|
64
64
|
* [x] CSS 變量主題
|
|
65
|
-
* [x] ([企業版](https://vxetable.cn/pluginDocs/))
|
|
65
|
+
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 数据汇总
|
|
66
|
+
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 聚合函数
|
|
66
67
|
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格區域選取
|
|
67
68
|
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格複製/粘貼
|
|
68
69
|
* [x] ([企業版](https://vxetable.cn/pluginDocs/)) 儲存格查找和替換
|
package/es/grid/src/grid.js
CHANGED
|
@@ -9,7 +9,7 @@ import VxeToolbarComponent from '../../toolbar/src/toolbar';
|
|
|
9
9
|
import tableComponentProps from '../../table/src/props';
|
|
10
10
|
import tableComponentEmits from '../../table/src/emits';
|
|
11
11
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
12
|
-
import { errLog } from '../../ui/src/log';
|
|
12
|
+
import { warnLog, errLog } from '../../ui/src/log';
|
|
13
13
|
const { getConfig, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI;
|
|
14
14
|
const tableComponentPropKeys = Object.keys(tableComponentProps);
|
|
15
15
|
const tableComponentMethodKeys = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isRemoveByRow', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeRowChildren', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'hasPendingByRow', 'isPendingByRow', 'getPendingRecords', 'clearPendingRow', 'sort', 'setSort', 'clearSort', 'clearSortByEvent', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'clearFilterByEvent', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'setRowGroupExpand', 'setAllRowGroupExpand', 'clearRowGroupExpand', 'isRowGroupExpandByRow', 'isRowGroupRecord', 'isAggregateRecord', 'isAggregateExpandByRow', 'getAggregateContentByRow', 'getAggregateRowChildren', 'setRowGroups', 'clearRowGroups', 'openTooltip', 'moveColumnTo', 'moveRowTo', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect'];
|
|
@@ -95,11 +95,11 @@ export default defineVxeComponent({
|
|
|
95
95
|
});
|
|
96
96
|
const computeIsRespMsg = computed(() => {
|
|
97
97
|
const proxyOpts = computeProxyOpts.value;
|
|
98
|
-
return XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg;
|
|
98
|
+
return !!(XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg);
|
|
99
99
|
});
|
|
100
100
|
const computeIsActiveMsg = computed(() => {
|
|
101
101
|
const proxyOpts = computeProxyOpts.value;
|
|
102
|
-
return proxyOpts.showActiveMsg;
|
|
102
|
+
return !!proxyOpts.showActiveMsg;
|
|
103
103
|
});
|
|
104
104
|
const computePagerOpts = computed(() => {
|
|
105
105
|
return Object.assign({}, getConfig().grid.pagerConfig, props.pagerConfig);
|
|
@@ -139,11 +139,12 @@ export default defineVxeComponent({
|
|
|
139
139
|
return rest;
|
|
140
140
|
});
|
|
141
141
|
const computeTableProps = computed(() => {
|
|
142
|
-
const { seqConfig, pagerConfig,
|
|
143
|
-
const { isZMax,
|
|
142
|
+
const { seqConfig, pagerConfig, editConfig, proxyConfig } = props;
|
|
143
|
+
const { isZMax, tablePage } = reactData;
|
|
144
144
|
const tableExtendProps = computeTableExtendProps.value;
|
|
145
145
|
const proxyOpts = computeProxyOpts.value;
|
|
146
146
|
const pagerOpts = computePagerOpts.value;
|
|
147
|
+
const isLoading = computeIsLoading.value;
|
|
147
148
|
const tProps = Object.assign({}, tableExtendProps);
|
|
148
149
|
if (isZMax) {
|
|
149
150
|
if (tableExtendProps.maxHeight) {
|
|
@@ -154,7 +155,7 @@ export default defineVxeComponent({
|
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
157
|
-
tProps.loading =
|
|
158
|
+
tProps.loading = isLoading;
|
|
158
159
|
if (pagerConfig && proxyOpts.seq && isEnableConf(pagerOpts)) {
|
|
159
160
|
tProps.seqConfig = Object.assign({}, seqConfig, { startIndex: (tablePage.currentPage - 1) * tablePage.pageSize });
|
|
160
161
|
}
|
|
@@ -204,6 +205,13 @@ export default defineVxeComponent({
|
|
|
204
205
|
const pagerOpts = computePagerOpts.value;
|
|
205
206
|
return pagerOpts.total;
|
|
206
207
|
});
|
|
208
|
+
const computeIsLoading = computed(() => {
|
|
209
|
+
const { loading, proxyConfig } = props;
|
|
210
|
+
const { tableLoading } = reactData;
|
|
211
|
+
const proxyOpts = computeProxyOpts.value;
|
|
212
|
+
const { showLoading } = proxyOpts;
|
|
213
|
+
return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts));
|
|
214
|
+
});
|
|
207
215
|
const refMaps = {
|
|
208
216
|
refElem,
|
|
209
217
|
refTable,
|
|
@@ -346,12 +354,12 @@ export default defineVxeComponent({
|
|
|
346
354
|
reactData.sortData = params.sortList;
|
|
347
355
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
348
356
|
reactData.tablePage.currentPage = 1;
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
358
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event);
|
|
351
359
|
});
|
|
352
360
|
}
|
|
353
361
|
}
|
|
354
|
-
|
|
362
|
+
$xeGrid.dispatchEvent('sort-change', params, params.$event);
|
|
355
363
|
};
|
|
356
364
|
const filterChangeEvent = (params) => {
|
|
357
365
|
const $xeTable = refTable.value;
|
|
@@ -364,12 +372,12 @@ export default defineVxeComponent({
|
|
|
364
372
|
reactData.filterData = params.filterList;
|
|
365
373
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
366
374
|
reactData.tablePage.currentPage = 1;
|
|
367
|
-
|
|
368
|
-
|
|
375
|
+
$xeGrid.commitProxy('query').then((rest) => {
|
|
376
|
+
$xeGrid.dispatchEvent('proxy-query', rest, params.$event);
|
|
369
377
|
});
|
|
370
378
|
}
|
|
371
379
|
}
|
|
372
|
-
|
|
380
|
+
$xeGrid.dispatchEvent('filter-change', params, params.$event);
|
|
373
381
|
};
|
|
374
382
|
const submitFormEvent = (params) => {
|
|
375
383
|
const { proxyConfig } = props;
|
|
@@ -378,32 +386,32 @@ export default defineVxeComponent({
|
|
|
378
386
|
return;
|
|
379
387
|
}
|
|
380
388
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
381
|
-
|
|
382
|
-
|
|
389
|
+
$xeGrid.commitProxy('reload').then((rest) => {
|
|
390
|
+
$xeGrid.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isReload: true }), params.$event);
|
|
383
391
|
});
|
|
384
392
|
}
|
|
385
|
-
|
|
393
|
+
$xeGrid.dispatchEvent('form-submit', params, params.$event);
|
|
386
394
|
};
|
|
387
395
|
const resetFormEvent = (params) => {
|
|
396
|
+
const $xeTable = refTable.value;
|
|
388
397
|
const { proxyConfig } = props;
|
|
389
398
|
const { $event } = params;
|
|
390
399
|
const proxyOpts = computeProxyOpts.value;
|
|
391
|
-
const $xeTable = refTable.value;
|
|
392
400
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
393
401
|
$xeTable.clearScroll();
|
|
394
|
-
|
|
395
|
-
|
|
402
|
+
$xeGrid.commitProxy('reload').then((rest) => {
|
|
403
|
+
$xeGrid.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isReload: true }), $event);
|
|
396
404
|
});
|
|
397
405
|
}
|
|
398
|
-
|
|
406
|
+
$xeGrid.dispatchEvent('form-reset', params, $event);
|
|
399
407
|
};
|
|
400
408
|
const submitInvalidEvent = (params) => {
|
|
401
|
-
|
|
409
|
+
$xeGrid.dispatchEvent('form-submit-invalid', params, params.$event);
|
|
402
410
|
};
|
|
403
411
|
const collapseEvent = (params) => {
|
|
404
412
|
const { $event } = params;
|
|
405
|
-
|
|
406
|
-
|
|
413
|
+
$xeGrid.dispatchEvent('form-toggle-collapse', params, $event);
|
|
414
|
+
$xeGrid.dispatchEvent('form-collapse', params, $event);
|
|
407
415
|
};
|
|
408
416
|
const handleZoom = (isMax) => {
|
|
409
417
|
const { isZMax } = reactData;
|
|
@@ -414,9 +422,9 @@ export default defineVxeComponent({
|
|
|
414
422
|
}
|
|
415
423
|
}
|
|
416
424
|
return nextTick()
|
|
417
|
-
.then(() =>
|
|
425
|
+
.then(() => $xeGrid.recalculate(true))
|
|
418
426
|
.then(() => {
|
|
419
|
-
setTimeout(() =>
|
|
427
|
+
setTimeout(() => $xeGrid.recalculate(true), 15);
|
|
420
428
|
return reactData.isZMax;
|
|
421
429
|
});
|
|
422
430
|
};
|
|
@@ -560,12 +568,13 @@ export default defineVxeComponent({
|
|
|
560
568
|
* 渲染表格顶部区域
|
|
561
569
|
*/
|
|
562
570
|
const renderTop = () => {
|
|
563
|
-
|
|
571
|
+
const topSlot = slots.top;
|
|
572
|
+
if (topSlot) {
|
|
564
573
|
return h('div', {
|
|
565
574
|
ref: refTopWrapper,
|
|
566
575
|
key: 'top',
|
|
567
576
|
class: 'vxe-grid--top-wrapper'
|
|
568
|
-
},
|
|
577
|
+
}, topSlot({ $grid: $xeGrid }));
|
|
569
578
|
}
|
|
570
579
|
return renderEmptyElement($xeGrid);
|
|
571
580
|
};
|
|
@@ -734,6 +743,30 @@ export default defineVxeComponent({
|
|
|
734
743
|
const type = XEUtils.camelCase(`on-${name}`);
|
|
735
744
|
tableCompEvents[type] = (...args) => emit(name, ...args);
|
|
736
745
|
});
|
|
746
|
+
const getDefaultFormData = () => {
|
|
747
|
+
const formOpts = computeFormOpts.value;
|
|
748
|
+
if (formOpts.items) {
|
|
749
|
+
const fData = {};
|
|
750
|
+
formOpts.items.forEach(item => {
|
|
751
|
+
const { field, itemRender } = item;
|
|
752
|
+
if (field) {
|
|
753
|
+
let itemValue = null;
|
|
754
|
+
if (itemRender) {
|
|
755
|
+
const { defaultValue } = itemRender;
|
|
756
|
+
if (XEUtils.isFunction(defaultValue)) {
|
|
757
|
+
itemValue = defaultValue({ item });
|
|
758
|
+
}
|
|
759
|
+
else if (!XEUtils.isUndefined(defaultValue)) {
|
|
760
|
+
itemValue = defaultValue;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
fData[field] = itemValue;
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
return fData;
|
|
767
|
+
}
|
|
768
|
+
return {};
|
|
769
|
+
};
|
|
737
770
|
const initProxy = () => {
|
|
738
771
|
const { proxyConfig, formConfig } = props;
|
|
739
772
|
const { proxyInited } = reactData;
|
|
@@ -741,30 +774,13 @@ export default defineVxeComponent({
|
|
|
741
774
|
const formOpts = computeFormOpts.value;
|
|
742
775
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
743
776
|
if (formConfig && isEnableConf(formOpts) && proxyOpts.form && formOpts.items) {
|
|
744
|
-
|
|
745
|
-
formOpts.items.forEach(item => {
|
|
746
|
-
const { field, itemRender } = item;
|
|
747
|
-
if (field) {
|
|
748
|
-
let itemValue = null;
|
|
749
|
-
if (itemRender) {
|
|
750
|
-
const { defaultValue } = itemRender;
|
|
751
|
-
if (XEUtils.isFunction(defaultValue)) {
|
|
752
|
-
itemValue = defaultValue({ item });
|
|
753
|
-
}
|
|
754
|
-
else if (!XEUtils.isUndefined(defaultValue)) {
|
|
755
|
-
itemValue = defaultValue;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
fData[field] = itemValue;
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
reactData.formData = fData;
|
|
777
|
+
reactData.formData = getDefaultFormData();
|
|
762
778
|
}
|
|
763
779
|
if (!proxyInited) {
|
|
764
780
|
reactData.proxyInited = true;
|
|
765
781
|
if (proxyOpts.autoLoad !== false) {
|
|
766
|
-
nextTick().then(() => gridMethods.commitProxy('
|
|
767
|
-
gridMethods.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isInited: true }), new Event('
|
|
782
|
+
nextTick().then(() => gridMethods.commitProxy('initial')).then((rest) => {
|
|
783
|
+
gridMethods.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isInited: true }), new Event('initial'));
|
|
768
784
|
});
|
|
769
785
|
}
|
|
770
786
|
}
|
|
@@ -774,7 +790,7 @@ export default defineVxeComponent({
|
|
|
774
790
|
const zoomOpts = computeZoomOpts.value;
|
|
775
791
|
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
|
|
776
792
|
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
777
|
-
|
|
793
|
+
$xeGrid.triggerZoomEvent(evnt);
|
|
778
794
|
}
|
|
779
795
|
};
|
|
780
796
|
const dispatchEvent = (type, params, evnt) => {
|
|
@@ -790,7 +806,7 @@ export default defineVxeComponent({
|
|
|
790
806
|
* @param {String/Object} code 字符串或对象
|
|
791
807
|
*/
|
|
792
808
|
commitProxy(proxyTarget, ...args) {
|
|
793
|
-
const { toolbarConfig, pagerConfig, editRules, validConfig } = props;
|
|
809
|
+
const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props;
|
|
794
810
|
const { tablePage } = reactData;
|
|
795
811
|
const isActiveMsg = computeIsActiveMsg.value;
|
|
796
812
|
const isRespMsg = computeIsRespMsg.value;
|
|
@@ -800,7 +816,7 @@ export default defineVxeComponent({
|
|
|
800
816
|
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
|
|
801
817
|
const resConfigs = proxyOpts.response || proxyOpts.props || {};
|
|
802
818
|
const $xeTable = refTable.value;
|
|
803
|
-
|
|
819
|
+
let formData = getFormData();
|
|
804
820
|
let button = null;
|
|
805
821
|
let code = null;
|
|
806
822
|
if (XEUtils.isString(proxyTarget)) {
|
|
@@ -842,14 +858,14 @@ export default defineVxeComponent({
|
|
|
842
858
|
break;
|
|
843
859
|
case 'reset_custom':
|
|
844
860
|
return $xeTable.resetCustom(true);
|
|
845
|
-
case '
|
|
861
|
+
case 'initial':
|
|
846
862
|
case 'reload':
|
|
847
863
|
case 'query': {
|
|
848
864
|
const ajaxMethods = ajax.query;
|
|
849
865
|
const querySuccessMethods = ajax.querySuccess;
|
|
850
866
|
const queryErrorMethods = ajax.queryError;
|
|
851
867
|
if (ajaxMethods) {
|
|
852
|
-
const isInited = code === '
|
|
868
|
+
const isInited = code === 'initial';
|
|
853
869
|
const isReload = code === 'reload';
|
|
854
870
|
if (!isInited && reactData.tableLoading) {
|
|
855
871
|
return nextTick();
|
|
@@ -859,6 +875,7 @@ export default defineVxeComponent({
|
|
|
859
875
|
let pageParams = {};
|
|
860
876
|
if (pagerConfig) {
|
|
861
877
|
if (isInited || isReload) {
|
|
878
|
+
// 重置分页
|
|
862
879
|
tablePage.currentPage = 1;
|
|
863
880
|
}
|
|
864
881
|
if (isEnableConf(pagerOpts)) {
|
|
@@ -866,26 +883,41 @@ export default defineVxeComponent({
|
|
|
866
883
|
}
|
|
867
884
|
}
|
|
868
885
|
if (isInited) {
|
|
869
|
-
|
|
886
|
+
// 重置代理表单数据
|
|
887
|
+
if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
|
|
888
|
+
formData = getDefaultFormData();
|
|
889
|
+
reactData.formData = formData;
|
|
890
|
+
}
|
|
870
891
|
if ($xeTable) {
|
|
892
|
+
const tableInternalData = $xeTable.internalData;
|
|
893
|
+
const { tableFullColumn, fullColumnFieldData } = tableInternalData;
|
|
871
894
|
const { computeSortOpts } = $xeTable.getComputeMaps();
|
|
872
895
|
const sortOpts = computeSortOpts.value;
|
|
873
|
-
defaultSort = sortOpts.defaultSort;
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
if (defaultSort) {
|
|
877
|
-
if (!XEUtils.isArray(defaultSort)) {
|
|
878
|
-
defaultSort = [defaultSort];
|
|
879
|
-
}
|
|
880
|
-
sortList = defaultSort.map((item) => {
|
|
881
|
-
return {
|
|
882
|
-
field: item.field,
|
|
883
|
-
property: item.field,
|
|
884
|
-
order: item.order
|
|
885
|
-
};
|
|
896
|
+
let defaultSort = sortOpts.defaultSort;
|
|
897
|
+
tableFullColumn.forEach((column) => {
|
|
898
|
+
column.order = null;
|
|
886
899
|
});
|
|
887
|
-
|
|
888
|
-
|
|
900
|
+
// 如果使用默认排序
|
|
901
|
+
if (defaultSort) {
|
|
902
|
+
if (!XEUtils.isArray(defaultSort)) {
|
|
903
|
+
defaultSort = [defaultSort];
|
|
904
|
+
}
|
|
905
|
+
sortList = defaultSort.map((item) => {
|
|
906
|
+
const { field, order } = item;
|
|
907
|
+
const colRest = fullColumnFieldData[field];
|
|
908
|
+
if (colRest) {
|
|
909
|
+
const column = colRest.column;
|
|
910
|
+
if (column) {
|
|
911
|
+
column.order = order;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return {
|
|
915
|
+
field,
|
|
916
|
+
property: field,
|
|
917
|
+
order
|
|
918
|
+
};
|
|
919
|
+
});
|
|
920
|
+
}
|
|
889
921
|
filterList = $xeTable.getCheckedFilters();
|
|
890
922
|
}
|
|
891
923
|
}
|
|
@@ -1222,23 +1254,23 @@ export default defineVxeComponent({
|
|
|
1222
1254
|
},
|
|
1223
1255
|
triggerToolbarCommitEvent(params, evnt) {
|
|
1224
1256
|
const { code } = params;
|
|
1225
|
-
return
|
|
1257
|
+
return $xeGrid.commitProxy(params, evnt).then((rest) => {
|
|
1226
1258
|
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1227
|
-
|
|
1259
|
+
$xeGrid.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', Object.assign(Object.assign({}, rest), { isReload: code === 'reload' }), evnt);
|
|
1228
1260
|
}
|
|
1229
1261
|
});
|
|
1230
1262
|
},
|
|
1231
1263
|
triggerToolbarBtnEvent(button, evnt) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1264
|
+
$xeGrid.triggerToolbarCommitEvent(button, evnt);
|
|
1265
|
+
$xeGrid.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt);
|
|
1234
1266
|
},
|
|
1235
1267
|
triggerToolbarTolEvent(tool, evnt) {
|
|
1236
|
-
|
|
1237
|
-
|
|
1268
|
+
$xeGrid.triggerToolbarCommitEvent(tool, evnt);
|
|
1269
|
+
$xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt);
|
|
1238
1270
|
},
|
|
1239
1271
|
triggerZoomEvent(evnt) {
|
|
1240
|
-
|
|
1241
|
-
|
|
1272
|
+
$xeGrid.zoom();
|
|
1273
|
+
$xeGrid.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt);
|
|
1242
1274
|
}
|
|
1243
1275
|
};
|
|
1244
1276
|
Object.assign($xeGrid, gridExtendTableMethods, gridMethods, gridPrivateMethods, {
|
|
@@ -1266,6 +1298,22 @@ export default defineVxeComponent({
|
|
|
1266
1298
|
return $xeGrid.loadColumn(columns);
|
|
1267
1299
|
}
|
|
1268
1300
|
});
|
|
1301
|
+
const renderVN = () => {
|
|
1302
|
+
const vSize = computeSize.value;
|
|
1303
|
+
const styles = computeStyles.value;
|
|
1304
|
+
const isLoading = computeIsLoading.value;
|
|
1305
|
+
return h('div', {
|
|
1306
|
+
ref: refElem,
|
|
1307
|
+
class: ['vxe-grid', {
|
|
1308
|
+
[`size--${vSize}`]: vSize,
|
|
1309
|
+
'is--animat': !!props.animat,
|
|
1310
|
+
'is--round': props.round,
|
|
1311
|
+
'is--maximize': reactData.isZMax,
|
|
1312
|
+
'is--loading': isLoading
|
|
1313
|
+
}],
|
|
1314
|
+
style: styles
|
|
1315
|
+
}, renderLayout());
|
|
1316
|
+
};
|
|
1269
1317
|
const columnFlag = ref(0);
|
|
1270
1318
|
watch(() => props.columns ? props.columns.length : -1, () => {
|
|
1271
1319
|
columnFlag.value++;
|
|
@@ -1304,6 +1352,7 @@ export default defineVxeComponent({
|
|
|
1304
1352
|
onMounted(() => {
|
|
1305
1353
|
nextTick(() => {
|
|
1306
1354
|
const { columns } = props;
|
|
1355
|
+
const proxyOpts = computeProxyOpts.value;
|
|
1307
1356
|
if (props.formConfig) {
|
|
1308
1357
|
if (!VxeUIFormComponent) {
|
|
1309
1358
|
errLog('vxe.error.reqComp', ['vxe-form']);
|
|
@@ -1315,14 +1364,13 @@ export default defineVxeComponent({
|
|
|
1315
1364
|
}
|
|
1316
1365
|
}
|
|
1317
1366
|
// const { data, columns, proxyConfig } = props
|
|
1318
|
-
// const proxyOpts = computeProxyOpts.value
|
|
1319
1367
|
// const formOpts = computeFormOpts.value
|
|
1320
1368
|
// if (isEnableConf(proxyConfig) && (data || (proxyOpts.form && formOpts.data))) {
|
|
1321
1369
|
// errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
|
|
1322
1370
|
// }
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1371
|
+
if (proxyOpts.props) {
|
|
1372
|
+
warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response']);
|
|
1373
|
+
}
|
|
1326
1374
|
if (columns && columns.length) {
|
|
1327
1375
|
$xeGrid.loadColumn(columns);
|
|
1328
1376
|
}
|
|
@@ -1334,21 +1382,6 @@ export default defineVxeComponent({
|
|
|
1334
1382
|
onUnmounted(() => {
|
|
1335
1383
|
globalEvents.off($xeGrid, 'keydown');
|
|
1336
1384
|
});
|
|
1337
|
-
const renderVN = () => {
|
|
1338
|
-
const vSize = computeSize.value;
|
|
1339
|
-
const styles = computeStyles.value;
|
|
1340
|
-
return h('div', {
|
|
1341
|
-
ref: refElem,
|
|
1342
|
-
class: ['vxe-grid', {
|
|
1343
|
-
[`size--${vSize}`]: vSize,
|
|
1344
|
-
'is--animat': !!props.animat,
|
|
1345
|
-
'is--round': props.round,
|
|
1346
|
-
'is--maximize': reactData.isZMax,
|
|
1347
|
-
'is--loading': props.loading || reactData.tableLoading
|
|
1348
|
-
}],
|
|
1349
|
-
style: styles
|
|
1350
|
-
}, renderLayout());
|
|
1351
|
-
};
|
|
1352
1385
|
$xeGrid.renderVN = renderVN;
|
|
1353
1386
|
provide('$xeGrid', $xeGrid);
|
|
1354
1387
|
return $xeGrid;
|