@websy/websy-designs 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  const puppeteer = require('puppeteer')
2
- const report = require('./puppeteer-report')
2
+ const report = require('puppeteer-report')
3
3
  const fs = require('fs')
4
4
  const utils = require('../../utils')
5
5
  const http = require('http')
@@ -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,14 +5737,17 @@ 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
@@ -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,15 +6227,18 @@ 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) {
@@ -8110,9 +8127,9 @@ var WebsyMap = /*#__PURE__*/function () {
8110
8127
  return;
8111
8128
  }
8112
8129
 
8113
- var mapOptions = {
8114
- click: this.handleMapClick.bind(this)
8115
- };
8130
+ var mapOptions = _extends({}, options.mapOptions);
8131
+
8132
+ mapOptions.click = this.handleMapClick.bind(this);
8116
8133
 
8117
8134
  if (this.options.disableZoom === true) {
8118
8135
  mapOptions.scrollWheelZoom = false;