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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b8b128f779a12a5f4bf7618a4c62ba9177a7c6da54b875b1fb74713a2ae1b7
|
4
|
+
data.tar.gz: 654dd180969300fbb4f0d9c61e0f81c47bc24e577d615585d2ca7c9194fca864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cec0f5d9a28e18853014d058818dd16c6c8c668269c6cc970ebd3ac17928a591cb0c2d49b6bbd962f473e6f68f69739c642f936ede01d3a79fd356e03db7ccff
|
7
|
+
data.tar.gz: c65bbcfaae3d8efb553bd2a548fa1b3f843ac44eefd2ed6171e488d8740eb6d368676414ee1747ed7bb4a81050b1c36e38253da5710502ad3a1780924fa67981
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Upgrade
|
2
|
+
|
3
|
+
To upgrade the datatables.net source code:
|
4
|
+
|
5
|
+
Visit https://datatables.net/download/
|
6
|
+
|
7
|
+
Step 1: Choose Bootstrap4
|
8
|
+
Step 2:
|
9
|
+
Packages: Just DataTables
|
10
|
+
Extensions: Buttons, Column visibility, HTML5 export, Print view, Responsive, RowReorder
|
11
|
+
Step 3: Download do not minify or concatenate
|
12
|
+
Step 4: Replace existing javascript and css with downloaded
|
13
|
+
|
14
|
+
After replacing the existing JS/CSS:
|
15
|
+
|
16
|
+
- Consider the buttons.colVis.js and add back the custom sorted functionality
|
17
|
+
- Consider the stylesheets/effective_datatables/overrides.bootstrap4.scss
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*! Bootstrap integration for DataTables' Buttons
|
2
|
-
* ©
|
2
|
+
* © SpryMedia Ltd - datatables.net/license
|
3
3
|
*/
|
4
4
|
|
5
5
|
(function( factory ){
|
@@ -11,21 +11,37 @@
|
|
11
11
|
}
|
12
12
|
else if ( typeof exports === 'object' ) {
|
13
13
|
// CommonJS
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
if ( ! $ || ! $.fn.dataTable ) {
|
20
|
-
$ = require('datatables.net-bs4')(root, $).$;
|
14
|
+
var jq = require('jquery');
|
15
|
+
var cjsRequires = function (root, $) {
|
16
|
+
if ( ! $.fn.dataTable ) {
|
17
|
+
require('datatables.net-bs4')(root, $);
|
21
18
|
}
|
22
19
|
|
23
20
|
if ( ! $.fn.dataTable.Buttons ) {
|
24
21
|
require('datatables.net-buttons')(root, $);
|
25
22
|
}
|
26
|
-
|
27
|
-
return factory( $, root, root.document );
|
28
23
|
};
|
24
|
+
|
25
|
+
if (typeof window === 'undefined') {
|
26
|
+
module.exports = function (root, $) {
|
27
|
+
if ( ! root ) {
|
28
|
+
// CommonJS environments without a window global must pass a
|
29
|
+
// root. This will give an error otherwise
|
30
|
+
root = window;
|
31
|
+
}
|
32
|
+
|
33
|
+
if ( ! $ ) {
|
34
|
+
$ = jq( root );
|
35
|
+
}
|
36
|
+
|
37
|
+
cjsRequires( root, $ );
|
38
|
+
return factory( $, root, root.document );
|
39
|
+
};
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
cjsRequires( window, jq );
|
43
|
+
module.exports = factory( jq, window, window.document );
|
44
|
+
}
|
29
45
|
}
|
30
46
|
else {
|
31
47
|
// Browser
|
@@ -35,29 +51,67 @@
|
|
35
51
|
'use strict';
|
36
52
|
var DataTable = $.fn.dataTable;
|
37
53
|
|
38
|
-
|
54
|
+
|
55
|
+
|
56
|
+
$.extend(true, DataTable.Buttons.defaults, {
|
39
57
|
dom: {
|
40
58
|
container: {
|
41
|
-
className: 'dt-buttons btn-group'
|
59
|
+
className: 'dt-buttons btn-group flex-wrap'
|
42
60
|
},
|
43
61
|
button: {
|
44
|
-
className: 'btn btn-secondary'
|
62
|
+
className: 'btn btn-secondary',
|
63
|
+
active: 'active'
|
45
64
|
},
|
46
65
|
collection: {
|
47
|
-
|
48
|
-
|
66
|
+
action: {
|
67
|
+
dropHtml: ''
|
68
|
+
},
|
69
|
+
container: {
|
70
|
+
tag: 'div',
|
71
|
+
className: 'dropdown-menu dt-button-collection'
|
72
|
+
},
|
73
|
+
closeButton: false,
|
49
74
|
button: {
|
50
75
|
tag: 'a',
|
51
76
|
className: 'dt-button dropdown-item',
|
52
|
-
active: 'active',
|
53
|
-
disabled: 'disabled'
|
77
|
+
active: 'dt-button-active',
|
78
|
+
disabled: 'disabled',
|
79
|
+
spacer: {
|
80
|
+
className: 'dropdown-divider',
|
81
|
+
tag: 'hr'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
},
|
85
|
+
split: {
|
86
|
+
action: {
|
87
|
+
tag: 'a',
|
88
|
+
className: 'btn btn-secondary dt-button-split-drop-button',
|
89
|
+
closeButton: false
|
90
|
+
},
|
91
|
+
dropdown: {
|
92
|
+
tag: 'button',
|
93
|
+
dropHtml: '',
|
94
|
+
className:
|
95
|
+
'btn btn-secondary dt-button-split-drop dropdown-toggle dropdown-toggle-split',
|
96
|
+
closeButton: false,
|
97
|
+
align: 'split-left',
|
98
|
+
splitAlignClass: 'dt-button-split-left'
|
99
|
+
},
|
100
|
+
wrapper: {
|
101
|
+
tag: 'div',
|
102
|
+
className: 'dt-button-split btn-group',
|
103
|
+
closeButton: false
|
54
104
|
}
|
55
105
|
}
|
106
|
+
},
|
107
|
+
buttonCreated: function (config, button) {
|
108
|
+
return config.buttons ? $('<div class="btn-group"/>').append(button) : button;
|
56
109
|
}
|
57
|
-
}
|
110
|
+
});
|
58
111
|
|
59
112
|
DataTable.ext.buttons.collection.className += ' dropdown-toggle';
|
60
113
|
DataTable.ext.buttons.collection.rightAlignClassName = 'dropdown-menu-right';
|
61
114
|
|
62
|
-
|
115
|
+
|
116
|
+
return DataTable;
|
63
117
|
}));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
* Column visibility buttons for Buttons and DataTables.
|
3
|
-
*
|
3
|
+
* © SpryMedia Ltd - datatables.net/license
|
4
4
|
*/
|
5
5
|
|
6
6
|
(function( factory ){
|
@@ -12,21 +12,37 @@
|
|
12
12
|
}
|
13
13
|
else if ( typeof exports === 'object' ) {
|
14
14
|
// CommonJS
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if ( ! $ || ! $.fn.dataTable ) {
|
21
|
-
$ = require('datatables.net')(root, $).$;
|
15
|
+
var jq = require('jquery');
|
16
|
+
var cjsRequires = function (root, $) {
|
17
|
+
if ( ! $.fn.dataTable ) {
|
18
|
+
require('datatables.net')(root, $);
|
22
19
|
}
|
23
20
|
|
24
21
|
if ( ! $.fn.dataTable.Buttons ) {
|
25
22
|
require('datatables.net-buttons')(root, $);
|
26
23
|
}
|
27
|
-
|
28
|
-
return factory( $, root, root.document );
|
29
24
|
};
|
25
|
+
|
26
|
+
if (typeof window === 'undefined') {
|
27
|
+
module.exports = function (root, $) {
|
28
|
+
if ( ! root ) {
|
29
|
+
// CommonJS environments without a window global must pass a
|
30
|
+
// root. This will give an error otherwise
|
31
|
+
root = window;
|
32
|
+
}
|
33
|
+
|
34
|
+
if ( ! $ ) {
|
35
|
+
$ = jq( root );
|
36
|
+
}
|
37
|
+
|
38
|
+
cjsRequires( root, $ );
|
39
|
+
return factory( $, root, root.document );
|
40
|
+
};
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
cjsRequires( window, jq );
|
44
|
+
module.exports = factory( jq, window, window.document );
|
45
|
+
}
|
30
46
|
}
|
31
47
|
else {
|
32
48
|
// Browser
|
@@ -37,44 +53,68 @@
|
|
37
53
|
var DataTable = $.fn.dataTable;
|
38
54
|
|
39
55
|
|
40
|
-
|
56
|
+
|
57
|
+
$.extend(DataTable.ext.buttons, {
|
41
58
|
// A collection of column visibility buttons
|
42
|
-
colvis: function (
|
43
|
-
|
59
|
+
colvis: function (dt, conf) {
|
60
|
+
var node = null;
|
61
|
+
var buttonConf = {
|
44
62
|
extend: 'collection',
|
45
|
-
|
46
|
-
|
63
|
+
init: function (dt, n) {
|
64
|
+
node = n;
|
65
|
+
},
|
66
|
+
text: function (dt) {
|
67
|
+
return dt.i18n('buttons.colvis', 'Column visibility');
|
47
68
|
},
|
48
69
|
className: 'buttons-colvis',
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
70
|
+
closeButton: false,
|
71
|
+
buttons: [
|
72
|
+
{
|
73
|
+
extend: 'columnsToggle',
|
74
|
+
columns: conf.columns,
|
75
|
+
columnText: conf.columnText
|
76
|
+
}
|
77
|
+
]
|
54
78
|
};
|
79
|
+
|
80
|
+
// Rebuild the collection with the new column structure if columns are reordered
|
81
|
+
dt.on('column-reorder.dt' + conf.namespace, function (e, settings, details) {
|
82
|
+
dt.button(null, dt.button(null, node).node()).collectionRebuild([
|
83
|
+
{
|
84
|
+
extend: 'columnsToggle',
|
85
|
+
columns: conf.columns,
|
86
|
+
columnText: conf.columnText
|
87
|
+
}
|
88
|
+
]);
|
89
|
+
});
|
90
|
+
|
91
|
+
return buttonConf;
|
55
92
|
},
|
56
93
|
|
57
94
|
// Selected columns with individual buttons - toggle column visibility
|
58
|
-
columnsToggle: function (
|
59
|
-
var columns = dt
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
95
|
+
columnsToggle: function (dt, conf) {
|
96
|
+
var columns = dt
|
97
|
+
.columns(conf.columns)
|
98
|
+
.indexes()
|
99
|
+
.map(function (idx) {
|
100
|
+
return {
|
101
|
+
extend: 'columnToggle',
|
102
|
+
columns: idx,
|
103
|
+
columnText: conf.columnText
|
104
|
+
};
|
105
|
+
})
|
106
|
+
|
107
|
+
var sorted = columns.sort(function (a, b) {
|
108
|
+
var a = dt.settings()[0].aoColumns[a.columns].sTitle;
|
109
|
+
var b = dt.settings()[0].aoColumns[b.columns].sTitle;
|
110
|
+
return a.localeCompare(b)
|
111
|
+
}).toArray();
|
112
|
+
|
113
|
+
return sorted;
|
74
114
|
},
|
75
115
|
|
76
116
|
// Single button to toggle column visibility
|
77
|
-
columnToggle: function (
|
117
|
+
columnToggle: function (dt, conf) {
|
78
118
|
return {
|
79
119
|
extend: 'columnVisibility',
|
80
120
|
columns: conf.columns,
|
@@ -83,15 +123,19 @@ $.extend( DataTable.ext.buttons, {
|
|
83
123
|
},
|
84
124
|
|
85
125
|
// Selected columns with individual buttons - set column visibility
|
86
|
-
columnsVisibility: function (
|
87
|
-
var columns = dt
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
126
|
+
columnsVisibility: function (dt, conf) {
|
127
|
+
var columns = dt
|
128
|
+
.columns(conf.columns)
|
129
|
+
.indexes()
|
130
|
+
.map(function (idx) {
|
131
|
+
return {
|
132
|
+
extend: 'columnVisibility',
|
133
|
+
columns: idx,
|
134
|
+
visibility: conf.visibility,
|
135
|
+
columnText: conf.columnText
|
136
|
+
};
|
137
|
+
})
|
138
|
+
.toArray();
|
95
139
|
|
96
140
|
return columns;
|
97
141
|
},
|
@@ -99,111 +143,113 @@ $.extend( DataTable.ext.buttons, {
|
|
99
143
|
// Single button to set column visibility
|
100
144
|
columnVisibility: {
|
101
145
|
columns: undefined, // column selector
|
102
|
-
text: function (
|
103
|
-
return conf._columnText(
|
146
|
+
text: function (dt, button, conf) {
|
147
|
+
return conf._columnText(dt, conf);
|
104
148
|
},
|
105
149
|
className: 'buttons-columnVisibility',
|
106
|
-
action: function (
|
107
|
-
var col = dt.columns(
|
150
|
+
action: function (e, dt, button, conf) {
|
151
|
+
var col = dt.columns(conf.columns);
|
108
152
|
var curr = col.visible();
|
109
153
|
|
110
|
-
col.visible(
|
111
|
-
conf.visibility :
|
112
|
-
! (curr.length ? curr[0] : false )
|
154
|
+
col.visible(
|
155
|
+
conf.visibility !== undefined ? conf.visibility : !(curr.length ? curr[0] : false)
|
113
156
|
);
|
114
157
|
},
|
115
|
-
init: function (
|
158
|
+
init: function (dt, button, conf) {
|
116
159
|
var that = this;
|
117
|
-
button.attr(
|
118
|
-
|
119
|
-
dt
|
120
|
-
.
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
.appendTo(button.parent());
|
143
|
-
} );
|
144
|
-
|
145
|
-
this.active( dt.column( conf.columns ).visible() );
|
160
|
+
button.attr('data-cv-idx', conf.columns);
|
161
|
+
|
162
|
+
dt.on('column-visibility.dt' + conf.namespace, function (e, settings) {
|
163
|
+
if (!settings.bDestroying && settings.nTable == dt.settings()[0].nTable) {
|
164
|
+
that.active(dt.column(conf.columns).visible());
|
165
|
+
}
|
166
|
+
}).on('column-reorder.dt' + conf.namespace, function (e, settings, details) {
|
167
|
+
// Button has been removed from the DOM
|
168
|
+
if (conf.destroying) {
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
172
|
+
if (dt.columns(conf.columns).count() !== 1) {
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
// This button controls the same column index but the text for the column has
|
177
|
+
// changed
|
178
|
+
that.text(conf._columnText(dt, conf));
|
179
|
+
|
180
|
+
// Since its a different column, we need to check its visibility
|
181
|
+
that.active(dt.column(conf.columns).visible());
|
182
|
+
});
|
183
|
+
|
184
|
+
this.active(dt.column(conf.columns).visible());
|
146
185
|
},
|
147
|
-
destroy: function (
|
148
|
-
dt
|
149
|
-
|
150
|
-
|
186
|
+
destroy: function (dt, button, conf) {
|
187
|
+
dt.off('column-visibility.dt' + conf.namespace).off(
|
188
|
+
'column-reorder.dt' + conf.namespace
|
189
|
+
);
|
151
190
|
},
|
152
191
|
|
153
|
-
_columnText: function (
|
192
|
+
_columnText: function (dt, conf) {
|
154
193
|
// Use DataTables' internal data structure until this is presented
|
155
194
|
// is a public API. The other option is to use
|
156
195
|
// `$( column(col).node() ).text()` but the node might not have been
|
157
196
|
// populated when Buttons is constructed.
|
158
|
-
var idx = dt.column(
|
159
|
-
var title = dt.settings()[0].aoColumns[
|
160
|
-
|
161
|
-
|
162
|
-
.
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
197
|
+
var idx = dt.column(conf.columns).index();
|
198
|
+
var title = dt.settings()[0].aoColumns[idx].sTitle;
|
199
|
+
|
200
|
+
if (!title) {
|
201
|
+
title = dt.column(idx).header().innerHTML;
|
202
|
+
}
|
203
|
+
|
204
|
+
title = title
|
205
|
+
.replace(/\n/g, ' ') // remove new lines
|
206
|
+
.replace(/<br\s*\/?>/gi, ' ') // replace line breaks with spaces
|
207
|
+
.replace(/<select(.*?)<\/select>/g, '') // remove select tags, including options text
|
208
|
+
.replace(/<!\-\-.*?\-\->/g, '') // strip HTML comments
|
209
|
+
.replace(/<.*?>/g, '') // strip HTML
|
210
|
+
.replace(/^\s+|\s+$/g, ''); // trim
|
211
|
+
|
212
|
+
return conf.columnText ? conf.columnText(dt, idx, title) : title;
|
170
213
|
}
|
171
214
|
},
|
172
215
|
|
173
|
-
|
174
216
|
colvisRestore: {
|
175
217
|
className: 'buttons-colvisRestore',
|
176
218
|
|
177
|
-
text: function (
|
178
|
-
return dt.i18n(
|
219
|
+
text: function (dt) {
|
220
|
+
return dt.i18n('buttons.colvisRestore', 'Restore visibility');
|
179
221
|
},
|
180
222
|
|
181
|
-
init: function (
|
182
|
-
conf._visOriginal = dt
|
183
|
-
|
184
|
-
|
223
|
+
init: function (dt, button, conf) {
|
224
|
+
conf._visOriginal = dt
|
225
|
+
.columns()
|
226
|
+
.indexes()
|
227
|
+
.map(function (idx) {
|
228
|
+
return dt.column(idx).visible();
|
229
|
+
})
|
230
|
+
.toArray();
|
185
231
|
},
|
186
232
|
|
187
|
-
action: function (
|
188
|
-
dt.columns().every(
|
233
|
+
action: function (e, dt, button, conf) {
|
234
|
+
dt.columns().every(function (i) {
|
189
235
|
// Take into account that ColReorder might have disrupted our
|
190
236
|
// indexes
|
191
|
-
var idx =
|
192
|
-
dt.colReorder.transpose
|
193
|
-
|
237
|
+
var idx =
|
238
|
+
dt.colReorder && dt.colReorder.transpose
|
239
|
+
? dt.colReorder.transpose(i, 'toOriginal')
|
240
|
+
: i;
|
194
241
|
|
195
|
-
this.visible(
|
196
|
-
}
|
242
|
+
this.visible(conf._visOriginal[idx]);
|
243
|
+
});
|
197
244
|
}
|
198
245
|
},
|
199
246
|
|
200
|
-
|
201
247
|
colvisGroup: {
|
202
248
|
className: 'buttons-colvisGroup',
|
203
249
|
|
204
|
-
action: function (
|
205
|
-
dt.columns(
|
206
|
-
dt.columns(
|
250
|
+
action: function (e, dt, button, conf) {
|
251
|
+
dt.columns(conf.show).visible(true, false);
|
252
|
+
dt.columns(conf.hide).visible(false, false);
|
207
253
|
|
208
254
|
dt.columns.adjust();
|
209
255
|
},
|
@@ -212,8 +258,8 @@ $.extend( DataTable.ext.buttons, {
|
|
212
258
|
|
213
259
|
hide: []
|
214
260
|
}
|
215
|
-
}
|
261
|
+
});
|
216
262
|
|
217
263
|
|
218
|
-
return DataTable
|
264
|
+
return DataTable;
|
219
265
|
}));
|