vxe-table 3.9.10 → 3.9.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/locale/lang/en-US.js +3 -1
- package/es/locale/lang/es-ES.js +3 -1
- package/es/locale/lang/hu-HU.js +3 -1
- package/es/locale/lang/ja-JP.js +3 -1
- package/es/locale/lang/ko-KR.js +3 -1
- package/es/locale/lang/pt-BR.js +3 -1
- package/es/locale/lang/ru-RU.js +3 -1
- package/es/locale/lang/uk-UA.js +3 -1
- package/es/locale/lang/vi-VN.js +3 -1
- package/es/locale/lang/zh-CHT.js +3 -1
- package/es/locale/lang/zh-CN.js +3 -1
- package/es/style.css +1 -1
- package/es/table/render/index.js +6 -0
- package/es/table/src/methods.js +62 -63
- package/es/table/src/table.js +0 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +83 -84
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -1
- package/lib/locale/lang/es-ES.js +3 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -1
- package/lib/locale/lang/hu-HU.js +3 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +3 -1
- package/lib/locale/lang/ja-JP.js +3 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +3 -1
- package/lib/locale/lang/ko-KR.js +3 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +3 -1
- package/lib/locale/lang/pt-BR.js +3 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +3 -1
- package/lib/locale/lang/ru-RU.js +3 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +3 -1
- package/lib/locale/lang/uk-UA.js +3 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +3 -1
- package/lib/locale/lang/vi-VN.js +3 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +3 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +3 -1
- package/lib/locale/lang/zh-CN.js +3 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +3 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +6 -0
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/methods.js +71 -71
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +0 -1
- 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 +3 -3
- package/packages/locale/lang/en-US.ts +3 -1
- package/packages/locale/lang/es-ES.ts +3 -1
- package/packages/locale/lang/hu-HU.ts +3 -1
- package/packages/locale/lang/ja-JP.ts +3 -1
- package/packages/locale/lang/ko-KR.ts +3 -1
- package/packages/locale/lang/pt-BR.ts +3 -1
- package/packages/locale/lang/ru-RU.ts +3 -1
- package/packages/locale/lang/uk-UA.ts +3 -1
- package/packages/locale/lang/vi-VN.ts +3 -1
- package/packages/locale/lang/zh-CHT.ts +3 -1
- package/packages/locale/lang/zh-CN.ts +3 -1
- package/packages/table/render/index.ts +6 -0
- package/packages/table/src/methods.ts +75 -64
- package/packages/table/src/table.ts +0 -1
- /package/es/{iconfont.1729062501514.ttf → iconfont.1729311815181.ttf} +0 -0
- /package/es/{iconfont.1729062501514.woff → iconfont.1729311815181.woff} +0 -0
- /package/es/{iconfont.1729062501514.woff2 → iconfont.1729311815181.woff2} +0 -0
- /package/lib/{iconfont.1729062501514.ttf → iconfont.1729311815181.ttf} +0 -0
- /package/lib/{iconfont.1729062501514.woff → iconfont.1729311815181.woff} +0 -0
- /package/lib/{iconfont.1729062501514.woff2 → iconfont.1729311815181.woff2} +0 -0
|
@@ -652,7 +652,7 @@ const Methods = {
|
|
|
652
652
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
653
653
|
*/
|
|
654
654
|
cacheRowMap (isSource?: boolean) {
|
|
655
|
-
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData,
|
|
655
|
+
const { treeConfig, treeOpts, tableFullData, fullAllDataRowIdData, tableFullTreeData } = this
|
|
656
656
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
657
657
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
658
658
|
const rowkey = getRowkey(this)
|
|
@@ -684,7 +684,6 @@ const Methods = {
|
|
|
684
684
|
this.fullDataRowIdData = fullDataRowIdMaps
|
|
685
685
|
}
|
|
686
686
|
this.fullAllDataRowIdData = fullAllDataRowIdMaps
|
|
687
|
-
fullAllDataRowMap.clear()
|
|
688
687
|
if (treeConfig) {
|
|
689
688
|
XEUtils.eachTree(tableFullTreeData, handleCache, { children: childrenField })
|
|
690
689
|
} else {
|
|
@@ -720,11 +719,13 @@ const Methods = {
|
|
|
720
719
|
return this.params
|
|
721
720
|
},
|
|
722
721
|
loadTreeChildren (row: any, childRecords: any) {
|
|
723
|
-
const
|
|
722
|
+
const $xeTable = this
|
|
723
|
+
|
|
724
|
+
const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullAllDataRowIdData, sourceDataRowIdData } = this
|
|
724
725
|
const { transform, mapChildrenField } = treeOpts
|
|
725
726
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
726
|
-
const
|
|
727
|
-
const parentLevel =
|
|
727
|
+
const parentRest = fullAllDataRowIdData[getRowid($xeTable, row)]
|
|
728
|
+
const parentLevel = parentRest ? parentRest.level : 0
|
|
728
729
|
return this.createData(childRecords).then((rows: any) => {
|
|
729
730
|
if (keepSource) {
|
|
730
731
|
const rowid = getRowid(this, row)
|
|
@@ -738,13 +739,11 @@ const Methods = {
|
|
|
738
739
|
})
|
|
739
740
|
}
|
|
740
741
|
XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
|
|
741
|
-
const rowid = getRowid(
|
|
742
|
-
const parentRow = parent || row
|
|
742
|
+
const rowid = getRowid($xeTable, childRow)
|
|
743
|
+
const parentRow = parent || parentRest.row
|
|
743
744
|
const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length }
|
|
744
745
|
fullDataRowIdData[rowid] = rest
|
|
745
|
-
fullDataRowMap.set(childRow, rest)
|
|
746
746
|
fullAllDataRowIdData[rowid] = rest
|
|
747
|
-
fullAllDataRowMap.set(childRow, rest)
|
|
748
747
|
}, { children: childrenField })
|
|
749
748
|
row[childrenField] = rows
|
|
750
749
|
if (transform) {
|
|
@@ -1202,6 +1201,8 @@ const Methods = {
|
|
|
1202
1201
|
return null
|
|
1203
1202
|
},
|
|
1204
1203
|
getCellLabel (row: any, fieldOrColumn: any) {
|
|
1204
|
+
const $xeTable = this
|
|
1205
|
+
|
|
1205
1206
|
const column = handleFieldOrColumn(this, fieldOrColumn)
|
|
1206
1207
|
if (!column) {
|
|
1207
1208
|
return null
|
|
@@ -1210,15 +1211,15 @@ const Methods = {
|
|
|
1210
1211
|
const cellValue = getCellValue(row, column)
|
|
1211
1212
|
let cellLabel = cellValue
|
|
1212
1213
|
if (formatter) {
|
|
1213
|
-
let
|
|
1214
|
-
const {
|
|
1214
|
+
let formatData
|
|
1215
|
+
const { fullAllDataRowIdData } = $xeTable
|
|
1216
|
+
const rowid = getRowid($xeTable, row)
|
|
1215
1217
|
const colid = column.id
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1218
|
-
rest = fullAllDataRowMap.get(row)
|
|
1218
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
1219
|
+
if (rest) {
|
|
1219
1220
|
formatData = rest.formatData
|
|
1220
1221
|
if (!formatData) {
|
|
1221
|
-
formatData =
|
|
1222
|
+
formatData = fullAllDataRowIdData[rowid].formatData = {}
|
|
1222
1223
|
}
|
|
1223
1224
|
if (rest && formatData[colid]) {
|
|
1224
1225
|
if (formatData[colid].value === cellValue) {
|
|
@@ -1596,8 +1597,10 @@ const Methods = {
|
|
|
1596
1597
|
* @param {Row} row 行对象
|
|
1597
1598
|
*/
|
|
1598
1599
|
getRowid (row: any) {
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1600
|
+
const $xeTable = this
|
|
1601
|
+
|
|
1602
|
+
const rowid = XEUtils.get(row, getRowkey($xeTable))
|
|
1603
|
+
return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid)
|
|
1601
1604
|
},
|
|
1602
1605
|
/**
|
|
1603
1606
|
* 获取处理后的表格数据
|
|
@@ -3859,9 +3862,11 @@ const Methods = {
|
|
|
3859
3862
|
},
|
|
3860
3863
|
// 还原展开、选中等相关状态
|
|
3861
3864
|
handleReserveStatus () {
|
|
3862
|
-
const
|
|
3865
|
+
const $xeTable = this
|
|
3866
|
+
|
|
3867
|
+
const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowIdData, currentRow, selectRadioRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxMaps, rowExpandedMaps, treeExpandedMaps, expandOpts } = this
|
|
3863
3868
|
// 单选框
|
|
3864
|
-
if (selectRadioRow && !
|
|
3869
|
+
if (selectRadioRow && !fullAllDataRowIdData[getRowid($xeTable, selectRadioRow)]) {
|
|
3865
3870
|
this.selectRadioRow = null // 刷新单选行状态
|
|
3866
3871
|
}
|
|
3867
3872
|
// 还原保留选中状态
|
|
@@ -3877,7 +3882,7 @@ const Methods = {
|
|
|
3877
3882
|
if (checkboxOpts.reserve) {
|
|
3878
3883
|
this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true)
|
|
3879
3884
|
}
|
|
3880
|
-
if (currentRow && !
|
|
3885
|
+
if (currentRow && !this.fullAllDataRowIdData[getRowid($xeTable, currentRow)]) {
|
|
3881
3886
|
this.currentRow = null // 刷新当前行状态
|
|
3882
3887
|
}
|
|
3883
3888
|
// 行展开
|
|
@@ -4594,14 +4599,19 @@ const Methods = {
|
|
|
4594
4599
|
* @param {Row} row 行对象
|
|
4595
4600
|
*/
|
|
4596
4601
|
isRowExpandLoaded (row: any) {
|
|
4597
|
-
const
|
|
4598
|
-
|
|
4602
|
+
const $xeTable = this
|
|
4603
|
+
|
|
4604
|
+
const { fullAllDataRowIdData } = this
|
|
4605
|
+
const rest = fullAllDataRowIdData[getRowid($xeTable, row)]
|
|
4606
|
+
return rest && !!rest.expandLoaded
|
|
4599
4607
|
},
|
|
4600
4608
|
clearRowExpandLoaded (row: any) {
|
|
4601
|
-
const
|
|
4609
|
+
const $xeTable = this
|
|
4610
|
+
|
|
4611
|
+
const { expandOpts, rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this
|
|
4602
4612
|
const { lazy } = expandOpts
|
|
4603
|
-
const rowid = getRowid(
|
|
4604
|
-
const rest =
|
|
4613
|
+
const rowid = getRowid($xeTable, row)
|
|
4614
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
4605
4615
|
if (lazy && rest) {
|
|
4606
4616
|
rest.expandLoaded = false
|
|
4607
4617
|
const rowTempExpandLazyLoadedMaps = { ...rowExpandLazyLoadedMaps }
|
|
@@ -4695,32 +4705,28 @@ const Methods = {
|
|
|
4695
4705
|
return this.setRowExpand(expandedRows, expanded)
|
|
4696
4706
|
},
|
|
4697
4707
|
handleAsyncRowExpand (row: any) {
|
|
4698
|
-
const
|
|
4699
|
-
|
|
4708
|
+
const $xeTable = this
|
|
4709
|
+
|
|
4700
4710
|
return new Promise<void>(resolve => {
|
|
4711
|
+
const { expandOpts } = this
|
|
4701
4712
|
const { loadMethod } = expandOpts
|
|
4702
4713
|
if (loadMethod) {
|
|
4703
|
-
const { rowExpandLazyLoadedMaps } = this
|
|
4704
|
-
const
|
|
4705
|
-
const
|
|
4706
|
-
|
|
4707
|
-
this.
|
|
4708
|
-
loadMethod({ $table: this, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
|
|
4709
|
-
rest.expandLoaded = true
|
|
4714
|
+
const { rowExpandLazyLoadedMaps, fullAllDataRowIdData } = this
|
|
4715
|
+
const rowid = getRowid($xeTable, row)
|
|
4716
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
4717
|
+
rowExpandLazyLoadedMaps[rowid] = row
|
|
4718
|
+
loadMethod({ $table: $xeTable, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).then(() => {
|
|
4710
4719
|
const { rowExpandedMaps } = this
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
this.rowExpandedMaps = rowTempExpandedMaps
|
|
4720
|
+
rest.expandLoaded = true
|
|
4721
|
+
rowExpandedMaps[rowid] = row
|
|
4714
4722
|
}).catch(() => {
|
|
4715
4723
|
rest.expandLoaded = false
|
|
4716
4724
|
}).finally(() => {
|
|
4717
4725
|
const { rowExpandLazyLoadedMaps } = this
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
delete rowTempExpandLazyLoadedMaps[rowid]
|
|
4726
|
+
if (rowExpandLazyLoadedMaps[rowid]) {
|
|
4727
|
+
delete rowExpandLazyLoadedMaps[rowid]
|
|
4721
4728
|
}
|
|
4722
|
-
this.
|
|
4723
|
-
resolve(this.$nextTick().then(this.recalculate))
|
|
4729
|
+
this.$nextTick().then(() => this.recalculate()).then(() => resolve())
|
|
4724
4730
|
})
|
|
4725
4731
|
} else {
|
|
4726
4732
|
resolve()
|
|
@@ -4862,14 +4868,19 @@ const Methods = {
|
|
|
4862
4868
|
* @param {Row} row 行对象
|
|
4863
4869
|
*/
|
|
4864
4870
|
isTreeExpandLoaded (row: any) {
|
|
4865
|
-
const
|
|
4866
|
-
|
|
4871
|
+
const $xeTable = this
|
|
4872
|
+
|
|
4873
|
+
const { fullAllDataRowIdData } = this
|
|
4874
|
+
const rest = fullAllDataRowIdData[getRowid($xeTable, row)]
|
|
4875
|
+
return rest && !!rest.treeLoaded
|
|
4867
4876
|
},
|
|
4868
4877
|
clearTreeExpandLoaded (row: any) {
|
|
4869
|
-
const
|
|
4878
|
+
const $xeTable = this
|
|
4879
|
+
|
|
4880
|
+
const { treeOpts, treeExpandedMaps, fullAllDataRowIdData } = this
|
|
4870
4881
|
const { transform, lazy } = treeOpts
|
|
4871
|
-
const rowid = getRowid(
|
|
4872
|
-
const rest =
|
|
4882
|
+
const rowid = getRowid($xeTable, row)
|
|
4883
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
4873
4884
|
if (lazy && rest) {
|
|
4874
4885
|
rest.treeLoaded = false
|
|
4875
4886
|
if (treeExpandedMaps[rowid]) {
|
|
@@ -4962,35 +4973,36 @@ const Methods = {
|
|
|
4962
4973
|
}
|
|
4963
4974
|
},
|
|
4964
4975
|
handleAsyncTreeExpandChilds (row: any) {
|
|
4976
|
+
const $xeTable = this
|
|
4977
|
+
|
|
4965
4978
|
const { treeOpts, checkboxOpts } = this
|
|
4966
4979
|
const { transform, loadMethod } = treeOpts
|
|
4967
4980
|
const { checkStrictly } = checkboxOpts
|
|
4968
4981
|
return new Promise<void>(resolve => {
|
|
4969
4982
|
if (loadMethod) {
|
|
4970
|
-
const {
|
|
4971
|
-
const rowid = getRowid(
|
|
4972
|
-
const rest =
|
|
4983
|
+
const { treeExpandLazyLoadedMaps, fullAllDataRowIdData } = this
|
|
4984
|
+
const rowid = getRowid($xeTable, row)
|
|
4985
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
4973
4986
|
treeExpandLazyLoadedMaps[rowid] = row
|
|
4974
|
-
|
|
4975
|
-
|
|
4987
|
+
Promise.resolve(
|
|
4988
|
+
loadMethod({ $table: $xeTable, row })
|
|
4989
|
+
).then((childRecords: any) => {
|
|
4976
4990
|
rest.treeLoaded = true
|
|
4977
4991
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
4978
|
-
treeExpandLazyLoadedMaps[rowid]
|
|
4992
|
+
delete treeExpandLazyLoadedMaps[rowid]
|
|
4979
4993
|
}
|
|
4980
4994
|
if (!XEUtils.isArray(childRecords)) {
|
|
4981
4995
|
childRecords = []
|
|
4982
4996
|
}
|
|
4983
4997
|
if (childRecords) {
|
|
4984
|
-
return this.loadTreeChildren(row, childRecords).then((childRows: any) => {
|
|
4998
|
+
return this.loadTreeChildren(row, childRecords).then((childRows: any[]) => {
|
|
4985
4999
|
const { treeExpandedMaps } = this
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
treeTempExpandedMaps[rowid] = row
|
|
4989
|
-
this.treeExpandedMaps = treeTempExpandedMaps
|
|
5000
|
+
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
5001
|
+
treeExpandedMaps[rowid] = row
|
|
4990
5002
|
}
|
|
4991
5003
|
// 如果当前节点已选中,则展开后子节点也被选中
|
|
4992
5004
|
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
4993
|
-
this.handleCheckedCheckboxRow(childRows, true
|
|
5005
|
+
this.handleCheckedCheckboxRow(childRows, true)
|
|
4994
5006
|
}
|
|
4995
5007
|
return this.$nextTick().then(() => {
|
|
4996
5008
|
if (transform) {
|
|
@@ -5000,11 +5012,10 @@ const Methods = {
|
|
|
5000
5012
|
})
|
|
5001
5013
|
}
|
|
5002
5014
|
}).catch(() => {
|
|
5003
|
-
// 如果响应异常,则不展开,再次点击后将重新触发懒加载
|
|
5004
|
-
rest.treeLoaded = false
|
|
5005
5015
|
const { treeExpandLazyLoadedMaps } = this
|
|
5016
|
+
rest.treeLoaded = false
|
|
5006
5017
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
5007
|
-
treeExpandLazyLoadedMaps[rowid]
|
|
5018
|
+
delete treeExpandLazyLoadedMaps[rowid]
|
|
5008
5019
|
}
|
|
5009
5020
|
}).finally(() => {
|
|
5010
5021
|
this.$nextTick().then(() => this.recalculate()).then(() => resolve())
|
|
@@ -5038,7 +5049,7 @@ const Methods = {
|
|
|
5038
5049
|
* @returns
|
|
5039
5050
|
*/
|
|
5040
5051
|
handleBaseTreeExpand (rows: any, expanded: any) {
|
|
5041
|
-
const {
|
|
5052
|
+
const { fullAllDataRowIdData, tableFullData, treeExpandedMaps, treeOpts, treeExpandLazyLoadedMaps, treeNodeColumn } = this
|
|
5042
5053
|
const { reserve, lazy, accordion, toggleMethod } = treeOpts
|
|
5043
5054
|
const treeTempExpandedMaps = { ...treeExpandedMaps }
|
|
5044
5055
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -5064,7 +5075,7 @@ const Methods = {
|
|
|
5064
5075
|
validRows.forEach((row: any) => {
|
|
5065
5076
|
const rowid = getRowid(this, row)
|
|
5066
5077
|
if (!treeTempExpandedMaps[rowid]) {
|
|
5067
|
-
const rest =
|
|
5078
|
+
const rest = fullAllDataRowIdData[rowid]
|
|
5068
5079
|
const isLoad = lazy && row[hasChildField] && !rest.treeLoaded && !treeExpandLazyLoadedMaps[rowid]
|
|
5069
5080
|
// 是否使用懒加载
|
|
5070
5081
|
if (isLoad) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|