vxe-table 3.21.12 → 3.21.14
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/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/edit/mixin.js +5 -5
- package/es/table/module/menu/panel.js +5 -5
- package/es/table/src/methods.js +212 -63
- package/es/table/src/table.js +14 -7
- package/es/table/style.css +11 -7
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +11 -7
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +42 -22
- 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/edit/mixin.js +5 -0
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +5 -5
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/src/methods.js +16 -9
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +14 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +11 -7
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- 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 +11 -7
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/mixin.ts +5 -5
- package/packages/table/module/menu/panel.ts +5 -5
- package/packages/table/src/methods.ts +216 -62
- package/packages/table/src/table.ts +14 -7
- package/styles/components/table-module/menu.scss +5 -2
- /package/es/{iconfont.1781140842818.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/es/{iconfont.1781140842818.woff → iconfont.1781257629862.woff} +0 -0
- /package/es/{iconfont.1781140842818.woff2 → iconfont.1781257629862.woff2} +0 -0
- /package/lib/{iconfont.1781140842818.ttf → iconfont.1781257629862.ttf} +0 -0
- /package/lib/{iconfont.1781140842818.woff → iconfont.1781257629862.woff} +0 -0
- /package/lib/{iconfont.1781140842818.woff2 → iconfont.1781257629862.woff2} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.14",
|
|
4
4
|
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vue-i18n": "^8.15.1",
|
|
69
69
|
"vue-router": "^3.5.1",
|
|
70
70
|
"vue-template-compiler": "2.6.14",
|
|
71
|
-
"vxe-pc-ui": "3.14.
|
|
71
|
+
"vxe-pc-ui": "3.14.36"
|
|
72
72
|
},
|
|
73
73
|
"vetur": {
|
|
74
74
|
"tags": "helper/vetur/tags.json",
|
|
@@ -80,7 +80,7 @@ function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
80
80
|
}
|
|
81
81
|
pChilds[funcName](item)
|
|
82
82
|
pMapChilds[funcName](item)
|
|
83
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
83
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
84
84
|
fullDataRowIdData[rowid] = rest
|
|
85
85
|
fullAllDataRowIdData[rowid] = rest
|
|
86
86
|
} else {
|
|
@@ -89,7 +89,7 @@ function insertTreeRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
89
89
|
}
|
|
90
90
|
afterFullData[funcName](item)
|
|
91
91
|
tableFullTreeData[funcName](item)
|
|
92
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
92
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
93
93
|
fullDataRowIdData[rowid] = rest
|
|
94
94
|
fullAllDataRowIdData[rowid] = rest
|
|
95
95
|
}
|
|
@@ -144,7 +144,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
144
144
|
} else {
|
|
145
145
|
newRecords.forEach(item => {
|
|
146
146
|
const rowid = getRowid($xeTable, item)
|
|
147
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
147
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
148
148
|
fullDataRowIdData[rowid] = rest
|
|
149
149
|
fullAllDataRowIdData[rowid] = rest
|
|
150
150
|
afterFullData.unshift(item)
|
|
@@ -173,7 +173,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
173
173
|
} else {
|
|
174
174
|
newRecords.forEach(item => {
|
|
175
175
|
const rowid = getRowid($xeTable, item)
|
|
176
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
176
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
177
177
|
fullDataRowIdData[rowid] = rest
|
|
178
178
|
fullAllDataRowIdData[rowid] = rest
|
|
179
179
|
afterFullData.push(item)
|
|
@@ -211,7 +211,7 @@ function handleInsertRowAt ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
211
211
|
})
|
|
212
212
|
XEUtils.eachTree(treeRecords, (item) => {
|
|
213
213
|
const rowid = getRowid($xeTable, item)
|
|
214
|
-
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
214
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
215
215
|
if (item[childrenField]) {
|
|
216
216
|
item[mapChildrenField] = item[childrenField]
|
|
217
217
|
}
|
|
@@ -61,7 +61,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
61
61
|
return options.every((item) => item.visible === false)
|
|
62
62
|
? renderEmptyElement($xeTable)
|
|
63
63
|
: h('ul', {
|
|
64
|
-
class: 'vxe-context-menu
|
|
64
|
+
class: 'vxe-table--context-menu-group-wrapper',
|
|
65
65
|
key: gIndex
|
|
66
66
|
}, options.map((item, index) => {
|
|
67
67
|
const { children, loading } = item
|
|
@@ -74,7 +74,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
74
74
|
return item.visible === false
|
|
75
75
|
? renderEmptyElement($xeTable)
|
|
76
76
|
: h('li', {
|
|
77
|
-
class: [item.className, {
|
|
77
|
+
class: ['vxe-table--context-menu--option', item.className, {
|
|
78
78
|
'link--loading': loading,
|
|
79
79
|
'link--disabled': item.disabled,
|
|
80
80
|
'link--active': item === ctxMenuStore.selected
|
|
@@ -128,12 +128,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
128
128
|
suffixOpts.content ? h('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)
|
|
129
129
|
])
|
|
130
130
|
]),
|
|
131
|
-
hasChildMenus &&
|
|
131
|
+
hasChildMenus && children
|
|
132
132
|
? h('ul', {
|
|
133
133
|
class: ['vxe-table--context-menu-clild-wrapper', {
|
|
134
134
|
'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
|
|
135
135
|
}]
|
|
136
|
-
},
|
|
136
|
+
}, children.map((child, cIndex) => {
|
|
137
137
|
const { loading: childLoading } = child
|
|
138
138
|
const childPrefixOpts = Object.assign({}, child.prefixConfig)
|
|
139
139
|
const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon
|
|
@@ -143,7 +143,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
|
|
|
143
143
|
return child.visible === false
|
|
144
144
|
? null
|
|
145
145
|
: h('li', {
|
|
146
|
-
class: [child.className, {
|
|
146
|
+
class: ['vxe-table--context-menu--option', child.className, {
|
|
147
147
|
'link--loading': childLoading,
|
|
148
148
|
'link--disabled': child.disabled,
|
|
149
149
|
'link--active': child === ctxMenuStore.selectChild
|
|
@@ -453,7 +453,11 @@ function updateScrollYStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
453
453
|
const { transform } = treeOpts
|
|
454
454
|
const allList = fullData || internalData.tableFullData
|
|
455
455
|
// 如果gt为0,则总是启用
|
|
456
|
-
|
|
456
|
+
let scrollYLoad = !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length)
|
|
457
|
+
if (scrollYLoad && (treeConfig && !transform)) {
|
|
458
|
+
errLog('vxe.error.notSupportProp', ['[table] virtual-y-config.enabled=true', 'tree-config.transform=false', 'tree-config.transform=true'])
|
|
459
|
+
scrollYLoad = false
|
|
460
|
+
}
|
|
457
461
|
reactData.scrollYLoad = scrollYLoad
|
|
458
462
|
syncGanttScrollYStatus($xeTable)
|
|
459
463
|
return scrollYLoad
|
|
@@ -650,28 +654,66 @@ function handleDefaultRowGroupExpand ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
650
654
|
}
|
|
651
655
|
}
|
|
652
656
|
|
|
657
|
+
function updateAfterTreeIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
658
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
659
|
+
|
|
660
|
+
const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData
|
|
661
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
662
|
+
const { transform, mapChildrenField } = treeOpts
|
|
663
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
664
|
+
const fullMaps: Record<string, any> = {}
|
|
665
|
+
let rowNum = 0
|
|
666
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
667
|
+
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
668
|
+
const rowid = handleGetRowId(row)
|
|
669
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
670
|
+
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
671
|
+
if (rowRest) {
|
|
672
|
+
rowRest.seq = seq
|
|
673
|
+
rowRest._seq = rowNum
|
|
674
|
+
rowRest.treeIndex = index
|
|
675
|
+
rowRest._tIndex = rowNum
|
|
676
|
+
} else {
|
|
677
|
+
const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: rowNum, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
678
|
+
fullAllDataRowIdData[rowid] = rest
|
|
679
|
+
fullDataRowIdData[rowid] = rest
|
|
680
|
+
}
|
|
681
|
+
rowNum++
|
|
682
|
+
fullMaps[rowid] = row
|
|
683
|
+
}, { children: transform ? mapChildrenField : childrenField })
|
|
684
|
+
if (transform) {
|
|
685
|
+
afterFullData.forEach((row, index) => {
|
|
686
|
+
const rowid = handleGetRowId(row)
|
|
687
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
688
|
+
if (rowRest) {
|
|
689
|
+
rowRest._index = index
|
|
690
|
+
}
|
|
691
|
+
})
|
|
692
|
+
}
|
|
693
|
+
internalData.afterFullRowMaps = fullMaps
|
|
694
|
+
}
|
|
695
|
+
|
|
653
696
|
function updateAfterListIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
654
|
-
const props = $xeTable
|
|
655
697
|
const internalData = $xeTable as unknown as TableInternalData
|
|
656
698
|
|
|
657
|
-
const { treeConfig } = props
|
|
658
699
|
const { afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData
|
|
659
700
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
660
701
|
const fullMaps: Record<string, any> = {}
|
|
702
|
+
let rowNum = 0
|
|
661
703
|
afterFullData.forEach((row, index) => {
|
|
662
704
|
const rowid = handleGetRowId(row)
|
|
663
705
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
664
706
|
const seq = index + 1
|
|
665
707
|
if (rowRest) {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
708
|
+
rowRest.seq = seq
|
|
709
|
+
rowRest._seq = rowNum
|
|
669
710
|
rowRest._index = index
|
|
670
711
|
} else {
|
|
671
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
712
|
+
const rest = { row, rowid, _seq: rowNum, seq, index: -1, $index: -1, _index: index, treeIndex: -1, _tIndex: -1, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
672
713
|
fullAllDataRowIdData[rowid] = rest
|
|
673
714
|
fullDataRowIdData[rowid] = rest
|
|
674
715
|
}
|
|
716
|
+
rowNum++
|
|
675
717
|
fullMaps[rowid] = row
|
|
676
718
|
})
|
|
677
719
|
internalData.afterFullRowMaps = fullMaps
|
|
@@ -683,47 +725,10 @@ function updateAfterListIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
683
725
|
*/
|
|
684
726
|
function updateAfterDataIndex ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
685
727
|
const props = $xeTable
|
|
686
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
687
728
|
|
|
688
729
|
const { treeConfig } = props
|
|
689
|
-
const { fullDataRowIdData, fullAllDataRowIdData, afterFullData, afterTreeFullData } = internalData
|
|
690
|
-
const treeOpts = $xeTable.computeTreeOpts
|
|
691
|
-
const { transform } = treeOpts
|
|
692
|
-
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
693
|
-
const fullMaps: Record<string, any> = {}
|
|
694
730
|
if (treeConfig) {
|
|
695
|
-
|
|
696
|
-
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
697
|
-
XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
698
|
-
const rowid = handleGetRowId(row)
|
|
699
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
700
|
-
const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
|
|
701
|
-
if (rowRest) {
|
|
702
|
-
rowRest.seq = seq
|
|
703
|
-
rowRest.treeIndex = index
|
|
704
|
-
rowRest._tIndex = _treeIndex
|
|
705
|
-
} else {
|
|
706
|
-
const rest = { row, rowid, seq, index: -1, $index: -1, _index: -1, treeIndex: -1, _tIndex: _treeIndex, items: [], parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
707
|
-
fullAllDataRowIdData[rowid] = rest
|
|
708
|
-
fullDataRowIdData[rowid] = rest
|
|
709
|
-
}
|
|
710
|
-
_treeIndex++
|
|
711
|
-
fullMaps[rowid] = row
|
|
712
|
-
}, { children: transform ? treeOpts.mapChildrenField : childrenField })
|
|
713
|
-
if (transform) {
|
|
714
|
-
afterFullData.forEach((row, index) => {
|
|
715
|
-
const rowid = handleGetRowId(row)
|
|
716
|
-
const rowRest = fullAllDataRowIdData[rowid]
|
|
717
|
-
const seq = index + 1
|
|
718
|
-
if (rowRest) {
|
|
719
|
-
if (!treeConfig) {
|
|
720
|
-
rowRest.seq = seq
|
|
721
|
-
}
|
|
722
|
-
rowRest._index = index
|
|
723
|
-
}
|
|
724
|
-
})
|
|
725
|
-
}
|
|
726
|
-
internalData.afterFullRowMaps = fullMaps
|
|
731
|
+
updateAfterTreeIndex($xeTable)
|
|
727
732
|
} else {
|
|
728
733
|
updateAfterListIndex($xeTable)
|
|
729
734
|
}
|
|
@@ -3195,12 +3200,15 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3195
3200
|
})
|
|
3196
3201
|
}
|
|
3197
3202
|
|
|
3198
|
-
const
|
|
3203
|
+
const defaultMinRunDelay = 50
|
|
3199
3204
|
|
|
3200
|
-
function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean
|
|
3205
|
+
function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean, options?: {
|
|
3206
|
+
minRunDelay?: number // 多少毫秒内至少执行一次
|
|
3207
|
+
}) {
|
|
3201
3208
|
const reactData = $xeTable as unknown as TableReactData
|
|
3202
3209
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3203
3210
|
|
|
3211
|
+
const minRunDelay = (options ? options.minRunDelay : defaultMinRunDelay) || defaultMinRunDelay
|
|
3204
3212
|
return new Promise<void>(resolve => {
|
|
3205
3213
|
const { customStore } = reactData
|
|
3206
3214
|
const { rceTimeout, rceRunTime } = internalData
|
|
@@ -3226,6 +3234,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3226
3234
|
}
|
|
3227
3235
|
if (rceTimeout) {
|
|
3228
3236
|
clearTimeout(rceTimeout)
|
|
3237
|
+
// 多少毫秒内至少执行一次
|
|
3229
3238
|
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3230
3239
|
resolve(
|
|
3231
3240
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
|
|
@@ -3251,7 +3260,19 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3251
3260
|
}
|
|
3252
3261
|
|
|
3253
3262
|
function handleResizeEvent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
3254
|
-
|
|
3263
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
3264
|
+
|
|
3265
|
+
if (internalData.rsePending) {
|
|
3266
|
+
return
|
|
3267
|
+
}
|
|
3268
|
+
internalData.rsePending = true
|
|
3269
|
+
handleLazyRecalculate($xeTable, true, true, true, {
|
|
3270
|
+
minRunDelay: 200
|
|
3271
|
+
}).then(() => {
|
|
3272
|
+
internalData.rsePending = false
|
|
3273
|
+
}).catch(() => {
|
|
3274
|
+
internalData.rsePending = false
|
|
3275
|
+
})
|
|
3255
3276
|
}
|
|
3256
3277
|
|
|
3257
3278
|
function handleUpdateAggValues ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
@@ -5122,17 +5143,19 @@ const tableMethods: any = {
|
|
|
5122
5143
|
|
|
5123
5144
|
const idMaps: Record<string, boolean> = {}
|
|
5124
5145
|
const { handleUpdateRowId } = createHandleUpdateRowId($xeTable)
|
|
5146
|
+
let rowNum = 0
|
|
5125
5147
|
const handleRowCache = (row: any, index: number, items: any, currIndex: number, parentRow: any, rowid: string, level: number, seq: string | number) => {
|
|
5126
5148
|
let rowRest = fullAllDataRowIdMaps[rowid]
|
|
5127
5149
|
if (idMaps[rowid]) {
|
|
5128
5150
|
errLog('vxe.error.repeatKey', [currKeyField, rowid])
|
|
5129
5151
|
}
|
|
5130
5152
|
if (!rowRest) {
|
|
5131
|
-
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
5153
|
+
rowRest = { row, rowid, _seq: -1, seq, index: -1, _index: -1, $index: -1, treeIndex: index, _tIndex: -1, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
5132
5154
|
}
|
|
5133
5155
|
rowRest.treeLoaded = false
|
|
5134
5156
|
rowRest.expandLoaded = false
|
|
5135
5157
|
|
|
5158
|
+
rowRest._seq = rowNum++
|
|
5136
5159
|
rowRest.row = row
|
|
5137
5160
|
rowRest.items = items
|
|
5138
5161
|
rowRest.parent = parentRow
|
|
@@ -5160,7 +5183,7 @@ const tableMethods: any = {
|
|
|
5160
5183
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
5161
5184
|
XEUtils.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
5162
5185
|
const rowid = handleUpdateRowId(row)
|
|
5163
|
-
if (
|
|
5186
|
+
if (lazy) {
|
|
5164
5187
|
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
5165
5188
|
row[childrenField] = null
|
|
5166
5189
|
}
|
|
@@ -5246,7 +5269,7 @@ const tableMethods: any = {
|
|
|
5246
5269
|
XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
|
|
5247
5270
|
const rowid = getRowid($xeTable, childRow)
|
|
5248
5271
|
const parentRow = parentItem || parentRest.row
|
|
5249
|
-
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
5272
|
+
const rest = { row: childRow, rowid, _seq: -1, seq: -1, index, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
5250
5273
|
fullDataRowIdData[rowid] = rest
|
|
5251
5274
|
fullAllDataRowIdData[rowid] = rest
|
|
5252
5275
|
}, { children: childrenField })
|
|
@@ -8743,31 +8766,162 @@ const tableMethods: any = {
|
|
|
8743
8766
|
const { treeConfig } = props
|
|
8744
8767
|
const { row } = params
|
|
8745
8768
|
const { isRowGroupStatus } = reactData
|
|
8746
|
-
const { afterFullData } = internalData
|
|
8769
|
+
const { fullAllDataRowIdData, afterFullData, afterTreeFullData, afterGroupFullData } = internalData
|
|
8747
8770
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
8748
|
-
const
|
|
8771
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
8772
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
8773
|
+
const { checkMethod, trigger, checkStrictly } = checkboxOpts
|
|
8749
8774
|
if (trigger === 'manual') {
|
|
8750
8775
|
return
|
|
8751
8776
|
}
|
|
8752
8777
|
evnt.stopPropagation()
|
|
8753
|
-
|
|
8778
|
+
|
|
8779
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey) {
|
|
8780
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
8754
8781
|
const checkboxRecords = $xeTable.getCheckboxRecords()
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8782
|
+
let currSeq = -1
|
|
8783
|
+
let currRow: any = null
|
|
8784
|
+
const currRowid = handleGetRowId(row)
|
|
8785
|
+
const rowRest = fullAllDataRowIdData[currRowid]
|
|
8786
|
+
if (rowRest) {
|
|
8787
|
+
currRow = rowRest.row
|
|
8788
|
+
currSeq = rowRest._seq
|
|
8789
|
+
}
|
|
8790
|
+
if (currRow && checkboxRecords.length) {
|
|
8791
|
+
let rangeRows: any[] = []
|
|
8792
|
+
let firstSeq = -1
|
|
8793
|
+
let firstRow: any = null
|
|
8794
|
+
let firstRowid = ''
|
|
8795
|
+
let lastSeq = -1
|
|
8796
|
+
let lastRow: any = null
|
|
8797
|
+
let lastRowid = ''
|
|
8798
|
+
// 根据序号取出范围最小/最大的行
|
|
8799
|
+
const selectMaps: Record<string, any> = {}
|
|
8800
|
+
checkboxRecords.forEach(item => {
|
|
8801
|
+
const rowid = handleGetRowId(item)
|
|
8802
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
8803
|
+
if (rowRest) {
|
|
8804
|
+
if (!firstRow || firstSeq > rowRest._seq) {
|
|
8805
|
+
firstRowid = rowRest.rowid
|
|
8806
|
+
firstRow = rowRest.row
|
|
8807
|
+
firstSeq = rowRest._seq
|
|
8808
|
+
}
|
|
8809
|
+
if (!lastRow || lastSeq < rowRest._seq) {
|
|
8810
|
+
lastRowid = rowRest.rowid
|
|
8811
|
+
lastRow = rowRest.row
|
|
8812
|
+
lastSeq = rowRest._seq
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
selectMaps[rowid] = item
|
|
8816
|
+
})
|
|
8817
|
+
// 如果已选只有一条并选择当前则跳过
|
|
8818
|
+
if (firstRow && lastRow && (checkboxRecords.length > 1 || currRowid !== firstRowid) && (Math.abs(firstSeq - lastSeq) > 1 || Math.abs(currSeq - firstSeq) > 1 || Math.abs(currSeq - lastSeq) > 1)) {
|
|
8819
|
+
// 树与分组
|
|
8820
|
+
if (treeConfig || isRowGroupStatus) {
|
|
8821
|
+
const { transform } = treeOpts
|
|
8822
|
+
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8823
|
+
const iteratorChildField = treeConfig ? (transform ? treeOpts.mapChildrenField : childrenField) : aggregateOpts.mapChildrenField as string
|
|
8824
|
+
let isMatchFirst = false
|
|
8825
|
+
let matchStartRowid = ''
|
|
8826
|
+
let matchEndRowid = ''
|
|
8827
|
+
|
|
8828
|
+
const handleGetChildRowid = (rowid: string, isLast: 0 | 1): string => {
|
|
8829
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
8830
|
+
if (rowRest) {
|
|
8831
|
+
const item = rowRest.row
|
|
8832
|
+
const childList = item[iteratorChildField]
|
|
8833
|
+
if (childList && childList.length) {
|
|
8834
|
+
const targetRow = isLast ? XEUtils.last(childList) : XEUtils.first(childList)
|
|
8835
|
+
return handleGetChildRowid(handleGetRowId(targetRow), isLast)
|
|
8836
|
+
}
|
|
8837
|
+
}
|
|
8838
|
+
return rowid
|
|
8839
|
+
}
|
|
8840
|
+
|
|
8841
|
+
const handleGetSelectParentRowid = (rowid: string): string => {
|
|
8842
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
8843
|
+
if (rowRest) {
|
|
8844
|
+
const parentItem = rowRest.parent
|
|
8845
|
+
if (parentItem) {
|
|
8846
|
+
const parentRowid = handleGetRowId(parentItem)
|
|
8847
|
+
if (selectMaps[parentRowid]) {
|
|
8848
|
+
return handleGetSelectParentRowid(parentRowid)
|
|
8849
|
+
}
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
return rowid
|
|
8853
|
+
}
|
|
8854
|
+
|
|
8855
|
+
const handleGetRootRow = (row: string): VxeTableDefines.RowCacheItem | null => {
|
|
8856
|
+
const rowid = handleGetRowId(row)
|
|
8857
|
+
if (rowid) {
|
|
8858
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
8859
|
+
if (rest) {
|
|
8860
|
+
return rest.parent ? handleGetRootRow(rest.parent) : rest
|
|
8861
|
+
}
|
|
8862
|
+
}
|
|
8863
|
+
return null
|
|
8864
|
+
}
|
|
8865
|
+
|
|
8866
|
+
if (currSeq < firstSeq) {
|
|
8867
|
+
matchStartRowid = handleGetChildRowid(currRowid, 0)
|
|
8868
|
+
matchEndRowid = handleGetChildRowid(firstRowid, 1)
|
|
8869
|
+
} else {
|
|
8870
|
+
if (currSeq > lastSeq) {
|
|
8871
|
+
matchStartRowid = handleGetSelectParentRowid(lastRowid)
|
|
8872
|
+
} else {
|
|
8873
|
+
matchStartRowid = handleGetChildRowid(firstRowid, 0)
|
|
8874
|
+
}
|
|
8875
|
+
matchEndRowid = handleGetChildRowid(currRowid, 1)
|
|
8876
|
+
}
|
|
8877
|
+
|
|
8878
|
+
const handleRangeRow = (item: any) => {
|
|
8879
|
+
const rowid = handleGetRowId(item)
|
|
8880
|
+
const childList = item[iteratorChildField]
|
|
8881
|
+
if (!isMatchFirst && rowid === matchStartRowid) {
|
|
8882
|
+
isMatchFirst = true
|
|
8883
|
+
}
|
|
8884
|
+
// 如果是父子关联,则排除父节点
|
|
8885
|
+
if (isMatchFirst && (checkStrictly || !childList || !childList.length)) {
|
|
8886
|
+
rangeRows.push(item)
|
|
8887
|
+
}
|
|
8888
|
+
// break
|
|
8889
|
+
return rowid === matchEndRowid
|
|
8890
|
+
}
|
|
8891
|
+
if (treeConfig) {
|
|
8892
|
+
const matchStartRowRest = fullAllDataRowIdData[matchStartRowid]
|
|
8893
|
+
const firstRootRowRest = matchStartRowRest ? handleGetRootRow(matchStartRowRest.row) : null
|
|
8894
|
+
if (firstRootRowRest) {
|
|
8895
|
+
// 优化查找复杂度
|
|
8896
|
+
XEUtils.findTree(afterTreeFullData.slice(firstRootRowRest.treeIndex), handleRangeRow, { children: iteratorChildField })
|
|
8897
|
+
} else {
|
|
8898
|
+
XEUtils.findTree(afterTreeFullData, handleRangeRow, { children: iteratorChildField })
|
|
8899
|
+
}
|
|
8900
|
+
} else {
|
|
8901
|
+
XEUtils.findTree(afterGroupFullData, handleRangeRow, { children: iteratorChildField })
|
|
8902
|
+
}
|
|
8903
|
+
} else {
|
|
8904
|
+
const _currRowIndex = $xeTable.getVTRowIndex(currRow)
|
|
8905
|
+
const _firstRowIndex = $xeTable.getVTRowIndex(firstRow)
|
|
8906
|
+
const _lastRowIndex = $xeTable.getVTRowIndex(lastRow)
|
|
8907
|
+
if (_currRowIndex < _firstRowIndex) {
|
|
8908
|
+
rangeRows = afterFullData.slice(_currRowIndex, _firstRowIndex + 1)
|
|
8909
|
+
} else if (_currRowIndex > _lastRowIndex) {
|
|
8910
|
+
rangeRows = afterFullData.slice(_lastRowIndex, _currRowIndex + 1)
|
|
8911
|
+
} else {
|
|
8912
|
+
rangeRows = afterFullData.slice(_firstRowIndex, _currRowIndex + 1)
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8760
8915
|
$xeTable.setAllCheckboxRow(false)
|
|
8761
|
-
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1)
|
|
8762
8916
|
$xeTable.$nextTick(() => {
|
|
8763
8917
|
handleCheckedCheckboxRow($xeTable, rangeRows, true, false)
|
|
8764
8918
|
})
|
|
8765
8919
|
$xeTable.dispatchEvent('checkbox-range-select', Object.assign({ rangeRecords: rangeRows }, params), evnt)
|
|
8766
|
-
return
|
|
8767
8920
|
}
|
|
8768
8921
|
}
|
|
8769
8922
|
}
|
|
8770
|
-
|
|
8923
|
+
|
|
8924
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, row })) {
|
|
8771
8925
|
$xeTable.handleBatchSelectRows([row], checked)
|
|
8772
8926
|
$xeTable.checkSelectionStatus()
|
|
8773
8927
|
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
|
@@ -1348,22 +1348,32 @@ export default {
|
|
|
1348
1348
|
const { tableFullColumn } = internalData
|
|
1349
1349
|
const { updateColFlag } = reactData
|
|
1350
1350
|
const editDirtyOpts = $xeTable.computeEditDirtyOpts
|
|
1351
|
-
const { includeFields, excludeFields } = editDirtyOpts
|
|
1351
|
+
const { extraFields, includeFields, excludeFields } = editDirtyOpts
|
|
1352
1352
|
const kpFields: string[] = []
|
|
1353
1353
|
if (updateColFlag) {
|
|
1354
1354
|
if (includeFields && includeFields.length) {
|
|
1355
1355
|
return includeFields
|
|
1356
1356
|
}
|
|
1357
|
-
const
|
|
1357
|
+
const excludeFdMaps: Record<string, number> = {}
|
|
1358
1358
|
if (excludeFields && excludeFields.length) {
|
|
1359
1359
|
excludeFields.forEach(field => {
|
|
1360
|
-
|
|
1360
|
+
excludeFdMaps[field] = 1
|
|
1361
|
+
})
|
|
1362
|
+
}
|
|
1363
|
+
const addFdMaps: Record<string, number> = {}
|
|
1364
|
+
if (extraFields && extraFields.length) {
|
|
1365
|
+
extraFields.forEach(field => {
|
|
1366
|
+
if (!addFdMaps[field]) {
|
|
1367
|
+
addFdMaps[field] = 1
|
|
1368
|
+
kpFields.push(field)
|
|
1369
|
+
}
|
|
1361
1370
|
})
|
|
1362
1371
|
}
|
|
1363
1372
|
for (let i = 0; i < tableFullColumn.length; i++) {
|
|
1364
1373
|
const column = tableFullColumn[i]
|
|
1365
1374
|
const { field, type, editRender, cellRender } = column
|
|
1366
|
-
if (field && !type && (editRender || cellRender) && !
|
|
1375
|
+
if (field && !type && (editRender || cellRender) && !addFdMaps[field] && !excludeFdMaps[field]) {
|
|
1376
|
+
addFdMaps[field] = 1
|
|
1367
1377
|
kpFields.push(field)
|
|
1368
1378
|
}
|
|
1369
1379
|
}
|
|
@@ -1862,9 +1872,6 @@ export default {
|
|
|
1862
1872
|
if (props.editConfig && editOpts.activeMethod) {
|
|
1863
1873
|
warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
|
|
1864
1874
|
}
|
|
1865
|
-
if (props.treeConfig && checkboxOpts.isShiftKey) {
|
|
1866
|
-
errLog('vxe.error.errConflicts', ['tree-config', 'checkbox-config.isShiftKey'])
|
|
1867
|
-
}
|
|
1868
1875
|
if (checkboxOpts.halfField) {
|
|
1869
1876
|
warnLog('vxe.error.delProp', ['checkbox-config.halfField', 'checkbox-config.indeterminateField'])
|
|
1870
1877
|
}
|
|
@@ -18,13 +18,16 @@
|
|
|
18
18
|
font-family: var(--vxe-ui-font-family);
|
|
19
19
|
background-color: var(--vxe-ui-layout-background-color);
|
|
20
20
|
}
|
|
21
|
+
.vxe-context-menu--option {
|
|
22
|
+
color: var(--vxe-ui-font-color);
|
|
23
|
+
}
|
|
21
24
|
.vxe-context-menu--link {
|
|
22
25
|
display: flex;
|
|
23
26
|
flex-direction: row;
|
|
24
27
|
width: var(--vxe-ui-table-menu-item-width);
|
|
25
28
|
line-height: 26px;
|
|
26
29
|
padding: 0 0.8em;
|
|
27
|
-
color:
|
|
30
|
+
color: inherit;
|
|
28
31
|
cursor: pointer;
|
|
29
32
|
.vxe-context-menu--link-prefix,
|
|
30
33
|
.vxe-context-menu--link-suffix {
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
white-space: nowrap;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
|
-
.vxe-context-menu
|
|
47
|
+
.vxe-table--context-menu-group-wrapper,
|
|
45
48
|
.vxe-table--context-menu-clild-wrapper {
|
|
46
49
|
margin: 0;
|
|
47
50
|
padding: 0;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|