@websy/websy-designs 1.2.33 → 1.3.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.
@@ -53,6 +53,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
53
53
  WebsySignup
54
54
  ResponsiveText
55
55
  WebsyDragDrop
56
+ WebsySearch
56
57
  Pager
57
58
  */
58
59
 
@@ -684,7 +685,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
684
685
  value: function floorDate(d) {
685
686
  if (typeof d === 'number') {
686
687
  d = new Date(d);
687
- }
688
+ } // d.setTime(d.getTime() + d.getTimezoneOffset() * 60000)
689
+
688
690
 
689
691
  return new Date(d.setHours(0, 0, 0, 0));
690
692
  }
@@ -703,11 +705,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
703
705
  var index = event.target.getAttribute('data-index');
704
706
  this.selectRange(index);
705
707
  this.updateRange(index);
706
- } else if (event.target.classList.contains('websy-dp-date')) {// if (event.target.classList.contains('websy-disabled-date')) {
707
- // return
708
- // }
709
- // const timestamp = event.target.id.split('_')[0]
710
- // this.selectDate(+timestamp)
708
+ } else if (event.target.classList.contains('websy-dp-date')) {//
711
709
  } else if (event.target.classList.contains('websy-dp-confirm')) {
712
710
  this.close(true);
713
711
  } else if (event.target.classList.contains('websy-dp-cancel')) {
@@ -741,7 +739,8 @@ var WebsyDatePicker = /*#__PURE__*/function () {
741
739
  value: function handleMouseDown(event) {
742
740
  if (this.shiftPressed === true && this.currentselection.length > 0) {
743
741
  this.mouseDownId = this.currentselection[this.currentselection.length - 1];
744
- this.selectDate(+event.target.id.split('_')[1]);
742
+ var dateId = event.target.getAttribute('data-id');
743
+ this.selectDate(+dateId);
745
744
  } else {
746
745
  this.mouseDown = true;
747
746
  this.dragging = false;
@@ -756,7 +755,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
756
755
  this.customRangeSelected = false;
757
756
  }
758
757
 
759
- this.mouseDownId = +event.target.id.split('_')[1];
758
+ this.mouseDownId = +event.target.getAttribute('data-id');
760
759
  this.selectDate(this.mouseDownId);
761
760
  }
762
761
  }
@@ -770,9 +769,11 @@ var WebsyDatePicker = /*#__PURE__*/function () {
770
769
  return;
771
770
  }
772
771
 
773
- if (event.target.id.split('_')[1] !== this.mouseDownId) {
772
+ var dateId = +event.target.getAttribute('data-id');
773
+
774
+ if (dateId !== this.mouseDownId) {
774
775
  this.dragging = true;
775
- this.selectDate(+event.target.id.split('_')[1]);
776
+ this.selectDate(dateId);
776
777
  }
777
778
  }
778
779
  }
@@ -828,6 +829,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
828
829
 
829
830
  if (this.options.mode === 'date') {
830
831
  d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + _i * this.oneDay));
832
+ d.setHours(0, 0, 0, 0);
831
833
  d = d.getTime();
832
834
  rangeStart = this.selectedRangeDates[0].getTime();
833
835
  rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime();
@@ -1120,7 +1122,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1120
1122
  }
1121
1123
 
1122
1124
  html += months[key].map(function (d) {
1123
- return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_date' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
1125
+ return "<li id='".concat(_this6.elementId, "_").concat(d.id, "_date' data-id='").concat(d.id, "' class='websy-dp-date ").concat(d.disabled === true ? 'websy-disabled-date' : '', "'>").concat(d.dayOfMonth, "</li>");
1124
1126
  }).join('');
1125
1127
  html += "\n </ul>\n </div>\n ";
1126
1128
  }
@@ -1257,7 +1259,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1257
1259
 
