fomantic-ui 2.10.0-beta.8 → 2.10.0-beta.81
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 +6 -23
- package/.github/workflows/ci.yml +9 -9
- package/.github/workflows/depsreview.yml +1 -1
- package/.github/workflows/nightly.yml +7 -5
- package/.github/workflows/release.yml +2 -2
- package/.stylelintrc.js +1 -15
- package/CHANGELOG.md +5289 -2325
- package/README.md +8 -4
- package/changelog-setup.js +32 -10
- package/changelog-template.hbs +256 -251
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +62 -73
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +3 -3
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +101 -161
- package/dist/components/api.min.js +3 -3
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +5 -6
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +3 -3
- package/dist/components/calendar.js +283 -332
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +3 -3
- 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 +58 -79
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +3 -3
- 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 +2 -2
- package/dist/components/dimmer.js +39 -52
- package/dist/components/dimmer.min.css +2 -2
- package/dist/components/dimmer.min.js +3 -3
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +21 -35
- package/dist/components/dropdown.js +435 -531
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +3 -3
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +55 -68
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +3 -3
- package/dist/components/emoji.css +3809 -7617
- package/dist/components/emoji.min.css +2 -2
- 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 +149 -168
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +3 -3
- package/dist/components/form.css +3 -5
- package/dist/components/form.js +249 -269
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +3 -3
- package/dist/components/grid.css +2 -2
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +6 -6
- package/dist/components/header.min.css +2 -2
- package/dist/components/icon.css +10 -37
- package/dist/components/icon.min.css +2 -2
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +284 -12
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +6 -14
- package/dist/components/label.min.css +2 -2
- package/dist/components/list.css +3 -3
- package/dist/components/list.min.css +2 -2
- package/dist/components/loader.css +53 -53
- package/dist/components/loader.min.css +2 -2
- package/dist/components/menu.css +45 -60
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +2 -2
- package/dist/components/message.min.css +2 -2
- package/dist/components/modal.css +5 -5
- package/dist/components/modal.js +161 -170
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +3 -3
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +74 -88
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +3 -3
- package/dist/components/placeholder.css +2 -2
- package/dist/components/placeholder.min.css +2 -2
- package/dist/components/popup.css +19 -73
- package/dist/components/popup.js +105 -138
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +3 -3
- package/dist/components/progress.css +4 -13
- package/dist/components/progress.js +75 -97
- package/dist/components/progress.min.css +2 -2
- package/dist/components/progress.min.js +3 -3
- 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 +49 -61
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +3 -3
- package/dist/components/reset.css +48 -208
- package/dist/components/reset.min.css +2 -2
- package/dist/components/reveal.css +2 -5
- package/dist/components/reveal.min.css +2 -2
- package/dist/components/search.css +2 -3
- package/dist/components/search.js +178 -198
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +3 -3
- package/dist/components/segment.css +6 -6
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +59 -69
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +3 -3
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +81 -101
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +3 -3
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +37 -58
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +3 -3
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +169 -183
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +3 -3
- package/dist/components/state.js +45 -59
- package/dist/components/state.min.js +3 -3
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +4 -4
- package/dist/components/step.min.css +2 -2
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +95 -117
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +3 -3
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +83 -115
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +3 -3
- package/dist/components/table.css +8 -8
- package/dist/components/table.min.css +2 -2
- 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 +64 -74
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +3 -3
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +61 -85
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +3 -3
- package/dist/components/visibility.js +120 -140
- package/dist/components/visibility.min.js +3 -3
- package/dist/semantic.css +4480 -8222
- package/dist/semantic.js +2886 -3485
- package/dist/semantic.min.css +3 -3
- package/dist/semantic.min.js +3 -3
- package/examples/attached.html +1 -1
- package/examples/components/menu.html +1 -1
- package/package.json +8 -5
- package/scripts/nightly-version.js +4 -4
- package/src/definitions/behaviors/api.js +100 -160
- package/src/definitions/behaviors/form.js +248 -268
- package/src/definitions/behaviors/state.js +44 -58
- package/src/definitions/behaviors/visibility.js +119 -139
- package/src/definitions/collections/breadcrumb.less +0 -1
- package/src/definitions/collections/form.less +3 -9
- package/src/definitions/collections/grid.less +1 -2
- package/src/definitions/collections/menu.less +106 -117
- package/src/definitions/collections/message.less +1 -2
- package/src/definitions/collections/table.less +7 -8
- package/src/definitions/elements/button.less +4 -6
- package/src/definitions/elements/container.less +0 -1
- package/src/definitions/elements/divider.less +1 -2
- package/src/definitions/elements/emoji.less +1 -1
- package/src/definitions/elements/flag.less +1 -1
- package/src/definitions/elements/header.less +4 -5
- package/src/definitions/elements/icon.less +10 -37
- package/src/definitions/elements/image.less +0 -1
- package/src/definitions/elements/input.less +4 -7
- package/src/definitions/elements/label.less +5 -14
- package/src/definitions/elements/list.less +2 -3
- package/src/definitions/elements/loader.less +10 -11
- package/src/definitions/elements/placeholder.less +1 -2
- package/src/definitions/elements/rail.less +0 -1
- package/src/definitions/elements/reveal.less +1 -5
- package/src/definitions/elements/segment.less +5 -6
- package/src/definitions/elements/step.less +3 -4
- package/src/definitions/elements/text.less +0 -1
- package/src/definitions/globals/reset.less +0 -1
- package/src/definitions/globals/site.js +36 -57
- package/src/definitions/globals/site.less +0 -1
- package/src/definitions/modules/accordion.js +61 -72
- package/src/definitions/modules/accordion.less +0 -1
- package/src/definitions/modules/calendar.js +282 -331
- package/src/definitions/modules/calendar.less +2 -3
- package/src/definitions/modules/checkbox.js +57 -78
- package/src/definitions/modules/checkbox.less +0 -1
- package/src/definitions/modules/dimmer.js +38 -51
- package/src/definitions/modules/dimmer.less +1 -2
- package/src/definitions/modules/dropdown.js +434 -530
- package/src/definitions/modules/dropdown.less +27 -38
- package/src/definitions/modules/embed.js +54 -67
- package/src/definitions/modules/embed.less +0 -1
- package/src/definitions/modules/flyout.js +148 -167
- package/src/definitions/modules/flyout.less +0 -1
- package/src/definitions/modules/modal.js +160 -169
- package/src/definitions/modules/modal.less +3 -4
- package/src/definitions/modules/nag.js +73 -87
- package/src/definitions/modules/nag.less +0 -1
- package/src/definitions/modules/popup.js +104 -137
- package/src/definitions/modules/popup.less +18 -73
- package/src/definitions/modules/progress.js +74 -96
- package/src/definitions/modules/progress.less +3 -13
- package/src/definitions/modules/rating.js +48 -60
- package/src/definitions/modules/rating.less +0 -1
- package/src/definitions/modules/search.js +177 -197
- package/src/definitions/modules/search.less +2 -4
- package/src/definitions/modules/shape.js +58 -68
- package/src/definitions/modules/shape.less +0 -1
- package/src/definitions/modules/sidebar.js +80 -100
- package/src/definitions/modules/sidebar.less +0 -1
- package/src/definitions/modules/slider.js +168 -182
- package/src/definitions/modules/slider.less +0 -1
- package/src/definitions/modules/sticky.js +94 -116
- package/src/definitions/modules/sticky.less +0 -1
- package/src/definitions/modules/tab.js +82 -114
- package/src/definitions/modules/tab.less +0 -1
- package/src/definitions/modules/toast.js +63 -73
- package/src/definitions/modules/toast.less +0 -1
- package/src/definitions/modules/transition.js +60 -84
- package/src/definitions/modules/transition.less +1 -2
- package/src/definitions/views/ad.less +0 -1
- package/src/definitions/views/card.less +0 -1
- package/src/definitions/views/comment.less +0 -1
- package/src/definitions/views/feed.less +0 -1
- package/src/definitions/views/item.less +0 -1
- package/src/definitions/views/statistic.less +0 -1
- package/src/semantic.less +1 -1
- package/src/themes/amazon/elements/button.overrides +1 -1
- package/src/themes/amazon/elements/button.variables +5 -6
- package/src/themes/amazon/globals/site.variables +2 -3
- package/src/themes/bookish/elements/header.variables +2 -2
- package/src/themes/bootstrap3/elements/button.variables +4 -5
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/chubby/elements/button.overrides +4 -4
- package/src/themes/chubby/modules/accordion.overrides +1 -1
- package/src/themes/chubby/views/comment.overrides +2 -2
- package/src/themes/chubby/views/comment.variables +2 -2
- package/src/themes/classic/collections/table.variables +2 -2
- package/src/themes/classic/elements/button.variables +11 -11
- package/src/themes/classic/modules/progress.variables +2 -2
- package/src/themes/classic/views/card.variables +2 -2
- package/src/themes/default/collections/form.variables +2 -3
- package/src/themes/default/collections/menu.variables +28 -28
- package/src/themes/default/collections/message.variables +1 -1
- package/src/themes/default/collections/table.variables +4 -4
- package/src/themes/default/elements/button.variables +9 -10
- package/src/themes/default/elements/divider.variables +1 -1
- package/src/themes/default/elements/icon.variables +2 -2
- package/src/themes/default/elements/image.variables +1 -1
- package/src/themes/default/elements/input.variables +2 -2
- package/src/themes/default/elements/label.variables +4 -4
- package/src/themes/default/elements/list.variables +1 -1
- package/src/themes/default/elements/placeholder.variables +6 -6
- package/src/themes/default/elements/segment.variables +8 -8
- package/src/themes/default/globals/reset.overrides +45 -201
- package/src/themes/default/globals/site.variables +50 -50
- package/src/themes/default/globals/variation.variables +3 -2
- package/src/themes/default/modules/accordion.variables +0 -1
- package/src/themes/default/modules/checkbox.variables +1 -1
- package/src/themes/default/modules/dimmer.variables +12 -12
- package/src/themes/default/modules/dropdown.variables +17 -16
- package/src/themes/default/modules/embed.variables +2 -2
- package/src/themes/default/modules/flyout.variables +3 -3
- package/src/themes/default/modules/modal.variables +14 -14
- package/src/themes/default/modules/nag.variables +1 -1
- package/src/themes/default/modules/rating.variables +1 -1
- package/src/themes/default/modules/search.variables +1 -1
- package/src/themes/default/modules/shape.variables +1 -1
- package/src/themes/default/modules/sidebar.variables +2 -2
- package/src/themes/default/modules/toast.variables +4 -4
- package/src/themes/default/views/card.variables +6 -7
- package/src/themes/default/views/feed.variables +4 -4
- package/src/themes/default/views/item.variables +2 -3
- package/src/themes/flat/collections/form.variables +1 -1
- package/src/themes/flat/globals/site.variables +9 -9
- package/src/themes/github/collections/form.overrides +3 -3
- package/src/themes/github/collections/form.variables +3 -3
- package/src/themes/github/collections/menu.overrides +1 -1
- package/src/themes/github/collections/menu.variables +10 -10
- package/src/themes/github/collections/message.variables +6 -6
- package/src/themes/github/elements/button.variables +17 -17
- package/src/themes/github/elements/input.variables +3 -3
- package/src/themes/github/elements/segment.variables +2 -2
- package/src/themes/github/elements/step.overrides +4 -4
- package/src/themes/github/elements/step.variables +3 -3
- package/src/themes/github/globals/site.variables +2 -2
- package/src/themes/github/modules/dropdown.variables +1 -3
- package/src/themes/gmail/collections/message.variables +2 -2
- package/src/themes/material/collections/menu.variables +1 -1
- package/src/themes/material/elements/button.overrides +4 -4
- package/src/themes/material/elements/button.variables +5 -5
- package/src/themes/material/modules/dropdown.variables +1 -1
- package/src/themes/material/modules/modal.variables +1 -1
- package/src/themes/raised/elements/button.variables +1 -1
- package/src/themes/round/elements/button.variables +12 -12
- package/src/themes/striped/modules/progress.overrides +3 -3
- package/src/themes/timeline/views/feed.variables +2 -2
- package/src/themes/twitter/elements/button.overrides +1 -1
- package/src/themes/twitter/elements/button.variables +4 -5
- package/tasks/admin/components/create.js +12 -15
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +30 -51
- 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 +5 -5
- 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 +10 -10
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +6 -12
- package/tasks/config/tasks.js +15 -11
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +18 -20
- package/tasks/install.js +14 -12
- package/test/meteor/assets.js +4 -4
- package/test/meteor/fonts.js +10 -11
- package/test/modules/module.spec.js +18 -18
|
@@ -19,23 +19,23 @@
|
|
|
19
19
|
? window
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
|
-
$.fn.slider = function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
$.fn.slider = function (...args) {
|
|
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,18 +177,18 @@
|
|
|
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
|
|
191
190
|
? max
|
|
192
|
-
: (attrValue
|
|
191
|
+
: Math.max(attrValue, min);
|
|
193
192
|
ratio = (attrValue - min) / (max - min);
|
|
194
193
|
} else {
|
|
195
194
|
ratio = (index + 1) / (numChildren + 1);
|
|
@@ -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) {
|
|
@@ -456,6 +455,7 @@
|
|
|
456
455
|
|
|
457
456
|
break;
|
|
458
457
|
}
|
|
458
|
+
// no default
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
@@ -494,14 +494,14 @@
|
|
|
494
494
|
if (!multiplier) {
|
|
495
495
|
multiplier = 1;
|
|
496
496
|
}
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
const step = module.get.step();
|
|
498
|
+
const currValue = module.get.currentThumbValue();
|
|
499
499
|
module.verbose('Taking a step');
|
|
500
500
|
if (step > 0) {
|
|
501
501
|
module.set.value(currValue + step * multiplier);
|
|
502
502
|
} else if (step === 0) {
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
const precision = module.get.precision();
|
|
504
|
+
const newValue = currValue + (multiplier / precision);
|
|
505
505
|
module.set.value(Math.round(newValue * precision) / precision);
|
|
506
506
|
}
|
|
507
507
|
},
|
|
@@ -510,14 +510,14 @@
|
|
|
510
510
|
if (!multiplier) {
|
|
511
511
|
multiplier = 1;
|
|
512
512
|
}
|
|
513
|
-
|
|
514
|
-
|
|
513
|
+
const step = module.get.step();
|
|
514
|
+
const currValue = module.get.currentThumbValue();
|
|
515
515
|
module.verbose('Going back a step');
|
|
516
516
|
if (step > 0) {
|
|
517
517
|
module.set.value(currValue - step * multiplier);
|
|
518
518
|
} else if (step === 0) {
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
const precision = module.get.precision();
|
|
520
|
+
const newValue = currValue - (multiplier / precision);
|
|
521
521
|
module.set.value(Math.round(newValue * precision) / precision);
|
|
522
522
|
}
|
|
523
523
|
},
|
|
@@ -658,14 +658,14 @@
|
|
|
658
658
|
precision: function () {
|
|
659
659
|
if (module.cache.precision === undefined) {
|
|
660
660
|
let decimalPlaces;
|
|
661
|
-
|
|
661
|
+
const step = module.get.step();
|
|
662
662
|
if (step !== 0) {
|
|
663
|
-
|
|
663
|
+
const split = String(step).split('.');
|
|
664
664
|
decimalPlaces = split.length === 2 ? split[1].length : 0;
|
|
665
665
|
} else {
|
|
666
666
|
decimalPlaces = settings.decimalPlaces;
|
|
667
667
|
}
|
|
668
|
-
|
|
668
|
+
const precision = 10 ** decimalPlaces;
|
|
669
669
|
module.debug('Precision determined', precision);
|
|
670
670
|
module.cache.precision = precision;
|
|
671
671
|
}
|
|
@@ -677,11 +677,11 @@
|
|
|
677
677
|
},
|
|
678
678
|
max: function () {
|
|
679
679
|
if (module.cache.max === undefined) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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;
|
|
685
685
|
if (remainder > 0) {
|
|
686
686
|
module.debug('Max value not divisible by given step. Increasing max value.', settings.max, step);
|
|
687
687
|
}
|
|
@@ -695,9 +695,9 @@
|
|
|
695
695
|
},
|
|
696
696
|
numLabels: function () {
|
|
697
697
|
if (module.cache.numLabels === undefined) {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
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;
|
|
701
701
|
module.debug('Determined that there should be ' + value + ' labels');
|
|
702
702
|
module.cache.numLabels = value;
|
|
703
703
|
}
|
|
@@ -723,8 +723,8 @@
|
|
|
723
723
|
return value;
|
|
724
724
|
}
|
|
725
725
|
let letterLabel = '';
|
|
726
|
-
|
|
727
|
-
|
|
726
|
+
const letters = Array.isArray(settings.letters) ? settings.letters : [...String(settings.letters)];
|
|
727
|
+
const lettersLen = letters.length;
|
|
728
728
|
|
|
729
729
|
while (stepValue >= 0) {
|
|
730
730
|
letterLabel = letters[stepValue % lettersLen] + letterLabel;
|
|
@@ -786,9 +786,9 @@
|
|
|
786
786
|
let gapRatio = 1;
|
|
787
787
|
|
|
788
788
|
if (settings.autoAdjustLabels) {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
const numLabels = module.get.numLabels();
|
|
790
|
+
const primePlus = module.is.prime(numLabels) ? 1 : 0;
|
|
791
|
+
const trackLength = module.get.trackLength();
|
|
792
792
|
let gapCounter = 1;
|
|
793
793
|
|
|
794
794
|
// While the distance between two labels is too short,
|
|
@@ -815,10 +815,10 @@
|
|
|
815
815
|
: pagePos - module.get.trackOffset() - module.get.trackStartPos();
|
|
816
816
|
},
|
|
817
817
|
closestThumb: function (eventPos) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
const thumbPos = Number.parseFloat(module.determine.thumbPos($thumb));
|
|
819
|
+
const thumbDelta = Math.abs(eventPos - thumbPos);
|
|
820
|
+
const secondThumbPos = Number.parseFloat(module.determine.thumbPos($secondThumb));
|
|
821
|
+
const secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
|
822
822
|
if (thumbDelta === secondThumbDelta && module.get.thumbValue() === module.get.min()) {
|
|
823
823
|
return $secondThumb;
|
|
824
824
|
}
|
|
@@ -826,10 +826,10 @@
|
|
|
826
826
|
return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
|
|
827
827
|
},
|
|
828
828
|
closestThumbPos: function (eventPos) {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
829
|
+
const thumbPos = Number.parseFloat(module.determine.thumbPos($thumb));
|
|
830
|
+
const thumbDelta = Math.abs(eventPos - thumbPos);
|
|
831
|
+
const secondThumbPos = Number.parseFloat(module.determine.thumbPos($secondThumb));
|
|
832
|
+
const secondThumbDelta = Math.abs(eventPos - secondThumbPos);
|
|
833
833
|
|
|
834
834
|
return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
|
|
835
835
|
},
|
|
@@ -839,30 +839,30 @@
|
|
|
839
839
|
: (module.is.reversed() ? $element.css('right') : $element.css('left'));
|
|
840
840
|
},
|
|
841
841
|
positionFromValue: function (val) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
842
|
+
const min = module.get.min();
|
|
843
|
+
const max = module.get.max();
|
|
844
|
+
const value = val > max
|
|
845
845
|
? max
|
|
846
|
-
: (val
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
846
|
+
: Math.max(val, min);
|
|
847
|
+
const trackLength = module.get.trackLength();
|
|
848
|
+
const ratio = (value - min) / (max - min);
|
|
849
|
+
const position = Math.round(ratio * trackLength);
|
|
850
850
|
module.verbose('Determined position: ' + position + ' from value: ' + value);
|
|
851
851
|
|
|
852
852
|
return position;
|
|
853
853
|
},
|
|
854
854
|
positionFromRatio: function (ratio) {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
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;
|
|
859
859
|
module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
|
|
860
860
|
|
|
861
861
|
return adjustedPos;
|
|
862
862
|
},
|
|
863
863
|
valueFromEvent: function (event) {
|
|
864
|
-
|
|
865
|
-
|
|
864
|
+
const eventPos = module.determine.eventPos(event);
|
|
865
|
+
const newPos = module.determine.pos(eventPos);
|
|
866
866
|
let value;
|
|
867
867
|
if (eventPos < module.get.trackOffset()) {
|
|
868
868
|
value = module.is.reversed() ? module.get.max() : module.get.min();
|
|
@@ -875,54 +875,52 @@
|
|
|
875
875
|
return value;
|
|
876
876
|
},
|
|
877
877
|
smoothValueFromEvent: function (event) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
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);
|
|
882
882
|
let newPos = eventPos - module.get.trackOffset();
|
|
883
883
|
let ratio;
|
|
884
|
-
let value;
|
|
885
884
|
newPos = newPos < 0
|
|
886
885
|
? 0
|
|
887
|
-
: (newPos
|
|
886
|
+
: Math.min(newPos, trackLength);
|
|
888
887
|
ratio = newPos / trackLength;
|
|
889
888
|
if (module.is.reversed()) {
|
|
890
889
|
ratio = 1 - ratio;
|
|
891
890
|
}
|
|
892
|
-
value = ratio * (max - min) + min;
|
|
893
891
|
|
|
894
|
-
return
|
|
892
|
+
return ratio * (max - min) + min;
|
|
895
893
|
},
|
|
896
894
|
eventPos: function (event) {
|
|
897
895
|
if (event.type === 'touchmove' || event.type === 'touchend') {
|
|
898
|
-
|
|
896
|
+
const touchEvent = event.touches ? event : event.originalEvent;
|
|
899
897
|
let touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
|
|
900
|
-
for (
|
|
901
|
-
if (
|
|
902
|
-
touch =
|
|
898
|
+
for (const t of touchEvent.touches) {
|
|
899
|
+
if (t.identifier === touchIdentifier) {
|
|
900
|
+
touch = t;
|
|
903
901
|
|
|
904
902
|
break;
|
|
905
903
|
}
|
|
906
904
|
}
|
|
907
|
-
|
|
908
|
-
|
|
905
|
+
const touchY = touch.pageY;
|
|
906
|
+
const touchX = touch.pageX;
|
|
909
907
|
|
|
910
908
|
return module.is.vertical() ? touchY : touchX;
|
|
911
909
|
}
|
|
912
|
-
|
|
913
|
-
|
|
910
|
+
const clickY = event.pageY || event.originalEvent.pageY;
|
|
911
|
+
const clickX = event.pageX || event.originalEvent.pageX;
|
|
914
912
|
|
|
915
913
|
return module.is.vertical() ? clickY : clickX;
|
|
916
914
|
},
|
|
917
915
|
value: function (position) {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
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;
|
|
926
924
|
module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
|
|
927
925
|
if (value !== difference) {
|
|
928
926
|
module.verbose('Rounding value to closest step: ' + difference);
|
|
@@ -934,17 +932,17 @@
|
|
|
934
932
|
return Math.round((difference + module.get.min()) * precision) / precision;
|
|
935
933
|
},
|
|
936
934
|
keyMovement: function (event) {
|
|
937
|
-
|
|
938
|
-
|
|
935
|
+
const key = event.which;
|
|
936
|
+
const downArrow = module.is.vertical()
|
|
939
937
|
? (module.is.reversed() ? keys.downArrow : keys.upArrow)
|
|
940
938
|
: keys.downArrow;
|
|
941
|
-
|
|
939
|
+
const upArrow = module.is.vertical()
|
|
942
940
|
? (module.is.reversed() ? keys.upArrow : keys.downArrow)
|
|
943
941
|
: keys.upArrow;
|
|
944
|
-
|
|
942
|
+
const leftArrow = !module.is.vertical()
|
|
945
943
|
? (module.is.reversed() ? keys.rightArrow : keys.leftArrow)
|
|
946
944
|
: keys.leftArrow;
|
|
947
|
-
|
|
945
|
+
const rightArrow = !module.is.vertical()
|
|
948
946
|
? (module.is.reversed() ? keys.leftArrow : keys.rightArrow)
|
|
949
947
|
: keys.rightArrow;
|
|
950
948
|
if (key === downArrow || key === leftArrow) {
|
|
@@ -965,33 +963,31 @@
|
|
|
965
963
|
},
|
|
966
964
|
|
|
967
965
|
handleNewValuePosition: function (val) {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
let newPos;
|
|
966
|
+
const min = module.get.min();
|
|
967
|
+
const max = module.get.max();
|
|
971
968
|
if (val <= min) {
|
|
972
969
|
val = min;
|
|
973
970
|
} else if (val >= max) {
|
|
974
971
|
val = max;
|
|
975
972
|
}
|
|
976
|
-
newPos = module.determine.positionFromValue(val);
|
|
977
973
|
|
|
978
|
-
return
|
|
974
|
+
return module.determine.positionFromValue(val);
|
|
979
975
|
},
|
|
980
976
|
|
|
981
977
|
set: {
|
|
982
978
|
active: function (thumbVal, secondThumbVal) {
|
|
983
979
|
if (settings.highlightRange) {
|
|
984
980
|
if (secondThumbVal < thumbVal) {
|
|
985
|
-
|
|
981
|
+
const tempVal = secondThumbVal;
|
|
986
982
|
secondThumbVal = thumbVal;
|
|
987
983
|
thumbVal = tempVal;
|
|
988
984
|
}
|
|
989
|
-
|
|
985
|
+
const $children = $labels.find('.label');
|
|
990
986
|
$children.each(function (index) {
|
|
991
|
-
|
|
987
|
+
const $child = $(this);
|
|
992
988
|
let attrValue = $child.attr('data-value');
|
|
993
989
|
if (attrValue) {
|
|
994
|
-
attrValue = parseInt(attrValue, 10);
|
|
990
|
+
attrValue = Number.parseInt(attrValue, 10);
|
|
995
991
|
if (attrValue >= thumbVal && attrValue <= secondThumbVal) {
|
|
996
992
|
$child.addClass(className.active);
|
|
997
993
|
} else {
|
|
@@ -1003,7 +999,7 @@
|
|
|
1003
999
|
},
|
|
1004
1000
|
value: function (newValue, fireChange) {
|
|
1005
1001
|
fireChange = fireChange !== false;
|
|
1006
|
-
|
|
1002
|
+
const toReset = previousValue === undefined;
|
|
1007
1003
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
|
1008
1004
|
module.update.value(newValue, function (value, thumbVal, secondThumbVal) {
|
|
1009
1005
|
if ((!initialLoad || settings.fireOnInit) && fireChange) {
|
|
@@ -1020,9 +1016,9 @@
|
|
|
1020
1016
|
rangeValue: function (first, second, fireChange) {
|
|
1021
1017
|
fireChange = fireChange !== false;
|
|
1022
1018
|
if (module.is.range()) {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1019
|
+
const min = module.get.min();
|
|
1020
|
+
const max = module.get.max();
|
|
1021
|
+
const toReset = previousValue === undefined;
|
|
1026
1022
|
previousValue = previousValue === undefined ? module.get.value() : previousValue;
|
|
1027
1023
|
if (first <= min) {
|
|
1028
1024
|
first = min;
|
|
@@ -1053,7 +1049,7 @@
|
|
|
1053
1049
|
}
|
|
1054
1050
|
},
|
|
1055
1051
|
position: function (position, which) {
|
|
1056
|
-
|
|
1052
|
+
const thumbVal = module.determine.value(position);
|
|
1057
1053
|
if (which === 'second') {
|
|
1058
1054
|
module.secondThumbVal = thumbVal;
|
|
1059
1055
|
module.update.position(thumbVal, $secondThumb);
|
|
@@ -1068,8 +1064,8 @@
|
|
|
1068
1064
|
|
|
1069
1065
|
update: {
|
|
1070
1066
|
value: function (newValue, callback) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1067
|
+
const min = module.get.min();
|
|
1068
|
+
const max = module.get.max();
|
|
1073
1069
|
if (newValue <= min) {
|
|
1074
1070
|
newValue = min;
|
|
1075
1071
|
} else if (newValue >= max) {
|
|
@@ -1102,12 +1098,12 @@
|
|
|
1102
1098
|
}
|
|
1103
1099
|
},
|
|
1104
1100
|
position: function (newValue, $element) {
|
|
1105
|
-
|
|
1106
|
-
|
|
1101
|
+
const newPos = module.handleNewValuePosition(newValue);
|
|
1102
|
+
const $targetThumb = $element || $currThumb;
|
|
1107
1103
|
let thumbVal = module.thumbVal || module.get.min();
|
|
1108
1104
|
let secondThumbVal = module.secondThumbVal || module.get.min();
|
|
1109
1105
|
if (settings.showThumbTooltip) {
|
|
1110
|
-
|
|
1106
|
+
const precision = module.get.precision();
|
|
1111
1107
|
$targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
|
|
1112
1108
|
}
|
|
1113
1109
|
if (module.is.range()) {
|
|
@@ -1125,11 +1121,11 @@
|
|
|
1125
1121
|
module.set.active(thumbVal, secondThumbVal);
|
|
1126
1122
|
let trackPosValue;
|
|
1127
1123
|
let thumbPosValue;
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
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));
|
|
1133
1129
|
if (module.is.vertical()) {
|
|
1134
1130
|
if (module.is.reversed()) {
|
|
1135
1131
|
thumbPosValue = { bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto' };
|
|
@@ -1138,29 +1134,27 @@
|
|
|
1138
1134
|
thumbPosValue = { top: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', bottom: 'auto' };
|
|
1139
1135
|
trackPosValue = { top: trackStartPosPercent + '%', bottom: trackEndPosPercent + '%' };
|
|
1140
1136
|
}
|
|
1137
|
+
} else if (module.is.reversed()) {
|
|
1138
|
+
thumbPosValue = { right: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', left: 'auto' };
|
|
1139
|
+
trackPosValue = { right: trackStartPosPercent + '%', left: trackEndPosPercent + '%' };
|
|
1141
1140
|
} else {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
trackPosValue = { right: trackStartPosPercent + '%', left: trackEndPosPercent + '%' };
|
|
1145
|
-
} else {
|
|
1146
|
-
thumbPosValue = { left: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', right: 'auto' };
|
|
1147
|
-
trackPosValue = { left: trackStartPosPercent + '%', right: trackEndPosPercent + '%' };
|
|
1148
|
-
}
|
|
1141
|
+
thumbPosValue = { left: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', right: 'auto' };
|
|
1142
|
+
trackPosValue = { left: trackStartPosPercent + '%', right: trackEndPosPercent + '%' };
|
|
1149
1143
|
}
|
|
1150
1144
|
$targetThumb.css(thumbPosValue);
|
|
1151
1145
|
$trackFill.css(trackPosValue);
|
|
1152
1146
|
module.debug('Setting slider position to ' + newPos);
|
|
1153
1147
|
},
|
|
1154
1148
|
labelPosition: function (ratio, $label) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1149
|
+
const startMargin = module.get.trackStartMargin();
|
|
1150
|
+
const endMargin = module.get.trackEndMargin();
|
|
1151
|
+
const posDir = module.is.vertical()
|
|
1158
1152
|
? (module.is.reversed() ? 'bottom' : 'top')
|
|
1159
1153
|
: (module.is.reversed() ? 'right' : 'left');
|
|
1160
|
-
|
|
1154
|
+
const startMarginMod = module.is.reversed() && !module.is.vertical()
|
|
1161
1155
|
? ' - '
|
|
1162
1156
|
: ' + ';
|
|
1163
|
-
|
|
1157
|
+
const position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
|
|
1164
1158
|
$label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
|
|
1165
1159
|
},
|
|
1166
1160
|
},
|
|
@@ -1176,7 +1170,7 @@
|
|
|
1176
1170
|
|
|
1177
1171
|
read: {
|
|
1178
1172
|
metadata: function () {
|
|
1179
|
-
|
|
1173
|
+
const data = {
|
|
1180
1174
|
thumbVal: $module.data(metadata.thumbVal),
|
|
1181
1175
|
secondThumbVal: $module.data(metadata.secondThumbVal),
|
|
1182
1176
|
};
|
|
@@ -1193,7 +1187,7 @@
|
|
|
1193
1187
|
settings: function () {
|
|
1194
1188
|
if (settings.start !== false) {
|
|
1195
1189
|
if (module.is.range()) {
|
|
1196
|
-
|
|
1190
|
+
const rangeDiff = settings.end - settings.start;
|
|
1197
1191
|
if (rangeDiff < 0
|
|
1198
1192
|
|| (settings.minRange && rangeDiff < settings.minRange)
|
|
1199
1193
|
|| (settings.maxRange && rangeDiff > settings.maxRange)
|
|
@@ -1235,30 +1229,30 @@
|
|
|
1235
1229
|
return module[name];
|
|
1236
1230
|
}
|
|
1237
1231
|
},
|
|
1238
|
-
debug: function () {
|
|
1232
|
+
debug: function (...args) {
|
|
1239
1233
|
if (!settings.silent && settings.debug) {
|
|
1240
1234
|
if (settings.performance) {
|
|
1241
|
-
module.performance.log(
|
|
1235
|
+
module.performance.log(args);
|
|
1242
1236
|
} else {
|
|
1243
1237
|
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
1244
|
-
module.debug.apply(console,
|
|
1238
|
+
module.debug.apply(console, args);
|
|
1245
1239
|
}
|
|
1246
1240
|
}
|
|
1247
1241
|
},
|
|
1248
|
-
verbose: function () {
|
|
1242
|
+
verbose: function (...args) {
|
|
1249
1243
|
if (!settings.silent && settings.verbose && settings.debug) {
|
|
1250
1244
|
if (settings.performance) {
|
|
1251
|
-
module.performance.log(
|
|
1245
|
+
module.performance.log(args);
|
|
1252
1246
|
} else {
|
|
1253
1247
|
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
1254
|
-
module.verbose.apply(console,
|
|
1248
|
+
module.verbose.apply(console, args);
|
|
1255
1249
|
}
|
|
1256
1250
|
}
|
|
1257
1251
|
},
|
|
1258
|
-
error: function () {
|
|
1252
|
+
error: function (...args) {
|
|
1259
1253
|
if (!settings.silent) {
|
|
1260
1254
|
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
1261
|
-
module.error.apply(console,
|
|
1255
|
+
module.error.apply(console, args);
|
|
1262
1256
|
}
|
|
1263
1257
|
},
|
|
1264
1258
|
|
|
@@ -1274,7 +1268,7 @@
|
|
|
1274
1268
|
time = currentTime;
|
|
1275
1269
|
performance.push({
|
|
1276
1270
|
Name: message[0],
|
|
1277
|
-
Arguments:
|
|
1271
|
+
Arguments: message.slice(1),
|
|
1278
1272
|
Element: element,
|
|
1279
1273
|
'Execution Time': executionTime,
|
|
1280
1274
|
});
|
|
@@ -1295,31 +1289,23 @@
|
|
|
1295
1289
|
title += ' ' + totalTime + 'ms';
|
|
1296
1290
|
if (performance.length > 0) {
|
|
1297
1291
|
console.groupCollapsed(title);
|
|
1298
|
-
|
|
1299
|
-
console.table(performance);
|
|
1300
|
-
} else {
|
|
1301
|
-
$.each(performance, function (index, data) {
|
|
1302
|
-
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1292
|
+
console.table(performance);
|
|
1305
1293
|
console.groupEnd();
|
|
1306
1294
|
}
|
|
1307
1295
|
performance = [];
|
|
1308
1296
|
},
|
|
1309
1297
|
},
|
|
1310
1298
|
|
|
1311
|
-
invoke: function (query, passedArguments, context) {
|
|
1299
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
1312
1300
|
let object = instance;
|
|
1313
1301
|
let maxDepth;
|
|
1314
1302
|
let found;
|
|
1315
1303
|
let response;
|
|
1316
|
-
passedArguments = passedArguments || queryArguments;
|
|
1317
|
-
context = context || element;
|
|
1318
1304
|
if (typeof query === 'string' && object !== undefined) {
|
|
1319
1305
|
query = query.split(/[ .]/);
|
|
1320
1306
|
maxDepth = query.length - 1;
|
|
1321
1307
|
$.each(query, function (depth, value) {
|
|
1322
|
-
|
|
1308
|
+
const camelCaseValue = depth !== maxDepth
|
|
1323
1309
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
1324
1310
|
: query;
|
|
1325
1311
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1362,7 +1348,7 @@
|
|
|
1362
1348
|
if (instance === undefined) {
|
|
1363
1349
|
module.initialize();
|
|
1364
1350
|
}
|
|
1365
|
-
module.invoke(
|
|
1351
|
+
module.invoke(parameters);
|
|
1366
1352
|
} else {
|
|
1367
1353
|
if (instance !== undefined) {
|
|
1368
1354
|
instance.invoke('destroy');
|