@websy/websy-designs 1.2.31 → 1.2.33

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.
@@ -413,6 +413,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
413
413
  value: function close(confirm) {
414
414
  var _this2 = this;
415
415
 
416
+ var isRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
416
417
  var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
417
418
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
418
419
  var el = document.getElementById(this.elementId);
@@ -446,7 +447,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
446
447
 
447
448
  this.options.onChange(_hoursOut, true);
448
449
  } else {
449
- this.options.onChange(this.currentselection, false);
450
+ this.options.onChange(this.currentselection, isRange);
450
451
  }
451
452
  }
452
453
  }
@@ -1056,7 +1057,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1056
1057
 
1057
1058
  this.highlightRange();
1058
1059
  this.updateRange();
1059
- this.close(confirm);
1060
+ this.close(confirm, true);
1060
1061
  }
1061
1062
  }
1062
1063
  }, {
@@ -1237,12 +1238,326 @@ var WebsyDatePicker = /*#__PURE__*/function () {
1237
1238
  Date.prototype.floor = function () {
1238
1239
  return new Date("".concat(this.getMonth() + 1, "/").concat(this.getDate(), "/").concat(this.getFullYear()));
1239
1240
  };
1241
+ /* global WebsyDesigns GlobalPubSub */
1242
+
1243
+
1244
+ var WebsyDragDrop = /*#__PURE__*/function () {
1245
+ function WebsyDragDrop(elementId, options) {
1246
+ _classCallCheck(this, WebsyDragDrop);
1247
+
1248
+ var DEFAULTS = {
1249
+ items: [],
1250
+ orientation: 'horizontal',
1251
+ dropPlaceholder: 'Drop item here'
1252
+ };
1253
+ this.busy = false;
1254
+ this.options = _extends({}, DEFAULTS, options);
1255
+ this.elementId = elementId;
1256
+
1257
+ if (!elementId) {
1258
+ console.log('No element Id provided for Websy DragDrop');
1259
+ return;
1260
+ }
1261
+
1262
+ var el = document.getElementById(elementId);
1263
+
1264
+ if (el) {
1265
+ el.innerHTML = "\n <div id='".concat(this.elementId, "_container' class='websy-drag-drop-container ").concat(this.options.orientation, "'>\n <div>\n </div>\n ");
1266
+ el.addEventListener('click', this.handleClick.bind(this));
1267
+ el.addEventListener('dragstart', this.handleDragStart.bind(this));
1268
+ el.addEventListener('dragover', this.handleDragOver.bind(this));
1269
+ el.addEventListener('dragleave', this.handleDragLeave.bind(this));
1270
+ el.addEventListener('drop', this.handleDrop.bind(this));
1271
+ window.addEventListener('dragend', this.handleDragEnd.bind(this));
1272
+ } else {
1273
+ console.error("No element found with ID ".concat(this.elementId));
1274
+ }
1275
+
1276
+ GlobalPubSub.subscribe(this.elementId, 'requestForDDItem', this.handleRequestForItem.bind(this));
1277
+ console.log('constructor dd');
1278
+ console.trace();
1279
+ GlobalPubSub.subscribe(this.elementId, 'add', this.addItem.bind(this));
1280
+ this.render();
1281
+ }
1282
+
1283
+ _createClass(WebsyDragDrop, [{
1284
+ key: "addItem",
1285
+ value: function addItem(data) {
1286
+ if (data.target === this.elementId && this.busy === false) {
1287
+ this.busy = true;
1288
+ console.log('adding item to dd'); // check that an item with the same id doesn't already exist
1289
+
1290
+ var index = this.getItemIndex(data.item.id);
1291
+
1292
+ if (index === -1) {
1293
+ this.options.items.splice(data.index, 0, data.item);
1294
+ var startEl = document.getElementById("".concat(this.elementId, "start_item"));
1295
+
1296
+ if (startEl) {
1297
+ if (this.options.items.length === 0) {
1298
+ startEl.classList.add('empty');
1299
+ } else {
1300
+ startEl.classList.remove('empty');
1301
+ }
1302
+ }
1303
+
1304
+ if (this.options.onItemAdded) {
1305
+ this.options.onItemAdded();
1306
+ }
1307
+ }
1308
+
1309
+ this.busy = false;
1310
+ }
1311
+ }
1312
+ }, {
1313
+ key: "createItemHtml",
1314
+ value: function createItemHtml(elementId, index, item) {
1315
+ if (!item.id) {
1316
+ item.id = WebsyDesigns.Utils.createIdentity();
1317
+ }
1318
+
1319
+ var html = "\n <div id='".concat(item.id, "_item' class='websy-dragdrop-item' draggable='true' data-id='").concat(item.id, "'> \n <div id='").concat(item.id, "_itemInner' class='websy-dragdrop-item-inner' data-id='").concat(item.id, "'>\n ");
1320
+
1321
+ if (item.component) {
1322
+ html += "<div id='".concat(item.id, "_component'></div>");
1323
+ } else {
1324
+ html += "".concat(item.html || item.label || '');
1325
+ }
1326
+
1327
+ html += "\n </div>\n <div id='".concat(item.id, "_dropZone' class='websy-drop-zone droppable' data-index='").concat(item.id, "' data-side='right' data-id='").concat(item.id, "' data-placeholder='").concat(this.options.dropPlaceholder, "'></div> \n </div>\n ");
1328
+ return html;
1329
+ }
1330
+ }, {
1331
+ key: "getItemIndex",
1332
+ value: function getItemIndex(id) {
1333
+ for (var i = 0; i < this.options.items.length; i++) {
1334
+ if (this.options.items[i].id === id) {
1335
+ return i;
1336
+ }
1337
+ }
1338
+
1339
+ return -1;
1340
+ }
1341
+ }, {
1342
+ key: "handleClick",
1343
+ value: function handleClick(event) {}
1344
+ }, {
1345
+ key: "handleDragStart",
1346
+ value: function handleDragStart(event) {
1347
+ this.draggedId = event.target.getAttribute('data-id');
1348
+ event.dataTransfer.effectAllowed = 'move';
1349
+ event.dataTransfer.setData('application/wd-item', JSON.stringify({
1350
+ el: event.target.id,
1351
+ id: this.elementId,
1352
+ itemId: this.draggedId
1353
+ }));
1354
+ console.log('drag start', event);
1355
+ event.target.style.opacity = 0.5;
1356
+ this.dragging = true;
1357
+ }
1358
+ }, {
1359
+ key: "handleDragOver",
1360
+ value: function handleDragOver(event) {
1361
+ console.log('drag over', event.target.classList);
1362
+
1363
+ if (event.preventDefault) {
1364
+ event.preventDefault();
1365
+ }
1366
+
1367
+ if (!event.target.classList.contains('droppable')) {
1368
+ return;
1369
+ }
1370
+
1371
+ event.target.classList.add('drag-over');
1372
+ }
1373
+ }, {
1374
+ key: "handleDragLeave",
1375
+ value: function handleDragLeave(event) {
1376
+ console.log('drag leave', event.target.classList);
1377
+
1378
+ if (!event.target.classList.contains('droppable')) {
1379
+ return;
1380
+ }
1381
+
1382
+ event.target.classList.remove('drag-over'); // let side = event.target.getAttribute('data-side')
1383
+ // let id = event.target.getAttribute('data-id')
1384
+ // let droppedItem = this.options.items[id]
1385
+ // this.removeExpandedDrop(side, id, droppedItem)
1386
+ }
1387
+ }, {
1388
+ key: "handleDrop",
1389
+ value: function handleDrop(event) {
1390
+ console.log('drag drop');
1391
+ console.log(event.dataTransfer.getData('application/wd-item'));
1392
+ var data = JSON.parse(event.dataTransfer.getData('application/wd-item'));
1393
+
1394
+ if (event.preventDefault) {
1395
+ event.preventDefault();
1396
+ }
1397
+
1398
+ if (!event.target.classList.contains('droppable')) {
1399
+ return;
1400
+ }
1401
+
1402
+ var side = event.target.getAttribute('data-side');
1403
+ var id = event.target.getAttribute('data-id');
1404
+ var index = this.getItemIndex(id);
1405
+ var draggedIndex = this.getItemIndex(data.id);
1406
+ var droppedItem = this.options.items[index];
1407
+
1408
+ if (side === 'right') {
1409
+ index += 1;
1410
+ }
1411
+
1412
+ if (draggedIndex === -1) {
1413
+ console.log('requestForDDItem');
1414
+ GlobalPubSub.publish(data.id, 'requestForDDItem', {
1415
+ group: this.options.group,
1416
+ source: data.id,
1417
+ target: this.elementId,
1418
+ index: index,
1419
+ id: data.itemId
1420
+ });
1421
+ } else if (index > draggedIndex) {
1422
+ // insert and then remove
1423
+ this.options.items.splice(index, 0, droppedItem);
1424
+ this.options.items.splice(draggedIndex, 1);
1425
+
1426
+ if (this.options.onOrderUpdated) {
1427
+ this.options.onOrderUpdated();
1428
+ }
1429
+ } else {
1430
+ // remove and then insert
1431
+ this.options.items.splice(draggedIndex, 1);
1432
+ this.options.items.splice(index, 0, droppedItem);
1433
+
1434
+ if (this.options.onOrderUpdated) {
1435
+ this.options.onOrderUpdated();
1436
+ }
1437
+ } // this.removeExpandedDrop(side, id, droppedItem)
1438
+ // const draggedEl = document.getElementById(`${this.elementId}_${this.draggedId}_item`)
1439
+
1440
+
1441
+ var draggedEl = document.getElementById(data.el);
1442
+ var droppedEl = document.getElementById("".concat(id, "_item"));
1443
+
1444
+ if (draggedEl) {
1445
+ droppedEl.insertAdjacentElement('afterend', draggedEl);
1446
+ }
1447
+
1448
+ var dragOverEl = droppedEl.querySelector('.drag-over');
1449
+
1450
+ if (dragOverEl) {
1451
+ dragOverEl.classList.remove('drag-over');
1452
+ }
1453
+ }
1454
+ }, {
1455
+ key: "handleDragEnd",
1456
+ value: function handleDragEnd(event) {
1457
+ console.log('drag end');
1458
+ event.target.style.opacity = 1;
1459
+ this.draggedId = null;
1460
+ this.dragging = false;
1461
+ var startEl = document.getElementById("".concat(this.elementId, "start_item"));
1462
+
1463
+ if (startEl) {
1464
+ if (this.options.items.length === 0) {
1465
+ startEl.classList.add('empty');
1466
+ } else {
1467
+ startEl.classList.remove('empty');
1468
+ }
1469
+ }
1470
+ }
1471
+ }, {
1472
+ key: "handleRequestForItem",
1473
+ value: function handleRequestForItem(data) {
1474
+ if (data.group === this.options.group) {
1475
+ var index = this.getItemIndex(data.id);
1476
+
1477
+ if (index !== -1) {
1478
+ var itemToAdd = this.options.items.splice(index, 1);
1479
+ GlobalPubSub.publish(data.target, 'add', {
1480
+ target: data.target,
1481
+ index: data.index,
1482
+ item: itemToAdd[0]
1483
+ });
1484
+ }
1485
+ }
1486
+ }
1487
+ }, {
1488
+ key: "measureItems",
1489
+ value: function measureItems() {
1490
+ var el = document.getElementById("".concat(this.elementId, "_container"));
1491
+ this.options.items.forEach(function (d) {});
1492
+ } // removeExpandedDrop (side, id, droppedItem) {
1493
+ // let dropEl
1494
+ // const dropImageEl = document.getElementById(`${id}_itemInner`)
1495
+ // // const placeholderEl = document.getElementById(`${this.elementId}_${id}_dropZonePlaceholder`)
1496
+ // if (side === 'left') {
1497
+ // dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneLeft`)
1498
+ // dropImageEl.style.left = `0px`
1499
+ // }
1500
+ // else if (side === 'right') {
1501
+ // dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneRight`)
1502
+ // }
1503
+ // else {
1504
+ // dropEl = document.getElementById(`${this.elementId}_${id}_dropZoneEnd`)
1505
+ // }
1506
+ // if (dropEl) {
1507
+ // const dropElSize = dropEl.getBoundingClientRect()
1508
+ // dropEl.style.width = `${(dropElSize.width / 2)}px`
1509
+ // dropEl.style.marginLeft = null
1510
+ // dropEl.style.border = null
1511
+ // }
1512
+ // if (placeholderEl) {
1513
+ // placeholderEl.classList.remove('active')
1514
+ // placeholderEl.style.left = null
1515
+ // placeholderEl.style.right = null
1516
+ // placeholderEl.style.width = null
1517
+ // placeholderEl.style.height = null
1518
+ // }
1519
+ // }
1520
+
1521
+ }, {
1522
+ key: "removeItem",
1523
+ value: function removeItem(id) {}
1524
+ }, {
1525
+ key: "render",
1526
+ value: function render() {
1527
+ var _this8 = this;
1528
+
1529
+ var el = document.getElementById("".concat(this.elementId, "_container"));
1530
+
1531
+ if (el) {
1532
+ this.measureItems();
1533
+ 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 ");
1534
+ html += this.options.items.map(function (d, i) {
1535
+ return _this8.createItemHtml(_this8.elementId, i, d);
1536
+ }).join('');
1537
+ el.innerHTML = html;
1538
+ this.options.items.forEach(function (item, i) {
1539
+ if (item.component) {
1540
+ if (item.isQlikPlugin && WebsyDesigns.QlikPlugin[item.component]) {
1541
+ item.instance = new WebsyDesigns.QlikPlugin[item.component]("".concat(item.id, "_component"), item.options);
1542
+ } else if (WebsyDesigns[item.component]) {
1543
+ item.instance = new WebsyDesigns[item.component]("".concat(item.id, "_component"), item.options);
1544
+ } else {
1545
+ console.error("Component ".concat(item.component, " not found."));
1546
+ }
1547
+ }
1548
+ });
1549
+ }
1550
+ }
1551
+ }]);
1552
+
1553
+ return WebsyDragDrop;
1554
+ }();
1240
1555
  /* global WebsyUtils */
1241
1556
 
1242
1557
 
1243
1558
  var WebsyDropdown = /*#__PURE__*/function () {
1244
1559
  function WebsyDropdown(elementId, options) {
1245
- var _this8 = this;
1560
+ var _this9 = this;
1246
1561
 
1247
1562
  _classCallCheck(this, WebsyDropdown);
1248
1563
 
@@ -1290,10 +1605,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1290
1605
  el.addEventListener('mouseout', this.handleMouseOut.bind(this));
1291
1606
  el.addEventListener('mousemove', this.handleMouseMove.bind(this));
1292
1607
  var headerLabel = this.selectedItems.map(function (s) {
1293
- return _this8.options.items[s].label || _this8.options.items[s].value;
1608
+ return _this9.options.items[s].label || _this9.options.items[s].value;
1294
1609
  }).join(this.options.multiValueDelimiter);
1295
1610
  var headerValue = this.selectedItems.map(function (s) {
1296
- return _this8.options.items[s].value || _this8.options.items[s].label;
1611
+ return _this9.options.items[s].value || _this9.options.items[s].label;
1297
1612
  }).join(this.options.multiValueDelimiter);
1298
1613
  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, " ").concat(this.options.customActions.length > 0 ? 'with-actions' : '', "'>\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 ").concat(this.options.searchIcon, "\n <span>\n <span class='websy-dropdown-header-value' data-info='").concat(headerLabel, "' id='").concat(this.elementId, "_selectedItems'>").concat(headerLabel, "</span> \n <span class='websy-dropdown-header-label' id='").concat(this.elementId, "_headerLabel'>").concat(this.options.label, "</span>\n </span>\n <input class='dropdown-input' id='").concat(this.elementId, "_input' name='").concat(this.options.field || this.options.label, "' value='").concat(headerValue, "'>\n ").concat(this.options.arrowIcon, "\n ");
1299
1614
 
@@ -1576,10 +1891,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1576
1891
  }, {
1577
1892
  key: "renderItems",
1578
1893
  value: function renderItems() {
1579
- var _this9 = this;
1894
+ var _this10 = this;
1580
1895
 
1581
1896
  var html = this.options.items.map(function (r, i) {
1582
- return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this9.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
1897
+ return "\n <li data-index='".concat(r.index, "' class='websy-dropdown-item ").concat((r.classes || []).join(' '), " ").concat(_this10.selectedItems.indexOf(r.index) !== -1 ? 'active' : '', "'>").concat(r.label, "</li>\n ");
1583
1898
  }).join('');
1584
1899
  var el = document.getElementById("".concat(this.elementId, "_items"));
1585
1900
 
@@ -1598,7 +1913,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
1598
1913
  }, {
1599
1914
  key: "updateHeader",
1600
1915
  value: function updateHeader(item) {
1601
- var _this10 = this;
1916
+ var _this11 = this;
1602
1917
 
1603
1918
  var el = document.getElementById(this.elementId);
1604
1919
  var headerEl = document.getElementById("".concat(this.elementId, "_header"));
@@ -1645,17 +1960,17 @@ var WebsyDropdown = /*#__PURE__*/function () {
1645
1960
  } else if (this.selectedItems.length > 1) {
1646
1961
  if (this.options.showCompleteSelectedList === true) {
1647
1962
  var selectedLabels = this.selectedItems.map(function (s) {
1648
- return _this10.options.items[s].label || _this10.options.items[s].value;
1963
+ return _this11.options.items[s].label || _this11.options.items[s].value;
1649
1964
  }).join(this.options.multiValueDelimiter);
1650
1965
  var selectedValues = this.selectedItems.map(function (s) {
1651
- return _this10.options.items[s].value || _this10.options.items[s].label;
1966
+ return _this11.options.items[s].value || _this11.options.items[s].label;
1652
1967
  }).join(this.options.multiValueDelimiter);
1653
1968
  labelEl.innerHTML = selectedLabels;
1654
1969
  labelEl.setAttribute('data-info', selectedLabels);
1655
1970
  inputEl.value = selectedValues;
1656
1971
  } else {
1657
1972
  var _selectedValues = this.selectedItems.map(function (s) {
1658
- return _this10.options.items[s].value || _this10.options.items[s].label;
1973
+ return _this11.options.items[s].value || _this11.options.items[s].label;
1659
1974
  }).join(this.options.multiValueDelimiter);
1660
1975
 
1661
1976
  labelEl.innerHTML = "".concat(this.selectedItems.length, " selected");
@@ -1684,13 +1999,14 @@ var WebsyDropdown = /*#__PURE__*/function () {
1684
1999
  this.selectedItems.push(index);
1685
2000
  }
1686
2001
  }
1687
- }
2002
+ } // const item = this.options.items[index]
2003
+
1688
2004
 
1689
- var item = this.options.items[index];
2005
+ var item = this._originalData[index] || this.options.items[index];
1690
2006
  this.updateHeader(item);
1691
2007
 
1692
2008
  if (item && this.options.onItemSelected) {
1693
- this.options.onItemSelected(item, this.selectedItems, this.options.items, this.options);
2009
+ this.options.onItemSelected(item, this.selectedItems, this._originalData || this.options.items, this.options);
1694
2010
  }
1695
2011
 
1696
2012
  if (this.options.closeAfterSelection === true) {
@@ -1712,6 +2028,12 @@ var WebsyDropdown = /*#__PURE__*/function () {
1712
2028
 
1713
2029
  return d;
1714
2030
  });
2031
+ var headerEl = document.getElementById("".concat(this.elementId, "_header"));
2032
+
2033
+ if (headerEl) {
2034
+ headerEl.classList["".concat(this.options.allowClear === true ? 'add' : 'remove')]('allow-clear');
2035
+ }
2036
+
1715
2037
  var el = document.getElementById("".concat(this.elementId, "_items"));
1716
2038
 
1717
2039
  if (el.childElementCount === 0) {
@@ -1792,16 +2114,16 @@ var WebsyForm = /*#__PURE__*/function () {
1792
2114
  }, {
1793
2115
  key: "checkRecaptcha",
1794
2116
  value: function checkRecaptcha() {
1795
- var _this11 = this;
2117
+ var _this12 = this;
1796
2118
 
1797
2119
  return new Promise(function (resolve, reject) {
1798
- if (_this11.options.useRecaptcha === true) {
2120
+ if (_this12.options.useRecaptcha === true) {
1799
2121
  // if (this.recaptchaValue) {
1800
2122
  grecaptcha.ready(function () {
1801
2123
  grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
1802
2124
  action: 'submit'
1803
2125
  }).then(function (token) {
1804
- _this11.apiService.add('google/checkrecaptcha', {
2126
+ _this12.apiService.add('google/checkrecaptcha', {
1805
2127
  grecaptcharesponse: token
1806
2128
  }).then(function (response) {
1807
2129
  if (response.success && response.success === true) {
@@ -1864,14 +2186,14 @@ var WebsyForm = /*#__PURE__*/function () {
1864
2186
  }, {
1865
2187
  key: "processComponents",
1866
2188
  value: function processComponents(components, callbackFn) {
1867
- var _this12 = this;
2189
+ var _this13 = this;
1868
2190
 
1869
2191
  if (components.length === 0) {
1870
2192
  callbackFn();
1871
2193
  } else {
1872
2194
  components.forEach(function (c) {
1873
2195
  if (typeof WebsyDesigns[c.component] !== 'undefined') {
1874
- c.instance = new WebsyDesigns[c.component]("".concat(_this12.elementId, "_input_").concat(c.field, "_component"), c.options);
2196
+ c.instance = new WebsyDesigns[c.component]("".concat(_this13.elementId, "_input_").concat(c.field, "_component"), c.options);
1875
2197
  } else {// some user feedback here
1876
2198
  }
1877
2199
  });
@@ -1892,7 +2214,7 @@ var WebsyForm = /*#__PURE__*/function () {
1892
2214
  }, {
1893
2215
  key: "render",
1894
2216
  value: function render(update, data) {
1895
- var _this13 = this;
2217
+ var _this14 = this;
1896
2218
 
1897
2219
  var el = document.getElementById(this.elementId);
1898
2220
  var componentsToProcess = [];
@@ -1902,11 +2224,11 @@ var WebsyForm = /*#__PURE__*/function () {
1902
2224
  this.options.fields.forEach(function (f, i) {
1903
2225
  if (f.component) {
1904
2226
  componentsToProcess.push(f);
1905
- 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(_this13.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
2227
+ 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(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
1906
2228
  } else if (f.type === 'longtext') {
1907
- 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(_this13.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 ");
2229
+ 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(_this14.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 ");
1908
2230
  } else {
1909
- 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(_this13.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 ");
2231
+ 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(_this14.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 ");
1910
2232
  }
1911
2233
  });
1912
2234
  html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
@@ -1923,7 +2245,7 @@ var WebsyForm = /*#__PURE__*/function () {
1923
2245
 
1924
2246
  el.innerHTML = html;
1925
2247
  this.processComponents(componentsToProcess, function () {
1926
- if (_this13.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
2248
+ if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {// this.recaptchaReady()
1927
2249
  }
1928
2250
  });
1929
2251
  }
@@ -1931,7 +2253,7 @@ var WebsyForm = /*#__PURE__*/function () {
1931
2253
  }, {
1932
2254
  key: "submitForm",
1933
2255
  value: function submitForm() {
1934
- var _this14 = this;
2256
+ var _this15 = this;
1935
2257
 
1936
2258
  var formEl = document.getElementById("".concat(this.elementId, "Form"));
1937
2259
 
@@ -1945,32 +2267,32 @@ var WebsyForm = /*#__PURE__*/function () {
1945
2267
  data[key] = value;
1946
2268
  });
1947
2269
 
1948
- if (_this14.options.url) {
1949
- var _this14$apiService;
2270
+ if (_this15.options.url) {
2271
+ var _this15$apiService;
1950
2272
 
1951
- var params = [_this14.options.url];
2273
+ var params = [_this15.options.url];
1952
2274
 
1953
- if (_this14.options.mode === 'update') {
1954
- params.push(_this14.options.id);
2275
+ if (_this15.options.mode === 'update') {
2276
+ params.push(_this15.options.id);
1955
2277
  }
1956
2278
 
1957
2279
  params.push(data);
1958
2280
 
1959
- (_this14$apiService = _this14.apiService)[_this14.options.mode].apply(_this14$apiService, params).then(function (result) {
1960
- if (_this14.options.clearAfterSave === true) {
2281
+ (_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
2282
+ if (_this15.options.clearAfterSave === true) {
1961
2283
  // this.render()
1962
2284
  formEl.reset();
1963
2285
  }
1964
2286
 
1965
- _this14.options.onSuccess.call(_this14, result);
2287
+ _this15.options.onSuccess.call(_this15, result);
1966
2288
  }, function (err) {
1967
2289
  console.log('Error submitting form data:', err);
1968
2290
 
1969
- _this14.options.onError.call(_this14, err);
2291
+ _this15.options.onError.call(_this15, err);
1970
2292
  });
1971
- } else if (_this14.options.submitFn) {
1972
- _this14.options.submitFn(data, function () {
1973
- if (_this14.options.clearAfterSave === true) {
2293
+ } else if (_this15.options.submitFn) {
2294
+ _this15.options.submitFn(data, function () {
2295
+ if (_this15.options.clearAfterSave === true) {
1974
2296
  // this.render()
1975
2297
  formEl.reset();
1976
2298
  }
@@ -1990,17 +2312,17 @@ var WebsyForm = /*#__PURE__*/function () {
1990
2312
  }, {
1991
2313
  key: "data",
1992
2314
  set: function set(d) {
1993
- var _this15 = this;
2315
+ var _this16 = this;
1994
2316
 
1995
2317
  if (!this.options.fields) {
1996
2318
  this.options.fields = [];
1997
2319
  }
1998
2320
 
1999
2321
  var _loop = function _loop(key) {
2000
- _this15.options.fields.forEach(function (f) {
2322
+ _this16.options.fields.forEach(function (f) {
2001
2323
  if (f.field === key) {
2002
2324
  f.value = d[key];
2003
- var el = document.getElementById("".concat(_this15.elementId, "_input_").concat(f.field));
2325
+ var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
2004
2326
  el.value = f.value;
2005
2327
  }
2006
2328
  });
@@ -2312,7 +2634,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2312
2634
 
2313
2635
  var Pager = /*#__PURE__*/function () {
2314
2636
  function Pager(elementId, options) {
2315
- var _this16 = this;
2637
+ var _this17 = this;
2316
2638
 
2317
2639
  _classCallCheck(this, Pager);
2318
2640
 
@@ -2365,8 +2687,8 @@ var Pager = /*#__PURE__*/function () {
2365
2687
  allowClear: false,
2366
2688
  disableSearch: true,
2367
2689
  onItemSelected: function onItemSelected(selectedItem) {
2368
- if (_this16.options.onChangePageSize) {
2369
- _this16.options.onChangePageSize(selectedItem.value);
2690
+ if (_this17.options.onChangePageSize) {
2691
+ _this17.options.onChangePageSize(selectedItem.value);
2370
2692
  }
2371
2693
  }
2372
2694
  });
@@ -2390,13 +2712,13 @@ var Pager = /*#__PURE__*/function () {
2390
2712
  }, {
2391
2713
  key: "render",
2392
2714
  value: function render() {
2393
- var _this17 = this;
2715
+ var _this18 = this;
2394
2716
 
2395
2717
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
2396
2718
 
2397
2719
  if (el) {
2398
2720
  var pages = this.options.pages.map(function (item, index) {
2399
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this17.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2721
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this18.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2400
2722
  });
2401
2723
  var startIndex = 0;
2402
2724
 
@@ -2464,58 +2786,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2464
2786
  _createClass(WebsyPDFButton, [{
2465
2787
  key: "handleClick",
2466
2788
  value: function handleClick(event) {
2467
- var _this18 = this;
2789
+ var _this19 = this;
2468
2790
 
2469
2791
  if (event.target.classList.contains('websy-pdf-button')) {
2470
2792
  this.loader.show();
2471
2793
  setTimeout(function () {
2472
- if (_this18.options.targetId) {
2473
- var el = document.getElementById(_this18.options.targetId);
2794
+ if (_this19.options.targetId) {
2795
+ var el = document.getElementById(_this19.options.targetId);
2474
2796
 
2475
2797
  if (el) {
2476
2798
  var pdfData = {
2477
2799
  options: {}
2478
2800
  };
2479
2801
 
2480
- if (_this18.options.pdfOptions) {
2481
- pdfData.options = _extends({}, _this18.options.pdfOptions);
2802
+ if (_this19.options.pdfOptions) {
2803
+ pdfData.options = _extends({}, _this19.options.pdfOptions);
2482
2804
  }
2483
2805
 
2484
- if (_this18.options.header) {
2485
- if (_this18.options.header.elementId) {
2486
- var headerEl = document.getElementById(_this18.options.header.elementId);
2806
+ if (_this19.options.header) {
2807
+ if (_this19.options.header.elementId) {
2808
+ var headerEl = document.getElementById(_this19.options.header.elementId);
2487
2809
 
2488
2810
  if (headerEl) {
2489
2811
  pdfData.header = headerEl.outerHTML;
2490
2812
 
2491
- if (_this18.options.header.css) {
2492
- pdfData.options.headerCSS = _this18.options.header.css;
2813
+ if (_this19.options.header.css) {
2814
+ pdfData.options.headerCSS = _this19.options.header.css;
2493
2815
  }
2494
2816
  }
2495
- } else if (_this18.options.header.html) {
2496
- pdfData.header = _this18.options.header.html;
2817
+ } else if (_this19.options.header.html) {
2818
+ pdfData.header = _this19.options.header.html;
2497
2819
 
2498
- if (_this18.options.header.css) {
2499
- pdfData.options.headerCSS = _this18.options.header.css;
2820
+ if (_this19.options.header.css) {
2821
+ pdfData.options.headerCSS = _this19.options.header.css;
2500
2822
  }
2501
2823
  } else {
2502
- pdfData.header = _this18.options.header;
2824
+ pdfData.header = _this19.options.header;
2503
2825
  }
2504
2826
  }
2505
2827
 
2506
- if (_this18.options.footer) {
2507
- if (_this18.options.footer.elementId) {
2508
- var footerEl = document.getElementById(_this18.options.footer.elementId);
2828
+ if (_this19.options.footer) {
2829
+ if (_this19.options.footer.elementId) {
2830
+ var footerEl = document.getElementById(_this19.options.footer.elementId);
2509
2831
 
2510
2832
  if (footerEl) {
2511
2833
  pdfData.footer = footerEl.outerHTML;
2512
2834
 
2513
- if (_this18.options.footer.css) {
2514
- pdfData.options.footerCSS = _this18.options.footer.css;
2835
+ if (_this19.options.footer.css) {
2836
+ pdfData.options.footerCSS = _this19.options.footer.css;
2515
2837
  }
2516
2838
  }
2517
2839
  } else {
2518
- pdfData.footer = _this18.options.footer;
2840
+ pdfData.footer = _this19.options.footer;
2519
2841
  }
2520
2842
  }
2521
2843
 
@@ -2524,31 +2846,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2524
2846
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
2525
2847
  // document.getElementById(`${this.elementId}_form`).submit()
2526
2848
 
2527
- _this18.service.add('', pdfData, {
2849
+ _this19.service.add('', pdfData, {
2528
2850
  responseType: 'blob'
2529
2851
  }).then(function (response) {
2530
- _this18.loader.hide();
2852
+ _this19.loader.hide();
2531
2853
 
2532
2854
  var blob = new Blob([response], {
2533
2855
  type: 'application/pdf'
2534
2856
  });
2535
2857
  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 ");
2536
2858
 
2537
- if (_this18.options.directDownload === true) {
2859
+ if (_this19.options.directDownload === true) {
2538
2860
  var fileName;
2539
2861
 
2540
- if (typeof _this18.options.fileName === 'function') {
2541
- fileName = _this18.options.fileName() || 'Export';
2862
+ if (typeof _this19.options.fileName === 'function') {
2863
+ fileName = _this19.options.fileName() || 'Export';
2542
2864
  } else {
2543
- fileName = _this18.options.fileName || 'Export';
2865
+ fileName = _this19.options.fileName || 'Export';
2544
2866
  }
2545
2867
 
2546
2868
  msg += "download='".concat(fileName, ".pdf'");
2547
2869
  }
2548
2870
 
2549
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this18.options.buttonText, "</button>\n </a>\n </div>\n ");
2871
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
2550
2872
 
2551
- _this18.popup.show({
2873
+ _this19.popup.show({
2552
2874
  message: msg,
2553
2875
  mask: true
2554
2876
  });
@@ -2710,21 +3032,37 @@ var WebsyPubSub = /*#__PURE__*/function () {
2710
3032
 
2711
3033
  _createClass(WebsyPubSub, [{
2712
3034
  key: "publish",
2713
- value: function publish(method, data) {
2714
- if (this.subscriptions[method]) {
2715
- this.subscriptions[method].forEach(function (fn) {
2716
- fn(data);
2717
- });
3035
+ value: function publish(id, method, data) {
3036
+ if (arguments.length === 3) {
3037
+ if (this.subscriptions[id] && this.subscriptions[id][method]) {
3038
+ this.subscriptions[id][method](data);
3039
+ }
3040
+ } else {
3041
+ if (this.subscriptions[method]) {
3042
+ this.subscriptions[method].forEach(function (fn) {
3043
+ fn(data);
3044
+ });
3045
+ }
2718
3046
  }
2719
3047
  }
2720
3048
  }, {
2721
3049
  key: "subscribe",
2722
- value: function subscribe(method, fn) {
2723
- if (!this.subscriptions[method]) {
2724
- this.subscriptions[method] = [];
2725
- }
3050
+ value: function subscribe(id, method, fn) {
3051
+ if (arguments.length === 3) {
3052
+ if (!this.subscriptions[id]) {
3053
+ this.subscriptions[id] = {};
3054
+ }
2726
3055
 
2727
- this.subscriptions[method].push(fn);
3056
+ if (!this.subscriptions[id][method]) {
3057
+ this.subscriptions[id][method] = fn;
3058
+ }
3059
+ } else {
3060
+ if (!this.subscriptions[method]) {
3061
+ this.subscriptions[method] = [];
3062
+ }
3063
+
3064
+ this.subscriptions[method].push(fn);
3065
+ }
2728
3066
  }
2729
3067
  }]);
2730
3068
 
@@ -2733,7 +3071,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
2733
3071
 
2734
3072
  var ResponsiveText = /*#__PURE__*/function () {
2735
3073
  function ResponsiveText(elementId, options) {
2736
- var _this19 = this;
3074
+ var _this20 = this;
2737
3075
 
2738
3076
  _classCallCheck(this, ResponsiveText);
2739
3077
 
@@ -2746,7 +3084,7 @@ var ResponsiveText = /*#__PURE__*/function () {
2746
3084
  this.elementId = elementId;
2747
3085
  this.canvas = document.createElement('canvas');
2748
3086
  window.addEventListener('resize', function () {
2749
- return _this19.render();
3087
+ return _this20.render();
2750
3088
  });
2751
3089
  var el = document.getElementById(this.elementId);
2752
3090
 
@@ -2965,7 +3303,7 @@ var ResponsiveText = /*#__PURE__*/function () {
2965
3303
 
2966
3304
  var WebsyResultList = /*#__PURE__*/function () {
2967
3305
  function WebsyResultList(elementId, options) {
2968
- var _this20 = this;
3306
+ var _this21 = this;
2969
3307
 
2970
3308
  _classCallCheck(this, WebsyResultList);
2971
3309
 
@@ -2993,9 +3331,9 @@ var WebsyResultList = /*#__PURE__*/function () {
2993
3331
 
2994
3332
  if (_typeof(options.template) === 'object' && options.template.url) {
2995
3333
  this.templateService.get(options.template.url).then(function (templateString) {
2996
- _this20.options.template = templateString;
3334
+ _this21.options.template = templateString;
2997
3335
 
2998
- _this20.render();
3336
+ _this21.render();
2999
3337
  });
3000
3338
  } else {
3001
3339
  this.render();
@@ -3014,7 +3352,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3014
3352
  }, {
3015
3353
  key: "buildHTML",
3016
3354
  value: function buildHTML(d) {
3017
- var _this21 = this;
3355
+ var _this22 = this;
3018
3356
 
3019
3357
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3020
3358
  var html = "";
@@ -3022,7 +3360,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3022
3360
  if (this.options.template) {
3023
3361
  if (d.length > 0) {
3024
3362
  d.forEach(function (row, ix) {
3025
- var template = "".concat(ix > 0 ? '-->' : '').concat(_this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3363
+ var template = "".concat(ix > 0 ? '-->' : '').concat(_this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3026
3364
 
3027
3365
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3028
3366
 
@@ -3142,7 +3480,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3142
3480
  }, {
3143
3481
  key: "handleClick",
3144
3482
  value: function handleClick(event) {
3145
- var _this22 = this;
3483
+ var _this23 = this;
3146
3484
 
3147
3485
  if (event.target.classList.contains('clickable')) {
3148
3486
  var l = event.target.getAttribute('data-event');
@@ -3160,8 +3498,8 @@ var WebsyResultList = /*#__PURE__*/function () {
3160
3498
  l = l[0];
3161
3499
  params = params.map(function (p) {
3162
3500
  if (typeof p !== 'string' && typeof p !== 'number') {
3163
- if (_this22.rows[+id]) {
3164
- p = _this22.rows[+id][p];
3501
+ if (_this23.rows[+id]) {
3502
+ p = _this23.rows[+id][p];
3165
3503
  }
3166
3504
  } else if (typeof p === 'string') {
3167
3505
  p = p.replace(/"/g, '').replace(/'/g, '');
@@ -3183,13 +3521,13 @@ var WebsyResultList = /*#__PURE__*/function () {
3183
3521
  }, {
3184
3522
  key: "render",
3185
3523
  value: function render() {
3186
- var _this23 = this;
3524
+ var _this24 = this;
3187
3525
 
3188
3526
  if (this.options.entity) {
3189
3527
  this.apiService.get(this.options.entity).then(function (results) {
3190
- _this23.rows = results.rows;
3528
+ _this24.rows = results.rows;
3191
3529
 
3192
- _this23.resize();
3530
+ _this24.resize();
3193
3531
  });
3194
3532
  } else {
3195
3533
  this.resize();
@@ -3268,14 +3606,14 @@ var WebsyRouter = /*#__PURE__*/function () {
3268
3606
  _createClass(WebsyRouter, [{
3269
3607
  key: "addGroup",
3270
3608
  value: function addGroup(group) {
3271
- var _this24 = this;
3609
+ var _this25 = this;
3272
3610
 
3273
3611
  if (!this.groups[group]) {
3274
3612
  var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
3275
3613
 
3276
3614
  if (els) {
3277
3615
  this.getClosestParent(els[0], function (parent) {
3278
- _this24.groups[group] = {
3616
+ _this25.groups[group] = {
3279
3617
  activeView: '',
3280
3618
  views: [],
3281
3619
  parent: parent.getAttribute('data-view')
@@ -3600,12 +3938,12 @@ var WebsyRouter = /*#__PURE__*/function () {
3600
3938
  }, {
3601
3939
  key: "showComponents",
3602
3940
  value: function showComponents(view) {
3603
- var _this25 = this;
3941
+ var _this26 = this;
3604
3942
 
3605
3943
  if (this.options.views && this.options.views[view] && this.options.views[view].components) {
3606
3944
  this.options.views[view].components.forEach(function (c) {
3607
3945
  if (typeof c.instance === 'undefined') {
3608
- _this25.prepComponent(c.elementId, c.options);
3946
+ _this26.prepComponent(c.elementId, c.options);
3609
3947
 
3610
3948
  c.instance = new c.Component(c.elementId, c.options);
3611
3949
  } else if (c.instance.render) {
@@ -3974,7 +4312,7 @@ var Switch = /*#__PURE__*/function () {
3974
4312
 
3975
4313
  var WebsyTemplate = /*#__PURE__*/function () {
3976
4314
  function WebsyTemplate(elementId, options) {
3977
- var _this26 = this;
4315
+ var _this27 = this;
3978
4316
 
3979
4317
  _classCallCheck(this, WebsyTemplate);
3980
4318
 
@@ -4000,9 +4338,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
4000
4338
 
4001
4339
  if (_typeof(options.template) === 'object' && options.template.url) {
4002
4340
  this.templateService.get(options.template.url).then(function (templateString) {
4003
- _this26.options.template = templateString;
4341
+ _this27.options.template = templateString;
4004
4342
 
4005
- _this26.render();
4343
+ _this27.render();
4006
4344
  });
4007
4345
  } else {
4008
4346
  this.render();
@@ -4012,7 +4350,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
4012
4350
  _createClass(WebsyTemplate, [{
4013
4351
  key: "buildHTML",
4014
4352
  value: function buildHTML() {
4015
- var _this27 = this;
4353
+ var _this28 = this;
4016
4354
 
4017
4355
  var html = "";
4018
4356
 
@@ -4074,14 +4412,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
4074
4412
  }
4075
4413
 
4076
4414
  if (polarity === true) {
4077
- if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
4415
+ if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] === parts[1]) {
4078
4416
  // remove the <if> tags
4079
4417
  removeAll = false;
4080
4418
  } else if (parts[0] === parts[1]) {
4081
4419
  removeAll = false;
4082
4420
  }
4083
4421
  } else if (polarity === false) {
4084
- if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
4422
+ if (typeof _this28.options.data[parts[0]] !== 'undefined' && _this28.options.data[parts[0]] !== parts[1]) {
4085
4423
  // remove the <if> tags
4086
4424
  removeAll = false;
4087
4425
  }
@@ -4368,7 +4706,7 @@ var WebsyUtils = {
4368
4706
 
4369
4707
  var WebsyTable = /*#__PURE__*/function () {
4370
4708
  function WebsyTable(elementId, options) {
4371
- var _this28 = this;
4709
+ var _this29 = this;
4372
4710
 
4373
4711
  _classCallCheck(this, WebsyTable);
4374
4712
 
@@ -4406,8 +4744,8 @@ var WebsyTable = /*#__PURE__*/function () {
4406
4744
  allowClear: false,
4407
4745
  disableSearch: true,
4408
4746
  onItemSelected: function onItemSelected(selectedItem) {
4409
- if (_this28.options.onChangePageSize) {
4410
- _this28.options.onChangePageSize(selectedItem.value);
4747
+ if (_this29.options.onChangePageSize) {
4748
+ _this29.options.onChangePageSize(selectedItem.value);
4411
4749
  }
4412
4750
  }
4413
4751
  });
@@ -4428,7 +4766,7 @@ var WebsyTable = /*#__PURE__*/function () {
4428
4766
  _createClass(WebsyTable, [{
4429
4767
  key: "appendRows",
4430
4768
  value: function appendRows(data) {
4431
- var _this29 = this;
4769
+ var _this30 = this;
4432
4770
 
4433
4771
  this.hideError();
4434
4772
  var bodyHTML = '';
@@ -4436,15 +4774,15 @@ var WebsyTable = /*#__PURE__*/function () {
4436
4774
  if (data) {
4437
4775
  bodyHTML += data.map(function (r, rowIndex) {
4438
4776
  return '<tr>' + r.map(function (c, i) {
4439
- if (_this29.options.columns[i].show !== false) {
4777
+ if (_this30.options.columns[i].show !== false) {
4440
4778
  var style = '';
4441
4779
 
4442
4780
  if (c.style) {
4443
4781
  style += c.style;
4444
4782
  }
4445
4783
 
4446
- if (_this29.options.columns[i].width) {
4447
- style += "width: ".concat(_this29.options.columns[i].width, "; ");
4784
+ if (_this30.options.columns[i].width) {
4785
+ style += "width: ".concat(_this30.options.columns[i].width, "; ");
4448
4786
  }
4449
4787
 
4450
4788
  if (c.backgroundColor) {
@@ -4459,18 +4797,18 @@ var WebsyTable = /*#__PURE__*/function () {
4459
4797
  style += "color: ".concat(c.color, "; ");
4460
4798
  }
4461
4799
 
4462
- if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4463
- return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4464
- } else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4465
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
4800
+ if (_this30.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4801
+ return "\n <td \n data-row-index='".concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this30.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4802
+ } else if ((_this30.options.columns[i].showAsNavigatorLink === true || _this30.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4803
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this30.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this30.options.columns[i].linkText || c.value, "</td>\n ");
4466
4804
  } else {
4467
4805
  var info = c.value;
4468
4806
 
4469
- if (_this29.options.columns[i].showAsImage === true) {
4807
+ if (_this30.options.columns[i].showAsImage === true) {
4470
4808
  c.value = "\n <img src='".concat(c.value, "'>\n ");
4471
4809
  }
4472
4810
 
4473
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
4811
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this30.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this30.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
4474
4812
  }
4475
4813
  }
4476
4814
  }).join('') + '</tr>';
@@ -4642,7 +4980,7 @@ var WebsyTable = /*#__PURE__*/function () {
4642
4980
  }, {
4643
4981
  key: "render",
4644
4982
  value: function render(data) {
4645
- var _this30 = this;
4983
+ var _this31 = this;
4646
4984
 
4647
4985
  if (!this.options.columns) {
4648
4986
  return;
@@ -4667,7 +5005,7 @@ var WebsyTable = /*#__PURE__*/function () {
4667
5005
 
4668
5006
  var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
4669
5007
  if (c.show !== false) {
4670
- 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 ? _this30.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
5008
+ 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 ? _this31.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
4671
5009
  }
4672
5010
  }).join('') + '</tr>';
4673
5011
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -4686,7 +5024,7 @@ var WebsyTable = /*#__PURE__*/function () {
4686
5024
 
4687
5025
  if (pagingEl) {
4688
5026
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
4689
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5027
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
4690
5028
  });
4691
5029
  var startIndex = 0;
4692
5030
 
@@ -4754,7 +5092,7 @@ var WebsyTable = /*#__PURE__*/function () {
4754
5092
 
4755
5093
  var WebsyTable2 = /*#__PURE__*/function () {
4756
5094
  function WebsyTable2(elementId, options) {
4757
- var _this31 = this;
5095
+ var _this32 = this;
4758
5096
 
4759
5097
  _classCallCheck(this, WebsyTable2);
4760
5098
 
@@ -4795,8 +5133,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
4795
5133
  allowClear: false,
4796
5134
  disableSearch: true,
4797
5135
  onItemSelected: function onItemSelected(selectedItem) {
4798
- if (_this31.options.onChangePageSize) {
4799
- _this31.options.onChangePageSize(selectedItem.value);
5136
+ if (_this32.options.onChangePageSize) {
5137
+ _this32.options.onChangePageSize(selectedItem.value);
4800
5138
  }
4801
5139
  }
4802
5140
  });
@@ -4820,7 +5158,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
4820
5158
  _createClass(WebsyTable2, [{
4821
5159
  key: "appendRows",
4822
5160
  value: function appendRows(data) {
4823
- var _this32 = this;
5161
+ var _this33 = this;
4824
5162
 
4825
5163
  this.hideError();
4826
5164
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
@@ -4829,15 +5167,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
4829
5167
  if (data) {
4830
5168
  bodyHTML += data.map(function (r, rowIndex) {
4831
5169
  return '<tr>' + r.map(function (c, i) {
4832
- if (_this32.options.columns[i].show !== false) {
4833
- var style = "height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px;");
5170
+ if (_this33.options.columns[i].show !== false) {
5171
+ var style = "height: ".concat(_this33.options.cellSize, "px; line-height: ").concat(_this33.options.cellSize, "px;");
4834
5172
 
4835
5173
  if (c.style) {
4836
5174
  style += c.style;
4837
5175
  }
4838
5176
 
4839
- if (_this32.options.columns[i].width) {
4840
- style += "width: ".concat(_this32.options.columns[i].width, "; ");
5177
+ if (_this33.options.columns[i].width) {
5178
+ style += "width: ".concat(_this33.options.columns[i].width, "; ");
4841
5179
  }
4842
5180
 
4843
5181
  if (c.backgroundColor) {
@@ -4852,18 +5190,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
4852
5190
  style += "color: ".concat(c.color, "; ");
4853
5191
  }
4854
5192
 
4855
- if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
4856
- return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
4857
- } else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
4858
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
5193
+ if (_this33.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5194
+ return "\n <td \n data-row-index='".concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this33.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5195
+ } else if ((_this33.options.columns[i].showAsNavigatorLink === true || _this33.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5196
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this33.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this33.options.columns[i].linkText || c.value, "</td>\n ");
4859
5197
  } else {
4860
5198
  var info = c.value;
4861
5199
 
4862
- if (_this32.options.columns[i].showAsImage === true) {
5200
+ if (_this33.options.columns[i].showAsImage === true) {
4863
5201
  c.value = "\n <img src='".concat(c.value, "'>\n ");
4864
5202
  }
4865
5203
 
4866
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
5204
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this33.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this33.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
4867
5205
  }
4868
5206
  }
4869
5207
  }).join('') + '</tr>';
@@ -5076,7 +5414,11 @@ var WebsyTable2 = /*#__PURE__*/function () {
5076
5414
  }, {
5077
5415
  key: "hideLoading",
5078
5416
  value: function hideLoading() {
5079
- this.loadingDialog.hide();
5417
+ if (this.options.onLoading) {
5418
+ this.options.onLoading(false);
5419
+ } else {
5420
+ this.loadingDialog.hide();
5421
+ }
5080
5422
  }
5081
5423
  }, {
5082
5424
  key: "internalSort",
@@ -5122,7 +5464,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5122
5464
  }, {
5123
5465
  key: "render",
5124
5466
  value: function render(data) {
5125
- var _this33 = this;
5467
+ var _this34 = this;
5126
5468
 
5127
5469
  if (!this.options.columns) {
5128
5470
  return;
@@ -5158,7 +5500,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5158
5500
  style += "width: ".concat(c.width || 'auto', "; ");
5159
5501
  }
5160
5502
 
5161
- 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-sort-index=\"").concat(c.sortIndex || i, "\"\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(i) : '', "\n </div>\n </th>\n ");
5503
+ 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-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5162
5504
  }
5163
5505
  }).join('') + '</tr>';
5164
5506
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -5169,7 +5511,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5169
5511
  var dropdownHTML = "";
5170
5512
  this.options.columns.forEach(function (c, i) {
5171
5513
  if (c.searchable && c.searchField) {
5172
- dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
5514
+ dropdownHTML += "\n <div id=\"".concat(_this34.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
5173
5515
  }
5174
5516
  });
5175
5517
  dropdownEl.innerHTML = dropdownHTML;
@@ -5191,7 +5533,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
5191
5533
 
5192
5534
  if (pagingEl) {
5193
5535
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
5194
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5536
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this34.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
5195
5537
  });
5196
5538
  var startIndex = 0;
5197
5539
 
@@ -5273,12 +5615,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
5273
5615
  }, {
5274
5616
  key: "showLoading",
5275
5617
  value: function showLoading(options) {
5276
- this.loadingDialog.show(options);
5618
+ if (this.options.onLoading) {
5619
+ this.options.onLoading(true);
5620
+ } else {
5621
+ this.loadingDialog.show(options);
5622
+ }
5277
5623
  }
5278
5624
  }, {
5279
5625
  key: "getColumnParameters",
5280
5626
  value: function getColumnParameters(values) {
5281
- var _this34 = this;
5627
+ var _this35 = this;
5282
5628
 
5283
5629
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
5284
5630
  tableEl.style.tableLayout = 'auto';
@@ -5286,10 +5632,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
5286
5632
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
5287
5633
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
5288
5634
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
5289
- return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5635
+ return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
5290
5636
  }).join('') + '</tr>';
5291
5637
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
5292
- return "\n <td \n style='height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5638
+ return "\n <td \n style='height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
5293
5639
  }).join('') + '</tr>'; // get height of the first data cell
5294
5640
 
5295
5641
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -5334,12 +5680,639 @@ var WebsyTable2 = /*#__PURE__*/function () {
5334
5680
 
5335
5681
  return WebsyTable2;
5336
5682
  }();
5683
+ /* global WebsyDesigns */
5684
+
5685
+
5686
+ var WebsyTable3 = /*#__PURE__*/function () {
5687
+ function WebsyTable3(elementId, options) {
5688
+ _classCallCheck(this, WebsyTable3);
5689
+
5690
+ this.elementId = elementId;
5691
+ var DEFAULTS = {
5692
+ virtualScroll: false,
5693
+ showTotalsAbove: true,
5694
+ minHandleSize: 20,
5695
+ maxColWidth: '50%',
5696
+ allowPivoting: false
5697
+ };
5698
+ this.options = _extends({}, DEFAULTS, options);
5699
+ this.sizes = {};
5700
+ this.scrollDragging = false;
5701
+ this.cellDragging = false;
5702
+ this.vScrollRequired = false;
5703
+ this.hScrollRequired = false;
5704
+ this.pinnedColumns = 0;
5705
+ this.startRow = 0;
5706
+ this.endRow = 0;
5707
+ this.startCol = 0;
5708
+ this.endCol = 0;
5709
+ this.mouseYStart = 0;
5710
+ this.mouseYStart = 0;
5711
+
5712
+ if (!elementId) {
5713
+ console.log('No element Id provided for Websy Table');
5714
+ return;
5715
+ }
5716
+
5717
+ var el = document.getElementById(this.elementId);
5718
+
5719
+ if (el) {
5720
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table-3 ").concat(this.options.paging === 'pages' ? 'with-paging' : '', " ").concat(this.options.virtualScroll === true ? 'with-virtual-scroll' : '', "'>\n <!--<div class=\"download-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M16 11h5l-9 10-9-10h5v-11h8v11zm1 11h-10v2h10v-2z\"/></svg>\n </div>-->\n <div id=\"").concat(this.elementId, "_tableInner\" class=\"websy-table-inner-container\">\n <table id=\"").concat(this.elementId, "_tableHeader\" class=\"websy-table-header\"></table>\n <table id=\"").concat(this.elementId, "_tableBody\" class=\"websy-table-body\"></table>\n <table id=\"").concat(this.elementId, "_tableFooter\" class=\"websy-table-footer\"></table>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div>\n </div> \n <div id=\"").concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainer\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n ");
5721
+
5722
+ if (this.options.paging === 'pages') {
5723
+ html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
5724
+ }
5725
+
5726
+ el.innerHTML = html;
5727
+ el.addEventListener('click', this.handleClick.bind(this));
5728
+ el.addEventListener('mousedown', this.handleMouseDown.bind(this));
5729
+ window.addEventListener('mousemove', this.handleMouseMove.bind(this));
5730
+ window.addEventListener('mouseup', this.handleMouseUp.bind(this));
5731
+ var scrollEl = document.getElementById("".concat(this.elementId, "_tableBody"));
5732
+
5733
+ if (scrollEl) {
5734
+ scrollEl.addEventListener('wheel', this.handleScrollWheel.bind(this));
5735
+ }
5736
+
5737
+ this.loadingDialog = new WebsyDesigns.LoadingDialog("".concat(this.elementId, "_loadingContainer"));
5738
+ this.render(this.options.data);
5739
+ } else {
5740
+ console.error("No element found with ID ".concat(this.elementId));
5741
+ }
5742
+ }
5743
+
5744
+ _createClass(WebsyTable3, [{
5745
+ key: "appendRows",
5746
+ value: function appendRows(data) {
5747
+ this.hideError();
5748
+ var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
5749
+
5750
+ if (bodyEl) {
5751
+ if (this.options.virtualScroll === true) {
5752
+ bodyEl.innerHTML = this.buildBodyHtml(data, true);
5753
+ } else {
5754
+ bodyEl.innerHTML += this.buildBodyHtml(data, true);
5755
+ }
5756
+ } // this.data = this.data.concat(data)
5757
+ // this.rowCount = this.data.length
5758
+
5759
+ }
5760
+ }, {
5761
+ key: "buildBodyHtml",
5762
+ value: function buildBodyHtml() {
5763
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5764
+ var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5765
+
5766
+ if (data.length === 0) {
5767
+ return '';
5768
+ }
5769
+
5770
+ var bodyHtml = "";
5771
+ var sizingColumns = this.options.columns[this.options.columns.length - 1];
5772
+
5773
+ if (useWidths === true) {
5774
+ bodyHtml += '<colgroup>';
5775
+ bodyHtml += sizingColumns.map(function (c) {
5776
+ return "\n <col\n style='width: ".concat(c.width || c.actualWidth, "px!important'\n ></col>\n ");
5777
+ }).join('');
5778
+ bodyHtml += '</colgroup>';
5779
+ }
5780
+
5781
+ data.forEach(function (row) {
5782
+ bodyHtml += "<tr class=\"websy-table-row\">";
5783
+ row.forEach(function (cell, cellIndex) {
5784
+ 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) {
5785
+ // bodyHtml += `
5786
+ // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
5787
+ // width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
5788
+ // `
5789
+ // }
5790
+
5791
+ bodyHtml += "\n >\n ".concat(cell.value, "\n </td>");
5792
+ });
5793
+ bodyHtml += "</tr>";
5794
+ }); // bodyHtml += `</div>`
5795
+
5796
+ return bodyHtml;
5797
+ }
5798
+ }, {
5799
+ key: "buildHeaderHtml",
5800
+ value: function buildHeaderHtml() {
5801
+ var _this36 = this;
5802
+
5803
+ var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5804
+ var headerHtml = '';
5805
+ var sizingColumns = this.options.columns[this.options.columns.length - 1];
5806
+
5807
+ if (useWidths === true) {
5808
+ headerHtml += '<colgroup>';
5809
+ headerHtml += sizingColumns.map(function (c) {
5810
+ return "\n <col\n style='width: ".concat(c.width || c.actualWidth, "px!important'\n ></col>\n ");
5811
+ }).join('');
5812
+ headerHtml += '</colgroup>';
5813
+ }
5814
+
5815
+ this.options.columns.forEach(function (row, rowIndex) {
5816
+ if (useWidths === false && rowIndex !== _this36.options.columns.length - 1) {
5817
+ // if we're calculating the size we only want to render the last row of column headers
5818
+ return;
5819
+ }
5820
+
5821
+ headerHtml += "<tr class=\"websy-table-row websy-table-header-row\">";
5822
+ row.forEach(function (col) {
5823
+ 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) {
5824
+ // headerHtml += `
5825
+ // style='width: ${col.width || col.actualWidth}px'
5826
+ // width='${col.width || col.actualWidth}'
5827
+ // `
5828
+ // }
5829
+
5830
+ headerHtml += " \n >\n ".concat(col.name, "\n </td>");
5831
+ });
5832
+ headerHtml += "</tr>";
5833
+ });
5834
+ return headerHtml;
5835
+ }
5836
+ }, {
5837
+ key: "buildTotalHtml",
5838
+ value: function buildTotalHtml() {
5839
+ var _this37 = this;
5840
+
5841
+ var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5842
+
5843
+ if (!this.options.totals) {
5844
+ return '';
5845
+ }
5846
+
5847
+ var totalHtml = "<tr class=\"websy-table-row websy-table-total-row\">";
5848
+ this.options.totals.forEach(function (col, colIndex) {
5849
+ totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
5850
+
5851
+ if (useWidths === true) {
5852
+ totalHtml += "\n style='width: ".concat(_this37.options.columns[_this37.options.columns.length - 1][colIndex].width || _this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
5853
+ }
5854
+
5855
+ totalHtml += " \n >\n ".concat(col.value, "\n </td>");
5856
+ });
5857
+ totalHtml += "</tr>";
5858
+ return totalHtml;
5859
+ }
5860
+ }, {
5861
+ key: "calculateSizes",
5862
+ value: function calculateSizes() {
5863
+ var _this38 = this;
5864
+
5865
+ var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5866
+ var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
5867
+ var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
5868
+ var pinnedColumns = arguments.length > 3 ? arguments[3] : undefined;
5869
+ this.totalRowCount = totalRowCount; // probably need some error handling here if no value is passed in
5870
+
5871
+ this.totalColumnCount = totalColumnCount; // probably need some error handling here if no value is passed in
5872
+
5873
+ this.pinnedColumns = pinnedColumns; // probably need some error handling here if no value is passed in
5874
+
5875
+ var outerEl = document.getElementById(this.elementId);
5876
+ var tableEl = document.getElementById("".concat(this.elementId, "_tableContainer"));
5877
+ var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
5878
+ headEl.style.width = 'auto';
5879
+ headEl.innerHTML = this.buildHeaderHtml();
5880
+ this.sizes.outer = outerEl.getBoundingClientRect();
5881
+ this.sizes.table = tableEl.getBoundingClientRect();
5882
+ this.sizes.header = headEl.getBoundingClientRect();
5883
+ var maxWidth;
5884
+
5885
+ if (typeof this.options.maxColWidth === 'number') {
5886
+ maxWidth = this.options.maxColWidth;
5887
+ } else if (this.options.maxColWidth.indexOf('%') !== -1) {
5888
+ maxWidth = this.sizes.outer.width * (+this.options.maxColWidth.replace('%', '') / 100);
5889
+ } else if (this.options.maxColWidth.indexOf('px') !== -1) {
5890
+ maxWidth = +this.options.maxColWidth.replace('px', '');
5891
+ }
5892
+
5893
+ var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody"));
5894
+ bodyEl.style.width = 'auto';
5895
+ bodyEl.innerHTML = this.buildBodyHtml([sample]);
5896
+ var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
5897
+ footerEl.innerHTML = this.buildTotalHtml();
5898
+ this.sizes.total = footerEl.getBoundingClientRect();
5899
+ var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
5900
+ var totalWidth = 0;
5901
+ this.sizes.scrollableWidth = this.sizes.outer.width;
5902
+ rows.forEach(function (row, rowIndex) {
5903
+ Array.from(row.children).forEach(function (col, colIndex) {
5904
+ var colSize = col.getBoundingClientRect();
5905
+ _this38.sizes.cellHeight = colSize.height;
5906
+
5907
+ if (_this38.options.columns[_this38.options.columns.length - 1][colIndex]) {
5908
+ if (!_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth) {
5909
+ _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = 0;
5910
+ }
5911
+
5912
+ _this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this38.options.columns[_this38.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
5913
+ _this38.options.columns[_this38.options.columns.length - 1][colIndex].cellHeight = colSize.height;
5914
+ }
5915
+ });
5916
+ });
5917
+ this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
5918
+ if (colIndex < _this38.pinnedColumns) {
5919
+ _this38.sizes.scrollableWidth -= col.actualWidth;
5920
+ }
5921
+ });
5922
+ this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
5923
+ return a + (b.width || b.actualWidth);
5924
+ }, 0);
5925
+ var outerSize = outerEl.getBoundingClientRect();
5926
+
5927
+ if (this.sizes.totalWidth < outerSize.width) {
5928
+ this.sizes.totalWidth = 0;
5929
+ var equalWidth = outerSize.width / this.options.columns[this.options.columns.length - 1].length;
5930
+ this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
5931
+ if (!c.width) {
5932
+ if (c.actualWidth < equalWidth) {
5933
+ // adjust the width
5934
+ c.actualWidth = equalWidth;
5935
+ }
5936
+ }
5937
+
5938
+ _this38.sizes.totalWidth += c.width || c.actualWidth;
5939
+ equalWidth = (outerSize.width - _this38.sizes.totalWidth) / (_this38.options.columns[_this38.options.columns.length - 1].length - (i + 1));
5940
+ });
5941
+ } // take the height of the last cell as the official height for data cells
5942
+ // this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
5943
+
5944
+
5945
+ headEl.innerHTML = '';
5946
+ bodyEl.innerHTML = '';
5947
+ footerEl.innerHTML = '';
5948
+ headEl.style.width = 'initial';
5949
+ bodyEl.style.width = 'initial';
5950
+ this.sizes.bodyHeight = this.sizes.table.height - (this.sizes.header.height + this.sizes.total.height);
5951
+ this.sizes.rowsToRender = Math.ceil(this.sizes.bodyHeight / this.sizes.cellHeight);
5952
+ this.sizes.rowsToRenderPrecise = this.sizes.bodyHeight / this.sizes.cellHeight;
5953
+ this.startRow = 0;
5954
+ this.endRow = this.sizes.rowsToRender;
5955
+ this.startCol = 0;
5956
+ this.endCol = this.options.columns[this.options.columns.length - 1].length;
5957
+
5958
+ if (this.sizes.rowsToRender < this.totalRowCount) {
5959
+ this.vScrollRequired = true;
5960
+ }
5961
+
5962
+ if (this.sizes.totalWidth > this.sizes.outer.width) {
5963
+ this.hScrollRequired = true;
5964
+ }
5965
+
5966
+ this.options.allColumns = this.options.columns.map(function (c) {
5967
+ return c;
5968
+ });
5969
+ console.log('sizes', this.sizes);
5970
+ return this.sizes;
5971
+ }
5972
+ }, {
5973
+ key: "createSample",
5974
+ value: function createSample(data) {
5975
+ var output = [];
5976
+ this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
5977
+ if (col.maxLength) {
5978
+ output.push({
5979
+ value: new Array(col.maxLength).fill('W').join('')
5980
+ });
5981
+ } else if (data) {
5982
+ var longest = '';
5983
+
5984
+ for (var i = 0; i < Math.min(data.length, 1000); i++) {
5985
+ if (longest.length < data[i][colIndex].value.length) {
5986
+ longest = data[i][colIndex].value;
5987
+ }
5988
+ }
5989
+
5990
+ output.push({
5991
+ value: longest
5992
+ });
5993
+ } else {
5994
+ output.push({
5995
+ value: ''
5996
+ });
5997
+ }
5998
+ });
5999
+ return output;
6000
+ }
6001
+ }, {
6002
+ key: "handleClick",
6003
+ value: function handleClick(event) {}
6004
+ }, {
6005
+ key: "handleMouseDown",
6006
+ value: function handleMouseDown(event) {
6007
+ if (event.target.classList.contains('websy-scroll-handle-y')) {
6008
+ // set up the scroll start values
6009
+ this.scrollDragging = true;
6010
+ this.scrollDirection = 'y';
6011
+ var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6012
+ this.handleYStart = scrollHandleEl.offsetTop;
6013
+ this.mouseYStart = event.pageY;
6014
+ console.log('mouse down', this.handleYStart, this.mouseYStart);
6015
+ console.log(scrollHandleEl.offsetTop);
6016
+ } else if (event.target.classList.contains('websy-scroll-handle-x')) {
6017
+ this.scrollDragging = true;
6018
+ this.scrollDirection = 'x';
6019
+
6020
+ var _scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6021
+
6022
+ this.handleXStart = _scrollHandleEl.offsetLeft;
6023
+ this.mouseXStart = event.pageX;
6024
+ }
6025
+ }
6026
+ }, {
6027
+ key: "handleMouseMove",
6028
+ value: function handleMouseMove(event) {
6029
+ // event.preventDefault()
6030
+ if (this.scrollDragging === true) {
6031
+ if (this.scrollDirection === 'y') {
6032
+ var diff = event.pageY - this.mouseYStart;
6033
+ this.scrollY(diff);
6034
+ } else if (this.scrollDirection === 'x') {
6035
+ var _diff = event.pageX - this.mouseXStart;
6036
+
6037
+ this.scrollX(_diff);
6038
+ }
6039
+ }
6040
+ }
6041
+ }, {
6042
+ key: "handleMouseUp",
6043
+ value: function handleMouseUp(event) {
6044
+ this.scrollDragging = false;
6045
+ this.cellDragging = false;
6046
+ this.handleYStart = null;
6047
+ this.mouseYStart = null;
6048
+ this.handleXStart = null;
6049
+ this.mouseXStart = null;
6050
+ }
6051
+ }, {
6052
+ key: "handleScrollWheel",
6053
+ value: function handleScrollWheel(event) {
6054
+ event.preventDefault();
6055
+ console.log('scrollwheel', event);
6056
+
6057
+ if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
6058
+ this.scrollX(Math.max(-5, Math.min(5, event.deltaX)));
6059
+ } else {
6060
+ this.scrollY(Math.max(-5, Math.min(5, event.deltaY)));
6061
+ }
6062
+ }
6063
+ }, {
6064
+ key: "hideError",
6065
+ value: function hideError() {
6066
+ var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
6067
+
6068
+ if (el) {
6069
+ el.classList.remove('has-error');
6070
+ }
6071
+
6072
+ var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
6073
+ tableEl.classList.remove('hidden');
6074
+ var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
6075
+
6076
+ if (containerEl) {
6077
+ containerEl.classList.remove('active');
6078
+ }
6079
+ }
6080
+ }, {
6081
+ key: "hideLoading",
6082
+ value: function hideLoading() {
6083
+ this.loadingDialog.hide();
6084
+ }
6085
+ }, {
6086
+ key: "render",
6087
+ value: function render(data) {
6088
+ var calcSizes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6089
+
6090
+ if (!this.options.columns) {
6091
+ console.log("No columns provided for table with ID ".concat(this.elementId));
6092
+ return;
6093
+ }
6094
+
6095
+ if (this.options.columns.length === 0) {
6096
+ console.log("No columns provided for table with ID ".concat(this.elementId));
6097
+ return;
6098
+ } // this.data = []
6099
+ // Adjust the sizing of the header/body/footer
6100
+
6101
+
6102
+ if (calcSizes === true) {
6103
+ var sample = this.createSample(data);
6104
+ this.calculateSizes(sample, data.length, (data[0] || []).length, 0);
6105
+ }
6106
+
6107
+ console.log(this.options.columns);
6108
+ var tableInnerEl = document.getElementById("".concat(this.elementId, "_tableInner"));
6109
+
6110
+ if (tableInnerEl) {
6111
+ tableInnerEl.style.width = "".concat(this.sizes.totalWidth, "px");
6112
+ }
6113
+
6114
+ this.renderColumnHeaders();
6115
+ this.renderTotals();
6116
+
6117
+ if (data) {
6118
+ this.appendRows(data);
6119
+ }
6120
+
6121
+ var bodyEl = document.getElementById("".concat(this.elementId, "_tableBody")); // bodyEl.innerHTML = this.buildBodyHtml(data, true)
6122
+
6123
+ bodyEl.style.height = "calc(100% - ".concat(this.sizes.header.height, "px - ").concat(this.sizes.total.height, "px)");
6124
+
6125
+ if (this.options.virtualScroll === true) {
6126
+ // set the scroll element positions
6127
+ if (this.vScrollRequired === true) {
6128
+ var vScrollEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6129
+ var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6130
+ vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
6131
+ vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
6132
+ vHandleEl.style.height = Math.max(this.options.minHandleSize, this.sizes.bodyHeight * (this.sizes.rowsToRenderPrecise / this.totalRowCount)) + 'px';
6133
+ }
6134
+
6135
+ if (this.hScrollRequired === true) {
6136
+ var hScrollEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6137
+ var hHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6138
+ hScrollEl.style.left = "".concat(this.sizes.table.width - this.sizes.scrollableWidth, "px");
6139
+ hScrollEl.style.width = "".concat(this.sizes.scrollableWidth - 20, "px");
6140
+ hHandleEl.style.width = Math.max(this.options.minHandleSize, this.sizes.scrollableWidth * (this.sizes.scrollableWidth / this.sizes.totalWidth)) + 'px';
6141
+ }
6142
+ }
6143
+ }
6144
+ }, {
6145
+ key: "renderColumnHeaders",
6146
+ value: function renderColumnHeaders() {
6147
+ var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
6148
+
6149
+ if (headEl) {
6150
+ headEl.innerHTML = this.buildHeaderHtml(true);
6151
+ }
6152
+ }
6153
+ }, {
6154
+ key: "renderTotals",
6155
+ value: function renderTotals() {
6156
+ var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
6157
+ var totalHtml = this.buildTotalHtml(true);
6158
+
6159
+ if (this.options.showTotalsAbove === true) {
6160
+ headEl.innerHTML += totalHtml;
6161
+ } else {
6162
+ var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
6163
+
6164
+ if (footerEl) {
6165
+ footerEl.innerHTML = totalHtml;
6166
+ }
6167
+ }
6168
+ }
6169
+ }, {
6170
+ key: "resize",
6171
+ value: function resize() {}
6172
+ }, {
6173
+ key: "showError",
6174
+ value: function showError(options) {
6175
+ var el = document.getElementById("".concat(this.elementId, "_tableContainer"));
6176
+
6177
+ if (el) {
6178
+ el.classList.add('has-error');
6179
+ }
6180
+
6181
+ var tableEl = document.getElementById("".concat(this.elementId, "_tableInner"));
6182
+ tableEl.classList.add('hidden');
6183
+ var containerEl = document.getElementById("".concat(this.elementId, "_errorContainer"));
6184
+
6185
+ if (containerEl) {
6186
+ containerEl.classList.add('active');
6187
+ }
6188
+
6189
+ if (options.title) {
6190
+ var titleEl = document.getElementById("".concat(this.elementId, "_errorTitle"));
6191
+
6192
+ if (titleEl) {
6193
+ titleEl.innerHTML = options.title;
6194
+ }
6195
+ }
6196
+
6197
+ if (options.message) {
6198
+ var messageEl = document.getElementById("".concat(this.elementId, "_errorMessage"));
6199
+
6200
+ if (messageEl) {
6201
+ messageEl.innerHTML = options.message;
6202
+ }
6203
+ }
6204
+ }
6205
+ }, {
6206
+ key: "scrollX",
6207
+ value: function scrollX(diff) {
6208
+ var scrollContainerEl = document.getElementById("".concat(this.elementId, "_hScrollContainer"));
6209
+ var scrollHandleEl = document.getElementById("".concat(this.elementId, "_hScrollHandle"));
6210
+ var handlePos;
6211
+
6212
+ if (typeof this.handleXStart !== 'undefined' && this.handleXStart !== null) {
6213
+ handlePos = this.handleXStart + diff;
6214
+ } else {
6215
+ handlePos = scrollHandleEl.offsetLeft + diff;
6216
+ }
6217
+
6218
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width;
6219
+ console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width);
6220
+ scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
6221
+
6222
+ if (this.options.onScroll) {
6223
+ var actualLeft = (this.sizes.totalWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace);
6224
+ var cumulativeWidth = 0;
6225
+ this.startCol = 0;
6226
+ this.endCol = 0;
6227
+
6228
+ for (var i = 0; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
6229
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth;
6230
+ console.log(actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth);
6231
+
6232
+ if (actualLeft < cumulativeWidth) {
6233
+ this.startCol = i;
6234
+ break;
6235
+ }
6236
+ }
6237
+
6238
+ cumulativeWidth = 0;
6239
+
6240
+ for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
6241
+ cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
6242
+
6243
+ if (cumulativeWidth < this.sizes.scrollableWidth) {
6244
+ this.endCol = _i10;
6245
+ }
6246
+ }
6247
+
6248
+ if (this.endCol < this.options.allColumns[this.options.allColumns.length - 1].length - 1) {
6249
+ this.endCol += 1;
6250
+ }
6251
+
6252
+ if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.totalWidth) {
6253
+ this.startCol += 1;
6254
+ }
6255
+
6256
+ this.endCol = Math.max(this.startCol, this.endCol);
6257
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
6258
+ }
6259
+ }
6260
+ }, {
6261
+ key: "scrollY",
6262
+ value: function scrollY(diff) {
6263
+ var scrollContainerEl = document.getElementById("".concat(this.elementId, "_vScrollContainer"));
6264
+ var scrollHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
6265
+ var handlePos;
6266
+
6267
+ if (typeof this.handleYStart !== 'undefined' && this.handleYStart !== null) {
6268
+ handlePos = this.handleYStart + diff;
6269
+ } else {
6270
+ console.log('appending not resetting');
6271
+ handlePos = scrollHandleEl.offsetTop + diff;
6272
+ }
6273
+
6274
+ var scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height;
6275
+ console.log('dragging y', diff, scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height);
6276
+ scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px';
6277
+
6278
+ if (this.options.onScroll) {
6279
+ this.startRow = Math.min(this.totalRowCount - this.sizes.rowsToRender, Math.max(0, Math.round((this.totalRowCount - this.sizes.rowsToRender) * (handlePos / scrollableSpace))));
6280
+ this.endRow = this.startRow + this.sizes.rowsToRender;
6281
+
6282
+ if (this.endRow === this.totalRowCount) {
6283
+ this.startRow += 1;
6284
+ }
6285
+
6286
+ this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol);
6287
+ }
6288
+ }
6289
+ }, {
6290
+ key: "showLoading",
6291
+ value: function showLoading(options) {
6292
+ this.loadingDialog.show(options);
6293
+ }
6294
+ }, {
6295
+ key: "columns",
6296
+ set: function set(columns) {
6297
+ this.options.columns = columns;
6298
+ this.renderColumnHeaders();
6299
+ }
6300
+ }, {
6301
+ key: "totals",
6302
+ set: function set(totals) {
6303
+ this.options.totals = totals;
6304
+ this.renderTotals();
6305
+ }
6306
+ }]);
6307
+
6308
+ return WebsyTable3;
6309
+ }();
5337
6310
  /* global d3 include WebsyDesigns */
5338
6311
 
5339
6312
 
5340
6313
  var WebsyChart = /*#__PURE__*/function () {
5341
6314
  function WebsyChart(elementId, options) {
5342
- var _this35 = this;
6315
+ var _this39 = this;
5343
6316
 
5344
6317
  _classCallCheck(this, WebsyChart);
5345
6318
 
@@ -5388,22 +6361,22 @@ var WebsyChart = /*#__PURE__*/function () {
5388
6361
  this.invertOverride = function (input, input2) {
5389
6362
  var xAxis = 'bottomAxis';
5390
6363
 
5391
- if (_this35.options.orientation === 'horizontal') {
6364
+ if (_this39.options.orientation === 'horizontal') {
5392
6365
  xAxis = 'leftAxis';
5393
6366
  }
5394
6367
 
5395
- var width = _this35[xAxis].step();
6368
+ var width = _this39[xAxis].step();
5396
6369
 
5397
6370
  var output;
5398
6371
 
5399
- var domain = _toConsumableArray(_this35[xAxis].domain());
6372
+ var domain = _toConsumableArray(_this39[xAxis].domain());
5400
6373
 
5401
- if (_this35.options.orientation === 'horizontal') {
6374
+ if (_this39.options.orientation === 'horizontal') {
5402
6375
  domain = domain.reverse();
5403
6376
  }
5404
6377
 
5405
6378
  for (var j = 0; j < domain.length; j++) {
5406
- var breakA = _this35[xAxis](domain[j]) - width / 2;
6379
+ var breakA = _this39[xAxis](domain[j]) - width / 2;
5407
6380
  var breakB = breakA + width;
5408
6381
 
5409
6382
  if (input > breakA && input <= breakB) {
@@ -5503,10 +6476,10 @@ var WebsyChart = /*#__PURE__*/function () {
5503
6476
  }, {
5504
6477
  key: "handleEventMouseMove",
5505
6478
  value: function handleEventMouseMove(event, d) {
5506
- var _this36 = this;
6479
+ var _this40 = this;
5507
6480
 
5508
6481
  var bisectDate = d3.bisector(function (d) {
5509
- return _this36.parseX(d.x.value);
6482
+ return _this40.parseX(d.x.value);
5510
6483
  }).left;
5511
6484
 
5512
6485
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -5545,8 +6518,8 @@ var WebsyChart = /*#__PURE__*/function () {
5545
6518
  }
5546
6519
 
5547
6520
  this.options.data.series.forEach(function (s) {
5548
- if (_this36.options.data[xData].scale !== 'Time') {
5549
- xPoint = _this36[xAxis](_this36.parseX(xLabel));
6521
+ if (_this40.options.data[xData].scale !== 'Time') {
6522
+ xPoint = _this40[xAxis](_this40.parseX(xLabel));
5550
6523
  s.data.forEach(function (d) {
5551
6524
  if (d.x.value === xLabel) {
5552
6525
  if (!tooltipTitle) {
@@ -5565,13 +6538,13 @@ var WebsyChart = /*#__PURE__*/function () {
5565
6538
  var pointA = s.data[index - 1];
5566
6539
  var pointB = s.data[index];
5567
6540
 
5568
- if (_this36.options.orientation === 'horizontal') {
6541
+ if (_this40.options.orientation === 'horizontal') {
5569
6542
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
5570
6543
  pointB = _toConsumableArray(s.data).reverse()[index];
5571
6544
  }
5572
6545
 
5573
6546
  if (pointA && !pointB) {
5574
- xPoint = _this36[xAxis](_this36.parseX(pointA.x.value));
6547
+ xPoint = _this40[xAxis](_this40.parseX(pointA.x.value));
5575
6548
  tooltipTitle = pointA.x.value;
5576
6549
 
5577
6550
  if (!pointA.y.color) {
@@ -5581,12 +6554,12 @@ var WebsyChart = /*#__PURE__*/function () {
5581
6554
  tooltipData.push(pointA.y);
5582
6555
 
5583
6556
  if (typeof pointA.x.value.getTime !== 'undefined') {
5584
- tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointA.x.value);
6557
+ tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointA.x.value);
5585
6558
  }
5586
6559
  }
5587
6560
 
5588
6561
  if (pointB && !pointA) {
5589
- xPoint = _this36[xAxis](_this36.parseX(pointB.x.value));
6562
+ xPoint = _this40[xAxis](_this40.parseX(pointB.x.value));
5590
6563
  tooltipTitle = pointB.x.value;
5591
6564
 
5592
6565
  if (!pointB.y.color) {
@@ -5596,14 +6569,14 @@ var WebsyChart = /*#__PURE__*/function () {
5596
6569
  tooltipData.push(pointB.y);
5597
6570
 
5598
6571
  if (typeof pointB.x.value.getTime !== 'undefined') {
5599
- tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
6572
+ tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
5600
6573
  }
5601
6574
  }
5602
6575
 
5603
6576
  if (pointA && pointB) {
5604
- var d0 = _this36[xAxis](_this36.parseX(pointA.x.value));
6577
+ var d0 = _this40[xAxis](_this40.parseX(pointA.x.value));
5605
6578
 
5606
- var d1 = _this36[xAxis](_this36.parseX(pointB.x.value));
6579
+ var d1 = _this40[xAxis](_this40.parseX(pointB.x.value));
5607
6580
 
5608
6581
  var mid = Math.abs(d0 - d1) / 2;
5609
6582
 
@@ -5612,7 +6585,7 @@ var WebsyChart = /*#__PURE__*/function () {
5612
6585
  tooltipTitle = pointB.x.value;
5613
6586
 
5614
6587
  if (typeof pointB.x.value.getTime !== 'undefined') {
5615
- tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
6588
+ tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
5616
6589
  }
5617
6590
 
5618
6591
  if (!pointB.y.color) {
@@ -5625,7 +6598,7 @@ var WebsyChart = /*#__PURE__*/function () {
5625
6598
  tooltipTitle = pointA.x.value;
5626
6599
 
5627
6600
  if (typeof pointB.x.value.getTime !== 'undefined') {
5628
- tooltipTitle = d3.timeFormat(_this36.options.dateFormat || _this36.options.calculatedTimeFormatPattern)(pointB.x.value);
6601
+ tooltipTitle = d3.timeFormat(_this40.options.dateFormat || _this40.options.calculatedTimeFormatPattern)(pointB.x.value);
5629
6602
  }
5630
6603
 
5631
6604
  if (!pointA.y.color) {
@@ -5730,7 +6703,7 @@ var WebsyChart = /*#__PURE__*/function () {
5730
6703
  }, {
5731
6704
  key: "render",
5732
6705
  value: function render(options) {
5733
- var _this37 = this;
6706
+ var _this41 = this;
5734
6707
 
5735
6708
  /* global d3 options WebsyUtils */
5736
6709
  if (typeof options !== 'undefined') {
@@ -5799,7 +6772,7 @@ var WebsyChart = /*#__PURE__*/function () {
5799
6772
  var legendData = this.options.data.series.map(function (s, i) {
5800
6773
  return {
5801
6774
  value: s.label || s.key,
5802
- color: s.color || _this37.options.colors[i % _this37.options.colors.length]
6775
+ color: s.color || _this41.options.colors[i % _this41.options.colors.length]
5803
6776
  };
5804
6777
  });
5805
6778
 
@@ -6051,7 +7024,7 @@ var WebsyChart = /*#__PURE__*/function () {
6051
7024
 
6052
7025
  if (this.options.data.bottom.formatter) {
6053
7026
  bAxisFunc.tickFormat(function (d) {
6054
- return _this37.options.data.bottom.formatter(d);
7027
+ return _this41.options.data.bottom.formatter(d);
6055
7028
  });
6056
7029
  }
6057
7030
 
@@ -6077,8 +7050,8 @@ var WebsyChart = /*#__PURE__*/function () {
6077
7050
 
6078
7051
  if (this.options.margin.axisLeft > 0) {
6079
7052
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
6080
- if (_this37.options.data.left.formatter) {
6081
- d = _this37.options.data.left.formatter(d);
7053
+ if (_this41.options.data.left.formatter) {
7054
+ d = _this41.options.data.left.formatter(d);
6082
7055
  }
6083
7056
 
6084
7057
  return d;
@@ -6115,8 +7088,8 @@ var WebsyChart = /*#__PURE__*/function () {
6115
7088
 
6116
7089
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
6117
7090
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
6118
- if (_this37.options.data.right.formatter) {
6119
- d = _this37.options.data.right.formatter(d);
7091
+ if (_this41.options.data.right.formatter) {
7092
+ d = _this41.options.data.right.formatter(d);
6120
7093
  }
6121
7094
 
6122
7095
  return d;
@@ -6142,16 +7115,16 @@ var WebsyChart = /*#__PURE__*/function () {
6142
7115
 
6143
7116
  this.options.data.series.forEach(function (series, index) {
6144
7117
  if (!series.key) {
6145
- series.key = _this37.createIdentity();
7118
+ series.key = _this41.createIdentity();
6146
7119
  }
6147
7120
 
6148
7121
  if (!series.color) {
6149
- series.color = _this37.options.colors[index % _this37.options.colors.length];
7122
+ series.color = _this41.options.colors[index % _this41.options.colors.length];
6150
7123
  }
6151
7124
 
6152
- _this37["render".concat(series.type || 'bar')](series, index);
7125
+ _this41["render".concat(series.type || 'bar')](series, index);
6153
7126
 
6154
- _this37.renderLabels(series, index);
7127
+ _this41.renderLabels(series, index);
6155
7128
  });
6156
7129
  }
6157
7130
  }
@@ -6159,17 +7132,17 @@ var WebsyChart = /*#__PURE__*/function () {
6159
7132
  }, {
6160
7133
  key: "renderarea",
6161
7134
  value: function renderarea(series, index) {
6162
- var _this38 = this;
7135
+ var _this42 = this;
6163
7136
 
6164
7137
  /* global d3 series index */
6165
7138
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
6166
7139
  return d3.area().x(function (d) {
6167
- return _this38[xAxis](_this38.parseX(d.x.value));
7140
+ return _this42[xAxis](_this42.parseX(d.x.value));
6168
7141
  }).y0(function (d) {
6169
- return _this38[yAxis](0);
7142
+ return _this42[yAxis](0);
6170
7143
  }).y1(function (d) {
6171
- return _this38[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6172
- }).curve(d3[curveStyle || _this38.options.curveStyle]);
7144
+ return _this42[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7145
+ }).curve(d3[curveStyle || _this42.options.curveStyle]);
6173
7146
  };
6174
7147
 
6175
7148
  var xAxis = 'bottomAxis';
@@ -6272,15 +7245,21 @@ var WebsyChart = /*#__PURE__*/function () {
6272
7245
  }
6273
7246
 
6274
7247
  bars.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
6275
- bars.attr('width', getBarWidth.bind(this)).attr('height', getBarHeight.bind(this)).attr('x', getBarX.bind(this)).attr('y', getBarY.bind(this)).transition(this.transition).attr('fill', series.color);
7248
+ bars.attr('width', getBarWidth.bind(this)).attr('height', getBarHeight.bind(this)).attr('x', getBarX.bind(this)).attr('y', getBarY.bind(this)).transition(this.transition).attr('fill', function (d) {
7249
+ return d.color || series.color;
7250
+ });
6276
7251
  bars.enter().append('rect').attr('width', getBarWidth.bind(this)).attr('height', getBarHeight.bind(this)).attr('x', getBarX.bind(this)).attr('y', getBarY.bind(this)) // .transition(this.transition)
6277
- .attr('fill', series.color).attr('class', function (d) {
7252
+ .attr('fill', function (d) {
7253
+ return d.color || series.color;
7254
+ }).attr('class', function (d) {
6278
7255
  return "bar bar_".concat(series.key);
6279
7256
  });
6280
7257
  }
6281
7258
  }, {
6282
7259
  key: "renderLabels",
6283
7260
  value: function renderLabels(series, index) {
7261
+ var _this43 = this;
7262
+
6284
7263
  /* global series index d3 WebsyDesigns */
6285
7264
  var xAxis = 'bottomAxis';
6286
7265
  var yAxis = 'leftAxis';
@@ -6297,10 +7276,14 @@ var WebsyChart = /*#__PURE__*/function () {
6297
7276
  // We currently only support 'Auto'
6298
7277
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
6299
7278
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
6300
- labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(series.color)).transition(this.transition).text(function (d) {
7279
+ labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
7280
+ return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7281
+ }).transition(this.transition).text(function (d) {
6301
7282
  return d.y.label || d.y.value;
6302
7283
  });
6303
- labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', this.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(series.color)).text(function (d) {
7284
+ labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).style('fill', function (d) {
7285
+ return _this43.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.color || series.color);
7286
+ }).text(function (d) {
6304
7287
  return d.y.label || d.y.value;
6305
7288
  }).each(function (d, i) {
6306
7289
  if (that.options.orientation === 'horizontal') {
@@ -6344,15 +7327,15 @@ var WebsyChart = /*#__PURE__*/function () {
6344
7327
  }, {
6345
7328
  key: "renderline",
6346
7329
  value: function renderline(series, index) {
6347
- var _this39 = this;
7330
+ var _this44 = this;
6348
7331
 
6349
7332
  /* global series index d3 */
6350
7333
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
6351
7334
  return d3.line().x(function (d) {
6352
- return _this39[xAxis](_this39.parseX(d.x.value));
7335
+ return _this44[xAxis](_this44.parseX(d.x.value));
6353
7336
  }).y(function (d) {
6354
- return _this39[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
6355
- }).curve(d3[curveStyle || _this39.options.curveStyle]);
7337
+ return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
7338
+ }).curve(d3[curveStyle || _this44.options.curveStyle]);
6356
7339
  };
6357
7340
 
6358
7341
  var xAxis = 'bottomAxis';
@@ -6390,14 +7373,14 @@ var WebsyChart = /*#__PURE__*/function () {
6390
7373
  }, {
6391
7374
  key: "rendersymbol",
6392
7375
  value: function rendersymbol(series, index) {
6393
- var _this40 = this;
7376
+ var _this45 = this;
6394
7377
 
6395
7378
  /* global d3 series index series.key */
6396
7379
  var drawSymbol = function drawSymbol(size) {
6397
7380
  return d3.symbol() // .type(d => {
6398
7381
  // return d3.symbols[0]
6399
7382
  // })
6400
- .size(size || _this40.options.symbolSize);
7383
+ .size(size || _this45.options.symbolSize);
6401
7384
  };
6402
7385
 
6403
7386
  var xAxis = 'bottomAxis';
@@ -6415,7 +7398,7 @@ var WebsyChart = /*#__PURE__*/function () {
6415
7398
  symbols.attr('d', function (d) {
6416
7399
  return drawSymbol(d.y.size || series.symbolSize)(d);
6417
7400
  }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
6418
- return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7401
+ return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6419
7402
  }); // Enter
6420
7403
 
6421
7404
  symbols.enter().append('path').attr('d', function (d) {
@@ -6424,7 +7407,7 @@ var WebsyChart = /*#__PURE__*/function () {
6424
7407
  .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
6425
7408
  return "symbol symbol_".concat(series.key);
6426
7409
  }).attr('transform', function (d) {
6427
- return "translate(".concat(_this40[xAxis](_this40.parseX(d.x.value)), ", ").concat(_this40[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
7410
+ return "translate(".concat(_this45[xAxis](_this45.parseX(d.x.value)), ", ").concat(_this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
6428
7411
  });
6429
7412
  }
6430
7413
  }, {
@@ -6579,7 +7562,7 @@ var WebsyLegend = /*#__PURE__*/function () {
6579
7562
  }, {
6580
7563
  key: "resize",
6581
7564
  value: function resize() {
6582
- var _this41 = this;
7565
+ var _this46 = this;
6583
7566
 
6584
7567
  var el = document.getElementById(this.elementId);
6585
7568
 
@@ -6592,7 +7575,7 @@ var WebsyLegend = /*#__PURE__*/function () {
6592
7575
  // }
6593
7576
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
6594
7577
  html += this._data.map(function (d, i) {
6595
- return _this41.getLegendItemHTML(d);
7578
+ return _this46.getLegendItemHTML(d);
6596
7579
  }).join('');
6597
7580
  html += "\n <div>\n ";
6598
7581
  el.innerHTML = html;
@@ -6764,7 +7747,7 @@ var WebsyMap = /*#__PURE__*/function () {
6764
7747
  }, {
6765
7748
  key: "render",
6766
7749
  value: function render() {
6767
- var _this42 = this;
7750
+ var _this47 = this;
6768
7751
 
6769
7752
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
6770
7753
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -6773,7 +7756,7 @@ var WebsyMap = /*#__PURE__*/function () {
6773
7756
  var legendData = this.options.data.polygons.map(function (s, i) {
6774
7757
  return {
6775
7758
  value: s.label || s.key,
6776
- color: s.color || _this42.options.colors[i % _this42.options.colors.length]
7759
+ color: s.color || _this47.options.colors[i % _this47.options.colors.length]
6777
7760
  };
6778
7761
  });
6779
7762
  var longestValue = legendData.map(function (s) {
@@ -6837,7 +7820,7 @@ var WebsyMap = /*#__PURE__*/function () {
6837
7820
 
6838
7821
  if (this.polygons) {
6839
7822
  this.polygons.forEach(function (p) {
6840
- return _this42.map.removeLayer(p);
7823
+ return _this47.map.removeLayer(p);
6841
7824
  });
6842
7825
  }
6843
7826
 
@@ -6895,18 +7878,18 @@ var WebsyMap = /*#__PURE__*/function () {
6895
7878
  }
6896
7879
 
6897
7880
  if (!p.options.color) {
6898
- p.options.color = _this42.options.colors[i % _this42.options.colors.length];
7881
+ p.options.color = _this47.options.colors[i % _this47.options.colors.length];
6899
7882
  }
6900
7883
 
6901
7884
  var pol = L.polygon(p.data.map(function (c) {
6902
7885
  return c.map(function (d) {
6903
7886
  return [d.Latitude, d.Longitude];
6904
7887
  });
6905
- }), p.options).addTo(_this42.map);
7888
+ }), p.options).addTo(_this47.map);
6906
7889
 
6907
- _this42.polygons.push(pol);
7890
+ _this47.polygons.push(pol);
6908
7891
 
6909
- _this42.map.fitBounds(pol.getBounds());
7892
+ _this47.map.fitBounds(pol.getBounds());
6910
7893
  });
6911
7894
  } // if (this.data.markers.length > 0) {
6912
7895
  // el.classList.remove('hidden')
@@ -7027,6 +8010,8 @@ var WebsyDesigns = {
7027
8010
  Form: WebsyForm,
7028
8011
  WebsyDatePicker: WebsyDatePicker,
7029
8012
  DatePicker: WebsyDatePicker,
8013
+ WebsyDragDrop: WebsyDragDrop,
8014
+ DragDrop: WebsyDragDrop,
7030
8015
  WebsyDropdown: WebsyDropdown,
7031
8016
  Dropdown: WebsyDropdown,
7032
8017
  WebsyResultList: WebsyResultList,
@@ -7039,8 +8024,10 @@ var WebsyDesigns = {
7039
8024
  Router: WebsyRouter,
7040
8025
  WebsyTable: WebsyTable,
7041
8026
  WebsyTable2: WebsyTable2,
8027
+ WebsyTable3: WebsyTable3,
7042
8028
  Table: WebsyTable,
7043
8029
  Table2: WebsyTable2,
8030
+ Table3: WebsyTable3,
7044
8031
  WebsyChart: WebsyChart,
7045
8032
  Chart: WebsyChart,
7046
8033
  WebsyChartTooltip: WebsyChartTooltip,
@@ -7066,5 +8053,6 @@ var WebsyDesigns = {
7066
8053
  WebsyIcons: WebsyIcons
7067
8054
  };
7068
8055
  WebsyDesigns.service = new WebsyDesigns.APIService('');
8056
+ window.GlobalPubSub = new WebsyPubSub('empty', {});
7069
8057
  var _default = WebsyDesigns;
7070
8058
  exports["default"] = _default;