1258
1260
  if (this.options.ranges[this.options.mode][index]) {
1259
1261
  this.selectedRangeDates = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1260
- this.currentselection = _toConsumableArray(this.options.ranges[this.options.mode][index].range);
1262
+ this.currentselection = this.options.ranges[this.options.mode][index].range.map(function (d) {
1263
+ return d.getTime();
1264
+ });
1261
1265
  this.selectedRange = +index;
1262
1266
  var el = document.getElementById("".concat(this.elementId, "_header"));
1263
1267
 
@@ -1813,14 +1817,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
1813
1817
  }, {
1814
1818
  key: "updateHeader",
1815
1819
  value: function updateHeader(item) {
1816
- var _this12 = this;
1817
-
1818
1820
  var el = document.getElementById(this.elementId);
1819
1821
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
1820
1822
  var headerLabelEl = document.getElementById("".concat(this.elementId, "_headerLabel"));
1821
1823
  var labelEl = document.getElementById("".concat(this.elementId, "_selectedItems"));
1822
1824
  var inputEl = document.getElementById("".concat(this.elementId, "_input"));
1823
1825
  var itemEls = el.querySelectorAll(".websy-dropdown-item");
1826
+ var dataToUse = this._originalData;
1827
+
1828
+ if (this.options.onSearch) {
1829
+ dataToUse = this.options.items;
1830
+ }
1824
1831
 
1825
1832
  for (var i = 0; i < itemEls.length; i++) {
1826
1833
  itemEls[i].classList.remove('active');
@@ -1860,17 +1867,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
1860
1867
  } else if (this.selectedItems.length > 1) {
1861
1868
  if (this.options.showCompleteSelectedList === true) {
1862
1869
  var selectedLabels = this.selectedItems.map(function (s) {
1863
- return _this12.options.items[s].label || _this12.options.items[s].value;
1870
+ return dataToUse[s].label || dataToUse[s].value;
1864
1871
  }).join(this.options.multiValueDelimiter);
1865
1872
  var selectedValues = this.selectedItems.map(function (s) {
1866
- return _this12.options.items[s].value || _this12.options.items[s].label;
1873
+ return dataToUse[s].value || dataToUse[s].label;
1867
1874
  }).join(this.options.multiValueDelimiter);
1868
1875
  labelEl.innerHTML = selectedLabels;
1869
1876
  labelEl.setAttribute('data-info', selectedLabels);
1870
1877
  inputEl.value = selectedValues;
1871
1878
  } else {
1872
1879
  var _selectedValues = this.selectedItems.map(function (s) {
1873
- return _this12.options.items[s].value || _this12.options.items[s].label;
1880
+ return dataToUse[s].value || dataToUse[s].label;
1874
1881
  }).join(this.options.multiValueDelimiter);
1875
1882
 
1876
1883
  labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
@@ -1887,6 +1894,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
1887
1894
  }, {
1888
1895
  key: "updateSelected",
1889
1896
  value: function updateSelected(index) {
1897
+ var dataToUse = this._originalData && this._originalData.length > 0 ? this._originalData : this.options.items;
1898
+
1899
+ if (this.options.onSearch) {
1900
+ dataToUse = this.options.items;
1901
+ }
1902
+
1890
1903
  if (typeof index !== 'undefined' && index !== null) {
1891
1904
  var pos = this.selectedItems.indexOf(index);
1892
1905
 
@@ -1902,11 +1915,11 @@ var WebsyDropdown = /*#__PURE__*/function () {
1902
1915
  } // const item = this.options.items[index]
1903
1916
 
1904
1917
 
1905
- var item = this._originalData[index] || this.options.items[index];
1918
+ var item = dataToUse[index];
1906
1919
  this.updateHeader(item);
1907
1920
 
1908
1921
  if (item && this.options.onItemSelected) {
1909
- this.options.onItemSelected(item, this.selectedItems, this._originalData || this.options.items, this.options);
1922
+ this.options.onItemSelected(item, this.selectedItems, dataToUse, this.options);
1910
1923
  }
1911
1924
 
1912
1925
  if (this.options.closeAfterSelection === true) {
@@ -1926,6 +1939,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1926
1939
  d.index = i;
1927
1940
  }
1928
1941
 
1942
+ d.currentIndex = i;
1929
1943
  return d;
1930
1944
  });
1931
1945
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
@@ -1936,16 +1950,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
1936
1950
 
1937
1951
  var el = document.getElementById("".concat(this.elementId, "_items"));
1938
1952
 
1939
- if (el.childElementCount === 0) {
1940
- this.render();
1941
- } else {
1942
- if (this.options.items.length === 0) {
1943
- this.options.items = [{
1944
- label: this.options.noItemsText || 'No Items'
1945
- }];
1946
- }
1953
+ if (el) {
1954
+ if (el.childElementCount === 0) {
1955
+ this.render();
1956
+ } else {
1957
+ if (this.options.items.length === 0) {
1958
+ this.options.items = [{
1959
+ label: this.options.noItemsText || 'No Items'
1960
+ }];
1961
+ }
1947
1962
 
1948
- this.renderItems();
1963
+ this.renderItems();
1964
+ }
1949
1965
  }
1950
1966
  },
1951
1967
  get: function get() {
@@ -1991,8 +2007,6 @@ var WebsyDragDrop = /*#__PURE__*/function () {
1991
2007
  }
1992
2008
 
1993
2009
  GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this));
1994
- console.log('constructor dd');
1995
- console.trace();
1996
2010
  GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this));
1997
2011
  this.render();
1998
2012
  }
@@ -2067,16 +2081,15 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2067
2081
  el: event.target.id,
2068
2082
  id: this.elementId,
2069
2083
  itemId: this.draggedId
2070
- }));
2071
- console.log('drag start', event);
2084
+ })); // console.log('drag start', event)
2085
+
2072
2086
  event.target.style.opacity = 0.5;
2073
2087
  this.dragging = true;
2074
2088
  }
