doway-coms 1.1.49 → 1.1.50

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 (627) hide show
  1. package/dist/css/{index.09276b50.css → index.7946d50b.css} +1 -1
  2. package/dist/js/{chunk-vendors.e0519f75.js → chunk-vendors.28fda91d.js} +22 -22
  3. package/dist/js/index.49bc6add.js +2 -0
  4. package/lib/package.json +30 -0
  5. package/node_modules/vxe-table/LICENSE +21 -0
  6. package/node_modules/vxe-table/README.md +170 -0
  7. package/node_modules/vxe-table/helper/vetur/attributes.json +1770 -0
  8. package/node_modules/vxe-table/helper/vetur/tags.json +588 -0
  9. package/node_modules/vxe-table/lib/all.js +528 -0
  10. package/node_modules/vxe-table/lib/all.min.js +1 -0
  11. package/node_modules/vxe-table/lib/button/index.d.ts +4 -0
  12. package/node_modules/vxe-table/lib/button/index.js +19 -0
  13. package/node_modules/vxe-table/lib/button/index.min.js +1 -0
  14. package/node_modules/vxe-table/lib/button/src/button.js +414 -0
  15. package/node_modules/vxe-table/lib/button/src/button.min.js +1 -0
  16. package/node_modules/vxe-table/lib/button/style/index.js +1 -0
  17. package/node_modules/vxe-table/lib/button/style/style.css +478 -0
  18. package/node_modules/vxe-table/lib/button/style/style.min.css +1 -0
  19. package/node_modules/vxe-table/lib/checkbox/index.d.ts +4 -0
  20. package/node_modules/vxe-table/lib/checkbox/index.js +19 -0
  21. package/node_modules/vxe-table/lib/checkbox/index.min.js +1 -0
  22. package/node_modules/vxe-table/lib/checkbox/src/checkbox.js +128 -0
  23. package/node_modules/vxe-table/lib/checkbox/src/checkbox.min.js +1 -0
  24. package/node_modules/vxe-table/lib/checkbox/src/group.js +62 -0
  25. package/node_modules/vxe-table/lib/checkbox/src/group.min.js +1 -0
  26. package/node_modules/vxe-table/lib/checkbox/style/index.js +1 -0
  27. package/node_modules/vxe-table/lib/checkbox/style/style.css +294 -0
  28. package/node_modules/vxe-table/lib/checkbox/style/style.min.css +1 -0
  29. package/node_modules/vxe-table/lib/checkbox-group/index.d.ts +4 -0
  30. package/node_modules/vxe-table/lib/checkbox-group/index.js +19 -0
  31. package/node_modules/vxe-table/lib/checkbox-group/index.min.js +1 -0
  32. package/node_modules/vxe-table/lib/checkbox-group/style/index.js +1 -0
  33. package/node_modules/vxe-table/lib/checkbox-group/style/style.css +25 -0
  34. package/node_modules/vxe-table/lib/checkbox-group/style/style.min.css +0 -0
  35. package/node_modules/vxe-table/lib/colgroup/index.d.ts +4 -0
  36. package/node_modules/vxe-table/lib/colgroup/index.js +21 -0
  37. package/node_modules/vxe-table/lib/colgroup/index.min.js +1 -0
  38. package/node_modules/vxe-table/lib/colgroup/style/index.js +1 -0
  39. package/node_modules/vxe-table/lib/colgroup/style/style.css +25 -0
  40. package/node_modules/vxe-table/lib/colgroup/style/style.min.css +0 -0
  41. package/node_modules/vxe-table/lib/column/index.d.ts +4 -0
  42. package/node_modules/vxe-table/lib/column/index.js +21 -0
  43. package/node_modules/vxe-table/lib/column/index.min.js +1 -0
  44. package/node_modules/vxe-table/lib/column/style/index.js +1 -0
  45. package/node_modules/vxe-table/lib/column/style/style.css +25 -0
  46. package/node_modules/vxe-table/lib/column/style/style.min.css +0 -0
  47. package/node_modules/vxe-table/lib/edit/index.d.ts +4 -0
  48. package/node_modules/vxe-table/lib/edit/index.js +25 -0
  49. package/node_modules/vxe-table/lib/edit/index.min.js +1 -0
  50. package/node_modules/vxe-table/lib/edit/src/mixin.js +997 -0
  51. package/node_modules/vxe-table/lib/edit/src/mixin.min.js +1 -0
  52. package/node_modules/vxe-table/lib/edit/style/index.js +1 -0
  53. package/node_modules/vxe-table/lib/edit/style/style.css +25 -0
  54. package/node_modules/vxe-table/lib/edit/style/style.min.css +0 -0
  55. package/node_modules/vxe-table/lib/export/index.d.ts +4 -0
  56. package/node_modules/vxe-table/lib/export/index.js +75 -0
  57. package/node_modules/vxe-table/lib/export/index.min.js +1 -0
  58. package/node_modules/vxe-table/lib/export/src/export-panel.js +451 -0
  59. package/node_modules/vxe-table/lib/export/src/export-panel.min.js +1 -0
  60. package/node_modules/vxe-table/lib/export/src/import-panel.js +196 -0
  61. package/node_modules/vxe-table/lib/export/src/import-panel.min.js +1 -0
  62. package/node_modules/vxe-table/lib/export/src/mixin.js +1943 -0
  63. package/node_modules/vxe-table/lib/export/src/mixin.min.js +1 -0
  64. package/node_modules/vxe-table/lib/export/style/index.js +1 -0
  65. package/node_modules/vxe-table/lib/export/style/style.css +255 -0
  66. package/node_modules/vxe-table/lib/export/style/style.min.css +1 -0
  67. package/node_modules/vxe-table/lib/filter/index.d.ts +4 -0
  68. package/node_modules/vxe-table/lib/filter/index.js +30 -0
  69. package/node_modules/vxe-table/lib/filter/index.min.js +1 -0
  70. package/node_modules/vxe-table/lib/filter/src/mixin.js +357 -0
  71. package/node_modules/vxe-table/lib/filter/src/mixin.min.js +1 -0
  72. package/node_modules/vxe-table/lib/filter/src/panel.js +220 -0
  73. package/node_modules/vxe-table/lib/filter/src/panel.min.js +1 -0
  74. package/node_modules/vxe-table/lib/filter/style/index.js +1 -0
  75. package/node_modules/vxe-table/lib/filter/style/style.css +208 -0
  76. package/node_modules/vxe-table/lib/filter/style/style.min.css +1 -0
  77. package/node_modules/vxe-table/lib/footer/index.d.ts +4 -0
  78. package/node_modules/vxe-table/lib/footer/index.js +19 -0
  79. package/node_modules/vxe-table/lib/footer/index.min.js +1 -0
  80. package/node_modules/vxe-table/lib/footer/src/footer.js +375 -0
  81. package/node_modules/vxe-table/lib/footer/src/footer.min.js +1 -0
  82. package/node_modules/vxe-table/lib/footer/style/index.js +1 -0
  83. package/node_modules/vxe-table/lib/footer/style/style.css +42 -0
  84. package/node_modules/vxe-table/lib/footer/style/style.min.css +1 -0
  85. package/node_modules/vxe-table/lib/form/index.d.ts +4 -0
  86. package/node_modules/vxe-table/lib/form/index.js +19 -0
  87. package/node_modules/vxe-table/lib/form/index.min.js +1 -0
  88. package/node_modules/vxe-table/lib/form/src/form-gather.js +37 -0
  89. package/node_modules/vxe-table/lib/form/src/form-gather.min.js +1 -0
  90. package/node_modules/vxe-table/lib/form/src/form-item.js +195 -0
  91. package/node_modules/vxe-table/lib/form/src/form-item.min.js +1 -0
  92. package/node_modules/vxe-table/lib/form/src/form.js +876 -0
  93. package/node_modules/vxe-table/lib/form/src/form.min.js +1 -0
  94. package/node_modules/vxe-table/lib/form/src/render.js +84 -0
  95. package/node_modules/vxe-table/lib/form/src/render.min.js +1 -0
  96. package/node_modules/vxe-table/lib/form/src/util.js +127 -0
  97. package/node_modules/vxe-table/lib/form/src/util.min.js +1 -0
  98. package/node_modules/vxe-table/lib/form/style/index.js +1 -0
  99. package/node_modules/vxe-table/lib/form/style/style.css +329 -0
  100. package/node_modules/vxe-table/lib/form/style/style.min.css +1 -0
  101. package/node_modules/vxe-table/lib/form-gather/index.d.ts +4 -0
  102. package/node_modules/vxe-table/lib/form-gather/index.js +19 -0
  103. package/node_modules/vxe-table/lib/form-gather/index.min.js +1 -0
  104. package/node_modules/vxe-table/lib/form-gather/style/index.js +1 -0
  105. package/node_modules/vxe-table/lib/form-gather/style/style.css +25 -0
  106. package/node_modules/vxe-table/lib/form-gather/style/style.min.css +0 -0
  107. package/node_modules/vxe-table/lib/form-item/index.d.ts +4 -0
  108. package/node_modules/vxe-table/lib/form-item/index.js +19 -0
  109. package/node_modules/vxe-table/lib/form-item/index.min.js +1 -0
  110. package/node_modules/vxe-table/lib/form-item/style/index.js +1 -0
  111. package/node_modules/vxe-table/lib/form-item/style/style.css +25 -0
  112. package/node_modules/vxe-table/lib/form-item/style/style.min.css +0 -0
  113. package/node_modules/vxe-table/lib/grid/index.d.ts +4 -0
  114. package/node_modules/vxe-table/lib/grid/index.js +23 -0
  115. package/node_modules/vxe-table/lib/grid/index.min.js +1 -0
  116. package/node_modules/vxe-table/lib/grid/src/grid.js +1338 -0
  117. package/node_modules/vxe-table/lib/grid/src/grid.min.js +1 -0
  118. package/node_modules/vxe-table/lib/grid/style/index.js +1 -0
  119. package/node_modules/vxe-table/lib/grid/style/style.css +78 -0
  120. package/node_modules/vxe-table/lib/grid/style/style.min.css +1 -0
  121. package/node_modules/vxe-table/lib/header/index.d.ts +4 -0
  122. package/node_modules/vxe-table/lib/header/index.js +19 -0
  123. package/node_modules/vxe-table/lib/header/index.min.js +1 -0
  124. package/node_modules/vxe-table/lib/header/src/header.js +378 -0
  125. package/node_modules/vxe-table/lib/header/src/header.min.js +1 -0
  126. package/node_modules/vxe-table/lib/header/src/util.js +92 -0
  127. package/node_modules/vxe-table/lib/header/src/util.min.js +1 -0
  128. package/node_modules/vxe-table/lib/header/style/index.js +1 -0
  129. package/node_modules/vxe-table/lib/header/style/style.css +129 -0
  130. package/node_modules/vxe-table/lib/header/style/style.min.css +1 -0
  131. package/node_modules/vxe-table/lib/icon/index.d.ts +4 -0
  132. package/node_modules/vxe-table/lib/icon/index.js +13 -0
  133. package/node_modules/vxe-table/lib/icon/index.min.js +1 -0
  134. package/node_modules/vxe-table/lib/icon/style/index.js +1 -0
  135. package/node_modules/vxe-table/lib/icon/style/style.css +533 -0
  136. package/node_modules/vxe-table/lib/icon/style/style.min.css +1 -0
  137. package/node_modules/vxe-table/lib/index.common.js +30 -0
  138. package/node_modules/vxe-table/lib/index.common.min.js +1 -0
  139. package/node_modules/vxe-table/lib/index.css +1 -0
  140. package/node_modules/vxe-table/lib/index.umd.js +38912 -0
  141. package/node_modules/vxe-table/lib/index.umd.min.js +1 -0
  142. package/node_modules/vxe-table/lib/input/index.d.ts +4 -0
  143. package/node_modules/vxe-table/lib/input/index.js +19 -0
  144. package/node_modules/vxe-table/lib/input/index.min.js +1 -0
  145. package/node_modules/vxe-table/lib/input/src/date.js +54 -0
  146. package/node_modules/vxe-table/lib/input/src/date.min.js +1 -0
  147. package/node_modules/vxe-table/lib/input/src/input.js +2452 -0
  148. package/node_modules/vxe-table/lib/input/src/input.min.js +1 -0
  149. package/node_modules/vxe-table/lib/input/src/number.js +23 -0
  150. package/node_modules/vxe-table/lib/input/src/number.min.js +1 -0
  151. package/node_modules/vxe-table/lib/input/style/index.js +1 -0
  152. package/node_modules/vxe-table/lib/input/style/style.css +874 -0
  153. package/node_modules/vxe-table/lib/input/style/style.min.css +1 -0
  154. package/node_modules/vxe-table/lib/keyboard/index.d.ts +4 -0
  155. package/node_modules/vxe-table/lib/keyboard/index.js +25 -0
  156. package/node_modules/vxe-table/lib/keyboard/index.min.js +1 -0
  157. package/node_modules/vxe-table/lib/keyboard/src/mixin.js +487 -0
  158. package/node_modules/vxe-table/lib/keyboard/src/mixin.min.js +1 -0
  159. package/node_modules/vxe-table/lib/keyboard/style/index.js +1 -0
  160. package/node_modules/vxe-table/lib/keyboard/style/style.css +25 -0
  161. package/node_modules/vxe-table/lib/keyboard/style/style.min.css +0 -0
  162. package/node_modules/vxe-table/lib/list/index.d.ts +4 -0
  163. package/node_modules/vxe-table/lib/list/index.js +19 -0
  164. package/node_modules/vxe-table/lib/list/index.min.js +1 -0
  165. package/node_modules/vxe-table/lib/list/src/list.js +386 -0
  166. package/node_modules/vxe-table/lib/list/src/list.min.js +1 -0
  167. package/node_modules/vxe-table/lib/list/style/index.js +1 -0
  168. package/node_modules/vxe-table/lib/list/style/style.css +46 -0
  169. package/node_modules/vxe-table/lib/list/style/style.min.css +1 -0
  170. package/node_modules/vxe-table/lib/locale/lang/en-US.d.ts +8 -0
  171. package/node_modules/vxe-table/lib/locale/lang/en-US.js +312 -0
  172. package/node_modules/vxe-table/lib/locale/lang/en-US.min.js +1 -0
  173. package/node_modules/vxe-table/lib/locale/lang/en-US.umd.js +326 -0
  174. package/node_modules/vxe-table/lib/locale/lang/ja-JP.d.ts +8 -0
  175. package/node_modules/vxe-table/lib/locale/lang/ja-JP.js +312 -0
  176. package/node_modules/vxe-table/lib/locale/lang/ja-JP.min.js +1 -0
  177. package/node_modules/vxe-table/lib/locale/lang/ja-JP.umd.js +326 -0
  178. package/node_modules/vxe-table/lib/locale/lang/language.d.ts +5 -0
  179. package/node_modules/vxe-table/lib/locale/lang/zh-CN.d.ts +8 -0
  180. package/node_modules/vxe-table/lib/locale/lang/zh-CN.js +312 -0
  181. package/node_modules/vxe-table/lib/locale/lang/zh-CN.min.js +1 -0
  182. package/node_modules/vxe-table/lib/locale/lang/zh-CN.umd.js +326 -0
  183. package/node_modules/vxe-table/lib/locale/lang/zh-HK.d.ts +8 -0
  184. package/node_modules/vxe-table/lib/locale/lang/zh-HK.js +13 -0
  185. package/node_modules/vxe-table/lib/locale/lang/zh-HK.min.js +1 -0
  186. package/node_modules/vxe-table/lib/locale/lang/zh-HK.umd.js +326 -0
  187. package/node_modules/vxe-table/lib/locale/lang/zh-MO.d.ts +8 -0
  188. package/node_modules/vxe-table/lib/locale/lang/zh-MO.js +13 -0
  189. package/node_modules/vxe-table/lib/locale/lang/zh-MO.min.js +1 -0
  190. package/node_modules/vxe-table/lib/locale/lang/zh-MO.umd.js +326 -0
  191. package/node_modules/vxe-table/lib/locale/lang/zh-TC.d.ts +8 -0
  192. package/node_modules/vxe-table/lib/locale/lang/zh-TC.js +312 -0
  193. package/node_modules/vxe-table/lib/locale/lang/zh-TC.min.js +1 -0
  194. package/node_modules/vxe-table/lib/locale/lang/zh-TC.umd.js +326 -0
  195. package/node_modules/vxe-table/lib/locale/lang/zh-TW.d.ts +8 -0
  196. package/node_modules/vxe-table/lib/locale/lang/zh-TW.js +13 -0
  197. package/node_modules/vxe-table/lib/locale/lang/zh-TW.min.js +1 -0
  198. package/node_modules/vxe-table/lib/locale/lang/zh-TW.umd.js +326 -0
  199. package/node_modules/vxe-table/lib/menu/index.d.ts +4 -0
  200. package/node_modules/vxe-table/lib/menu/index.js +30 -0
  201. package/node_modules/vxe-table/lib/menu/index.min.js +1 -0
  202. package/node_modules/vxe-table/lib/menu/src/mixin.js +394 -0
  203. package/node_modules/vxe-table/lib/menu/src/mixin.min.js +1 -0
  204. package/node_modules/vxe-table/lib/menu/src/panel.js +103 -0
  205. package/node_modules/vxe-table/lib/menu/src/panel.min.js +1 -0
  206. package/node_modules/vxe-table/lib/menu/style/index.js +1 -0
  207. package/node_modules/vxe-table/lib/menu/style/style.css +117 -0
  208. package/node_modules/vxe-table/lib/menu/style/style.min.css +1 -0
  209. package/node_modules/vxe-table/lib/mixins/size.js +16 -0
  210. package/node_modules/vxe-table/lib/mixins/size.min.js +1 -0
  211. package/node_modules/vxe-table/lib/modal/index.d.ts +4 -0
  212. package/node_modules/vxe-table/lib/modal/index.js +149 -0
  213. package/node_modules/vxe-table/lib/modal/index.min.js +1 -0
  214. package/node_modules/vxe-table/lib/modal/src/modal.js +1233 -0
  215. package/node_modules/vxe-table/lib/modal/src/modal.min.js +1 -0
  216. package/node_modules/vxe-table/lib/modal/style/index.js +1 -0
  217. package/node_modules/vxe-table/lib/modal/style/style.css +309 -0
  218. package/node_modules/vxe-table/lib/modal/style/style.min.css +1 -0
  219. package/node_modules/vxe-table/lib/optgroup/index.d.ts +4 -0
  220. package/node_modules/vxe-table/lib/optgroup/index.js +19 -0
  221. package/node_modules/vxe-table/lib/optgroup/index.min.js +1 -0
  222. package/node_modules/vxe-table/lib/optgroup/style/index.js +1 -0
  223. package/node_modules/vxe-table/lib/optgroup/style/style.css +25 -0
  224. package/node_modules/vxe-table/lib/optgroup/style/style.min.css +0 -0
  225. package/node_modules/vxe-table/lib/option/index.d.ts +4 -0
  226. package/node_modules/vxe-table/lib/option/index.js +19 -0
  227. package/node_modules/vxe-table/lib/option/index.min.js +1 -0
  228. package/node_modules/vxe-table/lib/option/style/index.js +1 -0
  229. package/node_modules/vxe-table/lib/option/style/style.css +25 -0
  230. package/node_modules/vxe-table/lib/option/style/style.min.css +0 -0
  231. package/node_modules/vxe-table/lib/pager/index.d.ts +4 -0
  232. package/node_modules/vxe-table/lib/pager/index.js +19 -0
  233. package/node_modules/vxe-table/lib/pager/index.min.js +1 -0
  234. package/node_modules/vxe-table/lib/pager/src/pager.js +508 -0
  235. package/node_modules/vxe-table/lib/pager/src/pager.min.js +1 -0
  236. package/node_modules/vxe-table/lib/pager/style/index.js +1 -0
  237. package/node_modules/vxe-table/lib/pager/style/style.css +300 -0
  238. package/node_modules/vxe-table/lib/pager/style/style.min.css +1 -0
  239. package/node_modules/vxe-table/lib/pulldown/index.d.ts +4 -0
  240. package/node_modules/vxe-table/lib/pulldown/index.js +19 -0
  241. package/node_modules/vxe-table/lib/pulldown/index.min.js +1 -0
  242. package/node_modules/vxe-table/lib/pulldown/src/pulldown.js +336 -0
  243. package/node_modules/vxe-table/lib/pulldown/src/pulldown.min.js +1 -0
  244. package/node_modules/vxe-table/lib/pulldown/style/index.js +1 -0
  245. package/node_modules/vxe-table/lib/pulldown/style/style.css +81 -0
  246. package/node_modules/vxe-table/lib/pulldown/style/style.min.css +1 -0
  247. package/node_modules/vxe-table/lib/radio/index.d.ts +4 -0
  248. package/node_modules/vxe-table/lib/radio/index.js +19 -0
  249. package/node_modules/vxe-table/lib/radio/index.min.js +1 -0
  250. package/node_modules/vxe-table/lib/radio/src/button.js +128 -0
  251. package/node_modules/vxe-table/lib/radio/src/button.min.js +1 -0
  252. package/node_modules/vxe-table/lib/radio/src/group.js +60 -0
  253. package/node_modules/vxe-table/lib/radio/src/group.min.js +1 -0
  254. package/node_modules/vxe-table/lib/radio/src/radio.js +132 -0
  255. package/node_modules/vxe-table/lib/radio/src/radio.min.js +1 -0
  256. package/node_modules/vxe-table/lib/radio/style/index.js +1 -0
  257. package/node_modules/vxe-table/lib/radio/style/style.css +330 -0
  258. package/node_modules/vxe-table/lib/radio/style/style.min.css +1 -0
  259. package/node_modules/vxe-table/lib/radio-button/index.d.ts +4 -0
  260. package/node_modules/vxe-table/lib/radio-button/index.js +19 -0
  261. package/node_modules/vxe-table/lib/radio-button/index.min.js +1 -0
  262. package/node_modules/vxe-table/lib/radio-button/style/index.js +1 -0
  263. package/node_modules/vxe-table/lib/radio-button/style/style.css +25 -0
  264. package/node_modules/vxe-table/lib/radio-button/style/style.min.css +0 -0
  265. package/node_modules/vxe-table/lib/radio-group/index.d.ts +4 -0
  266. package/node_modules/vxe-table/lib/radio-group/index.js +19 -0
  267. package/node_modules/vxe-table/lib/radio-group/index.min.js +1 -0
  268. package/node_modules/vxe-table/lib/radio-group/style/index.js +1 -0
  269. package/node_modules/vxe-table/lib/radio-group/style/style.css +25 -0
  270. package/node_modules/vxe-table/lib/radio-group/style/style.min.css +0 -0
  271. package/node_modules/vxe-table/lib/select/index.d.ts +4 -0
  272. package/node_modules/vxe-table/lib/select/index.js +27 -0
  273. package/node_modules/vxe-table/lib/select/index.min.js +1 -0
  274. package/node_modules/vxe-table/lib/select/src/optgroup.js +60 -0
  275. package/node_modules/vxe-table/lib/select/src/optgroup.min.js +1 -0
  276. package/node_modules/vxe-table/lib/select/src/option.js +54 -0
  277. package/node_modules/vxe-table/lib/select/src/option.min.js +1 -0
  278. package/node_modules/vxe-table/lib/select/src/select.js +941 -0
  279. package/node_modules/vxe-table/lib/select/src/select.min.js +1 -0
  280. package/node_modules/vxe-table/lib/select/src/util.js +91 -0
  281. package/node_modules/vxe-table/lib/select/src/util.min.js +1 -0
  282. package/node_modules/vxe-table/lib/select/style/index.js +1 -0
  283. package/node_modules/vxe-table/lib/select/style/style.css +247 -0
  284. package/node_modules/vxe-table/lib/select/style/style.min.css +1 -0
  285. package/node_modules/vxe-table/lib/style.css +1 -0
  286. package/node_modules/vxe-table/lib/style.min.css +1 -0
  287. package/node_modules/vxe-table/lib/switch/index.d.ts +4 -0
  288. package/node_modules/vxe-table/lib/switch/index.js +19 -0
  289. package/node_modules/vxe-table/lib/switch/index.min.js +1 -0
  290. package/node_modules/vxe-table/lib/switch/src/switch.js +158 -0
  291. package/node_modules/vxe-table/lib/switch/src/switch.min.js +1 -0
  292. package/node_modules/vxe-table/lib/switch/style/index.js +1 -0
  293. package/node_modules/vxe-table/lib/switch/style/style.css +107 -0
  294. package/node_modules/vxe-table/lib/switch/style/style.min.css +1 -0
  295. package/node_modules/vxe-table/lib/table/index.d.ts +4 -0
  296. package/node_modules/vxe-table/lib/table/index.js +44 -0
  297. package/node_modules/vxe-table/lib/table/index.min.js +1 -0
  298. package/node_modules/vxe-table/lib/table/src/body.js +947 -0
  299. package/node_modules/vxe-table/lib/table/src/body.min.js +1 -0
  300. package/node_modules/vxe-table/lib/table/src/cell.js +948 -0
  301. package/node_modules/vxe-table/lib/table/src/cell.min.js +1 -0
  302. package/node_modules/vxe-table/lib/table/src/column.js +158 -0
  303. package/node_modules/vxe-table/lib/table/src/column.min.js +1 -0
  304. package/node_modules/vxe-table/lib/table/src/columnInfo.js +202 -0
  305. package/node_modules/vxe-table/lib/table/src/columnInfo.min.js +1 -0
  306. package/node_modules/vxe-table/lib/table/src/group.js +22 -0
  307. package/node_modules/vxe-table/lib/table/src/group.min.js +1 -0
  308. package/node_modules/vxe-table/lib/table/src/methods.js +6541 -0
  309. package/node_modules/vxe-table/lib/table/src/methods.min.js +1 -0
  310. package/node_modules/vxe-table/lib/table/src/table.js +1439 -0
  311. package/node_modules/vxe-table/lib/table/src/table.min.js +1 -0
  312. package/node_modules/vxe-table/lib/table/src/util.js +390 -0
  313. package/node_modules/vxe-table/lib/table/src/util.min.js +1 -0
  314. package/node_modules/vxe-table/lib/table/style/index.js +1 -0
  315. package/node_modules/vxe-table/lib/table/style/style.css +1142 -0
  316. package/node_modules/vxe-table/lib/table/style/style.min.css +1 -0
  317. package/node_modules/vxe-table/lib/textarea/index.d.ts +4 -0
  318. package/node_modules/vxe-table/lib/textarea/index.js +19 -0
  319. package/node_modules/vxe-table/lib/textarea/index.min.js +1 -0
  320. package/node_modules/vxe-table/lib/textarea/src/textarea.js +293 -0
  321. package/node_modules/vxe-table/lib/textarea/src/textarea.min.js +1 -0
  322. package/node_modules/vxe-table/lib/textarea/style/index.js +1 -0
  323. package/node_modules/vxe-table/lib/textarea/style/style.css +115 -0
  324. package/node_modules/vxe-table/lib/textarea/style/style.min.css +1 -0
  325. package/node_modules/vxe-table/lib/toolbar/index.d.ts +4 -0
  326. package/node_modules/vxe-table/lib/toolbar/index.js +19 -0
  327. package/node_modules/vxe-table/lib/toolbar/index.min.js +1 -0
  328. package/node_modules/vxe-table/lib/toolbar/src/toolbar.js +820 -0
  329. package/node_modules/vxe-table/lib/toolbar/src/toolbar.min.js +1 -0
  330. package/node_modules/vxe-table/lib/toolbar/style/index.js +1 -0
  331. package/node_modules/vxe-table/lib/toolbar/style/style.css +315 -0
  332. package/node_modules/vxe-table/lib/toolbar/style/style.min.css +1 -0
  333. package/node_modules/vxe-table/lib/tools/dom.js +234 -0
  334. package/node_modules/vxe-table/lib/tools/dom.min.js +1 -0
  335. package/node_modules/vxe-table/lib/tools/event.js +109 -0
  336. package/node_modules/vxe-table/lib/tools/event.min.js +1 -0
  337. package/node_modules/vxe-table/lib/tools/log.js +29 -0
  338. package/node_modules/vxe-table/lib/tools/log.min.js +1 -0
  339. package/node_modules/vxe-table/lib/tools/resize.js +122 -0
  340. package/node_modules/vxe-table/lib/tools/resize.min.js +1 -0
  341. package/node_modules/vxe-table/lib/tools/utils.js +142 -0
  342. package/node_modules/vxe-table/lib/tools/utils.min.js +1 -0
  343. package/node_modules/vxe-table/lib/tooltip/index.d.ts +4 -0
  344. package/node_modules/vxe-table/lib/tooltip/index.js +22 -0
  345. package/node_modules/vxe-table/lib/tooltip/index.min.js +1 -0
  346. package/node_modules/vxe-table/lib/tooltip/src/tooltip.js +400 -0
  347. package/node_modules/vxe-table/lib/tooltip/src/tooltip.min.js +1 -0
  348. package/node_modules/vxe-table/lib/tooltip/style/index.js +1 -0
  349. package/node_modules/vxe-table/lib/tooltip/style/style.css +113 -0
  350. package/node_modules/vxe-table/lib/tooltip/style/style.min.css +1 -0
  351. package/node_modules/vxe-table/lib/v-x-e-table/index.d.ts +4 -0
  352. package/node_modules/vxe-table/lib/v-x-e-table/index.js +239 -0
  353. package/node_modules/vxe-table/lib/v-x-e-table/index.min.js +1 -0
  354. package/node_modules/vxe-table/lib/v-x-e-table/src/commands.js +19 -0
  355. package/node_modules/vxe-table/lib/v-x-e-table/src/commands.min.js +1 -0
  356. package/node_modules/vxe-table/lib/v-x-e-table/src/conf.js +345 -0
  357. package/node_modules/vxe-table/lib/v-x-e-table/src/conf.min.js +1 -0
  358. package/node_modules/vxe-table/lib/v-x-e-table/src/formats.js +19 -0
  359. package/node_modules/vxe-table/lib/v-x-e-table/src/formats.min.js +1 -0
  360. package/node_modules/vxe-table/lib/v-x-e-table/src/interceptor.js +71 -0
  361. package/node_modules/vxe-table/lib/v-x-e-table/src/interceptor.min.js +1 -0
  362. package/node_modules/vxe-table/lib/v-x-e-table/src/menus.js +19 -0
  363. package/node_modules/vxe-table/lib/v-x-e-table/src/menus.min.js +1 -0
  364. package/node_modules/vxe-table/lib/v-x-e-table/src/renderer.js +843 -0
  365. package/node_modules/vxe-table/lib/v-x-e-table/src/renderer.min.js +1 -0
  366. package/node_modules/vxe-table/lib/v-x-e-table/src/setup.js +19 -0
  367. package/node_modules/vxe-table/lib/v-x-e-table/src/setup.min.js +1 -0
  368. package/node_modules/vxe-table/lib/v-x-e-table/src/store.js +66 -0
  369. package/node_modules/vxe-table/lib/v-x-e-table/src/store.min.js +1 -0
  370. package/node_modules/vxe-table/lib/v-x-e-table/style/index.js +1 -0
  371. package/node_modules/vxe-table/lib/v-x-e-table/style/style.css +25 -0
  372. package/node_modules/vxe-table/lib/v-x-e-table/style/style.min.css +0 -0
  373. package/node_modules/vxe-table/lib/validator/index.d.ts +4 -0
  374. package/node_modules/vxe-table/lib/validator/index.js +25 -0
  375. package/node_modules/vxe-table/lib/validator/index.min.js +1 -0
  376. package/node_modules/vxe-table/lib/validator/src/mixin.js +492 -0
  377. package/node_modules/vxe-table/lib/validator/src/mixin.min.js +1 -0
  378. package/node_modules/vxe-table/lib/validator/style/index.js +1 -0
  379. package/node_modules/vxe-table/lib/validator/style/style.css +25 -0
  380. package/node_modules/vxe-table/lib/validator/style/style.min.css +0 -0
  381. package/node_modules/vxe-table/lib/vxe-table/index.d.ts +4 -0
  382. package/node_modules/vxe-table/lib/vxe-table/style/index.js +1 -0
  383. package/node_modules/vxe-table/lib/vxe-table/style/style.css +25 -0
  384. package/node_modules/vxe-table/lib/vxe-table/style/style.min.css +0 -0
  385. package/node_modules/vxe-table/package.json +110 -0
  386. package/node_modules/vxe-table/packages/all.js +136 -0
  387. package/node_modules/vxe-table/packages/button/index.d.ts +4 -0
  388. package/node_modules/vxe-table/packages/button/index.js +9 -0
  389. package/node_modules/vxe-table/packages/button/src/button.js +333 -0
  390. package/node_modules/vxe-table/packages/checkbox/index.d.ts +4 -0
  391. package/node_modules/vxe-table/packages/checkbox/index.js +9 -0
  392. package/node_modules/vxe-table/packages/checkbox/src/checkbox.js +84 -0
  393. package/node_modules/vxe-table/packages/checkbox/src/group.js +42 -0
  394. package/node_modules/vxe-table/packages/checkbox-group/index.d.ts +4 -0
  395. package/node_modules/vxe-table/packages/checkbox-group/index.js +9 -0
  396. package/node_modules/vxe-table/packages/colgroup/index.d.ts +4 -0
  397. package/node_modules/vxe-table/packages/colgroup/index.js +11 -0
  398. package/node_modules/vxe-table/packages/column/index.d.ts +4 -0
  399. package/node_modules/vxe-table/packages/column/index.js +11 -0
  400. package/node_modules/vxe-table/packages/edit/index.d.ts +4 -0
  401. package/node_modules/vxe-table/packages/edit/index.js +12 -0
  402. package/node_modules/vxe-table/packages/edit/src/mixin.js +667 -0
  403. package/node_modules/vxe-table/packages/export/index.d.ts +4 -0
  404. package/node_modules/vxe-table/packages/export/index.js +40 -0
  405. package/node_modules/vxe-table/packages/export/src/export-panel.js +458 -0
  406. package/node_modules/vxe-table/packages/export/src/import-panel.js +189 -0
  407. package/node_modules/vxe-table/packages/export/src/mixin.js +1446 -0
  408. package/node_modules/vxe-table/packages/filter/index.d.ts +4 -0
  409. package/node_modules/vxe-table/packages/filter/index.js +15 -0
  410. package/node_modules/vxe-table/packages/filter/src/mixin.js +258 -0
  411. package/node_modules/vxe-table/packages/filter/src/panel.js +209 -0
  412. package/node_modules/vxe-table/packages/footer/index.d.ts +4 -0
  413. package/node_modules/vxe-table/packages/footer/index.js +9 -0
  414. package/node_modules/vxe-table/packages/footer/src/footer.js +283 -0
  415. package/node_modules/vxe-table/packages/form/index.d.ts +4 -0
  416. package/node_modules/vxe-table/packages/form/index.js +9 -0
  417. package/node_modules/vxe-table/packages/form/src/form-gather.js +24 -0
  418. package/node_modules/vxe-table/packages/form/src/form-item.js +159 -0
  419. package/node_modules/vxe-table/packages/form/src/form.js +627 -0
  420. package/node_modules/vxe-table/packages/form/src/render.js +79 -0
  421. package/node_modules/vxe-table/packages/form/src/util.js +83 -0
  422. package/node_modules/vxe-table/packages/form-gather/index.d.ts +4 -0
  423. package/node_modules/vxe-table/packages/form-gather/index.js +9 -0
  424. package/node_modules/vxe-table/packages/form-item/index.d.ts +4 -0
  425. package/node_modules/vxe-table/packages/form-item/index.js +9 -0
  426. package/node_modules/vxe-table/packages/grid/index.d.ts +4 -0
  427. package/node_modules/vxe-table/packages/grid/index.js +12 -0
  428. package/node_modules/vxe-table/packages/grid/src/grid.js +950 -0
  429. package/node_modules/vxe-table/packages/header/index.d.ts +4 -0
  430. package/node_modules/vxe-table/packages/header/index.js +9 -0
  431. package/node_modules/vxe-table/packages/header/src/header.js +291 -0
  432. package/node_modules/vxe-table/packages/header/src/util.js +62 -0
  433. package/node_modules/vxe-table/packages/icon/index.d.ts +4 -0
  434. package/node_modules/vxe-table/packages/icon/index.js +6 -0
  435. package/node_modules/vxe-table/packages/index.common.js +4 -0
  436. package/node_modules/vxe-table/packages/input/index.d.ts +4 -0
  437. package/node_modules/vxe-table/packages/input/index.js +9 -0
  438. package/node_modules/vxe-table/packages/input/src/date.js +38 -0
  439. package/node_modules/vxe-table/packages/input/src/input.js +1966 -0
  440. package/node_modules/vxe-table/packages/input/src/number.js +12 -0
  441. package/node_modules/vxe-table/packages/keyboard/index.d.ts +4 -0
  442. package/node_modules/vxe-table/packages/keyboard/index.js +12 -0
  443. package/node_modules/vxe-table/packages/keyboard/src/mixin.js +354 -0
  444. package/node_modules/vxe-table/packages/list/index.d.ts +4 -0
  445. package/node_modules/vxe-table/packages/list/index.js +9 -0
  446. package/node_modules/vxe-table/packages/list/src/list.js +289 -0
  447. package/node_modules/vxe-table/packages/locale/lang/en-US.d.ts +8 -0
  448. package/node_modules/vxe-table/packages/locale/lang/en-US.js +305 -0
  449. package/node_modules/vxe-table/packages/locale/lang/ja-JP.d.ts +8 -0
  450. package/node_modules/vxe-table/packages/locale/lang/ja-JP.js +305 -0
  451. package/node_modules/vxe-table/packages/locale/lang/language.d.ts +5 -0
  452. package/node_modules/vxe-table/packages/locale/lang/zh-CN.d.ts +8 -0
  453. package/node_modules/vxe-table/packages/locale/lang/zh-CN.js +305 -0
  454. package/node_modules/vxe-table/packages/locale/lang/zh-HK.d.ts +8 -0
  455. package/node_modules/vxe-table/packages/locale/lang/zh-HK.js +3 -0
  456. package/node_modules/vxe-table/packages/locale/lang/zh-MO.d.ts +8 -0
  457. package/node_modules/vxe-table/packages/locale/lang/zh-MO.js +3 -0
  458. package/node_modules/vxe-table/packages/locale/lang/zh-TC.d.ts +8 -0
  459. package/node_modules/vxe-table/packages/locale/lang/zh-TC.js +305 -0
  460. package/node_modules/vxe-table/packages/locale/lang/zh-TW.d.ts +8 -0
  461. package/node_modules/vxe-table/packages/locale/lang/zh-TW.js +3 -0
  462. package/node_modules/vxe-table/packages/menu/index.d.ts +4 -0
  463. package/node_modules/vxe-table/packages/menu/index.js +15 -0
  464. package/node_modules/vxe-table/packages/menu/src/mixin.js +270 -0
  465. package/node_modules/vxe-table/packages/menu/src/panel.js +100 -0
  466. package/node_modules/vxe-table/packages/mixins/size.js +8 -0
  467. package/node_modules/vxe-table/packages/modal/index.d.ts +4 -0
  468. package/node_modules/vxe-table/packages/modal/index.js +111 -0
  469. package/node_modules/vxe-table/packages/modal/src/modal.js +801 -0
  470. package/node_modules/vxe-table/packages/optgroup/index.d.ts +4 -0
  471. package/node_modules/vxe-table/packages/optgroup/index.js +9 -0
  472. package/node_modules/vxe-table/packages/option/index.d.ts +4 -0
  473. package/node_modules/vxe-table/packages/option/index.js +9 -0
  474. package/node_modules/vxe-table/packages/pager/index.d.ts +4 -0
  475. package/node_modules/vxe-table/packages/pager/index.js +9 -0
  476. package/node_modules/vxe-table/packages/pager/src/pager.js +408 -0
  477. package/node_modules/vxe-table/packages/pulldown/index.d.ts +4 -0
  478. package/node_modules/vxe-table/packages/pulldown/index.js +9 -0
  479. package/node_modules/vxe-table/packages/pulldown/src/pulldown.js +258 -0
  480. package/node_modules/vxe-table/packages/radio/index.d.ts +4 -0
  481. package/node_modules/vxe-table/packages/radio/index.js +9 -0
  482. package/node_modules/vxe-table/packages/radio/src/button.js +92 -0
  483. package/node_modules/vxe-table/packages/radio/src/group.js +39 -0
  484. package/node_modules/vxe-table/packages/radio/src/radio.js +95 -0
  485. package/node_modules/vxe-table/packages/radio-button/index.d.ts +4 -0
  486. package/node_modules/vxe-table/packages/radio-button/index.js +9 -0
  487. package/node_modules/vxe-table/packages/radio-group/index.d.ts +4 -0
  488. package/node_modules/vxe-table/packages/radio-group/index.js +9 -0
  489. package/node_modules/vxe-table/packages/select/index.d.ts +4 -0
  490. package/node_modules/vxe-table/packages/select/index.js +15 -0
  491. package/node_modules/vxe-table/packages/select/src/optgroup.js +48 -0
  492. package/node_modules/vxe-table/packages/select/src/option.js +42 -0
  493. package/node_modules/vxe-table/packages/select/src/select.js +735 -0
  494. package/node_modules/vxe-table/packages/select/src/util.js +52 -0
  495. package/node_modules/vxe-table/packages/switch/index.d.ts +4 -0
  496. package/node_modules/vxe-table/packages/switch/index.js +9 -0
  497. package/node_modules/vxe-table/packages/switch/src/switch.js +124 -0
  498. package/node_modules/vxe-table/packages/table/index.d.ts +4 -0
  499. package/node_modules/vxe-table/packages/table/index.js +25 -0
  500. package/node_modules/vxe-table/packages/table/src/body.js +779 -0
  501. package/node_modules/vxe-table/packages/table/src/cell.js +775 -0
  502. package/node_modules/vxe-table/packages/table/src/column.js +125 -0
  503. package/node_modules/vxe-table/packages/table/src/columnInfo.js +149 -0
  504. package/node_modules/vxe-table/packages/table/src/group.js +12 -0
  505. package/node_modules/vxe-table/packages/table/src/methods.js +4658 -0
  506. package/node_modules/vxe-table/packages/table/src/table.js +1159 -0
  507. package/node_modules/vxe-table/packages/table/src/util.js +282 -0
  508. package/node_modules/vxe-table/packages/textarea/index.d.ts +4 -0
  509. package/node_modules/vxe-table/packages/textarea/index.js +9 -0
  510. package/node_modules/vxe-table/packages/textarea/src/textarea.js +206 -0
  511. package/node_modules/vxe-table/packages/toolbar/index.d.ts +4 -0
  512. package/node_modules/vxe-table/packages/toolbar/index.js +9 -0
  513. package/node_modules/vxe-table/packages/toolbar/src/toolbar.js +649 -0
  514. package/node_modules/vxe-table/packages/tools/dom.js +178 -0
  515. package/node_modules/vxe-table/packages/tools/event.js +82 -0
  516. package/node_modules/vxe-table/packages/tools/log.js +16 -0
  517. package/node_modules/vxe-table/packages/tools/resize.js +76 -0
  518. package/node_modules/vxe-table/packages/tools/utils.js +97 -0
  519. package/node_modules/vxe-table/packages/tooltip/index.d.ts +4 -0
  520. package/node_modules/vxe-table/packages/tooltip/index.js +11 -0
  521. package/node_modules/vxe-table/packages/tooltip/src/tooltip.js +282 -0
  522. package/node_modules/vxe-table/packages/v-x-e-table/index.d.ts +4 -0
  523. package/node_modules/vxe-table/packages/v-x-e-table/index.js +113 -0
  524. package/node_modules/vxe-table/packages/v-x-e-table/src/commands.js +7 -0
  525. package/node_modules/vxe-table/packages/v-x-e-table/src/conf.js +347 -0
  526. package/node_modules/vxe-table/packages/v-x-e-table/src/formats.js +7 -0
  527. package/node_modules/vxe-table/packages/v-x-e-table/src/interceptor.js +53 -0
  528. package/node_modules/vxe-table/packages/v-x-e-table/src/menus.js +7 -0
  529. package/node_modules/vxe-table/packages/v-x-e-table/src/renderer.js +692 -0
  530. package/node_modules/vxe-table/packages/v-x-e-table/src/setup.js +9 -0
  531. package/node_modules/vxe-table/packages/v-x-e-table/src/store.js +38 -0
  532. package/node_modules/vxe-table/packages/validator/index.d.ts +4 -0
  533. package/node_modules/vxe-table/packages/validator/index.js +12 -0
  534. package/node_modules/vxe-table/packages/validator/src/mixin.js +363 -0
  535. package/node_modules/vxe-table/packages/vxe-table/index.d.ts +4 -0
  536. package/node_modules/vxe-table/packages/vxe-table/index.ts +4 -0
  537. package/node_modules/vxe-table/styles/base/checked.scss +179 -0
  538. package/node_modules/vxe-table/styles/base/common.scss +88 -0
  539. package/node_modules/vxe-table/styles/base/loading.scss +71 -0
  540. package/node_modules/vxe-table/styles/button.scss +390 -0
  541. package/node_modules/vxe-table/styles/checkbox-group.scss +1 -0
  542. package/node_modules/vxe-table/styles/checkbox.scss +151 -0
  543. package/node_modules/vxe-table/styles/colgroup.scss +1 -0
  544. package/node_modules/vxe-table/styles/column.scss +1 -0
  545. package/node_modules/vxe-table/styles/default.scss +1 -0
  546. package/node_modules/vxe-table/styles/edit.scss +1 -0
  547. package/node_modules/vxe-table/styles/export.scss +161 -0
  548. package/node_modules/vxe-table/styles/filter.scss +146 -0
  549. package/node_modules/vxe-table/styles/footer.scss +23 -0
  550. package/node_modules/vxe-table/styles/form-gather.scss +1 -0
  551. package/node_modules/vxe-table/styles/form-item.scss +1 -0
  552. package/node_modules/vxe-table/styles/form.scss +319 -0
  553. package/node_modules/vxe-table/styles/grid.scss +70 -0
  554. package/node_modules/vxe-table/styles/header.scss +135 -0
  555. package/node_modules/vxe-table/styles/helpers/mixin.scss +3 -0
  556. package/node_modules/vxe-table/styles/icon.scss +712 -0
  557. package/node_modules/vxe-table/styles/index.scss +2 -0
  558. package/node_modules/vxe-table/styles/input.scss +864 -0
  559. package/node_modules/vxe-table/styles/keyboard.scss +1 -0
  560. package/node_modules/vxe-table/styles/list.scss +28 -0
  561. package/node_modules/vxe-table/styles/menu.scss +101 -0
  562. package/node_modules/vxe-table/styles/modal.scss +382 -0
  563. package/node_modules/vxe-table/styles/modules.scss +31 -0
  564. package/node_modules/vxe-table/styles/optgroup.scss +1 -0
  565. package/node_modules/vxe-table/styles/option.scss +1 -0
  566. package/node_modules/vxe-table/styles/pager.scss +285 -0
  567. package/node_modules/vxe-table/styles/pulldown.scss +58 -0
  568. package/node_modules/vxe-table/styles/radio-button.scss +1 -0
  569. package/node_modules/vxe-table/styles/radio-group.scss +1 -0
  570. package/node_modules/vxe-table/styles/radio.scss +216 -0
  571. package/node_modules/vxe-table/styles/select.scss +192 -0
  572. package/node_modules/vxe-table/styles/switch.scss +115 -0
  573. package/node_modules/vxe-table/styles/table.scss +1179 -0
  574. package/node_modules/vxe-table/styles/textarea.scss +104 -0
  575. package/node_modules/vxe-table/styles/toolbar.scss +207 -0
  576. package/node_modules/vxe-table/styles/tooltip.scss +135 -0
  577. package/node_modules/vxe-table/styles/v-x-e-table.scss +1 -0
  578. package/node_modules/vxe-table/styles/validator.scss +1 -0
  579. package/node_modules/vxe-table/styles/variable.scss +255 -0
  580. package/node_modules/vxe-table/styles/vxe-table.scss +1 -0
  581. package/node_modules/vxe-table/types/all.d.ts +79 -0
  582. package/node_modules/vxe-table/types/button.d.ts +43 -0
  583. package/node_modules/vxe-table/types/checkbox-group.d.ts +15 -0
  584. package/node_modules/vxe-table/types/checkbox.d.ts +31 -0
  585. package/node_modules/vxe-table/types/colgroup.d.ts +154 -0
  586. package/node_modules/vxe-table/types/column.d.ts +425 -0
  587. package/node_modules/vxe-table/types/component.d.ts +24 -0
  588. package/node_modules/vxe-table/types/edit.d.ts +60 -0
  589. package/node_modules/vxe-table/types/export.d.ts +236 -0
  590. package/node_modules/vxe-table/types/filter.d.ts +126 -0
  591. package/node_modules/vxe-table/types/footer.d.ts +44 -0
  592. package/node_modules/vxe-table/types/form-gather.d.ts +11 -0
  593. package/node_modules/vxe-table/types/form-item.d.ts +207 -0
  594. package/node_modules/vxe-table/types/form.d.ts +134 -0
  595. package/node_modules/vxe-table/types/grid.d.ts +138 -0
  596. package/node_modules/vxe-table/types/header.d.ts +32 -0
  597. package/node_modules/vxe-table/types/icon.d.ts +6 -0
  598. package/node_modules/vxe-table/types/index.d.ts +9 -0
  599. package/node_modules/vxe-table/types/input.d.ts +160 -0
  600. package/node_modules/vxe-table/types/keyboard.d.ts +6 -0
  601. package/node_modules/vxe-table/types/list.d.ts +70 -0
  602. package/node_modules/vxe-table/types/menu.d.ts +41 -0
  603. package/node_modules/vxe-table/types/modal.d.ts +324 -0
  604. package/node_modules/vxe-table/types/optgroup.d.ts +19 -0
  605. package/node_modules/vxe-table/types/option.d.ts +23 -0
  606. package/node_modules/vxe-table/types/pager.d.ts +122 -0
  607. package/node_modules/vxe-table/types/pulldown.d.ts +44 -0
  608. package/node_modules/vxe-table/types/radio-button.d.ts +19 -0
  609. package/node_modules/vxe-table/types/radio-group.d.ts +15 -0
  610. package/node_modules/vxe-table/types/radio.d.ts +31 -0
  611. package/node_modules/vxe-table/types/select.d.ts +65 -0
  612. package/node_modules/vxe-table/types/switch.d.ts +21 -0
  613. package/node_modules/vxe-table/types/table.d.ts +1449 -0
  614. package/node_modules/vxe-table/types/textarea.d.ts +63 -0
  615. package/node_modules/vxe-table/types/toolbar.d.ts +177 -0
  616. package/node_modules/vxe-table/types/tooltip.d.ts +39 -0
  617. package/node_modules/vxe-table/types/v-x-e-table/commands.d.ts +19 -0
  618. package/node_modules/vxe-table/types/v-x-e-table/formats.d.ts +19 -0
  619. package/node_modules/vxe-table/types/v-x-e-table/index.d.ts +116 -0
  620. package/node_modules/vxe-table/types/v-x-e-table/interceptor.d.ts +46 -0
  621. package/node_modules/vxe-table/types/v-x-e-table/menus.d.ts +13 -0
  622. package/node_modules/vxe-table/types/v-x-e-table/renderer.d.ts +173 -0
  623. package/node_modules/vxe-table/types/v-x-e-table/setup.d.ts +74 -0
  624. package/node_modules/vxe-table/types/validator.d.ts +61 -0
  625. package/node_modules/vxe-table/types/vxe-table/index.d.ts +4 -0
  626. package/package.json +5 -2
  627. package/dist/js/index.d840b37b.js +0 -2
