fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64
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 -1
- package/changelog-setup.js +10 -10
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +40 -41
- 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 +57 -61
- 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 +186 -187
- 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 +29 -30
- 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 +22 -23
- 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 +293 -337
- 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 +33 -35
- 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 +74 -81
- 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 +141 -146
- 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 +80 -81
- 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 +27 -28
- 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 +62 -72
- 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 +51 -55
- 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 +33 -34
- 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 +96 -109
- 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 +44 -45
- 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 +56 -64
- 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 +16 -17
- 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 +143 -148
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +24 -25
- 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 +42 -43
- 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 +57 -66
- 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 +32 -33
- 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 +38 -45
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +76 -77
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +1753 -1884
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +56 -60
- package/src/definitions/behaviors/form.js +140 -145
- package/src/definitions/behaviors/state.js +23 -24
- package/src/definitions/behaviors/visibility.js +75 -76
- package/src/definitions/globals/site.js +15 -16
- package/src/definitions/modules/accordion.js +39 -40
- package/src/definitions/modules/calendar.js +185 -186
- package/src/definitions/modules/checkbox.js +28 -29
- package/src/definitions/modules/dimmer.js +21 -22
- package/src/definitions/modules/dropdown.js +292 -336
- package/src/definitions/modules/embed.js +32 -34
- package/src/definitions/modules/flyout.js +73 -80
- package/src/definitions/modules/modal.js +79 -80
- package/src/definitions/modules/nag.js +26 -27
- package/src/definitions/modules/popup.js +61 -71
- package/src/definitions/modules/progress.js +50 -54
- package/src/definitions/modules/rating.js +32 -33
- package/src/definitions/modules/search.js +95 -108
- package/src/definitions/modules/shape.js +43 -44
- package/src/definitions/modules/sidebar.js +55 -63
- package/src/definitions/modules/slider.js +142 -147
- package/src/definitions/modules/sticky.js +41 -42
- package/src/definitions/modules/tab.js +56 -65
- package/src/definitions/modules/toast.js +31 -32
- package/src/definitions/modules/transition.js +37 -44
- package/tasks/admin/components/create.js +11 -11
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +24 -36
- package/tasks/admin/distributions/init.js +11 -12
- package/tasks/admin/distributions/update.js +18 -19
- package/tasks/admin/register.js +7 -7
- package/tasks/build/assets.js +1 -1
- package/tasks/build/css.js +1 -1
- package/tasks/build/javascript.js +1 -1
- package/tasks/config/admin/github.js +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/project/config.js +6 -6
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +5 -11
- package/tasks/config/tasks.js +5 -5
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +11 -12
- package/tasks/install.js +9 -9
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +18 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Slider
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.slider = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $document = $(document);
|
|
25
|
+
const $window = $(window);
|
|
26
26
|
|
|
27
27
|
let time = Date.now();
|
|
28
28
|
let performance = [];
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const parameters = args[0];
|
|
31
|
+
const methodInvoked = typeof parameters === 'string';
|
|
32
|
+
const queryArguments = args.slice(1);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const SINGLE_STEP = 1;
|
|
35
|
+
const BIG_STEP = 2;
|
|
36
|
+
const NO_STEP = 0;
|
|
37
|
+
const SINGLE_BACKSTEP = -1;
|
|
38
|
+
const BIG_BACKSTEP = -2;
|
|
39
39
|
|
|
40
40
|
// Used to manage document bound events.
|
|
41
41
|
// Use this so that we can distinguish between which document events are bound to which range.
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
let returnedValue;
|
|
45
45
|
|
|
46
46
|
$allModules.each(function () {
|
|
47
|
-
|
|
47
|
+
const settings = $.isPlainObject(parameters)
|
|
48
48
|
? $.extend(true, {}, $.fn.slider.settings, parameters)
|
|
49
49
|
: $.extend({}, $.fn.slider.settings);
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
const className = settings.className;
|
|
52
|
+
const metadata = settings.metadata;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
|
+
const error = settings.error;
|
|
55
|
+
const keys = settings.keys;
|
|
56
|
+
const interpretLabel = settings.interpretLabel;
|
|
57
57
|
|
|
58
58
|
let isHover = false;
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const eventNamespace = '.' + namespace;
|
|
60
|
+
const moduleNamespace = 'module-' + namespace;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
const $module = $(this);
|
|
63
63
|
let $currThumb;
|
|
64
64
|
let touchIdentifier;
|
|
65
65
|
let $thumb;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
let $trackFill;
|
|
69
69
|
let $labels;
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
const element = this;
|
|
72
72
|
let instance = $module.data(moduleNamespace);
|
|
73
73
|
|
|
74
74
|
let documentEventID;
|
|
@@ -82,9 +82,8 @@
|
|
|
82
82
|
|
|
83
83
|
let initialPosition;
|
|
84
84
|
let initialLoad;
|
|
85
|
-
let module;
|
|
86
85
|
|
|
87
|
-
module = {
|
|
86
|
+
const module = {
|
|
88
87
|
|
|
89
88
|
initialize: function () {
|
|
90
89
|
module.debug('Initializing slider', settings);
|
|
@@ -178,13 +177,13 @@
|
|
|
178
177
|
}
|
|
179
178
|
},
|
|
180
179
|
customLabel: function () {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
const $children = $labels.find('.label');
|
|
181
|
+
const numChildren = $children.length;
|
|
182
|
+
const min = module.get.min();
|
|
183
|
+
const max = module.get.max();
|
|
185
184
|
let ratio;
|
|
186
185
|
$children.each(function (index) {
|
|
187
|
-
|
|
186
|
+
const $child = $(this);
|
|
188
187
|
let attrValue = $child.attr('data-value');
|
|
189
188
|
if (attrValue) {
|
|
190
189
|
attrValue = attrValue > max
|
|
@@ -204,20 +203,20 @@
|
|
|
204
203
|
} else {
|
|
205
204
|
$labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
|
|
206
205
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
const step = module.get.step();
|
|
207
|
+
const precision = module.get.precision();
|
|
208
|
+
const len = module.get.numLabels();
|
|
209
|
+
const ignoreLabels = len - (settings.autoAdjustLabels !== 'fixed' ? 0 : module.get.max().toString().length + 4);
|
|
211
210
|
for (let i = 0; i <= len; i++) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
const stepValue = Math.round(((i * (step === 0 ? 1 : step)) + module.get.min()) * precision) / precision;
|
|
212
|
+
const labelText = module.get.label(i, stepValue);
|
|
213
|
+
const showLabel = settings.restrictedLabels.length === 0 || settings.restrictedLabels.includes(labelText);
|
|
214
|
+
const $label = labelText !== '' && (showLabel || settings.showLabelTicks === 'always')
|
|
216
215
|
? ((!(i % module.get.gapRatio()) && i < ignoreLabels) || i === len
|
|
217
216
|
? $('<li/>', { class: className.label, 'data-value': stepValue, html: showLabel ? labelText : '' })
|
|
218
217
|
: $('<li/>', { class: 'halftick label', 'data-value': stepValue }))
|
|
219
218
|
: null;
|
|
220
|
-
|
|
219
|
+
const ratio = i / len;
|
|
221
220
|
if ($label) {
|
|
222
221
|
module.update.labelPosition(ratio, $label);
|
|
223
222
|
$labels.append($label);
|
|
@@ -302,8 +301,8 @@
|
|
|
302
301
|
down: function (event) {
|
|
303
302
|
event.preventDefault();
|
|
304
303
|
if (module.is.range()) {
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
const eventPos = module.determine.eventPos(event);
|
|
305
|
+
const newPos = module.determine.pos(eventPos);
|
|
307
306
|
// Special handling if range mode and both thumbs have the same value
|
|
308
307
|
if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
|
|
309
308
|
initialPosition = newPos;
|
|
@@ -331,7 +330,7 @@
|
|
|
331
330
|
return;
|
|
332
331
|
}
|
|
333
332
|
$currThumb = $(event.target);
|
|
334
|
-
|
|
333
|
+
const touchEvent = event.touches ? event : event.originalEvent;
|
|
335
334
|
touchIdentifier = touchEvent.targetTouches[0].identifier;
|
|
336
335
|
if (previousValue === undefined) {
|
|
337
336
|
previousValue = module.get.currentThumbValue();
|
|
@@ -347,13 +346,13 @@
|
|
|
347
346
|
}
|
|
348
347
|
let value = module.determine.valueFromEvent(event);
|
|
349
348
|
if (event.type === 'mousemove' && $currThumb === undefined) {
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
const eventPos = module.determine.eventPos(event);
|
|
350
|
+
const newPos = module.determine.pos(eventPos);
|
|
352
351
|
$currThumb = initialPosition > newPos ? $thumb : $secondThumb;
|
|
353
352
|
}
|
|
354
353
|
if (module.is.range() && (settings.minRange || settings.maxRange)) {
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
const currentRangeDiff = module.get.currentRangeDiff(value);
|
|
355
|
+
const isSecondThumb = $currThumb.hasClass('second');
|
|
357
356
|
if ((settings.minRange && currentRangeDiff < settings.minRange)
|
|
358
357
|
|| (settings.maxRange && currentRangeDiff > settings.maxRange)
|
|
359
358
|
|| (settings.preventCrossover && !isSecondThumb && value > module.secondThumbVal)
|
|
@@ -399,7 +398,7 @@
|
|
|
399
398
|
if ($currThumb === undefined) {
|
|
400
399
|
$currThumb = value <= module.get.currentThumbValue() ? $thumb : $secondThumb;
|
|
401
400
|
}
|
|
402
|
-
|
|
401
|
+
const currentRangeDiff = module.get.currentRangeDiff(value);
|
|
403
402
|
if (settings.minRange && currentRangeDiff < settings.minRange) {
|
|
404
403
|
value = module.get.edgeValue(value, settings.minRange);
|
|
405
404
|
} else if (settings.maxRange && currentRangeDiff > settings.maxRange) {
|
|
@@ -432,7 +431,7 @@
|
|
|
432
431
|
$document.trigger(event);
|
|
433
432
|
}
|
|
434
433
|
if (first || module.is.focused()) {
|
|
435
|
-
|
|
434
|
+
const step = module.determine.keyMovement(event);
|
|
436
435
|
if (step !== NO_STEP) {
|
|
437
436
|
event.preventDefault();
|
|
438
437
|
switch (step) {
|
|
@@ -495,14 +494,14 @@
|
|
|
495
494
|
if (!multiplier) {
|
|
496
495
|
multiplier = 1;
|
|
497
496
|
}
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
const step = module.get.step();
|
|
498
|
+
const currValue = module.get.currentThumbValue();
|
|
500
499
|
module.verbose('Taking a step');
|
|
501
500
|
if (step > 0) {
|
|
502
501
|
module.set.value(currValue + step * multiplier);
|
|
503
502
|
} else if (step === 0) {
|
|
504
|
-
|
|
505
|
-
|
|
503
|
+
const precision = module.get.precision();
|
|
504
|
+
const newValue = currValue + (multiplier / precision);
|
|
506
505
|
module.set.value(Math.round(newValue * precision) / precision);
|
|
507
506
|
}
|
|
508
507
|
},
|
|
@@ -511,14 +510,14 @@
|
|
|
511
510
|
if (!multiplier) {
|
|
512
511
|
multiplier = 1;
|
|
513
512
|
}
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
const step = module.get.step();
|
|
514
|
+
const currValue = module.get.currentThumbValue();
|
|
516
515
|
module.verbose('Going back a step');
|
|
517
516
|
if (step > 0) {
|
|
518
517
|
module.set.value(currValue - step * multiplier);
|
|
519
518
|
} else if (step === 0) {
|
|
520
|
-
|
|
521
|
-
|
|
519
|
+
const precision = module.get.precision();
|
|
520
|
+
const newValue = currValue - (multiplier / precision);
|
|
522
521
|
module.set.value(Math.round(newValue * precision) / precision);
|
|
523
522
|
}
|
|
524
523
|
},
|
|
@@ -659,14 +658,14 @@
|
|
|
659
658
|
precision: function () {
|
|
660
659
|
if (module.cache.precision === undefined) {
|
|
661
660
|
let decimalPlaces;
|
|
662
|
-
|
|
661
|
+
const step = module.get.step();
|
|
663
662
|
if (step !== 0) {
|
|
664
|
-
|
|
663
|
+
const split = String(step).split('.');
|
|
665
664
|
decimalPlaces = split.length === 2 ? split[1].length : 0;
|
|
666
665
|
} else {
|
|
667
666
|
decimalPlaces = settings.decimalPlaces;
|
|
668
667
|
}
|
|
669
|
-
|
|
668
|
+
const precision = 10 ** decimalPlaces;
|
|
670
669
|
module.debug('Precision determined', precision);
|
|
671
670
|
module.cache.precision = precision;
|
|
672
671
|
}
|
|
@@ -678,11 +677,11 @@
|
|
|
678
677
|
},
|
|
679
678
|
max: function () {
|
|
680
679
|
if (module.cache.max === undefined) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
680
|
+
const step = module.get.step();
|
|
681
|
+
const min = module.get.min();
|
|
682
|
+
const precision = module.get.precision();
|
|
683
|
+
const quotient = step === 0 ? 0 : Math.floor(Math.round(((settings.max - min) / step) * precision) / precision);
|
|
684
|
+
const remainder = step === 0 ? 0 : (settings.max - min) % step;
|
|
686
685
|
if (remainder > 0) {
|
|
687
686
|
module.debug('Max value not divisible by given step. Increasing max value.', settings.max, step);
|
|
688
687
|
}
|
|
@@ -696,9 +695,9 @@
|
|
|
696
695
|
},
|
|
697
696
|
numLabels: function () {
|
|
698
697
|
if (module.cache.numLabels === undefined) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
698
|
+
const step = module.get.step();
|
|
699
|
+
const precision = module.get.precision();
|
|
700
|
+
const value = Math.round(((module.get.max() - module.get.min()) / (step === 0 ? 1 : step)) * precision) / precision;
|
|
702
701
|
module.debug('Determined that there should be ' + value + ' labels');
|
|
703
702
|
module.cache.numLabels = value;
|
|
704
703
|
}
|
|
@@ -724,8 +723,8 @@
|
|
|
724
723
|
return value;
|
|
725
724
|
}
|
|
726
725
|
let letterLabel = '';
|
|
727
|
-
|
|
728
|
-
|
|
726
|
+
const letters = Array.isArray(settings.letters) ? settings.letters : [...String(settings.letters)];
|
|
727
|
+
const lettersLen = letters.length;
|
|
729
728
|
|
|
730
729
|
while (stepValue >= 0) {
|
|
731
730
|
letterLabel = letters[stepValue % lettersLen] + letterLabel;
|
|
@@ -787,9 +786,9 @@
|
|
|
787
786
|
let gapRatio = 1;
|
|
788
787
|
|
|
789
788
|
if (settings.autoAdjustLabels) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
789
|
+
const numLabels = module.get.numLabels();
|
|
790
|
+
const primePlus = module.is.prime(numLabels) ? 1 : 0;
|
|
791
|
+
const trackLength = module.get.trackLength();
|
|
793
792
|
let gapCounter = 1;
|
|
794
793
|
|
|
795
794
|
// While the distance between two labels is too short,
|
|
@@ -816,10 +815,10 @@
|
|
|
816
815
|
: pagePos - module.get.trackOffset() - module.get.trackStartPos();
|
|
817
816
|
},
|
|
818
817
|
closestThumb: function (eventPos) {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
818
|
+
const thumbPos = parseFloat(module.determine.thumbPos($thumb));
|
|
819
|
+
const thumbDelta = Math.abs(eventPos - thumbPos);
|
|
820
|
+
const secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb));
|
|
821
|
+
const secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
|
823
822
|
if (thumbDelta === secondThumbDelta && module.get.thumbValue() === module.get.min()) {
|
|
824
823
|
return $secondThumb;
|
|
825
824
|
}
|
|
@@ -827,10 +826,10 @@
|
|
|
827
826
|
return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
|
|
828
827
|
},
|
|
829
828
|
closestThumbPos: function (eventPos) {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
829
|
+
const thumbPos = parseFloat(module.determine.thumbPos($thumb));
|
|
830
|
+
const thumbDelta = Math.abs(eventPos - thumbPos);
|
|
831
|
+
const secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb));
|
|
832
|
+
const secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
|
834
833
|
|
|
835
834
|
return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
|
|
836
835
|
},
|
|
@@ -840,30 +839,30 @@
|
|
|
840
839
|
: (module.is.reversed() ? $element.css('right') : $element.css('left'));
|
|
841
840
|
},
|
|
842
841
|
positionFromValue: function (val) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
842
|
+
const min = module.get.min();
|
|
843
|
+
const max = module.get.max();
|
|
844
|
+
const value = val > max
|
|
846
845
|
? max
|
|
847
846
|
: Math.max(val, min);
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
847
|
+
const trackLength = module.get.trackLength();
|
|
848
|
+
const ratio = (value - min) / (max - min);
|
|
849
|
+
const position = Math.round(ratio * trackLength);
|
|
851
850
|
module.verbose('Determined position: ' + position + ' from value: ' + value);
|
|
852
851
|
|
|
853
852
|
return position;
|
|
854
853
|
},
|
|
855
854
|
positionFromRatio: function (ratio) {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
855
|
+
const trackLength = module.get.trackLength();
|
|
856
|
+
const step = module.get.step();
|
|
857
|
+
const position = Math.round(ratio * trackLength);
|
|
858
|
+
const adjustedPos = step === 0 ? position : Math.round(position / step) * step;
|
|
860
859
|
module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
|
|
861
860
|
|
|
862
861
|
return adjustedPos;
|
|
863
862
|
},
|
|
864
863
|
valueFromEvent: function (event) {
|
|
865
|
-
|
|
866
|
-
|
|
864
|
+
const eventPos = module.determine.eventPos(event);
|
|
865
|
+
const newPos = module.determine.pos(eventPos);
|
|
867
866
|
let value;
|
|
868
867
|
if (eventPos < module.get.trackOffset()) {
|
|
869
868
|
value = module.is.reversed() ? module.get.max() : module.get.min();
|
|
@@ -876,13 +875,12 @@
|
|
|
876
875
|
return value;
|
|
877
876
|
},
|
|
878
877
|
smoothValueFromEvent: function (event) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
878
|
+
const min = module.get.min();
|
|
879
|
+
const max = module.get.max();
|
|
880
|
+
const trackLength = module.get.trackLength();
|
|
881
|
+
const eventPos = module.determine.eventPos(event);
|
|
883
882
|
let newPos = eventPos - module.get.trackOffset();
|
|
884
883
|
let ratio;
|
|
885
|
-
let value;
|
|
886
884
|
newPos = newPos < 0
|
|
887
885
|
? 0
|
|
888
886
|
: Math.min(newPos, trackLength);
|
|
@@ -890,13 +888,12 @@
|
|
|
890
888
|
if (module.is.reversed()) {
|
|
891
889
|
ratio = 1 - ratio;
|
|
892
890
|
}
|
|
893
|
-
value = ratio * (max - min) + min;
|
|
894
891
|
|
|
895
|
-
return
|
|
892
|
+
return ratio * (max - min) + min;
|
|
896
893
|
},
|
|
897
894
|
eventPos: function (event) {
|
|
898
895
|
if (event.type === 'touchmove' || event.type === 'touchend') {
|
|
899
|
-
|
|
896
|
+
const touchEvent = event.touches ? event : event.originalEvent;
|
|
900
897
|
let touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
|
|
901
898
|
for (const t of touchEvent.touches) {
|
|
902
899
|
if (t.identifier === touchIdentifier) {
|
|
@@ -905,25 +902,25 @@
|
|
|
905
902
|
break;
|
|
906
903
|
}
|
|
907
904
|
}
|
|
908
|
-
|
|
909
|
-
|
|
905
|
+
const touchY = touch.pageY;
|
|
906
|
+
const touchX = touch.pageX;
|
|
910
907
|
|
|
911
908
|
return module.is.vertical() ? touchY : touchX;
|
|
912
909
|
}
|
|
913
|
-
|
|
914
|
-
|
|
910
|
+
const clickY = event.pageY || event.originalEvent.pageY;
|
|
911
|
+
const clickX = event.pageX || event.originalEvent.pageX;
|
|
915
912
|
|
|
916
913
|
return module.is.vertical() ? clickY : clickX;
|
|
917
914
|
},
|
|
918
915
|
value: function (position) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
916
|
+
const precision = module.get.precision();
|
|
917
|
+
const startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos();
|
|
918
|
+
const endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos();
|
|
919
|
+
const ratio = (position - startPos) / (endPos - startPos);
|
|
920
|
+
const range = module.get.max() - module.get.min();
|
|
921
|
+
const step = module.get.step();
|
|
922
|
+
const value = ratio * range;
|
|
923
|
+
const difference = step === 0 ? value : Math.round(value / step) * step;
|
|
927
924
|
module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
|
|
928
925
|
if (value !== difference) {
|
|
929
926
|
module.verbose('Rounding value to closest step: ' + difference);
|
|
@@ -935,17 +932,17 @@
|
|
|
935
932
|
return Math.round((difference + module.get.min()) * precision) / precision;
|
|
936
933
|
},
|
|
937
934
|
keyMovement: function (event) {
|
|
938
|
-
|
|
939
|
-
|
|
935
|
+
const key = event.which;
|
|
936
|
+
const downArrow = module.is.vertical()
|
|
940
937
|
? (module.is.reversed() ? keys.downArrow : keys.upArrow)
|
|
941
938
|
: keys.downArrow;
|
|
942
|
-
|
|
939
|
+
const upArrow = module.is.vertical()
|
|
943
940
|
? (module.is.reversed() ? keys.upArrow : keys.downArrow)
|
|
944
941
|
: keys.upArrow;
|
|
945
|
-
|
|
942
|
+
const leftArrow = !module.is.vertical()
|
|
946
943
|
? (module.is.reversed() ? keys.rightArrow : keys.leftArrow)
|
|
947
944
|
: keys.leftArrow;
|
|
948
|
-
|
|
945
|
+
const rightArrow = !module.is.vertical()
|
|
949
946
|
? (module.is.reversed() ? keys.leftArrow : keys.rightArrow)
|
|
950
947
|
: keys.rightArrow;
|
|
951
948
|
if (key === downArrow || key === leftArrow) {
|
|
@@ -966,30 +963,28 @@
|
|
|
966
963
|
},
|
|
967
964
|
|
|
968
965
|
handleNewValuePosition: function (val) {
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
let newPos;
|
|
966
|
+
const min = module.get.min();
|
|
967
|
+
const max = module.get.max();
|
|
972
968
|
if (val <= min) {
|
|
973
969
|
val = min;
|
|
974
970
|
} else if (val >= max) {
|
|
975
971
|
val = max;
|
|
976
972
|
}
|
|
977
|
-
newPos = module.determine.positionFromValue(val);
|
|
978
973
|
|
|
979
|
-
return
|
|
974
|
+
return module.determine.positionFromValue(val);
|
|
980
975
|
},
|
|
981
976
|
|
|
982
977
|
set: {
|
|
983
978
|
active: function (thumbVal, secondThumbVal) {
|
|
984
979
|
if (settings.highlightRange) {
|
|
985
980
|
if (secondThumbVal < thumbVal) {
|
|
986
|
-
|
|
981
|
+
const tempVal = secondThumbVal;
|
|
987
982
|
secondThumbVal = thumbVal;
|
|
988
983
|
thumbVal = tempVal;
|
|
989
984
|
}
|
|
990
|
-
|
|
985
|
+
const $children = $labels.find('.label');
|
|
991
986
|
$children.each(function (index) {
|
|
992
|
-
|
|
987
|
+
const $child = $(this);
|
|
993
988
|
let attrValue = $child.attr('data-value');
|
|
994
989
|
if (attrValue) {
|
|
995
990
|
attrValue = parseInt(attrValue, 10);
|
|
@@ -1004,7 +999,7 @@
|
|
|
1004
999
|
},
|
|
1005
1000
|
value: function (newValue, fireChange) {
|
|
1006
1001
|
fireChange = fireChange !== false;
|
|
1007
|
-
|
|
1002
|
+
const toReset = previousValue === undefined;
|
|
1008
1003
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
|
1009
1004
|
module.update.value(newValue, function (value, thumbVal, secondThumbVal) {
|
|
1010
1005
|
if ((!initialLoad || settings.fireOnInit) && fireChange) {
|
|
@@ -1021,9 +1016,9 @@
|
|
|
1021
1016
|
rangeValue: function (first, second, fireChange) {
|
|
1022
1017
|
fireChange = fireChange !== false;
|
|
1023
1018
|
if (module.is.range()) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1019
|
+
const min = module.get.min();
|
|
1020
|
+
const max = module.get.max();
|
|
1021
|
+
const toReset = previousValue === undefined;
|
|
1027
1022
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
|
1028
1023
|
if (first <= min) {
|
|
1029
1024
|
first = min;
|
|
@@ -1054,7 +1049,7 @@
|
|
|
1054
1049
|
}
|
|
1055
1050
|
},
|
|
1056
1051
|
position: function (position, which) {
|
|
1057
|
-
|
|
1052
|
+
const thumbVal = module.determine.value(position);
|
|
1058
1053
|
if (which === 'second') {
|
|
1059
1054
|
module.secondThumbVal = thumbVal;
|
|
1060
1055
|
module.update.position(thumbVal, $secondThumb);
|
|
@@ -1069,8 +1064,8 @@
|
|
|
1069
1064
|
|
|
1070
1065
|
update: {
|
|
1071
1066
|
value: function (newValue, callback) {
|
|
1072
|
-
|
|
1073
|
-
|
|
1067
|
+
const min = module.get.min();
|
|
1068
|
+
const max = module.get.max();
|
|
1074
1069
|
if (newValue <= min) {
|
|
1075
1070
|
newValue = min;
|
|
1076
1071
|
} else if (newValue >= max) {
|
|
@@ -1103,12 +1098,12 @@
|
|
|
1103
1098
|
}
|
|
1104
1099
|
},
|
|
1105
1100
|
position: function (newValue, $element) {
|
|
1106
|
-
|
|
1107
|
-
|
|
1101
|
+
const newPos = module.handleNewValuePosition(newValue);
|
|
1102
|
+
const $targetThumb = $element || $currThumb;
|
|
1108
1103
|
let thumbVal = module.thumbVal || module.get.min();
|
|
1109
1104
|
let secondThumbVal = module.secondThumbVal || module.get.min();
|
|
1110
1105
|
if (settings.showThumbTooltip) {
|
|
1111
|
-
|
|
1106
|
+
const precision = module.get.precision();
|
|
1112
1107
|
$targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
|
|
1113
1108
|
}
|
|
1114
1109
|
if (module.is.range()) {
|
|
@@ -1126,11 +1121,11 @@
|
|
|
1126
1121
|
module.set.active(thumbVal, secondThumbVal);
|
|
1127
1122
|
let trackPosValue;
|
|
1128
1123
|
let thumbPosValue;
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1124
|
+
const min = module.get.min();
|
|
1125
|
+
const max = module.get.max();
|
|
1126
|
+
const thumbPosPercent = 100 * ((newValue - min) / (max - min));
|
|
1127
|
+
const trackStartPosPercent = 100 * ((Math.min(thumbVal, secondThumbVal) - min) / (max - min));
|
|
1128
|
+
const trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min));
|
|
1134
1129
|
if (module.is.vertical()) {
|
|
1135
1130
|
if (module.is.reversed()) {
|
|
1136
1131
|
thumbPosValue = { bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto' };
|
|
@@ -1151,15 +1146,15 @@
|
|
|
1151
1146
|
module.debug('Setting slider position to ' + newPos);
|
|
1152
1147
|
},
|
|
1153
1148
|
labelPosition: function (ratio, $label) {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1149
|
+
const startMargin = module.get.trackStartMargin();
|
|
1150
|
+
const endMargin = module.get.trackEndMargin();
|
|
1151
|
+
const posDir = module.is.vertical()
|
|
1157
1152
|
? (module.is.reversed() ? 'bottom' : 'top')
|
|
1158
1153
|
: (module.is.reversed() ? 'right' : 'left');
|
|
1159
|
-
|
|
1154
|
+
const startMarginMod = module.is.reversed() && !module.is.vertical()
|
|
1160
1155
|
? ' - '
|
|
1161
1156
|
: ' + ';
|
|
1162
|
-
|
|
1157
|
+
const position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
|
|
1163
1158
|
$label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
|
|
1164
1159
|
},
|
|
1165
1160
|
},
|
|
@@ -1175,7 +1170,7 @@
|
|
|
1175
1170
|
|
|
1176
1171
|
read: {
|
|
1177
1172
|
metadata: function () {
|
|
1178
|
-
|
|
1173
|
+
const data = {
|
|
1179
1174
|
thumbVal: $module.data(metadata.thumbVal),
|
|
1180
1175
|
secondThumbVal: $module.data(metadata.secondThumbVal),
|
|
1181
1176
|
};
|
|
@@ -1192,7 +1187,7 @@
|
|
|
1192
1187
|
settings: function () {
|
|
1193
1188
|
if (settings.start !== false) {
|
|
1194
1189
|
if (module.is.range()) {
|
|
1195
|
-
|
|
1190
|
+
const rangeDiff = settings.end - settings.start;
|
|
1196
1191
|
if (rangeDiff < 0
|
|
1197
1192
|
|| (settings.minRange && rangeDiff < settings.minRange)
|
|
1198
1193
|
|| (settings.maxRange && rangeDiff > settings.maxRange)
|
|
@@ -1310,7 +1305,7 @@
|
|
|
1310
1305
|
query = query.split(/[ .]/);
|
|
1311
1306
|
maxDepth = query.length - 1;
|
|
1312
1307
|
$.each(query, function (depth, value) {
|
|
1313
|
-
|
|
1308
|
+
const camelCaseValue = depth !== maxDepth
|
|
1314
1309
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
1315
1310
|
: query;
|
|
1316
1311
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|