2075
2089
  }, {
2076
2090
  key: "handleDragOver",
2077
2091
  value: function handleDragOver(event) {
2078
- console.log('drag over', event.target.classList);
2079
-
2092
+ // console.log('drag over', event.target.classList)
2080
2093
  if (event.preventDefault) {
2081
2094
  event.preventDefault();
2082
2095
  }
@@ -2090,8 +2103,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2090
2103
  }, {
2091
2104
  key: "handleDragLeave",
2092
2105
  value: function handleDragLeave(event) {
2093
- console.log('drag leave', event.target.classList);
2094
-
2106
+ // console.log('drag leave', event.target.classList)
2095
2107
  if (!event.target.classList.contains('droppable')) {
2096
2108
  return;
2097
2109
  }
@@ -2104,8 +2116,8 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2104
2116
  }, {
2105
2117
  key: "handleDrop",
2106
2118
  value: function handleDrop(event) {
2107
- console.log('drag drop');
2108
- console.log(event.dataTransfer.getData('application/wd-item'));
2119
+ // console.log('drag drop')
2120
+ // console.log(event.dataTransfer.getData('application/wd-item'))
2109
2121
  var data = JSON.parse(event.dataTransfer.getData('application/wd-item'));
2110
2122
 
2111
2123
  if (event.preventDefault) {
@@ -2127,7 +2139,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2127
2139
  }
2128
2140
 
2129
2141
  if (draggedIndex === -1) {
2130
- console.log('requestForDDItem');
2142
+ // console.log('requestForDDItem')
2131
2143
  GlobalPubSub.publish(data.id, 'requestForDDItem', {
2132
2144
  group: this.options.group,
2133
2145
  source: data.id,
@@ -2171,7 +2183,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2171
2183
  }, {
2172
2184
  key: "handleDragEnd",
2173
2185
  value: function handleDragEnd(event) {
2174
- console.log('drag end');
2186
+ // console.log('drag end')
2175
2187
  event.target.style.opacity = 1;
2176
2188
  this.draggedId = null;
2177
2189
  this.dragging = false;
@@ -2241,7 +2253,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2241
2253
  }, {
2242
2254
  key: "render",
2243
2255
  value: function render() {
2244
- var _this13 = this;
2256
+ var _this12 = this;
2245
2257
 
2246
2258
  var el = document.getElementById("".concat(this.elementId, "_container"));
2247
2259
 
@@ -2249,7 +2261,7 @@ var WebsyDragDrop = /*#__PURE__*/function () {
2249
2261
  this.measureItems();
2250
2262
  var html = "\n <div id='".concat(this.elementId, "start_item' class='websy-dragdrop-item ").concat(this.options.items.length === 0 ? 'empty' : '', "' data-id='").concat(this.elementId, "start'>\n <div id='").concat(this.elementId, "start_dropZone' class='websy-drop-zone droppable' data-index='start' data-side='start' data-id='").concat(this.elementId, "start' data-placeholder='").concat(this.options.dropPlaceholder, "'></div>\n </div>\n ");
2251
2263
  html += this.options.items.map(function (d, i) {
2252
- return _this13.createItemHtml(_this13.elementId, i, d);
2264
+ return _this12.createItemHtml(_this12.elementId, i, d);
2253
2265
  }).join('');
2254
2266
  el.innerHTML = html;
2255
2267
  this.options.items.forEach(function (item, i) {
@@ -2328,16 +2340,16 @@ var WebsyForm = /*#__PURE__*/function () {
2328
2340
  }, {
2329
2341
  key: "checkRecaptcha",
2330
2342
  value: function checkRecaptcha() {
2331
- var _this14 = this;
2343
+ var _this13 = this;
2332
2344
 
2333
2345
  return new Promise(function (resolve, reject) {
2334
- if (_this14.options.useRecaptcha === true) {
2346
+ if (_this13.options.useRecaptcha === true) {
2335
2347
  // if (this.recaptchaValue) {
2336
2348
  grecaptcha.ready(function () {
2337
2349
  grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
2338
2350
  action: 'submit'
2339
2351
  }).then(function (token) {
2340
- _this14.apiService.add('google/checkrecaptcha', {
2352
+ _this13.apiService.add('google/checkrecaptcha', {
2341
2353
  grecaptcharesponse: token
2342
2354
  }).then(function (response) {
2343
2355
  if (response.success && response.success === true) {
@@ -2400,14 +2412,14 @@ var WebsyForm = /*#__PURE__*/function () {
2400
2412
  }, {
2401
2413
  key: "processComponents",
2402
2414
  value: function processComponents(components, callbackFn) {
2403
- var _this15 = this;
2415
+ var _this14 = this;
2404
2416
 
2405
2417
  if (components.length === 0) {
2406
2418
  callbackFn();
2407
2419
  } else {
2408
2420
  components.forEach(function (c) {
2409
2421
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
2410
- c.instance = new WebsyDesigns[c.component]("".concat(_this15.elementId, "_input_").concat(c.field, "_component"), c.options);
2422
+ c.instance = new WebsyDesigns[c.component]("".concat(_this14.elementId, "_input_").concat(c.field, "_component"), c.options);
2411
2423
  } else {// some user feedback here
2412
2424
  }
2413
2425
  });
@@ -2428,7 +2440,7 @@ var WebsyForm = /*#__PURE__*/function () {
2428
2440
  }, {
2429
2441
  key: "render",
2430
2442
  value: function render(update, data) {
2431
- var _this16 = this;
2443
+ var _this15 = this;
2432
2444
 
2433
2445
  var el = document.getElementById(this.elementId);
2434
2446
  var componentsToProcess = [];
@@ -2438,11 +2450,11 @@ var WebsyForm = /*#__PURE__*/function () {
2438
2450
  this.options.fields.forEach(function (f, i) {
2439
2451
  if (f.component) {
2440
2452
  componentsToProcess.push(f);
2441
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2453
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this15.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2442
2454
  } else if (f.type === 'longtext') {
2443
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2455
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
2444
2456
  } else {
2445
- html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this16.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2457
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this15.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
2446
2458
  }
2447
2459
  });
2448
2460
  html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
@@ -2459,7 +2471,7 @@ var WebsyForm = /*#__PURE__*/function () {
2459
2471
 
2460
2472
  el.innerHTML = html;
2461
2473
  this.processComponents(componentsToProcess, function () {
2462
- if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
2474
+ if (_this15.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
2463
2475
  }
2464
2476
  });
2465
2477
  }
@@ -2467,7 +2479,7 @@ var WebsyForm = /*#__PURE__*/function () {
2467
2479
  }, {
2468
2480
  key: "submitForm",
2469
2481
  value: function submitForm() {
2470
- var _this17 = this;
2482
+ var _this16 = this;
2471
2483
 
2472
2484
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
2473
2485
 
@@ -2481,32 +2493,32 @@ var WebsyForm = /*#__PURE__*/function () {
2481
2493
  data[key] = value;
2482
2494
  });
2483
2495
 
2484
- if (_this17.options.url) {
2485
- var _this17$apiService;
2496
+ if (_this16.options.url) {
2497
+ var _this16$apiService;
2486
2498
 
2487
- var params = [_this17.options.url];
2499
+ var params = [_this16.options.url];
2488
2500
 
2489
- if (_this17.options.mode === 'update') {
2490
- params.push(_this17.options.id);
2501
+ if (_this16.options.mode === 'update') {
2502
+ params.push(_this16.options.id);
2491
2503
  }
2492
2504
 
2493
2505
  params.push(data);
2494
2506
 
2495
- (_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
2496
- if (_this17.options.clearAfterSave === true) {
2507
+ (_this16$apiService = _this16.apiService)[_this16.options.mode].apply(_this16$apiService, params).then(function (result) {
2508
+ if (_this16.options.clearAfterSave === true) {
2497
2509
  // this.render()
2498
2510
  formEl.reset();
2499
2511
  }
2500
2512
 
2501
- _this17.options.onSuccess.call(_this17, result);
2513
+ _this16.options.onSuccess.call(_this16, result);
2502
2514
  }, function (err) {
2503
2515
  console.log('Error submitting form data:', err);
2504
2516
 
2505
- _this17.options.onError.call(_this17, err);
2517
+ _this16.options.onError.call(_this16, err);
2506
2518
  });
2507
- } else if (_this17.options.submitFn) {
2508
- _this17.options.submitFn(data, function () {
2509
- if (_this17.options.clearAfterSave === true) {
2519
+ } else if (_this16.options.submitFn) {
2520
+ _this16.options.submitFn(data, function () {
2521
+ if (_this16.options.clearAfterSave === true) {
2510
2522
  // this.render()
2511
2523
  formEl.reset();
2512
2524
  }
@@ -2526,17 +2538,17 @@ var WebsyForm = /*#__PURE__*/function () {
2526
2538
  }, {
2527
2539
  key: "data",
2528
2540
  set: function set(d) {
2529
- var _this18 = this;
2541
+ var _this17 = this;
2530
2542
 
2531
2543
  if (!this.options.fields) {
2532
2544
  this.options.fields = [];
2533
2545
  }
2534
2546
 
2535
2547
  var _loop = function _loop(key) {
2536
- _this18.options.fields.forEach(function (f) {
2548
+ _this17.options.fields.forEach(function (f) {
2537
2549
  if (f.field === key) {
2538
2550
  f.value = d[key];
2539
- var el = document.getElementById("".concat(_this18.elementId, "_input_").concat(f.field));
2551
+ var el = document.getElementById("".concat(_this17.elementId, "_input_").concat(f.field));
2540
2552
  el.value = f.value;
2541
2553
  }
2542
2554
  });
@@ -2915,7 +2927,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2915
2927
 
2916
2928
  var Pager = /*#__PURE__*/function () {
2917
2929
  function Pager(elementId, options) {
2918
- var _this19 = this;
2930
+ var _this18 = this;
2919
2931
 
2920
2932
  _classCallCheck(this, Pager);
2921
2933
 
@@ -2968,8 +2980,8 @@ var Pager = /*#__PURE__*/function () {
2968
2980
  allowClear: false,
2969
2981
  disableSearch: true,
2970
2982
  onItemSelected: function onItemSelected(selectedItem) {
2971
- if (_this19.options.onChangePageSize) {
2972
- _this19.options.onChangePageSize(selectedItem.value);
2983
+ if (_this18.options.onChangePageSize) {
2984
+ _this18.options.onChangePageSize(selectedItem.value);
2973
2985
  }
2974
2986
  }
2975
2987
  });
@@ -2993,13 +3005,13 @@ var Pager = /*#__PURE__*/function () {
2993
3005
  }, {
2994
3006
  key: "render",
2995
3007
  value: function render() {
2996
- var _this20 = this;
3008
+ var _this19 = this;
2997
3009
 
2998
3010
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
2999
3011
 
3000
3012
  if (el) {
3001
3013
  var pages = this.options.pages.map(function (item, index) {
3002
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this20.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3014
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3003
3015
  });
3004
3016
  var startIndex = 0;
3005
3017
 
@@ -3067,58 +3079,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3067
3079
  _createClass(WebsyPDFButton, [{
3068
3080
  key: "handleClick",
3069
3081
  value: function handleClick(event) {
3070
- var _this21 = this;
3082
+ var _this20 = this;
3071
3083
 
3072
3084
  if (event.target.classList.contains('websy-pdf-button')) {
3073
3085
  this.loader.show();
3074
3086
  setTimeout(function () {
3075
- if (_this21.options.targetId) {
3076
- var el = document.getElementById(_this21.options.targetId);
3087
+ if (_this20.options.targetId) {
3088
+ var el = document.getElementById(_this20.options.targetId);
3077
3089
 
3078
3090
  if (el) {
3079
3091
  var pdfData = {
3080
3092
  options: {}
3081
3093
  };
3082
3094
 
3083
- if (_this21.options.pdfOptions) {
3084
- pdfData.options = _extends({}, _this21.options.pdfOptions);
3095
+ if (_this20.options.pdfOptions) {
3096
+ pdfData.options = _extends({}, _this20.options.pdfOptions);
3085
3097
  }
3086
3098
 
3087
- if (_this21.options.header) {
3088
- if (_this21.options.header.elementId) {
3089
- var headerEl = document.getElementById(_this21.options.header.elementId);
3099
+ if (_this20.options.header) {
3100
+ if (_this20.options.header.elementId) {
3101
+ var headerEl = document.getElementById(_this20.options.header.elementId);
3090
3102
 
3091
3103
  if (headerEl) {
3092
3104
  pdfData.header = headerEl.outerHTML;
3093
3105
 
3094
- if (_this21.options.header.css) {
3095
- pdfData.options.headerCSS = _this21.options.header.css;
3106
+ if (_this20.options.header.css) {
3107
+ pdfData.options.headerCSS = _this20.options.header.css;
3096
3108
  }
3097
3109
  }
3098
- } else if (_this21.options.header.html) {
3099
- pdfData.header = _this21.options.header.html;
3110
+ } else if (_this20.options.header.html) {
3111
+ pdfData.header = _this20.options.header.html;
3100
3112
 
3101
- if (_this21.options.header.css) {
3102
- pdfData.options.headerCSS = _this21.options.header.css;
3113
+ if (_this20.options.header.css) {
3114
+ pdfData.options.headerCSS = _this20.options.header.css;
3103
3115
  }
3104
3116
  } else {
3105
- pdfData.header = _this21.options.header;
3117
+ pdfData.header = _this20.options.header;
3106
3118
  }
3107
3119
  }
3108
3120
 
3109
- if (_this21.options.footer) {
3110
- if (_this21.options.footer.elementId) {
3111
- var footerEl = document.getElementById(_this21.options.footer.elementId);
3121
+ if (_this20.options.footer) {
3122
+ if (_this20.options.footer.elementId) {
3123
+ var footerEl = document.getElementById(_this20.options.footer.elementId);
3112
3124
 
3113
3125
  if (footerEl) {
3114
3126
  pdfData.footer = footerEl.outerHTML;
3115
3127
 
3116
- if (_this21.options.footer.css) {
3117
- pdfData.options.footerCSS = _this21.options.footer.css;
3128
+ if (_this20.options.footer.css) {
3129
+ pdfData.options.footerCSS = _this20.options.footer.css;
3118
3130
  }
3119
3131
  }
3120
3132
  } else {
3121
- pdfData.footer = _this21.options.footer;
3133
+ pdfData.footer = _this20.options.footer;
3122
3134
  }
3123
3135
  }
3124
3136
 
@@ -3127,31 +3139,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
3127
3139
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
3128
3140
  // document.getElementById(`${this.elementId}_form`).submit()
3129
3141
 
3130
- _this21.service.add('', pdfData, {
3142
+ _this20.service.add('', pdfData, {
3131
3143
  responseType: 'blob'
3132
3144
  }).then(function (response) {
3133
- _this21.loader.hide();
3145
+ _this20.loader.hide();
3134
3146
 
3135
3147
  var blob = new Blob([response], {
3136
3148
  type: 'application/pdf'
3137
3149
  });
3138
3150
  var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
3139
3151
 
3140
- if (_this21.options.directDownload === true) {
3152
+ if (_this20.options.directDownload === true) {
3141
3153
  var fileName;
3142
3154
 
3143
- if (typeof _this21.options.fileName === 'function') {
3144
- fileName = _this21.options.fileName() || 'Export';
3155
+ if (typeof _this20.options.fileName === 'function') {
3156
+ fileName = _this20.options.fileName() || 'Export';
3145
3157
  } else {
3146
- fileName = _this21.options.fileName || 'Export';
3158
+ fileName = _this20.options.fileName || 'Export';
3147
3159
  }
3148
3160
 
3149
3161
  msg += "download='".concat(fileName, ".pdf'");
3150
3162
  }
3151
3163
 
3152
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this21.options.buttonText, "</button>\n </a>\n </div>\n ");
3164
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
3153
3165
 
3154
- _this21.popup.show({
3166
+ _this20.popup.show({
3155
3167
  message: msg,
3156
3168
  mask: true
3157
3169
  });
@@ -3319,9 +3331,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
3319
3331
  this.subscriptions[id][method](data);
3320
3332
  }
3321
3333
  } else {
3322
- if (this.subscriptions[method]) {
3323
- this.subscriptions[method].forEach(function (fn) {
3324
- fn(data);
3334
+ if (this.subscriptions[id]) {
3335
+ this.subscriptions[id].forEach(function (fn) {
3336
+ fn(method);
3325
3337
  });
3326
3338
  }
3327
3339
  }
@@ -3338,11 +3350,11 @@ var WebsyPubSub = /*#__PURE__*/function () {
3338
3350
  this.subscriptions[id][method] = fn;
3339
3351
  }
3340
3352
  } else {
3341
- if (!this.subscriptions[method]) {
3342
- this.subscriptions[method] = [];
3353
+ if (!this.subscriptions[id]) {
3354
+ this.subscriptions[id] = [];
3343
3355
  }
3344
3356
 
3345
- this.subscriptions[method].push(fn);
3357
+ this.subscriptions[id].push(method);
3346
3358
  }
3347
3359
  }
3348
3360
  }]);
@@ -3352,7 +3364,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3352
3364
 
3353
3365
  var ResponsiveText = /*#__PURE__*/function () {
3354
3366
  function ResponsiveText(elementId, options) {
3355
- var _this22 = this;
3367
+ var _this21 = this;
3356
3368
 
3357
3369
  _classCallCheck(this, ResponsiveText);
3358
3370
 
@@ -3365,7 +3377,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3365
3377
  this.elementId = elementId;
3366
3378
  this.canvas = document.createElement('canvas');
3367
3379
  window.addEventListener('resize', function () {
3368
- return _this22.render();
3380
+ return _this21.render();
3369
3381
  });
3370
3382
  var el = document.getElementById(this.elementId);
3371
3383
 
@@ -3584,7 +3596,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3584
3596
 
3585
3597
  var WebsyResultList = /*#__PURE__*/function () {
3586
3598
  function WebsyResultList(elementId, options) {
3587
- var _this23 = this;
3599
+ var _this22 = this;
3588
3600
 
3589
3601
  _classCallCheck(this, WebsyResultList);
3590
3602
 
@@ -3612,9 +3624,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3612
3624
 
3613
3625
  if (_typeof(options.template) === 'object' && options.template.url) {
3614
3626
  this.templateService.get(options.template.url).then(function (templateString) {
3615
- _this23.options.template = templateString;
3627
+ _this22.options.template = templateString;
3616
3628
 
3617
- _this23.render();
3629
+ _this22.render();
3618
3630
  });
3619
3631
  } else {
3620
3632
  this.render();
@@ -3633,7 +3645,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3633
3645
  }, {
3634
3646
  key: "buildHTML",
3635
3647
  value: function buildHTML(d) {
3636
- var _this24 = this;
3648
+ var _this23 = this;
3637
3649
 
3638
3650
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3639
3651
  var html = "";
@@ -3641,7 +3653,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3641
3653
  if (this.options.template) {
3642
3654
  if (d.length > 0) {
3643
3655
  d.forEach(function (row, ix) {
3644
- var template = "".concat(ix > 0 ? '-->' : '').concat(_this24.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3656
+ var template = "".concat(ix > 0 ? '-->' : '').concat(_this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3645
3657
 
3646
3658
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3647
3659
 
@@ -3761,7 +3773,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3761
3773
  }, {
3762
3774
  key: "handleClick",
3763
3775
  value: function handleClick(event) {
3764
- var _this25 = this;
3776
+ var _this24 = this;
3765
3777
 
3766
3778
  if (event.target.classList.contains('clickable')) {
3767
3779
  var l = event.target.getAttribute('data-event');
@@ -3779,8 +3791,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3779
3791
  l = l[0];
3780
3792
  params = params.map(function (p) {
3781
3793
  if (typeof p !== 'string' && typeof p !== 'number') {
3782
- if (_this25.rows[+id]) {
3783
- p = _this25.rows[+id][p];
3794
+ if (_this24.rows[+id]) {
3795
+ p = _this24.rows[+id][p];
3784
3796
  }
3785
3797
  } else if (typeof p === 'string') {
3786
3798
  p = p.replace(/"/g, '').replace(/'/g, '');
@@ -3802,13 +3814,13 @@ var WebsyResultList = /*#__PURE__*/function () {
3802
3814
  }, {
3803
3815
  key: "render",
3804
3816
  value: function render() {
3805
- var _this26 = this;
3817
+ var _this25 = this;
3806
3818
 
3807
3819
  if (this.options.entity) {
3808
3820
  this.apiService.get(this.options.entity).then(function (results) {
3809
- _this26.rows = results.rows;
3821
+ _this25.rows = results.rows;
3810
3822
 
3811
- _this26.resize();
3823
+ _this25.resize();
3812
3824
  });
3813
3825
  } else {
3814
3826
  this.resize();
@@ -3887,14 +3899,14 @@ var WebsyRouter = /*#__PURE__*/function () {
3887
3899
  _createClass(WebsyRouter, [{
3888
3900
  key: "addGroup",
3889
3901
  value: function addGroup(group) {
3890
- var _this27 = this;
3902
+ var _this26 = this;
3891
3903
 
3892
3904
  if (!this.groups[group]) {
3893
3905
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
3894
3906
 
3895
3907
  if (els) {
3896
3908
  this.getClosestParent(els[0], function (parent) {
3897
- _this27.groups[group] = {
3909
+ _this26.groups[group] = {
3898
3910
  activeView: '',
3899
3911
  views: [],
3900
3912
  parent: parent.getAttribute('data-view')
@@ -4219,12 +4231,12 @@ var WebsyRouter = /*#__PURE__*/function () {
4219
4231
  }, {
4220
4232
  key: "showComponents",
4221
4233
  value: function showComponents(view) {
4222
- var _this28 = this;
4234
+ var _this27 = this;
4223
4235
 
4224
4236
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
4225
4237
  this.options.views[view].components.forEach(function (c) {
4226
4238
  if (typeof c.instance === 'undefined') {
4227
- _this28.prepComponent(c.elementId, c.options);
4239
+ _this27.prepComponent(c.elementId, c.options);
4228
4240
 
4229
4241
  c.instance = new c.Component(c.elementId, c.options);
4230
4242
  } else if (c.instance.render) {
@@ -4515,6 +4527,59 @@ var WebsyRouter = /*#__PURE__*/function () {
4515
4527
 
4516
4528
  return WebsyRouter;
4517
4529
  }();
4530
+
4531
+ var WebsySearch = /*#__PURE__*/function () {
4532
+ function WebsySearch(elementId, options) {
4533
+ _classCallCheck(this, WebsySearch);
4534
+
4535
+ this.elementId = elementId;
4536
+ var DEFAULTS = {
4537
+ searchIcon: "<svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>",
4538
+ clearIcon: "<svg class='clear' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
4539
+ placeholder: 'Search',
4540
+ searchTimeout: 500,
4541
+ minLength: 2
4542
+ };
4543
+ this.options = _extends({}, DEFAULTS, options);
4544
+ this.searchTimeoutFn = null;
4545
+ var el = document.getElementById(elementId);
4546
+
4547
+ if (el) {
4548
+ // el.addEventListener('click', this.handleClick.bind(this))
4549
+ el.addEventListener('keyup', this.handleKeyUp.bind(this));
4550
+ el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "'>\n ").concat(this.options.clearIcon, "\n </div>\n ");
4551
+ } else {
4552
+ console.log('No element found with Id', elementId);
4553
+ }
4554
+ }
4555
+
4556
+ _createClass(WebsySearch, [{
4557
+ key: "handleKeyUp",
4558
+ value: function handleKeyUp(event) {
4559
+ var _this28 = this;
4560
+
4561
+ if (event.target.classList.contains('websy-search-input')) {
4562
+ if (this.searchTimeoutFn) {
4563
+ clearTimeout(this.searchTimeoutFn);
4564
+ }
4565
+
4566
+ if (event.target.value.length >= this.options.minLength) {
4567
+ this.searchTimeoutFn = setTimeout(function () {
4568
+ if (_this28.options.onSearch) {
4569
+ _this28.options.onSearch(event.target.value);
4570
+ }
4571
+ }, this.options.searchTimeout);
4572
+ } else {
4573
+ if (this.options.onSearch) {
4574
+ this.options.onSearch('');
4575
+ }
4576
+ }
4577
+ }
4578
+ }
4579
+ }]);
4580
+
4581
+ return WebsySearch;
4582
+ }();
4518
4583
  /* global WebsyDesigns ENVIRONMENT */
4519
4584
 
4520
4585
 
@@ -4855,6 +4920,7 @@ var WebsyUtils = {
4855
4920
  var red = 0;
4856
4921
  var green = 0;
4857
4922
  var blue = 0;
4923
+ var alpha = 1;
4858
4924
 
4859
4925
  if (backgroundColor.indexOf('#') !== -1) {
4860
4926
  // hex color
@@ -4866,14 +4932,16 @@ var WebsyUtils = {
4866
4932
  blue = parseInt(colorParts[4] + colorParts[5], 16);
4867
4933
  } else if (backgroundColor.toLowerCase().indexOf('rgb') !== -1) {
4868
4934
  // rgb color
4869
- colorParts = backgroundColor.replace(/rgb\(/gi, '').replace(/\)/gi, '');
4935
+ colorParts = backgroundColor.replace(/rgba\(/gi, '').replace(/\)/gi, '');
4936
+ colorParts = colorParts.replace(/rgb\(/gi, '');
4870
4937
  colorParts = colorParts.split(',');
4871
4938
  red = colorParts[0];
4872
4939
  green = colorParts[1];
4873
4940
  blue = colorParts[2];
4941
+ alpha = colorParts[3] || 1;
4874
4942
  }
4875
4943
 
4876
- return red * 0.299 + green * 0.587 + blue * 0.114 > 186 ? darkColor : lightColor;
4944
+ return (red * 0.299 + green * 0.587 + blue * 0.114) / alpha > 186 ? darkColor : lightColor;
4877
4945
  },
4878
4946
  measureText: function measureText(text) {
4879
4947
  var rotation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -5345,7 +5413,17 @@ var WebsyTable = /*#__PURE__*/function () {
5345
5413
 
5346
5414
  var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
5347
5415
  if (c.show !== false) {
5348
- return "\n <th ".concat(c.width ? 'style="width: ' + (c.width || 'auto') + ';"' : '', ">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this33.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5416
+ var style = '';
5417
+
5418
+ if (c.style) {
5419
+ style += c.style;
5420
+ }
5421
+
5422
+ if (c.width) {
5423
+ style += "width: ".concat(c.width || 'auto', ";");
5424
+ }
5425
+
5426
+ return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this33.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5349
5427
  }
5350
5428
  }).join('') + '</tr>';
5351
5429
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6033,7 +6111,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6033
6111
  showTotalsAbove: true,
6034
6112
  minHandleSize: 20,
6035
6113
  maxColWidth: '50%',
6036
- allowPivoting: false
6114
+ allowPivoting: false,
6115
+ searchIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>"
6037
6116
  };
6038
6117
  this.options = _extends({}, DEFAULTS, options);
6039
6118
  this.sizes = {};
@@ -6121,7 +6200,25 @@ var WebsyTable3 = /*#__PURE__*/function () {
6121
6200
  data.forEach(function (row) {
6122
6201
  bodyHtml += "<tr class=\"websy-table-row\">";
6123
6202
  row.forEach(function (cell, cellIndex) {
6124
- bodyHtml += "<td \n class='websy-table-cell'\n style='".concat(cell.style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
6203
+ var style = '';
6204
+
6205
+ if (cell.style) {
6206
+ style += cell.style;
6207
+ }
6208
+
6209
+ if (cell.backgroundColor) {
6210
+ style += "background-color: ".concat(cell.backgroundColor, "; ");
6211
+
6212
+ if (!cell.color) {
6213
+ style += "color: ".concat(WebsyDesigns.Utils.getLightDark(cell.backgroundColor), "; ");
6214
+ }
6215
+ }
6216
+
6217
+ if (cell.color) {
6218
+ style += "color: ".concat(cell.color, "; ");
6219
+ }
6220
+
6221
+ bodyHtml += "<td \n class='websy-table-cell'\n style='".concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n "); // if (useWidths === true) {
6125
6222
  // bodyHtml += `
6126
6223
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
6127
6224
  // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
@@ -6159,7 +6256,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6159
6256
  }
6160
6257
 
6161
6258
  headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
6162
- row.forEach(function (col) {
6259
+ row.forEach(function (col, colIndex) {
6163
6260
  headerHtml += "<td \n class='websy-table-cell' \n style='".concat(col.style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n "); // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6164
6261
  // headerHtml += `
6165
6262
  // style='width: ${col.width || col.actualWidth}px'
@@ -6167,12 +6264,30 @@ var WebsyTable3 = /*#__PURE__*/function () {
6167
6264
  // `
6168
6265
  // }
6169
6266
 
6170
- headerHtml += " \n >\n ".concat(col.name, "\n </td>");
6267
+ headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6171
6268
  });
6172
6269
  headerHtml += "</tr>";
6173
6270
  });
6271
+ var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6272
+ this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6273
+ if (c.searchable && c.isExternalSearch === true) {
6274
+ var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
6275
+
6276
+ if (!testEl) {
6277
+ var newE = document.createElement('div');
6278
+ newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
6279
+ newE.className = 'websy-modal-dropdown';
6280
+ dropdownEl.appendChild(newE);
6281
+ }
6282
+ }
6283
+ });
6174
6284
  return headerHtml;
6175
6285
  }
6286
+ }, {
6287
+ key: "buildSearchIcon",
6288
+ value: function buildSearchIcon(col, index) {
6289
+ return "\n <div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>\n ");
6290
+ }
6176
6291
  }, {
6177
6292
  key: "buildTotalHtml",
6178
6293
  value: function buildTotalHtml() {
@@ -6340,7 +6455,16 @@ var WebsyTable3 = /*#__PURE__*/function () {
6340
6455
  }
6341
6456
  }, {
6342
6457
  key: "handleClick",
6343
- value: function handleClick(event) {}
6458
+ value: function handleClick(event) {
6459
+ if (event.target.classList.contains('websy-table-search-icon')) {
6460
+ console.log('clicked on search icon');
6461
+ var colIndex = +event.target.getAttribute('data-col-index');
6462
+
6463
+ if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
6464
+ this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex]);
6465
+ }
6466
+ }
6467
+ }
6344
6468
  }, {
6345
6469
  key: "handleMouseDown",
6346
6470
  value: function handleMouseDown(event) {
@@ -6464,20 +6588,26 @@ var WebsyTable3 = /*#__PURE__*/function () {
6464
6588
 
6465
6589
  if (this.options.virtualScroll === true) {
6466
6590
  // set the scroll element positions
6591
+ var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6592
+ var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6593
+
6467
6594
  if (this.vScrollRequired === true) {
6468
- var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6469
- var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6470
6595
  vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
6471
6596
  vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
6472
6597
  vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px';
6598
+ } else {
6599
+ vHandleEl.style.height = '0px';
6473
6600
  }
6474
6601
 
6602
+ var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6603
+ var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6604
+
6475
6605
  if (this.hScrollRequired === true) {
6476
- var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6477
- var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6478
6606
  hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
6479
6607
  hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
6480
6608
  hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalWidth)) + 'px';
6609
+ } else {
6610
+ hHandleEl.style.height = '0px';
6481
6611
  }
6482
6612
  }
6483
6613
  }
@@ -6567,7 +6697,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6567
6697
 
6568
6698
  for (var i = 0; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
6569
6699
  cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
6570
- console.log(actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6700
+ console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6571
6701
 
6572
6702
  if (actualLeft < cumulativeWidth) {
6573
6703
  this.startCol = i;
@@ -8394,7 +8524,9 @@ var WebsyDesigns = {
8394
8524
  ResponsiveText: ResponsiveText,
8395
8525
  WebsyResponsiveText: ResponsiveText,
8396
8526
  WebsyDragDrop: WebsyDragDrop,
8397
- DragDrop: WebsyDragDrop
8527
+ DragDrop: WebsyDragDrop,
8528
+ WebsySearch: WebsySearch,
8529
+ Search: WebsySearch
8398
8530
  };
8399
8531
  WebsyDesigns.service = new WebsyDesigns.APIService('');
8400
8532
  var GlobalPubSub = new WebsyPubSub('empty', {});