@websy/websy-designs 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
3
8
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
9
 
5
10
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -1172,11 +1177,11 @@ var WebsyForm = /*#__PURE__*/function () {
1172
1177
  }, {
1173
1178
  key: "handleClick",
1174
1179
  value: function handleClick(event) {
1175
- event.preventDefault();
1176
-
1177
1180
  if (event.target.classList.contains('submit')) {
1181
+ event.preventDefault();
1178
1182
  this.submitForm();
1179
1183
  } else if (event.target.classList.contains('cancel')) {
1184
+ event.preventDefault();
1180
1185
  this.cancelForm();
1181
1186
  }
1182
1187
  }
@@ -2676,18 +2681,6 @@ var WebsyRouter = /*#__PURE__*/function () {
2676
2681
  this.previousPath = this.groups[group].activeView;
2677
2682
  }
2678
2683
 
2679
- if (toggle === true) {
2680
- if (this.previousPath !== '') {
2681
- this.hideView(this.previousPath, group);
2682
- }
2683
- } else {
2684
- this.hideView(this.previousView, group);
2685
- }
2686
-
2687
- if (toggle === true && newPath === groupActiveView) {
2688
- return;
2689
- }
2690
-
2691
2684
  if (group && this.groups[group] && group !== this.options.defaultGroup) {
2692
2685
  this.groups[group].activeView = newPath;
2693
2686
  }
@@ -2708,6 +2701,18 @@ var WebsyRouter = /*#__PURE__*/function () {
2708
2701
  this.currentViewMain = this.options.defaultView;
2709
2702
  }
2710
2703
 
2704
+ if (toggle === true) {
2705
+ if (this.previousPath !== '') {
2706
+ this.hideView(this.previousPath, group);
2707
+ }
2708
+ } else {
2709
+ this.hideView(this.previousView, group);
2710
+ }
2711
+
2712
+ if (toggle === true && newPath === groupActiveView) {
2713
+ return;
2714
+ }
2715
+
2711
2716
  if (toggle === false) {
2712
2717
  this.showView(this.currentView, this.currentParams);
2713
2718
  } else if (newPath && newPath !== '') {
@@ -3300,10 +3305,13 @@ var WebsyUtils = {
3300
3305
 
3301
3306
  var WebsyTable = /*#__PURE__*/function () {
3302
3307
  function WebsyTable(elementId, options) {
3308
+ var _this20 = this;
3309
+
3303
3310
  _classCallCheck(this, WebsyTable);
3304
3311
 
3305
3312
  var DEFAULTS = {
3306
- pageSize: 20
3313
+ pageSize: 20,
3314
+ paging: 'scroll'
3307
3315
  };
3308
3316
  this.elementId = elementId;
3309
3317
  this.options = _extends({}, DEFAULTS, options);
@@ -3314,7 +3322,34 @@ var WebsyTable = /*#__PURE__*/function () {
3314
3322
  var el = document.getElementById(this.elementId);
3315
3323
 
3316
3324
  if (el) {
3317
- el.innerHTML = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table'>\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 <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table>\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, "_loadingContainer\"></div>\n </div>\n ");
3325
+ var html = "\n <div id='".concat(this.elementId, "_tableContainer' class='websy-vis-table ").concat(this.options.paging === 'pages' ? 'with-paging' : '', "'>\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 <table>\n <thead id=\"").concat(this.elementId, "_head\">\n </thead>\n <tbody id=\"").concat(this.elementId, "_body\">\n </tbody>\n <tfoot id=\"").concat(this.elementId, "_foot\">\n </tfoot>\n </table> \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, "_loadingContainer\"></div>\n </div>\n ");
3326
+
3327
+ if (this.options.paging === 'pages') {
3328
+ 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 ");
3329
+ }
3330
+
3331
+ var pageOptions = [10, 20, 50, 100, 200];
3332
+ el.innerHTML = html;
3333
+
3334
+ if (this.options.paging === 'pages') {
3335
+ this.pageSizeSelector = new WebsyDesigns.Dropdown("".concat(this.elementId, "_pageSizeSelector"), {
3336
+ selectedItems: [pageOptions.indexOf(this.options.pageSize)],
3337
+ items: pageOptions.map(function (p) {
3338
+ return {
3339
+ label: p.toString(),
3340
+ value: p
3341
+ };
3342
+ }),
3343
+ allowClear: false,
3344
+ disableSearch: true,
3345
+ onItemSelected: function onItemSelected(selectedItem) {
3346
+ if (_this20.options.onChangePageSize) {
3347
+ _this20.options.onChangePageSize(selectedItem.value);
3348
+ }
3349
+ }
3350
+ });
3351
+ }
3352
+
3318
3353
  el.addEventListener('click', this.handleClick.bind(this));
3319
3354
  el.addEventListener('mouseout', this.handleMouseOut.bind(this));
3320
3355
  el.addEventListener('mousemove', this.handleMouseMove.bind(this));
@@ -3330,7 +3365,7 @@ var WebsyTable = /*#__PURE__*/function () {
3330
3365
  _createClass(WebsyTable, [{
3331
3366
  key: "appendRows",
3332
3367
  value: function appendRows(data) {
3333
- var _this20 = this;
3368
+ var _this21 = this;
3334
3369
 
3335
3370
  this.hideError();
3336
3371
  var bodyHTML = '';
@@ -3338,15 +3373,15 @@ var WebsyTable = /*#__PURE__*/function () {
3338
3373
  if (data) {
3339
3374
  bodyHTML += data.map(function (r, rowIndex) {
3340
3375
  return '<tr>' + r.map(function (c, i) {
3341
- if (_this20.options.columns[i].show !== false) {
3376
+ if (_this21.options.columns[i].show !== false) {
3342
3377
  var style = '';
3343
3378
 
3344
3379
  if (c.style) {
3345
3380
  style += c.style;
3346
3381
  }
3347
3382
 
3348
- if (_this20.options.columns[i].width) {
3349
- style += "width: ".concat(_this20.options.columns[i].width, "; ");
3383
+ if (_this21.options.columns[i].width) {
3384
+ style += "width: ".concat(_this21.options.columns[i].width, "; ");
3350
3385
  }
3351
3386
 
3352
3387
  if (c.backgroundColor) {
@@ -3357,18 +3392,18 @@ var WebsyTable = /*#__PURE__*/function () {
3357
3392
  style += "color: ".concat(c.color, "; ");
3358
3393
  }
3359
3394
 
3360
- if (_this20.options.columns[i].showAsLink === true && c.value.trim() !== '') {
3361
- return "\n <td \n data-row-index='".concat(_this20.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this20.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(_this20.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this20.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
3362
- } else if ((_this20.options.columns[i].showAsNavigatorLink === true || _this20.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
3363
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this20.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this20.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this20.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this20.options.columns[i].linkText || c.value, "</td>\n ");
3395
+ if (_this21.options.columns[i].showAsLink === true && c.value.trim() !== '') {
3396
+ return "\n <td \n data-row-index='".concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.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(_this21.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
3397
+ } else if ((_this21.options.columns[i].showAsNavigatorLink === true || _this21.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
3398
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='trigger-item ").concat(_this21.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this21.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this21.options.columns[i].linkText || c.value, "</td>\n ");
3364
3399
  } else {
3365
3400
  var info = c.value;
3366
3401
 
3367
- if (_this20.options.columns[i].showAsImage === true) {
3402
+ if (_this21.options.columns[i].showAsImage === true) {
3368
3403
  c.value = "\n <img src='".concat(c.value, "'>\n ");
3369
3404
  }
3370
3405
 
3371
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this20.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this20.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 ");
3406
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this21.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this21.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 ");
3372
3407
  }
3373
3408
  }
3374
3409
  }).join('') + '</tr>';
@@ -3432,6 +3467,12 @@ var WebsyTable = /*#__PURE__*/function () {
3432
3467
  if (this.options.onClick) {
3433
3468
  this.options.onClick(event, this.data[rowIndex][_colIndex], this.data[rowIndex], this.options.columns[_colIndex]);
3434
3469
  }
3470
+ } else if (event.target.classList.contains('websy-page-num')) {
3471
+ var pageNum = +event.target.getAttribute('data-page');
3472
+
3473
+ if (this.options.onSetPage) {
3474
+ this.options.onSetPage(pageNum);
3475
+ }
3435
3476
  }
3436
3477
  }
3437
3478
  }, {
@@ -3459,7 +3500,7 @@ var WebsyTable = /*#__PURE__*/function () {
3459
3500
  }, {
3460
3501
  key: "handleScroll",
3461
3502
  value: function handleScroll(event) {
3462
- if (this.options.onScroll) {
3503
+ if (this.options.onScroll && this.options.paging === 'scroll') {
3463
3504
  this.options.onScroll(event);
3464
3505
  }
3465
3506
  }
@@ -3521,7 +3562,7 @@ var WebsyTable = /*#__PURE__*/function () {
3521
3562
  }, {
3522
3563
  key: "render",
3523
3564
  value: function render(data) {
3524
- var _this21 = this;
3565
+ var _this22 = this;
3525
3566
 
3526
3567
  if (!this.options.columns) {
3527
3568
  return;
@@ -3546,18 +3587,48 @@ var WebsyTable = /*#__PURE__*/function () {
3546
3587
 
3547
3588
  var headHTML = '<tr>' + this.options.columns.map(function (c, i) {
3548
3589
  if (c.show !== false) {
3549
- 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 ? _this21.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
3590
+ 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 ? _this22.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
3550
3591
  }
3551
3592
  }).join('') + '</tr>';
3552
3593
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
3553
- headEl.innerHTML = headHTML;
3554
- var footHTML = '<tr>' + this.options.columns.map(function (c, i) {
3555
- if (c.show !== false) {
3556
- return "\n <th></th>\n ";
3594
+ headEl.innerHTML = headHTML; // let footHTML = '<tr>' + this.options.columns.map((c, i) => {
3595
+ // if (c.show !== false) {
3596
+ // return `
3597
+ // <th></th>
3598
+ // `
3599
+ // }
3600
+ // }).join('') + '</tr>'
3601
+ // const footEl = document.getElementById(`${this.elementId}_foot`)
3602
+ // footEl.innerHTML = footHTML
3603
+
3604
+ if (this.options.paging === 'pages') {
3605
+ var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
3606
+
3607
+ if (pagingEl) {
3608
+ var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
3609
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
3610
+ });
3611
+ var startIndex = 0;
3612
+
3613
+ if (this.options.pageCount > 8) {
3614
+ startIndex = Math.max(0, this.options.pageNum - 4);
3615
+ pages = pages.splice(startIndex, 10);
3616
+
3617
+ if (startIndex > 0) {
3618
+ pages.splice(0, 0, "<li>Page&nbsp;</li><li data-page=\"0\" class=\"websy-page-num\">First</li><li>...</li>");
3619
+ } else {
3620
+ pages.splice(0, 0, '<li>Page&nbsp;</li>');
3621
+ }
3622
+
3623
+ if (this.options.pageNum < this.options.pageCount - 1) {
3624
+ pages.push('<li>...</li>');
3625
+ pages.push("<li data-page=\"".concat(this.options.pageCount - 1, "\" class=\"websy-page-num\">Last</li>"));
3626
+ }
3627
+ }
3628
+
3629
+ pagingEl.innerHTML = pages.join('');
3557
3630
  }
3558
- }).join('') + '</tr>';
3559
- var footEl = document.getElementById("".concat(this.elementId, "_foot"));
3560
- footEl.innerHTML = footHTML;
3631
+ }
3561
3632
 
3562
3633
  if (data) {
3563
3634
  // this.data = this.data.concat(data)
@@ -3603,7 +3674,7 @@ var WebsyTable = /*#__PURE__*/function () {
3603
3674
 
3604
3675
  var WebsyChart = /*#__PURE__*/function () {
3605
3676
  function WebsyChart(elementId, options) {
3606
- var _this22 = this;
3677
+ var _this23 = this;
3607
3678
 
3608
3679
  _classCallCheck(this, WebsyChart);
3609
3680
 
@@ -3651,22 +3722,22 @@ var WebsyChart = /*#__PURE__*/function () {
3651
3722
  this.invertOverride = function (input, input2) {
3652
3723
  var xAxis = 'bottomAxis';
3653
3724
 
3654
- if (_this22.options.orientation === 'horizontal') {
3725
+ if (_this23.options.orientation === 'horizontal') {
3655
3726
  xAxis = 'leftAxis';
3656
3727
  }
3657
3728
 
3658
- var width = _this22[xAxis].step();
3729
+ var width = _this23[xAxis].step();
3659
3730
 
3660
3731
  var output;
3661
3732
 
3662
- var domain = _toConsumableArray(_this22[xAxis].domain());
3733
+ var domain = _toConsumableArray(_this23[xAxis].domain());
3663
3734
 
3664
- if (_this22.options.orientation === 'horizontal') {
3735
+ if (_this23.options.orientation === 'horizontal') {
3665
3736
  domain = domain.reverse();
3666
3737
  }
3667
3738
 
3668
3739
  for (var j = 0; j < domain.length; j++) {
3669
- var breakA = _this22[xAxis](domain[j]) - width / 2;
3740
+ var breakA = _this23[xAxis](domain[j]) - width / 2;
3670
3741
  var breakB = breakA + width;
3671
3742
 
3672
3743
  if (input > breakA && input <= breakB) {
@@ -3766,10 +3837,10 @@ var WebsyChart = /*#__PURE__*/function () {
3766
3837
  }, {
3767
3838
  key: "handleEventMouseMove",
3768
3839
  value: function handleEventMouseMove(event, d) {
3769
- var _this23 = this;
3840
+ var _this24 = this;
3770
3841
 
3771
3842
  var bisectDate = d3.bisector(function (d) {
3772
- return _this23.parseX(d.x.value);
3843
+ return _this24.parseX(d.x.value);
3773
3844
  }).left;
3774
3845
 
3775
3846
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
@@ -3808,8 +3879,8 @@ var WebsyChart = /*#__PURE__*/function () {
3808
3879
  }
3809
3880
 
3810
3881
  this.options.data.series.forEach(function (s) {
3811
- if (_this23.options.data[xData].scale !== 'Time') {
3812
- xPoint = _this23[xAxis](_this23.parseX(xLabel));
3882
+ if (_this24.options.data[xData].scale !== 'Time') {
3883
+ xPoint = _this24[xAxis](_this24.parseX(xLabel));
3813
3884
  s.data.forEach(function (d) {
3814
3885
  if (d.x.value === xLabel) {
3815
3886
  if (!d.y.color) {
@@ -3824,13 +3895,13 @@ var WebsyChart = /*#__PURE__*/function () {
3824
3895
  var pointA = s.data[index - 1];
3825
3896
  var pointB = s.data[index];
3826
3897
 
3827
- if (_this23.options.orientation === 'horizontal') {
3898
+ if (_this24.options.orientation === 'horizontal') {
3828
3899
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
3829
3900
  pointB = _toConsumableArray(s.data).reverse()[index];
3830
3901
  }
3831
3902
 
3832
3903
  if (pointA && !pointB) {
3833
- xPoint = _this23[xAxis](_this23.parseX(pointA.x.value));
3904
+ xPoint = _this24[xAxis](_this24.parseX(pointA.x.value));
3834
3905
  tooltipTitle = pointA.x.value;
3835
3906
 
3836
3907
  if (!pointA.y.color) {
@@ -3840,12 +3911,12 @@ var WebsyChart = /*#__PURE__*/function () {
3840
3911
  tooltipData.push(pointA.y);
3841
3912
 
3842
3913
  if (typeof pointA.x.value.getTime !== 'undefined') {
3843
- tooltipTitle = d3.timeFormat(_this23.options.dateFormat || _this23.options.calculatedTimeFormatPattern)(pointA.x.value);
3914
+ tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointA.x.value);
3844
3915
  }
3845
3916
  }
3846
3917
 
3847
3918
  if (pointB && !pointA) {
3848
- xPoint = _this23[xAxis](_this23.parseX(pointB.x.value));
3919
+ xPoint = _this24[xAxis](_this24.parseX(pointB.x.value));
3849
3920
  tooltipTitle = pointB.x.value;
3850
3921
 
3851
3922
  if (!pointB.y.color) {
@@ -3855,14 +3926,14 @@ var WebsyChart = /*#__PURE__*/function () {
3855
3926
  tooltipData.push(pointB.y);
3856
3927
 
3857
3928
  if (typeof pointB.x.value.getTime !== 'undefined') {
3858
- tooltipTitle = d3.timeFormat(_this23.options.dateFormat || _this23.options.calculatedTimeFormatPattern)(pointB.x.value);
3929
+ tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
3859
3930
  }
3860
3931
  }
3861
3932
 
3862
3933
  if (pointA && pointB) {
3863
- var d0 = _this23[xAxis](_this23.parseX(pointA.x.value));
3934
+ var d0 = _this24[xAxis](_this24.parseX(pointA.x.value));
3864
3935
 
3865
- var d1 = _this23[xAxis](_this23.parseX(pointB.x.value));
3936
+ var d1 = _this24[xAxis](_this24.parseX(pointB.x.value));
3866
3937
 
3867
3938
  var mid = Math.abs(d0 - d1) / 2;
3868
3939
 
@@ -3871,7 +3942,7 @@ var WebsyChart = /*#__PURE__*/function () {
3871
3942
  tooltipTitle = pointB.x.value;
3872
3943
 
3873
3944
  if (typeof pointB.x.value.getTime !== 'undefined') {
3874
- tooltipTitle = d3.timeFormat(_this23.options.dateFormat || _this23.options.calculatedTimeFormatPattern)(pointB.x.value);
3945
+ tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
3875
3946
  }
3876
3947
 
3877
3948
  if (!pointB.y.color) {
@@ -3884,7 +3955,7 @@ var WebsyChart = /*#__PURE__*/function () {
3884
3955
  tooltipTitle = pointA.x.value;
3885
3956
 
3886
3957
  if (typeof pointB.x.value.getTime !== 'undefined') {
3887
- tooltipTitle = d3.timeFormat(_this23.options.dateFormat || _this23.options.calculatedTimeFormatPattern)(pointB.x.value);
3958
+ tooltipTitle = d3.timeFormat(_this24.options.dateFormat || _this24.options.calculatedTimeFormatPattern)(pointB.x.value);
3888
3959
  }
3889
3960
 
3890
3961
  if (!pointA.y.color) {
@@ -3989,7 +4060,7 @@ var WebsyChart = /*#__PURE__*/function () {
3989
4060
  }, {
3990
4061
  key: "render",
3991
4062
  value: function render(options) {
3992
- var _this24 = this;
4063
+ var _this25 = this;
3993
4064
 
3994
4065
  /* global d3 options */
3995
4066
  if (typeof options !== 'undefined') {
@@ -4058,7 +4129,7 @@ var WebsyChart = /*#__PURE__*/function () {
4058
4129
  var legendData = this.options.data.series.map(function (s, i) {
4059
4130
  return {
4060
4131
  value: s.label || s.key,
4061
- color: s.color || _this24.options.colors[i % _this24.options.colors.length]
4132
+ color: s.color || _this25.options.colors[i % _this25.options.colors.length]
4062
4133
  };
4063
4134
  });
4064
4135
 
@@ -4297,7 +4368,7 @@ var WebsyChart = /*#__PURE__*/function () {
4297
4368
 
4298
4369
  if (this.options.data.bottom.formatter) {
4299
4370
  bAxisFunc.tickFormat(function (d) {
4300
- return _this24.options.data.bottom.formatter(d);
4371
+ return _this25.options.data.bottom.formatter(d);
4301
4372
  });
4302
4373
  }
4303
4374
 
@@ -4324,8 +4395,8 @@ var WebsyChart = /*#__PURE__*/function () {
4324
4395
 
4325
4396
  if (this.options.margin.axisLeft > 0) {
4326
4397
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
4327
- if (_this24.options.data.left.formatter) {
4328
- d = _this24.options.data.left.formatter(d);
4398
+ if (_this25.options.data.left.formatter) {
4399
+ d = _this25.options.data.left.formatter(d);
4329
4400
  }
4330
4401
 
4331
4402
  return d;
@@ -4362,8 +4433,8 @@ var WebsyChart = /*#__PURE__*/function () {
4362
4433
 
4363
4434
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
4364
4435
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
4365
- if (_this24.options.data.right.formatter) {
4366
- d = _this24.options.data.right.formatter(d);
4436
+ if (_this25.options.data.right.formatter) {
4437
+ d = _this25.options.data.right.formatter(d);
4367
4438
  }
4368
4439
 
4369
4440
  return d;
@@ -4389,16 +4460,16 @@ var WebsyChart = /*#__PURE__*/function () {
4389
4460
 
4390
4461
  this.options.data.series.forEach(function (series, index) {
4391
4462
  if (!series.key) {
4392
- series.key = _this24.createIdentity();
4463
+ series.key = _this25.createIdentity();
4393
4464
  }
4394
4465
 
4395
4466
  if (!series.color) {
4396
- series.color = _this24.options.colors[index % _this24.options.colors.length];
4467
+ series.color = _this25.options.colors[index % _this25.options.colors.length];
4397
4468
  }
4398
4469
 
4399
- _this24["render".concat(series.type || 'bar')](series, index);
4470
+ _this25["render".concat(series.type || 'bar')](series, index);
4400
4471
 
4401
- _this24.renderLabels(series, index);
4472
+ _this25.renderLabels(series, index);
4402
4473
  });
4403
4474
  }
4404
4475
  }
@@ -4406,17 +4477,17 @@ var WebsyChart = /*#__PURE__*/function () {
4406
4477
  }, {
4407
4478
  key: "renderarea",
4408
4479
  value: function renderarea(series, index) {
4409
- var _this25 = this;
4480
+ var _this26 = this;
4410
4481
 
4411
4482
  /* global d3 series index */
4412
4483
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
4413
4484
  return d3.area().x(function (d) {
4414
- return _this25[xAxis](_this25.parseX(d.x.value));
4485
+ return _this26[xAxis](_this26.parseX(d.x.value));
4415
4486
  }).y0(function (d) {
4416
- return _this25[yAxis](0);
4487
+ return _this26[yAxis](0);
4417
4488
  }).y1(function (d) {
4418
- return _this25[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4419
- }).curve(d3[curveStyle || _this25.options.curveStyle]);
4489
+ return _this26[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4490
+ }).curve(d3[curveStyle || _this26.options.curveStyle]);
4420
4491
  };
4421
4492
 
4422
4493
  var xAxis = 'bottomAxis';
@@ -4589,15 +4660,15 @@ var WebsyChart = /*#__PURE__*/function () {
4589
4660
  }, {
4590
4661
  key: "renderline",
4591
4662
  value: function renderline(series, index) {
4592
- var _this26 = this;
4663
+ var _this27 = this;
4593
4664
 
4594
4665
  /* global series index d3 */
4595
4666
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
4596
4667
  return d3.line().x(function (d) {
4597
- return _this26[xAxis](_this26.parseX(d.x.value));
4668
+ return _this27[xAxis](_this27.parseX(d.x.value));
4598
4669
  }).y(function (d) {
4599
- return _this26[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4600
- }).curve(d3[curveStyle || _this26.options.curveStyle]);
4670
+ return _this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
4671
+ }).curve(d3[curveStyle || _this27.options.curveStyle]);
4601
4672
  };
4602
4673
 
4603
4674
  var xAxis = 'bottomAxis';
@@ -4635,14 +4706,14 @@ var WebsyChart = /*#__PURE__*/function () {
4635
4706
  }, {
4636
4707
  key: "rendersymbol",
4637
4708
  value: function rendersymbol(series, index) {
4638
- var _this27 = this;
4709
+ var _this28 = this;
4639
4710
 
4640
4711
  /* global d3 series index series.key */
4641
4712
  var drawSymbol = function drawSymbol(size) {
4642
4713
  return d3.symbol() // .type(d => {
4643
4714
  // return d3.symbols[0]
4644
4715
  // })
4645
- .size(size || _this27.options.symbolSize);
4716
+ .size(size || _this28.options.symbolSize);
4646
4717
  };
4647
4718
 
4648
4719
  var xAxis = 'bottomAxis';
@@ -4660,7 +4731,7 @@ var WebsyChart = /*#__PURE__*/function () {
4660
4731
  symbols.attr('d', function (d) {
4661
4732
  return drawSymbol(d.y.size || series.symbolSize)(d);
4662
4733
  }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
4663
- return "translate(".concat(_this27[xAxis](_this27.parseX(d.x.value)), ", ").concat(_this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
4734
+ return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
4664
4735
  }); // Enter
4665
4736
 
4666
4737
  symbols.enter().append('path').attr('d', function (d) {
@@ -4669,7 +4740,7 @@ var WebsyChart = /*#__PURE__*/function () {
4669
4740
  .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
4670
4741
  return "symbol symbol_".concat(series.key);
4671
4742
  }).attr('transform', function (d) {
4672
- return "translate(".concat(_this27[xAxis](_this27.parseX(d.x.value)), ", ").concat(_this27[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
4743
+ return "translate(".concat(_this28[xAxis](_this28.parseX(d.x.value)), ", ").concat(_this28[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
4673
4744
  });
4674
4745
  }
4675
4746
  }, {
@@ -4824,7 +4895,7 @@ var WebsyLegend = /*#__PURE__*/function () {
4824
4895
  }, {
4825
4896
  key: "resize",
4826
4897
  value: function resize() {
4827
- var _this28 = this;
4898
+ var _this29 = this;
4828
4899
 
4829
4900
  var el = document.getElementById(this.elementId);
4830
4901
 
@@ -4837,7 +4908,7 @@ var WebsyLegend = /*#__PURE__*/function () {
4837
4908
  // }
4838
4909
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
4839
4910
  html += this._data.map(function (d, i) {
4840
- return _this28.getLegendItemHTML(d);
4911
+ return _this29.getLegendItemHTML(d);
4841
4912
  }).join('');
4842
4913
  html += "\n <div>\n ";
4843
4914
  el.innerHTML = html;
@@ -5010,7 +5081,7 @@ var WebsyMap = /*#__PURE__*/function () {
5010
5081
  }, {
5011
5082
  key: "render",
5012
5083
  value: function render() {
5013
- var _this29 = this;
5084
+ var _this30 = this;
5014
5085
 
5015
5086
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
5016
5087
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -5019,7 +5090,7 @@ var WebsyMap = /*#__PURE__*/function () {
5019
5090
  var legendData = this.options.data.polygons.map(function (s, i) {
5020
5091
  return {
5021
5092
  value: s.label || s.key,
5022
- color: s.color || _this29.options.colors[i % _this29.options.colors.length]
5093
+ color: s.color || _this30.options.colors[i % _this30.options.colors.length]
5023
5094
  };
5024
5095
  });
5025
5096
  var longestValue = legendData.map(function (s) {
@@ -5083,7 +5154,7 @@ var WebsyMap = /*#__PURE__*/function () {
5083
5154
 
5084
5155
  if (this.polygons) {
5085
5156
  this.polygons.forEach(function (p) {
5086
- return _this29.map.removeLayer(p);
5157
+ return _this30.map.removeLayer(p);
5087
5158
  });
5088
5159
  }
5089
5160
 
@@ -5141,18 +5212,18 @@ var WebsyMap = /*#__PURE__*/function () {
5141
5212
  }
5142
5213
 
5143
5214
  if (!p.options.color) {
5144
- p.options.color = _this29.options.colors[i % _this29.options.colors.length];
5215
+ p.options.color = _this30.options.colors[i % _this30.options.colors.length];
5145
5216
  }
5146
5217
 
5147
5218
  var pol = L.polygon(p.data.map(function (c) {
5148
5219
  return c.map(function (d) {
5149
5220
  return [d.Latitude, d.Longitude];
5150
5221
  });
5151
- }), p.options).addTo(_this29.map);
5222
+ }), p.options).addTo(_this30.map);
5152
5223
 
5153
- _this29.polygons.push(pol);
5224
+ _this30.polygons.push(pol);
5154
5225
 
5155
- _this29.map.fitBounds(pol.getBounds());
5226
+ _this30.map.fitBounds(pol.getBounds());
5156
5227
  });
5157
5228
  } // if (this.data.markers.length > 0) {
5158
5229
  // el.classList.remove('hidden')
@@ -5322,3 +5393,6 @@ function usePayPal() {
5322
5393
  pps.src = '//www.paypal.com/sdk/js';
5323
5394
  document.getElementsByTagName('body')[0].appendChild(pps);
5324
5395
  }
5396
+
5397
+ var _default = WebsyDesigns;
5398
+ exports["default"] = _default;