@websy/websy-designs 1.10.3 → 1.10.5

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.
@@ -5116,22 +5116,71 @@ var WebsySearch = /*#__PURE__*/function () {
5116
5116
  clearAlwaysOn: false,
5117
5117
  placeholder: 'Search',
5118
5118
  searchTimeout: 500,
5119
+ suggestTimeout: 100,
5120
+ suggestingTimeout: 3000,
5121
+ suggestLimit: 5,
5119
5122
  minLength: 2
5120
5123
  };
5121
5124
  this.options = _extends({}, DEFAULTS, options);
5122
5125
  this.searchTimeoutFn = null;
5126
+ this.suggestTimeoutFn = null;
5127
+ this.suggestingTimeoutFn = null;
5128
+ this.isSuggesting = false;
5129
+ this.inSuggestions = false;
5130
+ this.cursorPosition = 0;
5131
+ this.terms = [];
5132
+ this.Key = {
5133
+ BACKSPACE: 8,
5134
+ ESCAPE: 27,
5135
+ CONTROL: 17,
5136
+ COMMAND: 91,
5137
+ PASTE: 86,
5138
+ TAB: 9,
5139
+ ENTER: 13,
5140
+ SHIFT: 16,
5141
+ UP: 38,
5142
+ DOWN: 40,
5143
+ RIGHT: 39,
5144
+ LEFT: 37,
5145
+ DELETE: 46,
5146
+ SPACE: 32
5147
+ };
5123
5148
  var el = document.getElementById(elementId);
5124
5149
  if (el) {
5125
5150
  // el.addEventListener('click', this.handleClick.bind(this))
5126
5151
  el.addEventListener('click', this.handleClick.bind(this));
5127
5152
  el.addEventListener('keyup', this.handleKeyUp.bind(this));
5128
- el.addEventListener('keyup', this.handleKeyDown.bind(this));
5129
- el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "' value='").concat(this.options.initialValue || '', "'>\n <div class='clear ").concat(this.options.clearAlwaysOn === true ? '' : 'websy-hidden', "' id='").concat(this.elementId, "_clear'>\n ").concat(this.options.clearIcon, "\n </div>\n </div>\n ");
5153
+ el.addEventListener('keydown', this.handleKeyDown.bind(this));
5154
+ el.addEventListener('mouseover', this.handleMouseOver.bind(this));
5155
+ // el.innerHTML = `
5156
+ // <div class='websy-search-input-container'>
5157
+ // ${this.options.searchIcon}
5158
+ // <input id='${this.elementId}_search' class='websy-search-input' placeholder='${this.options.placeholder || 'Search'}' value='${this.options.initialValue || ''}'>
5159
+ // <div class='clear ${this.options.clearAlwaysOn === true ? '' : 'websy-hidden'}' id='${this.elementId}_clear'>
5160
+ // ${this.options.clearIcon}
5161
+ // </div>
5162
+ // </div>
5163
+ // `
5164
+ el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <div id='").concat(this.elementId, "_ghost' class='websy-search-input-ghost'></div>\n <div id='").concat(this.elementId, "_lozenges' class='websy-search-lozenge-container'></div>\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "' value='").concat(this.options.initialValue || '', "' autocorrect='off' autocomplete='off' autocapitalize='off' spellcheck='false'>\n <div id='").concat(this.elementId, "_ambiguities' class='websy-search-ambiguity-container'></div>\n <div class='clear ").concat(this.options.clearAlwaysOn === true ? '' : 'websy-hidden', "' id='").concat(this.elementId, "_clear'>\n ").concat(this.options.clearIcon, "\n </div>\n <div id='").concat(this.elementId, "_suggestions' class='websy-search-suggestion-container'>\n <ul id='").concat(this.elementId, "_suggestionList'></ul>\n </div>\n <div id='").concat(this.elementId, "_associations' class='websy-search-association-container'>\n <ul id='").concat(this.elementId, "_associationsList'></ul>\n </div>\n </div>\n ");
5130
5165
  } else {
5131
5166
  console.log('No element found with Id', elementId);
5132
5167
  }
5133
5168
  }
