vxe-table 4.16.17 → 4.16.18

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 (228) hide show
  1. package/es/colgroup/style.css +0 -0
  2. package/es/colgroup/style.min.css +0 -0
  3. package/es/column/style.css +0 -0
  4. package/es/column/style.min.css +0 -0
  5. package/es/grid/style.css +86 -0
  6. package/es/grid/style.min.css +1 -0
  7. package/es/iconfont.1758510533325.ttf +0 -0
  8. package/es/iconfont.1758510533325.woff +0 -0
  9. package/es/iconfont.1758510533325.woff2 +0 -0
  10. package/es/index.esm.js +3 -0
  11. package/es/locale/lang/ar-EG.d.ts +2 -0
  12. package/es/locale/lang/de-DE.d.ts +2 -0
  13. package/es/locale/lang/en-US.d.ts +2 -0
  14. package/es/locale/lang/es-ES.d.ts +2 -0
  15. package/es/locale/lang/fr-FR.d.ts +2 -0
  16. package/es/locale/lang/hu-HU.d.ts +2 -0
  17. package/es/locale/lang/hy-AM.d.ts +2 -0
  18. package/es/locale/lang/id-ID.d.ts +2 -0
  19. package/es/locale/lang/it-IT.d.ts +2 -0
  20. package/es/locale/lang/ja-JP.d.ts +2 -0
  21. package/es/locale/lang/ko-KR.d.ts +2 -0
  22. package/es/locale/lang/ms-MY.d.ts +2 -0
  23. package/es/locale/lang/nb-NO.d.ts +2 -0
  24. package/es/locale/lang/pt-BR.d.ts +2 -0
  25. package/es/locale/lang/ru-RU.d.ts +2 -0
  26. package/es/locale/lang/th-TH.d.ts +2 -0
  27. package/es/locale/lang/ug-CN.d.ts +2 -0
  28. package/es/locale/lang/uk-UA.d.ts +2 -0
  29. package/es/locale/lang/uz-UZ.d.ts +2 -0
  30. package/es/locale/lang/vi-VN.d.ts +2 -0
  31. package/es/locale/lang/zh-CHT.d.ts +2 -0
  32. package/es/locale/lang/zh-CN.d.ts +2 -0
  33. package/es/locale/lang/zh-HK.d.ts +2 -0
  34. package/es/locale/lang/zh-MO.d.ts +2 -0
  35. package/es/locale/lang/zh-TW.d.ts +2 -0
  36. package/es/style.css +1 -1
  37. package/es/table/style.css +3657 -0
  38. package/es/table/style.min.css +1 -0
  39. package/es/toolbar/style.css +90 -0
  40. package/es/toolbar/style.min.css +1 -0
  41. package/es/ui/index.js +1 -1
  42. package/es/ui/src/log.js +1 -1
  43. package/es/ui/style.css +0 -0
  44. package/es/ui/style.min.css +0 -0
  45. package/es/v-x-e-table/style.css +0 -0
  46. package/es/v-x-e-table/style.min.css +0 -0
  47. package/es/vxe-colgroup/style.css +0 -0
  48. package/es/vxe-colgroup/style.min.css +0 -0
  49. package/es/vxe-column/style.css +0 -0
  50. package/es/vxe-column/style.min.css +0 -0
  51. package/es/vxe-grid/style.css +86 -0
  52. package/es/vxe-grid/style.min.css +1 -0
  53. package/es/vxe-table/style.css +3657 -0
  54. package/es/vxe-table/style.min.css +1 -0
  55. package/es/vxe-toolbar/style.css +90 -0
  56. package/es/vxe-toolbar/style.min.css +1 -0
  57. package/es/vxe-ui/style.css +0 -0
  58. package/es/vxe-ui/style.min.css +0 -0
  59. package/es/vxe-v-x-e-table/style.css +0 -0
  60. package/es/vxe-v-x-e-table/style.min.css +0 -0
  61. package/lib/colgroup/style/index.js +1 -0
  62. package/lib/colgroup/style/style.css +0 -0
  63. package/lib/colgroup/style/style.min.css +0 -0
  64. package/lib/column/style/index.js +1 -0
  65. package/lib/column/style/style.css +0 -0
  66. package/lib/column/style/style.min.css +0 -0
  67. package/lib/grid/style/index.js +1 -0
  68. package/lib/grid/style/style.css +86 -0
  69. package/lib/grid/style/style.min.css +1 -0
  70. package/lib/iconfont.1758510533325.ttf +0 -0
  71. package/lib/iconfont.1758510533325.woff +0 -0
  72. package/lib/iconfont.1758510533325.woff2 +0 -0
  73. package/lib/index.common.js +22 -0
  74. package/lib/index.umd.js +2 -2
  75. package/lib/index.umd.min.js +1 -1
  76. package/lib/locale/lang/ar-EG.d.ts +2 -0
  77. package/lib/locale/lang/ar-EG.min.js +1 -1
  78. package/lib/locale/lang/ar-EG.umd.js +806 -0
  79. package/lib/locale/lang/de-DE.d.ts +2 -0
  80. package/lib/locale/lang/de-DE.min.js +1 -1
  81. package/lib/locale/lang/de-DE.umd.js +806 -0
  82. package/lib/locale/lang/en-US.d.ts +2 -0
  83. package/lib/locale/lang/en-US.min.js +1 -1
  84. package/lib/locale/lang/en-US.umd.js +806 -0
  85. package/lib/locale/lang/es-ES.d.ts +2 -0
  86. package/lib/locale/lang/es-ES.min.js +1 -1
  87. package/lib/locale/lang/es-ES.umd.js +806 -0
  88. package/lib/locale/lang/fr-FR.d.ts +2 -0
  89. package/lib/locale/lang/fr-FR.min.js +1 -1
  90. package/lib/locale/lang/fr-FR.umd.js +806 -0
  91. package/lib/locale/lang/hu-HU.d.ts +2 -0
  92. package/lib/locale/lang/hu-HU.min.js +1 -1
  93. package/lib/locale/lang/hu-HU.umd.js +806 -0
  94. package/lib/locale/lang/hy-AM.d.ts +2 -0
  95. package/lib/locale/lang/hy-AM.min.js +1 -1
  96. package/lib/locale/lang/hy-AM.umd.js +806 -0
  97. package/lib/locale/lang/id-ID.d.ts +2 -0
  98. package/lib/locale/lang/id-ID.min.js +1 -1
  99. package/lib/locale/lang/id-ID.umd.js +806 -0
  100. package/lib/locale/lang/it-IT.d.ts +2 -0
  101. package/lib/locale/lang/it-IT.min.js +1 -1
  102. package/lib/locale/lang/it-IT.umd.js +806 -0
  103. package/lib/locale/lang/ja-JP.d.ts +2 -0
  104. package/lib/locale/lang/ja-JP.min.js +1 -1
  105. package/lib/locale/lang/ja-JP.umd.js +806 -0
  106. package/lib/locale/lang/ko-KR.d.ts +2 -0
  107. package/lib/locale/lang/ko-KR.min.js +1 -1
  108. package/lib/locale/lang/ko-KR.umd.js +806 -0
  109. package/lib/locale/lang/ms-MY.d.ts +2 -0
  110. package/lib/locale/lang/ms-MY.min.js +1 -1
  111. package/lib/locale/lang/ms-MY.umd.js +806 -0
  112. package/lib/locale/lang/nb-NO.d.ts +2 -0
  113. package/lib/locale/lang/nb-NO.min.js +1 -1
  114. package/lib/locale/lang/nb-NO.umd.js +806 -0
  115. package/lib/locale/lang/pt-BR.d.ts +2 -0
  116. package/lib/locale/lang/pt-BR.min.js +1 -1
  117. package/lib/locale/lang/pt-BR.umd.js +806 -0
  118. package/lib/locale/lang/ru-RU.d.ts +2 -0
  119. package/lib/locale/lang/ru-RU.min.js +1 -1
  120. package/lib/locale/lang/ru-RU.umd.js +806 -0
  121. package/lib/locale/lang/th-TH.d.ts +2 -0
  122. package/lib/locale/lang/th-TH.min.js +1 -1
  123. package/lib/locale/lang/th-TH.umd.js +806 -0
  124. package/lib/locale/lang/ug-CN.d.ts +2 -0
  125. package/lib/locale/lang/ug-CN.min.js +1 -1
  126. package/lib/locale/lang/ug-CN.umd.js +806 -0
  127. package/lib/locale/lang/uk-UA.d.ts +2 -0
  128. package/lib/locale/lang/uk-UA.min.js +1 -1
  129. package/lib/locale/lang/uk-UA.umd.js +806 -0
  130. package/lib/locale/lang/uz-UZ.d.ts +2 -0
  131. package/lib/locale/lang/uz-UZ.min.js +1 -1
  132. package/lib/locale/lang/uz-UZ.umd.js +806 -0
  133. package/lib/locale/lang/vi-VN.d.ts +2 -0
  134. package/lib/locale/lang/vi-VN.min.js +1 -1
  135. package/lib/locale/lang/vi-VN.umd.js +806 -0
  136. package/lib/locale/lang/zh-CHT.d.ts +2 -0
  137. package/lib/locale/lang/zh-CHT.min.js +1 -1
  138. package/lib/locale/lang/zh-CHT.umd.js +806 -0
  139. package/lib/locale/lang/zh-CN.d.ts +2 -0
  140. package/lib/locale/lang/zh-CN.min.js +1 -1
  141. package/lib/locale/lang/zh-CN.umd.js +808 -0
  142. package/lib/locale/lang/zh-HK.d.ts +2 -0
  143. package/lib/locale/lang/zh-HK.min.js +1 -1
  144. package/lib/locale/lang/zh-HK.umd.js +23 -0
  145. package/lib/locale/lang/zh-MO.d.ts +2 -0
  146. package/lib/locale/lang/zh-MO.min.js +1 -1
  147. package/lib/locale/lang/zh-MO.umd.js +23 -0
  148. package/lib/locale/lang/zh-TW.d.ts +2 -0
  149. package/lib/locale/lang/zh-TW.min.js +1 -1
  150. package/lib/locale/lang/zh-TW.umd.js +23 -0
  151. package/lib/style.css +1 -1
  152. package/lib/table/module/custom/hook.js +430 -0
  153. package/lib/table/module/custom/hook.min.js +1 -0
  154. package/lib/table/module/custom/panel.js +1193 -0
  155. package/lib/table/module/custom/panel.min.js +1 -0
  156. package/lib/table/module/edit/hook.js +1308 -0
  157. package/lib/table/module/edit/hook.min.js +1 -0
  158. package/lib/table/module/export/export-panel.js +467 -0
  159. package/lib/table/module/export/export-panel.min.js +1 -0
  160. package/lib/table/module/export/hook.js +1888 -0
  161. package/lib/table/module/export/hook.min.js +1 -0
  162. package/lib/table/module/export/import-panel.js +226 -0
  163. package/lib/table/module/export/import-panel.min.js +1 -0
  164. package/lib/table/module/export/util.js +20 -0
  165. package/lib/table/module/export/util.min.js +1 -0
  166. package/lib/table/module/filter/hook.js +442 -0
  167. package/lib/table/module/filter/hook.min.js +1 -0
  168. package/lib/table/module/filter/panel.js +265 -0
  169. package/lib/table/module/filter/panel.min.js +1 -0
  170. package/lib/table/module/keyboard/hook.js +579 -0
  171. package/lib/table/module/keyboard/hook.min.js +1 -0
  172. package/lib/table/module/menu/hook.js +392 -0
  173. package/lib/table/module/menu/hook.min.js +1 -0
  174. package/lib/table/module/menu/panel.js +145 -0
  175. package/lib/table/module/menu/panel.min.js +1 -0
  176. package/lib/table/module/validator/hook.js +681 -0
  177. package/lib/table/module/validator/hook.min.js +1 -0
  178. package/lib/table/src/header.min.js +1 -0
  179. package/lib/table/src/props.js +318 -0
  180. package/lib/table/src/props.min.js +1 -0
  181. package/lib/table/src/store.js +15 -0
  182. package/lib/table/src/store.min.js +1 -0
  183. package/lib/table/src/table.js +902 -0
  184. package/lib/table/src/table.min.js +1 -0
  185. package/lib/table/src/use/cell-view.js +57 -0
  186. package/lib/table/src/use/cell-view.min.js +1 -0
  187. package/lib/table/src/use/index.js +16 -0
  188. package/lib/table/src/use/index.min.js +1 -0
  189. package/lib/table/src/util.js +916 -0
  190. package/lib/table/src/util.min.js +1 -0
  191. package/lib/table/style/index.js +1 -0
  192. package/lib/table/style/style.css +3657 -0
  193. package/lib/table/style/style.min.css +1 -0
  194. package/lib/toolbar/style/index.js +1 -0
  195. package/lib/toolbar/style/style.css +90 -0
  196. package/lib/toolbar/style/style.min.css +1 -0
  197. package/lib/ui/index.js +1 -1
  198. package/lib/ui/index.min.js +1 -1
  199. package/lib/ui/src/log.js +1 -1
  200. package/lib/ui/src/log.min.js +1 -1
  201. package/lib/ui/style/index.js +1 -0
  202. package/lib/ui/style/style.css +0 -0
  203. package/lib/ui/style/style.min.css +0 -0
  204. package/lib/v-x-e-table/style/index.js +1 -0
  205. package/lib/v-x-e-table/style/style.css +0 -0
  206. package/lib/v-x-e-table/style/style.min.css +0 -0
  207. package/lib/vxe-colgroup/style/index.js +1 -0
  208. package/lib/vxe-colgroup/style/style.css +0 -0
  209. package/lib/vxe-colgroup/style/style.min.css +0 -0
  210. package/lib/vxe-column/style/index.js +1 -0
  211. package/lib/vxe-column/style/style.css +0 -0
  212. package/lib/vxe-column/style/style.min.css +0 -0
  213. package/lib/vxe-grid/style/index.js +1 -0
  214. package/lib/vxe-grid/style/style.css +86 -0
  215. package/lib/vxe-grid/style/style.min.css +1 -0
  216. package/lib/vxe-table/style/index.js +1 -0
  217. package/lib/vxe-table/style/style.css +3657 -0
  218. package/lib/vxe-table/style/style.min.css +1 -0
  219. package/lib/vxe-toolbar/style/index.js +1 -0
  220. package/lib/vxe-toolbar/style/style.css +90 -0
  221. package/lib/vxe-toolbar/style/style.min.css +1 -0
  222. package/lib/vxe-ui/style/index.js +1 -0
  223. package/lib/vxe-ui/style/style.css +0 -0
  224. package/lib/vxe-ui/style/style.min.css +0 -0
  225. package/lib/vxe-v-x-e-table/style/index.js +1 -0
  226. package/lib/vxe-v-x-e-table/style/style.css +0 -0
  227. package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
  228. package/package.json +1 -1
