fomantic-ui 2.10.0-beta.6 → 2.10.0-beta.8
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/.eslintrc.js +0 -10
- package/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +152 -205
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +76 -116
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +58 -91
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +674 -977
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +80 -127
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +192 -274
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +325 -429
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +221 -313
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +67 -97
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +185 -254
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +103 -138
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +89 -139
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +253 -352
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +157 -223
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +122 -163
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +116 -159
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +99 -132
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4100 -5721
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +673 -976
- package/src/definitions/modules/embed.js +79 -126
- package/src/definitions/modules/flyout.js +191 -273
- package/src/definitions/modules/modal.js +220 -312
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +184 -253
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +88 -138
- package/src/definitions/modules/search.js +252 -351
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +98 -131
- package/src/definitions/modules/transition.js +85 -140
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +71 -98
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.8+62e258f - Slider
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -20,73 +20,69 @@
|
|
20
20
|
: globalThis;
|
21
21
|
|
22
22
|
$.fn.slider = function (parameters) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
$window = $(window),
|
23
|
+
let $allModules = $(this);
|
24
|
+
let $document = $(document);
|
25
|
+
let $window = $(window);
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
let time = Date.now();
|
28
|
+
let performance = [];
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
let query = arguments[0];
|
31
|
+
let methodInvoked = typeof query === 'string';
|
32
|
+
let queryArguments = [].slice.call(arguments, 1);
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
let SINGLE_STEP = 1;
|
35
|
+
let BIG_STEP = 2;
|
36
|
+
let NO_STEP = 0;
|
37
|
+
let SINGLE_BACKSTEP = -1;
|
38
|
+
let BIG_BACKSTEP = -2;
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
// Used to manage document bound events.
|
41
|
+
// Use this so that we can distinguish between which document events are bound to which range.
|
42
|
+
let currentRange = 0;
|
44
43
|
|
45
|
-
|
46
|
-
;
|
44
|
+
let returnedValue;
|
47
45
|
|
48
46
|
$allModules.each(function () {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
module
|
89
|
-
;
|
47
|
+
let settings = $.isPlainObject(parameters)
|
48
|
+
? $.extend(true, {}, $.fn.slider.settings, parameters)
|
49
|
+
: $.extend({}, $.fn.slider.settings);
|
50
|
+
|
51
|
+
let className = settings.className;
|
52
|
+
let metadata = settings.metadata;
|
53
|
+
let namespace = settings.namespace;
|
54
|
+
let error = settings.error;
|
55
|
+
let keys = settings.keys;
|
56
|
+
let interpretLabel = settings.interpretLabel;
|
57
|
+
|
58
|
+
let isHover = false;
|
59
|
+
let eventNamespace = '.' + namespace;
|
60
|
+
let moduleNamespace = 'module-' + namespace;
|
61
|
+
|
62
|
+
let $module = $(this);
|
63
|
+
let $currThumb;
|
64
|
+
let touchIdentifier;
|
65
|
+
let $thumb;
|
66
|
+
let $secondThumb;
|
67
|
+
let $track;
|
68
|
+
let $trackFill;
|
69
|
+
let $labels;
|
70
|
+
|
71
|
+
let element = this;
|
72
|
+
let instance = $module.data(moduleNamespace);
|
73
|
+
|
74
|
+
let documentEventID;
|
75
|
+
|
76
|
+
let value;
|
77
|
+
let position;
|
78
|
+
let secondPos;
|
79
|
+
let offset;
|
80
|
+
let gapRatio = 1;
|
81
|
+
let previousValue;
|
82
|
+
|
83
|
+
let initialPosition;
|
84
|
+
let initialLoad;
|
85
|
+
let module;
|
90
86
|
|
91
87
|
module = {
|
92
88
|
|
@@ -113,8 +109,7 @@
|
|
113
109
|
module.verbose('Storing instance of slider', module);
|
114
110
|
instance = module;
|
115
111
|
$module
|
116
|
-
.data(moduleNamespace, module)
|
117
|
-
;
|
112
|
+
.data(moduleNamespace, module);
|
118
113
|
},
|
119
114
|
|
120
115
|
destroy: function () {
|
@@ -144,8 +139,7 @@
|
|
144
139
|
if (settings.showThumbTooltip) {
|
145
140
|
$thumb
|
146
141
|
.attr('data-position', settings.tooltipConfig.position)
|
147
|
-
.attr('data-variation', settings.tooltipConfig.variation)
|
148
|
-
;
|
142
|
+
.attr('data-variation', settings.tooltipConfig.variation);
|
149
143
|
}
|
150
144
|
$currThumb = $thumb;
|
151
145
|
if (module.is.range()) {
|
@@ -156,8 +150,7 @@
|
|
156
150
|
if (settings.showThumbTooltip) {
|
157
151
|
$secondThumb
|
158
152
|
.attr('data-position', settings.tooltipConfig.position)
|
159
|
-
.attr('data-variation', settings.tooltipConfig.variation)
|
160
|
-
;
|
153
|
+
.attr('data-variation', settings.tooltipConfig.variation);
|
161
154
|
}
|
162
155
|
}
|
163
156
|
$track = $module.find('.track');
|
@@ -185,18 +178,14 @@
|
|
185
178
|
}
|
186
179
|
},
|
187
180
|
customLabel: function () {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
ratio
|
194
|
-
;
|
181
|
+
let $children = $labels.find('.label');
|
182
|
+
let numChildren = $children.length;
|
183
|
+
let min = module.get.min();
|
184
|
+
let max = module.get.max();
|
185
|
+
let ratio;
|
195
186
|
$children.each(function (index) {
|
196
|
-
|
197
|
-
|
198
|
-
attrValue = $child.attr('data-value')
|
199
|
-
;
|
187
|
+
let $child = $(this);
|
188
|
+
let attrValue = $child.attr('data-value');
|
200
189
|
if (attrValue) {
|
201
190
|
attrValue = attrValue > max
|
202
191
|
? max
|
@@ -215,23 +204,20 @@
|
|
215
204
|
} else {
|
216
205
|
$labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
|
217
206
|
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
;
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
: null,
|
233
|
-
ratio = i / len
|
234
|
-
;
|
207
|
+
let step = module.get.step();
|
208
|
+
let precision = module.get.precision();
|
209
|
+
let len = module.get.numLabels();
|
210
|
+
let ignoreLabels = len - (settings.autoAdjustLabels !== 'fixed' ? 0 : module.get.max().toString().length + 4);
|
211
|
+
for (let i = 0; i <= len; i++) {
|
212
|
+
let stepValue = Math.round(((i * (step === 0 ? 1 : step)) + module.get.min()) * precision) / precision;
|
213
|
+
let labelText = module.get.label(i, stepValue);
|
214
|
+
let showLabel = settings.restrictedLabels.length === 0 || settings.restrictedLabels.indexOf(labelText) >= 0;
|
215
|
+
let $label = labelText !== '' && (showLabel || settings.showLabelTicks === 'always')
|
216
|
+
? ((!(i % module.get.gapRatio()) && i < ignoreLabels) || i === len
|
217
|
+
? $('<li/>', { class: className.label, 'data-value': stepValue, html: showLabel ? labelText : '' })
|
218
|
+
: $('<li/>', { class: 'halftick label', 'data-value': stepValue }))
|
219
|
+
: null;
|
220
|
+
let ratio = i / len;
|
235
221
|
if ($label) {
|
236
222
|
module.update.labelPosition(ratio, $label);
|
237
223
|
$labels.append($label);
|
@@ -277,8 +263,7 @@
|
|
277
263
|
.on('touchstart' + eventNamespace, module.event.touchDown)
|
278
264
|
.on('touchmove' + eventNamespace, module.event.move)
|
279
265
|
.on('touchend' + eventNamespace, module.event.up)
|
280
|
-
.on('touchcancel' + eventNamespace, module.event.touchCancel)
|
281
|
-
;
|
266
|
+
.on('touchcancel' + eventNamespace, module.event.touchCancel);
|
282
267
|
},
|
283
268
|
slidingEvents: function () {
|
284
269
|
// these don't need the identifier because we only ever want one of them to be registered with the document
|
@@ -301,8 +286,7 @@
|
|
301
286
|
.off('touchstart' + eventNamespace)
|
302
287
|
.off('touchmove' + eventNamespace)
|
303
288
|
.off('touchend' + eventNamespace)
|
304
|
-
.off('touchcancel' + eventNamespace)
|
305
|
-
;
|
289
|
+
.off('touchcancel' + eventNamespace);
|
306
290
|
$module.off('keydown' + eventNamespace);
|
307
291
|
$module.off('focusout' + eventNamespace);
|
308
292
|
$document.off('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
|
@@ -318,10 +302,8 @@
|
|
318
302
|
down: function (event) {
|
319
303
|
event.preventDefault();
|
320
304
|
if (module.is.range()) {
|
321
|
-
|
322
|
-
|
323
|
-
newPos = module.determine.pos(eventPos)
|
324
|
-
;
|
305
|
+
let eventPos = module.determine.eventPos(event);
|
306
|
+
let newPos = module.determine.pos(eventPos);
|
325
307
|
// Special handling if range mode and both thumbs have the same value
|
326
308
|
if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
|
327
309
|
initialPosition = newPos;
|
@@ -349,7 +331,7 @@
|
|
349
331
|
return;
|
350
332
|
}
|
351
333
|
$currThumb = $(event.target);
|
352
|
-
|
334
|
+
let touchEvent = event.touches ? event : event.originalEvent;
|
353
335
|
touchIdentifier = touchEvent.targetTouches[0].identifier;
|
354
336
|
if (previousValue === undefined) {
|
355
337
|
previousValue = module.get.currentThumbValue();
|
@@ -363,18 +345,15 @@
|
|
363
345
|
// touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
|
364
346
|
return;
|
365
347
|
}
|
366
|
-
|
348
|
+
let value = module.determine.valueFromEvent(event);
|
367
349
|
if (event.type === 'mousemove' && $currThumb === undefined) {
|
368
|
-
|
369
|
-
|
370
|
-
newPos = module.determine.pos(eventPos)
|
371
|
-
;
|
350
|
+
let eventPos = module.determine.eventPos(event);
|
351
|
+
let newPos = module.determine.pos(eventPos);
|
372
352
|
$currThumb = initialPosition > newPos ? $thumb : $secondThumb;
|
373
353
|
}
|
374
354
|
if (module.is.range() && (settings.minRange || settings.maxRange)) {
|
375
|
-
|
376
|
-
|
377
|
-
;
|
355
|
+
let currentRangeDiff = module.get.currentRangeDiff(value);
|
356
|
+
let isSecondThumb = $currThumb.hasClass('second');
|
378
357
|
if ((settings.minRange && currentRangeDiff < settings.minRange)
|
379
358
|
|| (settings.maxRange && currentRangeDiff > settings.maxRange)
|
380
359
|
|| (settings.preventCrossover && !isSecondThumb && value > module.secondThumbVal)
|
@@ -384,11 +363,9 @@
|
|
384
363
|
}
|
385
364
|
}
|
386
365
|
if (module.get.step() === 0 || module.is.smooth()) {
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
thumbSmoothVal = module.determine.smoothValueFromEvent(event)
|
391
|
-
;
|
366
|
+
let thumbVal = module.thumbVal;
|
367
|
+
let secondThumbVal = module.secondThumbVal;
|
368
|
+
let thumbSmoothVal = module.determine.smoothValueFromEvent(event);
|
392
369
|
if (!$currThumb.hasClass('second')) {
|
393
370
|
if (settings.preventCrossover && module.is.range()) {
|
394
371
|
value = Math.min(secondThumbVal, value);
|
@@ -417,12 +394,12 @@
|
|
417
394
|
// touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
|
418
395
|
return;
|
419
396
|
}
|
420
|
-
|
397
|
+
let value = module.determine.valueFromEvent(event);
|
421
398
|
if (module.is.range() && (settings.minRange || settings.maxRange)) {
|
422
399
|
if ($currThumb === undefined) {
|
423
400
|
$currThumb = value <= module.get.currentThumbValue() ? $thumb : $secondThumb;
|
424
401
|
}
|
425
|
-
|
402
|
+
let currentRangeDiff = module.get.currentRangeDiff(value);
|
426
403
|
if (settings.minRange && currentRangeDiff < settings.minRange) {
|
427
404
|
value = module.get.edgeValue(value, settings.minRange);
|
428
405
|
} else if (settings.maxRange && currentRangeDiff > settings.maxRange) {
|
@@ -455,7 +432,7 @@
|
|
455
432
|
$document.trigger(event);
|
456
433
|
}
|
457
434
|
if (first || module.is.focused()) {
|
458
|
-
|
435
|
+
let step = module.determine.keyMovement(event);
|
459
436
|
if (step !== NO_STEP) {
|
460
437
|
event.preventDefault();
|
461
438
|
switch (step) {
|
@@ -517,18 +494,14 @@
|
|
517
494
|
if (!multiplier) {
|
518
495
|
multiplier = 1;
|
519
496
|
}
|
520
|
-
|
521
|
-
|
522
|
-
currValue = module.get.currentThumbValue()
|
523
|
-
;
|
497
|
+
let step = module.get.step();
|
498
|
+
let currValue = module.get.currentThumbValue();
|
524
499
|
module.verbose('Taking a step');
|
525
500
|
if (step > 0) {
|
526
501
|
module.set.value(currValue + step * multiplier);
|
527
502
|
} else if (step === 0) {
|
528
|
-
|
529
|
-
|
530
|
-
newValue = currValue + (multiplier / precision)
|
531
|
-
;
|
503
|
+
let precision = module.get.precision();
|
504
|
+
let newValue = currValue + (multiplier / precision);
|
532
505
|
module.set.value(Math.round(newValue * precision) / precision);
|
533
506
|
}
|
534
507
|
},
|
@@ -537,18 +510,14 @@
|
|
537
510
|
if (!multiplier) {
|
538
511
|
multiplier = 1;
|
539
512
|
}
|
540
|
-
|
541
|
-
|
542
|
-
currValue = module.get.currentThumbValue()
|
543
|
-
;
|
513
|
+
let step = module.get.step();
|
514
|
+
let currValue = module.get.currentThumbValue();
|
544
515
|
module.verbose('Going back a step');
|
545
516
|
if (step > 0) {
|
546
517
|
module.set.value(currValue - step * multiplier);
|
547
518
|
} else if (step === 0) {
|
548
|
-
|
549
|
-
|
550
|
-
newValue = currValue - (multiplier / precision)
|
551
|
-
;
|
519
|
+
let precision = module.get.precision();
|
520
|
+
let newValue = currValue - (multiplier / precision);
|
552
521
|
module.set.value(Math.round(newValue * precision) / precision);
|
553
522
|
}
|
554
523
|
},
|
@@ -556,8 +525,8 @@
|
|
556
525
|
is: {
|
557
526
|
prime: function (n) {
|
558
527
|
if (module.cache['prime' + n] === undefined) {
|
559
|
-
|
560
|
-
for (
|
528
|
+
let p = true;
|
529
|
+
for (let i = 2, s = Math.sqrt(n); i <= s; i++) {
|
561
530
|
if (n % i === 0) {
|
562
531
|
p = false;
|
563
532
|
|
@@ -574,7 +543,7 @@
|
|
574
543
|
return module.cache['prime' + n];
|
575
544
|
},
|
576
545
|
range: function () {
|
577
|
-
|
546
|
+
let isRange = $module.hasClass(className.range);
|
578
547
|
if (!isRange && (settings.minRange || settings.maxRange)) {
|
579
548
|
$module.addClass(className.range);
|
580
549
|
isRange = true;
|
@@ -592,7 +561,7 @@
|
|
592
561
|
return $module.hasClass(className.disabled);
|
593
562
|
},
|
594
563
|
labeled: function () {
|
595
|
-
|
564
|
+
let isLabeled = $module.hasClass(className.labeled);
|
596
565
|
if (!isLabeled && (settings.restrictedLabels.length > 0 || settings.showLabelTicks !== false)) {
|
597
566
|
$module.addClass(className.labeled);
|
598
567
|
isLabeled = true;
|
@@ -613,7 +582,7 @@
|
|
613
582
|
|
614
583
|
get: {
|
615
584
|
currentRangeDiff: function (value) {
|
616
|
-
|
585
|
+
let currentRangeDiff;
|
617
586
|
if ($currThumb.hasClass('second')) {
|
618
587
|
currentRangeDiff = module.thumbVal < value
|
619
588
|
? value - module.thumbVal
|
@@ -667,7 +636,7 @@
|
|
667
636
|
return module.is.reversed() ? module.get.trackLeft() : module.get.trackLeft() + module.get.trackLength();
|
668
637
|
},
|
669
638
|
trackStartMargin: function () {
|
670
|
-
|
639
|
+
let margin;
|
671
640
|
if (module.is.vertical()) {
|
672
641
|
margin = module.is.reversed() ? $module.css('padding-bottom') : $module.css('padding-top');
|
673
642
|
} else {
|
@@ -677,7 +646,7 @@
|
|
677
646
|
return margin || '0px';
|
678
647
|
},
|
679
648
|
trackEndMargin: function () {
|
680
|
-
|
649
|
+
let margin;
|
681
650
|
if (module.is.vertical()) {
|
682
651
|
margin = module.is.reversed() ? $module.css('padding-top') : $module.css('padding-bottom');
|
683
652
|
} else {
|
@@ -688,17 +657,15 @@
|
|
688
657
|
},
|
689
658
|
precision: function () {
|
690
659
|
if (module.cache.precision === undefined) {
|
691
|
-
|
692
|
-
|
693
|
-
step = module.get.step()
|
694
|
-
;
|
660
|
+
let decimalPlaces;
|
661
|
+
let step = module.get.step();
|
695
662
|
if (step !== 0) {
|
696
|
-
|
663
|
+
let split = String(step).split('.');
|
697
664
|
decimalPlaces = split.length === 2 ? split[1].length : 0;
|
698
665
|
} else {
|
699
666
|
decimalPlaces = settings.decimalPlaces;
|
700
667
|
}
|
701
|
-
|
668
|
+
let precision = Math.pow(10, decimalPlaces);
|
702
669
|
module.debug('Precision determined', precision);
|
703
670
|
module.cache.precision = precision;
|
704
671
|
}
|
@@ -710,13 +677,11 @@
|
|
710
677
|
},
|
711
678
|
max: function () {
|
712
679
|
if (module.cache.max === undefined) {
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
remainder = step === 0 ? 0 : (settings.max - min) % step
|
719
|
-
;
|
680
|
+
let step = module.get.step();
|
681
|
+
let min = module.get.min();
|
682
|
+
let precision = module.get.precision();
|
683
|
+
let quotient = step === 0 ? 0 : Math.floor(Math.round(((settings.max - min) / step) * precision) / precision);
|
684
|
+
let remainder = step === 0 ? 0 : (settings.max - min) % step;
|
720
685
|
if (remainder > 0) {
|
721
686
|
module.debug('Max value not divisible by given step. Increasing max value.', settings.max, step);
|
722
687
|
}
|
@@ -730,9 +695,9 @@
|
|
730
695
|
},
|
731
696
|
numLabels: function () {
|
732
697
|
if (module.cache.numLabels === undefined) {
|
733
|
-
|
734
|
-
|
735
|
-
|
698
|
+
let step = module.get.step();
|
699
|
+
let precision = module.get.precision();
|
700
|
+
let value = Math.round(((module.get.max() - module.get.min()) / (step === 0 ? 1 : step)) * precision) / precision;
|
736
701
|
module.debug('Determined that there should be ' + value + ' labels');
|
737
702
|
module.cache.numLabels = value;
|
738
703
|
}
|
@@ -757,10 +722,9 @@
|
|
757
722
|
|
758
723
|
return value;
|
759
724
|
}
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
;
|
725
|
+
let letterLabel = '';
|
726
|
+
let letters = Array.isArray(settings.letters) ? settings.letters : String(settings.letters).split('');
|
727
|
+
let lettersLen = letters.length;
|
764
728
|
|
765
729
|
while (stepValue >= 0) {
|
766
730
|
letterLabel = letters[stepValue % lettersLen] + letterLabel;
|
@@ -819,15 +783,13 @@
|
|
819
783
|
}
|
820
784
|
},
|
821
785
|
gapRatio: function () {
|
822
|
-
|
786
|
+
let gapRatio = 1;
|
823
787
|
|
824
788
|
if (settings.autoAdjustLabels) {
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
gapCounter = 1
|
830
|
-
;
|
789
|
+
let numLabels = module.get.numLabels();
|
790
|
+
let primePlus = module.is.prime(numLabels) ? 1 : 0;
|
791
|
+
let trackLength = module.get.trackLength();
|
792
|
+
let gapCounter = 1;
|
831
793
|
|
832
794
|
// While the distance between two labels is too short,
|
833
795
|
// we divide the number of labels at each iteration
|
@@ -853,12 +815,10 @@
|
|
853
815
|
: pagePos - module.get.trackOffset() - module.get.trackStartPos();
|
854
816
|
},
|
855
817
|
closestThumb: function (eventPos) {
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
secondThumbDelta = Math.abs(eventPos - secondThumbPos)
|
861
|
-
;
|
818
|
+
let thumbPos = parseFloat(module.determine.thumbPos($thumb));
|
819
|
+
let thumbDelta = Math.abs(eventPos - thumbPos);
|
820
|
+
let secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb));
|
821
|
+
let secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
862
822
|
if (thumbDelta === secondThumbDelta && module.get.thumbValue() === module.get.min()) {
|
863
823
|
return $secondThumb;
|
864
824
|
}
|
@@ -866,53 +826,44 @@
|
|
866
826
|
return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
|
867
827
|
},
|
868
828
|
closestThumbPos: function (eventPos) {
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
secondThumbDelta = Math.abs(eventPos - secondThumbPos)
|
874
|
-
;
|
829
|
+
let thumbPos = parseFloat(module.determine.thumbPos($thumb));
|
830
|
+
let thumbDelta = Math.abs(eventPos - thumbPos);
|
831
|
+
let secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb));
|
832
|
+
let secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
875
833
|
|
876
834
|
return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
|
877
835
|
},
|
878
836
|
thumbPos: function ($element) {
|
879
837
|
return module.is.vertical()
|
880
838
|
? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
|
881
|
-
: (module.is.reversed() ? $element.css('right') : $element.css('left'))
|
882
|
-
;
|
839
|
+
: (module.is.reversed() ? $element.css('right') : $element.css('left'));
|
883
840
|
},
|
884
841
|
positionFromValue: function (val) {
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
position = Math.round(ratio * trackLength)
|
894
|
-
;
|
842
|
+
let min = module.get.min();
|
843
|
+
let max = module.get.max();
|
844
|
+
let value = val > max
|
845
|
+
? max
|
846
|
+
: (val < min ? min : val);
|
847
|
+
let trackLength = module.get.trackLength();
|
848
|
+
let ratio = (value - min) / (max - min);
|
849
|
+
let position = Math.round(ratio * trackLength);
|
895
850
|
module.verbose('Determined position: ' + position + ' from value: ' + value);
|
896
851
|
|
897
852
|
return position;
|
898
853
|
},
|
899
854
|
positionFromRatio: function (ratio) {
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
adjustedPos = step === 0 ? position : Math.round(position / step) * step
|
905
|
-
;
|
855
|
+
let trackLength = module.get.trackLength();
|
856
|
+
let step = module.get.step();
|
857
|
+
let position = Math.round(ratio * trackLength);
|
858
|
+
let adjustedPos = step === 0 ? position : Math.round(position / step) * step;
|
906
859
|
module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
|
907
860
|
|
908
861
|
return adjustedPos;
|
909
862
|
},
|
910
863
|
valueFromEvent: function (event) {
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
value
|
915
|
-
;
|
864
|
+
let eventPos = module.determine.eventPos(event);
|
865
|
+
let newPos = module.determine.pos(eventPos);
|
866
|
+
let value;
|
916
867
|
if (eventPos < module.get.trackOffset()) {
|
917
868
|
value = module.is.reversed() ? module.get.max() : module.get.min();
|
918
869
|
} else if (eventPos > module.get.trackOffset() + module.get.trackLength()) {
|
@@ -924,15 +875,13 @@
|
|
924
875
|
return value;
|
925
876
|
},
|
926
877
|
smoothValueFromEvent: function (event) {
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
value
|
935
|
-
;
|
878
|
+
let min = module.get.min();
|
879
|
+
let max = module.get.max();
|
880
|
+
let trackLength = module.get.trackLength();
|
881
|
+
let eventPos = module.determine.eventPos(event);
|
882
|
+
let newPos = eventPos - module.get.trackOffset();
|
883
|
+
let ratio;
|
884
|
+
let value;
|
936
885
|
newPos = newPos < 0
|
937
886
|
? 0
|
938
887
|
: (newPos > trackLength ? trackLength : newPos);
|
@@ -946,41 +895,34 @@
|
|
946
895
|
},
|
947
896
|
eventPos: function (event) {
|
948
897
|
if (event.type === 'touchmove' || event.type === 'touchend') {
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
for (var i = 0; i < touchEvent.touches.length; i++) {
|
898
|
+
let touchEvent = event.touches ? event : event.originalEvent;
|
899
|
+
let touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
|
900
|
+
for (let i = 0; i < touchEvent.touches.length; i++) {
|
953
901
|
if (touchEvent.touches[i].identifier === touchIdentifier) {
|
954
902
|
touch = touchEvent.touches[i];
|
955
903
|
|
956
904
|
break;
|
957
905
|
}
|
958
906
|
}
|
959
|
-
|
960
|
-
|
961
|
-
touchX = touch.pageX
|
962
|
-
;
|
907
|
+
let touchY = touch.pageY;
|
908
|
+
let touchX = touch.pageX;
|
963
909
|
|
964
910
|
return module.is.vertical() ? touchY : touchX;
|
965
911
|
}
|
966
|
-
|
967
|
-
|
968
|
-
clickX = event.pageX || event.originalEvent.pageX
|
969
|
-
;
|
912
|
+
let clickY = event.pageY || event.originalEvent.pageY;
|
913
|
+
let clickX = event.pageX || event.originalEvent.pageX;
|
970
914
|
|
971
915
|
return module.is.vertical() ? clickY : clickX;
|
972
916
|
},
|
973
917
|
value: function (position) {
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
difference = step === 0 ? value : Math.round(value / step) * step
|
983
|
-
;
|
918
|
+
let precision = module.get.precision();
|
919
|
+
let startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos();
|
920
|
+
let endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos();
|
921
|
+
let ratio = (position - startPos) / (endPos - startPos);
|
922
|
+
let range = module.get.max() - module.get.min();
|
923
|
+
let step = module.get.step();
|
924
|
+
let value = ratio * range;
|
925
|
+
let difference = step === 0 ? value : Math.round(value / step) * step;
|
984
926
|
module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
|
985
927
|
if (value !== difference) {
|
986
928
|
module.verbose('Rounding value to closest step: ' + difference);
|
@@ -992,21 +934,19 @@
|
|
992
934
|
return Math.round((difference + module.get.min()) * precision) / precision;
|
993
935
|
},
|
994
936
|
keyMovement: function (event) {
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
: keys.rightArrow
|
1009
|
-
;
|
937
|
+
let key = event.which;
|
938
|
+
let downArrow = module.is.vertical()
|
939
|
+
? (module.is.reversed() ? keys.downArrow : keys.upArrow)
|
940
|
+
: keys.downArrow;
|
941
|
+
let upArrow = module.is.vertical()
|
942
|
+
? (module.is.reversed() ? keys.upArrow : keys.downArrow)
|
943
|
+
: keys.upArrow;
|
944
|
+
let leftArrow = !module.is.vertical()
|
945
|
+
? (module.is.reversed() ? keys.rightArrow : keys.leftArrow)
|
946
|
+
: keys.leftArrow;
|
947
|
+
let rightArrow = !module.is.vertical()
|
948
|
+
? (module.is.reversed() ? keys.leftArrow : keys.rightArrow)
|
949
|
+
: keys.rightArrow;
|
1010
950
|
if (key === downArrow || key === leftArrow) {
|
1011
951
|
return SINGLE_BACKSTEP;
|
1012
952
|
}
|
@@ -1025,11 +965,9 @@
|
|
1025
965
|
},
|
1026
966
|
|
1027
967
|
handleNewValuePosition: function (val) {
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
newPos
|
1032
|
-
;
|
968
|
+
let min = module.get.min();
|
969
|
+
let max = module.get.max();
|
970
|
+
let newPos;
|
1033
971
|
if (val <= min) {
|
1034
972
|
val = min;
|
1035
973
|
} else if (val >= max) {
|
@@ -1044,16 +982,14 @@
|
|
1044
982
|
active: function (thumbVal, secondThumbVal) {
|
1045
983
|
if (settings.highlightRange) {
|
1046
984
|
if (secondThumbVal < thumbVal) {
|
1047
|
-
|
985
|
+
let tempVal = secondThumbVal;
|
1048
986
|
secondThumbVal = thumbVal;
|
1049
987
|
thumbVal = tempVal;
|
1050
988
|
}
|
1051
|
-
|
989
|
+
let $children = $labels.find('.label');
|
1052
990
|
$children.each(function (index) {
|
1053
|
-
|
1054
|
-
|
1055
|
-
attrValue = $child.attr('data-value')
|
1056
|
-
;
|
991
|
+
let $child = $(this);
|
992
|
+
let attrValue = $child.attr('data-value');
|
1057
993
|
if (attrValue) {
|
1058
994
|
attrValue = parseInt(attrValue, 10);
|
1059
995
|
if (attrValue >= thumbVal && attrValue <= secondThumbVal) {
|
@@ -1067,7 +1003,7 @@
|
|
1067
1003
|
},
|
1068
1004
|
value: function (newValue, fireChange) {
|
1069
1005
|
fireChange = fireChange !== false;
|
1070
|
-
|
1006
|
+
let toReset = previousValue === undefined;
|
1071
1007
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
1072
1008
|
module.update.value(newValue, function (value, thumbVal, secondThumbVal) {
|
1073
1009
|
if ((!initialLoad || settings.fireOnInit) && fireChange) {
|
@@ -1084,11 +1020,9 @@
|
|
1084
1020
|
rangeValue: function (first, second, fireChange) {
|
1085
1021
|
fireChange = fireChange !== false;
|
1086
1022
|
if (module.is.range()) {
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
toReset = previousValue === undefined
|
1091
|
-
;
|
1023
|
+
let min = module.get.min();
|
1024
|
+
let max = module.get.max();
|
1025
|
+
let toReset = previousValue === undefined;
|
1092
1026
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
1093
1027
|
if (first <= min) {
|
1094
1028
|
first = min;
|
@@ -1119,7 +1053,7 @@
|
|
1119
1053
|
}
|
1120
1054
|
},
|
1121
1055
|
position: function (position, which) {
|
1122
|
-
|
1056
|
+
let thumbVal = module.determine.value(position);
|
1123
1057
|
if (which === 'second') {
|
1124
1058
|
module.secondThumbVal = thumbVal;
|
1125
1059
|
module.update.position(thumbVal, $secondThumb);
|
@@ -1134,10 +1068,8 @@
|
|
1134
1068
|
|
1135
1069
|
update: {
|
1136
1070
|
value: function (newValue, callback) {
|
1137
|
-
|
1138
|
-
|
1139
|
-
max = module.get.max()
|
1140
|
-
;
|
1071
|
+
let min = module.get.min();
|
1072
|
+
let max = module.get.max();
|
1141
1073
|
if (newValue <= min) {
|
1142
1074
|
newValue = min;
|
1143
1075
|
} else if (newValue >= max) {
|
@@ -1170,14 +1102,12 @@
|
|
1170
1102
|
}
|
1171
1103
|
},
|
1172
1104
|
position: function (newValue, $element) {
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
secondThumbVal = module.secondThumbVal || module.get.min()
|
1178
|
-
;
|
1105
|
+
let newPos = module.handleNewValuePosition(newValue);
|
1106
|
+
let $targetThumb = $element || $currThumb;
|
1107
|
+
let thumbVal = module.thumbVal || module.get.min();
|
1108
|
+
let secondThumbVal = module.secondThumbVal || module.get.min();
|
1179
1109
|
if (settings.showThumbTooltip) {
|
1180
|
-
|
1110
|
+
let precision = module.get.precision();
|
1181
1111
|
$targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
|
1182
1112
|
}
|
1183
1113
|
if (module.is.range()) {
|
@@ -1193,15 +1123,13 @@
|
|
1193
1123
|
thumbVal = newValue;
|
1194
1124
|
}
|
1195
1125
|
module.set.active(thumbVal, secondThumbVal);
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min))
|
1204
|
-
;
|
1126
|
+
let trackPosValue;
|
1127
|
+
let thumbPosValue;
|
1128
|
+
let min = module.get.min();
|
1129
|
+
let max = module.get.max();
|
1130
|
+
let thumbPosPercent = 100 * ((newValue - min) / (max - min));
|
1131
|
+
let trackStartPosPercent = 100 * ((Math.min(thumbVal, secondThumbVal) - min) / (max - min));
|
1132
|
+
let trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min));
|
1205
1133
|
if (module.is.vertical()) {
|
1206
1134
|
if (module.is.reversed()) {
|
1207
1135
|
thumbPosValue = { bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto' };
|
@@ -1224,17 +1152,15 @@
|
|
1224
1152
|
module.debug('Setting slider position to ' + newPos);
|
1225
1153
|
},
|
1226
1154
|
labelPosition: function (ratio, $label) {
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
;
|
1237
|
-
var position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
|
1155
|
+
let startMargin = module.get.trackStartMargin();
|
1156
|
+
let endMargin = module.get.trackEndMargin();
|
1157
|
+
let posDir = module.is.vertical()
|
1158
|
+
? (module.is.reversed() ? 'bottom' : 'top')
|
1159
|
+
: (module.is.reversed() ? 'right' : 'left');
|
1160
|
+
let startMarginMod = module.is.reversed() && !module.is.vertical()
|
1161
|
+
? ' - '
|
1162
|
+
: ' + ';
|
1163
|
+
let position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
|
1238
1164
|
$label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
|
1239
1165
|
},
|
1240
1166
|
},
|
@@ -1250,12 +1176,10 @@
|
|
1250
1176
|
|
1251
1177
|
read: {
|
1252
1178
|
metadata: function () {
|
1253
|
-
|
1254
|
-
data
|
1255
|
-
|
1256
|
-
|
1257
|
-
}
|
1258
|
-
;
|
1179
|
+
let data = {
|
1180
|
+
thumbVal: $module.data(metadata.thumbVal),
|
1181
|
+
secondThumbVal: $module.data(metadata.secondThumbVal),
|
1182
|
+
};
|
1259
1183
|
if (data.thumbVal) {
|
1260
1184
|
if (module.is.range() && data.secondThumbVal) {
|
1261
1185
|
module.debug('Current value set from metadata', data.thumbVal, data.secondThumbVal);
|
@@ -1269,7 +1193,7 @@
|
|
1269
1193
|
settings: function () {
|
1270
1194
|
if (settings.start !== false) {
|
1271
1195
|
if (module.is.range()) {
|
1272
|
-
|
1196
|
+
let rangeDiff = settings.end - settings.start;
|
1273
1197
|
if (rangeDiff < 0
|
1274
1198
|
|| (settings.minRange && rangeDiff < settings.minRange)
|
1275
1199
|
|| (settings.maxRange && rangeDiff > settings.maxRange)
|
@@ -1340,11 +1264,9 @@
|
|
1340
1264
|
|
1341
1265
|
performance: {
|
1342
1266
|
log: function (message) {
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
previousTime
|
1347
|
-
;
|
1267
|
+
let currentTime;
|
1268
|
+
let executionTime;
|
1269
|
+
let previousTime;
|
1348
1270
|
if (settings.performance) {
|
1349
1271
|
currentTime = Date.now();
|
1350
1272
|
previousTime = time || currentTime;
|
@@ -1363,10 +1285,8 @@
|
|
1363
1285
|
}, 500);
|
1364
1286
|
},
|
1365
1287
|
display: function () {
|
1366
|
-
|
1367
|
-
|
1368
|
-
totalTime = 0
|
1369
|
-
;
|
1288
|
+
let title = settings.name + ':';
|
1289
|
+
let totalTime = 0;
|
1370
1290
|
time = false;
|
1371
1291
|
clearTimeout(module.performance.timer);
|
1372
1292
|
$.each(performance, function (index, data) {
|
@@ -1389,22 +1309,19 @@
|
|
1389
1309
|
},
|
1390
1310
|
|
1391
1311
|
invoke: function (query, passedArguments, context) {
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
response
|
1397
|
-
;
|
1312
|
+
let object = instance;
|
1313
|
+
let maxDepth;
|
1314
|
+
let found;
|
1315
|
+
let response;
|
1398
1316
|
passedArguments = passedArguments || queryArguments;
|
1399
1317
|
context = context || element;
|
1400
1318
|
if (typeof query === 'string' && object !== undefined) {
|
1401
1319
|
query = query.split(/[ .]/);
|
1402
1320
|
maxDepth = query.length - 1;
|
1403
1321
|
$.each(query, function (depth, value) {
|
1404
|
-
|
1322
|
+
let camelCaseValue = depth !== maxDepth
|
1405
1323
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1406
|
-
: query
|
1407
|
-
;
|
1324
|
+
: query;
|
1408
1325
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
1409
1326
|
object = object[camelCaseValue];
|
1410
1327
|
} else if (object[camelCaseValue] !== undefined) {
|