datatables.net-searchbuilder 1.6.0 → 1.7.0

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.
@@ -1,5 +1,5 @@
1
- /*! SearchBuilder 1.6.0
2
- * ©SpryMedia Ltd - datatables.net/license/mit
1
+ /*! SearchBuilder 1.7.0
2
+ -dev * ©SpryMedia Ltd - datatables.net/license/mit
3
3
  */
4
4
 
5
5
  (function( factory ){
@@ -43,7 +43,7 @@
43
43
  // Browser
44
44
  factory( jQuery, window, document );
45
45
  }
46
- }(function( $, window, document, undefined ) {
46
+ }(function( $, window, document ) {
47
47
  'use strict';
48
48
  var DataTable = $.fn.dataTable;
49
49
 
@@ -73,11 +73,11 @@ var DataTable = $.fn.dataTable;
73
73
  */
74
74
  var Criteria = /** @class */ (function () {
75
75
  function Criteria(table, opts, topGroup, index, depth, serverData, liveSearch) {
76
- var _this = this;
77
76
  if (index === void 0) { index = 0; }
78
77
  if (depth === void 0) { depth = 1; }
79
78
  if (serverData === void 0) { serverData = undefined; }
80
79
  if (liveSearch === void 0) { liveSearch = false; }
80
+ var _this = this;
81
81
  // Check that the required version of DataTables is included
82
82
  if (!dataTable$3 || !dataTable$3.versionCheck || !dataTable$3.versionCheck('1.10.0')) {
83
83
  throw new Error('SearchPane requires DataTables 1.10 or newer');
@@ -201,7 +201,9 @@ var DataTable = $.fn.dataTable;
201
201
  }
202
202
  };
203
203
  /**
204
- * Parses formatted numbers down to a form where they can be compared
204
+ * Parses formatted numbers down to a form where they can be compared.
205
+ * Note that this does not account for different decimal characters. Use
206
+ * parseNumber instead on the instance.
205
207
  *
206
208
  * @param val the value to convert
207
209
  * @returns the converted value
@@ -223,11 +225,11 @@ var DataTable = $.fn.dataTable;
223
225
  this.setListeners();
224
226
  // Trigger the inserted events for the value elements as they are inserted
225
227
  if (this.dom.value[0] !== undefined) {
226
- this.dom.value[0].trigger('dtsb-inserted');
228
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
227
229
  }
228
230
  for (var i = 1; i < this.dom.value.length; i++) {
229
231
  this.dom.inputCont.append(this.dom.value[i]);
230
- this.dom.value[i].trigger('dtsb-inserted');
232
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
231
233
  }
232
234
  // If this is a top level criteria then don't let it move left
233
235
  if (this.s.depth > 1) {
@@ -265,28 +267,28 @@ var DataTable = $.fn.dataTable;
265
267
  * @returns boolean Whether the criteria has passed
266
268
  */
267
269
  Criteria.prototype.search = function (rowData, rowIdx) {
270
+ var settings = this.s.dt.settings()[0];
268
271
  var condition = this.s.conditions[this.s.condition];
269
272
  if (this.s.condition !== undefined && condition !== undefined) {
270
273
  var filter = rowData[this.s.dataIdx];
271
274
  // This check is in place for if a custom decimal character is in place
272
275
  if (this.s.type.includes('num') &&
273
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
274
- this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
276
+ (settings.oLanguage.sDecimal !== '' ||
277
+ settings.oLanguage.sThousands !== '')) {
275
278
  var splitRD = [rowData[this.s.dataIdx]];
276
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
277
- splitRD = rowData[this.s.dataIdx].split(this.s.dt.settings()[0].oLanguage.sDecimal);
279
+ if (settings.oLanguage.sDecimal !== '') {
280
+ splitRD = rowData[this.s.dataIdx].split(settings.oLanguage.sDecimal);
278
281
  }
279
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
282
+ if (settings.oLanguage.sThousands !== '') {
280
283
  for (var i = 0; i < splitRD.length; i++) {
281
- splitRD[i] = splitRD[i].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
284
+ splitRD[i] = splitRD[i].replace(settings.oLanguage.sThousands, ',');
282
285
  }
283
286
  }
284
287
  filter = splitRD.join('.');
285
288
  }
286
289
  // If orthogonal data is in place we need to get it's values for searching
287
290
  if (this.c.orthogonal.search !== 'filter') {
288
- var settings = this.s.dt.settings()[0];
289
- filter = settings.oApi._fnGetCellData(settings, rowIdx, this.s.dataIdx, typeof this.c.orthogonal === 'string' ?
291
+ filter = settings.fastData(rowIdx, this.s.dataIdx, typeof this.c.orthogonal === 'string' ?
290
292
  this.c.orthogonal :
291
293
  this.c.orthogonal.search);
292
294
  }
@@ -322,18 +324,20 @@ var DataTable = $.fn.dataTable;
322
324
  */
323
325
  Criteria.prototype.getDetails = function (deFormatDates) {
324
326
  if (deFormatDates === void 0) { deFormatDates = false; }
327
+ var i;
328
+ var settings = this.s.dt.settings()[0];
325
329
  // This check is in place for if a custom decimal character is in place
326
330
  if (this.s.type !== null &&
327
331
  this.s.type.includes('num') &&
328
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' || this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
329
- for (var i = 0; i < this.s.value.length; i++) {
332
+ (settings.oLanguage.sDecimal !== '' || settings.oLanguage.sThousands !== '')) {
333
+ for (i = 0; i < this.s.value.length; i++) {
330
334
  var splitRD = [this.s.value[i].toString()];
331
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
332
- splitRD = this.s.value[i].split(this.s.dt.settings()[0].oLanguage.sDecimal);
335
+ if (settings.oLanguage.sDecimal !== '') {
336
+ splitRD = this.s.value[i].split(settings.oLanguage.sDecimal);
333
337
  }
334
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
338
+ if (settings.oLanguage.sThousands !== '') {
335
339
  for (var j = 0; j < splitRD.length; j++) {
336
- splitRD[j] = splitRD[j].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
340
+ splitRD[j] = splitRD[j].replace(settings.oLanguage.sThousands, ',');
337
341
  }
338
342
  }
339
343
  this.s.value[i] = splitRD.join('.');
@@ -342,14 +346,14 @@ var DataTable = $.fn.dataTable;
342
346
  else if (this.s.type !== null && deFormatDates) {
343
347
  if (this.s.type.includes('date') ||
344
348
  this.s.type.includes('time')) {
345
- for (var i = 0; i < this.s.value.length; i++) {
349
+ for (i = 0; i < this.s.value.length; i++) {
346
350
  if (this.s.value[i].match(/^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])$/g) === null) {
347
351
  this.s.value[i] = '';
348
352
  }
349
353
  }
350
354
  }
351
355
  else if (this.s.type.includes('moment')) {
352
- for (var i = 0; i < this.s.value.length; i++) {
356
+ for (i = 0; i < this.s.value.length; i++) {
353
357
  if (this.s.value[i] &&
354
358
  this.s.value[i].length > 0 &&
355
359
  moment()(this.s.value[i], this.s.dateFormat, true).isValid()) {
@@ -358,7 +362,7 @@ var DataTable = $.fn.dataTable;
358
362
  }
359
363
  }
360
364
  else if (this.s.type.includes('luxon')) {
361
- for (var i = 0; i < this.s.value.length; i++) {
365
+ for (i = 0; i < this.s.value.length; i++) {
362
366
  if (this.s.value[i] &&
363
367
  this.s.value[i].length > 0 &&
364
368
  luxon().DateTime.fromFormat(this.s.value[i], this.s.dateFormat).invalid === null) {
@@ -368,7 +372,7 @@ var DataTable = $.fn.dataTable;
368
372
  }
369
373
  }
370
374
  if (this.s.type.includes('num') && this.s.dt.page.info().serverSide) {
371
- for (var i = 0; i < this.s.value.length; i++) {
375
+ for (i = 0; i < this.s.value.length; i++) {
372
376
  this.s.value[i] = this.s.value[i].replace(/[^0-9.\-]/g, '');
373
377
  }
374
378
  }
@@ -388,6 +392,20 @@ var DataTable = $.fn.dataTable;
388
392
  Criteria.prototype.getNode = function () {
389
393
  return this.dom.container;
390
394
  };
395
+ /**
396
+ * Parses formatted numbers down to a form where they can be compared
397
+ *
398
+ * @param val the value to convert
399
+ * @returns the converted value
400
+ */
401
+ Criteria.prototype.parseNumber = function (val) {
402
+ var decimal = this.s.dt.i18n('decimal');
403
+ // Remove any periods and then replace the decimal with a period
404
+ if (decimal && decimal !== '.') {
405
+ val = val.replace(/\./g, '').replace(decimal, '.');
406
+ }
407
+ return +val.replace(/(?!^-)[^0-9.]/g, '');
408
+ };
391
409
  /**
392
410
  * Populates the criteria data, condition and value(s) as far as has been selected
393
411
  */
@@ -410,7 +428,7 @@ var DataTable = $.fn.dataTable;
410
428
  Criteria.prototype.rebuild = function (loadedCriteria) {
411
429
  // Check to see if the previously selected data exists, if so select it
412
430
  var foundData = false;
413
- var dataIdx;
431
+ var dataIdx, i;
414
432
  this._populateData();
415
433
  // If a data selection has previously been made attempt to find and select it
416
434
  if (loadedCriteria.data !== undefined) {
@@ -442,8 +460,7 @@ var DataTable = $.fn.dataTable;
442
460
  var condition = void 0;
443
461
  // Check to see if the previously selected condition exists, if so select it
444
462
  var options = this.dom.condition.children('option');
445
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
446
- for (var i = 0; i < options.length; i++) {
463
+ for (i = 0; i < options.length; i++) {
447
464
  var option = $$3(options[i]);
448
465
  if (loadedCriteria.condition !== undefined &&
449
466
  option.val() === loadedCriteria.condition &&
@@ -461,11 +478,10 @@ var DataTable = $.fn.dataTable;
461
478
  this.dom.conditionTitle.removeProp('selected');
462
479
  this.dom.conditionTitle.remove();
463
480
  this.dom.condition.removeClass(this.classes.italic);
464
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
465
- for (var i = 0; i < options.length; i++) {
466
- var option = $$3(options[i]);
467
- if (option.val() !== this.s.condition) {
468
- option.removeProp('selected');
481
+ for (i = 0; i < options.length; i++) {
482
+ var opt = $$3(options[i]);
483
+ if (opt.val() !== this.s.condition) {
484
+ opt.removeProp('selected');
469
485
  }
470
486
  }
471
487
  this._populateValue(loadedCriteria);
@@ -486,7 +502,6 @@ var DataTable = $.fn.dataTable;
486
502
  _this.dom.dataTitle.removeProp('selected');
487
503
  // Need to go over every option to identify the correct selection
488
504
  var options = _this.dom.data.children('option.' + _this.classes.option);
489
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
490
505
  for (var i = 0; i < options.length; i++) {
491
506
  var option = $$3(options[i]);
492
507
  if (option.val() === _this.dom.data.val()) {
@@ -521,7 +536,6 @@ var DataTable = $.fn.dataTable;
521
536
  _this.dom.conditionTitle.removeProp('selected');
522
537
  // Need to go over every option to identify the correct selection
523
538
  var options = _this.dom.condition.children('option.' + _this.classes.option);
524
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
525
539
  for (var i = 0; i < options.length; i++) {
526
540
  var option = $$3(options[i]);
527
541
  if (option.val() === _this.dom.condition.val()) {
@@ -610,20 +624,18 @@ var DataTable = $.fn.dataTable;
610
624
  * Clears the value elements
611
625
  */
612
626
  Criteria.prototype._clearValue = function () {
627
+ var val;
613
628
  if (this.s.condition !== undefined) {
614
629
  if (this.dom.value.length > 0 && this.dom.value[0] !== undefined) {
615
- var _loop_1 = function (val) {
630
+ // Remove all of the value elements
631
+ for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
632
+ val = _a[_i];
616
633
  if (val !== undefined) {
617
634
  // Timeout is annoying but because of IOS
618
635
  setTimeout(function () {
619
636
  val.remove();
620
637
  }, 50);
621
638
  }
622
- };
623
- // Remove all of the value elements
624
- for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
625
- var val = _a[_i];
626
- _loop_1(val);
627
639
  }
628
640
  }
629
641
  // Call the init function to get the value elements for this condition
@@ -633,27 +645,24 @@ var DataTable = $.fn.dataTable;
633
645
  .empty()
634
646
  .append(this.dom.value[0])
635
647
  .insertAfter(this.dom.condition);
636
- this.dom.value[0].trigger('dtsb-inserted');
648
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
637
649
  // Insert all of the value elements
638
650
  for (var i = 1; i < this.dom.value.length; i++) {
639
651
  this.dom.inputCont.append(this.dom.value[i]);
640
- this.dom.value[i].trigger('dtsb-inserted');
652
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
641
653
  }
642
654
  }
643
655
  }
644
656
  else {
645
- var _loop_2 = function (val) {
657
+ // Remove all of the value elements
658
+ for (var _b = 0, _c = this.dom.value; _b < _c.length; _b++) {
659
+ val = _c[_b];
646
660
  if (val !== undefined) {
647
661
  // Timeout is annoying but because of IOS
648
662
  setTimeout(function () {
649
663
  val.remove();
650
664
  }, 50);
651
665
  }
652
- };
653
- // Remove all of the value elements
654
- for (var _b = 0, _c = this.dom.value; _b < _c.length; _b++) {
655
- var val = _c[_b];
656
- _loop_2(val);
657
666
  }
658
667
  // Append the default valueTitle to the default select element
659
668
  this.dom.valueTitle
@@ -689,9 +698,10 @@ var DataTable = $.fn.dataTable;
689
698
  var conditionsLength = Object.keys(this.s.conditions).length;
690
699
  var colInits = this.s.dt.settings()[0].aoColumns;
691
700
  var column = +this.dom.data.children('option:selected').val();
701
+ var condition, condName;
692
702
  // If there are no conditions stored then we need to get them from the appropriate type
693
703
  if (conditionsLength === 0) {
694
- this.s.type = this.s.dt.columns().type().toArray()[column];
704
+ this.s.type = this.s.dt.column(column).type();
695
705
  if (colInits !== undefined) {
696
706
  var colInit = colInits[column];
697
707
  if (colInit.searchBuilderType !== undefined && colInit.searchBuilderType !== null) {
@@ -701,10 +711,13 @@ var DataTable = $.fn.dataTable;
701
711
  this.s.type = colInit.sType;
702
712
  }
703
713
  }
704
- // If the column type is still unknown, call a draw to try reading it again
714
+ // If the column type is still unknown use the internal API to detect type
705
715
  if (this.s.type === null || this.s.type === undefined) {
706
- $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
707
- this.s.type = this.s.dt.columns().type().toArray()[column];
716
+ // This can only happen in DT1 - DT2 will do the invalidation of the type itself
717
+ if ($$3.fn.dataTable.ext.oApi) {
718
+ $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
719
+ }
720
+ this.s.type = this.s.dt.column(column).type();
708
721
  }
709
722
  // Enable the condition element
710
723
  this.dom.condition
@@ -741,7 +754,7 @@ var DataTable = $.fn.dataTable;
741
754
  }
742
755
  // Add all of the conditions to the select element
743
756
  for (var _i = 0, _a = Object.keys(conditionObj); _i < _a.length; _i++) {
744
- var condition = _a[_i];
757
+ condition = _a[_i];
745
758
  if (conditionObj[condition] !== null) {
746
759
  // Serverside processing does not supply the options for the select elements
747
760
  // Instead input elements need to be used for these instead
@@ -759,7 +772,7 @@ var DataTable = $.fn.dataTable;
759
772
  }
760
773
  }
761
774
  this.s.conditions[condition] = conditionObj[condition];
762
- var condName = conditionObj[condition].conditionName;
775
+ condName = conditionObj[condition].conditionName;
763
776
  if (typeof condName === 'function') {
764
777
  condName = condName(this.s.dt, this.c.i18n);
765
778
  }
@@ -776,18 +789,18 @@ var DataTable = $.fn.dataTable;
776
789
  else if (conditionsLength > 0) {
777
790
  this.dom.condition.empty().removeAttr('disabled').addClass(this.classes.italic);
778
791
  for (var _b = 0, _c = Object.keys(this.s.conditions); _b < _c.length; _b++) {
779
- var condition = _c[_b];
780
- var condName = this.s.conditions[condition].conditionName;
781
- if (typeof condName === 'function') {
782
- condName = condName(this.s.dt, this.c.i18n);
792
+ condition = _c[_b];
793
+ var name_1 = this.s.conditions[condition].conditionName;
794
+ if (typeof name_1 === 'function') {
795
+ name_1 = name_1(this.s.dt, this.c.i18n);
783
796
  }
784
797
  var newOpt = $$3('<option>', {
785
- text: condName,
798
+ text: name_1,
786
799
  value: condition
787
800
  })
788
801
  .addClass(this.classes.option)
789
802
  .addClass(this.classes.notItalic);
790
- if (this.s.condition !== undefined && this.s.condition === condName) {
803
+ if (this.s.condition !== undefined && this.s.condition === name_1) {
791
804
  newOpt.prop('selected', true);
792
805
  this.dom.condition.removeClass(this.classes.italic);
793
806
  }
@@ -819,7 +832,7 @@ var DataTable = $.fn.dataTable;
819
832
  // Need to check against the stored conditions so we can match the token "cond" to the option
820
833
  for (var _e = 0, _f = Object.keys(this.s.conditions); _e < _f.length; _e++) {
821
834
  var cond = _f[_e];
822
- var condName = this.s.conditions[cond].conditionName;
835
+ condName = this.s.conditions[cond].conditionName;
823
836
  if (
824
837
  // If the conditionName matches the text of the option
825
838
  (typeof condName === 'string' ? condName : condName(this.s.dt, this.c.i18n)) ===
@@ -882,13 +895,14 @@ var DataTable = $.fn.dataTable;
882
895
  Criteria.prototype._populateValue = function (loadedCriteria) {
883
896
  var _this = this;
884
897
  var prevFilled = this.s.filled;
898
+ var i;
885
899
  this.s.filled = false;
886
900
  // Remove any previous value elements
887
901
  // Timeout is annoying but because of IOS
888
902
  setTimeout(function () {
889
903
  _this.dom.defaultValue.remove();
890
904
  }, 50);
891
- var _loop_3 = function (val) {
905
+ var _loop_1 = function (val) {
892
906
  // Timeout is annoying but because of IOS
893
907
  setTimeout(function () {
894
908
  if (val !== undefined) {
@@ -898,12 +912,11 @@ var DataTable = $.fn.dataTable;
898
912
  };
899
913
  for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
900
914
  var val = _a[_i];
901
- _loop_3(val);
915
+ _loop_1(val);
902
916
  }
903
917
  var children = this.dom.inputCont.children();
904
918
  if (children.length > 1) {
905
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
906
- for (var i = 0; i < children.length; i++) {
919
+ for (i = 0; i < children.length; i++) {
907
920
  $$3(children[i]).remove();
908
921
  }
909
922
  }
@@ -923,12 +936,12 @@ var DataTable = $.fn.dataTable;
923
936
  this.dom.inputCont.empty();
924
937
  // Insert value elements and trigger the inserted event
925
938
  if (this.dom.value[0] !== undefined) {
926
- this.dom.value[0]
939
+ $$3(this.dom.value[0])
927
940
  .appendTo(this.dom.inputCont)
928
941
  .trigger('dtsb-inserted');
929
942
  }
930
- for (var i = 1; i < this.dom.value.length; i++) {
931
- this.dom.value[i]
943
+ for (i = 1; i < this.dom.value.length; i++) {
944
+ $$3(this.dom.value[i])
932
945
  .insertAfter(this.dom.value[i - 1])
933
946
  .trigger('dtsb-inserted');
934
947
  }
@@ -1008,7 +1021,7 @@ var DataTable = $.fn.dataTable;
1008
1021
  if (array === void 0) { array = false; }
1009
1022
  var column = that.dom.data.children('option:selected').val();
1010
1023
  var indexArray = that.s.dt.rows().indexes().toArray();
1011
- var settings = that.s.dt.settings()[0];
1024
+ var fastData = that.s.dt.settings()[0].fastData;
1012
1025
  that.dom.valueTitle.prop('selected', true);
1013
1026
  // Declare select element to be used with all of the default classes and listeners.
1014
1027
  var el = $$3('<select/>')
@@ -1030,7 +1043,7 @@ var DataTable = $.fn.dataTable;
1030
1043
  // Only add one option for each possible value
1031
1044
  for (var _i = 0, indexArray_1 = indexArray; _i < indexArray_1.length; _i++) {
1032
1045
  var index = indexArray_1[_i];
1033
- var filter = settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1046
+ var filter = fastData(index, column, typeof that.c.orthogonal === 'string' ?
1034
1047
  that.c.orthogonal :
1035
1048
  that.c.orthogonal.search);
1036
1049
  var value = {
@@ -1038,7 +1051,7 @@ var DataTable = $.fn.dataTable;
1038
1051
  filter.replace(/[\r\n\u2028]/g, ' ') : // Need to replace certain characters to match search values
1039
1052
  filter,
1040
1053
  index: index,
1041
- text: settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1054
+ text: fastData(index, column, typeof that.c.orthogonal === 'string' ?
1042
1055
  that.c.orthogonal :
1043
1056
  that.c.orthogonal.display)
1044
1057
  };
@@ -1331,14 +1344,14 @@ var DataTable = $.fn.dataTable;
1331
1344
  i18n: i18n
1332
1345
  })
1333
1346
  .on('change.dtsb', searchDelay !== null ?
1334
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1347
+ DataTable.util.throttle(function () {
1335
1348
  return fn(that, this);
1336
1349
  }, searchDelay) :
1337
1350
  function () {
1338
1351
  fn(that, _this);
1339
1352
  })
1340
1353
  .on('input.dtsb keypress.dtsb', function (e) {
1341
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1354
+ DataTable.util.throttle(function () {
1342
1355
  var code = e.keyCode || e.which;
1343
1356
  return fn(that, this, code);
1344
1357
  }, searchDelay === null ? 0 : searchDelay);
@@ -1355,7 +1368,7 @@ var DataTable = $.fn.dataTable;
1355
1368
  i18n: i18n
1356
1369
  })
1357
1370
  .on('change.dtsb', searchDelay !== null ?
1358
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1371
+ DataTable.util.throttle(function () {
1359
1372
  return fn(that, this);
1360
1373
  }, searchDelay) :
1361
1374
  function () {
@@ -1365,7 +1378,7 @@ var DataTable = $.fn.dataTable;
1365
1378
  !(that.s.dt.settings()[0].oInit.search !== undefined &&
1366
1379
  that.s.dt.settings()[0].oInit.search["return"]) &&
1367
1380
  searchDelay !== null ?
1368
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1381
+ DataTable.util.throttle(function () {
1369
1382
  return fn(that, this);
1370
1383
  }, searchDelay) :
1371
1384
  function (e) {
@@ -1455,6 +1468,7 @@ var DataTable = $.fn.dataTable;
1455
1468
  // When the value is changed the criteria is now complete so can be included in searches
1456
1469
  // Get the condition from the map based on the key that has been selected for the condition
1457
1470
  var condition = that.s.conditions[that.s.condition];
1471
+ var i;
1458
1472
  that.s.filled = condition.isInputValid(that.dom.value, that);
1459
1473
  that.s.value = condition.inputValue(that.dom.value, that);
1460
1474
  if (!that.s.filled) {
@@ -1469,31 +1483,16 @@ var DataTable = $.fn.dataTable;
1469
1483
  if (!Array.isArray(that.s.value)) {
1470
1484
  that.s.value = [that.s.value];
1471
1485
  }
1472
- for (var i = 0; i < that.s.value.length; i++) {
1486
+ for (i = 0; i < that.s.value.length; i++) {
1473
1487
  // If the value is an array we need to sort it
1474
1488
  if (Array.isArray(that.s.value[i])) {
1475
1489
  that.s.value[i].sort();
1476
1490
  }
1477
- // Otherwise replace the decimal place character for i18n
1478
- else if (that.s.type.includes('num') &&
1479
- (that.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
1480
- that.s.dt.settings()[0].oLanguage.sThousands !== '')) {
1481
- var splitRD = [that.s.value[i].toString()];
1482
- if (that.s.dt.settings()[0].oLanguage.sDecimal !== '') {
1483
- splitRD = that.s.value[i].split(that.s.dt.settings()[0].oLanguage.sDecimal);
1484
- }
1485
- if (that.s.dt.settings()[0].oLanguage.sThousands !== '') {
1486
- for (var j = 0; j < splitRD.length; j++) {
1487
- splitRD[j] = splitRD[j].replace(that.s.dt.settings()[0].oLanguage.sThousands, ',');
1488
- }
1489
- }
1490
- that.s.value[i] = splitRD.join('.');
1491
- }
1492
1491
  }
1493
1492
  // Take note of the cursor position so that we can refocus there later
1494
1493
  var idx = null;
1495
1494
  var cursorPos = null;
1496
- for (var i = 0; i < that.dom.value.length; i++) {
1495
+ for (i = 0; i < that.dom.value.length; i++) {
1497
1496
  if (el === that.dom.value[i][0]) {
1498
1497
  idx = i;
1499
1498
  if (el.selectionStart !== undefined) {
@@ -1520,7 +1519,6 @@ var DataTable = $.fn.dataTable;
1520
1519
  // The order of the conditions will make eslint sad :(
1521
1520
  // Has to be in this order so that they are displayed correctly in select elements
1522
1521
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1523
- // eslint-disable-next-line @typescript-eslint/member-ordering
1524
1522
  Criteria.dateConditions = {
1525
1523
  '=': {
1526
1524
  conditionName: function (dt, i18n) {
@@ -1534,7 +1532,6 @@ var DataTable = $.fn.dataTable;
1534
1532
  return value === comparison[0];
1535
1533
  }
1536
1534
  },
1537
- // eslint-disable-next-line sort-keys
1538
1535
  '!=': {
1539
1536
  conditionName: function (dt, i18n) {
1540
1537
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1588,7 +1585,6 @@ var DataTable = $.fn.dataTable;
1588
1585
  }
1589
1586
  }
1590
1587
  },
1591
- // eslint-disable-next-line sort-keys
1592
1588
  '!between': {
1593
1589
  conditionName: function (dt, i18n) {
1594
1590
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1621,7 +1617,6 @@ var DataTable = $.fn.dataTable;
1621
1617
  return value === null || value === undefined || value.length === 0;
1622
1618
  }
1623
1619
  },
1624
- // eslint-disable-next-line sort-keys
1625
1620
  '!null': {
1626
1621
  conditionName: function (dt, i18n) {
1627
1622
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1641,7 +1636,6 @@ var DataTable = $.fn.dataTable;
1641
1636
  // The order of the conditions will make eslint sad :(
1642
1637
  // Has to be in this order so that they are displayed correctly in select elements
1643
1638
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1644
- // eslint-disable-next-line @typescript-eslint/member-ordering
1645
1639
  Criteria.momentDateConditions = {
1646
1640
  '=': {
1647
1641
  conditionName: function (dt, i18n) {
@@ -1655,7 +1649,6 @@ var DataTable = $.fn.dataTable;
1655
1649
  moment()(comparison[0], that.s.dateFormat).valueOf();
1656
1650
  }
1657
1651
  },
1658
- // eslint-disable-next-line sort-keys
1659
1652
  '!=': {
1660
1653
  conditionName: function (dt, i18n) {
1661
1654
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1709,7 +1702,6 @@ var DataTable = $.fn.dataTable;
1709
1702
  }
1710
1703
  }
1711
1704
  },
1712
- // eslint-disable-next-line sort-keys
1713
1705
  '!between': {
1714
1706
  conditionName: function (dt, i18n) {
1715
1707
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1744,7 +1736,6 @@ var DataTable = $.fn.dataTable;
1744
1736
  return value === null || value === undefined || value.length === 0;
1745
1737
  }
1746
1738
  },
1747
- // eslint-disable-next-line sort-keys
1748
1739
  '!null': {
1749
1740
  conditionName: function (dt, i18n) {
1750
1741
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1764,7 +1755,6 @@ var DataTable = $.fn.dataTable;
1764
1755
  // The order of the conditions will make eslint sad :(
1765
1756
  // Has to be in this order so that they are displayed correctly in select elements
1766
1757
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1767
- // eslint-disable-next-line @typescript-eslint/member-ordering
1768
1758
  Criteria.luxonDateConditions = {
1769
1759
  '=': {
1770
1760
  conditionName: function (dt, i18n) {
@@ -1778,7 +1768,6 @@ var DataTable = $.fn.dataTable;
1778
1768
  === luxon().DateTime.fromFormat(comparison[0], that.s.dateFormat).ts;
1779
1769
  }
1780
1770
  },
1781
- // eslint-disable-next-line sort-keys
1782
1771
  '!=': {
1783
1772
  conditionName: function (dt, i18n) {
1784
1773
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1834,7 +1823,6 @@ var DataTable = $.fn.dataTable;
1834
1823
  }
1835
1824
  }
1836
1825
  },
1837
- // eslint-disable-next-line sort-keys
1838
1826
  '!between': {
1839
1827
  conditionName: function (dt, i18n) {
1840
1828
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1869,7 +1857,6 @@ var DataTable = $.fn.dataTable;
1869
1857
  return value === null || value === undefined || value.length === 0;
1870
1858
  }
1871
1859
  },
1872
- // eslint-disable-next-line sort-keys
1873
1860
  '!null': {
1874
1861
  conditionName: function (dt, i18n) {
1875
1862
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1889,7 +1876,6 @@ var DataTable = $.fn.dataTable;
1889
1876
  // The order of the conditions will make eslint sad :(
1890
1877
  // Has to be in this order so that they are displayed correctly in select elements
1891
1878
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1892
- // eslint-disable-next-line @typescript-eslint/member-ordering
1893
1879
  Criteria.numConditions = {
1894
1880
  '=': {
1895
1881
  conditionName: function (dt, i18n) {
@@ -1902,7 +1888,6 @@ var DataTable = $.fn.dataTable;
1902
1888
  return +value === +comparison[0];
1903
1889
  }
1904
1890
  },
1905
- // eslint-disable-next-line sort-keys
1906
1891
  '!=': {
1907
1892
  conditionName: function (dt, i18n) {
1908
1893
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -1947,7 +1932,6 @@ var DataTable = $.fn.dataTable;
1947
1932
  return +value >= +comparison[0];
1948
1933
  }
1949
1934
  },
1950
- // eslint-disable-next-line sort-keys
1951
1935
  '>': {
1952
1936
  conditionName: function (dt, i18n) {
1953
1937
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -1975,7 +1959,6 @@ var DataTable = $.fn.dataTable;
1975
1959
  }
1976
1960
  }
1977
1961
  },
1978
- // eslint-disable-next-line sort-keys
1979
1962
  '!between': {
1980
1963
  conditionName: function (dt, i18n) {
1981
1964
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -2007,7 +1990,6 @@ var DataTable = $.fn.dataTable;
2007
1990
  return value === null || value === undefined || value.length === 0;
2008
1991
  }
2009
1992
  },
2010
- // eslint-disable-next-line sort-keys
2011
1993
  '!null': {
2012
1994
  conditionName: function (dt, i18n) {
2013
1995
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -2027,7 +2009,6 @@ var DataTable = $.fn.dataTable;
2027
2009
  // The order of the conditions will make eslint sad :(
2028
2010
  // Has to be in this order so that they are displayed correctly in select elements
2029
2011
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2030
- // eslint-disable-next-line @typescript-eslint/member-ordering
2031
2012
  Criteria.numFmtConditions = {
2032
2013
  '=': {
2033
2014
  conditionName: function (dt, i18n) {
@@ -2036,11 +2017,10 @@ var DataTable = $.fn.dataTable;
2036
2017
  init: Criteria.initSelect,
2037
2018
  inputValue: Criteria.inputValueSelect,
2038
2019
  isInputValid: Criteria.isInputValidSelect,
2039
- search: function (value, comparison) {
2040
- return Criteria.parseNumFmt(value) === Criteria.parseNumFmt(comparison[0]);
2020
+ search: function (value, comparison, criteria) {
2021
+ return criteria.parseNumber(value) === criteria.parseNumber(comparison[0]);
2041
2022
  }
2042
2023
  },
2043
- // eslint-disable-next-line sort-keys
2044
2024
  '!=': {
2045
2025
  conditionName: function (dt, i18n) {
2046
2026
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -2048,8 +2028,8 @@ var DataTable = $.fn.dataTable;
2048
2028
  init: Criteria.initSelect,
2049
2029
  inputValue: Criteria.inputValueSelect,
2050
2030
  isInputValid: Criteria.isInputValidSelect,
2051
- search: function (value, comparison) {
2052
- return Criteria.parseNumFmt(value) !== Criteria.parseNumFmt(comparison[0]);
2031
+ search: function (value, comparison, criteria) {
2032
+ return criteria.parseNumber(value) !== criteria.parseNumber(comparison[0]);
2053
2033
  }
2054
2034
  },
2055
2035
  '<': {
@@ -2059,8 +2039,8 @@ var DataTable = $.fn.dataTable;
2059
2039
  init: Criteria.initInput,
2060
2040
  inputValue: Criteria.inputValueInput,
2061
2041
  isInputValid: Criteria.isInputValidInput,
2062
- search: function (value, comparison) {
2063
- return Criteria.parseNumFmt(value) < Criteria.parseNumFmt(comparison[0]);
2042
+ search: function (value, comparison, criteria) {
2043
+ return criteria.parseNumber(value) < criteria.parseNumber(comparison[0]);
2064
2044
  }
2065
2045
  },
2066
2046
  '<=': {
@@ -2070,8 +2050,8 @@ var DataTable = $.fn.dataTable;
2070
2050
  init: Criteria.initInput,
2071
2051
  inputValue: Criteria.inputValueInput,
2072
2052
  isInputValid: Criteria.isInputValidInput,
2073
- search: function (value, comparison) {
2074
- return Criteria.parseNumFmt(value) <= Criteria.parseNumFmt(comparison[0]);
2053
+ search: function (value, comparison, criteria) {
2054
+ return criteria.parseNumber(value) <= criteria.parseNumber(comparison[0]);
2075
2055
  }
2076
2056
  },
2077
2057
  '>=': {
@@ -2081,11 +2061,10 @@ var DataTable = $.fn.dataTable;
2081
2061
  init: Criteria.initInput,
2082
2062
  inputValue: Criteria.inputValueInput,
2083
2063
  isInputValid: Criteria.isInputValidInput,
2084
- search: function (value, comparison) {
2085
- return Criteria.parseNumFmt(value) >= Criteria.parseNumFmt(comparison[0]);
2064
+ search: function (value, comparison, criteria) {
2065
+ return criteria.parseNumber(value) >= criteria.parseNumber(comparison[0]);
2086
2066
  }
2087
2067
  },
2088
- // eslint-disable-next-line sort-keys
2089
2068
  '>': {
2090
2069
  conditionName: function (dt, i18n) {
2091
2070
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -2093,8 +2072,8 @@ var DataTable = $.fn.dataTable;
2093
2072
  init: Criteria.initInput,
2094
2073
  inputValue: Criteria.inputValueInput,
2095
2074
  isInputValid: Criteria.isInputValidInput,
2096
- search: function (value, comparison) {
2097
- return Criteria.parseNumFmt(value) > Criteria.parseNumFmt(comparison[0]);
2075
+ search: function (value, comparison, criteria) {
2076
+ return criteria.parseNumber(value) > criteria.parseNumber(comparison[0]);
2098
2077
  }
2099
2078
  },
2100
2079
  'between': {
@@ -2104,10 +2083,10 @@ var DataTable = $.fn.dataTable;
2104
2083
  init: Criteria.init2Input,
2105
2084
  inputValue: Criteria.inputValueInput,
2106
2085
  isInputValid: Criteria.isInputValidInput,
2107
- search: function (value, comparison) {
2108
- var val = Criteria.parseNumFmt(value);
2109
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2110
- var comp1 = Criteria.parseNumFmt(comparison[1]);
2086
+ search: function (value, comparison, criteria) {
2087
+ var val = criteria.parseNumber(value);
2088
+ var comp0 = criteria.parseNumber(comparison[0]);
2089
+ var comp1 = criteria.parseNumber(comparison[1]);
2111
2090
  if (+comp0 < +comp1) {
2112
2091
  return +comp0 <= +val && +val <= +comp1;
2113
2092
  }
@@ -2116,7 +2095,6 @@ var DataTable = $.fn.dataTable;
2116
2095
  }
2117
2096
  }
2118
2097
  },
2119
- // eslint-disable-next-line sort-keys
2120
2098
  '!between': {
2121
2099
  conditionName: function (dt, i18n) {
2122
2100
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -2124,10 +2102,10 @@ var DataTable = $.fn.dataTable;
2124
2102
  init: Criteria.init2Input,
2125
2103
  inputValue: Criteria.inputValueInput,
2126
2104
  isInputValid: Criteria.isInputValidInput,
2127
- search: function (value, comparison) {
2128
- var val = Criteria.parseNumFmt(value);
2129
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2130
- var comp1 = Criteria.parseNumFmt(comparison[1]);
2105
+ search: function (value, comparison, criteria) {
2106
+ var val = criteria.parseNumber(value);
2107
+ var comp0 = criteria.parseNumber(comparison[0]);
2108
+ var comp1 = criteria.parseNumber(comparison[1]);
2131
2109
  if (+comp0 < +comp1) {
2132
2110
  return !(+comp0 <= +val && +val <= +comp1);
2133
2111
  }
@@ -2151,7 +2129,6 @@ var DataTable = $.fn.dataTable;
2151
2129
  return value === null || value === undefined || value.length === 0;
2152
2130
  }
2153
2131
  },
2154
- // eslint-disable-next-line sort-keys
2155
2132
  '!null': {
2156
2133
  conditionName: function (dt, i18n) {
2157
2134
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -2171,7 +2148,6 @@ var DataTable = $.fn.dataTable;
2171
2148
  // The order of the conditions will make eslint sad :(
2172
2149
  // Has to be in this order so that they are displayed correctly in select elements
2173
2150
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2174
- // eslint-disable-next-line @typescript-eslint/member-ordering
2175
2151
  Criteria.stringConditions = {
2176
2152
  '=': {
2177
2153
  conditionName: function (dt, i18n) {
@@ -2184,7 +2160,6 @@ var DataTable = $.fn.dataTable;
2184
2160
  return value === comparison[0];
2185
2161
  }
2186
2162
  },
2187
- // eslint-disable-next-line sort-keys
2188
2163
  '!=': {
2189
2164
  conditionName: function (dt, i18n) {
2190
2165
  return dt.i18n('searchBuilder.conditions.string.not', i18n.conditions.string.not);
@@ -2207,7 +2182,6 @@ var DataTable = $.fn.dataTable;
2207
2182
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) === 0;
2208
2183
  }
2209
2184
  },
2210
- // eslint-disable-next-line sort-keys
2211
2185
  '!starts': {
2212
2186
  conditionName: function (dt, i18n) {
2213
2187
  return dt.i18n('searchBuilder.conditions.string.notStartsWith', i18n.conditions.string.notStartsWith);
@@ -2219,7 +2193,6 @@ var DataTable = $.fn.dataTable;
2219
2193
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) !== 0;
2220
2194
  }
2221
2195
  },
2222
- // eslint-disable-next-line sort-keys
2223
2196
  'contains': {
2224
2197
  conditionName: function (dt, i18n) {
2225
2198
  return dt.i18n('searchBuilder.conditions.string.contains', i18n.conditions.string.contains);
@@ -2231,7 +2204,6 @@ var DataTable = $.fn.dataTable;
2231
2204
  return value.toLowerCase().includes(comparison[0].toLowerCase());
2232
2205
  }
2233
2206
  },
2234
- // eslint-disable-next-line sort-keys
2235
2207
  '!contains': {
2236
2208
  conditionName: function (dt, i18n) {
2237
2209
  return dt.i18n('searchBuilder.conditions.string.notContains', i18n.conditions.string.notContains);
@@ -2254,7 +2226,6 @@ var DataTable = $.fn.dataTable;
2254
2226
  return value.toLowerCase().endsWith(comparison[0].toLowerCase());
2255
2227
  }
2256
2228
  },
2257
- // eslint-disable-next-line sort-keys
2258
2229
  '!ends': {
2259
2230
  conditionName: function (dt, i18n) {
2260
2231
  return dt.i18n('searchBuilder.conditions.string.notEndsWith', i18n.conditions.string.notEndsWith);
@@ -2281,7 +2252,6 @@ var DataTable = $.fn.dataTable;
2281
2252
  return value === null || value === undefined || value.length === 0;
2282
2253
  }
2283
2254
  },
2284
- // eslint-disable-next-line sort-keys
2285
2255
  '!null': {
2286
2256
  conditionName: function (dt, i18n) {
2287
2257
  return dt.i18n('searchBuilder.conditions.string.notEmpty', i18n.conditions.string.notEmpty);
@@ -2300,7 +2270,6 @@ var DataTable = $.fn.dataTable;
2300
2270
  };
2301
2271
  // The order of the conditions will make eslint sad :(
2302
2272
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2303
- // eslint-disable-next-line @typescript-eslint/member-ordering
2304
2273
  Criteria.arrayConditions = {
2305
2274
  'contains': {
2306
2275
  conditionName: function (dt, i18n) {
@@ -2324,7 +2293,6 @@ var DataTable = $.fn.dataTable;
2324
2293
  return value.indexOf(comparison[0]) === -1;
2325
2294
  }
2326
2295
  },
2327
- // eslint-disable-next-line sort-keys
2328
2296
  '=': {
2329
2297
  conditionName: function (dt, i18n) {
2330
2298
  return dt.i18n('searchBuilder.conditions.array.equals', i18n.conditions.array.equals);
@@ -2344,7 +2312,6 @@ var DataTable = $.fn.dataTable;
2344
2312
  return false;
2345
2313
  }
2346
2314
  },
2347
- // eslint-disable-next-line sort-keys
2348
2315
  '!=': {
2349
2316
  conditionName: function (dt, i18n) {
2350
2317
  return dt.i18n('searchBuilder.conditions.array.not', i18n.conditions.array.not);
@@ -2379,7 +2346,6 @@ var DataTable = $.fn.dataTable;
2379
2346
  return value === null || value === undefined || value.length === 0;
2380
2347
  }
2381
2348
  },
2382
- // eslint-disable-next-line sort-keys
2383
2349
  '!null': {
2384
2350
  conditionName: function (dt, i18n) {
2385
2351
  return dt.i18n('searchBuilder.conditions.array.notEmpty', i18n.conditions.array.notEmpty);
@@ -2398,7 +2364,6 @@ var DataTable = $.fn.dataTable;
2398
2364
  };
2399
2365
  // eslint will be sad because we have to disable member ordering for this as the
2400
2366
  // private static properties used are not yet declared otherwise
2401
- // eslint-disable-next-line @typescript-eslint/member-ordering
2402
2367
  Criteria.defaults = {
2403
2368
  columns: true,
2404
2369
  conditions: {
@@ -2442,6 +2407,7 @@ var DataTable = $.fn.dataTable;
2442
2407
  value: 'Value',
2443
2408
  valueJoiner: 'and'
2444
2409
  },
2410
+ liveSearch: true,
2445
2411
  logic: 'AND',
2446
2412
  orthogonal: {
2447
2413
  display: 'display',
@@ -2540,7 +2506,6 @@ var DataTable = $.fn.dataTable;
2540
2506
  * Gets the details required to rebuild the group
2541
2507
  */
2542
2508
  // Eslint upset at empty object but needs to be done
2543
- // eslint-disable-next-line @typescript-eslint/ban-types
2544
2509
  Group.prototype.getDetails = function (deFormatDates) {
2545
2510
  if (deFormatDates === void 0) { deFormatDates = false; }
2546
2511
  if (this.s.criteria.length === 0) {
@@ -2571,6 +2536,7 @@ var DataTable = $.fn.dataTable;
2571
2536
  * @param loadedDetails the details required to rebuild the group
2572
2537
  */
2573
2538
  Group.prototype.rebuild = function (loadedDetails) {
2539
+ var crit;
2574
2540
  // If no criteria are stored then just return
2575
2541
  if (loadedDetails.criteria === undefined ||
2576
2542
  loadedDetails.criteria === null ||
@@ -2584,7 +2550,7 @@ var DataTable = $.fn.dataTable;
2584
2550
  // Add all of the criteria, be it a sub group or a criteria
2585
2551
  if (Array.isArray(loadedDetails.criteria)) {
2586
2552
  for (var _i = 0, _a = loadedDetails.criteria; _i < _a.length; _i++) {
2587
- var crit = _a[_i];
2553
+ crit = _a[_i];
2588
2554
  if (crit.logic !== undefined) {
2589
2555
  this._addPrevGroup(crit);
2590
2556
  }
@@ -2595,7 +2561,7 @@ var DataTable = $.fn.dataTable;
2595
2561
  }
2596
2562
  // For all of the criteria children, update the arrows incase they require changing and set the listeners
2597
2563
  for (var _b = 0, _c = this.s.criteria; _b < _c.length; _b++) {
2598
- var crit = _c[_b];
2564
+ crit = _c[_b];
2599
2565
  if (crit.criteria instanceof Criteria) {
2600
2566
  crit.criteria.updateArrows(this.s.criteria.length > 1);
2601
2567
  this._setCriteriaListeners(crit.criteria);
@@ -2613,8 +2579,10 @@ var DataTable = $.fn.dataTable;
2613
2579
  this.dom.container.children().detach();
2614
2580
  this.dom.container
2615
2581
  .append(this.dom.logicContainer)
2616
- .append(this.dom.add)
2617
- .append(this.dom.search);
2582
+ .append(this.dom.add);
2583
+ if (!this.c.liveSearch) {
2584
+ this.dom.container.append(this.dom.search);
2585
+ }
2618
2586
  // Sort the criteria by index so that they appear in the correct order
2619
2587
  this.s.criteria.sort(function (a, b) {
2620
2588
  if (a.criteria.s.index < b.criteria.s.index) {
@@ -2756,7 +2724,9 @@ var DataTable = $.fn.dataTable;
2756
2724
  _this.s.dt.state.save();
2757
2725
  return false;
2758
2726
  });
2759
- this.dom.search.on('click.dtsb', function () {
2727
+ this.dom.search
2728
+ .off('click.dtsb')
2729
+ .on('click.dtsb', function () {
2760
2730
  _this.s.dt.draw();
2761
2731
  });
2762
2732
  for (var _i = 0, _a = this.s.criteria; _i < _a.length; _i++) {
@@ -2955,6 +2925,7 @@ var DataTable = $.fn.dataTable;
2955
2925
  */
2956
2926
  Group.prototype._removeCriteria = function (criteria, group) {
2957
2927
  if (group === void 0) { group = false; }
2928
+ var i;
2958
2929
  // If removing a criteria and there is only then then just destroy the group
2959
2930
  if (this.s.criteria.length <= 1 && this.s.isChild) {
2960
2931
  this.destroy();
@@ -2962,7 +2933,7 @@ var DataTable = $.fn.dataTable;
2962
2933
  else {
2963
2934
  // Otherwise splice the given criteria out and redo the indexes
2964
2935
  var last = void 0;
2965
- for (var i = 0; i < this.s.criteria.length; i++) {
2936
+ for (i = 0; i < this.s.criteria.length; i++) {
2966
2937
  if (this.s.criteria[i].index === criteria.s.index &&
2967
2938
  (!group || this.s.criteria[i].criteria instanceof Group)) {
2968
2939
  last = i;
@@ -2972,7 +2943,7 @@ var DataTable = $.fn.dataTable;
2972
2943
  if (last !== undefined) {
2973
2944
  this.s.criteria.splice(last, 1);
2974
2945
  }
2975
- for (var i = 0; i < this.s.criteria.length; i++) {
2946
+ for (i = 0; i < this.s.criteria.length; i++) {
2976
2947
  this.s.criteria[i].index = i;
2977
2948
  this.s.criteria[i].criteria.s.index = i;
2978
2949
  }
@@ -3113,9 +3084,10 @@ var DataTable = $.fn.dataTable;
3113
3084
  if (this.s.isChild) {
3114
3085
  this.dom.container.append(this.dom.logicContainer);
3115
3086
  }
3116
- this.dom.container
3117
- .append(this.dom.add)
3118
- .append(this.dom.search);
3087
+ this.dom.container.append(this.dom.add);
3088
+ if (!this.c.liveSearch) {
3089
+ this.dom.container.append(this.dom.search);
3090
+ }
3119
3091
  };
3120
3092
  /**
3121
3093
  * Sets the listener for the logic button
@@ -3291,7 +3263,6 @@ var DataTable = $.fn.dataTable;
3291
3263
  * Gets the details required to rebuild the SearchBuilder as it currently is
3292
3264
  */
3293
3265
  // eslint upset at empty object but that is what it is
3294
- // eslint-disable-next-line @typescript-eslint/ban-types
3295
3266
  SearchBuilder.prototype.getDetails = function (deFormatDates) {
3296
3267
  if (deFormatDates === void 0) { deFormatDates = false; }
3297
3268
  return this.s.topGroup.getDetails(deFormatDates);
@@ -3361,16 +3332,19 @@ var DataTable = $.fn.dataTable;
3361
3332
  SearchBuilder.prototype._setUp = function (loadState) {
3362
3333
  var _this = this;
3363
3334
  if (loadState === void 0) { loadState = true; }
3364
- // Register an Api method for getting the column type
3365
- $$1.fn.DataTable.Api.registerPlural('columns().type()', 'column().type()', function () {
3366
- return this.iterator('column', function (settings, column) {
3367
- return settings.aoColumns[column].sType;
3368
- }, 1);
3369
- });
3335
+ // Register an Api method for getting the column type. DataTables 2 has
3336
+ // this built in
3337
+ if (typeof this.s.dt.column().type !== 'function') {
3338
+ DataTable.Api.registerPlural('columns().types()', 'column().type()', function () {
3339
+ return this.iterator('column', function (settings, column) {
3340
+ return settings.aoColumns[column].sType;
3341
+ }, 1);
3342
+ });
3343
+ }
3370
3344
  // Check that DateTime is included, If not need to check if it could be used
3371
3345
  // eslint-disable-next-line no-extra-parens
3372
3346
  if (!dataTable$1.DateTime) {
3373
- var types = this.s.dt.columns().type().toArray();
3347
+ var types = this.s.dt.columns().types().toArray();
3374
3348
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3375
3349
  types = [];
3376
3350
  for (var _i = 0, _a = this.s.dt.settings()[0].aoColumns; _i < _a.length; _i++) {
@@ -3379,10 +3353,13 @@ var DataTable = $.fn.dataTable;
3379
3353
  }
3380
3354
  }
3381
3355
  var columnIdxs = this.s.dt.columns().toArray();
3382
- // If the types are not yet set then draw to see if they can be retrieved then
3356
+ // If the column type is still unknown use the internal API to detect type
3383
3357
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3384
- $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3385
- types = this.s.dt.columns().type().toArray();
3358
+ // This can only happen in DT1 - DT2 will do the invalidation of the type itself
3359
+ if ($$1.fn.dataTable.ext.oApi) {
3360
+ $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3361
+ }
3362
+ types = this.s.dt.columns().types().toArray();
3386
3363
  }
3387
3364
  for (var i = 0; i < columnIdxs[0].length; i++) {
3388
3365
  var column = columnIdxs[0][i];
@@ -3421,7 +3398,9 @@ var DataTable = $.fn.dataTable;
3421
3398
  data.searchBuilder = _this._collapseArray(_this.getDetails(true));
3422
3399
  }
3423
3400
  });
3424
- this.s.dt.on('column-reorder', function () {
3401
+ this.s.dt.on(dataTable$1.versionCheck('2')
3402
+ ? 'columns-reordered'
3403
+ : 'column-reorder', function () {
3425
3404
  _this.rebuild(_this.getDetails());
3426
3405
  });
3427
3406
  if (loadState) {
@@ -3636,7 +3615,7 @@ var DataTable = $.fn.dataTable;
3636
3615
  _this.dom.clearAll.remove();
3637
3616
  });
3638
3617
  };
3639
- SearchBuilder.version = '1.6.0';
3618
+ SearchBuilder.version = '1.7.0';
3640
3619
  SearchBuilder.classes = {
3641
3620
  button: 'dtsb-button',
3642
3621
  clearAll: 'dtsb-clearAll',
@@ -3744,8 +3723,8 @@ var DataTable = $.fn.dataTable;
3744
3723
  return SearchBuilder;
3745
3724
  }());
3746
3725
 
3747
- /*! SearchBuilder 1.6.0
3748
- * ©SpryMedia Ltd - datatables.net/license/mit
3726
+ /*! SearchBuilder 1.7.0
3727
+ -dev * ©SpryMedia Ltd - datatables.net/license/mit
3749
3728
  */
3750
3729
  setJQuery($);
3751
3730
  setJQuery$1($);
@@ -3855,11 +3834,11 @@ var DataTable = $.fn.dataTable;
3855
3834
  fnInit: _init
3856
3835
  });
3857
3836
  // DataTables 2 layout feature
3858
- if (DataTable.ext.features) {
3859
- DataTable.ext.features.register('searchBuilder', _init);
3837
+ if (DataTable.feature) {
3838
+ DataTable.feature.register('searchBuilder', _init);
3860
3839
  }
3861
3840
 
3862
- }());
3841
+ })();
3863
3842
 
3864
3843
 
3865
3844
  return DataTable;