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.
Files changed (141) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +40 -40
  3. package/dist/evui.common.js +1907 -1832
  4. package/dist/evui.common.js.map +1 -1
  5. package/dist/evui.umd.js +1907 -1832
  6. package/dist/evui.umd.js.map +1 -1
  7. package/dist/evui.umd.min.js +1 -1
  8. package/dist/evui.umd.min.js.map +1 -1
  9. package/dist/img/{EVUI.7f3588fb.svg → EVUI.b82ee81a.svg} +292 -292
  10. package/dist/img/{icon_mysql.7ea26d5d.svg → icon_mysql.1085fdc9.svg} +78 -78
  11. package/dist/img/{icon_oracle.9009b108.svg → icon_oracle.0572d3ee.svg} +13 -13
  12. package/dist/img/{icon_postgresql.f8fffba9.svg → icon_postgresql.ee12bde8.svg} +58 -58
  13. package/package.json +61 -61
  14. package/src/common/emitter.js +20 -20
  15. package/src/common/utils.debounce.js +223 -223
  16. package/src/common/utils.js +134 -134
  17. package/src/common/utils.table.js +78 -78
  18. package/src/common/utils.throttle.js +83 -83
  19. package/src/common/utils.tree.js +18 -18
  20. package/src/components/button/Button.vue +198 -198
  21. package/src/components/button/index.js +7 -7
  22. package/src/components/buttonGroup/ButtonGroup.vue +11 -11
  23. package/src/components/buttonGroup/index.js +7 -7
  24. package/src/components/calendar/Calendar.vue +661 -661
  25. package/src/components/calendar/index.js +7 -7
  26. package/src/components/calendar/uses.js +1272 -1272
  27. package/src/components/chart/Chart.vue +189 -192
  28. package/src/components/chart/chart.core.js +870 -870
  29. package/src/components/chart/element/element.bar.js +524 -524
  30. package/src/components/chart/element/element.bar.time.js +156 -156
  31. package/src/components/chart/element/element.heatmap.js +533 -533
  32. package/src/components/chart/element/element.line.js +339 -339
  33. package/src/components/chart/element/element.pie.js +197 -197
  34. package/src/components/chart/element/element.scatter.js +184 -184
  35. package/src/components/chart/element/element.tip.js +550 -542
  36. package/src/components/chart/helpers/helpers.canvas.js +265 -265
  37. package/src/components/chart/helpers/helpers.constant.js +206 -206
  38. package/src/components/chart/helpers/helpers.util.js +346 -338
  39. package/src/components/chart/index.js +9 -9
  40. package/src/components/chart/model/index.js +4 -4
  41. package/src/components/chart/model/model.series.js +93 -93
  42. package/src/components/chart/model/model.store.js +977 -967
  43. package/src/components/chart/plugins/plugins.interaction.js +769 -769
  44. package/src/components/chart/plugins/plugins.legend.gradient.js +602 -602
  45. package/src/components/chart/plugins/plugins.legend.js +1155 -1151
  46. package/src/components/chart/plugins/plugins.pie.js +254 -254
  47. package/src/components/chart/plugins/plugins.title.js +56 -56
  48. package/src/components/chart/plugins/plugins.tooltip.js +692 -692
  49. package/src/components/chart/scale/scale.js +848 -848
  50. package/src/components/chart/scale/scale.linear.js +38 -38
  51. package/src/components/chart/scale/scale.logarithmic.js +128 -128
  52. package/src/components/chart/scale/scale.step.js +336 -336
  53. package/src/components/chart/scale/scale.time.category.js +277 -277
  54. package/src/components/chart/scale/scale.time.js +48 -48
  55. package/src/components/chart/style/chart.scss +312 -312
  56. package/src/components/chart/uses.js +264 -252
  57. package/src/components/checkbox/Checkbox.vue +200 -200
  58. package/src/components/checkbox/index.js +7 -7
  59. package/src/components/checkboxGroup/CheckboxGroup.vue +44 -44
  60. package/src/components/checkboxGroup/index.js +7 -7
  61. package/src/components/contextMenu/ContextMenu.vue +80 -80
  62. package/src/components/contextMenu/MenuList.vue +149 -149
  63. package/src/components/contextMenu/index.js +7 -7
  64. package/src/components/contextMenu/uses.js +203 -203
  65. package/src/components/datePicker/DatePicker.vue +437 -437
  66. package/src/components/datePicker/index.js +7 -7
  67. package/src/components/datePicker/uses.js +419 -419
  68. package/src/components/grid/Grid.vue +827 -827
  69. package/src/components/grid/grid.filter.window.vue +493 -493
  70. package/src/components/grid/grid.pagination.vue +75 -75
  71. package/src/components/grid/grid.summary.vue +265 -265
  72. package/src/components/grid/grid.toolbar.vue +26 -26
  73. package/src/components/grid/index.js +11 -11
  74. package/src/components/grid/style/grid.scss +263 -263
  75. package/src/components/grid/uses.js +1002 -1007
  76. package/src/components/icon/Icon.vue +49 -49
  77. package/src/components/icon/index.js +8 -8
  78. package/src/components/inputNumber/InputNumber.vue +212 -212
  79. package/src/components/inputNumber/index.js +7 -7
  80. package/src/components/inputNumber/uses.js +217 -217
  81. package/src/components/loading/Loading.vue +125 -125
  82. package/src/components/loading/index.js +7 -7
  83. package/src/components/menu/Menu.vue +68 -68
  84. package/src/components/menu/MenuItem.vue +187 -187
  85. package/src/components/menu/index.js +7 -7
  86. package/src/components/message/Message.vue +223 -223
  87. package/src/components/message/index.js +31 -31
  88. package/src/components/messageBox/MessageBox.vue +358 -358
  89. package/src/components/messageBox/index.js +22 -22
  90. package/src/components/notification/Notification.vue +316 -316
  91. package/src/components/notification/index.js +49 -49
  92. package/src/components/pagination/Pagination.vue +271 -271
  93. package/src/components/pagination/index.js +7 -7
  94. package/src/components/pagination/pageButton.vue +30 -30
  95. package/src/components/progress/Progress.vue +139 -139
  96. package/src/components/progress/index.js +7 -7
  97. package/src/components/radio/Radio.vue +159 -159
  98. package/src/components/radio/index.js +7 -7
  99. package/src/components/radioGroup/RadioGroup.vue +41 -41
  100. package/src/components/radioGroup/index.js +7 -7
  101. package/src/components/scheduler/Scheduler.vue +149 -149
  102. package/src/components/scheduler/index.js +7 -7
  103. package/src/components/scheduler/uses.js +183 -183
  104. package/src/components/select/Select.vue +440 -440
  105. package/src/components/select/index.js +7 -7
  106. package/src/components/select/uses.js +270 -270
  107. package/src/components/slider/Slider.vue +505 -505
  108. package/src/components/slider/index.js +7 -7
  109. package/src/components/slider/uses.js +390 -390
  110. package/src/components/tabPanel/TabPanel.vue +74 -74
  111. package/src/components/tabPanel/index.js +7 -7
  112. package/src/components/tabs/Tabs.vue +517 -517
  113. package/src/components/tabs/index.js +7 -7
  114. package/src/components/textField/TextField.vue +375 -375
  115. package/src/components/textField/index.js +7 -7
  116. package/src/components/timePicker/TimePicker.vue +352 -352
  117. package/src/components/timePicker/index.js +7 -7
  118. package/src/components/toggle/Toggle.vue +115 -115
  119. package/src/components/toggle/index.js +7 -7
  120. package/src/components/tree/Tree.vue +313 -313
  121. package/src/components/tree/TreeNode.vue +293 -293
  122. package/src/components/tree/index.js +7 -7
  123. package/src/components/treeGrid/TreeGrid.vue +758 -758
  124. package/src/components/treeGrid/TreeGridNode.vue +275 -275
  125. package/src/components/treeGrid/index.js +9 -9
  126. package/src/components/treeGrid/style/treeGrid.scss +261 -261
  127. package/src/components/treeGrid/treeGrid.toolbar.vue +26 -26
  128. package/src/components/treeGrid/uses.js +867 -867
  129. package/src/components/window/Window.vue +329 -329
  130. package/src/components/window/index.js +7 -7
  131. package/src/components/window/uses.js +899 -899
  132. package/src/directives/clickoutside.js +90 -90
  133. package/src/main.js +116 -116
  134. package/src/style/components/input.scss +108 -108
  135. package/src/style/functions.scss +3 -3
  136. package/src/style/index.scss +6 -6
  137. package/src/style/lib/fonts/EVUI.svg +292 -292
  138. package/src/style/lib/icon.css +888 -888
  139. package/src/style/mixins.scss +94 -94
  140. package/src/style/themes.scss +67 -67
  141. package/src/style/variables.scss +22 -22
