@websy/websy-designs 1.4.20 → 1.4.22

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.
@@ -4687,6 +4687,13 @@ class WebsySearch {
4687
4687
  }
4688
4688
  }
4689
4689
  }
4690
+ get text () {
4691
+ const el = document.getElementById(`${this.elementId}_search`)
4692
+ if (el) {
4693
+ return el.value
4694
+ }
4695
+ return ''
4696
+ }
4690
4697
  set text (text) {
4691
4698
  const el = document.getElementById(`${this.elementId}_search`)
4692
4699
  if (el) {
@@ -6220,6 +6227,9 @@ class WebsyTable3 {
6220
6227
  // this.rowCount = this.data.length
6221
6228
  }
6222
6229
  buildBodyHtml (data = [], useWidths = false) {
6230
+ if (!this.options.columns) {
6231
+ return ''
6232
+ }
6223
6233
  if (data.length === 0) {
6224
6234
  return ''
6225
6235
  }
@@ -6324,6 +6334,9 @@ class WebsyTable3 {
6324
6334
  return bodyHtml
6325
6335
  }
6326
6336
  buildHeaderHtml (useWidths = false) {
6337
+ if (!this.options.columns) {
6338
+ return ''
6339
+ }
6327
6340
  let headerHtml = ''
6328
6341
  let sizingColumns = this.options.columns[this.options.columns.length - 1]
6329
6342
  if (useWidths === true) {
@@ -6382,7 +6395,8 @@ class WebsyTable3 {
6382
6395
  return headerHtml
6383
6396
  }
6384
6397
  buildSearchIcon (col, index) {
6385
- return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
6398
+ // return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
6399
+ return `<div class="websy-table-search-icon" data-col-index="${index}">
6386
6400
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-f</title><path d="M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z" style="fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px"/><line x1="338.29" y1="338.29" x2="448" y2="448" style="fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px"/></svg>
6387
6401
  </div>`
6388
6402
  }
@@ -6709,7 +6723,7 @@ class WebsyTable3 {
6709
6723
  renderTotals () {
6710
6724
  let headEl = document.getElementById(`${this.elementId}_tableHeader`)
6711
6725
  let totalHtml = this.buildTotalHtml(true)
6712
- if (this.options.showTotalsAbove === true) {
6726
+ if (this.options.showTotalsAbove === true && headEl) {
6713
6727
  headEl.innerHTML += totalHtml
6714
6728
  }
6715
6729
  else {
@@ -7954,7 +7968,7 @@ function getLabelY (d, labelPosition = 'inside') {
7954
7968
  return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
7955
7969
  }
7956
7970
  else {
7957
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4
7971
+ return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize)
7958
7972
  }
7959
7973
  }
7960
7974
  }
@@ -8034,11 +8048,11 @@ const drawSymbol = (size) => {
8034
8048
  // })
8035
8049
  .size(size || this.options.symbolSize)
8036
8050
  }
8037
- let xAxis = 'bottomAxis'
8038
- let yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis'
8051
+ let xAxis = 'bottom'
8052
+ let yAxis = series.axis === 'secondary' ? 'right' : 'left'
8039
8053
  if (this.options.orienation === 'horizontal') {
8040
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis'
8041
- yAxis = 'bottomAxis'
8054
+ xAxis = series.axis === 'secondary' ? 'right' : 'left'
8055
+ yAxis = 'bottom'
8042
8056
  }
8043
8057
  let symbols = this.symbolLayer.selectAll(`.symbol_${series.key}`)
8044
8058
  .data(series.data)
@@ -8051,19 +8065,23 @@ symbols.exit()
8051
8065
  symbols
8052
8066
  .attr('d', d => drawSymbol(d.y.size || series.symbolSize)(d))
8053
8067
  .transition(this.transition)
8054
- .attr('fill', 'white')
8068
+ .attr('fill', series.fillSymbols ? series.color : 'white')
8055
8069
  .attr('stroke', series.color)
8056
- .attr('transform', d => { return `translate(${this[xAxis](this.parseX(d.x.value))}, ${this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)})` })
8070
+ .attr('transform', d => {
8071
+ let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
8072
+ return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8073
+ })
8057
8074
  // Enter
8058
8075
  symbols.enter()
8059
8076
  .append('path')
8060
8077
  .attr('d', d => drawSymbol(d.y.size || series.symbolSize)(d))
8061
8078
  // .transition(this.transition)
8062
- .attr('fill', 'white')
8079
+ .attr('fill', series.fillSymbols ? series.color : 'white')
8063
8080
  .attr('stroke', series.color)
8064
8081
  .attr('class', d => { return `symbol symbol_${series.key}` })
8065
8082
  .attr('transform', d => {
8066
- return `translate(${this[xAxis](this.parseX(d.x.value))}, ${this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)})`
8083
+ let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
8084
+ return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
8067
8085
  })
8068
8086
 
8069
8087
  }
@@ -5186,6 +5186,15 @@ var WebsySearch = /*#__PURE__*/function () {
5186
5186
  }
5187
5187
  }, {
5188
5188
  key: "text",
5189
+ get: function get() {
5190
+ var el = document.getElementById("".concat(this.elementId, "_search"));
5191
+
5192
+ if (el) {
5193
+ return el.value;
5194
+ }
5195
+
5196
+ return '';
5197
+ },
5189
5198
  set: function set(text) {
5190
5199
  var el = document.getElementById("".concat(this.elementId, "_search"));
5191
5200
 
@@ -6803,6 +6812,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6803
6812
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6804
6813
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6805
6814
 
6815
+ if (!this.options.columns) {
6816
+ return '';
6817
+ }
6818
+
6806
6819
  if (data.length === 0) {
6807
6820
  return '';
6808
6821
  }
@@ -6899,6 +6912,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6899
6912
  var _this41 = this;
6900
6913
 
6901
6914
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6915
+
6916
+ if (!this.options.columns) {
6917
+ return '';
6918
+ }
6919
+
6902
6920
  var headerHtml = '';
6903
6921
  var sizingColumns = this.options.columns[this.options.columns.length - 1];
6904
6922
 
@@ -6959,7 +6977,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6959
6977
  }, {
6960
6978
  key: "buildSearchIcon",
6961
6979
  value: function buildSearchIcon(col, index) {
6962
- return "<div class=\"websy-table-search-icon\" data-col-id=\"".concat(col.dimId, "\" data-col-index=\"").concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>");
6980
+ // return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
6981
+ return "<div class=\"websy-table-search-icon\" data-col-index=\"".concat(index, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-f</title><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>\n </div>");
6963
6982
  }
6964
6983
  }, {
6965
6984
  key: "buildTotalHtml",
@@ -7355,7 +7374,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
7355
7374
  var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
7356
7375
  var totalHtml = this.buildTotalHtml(true);
7357
7376
 
7358
- if (this.options.showTotalsAbove === true) {
7377
+ if (this.options.showTotalsAbove === true && headEl) {
7359
7378
  headEl.innerHTML += totalHtml;
7360
7379
  } else {
7361
7380
  var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
@@ -8660,7 +8679,7 @@ var WebsyChart = /*#__PURE__*/function () {
8660
8679
  if (this.options.grouping === 'stacked') {
8661
8680
  return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
8662
8681
  } else {
8663
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4;
8682
+ return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
8664
8683
  }
8665
8684
  }
8666
8685
  }
@@ -8731,12 +8750,12 @@ var WebsyChart = /*#__PURE__*/function () {
8731
8750
  .size(size || _this51.options.symbolSize);
8732
8751
  };
8733
8752
 
8734
- var xAxis = 'bottomAxis';
8735
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8753
+ var xAxis = 'bottom';
8754
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8736
8755
 
8737
8756
  if (this.options.orienation === 'horizontal') {
8738
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8739
- yAxis = 'bottomAxis';
8757
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8758
+ yAxis = 'bottom';
8740
8759
  }
8741
8760
 
8742
8761
  var symbols = this.symbolLayer.selectAll(".symbol_".concat(series.key)).data(series.data); // Exit
@@ -8745,17 +8764,19 @@ var WebsyChart = /*#__PURE__*/function () {
8745
8764
 
8746
8765
  symbols.attr('d', function (d) {
8747
8766
  return drawSymbol(d.y.size || series.symbolSize)(d);
8748
- }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
8749
- return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8767
+ }).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
8768
+ var adjustment = _this51.options.data[xAxis].scale === 'Time' ? 0 : _this51["".concat(xAxis, "Axis")].bandwidth() / 2;
8769
+ return "translate(".concat(_this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value)) + adjustment, ", ").concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8750
8770
  }); // Enter
8751
8771
 
8752
8772
  symbols.enter().append('path').attr('d', function (d) {
8753
8773
  return drawSymbol(d.y.size || series.symbolSize)(d);
8754
8774
  }) // .transition(this.transition)
8755
- .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
8775
+ .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
8756
8776
  return "symbol symbol_".concat(series.key);
8757
8777
  }).attr('transform', function (d) {
8758
- return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8778
+ var adjustment = _this51.options.data[xAxis].scale === 'Time' ? 0 : _this51["".concat(xAxis, "Axis")].bandwidth() / 2;
8779
+ return "translate(".concat(_this51["".concat(xAxis, "Axis")](_this51.parseX(d.x.value)) + adjustment, ", ").concat(_this51["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8759
8780
  });
8760
8781
  }
8761
8782
  }, {