@websy/websy-designs 1.9.13 → 1.9.14
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.
- package/dist/server/utils.js +1 -1
- package/dist/websy-designs-es6.debug.js +59 -14
- package/dist/websy-designs-es6.js +53 -13
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +59 -14
- package/dist/websy-designs.js +53 -13
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/server/utils.js
CHANGED
|
@@ -12,6 +12,6 @@ module.exports = {
|
|
|
12
12
|
const rect = el.getBoundingClientRect()
|
|
13
13
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
|
|
14
14
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
|
15
|
-
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
|
|
15
|
+
return { top: rect.top + scrollTop, left: rect.left + scrollLeft, width: rect.width, height: rect.height }
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1696,7 +1696,20 @@ class WebsyDropdown {
|
|
|
1696
1696
|
const maskEl = document.getElementById(`${this.elementId}_mask`)
|
|
1697
1697
|
const contentEl = document.getElementById(`${this.elementId}_content`)
|
|
1698
1698
|
const scrollEl = document.getElementById(`${this.elementId}_itemsContainer`)
|
|
1699
|
-
const actionEl = document.getElementById(`${this.elementId}_actionContainer`)
|
|
1699
|
+
const actionEl = document.getElementById(`${this.elementId}_actionContainer`)
|
|
1700
|
+
const headerEl = document.getElementById(`${this.elementId}_header`)
|
|
1701
|
+
const headerPos = WebsyUtils.getElementPos(headerEl)
|
|
1702
|
+
const contentPos = WebsyUtils.getElementPos(contentEl)
|
|
1703
|
+
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1704
|
+
contentEl.style.right = 'unset'
|
|
1705
|
+
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1706
|
+
// contentEl.classList.add('on-top')
|
|
1707
|
+
contentEl.style.bottom = 'unset'
|
|
1708
|
+
}
|
|
1709
|
+
else {
|
|
1710
|
+
contentEl.style.top = 'unset'
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1700
1713
|
if (actionEl) {
|
|
1701
1714
|
actionEl.classList.remove('active')
|
|
1702
1715
|
}
|
|
@@ -1720,7 +1733,7 @@ class WebsyDropdown {
|
|
|
1720
1733
|
return
|
|
1721
1734
|
}
|
|
1722
1735
|
if (event.target.classList.contains('websy-dropdown-header')) {
|
|
1723
|
-
this.open()
|
|
1736
|
+
this.open(event)
|
|
1724
1737
|
}
|
|
1725
1738
|
else if (event.target.classList.contains('websy-dropdown-mask')) {
|
|
1726
1739
|
this.close()
|
|
@@ -1835,17 +1848,27 @@ class WebsyDropdown {
|
|
|
1835
1848
|
}
|
|
1836
1849
|
}
|
|
1837
1850
|
}
|
|
1838
|
-
open (
|
|
1851
|
+
open (event, override = false) {
|
|
1839
1852
|
const maskEl = document.getElementById(`${this.elementId}_mask`)
|
|
1840
1853
|
const contentEl = document.getElementById(`${this.elementId}_content`)
|
|
1841
|
-
const
|
|
1842
|
-
if (el) {
|
|
1843
|
-
el.style.zIndex = 999
|
|
1844
|
-
}
|
|
1854
|
+
const headerEl = document.getElementById(`${this.elementId}_header`)
|
|
1845
1855
|
maskEl.classList.add('active')
|
|
1846
1856
|
contentEl.classList.add('active')
|
|
1847
|
-
|
|
1848
|
-
|
|
1857
|
+
const headerPos = WebsyUtils.getElementPos(headerEl)
|
|
1858
|
+
const contentPos = WebsyUtils.getElementPos(contentEl)
|
|
1859
|
+
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1860
|
+
contentEl.style.right = `calc(100vw - ${headerPos.right}px)`
|
|
1861
|
+
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1862
|
+
// contentEl.classList.add('on-top')
|
|
1863
|
+
contentEl.style.bottom = `calc(100vh - ${headerPos.top}px)`
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
contentEl.style.top = headerPos.bottom + 'px'
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
|
|
1870
|
+
const targetPos = WebsyUtils.getElementPos(event.target)
|
|
1871
|
+
contentEl.style.right = `calc(100vw - ${targetPos.right}px)`
|
|
1849
1872
|
}
|
|
1850
1873
|
if (this.options.disableSearch !== true) {
|
|
1851
1874
|
const searchEl = document.getElementById(`${this.elementId}_search`)
|
|
@@ -5107,7 +5130,9 @@ const WebsyUtils = {
|
|
|
5107
5130
|
top: rect.top + scrollTop,
|
|
5108
5131
|
left: rect.left + scrollLeft,
|
|
5109
5132
|
bottom: rect.top + scrollTop + el.clientHeight,
|
|
5110
|
-
right: rect.left + scrollLeft + el.clientWidth
|
|
5133
|
+
right: rect.left + scrollLeft + el.clientWidth,
|
|
5134
|
+
width: rect.width,
|
|
5135
|
+
height: rect.height
|
|
5111
5136
|
}
|
|
5112
5137
|
},
|
|
5113
5138
|
getLightDark: (backgroundColor, darkColor = '#000000', lightColor = '#ffffff') => {
|
|
@@ -6428,7 +6453,7 @@ class WebsyTable3 {
|
|
|
6428
6453
|
row.forEach((cell, cellIndex) => {
|
|
6429
6454
|
let sizeIndex = cell.level || cellIndex
|
|
6430
6455
|
let colIndex = cell.index || cellIndex
|
|
6431
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6456
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || this.options.columns[this.options.columns.length - 1][colIndex].show === false) {
|
|
6432
6457
|
return // need to revisit this logic
|
|
6433
6458
|
}
|
|
6434
6459
|
let style = ''
|
|
@@ -9420,6 +9445,14 @@ symbols
|
|
|
9420
9445
|
if (this.options.data[xAxis].scale === 'Time') {
|
|
9421
9446
|
xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
9422
9447
|
}
|
|
9448
|
+
else {
|
|
9449
|
+
let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
|
|
9450
|
+
let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
|
|
9451
|
+
if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
|
|
9452
|
+
xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
|
|
9453
|
+
}
|
|
9454
|
+
// return xPos
|
|
9455
|
+
}
|
|
9423
9456
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9424
9457
|
return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9425
9458
|
}
|
|
@@ -9446,6 +9479,14 @@ symbols.enter()
|
|
|
9446
9479
|
if (this.options.data[xAxis].scale === 'Time') {
|
|
9447
9480
|
xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
9448
9481
|
}
|
|
9482
|
+
else {
|
|
9483
|
+
let xIndex = this[xAxis + 'Axis'].domain().indexOf(d.x.value)
|
|
9484
|
+
let xPos = this[`custom${xAxis.toInitialCaps()}Range`][xIndex]
|
|
9485
|
+
if (this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1]) {
|
|
9486
|
+
xPos = xPos + ((this[`custom${xAxis.toInitialCaps()}Range`][xIndex + 1] - xPos) / 2)
|
|
9487
|
+
}
|
|
9488
|
+
// return xPos
|
|
9489
|
+
}
|
|
9449
9490
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9450
9491
|
return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9451
9492
|
}
|
|
@@ -9696,8 +9737,12 @@ class WebsyKPI {
|
|
|
9696
9737
|
constructor (elementId, options) {
|
|
9697
9738
|
const DEFAULTS = {
|
|
9698
9739
|
tooltip: {},
|
|
9699
|
-
label: {
|
|
9700
|
-
|
|
9740
|
+
label: {
|
|
9741
|
+
value: ''
|
|
9742
|
+
},
|
|
9743
|
+
value: {
|
|
9744
|
+
value: ''
|
|
9745
|
+
}
|
|
9701
9746
|
}
|
|
9702
9747
|
this.elementId = elementId
|
|
9703
9748
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -9733,7 +9778,7 @@ class WebsyKPI {
|
|
|
9733
9778
|
html += `
|
|
9734
9779
|
<div class="websy-kpi-info">
|
|
9735
9780
|
<div class="websy-kpi-label ${this.options.label.classes.join(' ') || ''}">
|
|
9736
|
-
${this.options.label.value || ''}
|
|
9781
|
+
${(this.options.label || {}).value || ''}
|
|
9737
9782
|
`
|
|
9738
9783
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
9739
9784
|
html += `
|
|
@@ -1667,6 +1667,18 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1667
1667
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1668
1668
|
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1669
1669
|
var actionEl = document.getElementById("".concat(this.elementId, "_actionContainer"));
|
|
1670
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1671
|
+
var headerPos = WebsyUtils.getElementPos(headerEl);
|
|
1672
|
+
var contentPos = WebsyUtils.getElementPos(contentEl);
|
|
1673
|
+
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1674
|
+
contentEl.style.right = 'unset';
|
|
1675
|
+
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1676
|
+
// contentEl.classList.add('on-top')
|
|
1677
|
+
contentEl.style.bottom = 'unset';
|
|
1678
|
+
} else {
|
|
1679
|
+
contentEl.style.top = 'unset';
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1670
1682
|
if (actionEl) {
|
|
1671
1683
|
actionEl.classList.remove('active');
|
|
1672
1684
|
}
|
|
@@ -1692,7 +1704,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1692
1704
|
return;
|
|
1693
1705
|
}
|
|
1694
1706
|
if (event.target.classList.contains('websy-dropdown-header')) {
|
|
1695
|
-
this.open();
|
|
1707
|
+
this.open(event);
|
|
1696
1708
|
} else if (event.target.classList.contains('websy-dropdown-mask')) {
|
|
1697
1709
|
this.close();
|
|
1698
1710
|
} else if (event.target.classList.contains('websy-dropdown-item')) {
|
|
@@ -1806,18 +1818,26 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1806
1818
|
}
|
|
1807
1819
|
}, {
|
|
1808
1820
|
key: "open",
|
|
1809
|
-
value: function open(
|
|
1821
|
+
value: function open(event) {
|
|
1810
1822
|
var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1811
1823
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1812
1824
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1813
|
-
var
|
|
1814
|
-
if (el) {
|
|
1815
|
-
el.style.zIndex = 999;
|
|
1816
|
-
}
|
|
1825
|
+
var headerEl = document.getElementById("".concat(this.elementId, "_header"));
|
|
1817
1826
|
maskEl.classList.add('active');
|
|
1818
1827
|
contentEl.classList.add('active');
|
|
1819
|
-
|
|
1820
|
-
|
|
1828
|
+
var headerPos = WebsyUtils.getElementPos(headerEl);
|
|
1829
|
+
var contentPos = WebsyUtils.getElementPos(contentEl);
|
|
1830
|
+
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1831
|
+
contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
|
|
1832
|
+
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
1833
|
+
// contentEl.classList.add('on-top')
|
|
1834
|
+
contentEl.style.bottom = "calc(100vh - ".concat(headerPos.top, "px)");
|
|
1835
|
+
} else {
|
|
1836
|
+
contentEl.style.top = headerPos.bottom + 'px';
|
|
1837
|
+
}
|
|
1838
|
+
} else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
|
|
1839
|
+
var targetPos = WebsyUtils.getElementPos(event.target);
|
|
1840
|
+
contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
|
|
1821
1841
|
}
|
|
1822
1842
|
if (this.options.disableSearch !== true) {
|
|
1823
1843
|
var searchEl = document.getElementById("".concat(this.elementId, "_search"));
|
|
@@ -4945,7 +4965,9 @@ var WebsyUtils = {
|
|
|
4945
4965
|
top: rect.top + scrollTop,
|
|
4946
4966
|
left: rect.left + scrollLeft,
|
|
4947
4967
|
bottom: rect.top + scrollTop + el.clientHeight,
|
|
4948
|
-
right: rect.left + scrollLeft + el.clientWidth
|
|
4968
|
+
right: rect.left + scrollLeft + el.clientWidth,
|
|
4969
|
+
width: rect.width,
|
|
4970
|
+
height: rect.height
|
|
4949
4971
|
};
|
|
4950
4972
|
},
|
|
4951
4973
|
getLightDark: function getLightDark(backgroundColor) {
|
|
@@ -6123,7 +6145,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6123
6145
|
row.forEach(function (cell, cellIndex) {
|
|
6124
6146
|
var sizeIndex = cell.level || cellIndex;
|
|
6125
6147
|
var colIndex = cell.index || cellIndex;
|
|
6126
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6148
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this40.options.columns[_this40.options.columns.length - 1][colIndex].show === false) {
|
|
6127
6149
|
return; // need to revisit this logic
|
|
6128
6150
|
}
|
|
6129
6151
|
|
|
@@ -8889,6 +8911,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8889
8911
|
} else {
|
|
8890
8912
|
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8891
8913
|
xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
|
|
8914
|
+
} else {
|
|
8915
|
+
var _xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8916
|
+
var _xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
8917
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
8918
|
+
_xPos = _xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
8919
|
+
}
|
|
8920
|
+
// return xPos
|
|
8892
8921
|
}
|
|
8893
8922
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8894
8923
|
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
@@ -8917,6 +8946,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8917
8946
|
} else {
|
|
8918
8947
|
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8919
8948
|
xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
|
|
8949
|
+
} else {
|
|
8950
|
+
var _xIndex2 = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8951
|
+
var _xPos2 = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
8952
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
8953
|
+
_xPos2 = _xPos2 + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
8954
|
+
}
|
|
8955
|
+
// return xPos
|
|
8920
8956
|
}
|
|
8921
8957
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8922
8958
|
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
@@ -9162,8 +9198,12 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
9162
9198
|
_classCallCheck(this, WebsyKPI);
|
|
9163
9199
|
var DEFAULTS = {
|
|
9164
9200
|
tooltip: {},
|
|
9165
|
-
label: {
|
|
9166
|
-
|
|
9201
|
+
label: {
|
|
9202
|
+
value: ''
|
|
9203
|
+
},
|
|
9204
|
+
value: {
|
|
9205
|
+
value: ''
|
|
9206
|
+
}
|
|
9167
9207
|
};
|
|
9168
9208
|
this.elementId = elementId;
|
|
9169
9209
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -9196,7 +9236,7 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
9196
9236
|
if (this.options.icon) {
|
|
9197
9237
|
html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
|
|
9198
9238
|
}
|
|
9199
|
-
html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n ").concat(this.options.label.value || '', "\n ");
|
|
9239
|
+
html += " \n <div class=\"websy-kpi-info\">\n <div class=\"websy-kpi-label ".concat(this.options.label.classes.join(' ') || '', "\">\n ").concat((this.options.label || {}).value || '', "\n ");
|
|
9200
9240
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
9201
9241
|
html += "\n <div class=\"websy-info ".concat(this.options.tooltip.classes.join(' ') || '', "\" data-info=\"").concat(this.options.tooltip.value, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-e</title><path d=\"M256,56C145.72,56,56,145.72,56,256s89.72,200,200,200,200-89.72,200-200S366.28,56,256,56Zm0,82a26,26,0,1,1-26,26A26,26,0,0,1,256,138Zm48,226H216a16,16,0,0,1,0-32h28V244H228a16,16,0,0,1,0-32h32a16,16,0,0,1,16,16V332h28a16,16,0,0,1,0,32Z\"/></svg>\n </div> \n ");
|
|
9202
9242
|
}
|