evui 2.0.8 → 2.1.1
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/dist/{adac9fa4f723f9d2cb5b6640517114a9.png → 0b8d1200e71cae8d747dce4e69c4efb6.png} +0 -0
- package/dist/1.css +4 -0
- package/dist/1.css.map +1 -0
- package/dist/1.evui.min.js +2 -0
- package/dist/1.evui.min.js.map +1 -0
- package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
- package/dist/2.css +4 -0
- package/dist/2.css.map +1 -0
- package/dist/2.evui.min.js +2 -0
- package/dist/2.evui.min.js.map +1 -0
- package/dist/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 278156e41e0ad908cf7f841b17130502.woff2} +0 -0
- package/dist/3.evui.min.js +2 -0
- package/dist/3.evui.min.js.map +1 -0
- package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
- package/dist/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 38c6d8bab26db77d8c806813e1497763.woff2} +0 -0
- package/dist/4.evui.min.js +2 -0
- package/dist/4.evui.min.js.map +1 -0
- package/dist/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
- package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
- package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
- package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
- package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
- package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
- package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
- package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
- package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
- package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
- package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
- package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
- package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
- package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
- package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
- package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
- package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
- package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
- package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
- package/dist/evui.min.js +12 -59485
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -1
- package/dist/main.css +85 -0
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -0
- package/package.json +58 -89
- package/src/common/emitter.js +20 -0
- package/src/common/utils.debounce.js +223 -0
- package/src/common/utils.js +51 -17
- package/src/common/utils.throttle.js +83 -0
- package/src/common/utils.tree.js +18 -0
- package/src/components/button/button.vue +316 -241
- package/src/components/chart/chart.core.js +699 -0
- package/src/components/chart/chart.vue +200 -204
- package/src/components/chart/element/element.bar.js +311 -0
- package/src/components/chart/element/element.bar.time.js +115 -0
- package/src/components/chart/element/element.line.js +288 -0
- package/src/components/chart/element/element.pie.js +86 -0
- package/src/components/chart/element/element.scatter.js +83 -0
- package/src/components/chart/element/element.tip.js +356 -0
- package/src/components/chart/helpers/helpers.canvas.js +237 -0
- package/src/components/chart/helpers/helpers.constant.js +138 -0
- package/src/components/chart/helpers/helpers.util.js +154 -0
- package/src/components/chart/index.js +0 -1
- package/src/components/chart/model/index.js +4 -0
- package/src/components/chart/model/model.series.js +86 -0
- package/src/components/chart/model/model.store.js +559 -0
- package/src/components/chart/plugins/plugins.interaction.js +324 -0
- package/src/components/chart/plugins/plugins.legend.js +589 -0
- package/src/components/chart/plugins/plugins.pie.js +179 -0
- package/src/components/chart/plugins/plugins.title.js +56 -0
- package/src/components/chart/plugins/plugins.tooltip.js +384 -0
- package/src/components/chart/scale/scale.js +272 -0
- package/src/components/chart/scale/scale.linear.js +30 -0
- package/src/components/chart/scale/scale.logarithmic.js +120 -0
- package/src/components/chart/scale/scale.step.js +197 -0
- package/src/components/chart/scale/scale.time.category.js +204 -0
- package/src/components/chart/scale/scale.time.js +40 -0
- package/src/components/checkbox/checkbox-group.vue +31 -12
- package/src/components/checkbox/checkbox.vue +269 -19
- package/src/components/codeview/code.vue +42 -29
- package/src/components/contextmenu/contextmenu.child.vue +79 -0
- package/src/components/contextmenu/contextmenu.vue +276 -0
- package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
- package/src/components/contextmenu/index.js +3 -0
- package/src/components/datepicker/calendar.core.js +604 -510
- package/src/components/datepicker/calendar.vue +0 -3
- package/src/components/datepicker/datepicker.vue +73 -14
- package/src/components/datepicker/index.js +5 -1
- package/src/components/grid/grid.filter.vue +290 -0
- package/src/components/grid/grid.filter.window.vue +411 -0
- package/src/components/grid/grid.render.vue +45 -0
- package/src/components/grid/grid.vue +1338 -0
- package/src/components/icon/icon.vue +22 -7
- package/src/components/input/input.number.vue +309 -277
- package/src/components/label/label.vue +2 -2
- package/src/components/loadingmask/loadingmask.vue +52 -63
- package/src/components/loginfield/index.js +3 -0
- package/src/components/loginfield/loginfield.vue +339 -0
- package/src/components/markdown/index.js +3 -0
- package/src/components/markdown/markdown.vue +1001 -0
- package/src/components/menu/index.js +1 -3
- package/src/components/menu/menu.nav.item.vue +115 -0
- package/src/components/menu/menu.nav.sub.vue +42 -0
- package/src/components/menu/menu.nav.vue +71 -98
- package/src/components/message/index.js +3 -0
- package/src/components/message/message.js +63 -0
- package/src/components/message/message.vue +191 -0
- package/src/components/message-box/index.js +3 -0
- package/src/components/message-box/message-box.js +31 -0
- package/src/components/message-box/message-box.vue +298 -0
- package/src/components/notification/index.js +3 -0
- package/src/components/notification/notification.js +75 -0
- package/src/components/notification/notification.vue +242 -0
- package/src/components/radio/radio-group.vue +12 -2
- package/src/components/radio/radio.vue +186 -25
- package/src/components/selectbox/dropdown.vue +96 -39
- package/src/components/selectbox/listbox.vue +68 -29
- package/src/components/selectbox/option.vue +1 -1
- package/src/components/selectbox/selectbox.vue +445 -245
- package/src/components/slider/slider-tooltip.vue +7 -7
- package/src/components/slider/slider.vue +20 -25
- package/src/components/splitter/index.js +3 -0
- package/src/components/splitter/splitter.vue +294 -0
- package/src/components/table/table.black.css +1 -1
- package/src/components/table/table.filter.lite.vue +8 -8
- package/src/components/table/table.filter.vue +1 -1
- package/src/components/table/table.grey.css +5 -6
- package/src/components/table/table.navy.css +1 -1
- package/src/components/table/table.vue +60 -55
- package/src/components/tabs/tab-panel.vue +19 -5
- package/src/components/tabs/tabs.vue +182 -87
- package/src/components/textfield/textfield.vue +140 -80
- package/src/components/timepicker/index.js +2 -2
- package/src/components/timepicker/spinner.vue +15 -17
- package/src/components/timepicker/timepicker.vue +98 -53
- package/src/components/toggle/toggle.vue +206 -158
- package/src/components/tree/index.js +2 -6
- package/src/components/tree/render.js +17 -0
- package/src/components/tree/tree-node.vue +214 -0
- package/src/components/tree/tree.vue +296 -0
- package/src/components/tree-table/index.js +7 -0
- package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
- package/src/components/{tree → tree-table}/tree.table.grey.css +12 -12
- package/src/components/{tree → tree-table}/tree.table.vue +151 -95
- package/src/components/tree-table/tree.util.js +119 -0
- package/src/components/window/window.vue +238 -183
- package/src/index.js +29 -12
- package/src/styles/base/base.scss +50 -0
- package/src/styles/base/index.scss +1 -0
- package/src/styles/default.scss +5 -0
- package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
- package/src/styles/{all.css → lib/fontawesome.css} +1 -1
- package/src/styles/lib/icon.css +792 -0
- package/src/styles/themes/index.scss +2 -0
- package/src/styles/themes/mixin.scss +33 -0
- package/src/styles/themes/variables.scss +206 -0
- package/src/styles/utils/colors.scss +222 -0
- package/src/styles/utils/index.scss +2 -0
- package/src/styles/utils/mixins.scss +34 -0
- package/src/styles/utils/variables.scss +27 -0
- package/src/webfonts/EVUI.eot +0 -0
- package/src/webfonts/EVUI.svg +251 -173
- package/src/webfonts/EVUI.ttf +0 -0
- package/src/webfonts/EVUI.woff +0 -0
- package/src/webfonts/Roboto-Bold.ttf +0 -0
- package/src/webfonts/Roboto-Medium.ttf +0 -0
- package/src/webfonts/Roboto-Regular.ttf +0 -0
- package/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
- package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
- package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
- package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
- package/src/components/chart/charts/chart.bar.js +0 -334
- package/src/components/chart/charts/chart.base.js +0 -1075
- package/src/components/chart/charts/chart.line.js +0 -262
- package/src/components/chart/charts/chart.pie.js +0 -383
- package/src/components/chart/charts/chart.scatter.js +0 -349
- package/src/components/chart/charts/chart.sunburst.js +0 -193
- package/src/components/chart/core/axis/axis.js +0 -217
- package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
- package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
- package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
- package/src/components/chart/core/core.constant.js +0 -91
- package/src/components/chart/core/core.legend.js +0 -473
- package/src/components/chart/core/core.util.js +0 -66
- package/src/components/chart/core/data/data.js +0 -412
- package/src/components/chart/core/data/data.pie.js +0 -70
- package/src/components/chart/core/data/data.stack.js +0 -222
- package/src/components/chart/core/data/data.sunburst.js +0 -172
- package/src/components/menu/menu.context.children.vue +0 -201
- package/src/components/menu/menu.context.vue +0 -144
- package/src/components/tabs/jun/tab.vue +0 -123
- package/src/components/tabs/jun/tabs.vue +0 -484
- package/src/components/tree/tree.util.js +0 -39
- package/src/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
ref="exampleLayer"
|
|
16
16
|
class="evui-codeview-example-layer"
|
|
17
17
|
>
|
|
18
|
-
<slot/>
|
|
18
|
+
<slot />
|
|
19
19
|
<div
|
|
20
20
|
v-if="description && isBottom"
|
|
21
21
|
ref="descriptionLayer"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
<div>
|
|
28
|
-
<div class="evui-codeview-split-layer"/>
|
|
28
|
+
<div class="evui-codeview-split-layer" />
|
|
29
29
|
<div
|
|
30
30
|
ref="codeLayer"
|
|
31
31
|
class="evui-codeview-code-layer"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
:class="selectIconClasses"
|
|
44
44
|
class="evui-codeview-example-bar-icon"
|
|
45
45
|
>
|
|
46
|
-
<icon class="fa-sort-down"/>
|
|
46
|
+
<icon class="fa-sort-down" />
|
|
47
47
|
<span
|
|
48
48
|
class="evui-codeview-example-bar-span"
|
|
49
49
|
>{{ txtBottomBar }}</span>
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
mounted() {
|
|
117
|
-
const descriptionLayerHeight = this.$refs.descriptionLayer
|
|
118
|
-
this.$refs.descriptionLayer.getBoundingClientRect().height + 14.5 : 0;
|
|
117
|
+
const descriptionLayerHeight = this.$refs.descriptionLayer
|
|
118
|
+
? this.$refs.descriptionLayer.getBoundingClientRect().height + 14.5 : 0;
|
|
119
119
|
const exampleLayerHeight = this.$refs.exampleLayer.getBoundingClientRect().height;
|
|
120
120
|
|
|
121
121
|
this.boxHeight = exampleLayerHeight + descriptionLayerHeight + 50;
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
onBottomClick: function onBottomClick() {
|
|
135
135
|
const codeLayerHeight = this.$refs.codeLayer.getBoundingClientRect().height;
|
|
136
136
|
const exampleLayerHeight = this.$refs.exampleLayer.getBoundingClientRect().height;
|
|
137
|
-
const descriptionLayerHeight = this.$refs.descriptionLayer
|
|
138
|
-
this.$refs.descriptionLayer.getBoundingClientRect().height + 14.5 : 0;
|
|
137
|
+
const descriptionLayerHeight = this.$refs.descriptionLayer
|
|
138
|
+
? this.$refs.descriptionLayer.getBoundingClientRect().height + 14.5 : 0;
|
|
139
139
|
if (this.txtBottomBar === 'Expand') {
|
|
140
140
|
this.txtBottomBar = 'Hide';
|
|
141
141
|
this.boxHeight = codeLayerHeight + exampleLayerHeight + descriptionLayerHeight + 33;
|
|
@@ -149,64 +149,73 @@
|
|
|
149
149
|
};
|
|
150
150
|
</script>
|
|
151
151
|
<style scoped>
|
|
152
|
-
.evui-codeview{
|
|
152
|
+
.evui-codeview {
|
|
153
153
|
position: relative;
|
|
154
154
|
width: 100%;
|
|
155
|
-
border: 1px solid #
|
|
155
|
+
border: 1px solid #DFE6E9;
|
|
156
156
|
margin: 5px;
|
|
157
157
|
padding: 10px 10px 20px 10px;
|
|
158
158
|
border-radius: 6px;
|
|
159
159
|
overflow: hidden;
|
|
160
|
-
z-index: 1;
|
|
161
160
|
transition: height .3s ease-in-out;
|
|
162
161
|
}
|
|
163
|
-
|
|
162
|
+
|
|
163
|
+
.evui-codeview.expand {
|
|
164
164
|
transition: height .3s ease-in-out;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
|
|
167
|
+
.evui-codeview-example-layer {
|
|
167
168
|
position: relative;
|
|
168
|
-
padding:
|
|
169
|
+
padding: 0 0 8px 0;
|
|
169
170
|
}
|
|
170
|
-
|
|
171
|
+
|
|
172
|
+
.evui-codeview-split-layer {
|
|
171
173
|
position: relative;
|
|
172
|
-
border-bottom: 1px solid #
|
|
174
|
+
border-bottom: 1px solid #DFE6E9;
|
|
173
175
|
}
|
|
174
|
-
|
|
176
|
+
|
|
177
|
+
.evui-codeview-code-layer {
|
|
175
178
|
position: relative;
|
|
176
179
|
width: 100%;
|
|
177
180
|
font-size: 8px;
|
|
178
181
|
}
|
|
179
|
-
|
|
182
|
+
|
|
183
|
+
.evui-codeview-example-bar {
|
|
180
184
|
position: absolute;
|
|
181
|
-
left:
|
|
182
|
-
bottom:
|
|
185
|
+
left: 0;
|
|
186
|
+
bottom: 0;
|
|
183
187
|
width: 100%;
|
|
184
188
|
height: 37px;
|
|
185
189
|
z-index: 10;
|
|
186
|
-
background-color: #
|
|
190
|
+
background-color: #FFFFFF;
|
|
187
191
|
transition: background-color .2s ease-in-out;
|
|
188
192
|
}
|
|
189
|
-
|
|
193
|
+
|
|
194
|
+
.evui-codeview-example-bar:hover {
|
|
190
195
|
cursor: pointer;
|
|
191
196
|
background-color: rgba(255, 255, 255, 0.4);
|
|
192
197
|
}
|
|
193
|
-
|
|
198
|
+
|
|
199
|
+
.evui-codeview-example:hover {
|
|
194
200
|
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
|
|
195
201
|
}
|
|
196
|
-
|
|
202
|
+
|
|
203
|
+
.evui-codeview-example-bar-icon {
|
|
197
204
|
width: 100%;
|
|
198
205
|
height: 100%;
|
|
199
206
|
line-height: 25px;
|
|
200
207
|
text-align: center;
|
|
201
208
|
}
|
|
202
|
-
|
|
209
|
+
|
|
210
|
+
.evui-codeview-example-bar-icon i {
|
|
203
211
|
height: 100%;
|
|
204
212
|
line-height: 30px;
|
|
205
213
|
font-size: 16px;
|
|
206
214
|
color: rgba(30, 101, 188, 0.5);
|
|
207
215
|
transition: all .3s ease-in-out;
|
|
208
216
|
}
|
|
209
|
-
|
|
217
|
+
|
|
218
|
+
.evui-codeview-example-bar-icon span {
|
|
210
219
|
line-height: 30px;
|
|
211
220
|
font-size: 13px;
|
|
212
221
|
font-weight: bold;
|
|
@@ -214,21 +223,24 @@
|
|
|
214
223
|
transition: all .3s ease-in-out;
|
|
215
224
|
}
|
|
216
225
|
|
|
217
|
-
.evui-codeview-example-bar-icon:hover i, .evui-codeview-example-bar-icon:hover span{
|
|
226
|
+
.evui-codeview-example-bar-icon:hover i, .evui-codeview-example-bar-icon:hover span {
|
|
218
227
|
color: rgb(30, 101, 188);
|
|
219
228
|
opacity: 1;
|
|
220
229
|
transform: translateX(-6px);
|
|
221
230
|
transition: all .3s ease-out;
|
|
222
231
|
}
|
|
223
|
-
|
|
232
|
+
|
|
233
|
+
.evui-codeview-example-bar-icon.select-down i {
|
|
224
234
|
transform: rotate(180deg);
|
|
225
235
|
transition: transform .4s ease-out;
|
|
226
236
|
}
|
|
237
|
+
|
|
227
238
|
.evui-codeview-example-bar-icon, .evui-codeview-example-bar-icon-span {
|
|
228
239
|
user-select: none;
|
|
229
240
|
}
|
|
241
|
+
|
|
230
242
|
.evui-codeview-description {
|
|
231
|
-
border: 1px solid #
|
|
243
|
+
border: 1px solid #DFE6E9;
|
|
232
244
|
border-radius: 2px;
|
|
233
245
|
padding: 5px 10px 8px 10px;
|
|
234
246
|
margin: 5px 3px 5px 3px;
|
|
@@ -236,7 +248,8 @@
|
|
|
236
248
|
text-align: left;
|
|
237
249
|
line-height: 1.5;
|
|
238
250
|
}
|
|
239
|
-
|
|
251
|
+
|
|
252
|
+
.evui-codeview-description span {
|
|
240
253
|
font-size: 13px;
|
|
241
254
|
}
|
|
242
255
|
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="prefixEvui"
|
|
4
|
+
>
|
|
5
|
+
<context-menu
|
|
6
|
+
:depth="depth"
|
|
7
|
+
:visibility="visibility"
|
|
8
|
+
:row-index="rowIndex"
|
|
9
|
+
:items="items"
|
|
10
|
+
@click="onClick"
|
|
11
|
+
/>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
ContextMenu: () => import('./contextmenu'),
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
depth: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 0,
|
|
24
|
+
},
|
|
25
|
+
rowKey: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '',
|
|
28
|
+
},
|
|
29
|
+
rowIndex: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 0,
|
|
32
|
+
},
|
|
33
|
+
focusedRowKey: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '',
|
|
36
|
+
},
|
|
37
|
+
items: {
|
|
38
|
+
type: Array,
|
|
39
|
+
default() {
|
|
40
|
+
return [];
|
|
41
|
+
},
|
|
42
|
+
validator(value) {
|
|
43
|
+
return value != null && value.constructor === Array;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
prefixEvui: 'contextmenu-child',
|
|
50
|
+
visibility: 'hidden',
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
focusedRowKey(value) {
|
|
55
|
+
if (value === this.rowKey) {
|
|
56
|
+
this.visibility = 'visible';
|
|
57
|
+
} else {
|
|
58
|
+
this.visibility = 'hidden';
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
onClick(item) {
|
|
64
|
+
if (!item.disabled) {
|
|
65
|
+
this.$emit('click', item);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss">
|
|
73
|
+
.contextmenu-child {
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 0;
|
|
76
|
+
left: 0;
|
|
77
|
+
z-index: 850;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="ctxMenuStyle"
|
|
4
|
+
:class="prefixEvui"
|
|
5
|
+
@mouseleave="onMouseLeave"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
class="contextmenu-body"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
v-for="(item, rowIdx) in items"
|
|
12
|
+
:key="getRowKey(depth, rowIdx, item.text)"
|
|
13
|
+
:class="getRowCls(item)"
|
|
14
|
+
:disabled="item.disabled"
|
|
15
|
+
@click="onRowClick(item, depth, rowIdx)"
|
|
16
|
+
@mouseover="onMouseOver(depth, rowIdx, item)"
|
|
17
|
+
>
|
|
18
|
+
<ev-icon
|
|
19
|
+
v-if="item.icon"
|
|
20
|
+
:cls="`${item.icon} contextmenu-row-icon`"
|
|
21
|
+
/>
|
|
22
|
+
{{ item.text }}
|
|
23
|
+
<ev-icon
|
|
24
|
+
v-if="item.items"
|
|
25
|
+
:cls="'ei-arrow-right2 menu-arrow'"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<context-menu-child
|
|
30
|
+
v-for="(item, rowIdx) in items"
|
|
31
|
+
v-if="item.items"
|
|
32
|
+
:key="`children_menu_${item.text}_${depth}_${rowIdx}`"
|
|
33
|
+
:depth="depth + 1"
|
|
34
|
+
:row-index="rowIdx"
|
|
35
|
+
:row-key="getRowKey(depth, rowIdx, item.text)"
|
|
36
|
+
:focused-row-key="focusedRowKey"
|
|
37
|
+
:items="item.items"
|
|
38
|
+
@click="onClick"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
export default {
|
|
45
|
+
components: {
|
|
46
|
+
ContextMenuChild: () => import('./contextmenu.child'),
|
|
47
|
+
},
|
|
48
|
+
props: {
|
|
49
|
+
visibility: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'visible',
|
|
52
|
+
validator(value) {
|
|
53
|
+
const list = ['visible', 'hidden', 'collapse', 'inherit', 'initial', 'unset'];
|
|
54
|
+
return list.indexOf(value) > -1;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
depth: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 0,
|
|
60
|
+
},
|
|
61
|
+
rowIndex: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 0,
|
|
64
|
+
},
|
|
65
|
+
items: {
|
|
66
|
+
type: Array,
|
|
67
|
+
default() {
|
|
68
|
+
return [];
|
|
69
|
+
},
|
|
70
|
+
validator(value) {
|
|
71
|
+
return value != null && value.constructor === Array;
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
data() {
|
|
76
|
+
return {
|
|
77
|
+
prefixEvui: 'contextmenu',
|
|
78
|
+
top: 0,
|
|
79
|
+
left: 0,
|
|
80
|
+
width: 0,
|
|
81
|
+
height: 0,
|
|
82
|
+
clientRect: null,
|
|
83
|
+
clientRectLeft: 0,
|
|
84
|
+
isHScroll: false,
|
|
85
|
+
isVScroll: false,
|
|
86
|
+
scrollbarSize: 16,
|
|
87
|
+
directionToShow: 'right',
|
|
88
|
+
rowHeight: 29,
|
|
89
|
+
focusedRowKey: '',
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
ctxMenuStyle() {
|
|
94
|
+
return this.depth === 0 ? '' : `
|
|
95
|
+
visibility: ${this.visibility};
|
|
96
|
+
top: ${this.top}px;
|
|
97
|
+
left: ${this.left}px;
|
|
98
|
+
`;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
watch: {
|
|
102
|
+
visibility(value) {
|
|
103
|
+
if (value === 'visible') {
|
|
104
|
+
this.setPosition();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
onRowClick(item, depth, rowIdx) {
|
|
110
|
+
if (!item.disabled) {
|
|
111
|
+
this.$emit('click', {
|
|
112
|
+
...item,
|
|
113
|
+
depth,
|
|
114
|
+
rowIdx,
|
|
115
|
+
scope: this,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
onClick(item) {
|
|
120
|
+
if (!item.disabled) {
|
|
121
|
+
this.$emit('click', item);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
onMouseOver(depth, rowIdx, item) {
|
|
125
|
+
if (item.disabled) {
|
|
126
|
+
this.focusedRowKey = '';
|
|
127
|
+
} else {
|
|
128
|
+
this.focusedRowKey = this.getRowKey(depth, rowIdx, item.text);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
onMouseLeave() {
|
|
132
|
+
this.focusedRowKey = '';
|
|
133
|
+
},
|
|
134
|
+
setPosition() {
|
|
135
|
+
const parent = this.$parent.$parent;
|
|
136
|
+
|
|
137
|
+
if (!this.clientRect) {
|
|
138
|
+
this.clientRect = this.getClientRect();
|
|
139
|
+
|
|
140
|
+
if (this.clientRect) {
|
|
141
|
+
const scrollEl = document.scrollingElement
|
|
142
|
+
|| document.documentElement || document.body;
|
|
143
|
+
this.isHScroll = window.innerWidth < scrollEl.scrollWidth;
|
|
144
|
+
this.isVScroll = window.innerHeight < scrollEl.scrollHeight;
|
|
145
|
+
this.width = this.clientRect.width || 0;
|
|
146
|
+
this.height = this.clientRect.height || 0;
|
|
147
|
+
this.top = this.rowIndex * this.rowHeight;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (this.clientRect && parent) {
|
|
152
|
+
const parentClientRect = parent.getClientRect();
|
|
153
|
+
const parentClientRectLeft = parent.clientRectLeft;
|
|
154
|
+
const parentWidth = parentClientRect.width || 0;
|
|
155
|
+
const parentY = parentClientRect.y || 0;
|
|
156
|
+
const parentDirectionToShow = parent.directionToShow;
|
|
157
|
+
let top = this.top;
|
|
158
|
+
let left = 0;
|
|
159
|
+
let clientRectLeft;
|
|
160
|
+
|
|
161
|
+
if (this.depth === 1) {
|
|
162
|
+
clientRectLeft = parentWidth;
|
|
163
|
+
} else {
|
|
164
|
+
clientRectLeft = parentWidth + parentClientRectLeft;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const remainingHeight = (window.innerHeight - (top + parentY))
|
|
168
|
+
- (this.isHScroll ? this.scrollbarSize : 0);
|
|
169
|
+
const remainingWidth = (window.innerWidth - (parentClientRect.x + parentWidth))
|
|
170
|
+
- (this.isVScroll ? this.scrollbarSize : 0);
|
|
171
|
+
|
|
172
|
+
if (this.height > remainingHeight) {
|
|
173
|
+
top -= (this.height - remainingHeight);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (parentDirectionToShow === 'left'
|
|
177
|
+
|| this.width > remainingWidth) {
|
|
178
|
+
left = -this.width;
|
|
179
|
+
this.directionToShow = 'left';
|
|
180
|
+
} else {
|
|
181
|
+
left = parentWidth;
|
|
182
|
+
this.directionToShow = 'right';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.clientRectLeft = clientRectLeft;
|
|
186
|
+
this.top = top;
|
|
187
|
+
this.left = left;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
getClientRect() {
|
|
191
|
+
return (
|
|
192
|
+
this.$el
|
|
193
|
+
&& this.$el.firstElementChild
|
|
194
|
+
&& this.$el.firstElementChild.getClientRects()[0]
|
|
195
|
+
) || {};
|
|
196
|
+
},
|
|
197
|
+
getRowCls(item) {
|
|
198
|
+
return {
|
|
199
|
+
'contextmenu-row': true,
|
|
200
|
+
'exist-arrow': !!item.items,
|
|
201
|
+
disabled: !!item.disabled,
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
getRowKey(depth, rowIndex, text) {
|
|
205
|
+
return `rowKey_${depth}_${rowIndex}_${text}`;
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
</script>
|
|
210
|
+
|
|
211
|
+
<style lang="scss">
|
|
212
|
+
@import '~@/styles/default';
|
|
213
|
+
|
|
214
|
+
.contextmenu {
|
|
215
|
+
position: absolute;
|
|
216
|
+
z-index: 850;
|
|
217
|
+
|
|
218
|
+
.contextmenu-body {
|
|
219
|
+
position: relative;
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
|
|
222
|
+
@include evThemify() {
|
|
223
|
+
background: evThemed('contextmenu-wrap-bg');
|
|
224
|
+
color: evThemed('contextmenu-color');
|
|
225
|
+
border: 1px solid evThemed('contextmenu-wrap-border');
|
|
226
|
+
box-shadow: 0 7px 15px 0 evThemed('contextmenu-wrap-boxshadow');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.contextmenu-row {
|
|
231
|
+
position: relative;
|
|
232
|
+
height: 29px;
|
|
233
|
+
padding: 2px 16px;
|
|
234
|
+
line-height: 22px;
|
|
235
|
+
white-space: nowrap;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
|
|
238
|
+
&:hover {
|
|
239
|
+
@include evThemify() {
|
|
240
|
+
background-color: evThemed('contextmenu-row-border');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&.disabled {
|
|
245
|
+
opacity: 0.5;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&:not(.disabled) {
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&.exist-arrow {
|
|
253
|
+
padding: 2px 21px 2px 16px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.menu-arrow {
|
|
257
|
+
position: absolute;
|
|
258
|
+
top: 8px;
|
|
259
|
+
right: 4px;
|
|
260
|
+
pointer-events: none;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
&:last-child {
|
|
264
|
+
border-bottom: 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@include evThemify() {
|
|
268
|
+
border-bottom: 1px solid evThemed('contextmenu-row-border');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&-icon {
|
|
272
|
+
padding: 0 5px 0 0;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-click-outside="hide"
|
|
4
|
+
:style="ctxMenuStyle"
|
|
5
|
+
:class="prefixEvui"
|
|
6
|
+
>
|
|
7
|
+
<context-menu
|
|
8
|
+
ref="ctxMenu"
|
|
9
|
+
:depth="0"
|
|
10
|
+
:items="items"
|
|
11
|
+
@click="onClick"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
components: {
|
|
19
|
+
ContextMenu: () => import('./contextmenu'),
|
|
20
|
+
},
|
|
21
|
+
directives: {
|
|
22
|
+
'click-outside': {
|
|
23
|
+
bind(el, binding) {
|
|
24
|
+
const contextMenuEl = el;
|
|
25
|
+
const bubble = binding.modifiers.bubble;
|
|
26
|
+
const handler = (e) => {
|
|
27
|
+
if (bubble || (contextMenuEl !== e.target && !contextMenuEl.contains(e.target))) {
|
|
28
|
+
binding.value(e);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
contextMenuEl.vueClickOutside = handler;
|
|
32
|
+
|
|
33
|
+
document.addEventListener('mousedown', handler);
|
|
34
|
+
},
|
|
35
|
+
unbind(el) {
|
|
36
|
+
const contextMenuEl = el;
|
|
37
|
+
document.removeEventListener('mousedown', contextMenuEl.vueClickOutside);
|
|
38
|
+
contextMenuEl.vueClickOutside = null;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
props: {
|
|
43
|
+
isUse: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true,
|
|
46
|
+
},
|
|
47
|
+
x: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 0,
|
|
50
|
+
},
|
|
51
|
+
y: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 0,
|
|
54
|
+
},
|
|
55
|
+
items: {
|
|
56
|
+
type: Array,
|
|
57
|
+
default() {
|
|
58
|
+
return [];
|
|
59
|
+
},
|
|
60
|
+
validator(value) {
|
|
61
|
+
return value != null && value.constructor === Array;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
prefixEvui: 'ev-contextmenu',
|
|
68
|
+
top: 0,
|
|
69
|
+
left: 0,
|
|
70
|
+
width: 0,
|
|
71
|
+
height: 0,
|
|
72
|
+
visibility: 'hidden',
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
computed: {
|
|
76
|
+
ctxMenuStyle() {
|
|
77
|
+
return `
|
|
78
|
+
visibility: ${this.visibility};
|
|
79
|
+
top: ${this.top}px;
|
|
80
|
+
left: ${this.left}px;
|
|
81
|
+
`;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
mounted() {
|
|
85
|
+
this.parentAddListener();
|
|
86
|
+
this.moveElToBody();
|
|
87
|
+
|
|
88
|
+
if (this.$el && this.$el.firstElementChild) {
|
|
89
|
+
const clientRect = this.$el.firstElementChild.getClientRects()[0] || {};
|
|
90
|
+
|
|
91
|
+
this.top = clientRect.top || 0;
|
|
92
|
+
this.left = clientRect.left || 0;
|
|
93
|
+
this.width = clientRect.width || 0;
|
|
94
|
+
this.height = clientRect.height || 0;
|
|
95
|
+
} else {
|
|
96
|
+
this.top = 0;
|
|
97
|
+
this.left = 0;
|
|
98
|
+
this.width = 0;
|
|
99
|
+
this.height = 0;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
beforeDestroy() {
|
|
103
|
+
if (this.$el) {
|
|
104
|
+
this.$el.remove();
|
|
105
|
+
}
|
|
106
|
+
const parentEl = this.$el.parentElement;
|
|
107
|
+
if (parentEl && this.onContextMenu) {
|
|
108
|
+
parentEl.removeEventListener('contextmenu', this.onContextMenu);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
parentAddListener() {
|
|
113
|
+
const parentEl = this.$el.parentElement;
|
|
114
|
+
|
|
115
|
+
if (parentEl) {
|
|
116
|
+
parentEl.addEventListener('contextmenu', this.onContextMenu);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
moveElToBody() {
|
|
120
|
+
document.body.appendChild(this.$el);
|
|
121
|
+
},
|
|
122
|
+
onContextMenu(e) {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
this.setPosition(e, e.clientX, e.clientY);
|
|
125
|
+
this.show();
|
|
126
|
+
this.$emit('on-context-menu');
|
|
127
|
+
},
|
|
128
|
+
onClick(item) {
|
|
129
|
+
this.$emit('click', item);
|
|
130
|
+
},
|
|
131
|
+
setPosition(e, x, y) {
|
|
132
|
+
const scrollEl = document.scrollingElement || document.documentElement || document.body;
|
|
133
|
+
const scrollbarSize = window.innerWidth - scrollEl.clientWidth;
|
|
134
|
+
const clientX = x || 0;
|
|
135
|
+
const clientY = y || 0;
|
|
136
|
+
const remainingWidth = (window.innerWidth - clientX)
|
|
137
|
+
- scrollbarSize;
|
|
138
|
+
const remainingHeight = (window.innerHeight - clientY)
|
|
139
|
+
- scrollbarSize;
|
|
140
|
+
let clientWidth = this.width;
|
|
141
|
+
let clientHeight = this.height;
|
|
142
|
+
|
|
143
|
+
const clientRects = this.$el.firstElementChild.getClientRects();
|
|
144
|
+
if (clientRects.length) {
|
|
145
|
+
const clientRect = clientRects[0];
|
|
146
|
+
clientWidth = clientRect.width;
|
|
147
|
+
clientHeight = clientRect.height;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let left = clientX + scrollEl.scrollLeft;
|
|
151
|
+
let top = clientY + scrollEl.scrollTop;
|
|
152
|
+
|
|
153
|
+
if (clientWidth > remainingWidth) {
|
|
154
|
+
left -= (clientWidth - remainingWidth);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (clientHeight > remainingHeight) {
|
|
158
|
+
top -= (clientHeight - remainingHeight);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.left = left;
|
|
162
|
+
this.top = top;
|
|
163
|
+
},
|
|
164
|
+
show() {
|
|
165
|
+
if (this.isUse) {
|
|
166
|
+
this.visibility = 'visible';
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
hide() {
|
|
170
|
+
const ctxMenu = this.$refs.ctxMenu;
|
|
171
|
+
|
|
172
|
+
if (ctxMenu && ctxMenu.hide) {
|
|
173
|
+
ctxMenu.hide(this.$children);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
this.visibility = 'hidden';
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<style lang="scss">
|
|
183
|
+
@import '~@/styles/default';
|
|
184
|
+
|
|
185
|
+
.ev-contextmenu {
|
|
186
|
+
position: absolute;
|
|
187
|
+
z-index: 850;
|
|
188
|
+
}
|
|
189
|
+
</style>
|