@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.
Files changed (231) hide show
  1. package/dist/index.css +1 -0
  2. package/dist/index.js +21861 -0
  3. package/dist/index.umd.cjs +46 -0
  4. package/package.json +27 -0
  5. package/src/components/base/ui/alert/Alert.vue +94 -0
  6. package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +77 -0
  7. package/src/components/base/ui/autocomplete/autocomplete.vue +305 -0
  8. package/src/components/base/ui/backtop/main.vue +112 -0
  9. package/src/components/base/ui/button/Button.vue +84 -0
  10. package/src/components/base/ui/button/ButtonGroup.vue +10 -0
  11. package/src/components/base/ui/carousel/Carousel.vue +304 -0
  12. package/src/components/base/ui/carousel/CarouselItem.vue +137 -0
  13. package/src/components/base/ui/cascader/cascader.vue +650 -0
  14. package/src/components/base/ui/cascader-panel/cascader-menu.vue +138 -0
  15. package/src/components/base/ui/cascader-panel/cascader-node.vue +246 -0
  16. package/src/components/base/ui/cascader-panel/cascader-panel.vue +382 -0
  17. package/src/components/base/ui/cascader-panel/node.js +166 -0
  18. package/src/components/base/ui/cascader-panel/store.js +62 -0
  19. package/src/components/base/ui/checkbox/checkbox-button.vue +199 -0
  20. package/src/components/base/ui/checkbox/checkbox-group.vue +48 -0
  21. package/src/components/base/ui/checkbox/checkbox.vue +222 -0
  22. package/src/components/base/ui/col/col.js +71 -0
  23. package/src/components/base/ui/collapse/collapse-item.vue +180 -0
  24. package/src/components/base/ui/collapse/collapse.vue +73 -0
  25. package/src/components/base/ui/color-picker/color.js +317 -0
  26. package/src/components/base/ui/color-picker/components/alpha-slider.vue +132 -0
  27. package/src/components/base/ui/color-picker/components/hue-slider.vue +123 -0
  28. package/src/components/base/ui/color-picker/components/picker-dropdown.vue +119 -0
  29. package/src/components/base/ui/color-picker/components/predefine.vue +61 -0
  30. package/src/components/base/ui/color-picker/components/sv-panel.vue +100 -0
  31. package/src/components/base/ui/color-picker/draggable.js +36 -0
  32. package/src/components/base/ui/color-picker/index.js +2 -0
  33. package/src/components/base/ui/color-picker/main.vue +188 -0
  34. package/src/components/base/ui/date-picker/basic/date-table.vue +441 -0
  35. package/src/components/base/ui/date-picker/basic/month-table.vue +254 -0
  36. package/src/components/base/ui/date-picker/basic/time-spinner.vue +304 -0
  37. package/src/components/base/ui/date-picker/basic/year-table.vue +101 -0
  38. package/src/components/base/ui/date-picker/panel/date-range.vue +680 -0
  39. package/src/components/base/ui/date-picker/panel/date.vue +597 -0
  40. package/src/components/base/ui/date-picker/panel/month-range.vue +289 -0
  41. package/src/components/base/ui/date-picker/panel/time-range.vue +248 -0
  42. package/src/components/base/ui/date-picker/panel/time-select.vue +178 -0
  43. package/src/components/base/ui/date-picker/panel/time.vue +186 -0
  44. package/src/components/base/ui/date-picker/picker/date-picker.js +43 -0
  45. package/src/components/base/ui/date-picker/picker/time-picker.js +39 -0
  46. package/src/components/base/ui/date-picker/picker/time-select.js +21 -0
  47. package/src/components/base/ui/date-picker/picker.vue +942 -0
  48. package/src/components/base/ui/dialog/Index.vue +212 -0
  49. package/src/components/base/ui/directive/repeat-click.js +24 -0
  50. package/src/components/base/ui/directive/ripple.js +303 -0
  51. package/src/components/base/ui/divider/Divider.vue +37 -0
  52. package/src/components/base/ui/drawer/Drawer.vue +202 -0
  53. package/src/components/base/ui/dropdown/dropdown-item.vue +39 -0
  54. package/src/components/base/ui/dropdown/dropdown-menu.vue +63 -0
  55. package/src/components/base/ui/dropdown/dropdown.vue +308 -0
  56. package/src/components/base/ui/form/Form.vue +167 -0
  57. package/src/components/base/ui/form/FormItem.vue +334 -0
  58. package/src/components/base/ui/form/LabelWrap.vue +69 -0
  59. package/src/components/base/ui/icon/icon.vue +13 -0
  60. package/src/components/base/ui/image/image-viewer.vue +302 -0
  61. package/src/components/base/ui/image/main.vue +248 -0
  62. package/src/components/base/ui/index.js +189 -0
  63. package/src/components/base/ui/input/Input.vue +438 -0
  64. package/src/components/base/ui/input/calcTextareaHeight.js +104 -0
  65. package/src/components/base/ui/input-number/input-number.vue +285 -0
  66. package/src/components/base/ui/locale/format.js +32 -0
  67. package/src/components/base/ui/locale/index.js +48 -0
  68. package/src/components/base/ui/locale/lang/zh-CN.js +120 -0
  69. package/src/components/base/ui/menu/menu-item-group.vue +45 -0
  70. package/src/components/base/ui/menu/menu-item.vue +112 -0
  71. package/src/components/base/ui/menu/menu-mixin.js +44 -0
  72. package/src/components/base/ui/menu/menu.vue +312 -0
  73. package/src/components/base/ui/menu/submenu.vue +408 -0
  74. package/src/components/base/ui/message/index.js +2 -0
  75. package/src/components/base/ui/message/main.js +87 -0
  76. package/src/components/base/ui/message/main.vue +110 -0
  77. package/src/components/base/ui/message-box/main.js +216 -0
  78. package/src/components/base/ui/message-box/main.vue +323 -0
  79. package/src/components/base/ui/mixin/emitter.js +31 -0
  80. package/src/components/base/ui/mixin/focus.js +9 -0
  81. package/src/components/base/ui/mixin/locale.js +9 -0
  82. package/src/components/base/ui/mixin/migrating.js +33 -0
  83. package/src/components/base/ui/pagination/pager.vue +163 -0
  84. package/src/components/base/ui/pagination/pagination.jsx +391 -0
  85. package/src/components/base/ui/popover/directive.js +20 -0
  86. package/src/components/base/ui/popover/index.js +14 -0
  87. package/src/components/base/ui/popover/main.vue +236 -0
  88. package/src/components/base/ui/progress/Progress.vue +227 -0
  89. package/src/components/base/ui/radio/radio-button.vue +114 -0
  90. package/src/components/base/ui/radio/radio-group.vue +111 -0
  91. package/src/components/base/ui/radio/radio.vue +134 -0
  92. package/src/components/base/ui/row/row.js +47 -0
  93. package/src/components/base/ui/scrollbar/bar.jsx +91 -0
  94. package/src/components/base/ui/scrollbar/index.jsx +203 -0
  95. package/src/components/base/ui/scrollbar/util.js +32 -0
  96. package/src/components/base/ui/select/Option.vue +168 -0
  97. package/src/components/base/ui/select/OptionGroup.vue +60 -0
  98. package/src/components/base/ui/select/Select.vue +920 -0
  99. package/src/components/base/ui/select/SelectDropdown.vue +74 -0
  100. package/src/components/base/ui/select/navigation-mixin.js +54 -0
  101. package/src/components/base/ui/skeleton/index.js +8 -0
  102. package/src/components/base/ui/skeleton/src/img-placeholder.vue +16 -0
  103. package/src/components/base/ui/skeleton/src/index.vue +80 -0
  104. package/src/components/base/ui/skeleton/src/item.vue +22 -0
  105. package/src/components/base/ui/skeleton-item/index.js +8 -0
  106. package/src/components/base/ui/slider/button.vue +238 -0
  107. package/src/components/base/ui/slider/main.vue +427 -0
  108. package/src/components/base/ui/slider/marker.js +18 -0
  109. package/src/components/base/ui/style/alert.scss +147 -0
  110. package/src/components/base/ui/style/animations.scss +65 -0
  111. package/src/components/base/ui/style/autocomplete.scss +81 -0
  112. package/src/components/base/ui/style/backtop.scss +20 -0
  113. package/src/components/base/ui/style/button-group.scss +0 -0
  114. package/src/components/base/ui/style/button.scss +380 -0
  115. package/src/components/base/ui/style/carousel-item.scss +50 -0
  116. package/src/components/base/ui/style/carousel.scss +161 -0
  117. package/src/components/base/ui/style/cascader-panel.scss +120 -0
  118. package/src/components/base/ui/style/cascader.scss +185 -0
  119. package/src/components/base/ui/style/checkbox-button.scss +0 -0
  120. package/src/components/base/ui/style/checkbox-group.scss +0 -0
  121. package/src/components/base/ui/style/checkbox.scss +360 -0
  122. package/src/components/base/ui/style/col.scss +156 -0
  123. package/src/components/base/ui/style/collapse-item.scss +0 -0
  124. package/src/components/base/ui/style/collapse.scss +114 -0
  125. package/src/components/base/ui/style/color-picker.scss +387 -0
  126. package/src/components/base/ui/style/config.scss +4 -0
  127. package/src/components/base/ui/style/date-picker/date-picker.scss +97 -0
  128. package/src/components/base/ui/style/date-picker/date-range-picker.scss +101 -0
  129. package/src/components/base/ui/style/date-picker/date-table.scss +151 -0
  130. package/src/components/base/ui/style/date-picker/month-table.scss +82 -0
  131. package/src/components/base/ui/style/date-picker/picker-panel.scss +117 -0
  132. package/src/components/base/ui/style/date-picker/picker.scss +197 -0
  133. package/src/components/base/ui/style/date-picker/time-picker.scss +85 -0
  134. package/src/components/base/ui/style/date-picker/time-range-picker.scss +31 -0
  135. package/src/components/base/ui/style/date-picker/time-spinner.scss +110 -0
  136. package/src/components/base/ui/style/date-picker/year-table.scss +51 -0
  137. package/src/components/base/ui/style/date-picker.scss +12 -0
  138. package/src/components/base/ui/style/dialog.scss +123 -0
  139. package/src/components/base/ui/style/divider.scss +47 -0
  140. package/src/components/base/ui/style/drawer.scss +218 -0
  141. package/src/components/base/ui/style/dropdown-item.scss +0 -0
  142. package/src/components/base/ui/style/dropdown-menu.scss +0 -0
  143. package/src/components/base/ui/style/dropdown.scss +185 -0
  144. package/src/components/base/ui/style/form-item.scss +0 -0
  145. package/src/components/base/ui/style/form.scss +203 -0
  146. package/src/components/base/ui/style/function.scss +43 -0
  147. package/src/components/base/ui/style/icon.scss +1167 -0
  148. package/src/components/base/ui/style/image.scss +184 -0
  149. package/src/components/base/ui/style/index.scss +57 -0
  150. package/src/components/base/ui/style/input-number.scss +187 -0
  151. package/src/components/base/ui/style/input.scss +477 -0
  152. package/src/components/base/ui/style/menu-item-group.scss +0 -0
  153. package/src/components/base/ui/style/menu-item.scss +0 -0
  154. package/src/components/base/ui/style/menu.scss +294 -0
  155. package/src/components/base/ui/style/message-box.scss +231 -0
  156. package/src/components/base/ui/style/message.scss +120 -0
  157. package/src/components/base/ui/style/mixins.scss +196 -0
  158. package/src/components/base/ui/style/option-group.scss +42 -0
  159. package/src/components/base/ui/style/option.scss +36 -0
  160. package/src/components/base/ui/style/pagination.scss +295 -0
  161. package/src/components/base/ui/style/popover.scss +40 -0
  162. package/src/components/base/ui/style/popper.scss +102 -0
  163. package/src/components/base/ui/style/popup.scss +42 -0
  164. package/src/components/base/ui/style/progress.scss +141 -0
  165. package/src/components/base/ui/style/radio-button.scss +113 -0
  166. package/src/components/base/ui/style/radio-group.scss +9 -0
  167. package/src/components/base/ui/style/radio.scss +203 -0
  168. package/src/components/base/ui/style/ripple.scss +35 -0
  169. package/src/components/base/ui/style/row.scss +39 -0
  170. package/src/components/base/ui/style/scrollbar.scss +75 -0
  171. package/src/components/base/ui/style/select-dropdown.scss +59 -0
  172. package/src/components/base/ui/style/select.scss +154 -0
  173. package/src/components/base/ui/style/skeleton-item.scss +84 -0
  174. package/src/components/base/ui/style/skeleton.scss +40 -0
  175. package/src/components/base/ui/style/slider.scss +250 -0
  176. package/src/components/base/ui/style/switch.scss +116 -0
  177. package/src/components/base/ui/style/tabs.scss +602 -0
  178. package/src/components/base/ui/style/tag.scss +174 -0
  179. package/src/components/base/ui/style/tooltip.scss +146 -0
  180. package/src/components/base/ui/style/transition.scss +138 -0
  181. package/src/components/base/ui/style/upload.scss +603 -0
  182. package/src/components/base/ui/style/utils.scss +39 -0
  183. package/src/components/base/ui/style/var.scss +1007 -0
  184. package/src/components/base/ui/switch/index.vue +174 -0
  185. package/src/components/base/ui/tabs/tab-bar.vue +57 -0
  186. package/src/components/base/ui/tabs/tab-nav.vue +294 -0
  187. package/src/components/base/ui/tabs/tab-pane.vue +56 -0
  188. package/src/components/base/ui/tabs/tabs.vue +191 -0
  189. package/src/components/base/ui/tag/Tag.vue +60 -0
  190. package/src/components/base/ui/tooltip/tooltip.jsx +234 -0
  191. package/src/components/base/ui/upload/Index.vue +340 -0
  192. package/src/components/base/ui/upload/Upload.vue +216 -0
  193. package/src/components/base/ui/upload/UploadDragger.vue +70 -0
  194. package/src/components/base/ui/upload/UploadList.vue +100 -0
  195. package/src/components/base/ui/upload/ajax.js +85 -0
  196. package/src/components/base/ui/util/aria-dialog.js +90 -0
  197. package/src/components/base/ui/util/aria-utils.js +122 -0
  198. package/src/components/base/ui/util/clickoutside.js +76 -0
  199. package/src/components/base/ui/util/date-util.js +292 -0
  200. package/src/components/base/ui/util/date.js +370 -0
  201. package/src/components/base/ui/util/debounce.js +21 -0
  202. package/src/components/base/ui/util/deepmerge.js +100 -0
  203. package/src/components/base/ui/util/dom.js +215 -0
  204. package/src/components/base/ui/util/index.js +262 -0
  205. package/src/components/base/ui/util/menu/aria-menubar.js +14 -0
  206. package/src/components/base/ui/util/menu/aria-menuitem.js +49 -0
  207. package/src/components/base/ui/util/menu/aria-submenu.js +59 -0
  208. package/src/components/base/ui/util/merge.js +14 -0
  209. package/src/components/base/ui/util/popper.js +1235 -0
  210. package/src/components/base/ui/util/popup/index.js +218 -0
  211. package/src/components/base/ui/util/popup/popup-manager.js +194 -0
  212. package/src/components/base/ui/util/resize-events.js +32 -0
  213. package/src/components/base/ui/util/scroll-into-view.js +27 -0
  214. package/src/components/base/ui/util/scrollbar-width.js +29 -0
  215. package/src/components/base/ui/util/shared.js +7 -0
  216. package/src/components/base/ui/util/throttle.js +91 -0
  217. package/src/components/base/ui/util/types.js +24 -0
  218. package/src/components/base/ui/util/vdom.js +5 -0
  219. package/src/components/base/ui/util/vue-popper.js +188 -0
  220. package/src/components/normal/AggsItemH.vue +139 -0
  221. package/src/index.js +10 -0
  222. package/src/static/base-icons.ttf +0 -0
  223. package/src/static/base-icons.woff +0 -0
  224. package/src/static/label_bg.png +0 -0
  225. package/src/static/term-label-bg.png +0 -0
  226. package/src/style/app-article.scss +698 -0
  227. package/src/style/app-comment.scss +259 -0
  228. package/src/style/app-recommend.scss +48 -0
  229. package/src/style/app-richtext.scss +176 -0
  230. package/src/style/index.scss +523 -0
  231. 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
+ }