vxe-table 3.11.27-beta.0 → 3.11.27

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 (135) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +1 -1
  4. package/es/locale/lang/de-DE.js +1 -1
  5. package/es/locale/lang/en-US.js +1 -1
  6. package/es/locale/lang/es-ES.js +1 -1
  7. package/es/locale/lang/fr-FR.js +1 -1
  8. package/es/locale/lang/hu-HU.js +1 -1
  9. package/es/locale/lang/hy-AM.js +1 -1
  10. package/es/locale/lang/ja-JP.js +1 -1
  11. package/es/locale/lang/ko-KR.js +1 -1
  12. package/es/locale/lang/nb-NO.js +1 -1
  13. package/es/locale/lang/pt-BR.js +1 -1
  14. package/es/locale/lang/ru-RU.js +1 -1
  15. package/es/locale/lang/ug-CN.js +1 -1
  16. package/es/locale/lang/uk-UA.js +1 -1
  17. package/es/locale/lang/vi-VN.js +1 -1
  18. package/es/locale/lang/zh-CHT.js +1 -1
  19. package/es/locale/lang/zh-CN.js +1 -1
  20. package/es/style.css +1 -1
  21. package/es/style.min.css +1 -1
  22. package/es/table/module/custom/mixin.js +2 -0
  23. package/es/table/module/custom/panel.js +436 -231
  24. package/es/table/src/body.js +1 -1
  25. package/es/table/src/methods.js +1 -4
  26. package/es/table/src/table.js +4 -1
  27. package/es/table/style.css +110 -40
  28. package/es/table/style.min.css +1 -1
  29. package/es/ui/index.js +1 -1
  30. package/es/ui/src/dom.js +1 -0
  31. package/es/ui/src/log.js +1 -1
  32. package/es/vxe-table/style.css +110 -40
  33. package/es/vxe-table/style.min.css +1 -1
  34. package/lib/index.css +1 -1
  35. package/lib/index.min.css +1 -1
  36. package/lib/index.umd.js +381 -165
  37. package/lib/index.umd.min.js +1 -1
  38. package/lib/locale/lang/ar-EG.js +1 -1
  39. package/lib/locale/lang/ar-EG.min.js +1 -1
  40. package/lib/locale/lang/de-DE.js +1 -1
  41. package/lib/locale/lang/de-DE.min.js +1 -1
  42. package/lib/locale/lang/en-US.js +1 -1
  43. package/lib/locale/lang/en-US.min.js +1 -1
  44. package/lib/locale/lang/en-US.umd.js +1 -1
  45. package/lib/locale/lang/es-ES.js +1 -1
  46. package/lib/locale/lang/es-ES.min.js +1 -1
  47. package/lib/locale/lang/es-ES.umd.js +1 -1
  48. package/lib/locale/lang/fr-FR.js +1 -1
  49. package/lib/locale/lang/fr-FR.min.js +1 -1
  50. package/lib/locale/lang/hu-HU.js +1 -1
  51. package/lib/locale/lang/hu-HU.min.js +1 -1
  52. package/lib/locale/lang/hu-HU.umd.js +1 -1
  53. package/lib/locale/lang/hy-AM.js +1 -1
  54. package/lib/locale/lang/hy-AM.min.js +1 -1
  55. package/lib/locale/lang/ja-JP.js +1 -1
  56. package/lib/locale/lang/ja-JP.min.js +1 -1
  57. package/lib/locale/lang/ja-JP.umd.js +1 -1
  58. package/lib/locale/lang/ko-KR.js +1 -1
  59. package/lib/locale/lang/ko-KR.min.js +1 -1
  60. package/lib/locale/lang/ko-KR.umd.js +1 -1
  61. package/lib/locale/lang/nb-NO.js +1 -1
  62. package/lib/locale/lang/nb-NO.min.js +1 -1
  63. package/lib/locale/lang/pt-BR.js +1 -1
  64. package/lib/locale/lang/pt-BR.min.js +1 -1
  65. package/lib/locale/lang/pt-BR.umd.js +1 -1
  66. package/lib/locale/lang/ru-RU.js +1 -1
  67. package/lib/locale/lang/ru-RU.min.js +1 -1
  68. package/lib/locale/lang/ru-RU.umd.js +1 -1
  69. package/lib/locale/lang/ug-CN.js +1 -1
  70. package/lib/locale/lang/ug-CN.min.js +1 -1
  71. package/lib/locale/lang/uk-UA.js +1 -1
  72. package/lib/locale/lang/uk-UA.min.js +1 -1
  73. package/lib/locale/lang/uk-UA.umd.js +1 -1
  74. package/lib/locale/lang/vi-VN.js +1 -1
  75. package/lib/locale/lang/vi-VN.min.js +1 -1
  76. package/lib/locale/lang/zh-CHT.js +1 -1
  77. package/lib/locale/lang/zh-CHT.min.js +1 -1
  78. package/lib/locale/lang/zh-CHT.umd.js +1 -1
  79. package/lib/locale/lang/zh-CN.js +1 -1
  80. package/lib/locale/lang/zh-CN.min.js +1 -1
  81. package/lib/locale/lang/zh-CN.umd.js +1 -1
  82. package/lib/style.css +1 -1
  83. package/lib/style.min.css +1 -1
  84. package/lib/table/module/custom/mixin.js +2 -0
  85. package/lib/table/module/custom/mixin.min.js +1 -1
  86. package/lib/table/module/custom/panel.js +369 -156
  87. package/lib/table/module/custom/panel.min.js +1 -1
  88. package/lib/table/src/body.js +1 -1
  89. package/lib/table/src/body.min.js +1 -1
  90. package/lib/table/src/methods.js +2 -5
  91. package/lib/table/src/methods.min.js +1 -1
  92. package/lib/table/src/table.js +4 -1
  93. package/lib/table/src/table.min.js +1 -1
  94. package/lib/table/style/style.css +110 -40
  95. package/lib/table/style/style.min.css +1 -1
  96. package/lib/ui/index.js +1 -1
  97. package/lib/ui/index.min.js +1 -1
  98. package/lib/ui/src/dom.js +2 -0
  99. package/lib/ui/src/dom.min.js +1 -1
  100. package/lib/ui/src/log.js +1 -1
  101. package/lib/ui/src/log.min.js +1 -1
  102. package/lib/vxe-table/style/style.css +110 -40
  103. package/lib/vxe-table/style/style.min.css +1 -1
  104. package/package.json +2 -2
  105. package/packages/locale/lang/ar-EG.ts +1 -1
  106. package/packages/locale/lang/de-DE.ts +1 -1
  107. package/packages/locale/lang/en-US.ts +1 -1
  108. package/packages/locale/lang/es-ES.ts +1 -1
  109. package/packages/locale/lang/fr-FR.ts +1 -1
  110. package/packages/locale/lang/hu-HU.ts +1 -1
  111. package/packages/locale/lang/hy-AM.ts +1 -1
  112. package/packages/locale/lang/ja-JP.ts +1 -1
  113. package/packages/locale/lang/ko-KR.ts +1 -1
  114. package/packages/locale/lang/nb-NO.ts +1 -1
  115. package/packages/locale/lang/pt-BR.ts +1 -1
  116. package/packages/locale/lang/ru-RU.ts +1 -1
  117. package/packages/locale/lang/ug-CN.ts +1 -1
  118. package/packages/locale/lang/uk-UA.ts +1 -1
  119. package/packages/locale/lang/vi-VN.ts +1 -1
  120. package/packages/locale/lang/zh-CHT.ts +1 -1
  121. package/packages/locale/lang/zh-CN.ts +1 -1
  122. package/packages/table/module/custom/mixin.ts +2 -0
  123. package/packages/table/module/custom/panel.ts +463 -234
  124. package/packages/table/src/body.ts +1 -1
  125. package/packages/table/src/methods.ts +1 -5
  126. package/packages/table/src/table.ts +4 -1
  127. package/packages/ui/src/dom.ts +2 -0
  128. package/styles/components/table-module/custom.scss +95 -13
  129. package/styles/components/table.scss +6 -2
  130. /package/es/{iconfont.1733931178504.ttf → iconfont.1734055169729.ttf} +0 -0
  131. /package/es/{iconfont.1733931178504.woff → iconfont.1734055169729.woff} +0 -0
  132. /package/es/{iconfont.1733931178504.woff2 → iconfont.1734055169729.woff2} +0 -0
  133. /package/lib/{iconfont.1733931178504.ttf → iconfont.1734055169729.ttf} +0 -0
  134. /package/lib/{iconfont.1733931178504.woff → iconfont.1734055169729.woff} +0 -0
  135. /package/lib/{iconfont.1733931178504.woff2 → iconfont.1734055169729.woff2} +0 -0
