patternfly-sass 3.17.0 → 3.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/assets/fonts/patternfly/OpenSans-Bold-webfont.eot +0 -0
  3. data/assets/fonts/patternfly/OpenSans-Bold-webfont.svg +19025 -1827
  4. data/assets/fonts/patternfly/OpenSans-Bold-webfont.ttf +0 -0
  5. data/assets/fonts/patternfly/OpenSans-Bold-webfont.woff +0 -0
  6. data/assets/fonts/patternfly/OpenSans-Bold-webfont.woff2 +0 -0
  7. data/assets/fonts/patternfly/OpenSans-BoldItalic-webfont.eot +0 -0
  8. data/assets/fonts/patternfly/OpenSans-BoldItalic-webfont.svg +19033 -1827
  9. data/assets/fonts/patternfly/OpenSans-BoldItalic-webfont.ttf +0 -0
  10. data/assets/fonts/patternfly/OpenSans-BoldItalic-webfont.woff +0 -0
  11. data/assets/fonts/patternfly/OpenSans-BoldItalic-webfont.woff2 +0 -0
  12. data/assets/fonts/patternfly/OpenSans-ExtraBold-webfont.eot +0 -0
  13. data/assets/fonts/patternfly/OpenSans-ExtraBold-webfont.svg +19027 -1827
  14. data/assets/fonts/patternfly/OpenSans-ExtraBold-webfont.ttf +0 -0
  15. data/assets/fonts/patternfly/OpenSans-ExtraBold-webfont.woff +0 -0
  16. data/assets/fonts/patternfly/OpenSans-ExtraBold-webfont.woff2 +0 -0
  17. data/assets/fonts/patternfly/OpenSans-ExtraBoldItalic-webfont.eot +0 -0
  18. data/assets/fonts/patternfly/OpenSans-ExtraBoldItalic-webfont.svg +19033 -1827
  19. data/assets/fonts/patternfly/OpenSans-ExtraBoldItalic-webfont.ttf +0 -0
  20. data/assets/fonts/patternfly/OpenSans-ExtraBoldItalic-webfont.woff +0 -0
  21. data/assets/fonts/patternfly/OpenSans-ExtraBoldItalic-webfont.woff2 +0 -0
  22. data/assets/fonts/patternfly/OpenSans-Italic-webfont.eot +0 -0
  23. data/assets/fonts/patternfly/OpenSans-Italic-webfont.svg +19040 -1827
  24. data/assets/fonts/patternfly/OpenSans-Italic-webfont.ttf +0 -0
  25. data/assets/fonts/patternfly/OpenSans-Italic-webfont.woff +0 -0
  26. data/assets/fonts/patternfly/OpenSans-Italic-webfont.woff2 +0 -0
  27. data/assets/fonts/patternfly/OpenSans-Light-webfont.eot +0 -0
  28. data/assets/fonts/patternfly/OpenSans-Light-webfont.svg +19023 -1828
  29. data/assets/fonts/patternfly/OpenSans-Light-webfont.ttf +0 -0
  30. data/assets/fonts/patternfly/OpenSans-Light-webfont.woff +0 -0
  31. data/assets/fonts/patternfly/OpenSans-Light-webfont.woff2 +0 -0
  32. data/assets/fonts/patternfly/OpenSans-LightItalic-webfont.eot +0 -0
  33. data/assets/fonts/patternfly/OpenSans-LightItalic-webfont.svg +19036 -1832
  34. data/assets/fonts/patternfly/OpenSans-LightItalic-webfont.ttf +0 -0
  35. data/assets/fonts/patternfly/OpenSans-LightItalic-webfont.woff +0 -0
  36. data/assets/fonts/patternfly/OpenSans-LightItalic-webfont.woff2 +0 -0
  37. data/assets/fonts/patternfly/OpenSans-Regular-webfont.eot +0 -0
  38. data/assets/fonts/patternfly/OpenSans-Regular-webfont.svg +19027 -1828
  39. data/assets/fonts/patternfly/OpenSans-Regular-webfont.ttf +0 -0
  40. data/assets/fonts/patternfly/OpenSans-Regular-webfont.woff +0 -0
  41. data/assets/fonts/patternfly/OpenSans-Regular-webfont.woff2 +0 -0
  42. data/assets/fonts/patternfly/OpenSans-Semibold-webfont.eot +0 -0
  43. data/assets/fonts/patternfly/OpenSans-Semibold-webfont.svg +19027 -1827
  44. data/assets/fonts/patternfly/OpenSans-Semibold-webfont.ttf +0 -0
  45. data/assets/fonts/patternfly/OpenSans-Semibold-webfont.woff +0 -0
  46. data/assets/fonts/patternfly/OpenSans-Semibold-webfont.woff2 +0 -0
  47. data/assets/fonts/patternfly/OpenSans-SemiboldItalic-webfont.eot +0 -0
  48. data/assets/fonts/patternfly/OpenSans-SemiboldItalic-webfont.svg +19040 -1827
  49. data/assets/fonts/patternfly/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  50. data/assets/fonts/patternfly/OpenSans-SemiboldItalic-webfont.woff +0 -0
  51. data/assets/fonts/patternfly/OpenSans-SemiboldItalic-webfont.woff2 +0 -0
  52. data/assets/fonts/patternfly/PatternFlyIcons-webfont.eot +0 -0
  53. data/assets/fonts/patternfly/PatternFlyIcons-webfont.svg +2 -0
  54. data/assets/fonts/patternfly/PatternFlyIcons-webfont.ttf +0 -0
  55. data/assets/fonts/patternfly/PatternFlyIcons-webfont.woff +0 -0
  56. data/assets/javascripts/patternfly-functions.js +118 -105
  57. data/assets/javascripts/patternfly-functions.min.js +1 -1
  58. data/assets/javascripts/patternfly-settings.js +24 -1
  59. data/assets/javascripts/patternfly-settings.min.js +1 -1
  60. data/assets/javascripts/patternfly.dataTables.pfEmpty.js +11 -2
  61. data/assets/javascripts/patternfly.dataTables.pfEmpty.min.js +1 -1
  62. data/assets/javascripts/patternfly.dataTables.pfFilter.js +13 -5
  63. data/assets/javascripts/patternfly.dataTables.pfFilter.min.js +1 -1
  64. data/assets/javascripts/patternfly.dataTables.pfPagination.js +401 -0
  65. data/assets/javascripts/patternfly.dataTables.pfPagination.min.js +1 -0
  66. data/assets/javascripts/patternfly.dataTables.pfSelect.js +2 -2
  67. data/assets/javascripts/patternfly.dataTables.pfSelect.min.js +1 -1
  68. data/assets/javascripts/patternfly.js +142 -106
  69. data/assets/javascripts/patternfly.min.js +2 -2
  70. data/assets/stylesheets/_patternfly.scss +1 -0
  71. data/assets/stylesheets/patternfly/_close.scss +2 -0
  72. data/assets/stylesheets/patternfly/_fonts.scss +95 -25
  73. data/assets/stylesheets/patternfly/_icons.scss +6 -0
  74. data/assets/stylesheets/patternfly/_list-view-dnd.scss +53 -0
  75. data/assets/stylesheets/patternfly/_list-view.scss +1 -0
  76. data/assets/stylesheets/patternfly/_pagination.scss +50 -0
  77. data/assets/stylesheets/patternfly/_variables.scss +2 -0
  78. data/assets/stylesheets/patternfly/lib/bootstrap-switch.scss +2 -5
  79. data/bower.json +1 -1
  80. data/lib/patternfly-sass/version.rb +2 -2
  81. data/package.json +1 -1
  82. data/spec/html/bar-charts.html +109 -0
  83. data/spec/html/basic.html +267 -0
  84. data/spec/html/bootstrap-treeview-2.html +3 -0
  85. data/spec/html/card-view-multi-select.html +20 -1
  86. data/spec/html/card-view-single-select.html +3 -0
  87. data/spec/html/cards.html +3 -0
  88. data/spec/html/dashboard.html +3 -0
  89. data/spec/html/dist/css/patternfly-additions.css +46 -0
  90. data/spec/html/dist/css/patternfly-additions.css.map +1 -1
  91. data/spec/html/dist/css/patternfly-additions.min.css +1 -1
  92. data/spec/html/dist/css/patternfly-additions.min.css.map +1 -1
  93. data/spec/html/dist/css/patternfly.css +124 -5
  94. data/spec/html/dist/css/patternfly.css.map +1 -1
  95. data/spec/html/dist/css/patternfly.min.css +3 -3
  96. data/spec/html/dist/css/patternfly.min.css.map +1 -1
  97. data/spec/html/form.html +3 -0
  98. data/spec/html/icons.html +10 -0
  99. data/spec/html/index.html +9 -0
  100. data/spec/html/list-view-compound-expansion.html +3 -0
  101. data/spec/html/list-view-rows.html +1 -1
  102. data/spec/html/list-view-simple-expansion.html +3 -0
  103. data/spec/html/list-view.html +19 -0
  104. data/spec/html/pagination-card-view.html +560 -0
  105. data/spec/html/pagination-list-view.html +1204 -0
  106. data/spec/html/pagination-table-view.html +800 -0
  107. data/spec/html/pagination.html +37 -0
  108. data/spec/html/tab.html +267 -0
  109. data/spec/html/table-view-navbar.html +268 -0
  110. data/spec/html/table-view.html +265 -0
  111. data/spec/html/toolbar.html +3 -0
  112. data/spec/html/typography-2.html +3 -0
  113. data/spec/html/typography.html +17 -0
  114. metadata +21 -2
