@progress/kendo-vue-inputs 3.2.1 → 3.2.2-dev.202204181420
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/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/range-slider/RangeSlider.d.ts +168 -0
- package/dist/es/range-slider/RangeSlider.js +606 -0
- package/dist/es/range-slider/range-raducer.d.ts +35 -0
- package/dist/es/range-slider/range-raducer.js +157 -0
- package/dist/es/slider/Slider.js +1 -2
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +1 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/range-slider/RangeSlider.d.ts +168 -0
- package/dist/npm/range-slider/RangeSlider.js +619 -0
- package/dist/npm/range-slider/range-raducer.d.ts +35 -0
- package/dist/npm/range-slider/range-raducer.js +163 -0
- package/dist/npm/slider/Slider.js +10 -12
- package/package.json +10 -10
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __assign = undefined && undefined.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
|
|
8
|
+
for (var p in s) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports.RangeSliderVue2 = exports.RangeSlider = void 0; // @ts-ignore
|
|
23
|
+
|
|
24
|
+
var Vue = require("vue");
|
|
25
|
+
|
|
26
|
+
var allVue = Vue;
|
|
27
|
+
var gh = allVue.h;
|
|
28
|
+
var ref = allVue.ref;
|
|
29
|
+
var inject = allVue.inject;
|
|
30
|
+
|
|
31
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
32
|
+
|
|
33
|
+
var messages_1 = require("./../messages");
|
|
34
|
+
|
|
35
|
+
var kendo_vue_intl_1 = require("@progress/kendo-vue-intl");
|
|
36
|
+
|
|
37
|
+
var range_raducer_1 = require("./range-raducer");
|
|
38
|
+
|
|
39
|
+
var package_metadata_1 = require("../package-metadata");
|
|
40
|
+
|
|
41
|
+
var RangeSliderVue2 = {
|
|
42
|
+
name: 'KendoRangeSlider',
|
|
43
|
+
model: {
|
|
44
|
+
event: 'changemodel'
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
id: String,
|
|
48
|
+
value: {
|
|
49
|
+
type: Object,
|
|
50
|
+
validator: function validator(value) {
|
|
51
|
+
return value.start <= value.end;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
defaultValue: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: function _default() {
|
|
57
|
+
return {
|
|
58
|
+
start: 0,
|
|
59
|
+
end: 0
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
validator: function validator(value) {
|
|
63
|
+
return value.start <= value.end;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
step: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 1
|
|
69
|
+
},
|
|
70
|
+
min: {
|
|
71
|
+
type: Number,
|
|
72
|
+
required: true
|
|
73
|
+
},
|
|
74
|
+
max: {
|
|
75
|
+
type: Number,
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
vertical: Boolean,
|
|
79
|
+
disabled: Boolean,
|
|
80
|
+
dir: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'ltr',
|
|
83
|
+
validator: function validator(value) {
|
|
84
|
+
return [null, 'ltr', 'rtl'].includes(value);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
startTabIndex: Number,
|
|
88
|
+
endTabIndex: Number
|
|
89
|
+
},
|
|
90
|
+
provide: function provide() {
|
|
91
|
+
return {
|
|
92
|
+
kendoMin: this.$props.min,
|
|
93
|
+
kendoMax: this.$props.max,
|
|
94
|
+
kendoVertical: this.$props.vertical
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
inject: {
|
|
98
|
+
kendoLocalizationService: {
|
|
99
|
+
default: null
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
created: function created() {
|
|
103
|
+
kendo_vue_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
104
|
+
},
|
|
105
|
+
data: function data() {
|
|
106
|
+
return {
|
|
107
|
+
currentValue: this.defaultValue,
|
|
108
|
+
currentDrag: '',
|
|
109
|
+
currentDir: 'ltr'
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
computed: {
|
|
113
|
+
computedValue: function computedValue() {
|
|
114
|
+
return this.$props.value !== undefined ? this.$props.value : this.currentValue;
|
|
115
|
+
},
|
|
116
|
+
percentStart: function percentStart() {
|
|
117
|
+
return (this.computedValue.start - this.min) / (this.max - this.min) * 100;
|
|
118
|
+
},
|
|
119
|
+
percentEnd: function percentEnd() {
|
|
120
|
+
return (this.computedValue.end - this.min) / (this.max - this.min) * 100;
|
|
121
|
+
},
|
|
122
|
+
sliderItemsStyle: function sliderItemsStyle() {
|
|
123
|
+
return this.vertical ? {
|
|
124
|
+
paddingTop: 0,
|
|
125
|
+
height: '100%'
|
|
126
|
+
} : {};
|
|
127
|
+
},
|
|
128
|
+
trackStyles: function trackStyles() {
|
|
129
|
+
return this.vertical ? {
|
|
130
|
+
marginTop: '0.5rem',
|
|
131
|
+
marginBottom: '0.5rem'
|
|
132
|
+
} : {
|
|
133
|
+
marginLeft: '0.5rem',
|
|
134
|
+
marginRight: '0.5rem'
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
mounted: function mounted() {
|
|
139
|
+
this.sliderRef = this.$refs.sliderRef;
|
|
140
|
+
this.sliderSelectionRef = this.$refs.sliderSelectionRef;
|
|
141
|
+
this.startHandle = this.$refs.startHandle;
|
|
142
|
+
this.endHandle = this.$refs.endHandle;
|
|
143
|
+
this.sliderTrackRef = this.$refs.sliderTrackRef;
|
|
144
|
+
this.sliderTrackWrapRef = this.$refs.sliderTrackWrapRef;
|
|
145
|
+
|
|
146
|
+
if (!this.currentDir && window && this.$el) {
|
|
147
|
+
// Note: getComputedStyle forces reflow
|
|
148
|
+
var direction = window.getComputedStyle(this.$el).direction;
|
|
149
|
+
|
|
150
|
+
if (direction) {
|
|
151
|
+
this.currentDir = direction;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
setup: !gh ? undefined : function () {
|
|
157
|
+
var v3 = !!gh;
|
|
158
|
+
var inputRef = ref(null);
|
|
159
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
160
|
+
return {
|
|
161
|
+
v3: v3,
|
|
162
|
+
inputRef: inputRef,
|
|
163
|
+
kendoLocalizationService: kendoLocalizationService
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
render: function render(createElement) {
|
|
167
|
+
var _this = this;
|
|
168
|
+
|
|
169
|
+
var _a, _b;
|
|
170
|
+
|
|
171
|
+
var h = gh || createElement;
|
|
172
|
+
var localization = kendo_vue_intl_1.provideLocalizationService(this);
|
|
173
|
+
var defaultSlot = kendo_vue_common_1.getDefaultSlots(this);
|
|
174
|
+
var _c = this.$props,
|
|
175
|
+
id = _c.id,
|
|
176
|
+
dir = _c.dir; // const dir = useDir(sliderRef, this.$props.dir);
|
|
177
|
+
|
|
178
|
+
return h("div", {
|
|
179
|
+
role: "slider",
|
|
180
|
+
attrs: this.v3 ? undefined : {
|
|
181
|
+
role: "slider",
|
|
182
|
+
id: id,
|
|
183
|
+
dir: this.currentDir,
|
|
184
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
185
|
+
"aria-describedby": this.$props.ariaDescribedBy
|
|
186
|
+
},
|
|
187
|
+
id: id,
|
|
188
|
+
dir: this.currentDir,
|
|
189
|
+
"class": kendo_vue_common_1.classNames('k-widget k-slider', {
|
|
190
|
+
'k-rtl': this.currentDir === 'rtl',
|
|
191
|
+
'k-state-disabled': this.$props.disabled,
|
|
192
|
+
'k-slider-vertical': this.$props.vertical,
|
|
193
|
+
'k-slider-horizontal': !this.$props.vertical
|
|
194
|
+
}, this.$props.class),
|
|
195
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
196
|
+
"aria-describedby": this.$props.ariaDescribedBy
|
|
197
|
+
}, [// @ts-ignore function children
|
|
198
|
+
h(kendo_vue_common_1.Draggable, {
|
|
199
|
+
onDrag: this.handleTrackPress,
|
|
200
|
+
on: this.v3 ? undefined : {
|
|
201
|
+
"drag": this.handleTrackPress,
|
|
202
|
+
"press": this.handleTrackPress,
|
|
203
|
+
"release": this.handleTrackRelease
|
|
204
|
+
},
|
|
205
|
+
onPress: this.handleTrackPress,
|
|
206
|
+
onRelease: this.handleTrackRelease,
|
|
207
|
+
ref: 'draggable'
|
|
208
|
+
}, this.v3 ? function () {
|
|
209
|
+
return [h("div", {
|
|
210
|
+
ref: 'sliderTrackWrapRef',
|
|
211
|
+
"class": "k-slider-track-wrap",
|
|
212
|
+
style: __assign({
|
|
213
|
+
flexGrow: 1,
|
|
214
|
+
position: 'relative',
|
|
215
|
+
touchAction: 'none'
|
|
216
|
+
}, _this.trackStyles)
|
|
217
|
+
}, [defaultSlot && h("ul", {
|
|
218
|
+
"class": "k-reset k-slider-items",
|
|
219
|
+
style: __assign({}, _this.sliderItemsStyle)
|
|
220
|
+
}, [defaultSlot]), h("div", {
|
|
221
|
+
ref: 'sliderTrackRef',
|
|
222
|
+
"class": "k-slider-track",
|
|
223
|
+
style: _this.$props.vertical ? {
|
|
224
|
+
bottom: 0,
|
|
225
|
+
height: '100%'
|
|
226
|
+
} : (_a = {}, _a[_this.currentDir === 'rtl' ? 'right' : 'left'] = 0, _a.width = '100%', _a)
|
|
227
|
+
}, [_this.percentStart !== null && _this.percentEnd !== null && h("div", {
|
|
228
|
+
"data-selection": true,
|
|
229
|
+
attrs: _this.v3 ? undefined : {
|
|
230
|
+
"data-selection": true,
|
|
231
|
+
title: _this.computedValue.start + " - " + _this.computedValue.end
|
|
232
|
+
},
|
|
233
|
+
ref: 'sliderSelectionRef',
|
|
234
|
+
title: _this.computedValue.start + " - " + _this.computedValue.end,
|
|
235
|
+
"class": "k-slider-selection",
|
|
236
|
+
style: _this.vertical ? {
|
|
237
|
+
height: _this.percentEnd - _this.percentStart + '%',
|
|
238
|
+
bottom: _this.percentStart + '%'
|
|
239
|
+
} : (_b = {}, _b[_this.currentDir === 'rtl' ? 'right' : 'left'] = _this.percentStart + '%', _b.width = _this.percentEnd - _this.percentStart + '%', _b)
|
|
240
|
+
}), h("a", {
|
|
241
|
+
ref: 'startHandle',
|
|
242
|
+
role: "slider",
|
|
243
|
+
attrs: _this.v3 ? undefined : {
|
|
244
|
+
role: "slider",
|
|
245
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.startTabIndex, _this.$props.disabled, undefined),
|
|
246
|
+
"aria-valuemin": _this.min,
|
|
247
|
+
"aria-valuemax": Math.max(_this.max, _this.computedValue.end),
|
|
248
|
+
"aria-valuenow": _this.computedValue.start,
|
|
249
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
250
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle])
|
|
251
|
+
},
|
|
252
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.startTabIndex, _this.$props.disabled, undefined),
|
|
253
|
+
"aria-valuemin": _this.min,
|
|
254
|
+
"aria-valuemax": Math.max(_this.max, _this.computedValue.end),
|
|
255
|
+
"aria-valuenow": _this.computedValue.start,
|
|
256
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
257
|
+
"class": "k-draghandle",
|
|
258
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]),
|
|
259
|
+
style: _this.vertical ? {
|
|
260
|
+
bottom: 'calc(' + _this.percentStart + '%)',
|
|
261
|
+
zIndex: 1
|
|
262
|
+
} : _this.currentDir === 'rtl' ? {
|
|
263
|
+
right: 'calc(' + _this.percentStart + '% - 13px)',
|
|
264
|
+
zIndex: 1
|
|
265
|
+
} : {
|
|
266
|
+
left: 'calc(' + _this.percentStart + '%)',
|
|
267
|
+
zIndex: 1
|
|
268
|
+
},
|
|
269
|
+
onKeydown: _this.handleStartKeyDown,
|
|
270
|
+
on: _this.v3 ? undefined : {
|
|
271
|
+
"keydown": _this.handleStartKeyDown
|
|
272
|
+
}
|
|
273
|
+
}), h("a", {
|
|
274
|
+
ref: 'endHandle',
|
|
275
|
+
role: "slider",
|
|
276
|
+
attrs: _this.v3 ? undefined : {
|
|
277
|
+
role: "slider",
|
|
278
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.endTabIndex, _this.$props.disabled, undefined),
|
|
279
|
+
"aria-valuemin": Math.min(_this.min, _this.computedValue.start),
|
|
280
|
+
"aria-valuemax": _this.max,
|
|
281
|
+
"aria-valuenow": _this.computedValue.end,
|
|
282
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
283
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle])
|
|
284
|
+
},
|
|
285
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.endTabIndex, _this.$props.disabled, undefined),
|
|
286
|
+
"aria-valuemin": Math.min(_this.min, _this.computedValue.start),
|
|
287
|
+
"aria-valuemax": _this.max,
|
|
288
|
+
"aria-valuenow": _this.computedValue.end,
|
|
289
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
290
|
+
"class": "k-draghandle",
|
|
291
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]),
|
|
292
|
+
style: _this.vertical ? {
|
|
293
|
+
bottom: 'calc(' + _this.percentEnd + '%)',
|
|
294
|
+
zIndex: 1
|
|
295
|
+
} : _this.currentDir === 'rtl' ? {
|
|
296
|
+
right: 'calc(' + _this.percentEnd + '% - 13px)',
|
|
297
|
+
zIndex: 1
|
|
298
|
+
} : {
|
|
299
|
+
left: 'calc(' + _this.percentEnd + '%)',
|
|
300
|
+
zIndex: 1
|
|
301
|
+
},
|
|
302
|
+
onKeydown: _this.handleEndKeyDown,
|
|
303
|
+
on: _this.v3 ? undefined : {
|
|
304
|
+
"keydown": _this.handleEndKeyDown
|
|
305
|
+
}
|
|
306
|
+
})])])];
|
|
307
|
+
} : [h("div", {
|
|
308
|
+
ref: 'sliderTrackWrapRef',
|
|
309
|
+
"class": "k-slider-track-wrap",
|
|
310
|
+
style: __assign({
|
|
311
|
+
flexGrow: 1,
|
|
312
|
+
position: 'relative',
|
|
313
|
+
touchAction: 'none'
|
|
314
|
+
}, _this.trackStyles)
|
|
315
|
+
}, [defaultSlot && h("ul", {
|
|
316
|
+
"class": "k-reset k-slider-items",
|
|
317
|
+
style: __assign({}, _this.sliderItemsStyle)
|
|
318
|
+
}, [defaultSlot]), h("div", {
|
|
319
|
+
ref: 'sliderTrackRef',
|
|
320
|
+
"class": "k-slider-track",
|
|
321
|
+
style: _this.$props.vertical ? {
|
|
322
|
+
bottom: 0,
|
|
323
|
+
height: '100%'
|
|
324
|
+
} : (_a = {}, _a[_this.currentDir === 'rtl' ? 'right' : 'left'] = 0, _a.width = '100%', _a)
|
|
325
|
+
}, [_this.percentStart !== null && _this.percentEnd !== null && h("div", {
|
|
326
|
+
"data-selection": true,
|
|
327
|
+
attrs: _this.v3 ? undefined : {
|
|
328
|
+
"data-selection": true,
|
|
329
|
+
title: _this.computedValue.start + " - " + _this.computedValue.end
|
|
330
|
+
},
|
|
331
|
+
ref: 'sliderSelectionRef',
|
|
332
|
+
title: _this.computedValue.start + " - " + _this.computedValue.end,
|
|
333
|
+
"class": "k-slider-selection",
|
|
334
|
+
style: _this.vertical ? {
|
|
335
|
+
height: _this.percentEnd - _this.percentStart + '%',
|
|
336
|
+
bottom: _this.percentStart + '%'
|
|
337
|
+
} : (_b = {}, _b[_this.currentDir === 'rtl' ? 'right' : 'left'] = _this.percentStart + '%', _b.width = _this.percentEnd - _this.percentStart + '%', _b)
|
|
338
|
+
}), h("a", {
|
|
339
|
+
ref: 'startHandle',
|
|
340
|
+
role: "slider",
|
|
341
|
+
attrs: _this.v3 ? undefined : {
|
|
342
|
+
role: "slider",
|
|
343
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.startTabIndex, _this.$props.disabled, undefined),
|
|
344
|
+
"aria-valuemin": _this.min,
|
|
345
|
+
"aria-valuemax": Math.max(_this.max, _this.computedValue.end),
|
|
346
|
+
"aria-valuenow": _this.computedValue.start,
|
|
347
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
348
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle])
|
|
349
|
+
},
|
|
350
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.startTabIndex, _this.$props.disabled, undefined),
|
|
351
|
+
"aria-valuemin": _this.min,
|
|
352
|
+
"aria-valuemax": Math.max(_this.max, _this.computedValue.end),
|
|
353
|
+
"aria-valuenow": _this.computedValue.start,
|
|
354
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
355
|
+
"class": "k-draghandle",
|
|
356
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]),
|
|
357
|
+
style: _this.vertical ? {
|
|
358
|
+
bottom: 'calc(' + _this.percentStart + '%)',
|
|
359
|
+
zIndex: 1
|
|
360
|
+
} : _this.currentDir === 'rtl' ? {
|
|
361
|
+
right: 'calc(' + _this.percentStart + '% - 13px)',
|
|
362
|
+
zIndex: 1
|
|
363
|
+
} : {
|
|
364
|
+
left: 'calc(' + _this.percentStart + '%)',
|
|
365
|
+
zIndex: 1
|
|
366
|
+
},
|
|
367
|
+
onKeydown: _this.handleStartKeyDown,
|
|
368
|
+
on: _this.v3 ? undefined : {
|
|
369
|
+
"keydown": _this.handleStartKeyDown
|
|
370
|
+
}
|
|
371
|
+
}), h("a", {
|
|
372
|
+
ref: 'endHandle',
|
|
373
|
+
role: "slider",
|
|
374
|
+
attrs: _this.v3 ? undefined : {
|
|
375
|
+
role: "slider",
|
|
376
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.endTabIndex, _this.$props.disabled, undefined),
|
|
377
|
+
"aria-valuemin": Math.min(_this.min, _this.computedValue.start),
|
|
378
|
+
"aria-valuemax": _this.max,
|
|
379
|
+
"aria-valuenow": _this.computedValue.end,
|
|
380
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
381
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle])
|
|
382
|
+
},
|
|
383
|
+
tabIndex: kendo_vue_common_1.getTabIndex(_this.endTabIndex, _this.$props.disabled, undefined),
|
|
384
|
+
"aria-valuemin": Math.min(_this.min, _this.computedValue.start),
|
|
385
|
+
"aria-valuemax": _this.max,
|
|
386
|
+
"aria-valuenow": _this.computedValue.end,
|
|
387
|
+
"aria-disabled": _this.disabled ? 'true' : undefined,
|
|
388
|
+
"class": "k-draghandle",
|
|
389
|
+
title: localization.toLanguageString(messages_1.sliderDragTitle, messages_1.messages[messages_1.sliderDragTitle]),
|
|
390
|
+
style: _this.vertical ? {
|
|
391
|
+
bottom: 'calc(' + _this.percentEnd + '%)',
|
|
392
|
+
zIndex: 1
|
|
393
|
+
} : _this.currentDir === 'rtl' ? {
|
|
394
|
+
right: 'calc(' + _this.percentEnd + '% - 13px)',
|
|
395
|
+
zIndex: 1
|
|
396
|
+
} : {
|
|
397
|
+
left: 'calc(' + _this.percentEnd + '%)',
|
|
398
|
+
zIndex: 1
|
|
399
|
+
},
|
|
400
|
+
onKeydown: _this.handleEndKeyDown,
|
|
401
|
+
on: _this.v3 ? undefined : {
|
|
402
|
+
"keydown": _this.handleEndKeyDown
|
|
403
|
+
}
|
|
404
|
+
})])])])]);
|
|
405
|
+
},
|
|
406
|
+
methods: {
|
|
407
|
+
dispatchStateValue: function dispatchStateValue(args) {
|
|
408
|
+
var newState = range_raducer_1.rangeReducer({
|
|
409
|
+
start: this.computedValue.start,
|
|
410
|
+
end: this.computedValue.end
|
|
411
|
+
}, __assign(__assign({}, args), {
|
|
412
|
+
min: this.min,
|
|
413
|
+
max: this.max,
|
|
414
|
+
step: this.step
|
|
415
|
+
}));
|
|
416
|
+
this.currentValue.start = newState.start;
|
|
417
|
+
this.currentValue.end = newState.end;
|
|
418
|
+
this.$emit('change', {
|
|
419
|
+
min: this.min,
|
|
420
|
+
max: this.max,
|
|
421
|
+
step: this.step,
|
|
422
|
+
value: {
|
|
423
|
+
start: newState.start,
|
|
424
|
+
end: newState.end
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
focus: function focus() {
|
|
429
|
+
if (this.startHandle) {
|
|
430
|
+
this.startHandle.focus();
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
handleChange: function handleChange(newValue, event) {
|
|
434
|
+
this.$emit('change', {
|
|
435
|
+
value: newValue,
|
|
436
|
+
// target: target.current,
|
|
437
|
+
event: event
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
calcNewDistance: function calcNewDistance(event) {
|
|
441
|
+
if (!this.sliderTrackWrapRef) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
event.originalEvent.preventDefault();
|
|
446
|
+
var computed = this.sliderTrackWrapRef.getBoundingClientRect();
|
|
447
|
+
var distance = this.$props.vertical ? computed.bottom - event.clientY : this.currentDir === 'rtl' ? computed.right - event.clientX : event.clientX - computed.left;
|
|
448
|
+
var size = this.$props.vertical ? computed.height : computed.width;
|
|
449
|
+
var percentage = distance / size;
|
|
450
|
+
var payload = this.min + percentage * (this.max - this.min);
|
|
451
|
+
return payload;
|
|
452
|
+
},
|
|
453
|
+
calcKey: function calcKey(payload) {
|
|
454
|
+
if (payload <= this.computedValue.start) {
|
|
455
|
+
return 'start';
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (payload >= this.computedValue.end) {
|
|
459
|
+
return 'end';
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return 2 * payload < this.computedValue.end + this.computedValue.start ? 'start' : 'end';
|
|
463
|
+
},
|
|
464
|
+
handleStartKeyDown: function handleStartKeyDown(event) {
|
|
465
|
+
switch (event.keyCode) {
|
|
466
|
+
case kendo_vue_common_1.Keys.right:
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
this.dispatchStateValue({
|
|
469
|
+
type: this.currentDir === 'rtl' ? range_raducer_1.RANGE_ACTION.decrease : range_raducer_1.RANGE_ACTION.increase,
|
|
470
|
+
key: 'start',
|
|
471
|
+
event: event
|
|
472
|
+
});
|
|
473
|
+
break;
|
|
474
|
+
|
|
475
|
+
case kendo_vue_common_1.Keys.up:
|
|
476
|
+
event.preventDefault();
|
|
477
|
+
this.dispatchStateValue({
|
|
478
|
+
type: range_raducer_1.RANGE_ACTION.increase,
|
|
479
|
+
key: 'start',
|
|
480
|
+
event: event
|
|
481
|
+
});
|
|
482
|
+
break;
|
|
483
|
+
|
|
484
|
+
case kendo_vue_common_1.Keys.left:
|
|
485
|
+
event.preventDefault();
|
|
486
|
+
this.dispatchStateValue({
|
|
487
|
+
type: this.currentDir === 'rtl' ? range_raducer_1.RANGE_ACTION.increase : range_raducer_1.RANGE_ACTION.decrease,
|
|
488
|
+
key: 'start',
|
|
489
|
+
event: event
|
|
490
|
+
});
|
|
491
|
+
break;
|
|
492
|
+
|
|
493
|
+
case kendo_vue_common_1.Keys.down:
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
this.dispatchStateValue({
|
|
496
|
+
type: range_raducer_1.RANGE_ACTION.decrease,
|
|
497
|
+
key: 'start',
|
|
498
|
+
event: event
|
|
499
|
+
});
|
|
500
|
+
break;
|
|
501
|
+
|
|
502
|
+
case kendo_vue_common_1.Keys.home:
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
this.dispatchStateValue({
|
|
505
|
+
type: range_raducer_1.RANGE_ACTION.min,
|
|
506
|
+
key: 'start',
|
|
507
|
+
event: event
|
|
508
|
+
});
|
|
509
|
+
break;
|
|
510
|
+
|
|
511
|
+
case kendo_vue_common_1.Keys.end:
|
|
512
|
+
event.preventDefault();
|
|
513
|
+
this.dispatchStateValue({
|
|
514
|
+
type: range_raducer_1.RANGE_ACTION.max,
|
|
515
|
+
key: 'start',
|
|
516
|
+
event: event
|
|
517
|
+
});
|
|
518
|
+
break;
|
|
519
|
+
|
|
520
|
+
default:
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
handleEndKeyDown: function handleEndKeyDown(event) {
|
|
525
|
+
switch (event.keyCode) {
|
|
526
|
+
case kendo_vue_common_1.Keys.right:
|
|
527
|
+
event.preventDefault();
|
|
528
|
+
this.dispatchStateValue({
|
|
529
|
+
type: this.currentDir === 'rtl' ? range_raducer_1.RANGE_ACTION.decrease : range_raducer_1.RANGE_ACTION.increase,
|
|
530
|
+
key: 'end',
|
|
531
|
+
event: event
|
|
532
|
+
});
|
|
533
|
+
break;
|
|
534
|
+
|
|
535
|
+
case kendo_vue_common_1.Keys.up:
|
|
536
|
+
event.preventDefault();
|
|
537
|
+
this.dispatchStateValue({
|
|
538
|
+
type: range_raducer_1.RANGE_ACTION.increase,
|
|
539
|
+
key: 'end',
|
|
540
|
+
event: event
|
|
541
|
+
});
|
|
542
|
+
break;
|
|
543
|
+
|
|
544
|
+
case kendo_vue_common_1.Keys.left:
|
|
545
|
+
event.preventDefault();
|
|
546
|
+
this.dispatchStateValue({
|
|
547
|
+
type: this.currentDir === 'rtl' ? range_raducer_1.RANGE_ACTION.increase : range_raducer_1.RANGE_ACTION.decrease,
|
|
548
|
+
key: 'end',
|
|
549
|
+
event: event
|
|
550
|
+
});
|
|
551
|
+
break;
|
|
552
|
+
|
|
553
|
+
case kendo_vue_common_1.Keys.down:
|
|
554
|
+
event.preventDefault();
|
|
555
|
+
this.dispatchStateValue({
|
|
556
|
+
type: range_raducer_1.RANGE_ACTION.decrease,
|
|
557
|
+
key: 'end',
|
|
558
|
+
event: event
|
|
559
|
+
});
|
|
560
|
+
break;
|
|
561
|
+
|
|
562
|
+
case kendo_vue_common_1.Keys.home:
|
|
563
|
+
event.preventDefault();
|
|
564
|
+
this.dispatchStateValue({
|
|
565
|
+
type: range_raducer_1.RANGE_ACTION.min,
|
|
566
|
+
key: 'end',
|
|
567
|
+
event: event
|
|
568
|
+
});
|
|
569
|
+
break;
|
|
570
|
+
|
|
571
|
+
case kendo_vue_common_1.Keys.end:
|
|
572
|
+
event.preventDefault();
|
|
573
|
+
this.dispatchStateValue({
|
|
574
|
+
type: range_raducer_1.RANGE_ACTION.max,
|
|
575
|
+
key: 'end',
|
|
576
|
+
event: event
|
|
577
|
+
});
|
|
578
|
+
break;
|
|
579
|
+
|
|
580
|
+
default:
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
handleTrackPress: function handleTrackPress(event) {
|
|
585
|
+
var payload = this.calcNewDistance(event);
|
|
586
|
+
var key = this.calcKey(payload);
|
|
587
|
+
this.currentDrag = key;
|
|
588
|
+
key === 'end' ? this.endHandle.focus() : this.startHandle.focus();
|
|
589
|
+
var action = key === 'end' ? range_raducer_1.RANGE_ACTION.end : range_raducer_1.RANGE_ACTION.start;
|
|
590
|
+
this.dispatchStateValue({
|
|
591
|
+
type: action,
|
|
592
|
+
payload: payload,
|
|
593
|
+
event: event
|
|
594
|
+
});
|
|
595
|
+
},
|
|
596
|
+
handleTrackDrag: function handleTrackDrag(event) {
|
|
597
|
+
var payload = this.calcNewDistance(event);
|
|
598
|
+
var action = this.currentDrag === 'end' ? range_raducer_1.RANGE_ACTION.end : range_raducer_1.RANGE_ACTION.start;
|
|
599
|
+
this.dispatchStateValue({
|
|
600
|
+
type: action,
|
|
601
|
+
payload: payload,
|
|
602
|
+
event: event
|
|
603
|
+
});
|
|
604
|
+
},
|
|
605
|
+
handleTrackRelease: function handleTrackRelease(event) {
|
|
606
|
+
var payload = this.calcNewDistance(event);
|
|
607
|
+
var action = this.currentDrag === 'end' ? range_raducer_1.RANGE_ACTION.end : range_raducer_1.RANGE_ACTION.start;
|
|
608
|
+
this.dispatchStateValue({
|
|
609
|
+
type: action,
|
|
610
|
+
payload: payload,
|
|
611
|
+
event: event
|
|
612
|
+
});
|
|
613
|
+
this.currentDrag = '';
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
exports.RangeSliderVue2 = RangeSliderVue2;
|
|
618
|
+
var RangeSlider = RangeSliderVue2;
|
|
619
|
+
exports.RangeSlider = RangeSlider;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Range } from './RangeSlider';
|
|
2
|
+
import { DraggableDragEvent } from '@progress/kendo-vue-common';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export declare enum RANGE_ACTION {
|
|
7
|
+
start = "start",
|
|
8
|
+
end = "end",
|
|
9
|
+
min = "min",
|
|
10
|
+
max = "max",
|
|
11
|
+
increase = "increase",
|
|
12
|
+
decrease = "decrease"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare type RangeActionDispatch = {
|
|
18
|
+
type: RANGE_ACTION;
|
|
19
|
+
payload?: number;
|
|
20
|
+
key?: string;
|
|
21
|
+
event?: any | DraggableDragEvent;
|
|
22
|
+
state?: Range;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export interface RangeAction extends RangeActionDispatch {
|
|
28
|
+
step: number;
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export declare const rangeReducer: (state: any, action: RangeAction) => any;
|