@@ -0,0 +1,4658 @@
1
+ import XEUtils from 'xe-utils'
2
+ import GlobalConfig from '../../v-x-e-table/src/conf'
3
+ import Cell from './cell'
4
+ import VXETable from '../../v-x-e-table'
5
+ import { getRowid, getRowkey, clearTableAllStatus, handleFieldOrColumn, restoreScrollLocation, restoreScrollListener, toTreePathSeq, rowToVisible, colToVisible } from './util'
6
+ import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/utils'
7
+ import DomTools, { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../tools/dom'
8
+ import { formats } from '../../v-x-e-table/src/formats'
9
+ import { warnLog, errLog } from '../../tools/log'
10
+
11
+ const { setCellValue, hasChildrenList, getColumnList } = UtilTools
12
+ const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
13
+
14
+ const isWebkit = browse['-webkit'] && !browse.edge
15
+ const debounceScrollYDuration = browse.msie ? 80 : 20
16
+
17
+ const resizableStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_WIDTH'
18
+ const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE'
19
+
20
+ /**
21
+ * 生成行的唯一主键
22
+ */
23
+ function getRowUniqueId () {
24
+ return XEUtils.uniqueId('row_')
25
+ }
26
+
27
+ function eqCellValue (row1, row2, field) {
28
+ const val1 = XEUtils.get(row1, field)
29
+ const val2 = XEUtils.get(row2, field)
30
+ if (eqEmptyValue(val1) && eqEmptyValue(val2)) {
31
+ return true
32
+ }
33
+ if (XEUtils.isString(val1) || XEUtils.isNumber(val1)) {
34
+ return ('' + val1) === ('' + val2)
35
+ }
36
+ return XEUtils.isEqual(val1, val2)
37
+ }
38
+
39
+ function getNextSortOrder (_vm, column) {
40
+ const orders = _vm.sortOpts.orders
41
+ const currOrder = column.order || null
42
+ const oIndex = orders.indexOf(currOrder) + 1
43
+ return orders[oIndex < orders.length ? oIndex : 0]
44
+ }
45
+
46
+ function getCustomStorageMap (key) {
47
+ const version = GlobalConfig.version
48
+ const rest = XEUtils.toStringJSON(localStorage.getItem(key))
49
+ return rest && rest._v === version ? rest : { _v: version }
50
+ }
51
+
52
+ function getRecoverRow (_vm, list) {
53
+ const { fullAllDataRowMap } = _vm
54
+ return list.filter(row => fullAllDataRowMap.has(row))
55
+ }
56
+
57
+ function handleReserveRow (_vm, reserveRowMap) {
58
+ const { fullDataRowIdData } = _vm
59
+ const reserveList = []
60
+ XEUtils.each(reserveRowMap, (item, rowid) => {
61
+ if (fullDataRowIdData[rowid] && reserveList.indexOf(fullDataRowIdData[rowid].row) === -1) {
62
+ reserveList.push(fullDataRowIdData[rowid].row)
63
+ }
64
+ })
65
+ return reserveList
66
+ }
67
+
68
+ function computeVirtualX (_vm) {
69
+ const { $refs, visibleColumn } = _vm
70
+ const { tableBody } = $refs
71
+ const tableBodyElem = tableBody ? tableBody.$el : null
72
+ if (tableBodyElem) {
73
+ const { scrollLeft, clientWidth } = tableBodyElem
74
+ const endWidth = scrollLeft + clientWidth
75
+ let toVisibleIndex = -1
76
+ let cWidth = 0
77
+ let visibleSize = 0
78
+ for (let colIndex = 0, colLen = visibleColumn.length; colIndex < colLen; colIndex++) {
79
+ cWidth += visibleColumn[colIndex].renderWidth
80
+ if (toVisibleIndex === -1 && scrollLeft < cWidth) {
81
+ toVisibleIndex = colIndex
82
+ }
83
+ if (toVisibleIndex >= 0) {
84
+ visibleSize++
85
+ if (cWidth > endWidth) {
86
+ break
87
+ }
88
+ }
89
+ }
90
+ return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(8, visibleSize) }
91
+ }
92
+ return { toVisibleIndex: 0, visibleSize: 8 }
93
+ }
94
+
95
+ function computeVirtualY (_vm) {
96
+ const { $refs, vSize, rowHeightMaps } = _vm
97
+ const { tableHeader, tableBody } = $refs
98
+ const tableBodyElem = tableBody ? tableBody.$el : null
99
+ if (tableBodyElem) {
100
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null
101
+ let rowHeight = 0
102
+ let firstTrElem
103
+ firstTrElem = tableBodyElem.querySelector('tr')
104
+ if (!firstTrElem && tableHeaderElem) {
105
+ firstTrElem = tableHeaderElem.querySelector('tr')
106
+ }
107
+ if (firstTrElem) {
108
+ rowHeight = firstTrElem.clientHeight
109
+ }
110
+ if (!rowHeight) {
111
+ rowHeight = rowHeightMaps[vSize || 'default']
112
+ }
113
+ const visibleSize = Math.max(8, Math.ceil(tableBodyElem.clientHeight / rowHeight) + 2)
114
+ return { rowHeight, visibleSize }
115
+ }
116
+ return { rowHeight: 0, visibleSize: 8 }
117
+ }
118
+
119
+ function calculateMergerOffserIndex (list, offsetItem, type) {
120
+ for (let mcIndex = 0, len = list.length; mcIndex < len; mcIndex++) {
121
+ const mergeItem = list[mcIndex]
122
+ const { startIndex, endIndex } = offsetItem
123
+ const mergeStartIndex = mergeItem[type]
124
+ const mergeSpanNumber = mergeItem[type + 'span']
125
+ const mergeEndIndex = mergeStartIndex + mergeSpanNumber
126
+ if (mergeStartIndex < startIndex && startIndex < mergeEndIndex) {
127
+ offsetItem.startIndex = mergeStartIndex
128
+ }
129
+ if (mergeStartIndex < endIndex && endIndex < mergeEndIndex) {
130
+ offsetItem.endIndex = mergeEndIndex
131
+ }
132
+ if (offsetItem.startIndex !== startIndex || offsetItem.endIndex !== endIndex) {
133
+ mcIndex = -1
134
+ }
135
+ }
136
+ }
137
+
138
+ function setMerges (_vm, merges, mList, rowList) {
139
+ if (merges) {
140
+ const { treeConfig, visibleColumn } = _vm
141
+ if (treeConfig) {
142
+ throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-footer-items']))
143
+ }
144
+ if (!XEUtils.isArray(merges)) {
145
+ merges = [merges]
146
+ }
147
+ merges.forEach(item => {
148
+ let { row, col, rowspan, colspan } = item
149
+ if (rowList && XEUtils.isNumber(row)) {
150
+ row = rowList[row]
151
+ }
152
+ if (XEUtils.isNumber(col)) {
153
+ col = visibleColumn[col]
154
+ }
155
+ if ((rowList ? row : XEUtils.isNumber(row)) && col && (rowspan || colspan)) {
156
+ rowspan = XEUtils.toNumber(rowspan) || 1
157
+ colspan = XEUtils.toNumber(colspan) || 1
158
+ if (rowspan > 1 || colspan > 1) {
159
+ const mcIndex = XEUtils.findIndexOf(mList, item => item._row === row && item._col === col)
160
+ const mergeItem = mList[mcIndex]
161
+ if (mergeItem) {
162
+ mergeItem.rowspan = rowspan
163
+ mergeItem.colspan = colspan
164
+ mergeItem._rowspan = rowspan
165
+ mergeItem._colspan = colspan
166
+ } else {
167
+ const mergeRowIndex = rowList ? rowList.indexOf(row) : row
168
+ const mergeColIndex = visibleColumn.indexOf(col)
169
+ mList.push({
170
+ row: mergeRowIndex,
171
+ col: mergeColIndex,
172
+ rowspan,
173
+ colspan,
174
+ _row: row,
175
+ _col: col,
176
+ _rowspan: rowspan,
177
+ _colspan: colspan
178
+ })
179
+ }
180
+ }
181
+ }
182
+ })
183
+ }
184
+ }
185
+
186
+ function removeMerges (_vm, merges, mList, rowList) {
187
+ const rest = []
188
+ if (merges) {
189
+ const { treeConfig, visibleColumn } = _vm
190
+ if (treeConfig) {
191
+ throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-cells']))
192
+ }
193
+ if (!XEUtils.isArray(merges)) {
194
+ merges = [merges]
195
+ }
196
+ merges.forEach(item => {
197
+ let { row, col } = item
198
+ if (rowList && XEUtils.isNumber(row)) {
199
+ row = rowList[row]
200
+ }
201
+ if (XEUtils.isNumber(col)) {
202
+ col = visibleColumn[col]
203
+ }
204
+ const mcIndex = XEUtils.findIndexOf(mList, item => item._row === row && item._col === col)
205
+ if (mcIndex > -1) {
206
+ const rItems = mList.splice(mcIndex, 1)
207
+ rest.push(rItems[0])
208
+ }
209
+ })
210
+ }
211
+ return rest
212
+ }
213
+
214
+ function clearAllSort (_vm) {
215
+ _vm.tableFullColumn.forEach((column) => {
216
+ column.order = null
217
+ })
218
+ }
219
+
220
+ function getOrderField (_vm, column) {
221
+ const { sortBy, sortType } = column
222
+ return (row) => {
223
+ let cellValue
224
+ if (sortBy) {
225
+ cellValue = XEUtils.isFunction(sortBy) ? sortBy({ row, column }) : XEUtils.get(row, sortBy)
226
+ } else {
227
+ cellValue = _vm.getCellLabel(row, column)
228
+ }
229
+ if (!sortType || sortType === 'auto') {
230
+ return isNaN(cellValue) ? cellValue : XEUtils.toNumber(cellValue)
231
+ } else if (sortType === 'number') {
232
+ return XEUtils.toNumber(cellValue)
233
+ } else if (sortType === 'string') {
234
+ return XEUtils.toValueString(cellValue)
235
+ }
236
+ return cellValue
237
+ }
238
+ }
239
+
240
+ const Methods = {
241
+ callSlot (slotFunc, params, h, vNodes) {
242
+ if (slotFunc) {
243
+ const { $xegrid } = this
244
+ if ($xegrid) {
245
+ return $xegrid.callSlot(slotFunc, params, h, vNodes)
246
+ }
247
+ if (XEUtils.isFunction(slotFunc)) {
248
+ return slotFunc.call(this, params, h, vNodes)
249
+ }
250
+ }
251
+ return []
252
+ },
253
+ /**
254
+ * 获取父容器元素
255
+ */
256
+ getParentElem () {
257
+ const { $el, $xegrid } = this
258
+ return $xegrid ? $xegrid.$el.parentNode : $el.parentNode
259
+ },
260
+ /**
261
+ * 获取父容器的高度
262
+ */
263
+ getParentHeight () {
264
+ const { $el, $xegrid, height } = this
265
+ const parentElem = $el.parentNode
266
+ const parentPaddingSize = height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
267
+ return Math.floor($xegrid ? $xegrid.getParentHeight() : XEUtils.toNumber(getComputedStyle(parentElem).height) - parentPaddingSize)
268
+ },
269
+ /**
270
+ * 获取需要排除的高度
271
+ * 但渲染表格高度时,需要排除工具栏或分页等相关组件的高度
272
+ * 如果存在表尾合计滚动条,则需要排除滚动条高度
273
+ */
274
+ getExcludeHeight () {
275
+ const { $xegrid } = this
276
+ return $xegrid ? $xegrid.getExcludeHeight() : 0
277
+ },
278
+ /**
279
+ * 重置表格的一切数据状态
280
+ */
281
+ clearAll () {
282
+ return clearTableAllStatus(this)
283
+ },
284
+ /**
285
+ * 同步 data 数据(即将废弃)
286
+ * 如果用了该方法,那么组件将不再记录增删改的状态,只能自行实现对应逻辑
287
+ * 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
288
+ */
289
+ syncData () {
290
+ return this.$nextTick().then(() => {
291
+ this.tableData = []
292
+ return this.$nextTick().then(() => this.loadTableData(this.tableFullData))
293
+ })
294
+ },
295
+ /**
296
+ * 手动处理数据,用于手动排序与筛选
297
+ * 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
298
+ */
299
+ updateData () {
300
+ const { scrollXLoad, scrollYLoad } = this
301
+ return this.handleTableData(true).then(() => {
302
+ this.updateFooter()
303
+ this.checkSelectionStatus()
304
+ if (scrollXLoad || scrollYLoad) {
305
+ if (scrollXLoad) {
306
+ this.updateScrollXSpace()
307
+ }
308
+ if (scrollYLoad) {
309
+ this.updateScrollYSpace()
310
+ }
311
+ return this.refreshScroll()
312
+ }
313
+ }).then(() => {
314
+ this.updateCellAreas()
315
+ return this.recalculate(true)
316
+ }).then(() => {
317
+ // 存在滚动行为未结束情况
318
+ setTimeout(() => this.recalculate(), 50)
319
+ })
320
+ },
321
+ handleTableData (force) {
322
+ const { scrollYLoad, scrollYStore, fullDataRowIdData, afterFullData } = this
323
+ let fullList = afterFullData
324
+ // 是否进行数据处理
325
+ if (force) {
326
+ // 更新数据,处理筛选和排序
327
+ this.updateAfterFullData()
328
+ // 如果为虚拟树,将树结构拍平
329
+ fullList = this.handleVirtualTreeToList()
330
+ }
331
+ const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
332
+ tableData.forEach((row, $index) => {
333
+ const rowid = getRowid(this, row)
334
+ const rest = fullDataRowIdData[rowid]
335
+ if (rest) {
336
+ rest.$index = $index
337
+ }
338
+ })
339
+ this.tableData = tableData
340
+ return this.$nextTick()
341
+ },
342
+ updateScrollYStatus (fullData) {
343
+ const { treeConfig, treeOpts, sYOpts } = this
344
+ const { transform } = treeOpts
345
+ const scrollYLoad = (transform || !treeConfig) && !!sYOpts.enabled && sYOpts.gt > -1 && sYOpts.gt < fullData.length
346
+ this.scrollYLoad = scrollYLoad
347
+ return scrollYLoad
348
+ },
349
+ /**
350
+ * 加载表格数据
351
+ * @param {Array} datas 数据
352
+ */
353
+ loadTableData (datas) {
354
+ const { keepSource, treeConfig, treeOpts, editStore, scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop, scrollYLoad: oldScrollYLoad } = this
355
+ let treeData = []
356
+ let fullData = datas ? datas.slice(0) : []
357
+ if (treeConfig) {
358
+ // 树结构自动转换
359
+ if (treeOpts.transform) {
360
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
361
+ if (!treeOpts.rowField) {
362
+ errLog('vxe.error.reqProp', ['table.tree-config.rowField'])
363
+ }
364
+ if (!treeOpts.parentField) {
365
+ errLog('vxe.error.reqProp', ['table.tree-config.parentField'])
366
+ }
367
+ if (!treeOpts.children) {
368
+ errLog('vxe.error.reqProp', ['tree-config.children'])
369
+ }
370
+ if (!treeOpts.mapChildren) {
371
+ errLog('vxe.error.reqProp', ['tree-config.mapChildren'])
372
+ }
373
+ if (treeOpts.children === treeOpts.mapChildren) {
374
+ errLog('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren'])
375
+ }
376
+ fullData.forEach(row => {
377
+ if (row[treeOpts.children] && row[treeOpts.children].length) {
378
+ warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
379
+ }
380
+ })
381
+ }
382
+ treeData = XEUtils.toArrayTree(fullData, {
383
+ key: treeOpts.rowField,
384
+ parentKey: treeOpts.parentField,
385
+ children: treeOpts.children,
386
+ mapChildren: treeOpts.mapChildren
387
+ })
388
+ fullData = treeData.slice(0)
389
+ } else {
390
+ treeData = fullData.slice(0)
391
+ }
392
+ }
393
+ scrollYStore.startIndex = 0
394
+ scrollYStore.endIndex = 1
395
+ scrollXStore.startIndex = 0
396
+ scrollXStore.endIndex = 1
397
+ editStore.insertList = []
398
+ editStore.removeList = []
399
+ const sYLoad = this.updateScrollYStatus(fullData)
400
+ this.scrollYLoad = sYLoad
401
+ // 全量数据
402
+ this.tableFullData = fullData
403
+ this.tableFullTreeData = treeData
404
+ // 缓存数据
405
+ this.cacheRowMap(true)
406
+ // 原始数据
407
+ this.tableSynchData = datas
408
+ // 克隆原数据,用于显示编辑状态,与编辑值做对比
409
+ if (keepSource) {
410
+ this.tableSourceData = XEUtils.clone(fullData, true)
411
+ }
412
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
413
+ if (sYLoad) {
414
+ if (!(this.height || this.maxHeight)) {
415
+ errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
416
+ }
417
+ if (!this.showOverflow) {
418
+ warnLog('vxe.error.reqProp', ['table.show-overflow'])
419
+ }
420
+ if (this.spanMethod) {
421
+ warnLog('vxe.error.scrollErrProp', ['table.span-method'])
422
+ }
423
+ }
424
+ }
425
+ if (this.clearCellAreas && this.mouseConfig) {
426
+ this.clearCellAreas()
427
+ this.clearCopyCellArea()
428
+ }
429
+ this.clearMergeCells()
430
+ this.clearMergeFooterItems()
431
+ this.handleTableData(true)
432
+ this.updateFooter()
433
+ return this.$nextTick().then(() => {
434
+ this.updateHeight()
435
+ this.updateStyle()
436
+ }).then(() => {
437
+ this.computeScrollLoad()
438
+ }).then(() => {
439
+ // 是否启用了虚拟滚动
440
+ if (sYLoad) {
441
+ scrollYStore.endIndex = scrollYStore.visibleSize
442
+ }
443
+ this.handleReserveStatus()
444
+ this.checkSelectionStatus()
445
+ return new Promise(resolve => {
446
+ this.$nextTick()
447
+ .then(() => this.recalculate())
448
+ .then(() => {
449
+ // 是否变更虚拟滚动
450
+ if (oldScrollYLoad === sYLoad) {
451
+ restoreScrollLocation(this, lastScrollLeft, lastScrollTop).then(resolve)
452
+ } else {
453
+ setTimeout(() => restoreScrollLocation(this, lastScrollLeft, lastScrollTop).then(resolve))
454
+ }
455
+ })
456
+ })
457
+ })
458
+ },
459
+ /**
460
+ * 重新加载数据,不会清空表格状态
461
+ * @param {Array} datas 数据
462
+ */
463
+ loadData (datas) {
464
+ const { inited, initStatus } = this
465
+ return this.loadTableData(datas).then(() => {
466
+ this.inited = true
467
+ this.initStatus = true
468
+ if (!initStatus) {
469
+ this.handleLoadDefaults()
470
+ }
471
+ if (!inited) {
472
+ this.handleInitDefaults()
473
+ }
474
+ return this.recalculate()
475
+ })
476
+ },
477
+ /**
478
+ * 重新加载数据,会清空表格状态
479
+ * @param {Array} datas 数据
480
+ */
481
+ reloadData (datas) {
482
+ const { inited } = this
483
+ return this.clearAll()
484
+ .then(() => {
485
+ this.inited = true
486
+ this.initStatus = true
487
+ return this.loadTableData(datas)
488
+ })
489
+ .then(() => {
490
+ this.handleLoadDefaults()
491
+ if (!inited) {
492
+ this.handleInitDefaults()
493
+ }
494
+ return this.recalculate()
495
+ })
496
+ },
497
+ /**
498
+ * 局部加载行数据并恢复到初始状态
499
+ * 对于行数据需要局部更改的场景中可能会用到
500
+ * @param {Row} row 行对象
501
+ * @param {Object} record 新数据
502
+ * @param {String} field 字段名
503
+ */
504
+ reloadRow (row, record, field) {
505
+ const { keepSource, tableSourceData, tableData } = this
506
+ if (keepSource) {
507
+ const rowIndex = this.getRowIndex(row)
508
+ const oRow = tableSourceData[rowIndex]
509
+ if (oRow && row) {
510
+ if (field) {
511
+ const newValue = XEUtils.get(record || row, field)
512
+ XEUtils.set(row, field, newValue)
513
+ XEUtils.set(oRow, field, newValue)
514
+ } else {
515
+ const newRecord = XEUtils.clone({ ...record }, true)
516
+ XEUtils.destructuring(oRow, Object.assign(row, newRecord))
517
+ }
518
+ }
519
+ this.tableData = tableData.slice(0)
520
+ } else {
521
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
522
+ warnLog('vxe.error.reqProp', ['keep-source'])
523
+ }
524
+ }
525
+ return this.$nextTick()
526
+ },
527
+ /**
528
+ * 加载列配置
529
+ * 对于表格列需要重载、局部递增场景下可能会用到
530
+ * @param {ColumnInfo} columns 列配置
531
+ */
532
+ loadColumn (columns) {
533
+ const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn(this, column), { children: 'children' })
534
+ return this.handleColumn(collectColumn)
535
+ },
536
+ /**
537
+ * 加载列配置并恢复到初始状态
538
+ * 对于表格列需要重载、局部递增场景下可能会用到
539
+ * @param {ColumnInfo} columns 列配置
540
+ */
541
+ reloadColumn (columns) {
542
+ return this.clearAll().then(() => {
543
+ return this.loadColumn(columns)
544
+ })
545
+ },
546
+ handleColumn (collectColumn) {
547
+ this.collectColumn = collectColumn
548
+ const tableFullColumn = getColumnList(collectColumn)
549
+ this.tableFullColumn = tableFullColumn
550
+ this.cacheColumnMap()
551
+ this.restoreCustomStorage()
552
+ this.parseColumns().then(() => {
553
+ if (this.scrollXLoad) {
554
+ this.loadScrollXData(true)
555
+ }
556
+ })
557
+ this.clearMergeCells()
558
+ this.clearMergeFooterItems()
559
+ this.handleTableData(true)
560
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
561
+ if ((this.scrollXLoad || this.scrollYLoad) && this.expandColumn) {
562
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
563
+ }
564
+ }
565
+ return this.$nextTick().then(() => {
566
+ if (this.$toolbar) {
567
+ this.$toolbar.syncUpdate({ collectColumn, $table: this })
568
+ }
569
+ return this.recalculate()
570
+ })
571
+ },
572
+ /**
573
+ * 更新数据行的 Map
574
+ * 牺牲数据组装的耗时,用来换取使用过程中的流畅
575
+ */
576
+ cacheRowMap (source) {
577
+ const { treeConfig, treeOpts, tableFullData, fullDataRowMap, fullAllDataRowMap, tableFullTreeData } = this
578
+ let { fullDataRowIdData, fullAllDataRowIdData } = this
579
+ const rowkey = getRowkey(this)
580
+ const isLazy = treeConfig && treeOpts.lazy
581
+ const handleCache = (row, index, items, path, parent, nodes) => {
582
+ let rowid = getRowid(this, row)
583
+ const seq = treeConfig && path ? toTreePathSeq(path) : index + 1
584
+ const level = nodes ? nodes.length - 1 : 0
585
+ if (eqEmptyValue(rowid)) {
586
+ rowid = getRowUniqueId()
587
+ XEUtils.set(row, rowkey, rowid)
588
+ }
589
+ if (isLazy && row[treeOpts.hasChild] && XEUtils.isUndefined(row[treeOpts.children])) {
590
+ row[treeOpts.children] = null
591
+ }
592
+ const rest = { row, rowid, seq, index: treeConfig && parent ? -1 : index, _index: -1, $index: -1, items, parent, level }
593
+ if (source) {
594
+ fullDataRowIdData[rowid] = rest
595
+ fullDataRowMap.set(row, rest)
596
+ }
597
+ fullAllDataRowIdData[rowid] = rest
598
+ fullAllDataRowMap.set(row, rest)
599
+ }
600
+ if (source) {
601
+ fullDataRowIdData = this.fullDataRowIdData = {}
602
+ fullDataRowMap.clear()
603
+ }
604
+ fullAllDataRowIdData = this.fullAllDataRowIdData = {}
605
+ fullAllDataRowMap.clear()
606
+ if (treeConfig) {
607
+ XEUtils.eachTree(tableFullTreeData, handleCache, treeOpts)
608
+ } else {
609
+ tableFullData.forEach(handleCache)
610
+ }
611
+ },
612
+ loadTreeChildren (row, childRecords) {
613
+ const { keepSource, tableSourceData, treeOpts, fullDataRowIdData, fullDataRowMap, fullAllDataRowMap, fullAllDataRowIdData } = this
614
+ const { transform, children, mapChildren } = treeOpts
615
+ const rest = fullAllDataRowIdData[getRowid(this, row)]
616
+ const parentLevel = rest ? rest.level : 0
617
+ return this.createData(childRecords).then((rows) => {
618
+ if (keepSource) {
619
+ const rowid = getRowid(this, row)
620
+ const matchObj = XEUtils.findTree(tableSourceData, (item) => rowid === getRowid(this, item), treeOpts)
621
+ if (matchObj) {
622
+ matchObj.item[children] = XEUtils.clone(rows, true)
623
+ }
624
+ }
625
+ XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
626
+ const rowid = getRowid(this, childRow)
627
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent, level: parentLevel + nodes.length }
628
+ fullDataRowIdData[rowid] = rest
629
+ fullDataRowMap.set(childRow, rest)
630
+ fullAllDataRowIdData[rowid] = rest
631
+ fullAllDataRowMap.set(childRow, rest)
632
+ }, treeOpts)
633
+ row[children] = rows
634
+ if (transform) {
635
+ row[mapChildren] = rows
636
+ }
637
+ this.updateAfterDataIndex()
638
+ return rows
639
+ })
640
+ },
641
+ /**
642
+ * 更新数据列的 Map
643
+ * 牺牲数据组装的耗时,用来换取使用过程中的流畅
644
+ */
645
+ cacheColumnMap () {
646
+ const { tableFullColumn, collectColumn, fullColumnMap, showOverflow } = this
647
+ const fullColumnIdData = this.fullColumnIdData = {}
648
+ const fullColumnFieldData = this.fullColumnFieldData = {}
649
+ const isGroup = collectColumn.some(hasChildrenList)
650
+ let isAllOverflow = !!showOverflow
651
+ let expandColumn
652
+ let treeNodeColumn
653
+ let checkboxColumn
654
+ let radioColumn
655
+ let hasFixed
656
+ const handleFunc = (column, index, items, path, parent) => {
657
+ const { id: colid, property, fixed, type, treeNode } = column
658
+ const rest = { column, colid, index, items, parent }
659
+ if (property) {
660
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
661
+ if (fullColumnFieldData[property]) {
662
+ warnLog('vxe.error.colRepet', ['field', property])
663
+ }
664
+ }
665
+ fullColumnFieldData[property] = rest
666
+ }
667
+ if (!hasFixed && fixed) {
668
+ hasFixed = fixed
669
+ }
670
+ if (treeNode) {
671
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
672
+ if (treeNodeColumn) {
673
+ warnLog('vxe.error.colRepet', ['tree-node', treeNode])
674
+ }
675
+ }
676
+ if (!treeNodeColumn) {
677
+ treeNodeColumn = column
678
+ }
679
+ } else if (type === 'expand') {
680
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
681
+ if (expandColumn) {
682
+ warnLog('vxe.error.colRepet', ['type', type])
683
+ }
684
+ }
685
+ if (!expandColumn) {
686
+ expandColumn = column
687
+ }
688
+ }
689
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
690
+ if (type === 'checkbox') {
691
+ if (checkboxColumn) {
692
+ warnLog('vxe.error.colRepet', ['type', type])
693
+ }
694
+ if (!checkboxColumn) {
695
+ checkboxColumn = column
696
+ }
697
+ } else if (type === 'radio') {
698
+ if (radioColumn) {
699
+ warnLog('vxe.error.colRepet', ['type', type])
700
+ }
701
+ if (!radioColumn) {
702
+ radioColumn = column
703
+ }
704
+ }
705
+ }
706
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
707
+ if (this.showOverflow && column.showOverflow === false) {
708
+ warnLog('vxe.error.errConflicts', [`table.show-overflow=${this.showOverflow}`, `column.show-overflow=${column.showOverflow}`])
709
+ }
710
+ if (this.showHeaderOverflow && column.showHeaderOverflow === false) {
711
+ warnLog('vxe.error.errConflicts', [`table.show-header-overflow=${this.showHeaderOverflow}`, `column.show-header-overflow=${column.showHeaderOverflow}`])
712
+ }
713
+ if (this.showFooterOverflow && column.showFooterOverflow === false) {
714
+ warnLog('vxe.error.errConflicts', [`table.show-footer-overflow=${this.showFooterOverflow}`, `column.show-footer-overflow=${column.showFooterOverflow}`])
715
+ }
716
+ }
717
+ if (isAllOverflow && column.showOverflow === false) {
718
+ isAllOverflow = false
719
+ }
720
+ if (fullColumnIdData[colid]) {
721
+ errLog('vxe.error.colRepet', ['colId', colid])
722
+ }
723
+ fullColumnIdData[colid] = rest
724
+ fullColumnMap.set(column, rest)
725
+ }
726
+ fullColumnMap.clear()
727
+ if (isGroup) {
728
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parent, nodes) => {
729
+ column.level = nodes.length
730
+ handleFunc(column, index, items, path, parent)
731
+ })
732
+ } else {
733
+ tableFullColumn.forEach(handleFunc)
734
+ }
735
+
736
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
737
+ if (expandColumn && this.mouseOpts.area) {
738
+ errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand'])
739
+ }
740
+ }
741
+
742
+ this.isGroup = isGroup
743
+ this.treeNodeColumn = treeNodeColumn
744
+ this.expandColumn = expandColumn
745
+ this.isAllOverflow = isAllOverflow
746
+ },
747
+ /**
748
+ * 根据 tr 元素获取对应的 row 信息
749
+ * @param {Element} tr 元素
750
+ */
751
+ getRowNode (tr) {
752
+ if (tr) {
753
+ const { fullAllDataRowIdData } = this
754
+ const rowid = tr.getAttribute('rowid')
755
+ const rest = fullAllDataRowIdData[rowid]
756
+ if (rest) {
757
+ return { rowid: rest.rowid, item: rest.row, index: rest.index, items: rest.items, parent: rest.parent }
758
+ }
759
+ }
760
+ return null
761
+ },
762
+ /**
763
+ * 根据 th/td 元素获取对应的 column 信息
764
+ * @param {Element} cell 元素
765
+ */
766
+ getColumnNode (cell) {
767
+ if (cell) {
768
+ const { fullColumnIdData } = this
769
+ const colid = cell.getAttribute('colid')
770
+ const rest = fullColumnIdData[colid]
771
+ if (rest) {
772
+ return { colid: rest.colid, item: rest.column, index: rest.index, items: rest.items, parent: rest.parent }
773
+ }
774
+ }
775
+ return null
776
+ },
777
+ /**
778
+ * 根据 row 获取序号
779
+ * @param {Row} row 行对象
780
+ */
781
+ getRowSeq (row) {
782
+ const { fullDataRowIdData } = this
783
+ if (row) {
784
+ const rowid = getRowid(this, row)
785
+ const rest = fullDataRowIdData[rowid]
786
+ if (rest) {
787
+ return rest.seq
788
+ }
789
+ }
790
+ return -1
791
+ },
792
+ /**
793
+ * 根据 row 获取相对于 data 中的索引
794
+ * @param {Row} row 行对象
795
+ */
796
+ getRowIndex (row) {
797
+ return this.fullDataRowMap.has(row) ? this.fullDataRowMap.get(row).index : -1
798
+ },
799
+ /**
800
+ * 根据 row 获取相对于当前数据中的索引
801
+ * @param {Row} row 行对象
802
+ */
803
+ getVTRowIndex (row) {
804
+ return this.afterFullData.indexOf(row)
805
+ },
806
+ // 在 v3 中废弃
807
+ _getRowIndex (row) {
808
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
809
+ warnLog('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex'])
810
+ }
811
+ return this.getVTRowIndex(row)
812
+ },
813
+ /**
814
+ * 根据 row 获取渲染中的虚拟索引
815
+ * @param {Row} row 行对象
816
+ */
817
+ getVMRowIndex (row) {
818
+ return this.tableData.indexOf(row)
819
+ },
820
+ // 在 v3 中废弃
821
+ $getRowIndex (row) {
822
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
823
+ warnLog('vxe.error.delFunc', ['$getRowIndex', 'getVMRowIndex'])
824
+ }
825
+ return this.getVMRowIndex(row)
826
+ },
827
+ /**
828
+ * 根据 column 获取相对于 columns 中的索引
829
+ * @param {ColumnInfo} column 列配置
830
+ */
831
+ getColumnIndex (column) {
832
+ return this.fullColumnMap.has(column) ? this.fullColumnMap.get(column).index : -1
833
+ },
834
+ /**
835
+ * 根据 column 获取相对于当前表格列中的索引
836
+ * @param {ColumnInfo} column 列配置
837
+ */
838
+ getVTColumnIndex (column) {
839
+ return this.visibleColumn.indexOf(column)
840
+ },
841
+ // 在 v3 中废弃
842
+ _getColumnIndex (column) {
843
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
844
+ warnLog('vxe.error.delFunc', ['_getColumnIndex', 'getVTColumnIndex'])
845
+ }
846
+ return this.getVTColumnIndex(column)
847
+ },
848
+ /**
849
+ * 根据 column 获取渲染中的虚拟索引
850
+ * @param {ColumnInfo} column 列配置
851
+ */
852
+ getVMColumnIndex (column) {
853
+ return this.tableColumn.indexOf(column)
854
+ },
855
+ // 在 v3 中废弃
856
+ $getColumnIndex (column) {
857
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
858
+ warnLog('vxe.error.delFunc', ['$getColumnIndex', 'getVMColumnIndex'])
859
+ }
860
+ return this.getVMColumnIndex(column)
861
+ },
862
+ /**
863
+ * 判断是否为索引列
864
+ * @param {ColumnInfo} column 列配置
865
+ */
866
+ isSeqColumn (column) {
867
+ return column && column.type === 'seq'
868
+ },
869
+ /**
870
+ * 定义行数据中的列属性,如果不存在则定义
871
+ * @param {Row} record 行数据
872
+ */
873
+ defineField (record) {
874
+ const { radioOpts, checkboxOpts, treeConfig, treeOpts, expandOpts } = this
875
+ const rowkey = getRowkey(this)
876
+ this.tableFullColumn.forEach(column => {
877
+ const { property, editRender } = column
878
+ if (property && !XEUtils.has(record, property)) {
879
+ let cellValue = null
880
+ if (editRender) {
881
+ const { defaultValue } = editRender
882
+ if (XEUtils.isFunction(defaultValue)) {
883
+ cellValue = defaultValue({ column })
884
+ } else if (!XEUtils.isUndefined(defaultValue)) {
885
+ cellValue = defaultValue
886
+ }
887
+ }
888
+ XEUtils.set(record, property, cellValue)
889
+ }
890
+ })
891
+ const otherFields = [radioOpts.labelField, checkboxOpts.checkField, checkboxOpts.labelField, expandOpts.labelField]
892
+ otherFields.forEach((key) => {
893
+ if (key && eqEmptyValue(XEUtils.get(record, key))) {
894
+ XEUtils.set(record, key, null)
895
+ }
896
+ })
897
+ if (treeConfig && treeOpts.lazy && XEUtils.isUndefined(record[treeOpts.children])) {
898
+ record[treeOpts.children] = null
899
+ }
900
+ // 必须有行数据的唯一主键,可以自行设置;也可以默认生成一个随机数
901
+ if (eqEmptyValue(XEUtils.get(record, rowkey))) {
902
+ XEUtils.set(record, rowkey, getRowUniqueId())
903
+ }
904
+ return record
905
+ },
906
+ /**
907
+ * 创建 data 对象
908
+ * 对于某些特殊场景可能会用到,会自动对数据的字段名进行检测,如果不存在就自动定义
909
+ * @param {Array} records 新数据
910
+ */
911
+ createData (records) {
912
+ const { treeConfig, treeOpts } = this
913
+ const handleRrecord = record => this.defineField(Object.assign({}, record))
914
+ const rows = treeConfig ? XEUtils.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord)
915
+ return this.$nextTick().then(() => rows)
916
+ },
917
+ /**
918
+ * 创建 Row|Rows 对象
919
+ * 对于某些特殊场景需要对数据进行手动插入时可能会用到
920
+ * @param {Array/Object} records 新数据
921
+ */
922
+ createRow (records) {
923
+ const isArr = XEUtils.isArray(records)
924
+ if (!isArr) {
925
+ records = [records]
926
+ }
927
+ return this.$nextTick().then(() => this.createData(records).then(rows => isArr ? rows : rows[0]))
928
+ },
929
+ /**
930
+ * 还原数据
931
+ * 如果不传任何参数,则还原整个表格
932
+ * 如果传 row 则还原一行
933
+ * 如果传 rows 则还原多行
934
+ * 如果还额外传了 field 则还原指定的单元格数据
935
+ */
936
+ revertData (rows, field) {
937
+ const { keepSource, tableSourceData, treeConfig } = this
938
+ if (!keepSource) {
939
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
940
+ warnLog('vxe.error.reqProp', ['keep-source'])
941
+ }
942
+ return this.$nextTick()
943
+ }
944
+ let targetRows = rows
945
+ if (rows) {
946
+ if (!XEUtils.isArray(rows)) {
947
+ targetRows = [rows]
948
+ }
949
+ } else {
950
+ targetRows = XEUtils.toArray(this.getUpdateRecords())
951
+ }
952
+ if (targetRows.length) {
953
+ targetRows.forEach(row => {
954
+ if (!this.isInsertByRow(row)) {
955
+ const rowIndex = this.getRowIndex(row)
956
+ if (treeConfig && rowIndex === -1) {
957
+ throw new Error(UtilTools.getLog('vxe.error.noTree', ['revertData']))
958
+ }
959
+ const oRow = tableSourceData[rowIndex]
960
+ if (oRow && row) {
961
+ if (field) {
962
+ XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true))
963
+ } else {
964
+ XEUtils.destructuring(row, XEUtils.clone(oRow, true))
965
+ }
966
+ }
967
+ }
968
+ })
969
+ }
970
+ if (rows) {
971
+ return this.$nextTick()
972
+ }
973
+ return this.reloadData(tableSourceData)
974
+ },
975
+ /**
976
+ * 清空单元格内容
977
+ * 如果不创参数,则清空整个表格内容
978
+ * 如果传 row 则清空一行内容
979
+ * 如果传 rows 则清空多行内容
980
+ * 如果还额外传了 field 则清空指定单元格内容
981
+ * @param {Array/Row} rows 行数据
982
+ * @param {String} field 字段名
983
+ */
984
+ clearData (rows, field) {
985
+ const { tableFullData, visibleColumn } = this
986
+ if (!arguments.length) {
987
+ rows = tableFullData
988
+ } else if (rows && !XEUtils.isArray(rows)) {
989
+ rows = [rows]
990
+ }
991
+ if (field) {
992
+ rows.forEach(row => XEUtils.set(row, field, null))
993
+ } else {
994
+ rows.forEach(row => {
995
+ visibleColumn.forEach(column => {
996
+ if (column.property) {
997
+ setCellValue(row, column, null)
998
+ }
999
+ })
1000
+ })
1001
+ }
1002
+ return this.$nextTick()
1003
+ },
1004
+ /**
1005
+ * 检查是否为临时行数据
1006
+ * @param {Row} row 行对象
1007
+ */
1008
+ isInsertByRow (row) {
1009
+ return this.editStore.insertList.indexOf(row) > -1
1010
+ },
1011
+ /**
1012
+ * 删除所有新增的临时数据
1013
+ * @returns
1014
+ */
1015
+ removeInsertRow () {
1016
+ return this.remove(this.editStore.insertList)
1017
+ },
1018
+ /**
1019
+ * 检查行或列数据是否发生改变
1020
+ * @param {Row} row 行对象
1021
+ * @param {String} field 字段名
1022
+ */
1023
+ isUpdateByRow (row, field) {
1024
+ const { visibleColumn, keepSource, treeConfig, treeOpts, tableSourceData, fullDataRowIdData } = this
1025
+ if (keepSource) {
1026
+ let oRow, property
1027
+ const rowid = getRowid(this, row)
1028
+ // 新增的数据不需要检测
1029
+ if (!fullDataRowIdData[rowid]) {
1030
+ return false
1031
+ }
1032
+ if (treeConfig) {
1033
+ const children = treeOpts.children
1034
+ const matchObj = XEUtils.findTree(tableSourceData, item => rowid === getRowid(this, item), treeOpts)
1035
+ row = Object.assign({}, row, { [children]: null })
1036
+ if (matchObj) {
1037
+ oRow = Object.assign({}, matchObj.item, { [children]: null })
1038
+ }
1039
+ } else {
1040
+ const oRowIndex = fullDataRowIdData[rowid].index
1041
+ oRow = tableSourceData[oRowIndex]
1042
+ }
1043
+ if (oRow) {
1044
+ if (arguments.length > 1) {
1045
+ return !eqCellValue(oRow, row, field)
1046
+ }
1047
+ for (let index = 0, len = visibleColumn.length; index < len; index++) {
1048
+ property = visibleColumn[index].property
1049
+ if (property && !eqCellValue(oRow, row, property)) {
1050
+ return true
1051
+ }
1052
+ }
1053
+ }
1054
+ }
1055
+ return false
1056
+ },
1057
+ /**
1058
+ * 获取表格的可视列,也可以指定索引获取列
1059
+ * @param {Number} columnIndex 索引
1060
+ */
1061
+ getColumns (columnIndex) {
1062
+ const columns = this.visibleColumn
1063
+ return XEUtils.isUndefined(columnIndex) ? columns.slice(0) : columns[columnIndex]
1064
+ },
1065
+ /**
1066
+ * 根据列的唯一主键获取列
1067
+ * @param {String} colid 列主键
1068
+ */
1069
+ getColumnById (colid) {
1070
+ const fullColumnIdData = this.fullColumnIdData
1071
+ return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null
1072
+ },
1073
+ /**
1074
+ * 根据列的字段名获取列
1075
+ * @param {String} field 字段名
1076
+ */
1077
+ getColumnByField (field) {
1078
+ const fullColumnFieldData = this.fullColumnFieldData
1079
+ return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null
1080
+ },
1081
+ /**
1082
+ * 获取当前表格的列
1083
+ * 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
1084
+ */
1085
+ getTableColumn () {
1086
+ return {
1087
+ collectColumn: this.collectColumn.slice(0),
1088
+ fullColumn: this.tableFullColumn.slice(0),
1089
+ visibleColumn: this.visibleColumn.slice(0),
1090
+ tableColumn: this.tableColumn.slice(0)
1091
+ }
1092
+ },
1093
+ /**
1094
+ * 获取数据,和 data 的行为一致,也可以指定索引获取数据
1095
+ */
1096
+ getData (rowIndex) {
1097
+ const tableSynchData = this.data || this.tableSynchData
1098
+ return XEUtils.isUndefined(rowIndex) ? tableSynchData.slice(0) : tableSynchData[rowIndex]
1099
+ },
1100
+ /**
1101
+ * 用于多选行,获取已选中的数据
1102
+ */
1103
+ getCheckboxRecords (isFull) {
1104
+ const { tableFullData, afterFullData, treeConfig, treeOpts, checkboxOpts, tableFullTreeData, afterTreeFullData } = this
1105
+ const { transform, children, mapChildren } = treeOpts
1106
+ const { checkField: property } = checkboxOpts
1107
+ const currTableData = isFull ? (transform ? tableFullTreeData : tableFullData) : (transform ? afterTreeFullData : afterFullData)
1108
+ let rowList = []
1109
+ if (property) {
1110
+ if (treeConfig) {
1111
+ rowList = XEUtils.filterTree(currTableData, row => XEUtils.get(row, property), { children: transform ? mapChildren : children })
1112
+ } else {
1113
+ rowList = currTableData.filter(row => XEUtils.get(row, property))
1114
+ }
1115
+ } else {
1116
+ const { selection } = this
1117
+ if (treeConfig) {
1118
+ rowList = XEUtils.filterTree(currTableData, row => selection.indexOf(row) > -1, { children: transform ? mapChildren : children })
1119
+ } else {
1120
+ rowList = currTableData.filter(row => selection.indexOf(row) > -1)
1121
+ }
1122
+ }
1123
+ return rowList
1124
+ },
1125
+ /**
1126
+ * 如果为虚拟树,将树结构拍平
1127
+ * @returns
1128
+ */
1129
+ handleVirtualTreeToList () {
1130
+ const { treeOpts, treeConfig, treeExpandeds, afterTreeFullData, afterFullData } = this
1131
+ if (treeConfig && treeOpts.transform) {
1132
+ const fullData = []
1133
+ const expandMaps = new Map()
1134
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path, parent) => {
1135
+ if (!parent || (expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1)) {
1136
+ expandMaps.set(row, 1)
1137
+ fullData.push(row)
1138
+ }
1139
+ }, { children: treeOpts.mapChildren })
1140
+ this.afterFullData = fullData
1141
+ this.updateScrollYStatus(fullData)
1142
+ return fullData
1143
+ }
1144
+ return afterFullData
1145
+ },
1146
+ /**
1147
+ * 获取处理后全量的表格数据
1148
+ * 如果存在筛选条件,继续处理
1149
+ */
1150
+ updateAfterFullData () {
1151
+ const { tableFullColumn, tableFullData, filterOpts, sortOpts, treeConfig, treeOpts, tableFullTreeData } = this
1152
+ const { remote: allRemoteFilter, filterMethod: allFilterMethod } = filterOpts
1153
+ const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological } = sortOpts
1154
+ const { transform } = treeOpts
1155
+ let tableData = []
1156
+ let tableTree = []
1157
+ const filterColumns = []
1158
+ let orderColumns = []
1159
+ tableFullColumn.forEach(column => {
1160
+ const { property, sortable, order, filters } = column
1161
+ if (!allRemoteFilter && filters && filters.length) {
1162
+ const valueList = []
1163
+ const itemList = []
1164
+ filters.forEach((item) => {
1165
+ if (item.checked) {
1166
+ itemList.push(item)
1167
+ valueList.push(item.value)
1168
+ }
1169
+ })
1170
+ if (itemList.length) {
1171
+ filterColumns.push({ column, valueList, itemList })
1172
+ }
1173
+ }
1174
+ if (!allRemoteSort && sortable && order) {
1175
+ orderColumns.push({ column, field: column.property, property, order, sortTime: column.sortTime })
1176
+ }
1177
+ })
1178
+ if (sortMultiple && chronological && orderColumns.length > 1) {
1179
+ orderColumns = XEUtils.orderBy(orderColumns, 'sortTime')
1180
+ }
1181
+ if (filterColumns.length) {
1182
+ const handleFilter = (row) => {
1183
+ return filterColumns.every(({ column, valueList, itemList }) => {
1184
+ if (valueList.length && !allRemoteFilter) {
1185
+ const { filterMethod, filterRender } = column
1186
+ const compConf = filterRender ? VXETable.renderer.get(filterRender.name) : null
1187
+ const compFilterMethod = compConf && compConf.renderFilter ? compConf.filterMethod : null
1188
+ const defaultFilterMethod = compConf ? compConf.defaultFilterMethod : null
1189
+ const cellValue = UtilTools.getCellValue(row, column)
1190
+ if (filterMethod) {
1191
+ return itemList.some((item) => filterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1192
+ } else if (compFilterMethod) {
1193
+ return itemList.some((item) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1194
+ } else if (allFilterMethod) {
1195
+ return allFilterMethod({ options: itemList, values: valueList, cellValue, row, column })
1196
+ } else if (defaultFilterMethod) {
1197
+ return itemList.some((item) => defaultFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: this }))
1198
+ }
1199
+ return valueList.indexOf(XEUtils.get(row, column.property)) > -1
1200
+ }
1201
+ return true
1202
+ })
1203
+ }
1204
+ if (treeConfig && transform) {
1205
+ // 筛选虚拟树
1206
+ tableTree = XEUtils.searchTree(tableFullTreeData, handleFilter, { ...treeOpts, original: true })
1207
+ tableData = tableTree
1208
+ } else {
1209
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter)
1210
+ tableTree = tableData
1211
+ }
1212
+ } else {
1213
+ if (treeConfig && transform) {
1214
+ // 还原虚拟树
1215
+ tableTree = XEUtils.searchTree(tableFullTreeData, () => true, { ...treeOpts, original: true })
1216
+ tableData = tableTree
1217
+ } else {
1218
+ tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0)
1219
+ tableTree = tableData
1220
+ }
1221
+ }
1222
+ const firstOrderColumn = orderColumns[0]
1223
+ if (!allRemoteSort && firstOrderColumn) {
1224
+ if (treeConfig && transform) {
1225
+ // 虚拟树和列表一样,只能排序根级节点
1226
+ if (allSortMethod) {
1227
+ const sortRests = allSortMethod({ data: tableTree, sortList: orderColumns, $table: this })
1228
+ tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
1229
+ } else {
1230
+ tableTree = XEUtils.orderBy(tableTree, orderColumns.map(({ column, order }) => [getOrderField(this, column), order]))
1231
+ }
1232
+ tableData = tableTree
1233
+ } else {
1234
+ if (allSortMethod) {
1235
+ const sortRests = allSortMethod({ data: tableData, column: firstOrderColumn.column, property: firstOrderColumn.property, order: firstOrderColumn.order, sortList: orderColumns, $table: this })
1236
+ tableData = XEUtils.isArray(sortRests) ? sortRests : tableData
1237
+ } else {
1238
+ // 兼容 v4
1239
+ if (sortMultiple) {
1240
+ tableData = XEUtils.orderBy(tableData, orderColumns.map(({ column, order }) => [getOrderField(this, column), order]))
1241
+ } else {
1242
+ // 兼容 v2,在 v4 中废弃, sortBy 不能为数组
1243
+ let sortByConfs
1244
+ if (XEUtils.isArray(firstOrderColumn.sortBy)) {
1245
+ sortByConfs = firstOrderColumn.sortBy.map(item => [item, firstOrderColumn.order])
1246
+ }
1247
+ tableData = XEUtils.orderBy(tableData, sortByConfs || [firstOrderColumn].map(({ column, order }) => [getOrderField(this, column), order]))
1248
+ }
1249
+ }
1250
+ tableTree = tableData
1251
+ }
1252
+ }
1253
+ this.afterFullData = tableData
1254
+ this.afterTreeFullData = tableTree
1255
+ this.updateAfterDataIndex()
1256
+ },
1257
+ /**
1258
+ * 预编译
1259
+ * 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
1260
+ */
1261
+ updateAfterDataIndex () {
1262
+ const { treeConfig, afterFullData, fullDataRowIdData, fullAllDataRowIdData, afterTreeFullData, treeOpts } = this
1263
+ if (treeConfig) {
1264
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path) => {
1265
+ const rowid = getRowid(this, row)
1266
+ const allrest = fullAllDataRowIdData[rowid]
1267
+ const seq = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
1268
+ if (allrest) {
1269
+ allrest.seq = seq
1270
+ allrest._index = index
1271
+ } else {
1272
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1273
+ fullAllDataRowIdData[rowid] = rest
1274
+ fullDataRowIdData[rowid] = rest
1275
+ }
1276
+ }, { children: treeOpts.transform ? treeOpts.mapChildren : treeOpts.children })
1277
+ } else {
1278
+ afterFullData.forEach((row, index) => {
1279
+ const rowid = getRowid(this, row)
1280
+ const allrest = fullAllDataRowIdData[rowid]
1281
+ const seq = index + 1
1282
+ if (allrest) {
1283
+ allrest.seq = seq
1284
+ allrest._index = index
1285
+ } else {
1286
+ const rest = { row, rowid, seq, index: -1, $index: -1, _index: index, items: [], parent: null, level: 0 }
1287
+ fullAllDataRowIdData[rowid] = rest
1288
+ fullDataRowIdData[rowid] = rest
1289
+ }
1290
+ })
1291
+ }
1292
+ },
1293
+ /**
1294
+ * 只对 tree-config 有效,获取行的父级
1295
+ */
1296
+ getParentRow (rowOrRowid) {
1297
+ const { treeConfig, fullDataRowIdData } = this
1298
+ if (rowOrRowid && treeConfig) {
1299
+ let rowid
1300
+ if (XEUtils.isString(rowOrRowid)) {
1301
+ rowid = rowOrRowid
1302
+ } else {
1303
+ rowid = getRowid(this, rowOrRowid)
1304
+ }
1305
+ if (rowid) {
1306
+ return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].parent : null
1307
+ }
1308
+ }
1309
+ return null
1310
+ },
1311
+ /**
1312
+ * 根据行的唯一主键获取行
1313
+ * @param {String/Number} rowid 行主键
1314
+ */
1315
+ getRowById (rowid) {
1316
+ const fullDataRowIdData = this.fullDataRowIdData
1317
+ return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null
1318
+ },
1319
+ /**
1320
+ * 根据行获取行的唯一主键
1321
+ * @param {Row} row 行对象
1322
+ */
1323
+ getRowid (row) {
1324
+ const fullAllDataRowMap = this.fullAllDataRowMap
1325
+ return fullAllDataRowMap.has(row) ? fullAllDataRowMap.get(row).rowid : null
1326
+ },
1327
+ /**
1328
+ * 获取处理后的表格数据
1329
+ * 如果存在筛选条件,继续处理
1330
+ * 如果存在排序,继续处理
1331
+ */
1332
+ getTableData () {
1333
+ const { tableFullData, afterFullData, tableData, footerTableData } = this
1334
+ return {
1335
+ fullData: tableFullData.slice(0),
1336
+ visibleData: afterFullData.slice(0),
1337
+ tableData: tableData.slice(0),
1338
+ footerData: footerTableData.slice(0)
1339
+ }
1340
+ },
1341
+ /**
1342
+ * 处理数据加载默认行为
1343
+ * 默认执行一次,除非被重置
1344
+ */
1345
+ handleLoadDefaults () {
1346
+ if (this.checkboxConfig) {
1347
+ this.handleDefaultSelectionChecked()
1348
+ }
1349
+ if (this.radioConfig) {
1350
+ this.handleDefaultRadioChecked()
1351
+ }
1352
+ if (this.expandConfig) {
1353
+ this.handleDefaultRowExpand()
1354
+ }
1355
+ if (this.treeConfig) {
1356
+ this.handleDefaultTreeExpand()
1357
+ }
1358
+ if (this.mergeCells) {
1359
+ this.handleDefaultMergeCells()
1360
+ }
1361
+ if (this.mergeFooterItems) {
1362
+ this.handleDefaultMergeFooterItems()
1363
+ }
1364
+ this.$nextTick(() => setTimeout(this.recalculate))
1365
+ },
1366
+ /**
1367
+ * 处理初始化的默认行为
1368
+ * 只会执行一次
1369
+ */
1370
+ handleInitDefaults () {
1371
+ const { sortConfig } = this
1372
+ if (sortConfig) {
1373
+ this.handleDefaultSort()
1374
+ }
1375
+ },
1376
+ /**
1377
+ * 隐藏指定列
1378
+ */
1379
+ hideColumn (fieldOrColumn) {
1380
+ const column = handleFieldOrColumn(this, fieldOrColumn)
1381
+ if (column) {
1382
+ column.visible = false
1383
+ }
1384
+ return this.handleCustom()
1385
+ },
1386
+ /**
1387
+ * 显示指定列
1388
+ */
1389
+ showColumn (fieldOrColumn) {
1390
+ const column = handleFieldOrColumn(this, fieldOrColumn)
1391
+ if (column) {
1392
+ column.visible = true
1393
+ }
1394
+ return this.handleCustom()
1395
+ },
1396
+ /**
1397
+ * 手动重置列的显示隐藏、列宽拖动的状态;
1398
+ * 如果为 true 则重置所有状态
1399
+ * 如果已关联工具栏,则会同步更新
1400
+ */
1401
+ resetColumn (options) {
1402
+ const { customOpts } = this
1403
+ const { checkMethod } = customOpts
1404
+ const opts = Object.assign({ visible: true, resizable: options === true }, options)
1405
+ this.tableFullColumn.forEach(column => {
1406
+ if (opts.resizable) {
1407
+ column.resizeWidth = 0
1408
+ }
1409
+ if (!checkMethod || checkMethod({ column })) {
1410
+ column.visible = column.defaultVisible
1411
+ }
1412
+ })
1413
+ if (opts.resizable) {
1414
+ this.saveCustomResizable(true)
1415
+ }
1416
+ return this.handleCustom()
1417
+ },
1418
+ handleCustom () {
1419
+ this.saveCustomVisible()
1420
+ this.analyColumnWidth()
1421
+ return this.refreshColumn()
1422
+ },
1423
+ /**
1424
+ * 还原自定义列操作状态
1425
+ */
1426
+ restoreCustomStorage () {
1427
+ const { id, collectColumn, customConfig, customOpts } = this
1428
+ const { storage } = customOpts
1429
+ const isAllStorage = customOpts.storage === true
1430
+ const isResizable = isAllStorage || (storage && storage.resizable)
1431
+ const isVisible = isAllStorage || (storage && storage.visible)
1432
+ if (customConfig && (isResizable || isVisible)) {
1433
+ const customMap = {}
1434
+ if (!id) {
1435
+ errLog('vxe.error.reqProp', ['id'])
1436
+ return
1437
+ }
1438
+ if (isResizable) {
1439
+ const columnWidthStorage = getCustomStorageMap(resizableStorageKey)[id]
1440
+ if (columnWidthStorage) {
1441
+ XEUtils.each(columnWidthStorage, (resizeWidth, field) => {
1442
+ customMap[field] = { field, resizeWidth }
1443
+ })
1444
+ }
1445
+ }
1446
+ if (isVisible) {
1447
+ const columnVisibleStorage = getCustomStorageMap(visibleStorageKey)[id]
1448
+ if (columnVisibleStorage) {
1449
+ const colVisibles = columnVisibleStorage.split('|')
1450
+ const colHides = colVisibles[0] ? colVisibles[0].split(',') : []
1451
+ const colShows = colVisibles[1] ? colVisibles[1].split(',') : []
1452
+ colHides.forEach(field => {
1453
+ if (customMap[field]) {
1454
+ customMap[field].visible = false
1455
+ } else {
1456
+ customMap[field] = { field, visible: false }
1457
+ }
1458
+ })
1459
+ colShows.forEach(field => {
1460
+ if (customMap[field]) {
1461
+ customMap[field].visible = true
1462
+ } else {
1463
+ customMap[field] = { field, visible: true }
1464
+ }
1465
+ })
1466
+ }
1467
+ }
1468
+ const keyMap = {}
1469
+ XEUtils.eachTree(collectColumn, column => {
1470
+ const colKey = column.getKey()
1471
+ if (colKey) {
1472
+ keyMap[colKey] = column
1473
+ }
1474
+ })
1475
+ XEUtils.each(customMap, ({ visible, resizeWidth }, field) => {
1476
+ const column = keyMap[field]
1477
+ if (column) {
1478
+ if (XEUtils.isNumber(resizeWidth)) {
1479
+ column.resizeWidth = resizeWidth
1480
+ }
1481
+ if (XEUtils.isBoolean(visible)) {
1482
+ column.visible = visible
1483
+ }
1484
+ }
1485
+ })
1486
+ }
1487
+ },
1488
+ saveCustomVisible () {
1489
+ const { id, collectColumn, customConfig, customOpts } = this
1490
+ const { checkMethod, storage } = customOpts
1491
+ const isAllStorage = customOpts.storage === true
1492
+ const isVisible = isAllStorage || (storage && storage.visible)
1493
+ if (customConfig && isVisible) {
1494
+ const columnVisibleStorageMap = getCustomStorageMap(visibleStorageKey)
1495
+ const colHides = []
1496
+ const colShows = []
1497
+ if (!id) {
1498
+ errLog('vxe.error.reqProp', ['id'])
1499
+ return
1500
+ }
1501
+ XEUtils.eachTree(collectColumn, column => {
1502
+ if (!checkMethod || checkMethod({ column })) {
1503
+ if (!column.visible && column.defaultVisible) {
1504
+ const colKey = column.getKey()
1505
+ if (colKey) {
1506
+ colHides.push(colKey)
1507
+ }
1508
+ } else if (column.visible && !column.defaultVisible) {
1509
+ const colKey = column.getKey()
1510
+ if (colKey) {
1511
+ colShows.push(colKey)
1512
+ }
1513
+ }
1514
+ }
1515
+ })
1516
+ columnVisibleStorageMap[id] = [colHides.join(',')].concat(colShows.length ? [colShows.join(',')] : []).join('|') || undefined
1517
+ localStorage.setItem(visibleStorageKey, XEUtils.toJSONString(columnVisibleStorageMap))
1518
+ }
1519
+ },
1520
+ saveCustomResizable (isReset) {
1521
+ const { id, collectColumn, customConfig, customOpts } = this
1522
+ const { storage } = customOpts
1523
+ const isAllStorage = customOpts.storage === true
1524
+ const isResizable = isAllStorage || (storage && storage.resizable)
1525
+ if (customConfig && isResizable) {
1526
+ const columnWidthStorageMap = getCustomStorageMap(resizableStorageKey)
1527
+ let columnWidthStorage
1528
+ if (!id) {
1529
+ errLog('vxe.error.reqProp', ['id'])
1530
+ return
1531
+ }
1532
+ if (!isReset) {
1533
+ columnWidthStorage = XEUtils.isPlainObject(columnWidthStorageMap[id]) ? columnWidthStorageMap[id] : {}
1534
+ XEUtils.eachTree(collectColumn, column => {
1535
+ if (column.resizeWidth) {
1536
+ const colKey = column.getKey()
1537
+ if (colKey) {
1538
+ columnWidthStorage[colKey] = column.renderWidth
1539
+ }
1540
+ }
1541
+ })
1542
+ }
1543
+ columnWidthStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage
1544
+ localStorage.setItem(resizableStorageKey, XEUtils.toJSONString(columnWidthStorageMap))
1545
+ }
1546
+ },
1547
+ /**
1548
+ * 刷新列配置
1549
+ */
1550
+ refreshColumn () {
1551
+ return this.parseColumns().then(() => {
1552
+ return this.refreshScroll()
1553
+ }).then(() => {
1554
+ return this.recalculate()
1555
+ })
1556
+ },
1557
+ /**
1558
+ * 刷新列信息
1559
+ * 将固定的列左边、右边分别靠边
1560
+ */
1561
+ parseColumns () {
1562
+ const leftList = []
1563
+ const centerList = []
1564
+ const rightList = []
1565
+ const { collectColumn, tableFullColumn, isGroup, columnStore, sXOpts, scrollXStore } = this
1566
+ // 如果是分组表头,如果子列全部被隐藏,则根列也隐藏
1567
+ if (isGroup) {
1568
+ const leftGroupList = []
1569
+ const centerGroupList = []
1570
+ const rightGroupList = []
1571
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
1572
+ const isColGroup = hasChildrenList(column)
1573
+ // 如果是分组,必须按组设置固定列,不允许给子列设置固定
1574
+ if (parent && parent.fixed) {
1575
+ column.fixed = parent.fixed
1576
+ }
1577
+ if (parent && column.fixed !== parent.fixed) {
1578
+ errLog('vxe.error.groupFixed')
1579
+ }
1580
+ if (isColGroup) {
1581
+ column.visible = !!XEUtils.findTree(column.children, subColumn => hasChildrenList(subColumn) ? null : subColumn.visible)
1582
+ } else if (column.visible) {
1583
+ if (column.fixed === 'left') {
1584
+ leftList.push(column)
1585
+ } else if (column.fixed === 'right') {
1586
+ rightList.push(column)
1587
+ } else {
1588
+ centerList.push(column)
1589
+ }
1590
+ }
1591
+ })
1592
+ collectColumn.forEach((column) => {
1593
+ if (column.visible) {
1594
+ if (column.fixed === 'left') {
1595
+ leftGroupList.push(column)
1596
+ } else if (column.fixed === 'right') {
1597
+ rightGroupList.push(column)
1598
+ } else {
1599
+ centerGroupList.push(column)
1600
+ }
1601
+ }
1602
+ })
1603
+ this.tableGroupColumn = leftGroupList.concat(centerGroupList).concat(rightGroupList)
1604
+ } else {
1605
+ // 重新分配列
1606
+ tableFullColumn.forEach((column) => {
1607
+ if (column.visible) {
1608
+ if (column.fixed === 'left') {
1609
+ leftList.push(column)
1610
+ } else if (column.fixed === 'right') {
1611
+ rightList.push(column)
1612
+ } else {
1613
+ centerList.push(column)
1614
+ }
1615
+ }
1616
+ })
1617
+ }
1618
+ const visibleColumn = leftList.concat(centerList).concat(rightList)
1619
+ let scrollXLoad = sXOpts.enabled && sXOpts.gt > -1 && sXOpts.gt < tableFullColumn.length
1620
+ this.hasFixedColumn = leftList.length > 0 || rightList.length > 0
1621
+ Object.assign(columnStore, { leftList, centerList, rightList })
1622
+ if (scrollXLoad && isGroup) {
1623
+ scrollXLoad = false
1624
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1625
+ warnLog('vxe.error.scrollXNotGroup')
1626
+ }
1627
+ }
1628
+ if (scrollXLoad) {
1629
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
1630
+ if (this.showHeader && !this.showHeaderOverflow) {
1631
+ warnLog('vxe.error.reqProp', ['show-header-overflow'])
1632
+ }
1633
+ if (this.showFooter && !this.showFooterOverflow) {
1634
+ warnLog('vxe.error.reqProp', ['show-footer-overflow'])
1635
+ }
1636
+ if (this.spanMethod) {
1637
+ warnLog('vxe.error.scrollErrProp', ['span-method'])
1638
+ }
1639
+ if (this.footerSpanMethod) {
1640
+ warnLog('vxe.error.scrollErrProp', ['footer-span-method'])
1641
+ }
1642
+ }
1643
+ const { visibleSize } = computeVirtualX(this)
1644
+ scrollXStore.startIndex = 0
1645
+ scrollXStore.endIndex = visibleSize
1646
+ scrollXStore.visibleSize = visibleSize
1647
+ }
1648
+ // 如果列被显示/隐藏,则清除合并状态
1649
+ // 如果列被设置为固定,则清除合并状态
1650
+ if (visibleColumn.length !== this.visibleColumn.length || !this.visibleColumn.every((column, index) => column === visibleColumn[index])) {
1651
+ this.clearMergeCells()
1652
+ this.clearMergeFooterItems()
1653
+ }
1654
+ this.scrollXLoad = scrollXLoad
1655
+ this.visibleColumn = visibleColumn
1656
+ this.handleTableColumn()
1657
+ return this.updateFooter().then(() => {
1658
+ return this.recalculate()
1659
+ }).then(() => {
1660
+ this.updateCellAreas()
1661
+ return this.recalculate()
1662
+ })
1663
+ },
1664
+ /**
1665
+ * 指定列宽的列进行拆分
1666
+ */
1667
+ analyColumnWidth () {
1668
+ const { columnOpts } = this
1669
+ const { width: defaultWidth, minWidth: defaultMinWidth } = columnOpts
1670
+ const resizeList = []
1671
+ const pxList = []
1672
+ const pxMinList = []
1673
+ const scaleList = []
1674
+ const scaleMinList = []
1675
+ const autoList = []
1676
+ this.tableFullColumn.forEach(column => {
1677
+ if (defaultWidth && !column.width) {
1678
+ column.width = defaultWidth
1679
+ }
1680
+ if (defaultMinWidth && !column.minWidth) {
1681
+ column.minWidth = defaultMinWidth
1682
+ }
1683
+ if (column.visible) {
1684
+ if (column.resizeWidth) {
1685
+ resizeList.push(column)
1686
+ } else if (DomTools.isPx(column.width)) {
1687
+ pxList.push(column)
1688
+ } else if (DomTools.isScale(column.width)) {
1689
+ scaleList.push(column)
1690
+ } else if (DomTools.isPx(column.minWidth)) {
1691
+ pxMinList.push(column)
1692
+ } else if (DomTools.isScale(column.minWidth)) {
1693
+ scaleMinList.push(column)
1694
+ } else {
1695
+ autoList.push(column)
1696
+ }
1697
+ }
1698
+ })
1699
+ Object.assign(this.columnStore, { resizeList, pxList, pxMinList, scaleList, scaleMinList, autoList })
1700
+ },
1701
+ /**
1702
+ * 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
1703
+ */
1704
+ refreshScroll () {
1705
+ const { lastScrollLeft, lastScrollTop } = this
1706
+ const { $refs } = this
1707
+ const { tableBody, leftBody, rightBody, tableFooter } = $refs
1708
+ const tableBodyElem = tableBody ? tableBody.$el : null
1709
+ const leftBodyElem = leftBody ? leftBody.$el : null
1710
+ const rightBodyElem = rightBody ? rightBody.$el : null
1711
+ const tableFooterElem = tableFooter ? tableFooter.$el : null
1712
+ return new Promise(resolve => {
1713
+ // 还原滚动条位置
1714
+ if (lastScrollLeft || lastScrollTop) {
1715
+ return restoreScrollLocation(this, lastScrollLeft, lastScrollTop).then(() => {
1716
+ // 存在滚动行为未结束情况
1717
+ setTimeout(resolve, 30)
1718
+ })
1719
+ }
1720
+ // 重置
1721
+ setScrollTop(tableBodyElem, lastScrollTop)
1722
+ setScrollTop(leftBodyElem, lastScrollTop)
1723
+ setScrollTop(rightBodyElem, lastScrollTop)
1724
+ setScrollLeft(tableFooterElem, lastScrollLeft)
1725
+ // 存在滚动行为未结束情况
1726
+ setTimeout(resolve, 30)
1727
+ })
1728
+ },
1729
+ /**
1730
+ * 计算单元格列宽,动态分配可用剩余空间
1731
+ * 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
1732
+ */
1733
+ recalculate (refull) {
1734
+ const { $refs } = this
1735
+ const { tableBody, tableHeader, tableFooter } = $refs
1736
+ const bodyElem = tableBody ? tableBody.$el : null
1737
+ const headerElem = tableHeader ? tableHeader.$el : null
1738
+ const footerElem = tableFooter ? tableFooter.$el : null
1739
+ if (bodyElem) {
1740
+ this.autoCellWidth(headerElem, bodyElem, footerElem)
1741
+ if (refull === true) {
1742
+ // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
1743
+ return this.computeScrollLoad().then(() => {
1744
+ this.autoCellWidth(headerElem, bodyElem, footerElem)
1745
+ return this.computeScrollLoad()
1746
+ })
1747
+ }
1748
+ }
1749
+ return this.computeScrollLoad()
1750
+ },
1751
+ /**
1752
+ * 列宽算法
1753
+ * 支持 px、%、固定 混合分配
1754
+ * 支持动态列表调整分配
1755
+ * 支持自动分配偏移量
1756
+ * @param {Element} headerElem
1757
+ * @param {Element} bodyElem
1758
+ * @param {Element} footerElem
1759
+ * @param {Number} bodyWidth
1760
+ */
1761
+ autoCellWidth (headerElem, bodyElem, footerElem) {
1762
+ let tableWidth = 0
1763
+ const minCellWidth = 40 // 列宽最少限制 40px
1764
+ const bodyWidth = bodyElem.clientWidth - 1
1765
+ let remainWidth = bodyWidth
1766
+ let meanWidth = remainWidth / 100
1767
+ const { fit, columnStore } = this
1768
+ const { resizeList, pxMinList, pxList, scaleList, scaleMinList, autoList } = columnStore
1769
+ // 最小宽
1770
+ pxMinList.forEach(column => {
1771
+ const minWidth = parseInt(column.minWidth)
1772
+ tableWidth += minWidth
1773
+ column.renderWidth = minWidth
1774
+ })
1775
+ // 最小百分比
1776
+ scaleMinList.forEach(column => {
1777
+ const scaleWidth = Math.floor(parseInt(column.minWidth) * meanWidth)
1778
+ tableWidth += scaleWidth
1779
+ column.renderWidth = scaleWidth
1780
+ })
1781
+ // 固定百分比
1782
+ scaleList.forEach(column => {
1783
+ const scaleWidth = Math.floor(parseInt(column.width) * meanWidth)
1784
+ tableWidth += scaleWidth
1785
+ column.renderWidth = scaleWidth
1786
+ })
1787
+ // 固定宽
1788
+ pxList.forEach(column => {
1789
+ const width = parseInt(column.width)
1790
+ tableWidth += width
1791
+ column.renderWidth = width
1792
+ })
1793
+ // 调整了列宽
1794
+ resizeList.forEach(column => {
1795
+ const width = parseInt(column.resizeWidth)
1796
+ tableWidth += width
1797
+ column.renderWidth = width
1798
+ })
1799
+ remainWidth -= tableWidth
1800
+ meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoList.length)) : 0
1801
+ if (fit) {
1802
+ if (remainWidth > 0) {
1803
+ scaleMinList.concat(pxMinList).forEach(column => {
1804
+ tableWidth += meanWidth
1805
+ column.renderWidth += meanWidth
1806
+ })
1807
+ }
1808
+ } else {
1809
+ meanWidth = minCellWidth
1810
+ }
1811
+ // 自适应
1812
+ autoList.forEach(column => {
1813
+ const width = Math.max(meanWidth, minCellWidth)
1814
+ column.renderWidth = width
1815
+ tableWidth += width
1816
+ })
1817
+ if (fit) {
1818
+ /**
1819
+ * 偏移量算法
1820
+ * 如果所有列足够放的情况下,从最后动态列开始分配
1821
+ */
1822
+ const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoList)
1823
+ let dynamicSize = dynamicList.length - 1
1824
+ if (dynamicSize > 0) {
1825
+ let odiffer = bodyWidth - tableWidth
1826
+ if (odiffer > 0) {
1827
+ while (odiffer > 0 && dynamicSize >= 0) {
1828
+ odiffer--
1829
+ dynamicList[dynamicSize--].renderWidth++
1830
+ }
1831
+ tableWidth = bodyWidth
1832
+ }
1833
+ }
1834
+ }
1835
+ const tableHeight = bodyElem.offsetHeight
1836
+ const overflowY = bodyElem.scrollHeight > bodyElem.clientHeight
1837
+ this.scrollbarWidth = overflowY ? bodyElem.offsetWidth - bodyElem.clientWidth : 0
1838
+ this.overflowY = overflowY
1839
+ this.tableWidth = tableWidth
1840
+ this.tableHeight = tableHeight
1841
+ if (headerElem) {
1842
+ this.headerHeight = headerElem.clientHeight
1843
+ this.$nextTick(() => {
1844
+ // 检测是否同步滚动
1845
+ if (headerElem && bodyElem && headerElem.scrollLeft !== bodyElem.scrollLeft) {
1846
+ headerElem.scrollLeft = bodyElem.scrollLeft
1847
+ }
1848
+ })
1849
+ } else {
1850
+ this.headerHeight = 0
1851
+ }
1852
+ if (footerElem) {
1853
+ const footerHeight = footerElem.offsetHeight
1854
+ this.scrollbarHeight = Math.max(footerHeight - footerElem.clientHeight, 0)
1855
+ this.overflowX = tableWidth > footerElem.clientWidth
1856
+ this.footerHeight = footerHeight
1857
+ } else {
1858
+ this.footerHeight = 0
1859
+ this.scrollbarHeight = Math.max(tableHeight - bodyElem.clientHeight, 0)
1860
+ this.overflowX = tableWidth > bodyWidth
1861
+ }
1862
+ this.updateHeight()
1863
+ this.parentHeight = Math.max(this.headerHeight + this.footerHeight + 20, this.getParentHeight())
1864
+ if (this.overflowX) {
1865
+ this.checkScrolling()
1866
+ }
1867
+ },
1868
+ updateHeight () {
1869
+ this.customHeight = calcHeight(this, 'height')
1870
+ this.customMaxHeight = calcHeight(this, 'maxHeight')
1871
+ },
1872
+ updateStyle () {
1873
+ let {
1874
+ $refs,
1875
+ isGroup,
1876
+ fullColumnIdData,
1877
+ tableColumn,
1878
+ customHeight,
1879
+ customMaxHeight,
1880
+ border,
1881
+ headerHeight,
1882
+ showFooter,
1883
+ showOverflow: allColumnOverflow,
1884
+ showHeaderOverflow: allColumnHeaderOverflow,
1885
+ showFooterOverflow: allColumnFooterOverflow,
1886
+ footerHeight,
1887
+ tableHeight,
1888
+ tableWidth,
1889
+ scrollbarHeight,
1890
+ scrollbarWidth,
1891
+ scrollXLoad,
1892
+ scrollYLoad,
1893
+ cellOffsetWidth,
1894
+ columnStore,
1895
+ elemStore,
1896
+ editStore,
1897
+ currentRow,
1898
+ mouseConfig,
1899
+ keyboardConfig,
1900
+ keyboardOpts,
1901
+ spanMethod,
1902
+ mergeList,
1903
+ mergeFooterList,
1904
+ footerSpanMethod,
1905
+ isAllOverflow,
1906
+ visibleColumn
1907
+ } = this
1908
+ const containerList = ['main', 'left', 'right']
1909
+ const emptyPlaceholderElem = $refs.emptyPlaceholder
1910
+ const bodyWrapperElem = elemStore['main-body-wrapper']
1911
+ if (emptyPlaceholderElem) {
1912
+ emptyPlaceholderElem.style.top = `${headerHeight}px`
1913
+ emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : ''
1914
+ }
1915
+ if (customHeight > 0) {
1916
+ if (showFooter) {
1917
+ customHeight += scrollbarHeight
1918
+ }
1919
+ }
1920
+ containerList.forEach((name, index) => {
1921
+ const fixedType = index > 0 ? name : ''
1922
+ const layoutList = ['header', 'body', 'footer']
1923
+ const fixedColumn = columnStore[`${fixedType}List`]
1924
+ const fixedWrapperElem = $refs[`${fixedType}Container`]
1925
+ layoutList.forEach(layout => {
1926
+ const wrapperElem = elemStore[`${name}-${layout}-wrapper`]
1927
+ const tableElem = elemStore[`${name}-${layout}-table`]
1928
+ if (layout === 'header') {
1929
+ // 表头体样式处理
1930
+ // 横向滚动渲染
1931
+ let tWidth = tableWidth
1932
+
1933
+ // 如果是使用优化模式
1934
+ let isOptimize = false
1935
+ if (!isGroup) {
1936
+ if (fixedType) {
1937
+ if (scrollXLoad || allColumnHeaderOverflow) {
1938
+ isOptimize = true
1939
+ }
1940
+ }
1941
+ }
1942
+ if (isOptimize) {
1943
+ tableColumn = fixedColumn
1944
+ }
1945
+ if (isOptimize || scrollXLoad) {
1946
+ tWidth = tableColumn.reduce((previous, column) => previous + column.renderWidth, 0)
1947
+ }
1948
+
1949
+ if (tableElem) {
1950
+ tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
1951
+ // 修复 IE 中高度无法自适应问题
1952
+ if (browse.msie) {
1953
+ XEUtils.arrayEach(tableElem.querySelectorAll('.vxe-resizable'), resizeElem => {
1954
+ resizeElem.style.height = `${resizeElem.parentNode.offsetHeight}px`
1955
+ })
1956
+ }
1957
+ }
1958
+
1959
+ const repairElem = elemStore[`${name}-${layout}-repair`]
1960
+ if (repairElem) {
1961
+ repairElem.style.width = `${tableWidth}px`
1962
+ }
1963
+
1964
+ const listElem = elemStore[`${name}-${layout}-list`]
1965
+ if (isGroup && listElem) {
1966
+ XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
1967
+ const colNode = this.getColumnNode(thElem)
1968
+ if (colNode) {
1969
+ const column = colNode.item
1970
+ const { showHeaderOverflow } = column
1971
+ const cellOverflow = XEUtils.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow
1972
+ const showEllipsis = cellOverflow === 'ellipsis'
1973
+ const showTitle = cellOverflow === 'title'
1974
+ const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
1975
+ const hasEllipsis = showTitle || showTooltip || showEllipsis
1976
+ let childWidth = 0
1977
+ let countChild = 0
1978
+ if (hasEllipsis) {
1979
+ XEUtils.eachTree(column.children, item => {
1980
+ if (!item.children || !column.children.length) {
1981
+ countChild++
1982
+ }
1983
+ childWidth += item.renderWidth
1984
+ })
1985
+ }
1986
+ thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : ''
1987
+ }
1988
+ })
1989
+ }
1990
+ } else if (layout === 'body') {
1991
+ const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
1992
+ if (isNodeElement(wrapperElem)) {
1993
+ if (customMaxHeight) {
1994
+ wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight}px`
1995
+ } else {
1996
+ if (customHeight > 0) {
1997
+ wrapperElem.style.height = `${fixedType ? (customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight) : customHeight - headerHeight - footerHeight}px`
1998
+ } else {
1999
+ wrapperElem.style.height = ''
2000
+ }
2001
+ }
2002
+ }
2003
+
2004
+ // 如果是固定列
2005
+ if (fixedWrapperElem) {
2006
+ const isRightFixed = fixedType === 'right'
2007
+ const fixedColumn = columnStore[`${fixedType}List`]
2008
+ if (isNodeElement(wrapperElem)) {
2009
+ wrapperElem.style.top = `${headerHeight}px`
2010
+ }
2011
+ fixedWrapperElem.style.height = `${(customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) + headerHeight + footerHeight - scrollbarHeight * (showFooter ? 2 : 1)}px`
2012
+ fixedWrapperElem.style.width = `${fixedColumn.reduce((previous, column) => previous + column.renderWidth, isRightFixed ? scrollbarWidth : 0)}px`
2013
+ }
2014
+
2015
+ let tWidth = tableWidth
2016
+
2017
+ // 如果是使用优化模式
2018
+ if (fixedType) {
2019
+ if (scrollXLoad || scrollYLoad || (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
2020
+ if (!mergeList.length && !spanMethod && !(keyboardConfig && keyboardOpts.isMerge)) {
2021
+ tableColumn = fixedColumn
2022
+ } else {
2023
+ tableColumn = visibleColumn
2024
+ }
2025
+ } else {
2026
+ tableColumn = visibleColumn
2027
+ }
2028
+ }
2029
+ tWidth = tableColumn.reduce((previous, column) => previous + column.renderWidth, 0)
2030
+
2031
+ if (tableElem) {
2032
+ tableElem.style.width = tWidth ? `${tWidth}px` : ''
2033
+ // 兼容性处理
2034
+ tableElem.style.paddingRight = scrollbarWidth && fixedType && (browse['-moz'] || browse.safari) ? `${scrollbarWidth}px` : ''
2035
+ }
2036
+ if (emptyBlockElem) {
2037
+ emptyBlockElem.style.width = tWidth ? `${tWidth}px` : ''
2038
+ }
2039
+ } else if (layout === 'footer') {
2040
+ let tWidth = tableWidth
2041
+
2042
+ // 如果是使用优化模式
2043
+ if (fixedType) {
2044
+ if (scrollXLoad || allColumnFooterOverflow) {
2045
+ if (!mergeFooterList.length || !footerSpanMethod) {
2046
+ tableColumn = fixedColumn
2047
+ } else {
2048
+ tableColumn = visibleColumn
2049
+ }
2050
+ } else {
2051
+ tableColumn = visibleColumn
2052
+ }
2053
+ }
2054
+ tWidth = tableColumn.reduce((previous, column) => previous + column.renderWidth, 0)
2055
+
2056
+ if (isNodeElement(wrapperElem)) {
2057
+ // 如果是固定列
2058
+ if (fixedWrapperElem) {
2059
+ wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight : tableHeight + headerHeight}px`
2060
+ }
2061
+ wrapperElem.style.marginTop = `${-scrollbarHeight}px`
2062
+ }
2063
+ if (tableElem) {
2064
+ tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
2065
+ }
2066
+ }
2067
+ const colgroupElem = elemStore[`${name}-${layout}-colgroup`]
2068
+ if (colgroupElem) {
2069
+ XEUtils.arrayEach(colgroupElem.children, colElem => {
2070
+ const colid = colElem.getAttribute('name')
2071
+ if (colid === 'col_gutter') {
2072
+ colElem.style.width = `${scrollbarWidth}px`
2073
+ }
2074
+ if (fullColumnIdData[colid]) {
2075
+ const column = fullColumnIdData[colid].column
2076
+ const { showHeaderOverflow, showFooterOverflow, showOverflow } = column
2077
+ let cellOverflow
2078
+ colElem.style.width = `${column.renderWidth}px`
2079
+ if (layout === 'header') {
2080
+ cellOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow
2081
+ } else if (layout === 'footer') {
2082
+ cellOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow
2083
+ } else {
2084
+ cellOverflow = XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow) ? allColumnOverflow : showOverflow
2085
+ }
2086
+ const showEllipsis = cellOverflow === 'ellipsis'
2087
+ const showTitle = cellOverflow === 'title'
2088
+ const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
2089
+ let hasEllipsis = showTitle || showTooltip || showEllipsis
2090
+ const listElem = elemStore[`${name}-${layout}-list`]
2091
+ // 滚动的渲染不支持动态行高
2092
+ if (layout === 'header' || layout === 'footer') {
2093
+ if (scrollXLoad && !hasEllipsis) {
2094
+ hasEllipsis = true
2095
+ }
2096
+ } else {
2097
+ if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
2098
+ hasEllipsis = true
2099
+ }
2100
+ }
2101
+ if (listElem) {
2102
+ XEUtils.arrayEach(listElem.querySelectorAll(`.${column.id}`), elem => {
2103
+ const colspan = parseInt(elem.getAttribute('colspan') || 1)
2104
+ const cellElem = elem.querySelector('.vxe-cell')
2105
+ let colWidth = column.renderWidth
2106
+ if (cellElem) {
2107
+ if (colspan > 1) {
2108
+ const columnIndex = this.getColumnIndex(column)
2109
+ for (let index = 1; index < colspan; index++) {
2110
+ const nextColumn = this.getColumns(columnIndex + index)
2111
+ if (nextColumn) {
2112
+ colWidth += nextColumn.renderWidth
2113
+ }
2114
+ }
2115
+ }
2116
+ cellElem.style.width = hasEllipsis ? `${colWidth - (cellOffsetWidth * colspan)}px` : ''
2117
+ }
2118
+ })
2119
+ }
2120
+ }
2121
+ })
2122
+ }
2123
+ })
2124
+ })
2125
+ if (currentRow) {
2126
+ this.setCurrentRow(currentRow)
2127
+ }
2128
+ if (mouseConfig && mouseConfig.selected && editStore.selected.row && editStore.selected.column) {
2129
+ this.addColSdCls()
2130
+ }
2131
+ return this.$nextTick()
2132
+ },
2133
+ /**
2134
+ * 处理固定列的显示状态
2135
+ */
2136
+ checkScrolling () {
2137
+ const { tableBody, leftContainer, rightContainer } = this.$refs
2138
+ const bodyElem = tableBody ? tableBody.$el : null
2139
+ if (bodyElem) {
2140
+ if (leftContainer) {
2141
+ DomTools[bodyElem.scrollLeft > 0 ? 'addClass' : 'removeClass'](leftContainer, 'scrolling--middle')
2142
+ }
2143
+ if (rightContainer) {
2144
+ DomTools[bodyElem.clientWidth < bodyElem.scrollWidth - Math.ceil(bodyElem.scrollLeft) ? 'addClass' : 'removeClass'](rightContainer, 'scrolling--middle')
2145
+ }
2146
+ }
2147
+ },
2148
+ preventEvent (evnt, type, args, next, end) {
2149
+ const evntList = VXETable.interceptor.get(type)
2150
+ let rest
2151
+ if (!evntList.some(func => func(Object.assign({ $grid: this.$xegrid, $table: this, $event: evnt }, args)) === false)) {
2152
+ if (next) {
2153
+ rest = next()
2154
+ }
2155
+ }
2156
+ if (end) {
2157
+ end()
2158
+ }
2159
+ return rest
2160
+ },
2161
+ /**
2162
+ * 全局按下事件处理
2163
+ */
2164
+ handleGlobalMousedownEvent (evnt) {
2165
+ const { $el, $refs, $xegrid, $toolbar, mouseConfig, editStore, ctxMenuStore, editOpts, filterStore, getRowNode } = this
2166
+ const { actived } = editStore
2167
+ const { ctxWrapper, filterWrapper, validTip } = $refs
2168
+ if (filterWrapper) {
2169
+ if (getEventTargetNode(evnt, $el, 'vxe-cell--filter').flag) {
2170
+ // 如果点击了筛选按钮
2171
+ } else if (getEventTargetNode(evnt, filterWrapper.$el).flag) {
2172
+ // 如果点击筛选容器
2173
+ } else {
2174
+ if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
2175
+ this.preventEvent(evnt, 'event.clearFilter', filterStore.args, this.closeFilter)
2176
+ }
2177
+ }
2178
+ }
2179
+ // 如果已激活了编辑状态
2180
+ if (actived.row) {
2181
+ if (!(editOpts.autoClear === false)) {
2182
+ // 如果是激活状态,点击了单元格之外
2183
+ const cell = actived.args.cell
2184
+ if ((!cell || !getEventTargetNode(evnt, cell).flag)) {
2185
+ if (validTip && getEventTargetNode(evnt, validTip.$el).flag) {
2186
+ // 如果是激活状态,且点击了校验提示框
2187
+ } else if (!this.lastCallTime || this.lastCallTime + 50 < Date.now()) {
2188
+ if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-clear').flag) {
2189
+ // 如果手动调用了激活单元格,避免触发源被移除后导致重复关闭
2190
+ this.preventEvent(evnt, 'event.clearActived', actived.args, () => {
2191
+ let isClearActived
2192
+ if (editOpts.mode === 'row') {
2193
+ const rowNode = getEventTargetNode(evnt, $el, 'vxe-body--row')
2194
+ // row 方式,如果点击了不同行
2195
+ isClearActived = rowNode.flag ? getRowNode(rowNode.targetElem).item !== actived.args.row : false
2196
+ } else {
2197
+ // cell 方式,如果是非编辑列
2198
+ isClearActived = !getEventTargetNode(evnt, $el, 'col--edit').flag
2199
+ }
2200
+ // 如果点击表头行,则清除激活状态
2201
+ if (!isClearActived) {
2202
+ isClearActived = getEventTargetNode(evnt, $el, 'vxe-header--row').flag
2203
+ }
2204
+ // 如果点击表尾行,则清除激活状态
2205
+ if (!isClearActived) {
2206
+ isClearActived = getEventTargetNode(evnt, $el, 'vxe-footer--row').flag
2207
+ }
2208
+ // 如果固定了高度且点击了行之外的空白处,则清除激活状态
2209
+ if (!isClearActived && this.height && !this.overflowY) {
2210
+ const bodyWrapperElem = evnt.target
2211
+ if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
2212
+ isClearActived = evnt.offsetY < bodyWrapperElem.clientHeight
2213
+ }
2214
+ }
2215
+ if (
2216
+ isClearActived ||
2217
+ // 如果点击了当前表格之外
2218
+ !getEventTargetNode(evnt, $el).flag
2219
+ ) {
2220
+ setTimeout(() => this.clearActived(evnt))
2221
+ }
2222
+ })
2223
+ }
2224
+ }
2225
+ }
2226
+ }
2227
+ } else if (mouseConfig) {
2228
+ if (!getEventTargetNode(evnt, $el).flag && !($xegrid && getEventTargetNode(evnt, $xegrid.$el).flag) && !(ctxWrapper && getEventTargetNode(evnt, ctxWrapper.$el).flag) && !($toolbar && getEventTargetNode(evnt, $toolbar.$el).flag)) {
2229
+ this.clearSelected()
2230
+ if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
2231
+ this.preventEvent(evnt, 'event.clearAreas', {}, () => {
2232
+ this.clearCellAreas()
2233
+ this.clearCopyCellArea()
2234
+ })
2235
+ }
2236
+ }
2237
+ }
2238
+ // 如果配置了快捷菜单且,点击了其他地方则关闭
2239
+ if (ctxMenuStore.visible && ctxWrapper && !getEventTargetNode(evnt, ctxWrapper.$el).flag) {
2240
+ this.closeMenu()
2241
+ }
2242
+ // 最后激活的表格
2243
+ this.isActivated = getEventTargetNode(evnt, ($xegrid || this).$el).flag
2244
+ },
2245
+ /**
2246
+ * 窗口失焦事件处理
2247
+ */
2248
+ handleGlobalBlurEvent () {
2249
+ this.closeFilter()
2250
+ this.closeMenu()
2251
+ },
2252
+ /**
2253
+ * 全局滚动事件
2254
+ */
2255
+ handleGlobalMousewheelEvent () {
2256
+ this.closeTooltip()
2257
+ this.closeMenu()
2258
+ },
2259
+ /**
2260
+ * 表格键盘事件
2261
+ */
2262
+ keydownEvent (evnt) {
2263
+ const { filterStore, ctxMenuStore, editStore, keyboardConfig, mouseConfig, mouseOpts, keyboardOpts } = this
2264
+ const { actived } = editStore
2265
+ const { keyCode } = evnt
2266
+ const isEsc = keyCode === 27
2267
+ if (isEsc) {
2268
+ this.preventEvent(evnt, 'event.keydown', null, () => {
2269
+ this.emitEvent('keydown-start', {}, evnt)
2270
+ if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardEvent) {
2271
+ this.handleKeyboardEvent(evnt)
2272
+ } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
2273
+ evnt.stopPropagation()
2274
+ // 如果按下了 Esc 键,关闭快捷菜单、筛选
2275
+ this.closeFilter()
2276
+ this.closeMenu()
2277
+ if (keyboardConfig && keyboardOpts.isEsc) {
2278
+ // 如果是激活编辑状态,则取消编辑
2279
+ if (actived.row) {
2280
+ const params = actived.args
2281
+ this.clearActived(evnt)
2282
+ // 如果配置了选中功能,则为选中状态
2283
+ if (mouseConfig && mouseOpts.selected) {
2284
+ this.$nextTick(() => this.handleSelected(params, evnt))
2285
+ }
2286
+ }
2287
+ }
2288
+ }
2289
+ this.emitEvent('keydown', {}, evnt)
2290
+ this.emitEvent('keydown-end', {}, evnt)
2291
+ })
2292
+ }
2293
+ },
2294
+ /**
2295
+ * 全局键盘事件
2296
+ */
2297
+ handleGlobalKeydownEvent (evnt) {
2298
+ // 该行为只对当前激活的表格有效
2299
+ if (this.isActivated) {
2300
+ this.preventEvent(evnt, 'event.keydown', null, () => {
2301
+ const { filterStore, isCtxMenu, ctxMenuStore, editStore, editOpts, editConfig, mouseConfig, mouseOpts, keyboardConfig, keyboardOpts, treeConfig, treeOpts, highlightCurrentRow, currentRow, bodyCtxMenu, rowOpts } = this
2302
+ const { selected, actived } = editStore
2303
+ const { keyCode } = evnt
2304
+ const isBack = keyCode === 8
2305
+ const isTab = keyCode === 9
2306
+ const isEnter = keyCode === 13
2307
+ const isEsc = keyCode === 27
2308
+ const isSpacebar = keyCode === 32
2309
+ const isLeftArrow = keyCode === 37
2310
+ const isUpArrow = keyCode === 38
2311
+ const isRightArrow = keyCode === 39
2312
+ const isDwArrow = keyCode === 40
2313
+ const isDel = keyCode === 46
2314
+ const isF2 = keyCode === 113
2315
+ const isContextMenu = keyCode === 93
2316
+ const hasMetaKey = evnt.metaKey
2317
+ const hasCtrlKey = evnt.ctrlKey
2318
+ const hasShiftKey = evnt.shiftKey
2319
+ const hasAltKey = evnt.altKey
2320
+ const operArrow = isLeftArrow || isUpArrow || isRightArrow || isDwArrow
2321
+ const operCtxMenu = isCtxMenu && ctxMenuStore.visible && (isEnter || isSpacebar || operArrow)
2322
+ const isEditStatus = isEnableConf(editConfig) && actived.column && actived.row
2323
+ let params
2324
+ if (filterStore.visible) {
2325
+ if (isEsc) {
2326
+ this.closeFilter()
2327
+ }
2328
+ return
2329
+ }
2330
+ if (operCtxMenu) {
2331
+ // 如果配置了右键菜单; 支持方向键操作、回车
2332
+ evnt.preventDefault()
2333
+ if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
2334
+ this.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children)
2335
+ } else {
2336
+ this.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, this.ctxMenuList)
2337
+ }
2338
+ } else if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardEvent) {
2339
+ this.handleKeyboardEvent(evnt)
2340
+ } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
2341
+ // 空格键支持选中复选框
2342
+ evnt.preventDefault()
2343
+ if (selected.column.type === 'checkbox') {
2344
+ this.handleToggleCheckRowEvent(evnt, selected.args)
2345
+ } else {
2346
+ this.triggerRadioRowEvent(evnt, selected.args)
2347
+ }
2348
+ } else if (isF2 && isEnableConf(editConfig)) {
2349
+ if (!isEditStatus) {
2350
+ // 如果按下了 F2 键
2351
+ if (selected.row && selected.column) {
2352
+ evnt.stopPropagation()
2353
+ evnt.preventDefault()
2354
+ this.handleActived(selected.args, evnt)
2355
+ }
2356
+ }
2357
+ } else if (isContextMenu) {
2358
+ // 如果按下上下文键
2359
+ this._keyCtx = selected.row && selected.column && bodyCtxMenu.length
2360
+ clearTimeout(this.keyCtxTimeout)
2361
+ this.keyCtxTimeout = setTimeout(() => {
2362
+ this._keyCtx = false
2363
+ }, 1000)
2364
+ } else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow))) {
2365
+ // 退出选中
2366
+ if (hasCtrlKey) {
2367
+ // 如果是激活编辑状态,则取消编辑
2368
+ if (actived.row) {
2369
+ params = actived.args
2370
+ this.clearActived(evnt)
2371
+ // 如果配置了选中功能,则为选中状态
2372
+ if (mouseConfig && mouseOpts.selected) {
2373
+ this.$nextTick(() => this.handleSelected(params, evnt))
2374
+ }
2375
+ }
2376
+ } else {
2377
+ // 如果是激活状态,退则出到上一行/下一行
2378
+ if (selected.row || actived.row) {
2379
+ const targetArgs = selected.row ? selected.args : actived.args
2380
+ if (hasShiftKey) {
2381
+ if (keyboardOpts.enterToTab) {
2382
+ this.moveTabSelected(targetArgs, hasShiftKey, evnt)
2383
+ } else {
2384
+ this.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt)
2385
+ }
2386
+ } else {
2387
+ if (keyboardOpts.enterToTab) {
2388
+ this.moveTabSelected(targetArgs, hasShiftKey, evnt)
2389
+ } else {
2390
+ this.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt)
2391
+ }
2392
+ }
2393
+ } else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
2394
+ // 如果是树形表格当前行回车移动到子节点
2395
+ const childrens = currentRow[treeOpts.children]
2396
+ if (childrens && childrens.length) {
2397
+ evnt.preventDefault()
2398
+ const targetRow = childrens[0]
2399
+ params = { $table: this, row: targetRow }
2400
+ this.setTreeExpand(currentRow, true)
2401
+ .then(() => this.scrollToRow(targetRow))
2402
+ .then(() => this.triggerCurrentRowEvent(evnt, params))
2403
+ }
2404
+ }
2405
+ }
2406
+ } else if (operArrow && keyboardConfig && keyboardOpts.isArrow) {
2407
+ if (!isEditStatus) {
2408
+ // 如果按下了方向键
2409
+ if (selected.row && selected.column) {
2410
+ this.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt)
2411
+ } else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
2412
+ // 当前行按键上下移动
2413
+ this.moveCurrentRow(isUpArrow, isDwArrow, evnt)
2414
+ }
2415
+ }
2416
+ } else if (isTab && keyboardConfig && keyboardOpts.isTab) {
2417
+ // 如果按下了 Tab 键切换
2418
+ if (selected.row || selected.column) {
2419
+ this.moveTabSelected(selected.args, hasShiftKey, evnt)
2420
+ } else if (actived.row || actived.column) {
2421
+ this.moveTabSelected(actived.args, hasShiftKey, evnt)
2422
+ }
2423
+ } else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
2424
+ if (!isEditStatus) {
2425
+ const { delMethod, backMethod } = keyboardOpts
2426
+ // 如果是删除键
2427
+ if (keyboardOpts.isDel && (selected.row || selected.column)) {
2428
+ if (delMethod) {
2429
+ delMethod({
2430
+ row: selected.row,
2431
+ rowIndex: this.getRowIndex(selected.row),
2432
+ column: selected.column,
2433
+ columnIndex: this.getColumnIndex(selected.column),
2434
+ $table: this
2435
+ })
2436
+ } else {
2437
+ setCellValue(selected.row, selected.column, null)
2438
+ }
2439
+ if (isBack) {
2440
+ if (backMethod) {
2441
+ backMethod({
2442
+ row: selected.row,
2443
+ rowIndex: this.getRowIndex(selected.row),
2444
+ column: selected.column,
2445
+ columnIndex: this.getColumnIndex(selected.column),
2446
+ $table: this
2447
+ })
2448
+ } else {
2449
+ this.handleActived(selected.args, evnt)
2450
+ }
2451
+ } else if (isDel) {
2452
+ // 如果按下 del 键,更新表尾数据
2453
+ this.updateFooter()
2454
+ }
2455
+ } else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
2456
+ // 如果树形表格回退键关闭当前行返回父节点
2457
+ const { parent: parentRow } = XEUtils.findTree(this.afterFullData, item => item === currentRow, treeOpts)
2458
+ if (parentRow) {
2459
+ evnt.preventDefault()
2460
+ params = { $table: this, row: parentRow }
2461
+ this.setTreeExpand(parentRow, false)
2462
+ .then(() => this.scrollToRow(parentRow))
2463
+ .then(() => this.triggerCurrentRowEvent(evnt, params))
2464
+ }
2465
+ }
2466
+ }
2467
+ } else if (keyboardConfig && keyboardOpts.isEdit && !hasCtrlKey && !hasMetaKey && (isSpacebar || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 96 && keyCode <= 111) || (keyCode >= 186 && keyCode <= 192) || (keyCode >= 219 && keyCode <= 222))) {
2468
+ const { editMethod } = keyboardOpts
2469
+ // 启用编辑后,空格键功能将失效
2470
+ // if (isSpacebar) {
2471
+ // evnt.preventDefault()
2472
+ // }
2473
+ // 如果是按下非功能键之外允许直接编辑
2474
+ if (selected.column && selected.row && isEnableConf(selected.column.editRender)) {
2475
+ if (!editOpts.activeMethod || editOpts.activeMethod({ ...selected.args, $table: this })) {
2476
+ if (editMethod) {
2477
+ editMethod({
2478
+ row: selected.row,
2479
+ rowIndex: this.getRowIndex(selected.row),
2480
+ column: selected.column,
2481
+ columnIndex: this.getColumnIndex(selected.column),
2482
+ $table: this
2483
+ })
2484
+ } else {
2485
+ setCellValue(selected.row, selected.column, null)
2486
+ this.handleActived(selected.args, evnt)
2487
+ }
2488
+ }
2489
+ }
2490
+ }
2491
+ this.emitEvent('keydown', {}, evnt)
2492
+ })
2493
+ }
2494
+ },
2495
+ handleGlobalPasteEvent (evnt) {
2496
+ const { isActivated, keyboardConfig, keyboardOpts, mouseConfig, mouseOpts, editStore, filterStore } = this
2497
+ const { actived } = editStore
2498
+ if (isActivated && !filterStore.visible) {
2499
+ if (!(actived.row || actived.column)) {
2500
+ if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handlePasteCellAreaEvent) {
2501
+ this.handlePasteCellAreaEvent(evnt)
2502
+ }
2503
+ }
2504
+ this.emitEvent('paste', {}, evnt)
2505
+ }
2506
+ },
2507
+ handleGlobalCopyEvent (evnt) {
2508
+ const { isActivated, keyboardConfig, keyboardOpts, mouseConfig, mouseOpts, editStore, filterStore } = this
2509
+ const { actived } = editStore
2510
+ if (isActivated && !filterStore.visible) {
2511
+ if (!(actived.row || actived.column)) {
2512
+ if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCopyCellAreaEvent) {
2513
+ this.handleCopyCellAreaEvent(evnt)
2514
+ }
2515
+ }
2516
+ this.emitEvent('copy', {}, evnt)
2517
+ }
2518
+ },
2519
+ handleGlobalCutEvent (evnt) {
2520
+ const { isActivated, keyboardConfig, keyboardOpts, mouseConfig, mouseOpts, editStore, filterStore } = this
2521
+ const { actived } = editStore
2522
+ if (isActivated && !filterStore.visible) {
2523
+ if (!(actived.row || actived.column)) {
2524
+ if (keyboardConfig && keyboardOpts.isClip && mouseConfig && mouseOpts.area && this.handleCutCellAreaEvent) {
2525
+ this.handleCutCellAreaEvent(evnt)
2526
+ }
2527
+ }
2528
+ this.emitEvent('cut', {}, evnt)
2529
+ }
2530
+ },
2531
+ handleGlobalResizeEvent () {
2532
+ this.closeMenu()
2533
+ this.updateCellAreas()
2534
+ this.recalculate(true)
2535
+ },
2536
+ handleTargetEnterEvent (isClear) {
2537
+ const $tooltip = this.$refs.tooltip
2538
+ clearTimeout(this.tooltipTimeout)
2539
+ if (isClear) {
2540
+ this.closeTooltip()
2541
+ } else {
2542
+ if ($tooltip) {
2543
+ $tooltip.setActived(true)
2544
+ }
2545
+ }
2546
+ },
2547
+ handleTargetLeaveEvent () {
2548
+ const tooltipOpts = this.tooltipOpts
2549
+ let $tooltip = this.$refs.tooltip
2550
+ if ($tooltip) {
2551
+ $tooltip.setActived(false)
2552
+ }
2553
+ if (tooltipOpts.enterable) {
2554
+ this.tooltipTimeout = setTimeout(() => {
2555
+ $tooltip = this.$refs.tooltip
2556
+ if ($tooltip && !$tooltip.isActived()) {
2557
+ this.closeTooltip()
2558
+ }
2559
+ }, tooltipOpts.leaveDelay)
2560
+ } else {
2561
+ this.closeTooltip()
2562
+ }
2563
+ },
2564
+ triggerHeaderHelpEvent (evnt, params) {
2565
+ const { column } = params
2566
+ const titlePrefix = column.titlePrefix || column.titleHelp
2567
+ if (titlePrefix.content || titlePrefix.message) {
2568
+ const { $refs, tooltipStore } = this
2569
+ const content = getFuncText(titlePrefix.content || titlePrefix.message)
2570
+ this.handleTargetEnterEvent(true)
2571
+ tooltipStore.visible = true
2572
+ tooltipStore.currOpts = { ...titlePrefix, content: null }
2573
+ this.$nextTick(() => {
2574
+ const $tooltip = $refs.tooltip
2575
+ if ($tooltip) {
2576
+ $tooltip.open(evnt.currentTarget, content)
2577
+ }
2578
+ })
2579
+ }
2580
+ },
2581
+ /**
2582
+ * 触发表头 tooltip 事件
2583
+ */
2584
+ triggerHeaderTooltipEvent (evnt, params) {
2585
+ const { tooltipStore } = this
2586
+ const { column } = params
2587
+ const titleElem = evnt.currentTarget
2588
+ this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row)
2589
+ if (tooltipStore.column !== column || !tooltipStore.visible) {
2590
+ this.handleTooltip(evnt, titleElem, titleElem, null, params)
2591
+ }
2592
+ },
2593
+ /**
2594
+ * 触发单元格 tooltip 事件
2595
+ */
2596
+ triggerBodyTooltipEvent (evnt, params) {
2597
+ const { editConfig, editOpts, editStore, tooltipStore } = this
2598
+ const { actived } = editStore
2599
+ const { row, column } = params
2600
+ const cell = evnt.currentTarget
2601
+ this.handleTargetEnterEvent(tooltipStore.column !== column || tooltipStore.row !== row)
2602
+ if (isEnableConf(editConfig)) {
2603
+ if ((editOpts.mode === 'row' && actived.row === row) || (actived.row === row && actived.column === column)) {
2604
+ return
2605
+ }
2606
+ }
2607
+ if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
2608
+ let overflowElem
2609
+ let tipElem
2610
+ if (column.treeNode) {
2611
+ overflowElem = cell.querySelector('.vxe-tree-cell')
2612
+ if (column.type === 'html') {
2613
+ tipElem = cell.querySelector('.vxe-cell--html')
2614
+ }
2615
+ } else {
2616
+ tipElem = cell.querySelector(column.type === 'html' ? '.vxe-cell--html' : '.vxe-cell--label')
2617
+ }
2618
+ this.handleTooltip(evnt, cell, overflowElem || cell.children[0], tipElem, params)
2619
+ }
2620
+ },
2621
+ /**
2622
+ * 触发表尾 tooltip 事件
2623
+ */
2624
+ triggerFooterTooltipEvent (evnt, params) {
2625
+ const { column } = params
2626
+ const { tooltipStore } = this
2627
+ const cell = evnt.currentTarget
2628
+ this.handleTargetEnterEvent(true)
2629
+ if (tooltipStore.column !== column || !tooltipStore.visible) {
2630
+ this.handleTooltip(evnt, cell, cell.querySelector('.vxe-cell--item') || cell.children[0], null, params)
2631
+ }
2632
+ },
2633
+ /**
2634
+ * 处理显示 tooltip
2635
+ * @param {Event} evnt 事件
2636
+ * @param {ColumnInfo} column 列配置
2637
+ * @param {Row} row 行对象
2638
+ */
2639
+ handleTooltip (evnt, cell, overflowElem, tipElem, params) {
2640
+ params.cell = cell
2641
+ const { $refs, tooltipOpts, tooltipStore } = this
2642
+ const { column, row } = params
2643
+ const { showAll, enabled, contentMethod } = tooltipOpts
2644
+ const customContent = contentMethod ? contentMethod(params) : null
2645
+ const useCustom = contentMethod && !XEUtils.eqNull(customContent)
2646
+ const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim()
2647
+ const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth
2648
+ if (content && (showAll || enabled || useCustom || isCellOverflow)) {
2649
+ Object.assign(tooltipStore, {
2650
+ row,
2651
+ column,
2652
+ visible: true,
2653
+ currOpts: null
2654
+ })
2655
+ this.$nextTick(() => {
2656
+ const $tooltip = $refs.tooltip
2657
+ if ($tooltip) {
2658
+ $tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), UtilTools.formatText(content))
2659
+ }
2660
+ })
2661
+ }
2662
+ return this.$nextTick()
2663
+ },
2664
+ openTooltip (target, content) {
2665
+ const { $refs } = this
2666
+ const commTip = $refs.commTip
2667
+ if (commTip) {
2668
+ return commTip.open(target, content)
2669
+ }
2670
+ return this.$nextTick()
2671
+ },
2672
+ /**
2673
+ * 关闭 tooltip
2674
+ */
2675
+ closeTooltip () {
2676
+ const { $refs, tooltipStore } = this
2677
+ const tooltip = $refs.tooltip
2678
+ const commTip = $refs.commTip
2679
+ if (tooltipStore.visible) {
2680
+ Object.assign(tooltipStore, {
2681
+ row: null,
2682
+ column: null,
2683
+ content: null,
2684
+ visible: false,
2685
+ currOpts: null
2686
+ })
2687
+ if (tooltip) {
2688
+ tooltip.close()
2689
+ }
2690
+ }
2691
+ if (commTip) {
2692
+ commTip.close()
2693
+ }
2694
+ return this.$nextTick()
2695
+ },
2696
+ /**
2697
+ * 判断列头复选框是否被选中
2698
+ */
2699
+ isAllCheckboxChecked () {
2700
+ return this.isAllSelected
2701
+ },
2702
+ /**
2703
+ * 判断列头复选框是否被半选
2704
+ */
2705
+ isAllCheckboxIndeterminate () {
2706
+ return !this.isAllSelected && this.isIndeterminate
2707
+ },
2708
+ isCheckboxIndeterminate () {
2709
+ warnLog('vxe.error.delFunc', ['isCheckboxIndeterminate', 'isAllCheckboxIndeterminate'])
2710
+ return this.isAllCheckboxIndeterminate()
2711
+ },
2712
+ /**
2713
+ * 获取复选框半选状态的行数据
2714
+ */
2715
+ getCheckboxIndeterminateRecords (isFull) {
2716
+ const { treeConfig, treeIndeterminates, afterFullData } = this
2717
+ if (treeConfig) {
2718
+ return isFull ? treeIndeterminates.slice(0) : treeIndeterminates.filter(row => afterFullData.indexOf(row))
2719
+ }
2720
+ return []
2721
+ },
2722
+ /**
2723
+ * 处理默认勾选
2724
+ */
2725
+ handleDefaultSelectionChecked () {
2726
+ const { fullDataRowIdData, checkboxOpts } = this
2727
+ const { checkAll, checkRowKeys } = checkboxOpts
2728
+ if (checkAll) {
2729
+ this.setAllCheckboxRow(true)
2730
+ } else if (checkRowKeys) {
2731
+ const defSelection = []
2732
+ checkRowKeys.forEach(rowid => {
2733
+ if (fullDataRowIdData[rowid]) {
2734
+ defSelection.push(fullDataRowIdData[rowid].row)
2735
+ }
2736
+ })
2737
+ this.setCheckboxRow(defSelection, true)
2738
+ }
2739
+ },
2740
+ /**
2741
+ * 用于多选行,设置行为选中状态,第二个参数为选中与否
2742
+ * @param {Array/Row} rows 行数据
2743
+ * @param {Boolean} value 是否选中
2744
+ */
2745
+ setCheckboxRow (rows, value) {
2746
+ if (rows && !XEUtils.isArray(rows)) {
2747
+ rows = [rows]
2748
+ }
2749
+ rows.forEach(row => this.handleSelectRow({ row }, !!value))
2750
+ return this.$nextTick()
2751
+ },
2752
+ isCheckedByCheckboxRow (row) {
2753
+ const { checkField: property } = this.checkboxOpts
2754
+ if (property) {
2755
+ return XEUtils.get(row, property)
2756
+ }
2757
+ return this.selection.indexOf(row) > -1
2758
+ },
2759
+ isIndeterminateByCheckboxRow (row) {
2760
+ return this.treeIndeterminates.indexOf(row) > -1 && !this.isCheckedByCheckboxRow(row)
2761
+ },
2762
+ /**
2763
+ * 多选,行选中事件
2764
+ * value 选中true 不选false 半选-1
2765
+ */
2766
+ handleSelectRow ({ row }, value) {
2767
+ const { selection, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
2768
+ const { checkField: property, checkStrictly, checkMethod } = checkboxOpts
2769
+ if (property) {
2770
+ if (treeConfig && !checkStrictly) {
2771
+ if (value === -1) {
2772
+ if (treeIndeterminates.indexOf(row) === -1) {
2773
+ treeIndeterminates.push(row)
2774
+ }
2775
+ XEUtils.set(row, property, false)
2776
+ } else {
2777
+ // 更新子节点状态
2778
+ XEUtils.eachTree([row], (item) => {
2779
+ if (row === item || (!checkMethod || checkMethod({ row: item }))) {
2780
+ XEUtils.set(item, property, value)
2781
+ XEUtils.remove(treeIndeterminates, half => half === item)
2782
+ this.handleCheckboxReserveRow(row, value)
2783
+ }
2784
+ }, treeOpts)
2785
+ }
2786
+ // 如果存在父节点,更新父节点状态
2787
+ const matchObj = XEUtils.findTree(afterFullData, item => item === row, treeOpts)
2788
+ if (matchObj && matchObj.parent) {
2789
+ let parentStatus
2790
+ const vItems = checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
2791
+ const indeterminatesItem = XEUtils.find(matchObj.items, item => treeIndeterminates.indexOf(item) > -1)
2792
+ if (indeterminatesItem) {
2793
+ parentStatus = -1
2794
+ } else {
2795
+ const selectItems = matchObj.items.filter(item => XEUtils.get(item, property))
2796
+ parentStatus = selectItems.filter(item => vItems.indexOf(item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
2797
+ }
2798
+ return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
2799
+ }
2800
+ } else {
2801
+ if (!checkMethod || checkMethod({ row })) {
2802
+ XEUtils.set(row, property, value)
2803
+ this.handleCheckboxReserveRow(row, value)
2804
+ }
2805
+ }
2806
+ } else {
2807
+ if (treeConfig && !checkStrictly) {
2808
+ if (value === -1) {
2809
+ if (treeIndeterminates.indexOf(row) === -1) {
2810
+ treeIndeterminates.push(row)
2811
+ }
2812
+ XEUtils.remove(selection, item => item === row)
2813
+ } else {
2814
+ // 更新子节点状态
2815
+ XEUtils.eachTree([row], (item) => {
2816
+ if (row === item || (!checkMethod || checkMethod({ row: item }))) {
2817
+ if (value) {
2818
+ selection.push(item)
2819
+ } else {
2820
+ XEUtils.remove(selection, select => select === item)
2821
+ }
2822
+ XEUtils.remove(treeIndeterminates, half => half === item)
2823
+ this.handleCheckboxReserveRow(row, value)
2824
+ }
2825
+ }, treeOpts)
2826
+ }
2827
+ // 如果存在父节点,更新父节点状态
2828
+ const matchObj = XEUtils.findTree(afterFullData, item => item === row, treeOpts)
2829
+ if (matchObj && matchObj.parent) {
2830
+ let parentStatus
2831
+ const vItems = checkMethod ? matchObj.items.filter((item) => checkMethod({ row: item })) : matchObj.items
2832
+ const indeterminatesItem = XEUtils.find(matchObj.items, item => treeIndeterminates.indexOf(item) > -1)
2833
+ if (indeterminatesItem) {
2834
+ parentStatus = -1
2835
+ } else {
2836
+ const selectItems = matchObj.items.filter(item => selection.indexOf(item) > -1)
2837
+ parentStatus = selectItems.filter(item => vItems.indexOf(item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
2838
+ }
2839
+ return this.handleSelectRow({ row: matchObj.parent }, parentStatus)
2840
+ }
2841
+ } else {
2842
+ if (!checkMethod || checkMethod({ row })) {
2843
+ if (value) {
2844
+ if (selection.indexOf(row) === -1) {
2845
+ selection.push(row)
2846
+ }
2847
+ } else {
2848
+ XEUtils.remove(selection, item => item === row)
2849
+ }
2850
+ this.handleCheckboxReserveRow(row, value)
2851
+ }
2852
+ }
2853
+ }
2854
+ this.checkSelectionStatus()
2855
+ },
2856
+ handleToggleCheckRowEvent (evnt, params) {
2857
+ const { selection, checkboxOpts } = this
2858
+ const { checkField: property } = checkboxOpts
2859
+ const { row } = params
2860
+ const value = property ? !XEUtils.get(row, property) : selection.indexOf(row) === -1
2861
+ if (evnt) {
2862
+ this.triggerCheckRowEvent(evnt, params, value)
2863
+ } else {
2864
+ this.handleSelectRow(params, value)
2865
+ }
2866
+ },
2867
+ triggerCheckRowEvent (evnt, params, value) {
2868
+ const { checkMethod } = this.checkboxOpts
2869
+ if (!checkMethod || checkMethod({ row: params.row })) {
2870
+ this.handleSelectRow(params, value)
2871
+ this.emitEvent('checkbox-change', Object.assign({ records: this.getCheckboxRecords(), reserves: this.getCheckboxReserveRecords(), indeterminates: this.getCheckboxIndeterminateRecords(), checked: value }, params), evnt)
2872
+ }
2873
+ },
2874
+ /**
2875
+ * 多选,切换某一行的选中状态
2876
+ */
2877
+ toggleCheckboxRow (row) {
2878
+ this.handleToggleCheckRowEvent(null, { row })
2879
+ return this.$nextTick()
2880
+ },
2881
+ /**
2882
+ * 用于多选行,设置所有行的选中状态
2883
+ * @param {Boolean} value 是否选中
2884
+ */
2885
+ setAllCheckboxRow (value) {
2886
+ const { afterFullData, treeConfig, treeOpts, selection, checkboxReserveRowMap, checkboxOpts } = this
2887
+ const { checkField: property, reserve, checkStrictly, checkMethod } = checkboxOpts
2888
+ let selectRows = []
2889
+ const beforeSelection = treeConfig ? [] : selection.filter(row => afterFullData.indexOf(row) === -1)
2890
+ if (checkStrictly) {
2891
+ this.isAllSelected = value
2892
+ } else {
2893
+ /**
2894
+ * 绑定属性方式(高性能,有污染)
2895
+ * 必须在行数据存在对应的属性,否则将不响应
2896
+ */
2897
+ if (property) {
2898
+ const checkValFn = (row) => {
2899
+ if (!checkMethod || checkMethod({ row })) {
2900
+ if (value) {
2901
+ selectRows.push(row)
2902
+ }
2903
+ XEUtils.set(row, property, value)
2904
+ }
2905
+ }
2906
+ // 如果存在选中方法
2907
+ // 如果方法成立,则更新值,否则忽略该数据
2908
+ if (treeConfig) {
2909
+ XEUtils.eachTree(afterFullData, checkValFn, treeOpts)
2910
+ } else {
2911
+ afterFullData.forEach(checkValFn)
2912
+ }
2913
+ } else {
2914
+ /**
2915
+ * 默认方式(低性能,无污染)
2916
+ * 无需任何属性,直接绑定
2917
+ */
2918
+ if (treeConfig) {
2919
+ if (value) {
2920
+ /**
2921
+ * 如果是树勾选
2922
+ * 如果方法成立,则添加到临时集合中
2923
+ */
2924
+ XEUtils.eachTree(afterFullData, (row) => {
2925
+ if (!checkMethod || checkMethod({ row })) {
2926
+ selectRows.push(row)
2927
+ }
2928
+ }, treeOpts)
2929
+ } else {
2930
+ /**
2931
+ * 如果是树取消
2932
+ * 如果方法成立,则不添加到临时集合中
2933
+ */
2934
+ if (checkMethod) {
2935
+ XEUtils.eachTree(afterFullData, (row) => {
2936
+ if (checkMethod({ row }) ? 0 : selection.indexOf(row) > -1) {
2937
+ selectRows.push(row)
2938
+ }
2939
+ }, treeOpts)
2940
+ }
2941
+ }
2942
+ } else {
2943
+ if (value) {
2944
+ /**
2945
+ * 如果是行勾选
2946
+ * 如果存在选中方法且成立或者本身已勾选,则添加到临时集合中
2947
+ * 如果不存在选中方法,则添加所有数据到临时集合中
2948
+ */
2949
+ if (checkMethod) {
2950
+ selectRows = afterFullData.filter((row) => selection.indexOf(row) > -1 || checkMethod({ row }))
2951
+ } else {
2952
+ selectRows = afterFullData.slice(0)
2953
+ }
2954
+ } else {
2955
+ /**
2956
+ * 如果是行取消
2957
+ * 如果方法成立,则不添加到临时集合中;如果方法不成立则判断当前是否已勾选,如果已被勾选则添加到新集合中
2958
+ * 如果不存在选中方法,无需处理,临时集合默认为空
2959
+ */
2960
+ if (checkMethod) {
2961
+ selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : selection.indexOf(row) > -1)
2962
+ }
2963
+ }
2964
+ }
2965
+ }
2966
+ if (reserve) {
2967
+ if (value) {
2968
+ selectRows.forEach(row => {
2969
+ checkboxReserveRowMap[getRowid(this, row)] = row
2970
+ })
2971
+ } else {
2972
+ afterFullData.forEach(row => this.handleCheckboxReserveRow(row, false))
2973
+ }
2974
+ }
2975
+ this.selection = property ? [] : beforeSelection.concat(selectRows)
2976
+ }
2977
+ this.treeIndeterminates = []
2978
+ this.checkSelectionStatus()
2979
+ },
2980
+ checkSelectionStatus () {
2981
+ const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
2982
+ const { checkField, halfField, checkStrictly, checkMethod } = checkboxOpts
2983
+ if (!checkStrictly) {
2984
+ const disableRows = []
2985
+ const checkRows = []
2986
+ let isAllResolve = false
2987
+ let isAllSelected = false
2988
+ let isIndeterminate = false
2989
+ if (checkField) {
2990
+ isAllResolve = afterFullData.every(
2991
+ checkMethod
2992
+ ? (row) => {
2993
+ if (!checkMethod({ row })) {
2994
+ disableRows.push(row)
2995
+ return true
2996
+ }
2997
+ if (XEUtils.get(row, checkField)) {
2998
+ checkRows.push(row)
2999
+ return true
3000
+ }
3001
+ return false
3002
+ }
3003
+ : row => XEUtils.get(row, checkField)
3004
+ )
3005
+ isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
3006
+ if (treeConfig) {
3007
+ if (halfField) {
3008
+ isIndeterminate = !isAllSelected && afterFullData.some(row => XEUtils.get(row, checkField) || XEUtils.get(row, halfField) || treeIndeterminates.indexOf(row) > -1)
3009
+ } else {
3010
+ isIndeterminate = !isAllSelected && afterFullData.some(row => XEUtils.get(row, checkField) || treeIndeterminates.indexOf(row) > -1)
3011
+ }
3012
+ } else {
3013
+ if (halfField) {
3014
+ isIndeterminate = !isAllSelected && afterFullData.some(row => XEUtils.get(row, checkField) || XEUtils.get(row, halfField))
3015
+ } else {
3016
+ isIndeterminate = !isAllSelected && afterFullData.some(row => XEUtils.get(row, checkField))
3017
+ }
3018
+ }
3019
+ } else {
3020
+ isAllResolve = afterFullData.every(
3021
+ checkMethod
3022
+ ? (row) => {
3023
+ if (!checkMethod({ row })) {
3024
+ disableRows.push(row)
3025
+ return true
3026
+ }
3027
+ if (selection.indexOf(row) > -1) {
3028
+ checkRows.push(row)
3029
+ return true
3030
+ }
3031
+ return false
3032
+ }
3033
+ : row => selection.indexOf(row) > -1
3034
+ )
3035
+ isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
3036
+ if (treeConfig) {
3037
+ isIndeterminate = !isAllSelected && afterFullData.some(row => treeIndeterminates.indexOf(row) > -1 || selection.indexOf(row) > -1)
3038
+ } else {
3039
+ isIndeterminate = !isAllSelected && afterFullData.some(row => selection.indexOf(row) > -1)
3040
+ }
3041
+ }
3042
+ this.isAllSelected = isAllSelected
3043
+ this.isIndeterminate = isIndeterminate
3044
+ }
3045
+ },
3046
+ // 还原展开、选中等相关状态
3047
+ handleReserveStatus () {
3048
+ const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRow, radioReserveRow, radioOpts, checkboxOpts, selection, rowExpandeds, treeExpandeds, expandOpts } = this
3049
+ // 单选框
3050
+ if (selectRow && !fullAllDataRowMap.has(selectRow)) {
3051
+ this.selectRow = null // 刷新单选行状态
3052
+ }
3053
+ // 还原保留选中状态
3054
+ if (radioOpts.reserve && radioReserveRow) {
3055
+ const rowid = getRowid(this, radioReserveRow)
3056
+ if (fullDataRowIdData[rowid]) {
3057
+ this.setRadioRow(fullDataRowIdData[rowid].row)
3058
+ }
3059
+ }
3060
+ // 复选框
3061
+ this.selection = getRecoverRow(this, selection) // 刷新多选行状态
3062
+ // 还原保留选中状态
3063
+ if (checkboxOpts.reserve) {
3064
+ this.setCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true)
3065
+ }
3066
+ if (currentRow && !fullAllDataRowMap.has(currentRow)) {
3067
+ this.currentRow = null // 刷新当前行状态
3068
+ }
3069
+ // 行展开
3070
+ this.rowExpandeds = expandColumn ? getRecoverRow(this, rowExpandeds) : [] // 刷新行展开状态
3071
+ // 还原保留状态
3072
+ if (expandColumn && expandOpts.reserve) {
3073
+ this.setRowExpand(handleReserveRow(this, this.rowExpandedReserveRowMap), true)
3074
+ }
3075
+ // 树展开
3076
+ this.treeExpandeds = treeConfig ? getRecoverRow(this, treeExpandeds) : [] // 刷新树展开状态
3077
+ if (treeConfig && treeOpts.reserve) {
3078
+ this.setTreeExpand(handleReserveRow(this, this.treeExpandedReserveRowMap), true)
3079
+ }
3080
+ },
3081
+ /**
3082
+ * 获取单选框保留选中的行
3083
+ */
3084
+ getRadioReserveRecord (isFull) {
3085
+ const { fullDataRowIdData, radioReserveRow, radioOpts, afterFullData, treeConfig, treeOpts } = this
3086
+ if (radioOpts.reserve && radioReserveRow) {
3087
+ const rowid = getRowid(this, radioReserveRow)
3088
+ if (isFull) {
3089
+ if (!fullDataRowIdData[rowid]) {
3090
+ return radioReserveRow
3091
+ }
3092
+ } else {
3093
+ const rowkey = getRowkey(this)
3094
+ if (treeConfig) {
3095
+ const matchObj = XEUtils.findTree(afterFullData, row => rowid === XEUtils.get(row, rowkey), treeOpts)
3096
+ if (matchObj) {
3097
+ return radioReserveRow
3098
+ }
3099
+ } else {
3100
+ if (!afterFullData.some(row => rowid === XEUtils.get(row, rowkey))) {
3101
+ return radioReserveRow
3102
+ }
3103
+ }
3104
+ }
3105
+ }
3106
+ return null
3107
+ },
3108
+ clearRadioReserve () {
3109
+ this.radioReserveRow = null
3110
+ return this.$nextTick()
3111
+ },
3112
+ handleRadioReserveRow (row) {
3113
+ const { radioOpts } = this
3114
+ if (radioOpts.reserve) {
3115
+ this.radioReserveRow = row
3116
+ }
3117
+ },
3118
+ /**
3119
+ * 获取复选框保留选中的行
3120
+ */
3121
+ getCheckboxReserveRecords (isFull) {
3122
+ const { fullDataRowIdData, afterFullData, checkboxReserveRowMap, checkboxOpts, treeConfig, treeOpts } = this
3123
+ const reserveSelection = []
3124
+ if (checkboxOpts.reserve) {
3125
+ const afterFullIdMaps = {}
3126
+ if (treeConfig) {
3127
+ XEUtils.eachTree(afterFullData, row => {
3128
+ afterFullIdMaps[getRowid(this, row)] = 1
3129
+ }, treeOpts)
3130
+ } else {
3131
+ afterFullData.forEach(row => {
3132
+ afterFullIdMaps[getRowid(this, row)] = 1
3133
+ })
3134
+ }
3135
+ XEUtils.each(checkboxReserveRowMap, (oldRow, oldRowid) => {
3136
+ if (oldRow) {
3137
+ if (isFull) {
3138
+ if (!fullDataRowIdData[oldRowid]) {
3139
+ reserveSelection.push(oldRow)
3140
+ }
3141
+ } else {
3142
+ if (!afterFullIdMaps[oldRowid]) {
3143
+ reserveSelection.push(oldRow)
3144
+ }
3145
+ }
3146
+ }
3147
+ })
3148
+ }
3149
+ return reserveSelection
3150
+ },
3151
+ clearCheckboxReserve () {
3152
+ this.checkboxReserveRowMap = {}
3153
+ return this.$nextTick()
3154
+ },
3155
+ handleCheckboxReserveRow (row, checked) {
3156
+ const { checkboxReserveRowMap, checkboxOpts } = this
3157
+ if (checkboxOpts.reserve) {
3158
+ const rowid = getRowid(this, row)
3159
+ if (checked) {
3160
+ checkboxReserveRowMap[rowid] = row
3161
+ } else if (checkboxReserveRowMap[rowid]) {
3162
+ delete checkboxReserveRowMap[rowid]
3163
+ }
3164
+ }
3165
+ },
3166
+ /**
3167
+ * 多选,选中所有事件
3168
+ */
3169
+ triggerCheckAllEvent (evnt, value) {
3170
+ this.setAllCheckboxRow(value)
3171
+ this.emitEvent('checkbox-all', { records: this.getCheckboxRecords(), reserves: this.getCheckboxReserveRecords(), indeterminates: this.getCheckboxIndeterminateRecords(), checked: value }, evnt)
3172
+ },
3173
+ /**
3174
+ * 多选,切换所有行的选中状态
3175
+ */
3176
+ toggleAllCheckboxRow () {
3177
+ this.triggerCheckAllEvent(null, !this.isAllSelected)
3178
+ return this.$nextTick()
3179
+ },
3180
+ /**
3181
+ * 用于多选行,手动清空用户的选择
3182
+ * 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
3183
+ */
3184
+ clearCheckboxRow () {
3185
+ const { tableFullData, treeConfig, treeOpts, checkboxOpts } = this
3186
+ const { checkField: property, reserve } = checkboxOpts
3187
+ if (property) {
3188
+ if (treeConfig) {
3189
+ XEUtils.eachTree(tableFullData, item => XEUtils.set(item, property, false), treeOpts)
3190
+ } else {
3191
+ tableFullData.forEach(item => XEUtils.set(item, property, false))
3192
+ }
3193
+ }
3194
+ if (reserve) {
3195
+ tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false))
3196
+ }
3197
+ this.isAllSelected = false
3198
+ this.isIndeterminate = false
3199
+ this.selection = []
3200
+ this.treeIndeterminates = []
3201
+ return this.$nextTick()
3202
+ },
3203
+ /**
3204
+ * 处理单选框默认勾选
3205
+ */
3206
+ handleDefaultRadioChecked () {
3207
+ const { radioOpts, fullDataRowIdData } = this
3208
+ const { checkRowKey: rowid, reserve } = radioOpts
3209
+ if (rowid) {
3210
+ if (fullDataRowIdData[rowid]) {
3211
+ this.setRadioRow(fullDataRowIdData[rowid].row)
3212
+ }
3213
+ if (reserve) {
3214
+ const rowkey = getRowkey(this)
3215
+ this.radioReserveRow = { [rowkey]: rowid }
3216
+ }
3217
+ }
3218
+ },
3219
+ /**
3220
+ * 单选,行选中事件
3221
+ */
3222
+ triggerRadioRowEvent (evnt, params) {
3223
+ const { selectRow: oldValue, radioOpts } = this
3224
+ const { row } = params
3225
+ let newValue = row
3226
+ let isChange = oldValue !== newValue
3227
+ if (isChange) {
3228
+ this.setRadioRow(newValue)
3229
+ } else if (!radioOpts.strict) {
3230
+ isChange = oldValue === newValue
3231
+ if (isChange) {
3232
+ newValue = null
3233
+ this.clearRadioRow()
3234
+ }
3235
+ }
3236
+ if (isChange) {
3237
+ this.emitEvent('radio-change', { oldValue, newValue, ...params }, evnt)
3238
+ }
3239
+ },
3240
+ triggerCurrentRowEvent (evnt, params) {
3241
+ const { currentRow: oldValue } = this
3242
+ const { row: newValue } = params
3243
+ const isChange = oldValue !== newValue
3244
+ this.setCurrentRow(newValue)
3245
+ if (isChange) {
3246
+ this.emitEvent('current-change', { oldValue, newValue, ...params }, evnt)
3247
+ }
3248
+ },
3249
+ /**
3250
+ * 用于当前行,设置某一行为高亮状态
3251
+ * @param {Row} row 行对象
3252
+ */
3253
+ setCurrentRow (row) {
3254
+ const { $el, rowOpts } = this
3255
+ this.clearCurrentRow()
3256
+ this.clearCurrentColumn()
3257
+ this.currentRow = row
3258
+ if (rowOpts.isCurrent || this.highlightCurrentRow) {
3259
+ if ($el) {
3260
+ XEUtils.arrayEach($el.querySelectorAll(`[rowid="${getRowid(this, row)}"]`), elem => addClass(elem, 'row--current'))
3261
+ }
3262
+ }
3263
+ return this.$nextTick()
3264
+ },
3265
+ isCheckedByRadioRow (row) {
3266
+ return this.selectRow === row
3267
+ },
3268
+ /**
3269
+ * 用于单选行,设置某一行为选中状态
3270
+ * @param {Row} row 行对象
3271
+ */
3272
+ setRadioRow (row) {
3273
+ const { radioOpts } = this
3274
+ const { checkMethod } = radioOpts
3275
+ if (row && (!checkMethod || checkMethod({ row }))) {
3276
+ this.selectRow = row
3277
+ this.handleRadioReserveRow(row)
3278
+ }
3279
+ return this.$nextTick()
3280
+ },
3281
+ /**
3282
+ * 用于当前行,手动清空当前高亮的状态
3283
+ */
3284
+ clearCurrentRow () {
3285
+ const { $el } = this
3286
+ this.currentRow = null
3287
+ this.hoverRow = null
3288
+ if ($el) {
3289
+ XEUtils.arrayEach($el.querySelectorAll('.row--current'), elem => removeClass(elem, 'row--current'))
3290
+ }
3291
+ return this.$nextTick()
3292
+ },
3293
+ /**
3294
+ * 用于单选行,手动清空用户的选择
3295
+ */
3296
+ clearRadioRow () {
3297
+ this.selectRow = null
3298
+ return this.$nextTick()
3299
+ },
3300
+ /**
3301
+ * 用于当前行,获取当前行的数据
3302
+ */
3303
+ getCurrentRecord () {
3304
+ return this.rowOpts.isCurrent || this.highlightCurrentRow ? this.currentRow : null
3305
+ },
3306
+ /**
3307
+ * 用于单选行,获取当已选中的数据
3308
+ */
3309
+ getRadioRecord (isFull) {
3310
+ const { treeConfig, treeOpts, selectRow, fullDataRowIdData, afterFullData } = this
3311
+ if (selectRow) {
3312
+ const rowid = getRowid(this, selectRow)
3313
+ if (isFull) {
3314
+ if (!fullDataRowIdData[rowid]) {
3315
+ return selectRow
3316
+ }
3317
+ } else {
3318
+ if (treeConfig) {
3319
+ const rowkey = getRowkey(this)
3320
+ const matchObj = XEUtils.findTree(afterFullData, row => rowid === XEUtils.get(row, rowkey), treeOpts)
3321
+ if (matchObj) {
3322
+ return selectRow
3323
+ }
3324
+ } else {
3325
+ if (afterFullData.indexOf(selectRow) > -1) {
3326
+ return selectRow
3327
+ }
3328
+ }
3329
+ }
3330
+ }
3331
+ return null
3332
+ },
3333
+ /**
3334
+ * 行 hover 事件
3335
+ */
3336
+ triggerHoverEvent (evnt, { row }) {
3337
+ this.setHoverRow(row)
3338
+ },
3339
+ setHoverRow (row) {
3340
+ const { $el } = this
3341
+ const rowid = getRowid(this, row)
3342
+ this.clearHoverRow()
3343
+ if ($el) {
3344
+ XEUtils.arrayEach($el.querySelectorAll(`[rowid="${rowid}"]`), elem => addClass(elem, 'row--hover'))
3345
+ }
3346
+ this.hoverRow = row
3347
+ },
3348
+ clearHoverRow () {
3349
+ const { $el } = this
3350
+ if ($el) {
3351
+ XEUtils.arrayEach($el.querySelectorAll('.vxe-body--row.row--hover'), elem => removeClass(elem, 'row--hover'))
3352
+ }
3353
+ this.hoverRow = null
3354
+ },
3355
+ triggerHeaderCellClickEvent (evnt, params) {
3356
+ const { _lastResizeTime, sortOpts } = this
3357
+ const { column } = params
3358
+ const cell = evnt.currentTarget
3359
+ const triggerResizable = _lastResizeTime && _lastResizeTime > Date.now() - 300
3360
+ const triggerSort = getEventTargetNode(evnt, cell, 'vxe-cell--sort').flag
3361
+ const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag
3362
+ if (sortOpts.trigger === 'cell' && !(triggerResizable || triggerSort || triggerFilter)) {
3363
+ this.triggerSortEvent(evnt, column, getNextSortOrder(this, column))
3364
+ }
3365
+ this.emitEvent('header-cell-click', Object.assign({ triggerResizable, triggerSort, triggerFilter, cell }, params), evnt)
3366
+ if (this.columnOpts.isCurrent || this.highlightCurrentColumn) {
3367
+ return this.setCurrentColumn(column)
3368
+ }
3369
+ return this.$nextTick()
3370
+ },
3371
+ triggerHeaderCellDblclickEvent (evnt, params) {
3372
+ this.emitEvent('header-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, params), evnt)
3373
+ },
3374
+ getCurrentColumn () {
3375
+ return this.columnOpts.isCurrent || this.highlightCurrentColumn ? this.currentColumn : null
3376
+ },
3377
+ /**
3378
+ * 用于当前列,设置某列行为高亮状态
3379
+ * @param {ColumnInfo} fieldOrColumn 列配置
3380
+ */
3381
+ setCurrentColumn (fieldOrColumn) {
3382
+ const column = handleFieldOrColumn(this, fieldOrColumn)
3383
+ if (column) {
3384
+ this.clearCurrentRow()
3385
+ this.clearCurrentColumn()
3386
+ this.currentColumn = column
3387
+ }
3388
+ return this.$nextTick()
3389
+ },
3390
+ /**
3391
+ * 用于当前列,手动清空当前高亮的状态
3392
+ */
3393
+ clearCurrentColumn () {
3394
+ this.currentColumn = null
3395
+ return this.$nextTick()
3396
+ },
3397
+ checkValidate (type) {
3398
+ if (VXETable._valid) {
3399
+ return this.triggerValidate(type)
3400
+ }
3401
+ return this.$nextTick()
3402
+ },
3403
+ /**
3404
+ * 当单元格发生改变时
3405
+ * 如果存在规则,则校验
3406
+ */
3407
+ handleChangeCell (evnt, params) {
3408
+ this.checkValidate('blur')
3409
+ .catch(e => e)
3410
+ .then(() => {
3411
+ this.handleActived(params, evnt)
3412
+ .then(() => this.checkValidate('change'))
3413
+ .catch(e => e)
3414
+ })
3415
+ },
3416
+ /**
3417
+ * 列点击事件
3418
+ * 如果是单击模式,则激活为编辑状态
3419
+ * 如果是双击模式,则单击后选中状态
3420
+ */
3421
+ triggerCellClickEvent (evnt, params) {
3422
+ const { highlightCurrentRow, editStore, radioOpts, expandOpts, treeOpts, editConfig, editOpts, checkboxOpts, rowOpts } = this
3423
+ const { actived } = editStore
3424
+ const { row, column } = params
3425
+ const { type, treeNode } = column
3426
+ const isRadioType = type === 'radio'
3427
+ const isCheckboxType = type === 'checkbox'
3428
+ const isExpandType = type === 'expand'
3429
+ const cell = evnt.currentTarget
3430
+ const triggerRadio = isRadioType && getEventTargetNode(evnt, cell, 'vxe-cell--radio').flag
3431
+ const triggerCheckbox = isCheckboxType && getEventTargetNode(evnt, cell, 'vxe-cell--checkbox').flag
3432
+ const triggerTreeNode = treeNode && getEventTargetNode(evnt, cell, 'vxe-tree--btn-wrapper').flag
3433
+ const triggerExpandNode = isExpandType && getEventTargetNode(evnt, cell, 'vxe-table--expanded').flag
3434
+ params = Object.assign({ cell, triggerRadio, triggerCheckbox, triggerTreeNode, triggerExpandNode }, params)
3435
+ if (!triggerCheckbox && !triggerRadio) {
3436
+ // 如果是展开行
3437
+ if (!triggerExpandNode && (expandOpts.trigger === 'row' || (isExpandType && expandOpts.trigger === 'cell'))) {
3438
+ this.triggerRowExpandEvent(evnt, params)
3439
+ }
3440
+ // 如果是树形表格
3441
+ if ((treeOpts.trigger === 'row' || (treeNode && treeOpts.trigger === 'cell'))) {
3442
+ this.triggerTreeExpandEvent(evnt, params)
3443
+ }
3444
+ }
3445
+ // 如果点击了树节点
3446
+ if (!triggerTreeNode) {
3447
+ if (!triggerExpandNode) {
3448
+ // 如果是高亮行
3449
+ if (rowOpts.isCurrent || highlightCurrentRow) {
3450
+ if (!triggerCheckbox && !triggerRadio) {
3451
+ this.triggerCurrentRowEvent(evnt, params)
3452
+ }
3453
+ }
3454
+ // 如果是单选框
3455
+ if (!triggerRadio && (radioOpts.trigger === 'row' || (isRadioType && radioOpts.trigger === 'cell'))) {
3456
+ this.triggerRadioRowEvent(evnt, params)
3457
+ }
3458
+ // 如果是复选框
3459
+ if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || (isCheckboxType && checkboxOpts.trigger === 'cell'))) {
3460
+ this.handleToggleCheckRowEvent(evnt, params)
3461
+ }
3462
+ }
3463
+ // 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
3464
+ if (isEnableConf(editConfig)) {
3465
+ if (editOpts.trigger === 'manual') {
3466
+ if (actived.args && actived.row === row && column !== actived.column) {
3467
+ this.handleChangeCell(evnt, params)
3468
+ }
3469
+ } else if (!actived.args || row !== actived.row || column !== actived.column) {
3470
+ if (editOpts.trigger === 'click') {
3471
+ this.handleChangeCell(evnt, params)
3472
+ } else if (editOpts.trigger === 'dblclick') {
3473
+ if (editOpts.mode === 'row' && actived.row === row) {
3474
+ this.handleChangeCell(evnt, params)
3475
+ }
3476
+ }
3477
+ }
3478
+ }
3479
+ }
3480
+ this.emitEvent('cell-click', params, evnt)
3481
+ },
3482
+ /**
3483
+ * 列双击点击事件
3484
+ * 如果是双击模式,则激活为编辑状态
3485
+ */
3486
+ triggerCellDblclickEvent (evnt, params) {
3487
+ const { editStore, editConfig, editOpts } = this
3488
+ const { actived } = editStore
3489
+ const cell = evnt.currentTarget
3490
+ params.cell = cell
3491
+ if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
3492
+ if (!actived.args || evnt.currentTarget !== actived.args.cell) {
3493
+ if (editOpts.mode === 'row') {
3494
+ this.checkValidate('blur')
3495
+ .catch(e => e)
3496
+ .then(() => {
3497
+ this.handleActived(params, evnt)
3498
+ .then(() => this.checkValidate('change'))
3499
+ .catch(e => e)
3500
+ })
3501
+ } else if (editOpts.mode === 'cell') {
3502
+ this.handleActived(params, evnt)
3503
+ .then(() => this.checkValidate('change'))
3504
+ .catch(e => e)
3505
+ }
3506
+ }
3507
+ }
3508
+ this.emitEvent('cell-dblclick', params, evnt)
3509
+ },
3510
+ handleDefaultSort () {
3511
+ const { sortConfig, sortOpts } = this
3512
+ let { defaultSort } = sortOpts
3513
+ if (defaultSort) {
3514
+ if (!XEUtils.isArray(defaultSort)) {
3515
+ defaultSort = [defaultSort]
3516
+ }
3517
+ if (defaultSort.length) {
3518
+ (sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
3519
+ const { field, order } = item
3520
+ if (field && order) {
3521
+ const column = this.getColumnByField(field)
3522
+ if (column && column.sortable) {
3523
+ column.order = order
3524
+ column.sortTime = Date.now() + index
3525
+ }
3526
+ }
3527
+ })
3528
+ if (!sortOpts.remote) {
3529
+ this.handleTableData(true).then(this.updateStyle)
3530
+ }
3531
+ }
3532
+ }
3533
+ },
3534
+ /**
3535
+ * 点击排序事件
3536
+ */
3537
+ triggerSortEvent (evnt, column, order) {
3538
+ const { sortOpts } = this
3539
+ const property = column.property
3540
+ if (column.sortable || column.remoteSort) {
3541
+ if (!order || column.order === order) {
3542
+ this.clearSort(sortOpts.multiple ? column : null)
3543
+ } else {
3544
+ this.sort({ field: property, order })
3545
+ }
3546
+ const params = { column, property, order: column.order, sortList: this.getSortColumns() }
3547
+ this.emitEvent('sort-change', params, evnt)
3548
+ }
3549
+ },
3550
+ sort (sortConfs, sortOrder) {
3551
+ const { sortOpts } = this
3552
+ const { multiple, remote, orders } = sortOpts
3553
+ if (sortConfs) {
3554
+ if (XEUtils.isString(sortConfs)) {
3555
+ sortConfs = [
3556
+ { field: sortConfs, order: sortOrder }
3557
+ ]
3558
+ }
3559
+ }
3560
+ if (!XEUtils.isArray(sortConfs)) {
3561
+ sortConfs = [sortConfs]
3562
+ }
3563
+ if (sortConfs.length) {
3564
+ let firstSortColumn
3565
+ if (!multiple) {
3566
+ clearAllSort(this)
3567
+ }
3568
+ (multiple ? sortConfs : [sortConfs[0]]).forEach((confs, index) => {
3569
+ let { field, order } = confs
3570
+ let column = field
3571
+ if (XEUtils.isString(field)) {
3572
+ column = this.getColumnByField(field)
3573
+ }
3574
+ if (column && (column.sortable || column.remoteSort)) {
3575
+ if (!firstSortColumn) {
3576
+ firstSortColumn = column
3577
+ }
3578
+ if (orders.indexOf(order) === -1) {
3579
+ order = getNextSortOrder(this, column)
3580
+ }
3581
+ if (column.order !== order) {
3582
+ column.order = order
3583
+ }
3584
+ column.sortTime = Date.now() + index
3585
+ }
3586
+ })
3587
+ // 如果是服务端排序,则跳过本地排序处理
3588
+ if (!remote || (firstSortColumn && firstSortColumn.remoteSort)) {
3589
+ this.handleTableData(true)
3590
+ }
3591
+ return this.$nextTick().then(this.updateStyle)
3592
+ }
3593
+ return this.$nextTick()
3594
+ },
3595
+ /**
3596
+ * 清空指定列的排序条件
3597
+ * 如果为空则清空所有列的排序条件
3598
+ * @param {String} column 列或字段名
3599
+ */
3600
+ clearSort (fieldOrColumn) {
3601
+ const { sortOpts } = this
3602
+ if (fieldOrColumn) {
3603
+ const column = handleFieldOrColumn(this, fieldOrColumn)
3604
+ if (column) {
3605
+ column.order = null
3606
+ }
3607
+ } else {
3608
+ clearAllSort(this)
3609
+ }
3610
+ if (!sortOpts.remote) {
3611
+ this.handleTableData(true)
3612
+ }
3613
+ return this.$nextTick().then(this.updateStyle)
3614
+ },
3615
+ // 在 v3 中废弃
3616
+ getSortColumn () {
3617
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
3618
+ warnLog('vxe.error.delFunc', ['getSortColumn', 'getSortColumns'])
3619
+ }
3620
+ return XEUtils.find(this.tableFullColumn, column => (column.sortable || column.remoteSort) && column.order)
3621
+ },
3622
+ isSort (fieldOrColumn) {
3623
+ if (fieldOrColumn) {
3624
+ const column = handleFieldOrColumn(this, fieldOrColumn)
3625
+ return column && column.sortable && !!column.order
3626
+ }
3627
+ return this.getSortColumns().length > 0
3628
+ },
3629
+ getSortColumns () {
3630
+ const { multiple, chronological } = this.sortOpts
3631
+ const sortList = []
3632
+ this.tableFullColumn.forEach((column) => {
3633
+ const { property, order } = column
3634
+ if ((column.sortable || column.remoteSort) && order) {
3635
+ sortList.push({ column, field: column.property, property, order, sortTime: column.sortTime })
3636
+ }
3637
+ })
3638
+ if (multiple && chronological && sortList.length > 1) {
3639
+ return XEUtils.orderBy(sortList, 'sortTime')
3640
+ }
3641
+ return sortList
3642
+ },
3643
+ /**
3644
+ * 关闭筛选
3645
+ * @param {Event} evnt 事件
3646
+ */
3647
+ closeFilter () {
3648
+ const { filterStore } = this
3649
+ const { column, visible } = filterStore
3650
+ Object.assign(filterStore, {
3651
+ isAllSelected: false,
3652
+ isIndeterminate: false,
3653
+ options: [],
3654
+ visible: false
3655
+ })
3656
+ if (visible) {
3657
+ this.emitEvent('filter-visible', { column, property: column.property, filterList: this.getCheckedFilters(), visible: false }, null)
3658
+ }
3659
+ return this.$nextTick()
3660
+ },
3661
+ /**
3662
+ * 判断指定列是否为筛选状态,如果为空则判断所有列
3663
+ * @param {String} fieldOrColumn 字段名
3664
+ */
3665
+ isFilter (fieldOrColumn) {
3666
+ const column = handleFieldOrColumn(this, fieldOrColumn)
3667
+ if (column) {
3668
+ return column.filters && column.filters.some(option => option.checked)
3669
+ }
3670
+ return this.getCheckedFilters().length > 0
3671
+ },
3672
+ /**
3673
+ * 判断展开行是否懒加载完成
3674
+ * @param {Row} row 行对象
3675
+ */
3676
+ isRowExpandLoaded (row) {
3677
+ const rest = this.fullAllDataRowMap.get(row)
3678
+ return rest && rest.expandLoaded
3679
+ },
3680
+ clearRowExpandLoaded (row) {
3681
+ const { expandOpts, expandLazyLoadeds, fullAllDataRowMap } = this
3682
+ const { lazy } = expandOpts
3683
+ const rest = fullAllDataRowMap.get(row)
3684
+ if (lazy && rest) {
3685
+ rest.expandLoaded = false
3686
+ XEUtils.remove(expandLazyLoadeds, item => row === item)
3687
+ }
3688
+ return this.$nextTick()
3689
+ },
3690
+ /**
3691
+ * 重新懒加载展开行,并展开内容
3692
+ * @param {Row} row 行对象
3693
+ */
3694
+ reloadRowExpand (row) {
3695
+ const { expandOpts, expandLazyLoadeds } = this
3696
+ const { lazy } = expandOpts
3697
+ if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
3698
+ this.clearRowExpandLoaded(row)
3699
+ .then(() => this.handleAsyncRowExpand(row))
3700
+ }
3701
+ return this.$nextTick()
3702
+ },
3703
+ reloadExpandContent (row) {
3704
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
3705
+ warnLog('vxe.error.delFunc', ['reloadExpandContent', 'reloadRowExpand'])
3706
+ }
3707
+ // 即将废弃
3708
+ return this.reloadRowExpand(row)
3709
+ },
3710
+ /**
3711
+ * 展开行事件
3712
+ */
3713
+ triggerRowExpandEvent (evnt, params) {
3714
+ const { expandOpts, expandLazyLoadeds, expandColumn: column } = this
3715
+ const { row } = params
3716
+ const { lazy } = expandOpts
3717
+ if (!lazy || expandLazyLoadeds.indexOf(row) === -1) {
3718
+ const expanded = !this.isExpandByRow(row)
3719
+ const columnIndex = this.getColumnIndex(column)
3720
+ const $columnIndex = this.getVMColumnIndex(column)
3721
+ this.setRowExpand(row, expanded)
3722
+ this.emitEvent('toggle-row-expand', { expanded, column, columnIndex, $columnIndex, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }, evnt)
3723
+ }
3724
+ },
3725
+ /**
3726
+ * 切换展开行
3727
+ */
3728
+ toggleRowExpand (row) {
3729
+ return this.setRowExpand(row, !this.isExpandByRow(row))
3730
+ },
3731
+ /**
3732
+ * 处理默认展开行
3733
+ */
3734
+ handleDefaultRowExpand () {
3735
+ const { expandOpts, fullDataRowIdData } = this
3736
+ const { expandAll, expandRowKeys } = expandOpts
3737
+ if (expandAll) {
3738
+ this.setAllRowExpand(true)
3739
+ } else if (expandRowKeys) {
3740
+ const defExpandeds = []
3741
+ expandRowKeys.forEach(rowid => {
3742
+ if (fullDataRowIdData[rowid]) {
3743
+ defExpandeds.push(fullDataRowIdData[rowid].row)
3744
+ }
3745
+ })
3746
+ this.setRowExpand(defExpandeds, true)
3747
+ }
3748
+ },
3749
+ /**
3750
+ * 设置所有行的展开与否
3751
+ * @param {Boolean} expanded 是否展开
3752
+ */
3753
+ setAllRowExpand (expanded) {
3754
+ return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded)
3755
+ },
3756
+ handleAsyncRowExpand (row) {
3757
+ const rest = this.fullAllDataRowMap.get(row)
3758
+ return new Promise(resolve => {
3759
+ this.expandLazyLoadeds.push(row)
3760
+ this.expandOpts.loadMethod({ $table: this, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) }).catch(e => e).then(() => {
3761
+ rest.expandLoaded = true
3762
+ XEUtils.remove(this.expandLazyLoadeds, item => item === row)
3763
+ this.rowExpandeds.push(row)
3764
+ resolve(this.$nextTick().then(this.recalculate))
3765
+ })
3766
+ })
3767
+ },
3768
+ /**
3769
+ * 设置展开行,二个参数设置这一行展开与否
3770
+ * 支持单行
3771
+ * 支持多行
3772
+ * @param {Array/Row} rows 行数据
3773
+ * @param {Boolean} expanded 是否展开
3774
+ */
3775
+ setRowExpand (rows, expanded) {
3776
+ const { fullAllDataRowMap, expandLazyLoadeds, expandOpts, expandColumn: column } = this
3777
+ let { rowExpandeds } = this
3778
+ const { reserve, lazy, accordion, toggleMethod } = expandOpts
3779
+ const lazyRests = []
3780
+ const columnIndex = this.getColumnIndex(column)
3781
+ const $columnIndex = this.getVMColumnIndex(column)
3782
+ if (rows) {
3783
+ if (!XEUtils.isArray(rows)) {
3784
+ rows = [rows]
3785
+ }
3786
+ if (accordion) {
3787
+ // 只能同时展开一个
3788
+ rowExpandeds = []
3789
+ rows = rows.slice(rows.length - 1, rows.length)
3790
+ }
3791
+ const validRows = toggleMethod ? rows.filter(row => toggleMethod({ expanded, column, columnIndex, $columnIndex, row, rowIndex: this.getRowIndex(row), $rowIndex: this.getVMRowIndex(row) })) : rows
3792
+ if (expanded) {
3793
+ validRows.forEach(row => {
3794
+ if (rowExpandeds.indexOf(row) === -1) {
3795
+ const rest = fullAllDataRowMap.get(row)
3796
+ const isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1
3797
+ if (isLoad) {
3798
+ lazyRests.push(this.handleAsyncRowExpand(row))
3799
+ } else {
3800
+ rowExpandeds.push(row)
3801
+ }
3802
+ }
3803
+ })
3804
+ } else {
3805
+ XEUtils.remove(rowExpandeds, row => validRows.indexOf(row) > -1)
3806
+ }
3807
+ if (reserve) {
3808
+ validRows.forEach(row => this.handleRowExpandReserve(row, expanded))
3809
+ }
3810
+ }
3811
+ this.rowExpandeds = rowExpandeds
3812
+ return Promise.all(lazyRests).then(this.recalculate)
3813
+ },
3814
+ /**
3815
+ * 判断行是否为展开状态
3816
+ * @param {Row} row 行对象
3817
+ */
3818
+ isExpandByRow (row) {
3819
+ return this.rowExpandeds.indexOf(row) > -1
3820
+ },
3821
+ /**
3822
+ * 手动清空展开行状态,数据会恢复成未展开的状态
3823
+ */
3824
+ clearRowExpand () {
3825
+ const { expandOpts, rowExpandeds, tableFullData } = this
3826
+ const { reserve } = expandOpts
3827
+ const isExists = rowExpandeds.length
3828
+ this.rowExpandeds = []
3829
+ if (reserve) {
3830
+ tableFullData.forEach(row => this.handleRowExpandReserve(row, false))
3831
+ }
3832
+ return this.$nextTick().then(() => {
3833
+ if (isExists) {
3834
+ this.recalculate()
3835
+ }
3836
+ })
3837
+ },
3838
+ clearRowExpandReserve () {
3839
+ this.rowExpandedReserveRowMap = {}
3840
+ return this.$nextTick()
3841
+ },
3842
+ handleRowExpandReserve (row, expanded) {
3843
+ const { rowExpandedReserveRowMap, expandOpts } = this
3844
+ if (expandOpts.reserve) {
3845
+ const rowid = getRowid(this, row)
3846
+ if (expanded) {
3847
+ rowExpandedReserveRowMap[rowid] = row
3848
+ } else if (rowExpandedReserveRowMap[rowid]) {
3849
+ delete rowExpandedReserveRowMap[rowid]
3850
+ }
3851
+ }
3852
+ },
3853
+ getRowExpandRecords () {
3854
+ return this.rowExpandeds.slice(0)
3855
+ },
3856
+ getTreeExpandRecords () {
3857
+ return this.treeExpandeds.slice(0)
3858
+ },
3859
+ /**
3860
+ * 获取数表格状态
3861
+ */
3862
+ getTreeStatus () {
3863
+ if (this.treeConfig) {
3864
+ return {
3865
+ config: this.treeOpts,
3866
+ rowExpandeds: this.getTreeExpandRecords()
3867
+ }
3868
+ }
3869
+ return null
3870
+ },
3871
+ /**
3872
+ * 判断树节点是否懒加载完成
3873
+ * @param {Row} row 行对象
3874
+ */
3875
+ isTreeExpandLoaded (row) {
3876
+ const rest = this.fullAllDataRowMap.get(row)
3877
+ return rest && rest.treeLoaded
3878
+ },
3879
+ clearTreeExpandLoaded (row) {
3880
+ const { treeOpts, treeExpandeds, fullAllDataRowMap } = this
3881
+ const { transform, lazy } = treeOpts
3882
+ const rest = fullAllDataRowMap.get(row)
3883
+ if (lazy && rest) {
3884
+ rest.treeLoaded = false
3885
+ XEUtils.remove(treeExpandeds, item => row === item)
3886
+ }
3887
+ if (transform) {
3888
+ this.handleVirtualTreeToList()
3889
+ return this.handleTableData()
3890
+ }
3891
+ return this.$nextTick()
3892
+ },
3893
+ /**
3894
+ * 重新懒加载树节点,并展开该节点
3895
+ * @param {Row} row 行对象
3896
+ */
3897
+ reloadTreeExpand (row) {
3898
+ const { treeOpts, treeLazyLoadeds } = this
3899
+ const { transform, lazy, hasChild } = treeOpts
3900
+ if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
3901
+ this.clearTreeExpandLoaded(row).then(() => {
3902
+ return this.handleAsyncTreeExpandChilds(row)
3903
+ }).then(() => {
3904
+ if (transform) {
3905
+ this.handleVirtualTreeToList()
3906
+ return this.handleTableData()
3907
+ }
3908
+ }).then(() => {
3909
+ return this.recalculate()
3910
+ })
3911
+ }
3912
+ return this.$nextTick()
3913
+ },
3914
+ reloadTreeChilds (row) {
3915
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
3916
+ warnLog('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand'])
3917
+ }
3918
+ // 即将废弃
3919
+ return this.reloadTreeExpand(row)
3920
+ },
3921
+ /**
3922
+ * 展开树节点事件
3923
+ */
3924
+ triggerTreeExpandEvent (evnt, params) {
3925
+ const { treeOpts, treeLazyLoadeds } = this
3926
+ const { row, column } = params
3927
+ const { lazy } = treeOpts
3928
+ if (!lazy || treeLazyLoadeds.indexOf(row) === -1) {
3929
+ const expanded = !this.isTreeExpandByRow(row)
3930
+ const columnIndex = this.getColumnIndex(column)
3931
+ const $columnIndex = this.getVMColumnIndex(column)
3932
+ this.setTreeExpand(row, expanded)
3933
+ this.emitEvent('toggle-tree-expand', { expanded, column, columnIndex, $columnIndex, row }, evnt)
3934
+ }
3935
+ },
3936
+ /**
3937
+ * 切换/展开树节点
3938
+ */
3939
+ toggleTreeExpand (row) {
3940
+ return this.setTreeExpand(row, !this.isTreeExpandByRow(row))
3941
+ },
3942
+ /**
3943
+ * 处理默认展开树节点
3944
+ */
3945
+ handleDefaultTreeExpand () {
3946
+ const { treeConfig, treeOpts, tableFullData } = this
3947
+ if (treeConfig) {
3948
+ const { expandAll, expandRowKeys } = treeOpts
3949
+ if (expandAll) {
3950
+ this.setAllTreeExpand(true)
3951
+ } else if (expandRowKeys) {
3952
+ const defExpandeds = []
3953
+ const rowkey = getRowkey(this)
3954
+ expandRowKeys.forEach(rowid => {
3955
+ const matchObj = XEUtils.findTree(tableFullData, item => rowid === XEUtils.get(item, rowkey), treeOpts)
3956
+ if (matchObj) {
3957
+ defExpandeds.push(matchObj.item)
3958
+ }
3959
+ })
3960
+ this.setTreeExpand(defExpandeds, true)
3961
+ }
3962
+ }
3963
+ },
3964
+ handleAsyncTreeExpandChilds (row) {
3965
+ const { fullAllDataRowMap, treeExpandeds, treeOpts, treeLazyLoadeds, checkboxOpts } = this
3966
+ const { transform, loadMethod } = treeOpts
3967
+ const { checkStrictly } = checkboxOpts
3968
+ const rest = fullAllDataRowMap.get(row)
3969
+ return new Promise(resolve => {
3970
+ treeLazyLoadeds.push(row)
3971
+ loadMethod({ $table: this, row }).catch(() => []).then(childRecords => {
3972
+ rest.treeLoaded = true
3973
+ XEUtils.remove(treeLazyLoadeds, item => item === row)
3974
+ if (!XEUtils.isArray(childRecords)) {
3975
+ childRecords = []
3976
+ }
3977
+ if (childRecords) {
3978
+ this.loadTreeChildren(row, childRecords).then(childRows => {
3979
+ if (childRows.length && treeExpandeds.indexOf(row) === -1) {
3980
+ treeExpandeds.push(row)
3981
+ }
3982
+ // 如果当前节点已选中,则展开后子节点也被选中
3983
+ if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
3984
+ this.setCheckboxRow(childRows, true)
3985
+ }
3986
+ this.$nextTick().then(() => {
3987
+ if (transform) {
3988
+ return this.handleTableData()
3989
+ }
3990
+ }).then(() => {
3991
+ return this.recalculate()
3992
+ }).then(() => resolve())
3993
+ })
3994
+ } else {
3995
+ this.$nextTick().then(() => this.recalculate()).then(() => resolve())
3996
+ }
3997
+ })
3998
+ })
3999
+ },
4000
+ /**
4001
+ * 设置所有树节点的展开与否
4002
+ * @param {Boolean} expanded 是否展开
4003
+ */
4004
+ setAllTreeExpand (expanded) {
4005
+ const { tableFullData, treeOpts } = this
4006
+ const { lazy, children } = treeOpts
4007
+ const expandeds = []
4008
+ XEUtils.eachTree(tableFullData, row => {
4009
+ const rowChildren = row[children]
4010
+ if (lazy || (rowChildren && rowChildren.length)) {
4011
+ expandeds.push(row)
4012
+ }
4013
+ }, treeOpts)
4014
+ return this.setTreeExpand(expandeds, expanded)
4015
+ },
4016
+ /**
4017
+ * 默认,展开与收起树节点
4018
+ * @param rows
4019
+ * @param expanded
4020
+ * @returns
4021
+ */
4022
+ handleBaseTreeExpand (rows, expanded) {
4023
+ const { fullAllDataRowMap, tableFullData, treeExpandeds, treeOpts, treeLazyLoadeds, treeNodeColumn } = this
4024
+ const { reserve, lazy, hasChild, children, accordion, toggleMethod } = treeOpts
4025
+ const result = []
4026
+ const columnIndex = this.getColumnIndex(treeNodeColumn)
4027
+ const $columnIndex = this.getVMColumnIndex(treeNodeColumn)
4028
+ let validRows = toggleMethod ? rows.filter(row => toggleMethod({ expanded, column: treeNodeColumn, columnIndex, $columnIndex, row })) : rows
4029
+ if (accordion) {
4030
+ validRows = validRows.length ? [validRows[validRows.length - 1]] : []
4031
+ // 同一级只能展开一个
4032
+ const matchObj = XEUtils.findTree(tableFullData, item => item === validRows[0], treeOpts)
4033
+ if (matchObj) {
4034
+ XEUtils.remove(treeExpandeds, item => matchObj.items.indexOf(item) > -1)
4035
+ }
4036
+ }
4037
+ if (expanded) {
4038
+ validRows.forEach(row => {
4039
+ if (treeExpandeds.indexOf(row) === -1) {
4040
+ const rest = fullAllDataRowMap.get(row)
4041
+ const isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1
4042
+ // 是否使用懒加载
4043
+ if (isLoad) {
4044
+ result.push(this.handleAsyncTreeExpandChilds(row))
4045
+ } else {
4046
+ if (row[children] && row[children].length) {
4047
+ treeExpandeds.push(row)
4048
+ }
4049
+ }
4050
+ }
4051
+ })
4052
+ } else {
4053
+ XEUtils.remove(treeExpandeds, row => validRows.indexOf(row) > -1)
4054
+ }
4055
+ if (reserve) {
4056
+ validRows.forEach(row => this.handleTreeExpandReserve(row, expanded))
4057
+ }
4058
+ return Promise.all(result).then(this.recalculate)
4059
+ },
4060
+ /**
4061
+ * 虚拟树的展开与收起
4062
+ * @param rows
4063
+ * @param expanded
4064
+ * @returns
4065
+ */
4066
+ handleVirtualTreeExpand (rows, expanded) {
4067
+ return this.handleBaseTreeExpand(rows, expanded).then(() => {
4068
+ this.handleVirtualTreeToList()
4069
+ return this.handleTableData()
4070
+ }).then(() => {
4071
+ return this.recalculate()
4072
+ })
4073
+ },
4074
+ /**
4075
+ * 设置展开树形节点,二个参数设置这一行展开与否
4076
+ * 支持单行
4077
+ * 支持多行
4078
+ * @param {Array/Row} rows 行数据
4079
+ * @param {Boolean} expanded 是否展开
4080
+ */
4081
+ setTreeExpand (rows, expanded) {
4082
+ const { treeOpts } = this
4083
+ const { transform } = treeOpts
4084
+ if (rows) {
4085
+ if (!XEUtils.isArray(rows)) {
4086
+ rows = [rows]
4087
+ }
4088
+ if (rows.length) {
4089
+ // 如果为虚拟树
4090
+ if (transform) {
4091
+ return this.handleVirtualTreeExpand(rows, expanded)
4092
+ } else {
4093
+ return this.handleBaseTreeExpand(rows, expanded)
4094
+ }
4095
+ }
4096
+ }
4097
+ return this.$nextTick()
4098
+ },
4099
+ /**
4100
+ * 判断行是否为树形节点展开状态
4101
+ * @param {Row} row 行对象
4102
+ */
4103
+ isTreeExpandByRow (row) {
4104
+ return this.treeExpandeds.indexOf(row) > -1
4105
+ },
4106
+ /**
4107
+ * 手动清空树形节点的展开状态,数据会恢复成未展开的状态
4108
+ */
4109
+ clearTreeExpand () {
4110
+ const { treeOpts, treeExpandeds, tableFullData } = this
4111
+ const { transform, reserve } = treeOpts
4112
+ const isExists = treeExpandeds.length
4113
+ this.treeExpandeds = []
4114
+ if (reserve) {
4115
+ XEUtils.eachTree(tableFullData, row => this.handleTreeExpandReserve(row, false), treeOpts)
4116
+ }
4117
+ return this.handleTableData().then(() => {
4118
+ if (transform) {
4119
+ this.handleVirtualTreeToList()
4120
+ return this.handleTableData()
4121
+ }
4122
+ }).then(() => {
4123
+ if (isExists) {
4124
+ this.recalculate()
4125
+ }
4126
+ })
4127
+ },
4128
+ clearTreeExpandReserve () {
4129
+ this.treeExpandedReserveRowMap = {}
4130
+ return this.$nextTick()
4131
+ },
4132
+ handleTreeExpandReserve (row, expanded) {
4133
+ const { treeExpandedReserveRowMap, treeOpts } = this
4134
+ if (treeOpts.reserve) {
4135
+ const rowid = getRowid(this, row)
4136
+ if (expanded) {
4137
+ treeExpandedReserveRowMap[rowid] = row
4138
+ } else if (treeExpandedReserveRowMap[rowid]) {
4139
+ delete treeExpandedReserveRowMap[rowid]
4140
+ }
4141
+ }
4142
+ },
4143
+ /**
4144
+ * 获取表格的滚动状态
4145
+ */
4146
+ getScroll () {
4147
+ const { $refs, scrollXLoad, scrollYLoad } = this
4148
+ const bodyElem = $refs.tableBody.$el
4149
+ return {
4150
+ virtualX: scrollXLoad,
4151
+ virtualY: scrollYLoad,
4152
+ scrollTop: bodyElem.scrollTop,
4153
+ scrollLeft: bodyElem.scrollLeft
4154
+ }
4155
+ },
4156
+ /**
4157
+ * 横向 X 可视渲染事件处理
4158
+ */
4159
+ triggerScrollXEvent () {
4160
+ this.loadScrollXData()
4161
+ },
4162
+ loadScrollXData () {
4163
+ const { mergeList, mergeFooterList, scrollXStore } = this
4164
+ const { startIndex, endIndex, offsetSize } = scrollXStore
4165
+ const { toVisibleIndex, visibleSize } = computeVirtualX(this)
4166
+ const offsetItem = {
4167
+ startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
4168
+ endIndex: toVisibleIndex + visibleSize + offsetSize
4169
+ }
4170
+ calculateMergerOffserIndex(mergeList.concat(mergeFooterList), offsetItem, 'col')
4171
+ const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
4172
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
4173
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
4174
+ scrollXStore.startIndex = offsetStartIndex
4175
+ scrollXStore.endIndex = offsetEndIndex
4176
+ this.updateScrollXData()
4177
+ }
4178
+ }
4179
+ this.closeTooltip()
4180
+ },
4181
+ /**
4182
+ * 纵向 Y 可视渲染事件处理
4183
+ */
4184
+ triggerScrollYEvent (evnt) {
4185
+ const { scrollYStore } = this
4186
+ const { adaptive, offsetSize, visibleSize } = scrollYStore
4187
+ // webkit 浏览器使用最佳的渲染方式,且最高渲染量不能大于 40 条
4188
+ if (isWebkit && adaptive && (offsetSize * 2 + visibleSize) <= 40) {
4189
+ this.loadScrollYData(evnt)
4190
+ } else {
4191
+ this.debounceScrollY(evnt)
4192
+ }
4193
+ },
4194
+ debounceScrollY: XEUtils.debounce(function (evnt) {
4195
+ this.loadScrollYData(evnt)
4196
+ }, debounceScrollYDuration, { leading: false, trailing: true }),
4197
+ /**
4198
+ * 纵向 Y 可视渲染处理
4199
+ */
4200
+ loadScrollYData (evnt) {
4201
+ const { mergeList, scrollYStore } = this
4202
+ const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore
4203
+ const scrollBodyElem = evnt.currentTarget || evnt.target
4204
+ const scrollTop = scrollBodyElem.scrollTop
4205
+ const toVisibleIndex = Math.floor(scrollTop / rowHeight)
4206
+ const offsetItem = {
4207
+ startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
4208
+ endIndex: toVisibleIndex + visibleSize + offsetSize
4209
+ }
4210
+ calculateMergerOffserIndex(mergeList, offsetItem, 'row')
4211
+ const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
4212
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
4213
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
4214
+ scrollYStore.startIndex = offsetStartIndex
4215
+ scrollYStore.endIndex = offsetEndIndex
4216
+ this.updateScrollYData()
4217
+ }
4218
+ }
4219
+ },
4220
+ // 计算可视渲染相关数据
4221
+ computeScrollLoad () {
4222
+ return this.$nextTick().then(() => {
4223
+ const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this
4224
+ // 计算 X 逻辑
4225
+ if (scrollXLoad) {
4226
+ const { visibleSize: visibleXSize } = computeVirtualX(this)
4227
+ const offsetXSize = sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : browse.msie ? 10 : (browse.edge ? 5 : 0)
4228
+ scrollXStore.offsetSize = offsetXSize
4229
+ scrollXStore.visibleSize = visibleXSize
4230
+ scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
4231
+ this.updateScrollXData()
4232
+ } else {
4233
+ this.updateScrollXSpace()
4234
+ }
4235
+ // 计算 Y 逻辑
4236
+ const { rowHeight, visibleSize: visibleYSize } = computeVirtualY(this)
4237
+ scrollYStore.rowHeight = rowHeight
4238
+ if (scrollYLoad) {
4239
+ const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : browse.msie ? 20 : (browse.edge ? 10 : 0)
4240
+ scrollYStore.offsetSize = offsetYSize
4241
+ scrollYStore.visibleSize = visibleYSize
4242
+ scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex)
4243
+ this.updateScrollYData()
4244
+ } else {
4245
+ this.updateScrollYSpace()
4246
+ }
4247
+ this.rowHeight = rowHeight
4248
+ this.$nextTick(this.updateStyle)
4249
+ })
4250
+ },
4251
+ handleTableColumn () {
4252
+ const { scrollXLoad, visibleColumn, scrollXStore } = this
4253
+ this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0)
4254
+ },
4255
+ updateScrollXData () {
4256
+ this.tableColumn = []
4257
+ this.$nextTick(() => {
4258
+ this.handleTableColumn()
4259
+ this.updateScrollXSpace()
4260
+ })
4261
+ },
4262
+ // 更新横向 X 可视渲染上下剩余空间大小
4263
+ updateScrollXSpace () {
4264
+ const { $refs, elemStore, visibleColumn, scrollXStore, scrollXLoad, tableWidth, scrollbarWidth } = this
4265
+ const { tableHeader, tableBody, tableFooter } = $refs
4266
+ const tableBodyElem = tableBody ? tableBody.$el : null
4267
+ if (tableBodyElem) {
4268
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null
4269
+ const tableFooterElem = tableFooter ? tableFooter.$el : null
4270
+ const headerElem = tableHeaderElem ? tableHeaderElem.querySelector('.vxe-table--header') : null
4271
+ const bodyElem = tableBodyElem.querySelector('.vxe-table--body')
4272
+ const footerElem = tableFooterElem ? tableFooterElem.querySelector('.vxe-table--footer') : null
4273
+ const leftSpaceWidth = visibleColumn.slice(0, scrollXStore.startIndex).reduce((previous, column) => previous + column.renderWidth, 0)
4274
+ let marginLeft = ''
4275
+ if (scrollXLoad) {
4276
+ marginLeft = `${leftSpaceWidth}px`
4277
+ }
4278
+ if (headerElem) {
4279
+ headerElem.style.marginLeft = marginLeft
4280
+ }
4281
+ bodyElem.style.marginLeft = marginLeft
4282
+ if (footerElem) {
4283
+ footerElem.style.marginLeft = marginLeft
4284
+ }
4285
+ const containerList = ['main']
4286
+ containerList.forEach(name => {
4287
+ const layoutList = ['header', 'body', 'footer']
4288
+ layoutList.forEach(layout => {
4289
+ const xSpaceElem = elemStore[`${name}-${layout}-xSpace`]
4290
+ if (xSpaceElem) {
4291
+ xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : ''
4292
+ }
4293
+ })
4294
+ })
4295
+ this.$nextTick(this.updateStyle)
4296
+ }
4297
+ },
4298
+ updateScrollYData () {
4299
+ this.tableData = []
4300
+ this.$nextTick(() => {
4301
+ this.handleTableData()
4302
+ this.updateScrollYSpace()
4303
+ })
4304
+ },
4305
+ // 更新纵向 Y 可视渲染上下剩余空间大小
4306
+ updateScrollYSpace () {
4307
+ const { elemStore, scrollYStore, scrollYLoad, afterFullData } = this
4308
+ const { startIndex, rowHeight } = scrollYStore
4309
+ const bodyHeight = afterFullData.length * rowHeight
4310
+ const topSpaceHeight = Math.max(0, startIndex * rowHeight)
4311
+ const containerList = ['main', 'left', 'right']
4312
+ let marginTop = ''
4313
+ let ySpaceHeight = ''
4314
+ if (scrollYLoad) {
4315
+ marginTop = `${topSpaceHeight}px`
4316
+ ySpaceHeight = `${bodyHeight}px`
4317
+ }
4318
+ containerList.forEach(name => {
4319
+ const layoutList = ['header', 'body', 'footer']
4320
+ const tableElem = elemStore[`${name}-body-table`]
4321
+ if (tableElem) {
4322
+ tableElem.style.marginTop = marginTop
4323
+ }
4324
+ layoutList.forEach(layout => {
4325
+ const ySpaceElem = elemStore[`${name}-${layout}-ySpace`]
4326
+ if (ySpaceElem) {
4327
+ ySpaceElem.style.height = ySpaceHeight
4328
+ }
4329
+ })
4330
+ })
4331
+ this.$nextTick(this.updateStyle)
4332
+ },
4333
+ /**
4334
+ * 如果有滚动条,则滚动到对应的位置
4335
+ * @param {Number} scrollLeft 左距离
4336
+ * @param {Number} scrollTop 上距离
4337
+ */
4338
+ scrollTo (scrollLeft, scrollTop) {
4339
+ const { $refs } = this
4340
+ const { tableBody, rightBody, tableFooter } = $refs
4341
+ const tableBodyElem = tableBody ? tableBody.$el : null
4342
+ const rightBodyElem = rightBody ? rightBody.$el : null
4343
+ const tableFooterElem = tableFooter ? tableFooter.$el : null
4344
+ if (XEUtils.isNumber(scrollLeft)) {
4345
+ setScrollLeft(tableFooterElem || tableBodyElem, scrollLeft)
4346
+ }
4347
+ if (XEUtils.isNumber(scrollTop)) {
4348
+ setScrollTop(rightBodyElem || tableBodyElem, scrollTop)
4349
+ }
4350
+ if (this.scrollXLoad || this.scrollYLoad) {
4351
+ return new Promise(resolve => setTimeout(() => resolve(this.$nextTick()), 50))
4352
+ }
4353
+ return this.$nextTick()
4354
+ },
4355
+ /**
4356
+ * 如果有滚动条,则滚动到对应的行
4357
+ * @param {Row} row 行对象
4358
+ * @param {ColumnInfo} column 列配置
4359
+ */
4360
+ scrollToRow (row, fieldOrColumn) {
4361
+ const rest = []
4362
+ if (row) {
4363
+ if (this.treeConfig) {
4364
+ rest.push(this.scrollToTreeRow(row))
4365
+ } else {
4366
+ rest.push(rowToVisible(this, row))
4367
+ }
4368
+ }
4369
+ if (fieldOrColumn) {
4370
+ rest.push(this.scrollToColumn(fieldOrColumn))
4371
+ }
4372
+ return Promise.all(rest)
4373
+ },
4374
+ /**
4375
+ * 如果有滚动条,则滚动到对应的列
4376
+ * @param {ColumnInfo} column 列配置
4377
+ */
4378
+ scrollToColumn (fieldOrColumn) {
4379
+ const column = handleFieldOrColumn(this, fieldOrColumn)
4380
+ if (column && this.fullColumnMap.has(column)) {
4381
+ return colToVisible(this, column)
4382
+ }
4383
+ return this.$nextTick()
4384
+ },
4385
+ /**
4386
+ * 对于树形结构中,可以直接滚动到指定深层节点中
4387
+ * 对于某些特定的场景可能会用到,比如定位到某一节点
4388
+ * @param {Row} row 行对象
4389
+ */
4390
+ scrollToTreeRow (row) {
4391
+ const { tableFullData, treeConfig, treeOpts } = this
4392
+ const rests = []
4393
+ if (treeConfig) {
4394
+ const matchObj = XEUtils.findTree(tableFullData, item => item === row, treeOpts)
4395
+ if (matchObj) {
4396
+ const nodes = matchObj.nodes
4397
+ nodes.forEach((row, index) => {
4398
+ if (index < nodes.length - 1 && !this.isTreeExpandByRow(row)) {
4399
+ rests.push(this.setTreeExpand(row, true))
4400
+ }
4401
+ })
4402
+ }
4403
+ }
4404
+ return Promise.all(rests).then(() => rowToVisible(this, row))
4405
+ },
4406
+ /**
4407
+ * 手动清除滚动相关信息,还原到初始状态
4408
+ */
4409
+ clearScroll () {
4410
+ const { $refs, scrollXStore, scrollYStore } = this
4411
+ const { tableBody, rightBody, tableFooter } = $refs
4412
+ const tableBodyElem = tableBody ? tableBody.$el : null
4413
+ const rightBodyElem = rightBody ? rightBody.$el : null
4414
+ const tableFooterElem = tableFooter ? tableFooter.$el : null
4415
+ if (rightBodyElem) {
4416
+ restoreScrollListener(rightBodyElem)
4417
+ rightBodyElem.scrollTop = 0
4418
+ }
4419
+ if (tableFooterElem) {
4420
+ tableFooterElem.scrollLeft = 0
4421
+ }
4422
+ if (tableBodyElem) {
4423
+ restoreScrollListener(tableBodyElem)
4424
+ tableBodyElem.scrollTop = 0
4425
+ tableBodyElem.scrollLeft = 0
4426
+ }
4427
+ scrollXStore.startIndex = 0
4428
+ scrollYStore.startIndex = 0
4429
+ return this.$nextTick()
4430
+ },
4431
+ /**
4432
+ * 更新表尾合计
4433
+ */
4434
+ updateFooter () {
4435
+ const { showFooter, visibleColumn, footerMethod } = this
4436
+ if (showFooter && footerMethod) {
4437
+ this.footerTableData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: this.afterFullData, $table: this, $grid: this.$xegrid }) : []
4438
+ }
4439
+ return this.$nextTick()
4440
+ },
4441
+ /**
4442
+ * 更新列状态
4443
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
4444
+ * 如果单元格配置了校验规则,则会进行校验
4445
+ */
4446
+ updateStatus (scope, cellValue) {
4447
+ const customVal = !XEUtils.isUndefined(cellValue)
4448
+ return this.$nextTick().then(() => {
4449
+ const { $refs, editRules, validStore } = this
4450
+ if (scope && $refs.tableBody && editRules) {
4451
+ const { row, column } = scope
4452
+ const type = 'change'
4453
+ if (this.hasCellRules(type, row, column)) {
4454
+ const cell = this.getCell(row, column)
4455
+ if (cell) {
4456
+ return this.validCellRules(type, row, column, cellValue)
4457
+ .then(() => {
4458
+ if (customVal && validStore.visible) {
4459
+ setCellValue(row, column, cellValue)
4460
+ }
4461
+ this.clearValidate()
4462
+ })
4463
+ .catch(({ rule }) => {
4464
+ if (customVal) {
4465
+ setCellValue(row, column, cellValue)
4466
+ }
4467
+ this.showValidTooltip({ rule, row, column, cell })
4468
+ })
4469
+ }
4470
+ }
4471
+ }
4472
+ })
4473
+ },
4474
+ handleDefaultMergeCells () {
4475
+ this.setMergeCells(this.mergeCells)
4476
+ },
4477
+ /**
4478
+ * 设置合并单元格
4479
+ * @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
4480
+ */
4481
+ setMergeCells (merges) {
4482
+ if (this.spanMethod) {
4483
+ errLog('vxe.error.errConflicts', ['merge-cells', 'span-method'])
4484
+ }
4485
+ setMerges(this, merges, this.mergeList, this.afterFullData)
4486
+ return this.$nextTick().then(() => this.updateCellAreas())
4487
+ },
4488
+ /**
4489
+ * 移除单元格合并
4490
+ * @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
4491
+ */
4492
+ removeMergeCells (merges) {
4493
+ if (this.spanMethod) {
4494
+ errLog('vxe.error.errConflicts', ['merge-cells', 'span-method'])
4495
+ }
4496
+ const rest = removeMerges(this, merges, this.mergeList, this.afterFullData)
4497
+ return this.$nextTick().then(() => {
4498
+ this.updateCellAreas()
4499
+ return rest
4500
+ })
4501
+ },
4502
+ /**
4503
+ * 获取所有被合并的单元格
4504
+ */
4505
+ getMergeCells () {
4506
+ return this.mergeList.slice(0)
4507
+ },
4508
+ /**
4509
+ * 清除所有单元格合并
4510
+ */
4511
+ clearMergeCells () {
4512
+ this.mergeList = []
4513
+ return this.$nextTick()
4514
+ },
4515
+ handleDefaultMergeFooterItems () {
4516
+ this.setMergeFooterItems(this.mergeFooterItems)
4517
+ },
4518
+ setMergeFooterItems (merges) {
4519
+ if (this.footerSpanMethod) {
4520
+ errLog('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
4521
+ }
4522
+ setMerges(this, merges, this.mergeFooterList, null)
4523
+ return this.$nextTick().then(() => this.updateCellAreas())
4524
+ },
4525
+ removeMergeFooterItems (merges) {
4526
+ if (this.footerSpanMethod) {
4527
+ errLog('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
4528
+ }
4529
+ const rest = removeMerges(this, merges, this.mergeFooterList, null)
4530
+ return this.$nextTick().then(() => {
4531
+ this.updateCellAreas()
4532
+ return rest
4533
+ })
4534
+ },
4535
+ /**
4536
+ * 获取所有被合并的表尾
4537
+ */
4538
+ getMergeFooterItems () {
4539
+ return this.mergeFooterList.slice(0)
4540
+ },
4541
+ /**
4542
+ * 清除所有表尾合并
4543
+ */
4544
+ clearMergeFooterItems () {
4545
+ this.mergeFooterList = []
4546
+ return this.$nextTick()
4547
+ },
4548
+ updateZindex () {
4549
+ if (this.zIndex) {
4550
+ this.tZindex = this.zIndex
4551
+ } else if (this.tZindex < UtilTools.getLastZIndex()) {
4552
+ this.tZindex = UtilTools.nextZIndex()
4553
+ }
4554
+ },
4555
+ updateCellAreas () {
4556
+ if (this.mouseConfig && this.mouseOpts.area && this.handleUpdateCellAreas) {
4557
+ this.handleUpdateCellAreas()
4558
+ }
4559
+ },
4560
+ emitEvent (type, params, evnt) {
4561
+ this.$emit(type, Object.assign({ $table: this, $grid: this.$xegrid, $event: evnt }, params))
4562
+ },
4563
+ focus () {
4564
+ this.isActivated = true
4565
+ return this.$nextTick()
4566
+ },
4567
+ blur () {
4568
+ this.isActivated = false
4569
+ return this.$nextTick()
4570
+ },
4571
+ // 连接工具栏
4572
+ connect ($toolbar) {
4573
+ if ($toolbar && $toolbar.syncUpdate) {
4574
+ $toolbar.syncUpdate({ collectColumn: this.collectColumn, $table: this })
4575
+ this.$toolbar = $toolbar
4576
+ } else {
4577
+ errLog('vxe.error.barUnableLink')
4578
+ }
4579
+ return this.$nextTick()
4580
+ },
4581
+
4582
+ /*************************
4583
+ * Publish methods
4584
+ *************************/
4585
+ getCell (row, column) {
4586
+ const { $refs } = this
4587
+ const rowid = getRowid(this, row)
4588
+ const bodyElem = $refs[`${column.fixed || 'table'}Body`] || $refs.tableBody
4589
+ if (bodyElem && bodyElem.$el) {
4590
+ return bodyElem.$el.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`)
4591
+ }
4592
+ return null
4593
+ },
4594
+ getCellLabel (row, column) {
4595
+ const formatter = column.formatter
4596
+ const cellValue = UtilTools.getCellValue(row, column)
4597
+ let cellLabel = cellValue
4598
+ if (formatter) {
4599
+ let rest, formatData
4600
+ const { fullAllDataRowMap } = this
4601
+ const colid = column.id
4602
+ const cacheFormat = fullAllDataRowMap.has(row)
4603
+ if (cacheFormat) {
4604
+ rest = fullAllDataRowMap.get(row)
4605
+ formatData = rest.formatData
4606
+ if (!formatData) {
4607
+ formatData = fullAllDataRowMap.get(row).formatData = {}
4608
+ }
4609
+ if (rest && formatData[colid]) {
4610
+ if (formatData[colid].value === cellValue) {
4611
+ return formatData[colid].label
4612
+ }
4613
+ }
4614
+ }
4615
+ const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
4616
+ if (XEUtils.isString(formatter)) {
4617
+ const globalFunc = formats.get(formatter)
4618
+ cellLabel = globalFunc ? globalFunc(formatParams) : ''
4619
+ } else if (XEUtils.isArray(formatter)) {
4620
+ const globalFunc = formats.get(formatter[0])
4621
+ cellLabel = globalFunc ? globalFunc(formatParams, ...formatter.slice(1)) : ''
4622
+ } else {
4623
+ cellLabel = formatter(formatParams)
4624
+ }
4625
+ if (formatData) {
4626
+ formatData[colid] = { value: cellValue, label: cellLabel }
4627
+ }
4628
+ }
4629
+ return cellLabel
4630
+ },
4631
+ /*************************
4632
+ * Publish methods
4633
+ *************************/
4634
+
4635
+ getSetupOptions () {
4636
+ return GlobalConfig
4637
+ }
4638
+ }
4639
+
4640
+ // Module methods
4641
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',')
4642
+
4643
+ funcs.forEach(name => {
4644
+ Methods[name] = function (...args) {
4645
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
4646
+ if (!this[`_${name}`]) {
4647
+ if ('openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').includes(name)) {
4648
+ errLog('vxe.error.reqModule', ['Export'])
4649
+ } else if ('clearValidate,fullValidate,validate'.split(',').includes(name)) {
4650
+ errLog('vxe.error.reqModule', ['Validator'])
4651
+ }
4652
+ }
4653
+ }
4654
+ return this[`_${name}`] ? this[`_${name}`](...args) : null
4655
+ }
4656
+ })
4657
+
4658
+ export default Methods