@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.
@@ -226,7 +226,7 @@ class PGHelper {
226
226
  return `${entity ? entity + '.' : ''}${parts[0]} < '${parts[1].replace('<', '')}'`
227
227
  }
228
228
  else if (parts[1].indexOf('%') !== -1) {
229
- return `${entity ? entity + '.' : ''}${parts[0]} LIKE '${parts[1]}'`
229
+ return `${entity ? entity + '.' : ''}LOWER(${parts[0]}) LIKE '${parts[1]}'`
230
230
  }
231
231
  else {
232
232
  return `${entity ? entity + '.' : ''}${parts[0]} = '${parts[1]}'`
@@ -5819,6 +5819,9 @@ class WebsyTable3 {
5819
5819
  // this.rowCount = this.data.length
5820
5820
  }
5821
5821
  buildBodyHtml (data = [], useWidths = false) {
5822
+ if (!this.options.columns) {
5823
+ return ''
5824
+ }
5822
5825
  if (data.length === 0) {
5823
5826
  return ''
5824
5827
  }
@@ -5923,6 +5926,9 @@ class WebsyTable3 {
5923
5926
  return bodyHtml
5924
5927
  }
5925
5928
  buildHeaderHtml (useWidths = false) {
5929
+ if (!this.options.columns) {
5930
+ return ''
5931
+ }
5926
5932
  let headerHtml = ''
5927
5933
  let sizingColumns = this.options.columns[this.options.columns.length - 1]
5928
5934
  if (useWidths === true) {
@@ -5981,7 +5987,8 @@ class WebsyTable3 {
5981
5987
  return headerHtml
5982
5988
  }
5983
5989
  buildSearchIcon (col, index) {
5984
- return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
5990
+ // return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
5991
+ return `<div class="websy-table-search-icon" data-col-index="${index}">
5985
5992
  <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>
5986
5993
  </div>`
5987
5994
  }
@@ -6308,7 +6315,7 @@ class WebsyTable3 {
6308
6315
  renderTotals () {
6309
6316
  let headEl = document.getElementById(`${this.elementId}_tableHeader`)
6310
6317
  let totalHtml = this.buildTotalHtml(true)
6311
- if (this.options.showTotalsAbove === true) {
6318
+ if (this.options.showTotalsAbove === true && headEl) {
6312
6319
  headEl.innerHTML += totalHtml
6313
6320
  }
6314
6321
  else {
@@ -7553,7 +7560,7 @@ function getLabelY (d, labelPosition = 'inside') {
7553
7560
  return this[yAxis](d.y.accumulative) + (this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1))
7554
7561
  }
7555
7562
  else {
7556
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4
7563
+ return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize)
7557
7564
  }
7558
7565
  }
7559
7566
  }
@@ -7633,11 +7640,11 @@ const drawSymbol = (size) => {
7633
7640
  // })
7634
7641
  .size(size || this.options.symbolSize)
7635
7642
  }
7636
- let xAxis = 'bottomAxis'
7637
- let yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis'
7643
+ let xAxis = 'bottom'
7644
+ let yAxis = series.axis === 'secondary' ? 'right' : 'left'
7638
7645
  if (this.options.orienation === 'horizontal') {
7639
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis'
7640
- yAxis = 'bottomAxis'
7646
+ xAxis = series.axis === 'secondary' ? 'right' : 'left'
7647
+ yAxis = 'bottom'
7641
7648
  }
7642
7649
  let symbols = this.symbolLayer.selectAll(`.symbol_${series.key}`)
7643
7650
  .data(series.data)
@@ -7650,19 +7657,23 @@ symbols.exit()
7650
7657
  symbols
7651
7658
  .attr('d', d => drawSymbol(d.y.size || series.symbolSize)(d))
7652
7659
  .transition(this.transition)
7653
- .attr('fill', 'white')
7660
+ .attr('fill', series.fillSymbols ? series.color : 'white')
7654
7661
  .attr('stroke', series.color)
7655
- .attr('transform', d => { return `translate(${this[xAxis](this.parseX(d.x.value))}, ${this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)})` })
7662
+ .attr('transform', d => {
7663
+ let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
7664
+ return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
7665
+ })
7656
7666
  // Enter
7657
7667
  symbols.enter()
7658
7668
  .append('path')
7659
7669
  .attr('d', d => drawSymbol(d.y.size || series.symbolSize)(d))
7660
7670
  // .transition(this.transition)
7661
- .attr('fill', 'white')
7671
+ .attr('fill', series.fillSymbols ? series.color : 'white')
7662
7672
  .attr('stroke', series.color)
7663
7673
  .attr('class', d => { return `symbol symbol_${series.key}` })
7664
7674
  .attr('transform', d => {
7665
- return `translate(${this[xAxis](this.parseX(d.x.value))}, ${this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)})`
7675
+ let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
7676
+ return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
7666
7677
  })
7667
7678
 
7668
7679
  }
@@ -6341,6 +6341,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
6341
6341
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6342
6342
  var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6343
6343
 
6344
+ if (!this.options.columns) {
6345
+ return '';
6346
+ }
6347
+
6344
6348
  if (data.length === 0) {
6345
6349
  return '';
6346
6350
  }
@@ -6437,6 +6441,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
6437
6441
  var _this38 = this;
6438
6442
 
6439
6443
  var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
6444
+
6445
+ if (!this.options.columns) {
6446
+ return '';
6447
+ }
6448
+
6440
6449
  var headerHtml = '';
6441
6450
  var sizingColumns = this.options.columns[this.options.columns.length - 1];
6442
6451
 
@@ -6497,7 +6506,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
6497
6506
  }, {
6498
6507
  key: "buildSearchIcon",
6499
6508
  value: function buildSearchIcon(col, index) {
6500
- 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>");
6509
+ // return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
6510
+ 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>");
6501
6511
  }
6502
6512
  }, {
6503
6513
  key: "buildTotalHtml",
@@ -6893,7 +6903,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
6893
6903
  var headEl = document.getElementById("".concat(this.elementId, "_tableHeader"));
6894
6904
  var totalHtml = this.buildTotalHtml(true);
6895
6905
 
6896
- if (this.options.showTotalsAbove === true) {
6906
+ if (this.options.showTotalsAbove === true && headEl) {
6897
6907
  headEl.innerHTML += totalHtml;
6898
6908
  } else {
6899
6909
  var footerEl = document.getElementById("".concat(this.elementId, "_tableFooter"));
@@ -8198,7 +8208,7 @@ var WebsyChart = /*#__PURE__*/function () {
8198
8208
  if (this.options.grouping === 'stacked') {
8199
8209
  return this[yAxis](d.y.accumulative) + this[yAxis](d.y.value) / (labelPosition === 'inside' ? 2 : 1);
8200
8210
  } else {
8201
- return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - 4;
8211
+ return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value) - (this.options.labelSize || this.options.fontSize);
8202
8212
  }
8203
8213
  }
8204
8214
  }
@@ -8269,12 +8279,12 @@ var WebsyChart = /*#__PURE__*/function () {
8269
8279
  .size(size || _this48.options.symbolSize);
8270
8280
  };
8271
8281
 
8272
- var xAxis = 'bottomAxis';
8273
- var yAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8282
+ var xAxis = 'bottom';
8283
+ var yAxis = series.axis === 'secondary' ? 'right' : 'left';
8274
8284
 
8275
8285
  if (this.options.orienation === 'horizontal') {
8276
- xAxis = series.axis === 'secondary' ? 'rightAxis' : 'leftAxis';
8277
- yAxis = 'bottomAxis';
8286
+ xAxis = series.axis === 'secondary' ? 'right' : 'left';
8287
+ yAxis = 'bottom';
8278
8288
  }
8279
8289
 
8280
8290
  var symbols = this.symbolLayer.selectAll(".symbol_".concat(series.key)).data(series.data); // Exit
@@ -8283,17 +8293,19 @@ var WebsyChart = /*#__PURE__*/function () {
8283
8293
 
8284
8294
  symbols.attr('d', function (d) {
8285
8295
  return drawSymbol(d.y.size || series.symbolSize)(d);
8286
- }).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
8287
- return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8296
+ }).transition(this.transition).attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('transform', function (d) {
8297
+ var adjustment = _this48.options.data[xAxis].scale === 'Time' ? 0 : _this48["".concat(xAxis, "Axis")].bandwidth() / 2;
8298
+ return "translate(".concat(_this48["".concat(xAxis, "Axis")](_this48.parseX(d.x.value)) + adjustment, ", ").concat(_this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8288
8299
  }); // Enter
8289
8300
 
8290
8301
  symbols.enter().append('path').attr('d', function (d) {
8291
8302
  return drawSymbol(d.y.size || series.symbolSize)(d);
8292
8303
  }) // .transition(this.transition)
8293
- .attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
8304
+ .attr('fill', series.fillSymbols ? series.color : 'white').attr('stroke', series.color).attr('class', function (d) {
8294
8305
  return "symbol symbol_".concat(series.key);
8295
8306
  }).attr('transform', function (d) {
8296
- return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
8307
+ var adjustment = _this48.options.data[xAxis].scale === 'Time' ? 0 : _this48["".concat(xAxis, "Axis")].bandwidth() / 2;
8308
+ return "translate(".concat(_this48["".concat(xAxis, "Axis")](_this48.parseX(d.x.value)) + adjustment, ", ").concat(_this48["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
8297
8309
  });
8298
8310
  }
8299
8311
  }, {