1 | import { __decorate } from "tslib";
|
2 | import { Component, Model, Prop, Watch, Vue } from 'vue-property-decorator';
|
3 | import VueSliderDot from './vue-slider-dot';
|
4 | import VueSliderMark from './vue-slider-mark';
|
5 | import { getSize, getPos, getKeyboardHandleFunc } from './utils';
|
6 | import Decimal from './utils/decimal';
|
7 | import Control from './utils/control';
|
8 | import State from './utils/state';
|
9 | import './styles/slider.scss';
|
10 | export const SliderState = {
|
11 | None: 0,
|
12 | Drag: 1 << 1,
|
13 | Focus: 1 << 2,
|
14 | };
|
15 | const DEFAULT_SLIDER_SIZE = 4;
|
16 | let VueSlider = (() => {
|
17 | let VueSlider = class VueSlider extends Vue {
|
18 | constructor() {
|
19 | super(...arguments);
|
20 | this.states = new State(SliderState);
|
21 |
|
22 | this.scale = 1;
|
23 |
|
24 | this.focusDotIndex = 0;
|
25 | }
|
26 | get tailSize() {
|
27 | return getSize((this.isHorizontal ? this.height : this.width) || DEFAULT_SLIDER_SIZE);
|
28 | }
|
29 | get containerClasses() {
|
30 | return [
|
31 | 'vue-slider',
|
32 | [`vue-slider-${this.direction}`],
|
33 | {
|
34 | 'vue-slider-disabled': this.disabled,
|
35 | },
|
36 | ];
|
37 | }
|
38 | get containerStyles() {
|
39 | const [dotWidth, dotHeight] = Array.isArray(this.dotSize)
|
40 | ? this.dotSize
|
41 | : [this.dotSize, this.dotSize];
|
42 | const containerWidth = this.width
|
43 | ? getSize(this.width)
|
44 | : this.isHorizontal
|
45 | ? 'auto'
|
46 | : getSize(DEFAULT_SLIDER_SIZE);
|
47 | const containerHeight = this.height
|
48 | ? getSize(this.height)
|
49 | : this.isHorizontal
|
50 | ? getSize(DEFAULT_SLIDER_SIZE)
|
51 | : 'auto';
|
52 | return {
|
53 | padding: this.contained
|
54 | ? `${dotHeight / 2}px ${dotWidth / 2}px`
|
55 | : this.isHorizontal
|
56 | ? `${dotHeight / 2}px 0`
|
57 | : `0 ${dotWidth / 2}px`,
|
58 | width: containerWidth,
|
59 | height: containerHeight,
|
60 | };
|
61 | }
|
62 | get processArray() {
|
63 | return this.control.processArray.map(([start, end, style], index) => {
|
64 | if (start > end) {
|
65 |
|
66 | ;
|
67 | [start, end] = [end, start];
|
68 | }
|
69 | const sizeStyleKey = this.isHorizontal ? 'width' : 'height';
|
70 | return {
|
71 | start,
|
72 | end,
|
73 | index,
|
74 | style: {
|
75 | [this.isHorizontal ? 'height' : 'width']: '100%',
|
76 | [this.isHorizontal ? 'top' : 'left']: 0,
|
77 | [this.mainDirection]: `${start}%`,
|
78 | [sizeStyleKey]: `${end - start}%`,
|
79 | transitionProperty: `${sizeStyleKey},${this.mainDirection}`,
|
80 | transitionDuration: `${this.animateTime}s`,
|
81 | ...this.processStyle,
|
82 | ...style,
|
83 | },
|
84 | };
|
85 | });
|
86 | }
|
87 | get dotBaseStyle() {
|
88 | const [dotWidth, dotHeight] = Array.isArray(this.dotSize)
|
89 | ? this.dotSize
|
90 | : [this.dotSize, this.dotSize];
|
91 | let dotPos;
|
92 | if (this.isHorizontal) {
|
93 | dotPos = {
|
94 | transform: `translate(${this.isReverse ? '50%' : '-50%'}, -50%)`,
|
95 | '-WebkitTransform': `translate(${this.isReverse ? '50%' : '-50%'}, -50%)`,
|
96 | top: '50%',
|
97 | [this.direction === 'ltr' ? 'left' : 'right']: '0',
|
98 | };
|
99 | }
|
100 | else {
|
101 | dotPos = {
|
102 | transform: `translate(-50%, ${this.isReverse ? '50%' : '-50%'})`,
|
103 | '-WebkitTransform': `translate(-50%, ${this.isReverse ? '50%' : '-50%'})`,
|
104 | left: '50%',
|
105 | [this.direction === 'btt' ? 'bottom' : 'top']: '0',
|
106 | };
|
107 | }
|
108 | return {
|
109 | width: `${dotWidth}px`,
|
110 | height: `${dotHeight}px`,
|
111 | ...dotPos,
|
112 | };
|
113 | }
|
114 | get mainDirection() {
|
115 | switch (this.direction) {
|
116 | case 'ltr':
|
117 | return 'left';
|
118 | case 'rtl':
|
119 | return 'right';
|
120 | case 'btt':
|
121 | return 'bottom';
|
122 | case 'ttb':
|
123 | return 'top';
|
124 | }
|
125 | }
|
126 | get isHorizontal() {
|
127 | return this.direction === 'ltr' || this.direction === 'rtl';
|
128 | }
|
129 | get isReverse() {
|
130 | return this.direction === 'rtl' || this.direction === 'btt';
|
131 | }
|
132 | get tooltipDirections() {
|
133 | const dir = this.tooltipPlacement || (this.isHorizontal ? 'top' : 'left');
|
134 | if (Array.isArray(dir)) {
|
135 | return dir;
|
136 | }
|
137 | else {
|
138 | return this.dots.map(() => dir);
|
139 | }
|
140 | }
|
141 | get dots() {
|
142 | return this.control.dotsPos.map((pos, index) => ({
|
143 | pos,
|
144 | index,
|
145 | value: this.control.dotsValue[index],
|
146 | focus: this.states.has(SliderState.Focus) && this.focusDotIndex === index,
|
147 | disabled: this.disabled,
|
148 | style: this.dotStyle,
|
149 | ...((Array.isArray(this.dotOptions) ? this.dotOptions[index] : this.dotOptions) || {}),
|
150 | }));
|
151 | }
|
152 | get animateTime() {
|
153 | if (this.states.has(SliderState.Drag)) {
|
154 | return 0;
|
155 | }
|
156 | return this.duration;
|
157 | }
|
158 | get canSort() {
|
159 | return this.order && !this.minRange && !this.maxRange && !this.fixed && this.enableCross;
|
160 | }
|
161 | isObjectData(data) {
|
162 | return !!data && Object.prototype.toString.call(data) === '[object Object]';
|
163 | }
|
164 | isObjectArrayData(data) {
|
165 | return !!data && Array.isArray(data) && data.length > 0 && typeof data[0] === 'object';
|
166 | }
|
167 | get sliderData() {
|
168 | if (this.isObjectArrayData(this.data)) {
|
169 | return this.data.map(obj => obj[this.dataValue]);
|
170 | }
|
171 | else if (this.isObjectData(this.data)) {
|
172 | return Object.keys(this.data);
|
173 | }
|
174 | else {
|
175 | return this.data;
|
176 | }
|
177 | }
|
178 | get sliderMarks() {
|
179 | if (this.marks) {
|
180 | return this.marks;
|
181 | }
|
182 | else if (this.isObjectArrayData(this.data)) {
|
183 | return val => {
|
184 | const mark = { label: val };
|
185 | this.data.some(obj => {
|
186 | if (obj[this.dataValue] === val) {
|
187 | mark.label = obj[this.dataLabel];
|
188 | return true;
|
189 | }
|
190 | return false;
|
191 | });
|
192 | return mark;
|
193 | };
|
194 | }
|
195 | else if (this.isObjectData(this.data)) {
|
196 | return this.data;
|
197 | }
|
198 | }
|
199 | get sliderTooltipFormatter() {
|
200 | if (this.tooltipFormatter) {
|
201 | return this.tooltipFormatter;
|
202 | }
|
203 | else if (this.isObjectArrayData(this.data)) {
|
204 | return val => {
|
205 | let tooltipText = '' + val;
|
206 | this.data.some(obj => {
|
207 | if (obj[this.dataValue] === val) {
|
208 | tooltipText = obj[this.dataLabel];
|
209 | return true;
|
210 | }
|
211 | return false;
|
212 | });
|
213 | return tooltipText;
|
214 | };
|
215 | }
|
216 | else if (this.isObjectData(this.data)) {
|
217 | const data = this.data;
|
218 | return val => data[val];
|
219 | }
|
220 | }
|
221 | onValueChanged() {
|
222 | if (this.control && !this.states.has(SliderState.Drag) && this.isNotSync) {
|
223 | this.control.setValue(this.value);
|
224 | this.syncValueByPos();
|
225 | }
|
226 | }
|
227 | created() {
|
228 | this.initControl();
|
229 | }
|
230 | mounted() {
|
231 | this.bindEvent();
|
232 | }
|
233 | beforeDestroy() {
|
234 | this.unbindEvent();
|
235 | }
|
236 | bindEvent() {
|
237 | document.addEventListener('touchmove', this.dragMove, { passive: false });
|
238 | document.addEventListener('touchend', this.dragEnd, { passive: false });
|
239 | document.addEventListener('mousedown', this.blurHandle);
|
240 | document.addEventListener('mousemove', this.dragMove, { passive: false });
|
241 | document.addEventListener('mouseup', this.dragEnd);
|
242 | document.addEventListener('mouseleave', this.dragEnd);
|
243 | document.addEventListener('keydown', this.keydownHandle);
|
244 | }
|
245 | unbindEvent() {
|
246 | document.removeEventListener('touchmove', this.dragMove);
|
247 | document.removeEventListener('touchend', this.dragEnd);
|
248 | document.removeEventListener('mousedown', this.blurHandle);
|
249 | document.removeEventListener('mousemove', this.dragMove);
|
250 | document.removeEventListener('mouseup', this.dragEnd);
|
251 | document.removeEventListener('mouseleave', this.dragEnd);
|
252 | document.removeEventListener('keydown', this.keydownHandle);
|
253 | }
|
254 | setScale() {
|
255 | const decimal = new Decimal(Math.floor(this.isHorizontal ? this.$refs.rail.offsetWidth : this.$refs.rail.offsetHeight));
|
256 | if (this.zoom !== void 0) {
|
257 | decimal.multiply(this.zoom);
|
258 | }
|
259 | decimal.divide(100);
|
260 | this.scale = decimal.toNumber();
|
261 | }
|
262 | initControl() {
|
263 | this.control = new Control({
|
264 | value: this.value,
|
265 | data: this.sliderData,
|
266 | enableCross: this.enableCross,
|
267 | fixed: this.fixed,
|
268 | max: this.max,
|
269 | min: this.min,
|
270 | interval: this.interval,
|
271 | minRange: this.minRange,
|
272 | maxRange: this.maxRange,
|
273 | order: this.order,
|
274 | marks: this.sliderMarks,
|
275 | included: this.included,
|
276 | process: this.process,
|
277 | adsorb: this.adsorb,
|
278 | dotOptions: this.dotOptions,
|
279 | onError: this.emitError,
|
280 | });
|
281 | this.syncValueByPos();
|
282 | [
|
283 | 'data',
|
284 | 'enableCross',
|
285 | 'fixed',
|
286 | 'max',
|
287 | 'min',
|
288 | 'interval',
|
289 | 'minRange',
|
290 | 'maxRange',
|
291 | 'order',
|
292 | 'marks',
|
293 | 'process',
|
294 | 'adsorb',
|
295 | 'included',
|
296 | 'dotOptions',
|
297 | ].forEach(name => {
|
298 | this.$watch(name, (val) => {
|
299 | if (name === 'data' &&
|
300 | Array.isArray(this.control.data) &&
|
301 | Array.isArray(val) &&
|
302 | this.control.data.length === val.length &&
|
303 | val.every((item, index) => item === this.control.data[index])) {
|
304 | return false;
|
305 | }
|
306 | switch (name) {
|
307 | case 'data':
|
308 | case 'dataLabel':
|
309 | case 'dataValue':
|
310 | this.control.data = this.sliderData;
|
311 | break;
|
312 | case 'mark':
|
313 | this.control.marks = this.sliderMarks;
|
314 | break;
|
315 | default:
|
316 | ;
|
317 | this.control[name] = val;
|
318 | }
|
319 | if (['data', 'max', 'min', 'interval'].indexOf(name) > -1) {
|
320 | this.control.syncDotsPos();
|
321 | }
|
322 | });
|
323 | });
|
324 | }
|
325 | syncValueByPos() {
|
326 | const values = this.control.dotsValue;
|
327 | if (this.isDiff(values, Array.isArray(this.value) ? this.value : [this.value])) {
|
328 | this.$emit('change', values.length === 1 ? values[0] : [...values], this.focusDotIndex);
|
329 | }
|
330 | }
|
331 |
|
332 | get isNotSync() {
|
333 | const values = this.control.dotsValue;
|
334 | return Array.isArray(this.value)
|
335 | ? this.value.length !== values.length ||
|
336 | this.value.some((val, index) => val !== values[index])
|
337 | : this.value !== values[0];
|
338 | }
|
339 | isDiff(value1, value2) {
|
340 | return value1.length !== value2.length || value1.some((val, index) => val !== value2[index]);
|
341 | }
|
342 | emitError(type, message) {
|
343 | if (!this.silent) {
|
344 | console.error(`[VueSlider error]: ${message}`);
|
345 | }
|
346 | this.$emit('error', type, message);
|
347 | }
|
348 | |
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 | get dragRange() {
|
357 | const prevDot = this.dots[this.focusDotIndex - 1];
|
358 | const nextDot = this.dots[this.focusDotIndex + 1];
|
359 | return [prevDot ? prevDot.pos : -Infinity, nextDot ? nextDot.pos : Infinity];
|
360 | }
|
361 | dragStartOnProcess(e) {
|
362 | if (this.dragOnClick) {
|
363 | this.setScale();
|
364 | const pos = this.getPosByEvent(e);
|
365 | const index = this.control.getRecentDot(pos);
|
366 | if (this.dots[index].disabled) {
|
367 | return;
|
368 | }
|
369 | this.dragStart(index);
|
370 | this.control.setDotPos(pos, this.focusDotIndex);
|
371 | if (!this.lazy) {
|
372 | this.syncValueByPos();
|
373 | }
|
374 | }
|
375 | }
|
376 | dragStart(index) {
|
377 | this.focusDotIndex = index;
|
378 | this.setScale();
|
379 | this.states.add(SliderState.Drag);
|
380 | this.states.add(SliderState.Focus);
|
381 | this.$emit('drag-start', this.focusDotIndex);
|
382 | }
|
383 | dragMove(e) {
|
384 | if (!this.states.has(SliderState.Drag)) {
|
385 | return false;
|
386 | }
|
387 | e.preventDefault();
|
388 | const pos = this.getPosByEvent(e);
|
389 | this.isCrossDot(pos);
|
390 | this.control.setDotPos(pos, this.focusDotIndex);
|
391 | if (!this.lazy) {
|
392 | this.syncValueByPos();
|
393 | }
|
394 | const value = this.control.dotsValue;
|
395 | this.$emit('dragging', value.length === 1 ? value[0] : [...value], this.focusDotIndex);
|
396 | }
|
397 |
|
398 | isCrossDot(pos) {
|
399 | if (this.canSort) {
|
400 | const curIndex = this.focusDotIndex;
|
401 | let curPos = pos;
|
402 | if (curPos > this.dragRange[1]) {
|
403 | curPos = this.dragRange[1];
|
404 | this.focusDotIndex++;
|
405 | }
|
406 | else if (curPos < this.dragRange[0]) {
|
407 | curPos = this.dragRange[0];
|
408 | this.focusDotIndex--;
|
409 | }
|
410 | if (curIndex !== this.focusDotIndex) {
|
411 | const dotVm = this.$refs[`dot-${this.focusDotIndex}`];
|
412 | if (dotVm && dotVm.$el) {
|
413 | dotVm.$el.focus();
|
414 | }
|
415 | this.control.setDotPos(curPos, curIndex);
|
416 | }
|
417 | }
|
418 | }
|
419 | dragEnd(e) {
|
420 | if (!this.states.has(SliderState.Drag)) {
|
421 | return false;
|
422 | }
|
423 | setTimeout(() => {
|
424 | if (this.lazy) {
|
425 | this.syncValueByPos();
|
426 | }
|
427 | if (this.included && this.isNotSync) {
|
428 | this.control.setValue(this.value);
|
429 | }
|
430 | else {
|
431 |
|
432 | this.control.syncDotsPos();
|
433 | }
|
434 | this.states.delete(SliderState.Drag);
|
435 |
|
436 | if (!this.useKeyboard || 'targetTouches' in e) {
|
437 | this.states.delete(SliderState.Focus);
|
438 | }
|
439 | this.$emit('drag-end', this.focusDotIndex);
|
440 | });
|
441 | }
|
442 | blurHandle(e) {
|
443 | if (!this.states.has(SliderState.Focus) ||
|
444 | !this.$refs.container ||
|
445 | this.$refs.container.contains(e.target)) {
|
446 | return false;
|
447 | }
|
448 | this.states.delete(SliderState.Focus);
|
449 | }
|
450 | clickHandle(e) {
|
451 | if (!this.clickable || this.disabled) {
|
452 | return false;
|
453 | }
|
454 | if (this.states.has(SliderState.Drag)) {
|
455 | return;
|
456 | }
|
457 | this.setScale();
|
458 | const pos = this.getPosByEvent(e);
|
459 | this.setValueByPos(pos);
|
460 | }
|
461 | focus(index = 0) {
|
462 | this.states.add(SliderState.Focus);
|
463 | this.focusDotIndex = index;
|
464 | }
|
465 | blur() {
|
466 | this.states.delete(SliderState.Focus);
|
467 | }
|
468 | getValue() {
|
469 | const values = this.control.dotsValue;
|
470 | return values.length === 1 ? values[0] : values;
|
471 | }
|
472 | getIndex() {
|
473 | const indexes = this.control.dotsIndex;
|
474 | return indexes.length === 1 ? indexes[0] : indexes;
|
475 | }
|
476 | setValue(value) {
|
477 | this.control.setValue(Array.isArray(value) ? [...value] : [value]);
|
478 | this.syncValueByPos();
|
479 | }
|
480 | setIndex(index) {
|
481 | const value = Array.isArray(index)
|
482 | ? index.map(n => this.control.getValueByIndex(n))
|
483 | : this.control.getValueByIndex(index);
|
484 | this.setValue(value);
|
485 | }
|
486 | setValueByPos(pos) {
|
487 | const index = this.control.getRecentDot(pos);
|
488 | if (this.disabled || this.dots[index].disabled) {
|
489 | return false;
|
490 | }
|
491 | this.focusDotIndex = index;
|
492 | this.control.setDotPos(pos, index);
|
493 | this.syncValueByPos();
|
494 | if (this.useKeyboard) {
|
495 | this.states.add(SliderState.Focus);
|
496 | }
|
497 | setTimeout(() => {
|
498 | if (this.included && this.isNotSync) {
|
499 | this.control.setValue(this.value);
|
500 | }
|
501 | else {
|
502 | this.control.syncDotsPos();
|
503 | }
|
504 | });
|
505 | }
|
506 | keydownHandle(e) {
|
507 | if (!this.useKeyboard || !this.states.has(SliderState.Focus)) {
|
508 | return false;
|
509 | }
|
510 | const isInclude = this.included && this.marks;
|
511 | const handleFunc = getKeyboardHandleFunc(e, {
|
512 | direction: this.direction,
|
513 | max: isInclude ? this.control.markList.length - 1 : this.control.total,
|
514 | min: 0,
|
515 | hook: this.keydownHook,
|
516 | });
|
517 | if (handleFunc) {
|
518 | e.preventDefault();
|
519 | let newIndex = -1;
|
520 | let pos = 0;
|
521 | if (isInclude) {
|
522 | this.control.markList.some((mark, index) => {
|
523 | if (mark.value === this.control.dotsValue[this.focusDotIndex]) {
|
524 | newIndex = handleFunc(index);
|
525 | return true;
|
526 | }
|
527 | return false;
|
528 | });
|
529 | if (newIndex < 0) {
|
530 | newIndex = 0;
|
531 | }
|
532 | else if (newIndex > this.control.markList.length - 1) {
|
533 | newIndex = this.control.markList.length - 1;
|
534 | }
|
535 | pos = this.control.markList[newIndex].pos;
|
536 | }
|
537 | else {
|
538 | newIndex = handleFunc(this.control.getIndexByValue(this.control.dotsValue[this.focusDotIndex]));
|
539 | pos = this.control.parseValue(this.control.getValueByIndex(newIndex));
|
540 | }
|
541 | this.isCrossDot(pos);
|
542 | this.control.setDotPos(pos, this.focusDotIndex);
|
543 | this.syncValueByPos();
|
544 | }
|
545 | }
|
546 | getPosByEvent(e) {
|
547 | return (getPos(e, this.$refs.rail, this.isReverse, this.zoom)[this.isHorizontal ? 'x' : 'y'] /
|
548 | this.scale);
|
549 | }
|
550 | renderSlot(name, data, defaultSlot, isDefault) {
|
551 | const scopedSlot = this.$scopedSlots[name];
|
552 | return scopedSlot ? (isDefault ? (scopedSlot(data)) : (<template slot={name}>{scopedSlot(data)}</template>)) : (defaultSlot);
|
553 | }
|
554 | render() {
|
555 | return (<div ref="container" class={this.containerClasses} style={this.containerStyles} onClick={this.clickHandle} onTouchstart={this.dragStartOnProcess} onMousedown={this.dragStartOnProcess} {...this.$attrs}>
|
556 |
|
557 | <div ref="rail" class="vue-slider-rail" style={this.railStyle}>
|
558 | {this.processArray.map((item, index) => this.renderSlot('process', item, <div class="vue-slider-process" key={`process-${index}`} style={item.style}/>, true))}
|
559 |
|
560 | {this.sliderMarks ? (<div class="vue-slider-marks">
|
561 | {this.control.markList.map((mark, index) => this.renderSlot('mark', mark, <vue-slider-mark key={`mark-${index}`} mark={mark} hideLabel={this.hideLabel} style={{
|
562 | [this.isHorizontal ? 'height' : 'width']: '100%',
|
563 | [this.isHorizontal ? 'width' : 'height']: this.tailSize,
|
564 | [this.mainDirection]: `${mark.pos}%`,
|
565 | }} stepStyle={this.stepStyle} stepActiveStyle={this.stepActiveStyle} labelStyle={this.labelStyle} labelActiveStyle={this.labelActiveStyle} onPressLabel={(pos) => this.clickable && this.setValueByPos(pos)}>
|
566 | {this.renderSlot('step', mark, null)}
|
567 | {this.renderSlot('label', mark, null)}
|
568 | </vue-slider-mark>, true))}
|
569 | </div>) : null}
|
570 |
|
571 | {this.dots.map((dot, index) => (<vue-slider-dot ref={`dot-${index}`} key={`dot-${index}`} value={dot.value} disabled={dot.disabled} focus={dot.focus} dot-style={[
|
572 | dot.style,
|
573 | dot.disabled ? dot.disabledStyle : null,
|
574 | dot.focus ? dot.focusStyle : null,
|
575 | ]} tooltip={dot.tooltip || this.tooltip} tooltip-style={[
|
576 | this.tooltipStyle,
|
577 | dot.tooltipStyle,
|
578 | dot.disabled ? dot.tooltipDisabledStyle : null,
|
579 | dot.focus ? dot.tooltipFocusStyle : null,
|
580 | ]} tooltip-formatter={Array.isArray(this.sliderTooltipFormatter)
|
581 | ? this.sliderTooltipFormatter[index]
|
582 | : this.sliderTooltipFormatter} tooltip-placement={this.tooltipDirections[index]} style={[
|
583 | this.dotBaseStyle,
|
584 | {
|
585 | [this.mainDirection]: `${dot.pos}%`,
|
586 | transition: `${this.mainDirection} ${this.animateTime}s`,
|
587 | },
|
588 | ]} onDrag-start={() => this.dragStart(index)} role="slider" aria-valuenow={dot.value} aria-valuemin={this.min} aria-valuemax={this.max} aria-orientation={this.isHorizontal ? 'horizontal' : 'vertical'} tabindex="0" nativeOnFocus={() => !dot.disabled && this.focus(index)} nativeOnBlur={() => this.blur()} {...{ attrs: this.dotAttrs }}>
|
589 | {this.renderSlot('dot', dot, null)}
|
590 | {this.renderSlot('tooltip', dot, null)}
|
591 | </vue-slider-dot>))}
|
592 | {this.renderSlot('default', { value: this.getValue() }, null, true)}
|
593 | </div>
|
594 | </div>);
|
595 | }
|
596 | };
|
597 | __decorate([
|
598 | Model('change', { default: 0 })
|
599 | ], VueSlider.prototype, "value", void 0);
|
600 | __decorate([
|
601 | Prop({ type: Boolean, default: false })
|
602 | ], VueSlider.prototype, "silent", void 0);
|
603 | __decorate([
|
604 | Prop({
|
605 | default: 'ltr',
|
606 | validator: dir => ['ltr', 'rtl', 'ttb', 'btt'].indexOf(dir) > -1,
|
607 | })
|
608 | ], VueSlider.prototype, "direction", void 0);
|
609 | __decorate([
|
610 | Prop({ type: [Number, String] })
|
611 | ], VueSlider.prototype, "width", void 0);
|
612 | __decorate([
|
613 | Prop({ type: [Number, String] })
|
614 | ], VueSlider.prototype, "height", void 0);
|
615 | __decorate([
|
616 | Prop({ default: 14 })
|
617 | ], VueSlider.prototype, "dotSize", void 0);
|
618 | __decorate([
|
619 | Prop({ default: false })
|
620 | ], VueSlider.prototype, "contained", void 0);
|
621 | __decorate([
|
622 | Prop({ type: Number, default: 0 })
|
623 | ], VueSlider.prototype, "min", void 0);
|
624 | __decorate([
|
625 | Prop({ type: Number, default: 100 })
|
626 | ], VueSlider.prototype, "max", void 0);
|
627 | __decorate([
|
628 | Prop({ type: Number, default: 1 })
|
629 | ], VueSlider.prototype, "interval", void 0);
|
630 | __decorate([
|
631 | Prop({ type: Boolean, default: false })
|
632 | ], VueSlider.prototype, "disabled", void 0);
|
633 | __decorate([
|
634 | Prop({ type: Boolean, default: true })
|
635 | ], VueSlider.prototype, "clickable", void 0);
|
636 | __decorate([
|
637 | Prop({ type: Boolean, default: false })
|
638 | ], VueSlider.prototype, "dragOnClick", void 0);
|
639 | __decorate([
|
640 | Prop({ type: Number, default: 0.5 })
|
641 | ], VueSlider.prototype, "duration", void 0);
|
642 | __decorate([
|
643 | Prop({ type: [Object, Array] })
|
644 | ], VueSlider.prototype, "data", void 0);
|
645 | __decorate([
|
646 | Prop({ type: String, default: 'value' })
|
647 | ], VueSlider.prototype, "dataValue", void 0);
|
648 | __decorate([
|
649 | Prop({ type: String, default: 'label' })
|
650 | ], VueSlider.prototype, "dataLabel", void 0);
|
651 | __decorate([
|
652 | Prop({ type: Boolean, default: false })
|
653 | ], VueSlider.prototype, "lazy", void 0);
|
654 | __decorate([
|
655 | Prop({
|
656 | type: String,
|
657 | validator: val => ['none', 'always', 'focus', 'hover', 'active'].indexOf(val) > -1,
|
658 | default: 'active',
|
659 | })
|
660 | ], VueSlider.prototype, "tooltip", void 0);
|
661 | __decorate([
|
662 | Prop({
|
663 | type: [String, Array],
|
664 | validator: data => (Array.isArray(data) ? data : [data]).every(val => ['top', 'right', 'bottom', 'left'].indexOf(val) > -1),
|
665 | })
|
666 | ], VueSlider.prototype, "tooltipPlacement", void 0);
|
667 | __decorate([
|
668 | Prop({ type: [String, Array, Function] })
|
669 | ], VueSlider.prototype, "tooltipFormatter", void 0);
|
670 | __decorate([
|
671 | Prop({ type: Boolean, default: true })
|
672 | ], VueSlider.prototype, "useKeyboard", void 0);
|
673 | __decorate([
|
674 | Prop(Function)
|
675 | ], VueSlider.prototype, "keydownHook", void 0);
|
676 | __decorate([
|
677 | Prop({ type: Boolean, default: true })
|
678 | ], VueSlider.prototype, "enableCross", void 0);
|
679 | __decorate([
|
680 | Prop({ type: Boolean, default: false })
|
681 | ], VueSlider.prototype, "fixed", void 0);
|
682 | __decorate([
|
683 | Prop({ type: Boolean, default: true })
|
684 | ], VueSlider.prototype, "order", void 0);
|
685 | __decorate([
|
686 | Prop(Number)
|
687 | ], VueSlider.prototype, "minRange", void 0);
|
688 | __decorate([
|
689 | Prop(Number)
|
690 | ], VueSlider.prototype, "maxRange", void 0);
|
691 | __decorate([
|
692 | Prop({ type: [Boolean, Object, Array, Function], default: false })
|
693 | ], VueSlider.prototype, "marks", void 0);
|
694 | __decorate([
|
695 | Prop({ type: [Boolean, Function], default: true })
|
696 | ], VueSlider.prototype, "process", void 0);
|
697 | __decorate([
|
698 | Prop({ type: [Number] })
|
699 | ], VueSlider.prototype, "zoom", void 0);
|
700 | __decorate([
|
701 | Prop(Boolean)
|
702 | ], VueSlider.prototype, "included", void 0);
|
703 | __decorate([
|
704 | Prop(Boolean)
|
705 | ], VueSlider.prototype, "adsorb", void 0);
|
706 | __decorate([
|
707 | Prop(Boolean)
|
708 | ], VueSlider.prototype, "hideLabel", void 0);
|
709 | __decorate([
|
710 | Prop()
|
711 | ], VueSlider.prototype, "dotOptions", void 0);
|
712 | __decorate([
|
713 | Prop()
|
714 | ], VueSlider.prototype, "dotAttrs", void 0);
|
715 | __decorate([
|
716 | Prop()
|
717 | ], VueSlider.prototype, "railStyle", void 0);
|
718 | __decorate([
|
719 | Prop()
|
720 | ], VueSlider.prototype, "processStyle", void 0);
|
721 | __decorate([
|
722 | Prop()
|
723 | ], VueSlider.prototype, "dotStyle", void 0);
|
724 | __decorate([
|
725 | Prop()
|
726 | ], VueSlider.prototype, "tooltipStyle", void 0);
|
727 | __decorate([
|
728 | Prop()
|
729 | ], VueSlider.prototype, "stepStyle", void 0);
|
730 | __decorate([
|
731 | Prop()
|
732 | ], VueSlider.prototype, "stepActiveStyle", void 0);
|
733 | __decorate([
|
734 | Prop()
|
735 | ], VueSlider.prototype, "labelStyle", void 0);
|
736 | __decorate([
|
737 | Prop()
|
738 | ], VueSlider.prototype, "labelActiveStyle", void 0);
|
739 | __decorate([
|
740 | Watch('value')
|
741 | ], VueSlider.prototype, "onValueChanged", null);
|
742 | VueSlider = __decorate([
|
743 | Component({
|
744 | name: 'VueSlider',
|
745 | data() {
|
746 | return {
|
747 | control: null,
|
748 | };
|
749 | },
|
750 | components: {
|
751 | VueSliderDot,
|
752 | VueSliderMark,
|
753 | },
|
754 | })
|
755 | ], VueSlider);
|
756 | return VueSlider;
|
757 | })();
|
758 | export default VueSlider;
|
759 | //# sourceMappingURL=vue-slider.jsx.map |
\ | No newline at end of file |