vxe-table 4.16.16 → 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 (230) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/src/table.js +5 -0
  3. package/es/ui/index.js +1 -1
  4. package/es/ui/src/log.js +1 -1
  5. package/lib/index.umd.js +3 -3
  6. package/lib/index.umd.min.js +1 -1
  7. package/lib/locale/lang/ar-EG.min.js +1 -1
  8. package/lib/locale/lang/de-DE.min.js +1 -1
  9. package/lib/locale/lang/en-US.min.js +1 -1
  10. package/lib/locale/lang/es-ES.min.js +1 -1
  11. package/lib/locale/lang/fr-FR.min.js +1 -1
  12. package/lib/locale/lang/hu-HU.min.js +1 -1
  13. package/lib/locale/lang/hy-AM.min.js +1 -1
  14. package/lib/locale/lang/id-ID.min.js +1 -1
  15. package/lib/locale/lang/it-IT.min.js +1 -1
  16. package/lib/locale/lang/ja-JP.min.js +1 -1
  17. package/lib/locale/lang/ko-KR.min.js +1 -1
  18. package/lib/locale/lang/ms-MY.min.js +1 -1
  19. package/lib/locale/lang/nb-NO.min.js +1 -1
  20. package/lib/locale/lang/pt-BR.min.js +1 -1
  21. package/lib/locale/lang/ru-RU.min.js +1 -1
  22. package/lib/locale/lang/th-TH.min.js +1 -1
  23. package/lib/locale/lang/ug-CN.min.js +1 -1
  24. package/lib/locale/lang/uk-UA.min.js +1 -1
  25. package/lib/locale/lang/uz-UZ.min.js +1 -1
  26. package/lib/locale/lang/vi-VN.min.js +1 -1
  27. package/lib/locale/lang/zh-CHT.min.js +1 -1
  28. package/lib/locale/lang/zh-CN.min.js +1 -1
  29. package/lib/locale/lang/zh-HK.min.js +1 -1
  30. package/lib/locale/lang/zh-MO.min.js +1 -1
  31. package/lib/locale/lang/zh-TW.min.js +1 -1
  32. package/lib/style.css +1 -1
  33. package/lib/table/src/props.js +0 -318
  34. package/lib/ui/index.js +1 -1
  35. package/lib/ui/index.min.js +1 -1
  36. package/lib/ui/src/log.js +1 -1
  37. package/lib/ui/src/log.min.js +1 -1
  38. package/package.json +1 -1
  39. package/packages/table/src/table.ts +5 -0
  40. package/es/colgroup/style.css +0 -0
  41. package/es/colgroup/style.min.css +0 -0
  42. package/es/column/style.css +0 -0
  43. package/es/column/style.min.css +0 -0
  44. package/es/grid/style.css +0 -86
  45. package/es/grid/style.min.css +0 -1
  46. package/es/iconfont.1758344508103.ttf +0 -0
  47. package/es/iconfont.1758344508103.woff +0 -0
  48. package/es/iconfont.1758344508103.woff2 +0 -0
  49. package/es/index.esm.js +0 -3
  50. package/es/locale/lang/ar-EG.d.ts +0 -2
  51. package/es/locale/lang/de-DE.d.ts +0 -2
  52. package/es/locale/lang/en-US.d.ts +0 -2
  53. package/es/locale/lang/es-ES.d.ts +0 -2
  54. package/es/locale/lang/fr-FR.d.ts +0 -2
  55. package/es/locale/lang/hu-HU.d.ts +0 -2
  56. package/es/locale/lang/hy-AM.d.ts +0 -2
  57. package/es/locale/lang/id-ID.d.ts +0 -2
  58. package/es/locale/lang/it-IT.d.ts +0 -2
  59. package/es/locale/lang/ja-JP.d.ts +0 -2
  60. package/es/locale/lang/ko-KR.d.ts +0 -2
  61. package/es/locale/lang/ms-MY.d.ts +0 -2
  62. package/es/locale/lang/nb-NO.d.ts +0 -2
  63. package/es/locale/lang/pt-BR.d.ts +0 -2
  64. package/es/locale/lang/ru-RU.d.ts +0 -2
  65. package/es/locale/lang/th-TH.d.ts +0 -2
  66. package/es/locale/lang/ug-CN.d.ts +0 -2
  67. package/es/locale/lang/uk-UA.d.ts +0 -2
  68. package/es/locale/lang/uz-UZ.d.ts +0 -2
  69. package/es/locale/lang/vi-VN.d.ts +0 -2
  70. package/es/locale/lang/zh-CHT.d.ts +0 -2
  71. package/es/locale/lang/zh-CN.d.ts +0 -2
  72. package/es/locale/lang/zh-HK.d.ts +0 -2
  73. package/es/locale/lang/zh-MO.d.ts +0 -2
  74. package/es/locale/lang/zh-TW.d.ts +0 -2
  75. package/es/table/style.css +0 -3657
  76. package/es/table/style.min.css +0 -1
  77. package/es/toolbar/style.css +0 -90
  78. package/es/toolbar/style.min.css +0 -1
  79. package/es/ui/style.css +0 -0
  80. package/es/ui/style.min.css +0 -0
  81. package/es/v-x-e-table/style.css +0 -0
  82. package/es/v-x-e-table/style.min.css +0 -0
  83. package/es/vxe-colgroup/style.css +0 -0
  84. package/es/vxe-colgroup/style.min.css +0 -0
  85. package/es/vxe-column/style.css +0 -0
  86. package/es/vxe-column/style.min.css +0 -0
  87. package/es/vxe-grid/style.css +0 -86
  88. package/es/vxe-grid/style.min.css +0 -1
  89. package/es/vxe-table/style.css +0 -3657
  90. package/es/vxe-table/style.min.css +0 -1
  91. package/es/vxe-toolbar/style.css +0 -90
  92. package/es/vxe-toolbar/style.min.css +0 -1
  93. package/es/vxe-ui/style.css +0 -0
  94. package/es/vxe-ui/style.min.css +0 -0
  95. package/es/vxe-v-x-e-table/style.css +0 -0
  96. package/es/vxe-v-x-e-table/style.min.css +0 -0
  97. package/lib/colgroup/style/index.js +0 -1
  98. package/lib/colgroup/style/style.css +0 -0
  99. package/lib/colgroup/style/style.min.css +0 -0
  100. package/lib/column/style/index.js +0 -1
  101. package/lib/column/style/style.css +0 -0
  102. package/lib/column/style/style.min.css +0 -0
  103. package/lib/grid/style/index.js +0 -1
  104. package/lib/grid/style/style.css +0 -86
  105. package/lib/grid/style/style.min.css +0 -1
  106. package/lib/iconfont.1758344508103.ttf +0 -0
  107. package/lib/iconfont.1758344508103.woff +0 -0
  108. package/lib/iconfont.1758344508103.woff2 +0 -0
  109. package/lib/index.common.js +0 -22
  110. package/lib/locale/lang/ar-EG.d.ts +0 -2
  111. package/lib/locale/lang/ar-EG.umd.js +0 -806
  112. package/lib/locale/lang/de-DE.d.ts +0 -2
  113. package/lib/locale/lang/de-DE.umd.js +0 -806
  114. package/lib/locale/lang/en-US.d.ts +0 -2
  115. package/lib/locale/lang/en-US.umd.js +0 -806
  116. package/lib/locale/lang/es-ES.d.ts +0 -2
  117. package/lib/locale/lang/es-ES.umd.js +0 -806
  118. package/lib/locale/lang/fr-FR.d.ts +0 -2
  119. package/lib/locale/lang/fr-FR.umd.js +0 -806
  120. package/lib/locale/lang/hu-HU.d.ts +0 -2
  121. package/lib/locale/lang/hu-HU.umd.js +0 -806
  122. package/lib/locale/lang/hy-AM.d.ts +0 -2
  123. package/lib/locale/lang/hy-AM.umd.js +0 -806
  124. package/lib/locale/lang/id-ID.d.ts +0 -2
  125. package/lib/locale/lang/id-ID.umd.js +0 -806
  126. package/lib/locale/lang/it-IT.d.ts +0 -2
  127. package/lib/locale/lang/it-IT.umd.js +0 -806
  128. package/lib/locale/lang/ja-JP.d.ts +0 -2
  129. package/lib/locale/lang/ja-JP.umd.js +0 -806
  130. package/lib/locale/lang/ko-KR.d.ts +0 -2
  131. package/lib/locale/lang/ko-KR.umd.js +0 -806
  132. package/lib/locale/lang/ms-MY.d.ts +0 -2
  133. package/lib/locale/lang/ms-MY.umd.js +0 -806
  134. package/lib/locale/lang/nb-NO.d.ts +0 -2
  135. package/lib/locale/lang/nb-NO.umd.js +0 -806
  136. package/lib/locale/lang/pt-BR.d.ts +0 -2
  137. package/lib/locale/lang/pt-BR.umd.js +0 -806
  138. package/lib/locale/lang/ru-RU.d.ts +0 -2
  139. package/lib/locale/lang/ru-RU.umd.js +0 -806
  140. package/lib/locale/lang/th-TH.d.ts +0 -2
  141. package/lib/locale/lang/th-TH.umd.js +0 -806
  142. package/lib/locale/lang/ug-CN.d.ts +0 -2
  143. package/lib/locale/lang/ug-CN.umd.js +0 -806
  144. package/lib/locale/lang/uk-UA.d.ts +0 -2
  145. package/lib/locale/lang/uk-UA.umd.js +0 -806
  146. package/lib/locale/lang/uz-UZ.d.ts +0 -2
  147. package/lib/locale/lang/uz-UZ.umd.js +0 -806
  148. package/lib/locale/lang/vi-VN.d.ts +0 -2
  149. package/lib/locale/lang/vi-VN.umd.js +0 -806
  150. package/lib/locale/lang/zh-CHT.d.ts +0 -2
  151. package/lib/locale/lang/zh-CHT.umd.js +0 -806
  152. package/lib/locale/lang/zh-CN.d.ts +0 -2
  153. package/lib/locale/lang/zh-CN.umd.js +0 -808
  154. package/lib/locale/lang/zh-HK.d.ts +0 -2
  155. package/lib/locale/lang/zh-HK.umd.js +0 -23
  156. package/lib/locale/lang/zh-MO.d.ts +0 -2
  157. package/lib/locale/lang/zh-MO.umd.js +0 -23
  158. package/lib/locale/lang/zh-TW.d.ts +0 -2
  159. package/lib/locale/lang/zh-TW.umd.js +0 -23
  160. package/lib/table/module/custom/hook.js +0 -430
  161. package/lib/table/module/custom/hook.min.js +0 -1
  162. package/lib/table/module/custom/panel.js +0 -1193
  163. package/lib/table/module/custom/panel.min.js +0 -1
  164. package/lib/table/module/edit/hook.js +0 -1308
  165. package/lib/table/module/edit/hook.min.js +0 -1
  166. package/lib/table/module/export/export-panel.js +0 -467
  167. package/lib/table/module/export/export-panel.min.js +0 -1
  168. package/lib/table/module/export/hook.js +0 -1888
  169. package/lib/table/module/export/hook.min.js +0 -1
  170. package/lib/table/module/export/import-panel.js +0 -226
  171. package/lib/table/module/export/import-panel.min.js +0 -1
  172. package/lib/table/module/export/util.js +0 -20
  173. package/lib/table/module/export/util.min.js +0 -1
  174. package/lib/table/module/filter/hook.js +0 -442
  175. package/lib/table/module/filter/hook.min.js +0 -1
  176. package/lib/table/module/filter/panel.js +0 -265
  177. package/lib/table/module/filter/panel.min.js +0 -1
  178. package/lib/table/module/keyboard/hook.js +0 -579
  179. package/lib/table/module/keyboard/hook.min.js +0 -1
  180. package/lib/table/module/menu/hook.js +0 -392
  181. package/lib/table/module/menu/hook.min.js +0 -1
  182. package/lib/table/module/menu/panel.js +0 -145
  183. package/lib/table/module/menu/panel.min.js +0 -1
  184. package/lib/table/module/validator/hook.js +0 -681
  185. package/lib/table/module/validator/hook.min.js +0 -1
  186. package/lib/table/src/header.min.js +0 -1
  187. package/lib/table/src/props.min.js +0 -1
  188. package/lib/table/src/store.js +0 -15
  189. package/lib/table/src/store.min.js +0 -1
  190. package/lib/table/src/table.js +0 -902
  191. package/lib/table/src/table.min.js +0 -1
  192. package/lib/table/src/use/cell-view.js +0 -57
  193. package/lib/table/src/use/cell-view.min.js +0 -1
  194. package/lib/table/src/use/index.js +0 -16
  195. package/lib/table/src/use/index.min.js +0 -1
  196. package/lib/table/src/util.js +0 -916
  197. package/lib/table/src/util.min.js +0 -1
  198. package/lib/table/style/index.js +0 -1
  199. package/lib/table/style/style.css +0 -3657
  200. package/lib/table/style/style.min.css +0 -1
  201. package/lib/toolbar/style/index.js +0 -1
  202. package/lib/toolbar/style/style.css +0 -90
  203. package/lib/toolbar/style/style.min.css +0 -1
  204. package/lib/ui/style/index.js +0 -1
  205. package/lib/ui/style/style.css +0 -0
  206. package/lib/ui/style/style.min.css +0 -0
  207. package/lib/v-x-e-table/style/index.js +0 -1
  208. package/lib/v-x-e-table/style/style.css +0 -0
  209. package/lib/v-x-e-table/style/style.min.css +0 -0
  210. package/lib/vxe-colgroup/style/index.js +0 -1
  211. package/lib/vxe-colgroup/style/style.css +0 -0
  212. package/lib/vxe-colgroup/style/style.min.css +0 -0
  213. package/lib/vxe-column/style/index.js +0 -1
  214. package/lib/vxe-column/style/style.css +0 -0
  215. package/lib/vxe-column/style/style.min.css +0 -0
  216. package/lib/vxe-grid/style/index.js +0 -1
  217. package/lib/vxe-grid/style/style.css +0 -86
  218. package/lib/vxe-grid/style/style.min.css +0 -1
  219. package/lib/vxe-table/style/index.js +0 -1
  220. package/lib/vxe-table/style/style.css +0 -3657
  221. package/lib/vxe-table/style/style.min.css +0 -1
  222. package/lib/vxe-toolbar/style/index.js +0 -1
  223. package/lib/vxe-toolbar/style/style.css +0 -90
  224. package/lib/vxe-toolbar/style/style.min.css +0 -1
  225. package/lib/vxe-ui/style/index.js +0 -1
  226. package/lib/vxe-ui/style/style.css +0 -0
  227. package/lib/vxe-ui/style/style.min.css +0 -0
  228. package/lib/vxe-v-x-e-table/style/index.js +0 -1
  229. package/lib/vxe-v-x-e-table/style/style.css +0 -0
  230. package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
