vxe-table 4.16.17 → 4.16.19
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.
- package/es/colgroup/style.css +0 -0
- package/es/colgroup/style.min.css +0 -0
- package/es/column/style.css +0 -0
- package/es/column/style.min.css +0 -0
- package/es/grid/style.css +86 -0
- package/es/grid/style.min.css +1 -0
- package/es/iconfont.1758609514163.ttf +0 -0
- package/es/iconfont.1758609514163.woff +0 -0
- package/es/iconfont.1758609514163.woff2 +0 -0
- package/es/index.esm.js +3 -0
- package/es/locale/lang/ar-EG.d.ts +2 -0
- package/es/locale/lang/de-DE.d.ts +2 -0
- package/es/locale/lang/en-US.d.ts +2 -0
- package/es/locale/lang/es-ES.d.ts +2 -0
- package/es/locale/lang/fr-FR.d.ts +2 -0
- package/es/locale/lang/hu-HU.d.ts +2 -0
- package/es/locale/lang/hy-AM.d.ts +2 -0
- package/es/locale/lang/id-ID.d.ts +2 -0
- package/es/locale/lang/it-IT.d.ts +2 -0
- package/es/locale/lang/ja-JP.d.ts +2 -0
- package/es/locale/lang/ko-KR.d.ts +2 -0
- package/es/locale/lang/ms-MY.d.ts +2 -0
- package/es/locale/lang/nb-NO.d.ts +2 -0
- package/es/locale/lang/pt-BR.d.ts +2 -0
- package/es/locale/lang/ru-RU.d.ts +2 -0
- package/es/locale/lang/th-TH.d.ts +2 -0
- package/es/locale/lang/ug-CN.d.ts +2 -0
- package/es/locale/lang/uk-UA.d.ts +2 -0
- package/es/locale/lang/uz-UZ.d.ts +2 -0
- package/es/locale/lang/vi-VN.d.ts +2 -0
- package/es/locale/lang/zh-CHT.d.ts +2 -0
- package/es/locale/lang/zh-CN.d.ts +2 -0
- package/es/locale/lang/zh-HK.d.ts +2 -0
- package/es/locale/lang/zh-MO.d.ts +2 -0
- package/es/locale/lang/zh-TW.d.ts +2 -0
- package/es/style.css +1 -1
- package/es/table/module/filter/hook.js +21 -5
- package/es/table/module/filter/panel.js +4 -4
- package/es/table/module/menu/panel.js +27 -14
- package/es/table/src/cell.js +10 -7
- package/es/table/src/table.js +22 -22
- package/es/table/style.css +3657 -0
- package/es/table/style.min.css +1 -0
- package/es/toolbar/style.css +90 -0
- package/es/toolbar/style.min.css +1 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/style.css +0 -0
- package/es/ui/style.min.css +0 -0
- package/es/v-x-e-table/style.css +0 -0
- package/es/v-x-e-table/style.min.css +0 -0
- package/es/vxe-colgroup/style.css +0 -0
- package/es/vxe-colgroup/style.min.css +0 -0
- package/es/vxe-column/style.css +0 -0
- package/es/vxe-column/style.min.css +0 -0
- package/es/vxe-grid/style.css +86 -0
- package/es/vxe-grid/style.min.css +1 -0
- package/es/vxe-table/style.css +3657 -0
- package/es/vxe-table/style.min.css +1 -0
- package/es/vxe-toolbar/style.css +90 -0
- package/es/vxe-toolbar/style.min.css +1 -0
- package/es/vxe-ui/style.css +0 -0
- package/es/vxe-ui/style.min.css +0 -0
- package/es/vxe-v-x-e-table/style.css +0 -0
- package/es/vxe-v-x-e-table/style.min.css +0 -0
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/colgroup/style/index.js +1 -0
- package/lib/colgroup/style/style.css +0 -0
- package/lib/colgroup/style/style.min.css +0 -0
- package/lib/column/style/index.js +1 -0
- package/lib/column/style/style.css +0 -0
- package/lib/column/style/style.min.css +0 -0
- package/lib/grid/style/index.js +1 -0
- package/lib/grid/style/style.css +86 -0
- package/lib/grid/style/style.min.css +1 -0
- package/lib/iconfont.1758609514163.ttf +0 -0
- package/lib/iconfont.1758609514163.woff +0 -0
- package/lib/iconfont.1758609514163.woff2 +0 -0
- package/lib/index.common.js +22 -0
- package/lib/index.umd.js +73 -25
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.d.ts +2 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +806 -0
- package/lib/locale/lang/de-DE.d.ts +2 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +806 -0
- package/lib/locale/lang/en-US.d.ts +2 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +806 -0
- package/lib/locale/lang/es-ES.d.ts +2 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +806 -0
- package/lib/locale/lang/fr-FR.d.ts +2 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +806 -0
- package/lib/locale/lang/hu-HU.d.ts +2 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +806 -0
- package/lib/locale/lang/hy-AM.d.ts +2 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +806 -0
- package/lib/locale/lang/id-ID.d.ts +2 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +806 -0
- package/lib/locale/lang/it-IT.d.ts +2 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +806 -0
- package/lib/locale/lang/ja-JP.d.ts +2 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +806 -0
- package/lib/locale/lang/ko-KR.d.ts +2 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +806 -0
- package/lib/locale/lang/ms-MY.d.ts +2 -0
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +806 -0
- package/lib/locale/lang/nb-NO.d.ts +2 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +806 -0
- package/lib/locale/lang/pt-BR.d.ts +2 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +806 -0
- package/lib/locale/lang/ru-RU.d.ts +2 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +806 -0
- package/lib/locale/lang/th-TH.d.ts +2 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +806 -0
- package/lib/locale/lang/ug-CN.d.ts +2 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +806 -0
- package/lib/locale/lang/uk-UA.d.ts +2 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +806 -0
- package/lib/locale/lang/uz-UZ.d.ts +2 -0
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +806 -0
- package/lib/locale/lang/vi-VN.d.ts +2 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +806 -0
- package/lib/locale/lang/zh-CHT.d.ts +2 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +806 -0
- package/lib/locale/lang/zh-CN.d.ts +2 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +808 -0
- package/lib/locale/lang/zh-HK.d.ts +2 -0
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +23 -0
- package/lib/locale/lang/zh-MO.d.ts +2 -0
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +23 -0
- package/lib/locale/lang/zh-TW.d.ts +2 -0
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +23 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/hook.js +430 -0
- package/lib/table/module/custom/hook.min.js +1 -0
- package/lib/table/module/custom/panel.js +1193 -0
- package/lib/table/module/custom/panel.min.js +1 -0
- package/lib/table/module/edit/hook.js +1308 -0
- package/lib/table/module/edit/hook.min.js +1 -0
- package/lib/table/module/export/export-panel.js +467 -0
- package/lib/table/module/export/export-panel.min.js +1 -0
- package/lib/table/module/export/hook.js +1888 -0
- package/lib/table/module/export/hook.min.js +1 -0
- package/lib/table/module/export/import-panel.js +226 -0
- package/lib/table/module/export/import-panel.min.js +1 -0
- package/lib/table/module/export/util.js +20 -0
- package/lib/table/module/export/util.min.js +1 -0
- package/lib/table/module/filter/hook.js +458 -0
- package/lib/table/module/filter/hook.min.js +1 -0
- package/lib/table/module/filter/panel.js +265 -0
- package/lib/table/module/filter/panel.min.js +1 -0
- package/lib/table/module/keyboard/hook.js +579 -0
- package/lib/table/module/keyboard/hook.min.js +1 -0
- package/lib/table/module/menu/hook.js +392 -0
- package/lib/table/module/menu/hook.min.js +1 -0
- package/lib/table/module/menu/panel.js +150 -0
- package/lib/table/module/menu/panel.min.js +1 -0
- package/lib/table/module/validator/hook.js +681 -0
- package/lib/table/module/validator/hook.min.js +1 -0
- package/lib/table/src/cell.js +9 -4
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/header.min.js +1 -0
- package/lib/table/src/props.js +318 -0
- package/lib/table/src/props.min.js +1 -0
- package/lib/table/src/store.js +15 -0
- package/lib/table/src/store.min.js +1 -0
- package/lib/table/src/table.js +924 -0
- package/lib/table/src/table.min.js +1 -0
- package/lib/table/src/use/cell-view.js +57 -0
- package/lib/table/src/use/cell-view.min.js +1 -0
- package/lib/table/src/use/index.js +16 -0
- package/lib/table/src/use/index.min.js +1 -0
- package/lib/table/src/util.js +916 -0
- package/lib/table/src/util.min.js +1 -0
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/style.css +3657 -0
- package/lib/table/style/style.min.css +1 -0
- package/lib/toolbar/style/index.js +1 -0
- package/lib/toolbar/style/style.css +90 -0
- package/lib/toolbar/style/style.min.css +1 -0
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/style/index.js +1 -0
- package/lib/ui/style/style.css +0 -0
- package/lib/ui/style/style.min.css +0 -0
- package/lib/v-x-e-table/style/index.js +1 -0
- package/lib/v-x-e-table/style/style.css +0 -0
- package/lib/v-x-e-table/style/style.min.css +0 -0
- package/lib/vxe-colgroup/style/index.js +1 -0
- package/lib/vxe-colgroup/style/style.css +0 -0
- package/lib/vxe-colgroup/style/style.min.css +0 -0
- package/lib/vxe-column/style/index.js +1 -0
- package/lib/vxe-column/style/style.css +0 -0
- package/lib/vxe-column/style/style.min.css +0 -0
- package/lib/vxe-grid/style/index.js +1 -0
- package/lib/vxe-grid/style/style.css +86 -0
- package/lib/vxe-grid/style/style.min.css +1 -0
- package/lib/vxe-table/style/index.js +1 -0
- package/lib/vxe-table/style/style.css +3657 -0
- package/lib/vxe-table/style/style.min.css +1 -0
- package/lib/vxe-toolbar/style/index.js +1 -0
- package/lib/vxe-toolbar/style/style.css +90 -0
- package/lib/vxe-toolbar/style/style.min.css +1 -0
- package/lib/vxe-ui/style/index.js +1 -0
- package/lib/vxe-ui/style/style.css +0 -0
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/lib/vxe-v-x-e-table/style/index.js +1 -0
- package/lib/vxe-v-x-e-table/style/style.css +0 -0
- package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
- package/package.json +1 -1
- package/packages/table/module/filter/hook.ts +23 -6
- package/packages/table/module/filter/panel.ts +4 -4
- package/packages/table/module/menu/panel.ts +29 -16
- package/packages/table/src/cell.ts +10 -7
- package/packages/table/src/table.ts +22 -22
|
@@ -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,150 @@
|
|
|
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 _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
10
|
+
var _ui = require("../../../ui");
|
|
11
|
+
var _utils = require("../../../ui/src/utils");
|
|
12
|
+
var _vn = require("../../../ui/src/vn");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const {
|
|
15
|
+
getIcon,
|
|
16
|
+
renderEmptyElement
|
|
17
|
+
} = _ui.VxeUI;
|
|
18
|
+
var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
19
|
+
name: 'VxeTableMenuPanel',
|
|
20
|
+
setup(props, context) {
|
|
21
|
+
const xID = _xeUtils.default.uniqueId();
|
|
22
|
+
const $xeTable = (0, _vue.inject)('$xeTable', {});
|
|
23
|
+
const {
|
|
24
|
+
reactData: tableReactData
|
|
25
|
+
} = $xeTable;
|
|
26
|
+
const refElem = (0, _vue.ref)();
|
|
27
|
+
const refMaps = {
|
|
28
|
+
refElem
|
|
29
|
+
};
|
|
30
|
+
const $xeMenuPanel = {
|
|
31
|
+
xID,
|
|
32
|
+
props,
|
|
33
|
+
context,
|
|
34
|
+
getRefMaps: () => refMaps
|
|
35
|
+
};
|
|
36
|
+
const renderVN = () => {
|
|
37
|
+
const {
|
|
38
|
+
ctxMenuStore
|
|
39
|
+
} = tableReactData;
|
|
40
|
+
const {
|
|
41
|
+
computeMenuOpts
|
|
42
|
+
} = $xeTable.getComputeMaps();
|
|
43
|
+
const menuOpts = computeMenuOpts.value;
|
|
44
|
+
const {
|
|
45
|
+
transfer,
|
|
46
|
+
destroyOnClose
|
|
47
|
+
} = menuOpts;
|
|
48
|
+
const {
|
|
49
|
+
visible,
|
|
50
|
+
list,
|
|
51
|
+
className
|
|
52
|
+
} = ctxMenuStore;
|
|
53
|
+
return (0, _vue.h)(_vue.Teleport, {
|
|
54
|
+
to: 'body',
|
|
55
|
+
disabled: !transfer
|
|
56
|
+
}, [(0, _vue.h)('div', {
|
|
57
|
+
ref: refElem,
|
|
58
|
+
class: ['vxe-table--context-menu-wrapper', className, {
|
|
59
|
+
'is--visible': visible
|
|
60
|
+
}],
|
|
61
|
+
style: ctxMenuStore.style
|
|
62
|
+
}, (destroyOnClose ? visible : true) ? list.map((options, gIndex) => {
|
|
63
|
+
return options.every(item => item.visible === false) ? renderEmptyElement($xeTable) : (0, _vue.h)('ul', {
|
|
64
|
+
class: 'vxe-context-menu--option-wrapper',
|
|
65
|
+
key: gIndex
|
|
66
|
+
}, options.map((item, index) => {
|
|
67
|
+
const hasChildMenus = item.children && item.children.some(child => child.visible !== false);
|
|
68
|
+
const prefixOpts = Object.assign({}, item.prefixConfig);
|
|
69
|
+
const prefixIcon = prefixOpts.icon || item.prefixIcon;
|
|
70
|
+
const suffixOpts = Object.assign({}, item.suffixConfig);
|
|
71
|
+
const suffixIcon = suffixOpts.icon || item.suffixIcon;
|
|
72
|
+
const menuContent = (0, _utils.getFuncText)(item.name);
|
|
73
|
+
return item.visible === false ? renderEmptyElement($xeTable) : (0, _vue.h)('li', {
|
|
74
|
+
class: [item.className, {
|
|
75
|
+
'link--disabled': item.disabled,
|
|
76
|
+
'link--active': item === ctxMenuStore.selected
|
|
77
|
+
}],
|
|
78
|
+
key: `${gIndex}_${index}`
|
|
79
|
+
}, [(0, _vue.h)('a', {
|
|
80
|
+
class: 'vxe-context-menu--link',
|
|
81
|
+
onClick(evnt) {
|
|
82
|
+
$xeTable.ctxMenuLinkEvent(evnt, item);
|
|
83
|
+
},
|
|
84
|
+
onMouseover(evnt) {
|
|
85
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item);
|
|
86
|
+
},
|
|
87
|
+
onMouseout(evnt) {
|
|
88
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item);
|
|
89
|
+
}
|
|
90
|
+
}, [(0, _vue.h)('div', {
|
|
91
|
+
class: ['vxe-context-menu--link-prefix', prefixOpts.className || '']
|
|
92
|
+
}, [prefixIcon && _xeUtils.default.isFunction(prefixIcon) ? (0, _vue.h)('span', {}, (0, _vn.getSlotVNs)(prefixIcon({}))) : (0, _vue.h)('i', {
|
|
93
|
+
class: prefixIcon
|
|
94
|
+
}), prefixOpts.content ? (0, _vue.h)('span', {}, `${prefixOpts.content}`) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
|
|
95
|
+
class: 'vxe-context-menu--link-content',
|
|
96
|
+
title: menuContent
|
|
97
|
+
}, menuContent), (0, _vue.h)('div', {
|
|
98
|
+
class: ['vxe-context-menu--link-suffix', suffixOpts.className || '']
|
|
99
|
+
}, [suffixIcon && _xeUtils.default.isFunction(suffixIcon) ? (0, _vue.h)('span', {}, (0, _vn.getSlotVNs)(suffixIcon({}))) : (0, _vue.h)('i', {
|
|
100
|
+
class: suffixIcon || (hasChildMenus ? getIcon().TABLE_MENU_OPTIONS : '')
|
|
101
|
+
}), suffixOpts.content ? (0, _vue.h)('span', `${suffixOpts.content}`) : renderEmptyElement($xeTable)])]), hasChildMenus && item.children ? (0, _vue.h)('ul', {
|
|
102
|
+
class: ['vxe-table--context-menu-clild-wrapper', {
|
|
103
|
+
'is--show': item === ctxMenuStore.selected && ctxMenuStore.showChild
|
|
104
|
+
}]
|
|
105
|
+
}, item.children.map((child, cIndex) => {
|
|
106
|
+
const childPrefixOpts = Object.assign({}, child.prefixConfig);
|
|
107
|
+
const childPrefixIcon = childPrefixOpts.icon || child.prefixIcon;
|
|
108
|
+
const childSuffixOpts = Object.assign({}, child.suffixConfig);
|
|
109
|
+
const childSuffixIcon = childSuffixOpts.icon || child.suffixIcon;
|
|
110
|
+
const childMenuContent = (0, _utils.getFuncText)(child.name);
|
|
111
|
+
return child.visible === false ? null : (0, _vue.h)('li', {
|
|
112
|
+
class: [child.className, {
|
|
113
|
+
'link--disabled': child.disabled,
|
|
114
|
+
'link--active': child === ctxMenuStore.selectChild
|
|
115
|
+
}],
|
|
116
|
+
key: `${gIndex}_${index}_${cIndex}`
|
|
117
|
+
}, [(0, _vue.h)('a', {
|
|
118
|
+
class: 'vxe-context-menu--link',
|
|
119
|
+
onClick(evnt) {
|
|
120
|
+
$xeTable.ctxMenuLinkEvent(evnt, child);
|
|
121
|
+
},
|
|
122
|
+
onMouseover(evnt) {
|
|
123
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item, child);
|
|
124
|
+
},
|
|
125
|
+
onMouseout(evnt) {
|
|
126
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item);
|
|
127
|
+
}
|
|
128
|
+
}, [(0, _vue.h)('div', {
|
|
129
|
+
class: ['vxe-context-menu--link-prefix', childPrefixOpts.className || '']
|
|
130
|
+
}, [childPrefixIcon && _xeUtils.default.isFunction(childPrefixIcon) ? (0, _vue.h)('span', {}, (0, _vn.getSlotVNs)(childPrefixIcon({}))) : (0, _vue.h)('i', {
|
|
131
|
+
class: childPrefixIcon
|
|
132
|
+
}), childPrefixOpts.content ? (0, _vue.h)('span', `${childPrefixOpts.content}`) : renderEmptyElement($xeTable)]), (0, _vue.h)('div', {
|
|
133
|
+
class: 'vxe-context-menu--link-content',
|
|
134
|
+
title: childMenuContent
|
|
135
|
+
}, childMenuContent), (0, _vue.h)('div', {
|
|
136
|
+
class: ['vxe-context-menu--link-suffix', childSuffixOpts.className || '']
|
|
137
|
+
}, [childSuffixIcon && _xeUtils.default.isFunction(childSuffixIcon) ? (0, _vue.h)('span', {}, (0, _vn.getSlotVNs)(childSuffixIcon({}))) : (0, _vue.h)('i', {
|
|
138
|
+
class: childSuffixIcon
|
|
139
|
+
}), childSuffixOpts.content ? (0, _vue.h)('span', `${childSuffixOpts.content}`) : renderEmptyElement($xeTable)])])]);
|
|
140
|
+
})) : null]);
|
|
141
|
+
}));
|
|
142
|
+
}) : [])]);
|
|
143
|
+
};
|
|
144
|
+
$xeMenuPanel.renderVN = renderVN;
|
|
145
|
+
return $xeMenuPanel;
|
|
146
|
+
},
|
|
147
|
+
render() {
|
|
148
|
+
return this.renderVN();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../../ui/src/comp"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../../ui"),_utils=require("../../../ui/src/utils"),_vn=require("../../../ui/src/vn");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 v=(0,_vue.inject)("$xeTable",{}),u=v.reactData,l=(0,_vue.ref)(),s={refElem:l};n={xID:n,props:e,context:t,getRefMaps:()=>s};return n.renderVN=()=>{let a=u.ctxMenuStore;var e=v.getComputeMaps().computeMenuOpts,{transfer:e,destroyOnClose:t}=e.value,{visible:n,list:s,className:i}=a;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:a.style},!t||n?s.map((e,r)=>e.every(e=>!1===e.visible)?renderEmptyElement(v):(0,_vue.h)("ul",{class:"vxe-context-menu--option-wrapper",key:r},e.map((c,o)=>{var e=c.children&&c.children.some(e=>!1!==e.visible),t=Object.assign({},c.prefixConfig),n=t.icon||c.prefixIcon,s=Object.assign({},c.suffixConfig),i=s.icon||c.suffixIcon,u=(0,_utils.getFuncText)(c.name);return!1===c.visible?renderEmptyElement(v):(0,_vue.h)("li",{class:[c.className,{"link--disabled":c.disabled,"link--active":c===a.selected}],key:r+"_"+o},[(0,_vue.h)("a",{class:"vxe-context-menu--link",onClick(e){v.ctxMenuLinkEvent(e,c)},onMouseover(e){v.ctxMenuMouseoverEvent(e,c)},onMouseout(e){v.ctxMenuMouseoutEvent(e,c)}},[(0,_vue.h)("div",{class:["vxe-context-menu--link-prefix",t.className||""]},[n&&_xeUtils.default.isFunction(n)?(0,_vue.h)("span",{},(0,_vn.getSlotVNs)(n({}))):(0,_vue.h)("i",{class:n}),t.content?(0,_vue.h)("span",{},""+t.content):renderEmptyElement(v)]),(0,_vue.h)("div",{class:"vxe-context-menu--link-content",title:u},u),(0,_vue.h)("div",{class:["vxe-context-menu--link-suffix",s.className||""]},[i&&_xeUtils.default.isFunction(i)?(0,_vue.h)("span",{},(0,_vn.getSlotVNs)(i({}))):(0,_vue.h)("i",{class:i||(e?getIcon().TABLE_MENU_OPTIONS:"")}),s.content?(0,_vue.h)("span",""+s.content):renderEmptyElement(v)])]),e&&c.children?(0,_vue.h)("ul",{class:["vxe-table--context-menu-clild-wrapper",{"is--show":c===a.selected&&a.showChild}]},c.children.map((t,e)=>{var n=Object.assign({},t.prefixConfig),s=n.icon||t.prefixIcon,i=Object.assign({},t.suffixConfig),u=i.icon||t.suffixIcon,l=(0,_utils.getFuncText)(t.name);return!1===t.visible?null:(0,_vue.h)("li",{class:[t.className,{"link--disabled":t.disabled,"link--active":t===a.selectChild}],key:r+`_${o}_`+e},[(0,_vue.h)("a",{class:"vxe-context-menu--link",onClick(e){v.ctxMenuLinkEvent(e,t)},onMouseover(e){v.ctxMenuMouseoverEvent(e,c,t)},onMouseout(e){v.ctxMenuMouseoutEvent(e,c)}},[(0,_vue.h)("div",{class:["vxe-context-menu--link-prefix",n.className||""]},[s&&_xeUtils.default.isFunction(s)?(0,_vue.h)("span",{},(0,_vn.getSlotVNs)(s({}))):(0,_vue.h)("i",{class:s}),n.content?(0,_vue.h)("span",""+n.content):renderEmptyElement(v)]),(0,_vue.h)("div",{class:"vxe-context-menu--link-content",title:l},l),(0,_vue.h)("div",{class:["vxe-context-menu--link-suffix",i.className||""]},[u&&_xeUtils.default.isFunction(u)?(0,_vue.h)("span",{},(0,_vn.getSlotVNs)(u({}))):(0,_vue.h)("i",{class:u}),i.content?(0,_vue.h)("span",""+i.content):renderEmptyElement(v)])])])})):null])}))):[])])},n},render(){return this.renderVN()}});
|