vxe-table 4.7.10 → 4.7.12
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/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +12 -22
- package/es/table/src/header.js +1 -1
- package/es/table/src/table.js +125 -256
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +150 -327
- 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/panel.js +11 -26
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/header.js +1 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +137 -298
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +2 -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/package.json +2 -2
- package/packages/table/module/custom/panel.ts +12 -23
- package/packages/table/src/header.ts +1 -1
- package/packages/table/src/table.ts +124 -261
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.12",
|
|
4
4
|
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"style": "lib/style.css",
|
|
29
29
|
"typings": "types/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"vxe-pc-ui": "^4.0.
|
|
31
|
+
"vxe-pc-ui": "^4.0.10"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/resize-observer-browser": "^0.1.11",
|
|
@@ -19,7 +19,7 @@ export default defineComponent({
|
|
|
19
19
|
setup (props) {
|
|
20
20
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|
|
21
21
|
|
|
22
|
-
const {
|
|
22
|
+
const { reactData } = $xeTable
|
|
23
23
|
const { computeCustomOpts, computeColumnOpts, computeIsMaxFixedColumn } = $xeTable.getComputeMaps()
|
|
24
24
|
|
|
25
25
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
@@ -46,19 +46,6 @@ export default defineComponent({
|
|
|
46
46
|
}, 300)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const handleSaveStore = (type: 'confirm' | 'reset') => {
|
|
50
|
-
const { id } = tableProps
|
|
51
|
-
const customOpts = computeCustomOpts.value
|
|
52
|
-
const { storage, updateStore } = customOpts
|
|
53
|
-
if (storage && id && updateStore) {
|
|
54
|
-
updateStore({
|
|
55
|
-
id,
|
|
56
|
-
type,
|
|
57
|
-
storeData: $xeTable.getCustomStoreData()
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
49
|
const confirmCustomEvent = (evnt: Event) => {
|
|
63
50
|
const { customColumnList } = reactData
|
|
64
51
|
const customOpts = computeCustomOpts.value
|
|
@@ -77,6 +64,7 @@ export default defineComponent({
|
|
|
77
64
|
if (column.renderVisible && (!column.children || column.children.length)) {
|
|
78
65
|
if (column.renderResizeWidth !== column.renderWidth) {
|
|
79
66
|
column.resizeWidth = column.renderResizeWidth
|
|
67
|
+
column.renderWidth = column.renderResizeWidth
|
|
80
68
|
}
|
|
81
69
|
}
|
|
82
70
|
}
|
|
@@ -86,7 +74,7 @@ export default defineComponent({
|
|
|
86
74
|
})
|
|
87
75
|
$xeTable.closeCustom()
|
|
88
76
|
$xeTable.emitCustomEvent('confirm', evnt)
|
|
89
|
-
|
|
77
|
+
$xeTable.saveCustomStore('confirm')
|
|
90
78
|
}
|
|
91
79
|
|
|
92
80
|
const cancelCustomEvent = (evnt: Event) => {
|
|
@@ -122,7 +110,6 @@ export default defineComponent({
|
|
|
122
110
|
$xeTable.resetColumn(true)
|
|
123
111
|
$xeTable.closeCustom()
|
|
124
112
|
$xeTable.emitCustomEvent('reset', evnt)
|
|
125
|
-
handleSaveStore('reset')
|
|
126
113
|
}
|
|
127
114
|
|
|
128
115
|
const resetCustomEvent = (evnt: Event) => {
|
|
@@ -164,6 +151,7 @@ export default defineComponent({
|
|
|
164
151
|
handleOptionCheck(column)
|
|
165
152
|
if (customOpts.immediate) {
|
|
166
153
|
$xeTable.handleCustom()
|
|
154
|
+
$xeTable.saveCustomStore('update:visible')
|
|
167
155
|
}
|
|
168
156
|
$xeTable.checkCustomStatus()
|
|
169
157
|
}
|
|
@@ -497,8 +485,9 @@ export default defineComponent({
|
|
|
497
485
|
const { customStore } = props
|
|
498
486
|
const { customColumnList } = reactData
|
|
499
487
|
const customOpts = computeCustomOpts.value
|
|
500
|
-
const { allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
|
|
488
|
+
const { modalOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
|
|
501
489
|
const columnOpts = computeColumnOpts.value
|
|
490
|
+
const modalOpts = Object.assign({}, modalOptions)
|
|
502
491
|
const isMaxFixedColumn = computeIsMaxFixedColumn.value
|
|
503
492
|
const trVNs: VNode[] = []
|
|
504
493
|
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
@@ -617,13 +606,13 @@ export default defineComponent({
|
|
|
617
606
|
const isAllIndeterminate = customStore.isIndeterminate
|
|
618
607
|
return h(resolveComponent('vxe-modal') as VxeModalComponent, {
|
|
619
608
|
key: 'popup',
|
|
620
|
-
className: 'vxe-table-custom-popup-wrapper vxe-table--ignore-clear',
|
|
609
|
+
className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
|
|
621
610
|
modelValue: customStore.visible,
|
|
622
|
-
title: getI18n('vxe.custom.cstmTitle'),
|
|
623
|
-
width:
|
|
624
|
-
minWidth: 700,
|
|
625
|
-
height:
|
|
626
|
-
minHeight: 400,
|
|
611
|
+
title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
|
|
612
|
+
width: modalOpts.width || '50vw',
|
|
613
|
+
minWidth: modalOpts.minWidth || 700,
|
|
614
|
+
height: modalOpts.height || '50vh',
|
|
615
|
+
minHeight: modalOpts.minHeight || 400,
|
|
627
616
|
mask: true,
|
|
628
617
|
lockView: true,
|
|
629
618
|
showFooter: true,
|
|
@@ -116,7 +116,7 @@ export default defineComponent({
|
|
|
116
116
|
tableInternalData._lastResizeTime = Date.now()
|
|
117
117
|
$xeTable.analyColumnWidth()
|
|
118
118
|
$xeTable.recalculate(true).then(() => {
|
|
119
|
-
$xeTable.
|
|
119
|
+
$xeTable.saveCustomStore('update:visible')
|
|
120
120
|
$xeTable.updateCellAreas()
|
|
121
121
|
$xeTable.dispatchEvent('resizable-change', { ...params, resizeWidth }, evnt)
|
|
122
122
|
})
|
|
@@ -24,10 +24,7 @@ const { getConfig, getI18n, renderer, formats, createEvent, globalResize, interc
|
|
|
24
24
|
|
|
25
25
|
const isWebkit = browse['-webkit'] && !browse.edge
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE'
|
|
29
|
-
const fixedStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_FIXED'
|
|
30
|
-
const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT'
|
|
27
|
+
const customStorageKey = 'VXE_CUSTOM_STORE'
|
|
31
28
|
|
|
32
29
|
export default defineComponent({
|
|
33
30
|
name: 'VxeTable',
|
|
@@ -252,7 +249,8 @@ export default defineComponent({
|
|
|
252
249
|
isFooter: false
|
|
253
250
|
},
|
|
254
251
|
scrollVMLoading: false,
|
|
255
|
-
_isResize: false
|
|
252
|
+
_isResize: false,
|
|
253
|
+
_isLoading: false
|
|
256
254
|
})
|
|
257
255
|
|
|
258
256
|
const internalData: TableInternalData = {
|
|
@@ -680,10 +678,19 @@ export default defineComponent({
|
|
|
680
678
|
return orders[oIndex < orders.length ? oIndex : 0]
|
|
681
679
|
}
|
|
682
680
|
|
|
683
|
-
const getCustomStorageMap = (
|
|
681
|
+
const getCustomStorageMap = (id?: string) => {
|
|
684
682
|
const version = getConfig().version
|
|
685
|
-
const rest = XEUtils.toStringJSON(localStorage.getItem(
|
|
686
|
-
|
|
683
|
+
const rest = XEUtils.toStringJSON(localStorage.getItem(customStorageKey) || '')
|
|
684
|
+
const maps = rest && rest._v === version ? rest : { _v: version }
|
|
685
|
+
return (id ? maps[id] : maps) || {}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
const setCustomStorageMap = (id: string, data: any) => {
|
|
689
|
+
const version = getConfig().version
|
|
690
|
+
const maps = getCustomStorageMap()
|
|
691
|
+
maps[id] = data || undefined
|
|
692
|
+
maps._v = version
|
|
693
|
+
localStorage.setItem(customStorageKey, XEUtils.toJSONString(maps))
|
|
687
694
|
}
|
|
688
695
|
|
|
689
696
|
const getRecoverRowMaps = (keyMaps: Record<string, any>) => {
|
|
@@ -888,8 +895,9 @@ export default defineComponent({
|
|
|
888
895
|
/**
|
|
889
896
|
* 还原自定义列操作状态
|
|
890
897
|
*/
|
|
891
|
-
const restoreCustomStorage = () => {
|
|
898
|
+
const restoreCustomStorage = async () => {
|
|
892
899
|
const { id, customConfig } = props
|
|
900
|
+
const { tableFullColumn } = internalData
|
|
893
901
|
const customOpts = computeCustomOpts.value
|
|
894
902
|
const { storage, restoreStore } = customOpts
|
|
895
903
|
const isAllCustom = storage === true
|
|
@@ -898,119 +906,45 @@ export default defineComponent({
|
|
|
898
906
|
const isCustomVisible = isAllCustom || storageOpts.visible
|
|
899
907
|
const isCustomFixed = isAllCustom || storageOpts.fixed
|
|
900
908
|
const isCustomSort = isAllCustom || storageOpts.sort
|
|
901
|
-
if (storage && id && restoreStore) {
|
|
902
|
-
restoreStore({ id })
|
|
903
|
-
}
|
|
904
909
|
if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
|
|
905
|
-
const customMap: {
|
|
906
|
-
[key: string]: {
|
|
907
|
-
field?: VxeColumnPropTypes.Field
|
|
908
|
-
resizeWidth?: number
|
|
909
|
-
visible?: boolean
|
|
910
|
-
fixed?: string
|
|
911
|
-
renderSortNumber?: number
|
|
912
|
-
}
|
|
913
|
-
} = {}
|
|
914
910
|
if (!id) {
|
|
915
911
|
errLog('vxe.error.reqProp', ['id'])
|
|
916
912
|
return
|
|
917
913
|
}
|
|
918
|
-
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
if (columnWidthStorage) {
|
|
922
|
-
XEUtils.each(columnWidthStorage, (resizeWidth: number, colKey) => {
|
|
923
|
-
customMap[colKey] = { resizeWidth }
|
|
924
|
-
})
|
|
925
|
-
}
|
|
914
|
+
let storeData: VxeTableDefines.CustomStoreData = getCustomStorageMap(id)
|
|
915
|
+
if (restoreStore) {
|
|
916
|
+
storeData = await restoreStore({ id, type: 'restore', storeData })
|
|
926
917
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
const columnFixedStorage = getCustomStorageMap(fixedStorageKey)[id]
|
|
930
|
-
if (columnFixedStorage) {
|
|
931
|
-
const colFixeds = columnFixedStorage.split(',')
|
|
932
|
-
colFixeds.forEach((fixConf: any) => {
|
|
933
|
-
const [colKey, fixed] = fixConf.split('|')
|
|
934
|
-
if (customMap[colKey]) {
|
|
935
|
-
customMap[colKey].fixed = fixed
|
|
936
|
-
} else {
|
|
937
|
-
customMap[colKey] = { fixed }
|
|
938
|
-
}
|
|
939
|
-
})
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
// 自定义顺序
|
|
943
|
-
let hasCustomSort = false
|
|
944
|
-
if (isCustomSort) {
|
|
945
|
-
const columnSortStorage = getCustomStorageMap(sortStorageKey)[id]
|
|
946
|
-
if (columnSortStorage) {
|
|
947
|
-
XEUtils.each(columnSortStorage, (renderSortNumber: number, colKey) => {
|
|
948
|
-
if (customMap[colKey]) {
|
|
949
|
-
customMap[colKey].renderSortNumber = renderSortNumber
|
|
950
|
-
} else {
|
|
951
|
-
customMap[colKey] = { renderSortNumber }
|
|
952
|
-
}
|
|
953
|
-
if (!hasCustomSort) {
|
|
954
|
-
hasCustomSort = true
|
|
955
|
-
}
|
|
956
|
-
})
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
// 自定义隐藏列
|
|
960
|
-
if (isCustomVisible) {
|
|
961
|
-
const columnVisibleStorage = getCustomStorageMap(visibleStorageKey)[id]
|
|
962
|
-
if (columnVisibleStorage) {
|
|
963
|
-
const colVisibles = columnVisibleStorage.split('|')
|
|
964
|
-
const colHides: string[] = colVisibles[0] ? colVisibles[0].split(',') : []
|
|
965
|
-
const colShows: string[] = colVisibles[1] ? colVisibles[1].split(',') : []
|
|
966
|
-
colHides.forEach((colKey) => {
|
|
967
|
-
if (customMap[colKey]) {
|
|
968
|
-
customMap[colKey].visible = false
|
|
969
|
-
} else {
|
|
970
|
-
customMap[colKey] = { visible: false }
|
|
971
|
-
}
|
|
972
|
-
})
|
|
973
|
-
colShows.forEach((colKey) => {
|
|
974
|
-
if (customMap[colKey]) {
|
|
975
|
-
customMap[colKey].visible = true
|
|
976
|
-
} else {
|
|
977
|
-
customMap[colKey] = { visible: true }
|
|
978
|
-
}
|
|
979
|
-
})
|
|
980
|
-
}
|
|
918
|
+
if (!storeData) {
|
|
919
|
+
return
|
|
981
920
|
}
|
|
982
921
|
let { collectColumn } = internalData
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
})
|
|
992
|
-
XEUtils.each(customMap, ({ visible, resizeWidth, fixed, renderSortNumber }, colKey) => {
|
|
993
|
-
const column = keyMap[colKey]
|
|
994
|
-
if (column) {
|
|
995
|
-
if (XEUtils.isNumber(resizeWidth)) {
|
|
996
|
-
column.resizeWidth = resizeWidth
|
|
922
|
+
const { resizableData, sortData, visibleData, fixedData } = storeData
|
|
923
|
+
let hasCustomSort = false
|
|
924
|
+
// 处理还原
|
|
925
|
+
if (resizableData || sortData || visibleData || fixedData) {
|
|
926
|
+
tableFullColumn.forEach(column => {
|
|
927
|
+
const colKey = column.getKey()
|
|
928
|
+
if (resizableData && XEUtils.isNumber(resizableData[colKey])) {
|
|
929
|
+
column.resizeWidth = resizableData[colKey]
|
|
997
930
|
}
|
|
998
|
-
if (XEUtils.isBoolean(
|
|
999
|
-
column.visible =
|
|
931
|
+
if (visibleData && XEUtils.isBoolean(visibleData[colKey])) {
|
|
932
|
+
column.visible = visibleData[colKey]
|
|
1000
933
|
}
|
|
1001
|
-
if (
|
|
1002
|
-
column.fixed =
|
|
934
|
+
if (fixedData && fixedData[colKey]) {
|
|
935
|
+
column.fixed = fixedData[colKey]
|
|
1003
936
|
}
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
937
|
+
if (sortData && XEUtils.isNumber(sortData[colKey])) {
|
|
938
|
+
hasCustomSort = true
|
|
939
|
+
column.renderSortNumber = sortData[colKey]
|
|
1006
940
|
}
|
|
941
|
+
})
|
|
942
|
+
// 如果自定义了顺序
|
|
943
|
+
if (hasCustomSort) {
|
|
944
|
+
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber')
|
|
945
|
+
internalData.collectColumn = collectColumn
|
|
946
|
+
internalData.tableFullColumn = getColumnList(collectColumn)
|
|
1007
947
|
}
|
|
1008
|
-
})
|
|
1009
|
-
// 如果自定义了顺序
|
|
1010
|
-
if (hasCustomSort) {
|
|
1011
|
-
collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber')
|
|
1012
|
-
internalData.collectColumn = collectColumn
|
|
1013
|
-
internalData.tableFullColumn = getColumnList(collectColumn)
|
|
1014
948
|
}
|
|
1015
949
|
}
|
|
1016
950
|
}
|
|
@@ -2560,27 +2494,30 @@ export default defineComponent({
|
|
|
2560
2494
|
internalData.collectColumn = collectColumn
|
|
2561
2495
|
const tableFullColumn = getColumnList(collectColumn)
|
|
2562
2496
|
internalData.tableFullColumn = tableFullColumn
|
|
2497
|
+
reactData._isLoading = true
|
|
2563
2498
|
initColumnSort()
|
|
2564
|
-
restoreCustomStorage()
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
if (
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
return nextTick().then(() => {
|
|
2580
|
-
if ($xeToolbar) {
|
|
2581
|
-
$xeToolbar.syncUpdate({ collectColumn, $table: $xeTable })
|
|
2499
|
+
return restoreCustomStorage().then(() => {
|
|
2500
|
+
reactData._isLoading = false
|
|
2501
|
+
cacheColumnMap()
|
|
2502
|
+
parseColumns().then(() => {
|
|
2503
|
+
if (reactData.scrollXLoad) {
|
|
2504
|
+
loadScrollXData()
|
|
2505
|
+
}
|
|
2506
|
+
})
|
|
2507
|
+
tableMethods.clearMergeCells()
|
|
2508
|
+
tableMethods.clearMergeFooterItems()
|
|
2509
|
+
tablePrivateMethods.handleTableData(true)
|
|
2510
|
+
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
2511
|
+
if ((reactData.scrollXLoad || reactData.scrollYLoad) && reactData.expandColumn) {
|
|
2512
|
+
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
2513
|
+
}
|
|
2582
2514
|
}
|
|
2583
|
-
return
|
|
2515
|
+
return nextTick().then(() => {
|
|
2516
|
+
if ($xeToolbar) {
|
|
2517
|
+
$xeToolbar.syncUpdate({ collectColumn, $table: $xeTable })
|
|
2518
|
+
}
|
|
2519
|
+
return tableMethods.recalculate()
|
|
2520
|
+
})
|
|
2584
2521
|
})
|
|
2585
2522
|
}
|
|
2586
2523
|
|
|
@@ -3284,7 +3221,7 @@ export default defineComponent({
|
|
|
3284
3221
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
3285
3222
|
column.fixed = fixed
|
|
3286
3223
|
})
|
|
3287
|
-
tablePrivateMethods.
|
|
3224
|
+
tablePrivateMethods.saveCustomStore('update:fixed')
|
|
3288
3225
|
return tableMethods.refreshColumn()
|
|
3289
3226
|
}
|
|
3290
3227
|
return nextTick()
|
|
@@ -3299,7 +3236,7 @@ export default defineComponent({
|
|
|
3299
3236
|
XEUtils.eachTree([targetColumn], (column) => {
|
|
3300
3237
|
column.fixed = null
|
|
3301
3238
|
})
|
|
3302
|
-
tablePrivateMethods.
|
|
3239
|
+
tablePrivateMethods.saveCustomStore('update:fixed')
|
|
3303
3240
|
return tableMethods.refreshColumn()
|
|
3304
3241
|
}
|
|
3305
3242
|
return nextTick()
|
|
@@ -3378,15 +3315,7 @@ export default defineComponent({
|
|
|
3378
3315
|
}
|
|
3379
3316
|
column.renderResizeWidth = column.renderWidth
|
|
3380
3317
|
})
|
|
3381
|
-
|
|
3382
|
-
tablePrivateMethods.saveCustomResizable(true)
|
|
3383
|
-
}
|
|
3384
|
-
if (opts.sort) {
|
|
3385
|
-
tablePrivateMethods.saveCustomSort(true)
|
|
3386
|
-
}
|
|
3387
|
-
if (opts.fixed) {
|
|
3388
|
-
tablePrivateMethods.saveCustomFixed()
|
|
3389
|
-
}
|
|
3318
|
+
$xeTable.saveCustomStore('reset')
|
|
3390
3319
|
return tablePrivateMethods.handleCustom()
|
|
3391
3320
|
},
|
|
3392
3321
|
/**
|
|
@@ -4536,22 +4465,27 @@ export default defineComponent({
|
|
|
4536
4465
|
const sortData: Record<string, number> = {}
|
|
4537
4466
|
const visibleData: Record<string, boolean> = {}
|
|
4538
4467
|
const fixedData: Record<string, VxeColumnPropTypes.Fixed> = {}
|
|
4539
|
-
const storeData = {
|
|
4540
|
-
resizableData,
|
|
4541
|
-
sortData,
|
|
4542
|
-
visibleData,
|
|
4543
|
-
fixedData
|
|
4468
|
+
const storeData: VxeTableDefines.CustomStoreData = {
|
|
4469
|
+
resizableData: undefined,
|
|
4470
|
+
sortData: undefined,
|
|
4471
|
+
visibleData: undefined,
|
|
4472
|
+
fixedData: undefined
|
|
4544
4473
|
}
|
|
4545
4474
|
if (!id) {
|
|
4546
4475
|
errLog('vxe.error.reqProp', ['id'])
|
|
4547
4476
|
return storeData
|
|
4548
4477
|
}
|
|
4478
|
+
let hasResizable = 0
|
|
4479
|
+
let hasSort = 0
|
|
4480
|
+
let hasFixedt = 0
|
|
4481
|
+
let hasVisible = 0
|
|
4549
4482
|
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
4550
4483
|
// 排序只支持一级
|
|
4551
4484
|
if (!parent) {
|
|
4552
4485
|
collectColumn.forEach((column) => {
|
|
4553
4486
|
const colKey = column.getKey()
|
|
4554
4487
|
if (colKey) {
|
|
4488
|
+
hasSort = 1
|
|
4555
4489
|
sortData[colKey] = column.renderSortNumber
|
|
4556
4490
|
}
|
|
4557
4491
|
})
|
|
@@ -4559,12 +4493,14 @@ export default defineComponent({
|
|
|
4559
4493
|
if (column.resizeWidth) {
|
|
4560
4494
|
const colKey = column.getKey()
|
|
4561
4495
|
if (colKey) {
|
|
4496
|
+
hasResizable = 1
|
|
4562
4497
|
resizableData[colKey] = column.renderWidth
|
|
4563
4498
|
}
|
|
4564
4499
|
}
|
|
4565
4500
|
if (column.fixed && column.fixed !== column.defaultFixed) {
|
|
4566
4501
|
const colKey = column.getKey()
|
|
4567
4502
|
if (colKey) {
|
|
4503
|
+
hasFixedt = 1
|
|
4568
4504
|
fixedData[colKey] = column.fixed
|
|
4569
4505
|
}
|
|
4570
4506
|
}
|
|
@@ -4572,16 +4508,30 @@ export default defineComponent({
|
|
|
4572
4508
|
if (!column.visible && column.defaultVisible) {
|
|
4573
4509
|
const colKey = column.getKey()
|
|
4574
4510
|
if (colKey) {
|
|
4511
|
+
hasVisible = 1
|
|
4575
4512
|
visibleData[colKey] = false
|
|
4576
4513
|
}
|
|
4577
4514
|
} else if (column.visible && !column.defaultVisible) {
|
|
4578
4515
|
const colKey = column.getKey()
|
|
4579
4516
|
if (colKey) {
|
|
4517
|
+
hasVisible = 1
|
|
4580
4518
|
visibleData[colKey] = true
|
|
4581
4519
|
}
|
|
4582
4520
|
}
|
|
4583
4521
|
}
|
|
4584
4522
|
})
|
|
4523
|
+
if (hasResizable) {
|
|
4524
|
+
storeData.resizableData = resizableData
|
|
4525
|
+
}
|
|
4526
|
+
if (hasSort) {
|
|
4527
|
+
storeData.sortData = sortData
|
|
4528
|
+
}
|
|
4529
|
+
if (hasFixedt) {
|
|
4530
|
+
storeData.fixedData = fixedData
|
|
4531
|
+
}
|
|
4532
|
+
if (hasVisible) {
|
|
4533
|
+
storeData.visibleData = visibleData
|
|
4534
|
+
}
|
|
4585
4535
|
return storeData
|
|
4586
4536
|
},
|
|
4587
4537
|
focus () {
|
|
@@ -5366,126 +5316,40 @@ export default defineComponent({
|
|
|
5366
5316
|
})
|
|
5367
5317
|
Object.assign(reactData.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList })
|
|
5368
5318
|
},
|
|
5369
|
-
|
|
5370
|
-
const { id
|
|
5371
|
-
const customOpts = computeCustomOpts.value
|
|
5372
|
-
const { collectColumn } = internalData
|
|
5373
|
-
const { storage } = customOpts
|
|
5374
|
-
const isAllStorage = storage === true
|
|
5375
|
-
const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
|
|
5376
|
-
const isResizable = isAllStorage || storageOpts.resizable
|
|
5377
|
-
if (customConfig && isResizable) {
|
|
5378
|
-
const columnWidthStorageMap = getCustomStorageMap(resizableStorageKey)
|
|
5379
|
-
let columnWidthStorage: any
|
|
5380
|
-
if (!id) {
|
|
5381
|
-
errLog('vxe.error.reqProp', ['id'])
|
|
5382
|
-
return
|
|
5383
|
-
}
|
|
5384
|
-
if (!isReset) {
|
|
5385
|
-
columnWidthStorage = XEUtils.isPlainObject(columnWidthStorageMap[id]) ? columnWidthStorageMap[id] : {}
|
|
5386
|
-
XEUtils.eachTree(collectColumn, (column) => {
|
|
5387
|
-
if (column.resizeWidth) {
|
|
5388
|
-
const colKey = column.getKey()
|
|
5389
|
-
if (colKey) {
|
|
5390
|
-
columnWidthStorage[colKey] = column.renderWidth
|
|
5391
|
-
}
|
|
5392
|
-
}
|
|
5393
|
-
})
|
|
5394
|
-
}
|
|
5395
|
-
columnWidthStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage
|
|
5396
|
-
localStorage.setItem(resizableStorageKey, XEUtils.toJSONString(columnWidthStorageMap))
|
|
5397
|
-
}
|
|
5398
|
-
},
|
|
5399
|
-
saveCustomSort (isReset?: boolean) {
|
|
5400
|
-
const { id, customConfig } = props
|
|
5319
|
+
saveCustomStore (type) {
|
|
5320
|
+
const { id } = props
|
|
5401
5321
|
const customOpts = computeCustomOpts.value
|
|
5402
|
-
const {
|
|
5403
|
-
const
|
|
5404
|
-
const
|
|
5405
|
-
const
|
|
5406
|
-
const
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5322
|
+
const { updateStore, storage } = customOpts
|
|
5323
|
+
const isAllCustom = storage === true
|
|
5324
|
+
const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {})
|
|
5325
|
+
const isCustomResizable = isAllCustom || storageOpts.resizable
|
|
5326
|
+
const isCustomVisible = isAllCustom || storageOpts.visible
|
|
5327
|
+
const isCustomFixed = isAllCustom || storageOpts.fixed
|
|
5328
|
+
const isCustomSort = isAllCustom || storageOpts.sort
|
|
5329
|
+
if (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort) {
|
|
5410
5330
|
if (!id) {
|
|
5411
5331
|
errLog('vxe.error.reqProp', ['id'])
|
|
5412
|
-
return
|
|
5332
|
+
return nextTick()
|
|
5413
5333
|
}
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
columnWidthStorage[colKey] = column.renderSortNumber
|
|
5334
|
+
const storeData = type === 'reset'
|
|
5335
|
+
? {
|
|
5336
|
+
resizableData: {},
|
|
5337
|
+
sortData: {},
|
|
5338
|
+
visibleData: {},
|
|
5339
|
+
fixedData: {}
|
|
5421
5340
|
}
|
|
5341
|
+
: tableMethods.getCustomStoreData()
|
|
5342
|
+
if (updateStore) {
|
|
5343
|
+
return updateStore({
|
|
5344
|
+
id,
|
|
5345
|
+
type,
|
|
5346
|
+
storeData
|
|
5422
5347
|
})
|
|
5348
|
+
} else {
|
|
5349
|
+
setCustomStorageMap(id, type === 'reset' ? null : storeData)
|
|
5423
5350
|
}
|
|
5424
|
-
columnSortStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage
|
|
5425
|
-
localStorage.setItem(sortStorageKey, XEUtils.toJSONString(columnSortStorageMap))
|
|
5426
|
-
}
|
|
5427
|
-
},
|
|
5428
|
-
saveCustomFixed () {
|
|
5429
|
-
const { id, customConfig } = props
|
|
5430
|
-
const { collectColumn } = internalData
|
|
5431
|
-
const customOpts = computeCustomOpts.value
|
|
5432
|
-
const { storage } = customOpts
|
|
5433
|
-
const isAllStorage = storage === true
|
|
5434
|
-
const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
|
|
5435
|
-
const isCustomFixed = isAllStorage || storageOpts.fixed
|
|
5436
|
-
if (customConfig && isCustomFixed) {
|
|
5437
|
-
const columnFixedStorageMap = getCustomStorageMap(fixedStorageKey)
|
|
5438
|
-
const colFixeds: any[] = []
|
|
5439
|
-
if (!id) {
|
|
5440
|
-
errLog('vxe.error.reqProp', ['id'])
|
|
5441
|
-
return
|
|
5442
|
-
}
|
|
5443
|
-
XEUtils.eachTree(collectColumn, (column) => {
|
|
5444
|
-
if (column.fixed && column.fixed !== column.defaultFixed) {
|
|
5445
|
-
const colKey = column.getKey()
|
|
5446
|
-
if (colKey) {
|
|
5447
|
-
colFixeds.push(`${colKey}|${column.fixed}`)
|
|
5448
|
-
}
|
|
5449
|
-
}
|
|
5450
|
-
})
|
|
5451
|
-
columnFixedStorageMap[id] = colFixeds.join(',') || undefined
|
|
5452
|
-
localStorage.setItem(fixedStorageKey, XEUtils.toJSONString(columnFixedStorageMap))
|
|
5453
|
-
}
|
|
5454
|
-
},
|
|
5455
|
-
saveCustomVisible () {
|
|
5456
|
-
const { id, customConfig } = props
|
|
5457
|
-
const { collectColumn } = internalData
|
|
5458
|
-
const customOpts = computeCustomOpts.value
|
|
5459
|
-
const { checkMethod, storage } = customOpts
|
|
5460
|
-
const isAllStorage = storage === true
|
|
5461
|
-
const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
|
|
5462
|
-
const isCustomVisible = isAllStorage || storageOpts.visible
|
|
5463
|
-
if (customConfig && isCustomVisible) {
|
|
5464
|
-
const columnVisibleStorageMap = getCustomStorageMap(visibleStorageKey)
|
|
5465
|
-
const colHides: any[] = []
|
|
5466
|
-
const colShows: any[] = []
|
|
5467
|
-
if (!id) {
|
|
5468
|
-
errLog('vxe.error.reqProp', ['id'])
|
|
5469
|
-
return
|
|
5470
|
-
}
|
|
5471
|
-
XEUtils.eachTree(collectColumn, (column) => {
|
|
5472
|
-
if (!checkMethod || checkMethod({ column })) {
|
|
5473
|
-
if (!column.visible && column.defaultVisible) {
|
|
5474
|
-
const colKey = column.getKey()
|
|
5475
|
-
if (colKey) {
|
|
5476
|
-
colHides.push(colKey)
|
|
5477
|
-
}
|
|
5478
|
-
} else if (column.visible && !column.defaultVisible) {
|
|
5479
|
-
const colKey = column.getKey()
|
|
5480
|
-
if (colKey) {
|
|
5481
|
-
colShows.push(colKey)
|
|
5482
|
-
}
|
|
5483
|
-
}
|
|
5484
|
-
}
|
|
5485
|
-
})
|
|
5486
|
-
columnVisibleStorageMap[id] = [colHides.join(',')].concat(colShows.length ? [colShows.join(',')] : []).join('|') || undefined
|
|
5487
|
-
localStorage.setItem(visibleStorageKey, XEUtils.toJSONString(columnVisibleStorageMap))
|
|
5488
5351
|
}
|
|
5352
|
+
return nextTick()
|
|
5489
5353
|
},
|
|
5490
5354
|
handleCustom () {
|
|
5491
5355
|
const { mouseConfig } = props
|
|
@@ -5498,8 +5362,6 @@ export default defineComponent({
|
|
|
5498
5362
|
$xeTable.clearCopyCellArea()
|
|
5499
5363
|
}
|
|
5500
5364
|
}
|
|
5501
|
-
tablePrivateMethods.saveCustomVisible()
|
|
5502
|
-
tablePrivateMethods.saveCustomSort()
|
|
5503
5365
|
tablePrivateMethods.analyColumnWidth()
|
|
5504
5366
|
return tableMethods.refreshColumn(true)
|
|
5505
5367
|
},
|
|
@@ -6892,6 +6754,7 @@ export default defineComponent({
|
|
|
6892
6754
|
const validTipOpts = computeValidTipOpts.value
|
|
6893
6755
|
const loadingOpts = computeLoadingOpts.value
|
|
6894
6756
|
const isMenu = computeIsMenu.value
|
|
6757
|
+
const currLoading = reactData._isLoading || loading
|
|
6895
6758
|
return h('div', {
|
|
6896
6759
|
ref: refElem,
|
|
6897
6760
|
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, {
|
|
@@ -6913,8 +6776,8 @@ export default defineComponent({
|
|
|
6913
6776
|
'is--animat': !!props.animat,
|
|
6914
6777
|
'is--round': props.round,
|
|
6915
6778
|
'is--stripe': !treeConfig && stripe,
|
|
6916
|
-
'is--loading':
|
|
6917
|
-
'is--empty': !
|
|
6779
|
+
'is--loading': currLoading,
|
|
6780
|
+
'is--empty': !currLoading && !tableData.length,
|
|
6918
6781
|
'is--scroll-y': overflowY,
|
|
6919
6782
|
'is--scroll-x': overflowX,
|
|
6920
6783
|
'is--virtual-x': scrollXLoad,
|
|
@@ -7011,7 +6874,7 @@ export default defineComponent({
|
|
|
7011
6874
|
*/
|
|
7012
6875
|
h(resolveComponent('vxe-loading') as VxeLoadingComponent, {
|
|
7013
6876
|
class: 'vxe-table--loading',
|
|
7014
|
-
modelValue:
|
|
6877
|
+
modelValue: currLoading,
|
|
7015
6878
|
icon: loadingOpts.icon,
|
|
7016
6879
|
text: loadingOpts.text
|
|
7017
6880
|
}, loadingSlot
|