patternfly-sass 3.13.0 → 3.14.0
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.
- checksums.yaml +4 -4
- data/assets/javascripts/patternfly-functions.js +1137 -0
- data/assets/javascripts/patternfly-functions.min.js +1 -0
- data/assets/javascripts/patternfly-settings.js +506 -0
- data/assets/javascripts/patternfly-settings.min.js +1 -0
- data/assets/javascripts/patternfly.dataTables.pfEmpty.js +244 -0
- data/assets/javascripts/patternfly.dataTables.pfEmpty.min.js +1 -0
- data/assets/javascripts/patternfly.dataTables.pfFilter.js +421 -0
- data/assets/javascripts/patternfly.dataTables.pfFilter.min.js +1 -0
- data/assets/javascripts/patternfly.dataTables.pfResize.js +214 -0
- data/assets/javascripts/patternfly.dataTables.pfResize.min.js +1 -0
- data/assets/javascripts/patternfly.dataTables.pfSelect.js +281 -0
- data/assets/javascripts/patternfly.dataTables.pfSelect.min.js +1 -0
- data/assets/javascripts/patternfly.js +692 -652
- data/assets/javascripts/patternfly.min.js +2 -2
- data/assets/stylesheets/_patternfly.scss +1 -0
- data/assets/stylesheets/patternfly/_datatables.scss +17 -49
- data/assets/stylesheets/patternfly/_table-view.scss +170 -0
- data/bower.json +1 -1
- data/lib/patternfly-sass/version.rb +2 -2
- data/package.json +70 -0
- data/spec/html/about-modal.html +1 -0
- data/spec/html/accordions.html +1 -0
- data/spec/html/alerts.html +1 -0
- data/spec/html/area-charts.html +1 -0
- data/spec/html/badges.html +1 -0
- data/spec/html/bar-charts.html +1 -0
- data/spec/html/basic.html +368 -418
- data/spec/html/blank-slate.html +2 -1
- data/spec/html/bootstrap-combobox.html +1 -0
- data/spec/html/bootstrap-datepicker.html +1 -0
- data/spec/html/bootstrap-select.html +1 -0
- data/spec/html/bootstrap-switch.html +1 -0
- data/spec/html/bootstrap-touchspin.html +1 -0
- data/spec/html/bootstrap-treeview-2.html +1 -0
- data/spec/html/bootstrap-treeview.html +1 -0
- data/spec/html/breadcrumbs.html +1 -0
- data/spec/html/buttons.html +1 -0
- data/spec/html/card-view-card-variations.html +1 -0
- data/spec/html/card-view-multi-select.html +1 -0
- data/spec/html/card-view-single-select.html +1 -0
- data/spec/html/cards.html +1 -0
- data/spec/html/code.html +1 -0
- data/spec/html/dashboard.html +1 -0
- data/spec/html/dist/css/patternfly-additions.css +143 -52
- data/spec/html/dist/css/patternfly-additions.css.map +1 -1
- data/spec/html/dist/css/patternfly-additions.min.css +1 -1
- data/spec/html/dist/css/patternfly-additions.min.css.map +1 -1
- data/spec/html/dist/css/patternfly.min.css +2 -2
- data/spec/html/dist/css/patternfly.min.css.map +1 -1
- data/spec/html/donut-charts.html +1 -0
- data/spec/html/dropdowns.html +1 -0
- data/spec/html/form.html +1 -0
- data/spec/html/forms.html +1 -0
- data/spec/html/horizontal-navigation.html +1 -0
- data/spec/html/icons.html +1 -0
- data/spec/html/index.html +10 -6
- data/spec/html/infotip.html +1 -0
- data/spec/html/labels.html +1 -0
- data/spec/html/line-charts.html +1 -0
- data/spec/html/list-group.html +1 -0
- data/spec/html/list-view-compound-expansion.html +1 -0
- data/spec/html/list-view-rows.html +1 -0
- data/spec/html/list-view-simple-expansion.html +1 -0
- data/spec/html/list-view.html +1 -0
- data/spec/html/login.html +1 -0
- data/spec/html/modals.html +1 -0
- data/spec/html/navbar.html +1 -0
- data/spec/html/notification-drawer-horizontal-nav.html +1 -0
- data/spec/html/notification-drawer-vertical-nav.html +1 -0
- data/spec/html/pagination.html +1 -0
- data/spec/html/panels.html +1 -0
- data/spec/html/pie-charts.html +1 -0
- data/spec/html/popovers.html +1 -0
- data/spec/html/progress-bars.html +1 -0
- data/spec/html/search.html +1 -0
- data/spec/html/spinner.html +1 -0
- data/spec/html/tab.html +373 -420
- data/spec/html/{datatables-columns.html → table-view-columns.html} +9 -7
- data/spec/html/table-view-navbar.html +532 -0
- data/spec/html/table-view.html +422 -0
- data/spec/html/tables.html +1 -0
- data/spec/html/tabs.html +1 -0
- data/spec/html/time-picker.html +1 -0
- data/spec/html/toast.html +1 -0
- data/spec/html/toolbar.html +1 -0
- data/spec/html/tooltip.html +1 -0
- data/spec/html/typography-2.html +1 -1
- data/spec/html/typography.html +1 -0
- data/spec/html/utilization-bar-charts.html +1 -0
- data/spec/html/vertical-navigation-primary-only.html +1 -0
- data/spec/html/vertical-navigation-with-badges.html +1 -0
- data/spec/html/vertical-navigation-with-secondary.html +1 -0
- data/spec/html/vertical-navigation-with-tertiary-no-icons.html +1 -0
- data/spec/html/vertical-navigation-with-tertiary-pins.html +1 -0
- data/spec/html/wizard.html +1 -0
- metadata +22 -6
- data/spec/html/datatables.html +0 -472
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b32dd92f39bf785c77093e53204a4bbbb9cb3ac
|
4
|
+
data.tar.gz: f01ddab67d2af5fb36340d08d1f7478b4b5e46bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45788a4eccf0535ec954acca6d5e4c2e069ec33d223097da969680ee03887cbed72e38c856cc55aa0b7145432b27c8310434b1c9a7704ff43d028860abd325a4
|
7
|
+
data.tar.gz: aa0c66f5769a85ea0d66975ff6645e20192544facd3742d4c4a8f34798714aab177d8b97472e02934f3ef3f9749d464f20311537dca9291696b44a0b052182fa
|
@@ -0,0 +1,1137 @@
|
|
1
|
+
// Util: PatternFly Sidebar
|
2
|
+
// Set height of sidebar-pf to height of document minus height of navbar-pf if not mobile
|
3
|
+
(function ($) {
|
4
|
+
'use strict';
|
5
|
+
$.fn.sidebar = function () {
|
6
|
+
var documentHeight = 0,
|
7
|
+
navbarpfHeight = 0,
|
8
|
+
colHeight = 0;
|
9
|
+
|
10
|
+
if ($('.navbar-pf .navbar-toggle').is(':hidden')) {
|
11
|
+
documentHeight = $(document).height();
|
12
|
+
navbarpfHeight = $('.navbar-pf').outerHeight();
|
13
|
+
colHeight = documentHeight - navbarpfHeight;
|
14
|
+
}
|
15
|
+
$('.sidebar-pf').parent('.row').children('[class*="col-"]').css({"min-height" : colHeight});
|
16
|
+
};
|
17
|
+
|
18
|
+
$(document).ready(function () {
|
19
|
+
// Call sidebar() on ready if .sidebar-pf exists and .datatable does not exist
|
20
|
+
if ($('.sidebar-pf').length > 0 && $('.datatable').length === 0) {
|
21
|
+
$.fn.sidebar();
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
$(window).resize(function () {
|
26
|
+
// Call sidebar() on resize if .sidebar-pf exists
|
27
|
+
if ($('.sidebar-pf').length > 0) {
|
28
|
+
$.fn.sidebar();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}(jQuery));
|
32
|
+
|
33
|
+
// Util: PatternFly Popovers
|
34
|
+
// Add data-close="true" to insert close X icon
|
35
|
+
(function ($) {
|
36
|
+
'use strict';
|
37
|
+
|
38
|
+
$.fn.popovers = function () {
|
39
|
+
// Initialize
|
40
|
+
this.popover();
|
41
|
+
|
42
|
+
// Add close icons
|
43
|
+
this.filter('[data-close=true]').each(function (index, element) {
|
44
|
+
var $this = $(element),
|
45
|
+
title = $this.attr('data-original-title') + '<button type="button" class="close" aria-hidden="true"><span class="pficon pficon-close"></span></button>';
|
46
|
+
|
47
|
+
$this.attr('data-original-title', title);
|
48
|
+
});
|
49
|
+
|
50
|
+
// Bind Close Icon to Toggle Display
|
51
|
+
this.on('click', function (e) {
|
52
|
+
var $this = $(this),
|
53
|
+
$title = $this.next('.popover').find('.popover-title');
|
54
|
+
|
55
|
+
// Only if data-close is true add class "x" to title for right padding
|
56
|
+
$title.find('.close').parent('.popover-title').addClass('closable');
|
57
|
+
|
58
|
+
// Bind x icon to close popover
|
59
|
+
$title.find('.close').on('click', function () {
|
60
|
+
$this.popover('hide');
|
61
|
+
});
|
62
|
+
|
63
|
+
// Prevent href="#" page scroll to top
|
64
|
+
e.preventDefault();
|
65
|
+
});
|
66
|
+
|
67
|
+
return this;
|
68
|
+
};
|
69
|
+
}(jQuery));
|
70
|
+
|
71
|
+
|
72
|
+
// Util: DataTables Settings
|
73
|
+
(function ($) {
|
74
|
+
'use strict';
|
75
|
+
if ($.fn.dataTableExt) {
|
76
|
+
/* Set the defaults for DataTables initialisation */
|
77
|
+
$.extend(true, $.fn.dataTable.defaults, {
|
78
|
+
"bDestroy": true,
|
79
|
+
"bAutoWidth": false,
|
80
|
+
"iDisplayLength": 20,
|
81
|
+
"sDom":
|
82
|
+
"<'dataTables_header' f i r >" +
|
83
|
+
"<'table-responsive' t >" +
|
84
|
+
"<'dataTables_footer' p >",
|
85
|
+
"oLanguage": {
|
86
|
+
"sInfo": "Showing <b>_START_</b> to <b>_END_</b> of <b>_TOTAL_</b> Items",
|
87
|
+
"sInfoFiltered" : "(of <b>_MAX_</b>)",
|
88
|
+
"sInfoEmpty" : "Showing <b>0</b> Results",
|
89
|
+
"sZeroRecords":
|
90
|
+
"<p>Suggestions</p>" +
|
91
|
+
"<ul>" +
|
92
|
+
"<li>Check the javascript regular expression syntax of the search term.</li>" +
|
93
|
+
"<li>Check that the correct menu option is chosen (token ID vs. user ID).</li>" +
|
94
|
+
"<li>Use wildcards (* to match 0 or more characters, + to match 1 or more characters, ? to match 0 or 1 character).</li>" +
|
95
|
+
"<li>Clear the search field, then click Search to return to the 20 most recent records.</li>" +
|
96
|
+
"</ul>",
|
97
|
+
"sSearch": ""
|
98
|
+
},
|
99
|
+
"sPaginationType": "bootstrap_input",
|
100
|
+
"oSearch": {
|
101
|
+
"sSearch": "",
|
102
|
+
"bRegex": true,
|
103
|
+
"bSmart": false
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
/* Default class modification */
|
108
|
+
$.extend($.fn.dataTableExt.oStdClasses, {
|
109
|
+
"sWrapper": "dataTables_wrapper"
|
110
|
+
});
|
111
|
+
|
112
|
+
/* API method to get paging information */
|
113
|
+
$.fn.dataTableExt.oApi.fnPagingInfo = function (oSettings) {
|
114
|
+
return {
|
115
|
+
"iStart": oSettings._iDisplayStart,
|
116
|
+
"iEnd": oSettings.fnDisplayEnd(),
|
117
|
+
"iLength": oSettings._iDisplayLength,
|
118
|
+
"iTotal": oSettings.fnRecordsTotal(),
|
119
|
+
"iFilteredTotal": oSettings.fnRecordsDisplay(),
|
120
|
+
"iPage": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength),
|
121
|
+
"iTotalPages": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)
|
122
|
+
};
|
123
|
+
};
|
124
|
+
|
125
|
+
/* Combination of Bootstrap + Input Text style pagination control */
|
126
|
+
$.extend($.fn.dataTableExt.oPagination, {
|
127
|
+
"bootstrap_input": {
|
128
|
+
"fnInit": function (oSettings, nPaging, fnDraw) {
|
129
|
+
var fnClickHandler = function (e) {
|
130
|
+
e.preventDefault();
|
131
|
+
if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
|
132
|
+
fnDraw(oSettings);
|
133
|
+
}
|
134
|
+
},
|
135
|
+
els,
|
136
|
+
nInput;
|
137
|
+
|
138
|
+
$(nPaging).append(
|
139
|
+
'<ul class="pagination">' +
|
140
|
+
' <li class="first disabled"><span class="i fa fa-angle-double-left"></span></li>' +
|
141
|
+
' <li class="prev disabled"><span class="i fa fa-angle-left"></span></li>' +
|
142
|
+
'</ul>' +
|
143
|
+
'<div class="pagination-input">' +
|
144
|
+
' <input type="text" class="paginate_input">' +
|
145
|
+
' <span class="paginate_of">of <b>3</b></span>' +
|
146
|
+
'</div>' +
|
147
|
+
'<ul class="pagination">' +
|
148
|
+
' <li class="next disabled"><span class="i fa fa-angle-right"></span></li>' +
|
149
|
+
' <li class="last disabled"><span class="i fa fa-angle-double-right"></span></li>' +
|
150
|
+
'</ul>'
|
151
|
+
);
|
152
|
+
|
153
|
+
els = $('li', nPaging);
|
154
|
+
$(els[0]).bind('click.DT', { action: "first" }, fnClickHandler);
|
155
|
+
$(els[1]).bind('click.DT', { action: "previous" }, fnClickHandler);
|
156
|
+
$(els[2]).bind('click.DT', { action: "next" }, fnClickHandler);
|
157
|
+
$(els[3]).bind('click.DT', { action: "last" }, fnClickHandler);
|
158
|
+
|
159
|
+
nInput = $('input', nPaging);
|
160
|
+
$(nInput).keyup(function (e) {
|
161
|
+
var iNewStart;
|
162
|
+
if (e.which === 38 || e.which === 39) {
|
163
|
+
this.value += 1;
|
164
|
+
} else if ((e.which === 37 || e.which === 40) && this.value > 1) {
|
165
|
+
this.value -= 1;
|
166
|
+
}
|
167
|
+
|
168
|
+
if (this.value === "" || !this.value.match(/[0-9]/)) {
|
169
|
+
/* Nothing entered or non-numeric character */
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
|
173
|
+
iNewStart = oSettings._iDisplayLength * (this.value - 1);
|
174
|
+
if (iNewStart >= oSettings.fnRecordsDisplay()) {
|
175
|
+
/* Display overrun */
|
176
|
+
oSettings._iDisplayStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) /
|
177
|
+
oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength;
|
178
|
+
fnDraw(oSettings);
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
|
182
|
+
oSettings._iDisplayStart = iNewStart;
|
183
|
+
fnDraw(oSettings);
|
184
|
+
});
|
185
|
+
},
|
186
|
+
|
187
|
+
"fnUpdate": function (oSettings, fnDraw) {
|
188
|
+
var oPaging = oSettings.oInstance.fnPagingInfo(),
|
189
|
+
an = oSettings.aanFeatures.p,
|
190
|
+
ien = an.length,
|
191
|
+
iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength),
|
192
|
+
iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1,
|
193
|
+
i;
|
194
|
+
|
195
|
+
for (i = 0; i < ien; i += 1) {
|
196
|
+
$('.paginate_input', an[i]).val(iCurrentPage)
|
197
|
+
.siblings('.paginate_of').find('b').html(iPages);
|
198
|
+
|
199
|
+
// Add / remove disabled classes from the static elements
|
200
|
+
if (oPaging.iPage === 0) {
|
201
|
+
$('li.first', an[i]).addClass('disabled');
|
202
|
+
$('li.prev', an[i]).addClass('disabled');
|
203
|
+
} else {
|
204
|
+
$('li.first', an[i]).removeClass('disabled');
|
205
|
+
$('li.prev', an[i]).removeClass('disabled');
|
206
|
+
}
|
207
|
+
|
208
|
+
if (oPaging.iPage === oPaging.iTotalPages - 1 || oPaging.iTotalPages === 0) {
|
209
|
+
$('li.next', an[i]).addClass('disabled');
|
210
|
+
$('li.last', an[i]).addClass('disabled');
|
211
|
+
} else {
|
212
|
+
$('li.next', an[i]).removeClass('disabled');
|
213
|
+
$('li.last', an[i]).removeClass('disabled');
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
});
|
219
|
+
}
|
220
|
+
}(jQuery));
|
221
|
+
|
222
|
+
// Util: definition of breakpoint sizes for tablet and desktop modes
|
223
|
+
(function ($) {
|
224
|
+
'use strict';
|
225
|
+
if (patternfly !== undefined) {
|
226
|
+
$.pfBreakpoints = patternfly.pfBreakpoints;
|
227
|
+
}
|
228
|
+
}(jQuery));
|
229
|
+
|
230
|
+
// Util: PatternFly Collapsible Left Hand Navigation
|
231
|
+
// Must have navbar-toggle in navbar-pf-alt for expand/collapse
|
232
|
+
(function ($) {
|
233
|
+
|
234
|
+
'use strict';
|
235
|
+
|
236
|
+
$.fn.navigation = function () {
|
237
|
+
|
238
|
+
var navElement = $('.layout-pf-alt-fixed .nav-pf-vertical-alt'),
|
239
|
+
bodyContentElement = $('.container-pf-alt-nav-pf-vertical-alt'),
|
240
|
+
toggleNavBarButton = $('.navbar-toggle'),
|
241
|
+
explicitCollapse = false,
|
242
|
+
checkNavState = function () {
|
243
|
+
var width = $(window).width();
|
244
|
+
|
245
|
+
//Always remove the hidden & peek class
|
246
|
+
navElement.removeClass('hidden show-mobile-nav collapsed');
|
247
|
+
|
248
|
+
//Set the body class back to the default
|
249
|
+
bodyContentElement.removeClass('collapsed-nav hidden-nav');
|
250
|
+
|
251
|
+
// Check to see if the nav needs to collapse
|
252
|
+
if (width < $.pfBreakpoints.desktop || explicitCollapse) {
|
253
|
+
navElement.addClass('collapsed');
|
254
|
+
bodyContentElement.addClass('collapsed-nav');
|
255
|
+
}
|
256
|
+
|
257
|
+
// Check to see if we need to move down to the mobile state
|
258
|
+
if (width < $.pfBreakpoints.tablet) {
|
259
|
+
//Set the nav to being hidden
|
260
|
+
navElement.addClass('hidden');
|
261
|
+
|
262
|
+
//Make sure this is expanded
|
263
|
+
navElement.removeClass('collapsed');
|
264
|
+
|
265
|
+
//Set the body class to the correct state
|
266
|
+
bodyContentElement.removeClass('collapsed-nav');
|
267
|
+
bodyContentElement.addClass('hidden-nav');
|
268
|
+
}
|
269
|
+
},
|
270
|
+
collapseMenu = function () {
|
271
|
+
//Make sure this is expanded
|
272
|
+
navElement.addClass('collapsed');
|
273
|
+
//Set the body class to the correct state
|
274
|
+
bodyContentElement.addClass('collapsed-nav');
|
275
|
+
|
276
|
+
explicitCollapse = true;
|
277
|
+
},
|
278
|
+
enableTransitions = function () {
|
279
|
+
// enable transitions only when toggleNavBarButton is clicked or window is resized
|
280
|
+
$('html').addClass('transitions');
|
281
|
+
},
|
282
|
+
expandMenu = function () {
|
283
|
+
//Make sure this is expanded
|
284
|
+
navElement.removeClass('collapsed');
|
285
|
+
//Set the body class to the correct state
|
286
|
+
bodyContentElement.removeClass('collapsed-nav');
|
287
|
+
|
288
|
+
explicitCollapse = false;
|
289
|
+
},
|
290
|
+
bindMenuBehavior = function () {
|
291
|
+
toggleNavBarButton.on('click', function (e) {
|
292
|
+
var inMobileState = bodyContentElement.hasClass('hidden-nav');
|
293
|
+
enableTransitions();
|
294
|
+
|
295
|
+
if (inMobileState && navElement.hasClass('show-mobile-nav')) {
|
296
|
+
//In mobile state just need to hide the nav
|
297
|
+
navElement.removeClass('show-mobile-nav');
|
298
|
+
} else if (inMobileState) {
|
299
|
+
navElement.addClass('show-mobile-nav');
|
300
|
+
} else if (navElement.hasClass('collapsed')) {
|
301
|
+
expandMenu();
|
302
|
+
} else {
|
303
|
+
collapseMenu();
|
304
|
+
}
|
305
|
+
});
|
306
|
+
},
|
307
|
+
setTooltips = function () {
|
308
|
+
$('.nav-pf-vertical-alt [data-toggle="tooltip"]').tooltip({'container': 'body', 'delay': { 'show': '500', 'hide': '200' }});
|
309
|
+
|
310
|
+
$(".nav-pf-vertical-alt").on("show.bs.tooltip", function (e) {
|
311
|
+
return $(this).hasClass("collapsed");
|
312
|
+
});
|
313
|
+
|
314
|
+
},
|
315
|
+
init = function () {
|
316
|
+
//Set correct state on load
|
317
|
+
checkNavState();
|
318
|
+
|
319
|
+
// Bind Top level hamburger menu with menu behavior;
|
320
|
+
bindMenuBehavior();
|
321
|
+
|
322
|
+
//Set tooltips
|
323
|
+
setTooltips();
|
324
|
+
};
|
325
|
+
|
326
|
+
//Listen for the window resize event and collapse/hide as needed
|
327
|
+
$(window).on('resize', function () {
|
328
|
+
checkNavState();
|
329
|
+
enableTransitions();
|
330
|
+
});
|
331
|
+
|
332
|
+
init();
|
333
|
+
|
334
|
+
};
|
335
|
+
|
336
|
+
$(document).ready(function () {
|
337
|
+
if ($('.nav-pf-vertical-alt').length > 0) {
|
338
|
+
$.fn.navigation();
|
339
|
+
}
|
340
|
+
});
|
341
|
+
|
342
|
+
}(jQuery));
|
343
|
+
|
344
|
+
// Count and Display Remaining Characters
|
345
|
+
(function ($) {
|
346
|
+
|
347
|
+
'use strict';
|
348
|
+
|
349
|
+
$.fn.countRemainingChars = function (options) {
|
350
|
+
|
351
|
+
var settings = $.extend({
|
352
|
+
// These are the defaults.
|
353
|
+
charsMaxLimit: 100,
|
354
|
+
charsWarnRemaining: 5,
|
355
|
+
blockInputAtMaxLimit: false
|
356
|
+
}, options),
|
357
|
+
$taFld = this,
|
358
|
+
$countFld = $('#' + settings.countFld).text(settings.charsMaxLimit),
|
359
|
+
charsRemainingFn = function (charsLength) {
|
360
|
+
var charsRemaining = settings.charsMaxLimit - charsLength;
|
361
|
+
$countFld.text(charsRemaining);
|
362
|
+
$countFld.toggleClass('chars-warn-remaining-pf', charsRemaining <= settings.charsWarnRemaining);
|
363
|
+
if (charsRemaining < 0) {
|
364
|
+
$taFld.trigger("overCharsMaxLimitEvent", $taFld.attr('id'));
|
365
|
+
} else {
|
366
|
+
$taFld.trigger("underCharsMaxLimitEvent", $taFld.attr('id'));
|
367
|
+
}
|
368
|
+
};
|
369
|
+
|
370
|
+
this.on('paste', function (event) {
|
371
|
+
setTimeout(function () {
|
372
|
+
var charsLength = $taFld.val().length, maxTxt;
|
373
|
+
|
374
|
+
if (settings.blockInputAtMaxLimit && charsLength > settings.charsMaxLimit) {
|
375
|
+
maxTxt = $taFld.val();
|
376
|
+
maxTxt = maxTxt.substring(0, settings.charsMaxLimit);
|
377
|
+
$taFld.val(maxTxt);
|
378
|
+
charsLength = $taFld.val().length;
|
379
|
+
}
|
380
|
+
|
381
|
+
charsRemainingFn(charsLength);
|
382
|
+
}, 100);
|
383
|
+
});
|
384
|
+
|
385
|
+
this.keyup(function (event) {
|
386
|
+
charsRemainingFn($taFld.val().length);
|
387
|
+
});
|
388
|
+
|
389
|
+
this.keydown(function (event) {
|
390
|
+
var charsLength = $taFld.val().length;
|
391
|
+
|
392
|
+
if (settings.blockInputAtMaxLimit && charsLength >= settings.charsMaxLimit) {
|
393
|
+
// Except backspace
|
394
|
+
if (event.keyCode !== 8) {
|
395
|
+
event.preventDefault();
|
396
|
+
}
|
397
|
+
}
|
398
|
+
});
|
399
|
+
|
400
|
+
return this;
|
401
|
+
};
|
402
|
+
}(jQuery));
|
403
|
+
|
404
|
+
// Util: PatternFly Palette colors
|
405
|
+
(function ($) {
|
406
|
+
'use strict';
|
407
|
+
|
408
|
+
if (patternfly !== undefined) {
|
409
|
+
$.pfPaletteColors = patternfly.pfPaletteColors;
|
410
|
+
}
|
411
|
+
}(jQuery));
|
412
|
+
|
413
|
+
// Util: PatternFly C3 Chart Defaults
|
414
|
+
(function ($) {
|
415
|
+
'use strict';
|
416
|
+
if (patternfly !== undefined) {
|
417
|
+
$.fn.pfSetDonutChartTitle = patternfly.pfSetDonutChartTitle;
|
418
|
+
$.fn.pfDonutTooltipContents = patternfly.pfDonutTooltipContents;
|
419
|
+
$.fn.pfGetUtilizationDonutTooltipContentsFn = patternfly.pfGetUtilizationDonutTooltipContentsFn;
|
420
|
+
$.fn.pfGetBarChartTooltipContentsFn = patternfly.pfGetBarChartTooltipContentsFn;
|
421
|
+
$.fn.pfSingleLineChartTooltipContentsFn = patternfly.pfSingleLineChartTooltipContentsFn;
|
422
|
+
$.fn.pfPieTooltipContents = patternfly.pfPieTooltipContents;
|
423
|
+
$.fn.c3ChartDefaults = patternfly.c3ChartDefaults;
|
424
|
+
}
|
425
|
+
}(jQuery));
|
426
|
+
|
427
|
+
// Util: PatternFly Collapse with fixed heights
|
428
|
+
// Update the max-height of collapse elements based on the parent container's height.
|
429
|
+
(function ($) {
|
430
|
+
'use strict';
|
431
|
+
|
432
|
+
$.fn.initCollapseHeights = function (scrollSelector) {
|
433
|
+
var parentElement = this, setCollapseHeights, targetScrollSelector = scrollSelector;
|
434
|
+
|
435
|
+
setCollapseHeights = function () {
|
436
|
+
var height, openPanel, contentHeight, bodyHeight, overflowY = 'hidden';
|
437
|
+
|
438
|
+
height = parentElement.height();
|
439
|
+
|
440
|
+
// Close any open panel
|
441
|
+
openPanel = parentElement.find('.collapse.in');
|
442
|
+
if (openPanel && openPanel.length > 0) {
|
443
|
+
openPanel.removeClass('in');
|
444
|
+
}
|
445
|
+
|
446
|
+
// Determine the necessary height for the closed content
|
447
|
+
contentHeight = 0;
|
448
|
+
parentElement.children().each($.proxy(function (i, element) {
|
449
|
+
var $element = $(element);
|
450
|
+
contentHeight += $element.outerHeight(true);
|
451
|
+
}, parentElement)).end();
|
452
|
+
|
453
|
+
// Determine the height remaining for opened collapse panels
|
454
|
+
bodyHeight = height - contentHeight;
|
455
|
+
|
456
|
+
// Make sure we have enough height to be able to scroll the contents if necessary
|
457
|
+
if (bodyHeight < 25) {
|
458
|
+
bodyHeight = 25;
|
459
|
+
|
460
|
+
// Allow the parent to scroll so the child elements are accessible
|
461
|
+
overflowY = 'auto';
|
462
|
+
}
|
463
|
+
|
464
|
+
// Reopen the initially opened panel
|
465
|
+
if (openPanel && openPanel.length > 0) {
|
466
|
+
openPanel.addClass("in");
|
467
|
+
}
|
468
|
+
|
469
|
+
setTimeout(function () {
|
470
|
+
// Set the max-height for the collapse panels
|
471
|
+
parentElement.find('[data-toggle="collapse"]').each($.proxy(function (i, element) {
|
472
|
+
var $element, selector, $target, scrollElement, innerHeight = 0;
|
473
|
+
$element = $(element);
|
474
|
+
|
475
|
+
// Determine the selector to find the target
|
476
|
+
selector = $element.attr('data-target');
|
477
|
+
if (!selector) {
|
478
|
+
selector = $element.attr('href');
|
479
|
+
}
|
480
|
+
|
481
|
+
// Determine the scroll element (either the target or the child of the target based on the given selector)
|
482
|
+
$target = $(selector);
|
483
|
+
scrollElement = $target;
|
484
|
+
if (targetScrollSelector) {
|
485
|
+
scrollElement = $target.find(targetScrollSelector);
|
486
|
+
if (scrollElement.length === 1) {
|
487
|
+
innerHeight = 0;
|
488
|
+
$target.children().each($.proxy(function (j, sibling) {
|
489
|
+
var $sibling = $(sibling);
|
490
|
+
if (sibling !== scrollElement[0]) {
|
491
|
+
innerHeight += $sibling.outerHeight(true);
|
492
|
+
}
|
493
|
+
}, $target)).end();
|
494
|
+
bodyHeight -= innerHeight;
|
495
|
+
} else {
|
496
|
+
scrollElement = $target;
|
497
|
+
}
|
498
|
+
}
|
499
|
+
// Set the max-height and vertical scroll of the scroll element
|
500
|
+
scrollElement.css({'max-height': (bodyHeight - innerHeight) + 'px', 'overflow-y': 'auto'});
|
501
|
+
}, parentElement)).end();
|
502
|
+
|
503
|
+
parentElement.css({'overflow-y': overflowY});
|
504
|
+
}, 100);
|
505
|
+
};
|
506
|
+
|
507
|
+
setCollapseHeights();
|
508
|
+
|
509
|
+
// Update on window resizing
|
510
|
+
$(window).resize(setCollapseHeights);
|
511
|
+
|
512
|
+
};
|
513
|
+
}(jQuery));
|
514
|
+
|
515
|
+
// Util: PatternFly TreeGrid Tables
|
516
|
+
(function ($) {
|
517
|
+
'use strict';
|
518
|
+
|
519
|
+
function getParent (rows, node) {
|
520
|
+
var parent = node.attr('data-parent');
|
521
|
+
|
522
|
+
if (typeof parent === "string") {
|
523
|
+
if (isNaN(parent)) {
|
524
|
+
parent = rows.closest(parent);
|
525
|
+
} else {
|
526
|
+
parent = $(rows[parseInt(parent, 10)]);
|
527
|
+
}
|
528
|
+
return parent;
|
529
|
+
}
|
530
|
+
return undefined;
|
531
|
+
}
|
532
|
+
|
533
|
+
function renderItem (item, parent) {
|
534
|
+
if (parent) {
|
535
|
+
parent.find('.treegrid-node > span.expand-icon')
|
536
|
+
.toggleClass('fa-angle-right', parent.hasClass('collapsed'))
|
537
|
+
.toggleClass('fa-angle-down', !parent.hasClass('collapsed'));
|
538
|
+
item.toggleClass('hidden', parent.hasClass('collapsed'));
|
539
|
+
if (parent.hasClass('collapsed')) {
|
540
|
+
item.addClass('collapsed');
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
544
|
+
|
545
|
+
function reStripe (tree) {
|
546
|
+
tree.find('tbody > tr').removeClass('odd');
|
547
|
+
tree.find('tbody > tr:not(.hidden):odd').addClass('odd');
|
548
|
+
}
|
549
|
+
|
550
|
+
$.fn.treegrid = function (options) {
|
551
|
+
var i, rows, _this;
|
552
|
+
rows = this.find('tbody > tr');
|
553
|
+
_this = this;
|
554
|
+
$.each(rows, function () {
|
555
|
+
var node, parent;
|
556
|
+
node = $(this);
|
557
|
+
parent = getParent(rows, node);
|
558
|
+
// Append expand icon dummies
|
559
|
+
node.children('.treegrid-node').prepend('<span class="icon expand-icon fa"/>');
|
560
|
+
|
561
|
+
// Set up an event listener for the node
|
562
|
+
node.children('.treegrid-node').on('click', function (e) {
|
563
|
+
var icon = node.find('span.expand-icon');
|
564
|
+
|
565
|
+
if (options && typeof options.callback === 'function') {
|
566
|
+
options.callback(e);
|
567
|
+
}
|
568
|
+
|
569
|
+
if (icon.hasClass('fa-angle-right')) {
|
570
|
+
node.removeClass('collapsed');
|
571
|
+
}
|
572
|
+
if (icon.hasClass('fa-angle-down')) {
|
573
|
+
node.addClass('collapsed');
|
574
|
+
}
|
575
|
+
$.each(rows.slice(rows.index(node) + 1), function () {
|
576
|
+
renderItem($(this), getParent(rows, $(this)));
|
577
|
+
});
|
578
|
+
reStripe(_this);
|
579
|
+
});
|
580
|
+
|
581
|
+
if (parent) {
|
582
|
+
// Calculate indentation depth
|
583
|
+
i = parent.find('.treegrid-node > span.indent').length + 1;
|
584
|
+
for (i; i > 0; i -= 1) {
|
585
|
+
node.children('.treegrid-node').prepend('<span class="indent"/>');
|
586
|
+
}
|
587
|
+
// Render expand/collapse icons
|
588
|
+
renderItem(node, parent);
|
589
|
+
}
|
590
|
+
});
|
591
|
+
reStripe(_this);
|
592
|
+
};
|
593
|
+
}(jQuery));
|
594
|
+
|
595
|
+
// Util: PatternFly Vertical Navigation
|
596
|
+
// Must have navbar-toggle in navbar-pf-vertical for expand/collapse
|
597
|
+
(function ($) {
|
598
|
+
'use strict';
|
599
|
+
|
600
|
+
$.fn.setupVerticalNavigation = function (handleItemSelections) {
|
601
|
+
|
602
|
+
var navElement = $('.nav-pf-vertical'),
|
603
|
+
bodyContentElement = $('.container-pf-nav-pf-vertical'),
|
604
|
+
toggleNavBarButton = $('.navbar-toggle'),
|
605
|
+
explicitCollapse = false,
|
606
|
+
subDesktop = false,
|
607
|
+
hoverDelay = 500,
|
608
|
+
hideDelay = hoverDelay + 200,
|
609
|
+
|
610
|
+
inMobileState = function () {
|
611
|
+
return bodyContentElement.hasClass('hidden-nav');
|
612
|
+
},
|
613
|
+
|
614
|
+
forceResize = function (delay) {
|
615
|
+
setTimeout(function () {
|
616
|
+
if (window.dispatchEvent) {
|
617
|
+
window.dispatchEvent(new Event('resize'));
|
618
|
+
}
|
619
|
+
// Special case for IE
|
620
|
+
if ($(document).fireEvent) {
|
621
|
+
$(document).fireEvent('onresize');
|
622
|
+
}
|
623
|
+
}, delay);
|
624
|
+
},
|
625
|
+
|
626
|
+
showSecondaryMenu = function () {
|
627
|
+
if (inMobileState() || !subDesktop) {
|
628
|
+
navElement.addClass('secondary-visible-pf');
|
629
|
+
bodyContentElement.addClass('secondary-visible-pf');
|
630
|
+
}
|
631
|
+
|
632
|
+
// Dispatch a resize event when showing the secondary menu in non-subdesktop state to
|
633
|
+
// allow content to adjust to the secondary menu sizing
|
634
|
+
if (!subDesktop) {
|
635
|
+
forceResize(100);
|
636
|
+
}
|
637
|
+
},
|
638
|
+
|
639
|
+
hideSecondaryMenu = function () {
|
640
|
+
navElement.removeClass('secondary-visible-pf');
|
641
|
+
bodyContentElement.removeClass('secondary-visible-pf');
|
642
|
+
navElement.find('.mobile-nav-item-pf').each(function (index, item) {
|
643
|
+
$(item).removeClass('mobile-nav-item-pf');
|
644
|
+
});
|
645
|
+
},
|
646
|
+
|
647
|
+
setPrimaryActiveItem = function (item) {
|
648
|
+
// Make the clicked on item active
|
649
|
+
$(document).find('.nav-pf-vertical > .list-group > .list-group-item.active').each(function (index, element) {
|
650
|
+
$(element).removeClass('active');
|
651
|
+
});
|
652
|
+
item.addClass('active');
|
653
|
+
},
|
654
|
+
|
655
|
+
setSecondaryActiveItem = function (item, $primaryParent) {
|
656
|
+
$(document).find('.nav-pf-secondary-nav > .list-group > .list-group-item.active').each(function (index, element) {
|
657
|
+
$(element).removeClass('active');
|
658
|
+
});
|
659
|
+
item.addClass('active');
|
660
|
+
|
661
|
+
setPrimaryActiveItem($primaryParent);
|
662
|
+
},
|
663
|
+
|
664
|
+
setTertiaryActiveItem = function (item, $secondaryParent, $primaryParent) {
|
665
|
+
$(document).find('.nav-pf-tertiary-nav > .list-group > .list-group-item.active').each(function (index, element) {
|
666
|
+
$(element).removeClass('active');
|
667
|
+
});
|
668
|
+
item.addClass('active');
|
669
|
+
|
670
|
+
setSecondaryActiveItem($secondaryParent, $primaryParent);
|
671
|
+
},
|
672
|
+
|
673
|
+
updateSecondaryMenuDisplayAfterSelection = function () {
|
674
|
+
if (inMobileState()) {
|
675
|
+
navElement.removeClass('show-mobile-nav');
|
676
|
+
hideSecondaryMenu();
|
677
|
+
navElement.find('.mobile-nav-item-pf').each(function (index, item) {
|
678
|
+
$(item).removeClass('mobile-nav-item-pf');
|
679
|
+
});
|
680
|
+
} else {
|
681
|
+
showSecondaryMenu();
|
682
|
+
}
|
683
|
+
},
|
684
|
+
|
685
|
+
updateSecondaryCollapsedState = function (setCollapsed, collapsedItem) {
|
686
|
+
if (setCollapsed) {
|
687
|
+
collapsedItem.addClass('collapsed');
|
688
|
+
navElement.addClass('collapsed-secondary-nav-pf');
|
689
|
+
bodyContentElement.addClass('collapsed-secondary-nav-pf');
|
690
|
+
} else {
|
691
|
+
if (collapsedItem) {
|
692
|
+
collapsedItem.removeClass('collapsed');
|
693
|
+
} else {
|
694
|
+
// Remove any collapsed secondary menus
|
695
|
+
navElement.find('[data-toggle="collapse-secondary-nav"]').each(function (index, element) {
|
696
|
+
var $e = $(element);
|
697
|
+
$e.removeClass('collapsed');
|
698
|
+
});
|
699
|
+
}
|
700
|
+
navElement.removeClass('collapsed-secondary-nav-pf');
|
701
|
+
bodyContentElement.removeClass('collapsed-secondary-nav-pf');
|
702
|
+
}
|
703
|
+
},
|
704
|
+
|
705
|
+
updateTertiaryCollapsedState = function (setCollapsed, collapsedItem) {
|
706
|
+
if (setCollapsed) {
|
707
|
+
collapsedItem.addClass('collapsed');
|
708
|
+
navElement.addClass('collapsed-tertiary-nav-pf');
|
709
|
+
bodyContentElement.addClass('collapsed-tertiary-nav-pf');
|
710
|
+
updateSecondaryCollapsedState(false);
|
711
|
+
} else {
|
712
|
+
if (collapsedItem) {
|
713
|
+
collapsedItem.removeClass('collapsed');
|
714
|
+
} else {
|
715
|
+
// Remove any collapsed tertiary menus
|
716
|
+
navElement.find('[data-toggle="collapse-tertiary-nav"]').each(function (index, element) {
|
717
|
+
var $e = $(element);
|
718
|
+
$e.removeClass('collapsed');
|
719
|
+
});
|
720
|
+
}
|
721
|
+
navElement.removeClass('collapsed-tertiary-nav-pf');
|
722
|
+
bodyContentElement.removeClass('collapsed-tertiary-nav-pf');
|
723
|
+
}
|
724
|
+
},
|
725
|
+
|
726
|
+
updateMobileMenu = function (selected, secondaryItem) {
|
727
|
+
$(document).find('.list-group-item.mobile-nav-item-pf').each(function (index, item) {
|
728
|
+
$(item).removeClass('mobile-nav-item-pf');
|
729
|
+
});
|
730
|
+
$(document).find('.list-group-item.mobile-secondary-item-pf').each(function (index, item) {
|
731
|
+
$(item).removeClass('mobile-secondary-item-pf');
|
732
|
+
});
|
733
|
+
if (selected) {
|
734
|
+
selected.addClass('mobile-nav-item-pf');
|
735
|
+
if (secondaryItem) {
|
736
|
+
secondaryItem.addClass('mobile-secondary-item-pf');
|
737
|
+
navElement.removeClass('show-mobile-secondary');
|
738
|
+
navElement.addClass('show-mobile-tertiary');
|
739
|
+
} else {
|
740
|
+
navElement.addClass('show-mobile-secondary');
|
741
|
+
navElement.removeClass('show-mobile-tertiary');
|
742
|
+
}
|
743
|
+
} else {
|
744
|
+
navElement.removeClass('show-mobile-secondary');
|
745
|
+
navElement.removeClass('show-mobile-tertiary');
|
746
|
+
}
|
747
|
+
},
|
748
|
+
|
749
|
+
checkNavState = function () {
|
750
|
+
var width = $(window).width(), makeSecondaryVisible;
|
751
|
+
|
752
|
+
// Check to see if we need to enter/exit the mobile state
|
753
|
+
if (width < $.pfBreakpoints.tablet) {
|
754
|
+
if (!navElement.hasClass('hidden')) {
|
755
|
+
//Set the nav to being hidden
|
756
|
+
navElement.addClass('hidden');
|
757
|
+
navElement.removeClass('collapsed');
|
758
|
+
|
759
|
+
//Set the body class to the correct state
|
760
|
+
bodyContentElement.removeClass('collapsed-nav');
|
761
|
+
bodyContentElement.addClass('hidden-nav');
|
762
|
+
|
763
|
+
// Reset the collapsed states
|
764
|
+
updateSecondaryCollapsedState(false);
|
765
|
+
updateTertiaryCollapsedState(false);
|
766
|
+
|
767
|
+
explicitCollapse = false;
|
768
|
+
}
|
769
|
+
} else if (navElement.hasClass('hidden')) {
|
770
|
+
// Always remove the hidden & peek class
|
771
|
+
navElement.removeClass('hidden show-mobile-nav');
|
772
|
+
|
773
|
+
// Set the body class back to the default
|
774
|
+
bodyContentElement.removeClass('hidden-nav');
|
775
|
+
}
|
776
|
+
|
777
|
+
// Check to see if we need to enter/exit the sub desktop state
|
778
|
+
if (width < $.pfBreakpoints.desktop) {
|
779
|
+
if (!subDesktop) {
|
780
|
+
// Collapse the navigation bars when entering sub desktop mode
|
781
|
+
navElement.addClass('collapsed');
|
782
|
+
bodyContentElement.addClass('collapsed-nav');
|
783
|
+
}
|
784
|
+
if (width >= $.pfBreakpoints.tablet) {
|
785
|
+
hideSecondaryMenu();
|
786
|
+
}
|
787
|
+
subDesktop = true;
|
788
|
+
} else {
|
789
|
+
makeSecondaryVisible = subDesktop && (navElement.find('.secondary-nav-item-pf.active').length > 0);
|
790
|
+
subDesktop = false;
|
791
|
+
if (makeSecondaryVisible) {
|
792
|
+
|
793
|
+
showSecondaryMenu();
|
794
|
+
}
|
795
|
+
}
|
796
|
+
|
797
|
+
if (explicitCollapse) {
|
798
|
+
navElement.addClass('collapsed');
|
799
|
+
bodyContentElement.addClass('collapsed-nav');
|
800
|
+
} else {
|
801
|
+
navElement.removeClass('collapsed');
|
802
|
+
bodyContentElement.removeClass('collapsed-nav');
|
803
|
+
}
|
804
|
+
},
|
805
|
+
|
806
|
+
collapseMenu = function () {
|
807
|
+
//Make sure this is expanded
|
808
|
+
navElement.addClass('collapsed');
|
809
|
+
//Set the body class to the correct state
|
810
|
+
bodyContentElement.addClass('collapsed-nav');
|
811
|
+
|
812
|
+
if (subDesktop) {
|
813
|
+
hideSecondaryMenu();
|
814
|
+
}
|
815
|
+
|
816
|
+
explicitCollapse = true;
|
817
|
+
},
|
818
|
+
|
819
|
+
enableTransitions = function () {
|
820
|
+
// enable transitions only when toggleNavBarButton is clicked or window is resized
|
821
|
+
$('html').addClass('transitions');
|
822
|
+
},
|
823
|
+
|
824
|
+
expandMenu = function () {
|
825
|
+
//Make sure this is expanded
|
826
|
+
navElement.removeClass('collapsed');
|
827
|
+
//Set the body class to the correct state
|
828
|
+
bodyContentElement.removeClass('collapsed-nav');
|
829
|
+
|
830
|
+
explicitCollapse = false;
|
831
|
+
|
832
|
+
// Dispatch a resize event when showing the expanding then menu to
|
833
|
+
// allow content to adjust to the menu sizing
|
834
|
+
if (!subDesktop) {
|
835
|
+
forceResize(100);
|
836
|
+
}
|
837
|
+
},
|
838
|
+
|
839
|
+
bindMenuBehavior = function () {
|
840
|
+
toggleNavBarButton.on('click', function (e) {
|
841
|
+
enableTransitions();
|
842
|
+
|
843
|
+
if (inMobileState()) {
|
844
|
+
// Toggle the mobile nav
|
845
|
+
if (navElement.hasClass('show-mobile-nav')) {
|
846
|
+
navElement.removeClass('show-mobile-nav');
|
847
|
+
} else {
|
848
|
+
// Always start at the primary menu
|
849
|
+
updateMobileMenu();
|
850
|
+
navElement.addClass('show-mobile-nav');
|
851
|
+
}
|
852
|
+
} else if (navElement.hasClass('collapsed')) {
|
853
|
+
window.localStorage.setItem('patternfly-navigation-primary', 'expanded');
|
854
|
+
expandMenu();
|
855
|
+
} else {
|
856
|
+
window.localStorage.setItem('patternfly-navigation-primary', 'collapsed');
|
857
|
+
collapseMenu();
|
858
|
+
}
|
859
|
+
});
|
860
|
+
},
|
861
|
+
|
862
|
+
forceHideSecondaryMenu = function () {
|
863
|
+
navElement.addClass('force-hide-secondary-nav-pf');
|
864
|
+
setTimeout(function () {
|
865
|
+
navElement.removeClass('force-hide-secondary-nav-pf');
|
866
|
+
}, 500);
|
867
|
+
},
|
868
|
+
|
869
|
+
bindMenuItemsBehavior = function (handleSelection) {
|
870
|
+
$(document).find('.nav-pf-vertical > .list-group > .list-group-item').each(function (index, primaryItem) {
|
871
|
+
var $primaryItem = $(primaryItem);
|
872
|
+
|
873
|
+
// Set main nav active item on click or show secondary nav if it has a secondary nav bar and we are in the mobile state
|
874
|
+
$primaryItem.on('click.pf.secondarynav.data-api', function (event) {
|
875
|
+
var $this = $(this), $secondaryItem, tertiaryItem;
|
876
|
+
|
877
|
+
if (!$this.hasClass('secondary-nav-item-pf')) {
|
878
|
+
hideSecondaryMenu();
|
879
|
+
if (inMobileState()) {
|
880
|
+
updateMobileMenu();
|
881
|
+
navElement.removeClass('show-mobile-nav');
|
882
|
+
}
|
883
|
+
if (handleSelection) {
|
884
|
+
setPrimaryActiveItem($this);
|
885
|
+
// Don't process the click on the item
|
886
|
+
event.stopImmediatePropagation();
|
887
|
+
}
|
888
|
+
} else if (inMobileState()) {
|
889
|
+
updateMobileMenu($this);
|
890
|
+
} else if (handleSelection) {
|
891
|
+
$secondaryItem = $($primaryItem.find('.nav-pf-secondary-nav > .list-group > .list-group-item')[0]);
|
892
|
+
if ($secondaryItem.hasClass('tertiary-nav-item-pf')) {
|
893
|
+
tertiaryItem = $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item')[0];
|
894
|
+
setTertiaryActiveItem($(tertiaryItem), $secondaryItem, $primaryItem);
|
895
|
+
} else {
|
896
|
+
setSecondaryActiveItem($secondaryItem, $this);
|
897
|
+
}
|
898
|
+
event.stopImmediatePropagation();
|
899
|
+
}
|
900
|
+
});
|
901
|
+
|
902
|
+
$primaryItem.find('.nav-pf-secondary-nav > .list-group > .list-group-item').each(function (index, secondaryItem) {
|
903
|
+
var $secondaryItem = $(secondaryItem);
|
904
|
+
// Set secondary nav active item on click or show tertiary nav if it has a tertiary nav bar and we are in the mobile state
|
905
|
+
$secondaryItem.on('click.pf.secondarynav.data-api', function (event) {
|
906
|
+
var $this = $(this), tertiaryItem;
|
907
|
+
if (!$this.hasClass('tertiary-nav-item-pf')) {
|
908
|
+
if (inMobileState()) {
|
909
|
+
updateMobileMenu();
|
910
|
+
navElement.removeClass('show-mobile-nav');
|
911
|
+
}
|
912
|
+
updateSecondaryMenuDisplayAfterSelection();
|
913
|
+
if (handleSelection) {
|
914
|
+
setSecondaryActiveItem($secondaryItem, $primaryItem);
|
915
|
+
// Don't process the click on the item
|
916
|
+
event.stopImmediatePropagation();
|
917
|
+
}
|
918
|
+
} else if (inMobileState()) {
|
919
|
+
updateMobileMenu($this, $primaryItem);
|
920
|
+
event.stopImmediatePropagation();
|
921
|
+
} else if (handleSelection) {
|
922
|
+
tertiaryItem = $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item')[0];
|
923
|
+
setTertiaryActiveItem($(tertiaryItem), $secondaryItem, $primaryItem);
|
924
|
+
event.stopImmediatePropagation();
|
925
|
+
}
|
926
|
+
});
|
927
|
+
|
928
|
+
$secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item').each(function (index, tertiaryItem) {
|
929
|
+
var $tertiaryItem = $(tertiaryItem);
|
930
|
+
// Set tertiary nav active item on click
|
931
|
+
$tertiaryItem.on('click.pf.secondarynav.data-api', function (event) {
|
932
|
+
if (inMobileState()) {
|
933
|
+
updateMobileMenu();
|
934
|
+
navElement.removeClass('show-mobile-nav');
|
935
|
+
}
|
936
|
+
updateSecondaryMenuDisplayAfterSelection();
|
937
|
+
if (handleSelection) {
|
938
|
+
setTertiaryActiveItem($tertiaryItem, $secondaryItem, $primaryItem);
|
939
|
+
// Don't process the click on the item
|
940
|
+
event.stopImmediatePropagation();
|
941
|
+
}
|
942
|
+
});
|
943
|
+
});
|
944
|
+
});
|
945
|
+
});
|
946
|
+
|
947
|
+
$(document).find('.secondary-nav-item-pf').each(function (index, secondaryItem) {
|
948
|
+
var $secondaryItem = $(secondaryItem);
|
949
|
+
|
950
|
+
// Collapse the secondary nav bar when the toggle is clicked
|
951
|
+
$secondaryItem.on('click.pf.secondarynav.data-api', '[data-toggle="collapse-secondary-nav"]', function (e) {
|
952
|
+
var $this = $(this);
|
953
|
+
if (inMobileState()) {
|
954
|
+
updateMobileMenu();
|
955
|
+
e.stopImmediatePropagation();
|
956
|
+
} else {
|
957
|
+
if ($this.hasClass('collapsed')) {
|
958
|
+
window.localStorage.setItem('patternfly-navigation-secondary', 'expanded');
|
959
|
+
window.localStorage.setItem('patternfly-navigation-tertiary', 'expanded');
|
960
|
+
updateSecondaryCollapsedState(false, $this);
|
961
|
+
forceHideSecondaryMenu();
|
962
|
+
} else {
|
963
|
+
window.localStorage.setItem('patternfly-navigation-secondary', 'collapsed');
|
964
|
+
updateSecondaryCollapsedState(true, $this);
|
965
|
+
}
|
966
|
+
}
|
967
|
+
navElement.removeClass('hover-secondary-nav-pf');
|
968
|
+
if (handleSelection) {
|
969
|
+
// Don't process the click on the parent item
|
970
|
+
e.stopImmediatePropagation();
|
971
|
+
}
|
972
|
+
});
|
973
|
+
|
974
|
+
$secondaryItem.find('.tertiary-nav-item-pf').each(function (index, primaryItem) {
|
975
|
+
var $primaryItem = $(primaryItem);
|
976
|
+
// Collapse the tertiary nav bar when the toggle is clicked
|
977
|
+
$primaryItem.on('click.pf.tertiarynav.data-api', '[data-toggle="collapse-tertiary-nav"]', function (e) {
|
978
|
+
var $this = $(this);
|
979
|
+
if (inMobileState()) {
|
980
|
+
updateMobileMenu($secondaryItem);
|
981
|
+
e.stopImmediatePropagation();
|
982
|
+
} else {
|
983
|
+
if ($this.hasClass('collapsed')) {
|
984
|
+
window.localStorage.setItem('patternfly-navigation-secondary', 'expanded');
|
985
|
+
window.localStorage.setItem('patternfly-navigation-tertiary', 'expanded');
|
986
|
+
updateTertiaryCollapsedState(false, $this);
|
987
|
+
forceHideSecondaryMenu();
|
988
|
+
} else {
|
989
|
+
window.localStorage.setItem('patternfly-navigation-tertiary', 'collapsed');
|
990
|
+
updateTertiaryCollapsedState(true, $this);
|
991
|
+
}
|
992
|
+
}
|
993
|
+
navElement.removeClass('hover-secondary-nav-pf');
|
994
|
+
navElement.removeClass('hover-tertiary-nav-pf');
|
995
|
+
if (handleSelection) {
|
996
|
+
// Don't process the click on the parent item
|
997
|
+
e.stopImmediatePropagation();
|
998
|
+
}
|
999
|
+
});
|
1000
|
+
});
|
1001
|
+
});
|
1002
|
+
|
1003
|
+
// Show secondary nav bar on hover of secondary nav items
|
1004
|
+
$(document).on('mouseenter.pf.tertiarynav.data-api', '.secondary-nav-item-pf', function (e) {
|
1005
|
+
var $this = $(this);
|
1006
|
+
if (!inMobileState()) {
|
1007
|
+
if ($this[0].navUnHoverTimeout !== undefined) {
|
1008
|
+
clearTimeout($this[0].navUnHoverTimeout);
|
1009
|
+
$this[0].navUnHoverTimeout = undefined;
|
1010
|
+
} else if ($this[0].navHoverTimeout === undefined) {
|
1011
|
+
$this[0].navHoverTimeout = setTimeout(function () {
|
1012
|
+
navElement.addClass('hover-secondary-nav-pf');
|
1013
|
+
$this.addClass('is-hover');
|
1014
|
+
$this[0].navHoverTimeout = undefined;
|
1015
|
+
}, hoverDelay);
|
1016
|
+
}
|
1017
|
+
}
|
1018
|
+
});
|
1019
|
+
|
1020
|
+
$(document).on('mouseleave.pf.tertiarynav.data-api', '.secondary-nav-item-pf', function (e) {
|
1021
|
+
var $this = $(this);
|
1022
|
+
if ($this[0].navHoverTimeout !== undefined) {
|
1023
|
+
clearTimeout($this[0].navHoverTimeout);
|
1024
|
+
$this[0].navHoverTimeout = undefined;
|
1025
|
+
} else if ($this[0].navUnHoverTimeout === undefined) {
|
1026
|
+
$this[0].navUnHoverTimeout = setTimeout(function () {
|
1027
|
+
if (navElement.find('.secondary-nav-item-pf.is-hover').length <= 1) {
|
1028
|
+
navElement.removeClass('hover-secondary-nav-pf');
|
1029
|
+
}
|
1030
|
+
$this.removeClass('is-hover');
|
1031
|
+
$this[0].navUnHoverTimeout = undefined;
|
1032
|
+
}, hideDelay);
|
1033
|
+
}
|
1034
|
+
});
|
1035
|
+
|
1036
|
+
// Show tertiary nav bar on hover of secondary nav items
|
1037
|
+
$(document).on('mouseover.pf.tertiarynav.data-api', '.tertiary-nav-item-pf', function (e) {
|
1038
|
+
var $this = $(this);
|
1039
|
+
if (!inMobileState()) {
|
1040
|
+
if ($this[0].navUnHoverTimeout !== undefined) {
|
1041
|
+
clearTimeout($this[0].navUnHoverTimeout);
|
1042
|
+
$this[0].navUnHoverTimeout = undefined;
|
1043
|
+
} else if ($this[0].navHoverTimeout === undefined) {
|
1044
|
+
$this[0].navHoverTimeout = setTimeout(function () {
|
1045
|
+
navElement.addClass('hover-tertiary-nav-pf');
|
1046
|
+
$this.addClass('is-hover');
|
1047
|
+
$this[0].navHoverTimeout = undefined;
|
1048
|
+
}, hoverDelay);
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
});
|
1052
|
+
$(document).on('mouseout.pf.tertiarynav.data-api', '.tertiary-nav-item-pf', function (e) {
|
1053
|
+
var $this = $(this);
|
1054
|
+
if ($this[0].navHoverTimeout !== undefined) {
|
1055
|
+
clearTimeout($this[0].navHoverTimeout);
|
1056
|
+
$this[0].navHoverTimeout = undefined;
|
1057
|
+
} else if ($this[0].navUnHoverTimeout === undefined) {
|
1058
|
+
$this[0].navUnHoverTimeout = setTimeout(function () {
|
1059
|
+
if (navElement.find('.tertiary-nav-item-pf.is-hover').length <= 1) {
|
1060
|
+
navElement.removeClass('hover-tertiary-nav-pf');
|
1061
|
+
}
|
1062
|
+
$this.removeClass('is-hover');
|
1063
|
+
$this[0].navUnHoverTimeout = undefined;
|
1064
|
+
}, hideDelay);
|
1065
|
+
}
|
1066
|
+
});
|
1067
|
+
},
|
1068
|
+
|
1069
|
+
loadFromLocalStorage = function () {
|
1070
|
+
if (inMobileState()) {
|
1071
|
+
return;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
if (window.localStorage.getItem('patternfly-navigation-primary') === 'collapsed') {
|
1075
|
+
collapseMenu();
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
if ($('.nav-pf-vertical.nav-pf-vertical-collapsible-menus').length > 0) {
|
1079
|
+
if (window.localStorage.getItem('patternfly-navigation-secondary') === 'collapsed') {
|
1080
|
+
updateSecondaryCollapsedState(true, $('.secondary-nav-item-pf.active [data-toggle=collapse-secondary-nav]'));
|
1081
|
+
}
|
1082
|
+
|
1083
|
+
if (window.localStorage.getItem('patternfly-navigation-tertiary') === 'collapsed') {
|
1084
|
+
updateTertiaryCollapsedState(true, $('.tertiary-nav-item-pf.active [data-toggle=collapse-tertiary-nav]'));
|
1085
|
+
}
|
1086
|
+
}
|
1087
|
+
},
|
1088
|
+
|
1089
|
+
setTooltips = function () {
|
1090
|
+
var tooltipOptions = {
|
1091
|
+
container: 'body',
|
1092
|
+
placement: 'bottom',
|
1093
|
+
delay: { 'show': '500', 'hide': '200' },
|
1094
|
+
template: '<div class="nav-pf-vertical-tooltip tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
1095
|
+
};
|
1096
|
+
$('.nav-pf-vertical [data-toggle="tooltip"]').tooltip(tooltipOptions);
|
1097
|
+
|
1098
|
+
$('.nav-pf-vertical').on("show.bs.tooltip", function (e) {
|
1099
|
+
return $(this).hasClass("collapsed");
|
1100
|
+
});
|
1101
|
+
},
|
1102
|
+
|
1103
|
+
init = function (handleItemSelections) {
|
1104
|
+
// Hide the nav menus during initialization
|
1105
|
+
navElement.addClass('hide-nav-pf');
|
1106
|
+
bodyContentElement.addClass('hide-nav-pf');
|
1107
|
+
|
1108
|
+
//Set correct state on load
|
1109
|
+
checkNavState();
|
1110
|
+
|
1111
|
+
// Bind Top level hamburger menu with menu behavior;
|
1112
|
+
bindMenuBehavior();
|
1113
|
+
|
1114
|
+
// Bind menu items
|
1115
|
+
bindMenuItemsBehavior(handleItemSelections);
|
1116
|
+
|
1117
|
+
//Set tooltips
|
1118
|
+
setTooltips();
|
1119
|
+
|
1120
|
+
loadFromLocalStorage();
|
1121
|
+
|
1122
|
+
// Show the nav menus
|
1123
|
+
navElement.removeClass('hide-nav-pf');
|
1124
|
+
bodyContentElement.removeClass('hide-nav-pf');
|
1125
|
+
forceResize(250);
|
1126
|
+
};
|
1127
|
+
|
1128
|
+
//Listen for the window resize event and collapse/hide as needed
|
1129
|
+
$(window).on('resize', function () {
|
1130
|
+
checkNavState();
|
1131
|
+
enableTransitions();
|
1132
|
+
});
|
1133
|
+
|
1134
|
+
init(handleItemSelections);
|
1135
|
+
};
|
1136
|
+
}(jQuery));
|
1137
|
+
|