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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/dataTables/UPGRADE.md +17 -0
- data/app/assets/javascripts/dataTables/buttons/buttons.bootstrap4.js +73 -19
- data/app/assets/javascripts/dataTables/buttons/buttons.colVis.js +166 -120
- data/app/assets/javascripts/dataTables/buttons/buttons.html5.js +749 -667
- data/app/assets/javascripts/dataTables/buttons/buttons.print.js +96 -64
- data/app/assets/javascripts/dataTables/buttons/dataTables.buttons.js +1568 -909
- data/app/assets/javascripts/dataTables/dataTables.bootstrap4.js +172 -154
- data/app/assets/javascripts/dataTables/jquery.dataTables.js +3119 -2704
- data/app/assets/javascripts/dataTables/responsive/dataTables.responsive.js +707 -531
- data/app/assets/javascripts/dataTables/responsive/responsive.bootstrap4.js +61 -33
- data/app/assets/javascripts/dataTables/rowReorder/dataTables.rowReorder.js +961 -740
- data/app/assets/javascripts/dataTables/rowReorder/rowReorder.bootstrap4.js +50 -30
- data/app/assets/stylesheets/dataTables/buttons/buttons.bootstrap4.scss +178 -151
- data/app/assets/stylesheets/dataTables/dataTables.bootstrap4.scss +300 -81
- data/app/assets/stylesheets/dataTables/responsive/responsive.bootstrap4.scss +54 -71
- data/app/assets/stylesheets/dataTables/rowReorder/rowReorder.bootstrap4.scss +23 -4
- data/app/assets/stylesheets/effective_datatables/_overrides.bootstrap4.scss +81 -39
- data/app/models/effective/datatable.rb +8 -2
- data/lib/effective_datatables/version.rb +1 -1
- metadata +3 -2
@@ -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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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 = '…';
|
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
|
|