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
  import jQuery from 'jquery';
@@ -33,11 +33,11 @@ let $ = jQuery;
33
33
  */
34
34
  var Criteria = /** @class */ (function () {
35
35
  function Criteria(table, opts, topGroup, index, depth, serverData, liveSearch) {
36
- var _this = this;
37
36
  if (index === void 0) { index = 0; }
38
37
  if (depth === void 0) { depth = 1; }
39
38
  if (serverData === void 0) { serverData = undefined; }
40
39
  if (liveSearch === void 0) { liveSearch = false; }
40
+ var _this = this;
41
41
  // Check that the required version of DataTables is included
42
42
  if (!dataTable$3 || !dataTable$3.versionCheck || !dataTable$3.versionCheck('1.10.0')) {
43
43
  throw new Error('SearchPane requires DataTables 1.10 or newer');
@@ -161,7 +161,9 @@ let $ = jQuery;
161
161
  }
162
162
  };
163
163
  /**
164
- * Parses formatted numbers down to a form where they can be compared
164
+ * Parses formatted numbers down to a form where they can be compared.
165
+ * Note that this does not account for different decimal characters. Use
166
+ * parseNumber instead on the instance.
165
167
  *
166
168
  * @param val the value to convert
167
169
  * @returns the converted value
@@ -183,11 +185,11 @@ let $ = jQuery;
183
185
  this.setListeners();
184
186
  // Trigger the inserted events for the value elements as they are inserted
185
187
  if (this.dom.value[0] !== undefined) {
186
- this.dom.value[0].trigger('dtsb-inserted');
188
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
187
189
  }
188
190
  for (var i = 1; i < this.dom.value.length; i++) {
189
191
  this.dom.inputCont.append(this.dom.value[i]);
190
- this.dom.value[i].trigger('dtsb-inserted');
192
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
191
193
  }
192
194
  // If this is a top level criteria then don't let it move left
193
195
  if (this.s.depth > 1) {
@@ -225,28 +227,28 @@ let $ = jQuery;
225
227
  * @returns boolean Whether the criteria has passed
226
228
  */
227
229
  Criteria.prototype.search = function (rowData, rowIdx) {
230
+ var settings = this.s.dt.settings()[0];
228
231
  var condition = this.s.conditions[this.s.condition];
229
232
  if (this.s.condition !== undefined && condition !== undefined) {
230
233
  var filter = rowData[this.s.dataIdx];
231
234
  // This check is in place for if a custom decimal character is in place
232
235
  if (this.s.type.includes('num') &&
233
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
234
- this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
236
+ (settings.oLanguage.sDecimal !== '' ||
237
+ settings.oLanguage.sThousands !== '')) {
235
238
  var splitRD = [rowData[this.s.dataIdx]];
236
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
237
- splitRD = rowData[this.s.dataIdx].split(this.s.dt.settings()[0].oLanguage.sDecimal);
239
+ if (settings.oLanguage.sDecimal !== '') {
240
+ splitRD = rowData[this.s.dataIdx].split(settings.oLanguage.sDecimal);
238
241
  }
239
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
242
+ if (settings.oLanguage.sThousands !== '') {
240
243
  for (var i = 0; i < splitRD.length; i++) {
241
- splitRD[i] = splitRD[i].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
244
+ splitRD[i] = splitRD[i].replace(settings.oLanguage.sThousands, ',');
242
245
  }
243
246
  }
244
247
  filter = splitRD.join('.');
245
248
  }
246
249
  // If orthogonal data is in place we need to get it's values for searching
247
250
  if (this.c.orthogonal.search !== 'filter') {
248
- var settings = this.s.dt.settings()[0];
249
- filter = settings.oApi._fnGetCellData(settings, rowIdx, this.s.dataIdx, typeof this.c.orthogonal === 'string' ?
251
+ filter = settings.fastData(rowIdx, this.s.dataIdx, typeof this.c.orthogonal === 'string' ?
250
252
  this.c.orthogonal :
251
253
  this.c.orthogonal.search);
252
254
  }
@@ -282,18 +284,20 @@ let $ = jQuery;
282
284
  */
283
285
  Criteria.prototype.getDetails = function (deFormatDates) {
284
286
  if (deFormatDates === void 0) { deFormatDates = false; }
287
+ var i;
288
+ var settings = this.s.dt.settings()[0];
285
289
  // This check is in place for if a custom decimal character is in place
286
290
  if (this.s.type !== null &&
287
291
  this.s.type.includes('num') &&
288
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' || this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
289
- for (var i = 0; i < this.s.value.length; i++) {
292
+ (settings.oLanguage.sDecimal !== '' || settings.oLanguage.sThousands !== '')) {
293
+ for (i = 0; i < this.s.value.length; i++) {
290
294
  var splitRD = [this.s.value[i].toString()];
291
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
292
- splitRD = this.s.value[i].split(this.s.dt.settings()[0].oLanguage.sDecimal);
295
+ if (settings.oLanguage.sDecimal !== '') {
296
+ splitRD = this.s.value[i].split(settings.oLanguage.sDecimal);
293
297
  }
294
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
298
+ if (settings.oLanguage.sThousands !== '') {
295
299
  for (var j = 0; j < splitRD.length; j++) {
296
- splitRD[j] = splitRD[j].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
300
+ splitRD[j] = splitRD[j].replace(settings.oLanguage.sThousands, ',');
297
301
  }
298
302
  }
299
303
  this.s.value[i] = splitRD.join('.');
@@ -302,14 +306,14 @@ let $ = jQuery;
302
306
  else if (this.s.type !== null && deFormatDates) {
303
307
  if (this.s.type.includes('date') ||
304
308
  this.s.type.includes('time')) {
305
- for (var i = 0; i < this.s.value.length; i++) {
309
+ for (i = 0; i < this.s.value.length; i++) {
306
310
  if (this.s.value[i].match(/^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])$/g) === null) {
307
311
  this.s.value[i] = '';
308
312
  }
309
313
  }
310
314
  }
311
315
  else if (this.s.type.includes('moment')) {
312
- for (var i = 0; i < this.s.value.length; i++) {
316
+ for (i = 0; i < this.s.value.length; i++) {
313
317
  if (this.s.value[i] &&
314
318
  this.s.value[i].length > 0 &&
315
319
  moment()(this.s.value[i], this.s.dateFormat, true).isValid()) {
@@ -318,7 +322,7 @@ let $ = jQuery;
318
322
  }
319
323
  }
320
324
  else if (this.s.type.includes('luxon')) {
321
- for (var i = 0; i < this.s.value.length; i++) {
325
+ for (i = 0; i < this.s.value.length; i++) {
322
326
  if (this.s.value[i] &&
323
327
  this.s.value[i].length > 0 &&
324
328
  luxon().DateTime.fromFormat(this.s.value[i], this.s.dateFormat).invalid === null) {
@@ -328,7 +332,7 @@ let $ = jQuery;
328
332
  }
329
333
  }
330
334
  if (this.s.type.includes('num') && this.s.dt.page.info().serverSide) {
331
- for (var i = 0; i < this.s.value.length; i++) {
335
+ for (i = 0; i < this.s.value.length; i++) {
332
336
  this.s.value[i] = this.s.value[i].replace(/[^0-9.\-]/g, '');
333
337
  }
334
338
  }
@@ -348,6 +352,20 @@ let $ = jQuery;
348
352
  Criteria.prototype.getNode = function () {
349
353
  return this.dom.container;
350
354
  };
355
+ /**
356
+ * Parses formatted numbers down to a form where they can be compared
357
+ *
358
+ * @param val the value to convert
359
+ * @returns the converted value
360
+ */
361
+ Criteria.prototype.parseNumber = function (val) {
362
+ var decimal = this.s.dt.i18n('decimal');
363
+ // Remove any periods and then replace the decimal with a period
364
+ if (decimal && decimal !== '.') {
365
+ val = val.replace(/\./g, '').replace(decimal, '.');
366
+ }
367
+ return +val.replace(/(?!^-)[^0-9.]/g, '');
368
+ };
351
369
  /**
352
370
  * Populates the criteria data, condition and value(s) as far as has been selected
353
371
  */
@@ -370,7 +388,7 @@ let $ = jQuery;
370
388
  Criteria.prototype.rebuild = function (loadedCriteria) {
371
389
  // Check to see if the previously selected data exists, if so select it
372
390
  var foundData = false;
373
- var dataIdx;
391
+ var dataIdx, i;
374
392
  this._populateData();
375
393
  // If a data selection has previously been made attempt to find and select it
376
394
  if (loadedCriteria.data !== undefined) {
@@ -402,8 +420,7 @@ let $ = jQuery;
402
420
  var condition = void 0;
403
421
  // Check to see if the previously selected condition exists, if so select it
404
422
  var options = this.dom.condition.children('option');
405
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
406
- for (var i = 0; i < options.length; i++) {
423
+ for (i = 0; i < options.length; i++) {
407
424
  var option = $$3(options[i]);
408
425
  if (loadedCriteria.condition !== undefined &&
409
426
  option.val() === loadedCriteria.condition &&
@@ -421,11 +438,10 @@ let $ = jQuery;
421
438
  this.dom.conditionTitle.removeProp('selected');
422
439
  this.dom.conditionTitle.remove();
423
440
  this.dom.condition.removeClass(this.classes.italic);
424
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
425
- for (var i = 0; i < options.length; i++) {
426
- var option = $$3(options[i]);
427
- if (option.val() !== this.s.condition) {
428
- option.removeProp('selected');
441
+ for (i = 0; i < options.length; i++) {
442
+ var opt = $$3(options[i]);
443
+ if (opt.val() !== this.s.condition) {
444
+ opt.removeProp('selected');
429
445
  }
430
446
  }
431
447
  this._populateValue(loadedCriteria);
@@ -446,7 +462,6 @@ let $ = jQuery;
446
462
  _this.dom.dataTitle.removeProp('selected');
447
463
  // Need to go over every option to identify the correct selection
448
464
  var options = _this.dom.data.children('option.' + _this.classes.option);
449
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
450
465
  for (var i = 0; i < options.length; i++) {
451
466
  var option = $$3(options[i]);
452
467
  if (option.val() === _this.dom.data.val()) {
@@ -481,7 +496,6 @@ let $ = jQuery;
481
496
  _this.dom.conditionTitle.removeProp('selected');
482
497
  // Need to go over every option to identify the correct selection
483
498
  var options = _this.dom.condition.children('option.' + _this.classes.option);
484
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
485
499
  for (var i = 0; i < options.length; i++) {
486
500
  var option = $$3(options[i]);
487
501
  if (option.val() === _this.dom.condition.val()) {
@@ -570,20 +584,18 @@ let $ = jQuery;
570
584
  * Clears the value elements
571
585
  */
572
586
  Criteria.prototype._clearValue = function () {
587
+ var val;
573
588
  if (this.s.condition !== undefined) {
574
589
  if (this.dom.value.length > 0 && this.dom.value[0] !== undefined) {
575
- var _loop_1 = function (val) {
590
+ // Remove all of the value elements
591
+ for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
592
+ val = _a[_i];
576
593
  if (val !== undefined) {
577
594
  // Timeout is annoying but because of IOS
578
595
  setTimeout(function () {
579
596
  val.remove();
580
597
  }, 50);
581
598
  }
582
- };
583
- // Remove all of the value elements
584
- for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
585
- var val = _a[_i];
586
- _loop_1(val);
587
599
  }
588
600
  }
589
601
  // Call the init function to get the value elements for this condition
@@ -593,27 +605,24 @@ let $ = jQuery;
593
605
  .empty()
594
606
  .append(this.dom.value[0])
595
607
  .insertAfter(this.dom.condition);
596
- this.dom.value[0].trigger('dtsb-inserted');
608
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
597
609
  // Insert all of the value elements
598
610
  for (var i = 1; i < this.dom.value.length; i++) {
599
611
  this.dom.inputCont.append(this.dom.value[i]);
600
- this.dom.value[i].trigger('dtsb-inserted');
612
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
601
613
  }
602
614
  }
603
615
  }
604
616
  else {
605
- var _loop_2 = function (val) {
617
+ // Remove all of the value elements
618
+ for (var _b = 0, _c = this.dom.value; _b < _c.length; _b++) {
619
+ val = _c[_b];
606
620
  if (val !== undefined) {
607
621
  // Timeout is annoying but because of IOS
608
622
  setTimeout(function () {
609
623
  val.remove();
610
624
  }, 50);
611
625
  }
612
- };
613
- // Remove all of the value elements
614
- for (var _b = 0, _c = this.dom.value; _b < _c.length; _b++) {
615
- var val = _c[_b];
616
- _loop_2(val);
617
626
  }
618
627
  // Append the default valueTitle to the default select element
619
628
  this.dom.valueTitle
@@ -649,9 +658,10 @@ let $ = jQuery;
649
658
  var conditionsLength = Object.keys(this.s.conditions).length;
650
659
  var colInits = this.s.dt.settings()[0].aoColumns;
651
660
  var column = +this.dom.data.children('option:selected').val();
661
+ var condition, condName;
652
662
  // If there are no conditions stored then we need to get them from the appropriate type
653
663
  if (conditionsLength === 0) {
654
- this.s.type = this.s.dt.columns().type().toArray()[column];
664
+ this.s.type = this.s.dt.column(column).type();
655
665
  if (colInits !== undefined) {
656
666
  var colInit = colInits[column];
657
667
  if (colInit.searchBuilderType !== undefined && colInit.searchBuilderType !== null) {
@@ -661,10 +671,13 @@ let $ = jQuery;
661
671
  this.s.type = colInit.sType;
662
672
  }
663
673
  }
664
- // If the column type is still unknown, call a draw to try reading it again
674
+ // If the column type is still unknown use the internal API to detect type
665
675
  if (this.s.type === null || this.s.type === undefined) {
666
- $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
667
- this.s.type = this.s.dt.columns().type().toArray()[column];
676
+ // This can only happen in DT1 - DT2 will do the invalidation of the type itself
677
+ if ($$3.fn.dataTable.ext.oApi) {
678
+ $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
679
+ }
680
+ this.s.type = this.s.dt.column(column).type();
668
681
  }
669
682
  // Enable the condition element
670
683
  this.dom.condition
@@ -701,7 +714,7 @@ let $ = jQuery;
701
714
  }
702
715
  // Add all of the conditions to the select element
703
716
  for (var _i = 0, _a = Object.keys(conditionObj); _i < _a.length; _i++) {
704
- var condition = _a[_i];
717
+ condition = _a[_i];
705
718
  if (conditionObj[condition] !== null) {
706
719
  // Serverside processing does not supply the options for the select elements
707
720
  // Instead input elements need to be used for these instead
@@ -719,7 +732,7 @@ let $ = jQuery;
719
732
  }
720
733
  }
721
734
  this.s.conditions[condition] = conditionObj[condition];
722
- var condName = conditionObj[condition].conditionName;
735
+ condName = conditionObj[condition].conditionName;
723
736
  if (typeof condName === 'function') {
724
737
  condName = condName(this.s.dt, this.c.i18n);
725
738
  }
@@ -736,18 +749,18 @@ let $ = jQuery;
736
749
  else if (conditionsLength > 0) {
737
750
  this.dom.condition.empty().removeAttr('disabled').addClass(this.classes.italic);
738
751
  for (var _b = 0, _c = Object.keys(this.s.conditions); _b < _c.length; _b++) {
739
- var condition = _c[_b];
740
- var condName = this.s.conditions[condition].conditionName;
741
- if (typeof condName === 'function') {
742
- condName = condName(this.s.dt, this.c.i18n);
752
+ condition = _c[_b];
753
+ var name_1 = this.s.conditions[condition].conditionName;
754
+ if (typeof name_1 === 'function') {
755
+ name_1 = name_1(this.s.dt, this.c.i18n);
743
756
  }
744
757
  var newOpt = $$3('<option>', {
745
- text: condName,
758
+ text: name_1,
746
759
  value: condition
747
760
  })
748
761
  .addClass(this.classes.option)
749
762
  .addClass(this.classes.notItalic);
750
- if (this.s.condition !== undefined && this.s.condition === condName) {
763
+ if (this.s.condition !== undefined && this.s.condition === name_1) {
751
764
  newOpt.prop('selected', true);
752
765
  this.dom.condition.removeClass(this.classes.italic);
753
766
  }
@@ -779,7 +792,7 @@ let $ = jQuery;
779
792
  // Need to check against the stored conditions so we can match the token "cond" to the option
780
793
  for (var _e = 0, _f = Object.keys(this.s.conditions); _e < _f.length; _e++) {
781
794
  var cond = _f[_e];
782
- var condName = this.s.conditions[cond].conditionName;
795
+ condName = this.s.conditions[cond].conditionName;
783
796
  if (
784
797
  // If the conditionName matches the text of the option
785
798
  (typeof condName === 'string' ? condName : condName(this.s.dt, this.c.i18n)) ===
@@ -842,13 +855,14 @@ let $ = jQuery;
842
855
  Criteria.prototype._populateValue = function (loadedCriteria) {
843
856
  var _this = this;
844
857
  var prevFilled = this.s.filled;
858
+ var i;
845
859
  this.s.filled = false;
846
860
  // Remove any previous value elements
847
861
  // Timeout is annoying but because of IOS
848
862
  setTimeout(function () {
849
863
  _this.dom.defaultValue.remove();
850
864
  }, 50);
851
- var _loop_3 = function (val) {
865
+ var _loop_1 = function (val) {
852
866
  // Timeout is annoying but because of IOS
853
867
  setTimeout(function () {
854
868
  if (val !== undefined) {
@@ -858,12 +872,11 @@ let $ = jQuery;
858
872
  };
859
873
  for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
860
874
  var val = _a[_i];
861
- _loop_3(val);
875
+ _loop_1(val);
862
876
  }
863
877
  var children = this.dom.inputCont.children();
864
878
  if (children.length > 1) {
865
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
866
- for (var i = 0; i < children.length; i++) {
879
+ for (i = 0; i < children.length; i++) {
867
880
  $$3(children[i]).remove();
868
881
  }
869
882
  }
@@ -883,12 +896,12 @@ let $ = jQuery;
883
896
  this.dom.inputCont.empty();
884
897
  // Insert value elements and trigger the inserted event
885
898
  if (this.dom.value[0] !== undefined) {
886
- this.dom.value[0]
899
+ $$3(this.dom.value[0])
887
900
  .appendTo(this.dom.inputCont)
888
901
  .trigger('dtsb-inserted');
889
902
  }
890
- for (var i = 1; i < this.dom.value.length; i++) {
891
- this.dom.value[i]
903
+ for (i = 1; i < this.dom.value.length; i++) {
904
+ $$3(this.dom.value[i])
892
905
  .insertAfter(this.dom.value[i - 1])
893
906
  .trigger('dtsb-inserted');
894
907
  }
@@ -968,7 +981,7 @@ let $ = jQuery;
968
981
  if (array === void 0) { array = false; }
969
982
  var column = that.dom.data.children('option:selected').val();
970
983
  var indexArray = that.s.dt.rows().indexes().toArray();
971
- var settings = that.s.dt.settings()[0];
984
+ var fastData = that.s.dt.settings()[0].fastData;
972
985
  that.dom.valueTitle.prop('selected', true);
973
986
  // Declare select element to be used with all of the default classes and listeners.
974
987
  var el = $$3('<select/>')
@@ -990,7 +1003,7 @@ let $ = jQuery;
990
1003
  // Only add one option for each possible value
991
1004
  for (var _i = 0, indexArray_1 = indexArray; _i < indexArray_1.length; _i++) {
992
1005
  var index = indexArray_1[_i];
993
- var filter = settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1006
+ var filter = fastData(index, column, typeof that.c.orthogonal === 'string' ?
994
1007
  that.c.orthogonal :
995
1008
  that.c.orthogonal.search);
996
1009
  var value = {
@@ -998,7 +1011,7 @@ let $ = jQuery;
998
1011
  filter.replace(/[\r\n\u2028]/g, ' ') : // Need to replace certain characters to match search values
999
1012
  filter,
1000
1013
  index: index,
1001
- text: settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1014
+ text: fastData(index, column, typeof that.c.orthogonal === 'string' ?
1002
1015
  that.c.orthogonal :
1003
1016
  that.c.orthogonal.display)
1004
1017
  };
@@ -1291,14 +1304,14 @@ let $ = jQuery;
1291
1304
  i18n: i18n
1292
1305
  })
1293
1306
  .on('change.dtsb', searchDelay !== null ?
1294
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1307
+ DataTable.util.throttle(function () {
1295
1308
  return fn(that, this);
1296
1309
  }, searchDelay) :
1297
1310
  function () {
1298
1311
  fn(that, _this);
1299
1312
  })
1300
1313
  .on('input.dtsb keypress.dtsb', function (e) {
1301
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1314
+ DataTable.util.throttle(function () {
1302
1315
  var code = e.keyCode || e.which;
1303
1316
  return fn(that, this, code);
1304
1317
  }, searchDelay === null ? 0 : searchDelay);
@@ -1315,7 +1328,7 @@ let $ = jQuery;
1315
1328
  i18n: i18n
1316
1329
  })
1317
1330
  .on('change.dtsb', searchDelay !== null ?
1318
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1331
+ DataTable.util.throttle(function () {
1319
1332
  return fn(that, this);
1320
1333
  }, searchDelay) :
1321
1334
  function () {
@@ -1325,7 +1338,7 @@ let $ = jQuery;
1325
1338
  !(that.s.dt.settings()[0].oInit.search !== undefined &&
1326
1339
  that.s.dt.settings()[0].oInit.search["return"]) &&
1327
1340
  searchDelay !== null ?
1328
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1341
+ DataTable.util.throttle(function () {
1329
1342
  return fn(that, this);
1330
1343
  }, searchDelay) :
1331
1344
  function (e) {
@@ -1415,6 +1428,7 @@ let $ = jQuery;
1415
1428
  // When the value is changed the criteria is now complete so can be included in searches
1416
1429
  // Get the condition from the map based on the key that has been selected for the condition
1417
1430
  var condition = that.s.conditions[that.s.condition];
1431
+ var i;
1418
1432
  that.s.filled = condition.isInputValid(that.dom.value, that);
1419
1433
  that.s.value = condition.inputValue(that.dom.value, that);
1420
1434
  if (!that.s.filled) {
@@ -1429,31 +1443,16 @@ let $ = jQuery;
1429
1443
  if (!Array.isArray(that.s.value)) {
1430
1444
  that.s.value = [that.s.value];
1431
1445
  }
1432
- for (var i = 0; i < that.s.value.length; i++) {
1446
+ for (i = 0; i < that.s.value.length; i++) {
1433
1447
  // If the value is an array we need to sort it
1434
1448
  if (Array.isArray(that.s.value[i])) {
1435
1449
  that.s.value[i].sort();
1436
1450
  }
1437
- // Otherwise replace the decimal place character for i18n
1438
- else if (that.s.type.includes('num') &&
1439
- (that.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
1440
- that.s.dt.settings()[0].oLanguage.sThousands !== '')) {
1441
- var splitRD = [that.s.value[i].toString()];
1442
- if (that.s.dt.settings()[0].oLanguage.sDecimal !== '') {
1443
- splitRD = that.s.value[i].split(that.s.dt.settings()[0].oLanguage.sDecimal);
1444
- }
1445
- if (that.s.dt.settings()[0].oLanguage.sThousands !== '') {
1446
- for (var j = 0; j < splitRD.length; j++) {
1447
- splitRD[j] = splitRD[j].replace(that.s.dt.settings()[0].oLanguage.sThousands, ',');
1448
- }
1449
- }
1450
- that.s.value[i] = splitRD.join('.');
1451
- }
1452
1451
  }
1453
1452
  // Take note of the cursor position so that we can refocus there later
1454
1453
  var idx = null;
1455
1454
  var cursorPos = null;
1456
- for (var i = 0; i < that.dom.value.length; i++) {
1455
+ for (i = 0; i < that.dom.value.length; i++) {
1457
1456
  if (el === that.dom.value[i][0]) {
1458
1457
  idx = i;
1459
1458
  if (el.selectionStart !== undefined) {
@@ -1480,7 +1479,6 @@ let $ = jQuery;
1480
1479
  // The order of the conditions will make eslint sad :(
1481
1480
  // Has to be in this order so that they are displayed correctly in select elements
1482
1481
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1483
- // eslint-disable-next-line @typescript-eslint/member-ordering
1484
1482
  Criteria.dateConditions = {
1485
1483
  '=': {
1486
1484
  conditionName: function (dt, i18n) {
@@ -1494,7 +1492,6 @@ let $ = jQuery;
1494
1492
  return value === comparison[0];
1495
1493
  }
1496
1494
  },
1497
- // eslint-disable-next-line sort-keys
1498
1495
  '!=': {
1499
1496
  conditionName: function (dt, i18n) {
1500
1497
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1548,7 +1545,6 @@ let $ = jQuery;
1548
1545
  }
1549
1546
  }
1550
1547
  },
1551
- // eslint-disable-next-line sort-keys
1552
1548
  '!between': {
1553
1549
  conditionName: function (dt, i18n) {
1554
1550
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1581,7 +1577,6 @@ let $ = jQuery;
1581
1577
  return value === null || value === undefined || value.length === 0;
1582
1578
  }
1583
1579
  },
1584
- // eslint-disable-next-line sort-keys
1585
1580
  '!null': {
1586
1581
  conditionName: function (dt, i18n) {
1587
1582
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1601,7 +1596,6 @@ let $ = jQuery;
1601
1596
  // The order of the conditions will make eslint sad :(
1602
1597
  // Has to be in this order so that they are displayed correctly in select elements
1603
1598
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1604
- // eslint-disable-next-line @typescript-eslint/member-ordering
1605
1599
  Criteria.momentDateConditions = {
1606
1600
  '=': {
1607
1601
  conditionName: function (dt, i18n) {
@@ -1615,7 +1609,6 @@ let $ = jQuery;
1615
1609
  moment()(comparison[0], that.s.dateFormat).valueOf();
1616
1610
  }
1617
1611
  },
1618
- // eslint-disable-next-line sort-keys
1619
1612
  '!=': {
1620
1613
  conditionName: function (dt, i18n) {
1621
1614
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1669,7 +1662,6 @@ let $ = jQuery;
1669
1662
  }
1670
1663
  }
1671
1664
  },
1672
- // eslint-disable-next-line sort-keys
1673
1665
  '!between': {
1674
1666
  conditionName: function (dt, i18n) {
1675
1667
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1704,7 +1696,6 @@ let $ = jQuery;
1704
1696
  return value === null || value === undefined || value.length === 0;
1705
1697
  }
1706
1698
  },
1707
- // eslint-disable-next-line sort-keys
1708
1699
  '!null': {
1709
1700
  conditionName: function (dt, i18n) {
1710
1701
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1724,7 +1715,6 @@ let $ = jQuery;
1724
1715
  // The order of the conditions will make eslint sad :(
1725
1716
  // Has to be in this order so that they are displayed correctly in select elements
1726
1717
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1727
- // eslint-disable-next-line @typescript-eslint/member-ordering
1728
1718
  Criteria.luxonDateConditions = {
1729
1719
  '=': {
1730
1720
  conditionName: function (dt, i18n) {
@@ -1738,7 +1728,6 @@ let $ = jQuery;
1738
1728
  === luxon().DateTime.fromFormat(comparison[0], that.s.dateFormat).ts;
1739
1729
  }
1740
1730
  },
1741
- // eslint-disable-next-line sort-keys
1742
1731
  '!=': {
1743
1732
  conditionName: function (dt, i18n) {
1744
1733
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1794,7 +1783,6 @@ let $ = jQuery;
1794
1783
  }
1795
1784
  }
1796
1785
  },
1797
- // eslint-disable-next-line sort-keys
1798
1786
  '!between': {
1799
1787
  conditionName: function (dt, i18n) {
1800
1788
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1829,7 +1817,6 @@ let $ = jQuery;
1829
1817
  return value === null || value === undefined || value.length === 0;
1830
1818
  }
1831
1819
  },
1832
- // eslint-disable-next-line sort-keys
1833
1820
  '!null': {
1834
1821
  conditionName: function (dt, i18n) {
1835
1822
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1849,7 +1836,6 @@ let $ = jQuery;
1849
1836
  // The order of the conditions will make eslint sad :(
1850
1837
  // Has to be in this order so that they are displayed correctly in select elements
1851
1838
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1852
- // eslint-disable-next-line @typescript-eslint/member-ordering
1853
1839
  Criteria.numConditions = {
1854
1840
  '=': {
1855
1841
  conditionName: function (dt, i18n) {
@@ -1862,7 +1848,6 @@ let $ = jQuery;
1862
1848
  return +value === +comparison[0];
1863
1849
  }
1864
1850
  },
1865
- // eslint-disable-next-line sort-keys
1866
1851
  '!=': {
1867
1852
  conditionName: function (dt, i18n) {
1868
1853
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -1907,7 +1892,6 @@ let $ = jQuery;
1907
1892
  return +value >= +comparison[0];
1908
1893
  }
1909
1894
  },
1910
- // eslint-disable-next-line sort-keys
1911
1895
  '>': {
1912
1896
  conditionName: function (dt, i18n) {
1913
1897
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -1935,7 +1919,6 @@ let $ = jQuery;
1935
1919
  }
1936
1920
  }
1937
1921
  },
1938
- // eslint-disable-next-line sort-keys
1939
1922
  '!between': {
1940
1923
  conditionName: function (dt, i18n) {
1941
1924
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -1967,7 +1950,6 @@ let $ = jQuery;
1967
1950
  return value === null || value === undefined || value.length === 0;
1968
1951
  }
1969
1952
  },
1970
- // eslint-disable-next-line sort-keys
1971
1953
  '!null': {
1972
1954
  conditionName: function (dt, i18n) {
1973
1955
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -1987,7 +1969,6 @@ let $ = jQuery;
1987
1969
  // The order of the conditions will make eslint sad :(
1988
1970
  // Has to be in this order so that they are displayed correctly in select elements
1989
1971
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1990
- // eslint-disable-next-line @typescript-eslint/member-ordering
1991
1972
  Criteria.numFmtConditions = {
1992
1973
  '=': {
1993
1974
  conditionName: function (dt, i18n) {
@@ -1996,11 +1977,10 @@ let $ = jQuery;
1996
1977
  init: Criteria.initSelect,
1997
1978
  inputValue: Criteria.inputValueSelect,
1998
1979
  isInputValid: Criteria.isInputValidSelect,
1999
- search: function (value, comparison) {
2000
- return Criteria.parseNumFmt(value) === Criteria.parseNumFmt(comparison[0]);
1980
+ search: function (value, comparison, criteria) {
1981
+ return criteria.parseNumber(value) === criteria.parseNumber(comparison[0]);
2001
1982
  }
2002
1983
  },
2003
- // eslint-disable-next-line sort-keys
2004
1984
  '!=': {
2005
1985
  conditionName: function (dt, i18n) {
2006
1986
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -2008,8 +1988,8 @@ let $ = jQuery;
2008
1988
  init: Criteria.initSelect,
2009
1989
  inputValue: Criteria.inputValueSelect,
2010
1990
  isInputValid: Criteria.isInputValidSelect,
2011
- search: function (value, comparison) {
2012
- return Criteria.parseNumFmt(value) !== Criteria.parseNumFmt(comparison[0]);
1991
+ search: function (value, comparison, criteria) {
1992
+ return criteria.parseNumber(value) !== criteria.parseNumber(comparison[0]);
2013
1993
  }
2014
1994
  },
2015
1995
  '<': {
@@ -2019,8 +1999,8 @@ let $ = jQuery;
2019
1999
  init: Criteria.initInput,
2020
2000
  inputValue: Criteria.inputValueInput,
2021
2001
  isInputValid: Criteria.isInputValidInput,
2022
- search: function (value, comparison) {
2023
- return Criteria.parseNumFmt(value) < Criteria.parseNumFmt(comparison[0]);
2002
+ search: function (value, comparison, criteria) {
2003
+ return criteria.parseNumber(value) < criteria.parseNumber(comparison[0]);
2024
2004
  }
2025
2005
  },
2026
2006
  '<=': {
@@ -2030,8 +2010,8 @@ let $ = jQuery;
2030
2010
  init: Criteria.initInput,
2031
2011
  inputValue: Criteria.inputValueInput,
2032
2012
  isInputValid: Criteria.isInputValidInput,
2033
- search: function (value, comparison) {
2034
- return Criteria.parseNumFmt(value) <= Criteria.parseNumFmt(comparison[0]);
2013
+ search: function (value, comparison, criteria) {
2014
+ return criteria.parseNumber(value) <= criteria.parseNumber(comparison[0]);
2035
2015
  }
2036
2016
  },
2037
2017
  '>=': {
@@ -2041,11 +2021,10 @@ let $ = jQuery;
2041
2021
  init: Criteria.initInput,
2042
2022
  inputValue: Criteria.inputValueInput,
2043
2023
  isInputValid: Criteria.isInputValidInput,
2044
- search: function (value, comparison) {
2045
- return Criteria.parseNumFmt(value) >= Criteria.parseNumFmt(comparison[0]);
2024
+ search: function (value, comparison, criteria) {
2025
+ return criteria.parseNumber(value) >= criteria.parseNumber(comparison[0]);
2046
2026
  }
2047
2027
  },
2048
- // eslint-disable-next-line sort-keys
2049
2028
  '>': {
2050
2029
  conditionName: function (dt, i18n) {
2051
2030
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -2053,8 +2032,8 @@ let $ = jQuery;
2053
2032
  init: Criteria.initInput,
2054
2033
  inputValue: Criteria.inputValueInput,
2055
2034
  isInputValid: Criteria.isInputValidInput,
2056
- search: function (value, comparison) {
2057
- return Criteria.parseNumFmt(value) > Criteria.parseNumFmt(comparison[0]);
2035
+ search: function (value, comparison, criteria) {
2036
+ return criteria.parseNumber(value) > criteria.parseNumber(comparison[0]);
2058
2037
  }
2059
2038
  },
2060
2039
  'between': {
@@ -2064,10 +2043,10 @@ let $ = jQuery;
2064
2043
  init: Criteria.init2Input,
2065
2044
  inputValue: Criteria.inputValueInput,
2066
2045
  isInputValid: Criteria.isInputValidInput,
2067
- search: function (value, comparison) {
2068
- var val = Criteria.parseNumFmt(value);
2069
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2070
- var comp1 = Criteria.parseNumFmt(comparison[1]);
2046
+ search: function (value, comparison, criteria) {
2047
+ var val = criteria.parseNumber(value);
2048
+ var comp0 = criteria.parseNumber(comparison[0]);
2049
+ var comp1 = criteria.parseNumber(comparison[1]);
2071
2050
  if (+comp0 < +comp1) {
2072
2051
  return +comp0 <= +val && +val <= +comp1;
2073
2052
  }
@@ -2076,7 +2055,6 @@ let $ = jQuery;
2076
2055
  }
2077
2056
  }
2078
2057
  },
2079
- // eslint-disable-next-line sort-keys
2080
2058
  '!between': {
2081
2059
  conditionName: function (dt, i18n) {
2082
2060
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -2084,10 +2062,10 @@ let $ = jQuery;
2084
2062
  init: Criteria.init2Input,
2085
2063
  inputValue: Criteria.inputValueInput,
2086
2064
  isInputValid: Criteria.isInputValidInput,
2087
- search: function (value, comparison) {
2088
- var val = Criteria.parseNumFmt(value);
2089
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2090
- var comp1 = Criteria.parseNumFmt(comparison[1]);
2065
+ search: function (value, comparison, criteria) {
2066
+ var val = criteria.parseNumber(value);
2067
+ var comp0 = criteria.parseNumber(comparison[0]);
2068
+ var comp1 = criteria.parseNumber(comparison[1]);
2091
2069
  if (+comp0 < +comp1) {
2092
2070
  return !(+comp0 <= +val && +val <= +comp1);
2093
2071
  }
@@ -2111,7 +2089,6 @@ let $ = jQuery;
2111
2089
  return value === null || value === undefined || value.length === 0;
2112
2090
  }
2113
2091
  },
2114
- // eslint-disable-next-line sort-keys
2115
2092
  '!null': {
2116
2093
  conditionName: function (dt, i18n) {
2117
2094
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -2131,7 +2108,6 @@ let $ = jQuery;
2131
2108
  // The order of the conditions will make eslint sad :(
2132
2109
  // Has to be in this order so that they are displayed correctly in select elements
2133
2110
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2134
- // eslint-disable-next-line @typescript-eslint/member-ordering
2135
2111
  Criteria.stringConditions = {
2136
2112
  '=': {
2137
2113
  conditionName: function (dt, i18n) {
@@ -2144,7 +2120,6 @@ let $ = jQuery;
2144
2120
  return value === comparison[0];
2145
2121
  }
2146
2122
  },
2147
- // eslint-disable-next-line sort-keys
2148
2123
  '!=': {
2149
2124
  conditionName: function (dt, i18n) {
2150
2125
  return dt.i18n('searchBuilder.conditions.string.not', i18n.conditions.string.not);
@@ -2167,7 +2142,6 @@ let $ = jQuery;
2167
2142
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) === 0;
2168
2143
  }
2169
2144
  },
2170
- // eslint-disable-next-line sort-keys
2171
2145
  '!starts': {
2172
2146
  conditionName: function (dt, i18n) {
2173
2147
  return dt.i18n('searchBuilder.conditions.string.notStartsWith', i18n.conditions.string.notStartsWith);
@@ -2179,7 +2153,6 @@ let $ = jQuery;
2179
2153
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) !== 0;
2180
2154
  }
2181
2155
  },
2182
- // eslint-disable-next-line sort-keys
2183
2156
  'contains': {
2184
2157
  conditionName: function (dt, i18n) {
2185
2158
  return dt.i18n('searchBuilder.conditions.string.contains', i18n.conditions.string.contains);
@@ -2191,7 +2164,6 @@ let $ = jQuery;
2191
2164
  return value.toLowerCase().includes(comparison[0].toLowerCase());
2192
2165
  }
2193
2166
  },
2194
- // eslint-disable-next-line sort-keys
2195
2167
  '!contains': {
2196
2168
  conditionName: function (dt, i18n) {
2197
2169
  return dt.i18n('searchBuilder.conditions.string.notContains', i18n.conditions.string.notContains);
@@ -2214,7 +2186,6 @@ let $ = jQuery;
2214
2186
  return value.toLowerCase().endsWith(comparison[0].toLowerCase());
2215
2187
  }
2216
2188
  },
2217
- // eslint-disable-next-line sort-keys
2218
2189
  '!ends': {
2219
2190
  conditionName: function (dt, i18n) {
2220
2191
  return dt.i18n('searchBuilder.conditions.string.notEndsWith', i18n.conditions.string.notEndsWith);
@@ -2241,7 +2212,6 @@ let $ = jQuery;
2241
2212
  return value === null || value === undefined || value.length === 0;
2242
2213
  }
2243
2214
  },
2244
- // eslint-disable-next-line sort-keys
2245
2215
  '!null': {
2246
2216
  conditionName: function (dt, i18n) {
2247
2217
  return dt.i18n('searchBuilder.conditions.string.notEmpty', i18n.conditions.string.notEmpty);
@@ -2260,7 +2230,6 @@ let $ = jQuery;
2260
2230
  };
2261
2231
  // The order of the conditions will make eslint sad :(
2262
2232
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2263
- // eslint-disable-next-line @typescript-eslint/member-ordering
2264
2233
  Criteria.arrayConditions = {
2265
2234
  'contains': {
2266
2235
  conditionName: function (dt, i18n) {
@@ -2284,7 +2253,6 @@ let $ = jQuery;
2284
2253
  return value.indexOf(comparison[0]) === -1;
2285
2254
  }
2286
2255
  },
2287
- // eslint-disable-next-line sort-keys
2288
2256
  '=': {
2289
2257
  conditionName: function (dt, i18n) {
2290
2258
  return dt.i18n('searchBuilder.conditions.array.equals', i18n.conditions.array.equals);
@@ -2304,7 +2272,6 @@ let $ = jQuery;
2304
2272
  return false;
2305
2273
  }
2306
2274
  },
2307
- // eslint-disable-next-line sort-keys
2308
2275
  '!=': {
2309
2276
  conditionName: function (dt, i18n) {
2310
2277
  return dt.i18n('searchBuilder.conditions.array.not', i18n.conditions.array.not);
@@ -2339,7 +2306,6 @@ let $ = jQuery;
2339
2306
  return value === null || value === undefined || value.length === 0;
2340
2307
  }
2341
2308
  },
2342
- // eslint-disable-next-line sort-keys
2343
2309
  '!null': {
2344
2310
  conditionName: function (dt, i18n) {
2345
2311
  return dt.i18n('searchBuilder.conditions.array.notEmpty', i18n.conditions.array.notEmpty);
@@ -2358,7 +2324,6 @@ let $ = jQuery;
2358
2324
  };
2359
2325
  // eslint will be sad because we have to disable member ordering for this as the
2360
2326
  // private static properties used are not yet declared otherwise
2361
- // eslint-disable-next-line @typescript-eslint/member-ordering
2362
2327
  Criteria.defaults = {
2363
2328
  columns: true,
2364
2329
  conditions: {
@@ -2402,6 +2367,7 @@ let $ = jQuery;
2402
2367
  value: 'Value',
2403
2368
  valueJoiner: 'and'
2404
2369
  },
2370
+ liveSearch: true,
2405
2371
  logic: 'AND',
2406
2372
  orthogonal: {
2407
2373
  display: 'display',
@@ -2500,7 +2466,6 @@ let $ = jQuery;
2500
2466
  * Gets the details required to rebuild the group
2501
2467
  */
2502
2468
  // Eslint upset at empty object but needs to be done
2503
- // eslint-disable-next-line @typescript-eslint/ban-types
2504
2469
  Group.prototype.getDetails = function (deFormatDates) {
2505
2470
  if (deFormatDates === void 0) { deFormatDates = false; }
2506
2471
  if (this.s.criteria.length === 0) {
@@ -2531,6 +2496,7 @@ let $ = jQuery;
2531
2496
  * @param loadedDetails the details required to rebuild the group
2532
2497
  */
2533
2498
  Group.prototype.rebuild = function (loadedDetails) {
2499
+ var crit;
2534
2500
  // If no criteria are stored then just return
2535
2501
  if (loadedDetails.criteria === undefined ||
2536
2502
  loadedDetails.criteria === null ||
@@ -2544,7 +2510,7 @@ let $ = jQuery;
2544
2510
  // Add all of the criteria, be it a sub group or a criteria
2545
2511
  if (Array.isArray(loadedDetails.criteria)) {
2546
2512
  for (var _i = 0, _a = loadedDetails.criteria; _i < _a.length; _i++) {
2547
- var crit = _a[_i];
2513
+ crit = _a[_i];
2548
2514
  if (crit.logic !== undefined) {
2549
2515
  this._addPrevGroup(crit);
2550
2516
  }
@@ -2555,7 +2521,7 @@ let $ = jQuery;
2555
2521
  }
2556
2522
  // For all of the criteria children, update the arrows incase they require changing and set the listeners
2557
2523
  for (var _b = 0, _c = this.s.criteria; _b < _c.length; _b++) {
2558
- var crit = _c[_b];
2524
+ crit = _c[_b];
2559
2525
  if (crit.criteria instanceof Criteria) {
2560
2526
  crit.criteria.updateArrows(this.s.criteria.length > 1);
2561
2527
  this._setCriteriaListeners(crit.criteria);
@@ -2573,8 +2539,10 @@ let $ = jQuery;
2573
2539
  this.dom.container.children().detach();
2574
2540
  this.dom.container
2575
2541
  .append(this.dom.logicContainer)
2576
- .append(this.dom.add)
2577
- .append(this.dom.search);
2542
+ .append(this.dom.add);
2543
+ if (!this.c.liveSearch) {
2544
+ this.dom.container.append(this.dom.search);
2545
+ }
2578
2546
  // Sort the criteria by index so that they appear in the correct order
2579
2547
  this.s.criteria.sort(function (a, b) {
2580
2548
  if (a.criteria.s.index < b.criteria.s.index) {
@@ -2716,7 +2684,9 @@ let $ = jQuery;
2716
2684
  _this.s.dt.state.save();
2717
2685
  return false;
2718
2686
  });
2719
- this.dom.search.on('click.dtsb', function () {
2687
+ this.dom.search
2688
+ .off('click.dtsb')
2689
+ .on('click.dtsb', function () {
2720
2690
  _this.s.dt.draw();
2721
2691
  });
2722
2692
  for (var _i = 0, _a = this.s.criteria; _i < _a.length; _i++) {
@@ -2915,6 +2885,7 @@ let $ = jQuery;
2915
2885
  */
2916
2886
  Group.prototype._removeCriteria = function (criteria, group) {
2917
2887
  if (group === void 0) { group = false; }
2888
+ var i;
2918
2889
  // If removing a criteria and there is only then then just destroy the group
2919
2890
  if (this.s.criteria.length <= 1 && this.s.isChild) {
2920
2891
  this.destroy();
@@ -2922,7 +2893,7 @@ let $ = jQuery;
2922
2893
  else {
2923
2894
  // Otherwise splice the given criteria out and redo the indexes
2924
2895
  var last = void 0;
2925
- for (var i = 0; i < this.s.criteria.length; i++) {
2896
+ for (i = 0; i < this.s.criteria.length; i++) {
2926
2897
  if (this.s.criteria[i].index === criteria.s.index &&
2927
2898
  (!group || this.s.criteria[i].criteria instanceof Group)) {
2928
2899
  last = i;
@@ -2932,7 +2903,7 @@ let $ = jQuery;
2932
2903
  if (last !== undefined) {
2933
2904
  this.s.criteria.splice(last, 1);
2934
2905
  }
2935
- for (var i = 0; i < this.s.criteria.length; i++) {
2906
+ for (i = 0; i < this.s.criteria.length; i++) {
2936
2907
  this.s.criteria[i].index = i;
2937
2908
  this.s.criteria[i].criteria.s.index = i;
2938
2909
  }
@@ -3073,9 +3044,10 @@ let $ = jQuery;
3073
3044
  if (this.s.isChild) {
3074
3045
  this.dom.container.append(this.dom.logicContainer);
3075
3046
  }
3076
- this.dom.container
3077
- .append(this.dom.add)
3078
- .append(this.dom.search);
3047
+ this.dom.container.append(this.dom.add);
3048
+ if (!this.c.liveSearch) {
3049
+ this.dom.container.append(this.dom.search);
3050
+ }
3079
3051
  };
3080
3052
  /**
3081
3053
  * Sets the listener for the logic button
@@ -3251,7 +3223,6 @@ let $ = jQuery;
3251
3223
  * Gets the details required to rebuild the SearchBuilder as it currently is
3252
3224
  */
3253
3225
  // eslint upset at empty object but that is what it is
3254
- // eslint-disable-next-line @typescript-eslint/ban-types
3255
3226
  SearchBuilder.prototype.getDetails = function (deFormatDates) {
3256
3227
  if (deFormatDates === void 0) { deFormatDates = false; }
3257
3228
  return this.s.topGroup.getDetails(deFormatDates);
@@ -3321,16 +3292,19 @@ let $ = jQuery;
3321
3292
  SearchBuilder.prototype._setUp = function (loadState) {
3322
3293
  var _this = this;
3323
3294
  if (loadState === void 0) { loadState = true; }
3324
- // Register an Api method for getting the column type
3325
- $$1.fn.DataTable.Api.registerPlural('columns().type()', 'column().type()', function () {
3326
- return this.iterator('column', function (settings, column) {
3327
- return settings.aoColumns[column].sType;
3328
- }, 1);
3329
- });
3295
+ // Register an Api method for getting the column type. DataTables 2 has
3296
+ // this built in
3297
+ if (typeof this.s.dt.column().type !== 'function') {
3298
+ DataTable.Api.registerPlural('columns().types()', 'column().type()', function () {
3299
+ return this.iterator('column', function (settings, column) {
3300
+ return settings.aoColumns[column].sType;
3301
+ }, 1);
3302
+ });
3303
+ }
3330
3304
  // Check that DateTime is included, If not need to check if it could be used
3331
3305
  // eslint-disable-next-line no-extra-parens
3332
3306
  if (!dataTable$1.DateTime) {
3333
- var types = this.s.dt.columns().type().toArray();
3307
+ var types = this.s.dt.columns().types().toArray();
3334
3308
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3335
3309
  types = [];
3336
3310
  for (var _i = 0, _a = this.s.dt.settings()[0].aoColumns; _i < _a.length; _i++) {
@@ -3339,10 +3313,13 @@ let $ = jQuery;
3339
3313
  }
3340
3314
  }
3341
3315
  var columnIdxs = this.s.dt.columns().toArray();
3342
- // If the types are not yet set then draw to see if they can be retrieved then
3316
+ // If the column type is still unknown use the internal API to detect type
3343
3317
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3344
- $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3345
- types = this.s.dt.columns().type().toArray();
3318
+ // This can only happen in DT1 - DT2 will do the invalidation of the type itself
3319
+ if ($$1.fn.dataTable.ext.oApi) {
3320
+ $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3321
+ }
3322
+ types = this.s.dt.columns().types().toArray();
3346
3323
  }
3347
3324
  for (var i = 0; i < columnIdxs[0].length; i++) {
3348
3325
  var column = columnIdxs[0][i];
@@ -3381,7 +3358,9 @@ let $ = jQuery;
3381
3358
  data.searchBuilder = _this._collapseArray(_this.getDetails(true));
3382
3359
  }
3383
3360
  });
3384
- this.s.dt.on('column-reorder', function () {
3361
+ this.s.dt.on(dataTable$1.versionCheck('2')
3362
+ ? 'columns-reordered'
3363
+ : 'column-reorder', function () {
3385
3364
  _this.rebuild(_this.getDetails());
3386
3365
  });
3387
3366
  if (loadState) {
@@ -3596,7 +3575,7 @@ let $ = jQuery;
3596
3575
  _this.dom.clearAll.remove();
3597
3576
  });
3598
3577
  };
3599
- SearchBuilder.version = '1.6.0';
3578
+ SearchBuilder.version = '1.7.0';
3600
3579
  SearchBuilder.classes = {
3601
3580
  button: 'dtsb-button',
3602
3581
  clearAll: 'dtsb-clearAll',
@@ -3704,8 +3683,8 @@ let $ = jQuery;
3704
3683
  return SearchBuilder;
3705
3684
  }());
3706
3685
 
3707
- /*! SearchBuilder 1.6.0
3708
- * ©SpryMedia Ltd - datatables.net/license/mit
3686
+ /*! SearchBuilder 1.7.0
3687
+ -dev * ©SpryMedia Ltd - datatables.net/license/mit
3709
3688
  */
3710
3689
  setJQuery($);
3711
3690
  setJQuery$1($);
@@ -3815,11 +3794,11 @@ let $ = jQuery;
3815
3794
  fnInit: _init
3816
3795
  });
3817
3796
  // DataTables 2 layout feature
3818
- if (DataTable.ext.features) {
3819
- DataTable.ext.features.register('searchBuilder', _init);
3797
+ if (DataTable.feature) {
3798
+ DataTable.feature.register('searchBuilder', _init);
3820
3799
  }
3821
3800
 
3822
- }());
3801
+ })();
3823
3802
 
3824
3803
 
3825
3804
  export default DataTable;