@websy/websy-designs 1.3.8 → 1.3.10

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.
@@ -176,7 +176,15 @@ class ButtonGroup {
176
176
  if (this.options.onActivate) {
177
177
  this.options.onActivate(this.options.items[index], index)
178
178
  }
179
- this.render()
179
+ const el = document.getElementById(this.elementId)
180
+ let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
181
+ buttons.forEach(el => {
182
+ let buttonIndex = el.getAttribute('data-index')
183
+ el.classList.add('inactive')
184
+ el.classList.remove('active')
185
+ })
186
+ event.target.classList.remove('inactive')
187
+ event.target.classList.add('active')
180
188
  }
181
189
  }
182
190
  }
@@ -194,9 +202,15 @@ class ButtonGroup {
194
202
  render () {
195
203
  const el = document.getElementById(this.elementId)
196
204
  if (el && this.options.items) {
197
- el.innerHTML = this.options.items.map((t, i) => `
198
- <div ${(t.attributes || []).join(' ')} data-id="${t.id || t.label}" data-index="${i}" class="websy-button-group-item ${(t.classes || []).join(' ')} ${this.options.style}-style ${i === this.options.activeItem ? 'active' : ''}">${t.label}</div>
199
- `).join('')
205
+ el.innerHTML = this.options.items.map((t, i) => {
206
+ let activeClass = ''
207
+ if (this.options.activeItem && this.options.activeItem !== -1) {
208
+ activeClass = i === this.options.activeItem ? 'active' : 'inactive'
209
+ }
210
+ return `
211
+ <div ${(t.attributes || []).join(' ')} data-id="${t.id || t.label}" data-index="${i}" class="websy-button-group-item ${(t.classes || []).join(' ')} ${this.options.style}-style ${activeClass}">${t.label}</div>
212
+ `
213
+ }).join('')
200
214
  }
201
215
  }
202
216
  }
@@ -5723,19 +5737,22 @@ class WebsyTable3 {
5723
5737
  if (this.sizes.totalWidth < outerSize.width) {
5724
5738
  this.sizes.totalWidth = 0
5725
5739
  this.sizes.totalNonPinnedWidth = 0
5726
- let equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length
5740
+ let equalWidth = (outerSize.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length
5727
5741
  this.options.columns[this.options.columns.length - 1].forEach((c, i) => {
5728
- if (!c.width) {
5729
- if (c.actualWidth < equalWidth) {
5730
- // adjust the width
5731
- c.actualWidth = equalWidth
5732
- }
5742
+ // if (!c.width) {
5743
+ // if (c.actualWidth < equalWidth) {
5744
+ // adjust the width
5745
+ if (c.width) {
5746
+ c.width += equalWidth
5733
5747
  }
5748
+ c.actualWidth += equalWidth
5749
+ // }
5750
+ // }
5734
5751
  this.sizes.totalWidth += c.width || c.actualWidth
5735
5752
  if (i < this.pinnedColumns) {
5736
5753
  this.sizes.totalNonPinnedWidth += c.width || c.actualWidth
5737
5754
  }
5738
- equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
5755
+ // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
5739
5756
  })
5740
5757
  }
5741
5758
  // take the height of the last cell as the official height for data cells
@@ -7513,9 +7530,8 @@ class WebsyMap {
7513
7530
  console.log('No element Id provided for Websy Map')
7514
7531
  return
7515
7532
  }
7516
- const mapOptions = {
7517
- click: this.handleMapClick.bind(this)
7518
- }
7533
+ const mapOptions = Object.assign({}, options.mapOptions)
7534
+ mapOptions.click = this.handleMapClick.bind(this)
7519
7535
  if (this.options.disableZoom === true) {
7520
7536
  mapOptions.scrollWheelZoom = false
7521
7537
  mapOptions.zoomControl = false
@@ -232,7 +232,15 @@ var ButtonGroup = /*#__PURE__*/function () {
232
232
  this.options.onActivate(this.options.items[index], index);
233
233
  }
234
234
 
235
- this.render();
235
+ var el = document.getElementById(this.elementId);
236
+ var buttons = Array.from(el.querySelectorAll('.websy-button-group-item'));
237
+ buttons.forEach(function (el) {
238
+ var buttonIndex = el.getAttribute('data-index');
239
+ el.classList.add('inactive');
240
+ el.classList.remove('active');
241
+ });
242
+ event.target.classList.remove('inactive');
243
+ event.target.classList.add('active');
236
244
  }
237
245
  }
238
246
  }
@@ -261,7 +269,13 @@ var ButtonGroup = /*#__PURE__*/function () {
261
269
 
262
270
  if (el && this.options.items) {
263
271
  el.innerHTML = this.options.items.map(function (t, i) {
264
- return "\n <div ".concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(i === _this.options.activeItem ? 'active' : '', "\">").concat(t.label, "</div>\n ");
272
+ var activeClass = '';
273
+
274
+ if (_this.options.activeItem && _this.options.activeItem !== -1) {
275
+ activeClass = i === _this.options.activeItem ? 'active' : 'inactive';
276
+ }
277
+
278
+ return "\n <div ".concat((t.attributes || []).join(' '), " data-id=\"").concat(t.id || t.label, "\" data-index=\"").concat(i, "\" class=\"websy-button-group-item ").concat((t.classes || []).join(' '), " ").concat(_this.options.style, "-style ").concat(activeClass, "\">").concat(t.label, "</div>\n ");
265
279
  }).join('');
266
280
  }
267
281
  }
@@ -6213,22 +6227,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6213
6227
  if (this.sizes.totalWidth < outerSize.width) {
6214
6228
  this.sizes.totalWidth = 0;
6215
6229
  this.sizes.totalNonPinnedWidth = 0;
6216
- var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
6230
+ var equalWidth = (outerSize.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length;
6217
6231
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6218
- if (!c.width) {
6219
- if (c.actualWidth < equalWidth) {
6220
- // adjust the width
6221
- c.actualWidth = equalWidth;
6222
- }
6232
+ // if (!c.width) {
6233
+ // if (c.actualWidth < equalWidth) {
6234
+ // adjust the width
6235
+ if (c.width) {
6236
+ c.width += equalWidth;
6223
6237
  }
6224
6238
 
6239
+ c.actualWidth += equalWidth; // }
6240
+ // }
6241
+
6225
6242
  _this37.sizes.totalWidth += c.width || c.actualWidth;
6226
6243
 
6227
6244
  if (i < _this37.pinnedColumns) {
6228
6245
  _this37.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
6229
- }
6246
+ } // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
6230
6247
 
6231
- equalWidth = (outerSize.width - _this37.sizes.totalWidth) / (_this37.options.columns[_this37.options.columns.length - 1].length - (i + 1));
6232
6248
  });
6233
6249
  } // take the height of the last cell as the official height for data cells
6234
6250
  // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
@@ -8110,9 +8126,9 @@ var WebsyMap = /*#__PURE__*/function () {
8110
8126
  return;
8111
8127
  }
8112
8128
 
8113
- var mapOptions = {
8114
- click: this.handleMapClick.bind(this)
8115
- };
8129
+ var mapOptions = _extends({}, options.mapOptions);
8130
+
8131
+ mapOptions.click = this.handleMapClick.bind(this);
8116
8132
 
8117
8133
  if (this.options.disableZoom === true) {
8118
8134
  mapOptions.scrollWheelZoom = false;