@@ -1 +1 @@
1
- !function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function addActiveFilterControl(dt,filter){var i,ctx=dt.settings()[0];ctx._pfFilter.activeFilterControls.append('<li><span class="label label-info">'+filter.name+": "+filter.value+'<a href="#"><span class="pficon pficon-close"/></a></span></li>'),$("a",ctx._pfFilter.activeFilterControls).last().on("click",function(e){for(i=0;i<ctx._pfFilter.filters.length;i++)if(ctx._pfFilter.filters[i].column===filter.column&&ctx._pfFilter.filters[i].value===filter.value){ctx._pfFilter.filters.splice(i,1),$(this).parents("li").remove();break}0===ctx._pfFilter.filters.length&&ctx._pfFilter.activeFilters.addClass("hidden"),dt.draw(),updateFilterResults(dt)}),ctx._pfFilter.activeFilters.removeClass("hidden")}function addFilter(dt,filter){var ctx=dt.settings()[0],found=!1;$.grep(ctx._pfFilter.filters,function(f){f.column===filter.column&&f.value===filter.value&&(found=!0)}),found||(ctx._pfFilter.filters.push(filter),dt.draw(),addActiveFilterControl(dt,filter),updateFilterResults(dt)),ctx._pfFilter.filterInput.val("")}function clearFilters(dt){var ctx=dt.settings()[0];ctx._pfFilter.filters.length=0,ctx._pfFilter.activeFilterControls.html(""),ctx._pfFilter.activeFilters.addClass("hidden"),dt.draw()}function handleClearFilters(dt){var ctx=dt.settings()[0];ctx._pfFilter.clearFilters!==undefined&&0!==ctx._pfFilter.clearFilters.length&&ctx._pfFilter.clearFilters.on("click",function(e){clearFilters(dt)})}function handleFilterInput(dt){var ctx=dt.settings()[0];ctx._pfFilter.filterInput!==undefined&&0!==ctx._pfFilter.filterInput.length&&ctx._pfFilter.filterInput.on("keypress",function(e){var keycode=e.keyCode?e.keyCode:e.which;return 13!==keycode||(e.preventDefault(),this.value.trim().length>0&&addFilter(dt,{column:ctx._pfFilter.filterColumn,name:ctx._pfFilter.filterName,value:this.value}),!1)})}function handleFilterOption(dt,i){var ctx=dt.settings()[0];null!==ctx._pfFilter.filterCols[i]&&ctx._pfFilter.filterCols[i].optionSelector!==undefined&&$(ctx._pfFilter.filterCols[i].optionSelector).on("click",function(e){ctx._pfFilter.filterInput!==undefined&&0!==ctx._pfFilter.filterInput.length&&(ctx._pfFilter.filterInput.get(0).placeholder=ctx._pfFilter.filterCols[i].placeholder),ctx._pfFilter.filterLabel!==undefined&&0!==ctx._pfFilter.filterLabel.length&&ctx._pfFilter.filterLabel.html($(this).text()),ctx._pfFilter.filterButton!==undefined&&0!==ctx._pfFilter.filterButton.length&&ctx._pfFilter.filterButton.html($(this).text()+' <span class="caret"></span>'),ctx._pfFilter.filterColumn=i,ctx._pfFilter.filterName=$(this).text()})}function updateFilterResults(dt){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"}).flatten().length;ctx._pfFilter.filterResults!==undefined&&0!==ctx._pfFilter.filterResults.length&&ctx._pfFilter.filterResults.html(filteredRows+" Results")}var DataTable=$.fn.dataTable,ACTIVE_FILTER_CONTROLS_SELECTOR=".list-inline",CLEAR_FILTERS_SELECTOR=".toolbar-pf-results a",FILTER_SELECTOR=".toolbar-pf-filter",FILTER_BUTTON_SELECTOR=FILTER_SELECTOR+" button",FILTER_INPUT_SELECTOR=FILTER_SELECTOR+" input",FILTER_LABEL_SELECTOR=FILTER_SELECTOR+" label",RESULTS_SELECTOR=".toolbar-pf-results",FILTER_RESULTS_SELECTOR=RESULTS_SELECTOR+" h5";return DataTable.pfFilter={},DataTable.pfFilter.init=function(dt){var i,ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{};if(ctx._pfFilter={},ctx._pfFilter.filterButton=$(FILTER_BUTTON_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterCols=opts.filterCols,ctx._pfFilter.filterLabel=$(FILTER_LABEL_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterInput=$(FILTER_INPUT_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filters=[],ctx._pfFilter.activeFilterControls=$(ACTIVE_FILTER_CONTROLS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.activeFilters=ctx._pfFilter.activeFilterControls.closest("div"),ctx._pfFilter.clearFilters=$(CLEAR_FILTERS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.results=$(RESULTS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterResults=$(FILTER_RESULTS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterCols!==undefined){for(i=0;i<ctx._pfFilter.filterCols.length&&(null===ctx._pfFilter.filterCols[i]||(ctx._pfFilter.filterColumn=i,ctx._pfFilter.filterName=$(ctx._pfFilter.filterCols[i].optionSelector).text(),ctx._pfFilter.filterCols[i].default!==!0));i++);for(i=0;i<ctx._pfFilter.filterCols.length;i++)handleFilterOption(dt,i);handleFilterInput(dt),handleClearFilters(dt),$.fn.dataTable.ext.search.push(function(ctx,data,dataIndex){var showThisRow=!0;return ctx._pfFilter&&$.each(ctx._pfFilter.filters,function(index,filter){data[filter.column].indexOf(filter.value)===-1&&(showThisRow=!1)}),showThisRow})}},DataTable.Api.register("pfFilter.addFilter()",function(filter){return this.iterator("table",function(ctx){addFilter(new DataTable.Api(ctx),filter)})}),DataTable.Api.register("pfFilter.clearFilters()",function(){return this.iterator("table",function(ctx){clearFilters(new DataTable.Api(ctx))})}),$(document).on("init.dt",function(e,ctx,json){"dt"===e.namespace&&DataTable.pfFilter.init(new DataTable.Api(ctx))}),DataTable.pfFilter});
1
+ !function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function addActiveFilterControl(dt,filter){var i,ctx=dt.settings()[0];ctx._pfFilter.activeFilterControls.append('<li><span class="label label-info">'+filter.name+": "+filter.value+'<a href="#"><span class="pficon pficon-close"/></a></span></li>'),$("a",ctx._pfFilter.activeFilterControls).last().on("click",function(e){for(i=0;i<ctx._pfFilter.filters.length;i++)if(ctx._pfFilter.filters[i].column===filter.column&&ctx._pfFilter.filters[i].value===filter.value){ctx._pfFilter.filters.splice(i,1),$(this).parents("li").remove();break}0===ctx._pfFilter.filters.length&&ctx._pfFilter.activeFilters.addClass("hidden"),dt.draw(),updateFilterResults(dt)}),ctx._pfFilter.activeFilters.removeClass("hidden")}function addFilter(dt,filter){var ctx=dt.settings()[0],found=!1;$.grep(ctx._pfFilter.filters,function(f){f.column===filter.column&&f.value===filter.value&&(found=!0)}),found||(ctx._pfFilter.filters.push(filter),dt.draw(),addActiveFilterControl(dt,filter),updateFilterResults(dt)),ctx._pfFilter.filterInput.val("")}function clearFilters(dt){var ctx=dt.settings()[0];ctx._pfFilter.filters.length=0,ctx._pfFilter.activeFilterControls.html(""),ctx._pfFilter.activeFilters.addClass("hidden"),dt.draw()}function handleClearFilters(dt){var ctx=dt.settings()[0];ctx._pfFilter.clearFilters!==undefined&&0!==ctx._pfFilter.clearFilters.length&&ctx._pfFilter.clearFilters.on("click",function(e){clearFilters(dt)})}function handleFilterInput(dt){var ctx=dt.settings()[0];ctx._pfFilter.filterInput!==undefined&&0!==ctx._pfFilter.filterInput.length&&ctx._pfFilter.filterInput.on("keypress",function(e){var keycode=e.keyCode?e.keyCode:e.which;return 13!==keycode||(e.preventDefault(),this.value.trim().length>0&&addFilter(dt,{column:ctx._pfFilter.filterColumn,name:ctx._pfFilter.filterName,value:this.value}),!1)})}function handleFilterOption(dt,i){var ctx=dt.settings()[0];null!==ctx._pfFilter.filterCols[i]&&ctx._pfFilter.filterCols[i].optionSelector!==undefined&&$(ctx._pfFilter.filterCols[i].optionSelector).on("click",function(e){ctx._pfFilter.filterInput!==undefined&&0!==ctx._pfFilter.filterInput.length&&(ctx._pfFilter.filterInput.get(0).placeholder=ctx._pfFilter.filterCols[i].placeholder),ctx._pfFilter.filterLabel!==undefined&&0!==ctx._pfFilter.filterLabel.length&&ctx._pfFilter.filterLabel.html($(this).text()),ctx._pfFilter.filterButton!==undefined&&0!==ctx._pfFilter.filterButton.length&&ctx._pfFilter.filterButton.html($(this).text()+' <span class="caret"></span>'),ctx._pfFilter.filterColumn=i,ctx._pfFilter.filterName=$(this).text()})}function updateFilterResults(dt){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"}).flatten().length;ctx._pfFilter.filterResults!==undefined&&0!==ctx._pfFilter.filterResults.length&&ctx._pfFilter.filterResults.html(filteredRows+" Results")}var DataTable=$.fn.dataTable,ACTIVE_FILTER_CONTROLS_SELECTOR=".list-inline",CLEAR_FILTERS_SELECTOR=".toolbar-pf-results a",FILTER_SELECTOR=".toolbar-pf-filter",FILTER_BUTTON_SELECTOR=FILTER_SELECTOR+" button",FILTER_INPUT_SELECTOR=FILTER_SELECTOR+" input",FILTER_LABEL_SELECTOR=FILTER_SELECTOR+" label",RESULTS_SELECTOR=".toolbar-pf-results",FILTER_RESULTS_SELECTOR=RESULTS_SELECTOR+" h5";return DataTable.pfFilter={},DataTable.pfFilter.init=function(dt){var i,ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{};if(ctx._pfFilter={},ctx._pfFilter.filterButton=$(FILTER_BUTTON_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterCols=opts.filterCols,ctx._pfFilter.filterLabel=$(FILTER_LABEL_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterInput=$(FILTER_INPUT_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filters=[],ctx._pfFilter.activeFilterControls=$(ACTIVE_FILTER_CONTROLS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.activeFilters=ctx._pfFilter.activeFilterControls.closest("div"),ctx._pfFilter.clearFilters=$(CLEAR_FILTERS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.results=$(RESULTS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterCaseInsensitive=opts.filterCaseInsensitive,ctx._pfFilter.filterResults=$(FILTER_RESULTS_SELECTOR,opts.toolbarSelector),ctx._pfFilter.filterCols!==undefined){for(i=0;i<ctx._pfFilter.filterCols.length&&(null===ctx._pfFilter.filterCols[i]||(ctx._pfFilter.filterColumn=i,ctx._pfFilter.filterName=$(ctx._pfFilter.filterCols[i].optionSelector).text(),ctx._pfFilter.filterCols[i].default!==!0));i++);for(i=0;i<ctx._pfFilter.filterCols.length;i++)handleFilterOption(dt,i);handleFilterInput(dt),handleClearFilters(dt),$.fn.dataTable.ext.search.push(function(ctx,data,dataIndex){var showThisRow=!0;return ctx._pfFilter&&$.each(ctx._pfFilter.filters,function(index,filter){ctx._pfFilter.filterCaseInsensitive!==undefined&&ctx._pfFilter.filterCaseInsensitive===!0?data[filter.column].toLowerCase().indexOf(filter.value.toLowerCase())===-1&&(showThisRow=!1):data[filter.column].indexOf(filter.value)===-1&&(showThisRow=!1)}),showThisRow})}},DataTable.Api.register("pfFilter.addFilter()",function(filter){return this.iterator("table",function(ctx){addFilter(new DataTable.Api(ctx),filter)})}),DataTable.Api.register("pfFilter.clearFilters()",function(){return this.iterator("table",function(ctx){clearFilters(new DataTable.Api(ctx))})}),$(document).on("init.dt",function(e,ctx,json){"dt"===e.namespace&&DataTable.pfFilter.init(new DataTable.Api(ctx))}),DataTable.pfFilter});
@@ -0,0 +1,401 @@
1
+ /**
2
+ * @summary pfPagination for DataTables
3
+ * @description A collection of API methods providing functionality to paginate DataTables data. This ensures
4
+ * DataTables meets the Patternfly design pattern while maintaining accessibility.
5
+ *
6
+ * The pagination layout is expected to contain the classes as shown in the example below.
7
+ *
8
+ * Example:
9
+ *
10
+ * <!-- NOTE: Some configuration may be omitted for clarity -->
11
+ * <table class="table table-striped table-bordered table-hover" id="table1">
12
+ * <thead>
13
+ * <tr>
14
+ * <th><input type="checkbox" name="selectAll"></th>
15
+ * <th>Rendering Engine</th>
16
+ * <th>Browser</th>
17
+ * </tr>
18
+ * </thead>
19
+ * </table>
20
+ * <form class="content-view-pf-pagination table-view-pf-pagination clearfix" id="pagination1">
21
+ * <div class="form-group">
22
+ * <select class="selectpicker pagination-pf-pagesize">
23
+ * <option value="6">6</option>
24
+ * <option value="10">10</option>
25
+ * <option value="15" selected="selected">15</option>
26
+ * <option value="25">25</option>
27
+ * <option value="50">50</option>
28
+ * </select>
29
+ * <span>per page</span>
30
+ * </div>
31
+ * <div class="form-group">
32
+ * <span><span class="pagination-pf-items-current">1-15</span> of <span class="pagination-pf-items-total">75</span></span>
33
+ * <ul class="pagination pagination-pf-back">
34
+ * <li><a href="#" onclick="return false;" title="First Page"><span class="i fa fa-angle-double-left"></span></a></li>
35
+ * <li><a href="#" onclick="return false;" title="Previous Page"><span class="i fa fa-angle-left"></span></a></li>
36
+ * </ul>
37
+ * <label for="pagination1-page" class="sr-only">Current Page</label>
38
+ * <input class="pagination-pf-page" type="text" value="1" id="pagination1-page"/>
39
+ * <span>of <span class="pagination-pf-pages">5</span></span>
40
+ * <ul class="pagination pagination-pf-forward">
41
+ * <li><a href="#" onclick="return false;" title="Next Page"><span class="i fa fa-angle-right"></span></a></li>
42
+ * <li><a href="#" onclick="return false;" title="Last Page"><span class="i fa fa-angle-double-right"></span></a></li>
43
+ * </ul>
44
+ * </div>
45
+ * </form>
46
+ * <script>
47
+ * // NOTE: Some properties may be omitted for clarity
48
+ * $(document).ready(function() {
49
+ * var dt = $("#table1").DataTable({
50
+ * columns: [
51
+ * { data: null, ... },
52
+ * { data: "engine" },
53
+ * { data: "browser" }
54
+ * ],
55
+ * data: null,
56
+ * dom: "t",
57
+ * pfConfig: {
58
+ * ...
59
+ * pageSize: 15,
60
+ * paginationSelector: "#pagination1",
61
+ * }
62
+ * });
63
+ * dt.table().pfPagination.next(); // Optional API to navigate to the next page
64
+ * dt.table().pfPagination.previous(); // Optional API to navigate to the previous page
65
+ * });
66
+ * </script>
67
+ */
68
+ (function (factory) {
69
+ "use strict";
70
+ if (typeof define === "function" && define.amd ) {
71
+ // AMD
72
+ define (["jquery", "datatables.net"], function ($) {
73
+ return factory ($, window, document);
74
+ });
75
+ } else if (typeof exports === "object") {
76
+ // CommonJS
77
+ module.exports = function (root, $) {
78
+ if (!root) {
79
+ root = window;
80
+ }
81
+ if (!$ || !$.fn.dataTable) {
82
+ $ = require("datatables.net")(root, $).$;
83
+ }
84
+ return factory($, root, root.document);
85
+ };
86
+ } else {
87
+ // Browser
88
+ factory(jQuery, window, document);
89
+ }
90
+ }(function ($, window, document, undefined) {
91
+ "use strict";
92
+ var DataTable = $.fn.dataTable;
93
+ var BACK_ACTIONS_SELECTOR = ".pagination-pf-back"; // Back navigation actions
94
+ var CURRENT_ITEMS_SELECTOR = ".pagination-pf-items-current"; // Current items text (e.g., 1-15)
95
+ var CURRENT_PAGE_SELECTOR = ".pagination-pf-page"; // Current page input
96
+ var FIRST_PAGE_SELECTOR = ".pagination-pf-back .fa-angle-double-left"; // First page button
97
+ var FORWARD_ACTIONS_SELECTOR = ".pagination-pf-forward"; // Forward navigation actions
98
+ var LAST_PAGE_SELECTOR = ".pagination-pf-forward .fa-angle-double-right"; // Last page button
99
+ var PAGE_SIZE_SELECTOR = ".pagination-pf-pagesize"; // Page size selection
100
+ var TOTAL_ITEMS_SELECTOR = ".pagination-pf-items-total"; // Total items
101
+ var TOTAL_PAGES_SELECTOR = ".pagination-pf-pages"; // Total pages text
102
+ var PREVIOUS_PAGE_SELECTOR = ".pagination-pf-back .fa-angle-left"; // Previous page button
103
+ var NEXT_PAGE_SELECTOR = ".pagination-pf-forward .fa-angle-right"; // Next page button
104
+
105
+ DataTable.pfPagination = {};
106
+
107
+ /**
108
+ * Initialize
109
+ *
110
+ * @param {DataTable.Api} dt DataTable
111
+ * @private
112
+ */
113
+ DataTable.pfPagination.init = function (dt) {
114
+ var ctx = dt.settings()[0];
115
+ var opts = (ctx.oInit.pfConfig) ? ctx.oInit.pfConfig : {};
116
+
117
+ ctx._pfPagination = {};
118
+ ctx._pfPagination.backActions = $(BACK_ACTIONS_SELECTOR, opts.paginationSelector); // Back navigation actions
119
+ ctx._pfPagination.currentItems = $(CURRENT_ITEMS_SELECTOR, opts.paginationSelector); // Current items
120
+ ctx._pfPagination.currentPage = $(CURRENT_PAGE_SELECTOR, opts.paginationSelector); // Current page
121
+ ctx._pfPagination.firstPage = $(FIRST_PAGE_SELECTOR, opts.paginationSelector); // First page button
122
+ ctx._pfPagination.forwardActions = $(FORWARD_ACTIONS_SELECTOR, opts.paginationSelector); // Forward navigation actions
123
+ ctx._pfPagination.lastPage = $(LAST_PAGE_SELECTOR, opts.paginationSelector); // Last page button
124
+ ctx._pfPagination.nextPage = $(NEXT_PAGE_SELECTOR, opts.paginationSelector); // Next page button
125
+ ctx._pfPagination.pageSize = $(PAGE_SIZE_SELECTOR, opts.paginationSelector); // Page size selection
126
+ ctx._pfPagination.previousPage = $(PREVIOUS_PAGE_SELECTOR, opts.paginationSelector); // Next page button
127
+ ctx._pfPagination.totalItems = $(TOTAL_ITEMS_SELECTOR, opts.paginationSelector); // Total items
128
+ ctx._pfPagination.totalPages = $(TOTAL_PAGES_SELECTOR, opts.paginationSelector); // Total pages
129
+
130
+ // Set initial page size
131
+ ctx._pfPagination.currentPageSize = (opts.pageSize !== undefined) ? opts.pageSize : 15;
132
+
133
+ // Handle page navigation
134
+ handleCurrentPage(dt);
135
+ handleFirstPage(dt);
136
+ handleLastPage(dt);
137
+ handlePageSize(dt);
138
+ handleNextPage(dt);
139
+ handlePreviousPage(dt);
140
+
141
+ // Update table on DataTables draw event
142
+ dt.on("draw.page", function () {
143
+ updateCurrentPage(dt);
144
+ updateCurrentItems(dt);
145
+ updateTotalItems(dt);
146
+ updateTotalPages(dt);
147
+ updateBackActions(dt);
148
+ updateForwardActions(dt);
149
+ });
150
+
151
+ // Initialize page info
152
+ dt.table().page.len(ctx._pfPagination.currentPageSize);
153
+ dt.table().draw('page');
154
+ };
155
+
156
+ // Local functions
157
+
158
+ /**
159
+ * Handle page navigation when enter is pressed
160
+ *
161
+ * @param {DataTable.Api} dt DataTable
162
+ * @private
163
+ */
164
+ function handleCurrentPage (dt) {
165
+ var ctx = dt.settings()[0];
166
+ if (ctx._pfPagination.currentPage === undefined || ctx._pfPagination.currentPage.length === 0) {
167
+ return;
168
+ }
169
+ ctx._pfPagination.currentPage.on("keypress", function (e) {
170
+ var page, pageInfo = dt.table().page.info();
171
+ var keycode = (e.keyCode ? e.keyCode : e.which);
172
+ if (keycode === 13) {
173
+ e.preventDefault();
174
+ page = parseInt(this.value) - 1;
175
+ if (page >= 0 && page < pageInfo.pages) {
176
+ dt.table().page(page).draw('page');
177
+ } else {
178
+ updateCurrentPage(dt); // Always update to replace bad values
179
+ }
180
+ return false;
181
+ }
182
+ return true;
183
+ });
184
+ }
185
+
186
+ /**
187
+ * Handle page navigation when first button is selected
188
+ *
189
+ * @param {DataTable.Api} dt DataTable
190
+ * @private
191
+ */
192
+ function handleFirstPage (dt) {
193
+ var ctx = dt.settings()[0];
194
+ if (ctx._pfPagination.firstPage === undefined || ctx._pfPagination.firstPage.length === 0) {
195
+ return;
196
+ }
197
+ $(ctx._pfPagination.firstPage).closest('li').on("click", function (e) {
198
+ dt.table().page('first').draw('page');
199
+ });
200
+ }
201
+
202
+ /**
203
+ * Handle page navigation when last button is selected
204
+ *
205
+ * @param {DataTable.Api} dt DataTable
206
+ * @private
207
+ */
208
+ function handleLastPage (dt) {
209
+ var ctx = dt.settings()[0];
210
+ if (ctx._pfPagination.lastPage === undefined || ctx._pfPagination.lastPage.length === 0) {
211
+ return;
212
+ }
213
+ $(ctx._pfPagination.lastPage).closest('li').on("click", function (e) {
214
+ dt.table().page('last').draw('page');
215
+ });
216
+ }
217
+
218
+ /**
219
+ * Handle page navigation when next button is selected
220
+ *
221
+ * @param {DataTable.Api} dt DataTable
222
+ * @private
223
+ */
224
+ function handleNextPage (dt) {
225
+ var ctx = dt.settings()[0];
226
+ if (ctx._pfPagination.nextPage === undefined || ctx._pfPagination.nextPage.length === 0) {
227
+ return;
228
+ }
229
+ $(ctx._pfPagination.nextPage).closest('a').on("click", function (e) {
230
+ dt.table().page('next').draw('page');
231
+ });
232
+ }
233
+
234
+ /**
235
+ * Handle page size when selected
236
+ *
237
+ * @param {DataTable.Api} dt DataTable
238
+ * @private
239
+ */
240
+ function handlePageSize (dt) {
241
+ var ctx = dt.settings()[0];
242
+ if (ctx._pfPagination.pageSize === undefined || ctx._pfPagination.pageSize.length === 0) {
243
+ return;
244
+ }
245
+ ctx._pfPagination.pageSize.on("change", function (e) {
246
+ ctx._pfPagination.currentPageSize = parseInt(this.value);
247
+ dt.table().page.len(ctx._pfPagination.currentPageSize).draw('page');
248
+ });
249
+ }
250
+
251
+ /**
252
+ * Handle page navigation when previous button is selected
253
+ *
254
+ * @param {DataTable.Api} dt DataTable
255
+ * @private
256
+ */
257
+ function handlePreviousPage (dt) {
258
+ var ctx = dt.settings()[0];
259
+ if (ctx._pfPagination.previousPage === undefined || ctx._pfPagination.previousPage.length === 0) {
260
+ return;
261
+ }
262
+ $(ctx._pfPagination.previousPage).closest('a').on("click", function (e) {
263
+ dt.table().page('previous').draw('page');
264
+ });
265
+ }
266
+
267
+ /**
268
+ * Update current page
269
+ *
270
+ * @param {DataTable.Api} dt DataTable
271
+ * @private
272
+ */
273
+ function updateCurrentPage (dt) {
274
+ var ctx = dt.settings()[0];
275
+ var pageInfo = dt.table().page.info();
276
+ var page = (pageInfo.recordsDisplay === 0) ? 0 : pageInfo.page + 1;
277
+ if (ctx._pfPagination.currentPage === undefined || ctx._pfPagination.currentPage.length === 0) {
278
+ return;
279
+ }
280
+ // Disable if pagination is not available due to filtering
281
+ if (pageInfo.recordsDisplay > pageInfo.length) {
282
+ $(ctx._pfPagination.currentPage).prop("disabled", false);
283
+ } else {
284
+ $(ctx._pfPagination.currentPage).prop("disabled", true);
285
+ }
286
+ // Set current page value
287
+ $(ctx._pfPagination.currentPage).val(page);
288
+ }
289
+
290
+ /**
291
+ * Update back navigation actions
292
+ *
293
+ * @param {DataTable.Api} dt DataTable
294
+ * @private
295
+ */
296
+ function updateBackActions (dt) {
297
+ var ctx = dt.settings()[0];
298
+ var pageInfo = dt.table().page.info();
299
+ if (pageInfo.page === 0) {
300
+ $("li", ctx._pfPagination.backActions).each(function () {
301
+ $(this).addClass("disabled");
302
+ });
303
+ } else {
304
+ $("li", ctx._pfPagination.backActions).each(function () {
305
+ $(this).removeClass("disabled");
306
+ });
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Update current items
312
+ *
313
+ * @param {DataTable.Api} dt DataTable
314
+ * @private
315
+ */
316
+ function updateCurrentItems (dt) {
317
+ var ctx = dt.settings()[0];
318
+ var pageInfo = dt.table().page.info();
319
+ var start = (pageInfo.recordsDisplay === 0) ? 0 : pageInfo.start + 1;
320
+ ctx._pfPagination.currentItems.html(start + "-" + pageInfo.end);
321
+ }
322
+
323
+ /**
324
+ * Update forward navigation actions
325
+ *
326
+ * @param {DataTable.Api} dt DataTable
327
+ * @private
328
+ */
329
+ function updateForwardActions (dt) {
330
+ var ctx = dt.settings()[0];
331
+ var pageInfo = dt.table().page.info();
332
+ if (pageInfo.recordsDisplay === 0 || pageInfo.page === pageInfo.pages - 1) {
333
+ $("li", ctx._pfPagination.forwardActions).each(function () {
334
+ $(this).addClass("disabled");
335
+ });
336
+ } else {
337
+ $("li", ctx._pfPagination.forwardActions).each(function () {
338
+ $(this).removeClass("disabled");
339
+ });
340
+ }
341
+ }
342
+
343
+ /**
344
+ * Update total items
345
+ *
346
+ * @param {DataTable.Api} dt DataTable
347
+ * @private
348
+ */
349
+ function updateTotalItems (dt) {
350
+ var ctx = dt.settings()[0];
351
+ var pageInfo = dt.table().page.info();
352
+
353
+ ctx._pfPagination.totalItems.html(pageInfo.recordsDisplay);
354
+ }
355
+
356
+ /**
357
+ * Update total pages
358
+ *
359
+ * @param {DataTable.Api} dt DataTable
360
+ * @private
361
+ */
362
+ function updateTotalPages (dt) {
363
+ var ctx = dt.settings()[0];
364
+ var pageInfo = dt.table().page.info();
365
+
366
+ ctx._pfPagination.totalPages.html(pageInfo.pages);
367
+ }
368
+
369
+ // DataTables API
370
+
371
+ /**
372
+ * Navigate to next page
373
+ *
374
+ * Example: dt.table().pfPagination.next();
375
+ */
376
+ DataTable.Api.register("pfPagination.next()", function () {
377
+ return this.iterator("table", function (ctx) {
378
+ handleNextPage(new DataTable.Api(ctx));
379
+ });
380
+ });
381
+
382
+ /**
383
+ * Navigate to previous page
384
+ *
385
+ * Example: dt.table().pfPagination.previous();
386
+ */
387
+ DataTable.Api.register("pfPagination.previous()", function () {
388
+ return this.iterator("table", function (ctx) {
389
+ handlePreviousPage(new DataTable.Api(ctx));
390
+ });
391
+ });
392
+
393
+ // DataTables creation
394
+ $(document).on("init.dt", function (e, ctx, json) {
395
+ if (e.namespace !== "dt") {
396
+ return;
397
+ }
398
+ DataTable.pfPagination.init(new DataTable.Api(ctx));
399
+ });
400
+ return DataTable.pfPagination;
401
+ }));
@@ -0,0 +1 @@
1
+ !function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function handleCurrentPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.currentPage!==undefined&&0!==ctx._pfPagination.currentPage.length&&ctx._pfPagination.currentPage.on("keypress",function(e){var page,pageInfo=dt.table().page.info(),keycode=e.keyCode?e.keyCode:e.which;return 13!==keycode||(e.preventDefault(),page=parseInt(this.value)-1,page>=0&&page<pageInfo.pages?dt.table().page(page).draw("page"):updateCurrentPage(dt),!1)})}function handleFirstPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.firstPage!==undefined&&0!==ctx._pfPagination.firstPage.length&&$(ctx._pfPagination.firstPage).closest("li").on("click",function(e){dt.table().page("first").draw("page")})}function handleLastPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.lastPage!==undefined&&0!==ctx._pfPagination.lastPage.length&&$(ctx._pfPagination.lastPage).closest("li").on("click",function(e){dt.table().page("last").draw("page")})}function handleNextPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.nextPage!==undefined&&0!==ctx._pfPagination.nextPage.length&&$(ctx._pfPagination.nextPage).closest("a").on("click",function(e){dt.table().page("next").draw("page")})}function handlePageSize(dt){var ctx=dt.settings()[0];ctx._pfPagination.pageSize!==undefined&&0!==ctx._pfPagination.pageSize.length&&ctx._pfPagination.pageSize.on("change",function(e){ctx._pfPagination.currentPageSize=parseInt(this.value),dt.table().page.len(ctx._pfPagination.currentPageSize).draw("page")})}function handlePreviousPage(dt){var ctx=dt.settings()[0];ctx._pfPagination.previousPage!==undefined&&0!==ctx._pfPagination.previousPage.length&&$(ctx._pfPagination.previousPage).closest("a").on("click",function(e){dt.table().page("previous").draw("page")})}function updateCurrentPage(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info(),page=0===pageInfo.recordsDisplay?0:pageInfo.page+1;ctx._pfPagination.currentPage!==undefined&&0!==ctx._pfPagination.currentPage.length&&(pageInfo.recordsDisplay>pageInfo.length?$(ctx._pfPagination.currentPage).prop("disabled",!1):$(ctx._pfPagination.currentPage).prop("disabled",!0),$(ctx._pfPagination.currentPage).val(page))}function updateBackActions(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();0===pageInfo.page?$("li",ctx._pfPagination.backActions).each(function(){$(this).addClass("disabled")}):$("li",ctx._pfPagination.backActions).each(function(){$(this).removeClass("disabled")})}function updateCurrentItems(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info(),start=0===pageInfo.recordsDisplay?0:pageInfo.start+1;ctx._pfPagination.currentItems.html(start+"-"+pageInfo.end)}function updateForwardActions(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();0===pageInfo.recordsDisplay||pageInfo.page===pageInfo.pages-1?$("li",ctx._pfPagination.forwardActions).each(function(){$(this).addClass("disabled")}):$("li",ctx._pfPagination.forwardActions).each(function(){$(this).removeClass("disabled")})}function updateTotalItems(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();ctx._pfPagination.totalItems.html(pageInfo.recordsDisplay)}function updateTotalPages(dt){var ctx=dt.settings()[0],pageInfo=dt.table().page.info();ctx._pfPagination.totalPages.html(pageInfo.pages)}var DataTable=$.fn.dataTable,BACK_ACTIONS_SELECTOR=".pagination-pf-back",CURRENT_ITEMS_SELECTOR=".pagination-pf-items-current",CURRENT_PAGE_SELECTOR=".pagination-pf-page",FIRST_PAGE_SELECTOR=".pagination-pf-back .fa-angle-double-left",FORWARD_ACTIONS_SELECTOR=".pagination-pf-forward",LAST_PAGE_SELECTOR=".pagination-pf-forward .fa-angle-double-right",PAGE_SIZE_SELECTOR=".pagination-pf-pagesize",TOTAL_ITEMS_SELECTOR=".pagination-pf-items-total",TOTAL_PAGES_SELECTOR=".pagination-pf-pages",PREVIOUS_PAGE_SELECTOR=".pagination-pf-back .fa-angle-left",NEXT_PAGE_SELECTOR=".pagination-pf-forward .fa-angle-right";return DataTable.pfPagination={},DataTable.pfPagination.init=function(dt){var ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{};ctx._pfPagination={},ctx._pfPagination.backActions=$(BACK_ACTIONS_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentItems=$(CURRENT_ITEMS_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentPage=$(CURRENT_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.firstPage=$(FIRST_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.forwardActions=$(FORWARD_ACTIONS_SELECTOR,opts.paginationSelector),ctx._pfPagination.lastPage=$(LAST_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.nextPage=$(NEXT_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.pageSize=$(PAGE_SIZE_SELECTOR,opts.paginationSelector),ctx._pfPagination.previousPage=$(PREVIOUS_PAGE_SELECTOR,opts.paginationSelector),ctx._pfPagination.totalItems=$(TOTAL_ITEMS_SELECTOR,opts.paginationSelector),ctx._pfPagination.totalPages=$(TOTAL_PAGES_SELECTOR,opts.paginationSelector),ctx._pfPagination.currentPageSize=opts.pageSize!==undefined?opts.pageSize:15,handleCurrentPage(dt),handleFirstPage(dt),handleLastPage(dt),handlePageSize(dt),handleNextPage(dt),handlePreviousPage(dt),dt.on("draw.page",function(){updateCurrentPage(dt),updateCurrentItems(dt),updateTotalItems(dt),updateTotalPages(dt),updateBackActions(dt),updateForwardActions(dt)}),dt.table().page.len(ctx._pfPagination.currentPageSize),dt.table().draw("page")},DataTable.Api.register("pfPagination.next()",function(){return this.iterator("table",function(ctx){handleNextPage(new DataTable.Api(ctx))})}),DataTable.Api.register("pfPagination.previous()",function(){return this.iterator("table",function(ctx){handlePreviousPage(new DataTable.Api(ctx))})}),$(document).on("init.dt",function(e,ctx,json){"dt"===e.namespace&&DataTable.pfPagination.init(new DataTable.Api(ctx))}),DataTable.pfPagination});
@@ -67,7 +67,7 @@
67
67
  * order: [[ 1, "asc" ]],
68
68
  * pfConfig: {
69
69
  * ...
70
- * toolbarSelector: "#{{include.toolbarId}}",
70
+ * toolbarSelector: "#toolbar1",
71
71
  * selectAllSelector: 'th:first-child input[type="checkbox"]'
72
72
  * }
73
73
  * select: {
@@ -218,7 +218,7 @@
218
218
  // De/select the select all checkbox
219
219
  var selectAll = $(ctx._pfSelect.selectAllSelector, dt.table().container())[0];
220
220
  if (selectAll) {
221
- selectAll.checked = (filteredRows === selectedFilteredRows);
221
+ selectAll.checked = (filteredRows !== 0 && filteredRows === selectedFilteredRows);
222
222
  }
223
223
  updateSelectedRowsText(dt);
224
224
  }
@@ -1 +1 @@
1
- !function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function selectAllRows(dt,select){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"});if("single"===dt.select.style())throw new Error("Cannot select all rows with selection style 'single'");select?filteredRows.select():filteredRows.deselect(),$(ctx._pfSelect.selector,dt.table().container()).prop("checked",select),syncSelectAllCheckbox(dt)}function syncSelectAllCheckbox(dt){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"}).flatten().length,selectedFilteredRows=dt.rows({page:"current",search:"applied",selected:!0}).flatten().length,selectAll=$(ctx._pfSelect.selectAllSelector,dt.table().container())[0];selectAll&&(selectAll.checked=filteredRows===selectedFilteredRows),updateSelectedRowsText(dt)}function syncSelectCheckboxes(dt){var ctx=dt.settings()[0];$(ctx._pfSelect.selector,dt.table().container()).prop("checked",!1),dt.rows({page:"current",search:"applied",selected:!0}).every(function(index){$(ctx._pfSelect.selector,dt.table().row(index).node()).prop("checked",!0)}),syncSelectAllCheckbox(dt)}function updateSelectedRowsText(dt){var ctx=dt.settings()[0],selectedRows=dt.rows({selected:!0}).flatten().length,totalRows=dt.rows().flatten().length;ctx._pfSelect.results!==undefined&&0!==ctx._pfSelect.results.length&&$(ctx._pfSelect.results).html("<strong>"+selectedRows+"</strong> of <strong>"+totalRows+"</strong> selected")}var DataTable=$.fn.dataTable,RESULTS_SELECTOR=".table-view-pf-select-results",SELECT_ALL_SELECTOR='th:first-child input[type="checkbox"]',SELECT_SELECTOR='td:first-child input[type="checkbox"]';return DataTable.pfSelect={},DataTable.pfSelect.init=function(dt){var ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{},select=ctx.oInit.select?ctx.oInit.select:{},style=dt.select.style();ctx._pfSelect={},ctx._pfSelect.selectAllSelector=opts.selectAllSelector!==undefined?opts.selectAllSelector:SELECT_ALL_SELECTOR,ctx._pfSelect.selector=select.selector!==undefined?select.selector:SELECT_SELECTOR,ctx._pfSelect.results=$(RESULTS_SELECTOR,opts.toolbarSelector),"api"===style?($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){evt.preventDefault()}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){evt.preventDefault()}),dt.table().on("select.dt",function(){syncSelectCheckboxes(dt)})):($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){selectAllRows(dt,evt.target.checked)}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){"multi"!==style||"multi+shift"!==style?syncSelectCheckboxes(dt):syncSelectAllCheckbox(dt)})),dt.table().on("draw.dt",function(){syncSelectCheckboxes(dt)}),updateSelectedRowsText(dt)},DataTable.Api.register("pfSelect.selectAllRows()",function(select){return this.iterator("table",function(ctx){selectAllRows(new DataTable.Api(ctx),select)})}),$(document).on("preInit.dt.dtSelect",function(e,ctx){"dt"===e.namespace&&DataTable.pfSelect.init(new DataTable.Api(ctx))}),DataTable.pfSelect});
1
+ !function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function selectAllRows(dt,select){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"});if("single"===dt.select.style())throw new Error("Cannot select all rows with selection style 'single'");select?filteredRows.select():filteredRows.deselect(),$(ctx._pfSelect.selector,dt.table().container()).prop("checked",select),syncSelectAllCheckbox(dt)}function syncSelectAllCheckbox(dt){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"}).flatten().length,selectedFilteredRows=dt.rows({page:"current",search:"applied",selected:!0}).flatten().length,selectAll=$(ctx._pfSelect.selectAllSelector,dt.table().container())[0];selectAll&&(selectAll.checked=0!==filteredRows&&filteredRows===selectedFilteredRows),updateSelectedRowsText(dt)}function syncSelectCheckboxes(dt){var ctx=dt.settings()[0];$(ctx._pfSelect.selector,dt.table().container()).prop("checked",!1),dt.rows({page:"current",search:"applied",selected:!0}).every(function(index){$(ctx._pfSelect.selector,dt.table().row(index).node()).prop("checked",!0)}),syncSelectAllCheckbox(dt)}function updateSelectedRowsText(dt){var ctx=dt.settings()[0],selectedRows=dt.rows({selected:!0}).flatten().length,totalRows=dt.rows().flatten().length;ctx._pfSelect.results!==undefined&&0!==ctx._pfSelect.results.length&&$(ctx._pfSelect.results).html("<strong>"+selectedRows+"</strong> of <strong>"+totalRows+"</strong> selected")}var DataTable=$.fn.dataTable,RESULTS_SELECTOR=".table-view-pf-select-results",SELECT_ALL_SELECTOR='th:first-child input[type="checkbox"]',SELECT_SELECTOR='td:first-child input[type="checkbox"]';return DataTable.pfSelect={},DataTable.pfSelect.init=function(dt){var ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{},select=ctx.oInit.select?ctx.oInit.select:{},style=dt.select.style();ctx._pfSelect={},ctx._pfSelect.selectAllSelector=opts.selectAllSelector!==undefined?opts.selectAllSelector:SELECT_ALL_SELECTOR,ctx._pfSelect.selector=select.selector!==undefined?select.selector:SELECT_SELECTOR,ctx._pfSelect.results=$(RESULTS_SELECTOR,opts.toolbarSelector),"api"===style?($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){evt.preventDefault()}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){evt.preventDefault()}),dt.table().on("select.dt",function(){syncSelectCheckboxes(dt)})):($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){selectAllRows(dt,evt.target.checked)}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){"multi"!==style||"multi+shift"!==style?syncSelectCheckboxes(dt):syncSelectAllCheckbox(dt)})),dt.table().on("draw.dt",function(){syncSelectCheckboxes(dt)}),updateSelectedRowsText(dt)},DataTable.Api.register("pfSelect.selectAllRows()",function(select){return this.iterator("table",function(ctx){selectAllRows(new DataTable.Api(ctx),select)})}),$(document).on("preInit.dt.dtSelect",function(e,ctx){"dt"===e.namespace&&DataTable.pfSelect.init(new DataTable.Api(ctx))}),DataTable.pfSelect});
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var patternfly = {
5
- version: "3.13.0"
5
+ version: "3.20.0",
6
6
  };
