vxe-table 3.7.0-beta.1 → 3.7.0-beta.10

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.
Files changed (189) hide show
  1. package/README.md +6 -9
  2. package/helper/vetur/attributes.json +86 -22
  3. package/helper/vetur/tags.json +17 -1
  4. package/lib/button/src/button.js +9 -3
  5. package/lib/button/src/button.min.js +1 -1
  6. package/lib/edit/src/mixin.js +10 -10
  7. package/lib/edit/src/mixin.min.js +1 -1
  8. package/lib/export/src/mixin.js +24 -13
  9. package/lib/export/src/mixin.min.js +1 -1
  10. package/lib/filter/src/mixin.js +13 -7
  11. package/lib/filter/src/mixin.min.js +1 -1
  12. package/lib/form/src/form.js +27 -5
  13. package/lib/form/src/form.min.js +1 -1
  14. package/lib/grid/src/grid.js +7 -3
  15. package/lib/grid/src/grid.min.js +1 -1
  16. package/lib/icon/style/style.css +1 -1
  17. package/lib/icon/style/style.min.css +1 -1
  18. package/lib/index.css +1 -1
  19. package/lib/index.umd.js +544 -229
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/input/src/input.js +11 -1
  22. package/lib/input/src/input.min.js +1 -1
  23. package/lib/locale/lang/en-US.js +8 -0
  24. package/lib/locale/lang/en-US.min.js +1 -1
  25. package/lib/locale/lang/en-US.umd.js +8 -0
  26. package/lib/locale/lang/es-ES.js +8 -0
  27. package/lib/locale/lang/es-ES.min.js +1 -1
  28. package/lib/locale/lang/es-ES.umd.js +8 -0
  29. package/lib/locale/lang/ja-JP.d.ts +1 -1
  30. package/lib/locale/lang/ja-JP.js +8 -0
  31. package/lib/locale/lang/ja-JP.min.js +1 -1
  32. package/lib/locale/lang/ja-JP.umd.js +8 -0
  33. package/lib/locale/lang/pt-BR.d.ts +8 -0
  34. package/lib/locale/lang/pt-BR.js +330 -0
  35. package/lib/locale/lang/pt-BR.min.js +1 -0
  36. package/lib/locale/lang/pt-BR.umd.js +344 -0
  37. package/lib/locale/lang/zh-CN.d.ts +1 -1
  38. package/lib/locale/lang/zh-CN.js +8 -0
  39. package/lib/locale/lang/zh-CN.min.js +1 -1
  40. package/lib/locale/lang/zh-CN.umd.js +8 -0
  41. package/lib/locale/lang/zh-HK.d.ts +1 -1
  42. package/lib/locale/lang/zh-HK.min.js +1 -1
  43. package/lib/locale/lang/zh-HK.umd.js +8 -0
  44. package/lib/locale/lang/zh-MO.d.ts +1 -1
  45. package/lib/locale/lang/zh-MO.min.js +1 -1
  46. package/lib/locale/lang/zh-MO.umd.js +8 -0
  47. package/lib/locale/lang/zh-TC.d.ts +1 -1
  48. package/lib/locale/lang/zh-TC.js +8 -0
  49. package/lib/locale/lang/zh-TC.min.js +1 -1
  50. package/lib/locale/lang/zh-TC.umd.js +8 -0
  51. package/lib/locale/lang/zh-TW.d.ts +1 -1
  52. package/lib/locale/lang/zh-TW.min.js +1 -1
  53. package/lib/locale/lang/zh-TW.umd.js +8 -0
  54. package/lib/menu/src/mixin.js +3 -3
  55. package/lib/menu/src/mixin.min.js +1 -1
  56. package/lib/pulldown/src/pulldown.js +11 -2
  57. package/lib/pulldown/src/pulldown.min.js +1 -1
  58. package/lib/select/src/select.js +11 -2
  59. package/lib/select/src/select.min.js +1 -1
  60. package/lib/style.css +1 -1
  61. package/lib/style.min.css +1 -1
  62. package/lib/table/src/body.js +3 -2
  63. package/lib/table/src/body.min.js +1 -1
  64. package/lib/table/src/cell.js +9 -7
  65. package/lib/table/src/cell.min.js +1 -1
  66. package/lib/table/src/columnInfo.js +7 -7
  67. package/lib/table/src/columnInfo.min.js +1 -1
  68. package/lib/table/src/methods.js +171 -124
  69. package/lib/table/src/methods.min.js +1 -1
  70. package/lib/table/src/table.js +22 -29
  71. package/lib/table/src/table.min.js +1 -1
  72. package/lib/table/src/util.js +3 -1
  73. package/lib/table/src/util.min.js +1 -1
  74. package/lib/table/style/style.css +7 -2
  75. package/lib/table/style/style.min.css +1 -1
  76. package/lib/textarea/src/textarea.js +6 -1
  77. package/lib/textarea/src/textarea.min.js +1 -1
  78. package/lib/toolbar/src/toolbar.js +23 -7
  79. package/lib/toolbar/src/toolbar.min.js +1 -1
  80. package/lib/tools/log.js +1 -1
  81. package/lib/tools/log.min.js +1 -1
  82. package/lib/tooltip/src/tooltip.js +5 -1
  83. package/lib/tooltip/src/tooltip.min.js +1 -1
  84. package/lib/tooltip/style/style.css +0 -6
  85. package/lib/tooltip/style/style.min.css +1 -1
  86. package/lib/v-x-e-table/index.js +3 -1
  87. package/lib/v-x-e-table/index.min.js +1 -1
  88. package/lib/v-x-e-table/src/commands.js +60 -2
  89. package/lib/v-x-e-table/src/commands.min.js +1 -1
  90. package/lib/v-x-e-table/src/conf.js +7 -4
  91. package/lib/v-x-e-table/src/conf.min.js +1 -1
  92. package/lib/v-x-e-table/src/formats.js +60 -2
  93. package/lib/v-x-e-table/src/formats.min.js +1 -1
  94. package/lib/v-x-e-table/src/menus.js +60 -2
  95. package/lib/v-x-e-table/src/menus.min.js +1 -1
  96. package/lib/v-x-e-table/src/renderer.js +10 -0
  97. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  98. package/lib/v-x-e-table/src/store.js +5 -2
  99. package/lib/v-x-e-table/src/store.min.js +1 -1
  100. package/lib/v-x-e-table/src/validators.js +15 -0
  101. package/lib/v-x-e-table/src/validators.min.js +1 -0
  102. package/lib/validator/src/mixin.js +36 -4
  103. package/lib/validator/src/mixin.min.js +1 -1
  104. package/package.json +2 -2
  105. package/packages/button/src/button.js +5 -4
  106. package/packages/edit/src/mixin.js +10 -9
  107. package/packages/export/src/mixin.js +22 -13
  108. package/packages/filter/src/mixin.js +5 -1
  109. package/packages/form/src/form.js +27 -6
  110. package/packages/grid/src/grid.js +7 -3
  111. package/packages/input/src/input.js +9 -1
  112. package/packages/locale/lang/en-US.js +8 -0
  113. package/packages/locale/lang/es-ES.js +8 -0
  114. package/packages/locale/lang/ja-JP.d.ts +1 -1
  115. package/packages/locale/lang/ja-JP.js +8 -0
  116. package/packages/locale/lang/pt-BR.d.ts +8 -0
  117. package/packages/locale/lang/pt-BR.js +323 -0
  118. package/packages/locale/lang/zh-CN.d.ts +1 -1
  119. package/packages/locale/lang/zh-CN.js +8 -0
  120. package/packages/locale/lang/zh-HK.d.ts +1 -1
  121. package/packages/locale/lang/zh-MO.d.ts +1 -1
  122. package/packages/locale/lang/zh-TC.d.ts +1 -1
  123. package/packages/locale/lang/zh-TC.js +8 -0
  124. package/packages/locale/lang/zh-TW.d.ts +1 -1
  125. package/packages/menu/src/mixin.js +3 -3
  126. package/packages/pulldown/src/pulldown.js +6 -3
  127. package/packages/select/src/select.js +7 -3
  128. package/packages/table/src/body.js +3 -2
  129. package/packages/table/src/cell.js +9 -5
  130. package/packages/table/src/columnInfo.js +7 -7
  131. package/packages/table/src/methods.js +142 -93
  132. package/packages/table/src/table.js +17 -7
  133. package/packages/table/src/util.js +3 -1
  134. package/packages/textarea/src/textarea.js +4 -1
  135. package/packages/toolbar/src/toolbar.js +22 -7
  136. package/packages/tooltip/src/tooltip.js +3 -2
  137. package/packages/v-x-e-table/index.js +2 -0
  138. package/packages/v-x-e-table/src/commands.js +50 -2
  139. package/packages/v-x-e-table/src/conf.js +7 -4
  140. package/packages/v-x-e-table/src/formats.js +50 -2
  141. package/packages/v-x-e-table/src/menus.js +50 -2
  142. package/packages/v-x-e-table/src/renderer.js +11 -1
  143. package/packages/v-x-e-table/src/store.js +4 -2
  144. package/packages/v-x-e-table/src/validators.js +7 -0
  145. package/packages/validator/src/mixin.js +35 -4
  146. package/styles/all.scss +30 -0
  147. package/styles/css-variable.scss +272 -0
  148. package/styles/cssvar.scss +2 -275
  149. package/styles/index.scss +2 -0
  150. package/styles/modules.scss +4 -1
  151. package/styles/table.scss +11 -4
  152. package/styles/tooltip.scss +0 -8
  153. package/styles/variable.scss +1 -4
  154. package/types/all.d.ts +2 -2
  155. package/types/colgroup.d.ts +3 -1
  156. package/types/column.d.ts +3 -0
  157. package/types/edit.d.ts +4 -2
  158. package/types/export.d.ts +3 -0
  159. package/types/filter.d.ts +3 -1
  160. package/types/footer.d.ts +3 -1
  161. package/types/form-item.d.ts +2 -0
  162. package/types/form.d.ts +16 -12
  163. package/types/grid.d.ts +3 -0
  164. package/types/header.d.ts +3 -1
  165. package/types/index.d.ts +1 -1
  166. package/types/input.d.ts +2 -0
  167. package/types/list.d.ts +1 -1
  168. package/types/menu.d.ts +2 -0
  169. package/types/modal.d.ts +7 -3
  170. package/types/pulldown.d.ts +2 -3
  171. package/types/table.d.ts +54 -30
  172. package/types/textarea.d.ts +1 -0
  173. package/types/toolbar.d.ts +2 -0
  174. package/types/tooltip.d.ts +1 -1
  175. package/types/v-x-e-table/commands.d.ts +23 -13
  176. package/types/v-x-e-table/formats.d.ts +21 -12
  177. package/types/v-x-e-table/index.d.ts +33 -26
  178. package/types/v-x-e-table/interceptor.d.ts +1 -1
  179. package/types/v-x-e-table/menus.d.ts +17 -6
  180. package/types/v-x-e-table/renderer.d.ts +5 -3
  181. package/types/v-x-e-table/setup.d.ts +10 -33
  182. package/types/v-x-e-table/validators.d.ts +30 -0
  183. package/types/validator.d.ts +15 -4
  184. /package/lib/icon/style/{iconfont.1688948811910.ttf → iconfont.1690849077922.ttf} +0 -0
  185. /package/lib/icon/style/{iconfont.1688948811910.woff → iconfont.1690849077922.woff} +0 -0
  186. /package/lib/icon/style/{iconfont.1688948811910.woff2 → iconfont.1690849077922.woff2} +0 -0
  187. /package/lib/{iconfont.1688948811910.ttf → iconfont.1690849077922.ttf} +0 -0
  188. /package/lib/{iconfont.1688948811910.woff → iconfont.1690849077922.woff} +0 -0
  189. /package/lib/{iconfont.1688948811910.woff2 → iconfont.1690849077922.woff2} +0 -0
