vxe-table 4.16.15 → 4.16.17

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 (258) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/es/grid/src/grid.js +7 -2
  4. package/es/index.css +1 -1
  5. package/es/index.min.css +1 -1
  6. package/es/locale/lang/en-US.js +2 -2
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/module/filter/panel.js +2 -1
  10. package/es/table/module/menu/hook.js +9 -3
  11. package/es/table/module/menu/panel.js +113 -109
  12. package/es/table/src/header.js +4 -1
  13. package/es/table/src/table.js +58 -30
  14. package/es/table/src/util.js +19 -4
  15. package/es/ui/index.js +8 -5
  16. package/es/ui/src/log.js +1 -1
  17. package/lib/grid/src/grid.js +6 -2
  18. package/lib/grid/src/grid.min.js +1 -1
  19. package/lib/index.css +1 -1
  20. package/lib/index.min.css +1 -1
  21. package/lib/index.umd.js +89 -41
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/locale/lang/ar-EG.min.js +1 -1
  24. package/lib/locale/lang/de-DE.min.js +1 -1
  25. package/lib/locale/lang/en-US.js +2 -2
  26. package/lib/locale/lang/en-US.min.js +1 -1
  27. package/lib/locale/lang/es-ES.min.js +1 -1
  28. package/lib/locale/lang/fr-FR.min.js +1 -1
  29. package/lib/locale/lang/hu-HU.min.js +1 -1
  30. package/lib/locale/lang/hy-AM.min.js +1 -1
  31. package/lib/locale/lang/id-ID.min.js +1 -1
  32. package/lib/locale/lang/it-IT.min.js +1 -1
  33. package/lib/locale/lang/ja-JP.min.js +1 -1
  34. package/lib/locale/lang/ko-KR.min.js +1 -1
  35. package/lib/locale/lang/ms-MY.min.js +1 -1
  36. package/lib/locale/lang/nb-NO.min.js +1 -1
  37. package/lib/locale/lang/pt-BR.min.js +1 -1
  38. package/lib/locale/lang/ru-RU.min.js +1 -1
  39. package/lib/locale/lang/th-TH.min.js +1 -1
  40. package/lib/locale/lang/ug-CN.min.js +1 -1
  41. package/lib/locale/lang/uk-UA.min.js +1 -1
  42. package/lib/locale/lang/uz-UZ.min.js +1 -1
  43. package/lib/locale/lang/vi-VN.min.js +1 -1
  44. package/lib/locale/lang/zh-CHT.min.js +1 -1
  45. package/lib/locale/lang/zh-CN.min.js +1 -1
  46. package/lib/locale/lang/zh-HK.min.js +1 -1
  47. package/lib/locale/lang/zh-MO.min.js +1 -1
  48. package/lib/locale/lang/zh-TW.min.js +1 -1
  49. package/lib/style.css +1 -1
  50. package/lib/style.min.css +1 -1
  51. package/lib/table/src/header.js +3 -1
  52. package/lib/table/src/props.js +0 -318
  53. package/lib/ui/index.js +8 -5
  54. package/lib/ui/index.min.js +1 -1
  55. package/lib/ui/src/log.js +1 -1
  56. package/lib/ui/src/log.min.js +1 -1
  57. package/package.json +1 -1
  58. package/packages/grid/src/grid.ts +8 -2
  59. package/packages/locale/lang/en-US.ts +2 -2
  60. package/packages/table/module/filter/panel.ts +2 -1
  61. package/packages/table/module/menu/hook.ts +11 -3
  62. package/packages/table/module/menu/panel.ts +112 -108
  63. package/packages/table/src/header.ts +3 -1
  64. package/packages/table/src/table.ts +58 -30
  65. package/packages/table/src/util.ts +19 -2
  66. package/packages/ui/index.ts +7 -4
  67. package/styles/components/grid.scss +0 -1
  68. package/es/colgroup/style.css +0 -0
  69. package/es/colgroup/style.min.css +0 -0
  70. package/es/column/style.css +0 -0
  71. package/es/column/style.min.css +0 -0
  72. package/es/grid/style.css +0 -87
  73. package/es/grid/style.min.css +0 -1
  74. package/es/iconfont.1758246364726.ttf +0 -0
  75. package/es/iconfont.1758246364726.woff +0 -0
  76. package/es/iconfont.1758246364726.woff2 +0 -0
  77. package/es/index.esm.js +0 -3
  78. package/es/locale/lang/ar-EG.d.ts +0 -2
  79. package/es/locale/lang/de-DE.d.ts +0 -2
  80. package/es/locale/lang/en-US.d.ts +0 -2
  81. package/es/locale/lang/es-ES.d.ts +0 -2
  82. package/es/locale/lang/fr-FR.d.ts +0 -2
  83. package/es/locale/lang/hu-HU.d.ts +0 -2
  84. package/es/locale/lang/hy-AM.d.ts +0 -2
  85. package/es/locale/lang/id-ID.d.ts +0 -2
  86. package/es/locale/lang/it-IT.d.ts +0 -2
  87. package/es/locale/lang/ja-JP.d.ts +0 -2
  88. package/es/locale/lang/ko-KR.d.ts +0 -2
  89. package/es/locale/lang/ms-MY.d.ts +0 -2
  90. package/es/locale/lang/nb-NO.d.ts +0 -2
  91. package/es/locale/lang/pt-BR.d.ts +0 -2
  92. package/es/locale/lang/ru-RU.d.ts +0 -2
  93. package/es/locale/lang/th-TH.d.ts +0 -2
  94. package/es/locale/lang/ug-CN.d.ts +0 -2
  95. package/es/locale/lang/uk-UA.d.ts +0 -2
  96. package/es/locale/lang/uz-UZ.d.ts +0 -2
  97. package/es/locale/lang/vi-VN.d.ts +0 -2
  98. package/es/locale/lang/zh-CHT.d.ts +0 -2
  99. package/es/locale/lang/zh-CN.d.ts +0 -2
  100. package/es/locale/lang/zh-HK.d.ts +0 -2
  101. package/es/locale/lang/zh-MO.d.ts +0 -2
  102. package/es/locale/lang/zh-TW.d.ts +0 -2
  103. package/es/table/style.css +0 -3657
  104. package/es/table/style.min.css +0 -1
  105. package/es/toolbar/style.css +0 -90
  106. package/es/toolbar/style.min.css +0 -1
  107. package/es/ui/style.css +0 -0
  108. package/es/ui/style.min.css +0 -0
  109. package/es/v-x-e-table/style.css +0 -0
  110. package/es/v-x-e-table/style.min.css +0 -0
  111. package/es/vxe-colgroup/style.css +0 -0
  112. package/es/vxe-colgroup/style.min.css +0 -0
  113. package/es/vxe-column/style.css +0 -0
  114. package/es/vxe-column/style.min.css +0 -0
  115. package/es/vxe-grid/style.css +0 -87
  116. package/es/vxe-grid/style.min.css +0 -1
  117. package/es/vxe-table/style.css +0 -3657
  118. package/es/vxe-table/style.min.css +0 -1
  119. package/es/vxe-toolbar/style.css +0 -90
  120. package/es/vxe-toolbar/style.min.css +0 -1
  121. package/es/vxe-ui/style.css +0 -0
  122. package/es/vxe-ui/style.min.css +0 -0
  123. package/es/vxe-v-x-e-table/style.css +0 -0
  124. package/es/vxe-v-x-e-table/style.min.css +0 -0
  125. package/lib/colgroup/style/index.js +0 -1
  126. package/lib/colgroup/style/style.css +0 -0
  127. package/lib/colgroup/style/style.min.css +0 -0
  128. package/lib/column/style/index.js +0 -1
  129. package/lib/column/style/style.css +0 -0
  130. package/lib/column/style/style.min.css +0 -0
  131. package/lib/grid/style/index.js +0 -1
  132. package/lib/grid/style/style.css +0 -87
  133. package/lib/grid/style/style.min.css +0 -1
  134. package/lib/iconfont.1758246364726.ttf +0 -0
  135. package/lib/iconfont.1758246364726.woff +0 -0
  136. package/lib/iconfont.1758246364726.woff2 +0 -0
  137. package/lib/index.common.js +0 -22
  138. package/lib/locale/lang/ar-EG.d.ts +0 -2
  139. package/lib/locale/lang/ar-EG.umd.js +0 -806
  140. package/lib/locale/lang/de-DE.d.ts +0 -2
  141. package/lib/locale/lang/de-DE.umd.js +0 -806
  142. package/lib/locale/lang/en-US.d.ts +0 -2
  143. package/lib/locale/lang/en-US.umd.js +0 -806
  144. package/lib/locale/lang/es-ES.d.ts +0 -2
  145. package/lib/locale/lang/es-ES.umd.js +0 -806
  146. package/lib/locale/lang/fr-FR.d.ts +0 -2
  147. package/lib/locale/lang/fr-FR.umd.js +0 -806
  148. package/lib/locale/lang/hu-HU.d.ts +0 -2
  149. package/lib/locale/lang/hu-HU.umd.js +0 -806
  150. package/lib/locale/lang/hy-AM.d.ts +0 -2
  151. package/lib/locale/lang/hy-AM.umd.js +0 -806
  152. package/lib/locale/lang/id-ID.d.ts +0 -2
  153. package/lib/locale/lang/id-ID.umd.js +0 -806
  154. package/lib/locale/lang/it-IT.d.ts +0 -2
  155. package/lib/locale/lang/it-IT.umd.js +0 -806
  156. package/lib/locale/lang/ja-JP.d.ts +0 -2
  157. package/lib/locale/lang/ja-JP.umd.js +0 -806
  158. package/lib/locale/lang/ko-KR.d.ts +0 -2
  159. package/lib/locale/lang/ko-KR.umd.js +0 -806
  160. package/lib/locale/lang/ms-MY.d.ts +0 -2
  161. package/lib/locale/lang/ms-MY.umd.js +0 -806
  162. package/lib/locale/lang/nb-NO.d.ts +0 -2
  163. package/lib/locale/lang/nb-NO.umd.js +0 -806
  164. package/lib/locale/lang/pt-BR.d.ts +0 -2
  165. package/lib/locale/lang/pt-BR.umd.js +0 -806
  166. package/lib/locale/lang/ru-RU.d.ts +0 -2
  167. package/lib/locale/lang/ru-RU.umd.js +0 -806
  168. package/lib/locale/lang/th-TH.d.ts +0 -2
  169. package/lib/locale/lang/th-TH.umd.js +0 -806
  170. package/lib/locale/lang/ug-CN.d.ts +0 -2
  171. package/lib/locale/lang/ug-CN.umd.js +0 -806
  172. package/lib/locale/lang/uk-UA.d.ts +0 -2
  173. package/lib/locale/lang/uk-UA.umd.js +0 -806
  174. package/lib/locale/lang/uz-UZ.d.ts +0 -2
  175. package/lib/locale/lang/uz-UZ.umd.js +0 -806
  176. package/lib/locale/lang/vi-VN.d.ts +0 -2
  177. package/lib/locale/lang/vi-VN.umd.js +0 -806
  178. package/lib/locale/lang/zh-CHT.d.ts +0 -2
  179. package/lib/locale/lang/zh-CHT.umd.js +0 -806
  180. package/lib/locale/lang/zh-CN.d.ts +0 -2
  181. package/lib/locale/lang/zh-CN.umd.js +0 -808
  182. package/lib/locale/lang/zh-HK.d.ts +0 -2
  183. package/lib/locale/lang/zh-HK.umd.js +0 -23
  184. package/lib/locale/lang/zh-MO.d.ts +0 -2
  185. package/lib/locale/lang/zh-MO.umd.js +0 -23
  186. package/lib/locale/lang/zh-TW.d.ts +0 -2
  187. package/lib/locale/lang/zh-TW.umd.js +0 -23
  188. package/lib/table/module/custom/hook.js +0 -430
  189. package/lib/table/module/custom/hook.min.js +0 -1
  190. package/lib/table/module/custom/panel.js +0 -1193
  191. package/lib/table/module/custom/panel.min.js +0 -1
  192. package/lib/table/module/edit/hook.js +0 -1308
  193. package/lib/table/module/edit/hook.min.js +0 -1
  194. package/lib/table/module/export/export-panel.js +0 -467
  195. package/lib/table/module/export/export-panel.min.js +0 -1
  196. package/lib/table/module/export/hook.js +0 -1888
  197. package/lib/table/module/export/hook.min.js +0 -1
  198. package/lib/table/module/export/import-panel.js +0 -226
  199. package/lib/table/module/export/import-panel.min.js +0 -1
  200. package/lib/table/module/export/util.js +0 -20
  201. package/lib/table/module/export/util.min.js +0 -1
  202. package/lib/table/module/filter/hook.js +0 -442
  203. package/lib/table/module/filter/hook.min.js +0 -1
  204. package/lib/table/module/filter/panel.js +0 -264
  205. package/lib/table/module/filter/panel.min.js +0 -1
  206. package/lib/table/module/keyboard/hook.js +0 -579
  207. package/lib/table/module/keyboard/hook.min.js +0 -1
  208. package/lib/table/module/menu/hook.js +0 -383
  209. package/lib/table/module/menu/hook.min.js +0 -1
  210. package/lib/table/module/menu/panel.js +0 -135
  211. package/lib/table/module/menu/panel.min.js +0 -1
  212. package/lib/table/module/validator/hook.js +0 -681
  213. package/lib/table/module/validator/hook.min.js +0 -1
  214. package/lib/table/src/header.min.js +0 -1
  215. package/lib/table/src/props.min.js +0 -1
  216. package/lib/table/src/store.js +0 -15
  217. package/lib/table/src/store.min.js +0 -1
  218. package/lib/table/src/table.js +0 -902
  219. package/lib/table/src/table.min.js +0 -1
  220. package/lib/table/src/use/cell-view.js +0 -57
  221. package/lib/table/src/use/cell-view.min.js +0 -1
  222. package/lib/table/src/use/index.js +0 -16
  223. package/lib/table/src/use/index.min.js +0 -1
  224. package/lib/table/src/util.js +0 -896
  225. package/lib/table/src/util.min.js +0 -1
  226. package/lib/table/style/index.js +0 -1
  227. package/lib/table/style/style.css +0 -3657
  228. package/lib/table/style/style.min.css +0 -1
  229. package/lib/toolbar/style/index.js +0 -1
  230. package/lib/toolbar/style/style.css +0 -90
  231. package/lib/toolbar/style/style.min.css +0 -1
  232. package/lib/ui/style/index.js +0 -1
  233. package/lib/ui/style/style.css +0 -0
  234. package/lib/ui/style/style.min.css +0 -0
  235. package/lib/v-x-e-table/style/index.js +0 -1
  236. package/lib/v-x-e-table/style/style.css +0 -0
  237. package/lib/v-x-e-table/style/style.min.css +0 -0
  238. package/lib/vxe-colgroup/style/index.js +0 -1
  239. package/lib/vxe-colgroup/style/style.css +0 -0
  240. package/lib/vxe-colgroup/style/style.min.css +0 -0
  241. package/lib/vxe-column/style/index.js +0 -1
  242. package/lib/vxe-column/style/style.css +0 -0
  243. package/lib/vxe-column/style/style.min.css +0 -0
  244. package/lib/vxe-grid/style/index.js +0 -1
  245. package/lib/vxe-grid/style/style.css +0 -87
  246. package/lib/vxe-grid/style/style.min.css +0 -1
  247. package/lib/vxe-table/style/index.js +0 -1
  248. package/lib/vxe-table/style/style.css +0 -3657
  249. package/lib/vxe-table/style/style.min.css +0 -1
  250. package/lib/vxe-toolbar/style/index.js +0 -1
  251. package/lib/vxe-toolbar/style/style.css +0 -90
  252. package/lib/vxe-toolbar/style/style.min.css +0 -1
  253. package/lib/vxe-ui/style/index.js +0 -1
  254. package/lib/vxe-ui/style/style.css +0 -0
  255. package/lib/vxe-ui/style/style.min.css +0 -0
  256. package/lib/vxe-v-x-e-table/style/index.js +0 -1
  257. package/lib/vxe-v-x-e-table/style/style.css +0 -0
  258. package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