7
7
 
8
8
  // Util: PatternFly Palette colors
@@ -200,6 +200,26 @@
200
200
  legend: this.getDefaultGroupedBarLegend()
201
201
  };
202
202
  },
203
+ getDefaultStackedBarGrid = function () {
204
+ return {
205
+ y: {
206
+ show: true
207
+ }
208
+ };
209
+ },
210
+ getDefaultStackedBarLegend = function () {
211
+ return {
212
+ show: true,
213
+ position: 'bottom'
214
+ };
215
+ },
216
+ getDefaultStackedBarConfig = function () {
217
+ return {
218
+ color: this.getDefaultColors(),
219
+ grid: this.getDefaultStackedBarGrid(),
220
+ legend: this.getDefaultStackedBarLegend()
221
+ };
222
+ },
203
223
  getDefaultDonut = function (title) {
204
224
  return {
205
225
  title: title,
@@ -450,6 +470,9 @@
450
470
  getDefaultGroupedBarGrid: getDefaultGroupedBarGrid,
451
471
  getDefaultGroupedBarLegend: getDefaultGroupedBarLegend,
452
472
  getDefaultGroupedBarConfig: getDefaultGroupedBarConfig,
473
+ getDefaultStackedBarGrid: getDefaultStackedBarGrid,
474
+ getDefaultStackedBarLegend: getDefaultStackedBarLegend,
475
+ getDefaultStackedBarConfig: getDefaultStackedBarConfig,
453
476
  getDefaultDonut: getDefaultDonut,
454
477
  getDefaultDonutSize: getDefaultDonutSize,
455
478
  getDefaultDonutColors: getDefaultDonutColors,
@@ -669,9 +692,9 @@
669
692
  }
670
693
 
671
694
  iNewStart = oSettings._iDisplayLength * (this.value - 1);
672
- if (iNewStart >= oSettings.fnRecordsDisplay()) {
695
+ if (iNewStart >= oSettings.fnRecordsDisplay() || iNewStart < 0) {
673
696
  /* Display overrun */
674
- oSettings._iDisplayStart = (Math.ceil((oSettings.fnRecordsDisplay() - 1) /
697
+ oSettings._iDisplayStart = (Math.ceil(oSettings.fnRecordsDisplay() /
675
698
  oSettings._iDisplayLength) - 1) * oSettings._iDisplayLength;
676
699
  fnDraw(oSettings);
677
700
  return;
@@ -1100,6 +1123,7 @@
1100
1123
  var navElement = $('.nav-pf-vertical'),
1101
1124
  bodyContentElement = $('.container-pf-nav-pf-vertical'),
1102
1125
  toggleNavBarButton = $('.navbar-toggle'),
1126
+ handleResize = true,
1103
1127
  explicitCollapse = false,
1104
1128
  subDesktop = false,
1105
1129
  hoverDelay = 500,
@@ -1136,30 +1160,12 @@
1136
1160
  });
1137
1161
  },
1138
1162
 
1139
- setPrimaryActiveItem = function (item) {
1140
- // Make the clicked on item active
1141
- $(document).find('.nav-pf-vertical > .list-group > .list-group-item.active').each(function (index, element) {
1142
- $(element).removeClass('active');
1143
- });
1144
- item.addClass('active');
1145
- },
1163
+ setActiveItem = function (item) {
1164
+ // remove all .active
1165
+ $('.nav-pf-vertical .list-group-item.active').removeClass('active');
1146
1166
 
1147
- setSecondaryActiveItem = function (item, $primaryParent) {
1148
- $(document).find('.nav-pf-secondary-nav > .list-group > .list-group-item.active').each(function (index, element) {
1149
- $(element).removeClass('active');
1150
- });
1151
- item.addClass('active');
1152
-
1153
- setPrimaryActiveItem($primaryParent);
1154
- },
1155
-
1156
- setTertiaryActiveItem = function (item, $secondaryParent, $primaryParent) {
1157
- $(document).find('.nav-pf-tertiary-nav > .list-group > .list-group-item.active').each(function (index, element) {
1158
- $(element).removeClass('active');
1159
- });
1160
- item.addClass('active');
1161
-
1162
- setSecondaryActiveItem($secondaryParent, $primaryParent);
1167
+ // add .active to item and its parents
1168
+ item.addClass('active').parents('.list-group-item').addClass('active');
1163
1169
  },
1164
1170
 
1165
1171
  updateSecondaryMenuDisplayAfterSelection = function () {
@@ -1238,32 +1244,42 @@
1238
1244
  }
1239
1245
  },
1240
1246
 
1241
- checkNavState = function () {
1242
- var width = $(window).width(), makeSecondaryVisible;
1247
+ enterMobileState = function () {
1248
+ if (!navElement.hasClass('hidden')) {
1249
+ //Set the nav to being hidden
1250
+ navElement.addClass('hidden');
1251
+ navElement.removeClass('collapsed');
1243
1252
 
1244
- // Check to see if we need to enter/exit the mobile state
1245
- if (width < $.pfBreakpoints.tablet) {
1246
- if (!navElement.hasClass('hidden')) {
1247
- //Set the nav to being hidden
1248
- navElement.addClass('hidden');
1249
- navElement.removeClass('collapsed');
1253
+ //Set the body class to the correct state
1254
+ bodyContentElement.removeClass('collapsed-nav');
1255
+ bodyContentElement.addClass('hidden-nav');
1250
1256
 
1251
- //Set the body class to the correct state
1252
- bodyContentElement.removeClass('collapsed-nav');
1253
- bodyContentElement.addClass('hidden-nav');
1257
+ // Reset the collapsed states
1258
+ updateSecondaryCollapsedState(false);
1259
+ updateTertiaryCollapsedState(false);
1254
1260
 
1255
- // Reset the collapsed states
1256
- updateSecondaryCollapsedState(false);
1257
- updateTertiaryCollapsedState(false);
1261
+ explicitCollapse = false;
1262
+ }
1263
+ },
1258
1264
 
1259
- explicitCollapse = false;
1260
- }
1261
- } else if (navElement.hasClass('hidden')) {
1262
- // Always remove the hidden & peek class
1263
- navElement.removeClass('hidden show-mobile-nav');
1265
+ exitMobileState = function () {
1266
+ // Always remove the hidden & peek class
1267
+ navElement.removeClass('hidden show-mobile-nav');
1264
1268
 
1265
- // Set the body class back to the default
1266
- bodyContentElement.removeClass('hidden-nav');
1269
+ // Set the body class back to the default
1270
+ bodyContentElement.removeClass('hidden-nav');
1271
+ },
1272
+
1273
+ checkNavState = function () {
1274
+ var width = $(window).width(), makeSecondaryVisible;
1275
+ if (!handleResize) {
1276
+ return;
1277
+ }
1278
+ // Check to see if we need to enter/exit the mobile state
1279
+ if (width < $.pfBreakpoints.tablet && !explicitCollapse) {
1280
+ enterMobileState();
1281
+ } else if (navElement.hasClass('hidden')) {
1282
+ exitMobileState();
1267
1283
  }
1268
1284
 
1269
1285
  // Check to see if we need to enter/exit the sub desktop state
@@ -1359,43 +1375,45 @@
1359
1375
  },
1360
1376
 
1361
1377
  bindMenuItemsBehavior = function (handleSelection) {
1362
- $(document).find('.nav-pf-vertical > .list-group > .list-group-item').each(function (index, primaryItem) {
1363
- var $primaryItem = $(primaryItem);
1378
+ $(document).find('.nav-pf-vertical .list-group-item').each(function (index, item) {
1379
+ var onClickFn,
1380
+ $item = $(item),
1381
+ $nav = $item.closest('[class*="nav-pf-"]');
1382
+
1383
+ if ($nav.hasClass('nav-pf-vertical')) {
1384
+ // 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
1385
+ onClickFn = function (event) {
1386
+ var $this = $(this), $secondaryItem, $tertiaryItem, $activeItem;
1387
+
1388
+ if (!$this.hasClass('secondary-nav-item-pf')) {
1389
+ hideSecondaryMenu();
1390
+ if (inMobileState()) {
1391
+ updateMobileMenu();
1392
+ navElement.removeClass('show-mobile-nav');
1393
+ }
1394
+ if (handleSelection) {
1395
+ setActiveItem($this);
1396
+ // Don't process the click on the item
1397
+ event.stopImmediatePropagation();
1398
+ }
1399
+ } else if (inMobileState()) {
1400
+ updateMobileMenu($this);
1401
+ } else if (handleSelection) {
1402
+ $activeItem = $secondaryItem = $item.find('.nav-pf-secondary-nav > .list-group > .list-group-item').eq(0);
1364
1403
 
1365
- // 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
1366
- $primaryItem.on('click.pf.secondarynav.data-api', function (event) {
1367
- var $this = $(this), $secondaryItem, tertiaryItem;
1404
+ if ($secondaryItem.hasClass('tertiary-nav-item-pf')) {
1405
+ $activeItem = $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item').eq(0);
1406
+ }
1368
1407
 
1369
- if (!$this.hasClass('secondary-nav-item-pf')) {
1370
- hideSecondaryMenu();
1371
- if (inMobileState()) {
1372
- updateMobileMenu();
1373
- navElement.removeClass('show-mobile-nav');
1374
- }
1375
- if (handleSelection) {
1376
- setPrimaryActiveItem($this);
1377
- // Don't process the click on the item
1408
+ setActiveItem($activeItem);
1378
1409
  event.stopImmediatePropagation();
1379
1410
  }
1380
- } else if (inMobileState()) {
1381
- updateMobileMenu($this);
1382
- } else if (handleSelection) {
1383
- $secondaryItem = $($primaryItem.find('.nav-pf-secondary-nav > .list-group > .list-group-item')[0]);
1384
- if ($secondaryItem.hasClass('tertiary-nav-item-pf')) {
1385
- tertiaryItem = $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item')[0];
1386
- setTertiaryActiveItem($(tertiaryItem), $secondaryItem, $primaryItem);
1387
- } else {
1388
- setSecondaryActiveItem($secondaryItem, $this);
1389
- }
1390
- event.stopImmediatePropagation();
1391
- }
1392
- });
1411
+ };
1393
1412
 
1394
- $primaryItem.find('.nav-pf-secondary-nav > .list-group > .list-group-item').each(function (index, secondaryItem) {
1395
- var $secondaryItem = $(secondaryItem);
1413
+ } else if ($nav.hasClass('nav-pf-secondary-nav')) {
1396
1414
  // 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
1397
- $secondaryItem.on('click.pf.secondarynav.data-api', function (event) {
1398
- var $this = $(this), tertiaryItem;
1415
+ onClickFn = function (event) {
1416
+ var $this = $(this), $tertiaryItem, $primaryItem;
1399
1417
  if (!$this.hasClass('tertiary-nav-item-pf')) {
1400
1418
  if (inMobileState()) {
1401
1419
  updateMobileMenu();
@@ -1403,37 +1421,39 @@
1403
1421
  }
1404
1422
  updateSecondaryMenuDisplayAfterSelection();
1405
1423
  if (handleSelection) {
1406
- setSecondaryActiveItem($secondaryItem, $primaryItem);
1424
+ setActiveItem($item);
1407
1425
  // Don't process the click on the item
1408
1426
  event.stopImmediatePropagation();
1409
1427
  }
1410
1428
  } else if (inMobileState()) {
1429
+ $primaryItem = $item.parents('.list-group-item');
1411
1430
  updateMobileMenu($this, $primaryItem);
1412
1431
  event.stopImmediatePropagation();
1413
1432
  } else if (handleSelection) {
1414
- tertiaryItem = $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item')[0];
1415
- setTertiaryActiveItem($(tertiaryItem), $secondaryItem, $primaryItem);
1433
+ $tertiaryItem = $item.find('.nav-pf-tertiary-nav > .list-group > .list-group-item').eq(0);
1434
+ setActiveItem($tertiaryItem);
1416
1435
  event.stopImmediatePropagation();
1417
1436
  }
1418
- });
1437
+ };
1419
1438
 
1420
- $secondaryItem.find('.nav-pf-tertiary-nav > .list-group > .list-group-item').each(function (index, tertiaryItem) {
1421
- var $tertiaryItem = $(tertiaryItem);
1422
- // Set tertiary nav active item on click
1423
- $tertiaryItem.on('click.pf.secondarynav.data-api', function (event) {
1424
- if (inMobileState()) {
1425
- updateMobileMenu();
1426
- navElement.removeClass('show-mobile-nav');
1427
- }
1428
- updateSecondaryMenuDisplayAfterSelection();
1429
- if (handleSelection) {
1430
- setTertiaryActiveItem($tertiaryItem, $secondaryItem, $primaryItem);
1431
- // Don't process the click on the item
1432
- event.stopImmediatePropagation();
1433
- }
1434
- });
1435
- });
1436
- });
1439
+ } else if ($nav.hasClass('nav-pf-tertiary-nav')) {
1440
+ // Set tertiary nav active item on click
1441
+ onClickFn = function (event) {
1442
+ if (inMobileState()) {
1443
+ updateMobileMenu();
1444
+ navElement.removeClass('show-mobile-nav');
1445
+ }
1446
+ updateSecondaryMenuDisplayAfterSelection();
1447
+ if (handleSelection) {
1448
+ setActiveItem($item);
1449
+ // Don't process the click on the item
1450
+ event.stopImmediatePropagation();
1451
+ }
1452
+ };
1453
+ }
1454
+
1455
+ // register event handler
1456
+ $item.on('click.pf.secondarynav.data-api', onClickFn);
1437
1457
  });
1438
1458
 
1439
1459
  $(document).find('.secondary-nav-item-pf').each(function (index, secondaryItem) {
@@ -1615,15 +1635,31 @@
1615
1635
  navElement.removeClass('hide-nav-pf');
1616
1636
  bodyContentElement.removeClass('hide-nav-pf');
1617
1637
  forceResize(250);
1638
+ },
1639
+ self = {
1640
+ hideMenu: function () {
1641
+ handleResize = false;
1642
+ enterMobileState();
1643
+ },
1644
+ showMenu: function () {
1645
+ handleResize = true;
1646
+ exitMobileState();
1647
+ },
1648
+ isVisible: function () {
1649
+ return handleResize;
1650
+ }
1618
1651
  };
1619
1652
 
1620
- //Listen for the window resize event and collapse/hide as needed
1621
- $(window).on('resize', function () {
1622
- checkNavState();
1623
- enableTransitions();
1624
- });
1653
+ if (!$.fn.setupVerticalNavigation.self) {
1654
+ $.fn.setupVerticalNavigation.self = self;
1655
+ //Listen for the window resize event and collapse/hide as needed
1656
+ $(window).on('resize', function () {
1657
+ checkNavState();
1658
+ enableTransitions();
1659
+ });
1625
1660
 
1626
- init(handleItemSelections);
1661
+ init(handleItemSelections);
1662
+ }
1663
+ return $.fn.setupVerticalNavigation.self;
1627
1664
  };
1628
1665
  }(jQuery));
1629
-