yy-vue-easytable 2.27.2

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 (205) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +187 -0
  3. package/libs/font/demo.css +539 -0
  4. package/libs/font/demo_index.html +400 -0
  5. package/libs/font/iconfont.css +57 -0
  6. package/libs/font/iconfont.eot +0 -0
  7. package/libs/font/iconfont.js +1 -0
  8. package/libs/font/iconfont.json +79 -0
  9. package/libs/font/iconfont.svg +56 -0
  10. package/libs/font/iconfont.ttf +0 -0
  11. package/libs/font/iconfont.woff +0 -0
  12. package/libs/font/iconfont.woff2 +0 -0
  13. package/libs/locale/lang/af-ZA.js +48 -0
  14. package/libs/locale/lang/en-US.js +48 -0
  15. package/libs/locale/lang/fr-FR.js +48 -0
  16. package/libs/locale/lang/ko-KR.js +48 -0
  17. package/libs/locale/lang/pt-BR.js +48 -0
  18. package/libs/locale/lang/ru-RU.js +48 -0
  19. package/libs/locale/lang/zh-CN.js +48 -0
  20. package/libs/locale/lang/zh-TW.js +48 -0
  21. package/libs/locale/lang/zu-ZA.js +48 -0
  22. package/libs/main.js +1 -0
  23. package/libs/theme-dark/base.css +1 -0
  24. package/libs/theme-dark/index.css +1253 -0
  25. package/libs/theme-dark/var.css +7 -0
  26. package/libs/theme-dark/ve-checkbox.css +150 -0
  27. package/libs/theme-dark/ve-contextmenu.css +71 -0
  28. package/libs/theme-dark/ve-dropdown.css +177 -0
  29. package/libs/theme-dark/ve-icon.css +10 -0
  30. package/libs/theme-dark/ve-loading.css +218 -0
  31. package/libs/theme-dark/ve-pagination.css +136 -0
  32. package/libs/theme-dark/ve-radio.css +111 -0
  33. package/libs/theme-dark/ve-select.css +50 -0
  34. package/libs/theme-dark/ve-table.css +385 -0
  35. package/libs/theme-default/base.css +1 -0
  36. package/libs/theme-default/index.css +1253 -0
  37. package/libs/theme-default/var.css +7 -0
  38. package/libs/theme-default/ve-checkbox.css +150 -0
  39. package/libs/theme-default/ve-contextmenu.css +71 -0
  40. package/libs/theme-default/ve-dropdown.css +177 -0
  41. package/libs/theme-default/ve-icon.css +10 -0
  42. package/libs/theme-default/ve-loading.css +218 -0
  43. package/libs/theme-default/ve-pagination.css +136 -0
  44. package/libs/theme-default/ve-radio.css +111 -0
  45. package/libs/theme-default/ve-select.css +50 -0
  46. package/libs/theme-default/ve-table.css +385 -0
  47. package/libs/umd/index.js +9 -0
  48. package/libs/ve-checkbox-group.js +1 -0
  49. package/libs/ve-checkbox.js +1 -0
  50. package/libs/ve-contextmenu.js +1 -0
  51. package/libs/ve-dropdown.js +1 -0
  52. package/libs/ve-icon.js +1 -0
  53. package/libs/ve-loading.js +1 -0
  54. package/libs/ve-locale.js +1 -0
  55. package/libs/ve-pagination.js +1 -0
  56. package/libs/ve-radio.js +1 -0
  57. package/libs/ve-select.js +1 -0
  58. package/libs/ve-table.js +1 -0
  59. package/package.json +142 -0
  60. package/packages/font/demo.css +539 -0
  61. package/packages/font/demo_index.html +400 -0
  62. package/packages/font/iconfont.css +57 -0
  63. package/packages/font/iconfont.eot +0 -0
  64. package/packages/font/iconfont.js +1 -0
  65. package/packages/font/iconfont.json +79 -0
  66. package/packages/font/iconfont.svg +56 -0
  67. package/packages/font/iconfont.ttf +0 -0
  68. package/packages/font/iconfont.woff +0 -0
  69. package/packages/font/iconfont.woff2 +0 -0
  70. package/packages/index.js +75 -0
  71. package/packages/src/comps/resize-observer/index.js +2 -0
  72. package/packages/src/comps/resize-observer/src/index.jsx +38 -0
  73. package/packages/src/directives/clickoutside.js +31 -0
  74. package/packages/src/directives/events-outside.js +79 -0
  75. package/packages/src/directives/focus.js +28 -0
  76. package/packages/src/locale/index.js +27 -0
  77. package/packages/src/locale/lang/af-ZA.js +29 -0
  78. package/packages/src/locale/lang/en-US.js +30 -0
  79. package/packages/src/locale/lang/fr-FR.js +29 -0
  80. package/packages/src/locale/lang/ko-KR.js +29 -0
  81. package/packages/src/locale/lang/pt-BR.js +29 -0
  82. package/packages/src/locale/lang/ru-RU.js +29 -0
  83. package/packages/src/locale/lang/zh-CN.js +30 -0
  84. package/packages/src/locale/lang/zh-TW.js +29 -0
  85. package/packages/src/locale/lang/zu-ZA.js +29 -0
  86. package/packages/src/mixins/emitter.js +39 -0
  87. package/packages/src/utils/animation-frame.js +39 -0
  88. package/packages/src/utils/auto-resize.js +179 -0
  89. package/packages/src/utils/constant.js +42 -0
  90. package/packages/src/utils/dom.js +239 -0
  91. package/packages/src/utils/event-key-codes.js +53 -0
  92. package/packages/src/utils/hooks-manager.js +76 -0
  93. package/packages/src/utils/index.js +161 -0
  94. package/packages/src/utils/mouse-event.js +24 -0
  95. package/packages/src/utils/random.js +6 -0
  96. package/packages/src/utils/request-animation-timeout.js +36 -0
  97. package/packages/src/utils/resize-event.js +40 -0
  98. package/packages/src/utils/scroll-bar.js +27 -0
  99. package/packages/style/ve-checkbox.less +179 -0
  100. package/packages/style/ve-contextmenu.less +76 -0
  101. package/packages/style/ve-dropdown.less +204 -0
  102. package/packages/style/ve-icon.less +3 -0
  103. package/packages/style/ve-loading.less +242 -0
  104. package/packages/style/ve-pagination.less +153 -0
  105. package/packages/style/ve-radio.less +126 -0
  106. package/packages/style/ve-select.less +48 -0
  107. package/packages/style/ve-table.less +539 -0
  108. package/packages/theme-dark/base.less +1 -0
  109. package/packages/theme-dark/index.less +12 -0
  110. package/packages/theme-dark/var.less +111 -0
  111. package/packages/theme-dark/ve-checkbox.less +2 -0
  112. package/packages/theme-dark/ve-contextmenu.less +2 -0
  113. package/packages/theme-dark/ve-dropdown.less +2 -0
  114. package/packages/theme-dark/ve-icon.less +2 -0
  115. package/packages/theme-dark/ve-loading.less +2 -0
  116. package/packages/theme-dark/ve-pagination.less +2 -0
  117. package/packages/theme-dark/ve-radio.less +2 -0
  118. package/packages/theme-dark/ve-select.less +2 -0
  119. package/packages/theme-dark/ve-table.less +2 -0
  120. package/packages/theme-default/base.less +1 -0
  121. package/packages/theme-default/index.less +12 -0
  122. package/packages/theme-default/var.less +111 -0
  123. package/packages/theme-default/ve-checkbox.less +2 -0
  124. package/packages/theme-default/ve-contextmenu.less +2 -0
  125. package/packages/theme-default/ve-dropdown.less +2 -0
  126. package/packages/theme-default/ve-icon.less +2 -0
  127. package/packages/theme-default/ve-loading.less +2 -0
  128. package/packages/theme-default/ve-pagination.less +2 -0
  129. package/packages/theme-default/ve-radio.less +2 -0
  130. package/packages/theme-default/ve-select.less +2 -0
  131. package/packages/theme-default/ve-table.less +2 -0
  132. package/packages/ve-checkbox/index.js +7 -0
  133. package/packages/ve-checkbox/src/index.jsx +175 -0
  134. package/packages/ve-checkbox/src/util/constant.js +14 -0
  135. package/packages/ve-checkbox/src/util/index.js +10 -0
  136. package/packages/ve-checkbox-group/index.js +7 -0
  137. package/packages/ve-checkbox-group/src/index.jsx +53 -0
  138. package/packages/ve-checkbox-group/src/util/constant.js +14 -0
  139. package/packages/ve-checkbox-group/src/util/index.js +10 -0
  140. package/packages/ve-contextmenu/index.js +7 -0
  141. package/packages/ve-contextmenu/src/index.jsx +731 -0
  142. package/packages/ve-contextmenu/src/util/constant.js +29 -0
  143. package/packages/ve-contextmenu/src/util/index.js +10 -0
  144. package/packages/ve-dropdown/index.js +7 -0
  145. package/packages/ve-dropdown/src/index.jsx +720 -0
  146. package/packages/ve-dropdown/src/util/constant.js +15 -0
  147. package/packages/ve-dropdown/src/util/index.js +10 -0
  148. package/packages/ve-icon/index.js +7 -0
  149. package/packages/ve-icon/src/index.jsx +52 -0
  150. package/packages/ve-icon/src/util/constant.js +10 -0
  151. package/packages/ve-icon/src/util/index.js +10 -0
  152. package/packages/ve-loading/index.js +8 -0
  153. package/packages/ve-loading/src/bounce.jsx +50 -0
  154. package/packages/ve-loading/src/flow.jsx +51 -0
  155. package/packages/ve-loading/src/grid.jsx +57 -0
  156. package/packages/ve-loading/src/index.js +106 -0
  157. package/packages/ve-loading/src/loading.jsx +63 -0
  158. package/packages/ve-loading/src/plane.jsx +38 -0
  159. package/packages/ve-loading/src/pulse.jsx +38 -0
  160. package/packages/ve-loading/src/util/constant.js +31 -0
  161. package/packages/ve-loading/src/util/index.js +10 -0
  162. package/packages/ve-loading/src/wave.jsx +53 -0
  163. package/packages/ve-locale/index.js +28 -0
  164. package/packages/ve-pagination/index.js +7 -0
  165. package/packages/ve-pagination/src/index.jsx +304 -0
  166. package/packages/ve-pagination/src/pager.jsx +166 -0
  167. package/packages/ve-pagination/src/util/constant.js +16 -0
  168. package/packages/ve-pagination/src/util/index.js +10 -0
  169. package/packages/ve-radio/index.js +7 -0
  170. package/packages/ve-radio/src/index.jsx +121 -0
  171. package/packages/ve-radio/src/util/constant.js +13 -0
  172. package/packages/ve-radio/src/util/index.js +10 -0
  173. package/packages/ve-select/index.js +7 -0
  174. package/packages/ve-select/src/index.jsx +193 -0
  175. package/packages/ve-select/src/util/constant.js +13 -0
  176. package/packages/ve-select/src/util/index.js +10 -0
  177. package/packages/ve-table/index.js +7 -0
  178. package/packages/ve-table/src/body/body-checkbox-content.jsx +126 -0
  179. package/packages/ve-table/src/body/body-radio-content.jsx +113 -0
  180. package/packages/ve-table/src/body/body-td.jsx +671 -0
  181. package/packages/ve-table/src/body/body-tr-scrolling.jsx +38 -0
  182. package/packages/ve-table/src/body/body-tr.jsx +383 -0
  183. package/packages/ve-table/src/body/expand-tr-icon.jsx +80 -0
  184. package/packages/ve-table/src/body/expand-tr.jsx +147 -0
  185. package/packages/ve-table/src/body/index.jsx +943 -0
  186. package/packages/ve-table/src/colgroup/index.jsx +48 -0
  187. package/packages/ve-table/src/column-resizer/index.jsx +318 -0
  188. package/packages/ve-table/src/editor/constant.js +5 -0
  189. package/packages/ve-table/src/editor/index.jsx +533 -0
  190. package/packages/ve-table/src/footer/footer-td.jsx +396 -0
  191. package/packages/ve-table/src/footer/footer-tr.jsx +249 -0
  192. package/packages/ve-table/src/footer/index.jsx +108 -0
  193. package/packages/ve-table/src/header/header-checkbox-content.jsx +69 -0
  194. package/packages/ve-table/src/header/header-filter-content.jsx +100 -0
  195. package/packages/ve-table/src/header/header-filter-custom-content.jsx +110 -0
  196. package/packages/ve-table/src/header/header-th.jsx +664 -0
  197. package/packages/ve-table/src/header/header-tr.jsx +255 -0
  198. package/packages/ve-table/src/header/index.jsx +195 -0
  199. package/packages/ve-table/src/index.jsx +4196 -0
  200. package/packages/ve-table/src/selection/constant.js +5 -0
  201. package/packages/ve-table/src/selection/index.jsx +1643 -0
  202. package/packages/ve-table/src/util/clipboard.js +428 -0
  203. package/packages/ve-table/src/util/constant.js +269 -0
  204. package/packages/ve-table/src/util/index.js +1585 -0
  205. package/packages/ve-table/src/util/store.js +14 -0