@@ -1,896 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.assembleColumn = assembleColumn;
7
- exports.calcTreeLine = calcTreeLine;
8
- exports.clearTableAllStatus = clearTableAllStatus;
9
- exports.clearTableDefaultStatus = clearTableDefaultStatus;
10
- exports.colToVisible = colToVisible;
11
- exports.convertHeaderColumnToRows = void 0;
12
- exports.convertHeaderToGridRows = convertHeaderToGridRows;
13
- exports.createColumn = createColumn;
14
- exports.createHandleGetRowId = createHandleGetRowId;
15
- exports.createHandleUpdateRowId = createHandleUpdateRowId;
16
- exports.createInternalData = createInternalData;
17
- exports.destroyColumn = destroyColumn;
18
- exports.encodeRowid = encodeRowid;
19
- exports.getCalcHeight = getCalcHeight;
20
- exports.getCellRestHeight = getCellRestHeight;
21
- exports.getCellValue = getCellValue;
22
- exports.getColReMaxWidth = getColReMaxWidth;
23
- exports.getColReMinWidth = getColReMinWidth;
24
- exports.getColumnList = getColumnList;
25
- exports.getOffsetSize = void 0;
26
- exports.getRefElem = getRefElem;
27
- exports.getRootColumn = getRootColumn;
28
- exports.getRowUniqueId = getRowUniqueId;
29
- exports.getRowid = getRowid;
30
- exports.getRowkey = getRowkey;
31
- exports.handleFieldOrColumn = handleFieldOrColumn;
32
- exports.handleRowidOrRow = handleRowidOrRow;
33
- exports.hasDeepKey = hasDeepKey;
34
- exports.isColumnInfo = isColumnInfo;
35
- exports.restoreScrollLocation = restoreScrollLocation;
36
- exports.rowToVisible = rowToVisible;
37
- exports.setCellValue = setCellValue;
38
- exports.toFilters = toFilters;
39
- exports.toTreePathSeq = toTreePathSeq;
40
- exports.updateDeepRowKey = updateDeepRowKey;
41
- exports.updateFastRowKey = updateFastRowKey;
42
- exports.watchColumn = watchColumn;
43
- var _vue = require("vue");
44
- var _xeUtils = _interopRequireDefault(require("xe-utils"));
45
- var _columnInfo = require("./columnInfo");
46
- var _dom = require("../../ui/src/dom");
47
- var _utils = require("../../ui/src/utils");
48
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
49
- function createInternalData() {
50
- return {
51
- tZindex: 0,
52
- currKeyField: '',
53
- isCurrDeepKey: false,
54
- elemStore: {},
55
- // 存放横向 X 虚拟滚动相关的信息
56
- scrollXStore: {
57
- preloadSize: 0,
58
- offsetSize: 0,
59
- visibleSize: 0,
60
- visibleStartIndex: 0,
61
- visibleEndIndex: 0,
62
- startIndex: 0,
63
- endIndex: 0
64
- },
65
- // 存放纵向 Y 虚拟滚动相关信息
66
- scrollYStore: {
67
- preloadSize: 0,
68
- offsetSize: 0,
69
- visibleSize: 0,
70
- visibleStartIndex: 0,
71
- visibleEndIndex: 0,
72
- startIndex: 0,
73
- endIndex: 0
74
- },
75
- // 表格宽度
76
- tableWidth: 0,
77
- // 表格高度
78
- tableHeight: 0,
79
- customHeight: 0,
80
- customMinHeight: 0,
81
- customMaxHeight: 0,
82
- // 当前 hover 行
83
- hoverRow: null,
84
- // 最后滚动位置
85
- lastScrollLeft: 0,
86
- lastScrollTop: 0,
87
- // 单选框属性,已选中保留的行
88
- radioReserveRow: null,
89
- // 复选框属性,已选中保留的行集合
90
- checkboxReserveRowMap: {},
91
- // 行数据,已展开保留的行集合
92
- rowExpandedReserveRowMap: {},
93
- // 树结构数据,已展开保留的行集合
94
- treeExpandedReserveRowMap: {},
95
- // 树结构数据,不确定状态的集合
96
- treeIndeterminateRowMaps: {},
97
- // 列表完整数据、条件处理后
98
- tableFullData: [],
99
- afterFullData: [],
100
- afterTreeFullData: [],
101
- afterGroupFullData: [],
102
- // 列表条件处理后数据集合
103
- afterFullRowMaps: {},
104
- // 树结构完整数据、条件处理后
105
- tableFullTreeData: [],
106
- // 行分组全量数据、条件处理后
107
- tableFullGroupData: [],
108
- tableSynchData: [],
109
- tableSourceData: [],
110
- // 收集的列配置(带分组)
111
- collectColumn: [],
112
- // 完整所有列(不带分组)
113
- tableFullColumn: [],
114
- // 渲染所有列
115
- visibleColumn: [],
116
- // 全量数据集(包括当前和已删除)
117
- fullAllDataRowIdData: {},
118
- // 数据集(仅当前)
119
- fullDataRowIdData: {},
120
- // 数据集(仅可视)
121
- visibleDataRowIdData: {},
122
- // 渲染中缓存数据
123
- sourceDataRowIdData: {},
124
- fullColumnIdData: {},
125
- fullColumnFieldData: {},
126
- // 合并表头单元格的数据
127
- mergeHeaderList: [],
128
- mergeHeaderMaps: {},
129
- // 已合并单元格数据集合
130
- mergeHeaderCellMaps: {},
131
- // 合并单元格的数据
132
- mergeBodyList: [],
133
- mergeBodyMaps: {},
134
- // 已合并单元格数据集合
135
- mergeBodyCellMaps: {},
136
- // 合并表尾的数据
137
- mergeFooterList: [],
138
- mergeFooterMaps: {},
139
- // 已合并表尾数据集合
140
- mergeFooterCellMaps: {},
141
- // 已展开的行集合
142
- rowExpandedMaps: {},
143
- // 懒加载中的展开行的集合
144
- rowExpandLazyLoadedMaps: {},
145
- // 已展开的分组行
146
- rowGroupExpandedMaps: {},
147
- // 已展开树节点集合
148
- treeExpandedMaps: {},
149
- // 懒加载中的树节点的集合
150
- treeExpandLazyLoadedMaps: {},
151
- // 复选框属性,已选中的行集合
152
- selectCheckboxMaps: {},
153
- // 已标记的对象集
154
- pendingRowMaps: {},
155
- // 已新增的临时行
156
- insertRowMaps: {},
157
- // 已删除行
158
- removeRowMaps: {},
159
- cvCacheMaps: {},
160
- // 表头高度
161
- tHeaderHeight: 0,
162
- // 表体高度
163
- tBodyHeight: 0,
164
- // 表尾高度
165
- tFooterHeight: 0,
166
- teleportToWrapperElem: null,
167
- inited: false,
168
- tooltipTimeout: null,
169
- initStatus: false,
170
- isActivated: false
171
- };
172
- }
173
- const getAllConvertColumns = (columns, parentColumn) => {
174
- const result = [];
175
- columns.forEach(column => {
176
- column.parentId = parentColumn ? parentColumn.id : null;
177
- if (column.visible) {
178
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
179
- result.push(column);
180
- result.push(...getAllConvertColumns(column.children, column));
181
- } else {
182
- result.push(column);
183
- }
184
- }
185
- });
186
- return result;
187
- };
188
- const convertHeaderColumnToRows = originColumns => {
189
- let maxLevel = 1;
190
- const traverse = (column, parent) => {
191
- if (parent) {
192
- column.level = parent.level + 1;
193
- if (maxLevel < column.level) {
194
- maxLevel = column.level;
195
- }
196
- }
197
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
198
- let colSpan = 0;
199
- column.children.forEach(subColumn => {
200
- if (subColumn.visible) {
201
- traverse(subColumn, column);
202
- colSpan += subColumn.colSpan;
203
- }
204
- });
205
- column.colSpan = colSpan;
206
- } else {
207
- column.colSpan = 1;
208
- }
209
- };
210
- originColumns.forEach(column => {
211
- column.level = 1;
212
- traverse(column);
213
- });
214
- const rows = [];
215
- for (let i = 0; i < maxLevel; i++) {
216
- rows.push([]);
217
- }
218
- const allColumns = getAllConvertColumns(originColumns);
219
- allColumns.forEach(column => {
220
- if (column.children && column.children.length && column.children.some(column => column.visible)) {
221
- column.rowSpan = 1;
222
- } else {
223
- column.rowSpan = maxLevel - column.level + 1;
224
- }
225
- rows[column.level - 1].push(column);
226
- });
227
- return rows;
228
- };
229
- exports.convertHeaderColumnToRows = convertHeaderColumnToRows;
230
- function convertHeaderToGridRows(spanColumns) {
231
- const rSize = spanColumns.length;
232
- const cSize = spanColumns[0].reduce((sum, cell) => sum + cell.colSpan, 0);
233
- const occupiedRows = [];
234
- const fullRows = [];
235
- for (let rIndex = 0; rIndex < rSize; rIndex++) {
236
- const oCols = [];
237
- const dCols = [];
238
- for (let cIndex = 0; cIndex < cSize; cIndex++) {
239
- oCols.push(false);
240
- dCols.push('');
241
- }
242
- occupiedRows.push(oCols);
243
- fullRows.push(dCols);
244
- }
245
- for (let rIndex = 0; rIndex < rSize; rIndex++) {
246
- let currColIndex = 0;
247
- for (const column of spanColumns[rIndex]) {
248
- const {
249
- colSpan,
250
- rowSpan
251
- } = column;
252
- let startColIndex = -1;
253
- for (let ccIndex = currColIndex; ccIndex <= cSize - colSpan; ccIndex++) {
254
- let oFlag = true;
255
- for (let csIndex = 0; csIndex < colSpan; csIndex++) {
256
- if (occupiedRows[rIndex][ccIndex + csIndex]) {
257
- oFlag = false;
258
- break;
259
- }
260
- }
261
- if (oFlag) {
262
- startColIndex = ccIndex;
263
- break;
264
- }
265
- }
266
- if (startColIndex === -1) {
267
- for (let j = 0; j <= cSize - colSpan; j++) {
268
- let oFlag = true;
269
- for (let k = 0; k < colSpan; k++) {
270
- if (occupiedRows[rIndex][j + k]) {
271
- oFlag = false;
272
- break;
273
- }
274
- }
275
- if (oFlag) {
276
- startColIndex = j;
277
- break;
278
- }
279
- }
280
- if (startColIndex === -1) {
281
- // error
282
- break;
283
- }
284
- }
285
- for (let srIndex = rIndex; srIndex < rIndex + rowSpan; srIndex++) {
286
- for (let scIndex = startColIndex; scIndex < startColIndex + colSpan; scIndex++) {
287
- occupiedRows[srIndex][scIndex] = true;
288
- fullRows[srIndex][scIndex] = column;
289
- }
290
- }
291
- currColIndex = startColIndex + colSpan;
292
- }
293
- }
294
- return fullRows;
295
- }
296
- function restoreScrollLocation($xeTable, scrollLeft, scrollTop) {
297
- const internalData = $xeTable.internalData;
298
- if (scrollLeft || scrollTop) {
299
- internalData.intoRunScroll = false;
300
- internalData.inVirtualScroll = false;
301
- internalData.inWheelScroll = false;
302
- internalData.inHeaderScroll = false;
303
- internalData.inBodyScroll = false;
304
- internalData.inFooterScroll = false;
305
- internalData.scrollRenderType = '';
306
- // 还原滚动状态
307
- return $xeTable.scrollTo(scrollLeft, scrollTop);
308
- }
309
- return $xeTable.clearScroll();
310
- }
311
- /**
312
- * 生成行的唯一主键
313
- */
314
- function getRowUniqueId() {
315
- return _xeUtils.default.uniqueId('row_');
316
- }
317
- function hasDeepKey(rowKey) {
318
- return rowKey.indexOf('.') > -1;
319
- }
320
- // 行主键 key
321
- function getRowkey($xeTable) {
322
- const {
323
- currKeyField
324
- } = $xeTable.internalData;
325
- return currKeyField;
326
- }
327
- // 行主键 value
328
- function getRowid($xeTable, row) {
329
- const internalData = $xeTable.internalData;
330
- const {
331
- isCurrDeepKey,
332
- currKeyField
333
- } = internalData;
334
- return row ? encodeRowid((isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey)(row, currKeyField)) : '';
335
- }
336
- function createHandleUpdateRowId($xeTable) {
337
- const internalData = $xeTable.internalData;
338
- const {
339
- isCurrDeepKey,
340
- currKeyField
341
- } = internalData;
342
- const updateRId = isCurrDeepKey ? updateDeepRowKey : updateFastRowKey;
343
- return {
344
- rowKey: currKeyField,
345
- handleUpdateRowId(row) {
346
- return row ? updateRId(row, currKeyField) : '';
347
- }
348
- };
349
- }
350
- function createHandleGetRowId($xeTable) {
351
- const internalData = $xeTable.internalData;
352
- const {
353
- isCurrDeepKey,
354
- currKeyField
355
- } = internalData;
356
- const getRId = isCurrDeepKey ? getDeepRowIdByKey : getFastRowIdByKey;
357
- return {
358
- rowKey: currKeyField,
359
- handleGetRowId(row) {
360
- return row ? encodeRowid(getRId(row, currKeyField)) : '';
361
- }
362
- };
363
- }
364
- // 编码行主键
365
- function encodeRowid(rowVal) {
366
- return _xeUtils.default.eqNull(rowVal) ? '' : encodeURIComponent(rowVal);
367
- }
368
- function getDeepRowIdByKey(row, rowKey) {
369
- return _xeUtils.default.get(row, rowKey);
370
- }
371
- function updateDeepRowKey(row, rowKey) {
372
- let rowid = encodeRowid(getDeepRowIdByKey(row, rowKey));
373
- if ((0, _utils.eqEmptyValue)(rowid)) {
374
- rowid = getRowUniqueId();
375
- _xeUtils.default.set(row, rowKey, rowid);
376
- }
377
- return rowid;
378
- }
379
- function getFastRowIdByKey(row, rowKey) {
380
- return row[rowKey];
381
- }
382
- function updateFastRowKey(row, rowKey) {
383
- let rowid = encodeRowid(getFastRowIdByKey(row, rowKey));
384
- if ((0, _utils.eqEmptyValue)(rowid)) {
385
- rowid = getRowUniqueId();
386
- row[rowKey] = rowid;
387
- }
388
- return rowid;
389
- }
390
- function handleFieldOrColumn($xeTable, fieldOrColumn) {
391
- if (fieldOrColumn) {
392
- return _xeUtils.default.isString(fieldOrColumn) || _xeUtils.default.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
393
- }
394
- return null;
395
- }
396
- function handleRowidOrRow($xeTable, rowidOrRow) {
397
- if (rowidOrRow) {
398
- const rowid = _xeUtils.default.isString(rowidOrRow) || _xeUtils.default.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
399
- return $xeTable.getRowById(rowid);
400
- }
401
- return null;
402
- }
403
- function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
404
- return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
405
- }
406
- function getPaddingLeftRightSize(elem) {
407
- if (elem) {
408
- const computedStyle = getComputedStyle(elem);
409
- const paddingLeft = _xeUtils.default.toNumber(computedStyle.paddingLeft);
410
- const paddingRight = _xeUtils.default.toNumber(computedStyle.paddingRight);
411
- return paddingLeft + paddingRight;
412
- }
413
- return 0;
414
- }
415
- function getElementMarginAndWidth(elem) {
416
- if (elem) {
417
- const computedStyle = getComputedStyle(elem);
418
- const marginLeft = _xeUtils.default.toNumber(computedStyle.marginLeft);
419
- const marginRight = _xeUtils.default.toNumber(computedStyle.marginRight);
420
- return elem.offsetWidth + marginLeft + marginRight;
421
- }
422
- return 0;
423
- }
424
- function toFilters(filters) {
425
- if (filters && _xeUtils.default.isArray(filters)) {
426
- return filters.map(({
427
- label,
428
- value,
429
- data,
430
- resetValue,
431
- checked
432
- }) => {
433
- return {
434
- label,
435
- value,
436
- data,
437
- resetValue,
438
- checked: !!checked,
439
- _checked: !!checked
440
- };
441
- });
442
- }
443
- return filters;
444
- }
445
- function toTreePathSeq(path) {
446
- return path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
447
- }
448
- function getCellValue(row, column) {
449
- return _xeUtils.default.get(row, column.field);
450
- }
451
- function setCellValue(row, column, value) {
452
- return _xeUtils.default.set(row, column.field, value);
453
- }
454
- function getRefElem(refEl) {
455
- if (refEl) {
456
- const rest = refEl.value;
457
- if (rest) {
458
- return rest.$el || rest;
459
- }
460
- }
461
- return null;
462
- }
463
- function getCalcHeight(height) {
464
- if (height === 'unset') {
465
- return 0;
466
- }
467
- return height || 0;
468
- }
469
- /**
470
- * 列宽拖动最大宽度
471
- * @param params
472
- * @returns
473
- */
474
- function getColReMaxWidth(params) {
475
- const {
476
- $table
477
- } = params;
478
- const {
479
- computeResizableOpts
480
- } = $table.getComputeMaps();
481
- const resizableOpts = computeResizableOpts.value;
482
- const {
483
- maxWidth: reMaxWidth
484
- } = resizableOpts;
485
- // 如果自定义调整宽度逻辑
486
- if (reMaxWidth) {
487
- const customMaxWidth = _xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
488
- if (customMaxWidth !== 'auto') {
489
- return Math.max(1, _xeUtils.default.toNumber(customMaxWidth));
490
- }
491
- }
492
- return -1;
493
- }
494
- /**
495
- * 列宽拖动最小宽度
496
- * @param params
497
- * @returns
498
- */
499
- function getColReMinWidth(params) {
500
- const {
501
- $table,
502
- column,
503
- cell
504
- } = params;
505
- const tableProps = $table.props;
506
- const internalData = $table.internalData;
507
- const {
508
- computeResizableOpts
509
- } = $table.getComputeMaps();
510
- const resizableOpts = computeResizableOpts.value;
511
- const {
512
- minWidth: reMinWidth
513
- } = resizableOpts;
514
- // 如果自定义调整宽度逻辑
515
- if (reMinWidth) {
516
- const customMinWidth = _xeUtils.default.isFunction(reMinWidth) ? reMinWidth(params) : reMinWidth;
517
- if (customMinWidth !== 'auto') {
518
- return Math.max(1, _xeUtils.default.toNumber(customMinWidth));
519
- }
520
- }
521
- const {
522
- elemStore
523
- } = internalData;
524
- const {
525
- showHeaderOverflow: allColumnHeaderOverflow
526
- } = tableProps;
527
- const {
528
- showHeaderOverflow,
529
- minWidth: colMinWidth
530
- } = column;
531
- const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
532
- const showEllipsis = headOverflow === 'ellipsis';
533
- const showTitle = headOverflow === 'title';
534
- const showTooltip = headOverflow === true || headOverflow === 'tooltip';
535
- const hasEllipsis = showTitle || showTooltip || showEllipsis;
536
- const minTitleWidth = _xeUtils.default.floor((_xeUtils.default.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
537
- const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize((0, _dom.queryElement)(cell, '.vxe-cell'));
538
- let mWidth = minTitleWidth + paddingLeftRight;
539
- // 默认最小宽处理
540
- if (hasEllipsis) {
541
- const dragIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--drag-handle'));
542
- const checkboxIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--checkbox'));
543
- const requiredIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--required-icon'));
544
- const editIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--edit-icon'));
545
- const prefixIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell-title-prefix-icon'));
546
- const suffixIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell-title-suffix-icon'));
547
- const sortIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--sort'));
548
- const filterIconWidth = getElementMarginAndWidth((0, _dom.queryElement)(cell, '.vxe-cell--filter'));
549
- mWidth += dragIconWidth + checkboxIconWidth + requiredIconWidth + editIconWidth + prefixIconWidth + suffixIconWidth + filterIconWidth + sortIconWidth;
550
- }
551
- // 如果设置最小宽
552
- if (colMinWidth) {
553
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
554
- if (bodyScrollElem) {
555
- if ((0, _dom.isScale)(colMinWidth)) {
556
- const bodyWidth = bodyScrollElem.clientWidth - 1;
557
- const meanWidth = bodyWidth / 100;
558
- return Math.max(mWidth, Math.floor(_xeUtils.default.toInteger(colMinWidth) * meanWidth));
559
- } else if ((0, _dom.isPx)(colMinWidth)) {
560
- return Math.max(mWidth, _xeUtils.default.toInteger(colMinWidth));
561
- }
562
- }
563
- }
564
- return mWidth;
565
- }
566
- function isColumnInfo(column) {
567
- return column && (column.constructor === _columnInfo.ColumnInfo || column instanceof _columnInfo.ColumnInfo);
568
- }
569
- // 获取所有的列,排除分组
570
- function getColumnList(columns) {
571
- const result = [];
572
- columns.forEach(column => {
573
- result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
574
- });
575
- return result;
576
- }
577
- function createColumn($xeTable, options, renderOptions) {
578
- return isColumnInfo(options) ? options : (0, _vue.reactive)(new _columnInfo.ColumnInfo($xeTable, options, renderOptions));
579
- }
580
- function watchColumn($xeTable, props, column) {
581
- Object.keys(props).forEach(name => {
582
- (0, _vue.watch)(() => props[name], value => {
583
- column.update(name, value);
584
- if ($xeTable) {
585
- if (name === 'filters') {
586
- $xeTable.setFilter(column, value);
587
- $xeTable.handleUpdateDataQueue();
588
- } else if (['visible', 'fixed', 'width', 'minWidth', 'maxWidth'].includes(name)) {
589
- $xeTable.handleRefreshColumnQueue();
590
- }
591
- }
592
- });
593
- });
594
- }
595
- function assembleColumn($xeTable, elem, column, colgroup) {
596
- const {
597
- reactData
598
- } = $xeTable;
599
- const {
600
- staticColumns
601
- } = reactData;
602
- const parentElem = elem.parentNode;
603
- const parentColumn = colgroup ? colgroup.columnConfig : null;
604
- const parentCols = parentColumn ? parentColumn.children : staticColumns;
605
- if (parentElem && parentCols) {
606
- column.defaultParentId = parentColumn ? parentColumn.id : null;
607
- parentCols.splice(_xeUtils.default.arrayIndexOf(parentElem.children, elem), 0, column);
608
- reactData.staticColumns = staticColumns.slice(0);
609
- }
610
- }
611
- function destroyColumn($xeTable, column) {
612
- const {
613
- reactData
614
- } = $xeTable;
615
- const {
616
- staticColumns
617
- } = reactData;
618
- const matchObj = _xeUtils.default.findTree(staticColumns, item => item.id === column.id, {
619
- children: 'children'
620
- });
621
- if (matchObj) {
622
- matchObj.items.splice(matchObj.index, 1);
623
- }
624
- reactData.staticColumns = staticColumns.slice(0);
625
- }
626
- function getRootColumn($xeTable, column) {
627
- const {
628
- internalData
629
- } = $xeTable;
630
- const {
631
- fullColumnIdData
632
- } = internalData;
633
- if (!column) {
634
- return null;
635
- }
636
- let parentColId = column.parentId;
637
- while (fullColumnIdData[parentColId]) {
638
- const column = fullColumnIdData[parentColId].column;
639
- parentColId = column.parentId;
640
- if (!parentColId) {
641
- return column;
642
- }
643
- }
644
- return column;
645
- }
646
- const lineOffsetSizes = {
647
- mini: 3,
648
- small: 2,
649
- medium: 1,
650
- large: 0
651
- };
652
- const countTreeExpand = (prevRow, params) => {
653
- let count = 1;
654
- if (!prevRow) {
655
- return count;
656
- }
657
- const {
658
- $table
659
- } = params;
660
- const reactData = $table.reactData;
661
- const {
662
- treeExpandedFlag
663
- } = reactData;
664
- const internalData = $table.internalData;
665
- const {
666
- treeExpandedMaps
667
- } = internalData;
668
- const {
669
- computeTreeOpts
670
- } = $table.getComputeMaps();
671
- const treeOpts = computeTreeOpts.value;
672
- const {
673
- transform,
674
- mapChildrenField
675
- } = treeOpts;
676
- const childrenField = treeOpts.children || treeOpts.childrenField;
677
- const rowChildren = prevRow[transform ? mapChildrenField : childrenField];
678
- if (rowChildren && treeExpandedFlag && treeExpandedMaps[getRowid($table, prevRow)]) {
679
- for (let index = 0; index < rowChildren.length; index++) {
680
- count += countTreeExpand(rowChildren[index], params);
681
- }
682
- }
683
- return count;
684
- };
685
- const getOffsetSize = $xeTable => {
686
- const {
687
- computeSize
688
- } = $xeTable.getComputeMaps();
689
- const vSize = computeSize.value;
690
- if (vSize) {
691
- return lineOffsetSizes[vSize] || 0;
692
- }
693
- return 0;
694
- };
695
- exports.getOffsetSize = getOffsetSize;
696
- function calcTreeLine(params, prevRow) {
697
- const {
698
- $table,
699
- row
700
- } = params;
701
- const tableProps = $table.props;
702
- const tableReactData = $table.reactData;
703
- const tableInternalData = $table.internalData;
704
- const {
705
- showOverflow
706
- } = tableProps;
707
- const {
708
- scrollYLoad
709
- } = tableReactData;
710
- const {
711
- fullAllDataRowIdData
712
- } = tableInternalData;
713
- const {
714
- computeRowOpts,
715
- computeCellOpts,
716
- computeDefaultRowHeight
717
- } = $table.getComputeMaps();
718
- const rowOpts = computeRowOpts.value;
719
- const cellOpts = computeCellOpts.value;
720
- const defaultRowHeight = computeDefaultRowHeight.value;
721
- const rowid = getRowid($table, row);
722
- const rowRest = fullAllDataRowIdData[rowid];
723
- const currCellHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
724
- let expandSize = 1;
725
- if (prevRow) {
726
- expandSize = countTreeExpand(prevRow, params);
727
- }
728
- let cellHeight = currCellHeight;
729
- const vnHeight = rowRest.height;
730
- if (scrollYLoad) {
731
- if (!showOverflow) {
732
- cellHeight = vnHeight || currCellHeight;
733
- }
734
- }
735
- return cellHeight * expandSize - (prevRow ? 1 : 12 - getOffsetSize($table));
736
- }
737
- function clearTableDefaultStatus($xeTable) {
738
- const {
739
- props,
740
- internalData
741
- } = $xeTable;
742
- internalData.initStatus = false;
743
- $xeTable.clearSort();
744
- $xeTable.clearCurrentRow();
745
- $xeTable.clearCurrentColumn();
746
- $xeTable.clearRadioRow();
747
- $xeTable.clearRadioReserve();
748
- $xeTable.clearCheckboxRow();
749
- $xeTable.clearCheckboxReserve();
750
- $xeTable.clearRowExpand();
751
- $xeTable.clearTreeExpand();
752
- $xeTable.clearTreeExpandReserve();
753
- $xeTable.clearPendingRow();
754
- if ($xeTable.clearFilter) {
755
- $xeTable.clearFilter();
756
- }
757
- if ($xeTable.clearSelected && (props.keyboardConfig || props.mouseConfig)) {
758
- $xeTable.clearSelected();
759
- }
760
- if ($xeTable.clearCellAreas && props.mouseConfig) {
761
- $xeTable.clearCellAreas();
762
- $xeTable.clearCopyCellArea();
763
- }
764
- return $xeTable.clearScroll();
765
- }
766
- function clearTableAllStatus($xeTable) {
767
- if ($xeTable.clearFilter) {
768
- $xeTable.clearFilter();
769
- }
770
- return clearTableDefaultStatus($xeTable);
771
- }
772
- function rowToVisible($xeTable, row) {
773
- const tableProps = $xeTable.props;
774
- const reactData = $xeTable.reactData;
775
- const internalData = $xeTable.internalData;
776
- const {
777
- computeLeftFixedWidth,
778
- computeRightFixedWidth,
779
- computeRowOpts,
780
- computeCellOpts,
781
- computeDefaultRowHeight
782
- } = $xeTable.getComputeMaps();
783
- const {
784
- showOverflow
785
- } = tableProps;
786
- const {
787
- scrollYLoad,
788
- scrollYTop
789
- } = reactData;
790
- const {
791
- elemStore,
792
- afterFullData,
793
- fullAllDataRowIdData,
794
- isResizeCellHeight
795
- } = internalData;
796
- const rowOpts = computeRowOpts.value;
797
- const cellOpts = computeCellOpts.value;
798
- const defaultRowHeight = computeDefaultRowHeight.value;
799
- const leftFixedWidth = computeLeftFixedWidth.value;
800
- const rightFixedWidth = computeRightFixedWidth.value;
801
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
802
- const rowid = getRowid($xeTable, row);
803
- if (bodyScrollElem) {
804
- const bodyHeight = bodyScrollElem.clientHeight;
805
- const bodyScrollTop = bodyScrollElem.scrollTop;
806
- const trElem = bodyScrollElem.querySelector(`[rowid="${rowid}"]`);
807
- if (trElem) {
808
- const trOffsetTop = trElem.offsetTop + (scrollYLoad ? scrollYTop : 0);
809
- const trHeight = trElem.clientHeight;
810
- // 检测行是否在可视区中
811
- if (trOffsetTop < bodyScrollTop || trOffsetTop > bodyScrollTop + bodyHeight) {
812
- return $xeTable.scrollTo(null, trOffsetTop);
813
- } else if (trOffsetTop + trHeight >= bodyHeight + bodyScrollTop) {
814
- return $xeTable.scrollTo(null, bodyScrollTop + trHeight);
815
- }
816
- } else {
817
- // 如果是虚拟渲染滚动
818
- if (scrollYLoad) {
819
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
820
- if (!isCustomCellHeight && showOverflow) {
821
- return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight);
822
- }
823
- const rowRest = fullAllDataRowIdData[rowid] || {};
824
- const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
825
- const scrollTop = rowRest.oTop;
826
- if (scrollTop < bodyScrollTop) {
827
- return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1);
828
- }
829
- return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - rightFixedWidth - 1));
830
- }
831
- }
832
- }
833
- return Promise.resolve();
834
- }
835
- function colToVisible($xeTable, column, row) {
836
- const reactData = $xeTable.reactData;
837
- const internalData = $xeTable.internalData;
838
- const {
839
- computeLeftFixedWidth,
840
- computeRightFixedWidth
841
- } = $xeTable.getComputeMaps();
842
- const {
843
- scrollXLoad,
844
- scrollXLeft
845
- } = reactData;
846
- const {
847
- elemStore,
848
- visibleColumn
849
- } = internalData;
850
- const leftFixedWidth = computeLeftFixedWidth.value;
851
- const rightFixedWidth = computeRightFixedWidth.value;
852
- const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
853
- if (column.fixed) {
854
- return Promise.resolve();
855
- }
856
- if (bodyScrollElem) {
857
- const bodyWidth = bodyScrollElem.clientWidth;
858
- const bodyScrollLeft = bodyScrollElem.scrollLeft;
859
- let tdElem = null;
860
- if (row) {
861
- const rowid = getRowid($xeTable, row);
862
- tdElem = bodyScrollElem.querySelector(`[rowid="${rowid}"] .${column.id}`);
863
- }
864
- if (!tdElem) {
865
- tdElem = bodyScrollElem.querySelector(`.${column.id}`);
866
- }
867
- if (tdElem) {
868
- const tdOffsetLeft = tdElem.offsetLeft + (scrollXLoad ? scrollXLeft : 0);
869
- const cellWidth = tdElem.clientWidth;
870
- // 检测是否在可视区中
871
- if (tdOffsetLeft < bodyScrollLeft + leftFixedWidth) {
872
- return $xeTable.scrollTo(tdOffsetLeft - leftFixedWidth - 1);
873
- } else if (tdOffsetLeft + cellWidth - bodyScrollLeft > bodyWidth - rightFixedWidth) {
874
- return $xeTable.scrollTo(tdOffsetLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
875
- }
876
- } else {
877
- // 检测是否在虚拟渲染可视区中
878
- if (scrollXLoad) {
879
- let scrollLeft = 0;
880
- const cellWidth = column.renderWidth;
881
- for (let i = 0; i < visibleColumn.length; i++) {
882
- const currCol = visibleColumn[i];
883
- if (currCol === column || currCol.id === column.id) {
884
- break;
885
- }
886
- scrollLeft += currCol.renderWidth;
887
- }
888
- if (scrollLeft < bodyScrollLeft) {
889
- return $xeTable.scrollTo(scrollLeft - leftFixedWidth - 1);
890
- }
891
- return $xeTable.scrollTo(scrollLeft + cellWidth - (bodyWidth - rightFixedWidth - 1));
892
- }
893
- }
894
- }
895
- return Promise.resolve();
896
- }