5134
5169
  _createClass(WebsySearch, [{
5170
+ key: "acceptSuggestion",
5171
+ value: function acceptSuggestion() {
5172
+ this.searchText = this.ghostQuery;
5173
+ this.suggestions = [];
5174
+ this.hideSuggestions();
5175
+ var inputEl = document.getElementById("".concat(this.elementId, "_search"));
5176
+ if (inputEl) {
5177
+ inputEl.value = this.searchText;
5178
+ }
5179
+ if (this.options.onSearch) {
5180
+ this.options.onSearch(this.searchText);
5181
+ }
5182
+ }
5183
+ }, {
5135
5184
  key: "handleClick",
5136
5185
  value: function handleClick(event) {
5137
5186
  if (event.target.classList.contains('clear')) {
@@ -5143,6 +5192,8 @@ var WebsySearch = /*#__PURE__*/function () {
5143
5192
  if (this.options.onClear) {
5144
5193
  this.options.onClear();
5145
5194
  }
5195
+ } else if (event.target.classList.contains('websy-search-suggestion-item')) {
5196
+ this.acceptSuggestion();
5146
5197
  }
5147
5198
  }
5148
5199
  }, {
@@ -5154,17 +5205,65 @@ var WebsySearch = /*#__PURE__*/function () {
5154
5205
  event.preventDefault();
5155
5206
  return false;
5156
5207
  }
5208
+ } else if (event.keyCode === this.Key.ESCAPE) {
5209
+ this.hideSuggestions();
5210
+ } else if (event.keyCode === this.Key.CONTROL || event.keyCode === this.Key.COMMAND) {
5211
+ // show the suggestions again
5212
+ this.isCutCopyPaste = true;
5213
+ } else if (event.keyCode === this.Key.PASTE && this.isCutCopyPaste) {
5214
+ // show the suggestions again
5215
+ this.isPaste = true;
5216
+ } else if (event.keyCode === this.Key.DOWN) {
5217
+ // show the suggestions again
5218
+ this.inSuggestions = true;
5219
+ this.showSuggestions();
5220
+ } else if (event.keyCode === this.Key.UP) {
5221
+ // show the suggestions again
5222
+ if (this.inSuggestions) {
5223
+ event.preventDefault();
5224
+ }
5225
+ this.inSuggestions = false;
5226
+ } else if (event.keyCode === this.Key.RIGHT) {
5227
+ if (this.suggesting && this.inSuggestions) {
5228
+ // activate the next suggestion
5229
+ event.preventDefault();
5230
+ this.nextSuggestion();
5231
+ }
5232
+ } else if (event.keyCode === this.Key.LEFT) {
5233
+ if (this.suggesting && this.inSuggestions) {
5234
+ // activate the previous suggestion
5235
+ event.preventDefault();
5236
+ this.prevSuggestion();
5237
+ }
5238
+ } else if (event.keyCode === this.Key.ENTER || event.keyCode === this.Key.TAB) {
5239
+ if (this.suggesting) {
5240
+ event.preventDefault();
5241
+ this.acceptSuggestion();
5242
+ } else if (this.associating && event.keyCode === this.Key.ENTER) {
5243
+ event.preventDefault();
5244
+ // this.searchEntity.selectAssociations(this.searchFields || [], 0);
5245
+ this.hideAssociations();
5246
+ }
5247
+ } else if (event.keyCode === this.Key.SPACE) {
5248
+ this.hideSuggestions();
5249
+ // this.hideAssociations()
5157
5250
  }
5251
+ // else{
5252
+ // this.hideSuggestions();
5253
+ // this.hideAssociations();
5254
+ // }
5158
5255
  }
5159
5256
  }, {
5160
5257
  key: "handleKeyUp",
5161
5258
  value: function handleKeyUp(event) {
5162
5259
  var _this35 = this;
5163
5260
  if (event.target.classList.contains('websy-search-input')) {
5261
+ this.cursorPosition = event.target.selectionStart;
5262
+ this.searchText = event.target.value;
5164
5263
  if (this.searchTimeoutFn) {
5165
5264
  clearTimeout(this.searchTimeoutFn);
5166
5265
  }
5167
- if (event.key === 'Enter') {
5266
+ if (event.key === 'Enter' || event.key === 'Tab') {
5168
5267
  return false;
5169
5268
  }
5170
5269
  var clearEl = document.getElementById("".concat(this.elementId, "_clear"));
@@ -5175,6 +5274,9 @@ var WebsySearch = /*#__PURE__*/function () {
5175
5274
  clearEl.classList.add('websy-hidden');
5176
5275
  }
5177
5276
  }
5277
+ if (this.options.onKeyUp) {
5278
+ this.options.onKeyUp(event.target.value, event);
5279
+ }
5178
5280
  if (event.target.value.length >= this.options.minLength) {
5179
5281
  this.searchTimeoutFn = setTimeout(function () {
5180
5282
  if (_this35.options.onSearch) {
@@ -5189,6 +5291,174 @@ var WebsySearch = /*#__PURE__*/function () {
5189
5291
  }
5190
5292
  }
5191
5293
  }
5294
+ // this.renderLozenges()
5295
+ }
5296
+ }, {
5297
+ key: "handleMouseOver",
5298
+ value: function handleMouseOver(event) {
5299
+ if (event.target.classList.contains('websy-search-suggestion-item')) {
5300
+ this.startSuggestionTimeout();
5301
+ var index = event.target.getAttribute('data-index');
5302
+ this.activeSuggestion = +index;
5303
+ this.renderGhost();
5304
+ this.highlightActiveSuggestion();
5305
+ }
5306
+ }
5307
+ }, {
5308
+ key: "hideSuggestions",
5309
+ value: function hideSuggestions() {
5310
+ this.suggesting = false;
5311
+ this.activeSuggestion = 0;
5312
+ this.inSuggestions = false;
5313
+ this.ghostPart = '';
5314
+ this.ghostQuery = '';
5315
+ this.ghostDisplay = '';
5316
+ this.hideGhost();
5317
+ var suggestEl = document.getElementById("".concat(this.elementId, "_suggestions"));
5318
+ if (suggestEl) {
5319
+ suggestEl.classList.remove('active');
5320
+ }
5321
+ }
5322
+ }, {
5323
+ key: "hideGhost",
5324
+ value: function hideGhost() {
5325
+ var ghostEl = document.getElementById("".concat(this.elementId, "_ghost"));
5326
+ if (ghostEl) {
5327
+ ghostEl.innerHTML = '';
5328
+ }
5329
+ }
5330
+ }, {
5331
+ key: "highlightActiveSuggestion",
5332
+ value: function highlightActiveSuggestion() {
5333
+ var _this36 = this;
5334
+ // remove all previous highlights
5335
+ // const parent = document.getElementById(`${this.elementId}_suggestionList`)
5336
+ // if (parent) {
5337
+ // for (let c = 0; c < parent.childElementCount; c++) {
5338
+ // parent.childNodes[c].classList.remove('active')
5339
+ // }
5340
+ // }
5341
+ // // add the 'active' class to the current suggestion
5342
+ // const activeSuggEl = document.getElementById(`${this.elementId}_suggestion_${this.activeSuggestion}`)
5343
+ // if (activeSuggEl) {
5344
+ // activeSuggEl.classList.add('active')
5345
+ // }
5346
+ var el = document.getElementById(this.elementId);
5347
+ if (el) {
5348
+ var els = document.querySelectorAll('.websy-search-suggestion-item');
5349
+ Array.from(els).forEach(function (e) {
5350
+ e.classList.remove('active');
5351
+ var index = e.getAttribute('data-index');
5352
+ if (+index === _this36.activeSuggestion) {
5353
+ e.classList.add('active');
5354
+ }
5355
+ });
5356
+ }
5357
+ }
5358
+ }, {
5359
+ key: "nextSuggestion",
5360
+ value: function nextSuggestion() {
5361
+ this.startSuggestionTimeout();
5362
+ if (this.activeSuggestion === this.suggestions.length - 1) {
5363
+ this.activeSuggestion = 0;
5364
+ } else {
5365
+ this.activeSuggestion++;
5366
+ }
5367
+ this.renderGhost();
5368
+ this.highlightActiveSuggestion();
5369
+ }
5370
+ }, {
5371
+ key: "prevSuggestion",
5372
+ value: function prevSuggestion() {
5373
+ this.startSuggestionTimeout();
5374
+ if (this.activeSuggestion === 0) {
5375
+ this.activeSuggestion = this.suggestions.length - 1;
5376
+ } else {
5377
+ this.activeSuggestion--;
5378
+ }
5379
+ this.renderGhost();
5380
+ this.highlightActiveSuggestion();
5381
+ }
5382
+ }, {
5383
+ key: "renderGhost",
5384
+ value: function renderGhost() {
5385
+ this.ghostPart = getGhostString(this.searchText, this.suggestions[this.activeSuggestion].label);
5386
+ this.ghostQuery = this.searchText + this.ghostPart;
5387
+ var ghostDisplay = "<span style='color: transparent;'>".concat(this.searchText, "</span>").concat(this.ghostPart);
5388
+ var ghostEl = document.getElementById("".concat(this.elementId, "_ghost"));
5389
+ if (ghostEl) {
5390
+ ghostEl.innerHTML = ghostDisplay;
5391
+ }
5392
+ function getGhostString(query, suggestion) {
5393
+ var suggestBase = query.toLowerCase();
5394
+ suggestion = suggestion.toLowerCase();
5395
+ while (suggestion.indexOf(suggestBase) === -1) {
5396
+ suggestBase = suggestBase.split(' ');
5397
+ suggestBase.splice(0, 1);
5398
+ suggestBase = suggestBase.join(' ');
5399
+ }
5400
+ var re = new RegExp(suggestBase, 'i');
5401
+ return suggestion.replace(re, '');
5402
+ }
5403
+ }
5404
+ }, {
5405
+ key: "renderLozenges",
5406
+ value: function renderLozenges() {
5407
+ var items = this.searchText.split('').map(function (d) {
5408
+ return "<div>".concat(d.replace(/ /g, '&nbsp;'), "</div>");
5409
+ });
5410
+ var el = document.getElementById("".concat(this.elementId, "_lozenges"));
5411
+ el.innerHTML = items.join('');
5412
+ }
5413
+ }, {
5414
+ key: "renderSuggestion",
5415
+ value: function renderSuggestion() {
5416
+ var suggestionsHtml = '';
5417
+ for (var i = 0; i < this.suggestions.length; i++) {
5418
+ suggestionsHtml += "\n <li id='".concat(this.elementId, "_suggestion_").concat(i, "' class='websy-search-suggestion-item' data-index='").concat(i, "'>\n ").concat(this.suggestions[i].label, "\n </li>\n ");
5419
+ }
5420
+ var suggListEl = document.getElementById("".concat(this.elementId, "_suggestionList"));
5421
+ if (suggListEl) {
5422
+ suggListEl.innerHTML = suggestionsHtml;
5423
+ }
5424
+ this.highlightActiveSuggestion();
5425
+ }
5426
+ }, {
5427
+ key: "showSuggestions",
5428
+ value: function showSuggestions() {
5429
+ var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5430
+ this.suggestions = items.splice(0, this.options.suggestLimit);
5431
+ this.startSuggestionTimeout();
5432
+ if (this.searchText && this.searchText.length > 1 && this.cursorPosition === this.searchText.length && this.suggestions.length > 0) {
5433
+ if (!this.suggesting) {
5434
+ this.activeSuggestion = 0;
5435
+ this.suggesting = true;
5436
+ }
5437
+ // render the suggested completion
5438
+ this.renderGhost();
5439
+ // render the suggestions
5440
+ var suggestEl = document.getElementById("".concat(this.elementId, "_suggestions"));
5441
+ if (suggestEl) {
5442
+ suggestEl.classList.add('active');
5443
+ }
5444
+ this.renderSuggestion();
5445
+ } else {
5446
+ this.suggesting = false;
5447
+ this.hideGhost();
5448
+ this.hideSuggestions();
5449
+ }
5450
+ }
5451
+ }, {
5452
+ key: "startSuggestionTimeout",
5453
+ value: function startSuggestionTimeout() {
5454
+ var _this37 = this;
5455
+ if (this.suggestingTimeoutFn) {
5456
+ clearTimeout(this.suggestingTimeoutFn);
5457
+ }
5458
+ this.suggestingTimeoutFn = setTimeout(function () {
5459
+ // close the suggestions after inactivity for [suggestingTimeout] milliseconds
5460
+ _this37.hideSuggestions(_this37);
5461
+ }, this.options.suggestingTimeout);
5192
5462
  }
5193
5463
  }, {
5194
5464
  key: "text",
@@ -5336,7 +5606,7 @@ var Switch = /*#__PURE__*/function () {
5336
5606
  /* global WebsyDesigns */
5337
5607
  var WebsyTemplate = /*#__PURE__*/function () {
5338
5608
  function WebsyTemplate(elementId, options) {
5339
- var _this36 = this;
5609
+ var _this38 = this;
5340
5610
  _classCallCheck(this, WebsyTemplate);
5341
5611
  var DEFAULTS = {
5342
5612
  listeners: {
@@ -5356,8 +5626,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
5356
5626
  }
5357
5627
  if (_typeof(options.template) === 'object' && options.template.url) {
5358
5628
  this.templateService.get(options.template.url).then(function (templateString) {
5359
- _this36.options.template = templateString;
5360
- _this36.render();
5629
+ _this38.options.template = templateString;
5630
+ _this38.render();
5361
5631
  });
5362
5632
  } else {
5363
5633
  this.render();
@@ -5366,7 +5636,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
5366
5636
  _createClass(WebsyTemplate, [{
5367
5637
  key: "buildHTML",
5368
5638
  value: function buildHTML() {
5369
- var _this37 = this;
5639
+ var _this39 = this;
5370
5640
  var html = "";
5371
5641
  if (this.options.template) {
5372
5642
  var template = this.options.template;
@@ -5415,14 +5685,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
5415
5685
  }
5416
5686
  }
5417
5687
  if (polarity === true) {
5418
- if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
5688
+ if (typeof _this39.options.data[parts[0]] !== 'undefined' && _this39.options.data[parts[0]] === parts[1]) {
5419
5689
  // remove the <if> tags
5420
5690
  removeAll = false;
5421
5691
  } else if (parts[0] === parts[1]) {
5422
5692
  removeAll = false;
5423
5693
  }
5424
5694
  } else if (polarity === false) {
5425
- if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
5695
+ if (typeof _this39.options.data[parts[0]] !== 'undefined' && _this39.options.data[parts[0]] !== parts[1]) {
5426
5696
  // remove the <if> tags
5427
5697
  removeAll = false;
5428
5698
  }
@@ -5735,7 +6005,7 @@ var WebsyUtils = {
5735
6005
  /* global WebsyDesigns */
5736
6006
  var WebsyTable = /*#__PURE__*/function () {
5737
6007
  function WebsyTable(elementId, options) {
5738
- var _this38 = this;
6008
+ var _this40 = this;
5739
6009
  _classCallCheck(this, WebsyTable);
5740
6010
  var DEFAULTS = {
5741
6011
  pageSize: 20,
@@ -5768,8 +6038,8 @@ var WebsyTable = /*#__PURE__*/function () {
5768
6038
  allowClear: false,
5769
6039
  disableSearch: true,
5770
6040
  onItemSelected: function onItemSelected(selectedItem) {
5771
- if (_this38.options.onChangePageSize) {
5772
- _this38.options.onChangePageSize(selectedItem.value);
6041
+ if (_this40.options.onChangePageSize) {
6042
+ _this40.options.onChangePageSize(selectedItem.value);
5773
6043
  }
5774
6044
  }
5775
6045
  });
@@ -5793,20 +6063,20 @@ var WebsyTable = /*#__PURE__*/function () {
5793
6063
  }, {
5794
6064
  key: "appendRows",
5795
6065
  value: function appendRows(data) {
5796
- var _this39 = this;
6066
+ var _this41 = this;
5797
6067
  this._isRendered = false;
5798
6068
  this.hideError();
5799
6069
  var bodyHTML = '';
5800
6070
  if (data) {
5801
6071
  bodyHTML += data.map(function (r, rowIndex) {
5802
6072
  return '<tr>' + r.map(function (c, i) {
5803
- if (_this39.options.columns[i].show !== false) {
6073
+ if (_this41.options.columns[i].show !== false) {
5804
6074
  var style = '';
5805
6075
  if (c.style) {
5806
6076
  style += c.style;
5807
6077
  }
5808
- if (_this39.options.columns[i].width) {
5809
- style += "width: ".concat(_this39.options.columns[i].width, "; ");
6078
+ if (_this41.options.columns[i].width) {
6079
+ style += "width: ".concat(_this41.options.columns[i].width, "; ");
5810
6080
  }
5811
6081
  if (c.backgroundColor) {
5812
6082
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -5817,16 +6087,16 @@ var WebsyTable = /*#__PURE__*/function () {
5817
6087
  if (c.color) {
5818
6088
  style += "color: ".concat(c.color, "; ");
5819
6089
  }
5820
- if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
5821
- return "\n <td \n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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(_this39.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
5822
- } else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
5823
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this39.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</td>\n ");
6090
+ if (_this41.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6091
+ return "\n <td \n data-row-index='".concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this41.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(_this41.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this41.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6092
+ } else if ((_this41.options.columns[i].showAsNavigatorLink === true || _this41.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6093
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this41.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this41.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this41.options.columns[i].linkText || c.value, "</td>\n ");
5824
6094
  } else {
5825
6095
  var info = c.value;
5826
- if (_this39.options.columns[i].showAsImage === true) {
6096
+ if (_this41.options.columns[i].showAsImage === true) {
5827
6097
  c.value = "\n <img src='".concat(c.value, "'>\n ");
5828
6098
  }
5829
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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 ");
6099
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this41.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this41.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 ");
5830
6100
  }
5831
6101
  }
5832
6102
  }).join('') + '</tr>';
@@ -5986,7 +6256,7 @@ var WebsyTable = /*#__PURE__*/function () {
5986
6256
  }, {
5987
6257
  key: "render",
5988
6258
  value: function render(data) {
5989
- var _this40 = this;
6259
+ var _this42 = this;
5990
6260
  this._isRendered = false;
5991
6261
  if (!this.options.columns) {
5992
6262
  return;
@@ -6014,7 +6284,7 @@ var WebsyTable = /*#__PURE__*/function () {
6014
6284
  if (c.width) {
6015
6285
  style += "width: ".concat(c.width || 'auto', ";");
6016
6286
  }
6017
- 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-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 ? _this40.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6287
+ 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-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 ? _this42.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
6018
6288
  }
6019
6289
  }).join('') + '</tr>';
6020
6290
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6032,7 +6302,7 @@ var WebsyTable = /*#__PURE__*/function () {
6032
6302
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6033
6303
  if (pagingEl) {
6034
6304
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6035
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6305
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this42.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6036
6306
  });
6037
6307
  var startIndex = 0;
6038
6308
  if (this.options.pageCount > 8) {
@@ -6075,6 +6345,7 @@ var WebsyTable = /*#__PURE__*/function () {
6075
6345
  messageEl.innerHTML = options.message;
6076
6346
  }
6077
6347
  }
6348
+ this._isRendered = true;
6078
6349
  }
6079
6350
  }, {
6080
6351
  key: "showLoading",
@@ -6087,7 +6358,7 @@ var WebsyTable = /*#__PURE__*/function () {
6087
6358
  /* global WebsyDesigns */
6088
6359
  var WebsyTable2 = /*#__PURE__*/function () {
6089
6360
  function WebsyTable2(elementId, options) {
6090
- var _this41 = this;
6361
+ var _this43 = this;
6091
6362
  _classCallCheck(this, WebsyTable2);
6092
6363
  var DEFAULTS = {
6093
6364
  pageSize: 20,
@@ -6122,8 +6393,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
6122
6393
  allowClear: false,
6123
6394
  disableSearch: true,
6124
6395
  onItemSelected: function onItemSelected(selectedItem) {
6125
- if (_this41.options.onChangePageSize) {
6126
- _this41.options.onChangePageSize(selectedItem.value);
6396
+ if (_this43.options.onChangePageSize) {
6397
+ _this43.options.onChangePageSize(selectedItem.value);
6127
6398
  }
6128
6399
  }
6129
6400
  });
@@ -6145,20 +6416,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
6145
6416
  _createClass(WebsyTable2, [{
6146
6417
  key: "appendRows",
6147
6418
  value: function appendRows(data) {
6148
- var _this42 = this;
6419
+ var _this44 = this;
6149
6420
  this.hideError();
6150
6421
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6151
6422
  var bodyHTML = '';
6152
6423
  if (data) {
6153
6424
  bodyHTML += data.map(function (r, rowIndex) {
6154
6425
  return '<tr>' + r.map(function (c, i) {
6155
- if (_this42.options.columns[i].show !== false) {
6156
- var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
6426
+ if (_this44.options.columns[i].show !== false) {
6427
+ var style = "height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px;");
6157
6428
  if (c.style) {
6158
6429
  style += c.style;
6159
6430
  }
6160
- if (_this42.options.columns[i].width) {
6161
- style += "width: ".concat(_this42.options.columns[i].width, "; ");
6431
+ if (_this44.options.columns[i].width) {
6432
+ style += "width: ".concat(_this44.options.columns[i].width, "; ");
6162
6433
  }
6163
6434
  if (c.backgroundColor) {
6164
6435
  style += "background-color: ".concat(c.backgroundColor, "; ");
@@ -6169,16 +6440,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
6169
6440
  if (c.color) {
6170
6441
  style += "color: ".concat(c.color, "; ");
6171
6442
  }
6172
- if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6173
- return "\n <td \n data-row-index='".concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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(_this42.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6174
- } else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6175
- return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this42.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this42.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</td>\n ");
6443
+ if (_this44.options.columns[i].showAsLink === true && c.value.trim() !== '') {
6444
+ return "\n <td \n data-row-index='".concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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(_this44.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
6445
+ } else if ((_this44.options.columns[i].showAsNavigatorLink === true || _this44.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
6446
+ return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this44.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this44.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</td>\n ");
6176
6447
  } else {
6177
6448
  var info = c.value;
6178
- if (_this42.options.columns[i].showAsImage === true) {
6449
+ if (_this44.options.columns[i].showAsImage === true) {
6179
6450
  c.value = "\n <img src='".concat(c.value, "'>\n ");
6180
6451
  }
6181
- return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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 ");
6452
+ return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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 ");
6182
6453
  }
6183
6454
  }
6184
6455
  }).join('') + '</tr>';
@@ -6412,7 +6683,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6412
6683
  }, {
6413
6684
  key: "render",
6414
6685
  value: function render(data) {
6415
- var _this43 = this;
6686
+ var _this45 = this;
6416
6687
  if (!this.options.columns) {
6417
6688
  return;
6418
6689
  }
@@ -6440,7 +6711,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6440
6711
  if (c.width) {
6441
6712
  style += "width: ".concat(c.width || 'auto', "; ");
6442
6713
  }
6443
- 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 ? _this43.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6714
+ 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 ? _this45.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6444
6715
  }
6445
6716
  }).join('') + '</tr>';
6446
6717
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
@@ -6450,7 +6721,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6450
6721
  var dropdownHTML = "";
6451
6722
  this.options.columns.forEach(function (c, i) {
6452
6723
  if (c.searchable && c.searchField) {
6453
- dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6724
+ dropdownHTML += "\n <div id=\"".concat(_this45.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
6454
6725
  }
6455
6726
  });
6456
6727
  dropdownEl.innerHTML = dropdownHTML;
@@ -6470,7 +6741,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
6470
6741
  var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
6471
6742
  if (pagingEl) {
6472
6743
  var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
6473
- return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6744
+ return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this45.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
6474
6745
  });
6475
6746
  var startIndex = 0;
6476
6747
  if (this.options.pageCount > 8) {
@@ -6547,17 +6818,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
6547
6818
  }, {
6548
6819
  key: "getColumnParameters",
6549
6820
  value: function getColumnParameters(values) {
6550
- var _this44 = this;
6821
+ var _this46 = this;
6551
6822
  var tableEl = document.getElementById("".concat(this.elementId, "_table"));
6552
6823
  tableEl.style.tableLayout = 'auto';
6553
6824
  tableEl.style.width = 'auto';
6554
6825
  var headEl = document.getElementById("".concat(this.elementId, "_head"));
6555
6826
  var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
6556
6827
  headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
6557
- 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 ? _this44.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6828
+ 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 ? _this46.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
6558
6829
  }).join('') + '</tr>';
6559
6830
  bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
6560
- return "\n <td \n style='height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6831
+ return "\n <td \n style='height: ".concat(_this46.options.cellSize, "px; line-height: ").concat(_this46.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || '&nbsp;', "</td>\n ");
6561
6832
  }).join('') + '</tr>';
6562
6833
  // get height of the first data cell
6563
6834
  var cells = bodyEl.querySelectorAll("tr:first-of-type td");
@@ -6721,7 +6992,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6721
6992
  }, {
6722
6993
  key: "buildBodyHtml",
6723
6994
  value: function buildBodyHtml() {
6724
- var _this45 = this;
6995
+ var _this47 = this;
6725
6996
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6726
6997
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6727
6998
  if (!this.options.columns) {
@@ -6746,7 +7017,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6746
7017
  row.forEach(function (cell, cellIndex) {
6747
7018
  var sizeIndex = cell.level || cellIndex;
6748
7019
  var colIndex = cell.index || cellIndex;
6749
- if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
7020
+ if (typeof sizingColumns[sizeIndex] === 'undefined' || _this47.options.columns[_this47.options.columns.length - 1][colIndex].show === false) {
6750
7021
  return; // need to revisit this logic
6751
7022
  }
6752
7023
 
@@ -6773,7 +7044,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6773
7044
  style += "color: ".concat(cell.color, "; ");
6774
7045
  }
6775
7046
  // console.log('rowspan', cell.rowspan)
6776
- bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this45.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n ");
7047
+ bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this47.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n ");
6777
7048
  // if (useWidths === true) {
6778
7049
  // bodyHtml += `
6779
7050
  // style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
@@ -6782,10 +7053,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6782
7053
  // }
6783
7054
  bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
6784
7055
  if (cell.expandable === true) {
6785
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this45.options.plusIcon, "</i>");
7056
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this47.options.plusIcon, "</i>");
6786
7057
  }
6787
7058
  if (cell.collapsable === true) {
6788
- bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this45.options.minusIcon, "</i>");
7059
+ bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this47.options.minusIcon, "</i>");
6789
7060
  }
6790
7061
  if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
6791
7062
  cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
@@ -6806,7 +7077,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6806
7077
  }, {
6807
7078
  key: "buildHeaderHtml",
6808
7079
  value: function buildHeaderHtml() {
6809
- var _this46 = this;
7080
+ var _this48 = this;
6810
7081
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6811
7082
  if (!this.options.columns) {
6812
7083
  return '';
@@ -6827,7 +7098,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6827
7098
  // // if we're calculating the size we only want to render the last row of column headers
6828
7099
  // return
6829
7100
  // }
6830
- headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this46.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
7101
+ headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this48.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
6831
7102
  row.filter(function (c) {
6832
7103
  return c.show !== false;
6833
7104
  }).forEach(function (col, colIndex) {
@@ -6847,24 +7118,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
6847
7118
  if (col.style) {
6848
7119
  style += col.style;
6849
7120
  }
6850
- headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this46.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
7121
+ headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this48.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6851
7122
  // if (useWidths === true && rowIndex === this.options.columns.length - 1) {
6852
7123
  // headerHtml += `
6853
7124
  // style='width: ${col.width || col.actualWidth}px'
6854
7125
  // width='${col.width || col.actualWidth}'
6855
7126
  // `
6856
7127
  // }
6857
- headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this46.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this46.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
7128
+ headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this48.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this48.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
6858
7129
  });
6859
7130
  headerHtml += "</tr>";
6860
7131
  });
6861
7132
  var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
6862
7133
  this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
6863
7134
  if (c.searchable && c.isExternalSearch === true) {
6864
- var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
7135
+ var testEl = document.getElementById("".concat(_this48.elementId, "_columnSearch_").concat(c.dimId || i));
6865
7136
  if (!testEl) {
6866
7137
  var newE = document.createElement('div');
6867
- newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
7138
+ newE.id = "".concat(_this48.elementId, "_columnSearch_").concat(c.dimId || i);
6868
7139
  newE.className = 'websy-modal-dropdown';
6869
7140
  dropdownEl.appendChild(newE);
6870
7141
  }
@@ -6887,7 +7158,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6887
7158
  }, {
6888
7159
  key: "buildTotalHtml",
6889
7160
  value: function buildTotalHtml() {
6890
- var _this47 = this;
7161
+ var _this49 = this;
6891
7162
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6892
7163
  if (!this.options.totals) {
6893
7164
  return '';
@@ -6903,7 +7174,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6903
7174
 
6904
7175
  totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
6905
7176
  if (useWidths === true) {
6906
- totalHtml += "\n style='width: ".concat(_this47.options.columns[_this47.options.columns.length - 1][colIndex].width || _this47.options.columns[_this47.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
7177
+ totalHtml += "\n style='width: ".concat(_this49.options.columns[_this49.options.columns.length - 1][colIndex].width || _this49.options.columns[_this49.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
6907
7178
  }
6908
7179
  totalHtml += " \n >\n ".concat(col.value, "\n </td>");
6909
7180
  });
@@ -6913,7 +7184,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6913
7184
  }, {
6914
7185
  key: "calculateSizes",
6915
7186
  value: function calculateSizes() {
6916
- var _this48 = this;
7187
+ var _this50 = this;
6917
7188
  var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6918
7189
  var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
6919
7190
  var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
@@ -6957,7 +7228,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6957
7228
  rows.forEach(function (row, rowIndex) {
6958
7229
  Array.from(row.children).forEach(function (col, colIndex) {
6959
7230
  var colSize = col.getBoundingClientRect();
6960
- _this48.sizes.cellHeight = colSize.height;
7231
+ _this50.sizes.cellHeight = colSize.height;
6961
7232
  if (columnsForSizing[colIndex]) {
6962
7233
  if (!columnsForSizing[colIndex].actualWidth) {
6963
7234
  columnsForSizing[colIndex].potentialWidth = 0;
@@ -6969,7 +7240,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6969
7240
  // columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
6970
7241
  // }
6971
7242
  columnsForSizing[colIndex].cellHeight = colSize.height;
6972
- if (colIndex >= _this48.pinnedColumns) {
7243
+ if (colIndex >= _this50.pinnedColumns) {
6973
7244
  firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
6974
7245
  }
6975
7246
  }
@@ -6984,7 +7255,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6984
7255
  return a + (b.width || b.actualWidth);
6985
7256
  }, 0);
6986
7257
  this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
6987
- return i >= _this48.pinnedColumns;
7258
+ return i >= _this50.pinnedColumns;
6988
7259
  }).reduce(function (a, b) {
6989
7260
  return a + (b.width || b.actualWidth);
6990
7261
  }, 0);
@@ -6995,7 +7266,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6995
7266
  var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
6996
7267
  columnsForSizing.forEach(function (c) {
6997
7268
  c.shouldGrow = true;
6998
- if (_this48.options.autoFitColumns === false) {
7269
+ if (_this50.options.autoFitColumns === false) {
6999
7270
  c.shouldGrow = false;
7000
7271
  if (c.potentialWidth > c.actualWidth) {
7001
7272
  c.shouldGrow = true;
@@ -7014,7 +7285,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7014
7285
  // if (!c.width) {
7015
7286
  // if (c.actualWidth < equalWidth) {
7016
7287
  // adjust the width
7017
- if (_this48.options.autoFitColumns === true) {
7288
+ if (_this50.options.autoFitColumns === true) {
7018
7289
  if (c.width) {
7019
7290
  c.width += equalWidth;
7020
7291
  }
@@ -7038,9 +7309,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
7038
7309
  }
7039
7310
  // }
7040
7311
  // }
7041
- _this48.sizes.totalWidth += c.width || c.actualWidth;
7042
- if (i > _this48.pinnedColumns) {
7043
- _this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7312
+ _this50.sizes.totalWidth += c.width || c.actualWidth;
7313
+ if (i > _this50.pinnedColumns) {
7314
+ _this50.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
7044
7315
  }
7045
7316
  // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
7046
7317
  });
@@ -7099,7 +7370,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7099
7370
  }, {
7100
7371
  key: "createSample",
7101
7372
  value: function createSample(data) {
7102
- var _this49 = this;
7373
+ var _this51 = this;
7103
7374
  var output = [];
7104
7375
  this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
7105
7376
  if (col.maxLength) {
@@ -7109,7 +7380,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7109
7380
  } else if (data) {
7110
7381
  var longest = '';
7111
7382
  for (var i = 0; i < Math.min(data.length, 1000); i++) {
7112
- if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
7383
+ if (data[i].length === _this51.options.columns[_this51.options.columns.length - 1].length) {
7113
7384
  if (longest.length < data[i][colIndex].value.length) {
7114
7385
  longest = data[i][colIndex].value;
7115
7386
  }
@@ -7381,7 +7652,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7381
7652
  }, {
7382
7653
  key: "perpetualScroll",
7383
7654
  value: function perpetualScroll() {
7384
- var _this50 = this;
7655
+ var _this52 = this;
7385
7656
  // if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
7386
7657
  if (this.touchEndTime - this.currentTouchtime > 300) {
7387
7658
  return;
@@ -7400,17 +7671,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
7400
7671
  var direction = touchDistance > 0 ? -1 : 1;
7401
7672
  var _loop2 = function _loop2(i) {
7402
7673
  setTimeout(function () {
7403
- var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
7674
+ var delta = _this52.mouseYStart - _this52.currentClientY + _this52.sizes.cellHeight * (i + 1) * direction;
7404
7675
  delta = Math.min(10, delta);
7405
7676
  delta = Math.max(-10, delta);
7406
7677
  // only run this if isPerpetual === true
7407
7678
  // this value is reset to false on touchStart
7408
- if (_this50.isPerpetual === true) {
7679
+ if (_this52.isPerpetual === true) {
7409
7680
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
7410
7681
  // this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
7411
- _this50.scrollY(Math.max(-5, Math.min(5, delta)));
7412
- if (_this50.scrollTimeout) {
7413
- clearTimeout(_this50.scrollTimeout);
7682
+ _this52.scrollY(Math.max(-5, Math.min(5, delta)));
7683
+ if (_this52.scrollTimeout) {
7684
+ clearTimeout(_this52.scrollTimeout);
7414
7685
  }
7415
7686
  }
7416
7687
  }, 1000 / fps * i);
@@ -7678,7 +7949,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7678
7949
  /* global d3 include WebsyDesigns */
7679
7950
  var WebsyChart = /*#__PURE__*/function () {
7680
7951
  function WebsyChart(elementId, options) {
7681
- var _this51 = this;
7952
+ var _this53 = this;
7682
7953
  _classCallCheck(this, WebsyChart);
7683
7954
  var DEFAULTS = {
7684
7955
  margin: {
@@ -7737,7 +8008,7 @@ var WebsyChart = /*#__PURE__*/function () {
7737
8008
  this.invertOverride = function (input, input2) {
7738
8009
  var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7739
8010
  var xAxis = 'bottom';
7740
- if (_this51.options.orientation === 'horizontal') {
8011
+ if (_this53.options.orientation === 'horizontal') {
7741
8012
  xAxis = 'left';
7742
8013
  }
7743
8014
  if (forBrush === true) {
@@ -7745,12 +8016,12 @@ var WebsyChart = /*#__PURE__*/function () {
7745
8016
  }
7746
8017
  xAxis += 'Axis';
7747
8018
  var output;
7748
- var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
8019
+ var width = _this53.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
7749
8020
  // if (this.customBottomRange) {
7750
- for (var index = 0; index < _this51.customBottomRange.length; index++) {
7751
- if (input > _this51.customBottomRange[index]) {
7752
- if (_this51.customBottomRange[index + 1]) {
7753
- if (input < _this51.customBottomRange[index + 1]) {
8021
+ for (var index = 0; index < _this53.customBottomRange.length; index++) {
8022
+ if (input > _this53.customBottomRange[index]) {
8023
+ if (_this53.customBottomRange[index + 1]) {
8024
+ if (input < _this53.customBottomRange[index + 1]) {
7754
8025
  output = index;
7755
8026
  break;
7756
8027
  }
@@ -7915,9 +8186,9 @@ var WebsyChart = /*#__PURE__*/function () {
7915
8186
  }, {
7916
8187
  key: "handleEventMouseMove",
7917
8188
  value: function handleEventMouseMove(event, d) {
7918
- var _this52 = this;
8189
+ var _this54 = this;
7919
8190
  var bisectDate = d3.bisector(function (d) {
7920
- return _this52.parseX(d.x.value);
8191
+ return _this54.parseX(d.x.value);
7921
8192
  }).left;
7922
8193
  if (this.options.showTrackingLine === true && d3.pointer(event)) {
7923
8194
  var xAxis = 'bottomAxis';
@@ -7950,9 +8221,9 @@ var WebsyChart = /*#__PURE__*/function () {
7950
8221
  xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
7951
8222
  }
7952
8223
  this.options.data.series.forEach(function (s) {
7953
- if (_this52.options.data[xData].scale !== 'Time') {
8224
+ if (_this54.options.data[xData].scale !== 'Time') {
7954
8225
  // if (this.customBottomRange && this.customBottomRange.length > 0) {
7955
- xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
8226
+ xPoint = _this54.customBottomRange[x0] + (_this54.customBottomRange[x0 + 1] - _this54.customBottomRange[x0]) / 2;
7956
8227
  // }
7957
8228
  // else {
7958
8229
  // xPoint = this[xAxis](this.parseX(xLabel))
@@ -7972,41 +8243,41 @@ var WebsyChart = /*#__PURE__*/function () {
7972
8243
  var index = bisectDate(s.data, x0, 1);
7973
8244
  var pointA = s.data[index - 1];
7974
8245
  var pointB = s.data[index];
7975
- if (_this52.options.orientation === 'horizontal') {
8246
+ if (_this54.options.orientation === 'horizontal') {
7976
8247
  pointA = _toConsumableArray(s.data).reverse()[index - 1];
7977
8248
  pointB = _toConsumableArray(s.data).reverse()[index];
7978
8249
  }
7979
8250
  if (pointA && !pointB) {
7980
- xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
8251
+ xPoint = _this54[xAxis](_this54.parseX(pointA.x.value));
7981
8252
  tooltipTitle = pointA.x.value;
7982
8253
  if (!pointA.y.color) {
7983
8254
  pointA.y.color = s.color;
7984
8255
  }
7985
8256
  tooltipData.push(pointA);
7986
8257
  if (typeof pointA.x.value.getTime !== 'undefined') {
7987
- tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
8258
+ tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointA.x.value);
7988
8259
  }
7989
8260
  }
7990
8261
  if (pointB && !pointA) {
7991
- xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
8262
+ xPoint = _this54[xAxis](_this54.parseX(pointB.x.value));
7992
8263
  tooltipTitle = pointB.x.value;
7993
8264
  if (!pointB.y.color) {
7994
8265
  pointB.y.color = s.color;
7995
8266
  }
7996
8267
  tooltipData.push(pointB);
7997
8268
  if (typeof pointB.x.value.getTime !== 'undefined') {
7998
- tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
8269
+ tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
7999
8270
  }
8000
8271
  }
8001
8272
  if (pointA && pointB) {
8002
- var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
8003
- var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
8273
+ var d0 = _this54[xAxis](_this54.parseX(pointA.x.value));
8274
+ var d1 = _this54[xAxis](_this54.parseX(pointB.x.value));
8004
8275
  var mid = Math.abs(d0 - d1) / 2;
8005
8276
  if (d3.pointer(event)[0] - d0 >= mid) {
8006
8277
  xPoint = d1;
8007
8278
  tooltipTitle = pointB.x.value;
8008
8279
  if (typeof pointB.x.value.getTime !== 'undefined') {
8009
- tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
8280
+ tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
8010
8281
  }
8011
8282
  if (!pointB.y.color) {
8012
8283
  pointB.y.color = s.color;
@@ -8016,7 +8287,7 @@ var WebsyChart = /*#__PURE__*/function () {
8016
8287
  xPoint = d0;
8017
8288
  tooltipTitle = pointA.x.value;
8018
8289
  if (typeof pointB.x.value.getTime !== 'undefined') {
8019
- tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
8290
+ tooltipTitle = d3.timeFormat(_this54.options.dateFormat || _this54.options.calculatedTimeFormatPattern)(pointB.x.value);
8020
8291
  }
8021
8292
  if (!pointA.y.color) {
8022
8293
  pointA.y.color = s.color;
@@ -8142,7 +8413,7 @@ var WebsyChart = /*#__PURE__*/function () {
8142
8413
  }, {
8143
8414
  key: "render",
8144
8415
  value: function render(options) {
8145
- var _this53 = this;
8416
+ var _this55 = this;
8146
8417
  /* global d3 options WebsyUtils */
8147
8418
  this._isRendered = false;
8148
8419
  if (typeof options !== 'undefined') {
@@ -8211,7 +8482,7 @@ var WebsyChart = /*#__PURE__*/function () {
8211
8482
  this.options.data.series.map(function (s, i) {
8212
8483
  return {
8213
8484
  value: s.label || s.key,
8214
- color: s.color || _this53.options.colors[i % _this53.options.colors.length]
8485
+ color: s.color || _this55.options.colors[i % _this55.options.colors.length]
8215
8486
  };
8216
8487
  });
8217
8488
  }
@@ -8568,25 +8839,25 @@ var WebsyChart = /*#__PURE__*/function () {
8568
8839
  if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
8569
8840
  var acc = 0;
8570
8841
  this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8571
- var adjustment = _this53.bandPadding * index + _this53.bandPadding;
8842
+ var adjustment = _this55.bandPadding * index + _this55.bandPadding;
8572
8843
  // if (this.options.data.bottom.padding) {
8573
8844
  // adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
8574
8845
  // }
8575
- var start = _this53.widthForCalc / noOfPoints * acc;
8846
+ var start = _this55.widthForCalc / noOfPoints * acc;
8576
8847
  for (var i = 0; i < (d.valueCount || 1); i++) {
8577
8848
  var pos = i * proposedBandWidth;
8578
- _this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8849
+ _this55["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
8579
8850
  }
8580
- acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8581
- var end = _this53.widthForCalc / noOfPoints * acc;
8851
+ acc += _this55.options.grouping !== 'stacked' && _this55.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8852
+ var end = _this55.widthForCalc / noOfPoints * acc;
8582
8853
  // this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
8583
8854
  return end + adjustment;
8584
8855
  })));
8585
8856
  acc = 0;
8586
8857
  this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
8587
- var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
8588
- acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8589
- return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
8858
+ var adjustment = _this55.brushBandPadding * index + _this55.brushBandPadding;
8859
+ acc += _this55.options.grouping !== 'stacked' && _this55.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
8860
+ return (_this55.options.orientation === 'vertical' ? _this55.plotWidth : _this55.plotHeight) / noOfPoints * acc;
8590
8861
  })));
8591
8862
  }
8592
8863
  // }
@@ -8759,7 +9030,7 @@ var WebsyChart = /*#__PURE__*/function () {
8759
9030
  this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
8760
9031
  if (this.options.data.bottom.formatter) {
8761
9032
  this.bAxisFunc.tickFormat(function (d) {
8762
- return _this53.options.data.bottom.formatter(d);
9033
+ return _this55.options.data.bottom.formatter(d);
8763
9034
  });
8764
9035
  }
8765
9036
  this.bottomAxisLayer.call(this.bAxisFunc);
@@ -8769,7 +9040,7 @@ var WebsyChart = /*#__PURE__*/function () {
8769
9040
  }
8770
9041
  if (this.customBottomRange.length > 0) {
8771
9042
  this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
8772
- return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
9043
+ return "translate(".concat(_this55.customBottomRange[i] + (_this55.customBottomRange[i + 1] - _this55.customBottomRange[i]) / 2, ", 0)");
8773
9044
  });
8774
9045
  }
8775
9046
  }
@@ -8788,14 +9059,14 @@ var WebsyChart = /*#__PURE__*/function () {
8788
9059
  }
8789
9060
  if (this.options.margin.axisLeft > 0) {
8790
9061
  this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
8791
- if (_this53.options.data.left.formatter) {
8792
- d = _this53.options.data.left.formatter(d);
9062
+ if (_this55.options.data.left.formatter) {
9063
+ d = _this55.options.data.left.formatter(d);
8793
9064
  }
8794
9065
  return d;
8795
9066
  }));
8796
9067
  if (this.customLeftRange.length > 0) {
8797
9068
  this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
8798
- return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
9069
+ return "translate(0, ".concat(_this55.customLeftRange[i] + (_this55.customLeftRange[i + 1] - _this55.customLeftRange[i]) / 2, ")");
8799
9070
  });
8800
9071
  }
8801
9072
  }
@@ -8823,8 +9094,8 @@ var WebsyChart = /*#__PURE__*/function () {
8823
9094
  }
8824
9095
  if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
8825
9096
  this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
8826
- if (_this53.options.data.right.formatter) {
8827
- d = _this53.options.data.right.formatter(d);
9097
+ if (_this55.options.data.right.formatter) {
9098
+ d = _this55.options.data.right.formatter(d);
8828
9099
  }
8829
9100
  return d;
8830
9101
  }));
@@ -8864,25 +9135,25 @@ var WebsyChart = /*#__PURE__*/function () {
8864
9135
  }, {
8865
9136
  key: "renderComponents",
8866
9137
  value: function renderComponents() {
8867
- var _this54 = this;
9138
+ var _this56 = this;
8868
9139
  // Draw the series data
8869
9140
  this.renderedKeys = {};
8870
9141
  this.options.data.series.forEach(function (series, index) {
8871
9142
  if (!series.key) {
8872
- series.key = _this54.createIdentity();
9143
+ series.key = _this56.createIdentity();
8873
9144
  }
8874
9145
  if (!series.color) {
8875
- series.color = _this54.options.colors[index % _this54.options.colors.length];
9146
+ series.color = _this56.options.colors[index % _this56.options.colors.length];
8876
9147
  }
8877
- _this54["render".concat(series.type || 'bar')](series, index);
8878
- _this54.renderLabels(series, index);
8879
- _this54.renderedKeys[series.key] = series.type;
9148
+ _this56["render".concat(series.type || 'bar')](series, index);
9149
+ _this56.renderLabels(series, index);
9150
+ _this56.renderedKeys[series.key] = series.type;
8880
9151
  });
8881
9152
  this.refLineLayer.selectAll('.reference-line').remove();
8882
9153
  this.refLineLayer.selectAll('.reference-line-label').remove();
8883
9154
  if (this.options.refLines && this.options.refLines.length > 0) {
8884
9155
  this.options.refLines.forEach(function (l) {
8885
- return _this54.renderRefLine(l);
9156
+ return _this56.renderRefLine(l);
8886
9157
  });
8887
9158
  }
8888
9159
  this._isRendered = true;
@@ -8890,25 +9161,25 @@ var WebsyChart = /*#__PURE__*/function () {
8890
9161
  }, {
8891
9162
  key: "renderarea",
8892
9163
  value: function renderarea(series, index) {
8893
- var _this55 = this;
9164
+ var _this57 = this;
8894
9165
  /* global d3 series index */
8895
9166
  var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
8896
9167
  return d3.area().x(function (d) {
8897
- if (_this55.options.data[xAxis].scale === 'Time') {
8898
- return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
9168
+ if (_this57.options.data[xAxis].scale === 'Time') {
9169
+ return _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
8899
9170
  } else {
8900
- var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
8901
- var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
8902
- if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
8903
- xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9171
+ var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
9172
+ var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9173
+ if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9174
+ xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
8904
9175
  }
8905
9176
  return xPos;
8906
9177
  }
8907
9178
  }).y0(function (d) {
8908
- return _this55["".concat(yAxis, "Axis")](0);
9179
+ return _this57["".concat(yAxis, "Axis")](0);
8909
9180
  }).y1(function (d) {
8910
- return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
8911
- }).curve(d3[curveStyle || _this55.options.curveStyle]);
9181
+ return _this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9182
+ }).curve(d3[curveStyle || _this57.options.curveStyle]);
8912
9183
  };
8913
9184
  var xAxis = 'bottom';
8914
9185
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -8948,7 +9219,7 @@ var WebsyChart = /*#__PURE__*/function () {
8948
9219
  }, {
8949
9220
  key: "renderbar",
8950
9221
  value: function renderbar(series, index) {
8951
- var _this56 = this;
9222
+ var _this58 = this;
8952
9223
  /* global series index d3 */
8953
9224
  var xAxis = 'bottom';
8954
9225
  var yAxis = 'left';
@@ -9115,26 +9386,26 @@ var WebsyChart = /*#__PURE__*/function () {
9115
9386
  }
9116
9387
  bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9117
9388
  bars.attr('width', function (d, i) {
9118
- return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
9389
+ return Math.abs(getBarWidth.call(_this58, d, i, yAxis, xAxis));
9119
9390
  }).attr('height', function (d, i) {
9120
- return getBarHeight.call(_this56, d, i, yAxis, xAxis);
9391
+ return getBarHeight.call(_this58, d, i, yAxis, xAxis);
9121
9392
  }).attr('x', function (d, i) {
9122
- return getBarX.call(_this56, d, i, yAxis, xAxis);
9393
+ return getBarX.call(_this58, d, i, yAxis, xAxis);
9123
9394
  }).attr('y', function (d, i) {
9124
- return getBarY.call(_this56, d, i, yAxis, xAxis);
9395
+ return getBarY.call(_this58, d, i, yAxis, xAxis);
9125
9396
  })
9126
9397
  // .transition(this.transition)
9127
9398
  .attr('fill', function (d) {
9128
9399
  return d.y.color || d.color || series.color;
9129
9400
  });
9130
9401
  bars.enter().append('rect').attr('width', function (d, i) {
9131
- return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
9402
+ return Math.abs(getBarWidth.call(_this58, d, i, yAxis, xAxis));
9132
9403
  }).attr('height', function (d, i) {
9133
- return getBarHeight.call(_this56, d, i, yAxis, xAxis);
9404
+ return getBarHeight.call(_this58, d, i, yAxis, xAxis);
9134
9405
  }).attr('x', function (d, i) {
9135
- return getBarX.call(_this56, d, i, yAxis, xAxis);
9406
+ return getBarX.call(_this58, d, i, yAxis, xAxis);
9136
9407
  }).attr('y', function (d, i) {
9137
- return getBarY.call(_this56, d, i, yAxis, xAxis);
9408
+ return getBarY.call(_this58, d, i, yAxis, xAxis);
9138
9409
  })
9139
9410
  // .transition(this.transition)
9140
9411
  .attr('fill', function (d) {
@@ -9146,26 +9417,26 @@ var WebsyChart = /*#__PURE__*/function () {
9146
9417
  this.brushBarsInitialized[series.key] = true;
9147
9418
  brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
9148
9419
  brushBars.attr('width', function (d, i) {
9149
- return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9420
+ return Math.abs(getBarWidth.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9150
9421
  }).attr('height', function (d, i) {
9151
- return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9422
+ return getBarHeight.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9152
9423
  }).attr('x', function (d, i) {
9153
- return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9424
+ return getBarX.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9154
9425
  }).attr('y', function (d, i) {
9155
- return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9426
+ return getBarY.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9156
9427
  })
9157
9428
  // .transition(this.transition)
9158
9429
  .attr('fill', function (d) {
9159
9430
  return d.y.color || d.color || series.color;
9160
9431
  });
9161
9432
  brushBars.enter().append('rect').attr('width', function (d, i) {
9162
- return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9433
+ return Math.abs(getBarWidth.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
9163
9434
  }).attr('height', function (d, i) {
9164
- return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9435
+ return getBarHeight.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9165
9436
  }).attr('x', function (d, i) {
9166
- return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9437
+ return getBarX.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9167
9438
  }).attr('y', function (d, i) {
9168
- return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9439
+ return getBarY.call(_this58, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
9169
9440
  })
9170
9441
  // .transition(this.transition)
9171
9442
  .attr('fill', function (d) {
@@ -9186,7 +9457,7 @@ var WebsyChart = /*#__PURE__*/function () {
9186
9457
  }, {
9187
9458
  key: "renderLabels",
9188
9459
  value: function renderLabels(series, index) {
9189
- var _this57 = this;
9460
+ var _this59 = this;
9190
9461
  /* global series index d3 WebsyDesigns */
9191
9462
  var xAxis = 'bottom';
9192
9463
  var yAxis = 'left';
@@ -9202,14 +9473,14 @@ var WebsyChart = /*#__PURE__*/function () {
9202
9473
  var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
9203
9474
  labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
9204
9475
  labels.attr('x', function (d) {
9205
- return getLabelX.call(_this57, d, series.labelPosition);
9476
+ return getLabelX.call(_this59, d, series.labelPosition);
9206
9477
  }).attr('y', function (d) {
9207
- return getLabelY.call(_this57, d, series.labelPosition);
9478
+ return getLabelY.call(_this59, d, series.labelPosition);
9208
9479
  }).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
9209
- if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
9480
+ if (_this59.options.grouping === 'stacked' && d.y.value === 0) {
9210
9481
  return 'transparent';
9211
9482
  }
9212
- return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9483
+ return _this59.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9213
9484
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
9214
9485
  return d.y.label || d.y.value;
9215
9486
  }).each(function (d, i) {
@@ -9243,14 +9514,14 @@ var WebsyChart = /*#__PURE__*/function () {
9243
9514
  }
9244
9515
  });
9245
9516
  labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
9246
- return getLabelX.call(_this57, d, series.labelPosition);
9517
+ return getLabelX.call(_this59, d, series.labelPosition);
9247
9518
  }).attr('y', function (d) {
9248
- return getLabelY.call(_this57, d, series.labelPosition);
9519
+ return getLabelY.call(_this59, d, series.labelPosition);
9249
9520
  }).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
9250
- if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
9521
+ if (_this59.options.grouping === 'stacked' && d.y.value === 0) {
9251
9522
  return 'transparent';
9252
9523
  }
9253
- return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9524
+ return _this59.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
9254
9525
  }).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
9255
9526
  return d.y.label || d.y.value;
9256
9527
  }).each(function (d, i) {
@@ -9328,32 +9599,32 @@ var WebsyChart = /*#__PURE__*/function () {
9328
9599
  }, {
9329
9600
  key: "renderline",
9330
9601
  value: function renderline(series, index) {
9331
- var _this58 = this;
9602
+ var _this60 = this;
9332
9603
  /* global series index d3 */
9333
9604
  var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
9334
9605
  return d3.line().x(function (d) {
9335
- if (_this58.options.orientation === 'horizontal') {
9336
- return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9606
+ if (_this60.options.orientation === 'horizontal') {
9607
+ return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9337
9608
  } else {
9338
- if (_this58.options.data[xAxis].scale === 'Time') {
9339
- return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
9609
+ if (_this60.options.data[xAxis].scale === 'Time') {
9610
+ return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
9340
9611
  } else {
9341
- var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
9342
- var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9343
- if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9344
- xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9612
+ var xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
9613
+ var xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9614
+ if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9615
+ xPos = xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9345
9616
  }
9346
9617
  return xPos;
9347
9618
  }
9348
9619
  }
9349
9620
  }).y(function (d) {
9350
- if (_this58.options.orientation === 'horizontal') {
9351
- var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
9352
- return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
9621
+ if (_this60.options.orientation === 'horizontal') {
9622
+ var adjustment = _this60.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this60.options.data[xAxis].bandWidth / 2;
9623
+ return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value)) + adjustment;
9353
9624
  } else {
9354
- return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9625
+ return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
9355
9626
  }
9356
- }).curve(d3[curveStyle || _this58.options.curveStyle]);
9627
+ }).curve(d3[curveStyle || _this60.options.curveStyle]);
9357
9628
  };
9358
9629
  var xAxis = 'bottom';
9359
9630
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9462,14 +9733,14 @@ var WebsyChart = /*#__PURE__*/function () {
9462
9733
  }, {
9463
9734
  key: "rendersymbol",
9464
9735
  value: function rendersymbol(series, index) {
9465
- var _this59 = this;
9736
+ var _this61 = this;
9466
9737
  /* global d3 series index series.key */
9467
9738
  var drawSymbol = function drawSymbol(size) {
9468
9739
  return d3.symbol()
9469
9740
  // .type(d => {
9470
9741
  // return d3.symbols[0]
9471
9742
  // })
9472
- .size(size || _this59.options.symbolSize);
9743
+ .size(size || _this61.options.symbolSize);
9473
9744
  };
9474
9745
  var xAxis = 'bottom';
9475
9746
  var yAxis = series.axis === 'secondary' ? 'right' : 'left';
@@ -9495,27 +9766,27 @@ var WebsyChart = /*#__PURE__*/function () {
9495
9766
  // else {
9496
9767
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9497
9768
  // }
9498
- var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9499
- var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9500
- if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9501
- xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9502
- }
9503
- var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
9504
- if (_this59.options.orientation === 'horizontal') {
9505
- return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9769
+ var xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9770
+ var xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9771
+ if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9772
+ xPos = xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9773
+ }
9774
+ var adjustment = _this61.options.data[xAxis].scale === 'Time' || _this61.options.data[xAxis].scale === 'Linear' ? 0 : _this61.options.data[xAxis].bandWidth / 2;
9775
+ if (_this61.options.orientation === 'horizontal') {
9776
+ return "translate(".concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9506
9777
  } else {
9507
- if (_this59.options.data[xAxis].scale === 'Time') {
9508
- xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
9778
+ if (_this61.options.data[xAxis].scale === 'Time') {
9779
+ xPos = _this61["".concat(xAxis, "Axis")](_this61.parseX(d.x.value));
9509
9780
  } else {
9510
- var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9511
- var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9512
- if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9513
- _xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9781
+ var _xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9782
+ var _xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
9783
+ if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
9784
+ _xPos = _xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
9514
9785
  }
9515
9786
  // return xPos
9516
9787
  }
9517
9788
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9518
- return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9789
+ return "translate(".concat(xPos, ", ").concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9519
9790
  }
9520
9791
  });
9521
9792
  // Enter
@@ -9530,27 +9801,27 @@ var WebsyChart = /*#__PURE__*/function () {
9530
9801
  }).attr('class', function (d) {
9531
9802
  return "symbol symbol_".concat(series.key);
9532
9803
  }).attr('transform', function (d) {
9533
- var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9534
- var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9535
- if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9536
- xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9537
- }
9538
- var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
9539
- if (_this59.options.orientation === 'horizontal') {
9540
- return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9804
+ var xIndex = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9805
+ var xPos = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
9806
+ if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
9807
+ xPos = xPos + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
9808
+ }
9809
+ var adjustment = _this61.options.data[xAxis].scale === 'Time' || _this61.options.data[xAxis].scale === 'Linear' ? 0 : _this61.options.data[xAxis].bandWidth / 2;
9810
+ if (_this61.options.orientation === 'horizontal') {
9811
+ return "translate(".concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
9541
9812
  } else {
9542
- if (_this59.options.data[xAxis].scale === 'Time') {
9543
- xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
9813
+ if (_this61.options.data[xAxis].scale === 'Time') {
9814
+ xPos = _this61["".concat(xAxis, "Axis")](_this61.parseX(d.x.value));
9544
9815
  } else {
9545
- var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
9546
- var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9547
- if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9548
- _xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9816
+ var _xIndex2 = _this61[xAxis + 'Axis'].domain().indexOf(d.x.value);
9817
+ var _xPos2 = _this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
9818
+ if (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
9819
+ _xPos2 = _xPos2 + (_this61["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
9549
9820
  }
9550
9821
  // return xPos
9551
9822
  }
9552
9823
  // return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
9553
- return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9824
+ return "translate(".concat(xPos, ", ").concat(_this61["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
9554
9825
  }
9555
9826
  });
9556
9827
  }
@@ -10173,7 +10444,7 @@ var WebsyLegend = /*#__PURE__*/function () {
10173
10444
  }, {
10174
10445
  key: "resize",
10175
10446
  value: function resize() {
10176
- var _this60 = this;
10447
+ var _this62 = this;
10177
10448
  var el = document.getElementById(this.elementId);
10178
10449
  if (el) {
10179
10450
  // if (this.options.width) {
@@ -10184,7 +10455,7 @@ var WebsyLegend = /*#__PURE__*/function () {
10184
10455
  // }
10185
10456
  var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
10186
10457
  html += this._data.map(function (d, i) {
10187
- return _this60.getLegendItemHTML(d);
10458
+ return _this62.getLegendItemHTML(d);
10188
10459
  }).join('');
10189
10460
  html += "\n <div>\n ";
10190
10461
  el.innerHTML = html;
@@ -10342,7 +10613,7 @@ var WebsyMap = /*#__PURE__*/function () {
10342
10613
  }, {
10343
10614
  key: "render",
10344
10615
  value: function render() {
10345
- var _this61 = this;
10616
+ var _this63 = this;
10346
10617
  this._isRendered = false;
10347
10618
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
10348
10619
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
@@ -10350,7 +10621,7 @@ var WebsyMap = /*#__PURE__*/function () {
10350
10621
  var legendData = this.options.data.polygons.map(function (s, i) {
10351
10622
  return {
10352
10623
  value: s.label || s.key,
10353
- color: s.color || _this61.options.colors[i % _this61.options.colors.length]
10624
+ color: s.color || _this63.options.colors[i % _this63.options.colors.length]
10354
10625
  };
10355
10626
  });
10356
10627
  var longestValue = legendData.map(function (s) {
@@ -10404,7 +10675,7 @@ var WebsyMap = /*#__PURE__*/function () {
10404
10675
  }
10405
10676
  if (this.polygons) {
10406
10677
  this.polygons.forEach(function (p) {
10407
- return _this61.map.removeLayer(p);
10678
+ return _this63.map.removeLayer(p);
10408
10679
  });
10409
10680
  }
10410
10681
  this.polygons = [];
@@ -10458,15 +10729,15 @@ var WebsyMap = /*#__PURE__*/function () {
10458
10729
  p.options = {};
10459
10730
  }
10460
10731
  if (!p.options.color) {
10461
- p.options.color = _this61.options.colors[i % _this61.options.colors.length];
10732
+ p.options.color = _this63.options.colors[i % _this63.options.colors.length];
10462
10733
  }
10463
10734
  var pol = L.polygon(p.data.map(function (c) {
10464
10735
  return c.map(function (d) {
10465
10736
  return [d.Latitude, d.Longitude];
10466
10737
  });
10467
- }), p.options).addTo(_this61.map);
10468
- _this61.polygons.push(pol);
10469
- _this61.map.fitBounds(pol.getBounds());
10738
+ }), p.options).addTo(_this63.map);
10739
+ _this63.polygons.push(pol);
10740
+ _this63.map.fitBounds(pol.getBounds());
10470
10741
  });
10471
10742
  }
10472
10743
  // if (this.data.markers.length > 0) {