fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.70
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 -33
- 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 +11 -8
- package/changelog-setup.js +88 -72
- package/changelog-template.hbs +256 -251
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +116 -164
- 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 +190 -303
- 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 +5 -6
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +3 -3
- package/dist/components/calendar.js +397 -482
- package/dist/components/calendar.min.css +2 -2
- 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 +105 -166
- 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 +2 -2
- package/dist/components/dimmer.js +75 -121
- package/dist/components/dimmer.min.css +2 -2
- 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 +21 -35
- package/dist/components/dropdown.js +775 -1161
- package/dist/components/dropdown.min.css +2 -2
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +95 -146
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- 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 +242 -336
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +3 -5
- package/dist/components/form.js +425 -554
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- 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 +274 -369
- package/dist/components/modal.min.css +2 -2
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +109 -153
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- 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 +210 -303
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +4 -13
- package/dist/components/progress.js +128 -185
- package/dist/components/progress.min.css +2 -2
- 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 +92 -145
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- 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 +311 -425
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- 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 +173 -249
- 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 +138 -199
- 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 +59 -99
- 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 +267 -364
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +88 -132
- 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 +4 -4
- package/dist/components/step.min.css +2 -2
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +163 -228
- 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 +192 -287
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- 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 +118 -155
- 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 +114 -193
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +175 -271
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +4479 -8221
- package/dist/semantic.js +5023 -7182
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/examples/attached.html +1 -1
- package/examples/components/menu.html +1 -1
- package/gulpfile.js +5 -7
- package/package.json +4 -5
- package/scripts/nightly-version.js +11 -14
- package/src/definitions/behaviors/api.js +189 -302
- package/src/definitions/behaviors/form.js +426 -555
- package/src/definitions/behaviors/state.js +87 -131
- package/src/definitions/behaviors/visibility.js +174 -270
- 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 +58 -98
- package/src/definitions/globals/site.less +0 -1
- package/src/definitions/modules/accordion.js +115 -163
- package/src/definitions/modules/accordion.less +0 -1
- package/src/definitions/modules/calendar.js +396 -481
- package/src/definitions/modules/calendar.less +2 -3
- package/src/definitions/modules/checkbox.js +104 -165
- package/src/definitions/modules/checkbox.less +0 -1
- package/src/definitions/modules/dimmer.js +74 -120
- package/src/definitions/modules/dimmer.less +1 -2
- package/src/definitions/modules/dropdown.js +774 -1160
- package/src/definitions/modules/dropdown.less +27 -38
- package/src/definitions/modules/embed.js +94 -145
- package/src/definitions/modules/embed.less +0 -1
- package/src/definitions/modules/flyout.js +241 -335
- package/src/definitions/modules/flyout.less +0 -1
- package/src/definitions/modules/modal.js +273 -368
- package/src/definitions/modules/modal.less +3 -4
- package/src/definitions/modules/nag.js +108 -152
- package/src/definitions/modules/nag.less +0 -1
- package/src/definitions/modules/popup.js +209 -302
- package/src/definitions/modules/popup.less +18 -73
- package/src/definitions/modules/progress.js +127 -184
- package/src/definitions/modules/progress.less +3 -13
- package/src/definitions/modules/rating.js +93 -146
- package/src/definitions/modules/rating.less +0 -1
- package/src/definitions/modules/search.js +312 -426
- package/src/definitions/modules/search.less +2 -4
- package/src/definitions/modules/shape.js +172 -248
- package/src/definitions/modules/shape.less +0 -1
- package/src/definitions/modules/sidebar.js +137 -198
- package/src/definitions/modules/sidebar.less +0 -1
- package/src/definitions/modules/slider.js +266 -363
- package/src/definitions/modules/slider.less +0 -1
- package/src/definitions/modules/sticky.js +162 -227
- package/src/definitions/modules/sticky.less +0 -1
- package/src/definitions/modules/tab.js +191 -286
- package/src/definitions/modules/tab.less +0 -1
- package/src/definitions/modules/toast.js +117 -154
- package/src/definitions/modules/toast.less +0 -1
- package/src/definitions/modules/transition.js +113 -192
- 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 +87 -110
- package/tasks/admin/components/init.js +26 -33
- package/tasks/admin/components/update.js +46 -54
- package/tasks/admin/distributions/create.js +74 -125
- package/tasks/admin/distributions/init.js +27 -34
- package/tasks/admin/distributions/update.js +45 -53
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +59 -68
- package/tasks/build/javascript.js +46 -54
- 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 +8 -10
- 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 +26 -34
- package/tasks/config/project/install.js +58 -72
- package/tasks/config/project/release.js +7 -15
- package/tasks/config/tasks.js +23 -24
- package/tasks/config/user.js +9 -16
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +35 -43
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +77 -102
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/assets.js +4 -4
- package/test/meteor/fonts.js +11 -13
- package/test/modules/module.spec.js +25 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.70+88a499a - Checkbox
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -19,46 +19,41 @@
|
|
|
19
19
|
? window
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
|
-
$.fn.checkbox = function (
|
|
23
|
-
|
|
24
|
-
$allModules = $(this),
|
|
22
|
+
$.fn.checkbox = function (...args) {
|
|
23
|
+
const $allModules = $(this);
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
let time = Date.now();
|
|
26
|
+
let performance = [];
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
;
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
|
+
let returnedValue;
|
|
34
32
|
|
|
35
33
|
$allModules.each(function () {
|
|
36
|
-
|
|
37
|
-
settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
|
|
34
|
+
const settings = $.extend(true, {}, $.fn.checkbox.settings, parameters);
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const className = settings.className;
|
|
37
|
+
const namespace = settings.namespace;
|
|
38
|
+
const selector = settings.selector;
|
|
39
|
+
const error = settings.error;
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const eventNamespace = '.' + namespace;
|
|
42
|
+
const moduleNamespace = 'module-' + namespace;
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
let $module = $(this);
|
|
45
|
+
let $label = $(this).children(selector.label);
|
|
46
|
+
let $input = $(this).children(selector.input);
|
|
47
|
+
let input = $input[0];
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
let initialLoad = false;
|
|
50
|
+
let shortcutPressed = false;
|
|
51
|
+
let instance = $module.data(moduleNamespace);
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
module
|
|
59
|
-
;
|
|
53
|
+
let observer;
|
|
54
|
+
const element = this;
|
|
60
55
|
|
|
61
|
-
module = {
|
|
56
|
+
const module = {
|
|
62
57
|
|
|
63
58
|
initialize: function () {
|
|
64
59
|
module.verbose('Initializing checkbox', settings);
|
|
@@ -78,8 +73,7 @@
|
|
|
78
73
|
module.verbose('Storing instance of module', module);
|
|
79
74
|
instance = module;
|
|
80
75
|
$module
|
|
81
|
-
.data(moduleNamespace, module)
|
|
82
|
-
;
|
|
76
|
+
.data(moduleNamespace, module);
|
|
83
77
|
},
|
|
84
78
|
|
|
85
79
|
destroy: function () {
|
|
@@ -134,43 +128,31 @@
|
|
|
134
128
|
},
|
|
135
129
|
|
|
136
130
|
observeChanges: function () {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
module.debug('Setting up mutation observer', observer);
|
|
147
|
-
}
|
|
131
|
+
observer = new MutationObserver(function (mutations) {
|
|
132
|
+
module.debug('DOM tree modified, updating selector cache');
|
|
133
|
+
module.refresh();
|
|
134
|
+
});
|
|
135
|
+
observer.observe(element, {
|
|
136
|
+
childList: true,
|
|
137
|
+
subtree: true,
|
|
138
|
+
});
|
|
139
|
+
module.debug('Setting up mutation observer', observer);
|
|
148
140
|
},
|
|
149
141
|
|
|
150
142
|
attachEvents: function (selector, event) {
|
|
151
|
-
|
|
152
|
-
$element = $(selector)
|
|
153
|
-
;
|
|
143
|
+
const $element = $(selector);
|
|
154
144
|
event = isFunction(module[event])
|
|
155
145
|
? module[event]
|
|
156
146
|
: module.toggle;
|
|
157
147
|
if ($element.length > 0) {
|
|
158
148
|
module.debug('Attaching checkbox events to element', selector, event);
|
|
159
149
|
$element
|
|
160
|
-
.on('click' + eventNamespace, event)
|
|
161
|
-
;
|
|
150
|
+
.on('click' + eventNamespace, event);
|
|
162
151
|
} else {
|
|
163
152
|
module.error(error.notFound);
|
|
164
153
|
}
|
|
165
154
|
},
|
|
166
155
|
|
|
167
|
-
preventDefaultOnInputTarget: function () {
|
|
168
|
-
if (event !== undefined && event !== null && $(event.target).is(selector.input)) {
|
|
169
|
-
module.verbose('Preventing default check action after manual check action');
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
|
|
174
156
|
event: {
|
|
175
157
|
change: function (event) {
|
|
176
158
|
if (!module.should.ignoreCallbacks()) {
|
|
@@ -178,9 +160,7 @@
|
|
|
178
160
|
}
|
|
179
161
|
},
|
|
180
162
|
click: function (event) {
|
|
181
|
-
|
|
182
|
-
$target = $(event.target)
|
|
183
|
-
;
|
|
163
|
+
const $target = $(event.target);
|
|
184
164
|
if ($target.is(selector.input)) {
|
|
185
165
|
module.verbose('Using default check action on initialized checkbox');
|
|
186
166
|
|
|
@@ -196,25 +176,21 @@
|
|
|
196
176
|
event.preventDefault();
|
|
197
177
|
},
|
|
198
178
|
keydown: function (event) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
rIndex = r.index($module),
|
|
215
|
-
rLen = r.length,
|
|
216
|
-
checkIndex = false
|
|
217
|
-
;
|
|
179
|
+
const key = event.which;
|
|
180
|
+
const keyCode = {
|
|
181
|
+
enter: 13,
|
|
182
|
+
space: 32,
|
|
183
|
+
escape: 27,
|
|
184
|
+
left: 37,
|
|
185
|
+
up: 38,
|
|
186
|
+
right: 39,
|
|
187
|
+
down: 40,
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const r = module.get.radios().not(selector.disabled);
|
|
191
|
+
const rIndex = r.index($module);
|
|
192
|
+
const rLen = r.length;
|
|
193
|
+
let checkIndex = false;
|
|
218
194
|
|
|
219
195
|
if (key === keyCode.left || key === keyCode.up) {
|
|
220
196
|
checkIndex = (rIndex === 0 ? rLen : rIndex) - 1;
|
|
@@ -223,15 +199,15 @@
|
|
|
223
199
|
}
|
|
224
200
|
|
|
225
201
|
if (!module.should.ignoreCallbacks() && checkIndex !== false) {
|
|
226
|
-
if (settings.beforeUnchecked.
|
|
202
|
+
if (settings.beforeUnchecked.call(input) === false) {
|
|
227
203
|
module.verbose('Option not allowed to be unchecked, cancelling key navigation');
|
|
228
204
|
|
|
229
205
|
return false;
|
|
230
206
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (disallowOption || settings.beforeChecked.
|
|
207
|
+
const nextOption = $(r[checkIndex]);
|
|
208
|
+
const nextInput = nextOption.children(selector.input);
|
|
209
|
+
const disallowOption = nextOption.hasClass(className.readOnly) || nextInput.prop('readonly');
|
|
210
|
+
if (disallowOption || settings.beforeChecked.call(nextInput[0]) === false) {
|
|
235
211
|
module.verbose('Next option should not allow check, cancelling key navigation');
|
|
236
212
|
|
|
237
213
|
return false;
|
|
@@ -279,7 +255,6 @@
|
|
|
279
255
|
settings.onChecked.call(input);
|
|
280
256
|
module.trigger.change();
|
|
281
257
|
}
|
|
282
|
-
module.preventDefaultOnInputTarget();
|
|
283
258
|
},
|
|
284
259
|
|
|
285
260
|
uncheck: function () {
|
|
@@ -292,7 +267,6 @@
|
|
|
292
267
|
settings.onUnchecked.call(input);
|
|
293
268
|
module.trigger.change();
|
|
294
269
|
}
|
|
295
|
-
module.preventDefaultOnInputTarget();
|
|
296
270
|
},
|
|
297
271
|
|
|
298
272
|
indeterminate: function () {
|
|
@@ -351,11 +325,9 @@
|
|
|
351
325
|
|
|
352
326
|
get: {
|
|
353
327
|
radios: function () {
|
|
354
|
-
|
|
355
|
-
name = module.get.name()
|
|
356
|
-
;
|
|
328
|
+
const name = module.get.name();
|
|
357
329
|
|
|
358
|
-
return $('input[name="' + name + '"]').closest(selector.checkbox);
|
|
330
|
+
return $('input[name="' + CSS.escape(name) + '"]').closest(selector.checkbox);
|
|
359
331
|
},
|
|
360
332
|
otherRadios: function () {
|
|
361
333
|
return module.get.radios().not($module);
|
|
@@ -399,7 +371,7 @@
|
|
|
399
371
|
|
|
400
372
|
return false;
|
|
401
373
|
}
|
|
402
|
-
if (!module.should.ignoreCallbacks() && settings.beforeChecked.
|
|
374
|
+
if (!module.should.ignoreCallbacks() && settings.beforeChecked.call(input) === false) {
|
|
403
375
|
module.debug('Should not allow check, beforeChecked cancelled');
|
|
404
376
|
|
|
405
377
|
return false;
|
|
@@ -413,7 +385,7 @@
|
|
|
413
385
|
|
|
414
386
|
return false;
|
|
415
387
|
}
|
|
416
|
-
if (!module.should.ignoreCallbacks() && settings.beforeUnchecked.
|
|
388
|
+
if (!module.should.ignoreCallbacks() && settings.beforeUnchecked.call(input) === false) {
|
|
417
389
|
module.debug('Should not allow uncheck, beforeUnchecked cancelled');
|
|
418
390
|
|
|
419
391
|
return false;
|
|
@@ -427,7 +399,7 @@
|
|
|
427
399
|
|
|
428
400
|
return false;
|
|
429
401
|
}
|
|
430
|
-
if (!module.should.ignoreCallbacks() && settings.beforeIndeterminate.
|
|
402
|
+
if (!module.should.ignoreCallbacks() && settings.beforeIndeterminate.call(input) === false) {
|
|
431
403
|
module.debug('Should not allow indeterminate, beforeIndeterminate cancelled');
|
|
432
404
|
|
|
433
405
|
return false;
|
|
@@ -441,7 +413,7 @@
|
|
|
441
413
|
|
|
442
414
|
return false;
|
|
443
415
|
}
|
|
444
|
-
if (!module.should.ignoreCallbacks() && settings.beforeDeterminate.
|
|
416
|
+
if (!module.should.ignoreCallbacks() && settings.beforeDeterminate.call(input) === false) {
|
|
445
417
|
module.debug('Should not allow determinate, beforeDeterminate cancelled');
|
|
446
418
|
|
|
447
419
|
return false;
|
|
@@ -473,8 +445,7 @@
|
|
|
473
445
|
module.verbose('Setting class to checked');
|
|
474
446
|
$module
|
|
475
447
|
.removeClass(className.indeterminate)
|
|
476
|
-
.addClass(className.checked)
|
|
477
|
-
;
|
|
448
|
+
.addClass(className.checked);
|
|
478
449
|
if (module.is.radio()) {
|
|
479
450
|
module.uncheckOthers();
|
|
480
451
|
}
|
|
@@ -486,15 +457,13 @@
|
|
|
486
457
|
module.verbose('Setting state to checked', input);
|
|
487
458
|
$input
|
|
488
459
|
.prop('indeterminate', false)
|
|
489
|
-
.prop('checked', true)
|
|
490
|
-
;
|
|
460
|
+
.prop('checked', true);
|
|
491
461
|
},
|
|
492
462
|
unchecked: function () {
|
|
493
463
|
module.verbose('Removing checked class');
|
|
494
464
|
$module
|
|
495
465
|
.removeClass(className.indeterminate)
|
|
496
|
-
.removeClass(className.checked)
|
|
497
|
-
;
|
|
466
|
+
.removeClass(className.checked);
|
|
498
467
|
if (!module.is.indeterminate() && module.is.unchecked()) {
|
|
499
468
|
module.debug('Input is already unchecked');
|
|
500
469
|
|
|
@@ -503,14 +472,12 @@
|
|
|
503
472
|
module.debug('Setting state to unchecked');
|
|
504
473
|
$input
|
|
505
474
|
.prop('indeterminate', false)
|
|
506
|
-
.prop('checked', false)
|
|
507
|
-
;
|
|
475
|
+
.prop('checked', false);
|
|
508
476
|
},
|
|
509
477
|
indeterminate: function () {
|
|
510
478
|
module.verbose('Setting class to indeterminate');
|
|
511
479
|
$module
|
|
512
|
-
.addClass(className.indeterminate)
|
|
513
|
-
;
|
|
480
|
+
.addClass(className.indeterminate);
|
|
514
481
|
if (module.is.indeterminate()) {
|
|
515
482
|
module.debug('Input is already indeterminate, skipping input property change');
|
|
516
483
|
|
|
@@ -518,14 +485,12 @@
|
|
|
518
485
|
}
|
|
519
486
|
module.debug('Setting state to indeterminate');
|
|
520
487
|
$input
|
|
521
|
-
.prop('indeterminate', true)
|
|
522
|
-
;
|
|
488
|
+
.prop('indeterminate', true);
|
|
523
489
|
},
|
|
524
490
|
determinate: function () {
|
|
525
491
|
module.verbose('Removing indeterminate class');
|
|
526
492
|
$module
|
|
527
|
-
.removeClass(className.indeterminate)
|
|
528
|
-
;
|
|
493
|
+
.removeClass(className.indeterminate);
|
|
529
494
|
if (module.is.determinate()) {
|
|
530
495
|
module.debug('Input is already determinate, skipping input property change');
|
|
531
496
|
|
|
@@ -533,14 +498,12 @@
|
|
|
533
498
|
}
|
|
534
499
|
module.debug('Setting state to determinate');
|
|
535
500
|
$input
|
|
536
|
-
.prop('indeterminate', false)
|
|
537
|
-
;
|
|
501
|
+
.prop('indeterminate', false);
|
|
538
502
|
},
|
|
539
503
|
disabled: function () {
|
|
540
504
|
module.verbose('Setting class to disabled');
|
|
541
505
|
$module
|
|
542
|
-
.addClass(className.disabled)
|
|
543
|
-
;
|
|
506
|
+
.addClass(className.disabled);
|
|
544
507
|
if (module.is.disabled()) {
|
|
545
508
|
module.debug('Input is already disabled, skipping input property change');
|
|
546
509
|
|
|
@@ -548,8 +511,7 @@
|
|
|
548
511
|
}
|
|
549
512
|
module.debug('Setting state to disabled');
|
|
550
513
|
$input
|
|
551
|
-
.prop('disabled', 'disabled')
|
|
552
|
-
;
|
|
514
|
+
.prop('disabled', 'disabled');
|
|
553
515
|
},
|
|
554
516
|
enabled: function () {
|
|
555
517
|
module.verbose('Removing disabled class');
|
|
@@ -561,8 +523,7 @@
|
|
|
561
523
|
}
|
|
562
524
|
module.debug('Setting state to enabled');
|
|
563
525
|
$input
|
|
564
|
-
.prop('disabled', false)
|
|
565
|
-
;
|
|
526
|
+
.prop('disabled', false);
|
|
566
527
|
},
|
|
567
528
|
tabbable: function () {
|
|
568
529
|
module.verbose('Adding tabindex to checkbox');
|
|
@@ -580,14 +541,11 @@
|
|
|
580
541
|
|
|
581
542
|
trigger: {
|
|
582
543
|
change: function () {
|
|
583
|
-
|
|
584
|
-
inputElement = $input[0]
|
|
585
|
-
;
|
|
544
|
+
const inputElement = $input[0];
|
|
586
545
|
if (inputElement) {
|
|
587
|
-
|
|
546
|
+
const event = new Event('change', { bubbles: true });
|
|
588
547
|
module.verbose('Triggering native change event');
|
|
589
|
-
|
|
590
|
-
inputElement.dispatchEvent(events);
|
|
548
|
+
inputElement.dispatchEvent(event);
|
|
591
549
|
}
|
|
592
550
|
},
|
|
593
551
|
},
|
|
@@ -617,8 +575,7 @@
|
|
|
617
575
|
.on('click' + eventNamespace, module.event.click)
|
|
618
576
|
.on('change' + eventNamespace, module.event.change)
|
|
619
577
|
.on('keydown' + eventNamespace, selector.input, module.event.keydown)
|
|
620
|
-
.on('keyup' + eventNamespace, selector.input, module.event.keyup)
|
|
621
|
-
;
|
|
578
|
+
.on('keyup' + eventNamespace, selector.input, module.event.keyup);
|
|
622
579
|
},
|
|
623
580
|
},
|
|
624
581
|
|
|
@@ -626,15 +583,12 @@
|
|
|
626
583
|
events: function () {
|
|
627
584
|
module.debug('Removing events');
|
|
628
585
|
$module
|
|
629
|
-
.off(eventNamespace)
|
|
630
|
-
;
|
|
586
|
+
.off(eventNamespace);
|
|
631
587
|
},
|
|
632
588
|
},
|
|
633
589
|
|
|
634
590
|
uncheckOthers: function () {
|
|
635
|
-
|
|
636
|
-
$radios = module.get.otherRadios()
|
|
637
|
-
;
|
|
591
|
+
const $radios = module.get.otherRadios();
|
|
638
592
|
module.debug('Unchecking other radios', $radios);
|
|
639
593
|
$radios.removeClass(className.checked);
|
|
640
594
|
},
|
|
@@ -678,39 +632,37 @@
|
|
|
678
632
|
return module[name];
|
|
679
633
|
}
|
|
680
634
|
},
|
|
681
|
-
debug: function () {
|
|
635
|
+
debug: function (...args) {
|
|
682
636
|
if (!settings.silent && settings.debug) {
|
|
683
637
|
if (settings.performance) {
|
|
684
|
-
module.performance.log(
|
|
638
|
+
module.performance.log(args);
|
|
685
639
|
} else {
|
|
686
640
|
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
687
|
-
module.debug.apply(console,
|
|
641
|
+
module.debug.apply(console, args);
|
|
688
642
|
}
|
|
689
643
|
}
|
|
690
644
|
},
|
|
691
|
-
verbose: function () {
|
|
645
|
+
verbose: function (...args) {
|
|
692
646
|
if (!settings.silent && settings.verbose && settings.debug) {
|
|
693
647
|
if (settings.performance) {
|
|
694
|
-
module.performance.log(
|
|
648
|
+
module.performance.log(args);
|
|
695
649
|
} else {
|
|
696
650
|
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
697
|
-
module.verbose.apply(console,
|
|
651
|
+
module.verbose.apply(console, args);
|
|
698
652
|
}
|
|
699
653
|
}
|
|
700
654
|
},
|
|
701
|
-
error: function () {
|
|
655
|
+
error: function (...args) {
|
|
702
656
|
if (!settings.silent) {
|
|
703
657
|
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
704
|
-
module.error.apply(console,
|
|
658
|
+
module.error.apply(console, args);
|
|
705
659
|
}
|
|
706
660
|
},
|
|
707
661
|
performance: {
|
|
708
662
|
log: function (message) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
previousTime
|
|
713
|
-
;
|
|
663
|
+
let currentTime;
|
|
664
|
+
let executionTime;
|
|
665
|
+
let previousTime;
|
|
714
666
|
if (settings.performance) {
|
|
715
667
|
currentTime = Date.now();
|
|
716
668
|
previousTime = time || currentTime;
|
|
@@ -718,7 +670,7 @@
|
|
|
718
670
|
time = currentTime;
|
|
719
671
|
performance.push({
|
|
720
672
|
Name: message[0],
|
|
721
|
-
Arguments:
|
|
673
|
+
Arguments: message.slice(1),
|
|
722
674
|
Element: element,
|
|
723
675
|
'Execution Time': executionTime,
|
|
724
676
|
});
|
|
@@ -729,10 +681,8 @@
|
|
|
729
681
|
}, 500);
|
|
730
682
|
},
|
|
731
683
|
display: function () {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
totalTime = 0
|
|
735
|
-
;
|
|
684
|
+
let title = settings.name + ':';
|
|
685
|
+
let totalTime = 0;
|
|
736
686
|
time = false;
|
|
737
687
|
clearTimeout(module.performance.timer);
|
|
738
688
|
$.each(performance, function (index, data) {
|
|
@@ -741,35 +691,24 @@
|
|
|
741
691
|
title += ' ' + totalTime + 'ms';
|
|
742
692
|
if (performance.length > 0) {
|
|
743
693
|
console.groupCollapsed(title);
|
|
744
|
-
|
|
745
|
-
console.table(performance);
|
|
746
|
-
} else {
|
|
747
|
-
$.each(performance, function (index, data) {
|
|
748
|
-
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
|
749
|
-
});
|
|
750
|
-
}
|
|
694
|
+
console.table(performance);
|
|
751
695
|
console.groupEnd();
|
|
752
696
|
}
|
|
753
697
|
performance = [];
|
|
754
698
|
},
|
|
755
699
|
},
|
|
756
|
-
invoke: function (query, passedArguments, context) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
response
|
|
762
|
-
;
|
|
763
|
-
passedArguments = passedArguments || queryArguments;
|
|
764
|
-
context = context || element;
|
|
700
|
+
invoke: function (query, passedArguments = queryArguments, context = element) {
|
|
701
|
+
let object = instance;
|
|
702
|
+
let maxDepth;
|
|
703
|
+
let found;
|
|
704
|
+
let response;
|
|
765
705
|
if (typeof query === 'string' && object !== undefined) {
|
|
766
706
|
query = query.split(/[ .]/);
|
|
767
707
|
maxDepth = query.length - 1;
|
|
768
708
|
$.each(query, function (depth, value) {
|
|
769
|
-
|
|
709
|
+
const camelCaseValue = depth !== maxDepth
|
|
770
710
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
771
|
-
: query
|
|
772
|
-
;
|
|
711
|
+
: query;
|
|
773
712
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
774
713
|
object = object[camelCaseValue];
|
|
775
714
|
} else if (object[camelCaseValue] !== undefined) {
|
|
@@ -810,7 +749,7 @@
|
|
|
810
749
|
if (instance === undefined) {
|
|
811
750
|
module.initialize();
|
|
812
751
|
}
|
|
813
|
-
module.invoke(
|
|
752
|
+
module.invoke(parameters);
|
|
814
753
|
} else {
|
|
815
754
|
if (instance !== undefined) {
|
|
816
755
|
instance.invoke('destroy');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.70+88a499a
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(I,D,O){"use strict";function S(e){return"function"==typeof e&&"number"!=typeof e.nodeType}D=void 0!==D&&D.Math===Math?D:globalThis,I.fn.checkbox=function(c){var s,e=I(this),u=Date.now(),b=[],C=c,x="string"==typeof C,w=[].slice.call(arguments,1);return e.each(function(){var e,h=I.extend(!0,{},I.fn.checkbox.settings,c),g=h.className,n=h.namespace,p=h.selector,r=h.error,t="."+n,i="module-"+n,f=I(this),o=I(this).children(p.label),k=I(this).children(p.input),m=k[0],a=!1,v=!1,d=f.data(i),l=this,y={initialize:function(){y.verbose("Initializing checkbox",h),y.create.label(),y.bind.events(),y.set.tabbable(),y.hide.input(),y.observeChanges(),y.instantiate(),y.setup()},instantiate:function(){y.verbose("Storing instance of module",y),d=y,f.data(i,y)},destroy:function(){y.verbose("Destroying module"),y.unbind.events(),y.show.input(),f.removeData(i)},fix:{reference:function(){f.is(p.input)&&(y.debug("Behavior called on <input> adjusting invoked element"),f=f.closest(p.checkbox),y.refresh())}},setup:function(){y.set.initialLoad(),y.is.indeterminate()?(y.debug("Initial value is indeterminate"),y.indeterminate()):y.is.checked()?(y.debug("Initial value is checked"),y.check()):(y.debug("Initial value is unchecked"),y.uncheck()),y.remove.initialLoad()},refresh:function(){o=f.children(p.label),k=f.children(p.input),m=k[0]},hide:{input:function(){y.verbose("Modifying <input> z-index to be unselectable"),k.addClass(g.hidden)}},show:{input:function(){y.verbose("Modifying <input> z-index to be selectable"),k.removeClass(g.hidden)}},observeChanges:function(){"MutationObserver"in D&&((e=new MutationObserver(function(e){y.debug("DOM tree modified, updating selector cache"),y.refresh()})).observe(l,{childList:!0,subtree:!0}),y.debug("Setting up mutation observer",e))},attachEvents:function(e,n){var i=I(e);n=S(y[n])?y[n]:y.toggle,0<i.length?(y.debug("Attaching checkbox events to element",e,n),i.on("click"+t,n)):y.error(r.notFound)},preventDefaultOnInputTarget:function(){void 0!==event&&null!==event&&I(event.target).is(p.input)&&(y.verbose("Preventing default check action after manual check action"),event.preventDefault())},event:{change:function(e){y.should.ignoreCallbacks()||h.onChange.call(m)},click:function(e){var n=I(e.target);n.is(p.input)?y.verbose("Using default check action on initialized checkbox"):n.is(p.link)?y.debug("Clicking link inside checkbox, skipping toggle"):(y.toggle(),k.trigger("focus"),e.preventDefault())},keydown:function(e){var n=e.which,i=13,t=32,o=27,a=37,c=38,r=39,d=40,l=y.get.radios().not(p.disabled),s=l.index(f),u=l.length,b=!1;if(n===a||n===c?b=(0===s?u:s)-1:n!==r&&n!==d||(b=s===u-1?0:s+1),!y.should.ignoreCallbacks()&&!1!==b){if(!1===h.beforeUnchecked.apply(m))return y.verbose("Option not allowed to be unchecked, cancelling key navigation"),!1;c=I(l[b]),d=c.children(p.input);if(c.hasClass(g.readOnly)||d.prop("readonly")||!1===h.beforeChecked.apply(d[0]))return y.verbose("Next option should not allow check, cancelling key navigation"),!1}v=!1,n===o?(y.verbose("Escape key pressed blurring field"),k.trigger("blur"),v=!0,e.stopPropagation()):y.can.change()?e.ctrlKey||(n===t||n===i&&h.enableEnterKey?(y.verbose("Enter/space key pressed, toggling checkbox"),y.toggle(),v=!0):f.is(".toggle, .slider")&&!y.is.radio()&&(n===a&&y.is.checked()?(y.uncheck(),v=!0):n===r&&y.is.unchecked()&&(y.check(),v=!0))):v=!0},keyup:function(e){v&&e.preventDefault()}},check:function(){y.should.allowCheck()&&(y.debug("Checking checkbox",k),y.set.checked(),y.should.ignoreCallbacks()||(h.onChecked.call(m),y.trigger.change()),y.preventDefaultOnInputTarget())},uncheck:function(){y.should.allowUncheck()&&(y.debug("Unchecking checkbox"),y.set.unchecked(),y.should.ignoreCallbacks()||(h.onUnchecked.call(m),y.trigger.change()),y.preventDefaultOnInputTarget())},indeterminate:function(){y.should.allowIndeterminate()?y.debug("Checkbox is already indeterminate"):(y.debug("Making checkbox indeterminate"),y.set.indeterminate(),y.should.ignoreCallbacks()||(h.onIndeterminate.call(m),y.trigger.change()))},determinate:function(){y.should.allowDeterminate()?y.debug("Checkbox is already determinate"):(y.debug("Making checkbox determinate"),y.set.determinate(),y.should.ignoreCallbacks()||(h.onDeterminate.call(m),y.trigger.change()))},enable:function(){y.is.enabled()?y.debug("Checkbox is already enabled"):(y.debug("Enabling checkbox"),y.set.enabled(),y.should.ignoreCallbacks()||h.onEnable.call(m))},disable:function(){y.is.disabled()?y.debug("Checkbox is already disabled"):(y.debug("Disabling checkbox"),y.set.disabled(),y.should.ignoreCallbacks()||h.onDisable.call(m))},get:{radios:function(){var e=y.get.name();return I('input[name="'+e+'"]').closest(p.checkbox)},otherRadios:function(){return y.get.radios().not(f)},name:function(){return k.attr("name")}},is:{initialLoad:function(){return a},radio:function(){return k.hasClass(g.radio)||"radio"===k.attr("type")},indeterminate:function(){return void 0!==k.prop("indeterminate")&&k.prop("indeterminate")},checked:function(){return void 0!==k.prop("checked")&&k.prop("checked")},disabled:function(){return void 0!==k.prop("disabled")&&k.prop("disabled")},enabled:function(){return!y.is.disabled()},determinate:function(){return!y.is.indeterminate()},unchecked:function(){return!y.is.checked()}},should:{allowCheck:function(){return y.is.determinate()&&y.is.checked()&&!y.is.initialLoad()?(y.debug("Should not allow check, checkbox is already checked"),!1):!(!y.should.ignoreCallbacks()&&!1===h.beforeChecked.apply(m))||(y.debug("Should not allow check, beforeChecked cancelled"),!1)},allowUncheck:function(){return y.is.determinate()&&y.is.unchecked()&&!y.is.initialLoad()?(y.debug("Should not allow uncheck, checkbox is already unchecked"),!1):!(!y.should.ignoreCallbacks()&&!1===h.beforeUnchecked.apply(m))||(y.debug("Should not allow uncheck, beforeUnchecked cancelled"),!1)},allowIndeterminate:function(){return y.is.indeterminate()&&!y.is.initialLoad()?(y.debug("Should not allow indeterminate, checkbox is already indeterminate"),!1):!(!y.should.ignoreCallbacks()&&!1===h.beforeIndeterminate.apply(m))||(y.debug("Should not allow indeterminate, beforeIndeterminate cancelled"),!1)},allowDeterminate:function(){return y.is.determinate()&&!y.is.initialLoad()?(y.debug("Should not allow determinate, checkbox is already determinate"),!1):!(!y.should.ignoreCallbacks()&&!1===h.beforeDeterminate.apply(m))||(y.debug("Should not allow determinate, beforeDeterminate cancelled"),!1)},ignoreCallbacks:function(){return a&&!h.fireOnInit}},can:{change:function(){return!(f.hasClass(g.disabled)||f.hasClass(g.readOnly)||k.prop("disabled")||k.prop("readonly"))},uncheck:function(){return"boolean"==typeof h.uncheckable?h.uncheckable:!y.is.radio()}},set:{initialLoad:function(){a=!0},checked:function(){y.verbose("Setting class to checked"),f.removeClass(g.indeterminate).addClass(g.checked),y.is.radio()&&y.uncheckOthers(),!y.is.indeterminate()&&y.is.checked()?y.debug("Input is already checked, skipping input property change"):(y.verbose("Setting state to checked",m),k.prop("indeterminate",!1).prop("checked",!0))},unchecked:function(){y.verbose("Removing checked class"),f.removeClass(g.indeterminate).removeClass(g.checked),!y.is.indeterminate()&&y.is.unchecked()?y.debug("Input is already unchecked"):(y.debug("Setting state to unchecked"),k.prop("indeterminate",!1).prop("checked",!1))},indeterminate:function(){y.verbose("Setting class to indeterminate"),f.addClass(g.indeterminate),y.is.indeterminate()?y.debug("Input is already indeterminate, skipping input property change"):(y.debug("Setting state to indeterminate"),k.prop("indeterminate",!0))},determinate:function(){y.verbose("Removing indeterminate class"),f.removeClass(g.indeterminate),y.is.determinate()?y.debug("Input is already determinate, skipping input property change"):(y.debug("Setting state to determinate"),k.prop("indeterminate",!1))},disabled:function(){y.verbose("Setting class to disabled"),f.addClass(g.disabled),y.is.disabled()?y.debug("Input is already disabled, skipping input property change"):(y.debug("Setting state to disabled"),k.prop("disabled","disabled"))},enabled:function(){y.verbose("Removing disabled class"),f.removeClass(g.disabled),y.is.enabled()?y.debug("Input is already enabled, skipping input property change"):(y.debug("Setting state to enabled"),k.prop("disabled",!1))},tabbable:function(){y.verbose("Adding tabindex to checkbox"),void 0===k.attr("tabindex")&&k.attr("tabindex",0)}},remove:{initialLoad:function(){a=!1}},trigger:{change:function(){var e,n=k[0];n&&(e=O.createEvent("HTMLEvents"),y.verbose("Triggering native change event"),e.initEvent("change",!0,!1),n.dispatchEvent(e))}},create:{label:function(){0<k.prevAll(p.label).length?(k.prev(p.label).detach().insertAfter(k),y.debug("Moving existing label",o)):y.has.label()||(o=I("<label>").insertAfter(k),y.debug("Creating label",o))}},has:{label:function(){return 0<o.length}},bind:{events:function(){y.verbose("Attaching checkbox events"),f.on("click"+t,y.event.click).on("change"+t,y.event.change).on("keydown"+t,p.input,y.event.keydown).on("keyup"+t,p.input,y.event.keyup)}},unbind:{events:function(){y.debug("Removing events"),f.off(t)}},uncheckOthers:function(){var e=y.get.otherRadios();y.debug("Unchecking other radios",e),e.removeClass(g.checked)},toggle:function(){y.can.change()?y.is.indeterminate()||y.is.unchecked()?(y.debug("Currently unchecked"),y.check()):y.is.checked()&&y.can.uncheck()&&(y.debug("Currently checked"),y.uncheck()):y.is.radio()||y.debug("Checkbox is read-only or disabled, ignoring toggle")},setting:function(e,n){if(y.debug("Changing setting",e,n),I.isPlainObject(e))I.extend(!0,h,e);else{if(void 0===n)return h[e];I.isPlainObject(h[e])?I.extend(!0,h[e],n):h[e]=n}},internal:function(e,n){if(I.isPlainObject(e))I.extend(!0,y,e);else{if(void 0===n)return y[e];y[e]=n}},debug:function(){!h.silent&&h.debug&&(h.performance?y.performance.log(arguments):(y.debug=Function.prototype.bind.call(console.info,console,h.name+":"),y.debug.apply(console,arguments)))},verbose:function(){!h.silent&&h.verbose&&h.debug&&(h.performance?y.performance.log(arguments):(y.verbose=Function.prototype.bind.call(console.info,console,h.name+":"),y.verbose.apply(console,arguments)))},error:function(){h.silent||(y.error=Function.prototype.bind.call(console.error,console,h.name+":"),y.error.apply(console,arguments))},performance:{log:function(e){var n,i;h.performance&&(i=(n=Date.now())-(u||n),u=n,b.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:l,"Execution Time":i})),clearTimeout(y.performance.timer),y.performance.timer=setTimeout(function(){y.performance.display()},500)},display:function(){var e=h.name+":",i=0;u=!1,clearTimeout(y.performance.timer),I.each(b,function(e,n){i+=n["Execution Time"]}),e+=" "+i+"ms",0<b.length&&(console.groupCollapsed(e),console.table?console.table(b):I.each(b,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),b=[]}},invoke:function(t,e,n){var o,a,i,c=d;return e=e||w,n=n||l,"string"==typeof t&&void 0!==c&&(t=t.split(/[ .]/),o=t.length-1,I.each(t,function(e,n){var i=e!==o?n+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(I.isPlainObject(c[i])&&e!==o)c=c[i];else{if(void 0!==c[i])return a=c[i],!1;{if(!I.isPlainObject(c[n])||e===o)return void 0!==c[n]?a=c[n]:y.error(r.method,t),!1;c=c[n]}}})),S(a)?i=a.apply(n,e):void 0!==a&&(i=a),Array.isArray(s)?s.push(i):void 0!==s?s=[s,i]:void 0!==i&&(s=i),a}};x?(void 0===d&&y.initialize(),y.invoke(C)):(void 0!==d&&d.invoke("destroy"),y.initialize())}),void 0!==s?s:this},I.fn.checkbox.settings={name:"Checkbox",namespace:"checkbox",silent:!1,debug:!1,verbose:!1,performance:!0,uncheckable:"auto",fireOnInit:!1,enableEnterKey:!0,onChange:function(){},beforeChecked:function(){},beforeUnchecked:function(){},beforeDeterminate:function(){},beforeIndeterminate:function(){},onChecked:function(){},onUnchecked:function(){},onDeterminate:function(){},onIndeterminate:function(){},onEnable:function(){},onDisable:function(){},className:{checked:"checked",indeterminate:"indeterminate",disabled:"disabled",hidden:"hidden",radio:"radio",readOnly:"read-only"},error:{method:"The method you called is not defined"},selector:{checkbox:".ui.checkbox",disabled:".disabled, :has(input[disabled])",label:"label",input:'input[type="checkbox"], input[type="radio"]',link:"a[href]"}}}(jQuery,window,document);
|
|
11
|
+
!function(w,e){"use strict";function S(e){return"function"==typeof e&&"number"!=typeof e.nodeType}e=void 0!==e&&e.Math===Math?e:globalThis,w.fn.checkbox=function(...e){const n=w(this);let c=Date.now(),s=[];const u=e[0],b="string"==typeof u,h=e.slice(1);let g;return n.each(function(){const k=w.extend(!0,{},w.fn.checkbox.settings,u),p=k.className;var e=k.namespace;const f=k.selector,r=k.error,t="."+e,n="module-"+e;let m=w(this),i=w(this).children(f.label),v=w(this).children(f.input),y=v[0],o=!1,C=!1,d=m.data(n),a;const l=this,x={initialize:function(){x.verbose("Initializing checkbox",k),x.create.label(),x.bind.events(),x.set.tabbable(),x.hide.input(),x.observeChanges(),x.instantiate(),x.setup()},instantiate:function(){x.verbose("Storing instance of module",x),d=x,m.data(n,x)},destroy:function(){x.verbose("Destroying module"),x.unbind.events(),x.show.input(),m.removeData(n)},fix:{reference:function(){m.is(f.input)&&(x.debug("Behavior called on <input> adjusting invoked element"),m=m.closest(f.checkbox),x.refresh())}},setup:function(){x.set.initialLoad(),x.is.indeterminate()?(x.debug("Initial value is indeterminate"),x.indeterminate()):x.is.checked()?(x.debug("Initial value is checked"),x.check()):(x.debug("Initial value is unchecked"),x.uncheck()),x.remove.initialLoad()},refresh:function(){i=m.children(f.label),v=m.children(f.input),y=v[0]},hide:{input:function(){x.verbose("Modifying <input> z-index to be unselectable"),v.addClass(p.hidden)}},show:{input:function(){x.verbose("Modifying <input> z-index to be selectable"),v.removeClass(p.hidden)}},observeChanges:function(){(a=new MutationObserver(function(e){x.debug("DOM tree modified, updating selector cache"),x.refresh()})).observe(l,{childList:!0,subtree:!0}),x.debug("Setting up mutation observer",a)},attachEvents:function(e,n){const i=w(e);n=S(x[n])?x[n]:x.toggle,0<i.length?(x.debug("Attaching checkbox events to element",e,n),i.on("click"+t,n)):x.error(r.notFound)},event:{change:function(e){x.should.ignoreCallbacks()||k.onChange.call(y)},click:function(e){const n=w(e.target);n.is(f.input)?x.verbose("Using default check action on initialized checkbox"):n.is(f.link)?x.debug("Clicking link inside checkbox, skipping toggle"):(x.toggle(),v.trigger("focus"),e.preventDefault())},keydown:function(e){var n=e.which;const i=13,t=32,o=27,a=37,c=38,r=39,d=40,l=x.get.radios().not(f.disabled);var s=l.index(m),u=l.length;let b=!1;if(n===a||n===c?b=(0===s?u:s)-1:n!==r&&n!==d||(b=s===u-1?0:s+1),!x.should.ignoreCallbacks()&&!1!==b){if(!1===k.beforeUnchecked.call(y))return x.verbose("Option not allowed to be unchecked, cancelling key navigation"),!1;const h=w(l[b]),g=h.children(f.input);if(h.hasClass(p.readOnly)||g.prop("readonly")||!1===k.beforeChecked.call(g[0]))return x.verbose("Next option should not allow check, cancelling key navigation"),!1}C=!1,n===o?(x.verbose("Escape key pressed blurring field"),v.trigger("blur"),C=!0,e.stopPropagation()):x.can.change()?e.ctrlKey||(n===t||n===i&&k.enableEnterKey?(x.verbose("Enter/space key pressed, toggling checkbox"),x.toggle(),C=!0):m.is(".toggle, .slider")&&!x.is.radio()&&(n===a&&x.is.checked()?(x.uncheck(),C=!0):n===r&&x.is.unchecked()&&(x.check(),C=!0))):C=!0},keyup:function(e){C&&e.preventDefault()}},check:function(){x.should.allowCheck()&&(x.debug("Checking checkbox",v),x.set.checked(),x.should.ignoreCallbacks()||(k.onChecked.call(y),x.trigger.change()))},uncheck:function(){x.should.allowUncheck()&&(x.debug("Unchecking checkbox"),x.set.unchecked(),x.should.ignoreCallbacks()||(k.onUnchecked.call(y),x.trigger.change()))},indeterminate:function(){x.should.allowIndeterminate()?x.debug("Checkbox is already indeterminate"):(x.debug("Making checkbox indeterminate"),x.set.indeterminate(),x.should.ignoreCallbacks()||(k.onIndeterminate.call(y),x.trigger.change()))},determinate:function(){x.should.allowDeterminate()?x.debug("Checkbox is already determinate"):(x.debug("Making checkbox determinate"),x.set.determinate(),x.should.ignoreCallbacks()||(k.onDeterminate.call(y),x.trigger.change()))},enable:function(){x.is.enabled()?x.debug("Checkbox is already enabled"):(x.debug("Enabling checkbox"),x.set.enabled(),x.should.ignoreCallbacks()||k.onEnable.call(y))},disable:function(){x.is.disabled()?x.debug("Checkbox is already disabled"):(x.debug("Disabling checkbox"),x.set.disabled(),x.should.ignoreCallbacks()||k.onDisable.call(y))},get:{radios:function(){var e=x.get.name();return w('input[name="'+CSS.escape(e)+'"]').closest(f.checkbox)},otherRadios:function(){return x.get.radios().not(m)},name:function(){return v.attr("name")}},is:{initialLoad:function(){return o},radio:function(){return v.hasClass(p.radio)||"radio"===v.attr("type")},indeterminate:function(){return void 0!==v.prop("indeterminate")&&v.prop("indeterminate")},checked:function(){return void 0!==v.prop("checked")&&v.prop("checked")},disabled:function(){return void 0!==v.prop("disabled")&&v.prop("disabled")},enabled:function(){return!x.is.disabled()},determinate:function(){return!x.is.indeterminate()},unchecked:function(){return!x.is.checked()}},should:{allowCheck:function(){return x.is.determinate()&&x.is.checked()&&!x.is.initialLoad()?(x.debug("Should not allow check, checkbox is already checked"),!1):!(!x.should.ignoreCallbacks()&&!1===k.beforeChecked.call(y))||(x.debug("Should not allow check, beforeChecked cancelled"),!1)},allowUncheck:function(){return x.is.determinate()&&x.is.unchecked()&&!x.is.initialLoad()?(x.debug("Should not allow uncheck, checkbox is already unchecked"),!1):!(!x.should.ignoreCallbacks()&&!1===k.beforeUnchecked.call(y))||(x.debug("Should not allow uncheck, beforeUnchecked cancelled"),!1)},allowIndeterminate:function(){return x.is.indeterminate()&&!x.is.initialLoad()?(x.debug("Should not allow indeterminate, checkbox is already indeterminate"),!1):!(!x.should.ignoreCallbacks()&&!1===k.beforeIndeterminate.call(y))||(x.debug("Should not allow indeterminate, beforeIndeterminate cancelled"),!1)},allowDeterminate:function(){return x.is.determinate()&&!x.is.initialLoad()?(x.debug("Should not allow determinate, checkbox is already determinate"),!1):!(!x.should.ignoreCallbacks()&&!1===k.beforeDeterminate.call(y))||(x.debug("Should not allow determinate, beforeDeterminate cancelled"),!1)},ignoreCallbacks:function(){return o&&!k.fireOnInit}},can:{change:function(){return!(m.hasClass(p.disabled)||m.hasClass(p.readOnly)||v.prop("disabled")||v.prop("readonly"))},uncheck:function(){return"boolean"==typeof k.uncheckable?k.uncheckable:!x.is.radio()}},set:{initialLoad:function(){o=!0},checked:function(){x.verbose("Setting class to checked"),m.removeClass(p.indeterminate).addClass(p.checked),x.is.radio()&&x.uncheckOthers(),!x.is.indeterminate()&&x.is.checked()?x.debug("Input is already checked, skipping input property change"):(x.verbose("Setting state to checked",y),v.prop("indeterminate",!1).prop("checked",!0))},unchecked:function(){x.verbose("Removing checked class"),m.removeClass(p.indeterminate).removeClass(p.checked),!x.is.indeterminate()&&x.is.unchecked()?x.debug("Input is already unchecked"):(x.debug("Setting state to unchecked"),v.prop("indeterminate",!1).prop("checked",!1))},indeterminate:function(){x.verbose("Setting class to indeterminate"),m.addClass(p.indeterminate),x.is.indeterminate()?x.debug("Input is already indeterminate, skipping input property change"):(x.debug("Setting state to indeterminate"),v.prop("indeterminate",!0))},determinate:function(){x.verbose("Removing indeterminate class"),m.removeClass(p.indeterminate),x.is.determinate()?x.debug("Input is already determinate, skipping input property change"):(x.debug("Setting state to determinate"),v.prop("indeterminate",!1))},disabled:function(){x.verbose("Setting class to disabled"),m.addClass(p.disabled),x.is.disabled()?x.debug("Input is already disabled, skipping input property change"):(x.debug("Setting state to disabled"),v.prop("disabled","disabled"))},enabled:function(){x.verbose("Removing disabled class"),m.removeClass(p.disabled),x.is.enabled()?x.debug("Input is already enabled, skipping input property change"):(x.debug("Setting state to enabled"),v.prop("disabled",!1))},tabbable:function(){x.verbose("Adding tabindex to checkbox"),void 0===v.attr("tabindex")&&v.attr("tabindex",0)}},remove:{initialLoad:function(){o=!1}},trigger:{change:function(){const e=v[0];var n;e&&(n=new Event("change",{bubbles:!0}),x.verbose("Triggering native change event"),e.dispatchEvent(n))}},create:{label:function(){0<v.prevAll(f.label).length?(v.prev(f.label).detach().insertAfter(v),x.debug("Moving existing label",i)):x.has.label()||(i=w("<label>").insertAfter(v),x.debug("Creating label",i))}},has:{label:function(){return 0<i.length}},bind:{events:function(){x.verbose("Attaching checkbox events"),m.on("click"+t,x.event.click).on("change"+t,x.event.change).on("keydown"+t,f.input,x.event.keydown).on("keyup"+t,f.input,x.event.keyup)}},unbind:{events:function(){x.debug("Removing events"),m.off(t)}},uncheckOthers:function(){const e=x.get.otherRadios();x.debug("Unchecking other radios",e),e.removeClass(p.checked)},toggle:function(){x.can.change()?x.is.indeterminate()||x.is.unchecked()?(x.debug("Currently unchecked"),x.check()):x.is.checked()&&x.can.uncheck()&&(x.debug("Currently checked"),x.uncheck()):x.is.radio()||x.debug("Checkbox is read-only or disabled, ignoring toggle")},setting:function(e,n){if(x.debug("Changing setting",e,n),w.isPlainObject(e))w.extend(!0,k,e);else{if(void 0===n)return k[e];w.isPlainObject(k[e])?w.extend(!0,k[e],n):k[e]=n}},internal:function(e,n){if(w.isPlainObject(e))w.extend(!0,x,e);else{if(void 0===n)return x[e];x[e]=n}},debug:function(...e){!k.silent&&k.debug&&(k.performance?x.performance.log(e):(x.debug=Function.prototype.bind.call(console.info,console,k.name+":"),x.debug.apply(console,e)))},verbose:function(...e){!k.silent&&k.verbose&&k.debug&&(k.performance?x.performance.log(e):(x.verbose=Function.prototype.bind.call(console.info,console,k.name+":"),x.verbose.apply(console,e)))},error:function(...e){k.silent||(x.error=Function.prototype.bind.call(console.error,console,k.name+":"),x.error.apply(console,e))},performance:{log:function(e){var n,i;k.performance&&(i=(n=Date.now())-(c||n),c=n,s.push({Name:e[0],Arguments:e.slice(1),Element:l,"Execution Time":i})),clearTimeout(x.performance.timer),x.performance.timer=setTimeout(function(){x.performance.display()},500)},display:function(){var e=k.name+":";let i=0;c=!1,clearTimeout(x.performance.timer),w.each(s,function(e,n){i+=n["Execution Time"]}),e+=" "+i+"ms",0<s.length&&(console.groupCollapsed(e),console.table(s),console.groupEnd()),s=[]}},invoke:function(t,e=h,n=l){let o=d,a,c,i;return"string"==typeof t&&void 0!==o&&(t=t.split(/[ .]/),a=t.length-1,w.each(t,function(e,n){var i=e!==a?n+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(w.isPlainObject(o[i])&&e!==a)o=o[i];else{if(void 0!==o[i])return c=o[i],!1;{if(!w.isPlainObject(o[n])||e===a)return void 0!==o[n]?c=o[n]:x.error(r.method,t),!1;o=o[n]}}})),S(c)?i=c.apply(n,e):void 0!==c&&(i=c),Array.isArray(g)?g.push(i):void 0!==g?g=[g,i]:void 0!==i&&(g=i),c}};b?(void 0===d&&x.initialize(),x.invoke(u)):(void 0!==d&&d.invoke("destroy"),x.initialize())}),void 0!==g?g:this},w.fn.checkbox.settings={name:"Checkbox",namespace:"checkbox",silent:!1,debug:!1,verbose:!1,performance:!0,uncheckable:"auto",fireOnInit:!1,enableEnterKey:!0,onChange:function(){},beforeChecked:function(){},beforeUnchecked:function(){},beforeDeterminate:function(){},beforeIndeterminate:function(){},onChecked:function(){},onUnchecked:function(){},onDeterminate:function(){},onIndeterminate:function(){},onEnable:function(){},onDisable:function(){},className:{checked:"checked",indeterminate:"indeterminate",disabled:"disabled",hidden:"hidden",radio:"radio",readOnly:"read-only"},error:{method:"The method you called is not defined"},selector:{checkbox:".ui.checkbox",disabled:".disabled, :has(input[disabled])",label:"label",input:'input[type="checkbox"], input[type="radio"]',link:"a[href]"}}}(jQuery,window,document);
|