@@ -1,505 +1,505 @@
1
- <template>
2
- <div
3
- class="ev-slider"
4
- :class="{
5
- readonly,
6
- disabled,
7
- 'hide-tooltip': !showTooltip,
8
- 'show-input': showInput,
9
- 'color-range': isColorArray,
10
- 'show-mark': markList.length,
11
- }"
12
- >
13
- <div class="ev-slider-wrapper">
14
- <div
15
- ref="sliderLine"
16
- class="ev-slider-line"
17
- >
18
- <template v-if="showStep && step">
19
- <div class="ev-slider-step-wrapper">
20
- <span
21
- v-for="(stepLeft, idx) in stepList"
22
- :key="`slider-step-${idx}`"
23
- :style="{ left: `${stepLeft}%` }"
24
- class="ev-slider-step"
25
- />
26
- </div>
27
- </template>
28
- <template v-if="isColorArray && color.length > 1">
29
- <div
30
- v-if="range"
31
- :style="leftThumbStyle"
32
- class="ev-slider-thumb left"
33
- />
34
- <div
35
- :style="rightThumbStyle"
36
- class="ev-slider-thumb right"
37
- />
38
- </template>
39
- <div
40
- class="ev-slider-thumb"
41
- :style="rangeThumbStyle"
42
- />
43
- <template v-if="markList.length > 0">
44
- <div class="ev-slider-mark-wrapper">
45
- <div
46
- v-for="(markItem, idx) in markList"
47
- :key="`slider-step-${idx}`"
48
- :style="{
49
- ...markItem.style,
50
- left: `${markItem.posX}%`,
51
- }"
52
- class="ev-slider-mark"
53
- >
54
- <span class="ev-slider-mark-label">{{ markItem.label }}</span>
55
- </div>
56
- </div>
57
- </template>
58
- <span
59
- class="ev-slider-line-layer"
60
- @click="clickSlider"
61
- />
62
- </div>
63
- <div
64
- v-if="range"
65
- class="ev-slider-handle"
66
- :class="{ dragging: dragging && handleType === 'left' }"
67
- :style="leftHandleStyle"
68
- @mousedown.stop.prevent="startDrag('left')"
69
- >
70
- <span
71
- :style="handleBtnStyle"
72
- class="ev-slider-handle-btn"
73
- />
74
- <div class="ev-slider-tooltip" v-html="formatValue.left" />
75
- </div>
76
- <div
77
- class="ev-slider-handle"
78
- :class="{ dragging: dragging && handleType === 'right' }"
79
- :style="rightHandleStyle"
80
- @mousedown.stop.prevent="startDrag('right')"
81
- >
82
- <span
83
- :style="handleBtnStyle"
84
- class="ev-slider-handle-btn"
85
- />
86
- <div class="ev-slider-tooltip" v-html="formatValue.right" />
87
- </div>
88
- </div>
89
- <template v-if="showInput && !range">
90
- <ev-input-number
91
- v-model="currentValue"
92
- :step="step"
93
- :min="min"
94
- :max="max"
95
- step-strictly
96
- @change="changeInput"
97
- />
98
- </template>
99
- <template v-else-if="showInput && range && Array.isArray(modelValue)">
100
- <ev-input-number
101
- v-model="currentValue[0]"
102
- :step="step"
103
- :min="min"
104
- :max="currentValue[1]"
105
- step-strictly
106
- @change="changeInput($event, 'left')"
107
- />
108
- <ev-input-number
109
- v-model="currentValue[1]"
110
- :step="step"
111
- :min="currentValue[0]"
112
- :max="max"
113
- step-strictly
114
- @change="changeInput($event, 'right')"
115
- />
116
- </template>
117
- </div>
118
- </template>
119
-
120
- <script>
121
- import { toRefs } from 'vue';
122
- import { useModel, useStyle, useEvent, useInit } from './uses';
123
-
124
- export default {
125
- name: 'EvSlider',
126
- components: {
127
- },
128
- props: {
129
- modelValue: {
130
- type: [Number, Array],
131
- default: null,
132
- },
133
- readonly: {
134
- type: Boolean,
135
- default: false,
136
- },
137
- disabled: {
138
- type: Boolean,
139
- default: false,
140
- },
141
- range: {
142
- type: Boolean,
143
- default: false,
144
- },
145
- max: {
146
- type: Number,
147
- default: 100,
148
- },
149
- min: {
150
- type: Number,
151
- default: 0,
152
- },
153
- step: {
154
- type: Number,
155
- default: 1,
156
- validator: val => val > 0,
157
- },
158
- mark: {
159
- type: Object,
160
- default: () => {},
161
- },
162
- showStep: {
163
- type: Boolean,
164
- default: false,
165
- },
166
- showTooltip: {
167
- type: Boolean,
168
- default: true,
169
- },
170
- showInput: {
171
- type: Boolean,
172
- default: false,
173
- },
174
- color: {
175
- type: [String, Array],
176
- default: null,
177
- },
178
- tooltipFormat: {
179
- type: Function,
180
- default: null,
181
- },
182
- },
183
- emits: [
184
- 'update:modelValue',
185
- 'change',
186
- ],
187
- setup() {
188
- const {
189
- currentValue,
190
- state,
191
- slider,
192
- formatValue,
193
- sliderLine,
194
- updateSliderInfo,
195
- setSliderValue,
196
- } = useModel();
197
-
198
- const {
199
- isColorArray,
200
- leftHandleStyle,
201
- rightHandleStyle,
202
- handleBtnStyle,
203
- rangeThumbStyle,
204
- leftThumbStyle,
205
- rightThumbStyle,
206
- } = useStyle({
207
- currentValue,
208
- state,
209
- slider,
210
- });
211
-
212
- const {
213
- startDrag,
214
- clickSlider,
215
- changeInput,
216
- } = useEvent({
217
- currentValue,
218
- state,
219
- slider,
220
- updateSliderInfo,
221
- setSliderValue,
222
- });
223
-
224
- useInit({
225
- currentValue,
226
- state,
227
- slider,
228
- updateSliderInfo,
229
- setSliderValue,
230
- });
231
-
232
- return {
233
- currentValue,
234
- isColorArray,
235
- leftHandleStyle,
236
- rightHandleStyle,
237
- handleBtnStyle,
238
- rangeThumbStyle,
239
- leftThumbStyle,
240
- rightThumbStyle,
241
- sliderLine,
242
- ...toRefs(state),
243
- ...toRefs(slider),
244
- formatValue,
245
- startDrag,
246
- clickSlider,
247
- changeInput,
248
- };
249
- },
250
- };
251
- </script>
252
-
253
- <style lang="scss">
254
- @import '../../style/index.scss';
255
-
256
- .ev-slider {
257
- $line-height: 6px;
258
- $handle-height: $line-height + 10px;
259
- $handle-padding: 6px;
260
-
261
- position: relative;
262
- box-sizing: border-box;
263
- user-select: none;
264
- &-wrapper {
265
- position: relative;
266
- height: $line-height + $handle-height;
267
- padding: #{$handle-height / 2} 0;
268
- margin: 0 #{$handle-height / 2};
269
- }
270
- &-line-layer {
271
- position: absolute;
272
- top: 0;
273
- left: 0;
274
- width: 100%;
275
- height: 100%;
276
- cursor: pointer;
277
- }
278
- &-line {
279
- position: relative;
280
- width: 100%;
281
- height: 100%;
282
- border-radius: #{$line-height / 2};
283
-
284
- @include evThemify() {
285
- background-color: evThemed('border-light');
286
- }
287
- }
288
- &-thumb {
289
- position: absolute;
290
- top: 0;
291
- left: 0;
292
- width: 0;
293
- height: $line-height;
294
- border-radius: #{$line-height / 2};
295
-
296
- @include evThemify() {
297
- background-color: evThemed('primary');
298
- }
299
- }
300
- &-handle {
301
- $handle-size: $handle-height + $handle-padding;
302
-
303
- position: absolute;
304
- top: 50%;
305
- left: 0;
306
- z-index: 9;
307
- width: $handle-size;
308
- height: $handle-size;
309
- padding: $handle-padding / 2;
310
- margin-top: ($handle-size / 2) * -1;
311
- margin-left: ($handle-size / 2) * -1;
312
- cursor: grab;
313
-
314
- &.dragging {
315
- cursor: grabbing;
316
- }
317
- &.dragging,
318
- &:hover {
319
- .ev-slider-handle-btn {
320
- transform: scale(1.2);
321
- }
322
- .ev-slider-tooltip {
323
- display: block;
324
- opacity: 1;
325
- }
326
- }
327
- &-btn {
328
- display: block;
329
- width: 100%;
330
- height: 100%;
331
- border-radius: 50%;
332
- background-color: $color-white;
333
- transition: transform 0.1s ease-in-out;
334
- box-sizing: border-box;
335
-
336
- @include evThemify() {
337
- border: 2px solid evThemed('primary');
338
- }
339
- }
340
- }
341
- &-tooltip {
342
- display: none;
343
- position: absolute;
344
- left: 50%;
345
- bottom: $handle-height + 10px;
346
- padding: 3px 5px;
347
- color: $color-white;
348
- border-radius: $default-radius;
349
- font-size: $font-size-base;
350
- opacity: 0;
351
- z-index: 850;
352
- transform: translateX(-50%);
353
- transition: all 0.2s ease-in-out;
354
- white-space: nowrap;
355
-
356
- @include evThemify() {
357
- background-color: evThemed('tooltip-background');
358
- }
359
- &:before {
360
- display: block;
361
- position: absolute;
362
- left: 50%;
363
- bottom: -4px;
364
- width: 6px;
365
- height: 6px;
366
- z-index: -1;
367
- transform: rotate(45deg) translateX(-50%);
368
- content: '';
369
-
370
- @include evThemify() {
371
- background-color: evThemed('tooltip-background');
372
- }
373
- }
374
- }
375
- &-step-wrapper {
376
- position: absolute;
377
- top: 0;
378
- left: 0;
379
- width: 100%;
380
- height: 100%;
381
- }
382
- &-step {
383
- display: block;
384
- position: absolute;
385
- top: 0;
386
- width: $line-height;
387
- height: $line-height;
388
- border-radius: #{$line-height / 2};
389
- transform: translateX(-50%);
390
-
391
- @include evThemify() {
392
- background-color: evThemed('border-base');
393
- }
394
- }
395
- &-mark-wrapper {
396
- position: relative;
397
- width: 100%;
398
- height: 100%;
399
- }
400
- &-mark {
401
- position: absolute;
402
- top: $line-height * 2;
403
- padding: 0 3px;
404
- transform: translateX(-50%);
405
- font-size: $font-size-base;
406
- line-height: 1.4em;
407
-
408
- &:before {
409
- position: absolute;
410
- top: $line-height * -2;
411
- left: 50%;
412
- width: $line-height;
413
- height: $line-height;
414
- border-radius: #{$line-height / 2};
415
- transform: translateX(-50%);
416
- content: '';
417
-
418
- @include evThemify() {
419
- background-color: evThemed('slider-mark-background');
420
- }
421
- }
422
- .ev-slider-mark-label {
423
- display: block;
424
- white-space: nowrap;
425
- }
426
- }
427
-
428
- @include state('hide-tooltip') {
429
- .ev-slider-tooltip {
430
- display: none;
431
- }
432
- }
433
- @include state('show-input') {
434
- display: flex;
435
- height: $input-default-height;
436
- align-items: center;
437
- .ev-slider-wrapper {
438
- flex: 1;
439
- }
440
- .ev-input-number {
441
- width: 100px;
442
- margin-left: 10px;
443
- }
444
- }
445
- @include state('color-range') {
446
- .ev-slider-handle-btn {
447
- border-color: #666666;
448
- }
449
- }
450
- @include state('show-mark') {
451
- padding-bottom: $handle-height;
452
- }
453
- @include state('readonly') {
454
- &, * {
455
- cursor: default !important;
456
- }
457
- .ev-slider-handle {
458
- &.on,
459
- &:hover {
460
- .ev-slider-handle-btn {
461
- transform: scale(1);
462
- }
463
- }
464
- }
465
- }
466
- @include state('disabled') {
467
- &, * {
468
- cursor: not-allowed !important;
469
- }
470
- .ev-slider-thumb {
471
- @include evThemify() {
472
- background-color: evThemed('disabled');
473
- }
474
- &.left,
475
- &.right {
476
- @include evThemify() {
477
- background-color: lighten(evThemed('disabled'), 5%);
478
- }
479
- }
480
- }
481
- .ev-slider-handle {
482
- &-btn {
483
- cursor: not-allowed !important;
484
-
485
- @include evThemify() {
486
- background-color: evThemed('border-light');
487
- border-color: evThemed('disabled');
488
- }
489
- }
490
- &.on,
491
- &:hover {
492
- .ev-slider-handle-btn {
493
- transform: scale(1);
494
- }
495
- }
496
- }
497
- .ev-slider-tooltip,
498
- .ev-slider-tooltip:before {
499
- @include evThemify() {
500
- background-color: evThemed('disabled');
501
- }
502
- }
503
- }
504
- }
505
- </style>
1
+ <template>
2
+ <div
3
+ class="ev-slider"
4
+ :class="{
5
+ readonly,
6
+ disabled,
7
+ 'hide-tooltip': !showTooltip,
8
+ 'show-input': showInput,
9
+ 'color-range': isColorArray,
10
+ 'show-mark': markList.length,
11
+ }"
12
+ >
13
+ <div class="ev-slider-wrapper">
14
+ <div
15
+ ref="sliderLine"
16
+ class="ev-slider-line"
17
+ >
18
+ <template v-if="showStep && step">
19
+ <div class="ev-slider-step-wrapper">
20
+ <span
21
+ v-for="(stepLeft, idx) in stepList"
22
+ :key="`slider-step-${idx}`"
23
+ :style="{ left: `${stepLeft}%` }"
24
+ class="ev-slider-step"
25
+ />
26
+ </div>
27
+ </template>
28
+ <template v-if="isColorArray && color.length > 1">
29
+ <div
30
+ v-if="range"
31
+ :style="leftThumbStyle"
32
+ class="ev-slider-thumb left"
33
+ />
34
+ <div
35
+ :style="rightThumbStyle"
36
+ class="ev-slider-thumb right"
37
+ />
38
+ </template>
39
+ <div
40
+ class="ev-slider-thumb"
41
+ :style="rangeThumbStyle"
42
+ />
43
+ <template v-if="markList.length > 0">
44
+ <div class="ev-slider-mark-wrapper">
45
+ <div
46
+ v-for="(markItem, idx) in markList"
47
+ :key="`slider-step-${idx}`"
48
+ :style="{
49
+ ...markItem.style,
50
+ left: `${markItem.posX}%`,
51
+ }"
52
+ class="ev-slider-mark"
53
+ >
54
+ <span class="ev-slider-mark-label">{{ markItem.label }}</span>
55
+ </div>
56
+ </div>
57
+ </template>
58
+ <span
59
+ class="ev-slider-line-layer"
60
+ @click="clickSlider"
61
+ />
62
+ </div>
63
+ <div
64
+ v-if="range"
65
+ class="ev-slider-handle"
66
+ :class="{ dragging: dragging && handleType === 'left' }"
67
+ :style="leftHandleStyle"
68
+ @mousedown.stop.prevent="startDrag('left')"
69
+ >
70
+ <span
71
+ :style="handleBtnStyle"
72
+ class="ev-slider-handle-btn"
73
+ />
74
+ <div class="ev-slider-tooltip" v-html="formatValue.left" />
75
+ </div>
76
+ <div
77
+ class="ev-slider-handle"
78
+ :class="{ dragging: dragging && handleType === 'right' }"
79
+ :style="rightHandleStyle"
80
+ @mousedown.stop.prevent="startDrag('right')"
81
+ >
82
+ <span
83
+ :style="handleBtnStyle"
84
+ class="ev-slider-handle-btn"
85
+ />
86
+ <div class="ev-slider-tooltip" v-html="formatValue.right" />
87
+ </div>
88
+ </div>
89
+ <template v-if="showInput && !range">
90
+ <ev-input-number
91
+ v-model="currentValue"
92
+ :step="step"
93
+ :min="min"
94
+ :max="max"
95
+ step-strictly
96
+ @change="changeInput"
97
+ />
98
+ </template>
99
+ <template v-else-if="showInput && range && Array.isArray(modelValue)">
100
+ <ev-input-number
101
+ v-model="currentValue[0]"
102
+ :step="step"
103
+ :min="min"
104
+ :max="currentValue[1]"
105
+ step-strictly
106
+ @change="changeInput($event, 'left')"
107
+ />
108
+ <ev-input-number
109
+ v-model="currentValue[1]"
110
+ :step="step"
111
+ :min="currentValue[0]"
112
+ :max="max"
113
+ step-strictly
114
+ @change="changeInput($event, 'right')"
115
+ />
116
+ </template>
117
+ </div>
118
+ </template>
119
+
120
+ <script>
121
+ import { toRefs } from 'vue';
122
+ import { useModel, useStyle, useEvent, useInit } from './uses';
123
+
124
+ export default {
125
+ name: 'EvSlider',
126
+ components: {
127
+ },
128
+ props: {
129
+ modelValue: {
130
+ type: [Number, Array],
131
+ default: null,
132
+ },
133
+ readonly: {
134
+ type: Boolean,
135
+ default: false,
136
+ },
137
+ disabled: {
138
+ type: Boolean,
139
+ default: false,
140
+ },
141
+ range: {
142
+ type: Boolean,
143
+ default: false,
144
+ },
145
+ max: {
146
+ type: Number,
147
+ default: 100,
148
+ },
149
+ min: {
150
+ type: Number,
151
+ default: 0,
152
+ },
153
+ step: {
154
+ type: Number,
155
+ default: 1,
156
+ validator: val => val > 0,
157
+ },
158
+ mark: {
159
+ type: Object,
160
+ default: () => {},
161
+ },
162
+ showStep: {
163
+ type: Boolean,
164
+ default: false,
165
+ },
166
+ showTooltip: {
167
+ type: Boolean,
168
+ default: true,
169
+ },
170
+ showInput: {
171
+ type: Boolean,
172
+ default: false,
173
+ },
174
+ color: {
175
+ type: [String, Array],
176
+ default: null,
177
+ },
178
+ tooltipFormat: {
179
+ type: Function,
180
+ default: null,
181
+ },
182
+ },
183
+ emits: [
184
+ 'update:modelValue',
185
+ 'change',
186
+ ],
187
+ setup() {
188
+ const {
189
+ currentValue,
190
+ state,
191
+ slider,
192
+ formatValue,
193
+ sliderLine,
194
+ updateSliderInfo,
195
+ setSliderValue,
196
+ } = useModel();
197
+
198
+ const {
199
+ isColorArray,
200
+ leftHandleStyle,
201
+ rightHandleStyle,
202
+ handleBtnStyle,
203
+ rangeThumbStyle,
204
+ leftThumbStyle,
205
+ rightThumbStyle,
206
+ } = useStyle({
207
+ currentValue,
208
+ state,
209
+ slider,
210
+ });
211
+
212
+ const {
213
+ startDrag,
214
+ clickSlider,
215
+ changeInput,
216
+ } = useEvent({
217
+ currentValue,
218
+ state,
219
+ slider,
220
+ updateSliderInfo,
221
+ setSliderValue,
222
+ });
223
+
224
+ useInit({
225
+ currentValue,
226
+ state,
227
+ slider,
228
+ updateSliderInfo,
229
+ setSliderValue,
230
+ });
231
+
232
+ return {
233
+ currentValue,
234
+ isColorArray,
235
+ leftHandleStyle,
236
+ rightHandleStyle,
237
+ handleBtnStyle,
238
+ rangeThumbStyle,
239
+ leftThumbStyle,
240
+ rightThumbStyle,
241
+ sliderLine,
242
+ ...toRefs(state),
243
+ ...toRefs(slider),
244
+ formatValue,
245
+ startDrag,
246
+ clickSlider,
247
+ changeInput,
248
+ };
249
+ },
250
+ };
251
+ </script>
252
+
253
+ <style lang="scss">
254
+ @import '../../style/index.scss';
255
+
256
+ .ev-slider {
257
+ $line-height: 6px;
258
+ $handle-height: $line-height + 10px;
259
+ $handle-padding: 6px;
260
+
261
+ position: relative;
262
+ box-sizing: border-box;
263
+ user-select: none;
264
+ &-wrapper {
265
+ position: relative;
266
+ height: $line-height + $handle-height;
267
+ padding: #{$handle-height / 2} 0;
268
+ margin: 0 #{$handle-height / 2};
269
+ }
270
+ &-line-layer {
271
+ position: absolute;
272
+ top: 0;
273
+ left: 0;
274
+ width: 100%;
275
+ height: 100%;
276
+ cursor: pointer;
277
+ }
278
+ &-line {
279
+ position: relative;
280
+ width: 100%;
281
+ height: 100%;
282
+ border-radius: #{$line-height / 2};
283
+
284
+ @include evThemify() {
285
+ background-color: evThemed('border-light');
286
+ }
287
+ }
288
+ &-thumb {
289
+ position: absolute;
290
+ top: 0;
291
+ left: 0;
292
+ width: 0;
293
+ height: $line-height;
294
+ border-radius: #{$line-height / 2};
295
+
296
+ @include evThemify() {
297
+ background-color: evThemed('primary');
298
+ }
299
+ }
300
+ &-handle {
301
+ $handle-size: $handle-height + $handle-padding;
302
+
303
+ position: absolute;
304
+ top: 50%;
305
+ left: 0;
306
+ z-index: 9;
307
+ width: $handle-size;
308
+ height: $handle-size;
309
+ padding: $handle-padding / 2;
310
+ margin-top: ($handle-size / 2) * -1;
311
+ margin-left: ($handle-size / 2) * -1;
312
+ cursor: grab;
313
+
314
+ &.dragging {
315
+ cursor: grabbing;
316
+ }
317
+ &.dragging,
318
+ &:hover {
319
+ .ev-slider-handle-btn {
320
+ transform: scale(1.2);
321
+ }
322
+ .ev-slider-tooltip {
323
+ display: block;
324
+ opacity: 1;
325
+ }
326
+ }
327
+ &-btn {
328
+ display: block;
329
+ width: 100%;
330
+ height: 100%;
331
+ border-radius: 50%;
332
+ background-color: $color-white;
333
+ transition: transform 0.1s ease-in-out;
334
+ box-sizing: border-box;
335
+
336
+ @include evThemify() {
337
+ border: 2px solid evThemed('primary');
338
+ }
339
+ }
340
+ }
341
+ &-tooltip {
342
+ display: none;
343
+ position: absolute;
344
+ left: 50%;
345
+ bottom: $handle-height + 10px;
346
+ padding: 3px 5px;
347
+ color: $color-white;
348
+ border-radius: $default-radius;
349
+ font-size: $font-size-base;
350
+ opacity: 0;
351
+ z-index: 850;
352
+ transform: translateX(-50%);
353
+ transition: all 0.2s ease-in-out;
354
+ white-space: nowrap;
355
+
356
+ @include evThemify() {
357
+ background-color: evThemed('tooltip-background');
358
+ }
359
+ &:before {
360
+ display: block;
361
+ position: absolute;
362
+ left: 50%;
363
+ bottom: -4px;
364
+ width: 6px;
365
+ height: 6px;
366
+ z-index: -1;
367
+ transform: rotate(45deg) translateX(-50%);
368
+ content: '';
369
+
370
+ @include evThemify() {
371
+ background-color: evThemed('tooltip-background');
372
+ }
373
+ }
374
+ }
375
+ &-step-wrapper {
376
+ position: absolute;
377
+ top: 0;
378
+ left: 0;
379
+ width: 100%;
380
+ height: 100%;
381
+ }
382
+ &-step {
383
+ display: block;
384
+ position: absolute;
385
+ top: 0;
386
+ width: $line-height;
387
+ height: $line-height;
388
+ border-radius: #{$line-height / 2};
389
+ transform: translateX(-50%);
390
+
391
+ @include evThemify() {
392
+ background-color: evThemed('border-base');
393
+ }
394
+ }
395
+ &-mark-wrapper {
396
+ position: relative;
397
+ width: 100%;
398
+ height: 100%;
399
+ }
400
+ &-mark {
401
+ position: absolute;
402
+ top: $line-height * 2;
403
+ padding: 0 3px;
404
+ transform: translateX(-50%);
405
+ font-size: $font-size-base;
406
+ line-height: 1.4em;
407
+
408
+ &:before {
409
+ position: absolute;
410
+ top: $line-height * -2;
411
+ left: 50%;
412
+ width: $line-height;
413
+ height: $line-height;
414
+ border-radius: #{$line-height / 2};
415
+ transform: translateX(-50%);
416
+ content: '';
417
+
418
+ @include evThemify() {
419
+ background-color: evThemed('slider-mark-background');
420
+ }
421
+ }
422
+ .ev-slider-mark-label {
423
+ display: block;
424
+ white-space: nowrap;
425
+ }
426
+ }
427
+
428
+ @include state('hide-tooltip') {
429
+ .ev-slider-tooltip {
430
+ display: none;
431
+ }
432
+ }
433
+ @include state('show-input') {
434
+ display: flex;
435
+ height: $input-default-height;
436
+ align-items: center;
437
+ .ev-slider-wrapper {
438
+ flex: 1;
439
+ }
440
+ .ev-input-number {
441
+ width: 100px;
442
+ margin-left: 10px;
443
+ }
444
+ }
445
+ @include state('color-range') {
446
+ .ev-slider-handle-btn {
447
+ border-color: #666666;
448
+ }
449
+ }
450
+ @include state('show-mark') {
451
+ padding-bottom: $handle-height;
452
+ }
453
+ @include state('readonly') {
454
+ &, * {
455
+ cursor: default !important;
456
+ }
457
+ .ev-slider-handle {
458
+ &.on,
459
+ &:hover {
460
+ .ev-slider-handle-btn {
461
+ transform: scale(1);
462
+ }
463
+ }
464
+ }
465
+ }
466
+ @include state('disabled') {
467
+ &, * {
468
+ cursor: not-allowed !important;
469
+ }
470
+ .ev-slider-thumb {
471
+ @include evThemify() {
472
+ background-color: evThemed('disabled');
473
+ }
474
+ &.left,
475
+ &.right {
476
+ @include evThemify() {
477
+ background-color: lighten(evThemed('disabled'), 5%);
478
+ }
479
+ }
480
+ }
481
+ .ev-slider-handle {
482
+ &-btn {
483
+ cursor: not-allowed !important;
484
+
485
+ @include evThemify() {
486
+ background-color: evThemed('border-light');
487
+ border-color: evThemed('disabled');
488
+ }
489
+ }
490
+ &.on,
491
+ &:hover {
492
+ .ev-slider-handle-btn {
493
+ transform: scale(1);
494
+ }
495
+ }
496
+ }
497
+ .ev-slider-tooltip,
498
+ .ev-slider-tooltip:before {
499
+ @include evThemify() {
500
+ background-color: evThemed('disabled');
501
+ }
502
+ }
503
+ }
504
+ }
505
+ </style>