@zkwq/business 0.0.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/index.css +1 -0
- package/dist/index.js +21861 -0
- package/dist/index.umd.cjs +46 -0
- package/package.json +27 -0
- package/src/components/base/ui/alert/Alert.vue +94 -0
- package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +77 -0
- package/src/components/base/ui/autocomplete/autocomplete.vue +305 -0
- package/src/components/base/ui/backtop/main.vue +112 -0
- package/src/components/base/ui/button/Button.vue +84 -0
- package/src/components/base/ui/button/ButtonGroup.vue +10 -0
- package/src/components/base/ui/carousel/Carousel.vue +304 -0
- package/src/components/base/ui/carousel/CarouselItem.vue +137 -0
- package/src/components/base/ui/cascader/cascader.vue +650 -0
- package/src/components/base/ui/cascader-panel/cascader-menu.vue +138 -0
- package/src/components/base/ui/cascader-panel/cascader-node.vue +246 -0
- package/src/components/base/ui/cascader-panel/cascader-panel.vue +382 -0
- package/src/components/base/ui/cascader-panel/node.js +166 -0
- package/src/components/base/ui/cascader-panel/store.js +62 -0
- package/src/components/base/ui/checkbox/checkbox-button.vue +199 -0
- package/src/components/base/ui/checkbox/checkbox-group.vue +48 -0
- package/src/components/base/ui/checkbox/checkbox.vue +222 -0
- package/src/components/base/ui/col/col.js +71 -0
- package/src/components/base/ui/collapse/collapse-item.vue +180 -0
- package/src/components/base/ui/collapse/collapse.vue +73 -0
- package/src/components/base/ui/color-picker/color.js +317 -0
- package/src/components/base/ui/color-picker/components/alpha-slider.vue +132 -0
- package/src/components/base/ui/color-picker/components/hue-slider.vue +123 -0
- package/src/components/base/ui/color-picker/components/picker-dropdown.vue +119 -0
- package/src/components/base/ui/color-picker/components/predefine.vue +61 -0
- package/src/components/base/ui/color-picker/components/sv-panel.vue +100 -0
- package/src/components/base/ui/color-picker/draggable.js +36 -0
- package/src/components/base/ui/color-picker/index.js +2 -0
- package/src/components/base/ui/color-picker/main.vue +188 -0
- package/src/components/base/ui/date-picker/basic/date-table.vue +441 -0
- package/src/components/base/ui/date-picker/basic/month-table.vue +254 -0
- package/src/components/base/ui/date-picker/basic/time-spinner.vue +304 -0
- package/src/components/base/ui/date-picker/basic/year-table.vue +101 -0
- package/src/components/base/ui/date-picker/panel/date-range.vue +680 -0
- package/src/components/base/ui/date-picker/panel/date.vue +597 -0
- package/src/components/base/ui/date-picker/panel/month-range.vue +289 -0
- package/src/components/base/ui/date-picker/panel/time-range.vue +248 -0
- package/src/components/base/ui/date-picker/panel/time-select.vue +178 -0
- package/src/components/base/ui/date-picker/panel/time.vue +186 -0
- package/src/components/base/ui/date-picker/picker/date-picker.js +43 -0
- package/src/components/base/ui/date-picker/picker/time-picker.js +39 -0
- package/src/components/base/ui/date-picker/picker/time-select.js +21 -0
- package/src/components/base/ui/date-picker/picker.vue +942 -0
- package/src/components/base/ui/dialog/Index.vue +212 -0
- package/src/components/base/ui/directive/repeat-click.js +24 -0
- package/src/components/base/ui/directive/ripple.js +303 -0
- package/src/components/base/ui/divider/Divider.vue +37 -0
- package/src/components/base/ui/drawer/Drawer.vue +202 -0
- package/src/components/base/ui/dropdown/dropdown-item.vue +39 -0
- package/src/components/base/ui/dropdown/dropdown-menu.vue +63 -0
- package/src/components/base/ui/dropdown/dropdown.vue +308 -0
- package/src/components/base/ui/form/Form.vue +167 -0
- package/src/components/base/ui/form/FormItem.vue +334 -0
- package/src/components/base/ui/form/LabelWrap.vue +69 -0
- package/src/components/base/ui/icon/icon.vue +13 -0
- package/src/components/base/ui/image/image-viewer.vue +302 -0
- package/src/components/base/ui/image/main.vue +248 -0
- package/src/components/base/ui/index.js +189 -0
- package/src/components/base/ui/input/Input.vue +438 -0
- package/src/components/base/ui/input/calcTextareaHeight.js +104 -0
- package/src/components/base/ui/input-number/input-number.vue +285 -0
- package/src/components/base/ui/locale/format.js +32 -0
- package/src/components/base/ui/locale/index.js +48 -0
- package/src/components/base/ui/locale/lang/zh-CN.js +120 -0
- package/src/components/base/ui/menu/menu-item-group.vue +45 -0
- package/src/components/base/ui/menu/menu-item.vue +112 -0
- package/src/components/base/ui/menu/menu-mixin.js +44 -0
- package/src/components/base/ui/menu/menu.vue +312 -0
- package/src/components/base/ui/menu/submenu.vue +408 -0
- package/src/components/base/ui/message/index.js +2 -0
- package/src/components/base/ui/message/main.js +87 -0
- package/src/components/base/ui/message/main.vue +110 -0
- package/src/components/base/ui/message-box/main.js +216 -0
- package/src/components/base/ui/message-box/main.vue +323 -0
- package/src/components/base/ui/mixin/emitter.js +31 -0
- package/src/components/base/ui/mixin/focus.js +9 -0
- package/src/components/base/ui/mixin/locale.js +9 -0
- package/src/components/base/ui/mixin/migrating.js +33 -0
- package/src/components/base/ui/pagination/pager.vue +163 -0
- package/src/components/base/ui/pagination/pagination.jsx +391 -0
- package/src/components/base/ui/popover/directive.js +20 -0
- package/src/components/base/ui/popover/index.js +14 -0
- package/src/components/base/ui/popover/main.vue +236 -0
- package/src/components/base/ui/progress/Progress.vue +227 -0
- package/src/components/base/ui/radio/radio-button.vue +114 -0
- package/src/components/base/ui/radio/radio-group.vue +111 -0
- package/src/components/base/ui/radio/radio.vue +134 -0
- package/src/components/base/ui/row/row.js +47 -0
- package/src/components/base/ui/scrollbar/bar.jsx +91 -0
- package/src/components/base/ui/scrollbar/index.jsx +203 -0
- package/src/components/base/ui/scrollbar/util.js +32 -0
- package/src/components/base/ui/select/Option.vue +168 -0
- package/src/components/base/ui/select/OptionGroup.vue +60 -0
- package/src/components/base/ui/select/Select.vue +920 -0
- package/src/components/base/ui/select/SelectDropdown.vue +74 -0
- package/src/components/base/ui/select/navigation-mixin.js +54 -0
- package/src/components/base/ui/skeleton/index.js +8 -0
- package/src/components/base/ui/skeleton/src/img-placeholder.vue +16 -0
- package/src/components/base/ui/skeleton/src/index.vue +80 -0
- package/src/components/base/ui/skeleton/src/item.vue +22 -0
- package/src/components/base/ui/skeleton-item/index.js +8 -0
- package/src/components/base/ui/slider/button.vue +238 -0
- package/src/components/base/ui/slider/main.vue +427 -0
- package/src/components/base/ui/slider/marker.js +18 -0
- package/src/components/base/ui/style/alert.scss +147 -0
- package/src/components/base/ui/style/animations.scss +65 -0
- package/src/components/base/ui/style/autocomplete.scss +81 -0
- package/src/components/base/ui/style/backtop.scss +20 -0
- package/src/components/base/ui/style/button-group.scss +0 -0
- package/src/components/base/ui/style/button.scss +380 -0
- package/src/components/base/ui/style/carousel-item.scss +50 -0
- package/src/components/base/ui/style/carousel.scss +161 -0
- package/src/components/base/ui/style/cascader-panel.scss +120 -0
- package/src/components/base/ui/style/cascader.scss +185 -0
- package/src/components/base/ui/style/checkbox-button.scss +0 -0
- package/src/components/base/ui/style/checkbox-group.scss +0 -0
- package/src/components/base/ui/style/checkbox.scss +360 -0
- package/src/components/base/ui/style/col.scss +156 -0
- package/src/components/base/ui/style/collapse-item.scss +0 -0
- package/src/components/base/ui/style/collapse.scss +114 -0
- package/src/components/base/ui/style/color-picker.scss +387 -0
- package/src/components/base/ui/style/config.scss +4 -0
- package/src/components/base/ui/style/date-picker/date-picker.scss +97 -0
- package/src/components/base/ui/style/date-picker/date-range-picker.scss +101 -0
- package/src/components/base/ui/style/date-picker/date-table.scss +151 -0
- package/src/components/base/ui/style/date-picker/month-table.scss +82 -0
- package/src/components/base/ui/style/date-picker/picker-panel.scss +117 -0
- package/src/components/base/ui/style/date-picker/picker.scss +197 -0
- package/src/components/base/ui/style/date-picker/time-picker.scss +85 -0
- package/src/components/base/ui/style/date-picker/time-range-picker.scss +31 -0
- package/src/components/base/ui/style/date-picker/time-spinner.scss +110 -0
- package/src/components/base/ui/style/date-picker/year-table.scss +51 -0
- package/src/components/base/ui/style/date-picker.scss +12 -0
- package/src/components/base/ui/style/dialog.scss +123 -0
- package/src/components/base/ui/style/divider.scss +47 -0
- package/src/components/base/ui/style/drawer.scss +218 -0
- package/src/components/base/ui/style/dropdown-item.scss +0 -0
- package/src/components/base/ui/style/dropdown-menu.scss +0 -0
- package/src/components/base/ui/style/dropdown.scss +185 -0
- package/src/components/base/ui/style/form-item.scss +0 -0
- package/src/components/base/ui/style/form.scss +203 -0
- package/src/components/base/ui/style/function.scss +43 -0
- package/src/components/base/ui/style/icon.scss +1167 -0
- package/src/components/base/ui/style/image.scss +184 -0
- package/src/components/base/ui/style/index.scss +57 -0
- package/src/components/base/ui/style/input-number.scss +187 -0
- package/src/components/base/ui/style/input.scss +477 -0
- package/src/components/base/ui/style/menu-item-group.scss +0 -0
- package/src/components/base/ui/style/menu-item.scss +0 -0
- package/src/components/base/ui/style/menu.scss +294 -0
- package/src/components/base/ui/style/message-box.scss +231 -0
- package/src/components/base/ui/style/message.scss +120 -0
- package/src/components/base/ui/style/mixins.scss +196 -0
- package/src/components/base/ui/style/option-group.scss +42 -0
- package/src/components/base/ui/style/option.scss +36 -0
- package/src/components/base/ui/style/pagination.scss +295 -0
- package/src/components/base/ui/style/popover.scss +40 -0
- package/src/components/base/ui/style/popper.scss +102 -0
- package/src/components/base/ui/style/popup.scss +42 -0
- package/src/components/base/ui/style/progress.scss +141 -0
- package/src/components/base/ui/style/radio-button.scss +113 -0
- package/src/components/base/ui/style/radio-group.scss +9 -0
- package/src/components/base/ui/style/radio.scss +203 -0
- package/src/components/base/ui/style/ripple.scss +35 -0
- package/src/components/base/ui/style/row.scss +39 -0
- package/src/components/base/ui/style/scrollbar.scss +75 -0
- package/src/components/base/ui/style/select-dropdown.scss +59 -0
- package/src/components/base/ui/style/select.scss +154 -0
- package/src/components/base/ui/style/skeleton-item.scss +84 -0
- package/src/components/base/ui/style/skeleton.scss +40 -0
- package/src/components/base/ui/style/slider.scss +250 -0
- package/src/components/base/ui/style/switch.scss +116 -0
- package/src/components/base/ui/style/tabs.scss +602 -0
- package/src/components/base/ui/style/tag.scss +174 -0
- package/src/components/base/ui/style/tooltip.scss +146 -0
- package/src/components/base/ui/style/transition.scss +138 -0
- package/src/components/base/ui/style/upload.scss +603 -0
- package/src/components/base/ui/style/utils.scss +39 -0
- package/src/components/base/ui/style/var.scss +1007 -0
- package/src/components/base/ui/switch/index.vue +174 -0
- package/src/components/base/ui/tabs/tab-bar.vue +57 -0
- package/src/components/base/ui/tabs/tab-nav.vue +294 -0
- package/src/components/base/ui/tabs/tab-pane.vue +56 -0
- package/src/components/base/ui/tabs/tabs.vue +191 -0
- package/src/components/base/ui/tag/Tag.vue +60 -0
- package/src/components/base/ui/tooltip/tooltip.jsx +234 -0
- package/src/components/base/ui/upload/Index.vue +340 -0
- package/src/components/base/ui/upload/Upload.vue +216 -0
- package/src/components/base/ui/upload/UploadDragger.vue +70 -0
- package/src/components/base/ui/upload/UploadList.vue +100 -0
- package/src/components/base/ui/upload/ajax.js +85 -0
- package/src/components/base/ui/util/aria-dialog.js +90 -0
- package/src/components/base/ui/util/aria-utils.js +122 -0
- package/src/components/base/ui/util/clickoutside.js +76 -0
- package/src/components/base/ui/util/date-util.js +292 -0
- package/src/components/base/ui/util/date.js +370 -0
- package/src/components/base/ui/util/debounce.js +21 -0
- package/src/components/base/ui/util/deepmerge.js +100 -0
- package/src/components/base/ui/util/dom.js +215 -0
- package/src/components/base/ui/util/index.js +262 -0
- package/src/components/base/ui/util/menu/aria-menubar.js +14 -0
- package/src/components/base/ui/util/menu/aria-menuitem.js +49 -0
- package/src/components/base/ui/util/menu/aria-submenu.js +59 -0
- package/src/components/base/ui/util/merge.js +14 -0
- package/src/components/base/ui/util/popper.js +1235 -0
- package/src/components/base/ui/util/popup/index.js +218 -0
- package/src/components/base/ui/util/popup/popup-manager.js +194 -0
- package/src/components/base/ui/util/resize-events.js +32 -0
- package/src/components/base/ui/util/scroll-into-view.js +27 -0
- package/src/components/base/ui/util/scrollbar-width.js +29 -0
- package/src/components/base/ui/util/shared.js +7 -0
- package/src/components/base/ui/util/throttle.js +91 -0
- package/src/components/base/ui/util/types.js +24 -0
- package/src/components/base/ui/util/vdom.js +5 -0
- package/src/components/base/ui/util/vue-popper.js +188 -0
- package/src/components/normal/AggsItemH.vue +139 -0
- package/src/index.js +10 -0
- package/src/static/base-icons.ttf +0 -0
- package/src/static/base-icons.woff +0 -0
- package/src/static/label_bg.png +0 -0
- package/src/static/term-label-bg.png +0 -0
- package/src/style/app-article.scss +698 -0
- package/src/style/app-comment.scss +259 -0
- package/src/style/app-recommend.scss +48 -0
- package/src/style/app-richtext.scss +176 -0
- package/src/style/index.scss +523 -0
- package/vite.config.js +38 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="base-slider"
|
|
4
|
+
:class="{ 'is-vertical': vertical, 'base-slider--with-input': showInput }"
|
|
5
|
+
role="slider"
|
|
6
|
+
:aria-valuemin="min"
|
|
7
|
+
:aria-valuemax="max"
|
|
8
|
+
:aria-orientation="vertical ? 'vertical': 'horizontal'"
|
|
9
|
+
:aria-disabled="sliderDisabled"
|
|
10
|
+
>
|
|
11
|
+
<base-input-number
|
|
12
|
+
v-model="firstValue"
|
|
13
|
+
v-if="showInput && !range"
|
|
14
|
+
class="base-slider__input"
|
|
15
|
+
ref="input"
|
|
16
|
+
@change="emitChange"
|
|
17
|
+
:step="step"
|
|
18
|
+
:disabled="sliderDisabled"
|
|
19
|
+
:controls="showInputControls"
|
|
20
|
+
:min="min"
|
|
21
|
+
:max="max"
|
|
22
|
+
:debounce="debounce"
|
|
23
|
+
:size="inputSize">
|
|
24
|
+
</base-input-number>
|
|
25
|
+
<div
|
|
26
|
+
class="base-slider__runway"
|
|
27
|
+
:class="{ 'show-input': showInput, 'disabled': sliderDisabled }"
|
|
28
|
+
:style="runwayStyle"
|
|
29
|
+
@click="onSliderClick"
|
|
30
|
+
ref="slider">
|
|
31
|
+
<div
|
|
32
|
+
class="base-slider__bar"
|
|
33
|
+
:style="barStyle">
|
|
34
|
+
</div>
|
|
35
|
+
<slider-button
|
|
36
|
+
:vertical="vertical"
|
|
37
|
+
v-model="firstValue"
|
|
38
|
+
:tooltip-class="tooltipClass"
|
|
39
|
+
ref="button1">
|
|
40
|
+
</slider-button>
|
|
41
|
+
<slider-button
|
|
42
|
+
:vertical="vertical"
|
|
43
|
+
v-model="secondValue"
|
|
44
|
+
:tooltip-class="tooltipClass"
|
|
45
|
+
ref="button2"
|
|
46
|
+
v-if="range">
|
|
47
|
+
</slider-button>
|
|
48
|
+
<div
|
|
49
|
+
class="base-slider__stop"
|
|
50
|
+
v-for="(item, key) in stops"
|
|
51
|
+
:key="key"
|
|
52
|
+
:style="getStopStyle(item)"
|
|
53
|
+
v-if="showStops">
|
|
54
|
+
</div>
|
|
55
|
+
<template v-if="markList.length > 0">
|
|
56
|
+
<div>
|
|
57
|
+
<div
|
|
58
|
+
v-for="(item, key) in markList"
|
|
59
|
+
:style="getStopStyle(item.position)"
|
|
60
|
+
class="base-slider__stop base-slider__marks-stop"
|
|
61
|
+
:key="key">
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="base-slider__marks">
|
|
65
|
+
<slider-marker
|
|
66
|
+
:mark="item.mark" v-for="(item, key) in markList"
|
|
67
|
+
:key="key"
|
|
68
|
+
:style="getStopStyle(item.position)">
|
|
69
|
+
</slider-marker>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script type="text/babel">
|
|
77
|
+
import BaseInputNumber from '../input-number/input-number';
|
|
78
|
+
import SliderButton from './button.vue';
|
|
79
|
+
import SliderMarker from './marker';
|
|
80
|
+
import Emitter from '../mixin/emitter';
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
name: 'BaseSlider',
|
|
84
|
+
|
|
85
|
+
mixins: [Emitter],
|
|
86
|
+
|
|
87
|
+
inject: {
|
|
88
|
+
baseForm: {
|
|
89
|
+
default: ''
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
props: {
|
|
94
|
+
min: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 0
|
|
97
|
+
},
|
|
98
|
+
max: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: 100
|
|
101
|
+
},
|
|
102
|
+
step: {
|
|
103
|
+
type: Number,
|
|
104
|
+
default: 1
|
|
105
|
+
},
|
|
106
|
+
value: {
|
|
107
|
+
type: [Number, Array],
|
|
108
|
+
default: 0
|
|
109
|
+
},
|
|
110
|
+
showInput: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false
|
|
113
|
+
},
|
|
114
|
+
showInputControls: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: true
|
|
117
|
+
},
|
|
118
|
+
inputSize: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: 'small'
|
|
121
|
+
},
|
|
122
|
+
showStops: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
showTooltip: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: true
|
|
129
|
+
},
|
|
130
|
+
formatTooltip: Function,
|
|
131
|
+
disabled: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false
|
|
134
|
+
},
|
|
135
|
+
range: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: false
|
|
138
|
+
},
|
|
139
|
+
vertical: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: false
|
|
142
|
+
},
|
|
143
|
+
height: {
|
|
144
|
+
type: String
|
|
145
|
+
},
|
|
146
|
+
debounce: {
|
|
147
|
+
type: Number,
|
|
148
|
+
default: 300
|
|
149
|
+
},
|
|
150
|
+
label: {
|
|
151
|
+
type: String
|
|
152
|
+
},
|
|
153
|
+
tooltipClass: String,
|
|
154
|
+
marks: Object
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
components: {
|
|
158
|
+
BaseInputNumber,
|
|
159
|
+
SliderButton,
|
|
160
|
+
SliderMarker
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
data() {
|
|
164
|
+
return {
|
|
165
|
+
firstValue: null,
|
|
166
|
+
secondValue: null,
|
|
167
|
+
oldValue: null,
|
|
168
|
+
dragging: false,
|
|
169
|
+
sliderSize: 1
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
watch: {
|
|
174
|
+
value(val, oldVal) {
|
|
175
|
+
if (this.dragging ||
|
|
176
|
+
Array.isArray(val) &&
|
|
177
|
+
Array.isArray(oldVal) &&
|
|
178
|
+
val.every((item, index) => item === oldVal[index])) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.setValues();
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
dragging(val) {
|
|
185
|
+
if (!val) {
|
|
186
|
+
this.setValues();
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
firstValue(val) {
|
|
191
|
+
if (this.range) {
|
|
192
|
+
this.$emit('input', [this.minValue, this.maxValue]);
|
|
193
|
+
} else {
|
|
194
|
+
this.$emit('input', val);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
secondValue() {
|
|
199
|
+
if (this.range) {
|
|
200
|
+
this.$emit('input', [this.minValue, this.maxValue]);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
min() {
|
|
205
|
+
this.setValues();
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
max() {
|
|
209
|
+
this.setValues();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
methods: {
|
|
214
|
+
valueChanged() {
|
|
215
|
+
if (this.range) {
|
|
216
|
+
return ![this.minValue, this.maxValue]
|
|
217
|
+
.every((item, index) => item === this.oldValue[index]);
|
|
218
|
+
} else {
|
|
219
|
+
return this.value !== this.oldValue;
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
setValues() {
|
|
223
|
+
if (this.min > this.max) {
|
|
224
|
+
console.error('[Element Error][Slider]min should not be greater than max.');
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const val = this.value;
|
|
228
|
+
if (this.range && Array.isArray(val)) {
|
|
229
|
+
if (val[1] < this.min) {
|
|
230
|
+
this.$emit('input', [this.min, this.min]);
|
|
231
|
+
} else if (val[0] > this.max) {
|
|
232
|
+
this.$emit('input', [this.max, this.max]);
|
|
233
|
+
} else if (val[0] < this.min) {
|
|
234
|
+
this.$emit('input', [this.min, val[1]]);
|
|
235
|
+
} else if (val[1] > this.max) {
|
|
236
|
+
this.$emit('input', [val[0], this.max]);
|
|
237
|
+
} else {
|
|
238
|
+
this.firstValue = val[0];
|
|
239
|
+
this.secondValue = val[1];
|
|
240
|
+
if (this.valueChanged()) {
|
|
241
|
+
this.dispatch('BaseFormItem', 'base.form.change', [this.minValue, this.maxValue]);
|
|
242
|
+
this.oldValue = val.slice();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} else if (!this.range && typeof val === 'number' && !isNaN(val)) {
|
|
246
|
+
if (val < this.min) {
|
|
247
|
+
this.$emit('input', this.min);
|
|
248
|
+
} else if (val > this.max) {
|
|
249
|
+
this.$emit('input', this.max);
|
|
250
|
+
} else {
|
|
251
|
+
this.firstValue = val;
|
|
252
|
+
if (this.valueChanged()) {
|
|
253
|
+
this.dispatch('BaseFormItem', 'base.form.change', val);
|
|
254
|
+
this.oldValue = val;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
setPosition(percent) {
|
|
261
|
+
const targetValue = this.min + percent * (this.max - this.min) / 100;
|
|
262
|
+
if (!this.range) {
|
|
263
|
+
this.$refs.button1.setPosition(percent);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let button;
|
|
267
|
+
if (Math.abs(this.minValue - targetValue) < Math.abs(this.maxValue - targetValue)) {
|
|
268
|
+
button = this.firstValue < this.secondValue ? 'button1' : 'button2';
|
|
269
|
+
} else {
|
|
270
|
+
button = this.firstValue > this.secondValue ? 'button1' : 'button2';
|
|
271
|
+
}
|
|
272
|
+
this.$refs[button].setPosition(percent);
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
onSliderClick(event) {
|
|
276
|
+
if (this.sliderDisabled || this.dragging) return;
|
|
277
|
+
this.resetSize();
|
|
278
|
+
if (this.vertical) {
|
|
279
|
+
const sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
|
|
280
|
+
this.setPosition((sliderOffsetBottom - event.clientY) / this.sliderSize * 100);
|
|
281
|
+
} else {
|
|
282
|
+
const sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
|
|
283
|
+
this.setPosition((event.clientX - sliderOffsetLeft) / this.sliderSize * 100);
|
|
284
|
+
}
|
|
285
|
+
this.emitChange();
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
resetSize() {
|
|
289
|
+
if (this.$refs.slider) {
|
|
290
|
+
this.sliderSize = this.$refs.slider[`client${ this.vertical ? 'Height' : 'Width' }`];
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
emitChange() {
|
|
295
|
+
this.$nextTick(() => {
|
|
296
|
+
this.$emit('change', this.range ? [this.minValue, this.maxValue] : this.value);
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
getStopStyle(position) {
|
|
301
|
+
return this.vertical ? { 'bottom': position + '%' } : { 'left': position + '%' };
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
computed: {
|
|
306
|
+
stops() {
|
|
307
|
+
if (!this.showStops || this.min > this.max) return [];
|
|
308
|
+
if (this.step === 0) {
|
|
309
|
+
process.env.NODE_ENV !== 'production' &&
|
|
310
|
+
console.warn('[Element Warn][Slider]step should not be 0.');
|
|
311
|
+
return [];
|
|
312
|
+
}
|
|
313
|
+
const stopCount = (this.max - this.min) / this.step;
|
|
314
|
+
const stepWidth = 100 * this.step / (this.max - this.min);
|
|
315
|
+
const result = [];
|
|
316
|
+
for (let i = 1; i < stopCount; i++) {
|
|
317
|
+
result.push(i * stepWidth);
|
|
318
|
+
}
|
|
319
|
+
if (this.range) {
|
|
320
|
+
return result.filter(step => {
|
|
321
|
+
return step < 100 * (this.minValue - this.min) / (this.max - this.min) ||
|
|
322
|
+
step > 100 * (this.maxValue - this.min) / (this.max - this.min);
|
|
323
|
+
});
|
|
324
|
+
} else {
|
|
325
|
+
return result.filter(step => step > 100 * (this.firstValue - this.min) / (this.max - this.min));
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
markList() {
|
|
330
|
+
if (!this.marks) {
|
|
331
|
+
return [];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const marksKeys = Object.keys(this.marks);
|
|
335
|
+
return marksKeys.map(parseFloat)
|
|
336
|
+
.sort((a, b) => a - b)
|
|
337
|
+
.filter(point => point <= this.max && point >= this.min)
|
|
338
|
+
.map(point => ({
|
|
339
|
+
point,
|
|
340
|
+
position: (point - this.min) * 100 / (this.max - this.min),
|
|
341
|
+
mark: this.marks[point]
|
|
342
|
+
}));
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
minValue() {
|
|
346
|
+
return Math.min(this.firstValue, this.secondValue);
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
maxValue() {
|
|
350
|
+
return Math.max(this.firstValue, this.secondValue);
|
|
351
|
+
},
|
|
352
|
+
|
|
353
|
+
barSize() {
|
|
354
|
+
return this.range
|
|
355
|
+
? `${ 100 * (this.maxValue - this.minValue) / (this.max - this.min) }%`
|
|
356
|
+
: `${ 100 * (this.firstValue - this.min) / (this.max - this.min) }%`;
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
barStart() {
|
|
360
|
+
return this.range
|
|
361
|
+
? `${ 100 * (this.minValue - this.min) / (this.max - this.min) }%`
|
|
362
|
+
: '0%';
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
precision() {
|
|
366
|
+
let precisions = [this.min, this.max, this.step].map(item => {
|
|
367
|
+
let decimal = ('' + item).split('.')[1];
|
|
368
|
+
return decimal ? decimal.length : 0;
|
|
369
|
+
});
|
|
370
|
+
return Math.max.apply(null, precisions);
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
runwayStyle() {
|
|
374
|
+
return this.vertical ? { height: this.height } : {};
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
barStyle() {
|
|
378
|
+
return this.vertical
|
|
379
|
+
? {
|
|
380
|
+
height: this.barSize,
|
|
381
|
+
bottom: this.barStart
|
|
382
|
+
} : {
|
|
383
|
+
width: this.barSize,
|
|
384
|
+
left: this.barStart
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
sliderDisabled() {
|
|
389
|
+
return this.disabled || (this.baseForm || {}).disabled;
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
mounted() {
|
|
394
|
+
let valuetext;
|
|
395
|
+
if (this.range) {
|
|
396
|
+
if (Array.isArray(this.value)) {
|
|
397
|
+
this.firstValue = Math.max(this.min, this.value[0]);
|
|
398
|
+
this.secondValue = Math.min(this.max, this.value[1]);
|
|
399
|
+
} else {
|
|
400
|
+
this.firstValue = this.min;
|
|
401
|
+
this.secondValue = this.max;
|
|
402
|
+
}
|
|
403
|
+
this.oldValue = [this.firstValue, this.secondValue];
|
|
404
|
+
valuetext = `${this.firstValue}-${this.secondValue}`;
|
|
405
|
+
} else {
|
|
406
|
+
if (typeof this.value !== 'number' || isNaN(this.value)) {
|
|
407
|
+
this.firstValue = this.min;
|
|
408
|
+
} else {
|
|
409
|
+
this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
|
|
410
|
+
}
|
|
411
|
+
this.oldValue = this.firstValue;
|
|
412
|
+
valuetext = this.firstValue;
|
|
413
|
+
}
|
|
414
|
+
this.$el.setAttribute('aria-valuetext', valuetext);
|
|
415
|
+
|
|
416
|
+
// label screen reader
|
|
417
|
+
this.$el.setAttribute('aria-label', this.label ? this.label : `slider between ${this.min} and ${this.max}`);
|
|
418
|
+
|
|
419
|
+
this.resetSize();
|
|
420
|
+
window.addEventListener('resize', this.resetSize);
|
|
421
|
+
},
|
|
422
|
+
|
|
423
|
+
beforeDestroy() {
|
|
424
|
+
window.removeEventListener('resize', this.resetSize);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'BaseMarker',
|
|
3
|
+
|
|
4
|
+
props: {
|
|
5
|
+
mark: {
|
|
6
|
+
type: [String, Object]
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
render() {
|
|
10
|
+
let label = typeof this.mark === 'string' ? this.mark : this.mark.label;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div class="base-slider__marks-text" style={ this.mark.style || {} }>
|
|
14
|
+
{ label }
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
@import "mixins";
|
|
2
|
+
@import "var";
|
|
3
|
+
|
|
4
|
+
@include b(alert) {
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: $--alert-padding;
|
|
7
|
+
margin: 0;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
border-radius: $--alert-border-radius;
|
|
10
|
+
position: relative;
|
|
11
|
+
background-color: $--color-white;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
opacity: 1;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
transition: opacity .2s;
|
|
17
|
+
|
|
18
|
+
@include when(light) {
|
|
19
|
+
.base-alert__closebtn {
|
|
20
|
+
color: $--color-text-placeholder;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include when(dark) {
|
|
25
|
+
.base-alert__closebtn {
|
|
26
|
+
color: $--color-white;
|
|
27
|
+
}
|
|
28
|
+
.base-alert__description {
|
|
29
|
+
color: $--color-white;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@include when(center) {
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@include m(success) {
|
|
38
|
+
&.is-light {
|
|
39
|
+
background-color: $--alert-success-color;
|
|
40
|
+
color: $--color-success;
|
|
41
|
+
|
|
42
|
+
.base-alert__description {
|
|
43
|
+
color: $--color-success;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.is-dark {
|
|
48
|
+
background-color: $--color-success;
|
|
49
|
+
color: $--color-white;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include m(info) {
|
|
54
|
+
&.is-light {
|
|
55
|
+
background-color: $--alert-info-color;
|
|
56
|
+
color: $--color-info;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.is-dark {
|
|
60
|
+
background-color: $--color-info;
|
|
61
|
+
color: $--color-white;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.base-alert__description {
|
|
65
|
+
color: $--color-info;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include m(warning) {
|
|
70
|
+
&.is-light {
|
|
71
|
+
background-color: $--alert-warning-color;
|
|
72
|
+
color: $--color-warning;
|
|
73
|
+
|
|
74
|
+
.base-alert__description {
|
|
75
|
+
color: $--color-warning;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.is-dark {
|
|
80
|
+
background-color: $--color-warning;
|
|
81
|
+
color: $--color-white;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@include m(error) {
|
|
86
|
+
&.is-light {
|
|
87
|
+
background-color: $--alert-danger-color;
|
|
88
|
+
color: $--color-danger;
|
|
89
|
+
|
|
90
|
+
.base-alert__description {
|
|
91
|
+
color: $--color-danger;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.is-dark {
|
|
96
|
+
background-color: $--color-danger;
|
|
97
|
+
color: $--color-white;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@include e(content) {
|
|
102
|
+
display: table-cell;
|
|
103
|
+
padding: 0 8px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include e(icon) {
|
|
107
|
+
font-size: $--alert-icon-size;
|
|
108
|
+
width: $--alert-icon-size;
|
|
109
|
+
@include when(big) {
|
|
110
|
+
font-size: $--alert-icon-large-size;
|
|
111
|
+
width: $--alert-icon-large-size;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@include e(title) {
|
|
116
|
+
font-size: $--alert-title-font-size;
|
|
117
|
+
line-height: 18px;
|
|
118
|
+
@include when(bold) {
|
|
119
|
+
font-weight: bold;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
& .base-alert__description {
|
|
124
|
+
font-size: $--alert-description-font-size;
|
|
125
|
+
margin: 5px 0 0 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@include e(closebtn) {
|
|
129
|
+
font-size: $--alert-close-font-size;
|
|
130
|
+
opacity: 1;
|
|
131
|
+
position: absolute;
|
|
132
|
+
top: 12px;
|
|
133
|
+
right: 15px;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
|
|
136
|
+
@include when(customed) {
|
|
137
|
+
font-style: normal;
|
|
138
|
+
font-size: $--alert-close-customed-font-size;
|
|
139
|
+
top: 9px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.base-alert-fade-enter,
|
|
145
|
+
.base-alert-fade-leave-active {
|
|
146
|
+
opacity: 0;
|
|
147
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@keyframes linear-double {
|
|
2
|
+
0% {
|
|
3
|
+
-webkit-transform: translateX(-56%);
|
|
4
|
+
transform: translateX(-56%)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
to {
|
|
8
|
+
-webkit-transform: translateX(56%);
|
|
9
|
+
transform: translateX(56%)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
@keyframes Bounce {
|
|
13
|
+
0%,to {
|
|
14
|
+
-webkit-transform: translateY(-100%);
|
|
15
|
+
transform: translateY(-100%)
|
|
16
|
+
}
|
|
17
|
+
50% {
|
|
18
|
+
-webkit-transform: translateY(100%);
|
|
19
|
+
transform: translateY(100%)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@keyframes BounceUp {
|
|
23
|
+
25% {
|
|
24
|
+
transform: translateY(-3px)
|
|
25
|
+
}
|
|
26
|
+
50% {
|
|
27
|
+
transform: translateY(0)
|
|
28
|
+
}
|
|
29
|
+
75% {
|
|
30
|
+
transform: translateY(3px)
|
|
31
|
+
}
|
|
32
|
+
100% {
|
|
33
|
+
transform: translateY(0)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.fade-enter-active, .fade-leave-active {
|
|
37
|
+
transition: opacity .5s;
|
|
38
|
+
}
|
|
39
|
+
.fade-enter, .fade-leave-to {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
}
|
|
42
|
+
.fade-fast-enter-active, .fade-fast-leave-active {
|
|
43
|
+
transition: opacity .2s linear;
|
|
44
|
+
}
|
|
45
|
+
.fade-fast-enter, .fade-fast-leave-to {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes fadeInOut {
|
|
50
|
+
0%{opacity:0}
|
|
51
|
+
25%{opacity:.25}
|
|
52
|
+
to{opacity:1}
|
|
53
|
+
}
|
|
54
|
+
.fade-enter-active, .fade-leave-active {
|
|
55
|
+
transition: opacity .5s;
|
|
56
|
+
}
|
|
57
|
+
.fade-enter, .fade-leave-to {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
}
|
|
60
|
+
.fade-fast-enter-active, .fade-fast-leave-active {
|
|
61
|
+
transition: opacity .2s linear;
|
|
62
|
+
}
|
|
63
|
+
.fade-fast-enter, .fade-fast-leave-to {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
}
|