datatables.net-searchbuilder 1.3.4 → 1.4.2

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,11 +1,58 @@
1
- /*! SearchBuilder 1.3.4
1
+ /*! SearchBuilder 1.4.2
2
2
  * ©SpryMedia Ltd - datatables.net/license/mit
3
3
  */
4
+
5
+ (function( factory ){
6
+ if ( typeof define === 'function' && define.amd ) {
7
+ // AMD
8
+ define( ['jquery', 'datatables.net'], function ( $ ) {
9
+ return factory( $, window, document );
10
+ } );
11
+ }
12
+ else if ( typeof exports === 'object' ) {
13
+ // CommonJS
14
+ var jq = require('jquery');
15
+ var cjsRequires = function (root, $) {
16
+ if ( ! $.fn.dataTable ) {
17
+ require('datatables.net')(root, $);
18
+ }
19
+ };
20
+
21
+ if (typeof window !== 'undefined') {
22
+ module.exports = function (root, $) {
23
+ if ( ! root ) {
24
+ // CommonJS environments without a window global must pass a
25
+ // root. This will give an error otherwise
26
+ root = window;
27
+ }
28
+
29
+ if ( ! $ ) {
30
+ $ = jq( root );
31
+ }
32
+
33
+ cjsRequires( root, $ );
34
+ return factory( $, root, root.document );
35
+ };
36
+ }
37
+ else {
38
+ cjsRequires( window, jq );
39
+ module.exports = factory( jq, window, window.document );
40
+ }
41
+ }
42
+ else {
43
+ // Browser
44
+ factory( jQuery, window, document );
45
+ }
46
+ }(function( $, window, document, undefined ) {
47
+ 'use strict';
48
+ var DataTable = $.fn.dataTable;
49
+
50
+
4
51
  (function () {
5
52
  'use strict';
6
53
 
7
- var $$2;
8
- var dataTable$2;
54
+ var $$3;
55
+ var dataTable$3;
9
56
  function moment() {
10
57
  return window.moment;
11
58
  }
@@ -18,8 +65,8 @@
18
65
  * @param jq the instance of jQuery to be set
19
66
  */
20
67
  function setJQuery$2(jq) {
21
- $$2 = jq;
22
- dataTable$2 = jq.fn.dataTable;
68
+ $$3 = jq;
69
+ dataTable$3 = jq.fn.dataTable;
23
70
  }
24
71
  /**
25
72
  * The Criteria class is used within SearchBuilder to represent a search criteria
@@ -31,12 +78,12 @@
31
78
  if (depth === void 0) { depth = 1; }
32
79
  if (serverData === void 0) { serverData = undefined; }
33
80
  // Check that the required version of DataTables is included
34
- if (!dataTable$2 || !dataTable$2.versionCheck || !dataTable$2.versionCheck('1.10.0')) {
81
+ if (!dataTable$3 || !dataTable$3.versionCheck || !dataTable$3.versionCheck('1.10.0')) {
35
82
  throw new Error('SearchPane requires DataTables 1.10 or newer');
36
83
  }
37
- this.classes = $$2.extend(true, {}, Criteria.classes);
84
+ this.classes = $$3.extend(true, {}, Criteria.classes);
38
85
  // Get options from user and any extra conditions/column types defined by plug-ins
39
- this.c = $$2.extend(true, {}, Criteria.defaults, $$2.fn.dataTable.ext.searchBuilder, opts);
86
+ this.c = $$3.extend(true, {}, Criteria.defaults, $$3.fn.dataTable.ext.searchBuilder, opts);
40
87
  var i18n = this.c.i18n;
41
88
  this.s = {
42
89
  condition: undefined,
@@ -57,58 +104,58 @@
57
104
  value: []
58
105
  };
59
106
  this.dom = {
60
- buttons: $$2('<div/>')
107
+ buttons: $$3('<div/>')
61
108
  .addClass(this.classes.buttonContainer),
62
- condition: $$2('<select disabled/>')
109
+ condition: $$3('<select disabled/>')
63
110
  .addClass(this.classes.condition)
64
111
  .addClass(this.classes.dropDown)
65
112
  .addClass(this.classes.italic)
66
113
  .attr('autocomplete', 'hacking'),
67
- conditionTitle: $$2('<option value="" disabled selected hidden/>')
114
+ conditionTitle: $$3('<option value="" disabled selected hidden/>')
68
115
  .html(this.s.dt.i18n('searchBuilder.condition', i18n.condition)),
69
- container: $$2('<div/>')
116
+ container: $$3('<div/>')
70
117
  .addClass(this.classes.container),
71
- data: $$2('<select/>')
118
+ data: $$3('<select/>')
72
119
  .addClass(this.classes.data)
73
120
  .addClass(this.classes.dropDown)
74
121
  .addClass(this.classes.italic),
75
- dataTitle: $$2('<option value="" disabled selected hidden/>')
122
+ dataTitle: $$3('<option value="" disabled selected hidden/>')
76
123
  .html(this.s.dt.i18n('searchBuilder.data', i18n.data)),
77
- defaultValue: $$2('<select disabled/>')
124
+ defaultValue: $$3('<select disabled/>')
78
125
  .addClass(this.classes.value)
79
126
  .addClass(this.classes.dropDown)
80
127
  .addClass(this.classes.select)
81
128
  .addClass(this.classes.italic),
82
- "delete": $$2('<button/>')
129
+ "delete": $$3('<button/>')
83
130
  .html(this.s.dt.i18n('searchBuilder.delete', i18n["delete"]))
84
131
  .addClass(this.classes["delete"])
85
132
  .addClass(this.classes.button)
86
133
  .attr('title', this.s.dt.i18n('searchBuilder.deleteTitle', i18n.deleteTitle))
87
134
  .attr('type', 'button'),
88
- inputCont: $$2('<div/>')
135
+ inputCont: $$3('<div/>')
89
136
  .addClass(this.classes.inputCont),
90
137
  // eslint-disable-next-line no-useless-escape
91
- left: $$2('<button/>')
138
+ left: $$3('<button/>')
92
139
  .html(this.s.dt.i18n('searchBuilder.left', i18n.left))
93
140
  .addClass(this.classes.left)
94
141
  .addClass(this.classes.button)
95
142
  .attr('title', this.s.dt.i18n('searchBuilder.leftTitle', i18n.leftTitle))
96
143
  .attr('type', 'button'),
97
144
  // eslint-disable-next-line no-useless-escape
98
- right: $$2('<button/>')
145
+ right: $$3('<button/>')
99
146
  .html(this.s.dt.i18n('searchBuilder.right', i18n.right))
100
147
  .addClass(this.classes.right)
101
148
  .addClass(this.classes.button)
102
149
  .attr('title', this.s.dt.i18n('searchBuilder.rightTitle', i18n.rightTitle))
103
150
  .attr('type', 'button'),
104
151
  value: [
105
- $$2('<select disabled/>')
152
+ $$3('<select disabled/>')
106
153
  .addClass(this.classes.value)
107
154
  .addClass(this.classes.dropDown)
108
155
  .addClass(this.classes.italic)
109
156
  .addClass(this.classes.select)
110
157
  ],
111
- valueTitle: $$2('<option value="--valueTitle--" disabled selected hidden/>')
158
+ valueTitle: $$3('<option value="--valueTitle--" disabled selected hidden/>')
112
159
  .html(this.s.dt.i18n('searchBuilder.value', i18n.value))
113
160
  };
114
161
  // If the greyscale option is selected then add the class to add the grey colour to SearchBuilder
@@ -121,7 +168,7 @@
121
168
  val.addClass(this.classes.greyscale);
122
169
  }
123
170
  }
124
- $$2(window).on('resize.dtsb', dataTable$2.util.throttle(function () {
171
+ $$3(window).on('resize.dtsb', dataTable$3.util.throttle(function () {
125
172
  _this.s.topGroup.trigger('dtsb-redrawLogic');
126
173
  }));
127
174
  this._buildCriteria();
@@ -310,7 +357,7 @@
310
357
  }
311
358
  if (this.s.type.includes('num') && this.s.dt.page.info().serverSide) {
312
359
  for (var i = 0; i < this.s.value.length; i++) {
313
- this.s.value[i] = this.s.value[i].replace(/[^0-9.]/g, '');
360
+ this.s.value[i] = this.s.value[i].replace(/[^0-9.\-]/g, '');
314
361
  }
315
362
  }
316
363
  return {
@@ -359,15 +406,15 @@
359
406
  var data_1 = this.dom.data;
360
407
  this.dom.data.children('option').each(function () {
361
408
  if (!foundData &&
362
- ($$2(this).text() === loadedCriteria.data ||
363
- loadedCriteria.origData && $$2(this).prop('origData') === loadedCriteria.origData)) {
364
- $$2(this).prop('selected', true);
409
+ ($$3(this).text() === loadedCriteria.data ||
410
+ loadedCriteria.origData && $$3(this).prop('origData') === loadedCriteria.origData)) {
411
+ $$3(this).prop('selected', true);
365
412
  data_1.removeClass(italic_1);
366
413
  foundData = true;
367
- dataIdx = $$2(this).val();
414
+ dataIdx = $$3(this).val();
368
415
  }
369
416
  else {
370
- $$2(this).removeProp('selected');
417
+ $$3(this).removeProp('selected');
371
418
  }
372
419
  });
373
420
  }
@@ -385,7 +432,7 @@
385
432
  var options = this.dom.condition.children('option');
386
433
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
387
434
  for (var i = 0; i < options.length; i++) {
388
- var option = $$2(options[i]);
435
+ var option = $$3(options[i]);
389
436
  if (loadedCriteria.condition !== undefined &&
390
437
  option.val() === loadedCriteria.condition &&
391
438
  typeof loadedCriteria.condition === 'string') {
@@ -404,7 +451,7 @@
404
451
  this.dom.condition.removeClass(this.classes.italic);
405
452
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
406
453
  for (var i = 0; i < options.length; i++) {
407
- var option = $$2(options[i]);
454
+ var option = $$3(options[i]);
408
455
  if (option.val() !== this.s.condition) {
409
456
  option.removeProp('selected');
410
457
  }
@@ -429,7 +476,7 @@
429
476
  var options = _this.dom.data.children('option.' + _this.classes.option);
430
477
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
431
478
  for (var i = 0; i < options.length; i++) {
432
- var option = $$2(options[i]);
479
+ var option = $$3(options[i]);
433
480
  if (option.val() === _this.dom.data.val()) {
434
481
  _this.dom.data.removeClass(_this.classes.italic);
435
482
  option.prop('selected', true);
@@ -464,7 +511,7 @@
464
511
  var options = _this.dom.condition.children('option.' + _this.classes.option);
465
512
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
466
513
  for (var i = 0; i < options.length; i++) {
467
- var option = $$2(options[i]);
514
+ var option = $$3(options[i]);
468
515
  if (option.val() === _this.dom.condition.val()) {
469
516
  _this.dom.condition.removeClass(_this.classes.italic);
470
517
  option.prop('selected', true);
@@ -605,7 +652,7 @@
605
652
  }
606
653
  this.s.value = [];
607
654
  this.dom.value = [
608
- $$2('<select disabled/>')
655
+ $$3('<select disabled/>')
609
656
  .addClass(this.classes.value)
610
657
  .addClass(this.classes.dropDown)
611
658
  .addClass(this.classes.italic)
@@ -620,7 +667,7 @@
620
667
  */
621
668
  Criteria.prototype._getOptions = function () {
622
669
  var table = this.s.dt;
623
- return $$2.extend(true, {}, Criteria.defaults, table.settings()[0].aoColumns[this.s.dataIdx].searchBuilder);
670
+ return $$3.extend(true, {}, Criteria.defaults, table.settings()[0].aoColumns[this.s.dataIdx].searchBuilder);
624
671
  };
625
672
  /**
626
673
  * Populates the condition dropdown
@@ -644,7 +691,7 @@
644
691
  }
645
692
  // If the column type is still unknown, call a draw to try reading it again
646
693
  if (this.s.type === null || this.s.type === undefined) {
647
- $$2.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
694
+ $$3.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
648
695
  this.s.type = this.s.dt.columns().type().toArray()[column];
649
696
  }
650
697
  // Enable the condition element
@@ -704,7 +751,7 @@
704
751
  if (typeof condName === 'function') {
705
752
  condName = condName(this.s.dt, this.c.i18n);
706
753
  }
707
- conditionOpts.push($$2('<option>', {
754
+ conditionOpts.push($$3('<option>', {
708
755
  text: condName,
709
756
  value: condition
710
757
  })
@@ -722,7 +769,7 @@
722
769
  if (typeof condName === 'function') {
723
770
  condName = condName(this.s.dt, this.c.i18n);
724
771
  }
725
- var newOpt = $$2('<option>', {
772
+ var newOpt = $$3('<option>', {
726
773
  text: condName,
727
774
  value: condition
728
775
  })
@@ -785,81 +832,33 @@
785
832
  }
786
833
  };
787
834
  /**
788
- * Populates the data select element
835
+ * Populates the data / column select element
789
836
  */
790
837
  Criteria.prototype._populateData = function () {
791
- var _this = this;
838
+ var columns = this.s.dt.settings()[0].aoColumns;
839
+ var includeColumns = this.s.dt.columns(this.c.columns).indexes().toArray();
792
840
  this.dom.data.empty().append(this.dom.dataTitle);
793
- // If there are no datas stored then we need to get them from the table
794
- if (this.s.dataPoints.length === 0) {
795
- this.s.dt.columns().every(function (index) {
796
- // Need to check that the column can be filtered on before adding it
797
- if (_this.c.columns === true ||
798
- _this.s.dt.columns(_this.c.columns).indexes().toArray().includes(index)) {
799
- var found = false;
800
- for (var _i = 0, _a = _this.s.dataPoints; _i < _a.length; _i++) {
801
- var val = _a[_i];
802
- if (val.index === index) {
803
- found = true;
804
- break;
805
- }
806
- }
807
- if (!found) {
808
- var col = _this.s.dt.settings()[0].aoColumns[index];
809
- var opt = {
810
- index: index,
811
- origData: col.data,
812
- text: (col.searchBuilderTitle === undefined ?
813
- col.sTitle :
814
- col.searchBuilderTitle).replace(/(<([^>]+)>)/ig, '')
815
- };
816
- _this.s.dataPoints.push(opt);
817
- _this.dom.data.append($$2('<option>', {
818
- text: opt.text,
819
- value: opt.index
820
- })
821
- .addClass(_this.classes.option)
822
- .addClass(_this.classes.notItalic)
823
- .prop('origData', col.data)
824
- .prop('selected', _this.s.dataIdx === opt.index ? true : false));
825
- if (_this.s.dataIdx === opt.index) {
826
- _this.dom.dataTitle.removeProp('selected');
827
- }
828
- }
829
- }
830
- });
831
- }
832
- // Otherwise we can just load them in
833
- else {
834
- var _loop_3 = function (data) {
835
- this_1.s.dt.columns().every(function (index) {
836
- var col = _this.s.dt.settings()[0].aoColumns[index];
837
- if ((col.searchBuilderTitle === undefined ?
838
- col.sTitle :
839
- col.searchBuilderTitle).replace(/(<([^>]+)>)/ig, '') === data.text) {
840
- data.index = index;
841
- data.origData = col.data;
842
- }
843
- });
844
- var newOpt = $$2('<option>', {
845
- text: data.text.replace(/(<([^>]+)>)/ig, ''),
846
- value: data.index
841
+ for (var index = 0; index < columns.length; index++) {
842
+ // Need to check that the column can be filtered on before adding it
843
+ if (this.c.columns === true || includeColumns.includes(index)) {
844
+ var col = columns[index];
845
+ var opt = {
846
+ index: index,
847
+ origData: col.data,
848
+ text: (col.searchBuilderTitle || col.sTitle)
849
+ .replace(/(<([^>]+)>)/ig, '')
850
+ };
851
+ this.dom.data.append($$3('<option>', {
852
+ text: opt.text,
853
+ value: opt.index
847
854
  })
848
- .addClass(this_1.classes.option)
849
- .addClass(this_1.classes.notItalic)
850
- .prop('origData', data.origData);
851
- if (this_1.s.data === data.text) {
852
- this_1.s.dataIdx = data.index;
853
- this_1.dom.dataTitle.removeProp('selected');
854
- newOpt.prop('selected', true);
855
- this_1.dom.data.removeClass(this_1.classes.italic);
855
+ .addClass(this.classes.option)
856
+ .addClass(this.classes.notItalic)
857
+ .prop('origData', col.data)
858
+ .prop('selected', this.s.dataIdx === opt.index ? true : false));
859
+ if (this.s.dataIdx === opt.index) {
860
+ this.dom.dataTitle.removeProp('selected');
856
861
  }
857
- this_1.dom.data.append(newOpt);
858
- };
859
- var this_1 = this;
860
- for (var _i = 0, _a = this.s.dataPoints; _i < _a.length; _i++) {
861
- var data = _a[_i];
862
- _loop_3(data);
863
862
  }
864
863
  }
865
864
  };
@@ -877,7 +876,7 @@
877
876
  setTimeout(function () {
878
877
  _this.dom.defaultValue.remove();
879
878
  }, 50);
880
- var _loop_4 = function (val) {
879
+ var _loop_3 = function (val) {
881
880
  // Timeout is annoying but because of IOS
882
881
  setTimeout(function () {
883
882
  if (val !== undefined) {
@@ -887,13 +886,13 @@
887
886
  };
888
887
  for (var _i = 0, _a = this.dom.value; _i < _a.length; _i++) {
889
888
  var val = _a[_i];
890
- _loop_4(val);
889
+ _loop_3(val);
891
890
  }
892
891
  var children = this.dom.inputCont.children();
893
892
  if (children.length > 1) {
894
893
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
895
894
  for (var i = 0; i < children.length; i++) {
896
- $$2(children[i]).remove();
895
+ $$3(children[i]).remove();
897
896
  }
898
897
  }
899
898
  // Find the column with the title matching the data for the criteria and take note of the index
@@ -1000,14 +999,14 @@
1000
999
  var settings = that.s.dt.settings()[0];
1001
1000
  that.dom.valueTitle.prop('selected', true);
1002
1001
  // Declare select element to be used with all of the default classes and listeners.
1003
- var el = $$2('<select/>')
1002
+ var el = $$3('<select/>')
1004
1003
  .addClass(Criteria.classes.value)
1005
1004
  .addClass(Criteria.classes.dropDown)
1006
1005
  .addClass(Criteria.classes.italic)
1007
1006
  .addClass(Criteria.classes.select)
1008
1007
  .append(that.dom.valueTitle)
1009
1008
  .on('change.dtsb', function () {
1010
- $$2(this).removeClass(Criteria.classes.italic);
1009
+ $$3(this).removeClass(Criteria.classes.italic);
1011
1010
  fn(that, this);
1012
1011
  });
1013
1012
  if (that.c.greyscale) {
@@ -1042,7 +1041,7 @@
1042
1041
  filt.replace(/(<([^>]+)>)/ig, '');
1043
1042
  }
1044
1043
  // Add text and value, stripping out any html if that is the column type
1045
- var opt = $$2('<option>', {
1044
+ var opt = $$3('<option>', {
1046
1045
  type: Array.isArray(filt) ? 'Array' : 'String',
1047
1046
  value: filt
1048
1047
  })
@@ -1131,14 +1130,14 @@
1131
1130
  if (preDefined === void 0) { preDefined = null; }
1132
1131
  that.dom.valueTitle.prop('selected', true);
1133
1132
  // Declare select element to be used with all of the default classes and listeners.
1134
- var el = $$2('<select/>')
1133
+ var el = $$3('<select/>')
1135
1134
  .addClass(Criteria.classes.value)
1136
1135
  .addClass(Criteria.classes.dropDown)
1137
1136
  .addClass(Criteria.classes.italic)
1138
1137
  .addClass(Criteria.classes.select)
1139
1138
  .append(that.dom.valueTitle)
1140
1139
  .on('change.dtsb', function () {
1141
- $$2(this).removeClass(Criteria.classes.italic);
1140
+ $$3(this).removeClass(Criteria.classes.italic);
1142
1141
  fn(that, this);
1143
1142
  });
1144
1143
  if (that.c.greyscale) {
@@ -1155,7 +1154,7 @@
1155
1154
  filt.replace(/(<([^>]+)>)/ig, '');
1156
1155
  }
1157
1156
  // Add text and value, stripping out any html if that is the column type
1158
- var opt = $$2('<option>', {
1157
+ var opt = $$3('<option>', {
1159
1158
  type: Array.isArray(filt) ? 'Array' : 'String',
1160
1159
  value: filt
1161
1160
  })
@@ -1198,7 +1197,7 @@
1198
1197
  if (preDefined === void 0) { preDefined = null; }
1199
1198
  // Declare the input element
1200
1199
  var searchDelay = that.s.dt.settings()[0].searchDelay;
1201
- var el = $$2('<input/>')
1200
+ var el = $$3('<input/>')
1202
1201
  .addClass(Criteria.classes.value)
1203
1202
  .addClass(Criteria.classes.input)
1204
1203
  .on('input.dtsb keypress.dtsb', that._throttle(function (e) {
@@ -1226,17 +1225,17 @@
1226
1225
  // Declare all of the necessary jQuery elements
1227
1226
  var searchDelay = that.s.dt.settings()[0].searchDelay;
1228
1227
  var els = [
1229
- $$2('<input/>')
1228
+ $$3('<input/>')
1230
1229
  .addClass(Criteria.classes.value)
1231
1230
  .addClass(Criteria.classes.input)
1232
1231
  .on('input.dtsb keypress.dtsb', that._throttle(function (e) {
1233
1232
  var code = e.keyCode || e.which;
1234
1233
  return fn(that, this, code);
1235
1234
  }, searchDelay === null ? 100 : searchDelay)),
1236
- $$2('<span>')
1235
+ $$3('<span>')
1237
1236
  .addClass(that.classes.joiner)
1238
1237
  .html(that.s.dt.i18n('searchBuilder.valueJoiner', that.c.i18n.valueJoiner)),
1239
- $$2('<input/>')
1238
+ $$3('<input/>')
1240
1239
  .addClass(Criteria.classes.value)
1241
1240
  .addClass(Criteria.classes.input)
1242
1241
  .on('input.dtsb keypress.dtsb', that._throttle(function (e) {
@@ -1266,7 +1265,7 @@
1266
1265
  if (preDefined === void 0) { preDefined = null; }
1267
1266
  var searchDelay = that.s.dt.settings()[0].searchDelay;
1268
1267
  // Declare date element using DataTables dateTime plugin
1269
- var el = $$2('<input/>')
1268
+ var el = $$3('<input/>')
1270
1269
  .addClass(Criteria.classes.value)
1271
1270
  .addClass(Criteria.classes.input)
1272
1271
  .dtDateTime({
@@ -1300,6 +1299,7 @@
1300
1299
  that.s.dt.one('draw.dtsb', function () {
1301
1300
  that.s.topGroup.trigger('dtsb-redrawLogic');
1302
1301
  });
1302
+ return [];
1303
1303
  };
1304
1304
  Criteria.init2Date = function (that, fn, preDefined) {
1305
1305
  var _this = this;
@@ -1307,7 +1307,7 @@
1307
1307
  var searchDelay = that.s.dt.settings()[0].searchDelay;
1308
1308
  // Declare all of the date elements that are required using DataTables dateTime plugin
1309
1309
  var els = [
1310
- $$2('<input/>')
1310
+ $$3('<input/>')
1311
1311
  .addClass(Criteria.classes.value)
1312
1312
  .addClass(Criteria.classes.input)
1313
1313
  .dtDateTime({
@@ -1327,10 +1327,10 @@
1327
1327
  return fn(that, this, code);
1328
1328
  }, searchDelay === null ? 0 : searchDelay);
1329
1329
  }),
1330
- $$2('<span>')
1330
+ $$3('<span>')
1331
1331
  .addClass(that.classes.joiner)
1332
1332
  .html(that.s.dt.i18n('searchBuilder.valueJoiner', that.c.i18n.valueJoiner)),
1333
- $$2('<input/>')
1333
+ $$3('<input/>')
1334
1334
  .addClass(Criteria.classes.value)
1335
1335
  .addClass(Criteria.classes.input)
1336
1336
  .dtDateTime({
@@ -2434,16 +2434,16 @@
2434
2434
  return Criteria;
2435
2435
  }());
2436
2436
 
2437
- var $$1;
2438
- var dataTable$1;
2437
+ var $$2;
2438
+ var dataTable$2;
2439
2439
  /**
2440
2440
  * Sets the value of jQuery for use in the file
2441
2441
  *
2442
2442
  * @param jq the instance of jQuery to be set
2443
2443
  */
2444
2444
  function setJQuery$1(jq) {
2445
- $$1 = jq;
2446
- dataTable$1 = jq.fn.dataTable;
2445
+ $$2 = jq;
2446
+ dataTable$2 = jq.fn.dataTable;
2447
2447
  }
2448
2448
  /**
2449
2449
  * The Group class is used within SearchBuilder to represent a group of criteria
@@ -2455,12 +2455,12 @@
2455
2455
  if (depth === void 0) { depth = 1; }
2456
2456
  if (serverData === void 0) { serverData = undefined; }
2457
2457
  // Check that the required version of DataTables is included
2458
- if (!dataTable$1 || !dataTable$1.versionCheck || !dataTable$1.versionCheck('1.10.0')) {
2458
+ if (!dataTable$2 || !dataTable$2.versionCheck || !dataTable$2.versionCheck('1.10.0')) {
2459
2459
  throw new Error('SearchBuilder requires DataTables 1.10 or newer');
2460
2460
  }
2461
- this.classes = $$1.extend(true, {}, Group.classes);
2461
+ this.classes = $$2.extend(true, {}, Group.classes);
2462
2462
  // Get options from user
2463
- this.c = $$1.extend(true, {}, Group.defaults, opts);
2463
+ this.c = $$2.extend(true, {}, Group.defaults, opts);
2464
2464
  this.s = {
2465
2465
  criteria: [],
2466
2466
  depth: depth,
@@ -2475,21 +2475,21 @@
2475
2475
  topGroup: topGroup
2476
2476
  };
2477
2477
  this.dom = {
2478
- add: $$1('<button/>')
2478
+ add: $$2('<button/>')
2479
2479
  .addClass(this.classes.add)
2480
2480
  .addClass(this.classes.button)
2481
2481
  .attr('type', 'button'),
2482
- clear: $$1('<button>&times</button>')
2482
+ clear: $$2('<button>&times</button>')
2483
2483
  .addClass(this.classes.button)
2484
2484
  .addClass(this.classes.clearGroup)
2485
2485
  .attr('type', 'button'),
2486
- container: $$1('<div/>')
2486
+ container: $$2('<div/>')
2487
2487
  .addClass(this.classes.group),
2488
- logic: $$1('<button><div/></button>')
2488
+ logic: $$2('<button><div/></button>')
2489
2489
  .addClass(this.classes.logic)
2490
2490
  .addClass(this.classes.button)
2491
2491
  .attr('type', 'button'),
2492
- logicContainer: $$1('<div/>')
2492
+ logicContainer: $$2('<div/>')
2493
2493
  .addClass(this.classes.logicContainer)
2494
2494
  };
2495
2495
  // A reference to the top level group is maintained throughout any subgroups and criteria that may be created
@@ -2704,7 +2704,7 @@
2704
2704
  // Set vertical alignment
2705
2705
  var firstCrit = this.dom.logicContainer.next();
2706
2706
  var currentTop = logicOffset.top;
2707
- var firstTop = $$1(firstCrit).offset().top;
2707
+ var firstTop = $$2(firstCrit).offset().top;
2708
2708
  var shuffleTop = currentTop - firstTop;
2709
2709
  var newTop = currentTop - shuffleTop;
2710
2710
  this.dom.logicContainer.offset({ top: newTop });
@@ -3173,16 +3173,16 @@
3173
3173
  return Group;
3174
3174
  }());
3175
3175
 
3176
- var $;
3177
- var dataTable;
3176
+ var $$1;
3177
+ var dataTable$1;
3178
3178
  /**
3179
3179
  * Sets the value of jQuery for use in the file
3180
3180
  *
3181
3181
  * @param jq the instance of jQuery to be set
3182
3182
  */
3183
3183
  function setJQuery(jq) {
3184
- $ = jq;
3185
- dataTable = jq.fn.DataTable;
3184
+ $$1 = jq;
3185
+ dataTable$1 = jq.fn.DataTable;
3186
3186
  }
3187
3187
  /**
3188
3188
  * SearchBuilder class for DataTables.
@@ -3192,23 +3192,23 @@
3192
3192
  function SearchBuilder(builderSettings, opts) {
3193
3193
  var _this = this;
3194
3194
  // Check that the required version of DataTables is included
3195
- if (!dataTable || !dataTable.versionCheck || !dataTable.versionCheck('1.10.0')) {
3195
+ if (!dataTable$1 || !dataTable$1.versionCheck || !dataTable$1.versionCheck('1.10.0')) {
3196
3196
  throw new Error('SearchBuilder requires DataTables 1.10 or newer');
3197
3197
  }
3198
- var table = new dataTable.Api(builderSettings);
3199
- this.classes = $.extend(true, {}, SearchBuilder.classes);
3198
+ var table = new dataTable$1.Api(builderSettings);
3199
+ this.classes = $$1.extend(true, {}, SearchBuilder.classes);
3200
3200
  // Get options from user
3201
- this.c = $.extend(true, {}, SearchBuilder.defaults, opts);
3201
+ this.c = $$1.extend(true, {}, SearchBuilder.defaults, opts);
3202
3202
  this.dom = {
3203
- clearAll: $('<button type="button">' + table.i18n('searchBuilder.clearAll', this.c.i18n.clearAll) + '</button>')
3203
+ clearAll: $$1('<button type="button">' + table.i18n('searchBuilder.clearAll', this.c.i18n.clearAll) + '</button>')
3204
3204
  .addClass(this.classes.clearAll)
3205
3205
  .addClass(this.classes.button)
3206
3206
  .attr('type', 'button'),
3207
- container: $('<div/>')
3207
+ container: $$1('<div/>')
3208
3208
  .addClass(this.classes.container),
3209
- title: $('<div/>')
3209
+ title: $$1('<div/>')
3210
3210
  .addClass(this.classes.title),
3211
- titleRow: $('<div/>')
3211
+ titleRow: $$1('<div/>')
3212
3212
  .addClass(this.classes.titleRow),
3213
3213
  topGroup: undefined
3214
3214
  };
@@ -3324,14 +3324,14 @@
3324
3324
  var _this = this;
3325
3325
  if (loadState === void 0) { loadState = true; }
3326
3326
  // Register an Api method for getting the column type
3327
- $.fn.DataTable.Api.registerPlural('columns().type()', 'column().type()', function () {
3327
+ $$1.fn.DataTable.Api.registerPlural('columns().type()', 'column().type()', function () {
3328
3328
  return this.iterator('column', function (settings, column) {
3329
3329
  return settings.aoColumns[column].sType;
3330
3330
  }, 1);
3331
3331
  });
3332
3332
  // Check that DateTime is included, If not need to check if it could be used
3333
3333
  // eslint-disable-next-line no-extra-parens
3334
- if (!dataTable.DateTime) {
3334
+ if (!dataTable$1.DateTime) {
3335
3335
  var types = this.s.dt.columns().type().toArray();
3336
3336
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3337
3337
  types = [];
@@ -3343,7 +3343,7 @@
3343
3343
  var columnIdxs = this.s.dt.columns().toArray();
3344
3344
  // If the types are not yet set then draw to see if they can be retrieved then
3345
3345
  if (types === undefined || types.includes(undefined) || types.includes(null)) {
3346
- $.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3346
+ $$1.fn.dataTable.ext.oApi._fnColumnTypes(this.s.dt.settings()[0]);
3347
3347
  types = this.s.dt.columns().type().toArray();
3348
3348
  }
3349
3349
  for (var i = 0; i < columnIdxs[0].length; i++) {
@@ -3466,7 +3466,7 @@
3466
3466
  this.dom.container.append(this.dom.topGroup);
3467
3467
  this._setRedrawListener();
3468
3468
  var tableNode = this.s.dt.table(0).node();
3469
- if (!$.fn.dataTable.ext.search.includes(this.s.search)) {
3469
+ if (!$$1.fn.dataTable.ext.search.includes(this.s.search)) {
3470
3470
  // Custom search function for SearchBuilder
3471
3471
  this.s.search = function (settings, searchData, dataIndex) {
3472
3472
  if (settings.nTable !== tableNode) {
@@ -3475,18 +3475,18 @@
3475
3475
  return _this.s.topGroup.search(searchData, dataIndex);
3476
3476
  };
3477
3477
  // Add SearchBuilder search function to the dataTables search array
3478
- $.fn.dataTable.ext.search.push(this.s.search);
3478
+ $$1.fn.dataTable.ext.search.push(this.s.search);
3479
3479
  }
3480
3480
  this.s.dt.on('destroy.dtsb', function () {
3481
3481
  _this.dom.container.remove();
3482
3482
  _this.dom.clearAll.remove();
3483
- var searchIdx = $.fn.dataTable.ext.search.indexOf(_this.s.search);
3483
+ var searchIdx = $$1.fn.dataTable.ext.search.indexOf(_this.s.search);
3484
3484
  while (searchIdx !== -1) {
3485
- $.fn.dataTable.ext.search.splice(searchIdx, 1);
3486
- searchIdx = $.fn.dataTable.ext.search.indexOf(_this.s.search);
3485
+ $$1.fn.dataTable.ext.search.splice(searchIdx, 1);
3486
+ searchIdx = $$1.fn.dataTable.ext.search.indexOf(_this.s.search);
3487
3487
  }
3488
3488
  _this.s.dt.off('.dtsb');
3489
- $(_this.s.dt.table().node()).off('.dtsb');
3489
+ $$1(_this.s.dt.table().node()).off('.dtsb');
3490
3490
  });
3491
3491
  };
3492
3492
  /**
@@ -3597,7 +3597,7 @@
3597
3597
  _this.dom.clearAll.remove();
3598
3598
  });
3599
3599
  };
3600
- SearchBuilder.version = '1.3.4';
3600
+ SearchBuilder.version = '1.4.2';
3601
3601
  SearchBuilder.classes = {
3602
3602
  button: 'dtsb-button',
3603
3603
  clearAll: 'dtsb-clearAll',
@@ -3703,149 +3703,123 @@
3703
3703
  return SearchBuilder;
3704
3704
  }());
3705
3705
 
3706
- /*! SearchBuilder 1.3.4
3706
+ /*! SearchBuilder 1.4.2
3707
3707
  * ©SpryMedia Ltd - datatables.net/license/mit
3708
3708
  */
3709
- // DataTables extensions common UMD. Note that this allows for AMD, CommonJS
3710
- // (with window and jQuery being allowed as parameters to the returned
3711
- // function) or just default browser loading.
3712
- (function (factory) {
3713
- if (typeof define === 'function' && define.amd) {
3714
- // AMD
3715
- define(['jquery', 'datatables.net'], function ($) {
3716
- return factory($, window, document);
3709
+ setJQuery($);
3710
+ setJQuery$1($);
3711
+ setJQuery$2($);
3712
+ var dataTable = $.fn.dataTable;
3713
+ // eslint-disable-next-line no-extra-parens
3714
+ DataTable.SearchBuilder = SearchBuilder;
3715
+ // eslint-disable-next-line no-extra-parens
3716
+ dataTable.SearchBuilder = SearchBuilder;
3717
+ // eslint-disable-next-line no-extra-parens
3718
+ DataTable.Group = Group;
3719
+ // eslint-disable-next-line no-extra-parens
3720
+ dataTable.Group = Group;
3721
+ // eslint-disable-next-line no-extra-parens
3722
+ DataTable.Criteria = Criteria;
3723
+ // eslint-disable-next-line no-extra-parens
3724
+ dataTable.Criteria = Criteria;
3725
+ // eslint-disable-next-line no-extra-parens
3726
+ var apiRegister = DataTable.Api.register;
3727
+ // Set up object for plugins
3728
+ DataTable.ext.searchBuilder = {
3729
+ conditions: {}
3730
+ };
3731
+ DataTable.ext.buttons.searchBuilder = {
3732
+ action: function (e, dt, node, config) {
3733
+ this.popover(config._searchBuilder.getNode(), {
3734
+ align: 'container',
3735
+ span: 'container'
3717
3736
  });
3737
+ var topGroup = config._searchBuilder.s.topGroup;
3738
+ // Need to redraw the contents to calculate the correct positions for the elements
3739
+ if (topGroup !== undefined) {
3740
+ topGroup.dom.container.trigger('dtsb-redrawContents-noDraw');
3741
+ }
3742
+ if (topGroup.s.criteria.length === 0) {
3743
+ $('.' + $.fn.dataTable.Group.classes.add.replace(/ /g, '.')).click();
3744
+ }
3745
+ },
3746
+ config: {},
3747
+ init: function (dt, node, config) {
3748
+ var sb = new DataTable.SearchBuilder(dt, $.extend({
3749
+ filterChanged: function (count, text) {
3750
+ dt.button(node).text(text);
3751
+ }
3752
+ }, config.config));
3753
+ dt.button(node).text(config.text || dt.i18n('searchBuilder.button', sb.c.i18n.button, 0));
3754
+ config._searchBuilder = sb;
3755
+ },
3756
+ text: null
3757
+ };
3758
+ apiRegister('searchBuilder.getDetails()', function (deFormatDates) {
3759
+ if (deFormatDates === void 0) { deFormatDates = false; }
3760
+ var ctx = this.context[0];
3761
+ // If SearchBuilder has not been initialised on this instance then return
3762
+ return ctx._searchBuilder ?
3763
+ ctx._searchBuilder.getDetails(deFormatDates) :
3764
+ null;
3765
+ });
3766
+ apiRegister('searchBuilder.rebuild()', function (details) {
3767
+ var ctx = this.context[0];
3768
+ // If SearchBuilder has not been initialised on this instance then return
3769
+ if (ctx._searchBuilder === undefined) {
3770
+ return null;
3718
3771
  }
3719
- else if (typeof exports === 'object') {
3720
- // CommonJS
3721
- module.exports = function (root, $) {
3722
- if (!root) {
3723
- root = window;
3724
- }
3725
- if (!$ || !$.fn.dataTable) {
3726
- // eslint-disable-next-line @typescript-eslint/no-var-requires
3727
- $ = require('datatables.net')(root, $).$;
3728
- }
3729
- return factory($, root, root.document);
3730
- };
3731
- }
3732
- else {
3733
- // Browser - assume jQuery has already been loaded
3734
- // eslint-disable-next-line no-extra-parens
3735
- factory(window.jQuery, window, document);
3736
- }
3737
- }(function ($, window, document) {
3738
- setJQuery($);
3739
- setJQuery$1($);
3740
- setJQuery$2($);
3741
- var dataTable = $.fn.dataTable;
3742
- // eslint-disable-next-line no-extra-parens
3743
- $.fn.dataTable.SearchBuilder = SearchBuilder;
3744
- // eslint-disable-next-line no-extra-parens
3745
- $.fn.DataTable.SearchBuilder = SearchBuilder;
3746
- // eslint-disable-next-line no-extra-parens
3747
- $.fn.dataTable.Group = Group;
3748
- // eslint-disable-next-line no-extra-parens
3749
- $.fn.DataTable.Group = Group;
3750
- // eslint-disable-next-line no-extra-parens
3751
- $.fn.dataTable.Criteria = Criteria;
3752
- // eslint-disable-next-line no-extra-parens
3753
- $.fn.DataTable.Criteria = Criteria;
3754
- // eslint-disable-next-line no-extra-parens
3755
- var apiRegister = $.fn.dataTable.Api.register;
3756
- // Set up object for plugins
3757
- $.fn.dataTable.ext.searchBuilder = {
3758
- conditions: {}
3759
- };
3760
- $.fn.dataTable.ext.buttons.searchBuilder = {
3761
- action: function (e, dt, node, config) {
3762
- this.popover(config._searchBuilder.getNode(), {
3763
- align: 'container',
3764
- span: 'container'
3765
- });
3766
- var topGroup = config._searchBuilder.s.topGroup;
3767
- // Need to redraw the contents to calculate the correct positions for the elements
3768
- if (topGroup !== undefined) {
3769
- topGroup.dom.container.trigger('dtsb-redrawContents-noDraw');
3770
- }
3771
- if (topGroup.s.criteria.length === 0) {
3772
- $('.' + $.fn.dataTable.Group.classes.add.replace(/ /g, '.')).click();
3773
- }
3774
- },
3775
- config: {},
3776
- init: function (dt, node, config) {
3777
- var sb = new $.fn.dataTable.SearchBuilder(dt, $.extend({
3778
- filterChanged: function (count, text) {
3779
- dt.button(node).text(text);
3780
- }
3781
- }, config.config));
3782
- dt.button(node).text(config.text || dt.i18n('searchBuilder.button', sb.c.i18n.button, 0));
3783
- config._searchBuilder = sb;
3784
- },
3785
- text: null
3786
- };
3787
- apiRegister('searchBuilder.getDetails()', function (deFormatDates) {
3788
- if (deFormatDates === void 0) { deFormatDates = false; }
3789
- var ctx = this.context[0];
3790
- // If SearchBuilder has not been initialised on this instance then return
3791
- return ctx._searchBuilder ?
3792
- ctx._searchBuilder.getDetails(deFormatDates) :
3793
- null;
3794
- });
3795
- apiRegister('searchBuilder.rebuild()', function (details) {
3796
- var ctx = this.context[0];
3797
- // If SearchBuilder has not been initialised on this instance then return
3798
- if (ctx._searchBuilder === undefined) {
3799
- return null;
3800
- }
3801
- ctx._searchBuilder.rebuild(details);
3802
- return this;
3803
- });
3804
- apiRegister('searchBuilder.container()', function () {
3805
- var ctx = this.context[0];
3806
- // If SearchBuilder has not been initialised on this instance then return
3807
- return ctx._searchBuilder ?
3808
- ctx._searchBuilder.getNode() :
3809
- null;
3810
- });
3811
- /**
3812
- * Init function for SearchBuilder
3813
- *
3814
- * @param settings the settings to be applied
3815
- * @param options the options for SearchBuilder
3816
- * @returns JQUERY<HTMLElement> Returns the node of the SearchBuilder
3817
- */
3818
- function _init(settings, options) {
3819
- var api = new dataTable.Api(settings);
3820
- var opts = options
3821
- ? options
3822
- : api.init().searchBuilder || dataTable.defaults.searchBuilder;
3823
- var searchBuilder = new SearchBuilder(api, opts);
3824
- var node = searchBuilder.getNode();
3825
- return node;
3772
+ ctx._searchBuilder.rebuild(details);
3773
+ return this;
3774
+ });
3775
+ apiRegister('searchBuilder.container()', function () {
3776
+ var ctx = this.context[0];
3777
+ // If SearchBuilder has not been initialised on this instance then return
3778
+ return ctx._searchBuilder ?
3779
+ ctx._searchBuilder.getNode() :
3780
+ null;
3781
+ });
3782
+ /**
3783
+ * Init function for SearchBuilder
3784
+ *
3785
+ * @param settings the settings to be applied
3786
+ * @param options the options for SearchBuilder
3787
+ * @returns JQUERY<HTMLElement> Returns the node of the SearchBuilder
3788
+ */
3789
+ function _init(settings, options) {
3790
+ var api = new DataTable.Api(settings);
3791
+ var opts = options
3792
+ ? options
3793
+ : api.init().searchBuilder || DataTable.defaults.searchBuilder;
3794
+ var searchBuilder = new SearchBuilder(api, opts);
3795
+ var node = searchBuilder.getNode();
3796
+ return node;
3797
+ }
3798
+ // Attach a listener to the document which listens for DataTables initialisation
3799
+ // events so we can automatically initialise
3800
+ $(document).on('preInit.dt.dtsp', function (e, settings) {
3801
+ if (e.namespace !== 'dt') {
3802
+ return;
3826
3803
  }
3827
- // Attach a listener to the document which listens for DataTables initialisation
3828
- // events so we can automatically initialise
3829
- $(document).on('preInit.dt.dtsp', function (e, settings) {
3830
- if (e.namespace !== 'dt') {
3831
- return;
3804
+ if (settings.oInit.searchBuilder ||
3805
+ DataTable.defaults.searchBuilder) {
3806
+ if (!settings._searchBuilder) {
3807
+ _init(settings);
3832
3808
  }
3833
- if (settings.oInit.searchBuilder ||
3834
- dataTable.defaults.searchBuilder) {
3835
- if (!settings._searchBuilder) {
3836
- _init(settings);
3837
- }
3838
- }
3839
- });
3840
- // DataTables `dom` feature option
3841
- dataTable.ext.feature.push({
3842
- cFeature: 'Q',
3843
- fnInit: _init
3844
- });
3845
- // DataTables 2 layout feature
3846
- if (dataTable.ext.features) {
3847
- dataTable.ext.features.register('searchBuilder', _init);
3848
3809
  }
3849
- }));
3810
+ });
3811
+ // DataTables `dom` feature option
3812
+ DataTable.ext.feature.push({
3813
+ cFeature: 'Q',
3814
+ fnInit: _init
3815
+ });
3816
+ // DataTables 2 layout feature
3817
+ if (DataTable.ext.features) {
3818
+ DataTable.ext.features.register('searchBuilder', _init);
3819
+ }
3850
3820
 
3851
3821
  }());
3822
+
3823
+
3824
+ return DataTable;
3825
+ }));