effective_datatables 4.17.3 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,53 @@
2
2
  * ©2011-2017 SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ var jq = require('jquery');
15
+ var cjsRequires = function (root, $) {
16
+ if ( ! $.fn.dataTable ) {
17
+ require('datatables.net')(root, $);
18
+ }
19
+ };
20
+
21
+ if (typeof window === 'undefined') {
22
+ module.exports = function (root, $) {
23
+ if ( ! root ) {
24
+ // CommonJS environments without a window global must pass a
25
+ // root. This will give an error otherwise
26
+ root = window;
27
+ }
28
+
29
+ if ( ! $ ) {
30
+ $ = jq( root );
31
+ }
32
+
33
+ cjsRequires( root, $ );
34
+ return factory( $, root, root.document );
35
+ };
36
+ }
37
+ else {
38
+ cjsRequires( window, jq );
39
+ module.exports = factory( jq, window, window.document );
40
+ }
41
+ }
42
+ else {
43
+ // Browser
44
+ factory( jQuery, window, document );
45
+ }
46
+ }(function( $, window, document, undefined ) {
47
+ 'use strict';
48
+ var DataTable = $.fn.dataTable;
49
+
50
+
51
+
5
52
  /**
6
53
  * DataTables integration for Bootstrap 4. This requires Bootstrap 4 and
7
54
  * DataTables 1.10 or newer.
@@ -10,173 +57,144 @@
10
57
  * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
11
58
  * for further information.
12
59
  */
13
- (function( factory ){
14
- if ( typeof define === 'function' && define.amd ) {
15
- // AMD
16
- define( ['jquery', 'datatables.net'], function ( $ ) {
17
- return factory( $, window, document );
18
- } );
19
- }
20
- else if ( typeof exports === 'object' ) {
21
- // CommonJS
22
- module.exports = function (root, $) {
23
- if ( ! root ) {
24
- root = window;
25
- }
26
-
27
- if ( ! $ || ! $.fn.dataTable ) {
28
- // Require DataTables, which attaches to jQuery, including
29
- // jQuery if needed and have a $ property so we can access the
30
- // jQuery object that is used
31
- $ = require('datatables.net')(root, $).$;
32
- }
33
-
34
- return factory( $, root, root.document );
35
- };
36
- }
37
- else {
38
- // Browser
39
- factory( jQuery, window, document );
40
- }
41
- }(function( $, window, document, undefined ) {
42
- 'use strict';
43
- var DataTable = $.fn.dataTable;
44
-
45
60
 
46
61
  /* Set the defaults for DataTables initialisation */
47
62
  $.extend( true, DataTable.defaults, {
48
- dom:
49
- "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" +
50
- "<'row'<'col-sm-12'tr>>" +
51
- "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
52
- renderer: 'bootstrap'
63
+ dom:
64
+ "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" +
65
+ "<'row'<'col-sm-12'tr>>" +
66
+ "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
67
+ renderer: 'bootstrap'
53
68
  } );
54
69
 
55
70
 
56
71
  /* Default class modification */
57
72
  $.extend( DataTable.ext.classes, {
58
- sWrapper: "dataTables_wrapper dt-bootstrap4",
59
- sFilterInput: "form-control form-control-sm",
60
- sLengthSelect: "custom-select custom-select-sm form-control form-control-sm",
61
- sProcessing: "dataTables_processing card",
62
- sPageButton: "paginate_button page-item"
73
+ sWrapper: "dataTables_wrapper dt-bootstrap4",
74
+ sFilterInput: "form-control form-control-sm",
75
+ sLengthSelect: "custom-select custom-select-sm form-control form-control-sm",
76
+ sProcessing: "dataTables_processing card",
77
+ sPageButton: "paginate_button page-item"
63
78
  } );
64
79
 
65
80
 
66
81
  /* Bootstrap paging button renderer */
67
82
  DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
68
- var api = new DataTable.Api( settings );
69
- var classes = settings.oClasses;
70
- var lang = settings.oLanguage.oPaginate;
71
- var aria = settings.oLanguage.oAria.paginate || {};
72
- var btnDisplay, btnClass, counter=0;
73
-
74
- var attach = function( container, buttons ) {
75
- var i, ien, node, button;
76
- var clickHandler = function ( e ) {
77
- e.preventDefault();
78
- if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
79
- api.page( e.data.action ).draw( 'page' );
80
- }
81
- };
82
-
83
- for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
84
- button = buttons[i];
85
-
86
- if ( $.isArray( button ) ) {
87
- attach( container, button );
88
- }
89
- else {
90
- btnDisplay = '';
91
- btnClass = '';
92
-
93
- switch ( button ) {
94
- case 'ellipsis':
95
- btnDisplay = '&#x2026;';
96
- btnClass = 'disabled';
97
- break;
98
-
99
- case 'first':
100
- btnDisplay = lang.sFirst;
101
- btnClass = button + (page > 0 ?
102
- '' : ' disabled');
103
- break;
104
-
105
- case 'previous':
106
- btnDisplay = lang.sPrevious;
107
- btnClass = button + (page > 0 ?
108
- '' : ' disabled');
109
- break;
110
-
111
- case 'next':
112
- btnDisplay = lang.sNext;
113
- btnClass = button + (page < pages-1 ?
114
- '' : ' disabled');
115
- break;
116
-
117
- case 'last':
118
- btnDisplay = lang.sLast;
119
- btnClass = button + (page < pages-1 ?
120
- '' : ' disabled');
121
- break;
122
-
123
- default:
124
- btnDisplay = button + 1;
125
- btnClass = page === button ?
126
- 'active' : '';
127
- break;
128
- }
129
-
130
- if ( btnDisplay ) {
131
- node = $('<li>', {
132
- 'class': classes.sPageButton+' '+btnClass,
133
- 'id': idx === 0 && typeof button === 'string' ?
134
- settings.sTableId +'_'+ button :
135
- null
136
- } )
137
- .append( $('<a>', {
138
- 'href': '#',
139
- 'aria-controls': settings.sTableId,
140
- 'aria-label': aria[ button ],
141
- 'data-dt-idx': counter,
142
- 'tabindex': settings.iTabIndex,
143
- 'class': 'page-link'
144
- } )
145
- .html( btnDisplay )
146
- )
147
- .appendTo( container );
148
-
149
- settings.oApi._fnBindAction(
150
- node, {action: button}, clickHandler
151
- );
152
-
153
- counter++;
154
- }
155
- }
156
- }
157
- };
158
-
159
- // IE9 throws an 'unknown error' if document.activeElement is used
160
- // inside an iframe or frame.
161
- var activeEl;
162
-
163
- try {
164
- // Because this approach is destroying and recreating the paging
165
- // elements, focus is lost on the select button which is bad for
166
- // accessibility. So we want to restore focus once the draw has
167
- // completed
168
- activeEl = $(host).find(document.activeElement).data('dt-idx');
169
- }
170
- catch (e) {}
171
-
172
- attach(
173
- $(host).empty().html('<ul class="pagination"/>').children('ul'),
174
- buttons
175
- );
176
-
177
- if ( activeEl !== undefined ) {
178
- $(host).find( '[data-dt-idx='+activeEl+']' ).focus();
179
- }
83
+ var api = new DataTable.Api( settings );
84
+ var classes = settings.oClasses;
85
+ var lang = settings.oLanguage.oPaginate;
86
+ var aria = settings.oLanguage.oAria.paginate || {};
87
+ var btnDisplay, btnClass;
88
+
89
+ var attach = function( container, buttons ) {
90
+ var i, ien, node, button;
91
+ var clickHandler = function ( e ) {
92
+ e.preventDefault();
93
+ if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) {
94
+ api.page( e.data.action ).draw( 'page' );
95
+ }
96
+ };
97
+
98
+ for ( i=0, ien=buttons.length ; i<ien ; i++ ) {
99
+ button = buttons[i];
100
+
101
+ if ( Array.isArray( button ) ) {
102
+ attach( container, button );
103
+ }
104
+ else {
105
+ btnDisplay = '';
106
+ btnClass = '';
107
+
108
+ switch ( button ) {
109
+ case 'ellipsis':
110
+ btnDisplay = '&#x2026;';
111
+ btnClass = 'disabled';
112
+ break;
113
+
114
+ case 'first':
115
+ btnDisplay = lang.sFirst;
116
+ btnClass = button + (page > 0 ?
117
+ '' : ' disabled');
118
+ break;
119
+
120
+ case 'previous':
121
+ btnDisplay = lang.sPrevious;
122
+ btnClass = button + (page > 0 ?
123
+ '' : ' disabled');
124
+ break;
125
+
126
+ case 'next':
127
+ btnDisplay = lang.sNext;
128
+ btnClass = button + (page < pages-1 ?
129
+ '' : ' disabled');
130
+ break;
131
+
132
+ case 'last':
133
+ btnDisplay = lang.sLast;
134
+ btnClass = button + (page < pages-1 ?
135
+ '' : ' disabled');
136
+ break;
137
+
138
+ default:
139
+ btnDisplay = button + 1;
140
+ btnClass = page === button ?
141
+ 'active' : '';
142
+ break;
143
+ }
144
+
145
+ if ( btnDisplay ) {
146
+ var disabled = btnClass.indexOf('disabled') !== -1;
147
+
148
+ node = $('<li>', {
149
+ 'class': classes.sPageButton+' '+btnClass,
150
+ 'id': idx === 0 && typeof button === 'string' ?
151
+ settings.sTableId +'_'+ button :
152
+ null
153
+ } )
154
+ .append( $('<a>', {
155
+ 'href': disabled ? null : '#',
156
+ 'aria-controls': settings.sTableId,
157
+ 'aria-disabled': disabled ? 'true' : null,
158
+ 'aria-label': aria[ button ],
159
+ 'role': 'link',
160
+ 'aria-current': btnClass === 'active' ? 'page' : null,
161
+ 'data-dt-idx': button,
162
+ 'tabindex': disabled ? -1 : settings.iTabIndex,
163
+ 'class': 'page-link'
164
+ } )
165
+ .html( btnDisplay )
166
+ )
167
+ .appendTo( container );
168
+
169
+ settings.oApi._fnBindAction(
170
+ node, {action: button}, clickHandler
171
+ );
172
+ }
173
+ }
174
+ }
175
+ };
176
+
177
+ // IE9 throws an 'unknown error' if document.activeElement is used
178
+ // inside an iframe or frame.
179
+ var activeEl;
180
+
181
+ try {
182
+ // Because this approach is destroying and recreating the paging
183
+ // elements, focus is lost on the select button which is bad for
184
+ // accessibility. So we want to restore focus once the draw has
185
+ // completed
186
+ activeEl = $(host).find(document.activeElement).data('dt-idx');
187
+ }
188
+ catch (e) {}
189
+
190
+ attach(
191
+ $(host).empty().html('<ul class="pagination"/>').children('ul'),
192
+ buttons
193
+ );
194
+
195
+ if ( activeEl !== undefined ) {
196
+ $(host).find( '[data-dt-idx='+activeEl+']' ).trigger('focus');
197
+ }
180
198
  };
181
199
 
182
200