@@ -357,6 +357,7 @@ const Methods = {
357
357
  */
358
358
  loadTableData (datas) {
359
359
  const { keepSource, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad, sXOpts, sYOpts } = this
360
+ const childrenField = treeOpts.children || treeOpts.childrenField
360
361
  let treeData = []
361
362
  let fullData = datas ? datas.slice(0) : []
362
363
  if (treeConfig) {
@@ -369,26 +370,26 @@ const Methods = {
369
370
  if (!treeOpts.parentField) {
370
371
  errLog('vxe.error.reqProp', ['table.tree-config.parentField'])
371
372
  }
372
- if (!treeOpts.children) {
373
- errLog('vxe.error.reqProp', ['tree-config.children'])
373
+ if (!childrenField) {
374
+ errLog('vxe.error.reqProp', ['tree-config.childrenField'])
374
375
  }
375
- if (!treeOpts.mapChildren) {
376
- errLog('vxe.error.reqProp', ['tree-config.mapChildren'])
376
+ if (!treeOpts.mapChildrenField) {
377
+ errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
377
378
  }
378
- if (treeOpts.children === treeOpts.mapChildren) {
379
- errLog('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren'])
379
+ if (childrenField === treeOpts.mapChildrenField) {
380
+ errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
380
381
  }
381
382
  fullData.forEach(row => {
382
- if (row[treeOpts.children] && row[treeOpts.children].length) {
383
- warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
383
+ if (row[childrenField] && row[childrenField].length) {
384
+ warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${childrenField}`])
384
385
  }
385
386
  })
386
387
  }
387
388
  treeData = XEUtils.toArrayTree(fullData, {
388
389
  key: treeOpts.rowField,
389
390
  parentKey: treeOpts.parentField,
390
- children: treeOpts.children,
391
- mapChildren: treeOpts.mapChildren
391
+ children: childrenField,
392
+ mapChildren: treeOpts.mapChildrenField
392
393
  })
393
394
  fullData = treeData.slice(0)
394
395
  } else {
@@ -414,7 +415,7 @@ const Methods = {
414
415
  this.tableSynchData = datas
415
416
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
416
417
  if (keepSource) {
417
- this.tableSourceData = XEUtils.clone(fullData, true)
418
+ this.cacheSourceMap(fullData)
418
419
  }
419
420
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
420
421
  if (sYLoad) {
@@ -592,6 +593,8 @@ const Methods = {
592
593
  cacheRowMap (source) {
593
594
  const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap, tableFullTreeData } = this
594
595
  let { fullDataRowIdData, fullAllDataRowIdData } = this
596
+ const childrenField = treeOpts.children || treeOpts.childrenField
597
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
595
598
  const rowkey = getRowkey(this)
596
599
  const isLazy = treeConfig && treeOpts.lazy
597
600
  const handleCache = (row, index, items, path, parent, nodes) => {
@@ -602,8 +605,8 @@ const Methods = {
602
605
  rowid = getRowUniqueId()
603
606
  XEUtils.set(row, rowkey, rowid)
604
607
  }
605
- if (isLazy && row[treeOpts.hasChild] && XEUtils.isUndefined(row[treeOpts.children])) {
606
- row[treeOpts.children] = null
608
+ if (isLazy && row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
609
+ row[childrenField] = null
607
610
  }
608
611
  const rest = { row, rowid, seq, index: treeConfig && parent ? -1 : index, _index: -1, $index: -1, items, parent, level }
609
612
  if (source) {
@@ -625,9 +628,34 @@ const Methods = {
625
628
  tableFullData.forEach(handleCache)
626
629
  }
627
630
  },
631
+ cacheSourceMap (fullData) {
632
+ let { treeConfig, treeOpts, sourceDataRowIdData } = this
633
+ const sourceData = XEUtils.clone(fullData, true)
634
+ const rowkey = getRowkey(this)
635
+ sourceDataRowIdData = this.sourceDataRowIdData = {}
636
+ const handleSourceRow = (row) => {
637
+ let rowid = getRowid(this, row)
638
+ if (eqEmptyValue(rowid)) {
639
+ rowid = getRowUniqueId()
640
+ XEUtils.set(row, rowkey, rowid)
641
+ }
642
+ sourceDataRowIdData[rowid] = {
643
+ row,
644
+ rowid
645
+ }
646
+ }
647
+ // 源数据缓存
648
+ if (treeConfig && !treeOpts.transform) {
649
+ XEUtils.eachTree(sourceData, handleSourceRow, treeOpts)
650
+ } else {
651
+ sourceData.forEach(handleSourceRow)
652
+ }
653
+ this.tableSourceData = sourceData
654
+ },
628
655
  loadTreeChildren (row, childRecords) {
629
656
  const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData } = this
630
- const { transform, children, mapChildren } = treeOpts
657
+ const { transform, mapChildrenField } = treeOpts
658
+ const childrenField = treeOpts.children || treeOpts.childrenField
631
659
  const rest = fullAllDataRowIdData[getRowid(this, row)]
632
660
  const parentLevel = rest ? rest.level : 0
633
661
  return this.createData(childRecords).then((rows) => {
@@ -635,7 +663,7 @@ const Methods = {
635
663
  const rowid = getRowid(this, row)
636
664
  const matchObj = XEUtils.findTree(tableSourceData, (item) => rowid === getRowid(this, item), treeOpts)
637
665
  if (matchObj) {
638
- matchObj.item[children] = XEUtils.clone(rows, true)
666
+ matchObj.item[childrenField] = XEUtils.clone(rows, true)
639
667
  }
640
668
  }
641
669
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
@@ -646,9 +674,9 @@ const Methods = {
646
674
  fullAllDataRowIdData[rowid] = rest
647
675
  fullAllDataRowMap.set(childRow, rest)
648
676
  }, treeOpts)
649
- row[children] = rows
677
+ row[childrenField] = rows
650
678
  if (transform) {
651
- row[mapChildren] = rows
679
+ row[mapChildrenField] = rows
652
680
  }
653
681
  this.updateAfterDataIndex()
654
682
  return rows
@@ -906,6 +934,7 @@ const Methods = {
906
934
  */
907
935
  defineField (records) {
908
936
  const { radioOpts, checkboxOpts, treeConfig, treeOpts, expandOpts } = this
937
+ const childrenField = treeOpts.children || treeOpts.childrenField
909
938
  const rowkey = getRowkey(this)
910
939
  if (!XEUtils.isArray(records)) {
911
940
  records = [records || {}]
@@ -932,8 +961,8 @@ const Methods = {
932
961
  XEUtils.set(record, key, null)
933
962
  }
934
963
  })
935
- if (treeConfig && treeOpts.lazy && XEUtils.isUndefined(record[treeOpts.children])) {
936
- record[treeOpts.children] = null
964
+ if (treeConfig && treeOpts.lazy && XEUtils.isUndefined(record[childrenField])) {
965
+ record[childrenField] = null
937
966
  }
938
967
  // 必须有行数据的唯一主键,可以自行设置;也可以默认生成一个随机数
939
968
  if (eqEmptyValue(XEUtils.get(record, rowkey))) {
@@ -1061,31 +1090,21 @@ const Methods = {
1061
1090
  * @param {String} field 字段名
1062
1091
  */
1063
1092
  isUpdateByRow (row, field) {
1064
- const { tableFullColumn, keepSource, treeConfig, treeOpts, tableSourceData, fullDataRowIdData } = this
1093
+ const { tableFullColumn, keepSource, sourceDataRowIdData, fullDataRowIdData } = this
1065
1094
  if (keepSource) {
1066
- let oRow, property
1067
1095
  const rowid = getRowid(this, row)
1068
1096
  // 新增的数据不需要检测
1069
1097
  if (!fullDataRowIdData[rowid]) {
1070
1098
  return false
1071
1099
  }
1072
- if (treeConfig) {
1073
- const children = treeOpts.children
1074
- const matchObj = XEUtils.findTree(tableSourceData, item => rowid === getRowid(this, item), treeOpts)
1075
- row = Object.assign({}, row, { [children]: null })
1076
- if (matchObj) {
1077
- oRow = Object.assign({}, matchObj.item, { [children]: null })
1078
- }
1079
- } else {
1080
- const oRowIndex = fullDataRowIdData[rowid].index
1081
- oRow = tableSourceData[oRowIndex]
1082
- }
1083
- if (oRow) {
1100
+ const oldRest = sourceDataRowIdData[rowid]
1101
+ if (oldRest) {
1102
+ const oRow = oldRest.row
1084
1103
  if (arguments.length > 1) {
1085
1104
  return !eqCellValue(oRow, row, field)
1086
1105
  }
1087
1106
  for (let index = 0, len = tableFullColumn.length; index < len; index++) {
1088
- property = tableFullColumn[index].field
1107
+ const property = tableFullColumn[index].field
1089
1108
  if (property && !eqCellValue(oRow, row, property)) {
1090
1109
  return true
1091
1110
  }
@@ -1142,22 +1161,23 @@ const Methods = {
1142
1161
  */
1143
1162
  getCheckboxRecords (isFull) {
1144
1163
  const { tableFullData, afterFullData, treeConfig, treeOpts, checkboxOpts, tableFullTreeData, afterTreeFullData } = this
1145
- const { transform, children, mapChildren } = treeOpts
1164
+ const { transform, mapChildrenField } = treeOpts
1146
1165
  const { checkField } = checkboxOpts
1166
+ const childrenField = treeOpts.children || treeOpts.childrenField
1147
1167
  const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
1148
1168
  let rowList = []
1149
1169
  if (checkField) {
1150
1170
  if (treeConfig) {
1151
- rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildren : children })
1171
+ rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, checkField), { children: transform ? mapChildrenField : childrenField })
1152
1172
  } else {
1153
1173
  rowList = currTableData.filter(row => XEUtils.get(row, checkField))
1154
1174
  }
1155
1175
  } else {
1156
- const { selection } = this
1176
+ const { selectCheckboxRows } = this
1157
1177
  if (treeConfig) {
1158
- rowList = XEUtils.filterTree(currTableData, row => this.findRowIndexOf(selection, row) > -1, { children: transform ? mapChildren : children })
1178
+ rowList = XEUtils.filterTree(currTableData, row => this.findRowIndexOf(selectCheckboxRows, row) > -1, { children: transform ? mapChildrenField : childrenField })
1159
1179
  } else {
1160
- rowList = currTableData.filter(row => this.findRowIndexOf(selection, row) > -1)
1180
+ rowList = currTableData.filter(row => this.findRowIndexOf(selectCheckboxRows, row) > -1)
1161
1181
  }
1162
1182
  }
1163
1183
  return rowList
@@ -1176,7 +1196,7 @@ const Methods = {
1176
1196
  expandMaps.set(row, 1)
1177
1197
  fullData.push(row)
1178
1198
  }
1179
- }, { children: treeOpts.mapChildren })
1199
+ }, { children: treeOpts.mapChildrenField })
1180
1200
  this.afterFullData = fullData
1181
1201
  this.updateScrollYStatus(fullData)
1182
1202
  return fullData
@@ -1300,6 +1320,7 @@ const Methods = {
1300
1320
  */
1301
1321
  updateAfterDataIndex () {
1302
1322
  const { treeConfig, afterFullData, fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData, treeOpts } = this
1323
+ const childrenField = treeOpts.children || treeOpts.childrenField
1303
1324
  if (treeConfig) {
1304
1325
  XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
1305
1326
  const rowid = getRowid(this, row)
@@ -1313,7 +1334,7 @@ const Methods = {
1313
1334
  fullAllDataRowIdData[rowid] = rest
1314
1335
  fullDataRowIdData[rowid] = rest
1315
1336
  }
1316
- }, { children: treeOpts.transform ? treeOpts.mapChildren : treeOpts.children })
1337
+ }, { children: treeOpts.transform ? treeOpts.mapChildrenField : childrenField })
1317
1338
  } else {
1318
1339
  afterFullData.forEach((row, index) => {
1319
1340
  const rowid = getRowid(this, row)
@@ -1460,7 +1481,7 @@ const Methods = {
1460
1481
  */
1461
1482
  showColumn (fieldOrColumn) {
1462
1483
  const column = handleFieldOrColumn(this, fieldOrColumn)
1463
- if (column & !column.visible) {
1484
+ if (column && column.visible) {
1464
1485
  column.visible = true
1465
1486
  return this.handleCustom()
1466
1487
  }
@@ -2035,6 +2056,7 @@ const Methods = {
2035
2056
  },
2036
2057
  updateHeight () {
2037
2058
  this.customHeight = calcHeight(this, 'height')
2059
+ this.customMinHeight = calcHeight(this, 'minHeight')
2038
2060
  this.customMaxHeight = calcHeight(this, 'maxHeight')
2039
2061
  },
2040
2062
  updateStyle () {
@@ -2044,6 +2066,7 @@ const Methods = {
2044
2066
  fullColumnIdData,
2045
2067
  tableColumn,
2046
2068
  customHeight,
2069
+ customMinHeight,
2047
2070
  customMaxHeight,
2048
2071
  border,
2049
2072
  headerHeight,
@@ -2156,15 +2179,22 @@ const Methods = {
2156
2179
  } else if (layout === 'body') {
2157
2180
  const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
2158
2181
  if (isNodeElement(wrapperElem)) {
2182
+ const bodyMinHeight = fixedType ? ((customMinHeight - headerHeight - footerHeight) - (showFooter ? 0 : scrollbarHeight)) : (customMinHeight - headerHeight - footerHeight)
2183
+ let bodyMaxHeight = 0
2159
2184
  if (customMaxHeight) {
2160
- wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight - footerHeight}px`
2161
- } else {
2162
- if (customHeight > 0) {
2163
- wrapperElem.style.height = `${fixedType ? (customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight) : customHeight - headerHeight - footerHeight}px`
2164
- } else {
2165
- wrapperElem.style.height = ''
2185
+ bodyMaxHeight = Math.max(bodyMinHeight, fixedType ? (customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight)) : (customMaxHeight - headerHeight - footerHeight))
2186
+ wrapperElem.style.maxHeight = `${bodyMaxHeight}px`
2187
+ }
2188
+ if (customHeight > 0) {
2189
+ let bodyHeight = fixedType ? ((customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight)) : (customHeight - headerHeight - footerHeight)
2190
+ if (bodyMaxHeight) {
2191
+ bodyHeight = Math.min(bodyMaxHeight, bodyHeight)
2166
2192
  }
2193
+ wrapperElem.style.height = `${Math.max(bodyMinHeight, bodyHeight)}px`
2194
+ } else {
2195
+ wrapperElem.style.height = ''
2167
2196
  }
2197
+ wrapperElem.style.minHeight = `${bodyMinHeight}px`
2168
2198
  }
2169
2199
 
2170
2200
  // 如果是固定列
@@ -2933,12 +2963,12 @@ const Methods = {
2933
2963
  return this.handleCheckedCheckboxRow(rows, value, true)
2934
2964
  },
2935
2965
  isCheckedByCheckboxRow (row) {
2936
- const { selection } = this
2966
+ const { selectCheckboxRows } = this
2937
2967
  const { checkField } = this.checkboxOpts
2938
2968
  if (checkField) {
2939
2969
  return XEUtils.get(row, checkField)
2940
2970
  }
2941
- return this.findRowIndexOf(selection, row) > -1
2971
+ return this.findRowIndexOf(selectCheckboxRows, row) > -1
2942
2972
  },
2943
2973
  isIndeterminateByCheckboxRow (row) {
2944
2974
  const { treeIndeterminates } = this
@@ -2949,7 +2979,7 @@ const Methods = {
2949
2979
  * value 选中true 不选false 半选-1
2950
2980
  */
2951
2981
  handleSelectRow ({ row }, value, isForce) {
2952
- const { selection, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
2982
+ const { selectCheckboxRows, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
2953
2983
  const { checkField, checkStrictly, checkMethod } = checkboxOpts
2954
2984
  if (checkField) {
2955
2985
  if (treeConfig && !checkStrictly) {
@@ -2994,15 +3024,15 @@ const Methods = {
2994
3024
  if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
2995
3025
  treeIndeterminates.push(row)
2996
3026
  }
2997
- XEUtils.remove(selection, item => this.eqRow(item, row))
3027
+ XEUtils.remove(selectCheckboxRows, item => this.eqRow(item, row))
2998
3028
  } else {
2999
3029
  // 更新子节点状态
3000
3030
  XEUtils.eachTree([row], (item) => {
3001
3031
  if (this.eqRow(item, row) || (isForce || (!checkMethod || checkMethod({ row: item })))) {
3002
3032
  if (value) {
3003
- selection.push(item)
3033
+ selectCheckboxRows.push(item)
3004
3034
  } else {
3005
- XEUtils.remove(selection, select => this.eqRow(select, item))
3035
+ XEUtils.remove(selectCheckboxRows, select => this.eqRow(select, item))
3006
3036
  }
3007
3037
  XEUtils.remove(treeIndeterminates, half => this.eqRow(half, item))
3008
3038
  this.handleCheckboxReserveRow(row, value)
@@ -3018,7 +3048,7 @@ const Methods = {
3018
3048
  if (indeterminatesItem) {
3019
3049
  parentStatus = -1
3020
3050
  } else {
3021
- const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selection, item) > -1)
3051
+ const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selectCheckboxRows, item) > -1)
3022
3052
  parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
3023
3053
  }
3024
3054
  return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
@@ -3026,11 +3056,11 @@ const Methods = {
3026
3056
  } else {
3027
3057
  if (isForce || (!checkMethod || checkMethod({ row }))) {
3028
3058
  if (value) {
3029
- if (this.findRowIndexOf(selection, row) === -1) {
3030
- selection.push(row)
3059
+ if (this.findRowIndexOf(selectCheckboxRows, row) === -1) {
3060
+ selectCheckboxRows.push(row)
3031
3061
  }
3032
3062
  } else {
3033
- XEUtils.remove(selection, item => this.eqRow(item, row))
3063
+ XEUtils.remove(selectCheckboxRows, item => this.eqRow(item, row))
3034
3064
  }
3035
3065
  this.handleCheckboxReserveRow(row, value)
3036
3066
  }
@@ -3039,10 +3069,10 @@ const Methods = {
3039
3069
  this.checkSelectionStatus()
3040
3070
  },
3041
3071
  handleToggleCheckRowEvent (evnt, params) {
3042
- const { selection, checkboxOpts } = this
3072
+ const { selectCheckboxRows, checkboxOpts } = this
3043
3073
  const { checkField } = checkboxOpts
3044
3074
  const { row } = params
3045
- const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selection, row) === -1
3075
+ const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1
3046
3076
  if (evnt) {
3047
3077
  this.triggerCheckRowEvent(evnt, params, value)
3048
3078
  } else {
@@ -3065,17 +3095,17 @@ const Methods = {
3065
3095
  * 多选,切换某一行的选中状态
3066
3096
  */
3067
3097
  toggleCheckboxRow (row) {
3068
- const { selection, checkboxOpts } = this
3098
+ const { selectCheckboxRows, checkboxOpts } = this
3069
3099
  const { checkField } = checkboxOpts
3070
- const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selection, row) === -1
3100
+ const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1
3071
3101
  this.handleSelectRow({ row }, value, true)
3072
3102
  return this.$nextTick()
3073
3103
  },
3074
3104
  handleCheckedAllCheckboxRow (value, isForce) {
3075
- const { afterFullData, treeConfig, treeOpts, selection, checkboxReserveRowMap, checkboxOpts } = this
3105
+ const { afterFullData, treeConfig, treeOpts, selectCheckboxRows, checkboxReserveRowMap, checkboxOpts } = this
3076
3106
  const { checkField, reserve, checkStrictly, checkMethod } = checkboxOpts
3077
3107
  let selectRows = []
3078
- const beforeSelection = treeConfig ? [] : selection.filter(row => this.findRowIndexOf(afterFullData, row) === -1)
3108
+ const beforeSelection = treeConfig ? [] : selectCheckboxRows.filter(row => this.findRowIndexOf(afterFullData, row) === -1)
3079
3109
  if (checkStrictly) {
3080
3110
  this.isAllSelected = value
3081
3111
  } else {
@@ -3122,7 +3152,7 @@ const Methods = {
3122
3152
  */
3123
3153
  if (!isForce && checkMethod) {
3124
3154
  XEUtils.eachTree(afterFullData, (row) => {
3125
- if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1) {
3155
+ if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selectCheckboxRows, row) > -1) {
3126
3156
  selectRows.push(row)
3127
3157
  }
3128
3158
  }, treeOpts)
@@ -3136,7 +3166,7 @@ const Methods = {
3136
3166
  * 如果不存在选中方法,则添加所有数据到临时集合中
3137
3167
  */
3138
3168
  if (!isForce && checkMethod) {
3139
- selectRows = afterFullData.filter((row) => this.findRowIndexOf(selection, row) > -1 || checkMethod({ row }))
3169
+ selectRows = afterFullData.filter((row) => this.findRowIndexOf(selectCheckboxRows, row) > -1 || checkMethod({ row }))
3140
3170
  } else {
3141
3171
  selectRows = afterFullData.slice(0)
3142
3172
  }
@@ -3147,7 +3177,7 @@ const Methods = {
3147
3177
  * 如果不存在选中方法,无需处理,临时集合默认为空
3148
3178
  */
3149
3179
  if (!isForce && checkMethod) {
3150
- selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1)
3180
+ selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selectCheckboxRows, row) > -1)
3151
3181
  }
3152
3182
  }
3153
3183
  }
@@ -3161,7 +3191,7 @@ const Methods = {
3161
3191
  afterFullData.forEach(row => this.handleCheckboxReserveRow(row, false))
3162
3192
  }
3163
3193
  }
3164
- this.selection = checkField ? [] : beforeSelection.concat(selectRows)
3194
+ this.selectCheckboxRows = checkField ? [] : beforeSelection.concat(selectRows)
3165
3195
  }
3166
3196
  this.treeIndeterminates = []
3167
3197
  this.checkSelectionStatus()
@@ -3175,7 +3205,7 @@ const Methods = {
3175
3205
  return this.handleCheckedAllCheckboxRow(value, true)
3176
3206
  },
3177
3207
  checkSelectionStatus () {
3178
- const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
3208
+ const { afterFullData, selectCheckboxRows, treeIndeterminates, checkboxOpts, treeConfig } = this
3179
3209
  const { checkField, halfField, checkStrictly, checkMethod } = checkboxOpts
3180
3210
  if (!checkStrictly) {
3181
3211
  const disableRows = []
@@ -3221,19 +3251,19 @@ const Methods = {
3221
3251
  disableRows.push(row)
3222
3252
  return true
3223
3253
  }
3224
- if (this.findRowIndexOf(selection, row) > -1) {
3254
+ if (this.findRowIndexOf(selectCheckboxRows, row) > -1) {
3225
3255
  checkRows.push(row)
3226
3256
  return true
3227
3257
  }
3228
3258
  return false
3229
3259
  }
3230
- : row => this.findRowIndexOf(selection, row) > -1
3260
+ : row => this.findRowIndexOf(selectCheckboxRows, row) > -1
3231
3261
  )
3232
3262
  isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
3233
3263
  if (treeConfig) {
3234
- isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(treeIndeterminates, row) > -1 || this.findRowIndexOf(selection, row) > -1)
3264
+ isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(treeIndeterminates, row) > -1 || this.findRowIndexOf(selectCheckboxRows, row) > -1)
3235
3265
  } else {
3236
- isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(selection, row) > -1)
3266
+ isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(selectCheckboxRows, row) > -1)
3237
3267
  }
3238
3268
  }
3239
3269
  this.isAllSelected = isAllSelected
@@ -3242,7 +3272,7 @@ const Methods = {
3242
3272
  },
3243
3273
  // 还原展开、选中等相关状态
3244
3274
  handleReserveStatus () {
3245
- const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRow, radioReserveRow, radioOpts, checkboxOpts, selection, rowExpandeds, treeExpandeds, expandOpts } = this
3275
+ const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxRows, rowExpandeds, treeExpandeds, expandOpts } = this
3246
3276
  // 单选框
3247
3277
  if (selectRow && !fullAllDataRowMap.has(selectRow)) {
3248
3278
  this.selectRow = null // 刷新单选行状态
@@ -3255,7 +3285,7 @@ const Methods = {
3255
3285
  }
3256
3286
  }
3257
3287
  // 复选框
3258
- this.selection = getRecoverRow(this, selection) // 刷新多选行状态
3288
+ this.selectCheckboxRows = getRecoverRow(this, selectCheckboxRows) // 刷新多选行状态
3259
3289
  // 还原保留选中状态
3260
3290
  if (checkboxOpts.reserve) {
3261
3291
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true)
@@ -3393,7 +3423,7 @@ const Methods = {
3393
3423
  }
3394
3424
  this.isAllSelected = false
3395
3425
  this.isIndeterminate = false
3396
- this.selection = []
3426
+ this.selectCheckboxRows = []
3397
3427
  this.treeIndeterminates = []
3398
3428
  return this.$nextTick()
3399
3429
  },
@@ -3743,7 +3773,10 @@ const Methods = {
3743
3773
  } else {
3744
3774
  this.sort({ field, order })
3745
3775
  }
3746
- const params = { column, field, property: field, order: column.order, sortList: this.getSortColumns() }
3776
+ const params = { $table: this, $event: evnt, column, field, property: field, order: column.order, sortList: this.getSortColumns(), sortTime: column.sortTime }
3777
+ if (this.mouseConfig && this.mouseOpts.area && this.handleSortEvent) {
3778
+ return this.handleSortEvent(evnt, params)
3779
+ }
3747
3780
  this.emitEvent('sort-change', params, evnt)
3748
3781
  }
3749
3782
  },
@@ -3788,7 +3821,10 @@ const Methods = {
3788
3821
  if (!remote || (firstSortColumn && firstSortColumn.remoteSort)) {
3789
3822
  this.handleTableData(true)
3790
3823
  }
3791
- return this.$nextTick().then(this.updateStyle)
3824
+ return this.$nextTick().then(() => {
3825
+ this.updateCellAreas()
3826
+ return this.updateStyle()
3827
+ })
3792
3828
  }
3793
3829
  return this.$nextTick()
3794
3830
  },
@@ -3955,7 +3991,16 @@ const Methods = {
3955
3991
  * @param {Boolean} expanded 是否展开
3956
3992
  */
3957
3993
  setAllRowExpand (expanded) {
3958
- return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded)
3994
+ const { treeConfig, treeOpts, tableFullData, tableFullTreeData } = this
3995
+ let expandedRows = []
3996
+ if (treeConfig) {
3997
+ XEUtils.eachTree(tableFullTreeData, (row) => {
3998
+ expandedRows.push(row)
3999
+ }, treeOpts)
4000
+ } else {
4001
+ expandedRows = tableFullData
4002
+ }
4003
+ return this.setRowExpand(expandedRows, expanded)
3959
4004
  },
3960
4005
  handleAsyncRowExpand (row) {
3961
4006
  const rest = this.fullAllDataRowMap.get(row)
@@ -4104,8 +4149,9 @@ const Methods = {
4104
4149
  */
4105
4150
  reloadTreeExpand (row) {
4106
4151
  const { treeOpts, treeLazyLoadeds } = this
4107
- const { transform, lazy, hasChild } = treeOpts
4108
- if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
4152
+ const { transform, lazy } = treeOpts
4153
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
4154
+ if (lazy && row[hasChildField] && treeLazyLoadeds.indexOf(row) === -1) {
4109
4155
  this.clearTreeExpandLoaded(row).then(() => {
4110
4156
  return this.handleAsyncTreeExpandChilds(row)
4111
4157
  }).then(() => {
@@ -4214,10 +4260,11 @@ const Methods = {
4214
4260
  */
4215
4261
  setAllTreeExpand (expanded) {
4216
4262
  const { tableFullData, treeOpts } = this
4217
- const { lazy, children } = treeOpts
4263
+ const { lazy } = treeOpts
4264
+ const childrenField = treeOpts.children || treeOpts.childrenField
4218
4265
  const expandeds = []
4219
4266
  XEUtils.eachTree(tableFullData, row => {
4220
- const rowChildren = row[children]
4267
+ const rowChildren = row[childrenField]
4221
4268
  if (lazy || (rowChildren && rowChildren.length)) {
4222
4269
  expandeds.push(row)
4223
4270
  }
@@ -4232,7 +4279,9 @@ const Methods = {
4232
4279
  */
4233
4280
  handleBaseTreeExpand (rows, expanded) {
4234
4281
  const { fullAllDataRowMap, tableFullData, treeExpandeds, treeOpts, treeLazyLoadeds, treeNodeColumn } = this
4235
- const { reserve, lazy, hasChild, children, accordion, toggleMethod } = treeOpts
4282
+ const { reserve, lazy, accordion, toggleMethod } = treeOpts
4283
+ const childrenField = treeOpts.children || treeOpts.childrenField
4284
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
4236
4285
  const result = []
4237
4286
  const columnIndex = this.getColumnIndex(treeNodeColumn)
4238
4287
  const $columnIndex = this.getVMColumnIndex(treeNodeColumn)
@@ -4249,12 +4298,12 @@ const Methods = {
4249
4298
  validRows.forEach(row => {
4250
4299
  if (treeExpandeds.indexOf(row) === -1) {
4251
4300
  const rest = fullAllDataRowMap.get(row)
4252
- const isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1
4301
+ const isLoad = lazy && row[(hasChildField)] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1
4253
4302
  // 是否使用懒加载
4254
4303
  if (isLoad) {
4255
4304
  result.push(this.handleAsyncTreeExpandChilds(row))
4256
4305
  } else {
4257
- if (row[children] && row[children].length) {
4306
+ if (row[childrenField] && row[childrenField].length) {
4258
4307
  treeExpandeds.push(row)
4259
4308
  }
4260
4309
  }
@@ -4654,12 +4703,12 @@ const Methods = {
4654
4703
  * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
4655
4704
  * 如果单元格配置了校验规则,则会进行校验
4656
4705
  */
4657
- updateStatus (scope, cellValue) {
4706
+ updateStatus (slotParams, cellValue) {
4658
4707
  const customVal = !XEUtils.isUndefined(cellValue)
4659
4708
  return this.$nextTick().then(() => {
4660
4709
  const { $refs, editRules, validStore } = this
4661
- if (scope && $refs.tableBody && editRules) {
4662
- const { row, column } = scope
4710
+ if (slotParams && $refs.tableBody && editRules) {
4711
+ const { row, column } = slotParams
4663
4712
  const type = 'change'
4664
4713
  if (this.hasCellRules(type, row, column)) {
4665
4714
  const cell = this.getCell(row, column)
@@ -4826,11 +4875,11 @@ const Methods = {
4826
4875
  }
4827
4876
  const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
4828
4877
  if (XEUtils.isString(formatter)) {
4829
- const globalFunc = formats.get(formatter)
4830
- cellLabel = globalFunc ? globalFunc(formatParams) : ''
4878
+ const gFormatOpts = formats.get(formatter)
4879
+ cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams) : ''
4831
4880
  } else if (XEUtils.isArray(formatter)) {
4832
- const globalFunc = formats.get(formatter[0])
4833
- cellLabel = globalFunc ? globalFunc(formatParams, ...formatter.slice(1)) : ''
4881
+ const gFormatOpts = formats.get(formatter[0])
4882
+ cellLabel = gFormatOpts && gFormatOpts.cellFormatMethod ? gFormatOpts.cellFormatMethod(formatParams, ...formatter.slice(1)) : ''
4834
4883
  } else {
4835
4884
  cellLabel = formatter(formatParams)
4836
4885
  }