fomantic-ui 2.10.0-beta.7 → 2.10.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -10
- package/README.md +4 -5
- package/changelog-setup.js +64 -70
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +94 -131
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +152 -205
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +305 -341
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +76 -116
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +58 -91
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +651 -941
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +70 -108
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +182 -256
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +325 -429
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +211 -295
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +67 -97
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +175 -235
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +103 -138
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +79 -120
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +239 -333
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +157 -223
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +122 -163
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +38 -57
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +242 -325
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +68 -98
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +116 -159
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +168 -233
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +89 -114
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +86 -141
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +134 -210
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +4006 -5558
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/examples/assets/show-examples.js +2 -4
- package/gulpfile.js +5 -7
- package/package.json +1 -1
- package/scripts/nightly-version.js +7 -10
- package/src/definitions/behaviors/api.js +151 -204
- package/src/definitions/behaviors/form.js +324 -428
- package/src/definitions/behaviors/state.js +67 -97
- package/src/definitions/behaviors/visibility.js +133 -209
- package/src/definitions/globals/site.js +37 -56
- package/src/definitions/modules/accordion.js +93 -130
- package/src/definitions/modules/calendar.js +304 -340
- package/src/definitions/modules/checkbox.js +75 -115
- package/src/definitions/modules/dimmer.js +57 -90
- package/src/definitions/modules/dropdown.js +650 -940
- package/src/definitions/modules/embed.js +69 -107
- package/src/definitions/modules/flyout.js +181 -255
- package/src/definitions/modules/modal.js +210 -294
- package/src/definitions/modules/nag.js +66 -96
- package/src/definitions/modules/popup.js +174 -234
- package/src/definitions/modules/progress.js +102 -137
- package/src/definitions/modules/rating.js +78 -119
- package/src/definitions/modules/search.js +238 -332
- package/src/definitions/modules/shape.js +156 -222
- package/src/definitions/modules/sidebar.js +121 -162
- package/src/definitions/modules/slider.js +241 -324
- package/src/definitions/modules/sticky.js +115 -158
- package/src/definitions/modules/tab.js +167 -232
- package/src/definitions/modules/toast.js +88 -113
- package/src/definitions/modules/transition.js +85 -140
- package/tasks/admin/components/create.js +88 -108
- package/tasks/admin/components/init.js +26 -32
- package/tasks/admin/components/update.js +46 -53
- package/tasks/admin/distributions/create.js +71 -101
- package/tasks/admin/distributions/init.js +27 -33
- package/tasks/admin/distributions/update.js +45 -52
- package/tasks/admin/register.js +11 -15
- package/tasks/build/assets.js +14 -18
- package/tasks/build/css.js +54 -63
- package/tasks/build/javascript.js +45 -53
- package/tasks/build.js +4 -6
- package/tasks/check-install.js +5 -7
- package/tasks/clean.js +2 -4
- package/tasks/collections/admin.js +13 -15
- package/tasks/collections/build.js +6 -8
- package/tasks/collections/docs.js +2 -4
- package/tasks/collections/install.js +2 -4
- package/tasks/collections/rtl.js +2 -4
- package/tasks/collections/various.js +2 -4
- package/tasks/config/admin/github.js +7 -9
- package/tasks/config/admin/templates/css-package.js +1 -3
- package/tasks/config/admin/templates/less-package.js +1 -3
- package/tasks/config/npm/gulpfile.js +4 -6
- package/tasks/config/project/config.js +22 -30
- package/tasks/config/project/install.js +56 -70
- package/tasks/config/project/release.js +6 -8
- package/tasks/config/tasks.js +8 -12
- package/tasks/config/user.js +13 -17
- package/tasks/docs/build.js +26 -31
- package/tasks/docs/metadata.js +24 -30
- package/tasks/docs/serve.js +20 -26
- package/tasks/install.js +71 -98
- package/tasks/rtl/build.js +2 -4
- package/tasks/rtl/watch.js +2 -4
- package/tasks/watch.js +9 -11
- package/test/meteor/fonts.js +1 -2
- package/test/modules/module.spec.js +16 -18
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.8+62e258f - 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,8 +356,7 @@
|
|
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
362
|
// if anchor exists, use parent tab
|
@@ -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
|
|
@@ -620,10 +568,8 @@
|
|
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) {
|