fomantic-ui 2.10.0-beta.2 → 2.10.0-beta.21
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/.all-contributorsrc +9 -0
- package/.eslintrc.js +0 -10
- package/CHANGELOG.md +5289 -2325
- package/CONTRIBUTING.md +4 -1
- package/CONTRIBUTORS.md +1 -0
- package/FAQ.md +7 -2
- package/README.md +5 -9
- package/ROADMAP.md +4 -4
- package/SECURITY.md +8 -7
- package/changelog-setup.js +85 -69
- package/changelog-template.hbs +256 -251
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +103 -142
- 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 +157 -210
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -2
- package/dist/components/button.min.css +2 -2
- package/dist/components/calendar.css +1 -2
- package/dist/components/calendar.js +314 -352
- 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 -2
- package/dist/components/checkbox.js +85 -135
- package/dist/components/checkbox.min.css +2 -2
- 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 +2 -4
- package/dist/components/container.min.css +2 -2
- package/dist/components/dimmer.css +1 -11
- package/dist/components/dimmer.js +61 -94
- package/dist/components/dimmer.min.css +2 -2
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -2
- package/dist/components/divider.min.css +2 -2
- package/dist/components/dropdown.css +30 -51
- package/dist/components/dropdown.js +754 -1096
- 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 +84 -114
- 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 +2 -3
- package/dist/components/flyout.js +225 -355
- package/dist/components/flyout.min.css +2 -2
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +5 -95
- package/dist/components/form.js +335 -444
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +2 -58
- package/dist/components/grid.min.css +2 -2
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +4 -4
- 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 +1 -536
- 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 +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -3
- package/dist/components/list.min.css +2 -2
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +40 -48
- package/dist/components/menu.min.css +2 -2
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +5 -9
- package/dist/components/modal.js +260 -384
- 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 +68 -98
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -2
- package/dist/components/popup.js +197 -271
- package/dist/components/popup.min.css +2 -2
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +109 -144
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +90 -123
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +2 -9
- package/dist/components/search.js +276 -379
- package/dist/components/search.min.css +2 -2
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +2 -7
- package/dist/components/segment.min.css +2 -2
- package/dist/components/shape.css +1 -2
- package/dist/components/shape.js +158 -224
- package/dist/components/shape.min.css +2 -2
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +2 -3
- package/dist/components/sidebar.js +124 -206
- package/dist/components/sidebar.min.css +2 -2
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +9 -25
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +2 -2
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +246 -329
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +70 -100
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +135 -180
- 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 +176 -241
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +3 -37
- 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 -3
- package/dist/components/toast.js +108 -147
- 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 +91 -146
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +146 -224
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +3945 -8759
- package/dist/semantic.js +4408 -6193
- 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 +3 -6
- package/scripts/nightly-version.js +7 -10
- package/src/README.md +3 -3
- package/src/definitions/behaviors/api.js +156 -209
- package/src/definitions/behaviors/form.js +334 -443
- package/src/definitions/behaviors/state.js +69 -99
- package/src/definitions/behaviors/visibility.js +145 -223
- package/src/definitions/collections/form.less +1 -13
- package/src/definitions/collections/grid.less +1 -61
- package/src/definitions/collections/menu.less +101 -107
- package/src/definitions/collections/table.less +1 -35
- package/src/definitions/elements/input.less +1 -61
- package/src/definitions/elements/segment.less +0 -6
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/globals/site.less +2 -18
- package/src/definitions/modules/accordion.js +102 -141
- package/src/definitions/modules/calendar.js +313 -351
- package/src/definitions/modules/checkbox.js +84 -134
- package/src/definitions/modules/dimmer.js +60 -93
- package/src/definitions/modules/dimmer.less +0 -9
- package/src/definitions/modules/dropdown.js +753 -1095
- package/src/definitions/modules/dropdown.less +31 -47
- package/src/definitions/modules/embed.js +83 -113
- package/src/definitions/modules/flyout.js +224 -354
- package/src/definitions/modules/modal.js +259 -383
- package/src/definitions/modules/modal.less +1 -1
- package/src/definitions/modules/nag.js +67 -97
- package/src/definitions/modules/popup.js +196 -270
- package/src/definitions/modules/progress.js +108 -143
- package/src/definitions/modules/rating.js +89 -122
- package/src/definitions/modules/search.js +275 -378
- package/src/definitions/modules/search.less +0 -3
- package/src/definitions/modules/shape.js +157 -223
- package/src/definitions/modules/sidebar.js +123 -205
- package/src/definitions/modules/slider.js +245 -328
- package/src/definitions/modules/slider.less +1 -1
- package/src/definitions/modules/sticky.js +134 -179
- package/src/definitions/modules/tab.js +175 -240
- package/src/definitions/modules/toast.js +107 -146
- package/src/definitions/modules/toast.less +1 -1
- package/src/definitions/modules/transition.js +90 -145
- package/src/theme.less +0 -13
- package/src/themes/basic/elements/icon.variables +1 -1
- package/src/themes/chubby/collections/menu.variables +1 -1
- package/src/themes/default/collections/grid.variables +0 -30
- package/src/themes/default/collections/menu.variables +23 -23
- package/src/themes/default/collections/table.variables +1 -5
- package/src/themes/default/elements/icon.variables +3 -3
- package/src/themes/default/globals/site.variables +8 -15
- package/src/themes/default/globals/variation.variables +3 -3
- package/src/themes/default/modules/dropdown.variables +1 -0
- package/src/themes/default/modules/slider.variables +1 -1
- package/src/themes/github/elements/icon.variables +1 -1
- package/src/themes/material/elements/icon.variables +1 -1
- package/tasks/README.md +1 -1
- package/tasks/admin/components/create.js +89 -122
- package/tasks/admin/components/init.js +34 -65
- package/tasks/admin/components/update.js +50 -61
- package/tasks/admin/distributions/create.js +71 -111
- package/tasks/admin/distributions/init.js +32 -63
- package/tasks/admin/distributions/update.js +49 -57
- package/tasks/admin/publish.js +1 -1
- package/tasks/admin/register.js +14 -19
- package/tasks/admin/release.js +2 -2
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +59 -68
- package/tasks/build/javascript.js +48 -56
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -8
- package/tasks/clean.js +5 -7
- package/tasks/collections/admin.js +14 -16
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +4 -6
- 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 +9 -19
- package/tasks/config/admin/templates/README.md +2 -2
- package/tasks/config/admin/templates/bower.json +2 -4
- package/tasks/config/admin/templates/composer.json +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -4
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/defaults.js +0 -1
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +27 -35
- package/tasks/config/project/install.js +64 -82
- package/tasks/config/project/release.js +7 -9
- package/tasks/config/tasks.js +10 -21
- package/tasks/config/user.js +14 -20
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +30 -39
- package/tasks/docs/serve.js +23 -27
- package/tasks/install.js +94 -128
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +3 -5
- package/tasks/watch.js +13 -13
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
- package/types/fomantic-ui-calendar.d.ts +1 -1
- package/types/fomantic-ui-dropdown.d.ts +45 -1
- package/types/fomantic-ui-embed.d.ts +1 -1
- package/types/fomantic-ui-flyout.d.ts +1 -1
- package/types/fomantic-ui-form.d.ts +0 -7
- package/types/fomantic-ui-modal.d.ts +1 -1
- package/types/fomantic-ui-search.d.ts +12 -6
- package/types/fomantic-ui-toast.d.ts +1 -1
- package/src/themes/basic/assets/fonts/icons.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- package/src/themes/default/assets/fonts/brand-icons.woff +0 -0
- package/src/themes/default/assets/fonts/icons.woff +0 -0
- package/src/themes/default/assets/fonts/outline-icons.woff +0 -0
- package/src/themes/github/assets/fonts/octicons.woff +0 -0
- package/src/themes/material/assets/fonts/icons.woff +0 -0
package/dist/components/tab.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.21+d6168a0 - Tab
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -24,66 +24,62 @@
|
|
24
24
|
: globalThis;
|
25
25
|
|
26
26
|
$.fn.tab = function (parameters) {
|
27
|
-
|
28
|
-
|
29
|
-
$
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
$context = win.frameElement ? contextCheck(context, win.parent) : window;
|
47
|
-
}
|
27
|
+
// use window context if none specified
|
28
|
+
let $allModules = isFunction(this)
|
29
|
+
? $(window)
|
30
|
+
: $(this);
|
31
|
+
let $document = $(document);
|
32
|
+
let time = Date.now();
|
33
|
+
let performance = [];
|
34
|
+
|
35
|
+
let query = arguments[0];
|
36
|
+
let methodInvoked = typeof query === 'string';
|
37
|
+
let queryArguments = [].slice.call(arguments, 1);
|
38
|
+
let contextCheck = function (context, win) {
|
39
|
+
let $context;
|
40
|
+
if ([window, document].indexOf(context) >= 0) {
|
41
|
+
$context = $(context);
|
42
|
+
} else {
|
43
|
+
$context = $(win.document).find(context);
|
44
|
+
if ($context.length === 0) {
|
45
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : window;
|
48
46
|
}
|
47
|
+
}
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
;
|
49
|
+
return $context;
|
50
|
+
};
|
51
|
+
let initializedHistory = false;
|
52
|
+
let returnedValue;
|
55
53
|
|
56
54
|
$allModules.each(function () {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
: $.extend({}, $.fn.tab.settings),
|
55
|
+
let settings = $.isPlainObject(parameters)
|
56
|
+
? $.extend(true, {}, $.fn.tab.settings, parameters)
|
57
|
+
: $.extend({}, $.fn.tab.settings);
|
61
58
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
let className = settings.className;
|
60
|
+
let metadata = settings.metadata;
|
61
|
+
let selector = settings.selector;
|
62
|
+
let error = settings.error;
|
63
|
+
let regExp = settings.regExp;
|
67
64
|
|
68
|
-
|
69
|
-
|
65
|
+
let eventNamespace = '.' + settings.namespace;
|
66
|
+
let moduleNamespace = 'module-' + settings.namespace;
|
70
67
|
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
let $module = $(this);
|
69
|
+
let $context;
|
70
|
+
let $tabs;
|
74
71
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
72
|
+
let cache = {};
|
73
|
+
let firstLoad = true;
|
74
|
+
let recursionDepth = 0;
|
75
|
+
let element = this;
|
76
|
+
let instance = $module.data(moduleNamespace);
|
80
77
|
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
let activeTabPath;
|
79
|
+
let parameterArray;
|
80
|
+
let module;
|
84
81
|
|
85
|
-
|
86
|
-
;
|
82
|
+
let historyEvent;
|
87
83
|
|
88
84
|
module = {
|
89
85
|
|
@@ -103,14 +99,14 @@
|
|
103
99
|
initializedHistory = true;
|
104
100
|
}
|
105
101
|
|
106
|
-
|
102
|
+
let activeTab = module.determine.activeTab();
|
107
103
|
if (settings.autoTabActivation && instance === undefined && activeTab === null) {
|
108
104
|
activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
|
109
105
|
module.debug('No active tab detected, setting tab active', activeTab);
|
110
106
|
module.changeTab(activeTab);
|
111
107
|
}
|
112
108
|
if (activeTab !== null && settings.history && settings.historyType === 'state') {
|
113
|
-
|
109
|
+
let autoUpdate = $.address.autoUpdate();
|
114
110
|
$.address.autoUpdate(false);
|
115
111
|
$.address.value(activeTab);
|
116
112
|
$.address.autoUpdate(autoUpdate);
|
@@ -123,16 +119,14 @@
|
|
123
119
|
module.verbose('Storing instance of module', module);
|
124
120
|
instance = module;
|
125
121
|
$module
|
126
|
-
.data(moduleNamespace, module)
|
127
|
-
;
|
122
|
+
.data(moduleNamespace, module);
|
128
123
|
},
|
129
124
|
|
130
125
|
destroy: function () {
|
131
126
|
module.debug('Destroying tabs', $module);
|
132
127
|
$module
|
133
128
|
.removeData(moduleNamespace)
|
134
|
-
.off(eventNamespace)
|
135
|
-
;
|
129
|
+
.off(eventNamespace);
|
136
130
|
},
|
137
131
|
|
138
132
|
bind: {
|
@@ -141,16 +135,13 @@
|
|
141
135
|
if (!isWindow(element)) {
|
142
136
|
module.debug('Attaching tab activation events to element', $module);
|
143
137
|
$module
|
144
|
-
.on('click' + eventNamespace, module.event.click)
|
145
|
-
;
|
138
|
+
.on('click' + eventNamespace, module.event.click);
|
146
139
|
}
|
147
140
|
},
|
148
141
|
},
|
149
142
|
|
150
143
|
determineTabs: function () {
|
151
|
-
|
152
|
-
$reference
|
153
|
-
;
|
144
|
+
let $reference;
|
154
145
|
|
155
146
|
// determine tab context
|
156
147
|
if (settings.context === 'parent') {
|
@@ -190,8 +181,7 @@
|
|
190
181
|
if (settings.path !== false) {
|
191
182
|
$.address
|
192
183
|
.history(true)
|
193
|
-
.state(settings.path)
|
194
|
-
;
|
184
|
+
.state(settings.path);
|
195
185
|
$(window).trigger('popstate');
|
196
186
|
} else {
|
197
187
|
module.error(error.path);
|
@@ -200,17 +190,14 @@
|
|
200
190
|
}
|
201
191
|
}
|
202
192
|
$.address
|
203
|
-
.bind('change', module.event.history.change)
|
204
|
-
;
|
193
|
+
.bind('change', module.event.history.change);
|
205
194
|
|
206
195
|
return true;
|
207
196
|
},
|
208
197
|
|
209
198
|
event: {
|
210
199
|
click: function (event) {
|
211
|
-
|
212
|
-
tabPath = $(this).data(metadata.tab)
|
213
|
-
;
|
200
|
+
let tabPath = $(this).data(metadata.tab);
|
214
201
|
if (tabPath !== undefined) {
|
215
202
|
if (settings.history) {
|
216
203
|
module.verbose('Updating page state', event);
|
@@ -226,10 +213,8 @@
|
|
226
213
|
},
|
227
214
|
history: {
|
228
215
|
change: function (event) {
|
229
|
-
|
230
|
-
|
231
|
-
pageTitle = settings.templates.determineTitle(tabPath) || false
|
232
|
-
;
|
216
|
+
let tabPath = event.pathNames.join('/') || module.get.initialPath();
|
217
|
+
let pageTitle = settings.templates.determineTitle(tabPath) || false;
|
233
218
|
module.performance.display();
|
234
219
|
module.debug('History change event', tabPath, event);
|
235
220
|
historyEvent = event;
|
@@ -269,21 +254,11 @@
|
|
269
254
|
},
|
270
255
|
},
|
271
256
|
|
272
|
-
escape: {
|
273
|
-
string: function (text) {
|
274
|
-
text = String(text);
|
275
|
-
|
276
|
-
return text.replace(regExp.escape, '\\$&');
|
277
|
-
},
|
278
|
-
},
|
279
|
-
|
280
257
|
set: {
|
281
258
|
auto: function () {
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
: '/{$tab}'
|
286
|
-
;
|
259
|
+
let url = typeof settings.path === 'string'
|
260
|
+
? settings.path.replace(/\/$/, '') + '/{$tab}'
|
261
|
+
: '/{$tab}';
|
287
262
|
module.verbose('Setting up automatic tab retrieval from server', url);
|
288
263
|
if ($.isPlainObject(settings.apiSettings)) {
|
289
264
|
settings.apiSettings.url = url;
|
@@ -294,17 +269,14 @@
|
|
294
269
|
}
|
295
270
|
},
|
296
271
|
loading: function (tabPath) {
|
297
|
-
|
298
|
-
|
299
|
-
isLoading = $tab.hasClass(className.loading)
|
300
|
-
;
|
272
|
+
let $tab = module.get.tabElement(tabPath);
|
273
|
+
let isLoading = $tab.hasClass(className.loading);
|
301
274
|
if (!isLoading) {
|
302
275
|
module.verbose('Setting loading state for', $tab);
|
303
276
|
$tab
|
304
277
|
.addClass(className.loading)
|
305
278
|
.siblings($tabs)
|
306
|
-
.removeClass(className.active + ' ' + className.loading)
|
307
|
-
;
|
279
|
+
.removeClass(className.active + ' ' + className.loading);
|
308
280
|
if ($tab.length > 0) {
|
309
281
|
settings.onRequest.call($tab[0], tabPath);
|
310
282
|
}
|
@@ -316,30 +288,26 @@
|
|
316
288
|
},
|
317
289
|
|
318
290
|
changeTab: function (tabPath) {
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
: module.get.defaultPathArray(tabPath)
|
327
|
-
;
|
291
|
+
let pushStateAvailable = window.history && window.history.pushState;
|
292
|
+
let shouldIgnoreLoad = pushStateAvailable && settings.ignoreFirstLoad && firstLoad;
|
293
|
+
let remoteContent = settings.auto || $.isPlainObject(settings.apiSettings);
|
294
|
+
// only add the default path if not remote content
|
295
|
+
let pathArray = remoteContent && !shouldIgnoreLoad
|
296
|
+
? module.utilities.pathToArray(tabPath)
|
297
|
+
: module.get.defaultPathArray(tabPath);
|
328
298
|
tabPath = module.utilities.arrayToPath(pathArray);
|
329
299
|
$.each(pathArray, function (index, tab) {
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
isLastTab
|
342
|
-
;
|
300
|
+
let currentPathArray = pathArray.slice(0, index + 1);
|
301
|
+
let currentPath = module.utilities.arrayToPath(currentPathArray);
|
302
|
+
|
303
|
+
let isTab = module.is.tab(currentPath);
|
304
|
+
let isLastIndex = index + 1 === pathArray.length;
|
305
|
+
|
306
|
+
let $tab = module.get.tabElement(currentPath);
|
307
|
+
let $anchor;
|
308
|
+
let nextPathArray;
|
309
|
+
let nextPath;
|
310
|
+
let isLastTab;
|
343
311
|
module.verbose('Looking for tab', tab);
|
344
312
|
if (isTab) {
|
345
313
|
module.verbose('Tab was found', tab);
|
@@ -388,11 +356,10 @@
|
|
388
356
|
settings.onLoad.call($tab[0], currentPath, parameterArray, historyEvent);
|
389
357
|
} else if (tabPath.search('/') === -1 && tabPath !== '') {
|
390
358
|
// look for in page anchor
|
391
|
-
tabPath =
|
392
|
-
$anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]');
|
359
|
+
$anchor = $('#' + CSS.escape(tabPath) + ', a[name="' + CSS.escape(tabPath) + '"]');
|
393
360
|
currentPath = $anchor.closest('[data-tab]').data(metadata.tab);
|
394
361
|
$tab = module.get.tabElement(currentPath);
|
395
|
-
// if anchor exists use parent tab
|
362
|
+
// if anchor exists, use parent tab
|
396
363
|
if ($anchor && $anchor.length > 0 && currentPath) {
|
397
364
|
module.debug('Anchor link used, opening parent tab', $tab, $anchor);
|
398
365
|
if (settings.onBeforeChange.call(element, currentPath) === false) {
|
@@ -424,11 +391,9 @@
|
|
424
391
|
},
|
425
392
|
|
426
393
|
scrollTo: function ($element) {
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
: false
|
431
|
-
;
|
394
|
+
let scrollOffset = $element && $element.length > 0
|
395
|
+
? $element.offset().top
|
396
|
+
: false;
|
432
397
|
if (scrollOffset !== false) {
|
433
398
|
module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
|
434
399
|
$document.scrollTop(scrollOffset);
|
@@ -437,18 +402,15 @@
|
|
437
402
|
|
438
403
|
update: {
|
439
404
|
content: function (tabPath, html, evaluateScripts) {
|
440
|
-
|
441
|
-
|
442
|
-
tab = $tab[0]
|
443
|
-
;
|
405
|
+
let $tab = module.get.tabElement(tabPath);
|
406
|
+
let tab = $tab[0];
|
444
407
|
evaluateScripts = evaluateScripts !== undefined
|
445
408
|
? evaluateScripts
|
446
409
|
: settings.evaluateScripts;
|
447
410
|
if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && typeof html !== 'string') {
|
448
411
|
$tab
|
449
412
|
.empty()
|
450
|
-
.append($(html).clone(true))
|
451
|
-
;
|
413
|
+
.append($(html).clone(true));
|
452
414
|
} else {
|
453
415
|
if (evaluateScripts) {
|
454
416
|
module.debug('Updating HTML and evaluating inline scripts', tabPath, html);
|
@@ -464,50 +426,46 @@
|
|
464
426
|
fetch: {
|
465
427
|
|
466
428
|
content: function (tabPath, fullTabPath) {
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
},
|
502
|
-
urlData: {
|
503
|
-
tab: fullTabPath,
|
504
|
-
},
|
429
|
+
let $tab = module.get.tabElement(tabPath);
|
430
|
+
let apiSettings = {
|
431
|
+
dataType: 'html',
|
432
|
+
encodeParameters: false,
|
433
|
+
on: 'now',
|
434
|
+
cache: settings.alwaysRefresh,
|
435
|
+
onSuccess: function (response) {
|
436
|
+
if (settings.cacheType === 'response') {
|
437
|
+
module.cache.add(fullTabPath, response);
|
438
|
+
}
|
439
|
+
module.update.content(tabPath, response);
|
440
|
+
if (tabPath == activeTabPath) {
|
441
|
+
module.debug('Content loaded', tabPath);
|
442
|
+
module.activate.tab(tabPath);
|
443
|
+
} else {
|
444
|
+
module.debug('Content loaded in background', tabPath);
|
445
|
+
}
|
446
|
+
settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
447
|
+
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
|
448
|
+
|
449
|
+
if (settings.loadOnce) {
|
450
|
+
module.cache.add(fullTabPath, true);
|
451
|
+
} else if (typeof settings.cacheType === 'string' && settings.cacheType.toLowerCase() === 'dom' && $tab.children().length > 0) {
|
452
|
+
setTimeout(function () {
|
453
|
+
let $clone = $tab.children().clone(true);
|
454
|
+
$clone = $clone.not('script');
|
455
|
+
module.cache.add(fullTabPath, $clone);
|
456
|
+
}, 0);
|
457
|
+
} else {
|
458
|
+
module.cache.add(fullTabPath, $tab.html());
|
459
|
+
}
|
460
|
+
},
|
461
|
+
urlData: {
|
462
|
+
tab: fullTabPath,
|
505
463
|
},
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
;
|
464
|
+
};
|
465
|
+
let request = $tab.api('get request') || false;
|
466
|
+
let existingRequest = request && request.state() === 'pending';
|
467
|
+
let requestSettings;
|
468
|
+
let cachedContent;
|
511
469
|
|
512
470
|
fullTabPath = fullTabPath || tabPath;
|
513
471
|
cachedContent = module.cache.read(fullTabPath);
|
@@ -543,42 +501,34 @@
|
|
543
501
|
module.activate.navigation(tabPath);
|
544
502
|
},
|
545
503
|
tab: function (tabPath) {
|
546
|
-
|
547
|
-
|
548
|
-
$
|
549
|
-
|
550
|
-
|
551
|
-
isActive = $tab.hasClass(className.active)
|
552
|
-
;
|
504
|
+
let $tab = module.get.tabElement(tabPath);
|
505
|
+
let $deactiveTabs = settings.deactivate === 'siblings'
|
506
|
+
? $tab.siblings($tabs)
|
507
|
+
: $tabs.not($tab);
|
508
|
+
let isActive = $tab.hasClass(className.active);
|
553
509
|
module.verbose('Showing tab content for', $tab);
|
554
510
|
if (!isActive) {
|
555
511
|
$tab
|
556
|
-
.addClass(className.active)
|
557
|
-
;
|
512
|
+
.addClass(className.active);
|
558
513
|
$deactiveTabs
|
559
|
-
.removeClass(className.active + ' ' + className.loading)
|
560
|
-
;
|
514
|
+
.removeClass(className.active + ' ' + className.loading);
|
561
515
|
if ($tab.length > 0) {
|
562
516
|
settings.onVisible.call($tab[0], tabPath);
|
563
517
|
}
|
564
518
|
}
|
565
519
|
},
|
566
520
|
navigation: function (tabPath) {
|
567
|
-
|
568
|
-
|
569
|
-
$
|
570
|
-
|
571
|
-
|
572
|
-
isActive = $navigation.hasClass(className.active)
|
573
|
-
;
|
521
|
+
let $navigation = module.get.navElement(tabPath);
|
522
|
+
let $deactiveNavigation = settings.deactivate === 'siblings'
|
523
|
+
? $navigation.siblings($allModules)
|
524
|
+
: $allModules.not($navigation);
|
525
|
+
let isActive = $navigation.hasClass(className.active);
|
574
526
|
module.verbose('Activating tab navigation for', $navigation, tabPath);
|
575
527
|
if (!isActive) {
|
576
528
|
$navigation
|
577
|
-
.addClass(className.active)
|
578
|
-
;
|
529
|
+
.addClass(className.active);
|
579
530
|
$deactiveNavigation
|
580
|
-
.removeClass(className.active + ' ' + className.loading)
|
581
|
-
;
|
531
|
+
.removeClass(className.active + ' ' + className.loading);
|
582
532
|
}
|
583
533
|
},
|
584
534
|
},
|
@@ -590,13 +540,11 @@
|
|
590
540
|
},
|
591
541
|
navigation: function () {
|
592
542
|
$allModules
|
593
|
-
.removeClass(className.active)
|
594
|
-
;
|
543
|
+
.removeClass(className.active);
|
595
544
|
},
|
596
545
|
tabs: function () {
|
597
546
|
$tabs
|
598
|
-
.removeClass(className.active + ' ' + className.loading)
|
599
|
-
;
|
547
|
+
.removeClass(className.active + ' ' + className.loading);
|
600
548
|
},
|
601
549
|
},
|
602
550
|
|
@@ -615,15 +563,13 @@
|
|
615
563
|
path: function () {
|
616
564
|
return $.address.value();
|
617
565
|
},
|
618
|
-
// adds default tabs to tab path
|
566
|
+
// adds default tabs to the tab path
|
619
567
|
defaultPathArray: function (tabPath) {
|
620
568
|
return module.utilities.pathToArray(module.get.defaultPath(tabPath));
|
621
569
|
},
|
622
570
|
defaultPath: function (tabPath) {
|
623
|
-
|
624
|
-
|
625
|
-
defaultTab = $defaultNav.data(metadata.tab) || false
|
626
|
-
;
|
571
|
+
let $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + CSS.escape(tabPath) + '/"]').eq(0);
|
572
|
+
let defaultTab = $defaultNav.data(metadata.tab) || false;
|
627
573
|
if (defaultTab) {
|
628
574
|
module.debug('Found default tab', defaultTab);
|
629
575
|
if (recursionDepth < settings.maxDepth) {
|
@@ -642,20 +588,18 @@
|
|
642
588
|
navElement: function (tabPath) {
|
643
589
|
tabPath = tabPath || activeTabPath;
|
644
590
|
|
645
|
-
return $allModules.filter('[data-' + metadata.tab + '="' +
|
591
|
+
return $allModules.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
|
646
592
|
},
|
647
593
|
tabElement: function (tabPath) {
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
lastTab
|
653
|
-
;
|
594
|
+
let $fullPathTab;
|
595
|
+
let $simplePathTab;
|
596
|
+
let tabPathArray;
|
597
|
+
let lastTab;
|
654
598
|
tabPath = tabPath || activeTabPath;
|
655
599
|
tabPathArray = module.utilities.pathToArray(tabPath);
|
656
600
|
lastTab = module.utilities.last(tabPathArray);
|
657
|
-
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' +
|
658
|
-
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' +
|
601
|
+
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
|
602
|
+
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + CSS.escape(lastTab) + '"]');
|
659
603
|
|
660
604
|
return $fullPathTab.length > 0
|
661
605
|
? $fullPathTab
|
@@ -668,16 +612,14 @@
|
|
668
612
|
|
669
613
|
determine: {
|
670
614
|
activeTab: function () {
|
671
|
-
|
615
|
+
let activeTab = null;
|
672
616
|
|
673
617
|
$tabs.each(function (_index, tab) {
|
674
|
-
|
618
|
+
let $tab = $(tab);
|
675
619
|
|
676
620
|
if ($tab.hasClass(className.active)) {
|
677
|
-
|
678
|
-
|
679
|
-
$anchor = $allModules.filter('[data-' + metadata.tab + '="' + module.escape.string(tabPath) + '"]')
|
680
|
-
;
|
621
|
+
let tabPath = $(this).data(metadata.tab);
|
622
|
+
let $anchor = $allModules.filter('[data-' + metadata.tab + '="' + CSS.escape(tabPath) + '"]');
|
681
623
|
|
682
624
|
if ($anchor.hasClass(className.active)) {
|
683
625
|
activeTab = tabPath;
|
@@ -767,11 +709,9 @@
|
|
767
709
|
},
|
768
710
|
performance: {
|
769
711
|
log: function (message) {
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
previousTime
|
774
|
-
;
|
712
|
+
let currentTime;
|
713
|
+
let executionTime;
|
714
|
+
let previousTime;
|
775
715
|
if (settings.performance) {
|
776
716
|
currentTime = Date.now();
|
777
717
|
previousTime = time || currentTime;
|
@@ -790,10 +730,8 @@
|
|
790
730
|
}, 500);
|
791
731
|
},
|
792
732
|
display: function () {
|
793
|
-
|
794
|
-
|
795
|
-
totalTime = 0
|
796
|
-
;
|
733
|
+
let title = settings.name + ':';
|
734
|
+
let totalTime = 0;
|
797
735
|
time = false;
|
798
736
|
clearTimeout(module.performance.timer);
|
799
737
|
$.each(performance, function (index, data) {
|
@@ -815,22 +753,19 @@
|
|
815
753
|
},
|
816
754
|
},
|
817
755
|
invoke: function (query, passedArguments, context) {
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
response
|
823
|
-
;
|
756
|
+
let object = instance;
|
757
|
+
let maxDepth;
|
758
|
+
let found;
|
759
|
+
let response;
|
824
760
|
passedArguments = passedArguments || queryArguments;
|
825
761
|
context = context || element;
|
826
762
|
if (typeof query === 'string' && object !== undefined) {
|
827
763
|
query = query.split(/[ .]/);
|
828
764
|
maxDepth = query.length - 1;
|
829
765
|
$.each(query, function (depth, value) {
|
830
|
-
|
766
|
+
let camelCaseValue = depth !== maxDepth
|
831
767
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
832
|
-
: query
|
833
|
-
;
|
768
|
+
: query;
|
834
769
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
835
770
|
object = object[camelCaseValue];
|
836
771
|
} else if (object[camelCaseValue] !== undefined) {
|
@@ -899,7 +834,7 @@
|
|
899
834
|
verbose: false,
|
900
835
|
performance: true,
|
901
836
|
|
902
|
-
auto: false, // uses pjax style endpoints fetching content from same url with remote-content headers
|
837
|
+
auto: false, // uses pjax style endpoints fetching content from the same url with remote-content headers
|
903
838
|
history: false, // use browser history
|
904
839
|
historyType: 'hash', // #/ or html5 state
|
905
840
|
path: false, // base path of url
|
@@ -913,21 +848,21 @@
|
|
913
848
|
alwaysRefresh: false, // load tab content new every tab click
|
914
849
|
cache: true, // cache the content requests to pull locally
|
915
850
|
loadOnce: false, // Whether tab data should only be loaded once when using remote content
|
916
|
-
cacheType: 'response', // Whether to cache exact response, or to
|
917
|
-
ignoreFirstLoad: false, // don't load remote content on first load
|
851
|
+
cacheType: 'response', // Whether to cache exact response, or to HTML cache contents after scripts execute
|
852
|
+
ignoreFirstLoad: false, // don't load remote content on the first load
|
918
853
|
|
919
854
|
apiSettings: false, // settings for api call
|
920
855
|
evaluateScripts: 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
|
921
|
-
autoTabActivation: true, // whether a non
|
856
|
+
autoTabActivation: true, // whether a non-existing active tab will auto activate the first available tab
|
922
857
|
|
923
858
|
onFirstLoad: function (tabPath, parameterArray, historyEvent) {}, // called first time loaded
|
924
859
|
onLoad: function (tabPath, parameterArray, historyEvent) {}, // called on every load
|
925
860
|
onVisible: function (tabPath, parameterArray, historyEvent) {}, // called every time tab visible
|
926
|
-
onRequest: function (tabPath, parameterArray, historyEvent) {}, // called
|
861
|
+
onRequest: function (tabPath, parameterArray, historyEvent) {}, // called every time a tab beings loading remote content
|
927
862
|
onBeforeChange: function (tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
|
928
863
|
|
929
864
|
templates: {
|
930
|
-
determineTitle: function (tabArray) {}, // returns page title for path
|
865
|
+
determineTitle: function (tabArray) {}, // returns page title for the path
|
931
866
|
},
|
932
867
|
|
933
868
|
error: {
|