@@ -0,0 +1,392 @@
1
+ "use strict";
2
+
3
+ var _vue = require("vue");
4
+ var _xeUtils = _interopRequireDefault(require("xe-utils"));
5
+ var _ui = require("../../../ui");
6
+ var _dom = require("../../../ui/src/dom");
7
+ var _utils = require("../../../ui/src/utils");
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const {
10
+ menus,
11
+ hooks,
12
+ globalEvents,
13
+ GLOBAL_EVENT_KEYS
14
+ } = _ui.VxeUI;
15
+ const tableMenuMethodKeys = ['closeMenu'];
16
+ hooks.add('tableMenuModule', {
17
+ setupTable($xeTable) {
18
+ const {
19
+ xID,
20
+ props,
21
+ reactData,
22
+ internalData
23
+ } = $xeTable;
24
+ const {
25
+ refElem,
26
+ refTableFilter,
27
+ refTableMenu
28
+ } = $xeTable.getRefMaps();
29
+ const {
30
+ computeMouseOpts,
31
+ computeIsContentMenu,
32
+ computeMenuOpts
33
+ } = $xeTable.getComputeMaps();
34
+ let menuMethods = {};
35
+ let menuPrivateMethods = {};
36
+ /**
37
+ * 显示快捷菜单
38
+ */
39
+ const handleOpenMenuEvent = (evnt, type, params) => {
40
+ const {
41
+ ctxMenuStore
42
+ } = reactData;
43
+ const isContentMenu = computeIsContentMenu.value;
44
+ const menuOpts = computeMenuOpts.value;
45
+ const config = menuOpts[type];
46
+ const {
47
+ transfer,
48
+ visibleMethod
49
+ } = menuOpts;
50
+ if (config) {
51
+ const {
52
+ options,
53
+ disabled
54
+ } = config;
55
+ if (disabled) {
56
+ evnt.preventDefault();
57
+ } else if (isContentMenu && options && options.length) {
58
+ params.options = options;
59
+ $xeTable.preventEvent(evnt, 'event.showMenu', params, () => {
60
+ if (!visibleMethod || visibleMethod(params)) {
61
+ evnt.preventDefault();
62
+ $xeTable.updateZindex();
63
+ const el = refElem.value;
64
+ const tableRect = el.getBoundingClientRect();
65
+ const {
66
+ scrollTop,
67
+ scrollLeft,
68
+ visibleHeight,
69
+ visibleWidth
70
+ } = (0, _dom.getDomNode)();
71
+ let top = evnt.clientY - tableRect.y;
72
+ let left = evnt.clientX - tableRect.x;
73
+ if (transfer) {
74
+ top = evnt.clientY + scrollTop;
75
+ left = evnt.clientX + scrollLeft;
76
+ }
77
+ const handleVisible = () => {
78
+ internalData._currMenuParams = params;
79
+ Object.assign(ctxMenuStore, {
80
+ visible: true,
81
+ list: options,
82
+ selected: null,
83
+ selectChild: null,
84
+ showChild: false,
85
+ style: {
86
+ zIndex: internalData.tZindex,
87
+ top: `${top}px`,
88
+ left: `${left}px`
89
+ }
90
+ });
91
+ (0, _vue.nextTick)(() => {
92
+ const tableMenu = refTableMenu.value;
93
+ const ctxElem = tableMenu.getRefMaps().refElem.value;
94
+ const clientHeight = ctxElem.clientHeight;
95
+ const clientWidth = ctxElem.clientWidth;
96
+ const {
97
+ boundingTop,
98
+ boundingLeft
99
+ } = (0, _dom.getAbsolutePos)(ctxElem);
100
+ const offsetTop = boundingTop + clientHeight - visibleHeight;
101
+ const offsetLeft = boundingLeft + clientWidth - visibleWidth;
102
+ if (offsetTop > -10) {
103
+ ctxMenuStore.style.top = `${Math.max(scrollTop + 2, top - clientHeight - 2)}px`;
104
+ }
105
+ if (offsetLeft > -10) {
106
+ ctxMenuStore.style.left = `${Math.max(scrollLeft + 2, left - clientWidth - 2)}px`;
107
+ }
108
+ });
109
+ };
110
+ const {
111
+ keyboard,
112
+ row,
113
+ column
114
+ } = params;
115
+ if (keyboard && row && column) {
116
+ $xeTable.scrollToRow(row, column).then(() => {
117
+ const cell = $xeTable.getCellElement(row, column);
118
+ if (cell) {
119
+ const {
120
+ boundingTop,
121
+ boundingLeft
122
+ } = (0, _dom.getAbsolutePos)(cell);
123
+ top = boundingTop + scrollTop + Math.floor(cell.offsetHeight / 2);
124
+ left = boundingLeft + scrollLeft + Math.floor(cell.offsetWidth / 2);
125
+ }
126
+ handleVisible();
127
+ });
128
+ } else {
129
+ handleVisible();
130
+ }
131
+ } else {
132
+ menuMethods.closeMenu();
133
+ }
134
+ });
135
+ }
136
+ }
137
+ $xeTable.closeFilter();
138
+ };
139
+ menuMethods = {
140
+ /**
141
+ * 关闭快捷菜单
142
+ */
143
+ closeMenu() {
144
+ Object.assign(reactData.ctxMenuStore, {
145
+ visible: false,
146
+ selected: null,
147
+ selectChild: null,
148
+ showChild: false
149
+ });
150
+ return (0, _vue.nextTick)();
151
+ }
152
+ };
153
+ menuPrivateMethods = {
154
+ /**
155
+ * 处理菜单的移动
156
+ */
157
+ moveCtxMenu(evnt, ctxMenuStore, property, hasOper, operRest, menuList) {
158
+ let selectItem;
159
+ const selectIndex = _xeUtils.default.findIndexOf(menuList, item => ctxMenuStore[property] === item);
160
+ if (hasOper) {
161
+ if (operRest && (0, _utils.hasChildrenList)(ctxMenuStore.selected)) {
162
+ ctxMenuStore.showChild = true;
163
+ } else {
164
+ ctxMenuStore.showChild = false;
165
+ ctxMenuStore.selectChild = null;
166
+ }
167
+ } else if (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)) {
168
+ for (let len = selectIndex - 1; len >= 0; len--) {
169
+ if (menuList[len].visible !== false) {
170
+ selectItem = menuList[len];
171
+ break;
172
+ }
173
+ }
174
+ ctxMenuStore[property] = selectItem || menuList[menuList.length - 1];
175
+ } else if (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)) {
176
+ for (let index = selectIndex + 1; index < menuList.length; index++) {
177
+ if (menuList[index].visible !== false) {
178
+ selectItem = menuList[index];
179
+ break;
180
+ }
181
+ }
182
+ ctxMenuStore[property] = selectItem || menuList[0];
183
+ } else if (ctxMenuStore[property] && (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER) || globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR))) {
184
+ $xeTable.ctxMenuLinkEvent(evnt, ctxMenuStore[property]);
185
+ }
186
+ },
187
+ handleOpenMenuEvent,
188
+ /**
189
+ * 快捷菜单事件处理
190
+ */
191
+ handleGlobalContextmenuEvent(evnt) {
192
+ const $xeGrid = $xeTable.xeGrid;
193
+ const $xeGantt = $xeTable.xeGantt;
194
+ const {
195
+ mouseConfig,
196
+ menuConfig
197
+ } = props;
198
+ const {
199
+ editStore,
200
+ ctxMenuStore
201
+ } = reactData;
202
+ const {
203
+ visibleColumn
204
+ } = internalData;
205
+ const tableFilter = refTableFilter.value;
206
+ const tableMenu = refTableMenu.value;
207
+ const mouseOpts = computeMouseOpts.value;
208
+ const menuOpts = computeMenuOpts.value;
209
+ const el = refElem.value;
210
+ const {
211
+ selected
212
+ } = editStore;
213
+ const layoutList = ['header', 'body', 'footer'];
214
+ if ((0, _utils.isEnableConf)(menuConfig)) {
215
+ if (ctxMenuStore.visible && tableMenu && (0, _dom.getEventTargetNode)(evnt, tableMenu.getRefMaps().refElem.value).flag) {
216
+ evnt.preventDefault();
217
+ return;
218
+ }
219
+ if (internalData._keyCtx) {
220
+ const type = 'body';
221
+ const params = {
222
+ type,
223
+ $table: $xeTable,
224
+ $grid: $xeGrid,
225
+ $gantt: $xeGantt,
226
+ keyboard: true,
227
+ columns: visibleColumn.slice(0),
228
+ $event: evnt
229
+ };
230
+ // 如果开启单元格区域
231
+ if (mouseConfig && mouseOpts.area) {
232
+ const activeArea = $xeTable.getActiveCellArea();
233
+ if (activeArea && activeArea.row && activeArea.column) {
234
+ params.row = activeArea.row;
235
+ params.column = activeArea.column;
236
+ handleOpenMenuEvent(evnt, type, params);
237
+ return;
238
+ }
239
+ } else if (mouseConfig && mouseOpts.selected) {
240
+ // 如果启用键盘导航且已选中单元格
241
+ if (selected.row && selected.column) {
242
+ params.row = selected.row;
243
+ params.column = selected.column;
244
+ handleOpenMenuEvent(evnt, type, params);
245
+ return;
246
+ }
247
+ }
248
+ }
249
+ // 分别匹配表尾、内容、表尾的快捷菜单
250
+ for (let index = 0; index < layoutList.length; index++) {
251
+ const layout = layoutList[index];
252
+ const columnTargetNode = (0, _dom.getEventTargetNode)(evnt, el, `vxe-${layout}--column`, target => {
253
+ // target=td|th,直接向上找 table 去匹配即可
254
+ return target.parentNode.parentNode.parentNode.getAttribute('xid') === xID;
255
+ });
256
+ const params = {
257
+ type: layout,
258
+ $table: $xeTable,
259
+ $grid: $xeGrid,
260
+ $gantt: $xeGantt,
261
+ columns: visibleColumn.slice(0),
262
+ $event: evnt
263
+ };
264
+ if (columnTargetNode.flag) {
265
+ const cell = columnTargetNode.targetElem;
266
+ const columnNodeRest = $xeTable.getColumnNode(cell);
267
+ const column = columnNodeRest ? columnNodeRest.item : null;
268
+ let typePrefix = `${layout}-`;
269
+ if (column) {
270
+ Object.assign(params, {
271
+ column,
272
+ columnIndex: $xeTable.getColumnIndex(column),
273
+ cell
274
+ });
275
+ }
276
+ if (layout === 'body') {
277
+ const rowNodeRest = $xeTable.getRowNode(cell.parentNode);
278
+ const row = rowNodeRest ? rowNodeRest.item : null;
279
+ typePrefix = '';
280
+ if (row) {
281
+ params.row = row;
282
+ params.rowIndex = $xeTable.getRowIndex(row);
283
+ }
284
+ }
285
+ const eventType = `${typePrefix}cell-menu`;
286
+ handleOpenMenuEvent(evnt, layout, params);
287
+ $xeTable.dispatchEvent(eventType, params, evnt);
288
+ return;
289
+ } else if ((0, _dom.getEventTargetNode)(evnt, el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === xID).flag) {
290
+ if (menuOpts.trigger === 'cell') {
291
+ evnt.preventDefault();
292
+ } else {
293
+ handleOpenMenuEvent(evnt, layout, params);
294
+ }
295
+ return;
296
+ }
297
+ }
298
+ }
299
+ if (tableFilter && !(0, _dom.getEventTargetNode)(evnt, tableFilter.getRefMaps().refElem.value).flag) {
300
+ $xeTable.closeFilter();
301
+ }
302
+ menuMethods.closeMenu();
303
+ },
304
+ ctxMenuMouseoverEvent(evnt, item, child) {
305
+ const menuElem = evnt.currentTarget;
306
+ const {
307
+ ctxMenuStore
308
+ } = reactData;
309
+ evnt.preventDefault();
310
+ evnt.stopPropagation();
311
+ ctxMenuStore.selected = item;
312
+ ctxMenuStore.selectChild = child;
313
+ if (!child) {
314
+ ctxMenuStore.showChild = (0, _utils.hasChildrenList)(item);
315
+ if (ctxMenuStore.showChild) {
316
+ (0, _vue.nextTick)(() => {
317
+ const childWrapperElem = menuElem.nextElementSibling;
318
+ if (childWrapperElem) {
319
+ const {
320
+ boundingTop,
321
+ boundingLeft,
322
+ visibleHeight,
323
+ visibleWidth
324
+ } = (0, _dom.getAbsolutePos)(menuElem);
325
+ const posTop = boundingTop + menuElem.offsetHeight;
326
+ const posLeft = boundingLeft + menuElem.offsetWidth;
327
+ let left = '';
328
+ let right = '';
329
+ // 是否超出右侧
330
+ if (posLeft + childWrapperElem.offsetWidth > visibleWidth - 10) {
331
+ left = 'auto';
332
+ right = `${menuElem.offsetWidth}px`;
333
+ }
334
+ // 是否超出底部
335
+ let top = '';
336
+ let bottom = '';
337
+ if (posTop + childWrapperElem.offsetHeight > visibleHeight - 10) {
338
+ top = 'auto';
339
+ bottom = '0';
340
+ }
341
+ childWrapperElem.style.left = left;
342
+ childWrapperElem.style.right = right;
343
+ childWrapperElem.style.top = top;
344
+ childWrapperElem.style.bottom = bottom;
345
+ }
346
+ });
347
+ }
348
+ }
349
+ },
350
+ ctxMenuMouseoutEvent(evnt, item) {
351
+ const {
352
+ ctxMenuStore
353
+ } = reactData;
354
+ if (!item.children) {
355
+ ctxMenuStore.selected = null;
356
+ }
357
+ ctxMenuStore.selectChild = null;
358
+ },
359
+ /**
360
+ * 快捷菜单点击事件
361
+ */
362
+ ctxMenuLinkEvent(evnt, menu) {
363
+ const $xeGrid = $xeTable.xeGrid;
364
+ const $xeGantt = $xeTable.xeGantt;
365
+ // 如果一级菜单有配置 code 则允许点击,否则不能点击
366
+ if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
367
+ const gMenuOpts = menus.get(menu.code);
368
+ const params = Object.assign({}, internalData._currMenuParams, {
369
+ menu,
370
+ $table: $xeTable,
371
+ $grid: $xeGrid,
372
+ $gantt: $xeGantt,
373
+ $event: evnt
374
+ });
375
+ const tmMethod = gMenuOpts ? gMenuOpts.tableMenuMethod || gMenuOpts.menuMethod : null;
376
+ if (tmMethod) {
377
+ tmMethod(params, evnt);
378
+ }
379
+ $xeTable.dispatchEvent('menu-click', params, evnt);
380
+ menuMethods.closeMenu();
381
+ }
382
+ }
383
+ };
384
+ return Object.assign(Object.assign({}, menuMethods), menuPrivateMethods);
385
+ },
386
+ setupGrid($xeGrid) {
387
+ return $xeGrid.extendTableMethods(tableMenuMethodKeys);
388
+ },
389
+ setupGantt($xeGantt) {
390
+ return $xeGantt.extendTableMethods(tableMenuMethodKeys);
391
+ }
392
+ });
@@ -0,0 +1 @@
1
+ var _vue=require("vue"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../../ui"),_dom=require("../../../ui/src/dom"),_utils=require("../../../ui/src/utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{menus,hooks,globalEvents,GLOBAL_EVENT_KEYS}=_ui.VxeUI,tableMenuMethodKeys=["closeMenu"];hooks.add("tableMenuModule",{setupTable(p){let{xID:M,props:x,reactData:E,internalData:_}=p,{refElem:C,refTableFilter:T,refTableMenu:y}=p.getRefMaps(),{computeMouseOpts:w,computeIsContentMenu:l,computeMenuOpts:L}=p.getComputeMaps(),N;var e;let O=(v,t,g)=>{let f=E.ctxMenuStore;var n=l.value,e=L.value,t=e[t];let{transfer:h,visibleMethod:o}=e;if(t){let{options:l,disabled:e}=t;e?v.preventDefault():n&&l&&l.length&&(g.options=l,p.preventEvent(v,"event.showMenu",g,()=>{if(!o||o(g)){v.preventDefault(),p.updateZindex();var t=C.value.getBoundingClientRect();let{scrollTop:o,scrollLeft:i,visibleHeight:u,visibleWidth:s}=(0,_dom.getDomNode)(),r=v.clientY-t.y,a=v.clientX-t.x,n=(h&&(r=v.clientY+o,a=v.clientX+i),()=>{_._currMenuParams=g,Object.assign(f,{visible:!0,list:l,selected:null,selectChild:null,showChild:!1,style:{zIndex:_.tZindex,top:r+"px",left:a+"px"}}),(0,_vue.nextTick)(()=>{var e=y.value.getRefMaps().refElem.value,t=e.clientHeight,l=e.clientWidth,{boundingTop:e,boundingLeft:n}=(0,_dom.getAbsolutePos)(e),e=e+t-u,n=n+l-s;-10<e&&(f.style.top=Math.max(o+2,r-t-2)+"px"),-10<n&&(f.style.left=Math.max(i+2,a-l-2)+"px")})}),{keyboard:e,row:d,column:c}=g;e&&d&&c?p.scrollToRow(d,c).then(()=>{var e,t,l=p.getCellElement(d,c);l&&({boundingTop:e,boundingLeft:t}=(0,_dom.getAbsolutePos)(l),r=e+o+Math.floor(l.offsetHeight/2),a=t+i+Math.floor(l.offsetWidth/2)),n()}):n()}else N.closeMenu()}))}p.closeFilter()};return N={closeMenu(){return Object.assign(E.ctxMenuStore,{visible:!1,selected:null,selectChild:null,showChild:!1}),(0,_vue.nextTick)()}},e={moveCtxMenu(e,t,l,n,o,i){let u;var s=_xeUtils.default.findIndexOf(i,e=>t[l]===e);if(n)o&&(0,_utils.hasChildrenList)(t.selected)?t.showChild=!0:(t.showChild=!1,t.selectChild=null);else if(globalEvents.hasKey(e,GLOBAL_EVENT_KEYS.ARROW_UP)){for(let e=s-1;0<=e;e--)if(!1!==i[e].visible){u=i[e];break}t[l]=u||i[i.length-1]}else if(globalEvents.hasKey(e,GLOBAL_EVENT_KEYS.ARROW_DOWN)){for(let e=s+1;e<i.length;e++)if(!1!==i[e].visible){u=i[e];break}t[l]=u||i[0]}else t[l]&&(globalEvents.hasKey(e,GLOBAL_EVENT_KEYS.ENTER)||globalEvents.hasKey(e,GLOBAL_EVENT_KEYS.SPACEBAR))&&p.ctxMenuLinkEvent(e,t[l])},handleOpenMenuEvent:O,handleGlobalContextmenuEvent(t){var l=p.xeGrid,n=p.xeGantt,{mouseConfig:e,menuConfig:o}=x,{editStore:i,ctxMenuStore:u}=E,s=_.visibleColumn,r=T.value,a=y.value,d=w.value,c=L.value,v=C.value,i=i.selected,g=["header","body","footer"];if((0,_utils.isEnableConf)(o)){if(u.visible&&a&&(0,_dom.getEventTargetNode)(t,a.getRefMaps().refElem.value).flag)return void t.preventDefault();if(_._keyCtx){o="body",u={type:o,$table:p,$grid:l,$gantt:n,keyboard:!0,columns:s.slice(0),$event:t};if(e&&d.area){a=p.getActiveCellArea();if(a&&a.row&&a.column)return u.row=a.row,u.column=a.column,void O(t,o,u)}else if(e&&d.selected&&i.row&&i.column)return u.row=i.row,u.column=i.column,void O(t,o,u)}for(let e=0;e<g.length;e++){var f=g[e],h=(0,_dom.getEventTargetNode)(t,v,`vxe-${f}--column`,e=>e.parentNode.parentNode.parentNode.getAttribute("xid")===M),b={type:f,$table:p,$grid:l,$gantt:n,columns:s.slice(0),$event:t};if(h.flag){var h=h.targetElem,m=p.getColumnNode(h),m=m?m.item:null;let e=f+"-";m&&Object.assign(b,{column:m,columnIndex:p.getColumnIndex(m),cell:h}),"body"===f&&(h=(m=p.getRowNode(h.parentNode))?m.item:null,e="",h)&&(b.row=h,b.rowIndex=p.getRowIndex(h));m=e+"cell-menu";return O(t,f,b),void p.dispatchEvent(m,b,t)}if((0,_dom.getEventTargetNode)(t,v,`vxe-table--${f}-wrapper`,e=>e.getAttribute("xid")===M).flag)return void("cell"===c.trigger?t.preventDefault():O(t,f,b))}}r&&!(0,_dom.getEventTargetNode)(t,r.getRefMaps().refElem.value).flag&&p.closeFilter(),N.closeMenu()},ctxMenuMouseoverEvent(e,t,l){let a=e.currentTarget;var n=E.ctxMenuStore;e.preventDefault(),e.stopPropagation(),n.selected=t,(n.selectChild=l)||(n.showChild=(0,_utils.hasChildrenList)(t),n.showChild&&(0,_vue.nextTick)(()=>{var o=a.nextElementSibling;if(o){var{boundingTop:i,boundingLeft:u,visibleHeight:s,visibleWidth:r}=(0,_dom.getAbsolutePos)(a),i=i+a.offsetHeight;let e="",t="",l=(u+a.offsetWidth+o.offsetWidth>r-10&&(e="auto",t=a.offsetWidth+"px"),""),n="";i+o.offsetHeight>s-10&&(l="auto",n="0"),o.style.left=e,o.style.right=t,o.style.top=l,o.style.bottom=n}}))},ctxMenuMouseoutEvent(e,t){var l=E.ctxMenuStore;t.children||(l.selected=null),l.selectChild=null},ctxMenuLinkEvent(e,t){var l,n=p.xeGrid,o=p.xeGantt;t.disabled||!t.code&&t.children&&t.children.length||(l=menus.get(t.code),t=Object.assign({},_._currMenuParams,{menu:t,$table:p,$grid:n,$gantt:o,$event:e}),(n=l?l.tableMenuMethod||l.menuMethod:null)&&n(t,e),p.dispatchEvent("menu-click",t,e),N.closeMenu())}},Object.assign(Object.assign({},N),e)},setupGrid(e){return e.extendTableMethods(tableMenuMethodKeys)},setupGantt(e){return e.extendTableMethods(tableMenuMethodKeys)}});
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _vue = require("vue");
8
+ var _comp = require("../../../ui/src/comp");
9
+ var _ui = require("../../../ui");
10
+ var _utils = require("../../../ui/src/utils");
11
+ var _xeUtils = _interopRequireDefault(require("xe-utils"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const {
14
+ getIcon,
15
+ renderEmptyElement
16
+ } = _ui.VxeUI;
17
+ var _default = exports.default = (0, _comp.defineVxeComponent)({
18
+ name: 'VxeTableMenuPanel',
19
+ setup(props, context) {
20
+ const xID = _xeUtils.default.uniqueId();
21
+ const $xeTable = (0, _vue.inject)('$xeTable', {});
22
+ const {
23
+ reactData: tableReactData
24
+ } = $xeTable;
25
+ const refElem = (0, _vue.ref)();
26
+ const refMaps = {
27
+ refElem
28
+ };
29
+ const $xeMenuPanel = {
30
+ xID,
31
+ props,
32
+ context,
33
+ getRefMaps: () => refMaps
34
+ };
35
+ const renderVN = () => {
36
+ const {
37
+ ctxMenuStore
38
+ } = tableReactData;
39
+ const {
40
+ computeMenuOpts
41
+ } = $xeTable.getComputeMaps();
42
+ const menuOpts = computeMenuOpts.value;
43
+ const {
44
+ transfer,
45
+ destroyOnClose
46
+ } = menuOpts;
47
+ const {
48
+ visible,
49
+ list,
50
+ className
51
+ } = ctxMenuStore;
52
+ return (0, _vue.h)(_vue.Teleport, {
53
+ to: 'body',
54
+ disabled: !transfer
55
+ }, [(0, _vue.h)('div', {
56
+ ref: refElem,
57
+ class: ['vxe-table--context-menu-wrapper', className, {
58
+ 'is--visible': visible
59
+ }],
60
+ style: ctxMenuStore.style
61
+ }, (destroyOnClose ? visible : true) ? list.map((options, gIndex) => {
62
+ return options.every(item => item.visible === false) ? renderEmptyElement($xeTable) : (0, _vue.h)('ul', {
63
+ class: 'vxe-context-menu--option-wrapper',
64
+ key: gIndex
65
+ }, options.map((item, index) => {
66
+ const hasChildMenus = item.children && item.children.some(child => child.visible !== false);
67
+ const prefixOpts = Object.assign({}, item.prefixConfig);
68
+ const suffixOpts = Object.assign({}, item.suffixConfig);
69
+ const menuContent = (0, _utils.getFuncText)(item.name);
70
+ return item.visible === false ? renderEmptyElement($xeTable) : (0, _vue.h)('li', {
71
+ class: [item.className, {
72
+ 'link--disabled': item.disabled,
73
+ 'link--active': item === ctxMenuStore.selected
74
+ }],
75
+ key: `${gIndex}_${index}`
76
+ }, [(0, _vue.h)('a', {
77
+ class: 'vxe-context-menu--link',
78
+ onClick(evnt) {
79
+ $xeTable.ctxMenuLinkEvent(evnt, item);
80
+ },
81
+ onMouseover(evnt) {
82
+ $xeTable.ctxMenuMouseoverEvent(evnt, item);
83
+ },
84
+ onMouseout(evnt) {
85
+ $xeTable.ctxMenuMouseoutEvent(evnt, item);
86
+ }
87
+ }, [(0, _vue.h)('div', {
88
+ class: ['vxe-context-menu--link-prefix', prefixOpts.className || '']
89
+ }, [(0, _vue.h)('i', {
90
+ class: prefixOpts.icon || item.prefixIcon
91
+ }), prefixOpts.content ? (0, _vue.h)('span', {}, `${prefixOpts.content}`) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
92
+ class: 'vxe-context-menu--link-content',
93
+ title: menuContent
94
+ }, menuContent), (0, _vue.h)('div', {
95
+ class: ['vxe-context-menu--link-suffix', suffixOpts.className || '']
96
+ }, [(0, _vue.h)('i', {
97
+ class: suffixOpts.icon || item.suffixIcon || (hasChildMenus ? getIcon().TABLE_MENU_OPTIONS : '')
98
+ }), suffixOpts.content ? (0, _vue.h)('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)])]), hasChildMenus ? (0, _vue.h)('ul', {
99
+ class: ['vxe-table--context-menu-clild-wrapper', {
100
+ 'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
101
+ }]
102
+ }, item.children.map((child, cIndex) => {
103
+ const childPrefixOpts = Object.assign({}, child.prefixConfig);
104
+ const childSuffixOpts = Object.assign({}, child.suffixConfig);
105
+ const childMenuContent = (0, _utils.getFuncText)(child.name);
106
+ return child.visible === false ? null : (0, _vue.h)('li', {
107
+ class: [child.className, {
108
+ 'link--disabled': child.disabled,
109
+ 'link--active': child === ctxMenuStore.selectChild
110
+ }],
111
+ key: `${gIndex}_${index}_${cIndex}`
112
+ }, [(0, _vue.h)('a', {
113
+ class: 'vxe-context-menu--link',
114
+ onClick(evnt) {
115
+ $xeTable.ctxMenuLinkEvent(evnt, child);
116
+ },
117
+ onMouseover(evnt) {
118
+ $xeTable.ctxMenuMouseoverEvent(evnt, item, child);
119
+ },
120
+ onMouseout(evnt) {
121
+ $xeTable.ctxMenuMouseoutEvent(evnt, item);
122
+ }
123
+ }, [(0, _vue.h)('div', {
124
+ class: ['vxe-context-menu--link-prefix', childPrefixOpts.className || '']
125
+ }, [(0, _vue.h)('i', {
126
+ class: childPrefixOpts.icon || child.prefixIcon
127
+ }), childPrefixOpts.content ? (0, _vue.h)('span', `${childPrefixOpts.content}`) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
128
+ class: 'vxe-context-menu--link-content',
129
+ title: childMenuContent
130
+ }, childMenuContent), (0, _vue.h)('div', {
131
+ class: ['vxe-context-menu--link-suffix', childSuffixOpts.className || '']
132
+ }, [(0, _vue.h)('i', {
133
+ class: childSuffixOpts.icon
134
+ }), childSuffixOpts.content ? (0, _vue.h)('span', `${childSuffixOpts.content}`) : renderEmptyElement($xeTable)])])]);
135
+ })) : null]);
136
+ }));
137
+ }) : [])]);
138
+ };
139
+ $xeMenuPanel.renderVN = renderVN;
140
+ return $xeMenuPanel;
141
+ },
142
+ render() {
143
+ return this.renderVN();
144
+ }
145
+ });
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../../ui/src/comp"),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getIcon,renderEmptyElement}=_ui.VxeUI;var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeTableMenuPanel",setup(e,t){var n=_xeUtils.default.uniqueId();let o=(0,_vue.inject)("$xeTable",{}),u=o.reactData,l=(0,_vue.ref)(),s={refElem:l};n={xID:n,props:e,context:t,getRefMaps:()=>s};return n.renderVN=()=>{let r=u.ctxMenuStore;var e=o.getComputeMaps().computeMenuOpts,{transfer:e,destroyOnClose:t}=e.value,{visible:n,list:s,className:i}=r;return(0,_vue.h)(_vue.Teleport,{to:"body",disabled:!e},[(0,_vue.h)("div",{ref:l,class:["vxe-table--context-menu-wrapper",i,{"is--visible":n}],style:r.style},!t||n?s.map((e,c)=>e.every(e=>!1===e.visible)?renderEmptyElement(o):(0,_vue.h)("ul",{class:"vxe-context-menu--option-wrapper",key:c},e.map((u,l)=>{var e=u.children&&u.children.some(e=>!1!==e.visible),t=Object.assign({},u.prefixConfig),n=Object.assign({},u.suffixConfig),s=(0,_utils.getFuncText)(u.name);return!1===u.visible?renderEmptyElement(o):(0,_vue.h)("li",{class:[u.className,{"link--disabled":u.disabled,"link--active":u===r.selected}],key:c+"_"+l},[(0,_vue.h)("a",{class:"vxe-context-menu--link",onClick(e){o.ctxMenuLinkEvent(e,u)},onMouseover(e){o.ctxMenuMouseoverEvent(e,u)},onMouseout(e){o.ctxMenuMouseoutEvent(e,u)}},[(0,_vue.h)("div",{class:["vxe-context-menu--link-prefix",t.className||""]},[(0,_vue.h)("i",{class:t.icon||u.prefixIcon}),t.content?(0,_vue.h)("span",{},""+t.content):renderEmptyElement(o)]),(0,_vue.h)("div",{class:"vxe-context-menu--link-content",title:s},s),(0,_vue.h)("div",{class:["vxe-context-menu--link-suffix",n.className||""]},[(0,_vue.h)("i",{class:n.icon||u.suffixIcon||(e?getIcon().TABLE_MENU_OPTIONS:"")}),n.content?(0,_vue.h)("span",""+n.content):renderEmptyElement(o)])]),e?(0,_vue.h)("ul",{class:["vxe-table--context-menu-clild-wrapper",{"is--show":u===r.selected&&r.showChild}]},u.children.map((t,e)=>{var n=Object.assign({},t.prefixConfig),s=Object.assign({},t.suffixConfig),i=(0,_utils.getFuncText)(t.name);return!1===t.visible?null:(0,_vue.h)("li",{class:[t.className,{"link--disabled":t.disabled,"link--active":t===r.selectChild}],key:c+`_${l}_`+e},[(0,_vue.h)("a",{class:"vxe-context-menu--link",onClick(e){o.ctxMenuLinkEvent(e,t)},onMouseover(e){o.ctxMenuMouseoverEvent(e,u,t)},onMouseout(e){o.ctxMenuMouseoutEvent(e,u)}},[(0,_vue.h)("div",{class:["vxe-context-menu--link-prefix",n.className||""]},[(0,_vue.h)("i",{class:n.icon||t.prefixIcon}),n.content?(0,_vue.h)("span",""+n.content):renderEmptyElement(o)]),(0,_vue.h)("div",{class:"vxe-context-menu--link-content",title:i},i),(0,_vue.h)("div",{class:["vxe-context-menu--link-suffix",s.className||""]},[(0,_vue.h)("i",{class:s.icon}),s.content?(0,_vue.h)("span",""+s.content):renderEmptyElement(o)])])])})):null])}))):[])])},n},render(){return this.renderVN()}});