evui 2.1.0 → 2.1.3
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 +6 -86054
- package/dist/evui.min.js.gz +0 -0
- package/dist/evui.min.js.map +1 -1
- package/dist/main.css +43 -5541
- package/dist/main.css.gz +0 -0
- package/dist/main.css.map +1 -1
- package/package.json +56 -76
- 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 +317 -241
- package/src/components/chart/chart.core.js +378 -85
- package/src/components/chart/chart.vue +133 -115
- package/src/components/chart/element/element.bar.js +219 -25
- package/src/components/chart/element/element.bar.time.js +115 -0
- package/src/components/chart/element/element.line.js +172 -21
- package/src/components/chart/element/element.pie.js +86 -0
- package/src/components/chart/element/element.scatter.js +9 -2
- package/src/components/chart/element/element.tip.js +356 -0
- package/src/components/chart/helpers/helpers.canvas.js +94 -0
- package/src/components/chart/helpers/helpers.constant.js +25 -6
- package/src/components/chart/helpers/helpers.util.js +83 -38
- package/src/components/chart/index.js +0 -1
- package/src/components/chart/model/model.series.js +43 -14
- package/src/components/chart/model/model.store.js +440 -46
- package/src/components/chart/plugins/plugins.interaction.js +324 -0
- package/src/components/chart/plugins/plugins.legend.js +233 -91
- package/src/components/chart/plugins/plugins.pie.js +179 -0
- package/src/components/chart/plugins/plugins.title.js +25 -2
- package/src/components/chart/plugins/plugins.tooltip.js +384 -0
- package/src/components/chart/scale/scale.js +91 -29
- package/src/components/chart/scale/scale.linear.js +12 -0
- package/src/components/chart/scale/scale.logarithmic.js +25 -0
- package/src/components/chart/scale/scale.step.js +89 -52
- package/src/components/chart/scale/scale.time.category.js +204 -0
- package/src/components/chart/scale/scale.time.js +19 -1
- package/src/components/checkbox/checkbox-group.vue +15 -11
- package/src/components/checkbox/checkbox.vue +210 -138
- 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 +588 -492
- package/src/components/datepicker/calendar.vue +0 -3
- package/src/components/datepicker/datepicker.vue +43 -15
- 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 +23 -7
- package/src/components/input/input.number.vue +309 -277
- package/src/components/label/label.vue +2 -2
- package/src/components/loadingmask/loadingmask.vue +6 -13
- package/src/components/loginfield/loginfield.vue +46 -37
- 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 +7 -0
- package/src/components/message-box/message-box.js +32 -0
- package/src/components/message-box/message-box.vue +291 -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 +6 -2
- package/src/components/radio/radio.vue +156 -76
- package/src/components/selectbox/dropdown.vue +86 -40
- package/src/components/selectbox/listbox.vue +47 -18
- package/src/components/selectbox/option.vue +1 -1
- package/src/components/selectbox/selectbox.vue +304 -316
- package/src/components/slider/slider-tooltip.vue +7 -7
- package/src/components/slider/slider.vue +20 -25
- package/src/components/splitter/splitter.vue +104 -94
- package/src/components/table/table.black.css +1 -1
- package/src/components/table/table.filter.lite.vue +7 -7
- 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 +55 -48
- package/src/components/tabs/tab-panel.vue +19 -5
- package/src/components/tabs/tabs.vue +182 -87
- package/src/components/textfield/textfield.vue +110 -87
- 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 +148 -109
- 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 +0 -0
- package/src/components/{tree → tree-table}/tree.table.vue +36 -41
- package/src/components/{tree → tree-table}/tree.util.js +0 -0
- package/src/components/window/window.vue +238 -191
- package/src/index.js +28 -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 -116
- 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/styles/evui.css +0 -386
- package/src/styles/icon.css +0 -557
|
@@ -5,34 +5,32 @@
|
|
|
5
5
|
class="ev-toggle"
|
|
6
6
|
@click="changeToggle"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
8
|
+
<span
|
|
9
9
|
v-if="toggleType === 'slide'"
|
|
10
10
|
v-show="toggleText.offText"
|
|
11
11
|
ref="offTextRef"
|
|
12
12
|
:style="{
|
|
13
13
|
fontSize: toggleFontSize + 'px',
|
|
14
|
-
marginRight: toggleObj.height/5 + 'px',
|
|
15
14
|
}"
|
|
16
15
|
class="ev-toggle-offText-slide"
|
|
17
16
|
>
|
|
18
17
|
{{ toggleText.offText }}
|
|
19
|
-
</
|
|
20
|
-
<
|
|
18
|
+
</span>
|
|
19
|
+
<span
|
|
21
20
|
v-if="toggleType === 'slide'"
|
|
22
21
|
v-show="toggleText.onText"
|
|
23
22
|
ref="onTextRef"
|
|
24
23
|
:style="{
|
|
25
24
|
fontSize: toggleFontSize + 'px',
|
|
26
|
-
marginLeft: toggleObj.height/5 + 'px',
|
|
27
25
|
}"
|
|
28
26
|
class="ev-toggle-onText-slide"
|
|
29
27
|
>
|
|
30
28
|
{{ toggleText.onText }}
|
|
31
|
-
</
|
|
29
|
+
</span>
|
|
32
30
|
<div
|
|
33
31
|
v-show="isShow"
|
|
34
32
|
v-if="toggleType === 'slide'"
|
|
35
|
-
|
|
33
|
+
ref="toggleSwitch"
|
|
36
34
|
class="ev-toggle-switch"
|
|
37
35
|
/>
|
|
38
36
|
<div
|
|
@@ -55,7 +53,7 @@
|
|
|
55
53
|
>
|
|
56
54
|
{{ toggleText.offText }}
|
|
57
55
|
</div>
|
|
58
|
-
<
|
|
56
|
+
<span
|
|
59
57
|
v-if="toggleType === 'button'"
|
|
60
58
|
ref="onTextRef"
|
|
61
59
|
:style="{
|
|
@@ -64,8 +62,8 @@
|
|
|
64
62
|
class="ev-toggle-onText-button"
|
|
65
63
|
>
|
|
66
64
|
{{ toggleText.onText }}
|
|
67
|
-
</
|
|
68
|
-
<
|
|
65
|
+
</span>
|
|
66
|
+
<span
|
|
69
67
|
v-if="toggleType === 'button'"
|
|
70
68
|
ref="offTextRef"
|
|
71
69
|
:style="{
|
|
@@ -74,14 +72,12 @@
|
|
|
74
72
|
class="ev-toggle-offText-button"
|
|
75
73
|
>
|
|
76
74
|
{{ toggleText.offText }}
|
|
77
|
-
</
|
|
75
|
+
</span>
|
|
78
76
|
</div>
|
|
79
77
|
</template>
|
|
80
78
|
|
|
81
79
|
<script>
|
|
82
80
|
export default {
|
|
83
|
-
model: {
|
|
84
|
-
},
|
|
85
81
|
props: {
|
|
86
82
|
value: {
|
|
87
83
|
type: Boolean,
|
|
@@ -128,17 +124,24 @@
|
|
|
128
124
|
computed: {
|
|
129
125
|
},
|
|
130
126
|
watch: {
|
|
127
|
+
value(val) {
|
|
128
|
+
this.dataToggleOn = val;
|
|
129
|
+
},
|
|
131
130
|
toggleText: {
|
|
132
|
-
handler() {
|
|
133
|
-
this.setToggleStyle();
|
|
131
|
+
async handler() {
|
|
132
|
+
await this.setToggleStyle();
|
|
133
|
+
await this.setToggleButtonStyle();
|
|
134
134
|
},
|
|
135
135
|
deep: true,
|
|
136
136
|
},
|
|
137
|
+
dataToggleOn() {
|
|
138
|
+
this.setToggleButtonStyle();
|
|
139
|
+
},
|
|
137
140
|
},
|
|
138
141
|
mounted() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
setTimeout(async () => {
|
|
143
|
+
await this.setToggleStyle();
|
|
144
|
+
await this.setToggleButtonStyle();
|
|
142
145
|
this.isShow = true;
|
|
143
146
|
});
|
|
144
147
|
},
|
|
@@ -146,34 +149,29 @@
|
|
|
146
149
|
setToggleStyle() {
|
|
147
150
|
if (this.toggleText.onText || this.toggleText.offText) {
|
|
148
151
|
let maxTextWidth = 0;
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
maxTextWidth
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
const onTextWidth = Math.ceil(this.$refs.onTextRef.getBoundingClientRect().width);
|
|
153
|
+
const offTextWidth = Math.ceil(this.$refs.offTextRef.getBoundingClientRect().width);
|
|
154
|
+
const wrapperWidth = Math.ceil(this.$refs.toggleRef.getBoundingClientRect().width);
|
|
155
|
+
if (this.toggleType === 'slide') {
|
|
156
|
+
maxTextWidth = offTextWidth < onTextWidth ? onTextWidth : offTextWidth;
|
|
157
|
+
if (wrapperWidth - maxTextWidth !== 60) {
|
|
158
|
+
if (maxTextWidth < this.toggleObj.width - 60) {
|
|
159
|
+
this.maxWidth = this.toggleObj.width;
|
|
160
|
+
} else {
|
|
161
|
+
this.maxWidth = maxTextWidth + 60;
|
|
162
|
+
}
|
|
160
163
|
} else {
|
|
161
|
-
|
|
164
|
+
this.maxWidth = wrapperWidth;
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
|
-
if (maxTextWidth < this.toggleObj.width) {
|
|
165
|
-
this.maxWidth = this.toggleObj.width;
|
|
166
|
-
} else {
|
|
167
|
-
this.maxWidth = maxTextWidth;
|
|
168
|
-
}
|
|
169
167
|
} else {
|
|
170
168
|
this.maxWidth = this.toggleObj.width;
|
|
171
|
-
}
|
|
169
|
+
}
|
|
172
170
|
|
|
173
171
|
let toggleWrapStyle = {};
|
|
174
172
|
if (this.toggleType === 'tab') {
|
|
175
173
|
toggleWrapStyle = {
|
|
176
|
-
width:
|
|
174
|
+
width: 'auto',
|
|
177
175
|
height: `${this.toggleObj.height}px`,
|
|
178
176
|
lineHeight: `${this.toggleObj.height}px`,
|
|
179
177
|
borderRadius: '4px',
|
|
@@ -196,17 +194,17 @@
|
|
|
196
194
|
}
|
|
197
195
|
} else if (this.toggleType === 'button') {
|
|
198
196
|
toggleWrapStyle = {
|
|
199
|
-
width:
|
|
197
|
+
width: 'auto',
|
|
200
198
|
height: `${this.toggleObj.height}px`,
|
|
201
199
|
lineHeight: `${this.toggleObj.height}px`,
|
|
202
200
|
borderRadius: '4px',
|
|
203
201
|
};
|
|
204
|
-
}
|
|
202
|
+
}
|
|
205
203
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
204
|
+
const keys = Object.keys(toggleWrapStyle);
|
|
205
|
+
for (let ix = 0, ixLen = keys.length; ix < ixLen; ix++) {
|
|
206
|
+
this.$refs.toggleRef.style[keys[ix]] = toggleWrapStyle[keys[ix]];
|
|
207
|
+
}
|
|
210
208
|
},
|
|
211
209
|
changeToggle() {
|
|
212
210
|
this.dataToggleOn = !this.dataToggleOn;
|
|
@@ -219,146 +217,187 @@
|
|
|
219
217
|
toggleButtonStyle = {
|
|
220
218
|
width: `${this.toggleObj.height - 4}px`,
|
|
221
219
|
height: `${this.toggleObj.height - 4}px`,
|
|
222
|
-
|
|
220
|
+
top: '2px',
|
|
221
|
+
left: this.dataToggleOn ? 'auto' : '2px',
|
|
222
|
+
right: this.dataToggleOn ? '2px' : '0',
|
|
223
223
|
};
|
|
224
224
|
} else {
|
|
225
225
|
toggleButtonStyle = {
|
|
226
|
-
width: `${this.toggleObj.height
|
|
227
|
-
height: `${this.toggleObj.height
|
|
228
|
-
|
|
226
|
+
width: `${this.toggleObj.height + 2}px`,
|
|
227
|
+
height: `${this.toggleObj.height + 2}px`,
|
|
228
|
+
top: '-1px',
|
|
229
|
+
left: this.dataToggleOn ? 'auto' : '-1px',
|
|
230
|
+
right: this.dataToggleOn ? '-1px' : '0',
|
|
229
231
|
borderRadius: '50%',
|
|
230
232
|
};
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
|
-
|
|
235
|
+
const keys = Object.keys(toggleButtonStyle);
|
|
236
|
+
for (let ix = 0, ixLen = keys.length; ix < ixLen; ix++) {
|
|
237
|
+
this.$refs.toggleSwitch.style[keys[ix]] = toggleButtonStyle[keys[ix]];
|
|
238
|
+
}
|
|
234
239
|
},
|
|
235
240
|
},
|
|
236
241
|
};
|
|
237
242
|
</script>
|
|
238
243
|
|
|
239
|
-
<style
|
|
244
|
+
<style lang="scss">
|
|
245
|
+
@import '~@/styles/default';
|
|
246
|
+
|
|
240
247
|
.ev-toggle.slide {
|
|
241
248
|
display: inline-block;
|
|
242
249
|
position: relative;
|
|
243
250
|
vertical-align: middle;
|
|
244
|
-
|
|
245
|
-
background-color: #cccccc;
|
|
251
|
+
background-color: #CCCCCC;
|
|
246
252
|
color: #000000;
|
|
247
253
|
transition: all .2s ease-in-out;
|
|
248
254
|
user-select: none;
|
|
249
255
|
cursor: pointer;
|
|
256
|
+
|
|
257
|
+
&.active {
|
|
258
|
+
color: $color-white;
|
|
259
|
+
|
|
260
|
+
@include evThemify() {
|
|
261
|
+
background-color: evThemed('color-primary');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
250
264
|
}
|
|
251
|
-
|
|
252
|
-
border: 1px solid #2d8cf0;
|
|
253
|
-
background-color: #2d8cf0;
|
|
254
|
-
color: #ffffff;
|
|
255
|
-
}
|
|
265
|
+
|
|
256
266
|
.ev-toggle.tab {
|
|
257
|
-
display: inline-
|
|
267
|
+
display: inline-flex;
|
|
258
268
|
position: relative;
|
|
259
|
-
border: 1px solid #2d8cf0;
|
|
260
269
|
user-select: none;
|
|
261
270
|
cursor: pointer;
|
|
271
|
+
|
|
272
|
+
@include evThemify() {
|
|
273
|
+
border: 1px solid evThemed('color-primary');
|
|
274
|
+
}
|
|
262
275
|
}
|
|
276
|
+
|
|
263
277
|
.ev-toggle.button {
|
|
264
278
|
display: inline-block;
|
|
265
279
|
position: relative;
|
|
266
|
-
border:
|
|
267
|
-
|
|
268
|
-
color:
|
|
280
|
+
border: 0;
|
|
281
|
+
padding: 0 10px 0 10px;
|
|
282
|
+
color: $color-white;
|
|
269
283
|
user-select: none;
|
|
270
284
|
cursor: pointer;
|
|
285
|
+
|
|
286
|
+
@include evThemify() {
|
|
287
|
+
background-color: evThemed('color-primary');
|
|
288
|
+
}
|
|
271
289
|
}
|
|
290
|
+
|
|
272
291
|
.ev-toggle-switch {
|
|
273
292
|
position: absolute;
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
transition: all .2s ease-in-out;
|
|
293
|
+
background-color: $color-white;
|
|
294
|
+
transition-duration: 0.5s;
|
|
277
295
|
cursor: pointer;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
.active > .ev-toggle-switch {
|
|
281
|
-
position: absolute;
|
|
282
|
-
top: 1px;
|
|
283
|
-
background-color: #ffffff;
|
|
284
|
-
transition: all .2s ease-in-out;
|
|
285
|
-
cursor: pointer;
|
|
286
|
-
content: '';
|
|
296
|
+
box-shadow: 0 0 12px 0 rgba($color-black, 0.2);
|
|
297
|
+
transition: left $animate-base;
|
|
287
298
|
}
|
|
299
|
+
|
|
288
300
|
.ev-toggle-offText-slide {
|
|
289
301
|
display: inline-block;
|
|
290
302
|
height: 0;
|
|
303
|
+
margin-right: 10px;
|
|
291
304
|
visibility: visible;
|
|
292
305
|
float: right;
|
|
293
306
|
}
|
|
294
|
-
|
|
295
|
-
visibility: hidden;
|
|
296
|
-
}
|
|
307
|
+
|
|
297
308
|
.ev-toggle-onText-slide {
|
|
298
309
|
height: 0;
|
|
310
|
+
margin-left: 10px;
|
|
299
311
|
visibility: hidden;
|
|
300
312
|
}
|
|
301
|
-
|
|
302
|
-
display: inline-block;
|
|
303
|
-
visibility: visible;
|
|
304
|
-
float: left;
|
|
305
|
-
}
|
|
313
|
+
|
|
306
314
|
.ev-toggle-offText-tab {
|
|
307
315
|
display: inline-block;
|
|
308
316
|
float: left;
|
|
309
|
-
width:
|
|
317
|
+
width: auto;
|
|
310
318
|
height: 100%;
|
|
311
319
|
border-top-left-radius: 4px;
|
|
312
320
|
border-bottom-left-radius: 4px;
|
|
313
|
-
background-color:
|
|
314
|
-
|
|
321
|
+
background-color: $color-gray5;
|
|
322
|
+
padding: 0 10px 0 10px;
|
|
323
|
+
color: $color-black;
|
|
315
324
|
text-align: center;
|
|
316
325
|
vertical-align: middle;
|
|
317
326
|
user-select: none;
|
|
318
327
|
transition: all .2s ease-in-out;
|
|
319
328
|
}
|
|
320
|
-
|
|
321
|
-
border-top-left-radius: 0;
|
|
322
|
-
border-bottom-left-radius: 0;
|
|
323
|
-
background-color: #2d8cf0;
|
|
324
|
-
color: #ffffff;
|
|
325
|
-
}
|
|
329
|
+
|
|
326
330
|
.ev-toggle-onText-tab {
|
|
327
331
|
display: inline-block;
|
|
328
332
|
float: left;
|
|
329
|
-
width:
|
|
333
|
+
width: auto;
|
|
330
334
|
height: 100%;
|
|
331
|
-
border-top-right-radius:
|
|
332
|
-
border-bottom-right-radius:
|
|
333
|
-
|
|
334
|
-
color:
|
|
335
|
+
border-top-right-radius: 0;
|
|
336
|
+
border-bottom-right-radius: 0;
|
|
337
|
+
padding: 0 10px 0 10px;
|
|
338
|
+
color: $color-white;
|
|
335
339
|
text-align: center;
|
|
336
340
|
vertical-align: middle;
|
|
337
341
|
user-select: none;
|
|
338
342
|
transition: all .2s ease-in-out;
|
|
343
|
+
|
|
344
|
+
@include evThemify() {
|
|
345
|
+
background-color: evThemed('color-primary');
|
|
346
|
+
}
|
|
339
347
|
}
|
|
340
|
-
|
|
341
|
-
border-top-right-radius: 4px;
|
|
342
|
-
border-bottom-right-radius: 4px;
|
|
343
|
-
background-color: #f7f7f7;
|
|
344
|
-
color: #000000;
|
|
345
|
-
}
|
|
348
|
+
|
|
346
349
|
.ev-toggle-onText-button {
|
|
347
350
|
display: block;
|
|
348
|
-
|
|
351
|
+
left: 0;
|
|
352
|
+
right: 0;
|
|
353
|
+
height: 0;
|
|
349
354
|
visibility: hidden;
|
|
350
355
|
}
|
|
351
|
-
|
|
352
|
-
text-align: center;
|
|
353
|
-
visibility: visible;
|
|
354
|
-
}
|
|
356
|
+
|
|
355
357
|
.ev-toggle-offText-button {
|
|
356
358
|
display: block;
|
|
357
|
-
|
|
359
|
+
left: 0;
|
|
360
|
+
right: 0;
|
|
361
|
+
height: 0;
|
|
358
362
|
text-align: center;
|
|
359
363
|
visibility: visible;
|
|
360
364
|
}
|
|
361
|
-
|
|
362
|
-
|
|
365
|
+
|
|
366
|
+
.active {
|
|
367
|
+
.ev-toggle-offText-slide {
|
|
368
|
+
visibility: hidden;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.ev-toggle-onText-slide {
|
|
372
|
+
display: inline-block;
|
|
373
|
+
visibility: visible;
|
|
374
|
+
float: left;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.ev-toggle-offText-tab {
|
|
378
|
+
border-top-left-radius: 0;
|
|
379
|
+
border-bottom-left-radius: 0;
|
|
380
|
+
color: $color-white;
|
|
381
|
+
|
|
382
|
+
@include evThemify() {
|
|
383
|
+
background-color: evThemed('color-primary');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.ev-toggle-onText-tab {
|
|
388
|
+
border-top-right-radius: 4px;
|
|
389
|
+
border-bottom-right-radius: 4px;
|
|
390
|
+
background-color: $color-gray5;
|
|
391
|
+
color: $color-black;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.ev-toggle-onText-button {
|
|
395
|
+
text-align: center;
|
|
396
|
+
visibility: visible;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.ev-toggle-offText-button {
|
|
400
|
+
visibility: hidden;
|
|
401
|
+
}
|
|
363
402
|
}
|
|
364
403
|
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'RenderCell',
|
|
3
|
+
functional: true,
|
|
4
|
+
props: {
|
|
5
|
+
render: Function,
|
|
6
|
+
data: Object,
|
|
7
|
+
node: Array,
|
|
8
|
+
},
|
|
9
|
+
render: (h, ctx) => {
|
|
10
|
+
const params = {
|
|
11
|
+
root: ctx.props.node[0],
|
|
12
|
+
node: ctx.props.node[1],
|
|
13
|
+
data: ctx.props.data,
|
|
14
|
+
};
|
|
15
|
+
return ctx.props.render(h, params);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul :class="classes">
|
|
3
|
+
<li>
|
|
4
|
+
<span
|
|
5
|
+
:class="[`${prefixCls}-arrow`, {[`${prefixCls}-arrow-disabled`]: data.disabled}]"
|
|
6
|
+
@click="handleExpand"
|
|
7
|
+
>
|
|
8
|
+
<ev-icon v-if="showArrow" :cls="arrowClasses"/>
|
|
9
|
+
<ev-loading-mask v-if="showLoading"/>
|
|
10
|
+
</span>
|
|
11
|
+
<div :class="selectedCls">
|
|
12
|
+
<ev-checkbox
|
|
13
|
+
v-if="useCheckbox"
|
|
14
|
+
v-model="data.checked"
|
|
15
|
+
type="square"
|
|
16
|
+
size="small"
|
|
17
|
+
after-type="check"
|
|
18
|
+
:indeterminate.sync="data.indeterminate"
|
|
19
|
+
:disabled="data.disabled || data.disableCheckbox"
|
|
20
|
+
@on-click="handleCheck"
|
|
21
|
+
/>
|
|
22
|
+
<Render v-if="data.render" :render="data.render" :data="data" :node="node"/>
|
|
23
|
+
<Render v-else-if="isParentRender" :render="parentRender" :data="data" :node="node"/>
|
|
24
|
+
<template v-else>
|
|
25
|
+
<ev-icon
|
|
26
|
+
v-if="data.icon"
|
|
27
|
+
:class="`${prefixCls}-icon`"
|
|
28
|
+
:cls="data.icon"
|
|
29
|
+
/>
|
|
30
|
+
<span
|
|
31
|
+
:class="titleClasses"
|
|
32
|
+
@contextmenu="handleContextmenu"
|
|
33
|
+
@click="handleSelect"
|
|
34
|
+
@dblclick="handleDblclick"
|
|
35
|
+
>
|
|
36
|
+
{{ data[titleKey] }}
|
|
37
|
+
</span>
|
|
38
|
+
</template>
|
|
39
|
+
</div>
|
|
40
|
+
<tree-node
|
|
41
|
+
v-for="(item, i) in children"
|
|
42
|
+
v-if="data.expand"
|
|
43
|
+
:key="i"
|
|
44
|
+
:data="item"
|
|
45
|
+
:use-checkbox="useCheckbox"
|
|
46
|
+
:children-key="childrenKey"
|
|
47
|
+
:title-key="titleKey"
|
|
48
|
+
:expand-icon="expandIcon"
|
|
49
|
+
:collapse-icon="collapseIcon"
|
|
50
|
+
/>
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import { findComponentUpward } from '@/common/utils.tree';
|
|
57
|
+
import Emitter from '@/common/emitter';
|
|
58
|
+
import Render from './render';
|
|
59
|
+
|
|
60
|
+
const prefixCls = 'ev-tree';
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
name: 'TreeNode',
|
|
64
|
+
components: {
|
|
65
|
+
Render,
|
|
66
|
+
},
|
|
67
|
+
mixins: [Emitter],
|
|
68
|
+
props: {
|
|
69
|
+
data: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default() {
|
|
72
|
+
return {};
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
childrenKey: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: 'children',
|
|
78
|
+
},
|
|
79
|
+
useCheckbox: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
titleKey: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'title',
|
|
86
|
+
},
|
|
87
|
+
expandIcon: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '',
|
|
90
|
+
},
|
|
91
|
+
collapseIcon: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: '',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
prefixCls,
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
computed: {
|
|
102
|
+
classes() {
|
|
103
|
+
return [
|
|
104
|
+
`${prefixCls}-children`,
|
|
105
|
+
];
|
|
106
|
+
},
|
|
107
|
+
selectedCls() {
|
|
108
|
+
return [
|
|
109
|
+
`${prefixCls}-node`,
|
|
110
|
+
{
|
|
111
|
+
[`${prefixCls}-node-selected`]: this.data.selected,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
},
|
|
115
|
+
arrowClasses() {
|
|
116
|
+
// return this.data.expand ? 'ei-arrow-down' : 'ei-arrow-right';
|
|
117
|
+
const expandIcon = this.expandIcon ? this.expandIcon : 'ei-arrow-right';
|
|
118
|
+
const collapseIcon = this.expandIcon ? this.collapseIcon : 'ei-arrow-down';
|
|
119
|
+
return this.data.expand ? collapseIcon : expandIcon;
|
|
120
|
+
},
|
|
121
|
+
titleClasses() {
|
|
122
|
+
return [
|
|
123
|
+
`${prefixCls}-title`,
|
|
124
|
+
{
|
|
125
|
+
[`${prefixCls}-title-selected`]: this.data.selected,
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
},
|
|
129
|
+
showArrow() {
|
|
130
|
+
return (this.data[this.childrenKey] && this.data[this.childrenKey].length) || ('loading' in this.data && !this.data.loading);
|
|
131
|
+
},
|
|
132
|
+
showLoading() {
|
|
133
|
+
return 'loading' in this.data && this.data.loading;
|
|
134
|
+
},
|
|
135
|
+
isParentRender() {
|
|
136
|
+
const Tree = findComponentUpward(this, 'Tree');
|
|
137
|
+
return Tree && Tree.render;
|
|
138
|
+
},
|
|
139
|
+
parentRender() {
|
|
140
|
+
const Tree = findComponentUpward(this, 'Tree');
|
|
141
|
+
if (Tree && Tree.render) {
|
|
142
|
+
return Tree.render;
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
},
|
|
146
|
+
node() {
|
|
147
|
+
const Tree = findComponentUpward(this, 'Tree');
|
|
148
|
+
if (Tree) {
|
|
149
|
+
return [Tree.flatState, Tree.flatState.find(item => item.nodeKey === this.data.nodeKey)];
|
|
150
|
+
}
|
|
151
|
+
return [];
|
|
152
|
+
},
|
|
153
|
+
children() {
|
|
154
|
+
return this.data[this.childrenKey];
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
methods: {
|
|
158
|
+
handleExpand() {
|
|
159
|
+
const item = this.data;
|
|
160
|
+
if (item.disabled) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// async loading
|
|
164
|
+
if (!item[this.childrenKey].length) {
|
|
165
|
+
const tree = findComponentUpward(this, 'Tree');
|
|
166
|
+
if (tree && tree.loadData) {
|
|
167
|
+
this.$set(this.data, 'loading', true);
|
|
168
|
+
tree.loadData(item, (children) => {
|
|
169
|
+
this.$set(this.data, 'loading', false);
|
|
170
|
+
if (children.length) {
|
|
171
|
+
this.$set(this.data, this.childrenKey, children);
|
|
172
|
+
this.$nextTick(() => this.handleExpand());
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (item[this.childrenKey] && item[this.childrenKey].length) {
|
|
179
|
+
this.$set(this.data, 'expand', !this.data.expand);
|
|
180
|
+
this.dispatch('Tree', 'toggle-expand', this.data);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
handleSelect() {
|
|
184
|
+
if (this.data.disabled) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.dispatch('Tree', 'on-selected', this.data.nodeKey);
|
|
188
|
+
},
|
|
189
|
+
handleDblclick() {
|
|
190
|
+
if (this.data.disabled) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.dispatch('Tree', 'on-dbl-click', this.data.nodeKey);
|
|
194
|
+
},
|
|
195
|
+
handleCheck() {
|
|
196
|
+
if (this.data.disabled) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const changes = {
|
|
200
|
+
checked: this.data.checked,
|
|
201
|
+
nodeKey: this.data.nodeKey,
|
|
202
|
+
};
|
|
203
|
+
this.dispatch('Tree', 'on-click-checkbox', changes);
|
|
204
|
+
},
|
|
205
|
+
handleContextmenu() {
|
|
206
|
+
this.dispatch('Tree', 'on-context-menu', this.data.nodeKey);
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<style scoped>
|
|
213
|
+
|
|
214
|
+
</style>
|