@@ -1,24 +1,85 @@
1
1
  import { VxeUI } from '../../../ui';
2
2
  import { formatText } from '../../../ui/src/utils';
3
- import { addClass, removeClass } from '../../../ui/src/dom';
3
+ import { tpImg, addClass, removeClass } from '../../../ui/src/dom';
4
4
  import { errLog } from '../../../ui/src/log';
5
5
  import XEUtils from 'xe-utils';
6
6
  const { getI18n, getIcon, renderEmptyElement } = VxeUI;
7
- function updateDropHint(_vm, evnt) {
8
- const { $refs } = _vm;
9
- const dragHintEl = $refs.dragHintElemRef;
10
- const bodyEl = $refs.bodyElemRef;
11
- if (!bodyEl) {
7
+ function showDropTip(_vm, evnt, optEl, showLine, dragPos) {
8
+ const { prevDragToChild } = _vm;
9
+ const el = _vm.$refs.bodyElemRef;
10
+ if (!el) {
12
11
  return;
13
12
  }
14
- if (dragHintEl) {
15
- const wrapperEl = bodyEl.parentNode;
16
- const wrapperRect = wrapperEl.getBoundingClientRect();
17
- dragHintEl.style.display = 'block';
18
- dragHintEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - dragHintEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
19
- dragHintEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - dragHintEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
13
+ const wrapperRect = el.getBoundingClientRect();
14
+ if (optEl) {
15
+ const dragLineEl = _vm.$refs.refDragLineElem;
16
+ if (dragLineEl) {
17
+ if (showLine) {
18
+ const optRect = optEl.getBoundingClientRect();
19
+ dragLineEl.style.display = 'block';
20
+ dragLineEl.style.top = `${Math.max(1, optRect.y - wrapperRect.y)}px`;
21
+ dragLineEl.style.height = `${optRect.height}px`;
22
+ dragLineEl.style.width = `${optRect.width}px`;
23
+ dragLineEl.setAttribute('drag-pos', dragPos);
24
+ dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
25
+ }
26
+ else {
27
+ dragLineEl.style.display = '';
28
+ }
29
+ }
30
+ }
31
+ const dragTipEl = _vm.$refs.refDragTipElem;
32
+ if (dragTipEl) {
33
+ dragTipEl.style.display = 'block';
34
+ dragTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - dragTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
35
+ dragTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - dragTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
36
+ dragTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled');
20
37
  }
21
38
  }
39
+ function hideDropTip(_vm) {
40
+ const dragTipEl = _vm.$refs.refDragTipElem;
41
+ const dragLineEl = _vm.$refs.refDragLineElem;
42
+ if (dragTipEl) {
43
+ dragTipEl.style.display = '';
44
+ }
45
+ if (dragLineEl) {
46
+ dragLineEl.style.display = '';
47
+ }
48
+ }
49
+ const renderDragTip = (h, _vm) => {
50
+ const { dragCol } = _vm;
51
+ return h('div', {}, [
52
+ h('div', {
53
+ ref: 'refDragLineElem',
54
+ class: 'vxe-table-custom-popup--drag-line'
55
+ }),
56
+ h('div', {
57
+ ref: 'refDragTipElem',
58
+ class: 'vxe-table-custom-popup--drag-tip'
59
+ }, [
60
+ h('div', {
61
+ class: 'vxe-table-custom-popup--drag-tip-wrapper'
62
+ }, [
63
+ h('div', {
64
+ class: 'vxe-table-custom-popup--drag-tip-status'
65
+ }, [
66
+ h('span', {
67
+ class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
68
+ }),
69
+ h('span', {
70
+ class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
71
+ }),
72
+ h('span', {
73
+ class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
74
+ })
75
+ ]),
76
+ h('div', {
77
+ class: 'vxe-table--drag-tip-content'
78
+ }, getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']))
79
+ ])
80
+ ])
81
+ ]);
82
+ };
22
83
  const renderSimplePanel = (h, _vm) => {
23
84
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
24
85
  const props = _vm;
@@ -27,9 +88,12 @@ const renderSimplePanel = (h, _vm) => {
27
88
  const { customStore } = props;
28
89
  const { isCustomStatus, customColumnList } = reactData;
29
90
  const customOpts = $xeTable.computeCustomOpts;
91
+ const { immediate } = customOpts;
92
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
30
93
  const { maxHeight } = customStore;
31
94
  const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
32
95
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
96
+ const { isCrossDrag } = columnDragOpts;
33
97
  const slots = customOpts.slots || {};
34
98
  const headerSlot = slots.header;
35
99
  const topSlot = slots.top;
@@ -40,7 +104,6 @@ const renderSimplePanel = (h, _vm) => {
40
104
  const customWrapperOns = {};
41
105
  const isAllChecked = customStore.isAll;
42
106
  const isAllIndeterminate = customStore.isIndeterminate;
43
- const dragColumn = _vm.dragColumn;
44
107
  // hover 触发
45
108
  if (trigger === 'hover') {
46
109
  customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
@@ -101,45 +164,49 @@ const renderSimplePanel = (h, _vm) => {
101
164
  })
102
165
  ])
103
166
  : renderEmptyElement($xeTable),
104
- allowSort && column.level === 1
105
- ? h('div', {
106
- class: 'vxe-table-custom--sort-option'
107
- }, [
108
- h('span', {
109
- class: ['vxe-table-custom--sort-btn', {
110
- 'is--disabled': isDisabled || isHidden
111
- }],
112
- attrs: {
113
- title: getI18n('vxe.custom.setting.sortHelpTip')
114
- },
115
- on: isDisabled || isHidden
116
- ? {}
117
- : {
118
- mousedown: _vm.sortMousedownEvent,
119
- mouseup: _vm.sortMouseupEvent
120
- }
167
+ h('div', {
168
+ class: 'vxe-table-custom--name-option'
169
+ }, [
170
+ allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
171
+ ? h('div', {
172
+ class: 'vxe-table-custom--sort-option'
121
173
  }, [
122
- h('i', {
123
- class: getIcon().TABLE_CUSTOM_SORT
124
- })
174
+ h('span', {
175
+ class: ['vxe-table-custom--sort-btn', {
176
+ 'is--disabled': isDisabled || isHidden || column.renderFixed
177
+ }],
178
+ attrs: {
179
+ title: getI18n('vxe.custom.setting.sortHelpTip')
180
+ },
181
+ on: isDisabled || isHidden || column.renderFixed
182
+ ? {}
183
+ : {
184
+ mousedown: _vm.sortMousedownEvent,
185
+ mouseup: _vm.sortMouseupEvent
186
+ }
187
+ }, [
188
+ h('i', {
189
+ class: getIcon().TABLE_CUSTOM_SORT
190
+ })
191
+ ])
125
192
  ])
126
- ])
127
- : renderEmptyElement($xeTable),
128
- column.type === 'html'
129
- ? h('div', {
130
- key: '1',
131
- class: 'vxe-table-custom--checkbox-label',
132
- domProps: {
133
- innerHTML: colTitle
134
- }
135
- })
136
- : h('div', {
137
- key: '0',
138
- class: 'vxe-table-custom--checkbox-label',
139
- attrs: {
140
- title: colTitle
141
- }
142
- }, colTitle),
193
+ : renderEmptyElement($xeTable),
194
+ column.type === 'html'
195
+ ? h('div', {
196
+ key: '1',
197
+ class: 'vxe-table-custom--checkbox-label',
198
+ domProps: {
199
+ innerHTML: colTitle
200
+ }
201
+ })
202
+ : h('div', {
203
+ key: '0',
204
+ class: 'vxe-table-custom--checkbox-label',
205
+ attrs: {
206
+ title: colTitle
207
+ }
208
+ }, colTitle)
209
+ ]),
143
210
  !parent && allowFixed
144
211
  ? h('div', {
145
212
  class: 'vxe-table-custom--fixed-option'
@@ -252,10 +319,7 @@ const renderSimplePanel = (h, _vm) => {
252
319
  class: 'vxe-table-custom--panel-bottom'
253
320
  }, $xeTable.callSlot(bottomSlot, params, h))
254
321
  : renderEmptyElement($xeTable),
255
- h('div', {
256
- ref: 'dragHintElemRef',
257
- class: 'vxe-table-custom-popup--drag-hint'
258
- }, getI18n('vxe.custom.cstmDragTarget', [dragColumn && dragColumn.type !== 'html' ? dragColumn.getTitle() : '']))
322
+ renderDragTip(h, _vm)
259
323
  ]),
260
324
  customOpts.showFooter
261
325
  ? h('div', {
@@ -276,7 +340,7 @@ const renderSimplePanel = (h, _vm) => {
276
340
  click: _vm.resetCustomEvent
277
341
  }
278
342
  }),
279
- customOpts.immediate
343
+ immediate
280
344
  ? h(VxeUIButtonComponent, {
281
345
  props: {
282
346
  mode: 'text',
@@ -295,7 +359,7 @@ const renderSimplePanel = (h, _vm) => {
295
359
  click: _vm.cancelCustomEvent
296
360
  }
297
361
  }),
298
- customOpts.immediate
362
+ immediate
299
363
  ? renderEmptyElement($xeTable)
300
364
  : h(VxeUIButtonComponent, {
301
365
  props: {
@@ -318,7 +382,6 @@ const renderPopupPanel = (h, _vm) => {
318
382
  const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
319
383
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
320
384
  const VxeUINumberInputComponent = VxeUI.getComponent('VxeInput');
321
- const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
322
385
  const $xeTableCustomPanel = _vm;
323
386
  const props = _vm;
324
387
  const $xeTable = _vm.$xeTable;
@@ -328,6 +391,8 @@ const renderPopupPanel = (h, _vm) => {
328
391
  const { resizable: allResizable } = tableProps;
329
392
  const { isCustomStatus, customColumnList } = reactData;
330
393
  const customOpts = $xeTable.computeCustomOpts;
394
+ const { immediate } = customOpts;
395
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
331
396
  const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
332
397
  const columnOpts = $xeTable.computeColumnOpts;
333
398
  const { maxFixedSize } = columnOpts;
@@ -336,6 +401,7 @@ const renderPopupPanel = (h, _vm) => {
336
401
  const modalOpts = Object.assign({}, modalOptions);
337
402
  const drawerOpts = Object.assign({}, drawerOptions);
338
403
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
404
+ const { isCrossDrag } = columnDragOpts;
339
405
  const slots = customOpts.slots || {};
340
406
  const headerSlot = slots.header;
341
407
  const topSlot = slots.top;
@@ -345,7 +411,6 @@ const renderPopupPanel = (h, _vm) => {
345
411
  const trVNs = [];
346
412
  const isAllChecked = customStore.isAll;
347
413
  const isAllIndeterminate = customStore.isIndeterminate;
348
- const dragColumn = _vm.dragColumn;
349
414
  const params = {
350
415
  $table: $xeTable,
351
416
  $grid: $xeTable.xegrid,
@@ -422,50 +487,52 @@ const renderPopupPanel = (h, _vm) => {
422
487
  ])
423
488
  ])
424
489
  : renderEmptyElement($xeTable),
425
- allowSort
426
- ? h('td', {
427
- class: 'vxe-table-custom-popup--column-item col--sort'
428
- }, [
429
- column.level === 1
430
- ? h('span', {
431
- class: ['vxe-table-custom-popup--column-sort-btn', {
432
- 'is--disabled': isDisabled || isHidden
433
- }],
434
- attrs: {
435
- title: getI18n('vxe.custom.setting.sortHelpTip')
436
- },
437
- on: isDisabled || isHidden
438
- ? {}
439
- : {
440
- mousedown: _vm.sortMousedownEvent,
441
- mouseup: _vm.sortMouseupEvent
442
- }
443
- }, [
444
- h('i', {
445
- class: getIcon().TABLE_CUSTOM_SORT
446
- })
447
- ])
448
- : h('span', '-')
449
- ])
450
- : renderEmptyElement($xeTable),
451
490
  h('td', {
452
491
  class: 'vxe-table-custom-popup--column-item col--name'
453
492
  }, [
454
- column.type === 'html'
455
- ? h('div', {
456
- key: '1',
457
- class: 'vxe-table-custom-popup--name',
458
- domProps: {
459
- innerHTML: colTitle
460
- }
461
- })
462
- : h('div', {
463
- key: '0',
464
- class: 'vxe-table-custom-popup--name',
465
- attrs: {
466
- title: colTitle
467
- }
468
- }, colTitle)
493
+ h('div', {
494
+ class: 'vxe-table-custom-popup--name'
495
+ }, [
496
+ allowSort
497
+ ? ((isCrossDrag ? immediate : false) || column.level === 1
498
+ ? h('div', {
499
+ class: ['vxe-table-custom-popup--column-sort-btn', {
500
+ 'is--disabled': isDisabled || isHidden || column.renderFixed
501
+ }],
502
+ attrs: {
503
+ title: getI18n('vxe.custom.setting.sortHelpTip')
504
+ },
505
+ on: (isDisabled || isHidden || column.renderFixed
506
+ ? {}
507
+ : {
508
+ mousedown: _vm.sortMousedownEvent,
509
+ mouseup: _vm.sortMouseupEvent
510
+ })
511
+ }, [
512
+ h('i', {
513
+ class: getIcon().TABLE_CUSTOM_SORT
514
+ })
515
+ ])
516
+ : h('div', {
517
+ class: 'vxe-table-custom-popup--column-sort-placeholder'
518
+ }))
519
+ : renderEmptyElement($xeTable),
520
+ column.type === 'html'
521
+ ? h('div', {
522
+ key: '1',
523
+ class: 'vxe-table-custom-popup--title',
524
+ domProps: {
525
+ innerHTML: colTitle
526
+ }
527
+ })
528
+ : h('div', {
529
+ key: '0',
530
+ class: 'vxe-table-custom-popup--title',
531
+ attrs: {
532
+ title: colTitle
533
+ }
534
+ }, colTitle)
535
+ ])
469
536
  ]),
470
537
  allowResizable
471
538
  ? h('td', {
@@ -478,6 +545,7 @@ const renderPopupPanel = (h, _vm) => {
478
545
  ? h(VxeUINumberInputComponent, {
479
546
  props: {
480
547
  type: 'integer',
548
+ immediate: false,
481
549
  disabled: isDisabled || isHidden,
482
550
  value: column.renderResizeWidth,
483
551
  min: customMinWidth || undefined,
@@ -486,6 +554,9 @@ const renderPopupPanel = (h, _vm) => {
486
554
  on: {
487
555
  modelValue(value) {
488
556
  column.renderResizeWidth = Math.max(0, Number(value));
557
+ },
558
+ change() {
559
+ _vm.changeColumnWidth(column);
489
560
  }
490
561
  }
491
562
  })
@@ -512,7 +583,7 @@ const renderPopupPanel = (h, _vm) => {
512
583
  },
513
584
  on: {
514
585
  input(value) {
515
- column.renderFixed = value;
586
+ _vm.changeFixedOption(column, value);
516
587
  }
517
588
  }
518
589
  })
@@ -545,11 +616,6 @@ const renderPopupPanel = (h, _vm) => {
545
616
  class: 'vxe-table-custom-popup--table-col-seq'
546
617
  })
547
618
  : renderEmptyElement($xeTable),
548
- allowSort
549
- ? h('col', {
550
- class: 'vxe-table-custom-popup--table-col-sort'
551
- })
552
- : renderEmptyElement($xeTable),
553
619
  h('col', {
554
620
  class: 'vxe-table-custom-popup--table-col-title'
555
621
  }),
@@ -589,29 +655,6 @@ const renderPopupPanel = (h, _vm) => {
589
655
  ])
590
656
  ])
591
657
  : renderEmptyElement($xeTable),
592
- allowSort
593
- ? h('th', {}, [
594
- h('span', {
595
- class: 'vxe-table-custom-popup--table-sort-help-title'
596
- }, getI18n('vxe.custom.setting.colSort')),
597
- VxeUITooltipComponent
598
- ? h(VxeUITooltipComponent, {
599
- props: {
600
- enterable: true,
601
- content: getI18n('vxe.custom.setting.sortHelpTip'),
602
- popupClassName: 'vxe-table--ignore-clear'
603
- },
604
- scopedSlots: {
605
- default: () => {
606
- return h('i', {
607
- class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
608
- });
609
- }
610
- }
611
- })
612
- : renderEmptyElement($xeTableCustomPanel)
613
- ])
614
- : renderEmptyElement($xeTable),
615
658
  h('th', {}, getI18n('vxe.custom.setting.colTitle')),
616
659
  allowResizable
617
660
  ? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
@@ -635,10 +678,7 @@ const renderPopupPanel = (h, _vm) => {
635
678
  class: 'vxe-table-custom-popup--table-bottom'
636
679
  }, $xeTable.callSlot(bottomSlot, params, h))
637
680
  : renderEmptyElement($xeTable),
638
- h('div', {
639
- ref: 'dragHintElemRef',
640
- class: 'vxe-table-custom-popup--drag-hint'
641
- }, getI18n('vxe.custom.cstmDragTarget', [dragColumn ? dragColumn.getTitle() : '']))
681
+ renderDragTip(h, _vm)
642
682
  ]);
643
683
  },
644
684
  footer: () => {
@@ -657,23 +697,34 @@ const renderPopupPanel = (h, _vm) => {
657
697
  click: _vm.resetCustomEvent
658
698
  }
659
699
  }),
660
- h(VxeUIButtonComponent, {
661
- props: {
662
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
663
- },
664
- on: {
665
- click: _vm.cancelCustomEvent
666
- }
667
- }),
668
- h(VxeUIButtonComponent, {
669
- props: {
670
- status: 'primary',
671
- content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
672
- },
673
- on: {
674
- click: _vm.confirmCustomEvent
675
- }
676
- })
700
+ immediate
701
+ ? h(VxeUIButtonComponent, {
702
+ props: {
703
+ content: customOpts.resetButtonText || getI18n('vxe.custom.customClose')
704
+ },
705
+ on: {
706
+ click: _vm.cancelCloseEvent
707
+ }
708
+ })
709
+ : h(VxeUIButtonComponent, {
710
+ props: {
711
+ content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
712
+ },
713
+ on: {
714
+ click: _vm.cancelCustomEvent
715
+ }
716
+ }),
717
+ immediate
718
+ ? renderEmptyElement($xeTable)
719
+ : h(VxeUIButtonComponent, {
720
+ props: {
721
+ status: 'primary',
722
+ content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
723
+ },
724
+ on: {
725
+ click: _vm.confirmCustomEvent
726
+ }
727
+ })
677
728
  ]);
678
729
  }
679
730
  };
@@ -754,7 +805,9 @@ export default {
754
805
  },
755
806
  data() {
756
807
  return {
757
- dragColumn: null
808
+ prevDragCol: undefined,
809
+ prevDragToChild: false,
810
+ prevDragPos: null
758
811
  };
759
812
  },
760
813
  computed: {},
@@ -764,7 +817,6 @@ export default {
764
817
  const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
765
818
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
766
819
  const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
767
- const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
768
820
  const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
769
821
  this.$nextTick(() => {
770
822
  const { $xetable } = this;
@@ -782,9 +834,6 @@ export default {
782
834
  if (!VxeUINumberInputComponent) {
783
835
  errLog('vxe.error.reqComp', ['vxe-input']);
784
836
  }
785
- if (!VxeUITooltipComponent) {
786
- errLog('vxe.error.reqComp', ['vxe-tooltip']);
787
- }
788
837
  if (!VxeUIRadioGroupComponent) {
789
838
  errLog('vxe.error.reqComp', ['vxe-radio-group']);
790
839
  }
@@ -819,6 +868,8 @@ export default {
819
868
  },
820
869
  confirmCustomEvent({ $event }) {
821
870
  const $xeTable = this.$xeTable;
871
+ const reactData = $xeTable;
872
+ reactData.isCustomStatus = true;
822
873
  $xeTable.saveCustom();
823
874
  $xeTable.closeCustom();
824
875
  $xeTable.emitCustomEvent('confirm', $event);
@@ -886,8 +937,9 @@ export default {
886
937
  }
887
938
  },
888
939
  changeCheckboxOption(column) {
889
- const { $xetable } = this;
890
- const { customOpts } = $xetable;
940
+ const $xeTable = this.$xetable;
941
+ const reactData = $xeTable;
942
+ const { customOpts } = $xeTable.customOpts;
891
943
  const isChecked = !column.renderVisible;
892
944
  if (customOpts.immediate) {
893
945
  XEUtils.eachTree([column], (item) => {
@@ -895,8 +947,9 @@ export default {
895
947
  item.renderVisible = isChecked;
896
948
  item.halfVisible = false;
897
949
  });
898
- $xetable.handleCustom();
899
- $xetable.saveCustomStore('update:visible');
950
+ reactData.isCustomStatus = true;
951
+ $xeTable.handleCustom();
952
+ $xeTable.saveCustomStore('update:visible');
900
953
  }
901
954
  else {
902
955
  XEUtils.eachTree([column], (item) => {
@@ -905,11 +958,27 @@ export default {
905
958
  });
906
959
  }
907
960
  this.handleOptionCheck(column);
908
- $xetable.checkCustomStatus();
961
+ $xeTable.checkCustomStatus();
962
+ },
963
+ changeColumnWidth(column) {
964
+ const $xeTable = this.$xetable;
965
+ const reactData = $xeTable;
966
+ const customOpts = $xeTable.computeCustomOpts;
967
+ if (customOpts.immediate) {
968
+ if (column.renderResizeWidth !== column.renderWidth) {
969
+ column.resizeWidth = column.renderResizeWidth;
970
+ column.renderWidth = column.renderResizeWidth;
971
+ reactData.isCustomStatus = true;
972
+ $xeTable.handleCustom();
973
+ $xeTable.saveCustomStore('update:width');
974
+ }
975
+ }
909
976
  },
910
977
  changeFixedOption(column, colFixed) {
911
- const { $xetable } = this;
912
- const { isMaxFixedColumn, customOpts } = $xetable;
978
+ const $xeTable = this.$xetable;
979
+ const reactData = $xeTable;
980
+ const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
981
+ const customOpts = $xeTable.computeCustomOpts;
913
982
  if (customOpts.immediate) {
914
983
  if (column.renderFixed === colFixed) {
915
984
  XEUtils.eachTree([column], col => {
@@ -925,8 +994,9 @@ export default {
925
994
  });
926
995
  }
927
996
  }
928
- $xetable.handleCustom();
929
- $xetable.saveCustomStore('update:fixed');
997
+ reactData.isCustomStatus = true;
998
+ $xeTable.handleCustom();
999
+ $xeTable.saveCustomStore('update:fixed');
930
1000
  }
931
1001
  else {
932
1002
  if (column.renderFixed === colFixed) {
@@ -948,102 +1018,237 @@ export default {
948
1018
  $xetable.toggleCustomAllCheckbox();
949
1019
  },
950
1020
  sortMousedownEvent(evnt) {
951
- const { $xetable } = this;
1021
+ const $xeTable = this.$xetable;
952
1022
  const btnEl = evnt.currentTarget;
953
- const tdEl = btnEl.parentNode;
954
- const trEl = tdEl.parentNode;
1023
+ const cellEl = btnEl.parentElement;
1024
+ const tdEl = cellEl.parentElement;
1025
+ const trEl = tdEl.parentElement;
955
1026
  const colid = trEl.getAttribute('colid');
956
- const column = $xetable.getColumnById(colid);
1027
+ const column = $xeTable.getColumnById(colid);
957
1028
  trEl.draggable = true;
958
- this.dragColumn = column;
1029
+ this.dragCol = column;
959
1030
  addClass(trEl, 'active--drag-origin');
960
- updateDropHint(this, evnt);
961
1031
  },
962
1032
  sortMouseupEvent(evnt) {
963
1033
  const btnEl = evnt.currentTarget;
964
- const tdEl = btnEl.parentNode;
965
- const trEl = tdEl.parentNode;
966
- const dragHintEl = this.$refs.dragHintElemRef;
1034
+ const cellEl = btnEl.parentElement;
1035
+ const tdEl = cellEl.parentElement;
1036
+ const trEl = tdEl.parentElement;
1037
+ hideDropTip(this);
967
1038
  trEl.draggable = false;
968
- this.dragColumn = null;
1039
+ this.dragCol = null;
969
1040
  removeClass(trEl, 'active--drag-origin');
970
- if (dragHintEl) {
971
- dragHintEl.style.display = '';
972
- }
973
1041
  },
974
1042
  sortDragstartEvent(evnt) {
975
- const img = new Image();
976
1043
  if (evnt.dataTransfer) {
1044
+ const img = new Image();
1045
+ img.src = tpImg;
977
1046
  evnt.dataTransfer.setDragImage(img, 0, 0);
978
1047
  }
979
1048
  },
980
1049
  sortDragendEvent(evnt) {
981
- const { $xetable, prevDropTrEl } = this;
982
- const { customColumnList, customOpts } = $xetable;
1050
+ const $xeTable = this.$xetable;
1051
+ const tableProps = $xeTable;
1052
+ const reactData = $xeTable;
1053
+ const internalData = $xeTable;
1054
+ const { dragCol, prevDragPos, prevDragCol, prevDragToChild } = this;
1055
+ const { mouseConfig } = tableProps;
1056
+ const { customColumnList } = reactData;
1057
+ const { collectColumn } = internalData;
1058
+ const customOpts = $xeTable.computeCustomOpts;
1059
+ const { immediate } = customOpts;
983
1060
  const trEl = evnt.currentTarget;
984
- const dragHintEl = this.$refs.dragHintElemRef;
985
- if (prevDropTrEl) {
1061
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
1062
+ const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
1063
+ const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
1064
+ if (prevDragCol && dragCol) {
986
1065
  // 判断是否有拖动
987
- if (prevDropTrEl !== trEl) {
988
- const dragOffset = prevDropTrEl.getAttribute('drag-pos');
989
- const colid = trEl.getAttribute('colid');
990
- const column = $xetable.getColumnById(colid);
991
- if (!column) {
992
- return;
993
- }
994
- const cIndex = XEUtils.findIndexOf(customColumnList, item => item.id === column.id);
995
- const targetColid = prevDropTrEl.getAttribute('colid');
996
- const targetColumn = $xetable.getColumnById(targetColid);
997
- if (!targetColumn) {
998
- return;
999
- }
1000
- // 移出源位置
1001
- customColumnList.splice(cIndex, 1);
1002
- const tcIndex = XEUtils.findIndexOf(customColumnList, item => item.id === targetColumn.id);
1003
- // 插新位置
1004
- customColumnList.splice(tcIndex + (dragOffset === 'bottom' ? 1 : 0), 0, column);
1066
+ if (prevDragCol !== dragCol) {
1067
+ const oldColumn = dragCol;
1068
+ const newColumn = prevDragCol;
1069
+ Promise.resolve(dragEndMethod
1070
+ ? dragEndMethod({
1071
+ oldColumn,
1072
+ newColumn,
1073
+ dragPos: prevDragPos,
1074
+ offsetIndex: dragOffsetIndex
1075
+ })
1076
+ : true).then((status) => {
1077
+ if (!status) {
1078
+ return;
1079
+ }
1080
+ let oafIndex = -1;
1081
+ let nafIndex = -1;
1082
+ const oldAllMaps = {};
1083
+ XEUtils.eachTree([oldColumn], column => {
1084
+ oldAllMaps[column.id] = column;
1085
+ });
1086
+ let isSelfToChildStatus = false;
1087
+ // 只有实时拖拽支持跨层级
1088
+ if (immediate) {
1089
+ if (oldColumn.parentId && newColumn.parentId) {
1090
+ // 子到子
1091
+ if (!isCrossDrag) {
1092
+ return;
1093
+ }
1094
+ if (oldAllMaps[newColumn.id]) {
1095
+ isSelfToChildStatus = true;
1096
+ if (!isSelfToChildDrag) {
1097
+ if (VxeUI.modal) {
1098
+ VxeUI.modal.message({
1099
+ status: 'error',
1100
+ content: getI18n('vxe.error.treeDragChild')
1101
+ });
1102
+ }
1103
+ return;
1104
+ }
1105
+ }
1106
+ }
1107
+ else if (oldColumn.parentId) {
1108
+ // 子到根
1109
+ if (!isCrossDrag) {
1110
+ return;
1111
+ }
1112
+ }
1113
+ else if (newColumn.parentId) {
1114
+ // 根到子
1115
+ if (!isCrossDrag) {
1116
+ return;
1117
+ }
1118
+ if (oldAllMaps[newColumn.id]) {
1119
+ isSelfToChildStatus = true;
1120
+ if (!isSelfToChildDrag) {
1121
+ if (VxeUI.modal) {
1122
+ VxeUI.modal.message({
1123
+ status: 'error',
1124
+ content: getI18n('vxe.error.treeDragChild')
1125
+ });
1126
+ }
1127
+ return;
1128
+ }
1129
+ }
1130
+ }
1131
+ else {
1132
+ // 根到根
1133
+ }
1134
+ const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === oldColumn.id);
1135
+ // 改变层级
1136
+ if (isSelfToChildStatus && isSelfToChildDrag) {
1137
+ if (oldewMatchRest) {
1138
+ const { items: oCols, index: oIndex } = oldewMatchRest;
1139
+ const childList = oldColumn.children || [];
1140
+ childList.forEach(column => {
1141
+ column.parentId = oldColumn.parentId;
1142
+ });
1143
+ oCols.splice(oIndex, 1, ...childList);
1144
+ oldColumn.children = [];
1145
+ }
1146
+ }
1147
+ else {
1148
+ if (oldewMatchRest) {
1149
+ const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
1150
+ oCols.splice(oIndex, 1);
1151
+ if (!oParent) {
1152
+ oafIndex = oIndex;
1153
+ }
1154
+ }
1155
+ }
1156
+ const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
1157
+ if (newMatchRest) {
1158
+ const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
1159
+ // 转子级
1160
+ if (isToChildDrag && prevDragToChild) {
1161
+ oldColumn.parentId = newColumn.id;
1162
+ newColumn.children = (newColumn.children || []).concat([oldColumn]);
1163
+ }
1164
+ else {
1165
+ oldColumn.parentId = newColumn.parentId;
1166
+ nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn);
1167
+ }
1168
+ if (!nParent) {
1169
+ nafIndex = nIndex;
1170
+ }
1171
+ }
1172
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
1173
+ if (!parent) {
1174
+ const sortIndex = index + 1;
1175
+ column.renderSortNumber = sortIndex;
1176
+ }
1177
+ });
1178
+ }
1179
+ else {
1180
+ oafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === oldColumn.id);
1181
+ customColumnList.splice(oafIndex, 1);
1182
+ nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id);
1183
+ customColumnList.splice(nafIndex + dragOffsetIndex, 0, oldColumn);
1184
+ }
1185
+ reactData.isDragColMove = true;
1186
+ if (mouseConfig) {
1187
+ if ($xeTable.clearSelected) {
1188
+ $xeTable.clearSelected();
1189
+ }
1190
+ if ($xeTable.clearCellAreas) {
1191
+ $xeTable.clearCellAreas();
1192
+ $xeTable.clearCopyCellArea();
1193
+ }
1194
+ }
1195
+ $xeTable.dispatchEvent('column-dragend', {
1196
+ oldColumn,
1197
+ newColumn,
1198
+ dragPos: prevDragPos,
1199
+ offsetIndex: dragOffsetIndex,
1200
+ _index: {
1201
+ newIndex: nafIndex,
1202
+ oldIndex: oafIndex
1203
+ }
1204
+ }, evnt);
1205
+ if (immediate) {
1206
+ reactData.customColumnList = collectColumn.slice(0);
1207
+ $xeTable.refreshColumn(true).then(() => {
1208
+ $xeTable.updateCellAreas();
1209
+ $xeTable.handleCustom();
1210
+ $xeTable.saveCustomStore('update:sort');
1211
+ });
1212
+ }
1213
+ }).catch(() => {
1214
+ });
1005
1215
  }
1006
- prevDropTrEl.draggable = false;
1007
- prevDropTrEl.removeAttribute('drag-pos');
1008
- removeClass(prevDropTrEl, 'active--drag-target');
1009
1216
  }
1010
- this.dragColumn = null;
1217
+ hideDropTip(this);
1218
+ this.dragCol.value = null;
1011
1219
  trEl.draggable = false;
1012
1220
  trEl.removeAttribute('drag-pos');
1013
- if (dragHintEl) {
1014
- dragHintEl.style.display = '';
1015
- }
1016
1221
  removeClass(trEl, 'active--drag-target');
1017
1222
  removeClass(trEl, 'active--drag-origin');
1018
- if (customOpts.immediate) {
1019
- XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
1020
- if (!parent) {
1021
- const sortIndex = index + 1;
1022
- column.renderSortNumber = sortIndex;
1023
- }
1024
- });
1025
- $xetable.handleCustom();
1026
- $xetable.saveCustomStore('update:sort');
1027
- }
1028
1223
  },
1029
1224
  sortDragoverEvent(evnt) {
1030
- const { $xetable, prevDropTrEl } = this;
1031
- const trEl = evnt.currentTarget;
1032
- if (prevDropTrEl !== trEl) {
1033
- removeClass(prevDropTrEl, 'active--drag-target');
1034
- }
1035
- const colid = trEl.getAttribute('colid');
1036
- const column = $xetable.getColumnById(colid);
1037
- // 是否移入有效元行
1038
- if (column && column.level === 1) {
1225
+ const $xeTable = this.$xetable;
1226
+ const { dragCol } = this;
1227
+ const customOpts = $xeTable.computeCustomOpts;
1228
+ const { immediate } = customOpts;
1229
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
1230
+ const { isCrossDrag, isToChildDrag } = columnDragOpts;
1231
+ const optEl = evnt.currentTarget;
1232
+ const hasCtrlKey = evnt.ctrlKey;
1233
+ const colid = optEl.getAttribute('colid');
1234
+ const column = $xeTable.getColumnById(colid);
1235
+ // 是否移入有效列
1236
+ if (column && (isCrossDrag || column.level === 1)) {
1039
1237
  evnt.preventDefault();
1040
- const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
1041
- const dragOffset = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
1042
- addClass(trEl, 'active--drag-target');
1043
- trEl.setAttribute('drag-pos', dragOffset);
1044
- this.prevDropTrEl = trEl;
1238
+ const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
1239
+ const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
1240
+ if ((dragCol && dragCol.id === column.id) ||
1241
+ (!isCrossDrag && column.level > 1) ||
1242
+ (!immediate && column.level > 1) ||
1243
+ column.renderFixed) {
1244
+ showDropTip(this, evnt, optEl, false, dragPos);
1245
+ return;
1246
+ }
1247
+ this.prevDragToChild = !!(isToChildDrag && hasCtrlKey && immediate);
1248
+ this.prevDragCol = column;
1249
+ this.prevDragPos = dragPos;
1250
+ showDropTip(this, evnt, optEl, true, dragPos);
1045
1251
  }
1046
- updateDropHint(this, evnt);
1047
1252
  }
1048
1253
  }
1049
1254
  };