@websy/websy-designs 1.1.0 → 1.1.1

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.
@@ -828,12 +828,13 @@ class WebsyDropdown {
828
828
  const headerLabel = this.selectedItems.map(s => this.options.items[s].label || this.options.items[s].value).join(this.options.multiValueDelimiter)
829
829
  const headerValue = this.selectedItems.map(s => this.options.items[s].value || this.options.items[s].label).join(this.options.multiValueDelimiter)
830
830
  let html = `
831
- <div class='websy-dropdown-container ${this.options.disabled ? 'disabled' : ''} ${this.options.disableSearch !== true ? 'with-search' : ''}'>
831
+ <div id='${this.elementId}_container' class='websy-dropdown-container ${this.options.disabled ? 'disabled' : ''} ${this.options.disableSearch !== true ? 'with-search' : ''} ${this.options.style}'>
832
832
  <div id='${this.elementId}_header' class='websy-dropdown-header ${this.selectedItems.length === 1 ? 'one-selected' : ''} ${this.options.allowClear === true ? 'allow-clear' : ''}'>
833
+ <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>
833
834
  <span id='${this.elementId}_headerLabel' class='websy-dropdown-header-label'>${this.options.label}</span>
834
835
  <span data-info='${headerLabel}' class='websy-dropdown-header-value' id='${this.elementId}_selectedItems'>${headerLabel}</span>
835
836
  <input class='dropdown-input' id='${this.elementId}_input' name='${this.options.field || this.options.label}' value='${headerValue}'>
836
- <svg class='arrow' xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z"/></svg>
837
+ <svg class='arrow' xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z"/></svg>
837
838
  `
838
839
  if (this.options.allowClear === true) {
839
840
  html += `
@@ -928,6 +929,10 @@ class WebsyDropdown {
928
929
  else if (event.target.classList.contains('clear')) {
929
930
  this.clearSelected()
930
931
  }
932
+ else if (event.target.classList.contains('search')) {
933
+ const el = document.getElementById(`${this.elementId}_container`)
934
+ el.classList.toggle('search-open')
935
+ }
931
936
  }
932
937
  handleKeyUp (event) {
933
938
  if (event.target.classList.contains('websy-dropdown-search')) {
@@ -3616,6 +3621,9 @@ class WebsyTable2 {
3616
3621
  }
3617
3622
  if (c.backgroundColor) {
3618
3623
  style += `background-color: ${c.backgroundColor}; `
3624
+ if (!c.color) {
3625
+ style += `color: ${WebsyDesigns.Utils.getLightDark(c.backgroundColor)}; `
3626
+ }
3619
3627
  }
3620
3628
  if (c.color) {
3621
3629
  style += `color: ${c.color}; `
@@ -3910,16 +3918,18 @@ class WebsyTable2 {
3910
3918
  }).join('') + '</tr>'
3911
3919
  const headEl = document.getElementById(`${this.elementId}_head`)
3912
3920
  headEl.innerHTML = headHTML
3913
- let dropdownHTML = ``
3914
- this.options.columns.forEach((c, i) => {
3915
- if (c.searchable && c.searchField) {
3916
- dropdownHTML += `
3917
- <div id="${this.elementId}_columnSearch_${i}" class="websy-modal-dropdown"></div>
3918
- `
3919
- }
3920
- })
3921
3921
  const dropdownEl = document.getElementById(`${this.elementId}_dropdownContainer`)
3922
- dropdownEl.innerHTML = dropdownHTML
3922
+ if (dropdownEl.innerHTML === '') {
3923
+ let dropdownHTML = ``
3924
+ this.options.columns.forEach((c, i) => {
3925
+ if (c.searchable && c.searchField) {
3926
+ dropdownHTML += `
3927
+ <div id="${this.elementId}_columnSearch_${i}" class="websy-modal-dropdown"></div>
3928
+ `
3929
+ }
3930
+ })
3931
+ dropdownEl.innerHTML = dropdownHTML
3932
+ }
3923
3933
  // const colGroupEl = document.getElementById(`${this.elementId}_cols`)
3924
3934
  // colGroupEl.innerHTML = colGroupHTML
3925
3935
  // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
@@ -991,7 +991,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
991
991
  var headerValue = this.selectedItems.map(function (s) {
992
992
  return _this6.options.items[s].value || _this6.options.items[s].label;
993
993
  }).join(this.options.multiValueDelimiter);
994
- var html = "\n <div class='websy-dropdown-container ".concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n ");
994
+ var html = "\n <div id='".concat(this.elementId, "_container' class='websy-dropdown-container ").concat(this.options.disabled ? 'disabled' : '', " ").concat(this.options.disableSearch !== true ? 'with-search' : '', " ").concat(this.options.style, "'>\n <div id='").concat(this.elementId, "_header' class='websy-dropdown-header ").concat(this.selectedItems.length === 1 ? 'one-selected' : '', " ").concat(this.options.allowClear === true ? 'allow-clear' : '', "'>\n <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>\n <span id='").concat(this.elementId, "_headerLabel' class='websy-dropdown-header-label'>").concat(this.options.label, "</span>\n <span data-info='").concat(headerLabel, "' class='websy-dropdown-header-value' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n <svg class='arrow' xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg> \n ");
995
995
 
996
996
  if (this.options.allowClear === true) {
997
997
  html += "\n <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>\n ";
@@ -1059,6 +1059,9 @@ var WebsyDropdown = /*#__PURE__*/function () {
1059
1059
  this.updateSelected(+index);
1060
1060
  } else if (event.target.classList.contains('clear')) {
1061
1061
  this.clearSelected();
1062
+ } else if (event.target.classList.contains('search')) {
1063
+ var el = document.getElementById("".concat(this.elementId, "_container"));
1064
+ el.classList.toggle('search-open');
1062
1065
  }
1063
1066
  }
1064
1067
  }, {
@@ -4169,6 +4172,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
4169
4172
 
4170
4173
  if (c.backgroundColor) {
4171
4174
  style += "background-color: ".concat(c.backgroundColor, "; ");
4175
+
4176
+ if (!c.color) {
4177
+ style += "color: ".concat(WebsyDesigns.Utils.getLightDark(c.backgroundColor), "; ");
4178
+ }
4172
4179
  }
4173
4180
 
4174
4181
  if (c.color) {
@@ -4460,14 +4467,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
4460
4467
  }).join('') + '</tr>';
4461
4468
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
4462
4469
  headEl.innerHTML = headHTML;
4463
- var dropdownHTML = "";
4464
- this.options.columns.forEach(function (c, i) {
4465
- if (c.searchable && c.searchField) {
4466
- dropdownHTML += "\n <div id=\"".concat(_this30.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
4467
- }
4468
- });
4469
4470
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
4470
- dropdownEl.innerHTML = dropdownHTML; // const colGroupEl = document.getElementById(`${this.elementId}_cols`)
4471
+
4472
+ if (dropdownEl.innerHTML === '') {
4473
+ var dropdownHTML = "";
4474
+ this.options.columns.forEach(function (c, i) {
4475
+ if (c.searchable && c.searchField) {
4476
+ dropdownHTML += "\n <div id=\"".concat(_this30.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
4477
+ }
4478
+ });
4479
+ dropdownEl.innerHTML = dropdownHTML;
4480
+ } // const colGroupEl = document.getElementById(`${this.elementId}_cols`)
4471
4481
  // colGroupEl.innerHTML = colGroupHTML
4472
4482
  // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
4473
4483
  // if (c.show !== false) {
@@ -4479,6 +4489,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
4479
4489
  // const footEl = document.getElementById(`${this.elementId}_foot`)
4480
4490
  // footEl.innerHTML = footHTML
4481
4491
 
4492
+
4482
4493
  if (this.options.paging === 'pages') {
4483
4494
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
4484
4495