datatables.net-searchbuilder 1.5.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.5.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
 
@@ -72,11 +72,12 @@ var DataTable = $.fn.dataTable;
72
72
  * The Criteria class is used within SearchBuilder to represent a search criteria
73
73
  */
74
74
  var Criteria = /** @class */ (function () {
75
- function Criteria(table, opts, topGroup, index, depth, serverData) {
76
- var _this = this;
75
+ function Criteria(table, opts, topGroup, index, depth, serverData, liveSearch) {
77
76
  if (index === void 0) { index = 0; }
78
77
  if (depth === void 0) { depth = 1; }
79
78
  if (serverData === void 0) { serverData = undefined; }
79
+ if (liveSearch === void 0) { liveSearch = false; }
80
+ var _this = this;
80
81
  // Check that the required version of DataTables is included
81
82
  if (!dataTable$3 || !dataTable$3.versionCheck || !dataTable$3.versionCheck('1.10.0')) {
82
83
  throw new Error('SearchPane requires DataTables 1.10 or newer');
@@ -96,6 +97,7 @@ var DataTable = $.fn.dataTable;
96
97
  dt: table,
97
98
  filled: false,
98
99
  index: index,
100
+ liveSearch: liveSearch,
99
101
  origData: undefined,
100
102
  preventRedraw: false,
101
103
  serverData: serverData,
@@ -189,7 +191,19 @@ var DataTable = $.fn.dataTable;
189
191
  .replace(/"/g, '"');
190
192
  };
191
193
  /**
192
- * Parses formatted numbers down to a form where they can be compared
194
+ * Redraw the DataTable with the current search parameters
195
+ */
196
+ Criteria.prototype.doSearch = function () {
197
+ // Only do the search if live search is disabled, otherwise the search
198
+ // is triggered by the button at the top level group.
199
+ if (this.c.liveSearch) {
200
+ this.s.dt.draw();
201
+ }
202
+ };
203
+ /**
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.
193
207
  *
194
208
  * @param val the value to convert
195
209
  * @returns the converted value
@@ -211,11 +225,11 @@ var DataTable = $.fn.dataTable;
211
225
  this.setListeners();
212
226
  // Trigger the inserted events for the value elements as they are inserted
213
227
  if (this.dom.value[0] !== undefined) {
214
- this.dom.value[0].trigger('dtsb-inserted');
228
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
215
229
  }
216
230
  for (var i = 1; i < this.dom.value.length; i++) {
217
231
  this.dom.inputCont.append(this.dom.value[i]);
218
- this.dom.value[i].trigger('dtsb-inserted');
232
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
219
233
  }
220
234
  // If this is a top level criteria then don't let it move left
221
235
  if (this.s.depth > 1) {
@@ -253,28 +267,28 @@ var DataTable = $.fn.dataTable;
253
267
  * @returns boolean Whether the criteria has passed
254
268
  */
255
269
  Criteria.prototype.search = function (rowData, rowIdx) {
270
+ var settings = this.s.dt.settings()[0];
256
271
  var condition = this.s.conditions[this.s.condition];
257
272
  if (this.s.condition !== undefined && condition !== undefined) {
258
273
  var filter = rowData[this.s.dataIdx];
259
274
  // This check is in place for if a custom decimal character is in place
260
275
  if (this.s.type.includes('num') &&
261
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
262
- this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
276
+ (settings.oLanguage.sDecimal !== '' ||
277
+ settings.oLanguage.sThousands !== '')) {
263
278
  var splitRD = [rowData[this.s.dataIdx]];
264
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
265
- 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);
266
281
  }
267
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
282
+ if (settings.oLanguage.sThousands !== '') {
268
283
  for (var i = 0; i < splitRD.length; i++) {
269
- splitRD[i] = splitRD[i].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
284
+ splitRD[i] = splitRD[i].replace(settings.oLanguage.sThousands, ',');
270
285
  }
271
286
  }
272
287
  filter = splitRD.join('.');
273
288
  }
274
289
  // If orthogonal data is in place we need to get it's values for searching
275
290
  if (this.c.orthogonal.search !== 'filter') {
276
- var settings = this.s.dt.settings()[0];
277
- 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' ?
278
292
  this.c.orthogonal :
279
293
  this.c.orthogonal.search);
280
294
  }
@@ -310,18 +324,20 @@ var DataTable = $.fn.dataTable;
310
324
  */
311
325
  Criteria.prototype.getDetails = function (deFormatDates) {
312
326
  if (deFormatDates === void 0) { deFormatDates = false; }
327
+ var i;
328
+ var settings = this.s.dt.settings()[0];
313
329
  // This check is in place for if a custom decimal character is in place
314
330
  if (this.s.type !== null &&
315
331
  this.s.type.includes('num') &&
316
- (this.s.dt.settings()[0].oLanguage.sDecimal !== '' || this.s.dt.settings()[0].oLanguage.sThousands !== '')) {
317
- 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++) {
318
334
  var splitRD = [this.s.value[i].toString()];
319
- if (this.s.dt.settings()[0].oLanguage.sDecimal !== '') {
320
- 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);
321
337
  }
322
- if (this.s.dt.settings()[0].oLanguage.sThousands !== '') {
338
+ if (settings.oLanguage.sThousands !== '') {
323
339
  for (var j = 0; j < splitRD.length; j++) {
324
- splitRD[j] = splitRD[j].replace(this.s.dt.settings()[0].oLanguage.sThousands, ',');
340
+ splitRD[j] = splitRD[j].replace(settings.oLanguage.sThousands, ',');
325
341
  }
326
342
  }
327
343
  this.s.value[i] = splitRD.join('.');
@@ -330,14 +346,14 @@ var DataTable = $.fn.dataTable;
330
346
  else if (this.s.type !== null && deFormatDates) {
331
347
  if (this.s.type.includes('date') ||
332
348
  this.s.type.includes('time')) {
333
- for (var i = 0; i < this.s.value.length; i++) {
349
+ for (i = 0; i < this.s.value.length; i++) {
334
350
  if (this.s.value[i].match(/^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])$/g) === null) {
335
351
  this.s.value[i] = '';
336
352
  }
337
353
  }
338
354
  }
339
355
  else if (this.s.type.includes('moment')) {
340
- for (var i = 0; i < this.s.value.length; i++) {
356
+ for (i = 0; i < this.s.value.length; i++) {
341
357
  if (this.s.value[i] &&
342
358
  this.s.value[i].length > 0 &&
343
359
  moment()(this.s.value[i], this.s.dateFormat, true).isValid()) {
@@ -346,7 +362,7 @@ var DataTable = $.fn.dataTable;
346
362
  }
347
363
  }
348
364
  else if (this.s.type.includes('luxon')) {
349
- for (var i = 0; i < this.s.value.length; i++) {
365
+ for (i = 0; i < this.s.value.length; i++) {
350
366
  if (this.s.value[i] &&
351
367
  this.s.value[i].length > 0 &&
352
368
  luxon().DateTime.fromFormat(this.s.value[i], this.s.dateFormat).invalid === null) {
@@ -356,7 +372,7 @@ var DataTable = $.fn.dataTable;
356
372
  }
357
373
  }
358
374
  if (this.s.type.includes('num') && this.s.dt.page.info().serverSide) {
359
- for (var i = 0; i < this.s.value.length; i++) {
375
+ for (i = 0; i < this.s.value.length; i++) {
360
376
  this.s.value[i] = this.s.value[i].replace(/[^0-9.\-]/g, '');
361
377
  }
362
378
  }
@@ -376,6 +392,20 @@ var DataTable = $.fn.dataTable;
376
392
  Criteria.prototype.getNode = function () {
377
393
  return this.dom.container;
378
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
+ };
379
409
  /**
380
410
  * Populates the criteria data, condition and value(s) as far as has been selected
381
411
  */
@@ -398,7 +428,7 @@ var DataTable = $.fn.dataTable;
398
428
  Criteria.prototype.rebuild = function (loadedCriteria) {
399
429
  // Check to see if the previously selected data exists, if so select it
400
430
  var foundData = false;
401
- var dataIdx;
431
+ var dataIdx, i;
402
432
  this._populateData();
403
433
  // If a data selection has previously been made attempt to find and select it
404
434
  if (loadedCriteria.data !== undefined) {
@@ -411,7 +441,7 @@ var DataTable = $.fn.dataTable;
411
441
  $$3(this).prop('selected', true);
412
442
  data_1.removeClass(italic_1);
413
443
  foundData = true;
414
- dataIdx = $$3(this).val();
444
+ dataIdx = parseInt($$3(this).val(), 10);
415
445
  }
416
446
  else {
417
447
  $$3(this).removeProp('selected');
@@ -430,8 +460,7 @@ var DataTable = $.fn.dataTable;
430
460
  var condition = void 0;
431
461
  // Check to see if the previously selected condition exists, if so select it
432
462
  var options = this.dom.condition.children('option');
433
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
434
- for (var i = 0; i < options.length; i++) {
463
+ for (i = 0; i < options.length; i++) {
435
464
  var option = $$3(options[i]);
436
465
  if (loadedCriteria.condition !== undefined &&
437
466
  option.val() === loadedCriteria.condition &&
@@ -449,11 +478,10 @@ var DataTable = $.fn.dataTable;
449
478
  this.dom.conditionTitle.removeProp('selected');
450
479
  this.dom.conditionTitle.remove();
451
480
  this.dom.condition.removeClass(this.classes.italic);
452
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
453
- for (var i = 0; i < options.length; i++) {
454
- var option = $$3(options[i]);
455
- if (option.val() !== this.s.condition) {
456
- 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');
457
485
  }
458
486
  }
459
487
  this._populateValue(loadedCriteria);
@@ -474,7 +502,6 @@ var DataTable = $.fn.dataTable;
474
502
  _this.dom.dataTitle.removeProp('selected');
475
503
  // Need to go over every option to identify the correct selection
476
504
  var options = _this.dom.data.children('option.' + _this.classes.option);
477
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
478
505
  for (var i = 0; i < options.length; i++) {
479
506
  var option = $$3(options[i]);
480
507
  if (option.val() === _this.dom.data.val()) {
@@ -493,7 +520,7 @@ var DataTable = $.fn.dataTable;
493
520
  // remove it from the search and trigger a new search
494
521
  if (_this.s.filled) {
495
522
  _this.s.filled = false;
496
- _this.s.dt.draw();
523
+ _this.doSearch();
497
524
  _this.setListeners();
498
525
  }
499
526
  _this.s.dt.state.save();
@@ -509,7 +536,6 @@ var DataTable = $.fn.dataTable;
509
536
  _this.dom.conditionTitle.removeProp('selected');
510
537
  // Need to go over every option to identify the correct selection
511
538
  var options = _this.dom.condition.children('option.' + _this.classes.option);
512
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
513
539
  for (var i = 0; i < options.length; i++) {
514
540
  var option = $$3(options[i]);
515
541
  if (option.val() === _this.dom.condition.val()) {
@@ -534,13 +560,13 @@ var DataTable = $.fn.dataTable;
534
560
  // it from the search and trigger a new search
535
561
  if (_this.s.filled && val !== undefined && _this.dom.inputCont.has(val[0]).length !== 0) {
536
562
  _this.s.filled = false;
537
- _this.s.dt.draw();
563
+ _this.doSearch();
538
564
  _this.setListeners();
539
565
  }
540
566
  }
541
567
  if (_this.dom.value.length === 0 ||
542
568
  _this.dom.value.length === 1 && _this.dom.value[0] === undefined) {
543
- _this.s.dt.draw();
569
+ _this.doSearch();
544
570
  }
545
571
  }
546
572
  else {
@@ -598,20 +624,18 @@ var DataTable = $.fn.dataTable;
598
624
  * Clears the value elements
599
625
  */
600
626
  Criteria.prototype._clearValue = function () {
627
+ var val;
601
628
  if (this.s.condition !== undefined) {
602
629
  if (this.dom.value.length > 0 && this.dom.value[0] !== undefined) {
603
- 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];
604
633
  if (val !== undefined) {
605
634
  // Timeout is annoying but because of IOS
606
635
  setTimeout(function () {
607
636
  val.remove();
608
637
  }, 50);
609
638
  }
610
- };
611
- // Remove all of the value elements
612
- for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
613
- var val = _a[_i];
614
- _loop_1(val);
615
639
  }
616
640
  }
617
641
  // Call the init function to get the value elements for this condition
@@ -621,27 +645,24 @@ var DataTable = $.fn.dataTable;
621
645
  .empty()
622
646
  .append(this.dom.value[0])
623
647
  .insertAfter(this.dom.condition);
624
- this.dom.value[0].trigger('dtsb-inserted');
648
+ $$3(this.dom.value[0]).trigger('dtsb-inserted');
625
649
  // Insert all of the value elements
626
650
  for (var i = 1; i < this.dom.value.length; i++) {
627
651
  this.dom.inputCont.append(this.dom.value[i]);
628
- this.dom.value[i].trigger('dtsb-inserted');
652
+ $$3(this.dom.value[i]).trigger('dtsb-inserted');
629
653
  }
630
654
  }
631
655
  }
632
656
  else {
633
- 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];
634
660
  if (val !== undefined) {
635
661
  // Timeout is annoying but because of IOS
636
662
  setTimeout(function () {
637
663
  val.remove();
638
664
  }, 50);
639
665
  }
640
- };
641
- // Remove all of the value elements
642
- for (var _b = 0, _c = this.dom.value; _b < _c.length; _b++) {
643
- var val = _c[_b];
644
- _loop_2(val);
645
666
  }
646
667
  // Append the default valueTitle to the default select element
647
668
  this.dom.valueTitle
@@ -677,9 +698,10 @@ var DataTable = $.fn.dataTable;
677
698
  var conditionsLength = Object.keys(this.s.conditions).length;
678
699
  var colInits = this.s.dt.settings()[0].aoColumns;
679
700
  var column = +this.dom.data.children('option:selected').val();
701
+ var condition, condName;
680
702
  // If there are no conditions stored then we need to get them from the appropriate type
681
703
  if (conditionsLength === 0) {
682
- this.s.type = this.s.dt.columns().type().toArray()[column];
704
+ this.s.type = this.s.dt.column(column).type();
683
705
  if (colInits !== undefined) {
684
706
  var colInit = colInits[column];
685
707
  if (colInit.searchBuilderType !== undefined && colInit.searchBuilderType !== null) {
@@ -689,10 +711,13 @@ var DataTable = $.fn.dataTable;
689
711
  this.s.type = colInit.sType;
690
712
  }
691
713
  }
692
- // 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
693
715
  if (this.s.type === null || this.s.type === undefined) {
694
- $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
695
- 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();
696
721
  }
697
722
  // Enable the condition element
698
723
  this.dom.condition
@@ -729,7 +754,7 @@ var DataTable = $.fn.dataTable;
729
754
  }
730
755
  // Add all of the conditions to the select element
731
756
  for (var _i = 0, _a = Object.keys(conditionObj); _i < _a.length; _i++) {
732
- var condition = _a[_i];
757
+ condition = _a[_i];
733
758
  if (conditionObj[condition] !== null) {
734
759
  // Serverside processing does not supply the options for the select elements
735
760
  // Instead input elements need to be used for these instead
@@ -747,7 +772,7 @@ var DataTable = $.fn.dataTable;
747
772
  }
748
773
  }
749
774
  this.s.conditions[condition] = conditionObj[condition];
750
- var condName = conditionObj[condition].conditionName;
775
+ condName = conditionObj[condition].conditionName;
751
776
  if (typeof condName === 'function') {
752
777
  condName = condName(this.s.dt, this.c.i18n);
753
778
  }
@@ -764,18 +789,18 @@ var DataTable = $.fn.dataTable;
764
789
  else if (conditionsLength > 0) {
765
790
  this.dom.condition.empty().removeAttr('disabled').addClass(this.classes.italic);
766
791
  for (var _b = 0, _c = Object.keys(this.s.conditions); _b < _c.length; _b++) {
767
- var condition = _c[_b];
768
- var condName = this.s.conditions[condition].conditionName;
769
- if (typeof condName === 'function') {
770
- 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);
771
796
  }
772
797
  var newOpt = $$3('<option>', {
773
- text: condName,
798
+ text: name_1,
774
799
  value: condition
775
800
  })
776
801
  .addClass(this.classes.option)
777
802
  .addClass(this.classes.notItalic);
778
- if (this.s.condition !== undefined && this.s.condition === condName) {
803
+ if (this.s.condition !== undefined && this.s.condition === name_1) {
779
804
  newOpt.prop('selected', true);
780
805
  this.dom.condition.removeClass(this.classes.italic);
781
806
  }
@@ -807,7 +832,7 @@ var DataTable = $.fn.dataTable;
807
832
  // Need to check against the stored conditions so we can match the token "cond" to the option
808
833
  for (var _e = 0, _f = Object.keys(this.s.conditions); _e < _f.length; _e++) {
809
834
  var cond = _f[_e];
810
- var condName = this.s.conditions[cond].conditionName;
835
+ condName = this.s.conditions[cond].conditionName;
811
836
  if (
812
837
  // If the conditionName matches the text of the option
813
838
  (typeof condName === 'string' ? condName : condName(this.s.dt, this.c.i18n)) ===
@@ -870,13 +895,14 @@ var DataTable = $.fn.dataTable;
870
895
  Criteria.prototype._populateValue = function (loadedCriteria) {
871
896
  var _this = this;
872
897
  var prevFilled = this.s.filled;
898
+ var i;
873
899
  this.s.filled = false;
874
900
  // Remove any previous value elements
875
901
  // Timeout is annoying but because of IOS
876
902
  setTimeout(function () {
877
903
  _this.dom.defaultValue.remove();
878
904
  }, 50);
879
- var _loop_3 = function (val) {
905
+ var _loop_1 = function (val) {
880
906
  // Timeout is annoying but because of IOS
881
907
  setTimeout(function () {
882
908
  if (val !== undefined) {
@@ -886,12 +912,11 @@ var DataTable = $.fn.dataTable;
886
912
  };
887
913
  for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
888
914
  var val = _a[_i];
889
- _loop_3(val);
915
+ _loop_1(val);
890
916
  }
891
917
  var children = this.dom.inputCont.children();
892
918
  if (children.length > 1) {
893
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
894
- for (var i = 0; i < children.length; i++) {
919
+ for (i = 0; i < children.length; i++) {
895
920
  $$3(children[i]).remove();
896
921
  }
897
922
  }
@@ -911,12 +936,12 @@ var DataTable = $.fn.dataTable;
911
936
  this.dom.inputCont.empty();
912
937
  // Insert value elements and trigger the inserted event
913
938
  if (this.dom.value[0] !== undefined) {
914
- this.dom.value[0]
939
+ $$3(this.dom.value[0])
915
940
  .appendTo(this.dom.inputCont)
916
941
  .trigger('dtsb-inserted');
917
942
  }
918
- for (var i = 1; i < this.dom.value.length; i++) {
919
- this.dom.value[i]
943
+ for (i = 1; i < this.dom.value.length; i++) {
944
+ $$3(this.dom.value[i])
920
945
  .insertAfter(this.dom.value[i - 1])
921
946
  .trigger('dtsb-inserted');
922
947
  }
@@ -928,7 +953,7 @@ var DataTable = $.fn.dataTable;
928
953
  // If using SSP we want to restrict the amount of server calls that take place
929
954
  // and this will already have taken place
930
955
  if (!this.s.dt.page.info().serverSide) {
931
- this.s.dt.draw();
956
+ this.doSearch();
932
957
  }
933
958
  this.setListeners();
934
959
  }
@@ -996,7 +1021,7 @@ var DataTable = $.fn.dataTable;
996
1021
  if (array === void 0) { array = false; }
997
1022
  var column = that.dom.data.children('option:selected').val();
998
1023
  var indexArray = that.s.dt.rows().indexes().toArray();
999
- var settings = that.s.dt.settings()[0];
1024
+ var fastData = that.s.dt.settings()[0].fastData;
1000
1025
  that.dom.valueTitle.prop('selected', true);
1001
1026
  // Declare select element to be used with all of the default classes and listeners.
1002
1027
  var el = $$3('<select/>')
@@ -1018,7 +1043,7 @@ var DataTable = $.fn.dataTable;
1018
1043
  // Only add one option for each possible value
1019
1044
  for (var _i = 0, indexArray_1 = indexArray; _i < indexArray_1.length; _i++) {
1020
1045
  var index = indexArray_1[_i];
1021
- var filter = settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1046
+ var filter = fastData(index, column, typeof that.c.orthogonal === 'string' ?
1022
1047
  that.c.orthogonal :
1023
1048
  that.c.orthogonal.search);
1024
1049
  var value = {
@@ -1026,7 +1051,7 @@ var DataTable = $.fn.dataTable;
1026
1051
  filter.replace(/[\r\n\u2028]/g, ' ') : // Need to replace certain characters to match search values
1027
1052
  filter,
1028
1053
  index: index,
1029
- text: settings.oApi._fnGetCellData(settings, index, column, typeof that.c.orthogonal === 'string' ?
1054
+ text: fastData(index, column, typeof that.c.orthogonal === 'string' ?
1030
1055
  that.c.orthogonal :
1031
1056
  that.c.orthogonal.display)
1032
1057
  };
@@ -1319,14 +1344,14 @@ var DataTable = $.fn.dataTable;
1319
1344
  i18n: i18n
1320
1345
  })
1321
1346
  .on('change.dtsb', searchDelay !== null ?
1322
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1347
+ DataTable.util.throttle(function () {
1323
1348
  return fn(that, this);
1324
1349
  }, searchDelay) :
1325
1350
  function () {
1326
1351
  fn(that, _this);
1327
1352
  })
1328
1353
  .on('input.dtsb keypress.dtsb', function (e) {
1329
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1354
+ DataTable.util.throttle(function () {
1330
1355
  var code = e.keyCode || e.which;
1331
1356
  return fn(that, this, code);
1332
1357
  }, searchDelay === null ? 0 : searchDelay);
@@ -1343,7 +1368,7 @@ var DataTable = $.fn.dataTable;
1343
1368
  i18n: i18n
1344
1369
  })
1345
1370
  .on('change.dtsb', searchDelay !== null ?
1346
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1371
+ DataTable.util.throttle(function () {
1347
1372
  return fn(that, this);
1348
1373
  }, searchDelay) :
1349
1374
  function () {
@@ -1353,7 +1378,7 @@ var DataTable = $.fn.dataTable;
1353
1378
  !(that.s.dt.settings()[0].oInit.search !== undefined &&
1354
1379
  that.s.dt.settings()[0].oInit.search["return"]) &&
1355
1380
  searchDelay !== null ?
1356
- that.s.dt.settings()[0].oApi._fnThrottle(function () {
1381
+ DataTable.util.throttle(function () {
1357
1382
  return fn(that, this);
1358
1383
  }, searchDelay) :
1359
1384
  function (e) {
@@ -1443,6 +1468,7 @@ var DataTable = $.fn.dataTable;
1443
1468
  // When the value is changed the criteria is now complete so can be included in searches
1444
1469
  // Get the condition from the map based on the key that has been selected for the condition
1445
1470
  var condition = that.s.conditions[that.s.condition];
1471
+ var i;
1446
1472
  that.s.filled = condition.isInputValid(that.dom.value, that);
1447
1473
  that.s.value = condition.inputValue(that.dom.value, that);
1448
1474
  if (!that.s.filled) {
@@ -1450,38 +1476,23 @@ var DataTable = $.fn.dataTable;
1450
1476
  !(that.s.dt.settings()[0].oInit.search !== undefined &&
1451
1477
  that.s.dt.settings()[0].oInit.search["return"]) ||
1452
1478
  code === 13) {
1453
- that.s.dt.draw();
1479
+ that.doSearch();
1454
1480
  }
1455
1481
  return;
1456
1482
  }
1457
1483
  if (!Array.isArray(that.s.value)) {
1458
1484
  that.s.value = [that.s.value];
1459
1485
  }
1460
- for (var i = 0; i < that.s.value.length; i++) {
1486
+ for (i = 0; i < that.s.value.length; i++) {
1461
1487
  // If the value is an array we need to sort it
1462
1488
  if (Array.isArray(that.s.value[i])) {
1463
1489
  that.s.value[i].sort();
1464
1490
  }
1465
- // Otherwise replace the decimal place character for i18n
1466
- else if (that.s.type.includes('num') &&
1467
- (that.s.dt.settings()[0].oLanguage.sDecimal !== '' ||
1468
- that.s.dt.settings()[0].oLanguage.sThousands !== '')) {
1469
- var splitRD = [that.s.value[i].toString()];
1470
- if (that.s.dt.settings()[0].oLanguage.sDecimal !== '') {
1471
- splitRD = that.s.value[i].split(that.s.dt.settings()[0].oLanguage.sDecimal);
1472
- }
1473
- if (that.s.dt.settings()[0].oLanguage.sThousands !== '') {
1474
- for (var j = 0; j < splitRD.length; j++) {
1475
- splitRD[j] = splitRD[j].replace(that.s.dt.settings()[0].oLanguage.sThousands, ',');
1476
- }
1477
- }
1478
- that.s.value[i] = splitRD.join('.');
1479
- }
1480
1491
  }
1481
1492
  // Take note of the cursor position so that we can refocus there later
1482
1493
  var idx = null;
1483
1494
  var cursorPos = null;
1484
- for (var i = 0; i < that.dom.value.length; i++) {
1495
+ for (i = 0; i < that.dom.value.length; i++) {
1485
1496
  if (el === that.dom.value[i][0]) {
1486
1497
  idx = i;
1487
1498
  if (el.selectionStart !== undefined) {
@@ -1494,7 +1505,7 @@ var DataTable = $.fn.dataTable;
1494
1505
  that.s.dt.settings()[0].oInit.search["return"]) ||
1495
1506
  code === 13) {
1496
1507
  // Trigger a search
1497
- that.s.dt.draw();
1508
+ that.doSearch();
1498
1509
  }
1499
1510
  // Refocus the element and set the correct cursor position
1500
1511
  if (idx !== null) {
@@ -1508,7 +1519,6 @@ var DataTable = $.fn.dataTable;
1508
1519
  // The order of the conditions will make eslint sad :(
1509
1520
  // Has to be in this order so that they are displayed correctly in select elements
1510
1521
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1511
- // eslint-disable-next-line @typescript-eslint/member-ordering
1512
1522
  Criteria.dateConditions = {
1513
1523
  '=': {
1514
1524
  conditionName: function (dt, i18n) {
@@ -1522,7 +1532,6 @@ var DataTable = $.fn.dataTable;
1522
1532
  return value === comparison[0];
1523
1533
  }
1524
1534
  },
1525
- // eslint-disable-next-line sort-keys
1526
1535
  '!=': {
1527
1536
  conditionName: function (dt, i18n) {
1528
1537
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1576,7 +1585,6 @@ var DataTable = $.fn.dataTable;
1576
1585
  }
1577
1586
  }
1578
1587
  },
1579
- // eslint-disable-next-line sort-keys
1580
1588
  '!between': {
1581
1589
  conditionName: function (dt, i18n) {
1582
1590
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1609,7 +1617,6 @@ var DataTable = $.fn.dataTable;
1609
1617
  return value === null || value === undefined || value.length === 0;
1610
1618
  }
1611
1619
  },
1612
- // eslint-disable-next-line sort-keys
1613
1620
  '!null': {
1614
1621
  conditionName: function (dt, i18n) {
1615
1622
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1629,7 +1636,6 @@ var DataTable = $.fn.dataTable;
1629
1636
  // The order of the conditions will make eslint sad :(
1630
1637
  // Has to be in this order so that they are displayed correctly in select elements
1631
1638
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1632
- // eslint-disable-next-line @typescript-eslint/member-ordering
1633
1639
  Criteria.momentDateConditions = {
1634
1640
  '=': {
1635
1641
  conditionName: function (dt, i18n) {
@@ -1643,7 +1649,6 @@ var DataTable = $.fn.dataTable;
1643
1649
  moment()(comparison[0], that.s.dateFormat).valueOf();
1644
1650
  }
1645
1651
  },
1646
- // eslint-disable-next-line sort-keys
1647
1652
  '!=': {
1648
1653
  conditionName: function (dt, i18n) {
1649
1654
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1697,7 +1702,6 @@ var DataTable = $.fn.dataTable;
1697
1702
  }
1698
1703
  }
1699
1704
  },
1700
- // eslint-disable-next-line sort-keys
1701
1705
  '!between': {
1702
1706
  conditionName: function (dt, i18n) {
1703
1707
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1732,7 +1736,6 @@ var DataTable = $.fn.dataTable;
1732
1736
  return value === null || value === undefined || value.length === 0;
1733
1737
  }
1734
1738
  },
1735
- // eslint-disable-next-line sort-keys
1736
1739
  '!null': {
1737
1740
  conditionName: function (dt, i18n) {
1738
1741
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1752,7 +1755,6 @@ var DataTable = $.fn.dataTable;
1752
1755
  // The order of the conditions will make eslint sad :(
1753
1756
  // Has to be in this order so that they are displayed correctly in select elements
1754
1757
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1755
- // eslint-disable-next-line @typescript-eslint/member-ordering
1756
1758
  Criteria.luxonDateConditions = {
1757
1759
  '=': {
1758
1760
  conditionName: function (dt, i18n) {
@@ -1766,7 +1768,6 @@ var DataTable = $.fn.dataTable;
1766
1768
  === luxon().DateTime.fromFormat(comparison[0], that.s.dateFormat).ts;
1767
1769
  }
1768
1770
  },
1769
- // eslint-disable-next-line sort-keys
1770
1771
  '!=': {
1771
1772
  conditionName: function (dt, i18n) {
1772
1773
  return dt.i18n('searchBuilder.conditions.date.not', i18n.conditions.date.not);
@@ -1822,7 +1823,6 @@ var DataTable = $.fn.dataTable;
1822
1823
  }
1823
1824
  }
1824
1825
  },
1825
- // eslint-disable-next-line sort-keys
1826
1826
  '!between': {
1827
1827
  conditionName: function (dt, i18n) {
1828
1828
  return dt.i18n('searchBuilder.conditions.date.notBetween', i18n.conditions.date.notBetween);
@@ -1857,7 +1857,6 @@ var DataTable = $.fn.dataTable;
1857
1857
  return value === null || value === undefined || value.length === 0;
1858
1858
  }
1859
1859
  },
1860
- // eslint-disable-next-line sort-keys
1861
1860
  '!null': {
1862
1861
  conditionName: function (dt, i18n) {
1863
1862
  return dt.i18n('searchBuilder.conditions.date.notEmpty', i18n.conditions.date.notEmpty);
@@ -1877,7 +1876,6 @@ var DataTable = $.fn.dataTable;
1877
1876
  // The order of the conditions will make eslint sad :(
1878
1877
  // Has to be in this order so that they are displayed correctly in select elements
1879
1878
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
1880
- // eslint-disable-next-line @typescript-eslint/member-ordering
1881
1879
  Criteria.numConditions = {
1882
1880
  '=': {
1883
1881
  conditionName: function (dt, i18n) {
@@ -1890,7 +1888,6 @@ var DataTable = $.fn.dataTable;
1890
1888
  return +value === +comparison[0];
1891
1889
  }
1892
1890
  },
1893
- // eslint-disable-next-line sort-keys
1894
1891
  '!=': {
1895
1892
  conditionName: function (dt, i18n) {
1896
1893
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -1935,7 +1932,6 @@ var DataTable = $.fn.dataTable;
1935
1932
  return +value >= +comparison[0];
1936
1933
  }
1937
1934
  },
1938
- // eslint-disable-next-line sort-keys
1939
1935
  '>': {
1940
1936
  conditionName: function (dt, i18n) {
1941
1937
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -1963,7 +1959,6 @@ var DataTable = $.fn.dataTable;
1963
1959
  }
1964
1960
  }
1965
1961
  },
1966
- // eslint-disable-next-line sort-keys
1967
1962
  '!between': {
1968
1963
  conditionName: function (dt, i18n) {
1969
1964
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -1995,7 +1990,6 @@ var DataTable = $.fn.dataTable;
1995
1990
  return value === null || value === undefined || value.length === 0;
1996
1991
  }
1997
1992
  },
1998
- // eslint-disable-next-line sort-keys
1999
1993
  '!null': {
2000
1994
  conditionName: function (dt, i18n) {
2001
1995
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -2015,7 +2009,6 @@ var DataTable = $.fn.dataTable;
2015
2009
  // The order of the conditions will make eslint sad :(
2016
2010
  // Has to be in this order so that they are displayed correctly in select elements
2017
2011
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2018
- // eslint-disable-next-line @typescript-eslint/member-ordering
2019
2012
  Criteria.numFmtConditions = {
2020
2013
  '=': {
2021
2014
  conditionName: function (dt, i18n) {
@@ -2024,11 +2017,10 @@ var DataTable = $.fn.dataTable;
2024
2017
  init: Criteria.initSelect,
2025
2018
  inputValue: Criteria.inputValueSelect,
2026
2019
  isInputValid: Criteria.isInputValidSelect,
2027
- search: function (value, comparison) {
2028
- return Criteria.parseNumFmt(value) === Criteria.parseNumFmt(comparison[0]);
2020
+ search: function (value, comparison, criteria) {
2021
+ return criteria.parseNumber(value) === criteria.parseNumber(comparison[0]);
2029
2022
  }
2030
2023
  },
2031
- // eslint-disable-next-line sort-keys
2032
2024
  '!=': {
2033
2025
  conditionName: function (dt, i18n) {
2034
2026
  return dt.i18n('searchBuilder.conditions.number.not', i18n.conditions.number.not);
@@ -2036,8 +2028,8 @@ var DataTable = $.fn.dataTable;
2036
2028
  init: Criteria.initSelect,
2037
2029
  inputValue: Criteria.inputValueSelect,
2038
2030
  isInputValid: Criteria.isInputValidSelect,
2039
- search: function (value, comparison) {
2040
- return Criteria.parseNumFmt(value) !== Criteria.parseNumFmt(comparison[0]);
2031
+ search: function (value, comparison, criteria) {
2032
+ return criteria.parseNumber(value) !== criteria.parseNumber(comparison[0]);
2041
2033
  }
2042
2034
  },
2043
2035
  '<': {
@@ -2047,8 +2039,8 @@ var DataTable = $.fn.dataTable;
2047
2039
  init: Criteria.initInput,
2048
2040
  inputValue: Criteria.inputValueInput,
2049
2041
  isInputValid: Criteria.isInputValidInput,
2050
- search: function (value, comparison) {
2051
- return Criteria.parseNumFmt(value) < Criteria.parseNumFmt(comparison[0]);
2042
+ search: function (value, comparison, criteria) {
2043
+ return criteria.parseNumber(value) < criteria.parseNumber(comparison[0]);
2052
2044
  }
2053
2045
  },
2054
2046
  '<=': {
@@ -2058,8 +2050,8 @@ var DataTable = $.fn.dataTable;
2058
2050
  init: Criteria.initInput,
2059
2051
  inputValue: Criteria.inputValueInput,
2060
2052
  isInputValid: Criteria.isInputValidInput,
2061
- search: function (value, comparison) {
2062
- return Criteria.parseNumFmt(value) <= Criteria.parseNumFmt(comparison[0]);
2053
+ search: function (value, comparison, criteria) {
2054
+ return criteria.parseNumber(value) <= criteria.parseNumber(comparison[0]);
2063
2055
  }
2064
2056
  },
2065
2057
  '>=': {
@@ -2069,11 +2061,10 @@ var DataTable = $.fn.dataTable;
2069
2061
  init: Criteria.initInput,
2070
2062
  inputValue: Criteria.inputValueInput,
2071
2063
  isInputValid: Criteria.isInputValidInput,
2072
- search: function (value, comparison) {
2073
- return Criteria.parseNumFmt(value) >= Criteria.parseNumFmt(comparison[0]);
2064
+ search: function (value, comparison, criteria) {
2065
+ return criteria.parseNumber(value) >= criteria.parseNumber(comparison[0]);
2074
2066
  }
2075
2067
  },
2076
- // eslint-disable-next-line sort-keys
2077
2068
  '>': {
2078
2069
  conditionName: function (dt, i18n) {
2079
2070
  return dt.i18n('searchBuilder.conditions.number.gt', i18n.conditions.number.gt);
@@ -2081,8 +2072,8 @@ var DataTable = $.fn.dataTable;
2081
2072
  init: Criteria.initInput,
2082
2073
  inputValue: Criteria.inputValueInput,
2083
2074
  isInputValid: Criteria.isInputValidInput,
2084
- search: function (value, comparison) {
2085
- return Criteria.parseNumFmt(value) > Criteria.parseNumFmt(comparison[0]);
2075
+ search: function (value, comparison, criteria) {
2076
+ return criteria.parseNumber(value) > criteria.parseNumber(comparison[0]);
2086
2077
  }
2087
2078
  },
2088
2079
  'between': {
@@ -2092,10 +2083,10 @@ var DataTable = $.fn.dataTable;
2092
2083
  init: Criteria.init2Input,
2093
2084
  inputValue: Criteria.inputValueInput,
2094
2085
  isInputValid: Criteria.isInputValidInput,
2095
- search: function (value, comparison) {
2096
- var val = Criteria.parseNumFmt(value);
2097
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2098
- 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]);
2099
2090
  if (+comp0 < +comp1) {
2100
2091
  return +comp0 <= +val && +val <= +comp1;
2101
2092
  }
@@ -2104,7 +2095,6 @@ var DataTable = $.fn.dataTable;
2104
2095
  }
2105
2096
  }
2106
2097
  },
2107
- // eslint-disable-next-line sort-keys
2108
2098
  '!between': {
2109
2099
  conditionName: function (dt, i18n) {
2110
2100
  return dt.i18n('searchBuilder.conditions.number.notBetween', i18n.conditions.number.notBetween);
@@ -2112,10 +2102,10 @@ var DataTable = $.fn.dataTable;
2112
2102
  init: Criteria.init2Input,
2113
2103
  inputValue: Criteria.inputValueInput,
2114
2104
  isInputValid: Criteria.isInputValidInput,
2115
- search: function (value, comparison) {
2116
- var val = Criteria.parseNumFmt(value);
2117
- var comp0 = Criteria.parseNumFmt(comparison[0]);
2118
- 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]);
2119
2109
  if (+comp0 < +comp1) {
2120
2110
  return !(+comp0 <= +val && +val <= +comp1);
2121
2111
  }
@@ -2139,7 +2129,6 @@ var DataTable = $.fn.dataTable;
2139
2129
  return value === null || value === undefined || value.length === 0;
2140
2130
  }
2141
2131
  },
2142
- // eslint-disable-next-line sort-keys
2143
2132
  '!null': {
2144
2133
  conditionName: function (dt, i18n) {
2145
2134
  return dt.i18n('searchBuilder.conditions.number.notEmpty', i18n.conditions.number.notEmpty);
@@ -2159,7 +2148,6 @@ var DataTable = $.fn.dataTable;
2159
2148
  // The order of the conditions will make eslint sad :(
2160
2149
  // Has to be in this order so that they are displayed correctly in select elements
2161
2150
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2162
- // eslint-disable-next-line @typescript-eslint/member-ordering
2163
2151
  Criteria.stringConditions = {
2164
2152
  '=': {
2165
2153
  conditionName: function (dt, i18n) {
@@ -2172,7 +2160,6 @@ var DataTable = $.fn.dataTable;
2172
2160
  return value === comparison[0];
2173
2161
  }
2174
2162
  },
2175
- // eslint-disable-next-line sort-keys
2176
2163
  '!=': {
2177
2164
  conditionName: function (dt, i18n) {
2178
2165
  return dt.i18n('searchBuilder.conditions.string.not', i18n.conditions.string.not);
@@ -2195,7 +2182,6 @@ var DataTable = $.fn.dataTable;
2195
2182
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) === 0;
2196
2183
  }
2197
2184
  },
2198
- // eslint-disable-next-line sort-keys
2199
2185
  '!starts': {
2200
2186
  conditionName: function (dt, i18n) {
2201
2187
  return dt.i18n('searchBuilder.conditions.string.notStartsWith', i18n.conditions.string.notStartsWith);
@@ -2207,7 +2193,6 @@ var DataTable = $.fn.dataTable;
2207
2193
  return value.toLowerCase().indexOf(comparison[0].toLowerCase()) !== 0;
2208
2194
  }
2209
2195
  },
2210
- // eslint-disable-next-line sort-keys
2211
2196
  'contains': {
2212
2197
  conditionName: function (dt, i18n) {
2213
2198
  return dt.i18n('searchBuilder.conditions.string.contains', i18n.conditions.string.contains);
@@ -2219,7 +2204,6 @@ var DataTable = $.fn.dataTable;
2219
2204
  return value.toLowerCase().includes(comparison[0].toLowerCase());
2220
2205
  }
2221
2206
  },
2222
- // eslint-disable-next-line sort-keys
2223
2207
  '!contains': {
2224
2208
  conditionName: function (dt, i18n) {
2225
2209
  return dt.i18n('searchBuilder.conditions.string.notContains', i18n.conditions.string.notContains);
@@ -2242,7 +2226,6 @@ var DataTable = $.fn.dataTable;
2242
2226
  return value.toLowerCase().endsWith(comparison[0].toLowerCase());
2243
2227
  }
2244
2228
  },
2245
- // eslint-disable-next-line sort-keys
2246
2229
  '!ends': {
2247
2230
  conditionName: function (dt, i18n) {
2248
2231
  return dt.i18n('searchBuilder.conditions.string.notEndsWith', i18n.conditions.string.notEndsWith);
@@ -2269,7 +2252,6 @@ var DataTable = $.fn.dataTable;
2269
2252
  return value === null || value === undefined || value.length === 0;
2270
2253
  }
2271
2254
  },
2272
- // eslint-disable-next-line sort-keys
2273
2255
  '!null': {
2274
2256
  conditionName: function (dt, i18n) {
2275
2257
  return dt.i18n('searchBuilder.conditions.string.notEmpty', i18n.conditions.string.notEmpty);
@@ -2288,7 +2270,6 @@ var DataTable = $.fn.dataTable;
2288
2270
  };
2289
2271
  // The order of the conditions will make eslint sad :(
2290
2272
  // Also have to disable member ordering for this as the private methods used are not yet declared otherwise
2291
- // eslint-disable-next-line @typescript-eslint/member-ordering
2292
2273
  Criteria.arrayConditions = {
2293
2274
  'contains': {
2294
2275
  conditionName: function (dt, i18n) {
@@ -2312,7 +2293,6 @@ var DataTable = $.fn.dataTable;
2312
2293
  return value.indexOf(comparison[0]) === -1;
2313
2294
  }
2314
2295
  },
2315
- // eslint-disable-next-line sort-keys
2316
2296
  '=': {
2317
2297
  conditionName: function (dt, i18n) {
2318
2298
  return dt.i18n('searchBuilder.conditions.array.equals', i18n.conditions.array.equals);
@@ -2332,7 +2312,6 @@ var DataTable = $.fn.dataTable;
2332
2312
  return false;
2333
2313
  }
2334
2314
  },
2335
- // eslint-disable-next-line sort-keys
2336
2315
  '!=': {
2337
2316
  conditionName: function (dt, i18n) {
2338
2317
  return dt.i18n('searchBuilder.conditions.array.not', i18n.conditions.array.not);
@@ -2367,7 +2346,6 @@ var DataTable = $.fn.dataTable;
2367
2346
  return value === null || value === undefined || value.length === 0;
2368
2347
  }
2369
2348
  },
2370
- // eslint-disable-next-line sort-keys
2371
2349
  '!null': {
2372
2350
  conditionName: function (dt, i18n) {
2373
2351
  return dt.i18n('searchBuilder.conditions.array.notEmpty', i18n.conditions.array.notEmpty);
@@ -2386,7 +2364,6 @@ var DataTable = $.fn.dataTable;
2386
2364
  };
2387
2365
  // eslint will be sad because we have to disable member ordering for this as the
2388
2366
  // private static properties used are not yet declared otherwise
2389
- // eslint-disable-next-line @typescript-eslint/member-ordering
2390
2367
  Criteria.defaults = {
2391
2368
  columns: true,
2392
2369
  conditions: {
@@ -2422,6 +2399,7 @@ var DataTable = $.fn.dataTable;
2422
2399
  logicOr: 'Or',
2423
2400
  right: '>',
2424
2401
  rightTitle: 'Indent criteria',
2402
+ search: 'Search',
2425
2403
  title: {
2426
2404
  0: 'Custom Search Builder',
2427
2405
  _: 'Custom Search Builder (%d)'
@@ -2429,6 +2407,7 @@ var DataTable = $.fn.dataTable;
2429
2407
  value: 'Value',
2430
2408
  valueJoiner: 'and'
2431
2409
  },
2410
+ liveSearch: true,
2432
2411
  logic: 'AND',
2433
2412
  orthogonal: {
2434
2413
  display: 'display',
@@ -2495,7 +2474,12 @@ var DataTable = $.fn.dataTable;
2495
2474
  .addClass(this.classes.button)
2496
2475
  .attr('type', 'button'),
2497
2476
  logicContainer: $$2('<div/>')
2498
- .addClass(this.classes.logicContainer)
2477
+ .addClass(this.classes.logicContainer),
2478
+ search: $$2('<button/>')
2479
+ .addClass(this.classes.search)
2480
+ .addClass(this.classes.button)
2481
+ .attr('type', 'button')
2482
+ .css('display', 'none')
2499
2483
  };
2500
2484
  // A reference to the top level group is maintained throughout any subgroups and criteria that may be created
2501
2485
  if (this.s.topGroup === undefined) {
@@ -2511,6 +2495,7 @@ var DataTable = $.fn.dataTable;
2511
2495
  // Turn off listeners
2512
2496
  this.dom.add.off('.dtsb');
2513
2497
  this.dom.logic.off('.dtsb');
2498
+ this.dom.search.off('.dtsb');
2514
2499
  // Trigger event for groups at a higher level to pick up on
2515
2500
  this.dom.container
2516
2501
  .trigger('dtsb-destroy')
@@ -2521,7 +2506,6 @@ var DataTable = $.fn.dataTable;
2521
2506
  * Gets the details required to rebuild the group
2522
2507
  */
2523
2508
  // Eslint upset at empty object but needs to be done
2524
- // eslint-disable-next-line @typescript-eslint/ban-types
2525
2509
  Group.prototype.getDetails = function (deFormatDates) {
2526
2510
  if (deFormatDates === void 0) { deFormatDates = false; }
2527
2511
  if (this.s.criteria.length === 0) {
@@ -2552,6 +2536,7 @@ var DataTable = $.fn.dataTable;
2552
2536
  * @param loadedDetails the details required to rebuild the group
2553
2537
  */
2554
2538
  Group.prototype.rebuild = function (loadedDetails) {
2539
+ var crit;
2555
2540
  // If no criteria are stored then just return
2556
2541
  if (loadedDetails.criteria === undefined ||
2557
2542
  loadedDetails.criteria === null ||
@@ -2565,7 +2550,7 @@ var DataTable = $.fn.dataTable;
2565
2550
  // Add all of the criteria, be it a sub group or a criteria
2566
2551
  if (Array.isArray(loadedDetails.criteria)) {
2567
2552
  for (var _i = 0, _a = loadedDetails.criteria; _i < _a.length; _i++) {
2568
- var crit = _a[_i];
2553
+ crit = _a[_i];
2569
2554
  if (crit.logic !== undefined) {
2570
2555
  this._addPrevGroup(crit);
2571
2556
  }
@@ -2576,7 +2561,7 @@ var DataTable = $.fn.dataTable;
2576
2561
  }
2577
2562
  // For all of the criteria children, update the arrows incase they require changing and set the listeners
2578
2563
  for (var _b = 0, _c = this.s.criteria; _b < _c.length; _b++) {
2579
- var crit = _c[_b];
2564
+ crit = _c[_b];
2580
2565
  if (crit.criteria instanceof Criteria) {
2581
2566
  crit.criteria.updateArrows(this.s.criteria.length > 1);
2582
2567
  this._setCriteriaListeners(crit.criteria);
@@ -2595,6 +2580,9 @@ var DataTable = $.fn.dataTable;
2595
2580
  this.dom.container
2596
2581
  .append(this.dom.logicContainer)
2597
2582
  .append(this.dom.add);
2583
+ if (!this.c.liveSearch) {
2584
+ this.dom.container.append(this.dom.search);
2585
+ }
2598
2586
  // Sort the criteria by index so that they appear in the correct order
2599
2587
  this.s.criteria.sort(function (a, b) {
2600
2588
  if (a.criteria.s.index < b.criteria.s.index) {
@@ -2681,10 +2669,14 @@ var DataTable = $.fn.dataTable;
2681
2669
  // Set criteria left margin
2682
2670
  this.dom.container.css('margin-left', 0);
2683
2671
  }
2672
+ this.dom.search.css('display', 'none');
2684
2673
  return;
2685
2674
  }
2686
2675
  this.dom.clear.height('0px');
2687
2676
  this.dom.logicContainer.append(this.dom.clear);
2677
+ if (!this.s.isChild) {
2678
+ this.dom.search.css('display', 'inline-block');
2679
+ }
2688
2680
  // Prepend logic button
2689
2681
  this.dom.container.prepend(this.dom.logicContainer);
2690
2682
  for (var _i = 0, _a = this.s.criteria; _i < _a.length; _i++) {
@@ -2732,6 +2724,11 @@ var DataTable = $.fn.dataTable;
2732
2724
  _this.s.dt.state.save();
2733
2725
  return false;
2734
2726
  });
2727
+ this.dom.search
2728
+ .off('click.dtsb')
2729
+ .on('click.dtsb', function () {
2730
+ _this.s.dt.draw();
2731
+ });
2735
2732
  for (var _i = 0, _a = this.s.criteria; _i < _a.length; _i++) {
2736
2733
  var crit = _a[_i];
2737
2734
  crit.criteria.setListeners();
@@ -2747,7 +2744,7 @@ var DataTable = $.fn.dataTable;
2747
2744
  Group.prototype.addCriteria = function (crit) {
2748
2745
  if (crit === void 0) { crit = null; }
2749
2746
  var index = crit === null ? this.s.criteria.length : crit.s.index;
2750
- var criteria = new Criteria(this.s.dt, this.s.opts, this.s.topGroup, index, this.s.depth, this.s.serverData);
2747
+ var criteria = new Criteria(this.s.dt, this.s.opts, this.s.topGroup, index, this.s.depth, this.s.serverData, this.c.liveSearch);
2751
2748
  // If a Criteria has been passed in then set the values to continue that
2752
2749
  if (crit !== null) {
2753
2750
  criteria.c = crit.c;
@@ -2928,6 +2925,7 @@ var DataTable = $.fn.dataTable;
2928
2925
  */
2929
2926
  Group.prototype._removeCriteria = function (criteria, group) {
2930
2927
  if (group === void 0) { group = false; }
2928
+ var i;
2931
2929
  // If removing a criteria and there is only then then just destroy the group
2932
2930
  if (this.s.criteria.length <= 1 && this.s.isChild) {
2933
2931
  this.destroy();
@@ -2935,7 +2933,7 @@ var DataTable = $.fn.dataTable;
2935
2933
  else {
2936
2934
  // Otherwise splice the given criteria out and redo the indexes
2937
2935
  var last = void 0;
2938
- for (var i = 0; i < this.s.criteria.length; i++) {
2936
+ for (i = 0; i < this.s.criteria.length; i++) {
2939
2937
  if (this.s.criteria[i].index === criteria.s.index &&
2940
2938
  (!group || this.s.criteria[i].criteria instanceof Group)) {
2941
2939
  last = i;
@@ -2945,7 +2943,7 @@ var DataTable = $.fn.dataTable;
2945
2943
  if (last !== undefined) {
2946
2944
  this.s.criteria.splice(last, 1);
2947
2945
  }
2948
- for (var i = 0; i < this.s.criteria.length; i++) {
2946
+ for (i = 0; i < this.s.criteria.length; i++) {
2949
2947
  this.s.criteria[i].index = i;
2950
2948
  this.s.criteria[i].criteria.s.index = i;
2951
2949
  }
@@ -3072,6 +3070,7 @@ var DataTable = $.fn.dataTable;
3072
3070
  Group.prototype._setup = function () {
3073
3071
  this.setListeners();
3074
3072
  this.dom.add.html(this.s.dt.i18n('searchBuilder.add', this.c.i18n.add));
3073
+ this.dom.search.html(this.s.dt.i18n('searchBuilder.search', this.c.i18n.search));
3075
3074
  this.dom.logic.children().first().html(this.c.logic === 'OR'
3076
3075
  ? this.s.dt.i18n('searchBuilder.logicOr', this.c.i18n.logicOr)
3077
3076
  : this.s.dt.i18n('searchBuilder.logicAnd', this.c.i18n.logicAnd));
@@ -3086,6 +3085,9 @@ var DataTable = $.fn.dataTable;
3086
3085
  this.dom.container.append(this.dom.logicContainer);
3087
3086
  }
3088
3087
  this.dom.container.append(this.dom.add);
3088
+ if (!this.c.liveSearch) {
3089
+ this.dom.container.append(this.dom.search);
3090
+ }
3089
3091
  };
3090
3092
  /**
3091
3093
  * Sets the listener for the logic button
@@ -3125,7 +3127,8 @@ var DataTable = $.fn.dataTable;
3125
3127
  group: 'dtsb-group',
3126
3128
  inputButton: 'dtsb-iptbtn',
3127
3129
  logic: 'dtsb-logic',
3128
- logicContainer: 'dtsb-logicContainer'
3130
+ logicContainer: 'dtsb-logicContainer',
3131
+ search: 'dtsb-search'
3129
3132
  };
3130
3133
  Group.defaults = {
3131
3134
  columns: true,
@@ -3144,6 +3147,7 @@ var DataTable = $.fn.dataTable;
3144
3147
  enterSearch: false,
3145
3148
  filterChanged: undefined,
3146
3149
  greyscale: false,
3150
+ liveSearch: true,
3147
3151
  i18n: {
3148
3152
  add: 'Add Condition',
3149
3153
  button: {
@@ -3161,6 +3165,7 @@ var DataTable = $.fn.dataTable;
3161
3165
  logicOr: 'Or',
3162
3166
  right: '>',
3163
3167
  rightTitle: 'Indent criteria',
3168
+ search: 'Search',
3164
3169
  title: {
3165
3170
  0: 'Custom Search Builder',
3166
3171
  _: 'Custom Search Builder (%d)'
@@ -3258,7 +3263,6 @@ var DataTable = $.fn.dataTable;
3258
3263
  * Gets the details required to rebuild the SearchBuilder as it currently is
3259
3264
  */
3260
3265
  // eslint upset at empty object but that is what it is
3261
- // eslint-disable-next-line @typescript-eslint/ban-types
3262
3266
  SearchBuilder.prototype.getDetails = function (deFormatDates) {
3263
3267
  if (deFormatDates === void 0) { deFormatDates = false; }
3264
3268
  return this.s.topGroup.getDetails(deFormatDates);
@@ -3328,16 +3332,19 @@ var DataTable = $.fn.dataTable;
3328
3332
  SearchBuilder.prototype._setUp = function (loadState) {
3329
3333
  var _this = this;
3330
3334
  if (loadState === void 0) { loadState = true; }
3331
- // Register an Api method for getting the column type
3332
- $$1.fn.DataTable.Api.registerPlural('columns().type()', 'column().type()', function () {
3333
- return this.iterator('column', function (settings, column) {
3334
- return settings.aoColumns[column].sType;
3335
- }, 1);
3336
- });
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
+ }
3337
3344
  // Check that DateTime is included, If not need to check if it could be used
3338
3345
  // eslint-disable-next-line no-extra-parens
3339
3346
  if (!dataTable$1.DateTime) {
3340
- var types = this.s.dt.columns().type().toArray();
3347
+ var types = this.s.dt.columns().types().toArray();
3341
3348
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3342
3349
  types = [];
3343
3350
  for (var _i = 0, _a = this.s.dt.settings()[0].aoColumns; _i < _a.length; _i++) {
@@ -3346,10 +3353,13 @@ var DataTable = $.fn.dataTable;
3346
3353
  }
3347
3354
  }
3348
3355
  var columnIdxs = this.s.dt.columns().toArray();
3349
- // 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
3350
3357
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3351
- $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3352
- 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();
3353
3363
  }
3354
3364
  for (var i = 0; i < columnIdxs[0].length; i++) {
3355
3365
  var column = columnIdxs[0][i];
@@ -3388,7 +3398,9 @@ var DataTable = $.fn.dataTable;
3388
3398
  data.searchBuilder = _this._collapseArray(_this.getDetails(true));
3389
3399
  }
3390
3400
  });
3391
- this.s.dt.on('column-reorder', function () {
3401
+ this.s.dt.on(dataTable$1.versionCheck('2')
3402
+ ? 'columns-reordered'
3403
+ : 'column-reorder', function () {
3392
3404
  _this.rebuild(_this.getDetails());
3393
3405
  });
3394
3406
  if (loadState) {
@@ -3603,7 +3615,7 @@ var DataTable = $.fn.dataTable;
3603
3615
  _this.dom.clearAll.remove();
3604
3616
  });
3605
3617
  };
3606
- SearchBuilder.version = '1.5.0';
3618
+ SearchBuilder.version = '1.7.0';
3607
3619
  SearchBuilder.classes = {
3608
3620
  button: 'dtsb-button',
3609
3621
  clearAll: 'dtsb-clearAll',
@@ -3629,6 +3641,7 @@ var DataTable = $.fn.dataTable;
3629
3641
  enterSearch: false,
3630
3642
  filterChanged: undefined,
3631
3643
  greyscale: false,
3644
+ liveSearch: true,
3632
3645
  i18n: {
3633
3646
  add: 'Add Condition',
3634
3647
  button: {
@@ -3692,6 +3705,7 @@ var DataTable = $.fn.dataTable;
3692
3705
  logicOr: 'Or',
3693
3706
  right: '>',
3694
3707
  rightTitle: 'Indent criteria',
3708
+ search: 'Search',
3695
3709
  title: {
3696
3710
  0: 'Custom Search Builder',
3697
3711
  _: 'Custom Search Builder (%d)'
@@ -3709,8 +3723,8 @@ var DataTable = $.fn.dataTable;
3709
3723
  return SearchBuilder;
3710
3724
  }());
3711
3725
 
3712
- /*! SearchBuilder 1.5.0
3713
- * ©SpryMedia Ltd - datatables.net/license/mit
3726
+ /*! SearchBuilder 1.7.0
3727
+ -dev * ©SpryMedia Ltd - datatables.net/license/mit
3714
3728
  */
3715
3729
  setJQuery($);
3716
3730
  setJQuery$1($);
@@ -3820,11 +3834,11 @@ var DataTable = $.fn.dataTable;
3820
3834
  fnInit: _init
3821
3835
  });
3822
3836
  // DataTables 2 layout feature
3823
- if (DataTable.ext.features) {
3824
- DataTable.ext.features.register('searchBuilder', _init);
3837
+ if (DataTable.feature) {
3838
+ DataTable.feature.register('searchBuilder', _init);
3825
3839
  }
3826
3840
 
3827
- }());
3841
+ })();
3828
3842
 
3829
3843
 
3830
3844
  return DataTable;