@@ -0,0 +1,671 @@
1
+ import BodyCheckboxContent from "./body-checkbox-content";
2
+ import BodyRadioContent from "./body-radio-content";
3
+ import ExpandTrIcon from "./expand-tr-icon";
4
+ import { clsName, getRowKeysByRangeRowKeys } from "../util";
5
+ import { isNumber, isBoolean, isEmptyValue } from "../../../src/utils/index.js";
6
+
7
+ import {
8
+ COMPS_NAME,
9
+ COLUMN_TYPES,
10
+ EXPAND_TRIGGER_TYPES,
11
+ EMIT_EVENTS,
12
+ COMPS_CUSTOM_ATTRS,
13
+ } from "../util/constant";
14
+ import emitter from "../../../src/mixins/emitter";
15
+
16
+ export default {
17
+ name: COMPS_NAME.VE_TABLE_BODY_TD,
18
+ mixins: [emitter],
19
+ props: {
20
+ rowData: {
21
+ type: Object,
22
+ required: true,
23
+ },
24
+ column: {
25
+ type: Object,
26
+ required: true,
27
+ },
28
+ columnCollection: {
29
+ type: Array,
30
+ required: true,
31
+ },
32
+ rowIndex: {
33
+ type: Number,
34
+ required: true,
35
+ },
36
+ colgroups: {
37
+ type: Array,
38
+ required: true,
39
+ },
40
+ rowKeyFieldName: {
41
+ type: String,
42
+ default: null,
43
+ },
44
+ allRowKeys: {
45
+ type: Array,
46
+ required: true,
47
+ },
48
+ /*
49
+ expand
50
+ */
51
+ // expand row option
52
+ expandOption: {
53
+ type: Object,
54
+ default: function () {
55
+ return null;
56
+ },
57
+ },
58
+ // is expand row
59
+ isExpandRow: {
60
+ type: Boolean,
61
+ required: true,
62
+ },
63
+ // expanded row keys
64
+ expandedRowkeys: {
65
+ type: Array,
66
+ default: function () {
67
+ return [];
68
+ },
69
+ },
70
+
71
+ /*
72
+ checkbox
73
+ */
74
+ // checkbox option
75
+ checkboxOption: {
76
+ type: Object,
77
+ default: function () {
78
+ return null;
79
+ },
80
+ },
81
+ internalCheckboxSelectedRowKeys: {
82
+ type: Array,
83
+ default: function () {
84
+ return null;
85
+ },
86
+ },
87
+
88
+ /*
89
+ radio
90
+ */
91
+ radioOption: {
92
+ type: Object,
93
+ default: function () {
94
+ return null;
95
+ },
96
+ },
97
+ internalRadioSelectedRowKey: {
98
+ type: [String, Number],
99
+ default: null,
100
+ },
101
+ // cell style option
102
+ cellStyleOption: {
103
+ type: Object,
104
+ default: function () {
105
+ return null;
106
+ },
107
+ },
108
+ // event custom option
109
+ eventCustomOption: {
110
+ type: Object,
111
+ default: function () {
112
+ return null;
113
+ },
114
+ },
115
+ // cell selection data
116
+ cellSelectionData: {
117
+ type: Object,
118
+ default: function () {
119
+ return null;
120
+ },
121
+ },
122
+ // cell selection range data
123
+ cellSelectionRangeData: {
124
+ type: Object,
125
+ default: function () {
126
+ return null;
127
+ },
128
+ },
129
+ bodyIndicatorRowKeys: {
130
+ type: Object,
131
+ default: function () {
132
+ return null;
133
+ },
134
+ },
135
+ // cell span option
136
+ cellSpanOption: {
137
+ type: Object,
138
+ default: function () {
139
+ return null;
140
+ },
141
+ },
142
+ // edit opttion
143
+ editOption: {
144
+ type: Object,
145
+ default: function () {
146
+ return null;
147
+ },
148
+ },
149
+ },
150
+ data() {
151
+ return {
152
+ // 原始单元格数据
153
+ rawCellValue: "",
154
+ };
155
+ },
156
+ computed: {
157
+ /*
158
+ current column collection item
159
+ 1、Cache the style、class of each column
160
+ */
161
+ currentColumnCollectionItem() {
162
+ const { columnCollection, column } = this;
163
+ return columnCollection.find((x) => x.colKey === column.key);
164
+ },
165
+
166
+ // current row key
167
+ currentRowKey() {
168
+ const { rowData, rowKeyFieldName } = this;
169
+ return rowData[rowKeyFieldName];
170
+ },
171
+ },
172
+ watch: {
173
+ // watch row data
174
+ rowData: {
175
+ handler(rowData) {
176
+ const column = this.column;
177
+ if (column) {
178
+ this.rawCellValue = rowData[column.field];
179
+ }
180
+ },
181
+ deep: true,
182
+ immediate: true,
183
+ },
184
+ },
185
+ methods: {
186
+ /*
187
+ * @bodyTdStyle
188
+ * @desc body td style
189
+ */
190
+ bodyTdStyle() {
191
+ const { currentColumnCollectionItem } = this;
192
+
193
+ let result = {};
194
+
195
+ if (currentColumnCollectionItem) {
196
+ result = Object.assign(
197
+ result,
198
+ currentColumnCollectionItem.style,
199
+ );
200
+ }
201
+
202
+ return result;
203
+ },
204
+
205
+ /*
206
+ * @bodyTdClass
207
+ * @desc body td class
208
+ */
209
+ bodyTdClass() {
210
+ const { currentColumnCollectionItem } = this;
211
+
212
+ const { fixed, operationColumn } = this.column;
213
+
214
+ let result = {
215
+ [clsName("body-td")]: true,
216
+ };
217
+
218
+ const {
219
+ cellStyleOption,
220
+ rowData,
221
+ column,
222
+ rowIndex,
223
+ allRowKeys,
224
+ cellSelectionData,
225
+ cellSelectionRangeData,
226
+ bodyIndicatorRowKeys,
227
+ currentRowKey,
228
+ } = this;
229
+
230
+ // column fixed
231
+ if (fixed) {
232
+ result[clsName("fixed-left")] = fixed === "left";
233
+ result[clsName("fixed-right")] = fixed === "right";
234
+ }
235
+
236
+ // operation column
237
+ if (operationColumn) {
238
+ result[clsName("operation-col")] = true;
239
+ }
240
+
241
+ // cell style option
242
+ if (
243
+ cellStyleOption &&
244
+ typeof cellStyleOption.bodyCellClass === "function"
245
+ ) {
246
+ const customClass = cellStyleOption.bodyCellClass({
247
+ row: rowData,
248
+ column,
249
+ rowIndex,
250
+ });
251
+ if (customClass) {
252
+ result[customClass] = true;
253
+ }
254
+ }
255
+
256
+ if (cellSelectionData) {
257
+ const { rowKey, colKey } = cellSelectionData.currentCell;
258
+
259
+ if (!isEmptyValue(rowKey) && !isEmptyValue(colKey)) {
260
+ if (currentRowKey === rowKey) {
261
+ // cell selection
262
+ if (column["key"] === colKey) {
263
+ result[clsName("cell-selection")] = true;
264
+ }
265
+ }
266
+
267
+ if (operationColumn) {
268
+ const { topRowKey, bottomRowKey } =
269
+ cellSelectionRangeData;
270
+ const { startRowKeyIndex } = bodyIndicatorRowKeys;
271
+ const isIndicatorActive = startRowKeyIndex > -1;
272
+
273
+ let indicatorRowKeys = [];
274
+ if (topRowKey === bottomRowKey) {
275
+ indicatorRowKeys = [topRowKey];
276
+ } else {
277
+ indicatorRowKeys = getRowKeysByRangeRowKeys({
278
+ topRowKey,
279
+ bottomRowKey,
280
+ allRowKeys,
281
+ });
282
+ }
283
+
284
+ // cell indicator (operation column)
285
+ if (indicatorRowKeys.indexOf(currentRowKey) > -1) {
286
+ if (isIndicatorActive) {
287
+ result[clsName("cell-indicator-active")] = true;
288
+ } else {
289
+ result[clsName("cell-indicator")] = true;
290
+ }
291
+ }
292
+ }
293
+ }
294
+ }
295
+
296
+ if (currentColumnCollectionItem) {
297
+ result = Object.assign(
298
+ result,
299
+ currentColumnCollectionItem.class,
300
+ );
301
+ }
302
+
303
+ return result;
304
+ },
305
+
306
+ // get ellipsis content style
307
+ getEllipsisContentStyle() {
308
+ let result = {};
309
+
310
+ const { ellipsis } = this.column;
311
+
312
+ if (ellipsis) {
313
+ const { lineClamp } = ellipsis;
314
+
315
+ let _lineClamp = isNumber(lineClamp) ? lineClamp : 1;
316
+ result["-webkit-line-clamp"] = _lineClamp;
317
+ }
318
+
319
+ return result;
320
+ },
321
+
322
+ // get render content
323
+ getRenderContent(h) {
324
+ let content = null;
325
+
326
+ const { column, rowData, rowIndex, rawCellValue } = this;
327
+
328
+ // has render function
329
+ if (typeof column.renderBodyCell === "function") {
330
+ const renderResult = column.renderBodyCell(
331
+ {
332
+ row: rowData,
333
+ column,
334
+ rowIndex,
335
+ },
336
+ h,
337
+ );
338
+
339
+ content = renderResult;
340
+ } else {
341
+ content = rawCellValue;
342
+ }
343
+
344
+ // ellipisis
345
+ if (column.ellipsis) {
346
+ const { showTitle } = column.ellipsis;
347
+
348
+ // default true
349
+ const isShowTitle = isBoolean(showTitle) ? showTitle : true;
350
+
351
+ content = (
352
+ <span
353
+ title={isShowTitle ? content : ""}
354
+ style={this.getEllipsisContentStyle()}
355
+ class={clsName("body-td-span-ellipsis")}
356
+ >
357
+ {content}
358
+ </span>
359
+ );
360
+ }
361
+
362
+ return content;
363
+ },
364
+
365
+ // get chcekbox content
366
+ getCheckboxContent() {
367
+ if (this.column.type === COLUMN_TYPES.CHECKBOX) {
368
+ // checkbox content props
369
+ const checkboxProps = {
370
+ props: {
371
+ column: this.column,
372
+ checkboxOption: this.checkboxOption,
373
+ rowKey: this.rowData[this.rowKeyFieldName],
374
+ internalCheckboxSelectedRowKeys:
375
+ this.internalCheckboxSelectedRowKeys,
376
+ },
377
+ };
378
+
379
+ return <BodyCheckboxContent {...checkboxProps} />;
380
+ }
381
+ return null;
382
+ },
383
+
384
+ // get radio content
385
+ getRadioContent() {
386
+ if (this.column.type === COLUMN_TYPES.RADIO) {
387
+ // radio props
388
+ const radioProps = {
389
+ props: {
390
+ column: this.column,
391
+ radioOption: this.radioOption,
392
+ rowKey: this.rowData[this.rowKeyFieldName],
393
+ internalRadioSelectedRowKey:
394
+ this.internalRadioSelectedRowKey,
395
+ },
396
+ };
397
+
398
+ return <BodyRadioContent {...radioProps} />;
399
+ }
400
+ return null;
401
+ },
402
+
403
+ // get cell span
404
+ getCellSpan() {
405
+ const { cellSpanOption, rowData, column, rowIndex } = this;
406
+ let rowspan = 1;
407
+ let colspan = 1;
408
+
409
+ if (cellSpanOption) {
410
+ const { bodyCellSpan } = cellSpanOption;
411
+
412
+ if (typeof bodyCellSpan === "function") {
413
+ const result = bodyCellSpan({
414
+ row: rowData,
415
+ column,
416
+ rowIndex,
417
+ });
418
+
419
+ if (typeof result === "object") {
420
+ rowspan = result.rowspan;
421
+ colspan = result.colspan;
422
+ }
423
+ }
424
+ }
425
+
426
+ return { rowspan, colspan };
427
+ },
428
+ // cell click
429
+ cellClick(e, fn) {
430
+ fn && fn(e);
431
+
432
+ const { column, expandOption, rowData } = this;
433
+
434
+ this.dispatch(COMPS_NAME.VE_TABLE, EMIT_EVENTS.BODY_CELL_CLICK, {
435
+ event: e,
436
+ rowData,
437
+ column,
438
+ });
439
+
440
+ if (column.type !== COLUMN_TYPES.EXPAND) {
441
+ return false;
442
+ }
443
+
444
+ if (expandOption) {
445
+ const eventTargetName = e.target.nodeName;
446
+
447
+ const trigger = expandOption.trigger;
448
+
449
+ // expand row by click icon
450
+ if (!trigger || trigger === EXPAND_TRIGGER_TYPES.ICON) {
451
+ if (eventTargetName !== "TD") {
452
+ e.stopPropagation();
453
+ this.$emit(EMIT_EVENTS.EXPAND_ROW_CHANGE);
454
+ }
455
+ }
456
+ // expand row by click cell(td)
457
+ else if (trigger === EXPAND_TRIGGER_TYPES.CELL) {
458
+ e.stopPropagation();
459
+ this.$emit(EMIT_EVENTS.EXPAND_ROW_CHANGE);
460
+ }
461
+ }
462
+ },
463
+ // dblclick
464
+ cellDblclick(e, fn) {
465
+ fn && fn(e);
466
+
467
+ const { column, rowData } = this;
468
+
469
+ this.dispatch(
470
+ COMPS_NAME.VE_TABLE,
471
+ EMIT_EVENTS.BODY_CELL_DOUBLE_CLICK,
472
+ {
473
+ event: e,
474
+ rowData,
475
+ column,
476
+ },
477
+ );
478
+ },
479
+ // contextmenu
480
+ cellContextmenu(e, fn) {
481
+ fn && fn(e);
482
+
483
+ const { column, rowData } = this;
484
+
485
+ this.dispatch(
486
+ COMPS_NAME.VE_TABLE,
487
+ EMIT_EVENTS.BODY_CELL_CONTEXTMENU,
488
+ {
489
+ event: e,
490
+ rowData,
491
+ column,
492
+ },
493
+ );
494
+ },
495
+ // mouseenter
496
+ cellMouseenter(e, fn) {
497
+ fn && fn(e);
498
+ },
499
+ // mouseleave
500
+ cellMouseleave(e, fn) {
501
+ fn && fn(e);
502
+ },
503
+ // mousemove
504
+ cellMousemove(e, fn) {
505
+ fn && fn(e);
506
+
507
+ const { column, rowData } = this;
508
+
509
+ this.dispatch(
510
+ COMPS_NAME.VE_TABLE,
511
+ EMIT_EVENTS.BODY_CELL_MOUSEMOVE,
512
+ {
513
+ event: e,
514
+ rowData,
515
+ column,
516
+ },
517
+ );
518
+ },
519
+ // mouseover
520
+ cellMouseover(e, fn) {
521
+ fn && fn(e);
522
+
523
+ const { column, rowData } = this;
524
+
525
+ this.dispatch(
526
+ COMPS_NAME.VE_TABLE,
527
+ EMIT_EVENTS.BODY_CELL_MOUSEOVER,
528
+ {
529
+ event: e,
530
+ rowData,
531
+ column,
532
+ },
533
+ );
534
+ },
535
+ // mousedown
536
+ cellMousedown(e, fn) {
537
+ fn && fn(e);
538
+
539
+ const { column, rowData } = this;
540
+
541
+ this.dispatch(
542
+ COMPS_NAME.VE_TABLE,
543
+ EMIT_EVENTS.BODY_CELL_MOUSEDOWN,
544
+ {
545
+ event: e,
546
+ rowData,
547
+ column,
548
+ },
549
+ );
550
+ },
551
+ // mouseup
552
+ cellMouseup(e, fn) {
553
+ fn && fn(e);
554
+
555
+ const { column, rowData } = this;
556
+
557
+ this.dispatch(COMPS_NAME.VE_TABLE, EMIT_EVENTS.BODY_CELL_MOUSEUP, {
558
+ event: e,
559
+ rowData,
560
+ column,
561
+ });
562
+ },
563
+ },
564
+ render(h) {
565
+ const {
566
+ column,
567
+ cellClick,
568
+ rowData,
569
+ isExpandRow,
570
+ expandOption,
571
+ expandedRowkeys,
572
+ rowKeyFieldName,
573
+ eventCustomOption,
574
+ rowIndex,
575
+ } = this;
576
+
577
+ // expand icon props
578
+ const expandIconProps = {
579
+ props: {
580
+ rowData,
581
+ column,
582
+ expandOption,
583
+ expandedRowkeys,
584
+ rowKeyFieldName,
585
+ cellClick,
586
+ },
587
+ };
588
+
589
+ const { rowspan, colspan } = this.getCellSpan();
590
+ if (!rowspan || !colspan) {
591
+ return null;
592
+ }
593
+
594
+ // custom on cell event
595
+ let customEvents = {};
596
+ if (eventCustomOption) {
597
+ const { bodyCellEvents } = eventCustomOption;
598
+
599
+ customEvents = bodyCellEvents
600
+ ? bodyCellEvents({ row: rowData, column, rowIndex })
601
+ : {};
602
+ }
603
+
604
+ const {
605
+ click,
606
+ dblclick,
607
+ contextmenu,
608
+ mouseenter,
609
+ mouseleave,
610
+ mousemove,
611
+ mouseover,
612
+ mousedown,
613
+ mouseup,
614
+ } = customEvents;
615
+
616
+ const events = {
617
+ click: (e) => {
618
+ this.cellClick(e, click);
619
+ },
620
+ dblclick: (e) => {
621
+ this.cellDblclick(e, dblclick);
622
+ },
623
+ contextmenu: (e) => {
624
+ this.cellContextmenu(e, contextmenu);
625
+ },
626
+ mouseenter: (e) => {
627
+ this.cellMouseenter(e, mouseenter);
628
+ },
629
+ mouseleave: (e) => {
630
+ this.cellMouseleave(e, mouseleave);
631
+ },
632
+ mousemove: (e) => {
633
+ this.cellMousemove(e, mousemove);
634
+ },
635
+ mouseover: (e) => {
636
+ this.cellMouseover(e, mouseover);
637
+ },
638
+ mousedown: (e) => {
639
+ this.cellMousedown(e, mousedown);
640
+ },
641
+ mouseup: (e) => {
642
+ this.cellMouseup(e, mouseup);
643
+ },
644
+ };
645
+
646
+ // td props
647
+ const tdProps = {
648
+ class: this.bodyTdClass(),
649
+ style: this.bodyTdStyle(),
650
+ attrs: {
651
+ rowspan,
652
+ colspan,
653
+ [COMPS_CUSTOM_ATTRS.BODY_COLUMN_KEY]: column.key,
654
+ },
655
+ on: events,
656
+ };
657
+
658
+ return (
659
+ <td {...tdProps}>
660
+ {/* expadn tr icon */}
661
+ {isExpandRow && <ExpandTrIcon {...expandIconProps} />}
662
+ {/* checkbox content */}
663
+ {this.getCheckboxContent()}
664
+ {/* radio content */}
665
+ {this.getRadioContent()}
666
+ {/* other cell content */}
667
+ {this.getRenderContent(h)}
668
+ </td>
669
+ );
670
+ },
671
+ };
@@ -0,0 +1,38 @@
1
+ import { clsName } from "../util";
2
+ import { COMPS_NAME } from "../util/constant";
3
+ export default {
4
+ name: COMPS_NAME.VE_TABLE_BODY_TR_SCROLLING,
5
+ props: {
6
+ colgroups: {
7
+ type: Array,
8
+ required: true,
9
+ },
10
+ },
11
+ computed: {
12
+ // tr class
13
+ trClass() {
14
+ let result = null;
15
+
16
+ result = {
17
+ [clsName("body-tr")]: true,
18
+ [clsName("body-row-scrolling")]: true,
19
+ };
20
+
21
+ return result;
22
+ },
23
+ },
24
+
25
+ render() {
26
+ const { colgroups } = this;
27
+
28
+ const props = {
29
+ class: this.trClass,
30
+ };
31
+
32
+ return (
33
+ <tr {...props}>
34
+ <td colSpan={colgroups.length}></td>
35
+ </tr>
36
+ );
37
+ },
38
+ };