@@ -1,1193 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createInternalData = createInternalData;
7
- exports.default = void 0;
8
- var _vue = require("vue");
9
- var _comp = require("../../../ui/src/comp");
10
- var _ui = require("../../../ui");
11
- var _utils = require("../../../ui/src/utils");
12
- var _dom = require("../../../ui/src/dom");
13
- var _log = require("../../../ui/src/log");
14
- var _xeUtils = _interopRequireDefault(require("xe-utils"));
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- const {
17
- getI18n,
18
- getIcon,
19
- renderEmptyElement
20
- } = _ui.VxeUI;
21
- function createInternalData() {
22
- return {
23
- // teleportTo: undefined,
24
- // prevDragCol: undefined,
25
- // prevDragGroupField: undefined,
26
- // prevDragAggFnColid: undefined,
27
- // prevDragToChild: false,
28
- // prevDragPos: null
29
- };
30
- }
31
- var _default = exports.default = (0, _comp.defineVxeComponent)({
32
- name: 'TableCustomPanel',
33
- props: {
34
- customStore: {
35
- type: Object,
36
- default: () => ({})
37
- }
38
- },
39
- setup(props, context) {
40
- const xID = _xeUtils.default.uniqueId();
41
- const VxeUIModalComponent = _ui.VxeUI.getComponent('VxeModal');
42
- const VxeUIDrawerComponent = _ui.VxeUI.getComponent('VxeDrawer');
43
- const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
44
- const VxeUINumberInputComponent = _ui.VxeUI.getComponent('VxeNumberInput');
45
- const VxeUIRadioGroupComponent = _ui.VxeUI.getComponent('VxeRadioGroup');
46
- const $xeTable = (0, _vue.inject)('$xeTable', {});
47
- const {
48
- props: tableProps,
49
- reactData: tableReactData,
50
- internalData: tableInternalData
51
- } = $xeTable;
52
- const {
53
- computeCustomOpts,
54
- computeColumnDragOpts,
55
- computeColumnOpts,
56
- computeIsMaxFixedColumn,
57
- computeResizableOpts
58
- } = $xeTable.getComputeMaps();
59
- const refElem = (0, _vue.ref)();
60
- const refBodyWrapperElem = (0, _vue.ref)();
61
- const refCustomBodyElem = (0, _vue.ref)();
62
- const refDragLineElem = (0, _vue.ref)();
63
- const refDragTipElem = (0, _vue.ref)();
64
- const customPanelReactData = (0, _vue.reactive)({
65
- dragCol: null,
66
- dragGroupField: null,
67
- dragAggFnCol: null,
68
- dragTipText: ''
69
- });
70
- let customPanelInternalData = createInternalData();
71
- const refMaps = {
72
- refElem,
73
- refBodyWrapperElem,
74
- refCustomBodyElem,
75
- refDragLineElem,
76
- refDragTipElem
77
- };
78
- const computeMaps = {};
79
- const handleWrapperMouseenterEvent = evnt => {
80
- const {
81
- customStore
82
- } = props;
83
- customStore.activeWrapper = true;
84
- $xeTable.customOpenEvent(evnt);
85
- };
86
- const handleWrapperMouseleaveEvent = evnt => {
87
- const {
88
- customStore
89
- } = props;
90
- customStore.activeWrapper = false;
91
- setTimeout(() => {
92
- if (!customStore.activeBtn && !customStore.activeWrapper) {
93
- $xeTable.customCloseEvent(evnt);
94
- }
95
- }, 300);
96
- };
97
- const confirmCustomEvent = ({
98
- $event
99
- }) => {
100
- tableReactData.isCustomStatus = true;
101
- $xeTable.saveCustom();
102
- $xeTable.closeCustom();
103
- $xeTable.emitCustomEvent('confirm', $event);
104
- };
105
- const cancelCloseEvent = ({
106
- $event
107
- }) => {
108
- $xeTable.closeCustom();
109
- $xeTable.emitCustomEvent('close', $event);
110
- };
111
- const cancelCustomEvent = ({
112
- $event
113
- }) => {
114
- $xeTable.cancelCustom();
115
- $xeTable.closeCustom();
116
- $xeTable.emitCustomEvent('cancel', $event);
117
- };
118
- const handleResetCustomEvent = evnt => {
119
- $xeTable.resetCustom(true);
120
- $xeTable.closeCustom();
121
- $xeTable.emitCustomEvent('reset', evnt);
122
- };
123
- const resetCustomEvent = ({
124
- $event
125
- }) => {
126
- if (_ui.VxeUI.modal) {
127
- _ui.VxeUI.modal.confirm({
128
- content: getI18n('vxe.custom.cstmConfirmRestore'),
129
- className: 'vxe-table--ignore-clear',
130
- escClosable: true
131
- }).then(type => {
132
- if (type === 'confirm') {
133
- handleResetCustomEvent($event);
134
- }
135
- });
136
- } else {
137
- handleResetCustomEvent($event);
138
- }
139
- };
140
- const handleOptionCheck = column => {
141
- const {
142
- customColumnList
143
- } = tableReactData;
144
- const matchObj = _xeUtils.default.findTree(customColumnList, item => item === column);
145
- if (matchObj && matchObj.parent) {
146
- const {
147
- parent
148
- } = matchObj;
149
- if (parent.children && parent.children.length) {
150
- parent.renderVisible = parent.children.every(column => column.renderVisible);
151
- parent.halfVisible = !parent.renderVisible && parent.children.some(column => column.renderVisible || column.halfVisible);
152
- handleOptionCheck(parent);
153
- }
154
- }
155
- };
156
- const changeCheckboxOption = (column, evnt) => {
157
- const isChecked = !column.renderVisible;
158
- const customOpts = computeCustomOpts.value;
159
- if (customOpts.immediate) {
160
- _xeUtils.default.eachTree([column], item => {
161
- item.visible = isChecked;
162
- item.renderVisible = isChecked;
163
- item.halfVisible = false;
164
- });
165
- tableReactData.isCustomStatus = true;
166
- $xeTable.handleCustom();
167
- $xeTable.saveCustomStore('update:visible');
168
- } else {
169
- _xeUtils.default.eachTree([column], item => {
170
- item.renderVisible = isChecked;
171
- item.halfVisible = false;
172
- });
173
- }
174
- handleOptionCheck(column);
175
- $xeTable.checkCustomStatus();
176
- $xeTable.dispatchEvent('custom-visible-change', {
177
- column,
178
- checked: isChecked
179
- }, evnt);
180
- };
181
- const changeColumnWidth = column => {
182
- const customOpts = computeCustomOpts.value;
183
- if (customOpts.immediate) {
184
- if (column.renderResizeWidth !== column.renderWidth) {
185
- column.resizeWidth = column.renderResizeWidth;
186
- column.renderWidth = column.renderResizeWidth;
187
- tableReactData.isCustomStatus = true;
188
- $xeTable.handleCustom();
189
- $xeTable.saveCustomStore('update:width');
190
- }
191
- }
192
- };
193
- const changeFixedOption = (column, colFixed, evnt) => {
194
- const isMaxFixedColumn = computeIsMaxFixedColumn.value;
195
- const customOpts = computeCustomOpts.value;
196
- let targetFixed = null;
197
- if (customOpts.immediate) {
198
- if (column.renderFixed === colFixed) {
199
- targetFixed = '';
200
- _xeUtils.default.eachTree([column], col => {
201
- col.fixed = '';
202
- col.renderFixed = '';
203
- });
204
- } else {
205
- if (!isMaxFixedColumn || column.renderFixed) {
206
- targetFixed = colFixed;
207
- _xeUtils.default.eachTree([column], col => {
208
- col.fixed = colFixed;
209
- col.renderFixed = colFixed;
210
- });
211
- }
212
- }
213
- tableReactData.isCustomStatus = true;
214
- $xeTable.handleCustom();
215
- $xeTable.saveCustomStore('update:fixed');
216
- } else {
217
- if (column.renderFixed === colFixed) {
218
- targetFixed = '';
219
- _xeUtils.default.eachTree([column], col => {
220
- col.renderFixed = '';
221
- });
222
- } else {
223
- if (!isMaxFixedColumn || column.renderFixed) {
224
- targetFixed = colFixed;
225
- _xeUtils.default.eachTree([column], col => {
226
- col.renderFixed = colFixed;
227
- });
228
- }
229
- }
230
- }
231
- if (targetFixed !== null) {
232
- $xeTable.dispatchEvent('custom-fixed-change', {
233
- column,
234
- fixed: targetFixed
235
- }, evnt);
236
- }
237
- };
238
- const allOptionEvent = evnt => {
239
- const {
240
- customStore
241
- } = tableReactData;
242
- const isAll = !customStore.isAll;
243
- $xeTable.toggleCustomAllCheckbox();
244
- $xeTable.dispatchEvent('custom-visible-all', {
245
- checked: isAll
246
- }, evnt);
247
- };
248
- const showDropTip = (evnt, optEl, showLine, dragPos) => {
249
- const bodyWrapperElem = refBodyWrapperElem.value;
250
- if (!bodyWrapperElem) {
251
- return;
252
- }
253
- const customBodyElem = refCustomBodyElem.value;
254
- if (!customBodyElem) {
255
- return;
256
- }
257
- const {
258
- prevDragToChild
259
- } = customPanelInternalData;
260
- const bodyWrapperRect = bodyWrapperElem.getBoundingClientRect();
261
- const customBodyRect = customBodyElem.getBoundingClientRect();
262
- const dragLineEl = refDragLineElem.value;
263
- if (optEl) {
264
- if (dragLineEl) {
265
- if (showLine) {
266
- const optRect = optEl.getBoundingClientRect();
267
- dragLineEl.style.display = 'block';
268
- dragLineEl.style.left = `${Math.max(0, customBodyRect.x - bodyWrapperRect.x)}px`;
269
- dragLineEl.style.top = `${Math.max(1, optRect.y + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
270
- dragLineEl.style.height = `${optRect.height}px`;
271
- dragLineEl.style.width = `${optRect.width}px`;
272
- dragLineEl.setAttribute('drag-pos', dragPos);
273
- dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
274
- } else {
275
- dragLineEl.style.display = '';
276
- }
277
- }
278
- } else {
279
- if (dragLineEl) {
280
- dragLineEl.style.display = 'node';
281
- }
282
- }
283
- const dragTipEl = refDragTipElem.value;
284
- if (dragTipEl) {
285
- dragTipEl.style.display = 'block';
286
- dragTipEl.style.top = `${Math.min(bodyWrapperElem.clientHeight + bodyWrapperElem.scrollTop - dragTipEl.clientHeight, evnt.clientY + bodyWrapperElem.scrollTop - bodyWrapperRect.y)}px`;
287
- dragTipEl.style.left = `${Math.min(bodyWrapperElem.clientWidth + bodyWrapperElem.scrollLeft - dragTipEl.clientWidth, evnt.clientX + bodyWrapperElem.scrollLeft - bodyWrapperRect.x)}px`;
288
- dragTipEl.setAttribute('drag-status', showLine ? prevDragToChild ? 'sub' : 'normal' : 'disabled');
289
- }
290
- };
291
- const updateColDropTipContent = () => {
292
- const {
293
- dragCol
294
- } = customPanelReactData;
295
- const columnDragOpts = computeColumnDragOpts.value;
296
- const {
297
- tooltipMethod
298
- } = columnDragOpts;
299
- let tipContent = '';
300
- if (tooltipMethod) {
301
- const dtParams = {
302
- $table: $xeTable,
303
- column: dragCol
304
- };
305
- tipContent = `${tooltipMethod(dtParams) || ''}`;
306
- } else {
307
- tipContent = getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']);
308
- }
309
- customPanelReactData.dragTipText = tipContent;
310
- };
311
- const hideDropTip = () => {
312
- const dragTipEl = refDragTipElem.value;
313
- const dragLineEl = refDragLineElem.value;
314
- if (dragTipEl) {
315
- dragTipEl.style.display = '';
316
- }
317
- if (dragLineEl) {
318
- dragLineEl.style.display = '';
319
- }
320
- };
321
- const sortMousedownEvent = evnt => {
322
- const btnEl = evnt.currentTarget;
323
- const cellEl = btnEl.parentElement;
324
- const tdEl = cellEl.parentElement;
325
- const trEl = tdEl.parentElement;
326
- const colid = trEl.getAttribute('colid');
327
- const column = $xeTable.getColumnById(colid);
328
- trEl.draggable = true;
329
- customPanelReactData.dragCol = column;
330
- customPanelReactData.dragGroupField = null;
331
- customPanelReactData.dragAggFnCol = null;
332
- updateColDropTipContent();
333
- (0, _dom.addClass)(trEl, 'active--drag-origin');
334
- };
335
- const sortMouseupEvent = evnt => {
336
- const btnEl = evnt.currentTarget;
337
- const cellEl = btnEl.parentElement;
338
- const tdEl = cellEl.parentElement;
339
- const trEl = tdEl.parentElement;
340
- hideDropTip();
341
- trEl.draggable = false;
342
- customPanelReactData.dragCol = null;
343
- customPanelReactData.dragGroupField = null;
344
- customPanelReactData.dragAggFnCol = null;
345
- (0, _dom.removeClass)(trEl, 'active--drag-origin');
346
- };
347
- const sortDragstartEvent = evnt => {
348
- if (evnt.dataTransfer) {
349
- evnt.dataTransfer.setDragImage((0, _dom.getTpImg)(), 0, 0);
350
- }
351
- customPanelInternalData.prevDragGroupField = null;
352
- customPanelInternalData.prevDragAggFnColid = null;
353
- };
354
- const sortDragendEvent = evnt => {
355
- const {
356
- mouseConfig
357
- } = tableProps;
358
- const {
359
- customColumnList
360
- } = tableReactData;
361
- const {
362
- collectColumn
363
- } = tableInternalData;
364
- const customOpts = computeCustomOpts.value;
365
- const {
366
- immediate
367
- } = customOpts;
368
- const trEl = evnt.currentTarget;
369
- const columnDragOpts = computeColumnDragOpts.value;
370
- const {
371
- isCrossDrag,
372
- isSelfToChildDrag,
373
- isToChildDrag,
374
- dragEndMethod
375
- } = columnDragOpts;
376
- const {
377
- dragCol
378
- } = customPanelReactData;
379
- const {
380
- prevDragCol,
381
- prevDragGroupField,
382
- prevDragAggFnColid,
383
- prevDragPos,
384
- prevDragToChild
385
- } = customPanelInternalData;
386
- const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
387
- if (prevDragGroupField || prevDragAggFnColid) {
388
- if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
389
- $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt);
390
- }
391
- } else if (prevDragCol && dragCol) {
392
- // 判断是否有拖动
393
- if (prevDragCol !== dragCol) {
394
- const dragColumn = dragCol;
395
- const newColumn = prevDragCol;
396
- Promise.resolve(dragEndMethod ? dragEndMethod({
397
- oldColumn: dragColumn,
398
- newColumn,
399
- dragColumn,
400
- dragPos: prevDragPos,
401
- dragToChild: !!prevDragToChild,
402
- offsetIndex: dragOffsetIndex
403
- }) : true).then(status => {
404
- if (!status) {
405
- return;
406
- }
407
- let oafIndex = -1;
408
- let nafIndex = -1;
409
- const oldAllMaps = {};
410
- _xeUtils.default.eachTree([dragColumn], column => {
411
- oldAllMaps[column.id] = column;
412
- });
413
- let isSelfToChildStatus = false;
414
- // 只有实时拖拽支持跨层级
415
- if (immediate) {
416
- if (dragColumn.parentId && newColumn.parentId) {
417
- // 子到子
418
- if (!isCrossDrag) {
419
- return;
420
- }
421
- if (oldAllMaps[newColumn.id]) {
422
- isSelfToChildStatus = true;
423
- if (!(isCrossDrag && isSelfToChildDrag)) {
424
- if (_ui.VxeUI.modal) {
425
- _ui.VxeUI.modal.message({
426
- status: 'error',
427
- content: getI18n('vxe.error.treeDragChild')
428
- });
429
- }
430
- return;
431
- }
432
- }
433
- } else if (dragColumn.parentId) {
434
- // 子到根
435
- if (!isCrossDrag) {
436
- return;
437
- }
438
- } else if (newColumn.parentId) {
439
- // 根到子
440
- if (!isCrossDrag) {
441
- return;
442
- }
443
- if (oldAllMaps[newColumn.id]) {
444
- isSelfToChildStatus = true;
445
- if (!(isCrossDrag && isSelfToChildDrag)) {
446
- if (_ui.VxeUI.modal) {
447
- _ui.VxeUI.modal.message({
448
- status: 'error',
449
- content: getI18n('vxe.error.treeDragChild')
450
- });
451
- }
452
- return;
453
- }
454
- }
455
- } else {
456
- // 根到根
457
- }
458
- const oldewMatchRest = _xeUtils.default.findTree(collectColumn, item => item.id === dragColumn.id);
459
- // 改变层级
460
- if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
461
- if (oldewMatchRest) {
462
- const {
463
- items: oCols,
464
- index: oIndex
465
- } = oldewMatchRest;
466
- const childList = dragColumn.children || [];
467
- childList.forEach(column => {
468
- column.parentId = dragColumn.parentId;
469
- });
470
- oCols.splice(oIndex, 1, ...childList);
471
- dragColumn.children = [];
472
- }
473
- } else {
474
- if (oldewMatchRest) {
475
- const {
476
- items: oCols,
477
- index: oIndex,
478
- parent: oParent
479
- } = oldewMatchRest;
480
- oCols.splice(oIndex, 1);
481
- if (!oParent) {
482
- oafIndex = oIndex;
483
- }
484
- }
485
- }
486
- const newMatchRest = _xeUtils.default.findTree(collectColumn, item => item.id === newColumn.id);
487
- if (newMatchRest) {
488
- const {
489
- items: nCols,
490
- index: nIndex,
491
- parent: nParent
492
- } = newMatchRest;
493
- // 转子级
494
- if (isCrossDrag && isToChildDrag && prevDragToChild) {
495
- dragColumn.parentId = newColumn.id;
496
- newColumn.children = (newColumn.children || []).concat([dragColumn]);
497
- } else {
498
- dragColumn.parentId = newColumn.parentId;
499
- nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
500
- }
501
- if (!nParent) {
502
- nafIndex = nIndex;
503
- }
504
- }
505
- _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parent) => {
506
- if (!parent) {
507
- const sortIndex = index + 1;
508
- column.renderSortNumber = sortIndex;
509
- }
510
- });
511
- } else {
512
- oafIndex = _xeUtils.default.findIndexOf(customColumnList, item => item.id === dragColumn.id);
513
- customColumnList.splice(oafIndex, 1);
514
- nafIndex = _xeUtils.default.findIndexOf(customColumnList, item => item.id === newColumn.id);
515
- customColumnList.splice(nafIndex + dragOffsetIndex, 0, dragColumn);
516
- }
517
- if (mouseConfig) {
518
- if ($xeTable.clearSelected) {
519
- $xeTable.clearSelected();
520
- }
521
- if ($xeTable.clearCellAreas) {
522
- $xeTable.clearCellAreas();
523
- $xeTable.clearCopyCellArea();
524
- }
525
- }
526
- $xeTable.dispatchEvent('column-dragend', {
527
- oldColumn: dragColumn,
528
- newColumn,
529
- dragColumn,
530
- dragPos: prevDragPos,
531
- offsetIndex: dragOffsetIndex,
532
- _index: {
533
- newIndex: nafIndex,
534
- oldIndex: oafIndex
535
- }
536
- }, evnt);
537
- if (immediate) {
538
- tableReactData.customColumnList = collectColumn.slice(0);
539
- $xeTable.handleColDragSwapColumn();
540
- }
541
- }).catch(() => {});
542
- }
543
- }
544
- hideDropTip();
545
- customPanelReactData.dragCol = null;
546
- customPanelReactData.dragGroupField = null;
547
- customPanelReactData.dragAggFnCol = null;
548
- customPanelInternalData.prevDragGroupField = null;
549
- customPanelInternalData.prevDragAggFnColid = null;
550
- trEl.draggable = false;
551
- trEl.removeAttribute('drag-pos');
552
- (0, _dom.removeClass)(trEl, 'active--drag-target');
553
- (0, _dom.removeClass)(trEl, 'active--drag-origin');
554
- };
555
- const sortDragoverEvent = evnt => {
556
- const customOpts = computeCustomOpts.value;
557
- const {
558
- immediate
559
- } = customOpts;
560
- const columnDragOpts = computeColumnDragOpts.value;
561
- const {
562
- isCrossDrag,
563
- isToChildDrag
564
- } = columnDragOpts;
565
- const optEl = evnt.currentTarget;
566
- const isControlKey = (0, _dom.hasControlKey)(evnt);
567
- const colid = optEl.getAttribute('colid');
568
- const column = $xeTable.getColumnById(colid);
569
- const {
570
- dragCol
571
- } = customPanelReactData;
572
- customPanelInternalData.prevDragGroupField = null;
573
- customPanelInternalData.prevDragAggFnColid = null;
574
- // 是否移入有效列
575
- if (column && (isCrossDrag || column.level === 1)) {
576
- evnt.preventDefault();
577
- const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
578
- const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
579
- if (!dragCol || dragCol && dragCol.id === column.id || !isCrossDrag && column.level > 1 || !immediate && column.level > 1) {
580
- showDropTip(evnt, optEl, false, dragPos);
581
- return;
582
- }
583
- customPanelInternalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && isControlKey && immediate);
584
- customPanelInternalData.prevDragCol = column;
585
- customPanelInternalData.prevDragPos = dragPos;
586
- showDropTip(evnt, optEl, true, dragPos);
587
- }
588
- };
589
- const renderDragTip = () => {
590
- const {
591
- dragTipText
592
- } = customPanelReactData;
593
- const columnDragOpts = computeColumnDragOpts.value;
594
- return (0, _vue.h)('div', {}, [(0, _vue.h)('div', {
595
- ref: refDragLineElem,
596
- class: ['vxe-table-custom-popup--drag-line', {
597
- 'is--guides': columnDragOpts.showGuidesStatus
598
- }]
599
- }), (0, _vue.h)('div', {
600
- ref: refDragTipElem,
601
- class: 'vxe-table-custom-popup--drag-tip'
602
- }, [(0, _vue.h)('div', {
603
- class: 'vxe-table-custom-popup--drag-tip-wrapper'
604
- }, [(0, _vue.h)('div', {
605
- class: 'vxe-table-custom-popup--drag-tip-status'
606
- }, [(0, _vue.h)('span', {
607
- class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
608
- }), (0, _vue.h)('span', {
609
- class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
610
- }), (0, _vue.h)('span', {
611
- class: ['vxe-table-custom-popup--drag-tip-group-status', getIcon().TABLE_DRAG_STATUS_AGG_GROUP]
612
- }), (0, _vue.h)('span', {
613
- class: ['vxe-table-custom-popup--drag-tip-values-status', getIcon().TABLE_DRAG_STATUS_AGG_VALUES]
614
- }), (0, _vue.h)('span', {
615
- class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
616
- })]), (0, _vue.h)('div', {
617
- class: 'vxe-table-custom-popup--drag-tip-content'
618
- }, `${dragTipText || ''}`)])])]);
619
- };
620
- const renderSimplePanel = () => {
621
- const $xeGrid = $xeTable.xeGrid;
622
- const $xeGantt = $xeTable.xeGantt;
623
- const tableProps = $xeTable.props;
624
- const {
625
- customStore
626
- } = props;
627
- const {
628
- treeConfig,
629
- rowGroupConfig,
630
- aggregateConfig
631
- } = tableProps;
632
- const {
633
- isCustomStatus,
634
- customColumnList
635
- } = tableReactData;
636
- const customOpts = computeCustomOpts.value;
637
- const {
638
- immediate
639
- } = customOpts;
640
- const columnDragOpts = computeColumnDragOpts.value;
641
- const {
642
- maxHeight
643
- } = customStore;
644
- const {
645
- checkMethod,
646
- visibleMethod,
647
- allowVisible,
648
- allowSort,
649
- allowFixed,
650
- trigger,
651
- placement
652
- } = customOpts;
653
- const isMaxFixedColumn = computeIsMaxFixedColumn.value;
654
- const {
655
- isCrossDrag
656
- } = columnDragOpts;
657
- const slots = customOpts.slots || {};
658
- const headerSlot = slots.header;
659
- const topSlot = slots.top;
660
- const bottomSlot = slots.bottom;
661
- const defaultSlot = slots.default;
662
- const footerSlot = slots.footer;
663
- const colVNs = [];
664
- const customWrapperOns = {};
665
- const isAllChecked = customStore.isAll;
666
- const isAllIndeterminate = customStore.isIndeterminate;
667
- // hover 触发
668
- if (trigger === 'hover') {
669
- customWrapperOns.onMouseenter = handleWrapperMouseenterEvent;
670
- customWrapperOns.onMouseleave = handleWrapperMouseleaveEvent;
671
- }
672
- const params = {
673
- $table: $xeTable,
674
- $grid: $xeGrid,
675
- $gantt: $xeGantt,
676
- columns: customColumnList,
677
- isAllChecked,
678
- isAllIndeterminate,
679
- isCustomStatus
680
- };
681
- _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
682
- const isVisible = visibleMethod ? visibleMethod({
683
- $table: $xeTable,
684
- column
685
- }) : true;
686
- if (isVisible) {
687
- const isChecked = column.renderVisible;
688
- const isIndeterminate = column.halfVisible;
689
- const isColGroup = column.children && column.children.length;
690
- const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
691
- const isDisabled = checkMethod ? !checkMethod({
692
- $table: $xeTable,
693
- column
694
- }) : false;
695
- const isHidden = !isChecked;
696
- colVNs.push((0, _vue.h)('li', {
697
- key: column.id,
698
- colid: column.id,
699
- class: ['vxe-table-custom--option', `level--${column.level}`, {
700
- 'is--hidden': isDisabled || isHidden,
701
- 'is--group': isColGroup
702
- }],
703
- onDragstart: sortDragstartEvent,
704
- onDragend: sortDragendEvent,
705
- onDragover: sortDragoverEvent
706
- }, [allowVisible ? (0, _vue.h)('div', {
707
- class: ['vxe-table-custom--checkbox-option', {
708
- 'is--checked': isChecked,
709
- 'is--indeterminate': isIndeterminate,
710
- 'is--disabled': isDisabled
711
- }],
712
- title: getI18n('vxe.custom.setting.colVisible'),
713
- onClick: evnt => {
714
- if (!isDisabled) {
715
- changeCheckboxOption(column, evnt);
716
- }
717
- }
718
- }, [(0, _vue.h)('span', {
719
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
720
- })]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('div', {
721
- class: 'vxe-table-custom--name-option'
722
- }, [allowSort && ((isCrossDrag ? immediate : false) || column.level === 1) ? (0, _vue.h)('div', {
723
- class: 'vxe-table-custom--sort-option'
724
- }, [(0, _vue.h)('span', Object.assign({
725
- class: ['vxe-table-custom--sort-btn', {
726
- 'is--disabled': isDisabled || isHidden
727
- }],
728
- title: getI18n('vxe.custom.setting.sortHelpTip')
729
- }, isDisabled || isHidden ? {} : {
730
- onMousedown: sortMousedownEvent,
731
- onMouseup: sortMouseupEvent
732
- }), [(0, _vue.h)('i', {
733
- class: getIcon().TABLE_CUSTOM_SORT
734
- })])]) : (0, _vue.createCommentVNode)(), column.type === 'html' ? (0, _vue.h)('div', {
735
- key: '1',
736
- class: 'vxe-table-custom--checkbox-label',
737
- innerHTML: colTitle
738
- }) : (0, _vue.h)('div', {
739
- key: '0',
740
- class: 'vxe-table-custom--checkbox-label'
741
- }, colTitle)]), !parent && allowFixed ? (0, _vue.h)('div', {
742
- class: 'vxe-table-custom--fixed-option'
743
- }, [VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
744
- mode: 'text',
745
- icon: column.renderFixed === 'left' ? getIcon().TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_LEFT,
746
- status: column.renderFixed === 'left' ? 'primary' : '',
747
- disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
748
- title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft'),
749
- onClick: ({
750
- $event
751
- }) => {
752
- changeFixedOption(column, 'left', $event);
753
- }
754
- }) : (0, _vue.createCommentVNode)(), VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
755
- mode: 'text',
756
- icon: column.renderFixed === 'right' ? getIcon().TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE : getIcon().TOOLBAR_TOOLS_FIXED_RIGHT,
757
- status: column.renderFixed === 'right' ? 'primary' : '',
758
- disabled: isDisabled || isHidden || isMaxFixedColumn && !column.renderFixed,
759
- title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight'),
760
- onClick: ({
761
- $event
762
- }) => {
763
- changeFixedOption(column, 'right', $event);
764
- }
765
- }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)()]));
766
- }
767
- });
768
- return (0, _vue.h)('div', {
769
- ref: refElem,
770
- key: 'simple',
771
- class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
772
- 'is--active': customStore.visible
773
- }],
774
- style: maxHeight && !['left', 'right'].includes(placement || '') ? {
775
- maxHeight: `${maxHeight}px`
776
- } : {}
777
- }, customStore.visible ? [(0, _vue.h)('div', {
778
- ref: refBodyWrapperElem,
779
- class: 'vxe-table-custom-simple--body-wrapper'
780
- }, [!treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregateSimplePanel ? (0, _vue.h)($xeTable.getPivotTableAggregateSimplePanel(), {
781
- customStore
782
- }) : renderEmptyElement($xeTable), (0, _vue.h)('div', {
783
- ref: refCustomBodyElem,
784
- class: 'vxe-table-custom--handle-wrapper'
785
- }, [(0, _vue.h)('div', {
786
- class: 'vxe-table-custom--header'
787
- }, headerSlot ? $xeTable.callSlot(headerSlot, params) : [(0, _vue.h)('ul', {
788
- class: 'vxe-table-custom--panel-list'
789
- }, [(0, _vue.h)('li', {
790
- class: 'vxe-table-custom--option'
791
- }, [allowVisible ? (0, _vue.h)('div', {
792
- class: ['vxe-table-custom--checkbox-option', {
793
- 'is--checked': isAllChecked,
794
- 'is--indeterminate': isAllIndeterminate
795
- }],
796
- title: getI18n('vxe.table.allTitle'),
797
- onClick: allOptionEvent
798
- }, [(0, _vue.h)('span', {
799
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
800
- }), (0, _vue.h)('span', {
801
- class: 'vxe-checkbox--label'
802
- }, getI18n('vxe.toolbar.customAll'))]) : (0, _vue.h)('span', {
803
- class: 'vxe-checkbox--label'
804
- }, getI18n('vxe.table.customTitle'))])])]), (0, _vue.h)('div', {
805
- class: 'vxe-table-custom--body'
806
- }, [topSlot ? (0, _vue.h)('div', {
807
- class: 'vxe-table-custom--panel-top'
808
- }, $xeTable.callSlot(topSlot, params)) : renderEmptyElement($xeTable), defaultSlot ? (0, _vue.h)('div', {
809
- class: 'vxe-table-custom--panel-body'
810
- }, $xeTable.callSlot(defaultSlot, params)) : (0, _vue.h)(_vue.TransitionGroup, Object.assign({
811
- class: 'vxe-table-custom--panel-list',
812
- name: 'vxe-table-custom--list',
813
- tag: 'ul'
814
- }, customWrapperOns), {
815
- default: () => colVNs
816
- }), bottomSlot ? (0, _vue.h)('div', {
817
- class: 'vxe-table-custom--panel-bottom'
818
- }, $xeTable.callSlot(bottomSlot, params)) : renderEmptyElement($xeTable)]), customOpts.showFooter ? (0, _vue.h)('div', {
819
- class: 'vxe-table-custom--footer'
820
- }, footerSlot ? $xeTable.callSlot(footerSlot, params) : [(0, _vue.h)('div', {
821
- class: 'vxe-table-custom--footer-buttons'
822
- }, [VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
823
- mode: 'text',
824
- content: customOpts.resetButtonText || getI18n('vxe.table.customRestore'),
825
- disabled: !isCustomStatus,
826
- onClick: resetCustomEvent
827
- }) : (0, _vue.createCommentVNode)(), immediate ? VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
828
- mode: 'text',
829
- content: customOpts.closeButtonText || getI18n('vxe.table.customClose'),
830
- onClick: cancelCloseEvent
831
- }) : (0, _vue.createCommentVNode)() : VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
832
- mode: 'text',
833
- content: customOpts.cancelButtonText || getI18n('vxe.table.customCancel'),
834
- onClick: cancelCustomEvent
835
- }) : (0, _vue.createCommentVNode)(), immediate ? (0, _vue.createCommentVNode)() : VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
836
- mode: 'text',
837
- status: 'primary',
838
- content: customOpts.confirmButtonText || getI18n('vxe.table.customConfirm'),
839
- onClick: confirmCustomEvent
840
- }) : (0, _vue.createCommentVNode)()])]) : null]), renderDragTip()])] : []);
841
- };
842
- const renderPopupPanel = () => {
843
- const $xeGrid = $xeTable.xeGrid;
844
- const $xeGantt = $xeTable.xeGantt;
845
- const {
846
- customStore
847
- } = props;
848
- const {
849
- treeConfig,
850
- rowGroupConfig,
851
- aggregateConfig,
852
- resizable: allResizable
853
- } = tableProps;
854
- const {
855
- isCustomStatus,
856
- customColumnList
857
- } = tableReactData;
858
- const customOpts = computeCustomOpts.value;
859
- const {
860
- immediate
861
- } = customOpts;
862
- const columnDragOpts = computeColumnDragOpts.value;
863
- const {
864
- mode,
865
- modalOptions,
866
- drawerOptions,
867
- allowVisible,
868
- allowSort,
869
- allowFixed,
870
- allowResizable,
871
- checkMethod,
872
- visibleMethod
873
- } = customOpts;
874
- const columnOpts = computeColumnOpts.value;
875
- const {
876
- maxFixedSize
877
- } = columnOpts;
878
- const resizableOpts = computeResizableOpts.value;
879
- const {
880
- minWidth: reMinWidth,
881
- maxWidth: reMaxWidth
882
- } = resizableOpts;
883
- const modalOpts = Object.assign({}, modalOptions);
884
- const drawerOpts = Object.assign({}, drawerOptions);
885
- const isMaxFixedColumn = computeIsMaxFixedColumn.value;
886
- const {
887
- isCrossDrag
888
- } = columnDragOpts;
889
- const slots = customOpts.slots || {};
890
- const headerSlot = slots.header;
891
- const topSlot = slots.top;
892
- const bottomSlot = slots.bottom;
893
- const defaultSlot = slots.default;
894
- const footerSlot = slots.footer;
895
- const trVNs = [];
896
- const isAllChecked = customStore.isAll;
897
- const isAllIndeterminate = customStore.isIndeterminate;
898
- const params = {
899
- $table: $xeTable,
900
- $grid: $xeGrid,
901
- $gantt: $xeGantt,
902
- columns: customColumnList,
903
- isAllChecked,
904
- isAllIndeterminate,
905
- isCustomStatus
906
- };
907
- _xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
908
- const isVisible = visibleMethod ? visibleMethod({
909
- $table: $xeTable,
910
- column
911
- }) : true;
912
- if (isVisible) {
913
- // 默认继承调整宽度
914
- let customMinWidth = 0;
915
- let customMaxWidth = 0;
916
- if (allowResizable) {
917
- const resizeParams = {
918
- $table: $xeTable,
919
- column,
920
- columnIndex: index,
921
- $columnIndex: index,
922
- $rowIndex: -1
923
- };
924
- if (reMinWidth) {
925
- customMinWidth = _xeUtils.default.toNumber(_xeUtils.default.isFunction(reMinWidth) ? reMinWidth(resizeParams) : reMinWidth);
926
- }
927
- if (reMaxWidth) {
928
- customMaxWidth = _xeUtils.default.toNumber(_xeUtils.default.isFunction(reMaxWidth) ? reMaxWidth(resizeParams) : reMaxWidth);
929
- }
930
- }
931
- const isChecked = column.renderVisible;
932
- const isIndeterminate = column.halfVisible;
933
- const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
934
- const isColGroup = column.children && column.children.length;
935
- const isDisabled = checkMethod ? !checkMethod({
936
- $table: $xeTable,
937
- column
938
- }) : false;
939
- const isHidden = !isChecked;
940
- trVNs.push((0, _vue.h)('tr', {
941
- key: column.id,
942
- colid: column.id,
943
- class: [`vxe-table-custom-popup--row level--${column.level}`, {
944
- 'is--group': isColGroup
945
- }],
946
- onDragstart: sortDragstartEvent,
947
- onDragend: sortDragendEvent,
948
- onDragover: sortDragoverEvent
949
- }, [allowVisible ? (0, _vue.h)('td', {
950
- class: 'vxe-table-custom-popup--column-item col--visible'
951
- }, [(0, _vue.h)('div', {
952
- class: ['vxe-table-custom--checkbox-option', {
953
- 'is--checked': isChecked,
954
- 'is--indeterminate': isIndeterminate,
955
- 'is--disabled': isDisabled
956
- }],
957
- title: getI18n('vxe.custom.setting.colVisible'),
958
- onClick: evnt => {
959
- if (!isDisabled) {
960
- changeCheckboxOption(column, evnt);
961
- }
962
- }
963
- }, [(0, _vue.h)('span', {
964
- class: ['vxe-checkbox--icon', isIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
965
- })])]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('td', {
966
- class: 'vxe-table-custom-popup--column-item col--name'
967
- }, [(0, _vue.h)('div', {
968
- class: 'vxe-table-custom-popup--name'
969
- }, [allowSort ? (isCrossDrag ? immediate : false) || column.level === 1 ? (0, _vue.h)('div', Object.assign({
970
- class: ['vxe-table-custom-popup--column-sort-btn', {
971
- 'is--disabled': isDisabled || isHidden
972
- }],
973
- title: getI18n('vxe.custom.setting.sortHelpTip')
974
- }, isDisabled || isHidden ? {} : {
975
- onMousedown: sortMousedownEvent,
976
- onMouseup: sortMouseupEvent
977
- }), [(0, _vue.h)('i', {
978
- class: getIcon().TABLE_CUSTOM_SORT
979
- })]) : (0, _vue.h)('div', {
980
- class: 'vxe-table-custom-popup--column-sort-placeholder'
981
- }) : (0, _vue.createCommentVNode)(), column.type === 'html' ? (0, _vue.h)('div', {
982
- key: '1',
983
- class: 'vxe-table-custom-popup--title',
984
- innerHTML: colTitle
985
- }) : (0, _vue.h)('div', {
986
- key: '0',
987
- class: 'vxe-table-custom-popup--title',
988
- title: colTitle
989
- }, colTitle)])]), allowResizable ? (0, _vue.h)('td', {
990
- class: 'vxe-table-custom-popup--column-item col--resizable'
991
- }, [column.children && column.children.length || !(_xeUtils.default.isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? (0, _vue.h)('span', '-') : VxeUINumberInputComponent ? (0, _vue.h)(VxeUINumberInputComponent, {
992
- type: 'integer',
993
- immediate: false,
994
- disabled: isDisabled || isHidden,
995
- modelValue: column.renderResizeWidth,
996
- min: customMinWidth || undefined,
997
- max: customMaxWidth || undefined,
998
- 'onUpdate:modelValue'(value) {
999
- const width = Math.max(0, Number(value));
1000
- column.renderResizeWidth = width;
1001
- },
1002
- onChange() {
1003
- changeColumnWidth(column);
1004
- }
1005
- }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)(), allowFixed ? (0, _vue.h)('td', {
1006
- class: 'vxe-table-custom-popup--column-item col--fixed'
1007
- }, [parent ? (0, _vue.h)('span', '-') : VxeUIRadioGroupComponent ? (0, _vue.h)(VxeUIRadioGroupComponent, {
1008
- modelValue: column.renderFixed || '',
1009
- type: 'button',
1010
- size: 'mini',
1011
- disabled: isDisabled || isHidden,
1012
- options: [{
1013
- label: getI18n('vxe.custom.setting.fixedLeft'),
1014
- value: 'left',
1015
- disabled: isDisabled || isHidden || isMaxFixedColumn
1016
- }, {
1017
- label: getI18n('vxe.custom.setting.fixedUnset'),
1018
- value: '',
1019
- disabled: isDisabled || isHidden
1020
- }, {
1021
- label: getI18n('vxe.custom.setting.fixedRight'),
1022
- value: 'right',
1023
- disabled: isDisabled || isHidden || isMaxFixedColumn
1024
- }],
1025
- onChange({
1026
- label,
1027
- $event
1028
- }) {
1029
- changeFixedOption(column, label, $event);
1030
- }
1031
- }) : (0, _vue.createCommentVNode)()]) : (0, _vue.createCommentVNode)()]));
1032
- }
1033
- });
1034
- const scopedSlots = {
1035
- default: () => {
1036
- return (0, _vue.h)('div', {
1037
- ref: refBodyWrapperElem,
1038
- class: 'vxe-table-custom-popup--body-wrapper'
1039
- }, defaultSlot ? $xeTable.callSlot(defaultSlot, params) : [(0, _vue.h)('div', {
1040
- ref: refCustomBodyElem,
1041
- class: 'vxe-table-custom-popup--handle-wrapper'
1042
- }, [topSlot ? (0, _vue.h)('div', {
1043
- class: 'vxe-table-custom-popup--table-top'
1044
- }, $xeTable.callSlot(topSlot, params)) : renderEmptyElement($xeTable), (0, _vue.h)('div', {
1045
- class: 'vxe-table-custom-popup--table-wrapper'
1046
- }, [(0, _vue.h)('table', {}, [(0, _vue.h)('colgroup', {}, [allowVisible ? (0, _vue.h)('col', {
1047
- class: 'vxe-table-custom-popup--table-col-seq'
1048
- }) : (0, _vue.createCommentVNode)(), (0, _vue.h)('col', {
1049
- class: 'vxe-table-custom-popup--table-col-title'
1050
- }), allowResizable ? (0, _vue.h)('col', {
1051
- class: 'vxe-table-custom-popup--table-col-width'
1052
- }) : (0, _vue.createCommentVNode)(), allowFixed ? (0, _vue.h)('col', {
1053
- class: 'vxe-table-custom-popup--table-col-fixed'
1054
- }) : (0, _vue.createCommentVNode)()]), (0, _vue.h)('thead', {}, [(0, _vue.h)('tr', {}, [allowVisible ? (0, _vue.h)('th', {}, [(0, _vue.h)('div', {
1055
- class: ['vxe-table-custom--checkbox-option', {
1056
- 'is--checked': isAllChecked,
1057
- 'is--indeterminate': isAllIndeterminate
1058
- }],
1059
- title: getI18n('vxe.table.allTitle'),
1060
- onClick: allOptionEvent
1061
- }, [(0, _vue.h)('span', {
1062
- class: ['vxe-checkbox--icon', isAllIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllChecked ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
1063
- }), (0, _vue.h)('span', {
1064
- class: 'vxe-checkbox--label'
1065
- }, getI18n('vxe.toolbar.customAll'))])]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colTitle')), allowResizable ? (0, _vue.h)('th', {}, getI18n('vxe.custom.setting.colResizable')) : (0, _vue.createCommentVNode)(), allowFixed ? (0, _vue.h)('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize])) : (0, _vue.createCommentVNode)()])]), (0, _vue.h)(_vue.TransitionGroup, {
1066
- class: 'vxe-table-custom--panel-list',
1067
- tag: 'tbody',
1068
- name: 'vxe-table-custom--list'
1069
- }, {
1070
- default: () => trVNs
1071
- })])]), bottomSlot ? (0, _vue.h)('div', {
1072
- class: 'vxe-table-custom-popup--table-bottom'
1073
- }, $xeTable.callSlot(bottomSlot, params)) : renderEmptyElement($xeTable), renderDragTip()]), !treeConfig && (aggregateConfig || rowGroupConfig) && $xeTable.getPivotTableAggregatePopupPanel ? (0, _vue.h)($xeTable.getPivotTableAggregatePopupPanel(), {
1074
- customStore
1075
- }) : renderEmptyElement($xeTable)]);
1076
- },
1077
- footer: () => {
1078
- if (footerSlot) {
1079
- return $xeTable.callSlot(footerSlot, params);
1080
- }
1081
- return (0, _vue.h)('div', {
1082
- class: 'vxe-table-custom-popup--footer'
1083
- }, [VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
1084
- content: customOpts.resetButtonText || getI18n('vxe.custom.cstmRestore'),
1085
- disabled: !isCustomStatus,
1086
- onClick: resetCustomEvent
1087
- }) : (0, _vue.createCommentVNode)(), immediate ? VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
1088
- content: customOpts.closeButtonText || getI18n('vxe.table.customClose'),
1089
- onClick: cancelCloseEvent
1090
- }) : (0, _vue.createCommentVNode)() : VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
1091
- content: customOpts.cancelButtonText || getI18n('vxe.table.customCancel'),
1092
- onClick: cancelCustomEvent
1093
- }) : (0, _vue.createCommentVNode)(), immediate ? (0, _vue.createCommentVNode)() : VxeUIButtonComponent ? (0, _vue.h)(VxeUIButtonComponent, {
1094
- status: 'primary',
1095
- content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm'),
1096
- onClick: confirmCustomEvent
1097
- }) : (0, _vue.createCommentVNode)()]);
1098
- }
1099
- };
1100
- if (headerSlot) {
1101
- scopedSlots.header = () => $xeTable.callSlot(headerSlot, params);
1102
- }
1103
- if (mode === 'drawer') {
1104
- return VxeUIDrawerComponent ? (0, _vue.h)(VxeUIDrawerComponent, {
1105
- key: 'drawer',
1106
- className: ['vxe-table-custom-drawer-wrapper', 'vxe-table--ignore-clear', drawerOpts.className || ''].join(' '),
1107
- modelValue: customStore.visible,
1108
- title: drawerOpts.title || getI18n('vxe.custom.cstmTitle'),
1109
- width: drawerOpts.width || Math.min(880, Math.floor(document.documentElement.clientWidth * 0.6)),
1110
- position: drawerOpts.position,
1111
- resize: !!drawerOpts.resize,
1112
- escClosable: !!drawerOpts.escClosable,
1113
- maskClosable: !!drawerOpts.maskClosable,
1114
- destroyOnClose: true,
1115
- showFooter: true,
1116
- 'onUpdate:modelValue'(value) {
1117
- customStore.visible = value;
1118
- }
1119
- }, scopedSlots) : (0, _vue.createCommentVNode)();
1120
- }
1121
- return VxeUIModalComponent ? (0, _vue.h)(VxeUIModalComponent, {
1122
- key: 'modal',
1123
- className: ['vxe-table-custom-modal-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
1124
- modelValue: customStore.visible,
1125
- title: modalOpts.title || getI18n('vxe.custom.cstmTitle'),
1126
- width: modalOpts.width || Math.min(880, document.documentElement.clientWidth),
1127
- minWidth: modalOpts.minWidth || 700,
1128
- height: modalOpts.height || Math.min(680, document.documentElement.clientHeight),
1129
- minHeight: modalOpts.minHeight || 400,
1130
- showZoom: modalOpts.showZoom,
1131
- showMaximize: modalOpts.showMaximize,
1132
- showMinimize: modalOpts.showMinimize,
1133
- mask: modalOpts.mask,
1134
- lockView: modalOpts.lockView,
1135
- resize: modalOpts.resize,
1136
- escClosable: !!modalOpts.escClosable,
1137
- maskClosable: !!modalOpts.maskClosable,
1138
- destroyOnClose: true,
1139
- showFooter: true,
1140
- 'onUpdate:modelValue'(value) {
1141
- customStore.visible = value;
1142
- }
1143
- }, scopedSlots) : (0, _vue.createCommentVNode)();
1144
- };
1145
- const renderVN = () => {
1146
- const customOpts = computeCustomOpts.value;
1147
- if (['modal', 'drawer', 'popup'].includes(`${customOpts.mode}`)) {
1148
- return renderPopupPanel();
1149
- }
1150
- return renderSimplePanel();
1151
- };
1152
- (0, _vue.nextTick)(() => {
1153
- const customOpts = computeCustomOpts.value;
1154
- const {
1155
- mode
1156
- } = customOpts;
1157
- if (!VxeUIModalComponent && mode === 'modal') {
1158
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-modal']);
1159
- }
1160
- if (!VxeUIDrawerComponent && mode === 'drawer') {
1161
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-drawer']);
1162
- }
1163
- if (!VxeUIButtonComponent) {
1164
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-button']);
1165
- }
1166
- if (!VxeUINumberInputComponent) {
1167
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-number-input']);
1168
- }
1169
- if (!VxeUIRadioGroupComponent) {
1170
- (0, _log.errLog)('vxe.error.reqComp', ['vxe-radio-group']);
1171
- }
1172
- });
1173
- const $xeTableCustomPanel = {
1174
- xID,
1175
- props,
1176
- context,
1177
- reactData: customPanelReactData,
1178
- internalData: customPanelInternalData,
1179
- xeTable: $xeTable,
1180
- getRefMaps: () => refMaps,
1181
- getComputeMaps: () => computeMaps,
1182
- renderVN
1183
- };
1184
- (0, _vue.onUnmounted)(() => {
1185
- customPanelInternalData = createInternalData();
1186
- });
1187
- (0, _vue.provide)('$xeTableCustomPanel', $xeTableCustomPanel);
1188
- return $xeTableCustomPanel;
1189
- },
1190
- render() {
1191
- return this.renderVN();
1192
- }
1193
- });