datatables.net 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/dataTables.js +53 -25
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +53 -25
- package/package.json +1 -1
- package/types/types.d.ts +5 -0
package/js/dataTables.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables 2.3.
|
|
1
|
+
/*! DataTables 2.3.7
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -139,7 +139,7 @@ var DataTable = function ( selector, options )
|
|
|
139
139
|
"sDestroyWidth": $this[0].style.width,
|
|
140
140
|
"sInstance": sId,
|
|
141
141
|
"sTableId": sId,
|
|
142
|
-
colgroup: $('<colgroup>')
|
|
142
|
+
colgroup: $('<colgroup>'),
|
|
143
143
|
fastData: function (row, column, type) {
|
|
144
144
|
return _fnGetCellData(oSettings, row, column, type);
|
|
145
145
|
}
|
|
@@ -212,6 +212,7 @@ var DataTable = function ( selector, options )
|
|
|
212
212
|
"orderHandler",
|
|
213
213
|
"titleRow",
|
|
214
214
|
"typeDetect",
|
|
215
|
+
"columnTitleTag",
|
|
215
216
|
[ "iCookieDuration", "iStateDuration" ], // backwards compat
|
|
216
217
|
[ "oSearch", "oPreviousSearch" ],
|
|
217
218
|
[ "aoSearchCols", "aoPreSearchCols" ],
|
|
@@ -376,7 +377,7 @@ var DataTable = function ( selector, options )
|
|
|
376
377
|
|
|
377
378
|
if ( oSettings.caption ) {
|
|
378
379
|
if ( caption.length === 0 ) {
|
|
379
|
-
caption = $('<caption/>').
|
|
380
|
+
caption = $('<caption/>').prependTo( $this );
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
caption.html( oSettings.caption );
|
|
@@ -389,6 +390,14 @@ var DataTable = function ( selector, options )
|
|
|
389
390
|
oSettings.captionNode = caption[0];
|
|
390
391
|
}
|
|
391
392
|
|
|
393
|
+
// Place the colgroup element in the correct location for the HTML structure
|
|
394
|
+
if (caption.length) {
|
|
395
|
+
oSettings.colgroup.insertAfter(caption);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
oSettings.colgroup.prependTo(oSettings.nTable);
|
|
399
|
+
}
|
|
400
|
+
|
|
392
401
|
if ( thead.length === 0 ) {
|
|
393
402
|
thead = $('<thead/>').appendTo($this);
|
|
394
403
|
}
|
|
@@ -1245,7 +1254,7 @@ var _removeEmpty = function ( a )
|
|
|
1245
1254
|
};
|
|
1246
1255
|
|
|
1247
1256
|
// Replaceable function in api.util
|
|
1248
|
-
var _stripHtml = function (input) {
|
|
1257
|
+
var _stripHtml = function (input, replacement) {
|
|
1249
1258
|
if (! input || typeof input !== 'string') {
|
|
1250
1259
|
return input;
|
|
1251
1260
|
}
|
|
@@ -1257,7 +1266,7 @@ var _stripHtml = function (input) {
|
|
|
1257
1266
|
|
|
1258
1267
|
var previous;
|
|
1259
1268
|
|
|
1260
|
-
input = input.replace(_re_html, ''); // Complete tags
|
|
1269
|
+
input = input.replace(_re_html, replacement || ''); // Complete tags
|
|
1261
1270
|
|
|
1262
1271
|
// Safety for incomplete script tag - use do / while to ensure that
|
|
1263
1272
|
// we get all instances
|
|
@@ -1722,7 +1731,7 @@ DataTable.util = {
|
|
|
1722
1731
|
}
|
|
1723
1732
|
},
|
|
1724
1733
|
|
|
1725
|
-
stripHtml: function (mixed) {
|
|
1734
|
+
stripHtml: function (mixed, replacement) {
|
|
1726
1735
|
var type = typeof mixed;
|
|
1727
1736
|
|
|
1728
1737
|
if (type === 'function') {
|
|
@@ -1730,7 +1739,7 @@ DataTable.util = {
|
|
|
1730
1739
|
return;
|
|
1731
1740
|
}
|
|
1732
1741
|
else if (type === 'string') {
|
|
1733
|
-
return _stripHtml(mixed);
|
|
1742
|
+
return _stripHtml(mixed, replacement);
|
|
1734
1743
|
}
|
|
1735
1744
|
return mixed;
|
|
1736
1745
|
},
|
|
@@ -3332,7 +3341,7 @@ function _fnHeaderLayout( settings, source, incColumns )
|
|
|
3332
3341
|
colspan++;
|
|
3333
3342
|
}
|
|
3334
3343
|
|
|
3335
|
-
var titleSpan = $('
|
|
3344
|
+
var titleSpan = $('.dt-column-title', cell);
|
|
3336
3345
|
|
|
3337
3346
|
structure[row][column] = {
|
|
3338
3347
|
cell: cell,
|
|
@@ -4046,8 +4055,8 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4046
4055
|
}
|
|
4047
4056
|
|
|
4048
4057
|
// Wrap the column title so we can write to it in future
|
|
4049
|
-
if ( $('
|
|
4050
|
-
$(
|
|
4058
|
+
if ( $('.dt-column-title', cell).length === 0) {
|
|
4059
|
+
$(document.createElement(settings.columnTitleTag))
|
|
4051
4060
|
.addClass('dt-column-title')
|
|
4052
4061
|
.append(cell.childNodes)
|
|
4053
4062
|
.appendTo(cell);
|
|
@@ -4058,9 +4067,9 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4058
4067
|
isHeader &&
|
|
4059
4068
|
jqCell.filter(':not([data-dt-order=disable])').length !== 0 &&
|
|
4060
4069
|
jqCell.parent(':not([data-dt-order=disable])').length !== 0 &&
|
|
4061
|
-
$('
|
|
4070
|
+
$('.dt-column-order', cell).length === 0
|
|
4062
4071
|
) {
|
|
4063
|
-
$(
|
|
4072
|
+
$(document.createElement(settings.columnTitleTag))
|
|
4064
4073
|
.addClass('dt-column-order')
|
|
4065
4074
|
.appendTo(cell);
|
|
4066
4075
|
}
|
|
@@ -4069,7 +4078,7 @@ function _fnDetectHeader ( settings, thead, write )
|
|
|
4069
4078
|
// layout for those elements
|
|
4070
4079
|
var headerFooter = isHeader ? 'header' : 'footer';
|
|
4071
4080
|
|
|
4072
|
-
if ( $('
|
|
4081
|
+
if ( $('div.dt-column-' + headerFooter, cell).length === 0) {
|
|
4073
4082
|
$('<div>')
|
|
4074
4083
|
.addClass('dt-column-' + headerFooter)
|
|
4075
4084
|
.append(cell.childNodes)
|
|
@@ -4226,6 +4235,10 @@ function _fnBuildAjax(oSettings, data, fn) {
|
|
|
4226
4235
|
// Custom Ajax option to submit the parameters as a JSON string
|
|
4227
4236
|
if (baseAjax.submitAs === 'json' && typeof data === 'object') {
|
|
4228
4237
|
baseAjax.data = JSON.stringify(data);
|
|
4238
|
+
|
|
4239
|
+
if (!baseAjax.contentType) {
|
|
4240
|
+
baseAjax.contentType = 'application/json; charset=utf-8';
|
|
4241
|
+
}
|
|
4229
4242
|
}
|
|
4230
4243
|
|
|
4231
4244
|
if (typeof ajax === 'function') {
|
|
@@ -5484,7 +5497,7 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5484
5497
|
var autoClass = _ext.type.className[column.sType];
|
|
5485
5498
|
var padding = column.sContentPadding || (scrollX ? '-' : '');
|
|
5486
5499
|
var text = longest + padding;
|
|
5487
|
-
var insert = longest.indexOf('<') === -1
|
|
5500
|
+
var insert = longest.indexOf('<') === -1 && longest.indexOf('&') === -1
|
|
5488
5501
|
? document.createTextNode(text)
|
|
5489
5502
|
: text
|
|
5490
5503
|
|
|
@@ -5672,15 +5685,20 @@ function _fnGetWideStrings( settings, colIdx )
|
|
|
5672
5685
|
.replace(/id=".*?"/g, '')
|
|
5673
5686
|
.replace(/name=".*?"/g, '');
|
|
5674
5687
|
|
|
5675
|
-
|
|
5688
|
+
// Don't want Javascript at all in these calculation cells.
|
|
5689
|
+
cellString = cellString.replace(/<script.*?<\/script>/gi, ' ');
|
|
5690
|
+
|
|
5691
|
+
var noHtml = _stripHtml(cellString, ' ')
|
|
5676
5692
|
.replace( / /g, ' ' );
|
|
5677
5693
|
|
|
5694
|
+
// The length is calculated on the text only, but we keep the HTML
|
|
5695
|
+
// in the string so it can be used in the calculation table
|
|
5678
5696
|
collection.push({
|
|
5679
|
-
str:
|
|
5680
|
-
len:
|
|
5697
|
+
str: cellString,
|
|
5698
|
+
len: noHtml.length
|
|
5681
5699
|
});
|
|
5682
5700
|
|
|
5683
|
-
allStrings.push(
|
|
5701
|
+
allStrings.push(noHtml);
|
|
5684
5702
|
}
|
|
5685
5703
|
|
|
5686
5704
|
// Order and then cut down to the size we need
|
|
@@ -8735,7 +8753,7 @@ var __column_header = function ( settings, column, row ) {
|
|
|
8735
8753
|
// Automatic - find the _last_ unique cell from the top that is not empty (last for
|
|
8736
8754
|
// backwards compatibility)
|
|
8737
8755
|
for (var i=0 ; i<header.length ; i++) {
|
|
8738
|
-
if (header[i][column].unique && $('
|
|
8756
|
+
if (header[i][column].unique && $('.dt-column-title', header[i][column].cell).text()) {
|
|
8739
8757
|
target = i;
|
|
8740
8758
|
}
|
|
8741
8759
|
}
|
|
@@ -8831,6 +8849,10 @@ var __column_selector = function ( settings, selector, opts )
|
|
|
8831
8849
|
return null;
|
|
8832
8850
|
}
|
|
8833
8851
|
|
|
8852
|
+
if (col.responsiveVisible === false) {
|
|
8853
|
+
return null;
|
|
8854
|
+
}
|
|
8855
|
+
|
|
8834
8856
|
// Selector
|
|
8835
8857
|
if (match[1]) {
|
|
8836
8858
|
return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
|
|
@@ -9042,7 +9064,7 @@ _api_registerPlural( 'columns().titles()', 'column().title()', function (title,
|
|
|
9042
9064
|
title = undefined;
|
|
9043
9065
|
}
|
|
9044
9066
|
|
|
9045
|
-
var span = $('
|
|
9067
|
+
var span = $('.dt-column-title', this.column(column).header(row));
|
|
9046
9068
|
|
|
9047
9069
|
if (title !== undefined) {
|
|
9048
9070
|
span.html(title);
|
|
@@ -10216,8 +10238,8 @@ _api_register( 'i18n()', function ( token, def, plural ) {
|
|
|
10216
10238
|
|
|
10217
10239
|
// Needed for header and footer, so pulled into its own function
|
|
10218
10240
|
function cleanHeader(node, className) {
|
|
10219
|
-
$(node).find('
|
|
10220
|
-
$(node).find('
|
|
10241
|
+
$(node).find('.dt-column-order').remove();
|
|
10242
|
+
$(node).find('.dt-column-title').each(function () {
|
|
10221
10243
|
var title = $(this).html();
|
|
10222
10244
|
$(this).parent().parent().append(title);
|
|
10223
10245
|
$(this).remove();
|
|
@@ -10235,7 +10257,7 @@ function cleanHeader(node, className) {
|
|
|
10235
10257
|
* @type string
|
|
10236
10258
|
* @default Version number
|
|
10237
10259
|
*/
|
|
10238
|
-
DataTable.version = "2.3.
|
|
10260
|
+
DataTable.version = "2.3.7";
|
|
10239
10261
|
|
|
10240
10262
|
/**
|
|
10241
10263
|
* Private data store, containing all of the settings objects that are
|
|
@@ -11403,7 +11425,10 @@ DataTable.defaults = {
|
|
|
11403
11425
|
iDeferLoading: null,
|
|
11404
11426
|
|
|
11405
11427
|
/** Event listeners */
|
|
11406
|
-
on: null
|
|
11428
|
+
on: null,
|
|
11429
|
+
|
|
11430
|
+
/** Title wrapper element type */
|
|
11431
|
+
columnTitleTag: 'span'
|
|
11407
11432
|
};
|
|
11408
11433
|
|
|
11409
11434
|
_fnHungarianMap( DataTable.defaults );
|
|
@@ -12367,7 +12392,10 @@ DataTable.models.oSettings = {
|
|
|
12367
12392
|
orderHandler: true,
|
|
12368
12393
|
|
|
12369
12394
|
/** Title row indicator */
|
|
12370
|
-
titleRow: null
|
|
12395
|
+
titleRow: null,
|
|
12396
|
+
|
|
12397
|
+
/** Title wrapper element type */
|
|
12398
|
+
columnTitleTag: 'span'
|
|
12371
12399
|
};
|
|
12372
12400
|
|
|
12373
12401
|
/**
|
package/package.json
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -338,6 +338,11 @@ export interface Config {
|
|
|
338
338
|
*/
|
|
339
339
|
columnDefs?: ConfigColumnDefs[];
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* HTML element to use for the title elements (including order indicator)
|
|
343
|
+
*/
|
|
344
|
+
columnTitleTag?: string;
|
|
345
|
+
|
|
341
346
|
/**
|
|
342
347
|
* Data to use as the display data for the table.
|
|
343
348
|
*/
|