evui 3.3.36 → 3.3.39
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/LICENSE +21 -21
- package/README.md +40 -40
- package/dist/evui.common.js +1907 -1832
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1907 -1832
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/dist/img/{EVUI.7f3588fb.svg → EVUI.b82ee81a.svg} +292 -292
- package/dist/img/{icon_mysql.7ea26d5d.svg → icon_mysql.1085fdc9.svg} +78 -78
- package/dist/img/{icon_oracle.9009b108.svg → icon_oracle.0572d3ee.svg} +13 -13
- package/dist/img/{icon_postgresql.f8fffba9.svg → icon_postgresql.ee12bde8.svg} +58 -58
- package/package.json +61 -61
- package/src/common/emitter.js +20 -20
- package/src/common/utils.debounce.js +223 -223
- package/src/common/utils.js +134 -134
- package/src/common/utils.table.js +78 -78
- package/src/common/utils.throttle.js +83 -83
- package/src/common/utils.tree.js +18 -18
- package/src/components/button/Button.vue +198 -198
- package/src/components/button/index.js +7 -7
- package/src/components/buttonGroup/ButtonGroup.vue +11 -11
- package/src/components/buttonGroup/index.js +7 -7
- package/src/components/calendar/Calendar.vue +661 -661
- package/src/components/calendar/index.js +7 -7
- package/src/components/calendar/uses.js +1272 -1272
- package/src/components/chart/Chart.vue +189 -192
- package/src/components/chart/chart.core.js +870 -870
- package/src/components/chart/element/element.bar.js +524 -524
- package/src/components/chart/element/element.bar.time.js +156 -156
- package/src/components/chart/element/element.heatmap.js +533 -533
- package/src/components/chart/element/element.line.js +339 -339
- package/src/components/chart/element/element.pie.js +197 -197
- package/src/components/chart/element/element.scatter.js +184 -184
- package/src/components/chart/element/element.tip.js +550 -542
- package/src/components/chart/helpers/helpers.canvas.js +265 -265
- package/src/components/chart/helpers/helpers.constant.js +206 -206
- package/src/components/chart/helpers/helpers.util.js +346 -338
- package/src/components/chart/index.js +9 -9
- package/src/components/chart/model/index.js +4 -4
- package/src/components/chart/model/model.series.js +93 -93
- package/src/components/chart/model/model.store.js +977 -967
- package/src/components/chart/plugins/plugins.interaction.js +769 -769
- package/src/components/chart/plugins/plugins.legend.gradient.js +602 -602
- package/src/components/chart/plugins/plugins.legend.js +1155 -1151
- package/src/components/chart/plugins/plugins.pie.js +254 -254
- package/src/components/chart/plugins/plugins.title.js +56 -56
- package/src/components/chart/plugins/plugins.tooltip.js +692 -692
- package/src/components/chart/scale/scale.js +848 -848
- package/src/components/chart/scale/scale.linear.js +38 -38
- package/src/components/chart/scale/scale.logarithmic.js +128 -128
- package/src/components/chart/scale/scale.step.js +336 -336
- package/src/components/chart/scale/scale.time.category.js +277 -277
- package/src/components/chart/scale/scale.time.js +48 -48
- package/src/components/chart/style/chart.scss +312 -312
- package/src/components/chart/uses.js +264 -252
- package/src/components/checkbox/Checkbox.vue +200 -200
- package/src/components/checkbox/index.js +7 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +44 -44
- package/src/components/checkboxGroup/index.js +7 -7
- package/src/components/contextMenu/ContextMenu.vue +80 -80
- package/src/components/contextMenu/MenuList.vue +149 -149
- package/src/components/contextMenu/index.js +7 -7
- package/src/components/contextMenu/uses.js +203 -203
- package/src/components/datePicker/DatePicker.vue +437 -437
- package/src/components/datePicker/index.js +7 -7
- package/src/components/datePicker/uses.js +419 -419
- package/src/components/grid/Grid.vue +827 -827
- package/src/components/grid/grid.filter.window.vue +493 -493
- package/src/components/grid/grid.pagination.vue +75 -75
- package/src/components/grid/grid.summary.vue +265 -265
- package/src/components/grid/grid.toolbar.vue +26 -26
- package/src/components/grid/index.js +11 -11
- package/src/components/grid/style/grid.scss +263 -263
- package/src/components/grid/uses.js +1002 -1007
- package/src/components/icon/Icon.vue +49 -49
- package/src/components/icon/index.js +8 -8
- package/src/components/inputNumber/InputNumber.vue +212 -212
- package/src/components/inputNumber/index.js +7 -7
- package/src/components/inputNumber/uses.js +217 -217
- package/src/components/loading/Loading.vue +125 -125
- package/src/components/loading/index.js +7 -7
- package/src/components/menu/Menu.vue +68 -68
- package/src/components/menu/MenuItem.vue +187 -187
- package/src/components/menu/index.js +7 -7
- package/src/components/message/Message.vue +223 -223
- package/src/components/message/index.js +31 -31
- package/src/components/messageBox/MessageBox.vue +358 -358
- package/src/components/messageBox/index.js +22 -22
- package/src/components/notification/Notification.vue +316 -316
- package/src/components/notification/index.js +49 -49
- package/src/components/pagination/Pagination.vue +271 -271
- package/src/components/pagination/index.js +7 -7
- package/src/components/pagination/pageButton.vue +30 -30
- package/src/components/progress/Progress.vue +139 -139
- package/src/components/progress/index.js +7 -7
- package/src/components/radio/Radio.vue +159 -159
- package/src/components/radio/index.js +7 -7
- package/src/components/radioGroup/RadioGroup.vue +41 -41
- package/src/components/radioGroup/index.js +7 -7
- package/src/components/scheduler/Scheduler.vue +149 -149
- package/src/components/scheduler/index.js +7 -7
- package/src/components/scheduler/uses.js +183 -183
- package/src/components/select/Select.vue +440 -440
- package/src/components/select/index.js +7 -7
- package/src/components/select/uses.js +270 -270
- package/src/components/slider/Slider.vue +505 -505
- package/src/components/slider/index.js +7 -7
- package/src/components/slider/uses.js +390 -390
- package/src/components/tabPanel/TabPanel.vue +74 -74
- package/src/components/tabPanel/index.js +7 -7
- package/src/components/tabs/Tabs.vue +517 -517
- package/src/components/tabs/index.js +7 -7
- package/src/components/textField/TextField.vue +375 -375
- package/src/components/textField/index.js +7 -7
- package/src/components/timePicker/TimePicker.vue +352 -352
- package/src/components/timePicker/index.js +7 -7
- package/src/components/toggle/Toggle.vue +115 -115
- package/src/components/toggle/index.js +7 -7
- package/src/components/tree/Tree.vue +313 -313
- package/src/components/tree/TreeNode.vue +293 -293
- package/src/components/tree/index.js +7 -7
- package/src/components/treeGrid/TreeGrid.vue +758 -758
- package/src/components/treeGrid/TreeGridNode.vue +275 -275
- package/src/components/treeGrid/index.js +9 -9
- package/src/components/treeGrid/style/treeGrid.scss +261 -261
- package/src/components/treeGrid/treeGrid.toolbar.vue +26 -26
- package/src/components/treeGrid/uses.js +867 -867
- package/src/components/window/Window.vue +329 -329
- package/src/components/window/index.js +7 -7
- package/src/components/window/uses.js +899 -899
- package/src/directives/clickoutside.js +90 -90
- package/src/main.js +116 -116
- package/src/style/components/input.scss +108 -108
- package/src/style/functions.scss +3 -3
- package/src/style/index.scss +6 -6
- package/src/style/lib/fonts/EVUI.svg +292 -292
- package/src/style/lib/icon.css +888 -888
- package/src/style/mixins.scss +94 -94
- package/src/style/themes.scss +67 -67
- package/src/style/variables.scss +22 -22
|
@@ -1,203 +1,203 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ref, reactive, computed, nextTick,
|
|
3
|
-
getCurrentInstance, defineComponent,
|
|
4
|
-
} from 'vue';
|
|
5
|
-
import MenuList from './MenuList';
|
|
6
|
-
|
|
7
|
-
export const useModel = () => {
|
|
8
|
-
const comp = defineComponent(MenuList);
|
|
9
|
-
const childrenItems = ref([]);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 컴포넌트 초기에 body에 wrapperDiv를 append한다.
|
|
13
|
-
*/
|
|
14
|
-
const initWrapperDiv = () => {
|
|
15
|
-
const root = document.createElement('div');
|
|
16
|
-
root.id = 'ev-context-menu-modal';
|
|
17
|
-
root.setAttribute('style', 'position: absolute; top: 0; left: 0;');
|
|
18
|
-
const hasRoot = document.getElementById('ev-context-menu-modal');
|
|
19
|
-
if (!hasRoot) {
|
|
20
|
-
document.body.appendChild(root);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
comp,
|
|
26
|
-
childrenItems,
|
|
27
|
-
initWrapperDiv,
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const usePosition = () => {
|
|
32
|
-
const isShow = ref(false);
|
|
33
|
-
const rootMenuList = ref(null);
|
|
34
|
-
const menuStyle = reactive({
|
|
35
|
-
top: null,
|
|
36
|
-
left: null,
|
|
37
|
-
right: null,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* ContextMenu.vue 컴포넌트 생성 메소드
|
|
42
|
-
* @param e - 사용자가 우클릭한 마우스 이벤트 정보
|
|
43
|
-
* @returns null
|
|
44
|
-
*/
|
|
45
|
-
const show = async (e) => {
|
|
46
|
-
isShow.value = true;
|
|
47
|
-
await nextTick();
|
|
48
|
-
const menuListRect = rootMenuList.value?.$el?.children[0].getBoundingClientRect();
|
|
49
|
-
if (menuListRect) {
|
|
50
|
-
const menuListHeight = menuListRect.height;
|
|
51
|
-
const menuListWidth = menuListRect.width;
|
|
52
|
-
const docHeight = document.documentElement.clientHeight;
|
|
53
|
-
const docWidth = document.documentElement.clientWidth;
|
|
54
|
-
const RIGHT_BUFFER_PX = 20;
|
|
55
|
-
if (docHeight < e.clientY + menuListHeight) {
|
|
56
|
-
// dropTop
|
|
57
|
-
menuStyle.top = `${e.pageY - menuListHeight}px`;
|
|
58
|
-
if (docWidth < e.clientX + menuListWidth + RIGHT_BUFFER_PX) {
|
|
59
|
-
menuStyle.left = `${e.pageX - menuListWidth}px`;
|
|
60
|
-
} else {
|
|
61
|
-
menuStyle.left = `${e.pageX}px`;
|
|
62
|
-
}
|
|
63
|
-
} else {
|
|
64
|
-
// dropDown
|
|
65
|
-
menuStyle.top = `${e.pageY}px`;
|
|
66
|
-
if (docWidth < e.clientX + menuListWidth + RIGHT_BUFFER_PX) {
|
|
67
|
-
menuStyle.left = `${e.pageX - menuListWidth}px`;
|
|
68
|
-
} else {
|
|
69
|
-
menuStyle.left = `${e.pageX}px`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* ContextMenu 컴포넌트 숨김 메소드
|
|
77
|
-
* @returns null
|
|
78
|
-
*/
|
|
79
|
-
const hide = async () => {
|
|
80
|
-
await nextTick();
|
|
81
|
-
isShow.value = false;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
isShow,
|
|
86
|
-
rootMenuList,
|
|
87
|
-
menuStyle,
|
|
88
|
-
show,
|
|
89
|
-
hide,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const useMenuList = () => {
|
|
94
|
-
const { props, emit } = getCurrentInstance();
|
|
95
|
-
|
|
96
|
-
// nested구조 하위 리스트에서 최상단의 ContextMenu에 isShow를 전달할 때 사용하는 변수
|
|
97
|
-
const computedIsShow = computed({
|
|
98
|
-
get: () => props.isShow,
|
|
99
|
-
set: val => emit('update:isShow', val),
|
|
100
|
-
});
|
|
101
|
-
// 자식(.children 속성) 존재 여부
|
|
102
|
-
const isExistChild = computed(() => !!props.items.some(v => v.children));
|
|
103
|
-
// 마우스오버한 항목에 자식 리스트 정보
|
|
104
|
-
const childrenItems = ref([]);
|
|
105
|
-
// 자식 컴포넌트 보임 여부
|
|
106
|
-
const isShowChild = ref(false);
|
|
107
|
-
const childMenu = ref(null);
|
|
108
|
-
// MenuList 스타일 정보
|
|
109
|
-
const menuStyle = reactive({
|
|
110
|
-
top: null,
|
|
111
|
-
left: null,
|
|
112
|
-
right: null,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* 모두 닫기 메소드, 주로 정상적인 항목 클릭 후 해당 메소드 실행
|
|
117
|
-
* 자식이 있는 항목은 클릭하였을 때, return 한다.
|
|
118
|
-
* @param children
|
|
119
|
-
*/
|
|
120
|
-
const hideAll = (children) => {
|
|
121
|
-
if (children) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
computedIsShow.value = false;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* 자식 항목 숨기기 메소드
|
|
128
|
-
* 다른 항목에 마우스오버 시 자식이 존재하는 항목의 자식 컴포넌트를 숨긴다.
|
|
129
|
-
*/
|
|
130
|
-
const hideChild = () => {
|
|
131
|
-
isShowChild.value = false;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* 자식 컴포넌트 보여주기 (nested구조에서 2depth 컴포넌트부터 사용한다.)
|
|
135
|
-
* mouseenter된 항목의 좌표를 잡아서 offset 등 여러 조건에 따라 좌우로 드랍업/다운을 실행
|
|
136
|
-
* @param e - 마우스 이벤트
|
|
137
|
-
* @param children - 자식 리스트
|
|
138
|
-
* @returns null
|
|
139
|
-
*/
|
|
140
|
-
const showChild = async (e, children) => {
|
|
141
|
-
isShowChild.value = true;
|
|
142
|
-
childrenItems.value = children;
|
|
143
|
-
await nextTick();
|
|
144
|
-
if (!childMenu.value?.$el?.children[0]) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const targetUlRect = e.target.parentElement?.getBoundingClientRect();
|
|
149
|
-
const targetUlX = targetUlRect.x;
|
|
150
|
-
const targetUlWidth = targetUlRect.width;
|
|
151
|
-
|
|
152
|
-
const childMenuRect = childMenu.value?.$el?.children[0].getBoundingClientRect();
|
|
153
|
-
const menuListHeight = childMenuRect.height;
|
|
154
|
-
const menuListWidth = childMenuRect.width;
|
|
155
|
-
|
|
156
|
-
const docHeight = document.documentElement.clientHeight;
|
|
157
|
-
const docWidth = document.documentElement.clientWidth;
|
|
158
|
-
const RIGHT_BUFFER_PX = 20;
|
|
159
|
-
|
|
160
|
-
if (docHeight < e.target.offsetTop + menuListHeight) {
|
|
161
|
-
// dropTop
|
|
162
|
-
menuStyle.top = `${e.target.offsetTop - menuListHeight}px`;
|
|
163
|
-
if (docWidth < targetUlX + targetUlWidth + menuListWidth + RIGHT_BUFFER_PX) {
|
|
164
|
-
menuStyle.left = `${e.offsetX - menuListWidth}px`;
|
|
165
|
-
} else {
|
|
166
|
-
menuStyle.left = `${e.offsetX}px`;
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
// dropDown
|
|
170
|
-
menuStyle.top = `${e.target.offsetTop}px`;
|
|
171
|
-
if (docWidth < targetUlX + targetUlWidth + menuListWidth + RIGHT_BUFFER_PX) {
|
|
172
|
-
menuStyle.left = `${0 - menuListWidth}px`;
|
|
173
|
-
} else {
|
|
174
|
-
menuStyle.left = `${targetUlWidth}px`;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* 항목에 마우스엔터 시 발생하는 이벤트
|
|
181
|
-
* @param e - 마우스 이벤트 (showChild에 넘김)
|
|
182
|
-
* @param children - 자식 리스트
|
|
183
|
-
* @returns null
|
|
184
|
-
*/
|
|
185
|
-
const mouseenterLi = async (e, children) => {
|
|
186
|
-
if (!children || !Array.isArray(children)) {
|
|
187
|
-
hideChild();
|
|
188
|
-
} else {
|
|
189
|
-
await showChild(e, children);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
computedIsShow,
|
|
195
|
-
isExistChild,
|
|
196
|
-
isShowChild,
|
|
197
|
-
childMenu,
|
|
198
|
-
menuStyle,
|
|
199
|
-
childrenItems,
|
|
200
|
-
mouseenterLi,
|
|
201
|
-
hideAll,
|
|
202
|
-
};
|
|
203
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
ref, reactive, computed, nextTick,
|
|
3
|
+
getCurrentInstance, defineComponent,
|
|
4
|
+
} from 'vue';
|
|
5
|
+
import MenuList from './MenuList';
|
|
6
|
+
|
|
7
|
+
export const useModel = () => {
|
|
8
|
+
const comp = defineComponent(MenuList);
|
|
9
|
+
const childrenItems = ref([]);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 컴포넌트 초기에 body에 wrapperDiv를 append한다.
|
|
13
|
+
*/
|
|
14
|
+
const initWrapperDiv = () => {
|
|
15
|
+
const root = document.createElement('div');
|
|
16
|
+
root.id = 'ev-context-menu-modal';
|
|
17
|
+
root.setAttribute('style', 'position: absolute; top: 0; left: 0;');
|
|
18
|
+
const hasRoot = document.getElementById('ev-context-menu-modal');
|
|
19
|
+
if (!hasRoot) {
|
|
20
|
+
document.body.appendChild(root);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
comp,
|
|
26
|
+
childrenItems,
|
|
27
|
+
initWrapperDiv,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const usePosition = () => {
|
|
32
|
+
const isShow = ref(false);
|
|
33
|
+
const rootMenuList = ref(null);
|
|
34
|
+
const menuStyle = reactive({
|
|
35
|
+
top: null,
|
|
36
|
+
left: null,
|
|
37
|
+
right: null,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ContextMenu.vue 컴포넌트 생성 메소드
|
|
42
|
+
* @param e - 사용자가 우클릭한 마우스 이벤트 정보
|
|
43
|
+
* @returns null
|
|
44
|
+
*/
|
|
45
|
+
const show = async (e) => {
|
|
46
|
+
isShow.value = true;
|
|
47
|
+
await nextTick();
|
|
48
|
+
const menuListRect = rootMenuList.value?.$el?.children[0].getBoundingClientRect();
|
|
49
|
+
if (menuListRect) {
|
|
50
|
+
const menuListHeight = menuListRect.height;
|
|
51
|
+
const menuListWidth = menuListRect.width;
|
|
52
|
+
const docHeight = document.documentElement.clientHeight;
|
|
53
|
+
const docWidth = document.documentElement.clientWidth;
|
|
54
|
+
const RIGHT_BUFFER_PX = 20;
|
|
55
|
+
if (docHeight < e.clientY + menuListHeight) {
|
|
56
|
+
// dropTop
|
|
57
|
+
menuStyle.top = `${e.pageY - menuListHeight}px`;
|
|
58
|
+
if (docWidth < e.clientX + menuListWidth + RIGHT_BUFFER_PX) {
|
|
59
|
+
menuStyle.left = `${e.pageX - menuListWidth}px`;
|
|
60
|
+
} else {
|
|
61
|
+
menuStyle.left = `${e.pageX}px`;
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
// dropDown
|
|
65
|
+
menuStyle.top = `${e.pageY}px`;
|
|
66
|
+
if (docWidth < e.clientX + menuListWidth + RIGHT_BUFFER_PX) {
|
|
67
|
+
menuStyle.left = `${e.pageX - menuListWidth}px`;
|
|
68
|
+
} else {
|
|
69
|
+
menuStyle.left = `${e.pageX}px`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* ContextMenu 컴포넌트 숨김 메소드
|
|
77
|
+
* @returns null
|
|
78
|
+
*/
|
|
79
|
+
const hide = async () => {
|
|
80
|
+
await nextTick();
|
|
81
|
+
isShow.value = false;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
isShow,
|
|
86
|
+
rootMenuList,
|
|
87
|
+
menuStyle,
|
|
88
|
+
show,
|
|
89
|
+
hide,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const useMenuList = () => {
|
|
94
|
+
const { props, emit } = getCurrentInstance();
|
|
95
|
+
|
|
96
|
+
// nested구조 하위 리스트에서 최상단의 ContextMenu에 isShow를 전달할 때 사용하는 변수
|
|
97
|
+
const computedIsShow = computed({
|
|
98
|
+
get: () => props.isShow,
|
|
99
|
+
set: val => emit('update:isShow', val),
|
|
100
|
+
});
|
|
101
|
+
// 자식(.children 속성) 존재 여부
|
|
102
|
+
const isExistChild = computed(() => !!props.items.some(v => v.children));
|
|
103
|
+
// 마우스오버한 항목에 자식 리스트 정보
|
|
104
|
+
const childrenItems = ref([]);
|
|
105
|
+
// 자식 컴포넌트 보임 여부
|
|
106
|
+
const isShowChild = ref(false);
|
|
107
|
+
const childMenu = ref(null);
|
|
108
|
+
// MenuList 스타일 정보
|
|
109
|
+
const menuStyle = reactive({
|
|
110
|
+
top: null,
|
|
111
|
+
left: null,
|
|
112
|
+
right: null,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 모두 닫기 메소드, 주로 정상적인 항목 클릭 후 해당 메소드 실행
|
|
117
|
+
* 자식이 있는 항목은 클릭하였을 때, return 한다.
|
|
118
|
+
* @param children
|
|
119
|
+
*/
|
|
120
|
+
const hideAll = (children) => {
|
|
121
|
+
if (children) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
computedIsShow.value = false;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* 자식 항목 숨기기 메소드
|
|
128
|
+
* 다른 항목에 마우스오버 시 자식이 존재하는 항목의 자식 컴포넌트를 숨긴다.
|
|
129
|
+
*/
|
|
130
|
+
const hideChild = () => {
|
|
131
|
+
isShowChild.value = false;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* 자식 컴포넌트 보여주기 (nested구조에서 2depth 컴포넌트부터 사용한다.)
|
|
135
|
+
* mouseenter된 항목의 좌표를 잡아서 offset 등 여러 조건에 따라 좌우로 드랍업/다운을 실행
|
|
136
|
+
* @param e - 마우스 이벤트
|
|
137
|
+
* @param children - 자식 리스트
|
|
138
|
+
* @returns null
|
|
139
|
+
*/
|
|
140
|
+
const showChild = async (e, children) => {
|
|
141
|
+
isShowChild.value = true;
|
|
142
|
+
childrenItems.value = children;
|
|
143
|
+
await nextTick();
|
|
144
|
+
if (!childMenu.value?.$el?.children[0]) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const targetUlRect = e.target.parentElement?.getBoundingClientRect();
|
|
149
|
+
const targetUlX = targetUlRect.x;
|
|
150
|
+
const targetUlWidth = targetUlRect.width;
|
|
151
|
+
|
|
152
|
+
const childMenuRect = childMenu.value?.$el?.children[0].getBoundingClientRect();
|
|
153
|
+
const menuListHeight = childMenuRect.height;
|
|
154
|
+
const menuListWidth = childMenuRect.width;
|
|
155
|
+
|
|
156
|
+
const docHeight = document.documentElement.clientHeight;
|
|
157
|
+
const docWidth = document.documentElement.clientWidth;
|
|
158
|
+
const RIGHT_BUFFER_PX = 20;
|
|
159
|
+
|
|
160
|
+
if (docHeight < e.target.offsetTop + menuListHeight) {
|
|
161
|
+
// dropTop
|
|
162
|
+
menuStyle.top = `${e.target.offsetTop - menuListHeight}px`;
|
|
163
|
+
if (docWidth < targetUlX + targetUlWidth + menuListWidth + RIGHT_BUFFER_PX) {
|
|
164
|
+
menuStyle.left = `${e.offsetX - menuListWidth}px`;
|
|
165
|
+
} else {
|
|
166
|
+
menuStyle.left = `${e.offsetX}px`;
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
// dropDown
|
|
170
|
+
menuStyle.top = `${e.target.offsetTop}px`;
|
|
171
|
+
if (docWidth < targetUlX + targetUlWidth + menuListWidth + RIGHT_BUFFER_PX) {
|
|
172
|
+
menuStyle.left = `${0 - menuListWidth}px`;
|
|
173
|
+
} else {
|
|
174
|
+
menuStyle.left = `${targetUlWidth}px`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 항목에 마우스엔터 시 발생하는 이벤트
|
|
181
|
+
* @param e - 마우스 이벤트 (showChild에 넘김)
|
|
182
|
+
* @param children - 자식 리스트
|
|
183
|
+
* @returns null
|
|
184
|
+
*/
|
|
185
|
+
const mouseenterLi = async (e, children) => {
|
|
186
|
+
if (!children || !Array.isArray(children)) {
|
|
187
|
+
hideChild();
|
|
188
|
+
} else {
|
|
189
|
+
await showChild(e, children);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
computedIsShow,
|
|
195
|
+
isExistChild,
|
|
196
|
+
isShowChild,
|
|
197
|
+
childMenu,
|
|
198
|
+
menuStyle,
|
|
199
|
+
childrenItems,
|
|
200
|
+
mouseenterLi,
|
|
201
|
+
hideAll,
|
|
202
|
+
};
|
|
203
|
+
};
|