@websy/websy-designs 1.9.12 → 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/routes/v1/shop.js +2 -1
- package/dist/server/utils.js +1 -1
- package/dist/websy-designs-es6.debug.js +126 -31
- package/dist/websy-designs-es6.js +116 -29
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +126 -31
- package/dist/websy-designs.js +116 -29
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -197,7 +197,8 @@ function ShopRoutes (dbHelper, engine, app) {
|
|
|
197
197
|
basket.items = JSON.parse(basket.items)
|
|
198
198
|
}
|
|
199
199
|
catch (error) {
|
|
200
|
-
console.log(
|
|
200
|
+
console.log(`Unable to parse basket items for ${req.session.user.id}`)
|
|
201
|
+
console.log(`Basket items has a type of ${typeof basket.items}`)
|
|
201
202
|
console.log(basket.items)
|
|
202
203
|
}
|
|
203
204
|
}
|
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') => {
|
|
@@ -6278,7 +6303,8 @@ class WebsyTable3 {
|
|
|
6278
6303
|
disableInternalLoader: false,
|
|
6279
6304
|
disableTouch: false,
|
|
6280
6305
|
scrollWidth: 10,
|
|
6281
|
-
touchScrollWidth: 30
|
|
6306
|
+
touchScrollWidth: 30,
|
|
6307
|
+
autoFitColumns: true
|
|
6282
6308
|
}
|
|
6283
6309
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
6284
6310
|
this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
|
|
@@ -6427,7 +6453,7 @@ class WebsyTable3 {
|
|
|
6427
6453
|
row.forEach((cell, cellIndex) => {
|
|
6428
6454
|
let sizeIndex = cell.level || cellIndex
|
|
6429
6455
|
let colIndex = cell.index || cellIndex
|
|
6430
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6456
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || this.options.columns[this.options.columns.length - 1][colIndex].show === false) {
|
|
6431
6457
|
return // need to revisit this logic
|
|
6432
6458
|
}
|
|
6433
6459
|
let style = ''
|
|
@@ -6656,7 +6682,7 @@ class WebsyTable3 {
|
|
|
6656
6682
|
maxWidth = this.options.maxColWidth
|
|
6657
6683
|
}
|
|
6658
6684
|
else if (this.options.maxColWidth.indexOf('%') !== -1) {
|
|
6659
|
-
maxWidth = this.sizes.
|
|
6685
|
+
maxWidth = this.sizes.table.width * (+(this.options.maxColWidth.replace('%', '')) / 100)
|
|
6660
6686
|
}
|
|
6661
6687
|
else if (this.options.maxColWidth.indexOf('px') !== -1) {
|
|
6662
6688
|
maxWidth = +this.options.maxColWidth.replace('px', '')
|
|
@@ -6669,7 +6695,7 @@ class WebsyTable3 {
|
|
|
6669
6695
|
this.sizes.total = footerEl.getBoundingClientRect()
|
|
6670
6696
|
const rows = Array.from(tableEl.querySelectorAll('.websy-table-row'))
|
|
6671
6697
|
let totalWidth = 0
|
|
6672
|
-
this.sizes.scrollableWidth = this.sizes.
|
|
6698
|
+
this.sizes.scrollableWidth = this.sizes.table.width
|
|
6673
6699
|
let firstNonPinnedColumnWidth = 0
|
|
6674
6700
|
let columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(c => c.show !== false)
|
|
6675
6701
|
rows.forEach((row, rowIndex) => {
|
|
@@ -6678,8 +6704,10 @@ class WebsyTable3 {
|
|
|
6678
6704
|
this.sizes.cellHeight = colSize.height
|
|
6679
6705
|
if (columnsForSizing[colIndex]) {
|
|
6680
6706
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6707
|
+
columnsForSizing[colIndex].potentialWidth = 0
|
|
6681
6708
|
columnsForSizing[colIndex].actualWidth = 0
|
|
6682
6709
|
}
|
|
6710
|
+
columnsForSizing[colIndex].potentialWidth = Math.max(columnsForSizing[colIndex].potentialWidth, colSize.width)
|
|
6683
6711
|
columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth)
|
|
6684
6712
|
// if (columnsForSizing[colIndex].width) {
|
|
6685
6713
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
@@ -6699,19 +6727,53 @@ class WebsyTable3 {
|
|
|
6699
6727
|
this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
6700
6728
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
6701
6729
|
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
|
|
6702
|
-
// const outerSize = outerEl.getBoundingClientRect()
|
|
6703
|
-
if (this.sizes.totalWidth < this.sizes.
|
|
6704
|
-
let
|
|
6730
|
+
// const outerSize = outerEl.getBoundingClientRect()
|
|
6731
|
+
if (this.sizes.totalWidth < this.sizes.table.width) {
|
|
6732
|
+
let requiredSpace = 0
|
|
6733
|
+
let availableSpace = (this.sizes.table.width - this.sizes.totalWidth)
|
|
6734
|
+
columnsForSizing.forEach(c => {
|
|
6735
|
+
c.shouldGrow = true
|
|
6736
|
+
if (this.options.autoFitColumns === false) {
|
|
6737
|
+
c.shouldGrow = false
|
|
6738
|
+
if (c.potentialWidth > c.actualWidth) {
|
|
6739
|
+
c.shouldGrow = true
|
|
6740
|
+
c.growDiff = c.potentialWidth - c.actualWidth
|
|
6741
|
+
c.growDiffPerc = (c.potentialWidth - c.actualWidth) / availableSpace
|
|
6742
|
+
requiredSpace += c.growDiff
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
})
|
|
6746
|
+
let equalWidth = (this.sizes.table.width - this.sizes.totalWidth) / columnsForSizing.filter(c => c.shouldGrow).length
|
|
6705
6747
|
this.sizes.totalWidth = 0
|
|
6706
6748
|
this.sizes.totalNonPinnedWidth = 0
|
|
6707
6749
|
columnsForSizing.forEach((c, i) => {
|
|
6708
6750
|
// if (!c.width) {
|
|
6709
6751
|
// if (c.actualWidth < equalWidth) {
|
|
6710
6752
|
// adjust the width
|
|
6711
|
-
if (
|
|
6712
|
-
c.width
|
|
6753
|
+
if (this.options.autoFitColumns === true) {
|
|
6754
|
+
if (c.width) {
|
|
6755
|
+
c.width += equalWidth
|
|
6756
|
+
}
|
|
6757
|
+
c.actualWidth += equalWidth
|
|
6758
|
+
}
|
|
6759
|
+
else {
|
|
6760
|
+
if (requiredSpace > 0 && requiredSpace <= availableSpace) {
|
|
6761
|
+
if (c.shouldGrow) {
|
|
6762
|
+
if (c.width) {
|
|
6763
|
+
c.width += c.growDiff
|
|
6764
|
+
}
|
|
6765
|
+
c.actualWidth += c.growDiff
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
else {
|
|
6769
|
+
if (c.shouldGrow) {
|
|
6770
|
+
if (c.width) {
|
|
6771
|
+
c.width += availableSpace * (c.growDiff / requiredSpace)
|
|
6772
|
+
}
|
|
6773
|
+
c.actualWidth += availableSpace * (c.growDiff / requiredSpace)
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6713
6776
|
}
|
|
6714
|
-
c.actualWidth += equalWidth
|
|
6715
6777
|
// }
|
|
6716
6778
|
// }
|
|
6717
6779
|
this.sizes.totalWidth += c.width || c.actualWidth
|
|
@@ -6722,9 +6784,9 @@ class WebsyTable3 {
|
|
|
6722
6784
|
})
|
|
6723
6785
|
}
|
|
6724
6786
|
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
6725
|
-
if (this.sizes.pinnedWidth > (this.sizes.
|
|
6787
|
+
if (this.sizes.pinnedWidth > (this.sizes.table.width - firstNonPinnedColumnWidth)) {
|
|
6726
6788
|
this.sizes.totalWidth = 0
|
|
6727
|
-
let diff = this.sizes.pinnedWidth - (this.sizes.
|
|
6789
|
+
let diff = this.sizes.pinnedWidth - (this.sizes.table.width - firstNonPinnedColumnWidth)
|
|
6728
6790
|
let oldPinnedWidth = this.sizes.pinnedWidth
|
|
6729
6791
|
this.sizes.pinnedWidth = 0
|
|
6730
6792
|
// let colDiff = diff / this.pinnedColumns
|
|
@@ -6762,7 +6824,7 @@ class WebsyTable3 {
|
|
|
6762
6824
|
else {
|
|
6763
6825
|
this.vScrollRequired = false
|
|
6764
6826
|
}
|
|
6765
|
-
if (this.sizes.totalWidth > this.sizes.
|
|
6827
|
+
if (this.sizes.totalWidth.toFixed(3) > this.sizes.table.width.toFixed(3)) {
|
|
6766
6828
|
this.hScrollRequired = true
|
|
6767
6829
|
}
|
|
6768
6830
|
else {
|
|
@@ -7127,7 +7189,6 @@ class WebsyTable3 {
|
|
|
7127
7189
|
let vHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
7128
7190
|
if (this.vScrollRequired === true) {
|
|
7129
7191
|
vScrollEl.style.top = `${this.sizes.header.height + this.sizes.total.height}px`
|
|
7130
|
-
// vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
|
|
7131
7192
|
vScrollEl.style.height = `${this.sizes.bodyHeight}px`
|
|
7132
7193
|
if (this.isTouchDevice === true) {
|
|
7133
7194
|
vScrollEl.style.visibility = `unset`
|
|
@@ -7240,7 +7301,8 @@ class WebsyTable3 {
|
|
|
7240
7301
|
}
|
|
7241
7302
|
}
|
|
7242
7303
|
}
|
|
7243
|
-
cumulativeWidth = 0
|
|
7304
|
+
cumulativeWidth = 0
|
|
7305
|
+
let lastColWidth = 0
|
|
7244
7306
|
for (let i = this.startCol; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
7245
7307
|
if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
|
|
7246
7308
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
@@ -7255,9 +7317,22 @@ class WebsyTable3 {
|
|
|
7255
7317
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
7256
7318
|
this.startCol += 1
|
|
7257
7319
|
}
|
|
7258
|
-
if (
|
|
7259
|
-
|
|
7260
|
-
|
|
7320
|
+
if (
|
|
7321
|
+
scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >=
|
|
7322
|
+
scrollContainerEl.offsetWidth - lastColWidth
|
|
7323
|
+
) {
|
|
7324
|
+
this.endCol = this.options.allColumns[this.options.allColumns.length - 1].length - 1
|
|
7325
|
+
this.startCol = this.endCol + 1
|
|
7326
|
+
// one last measurement
|
|
7327
|
+
let finalAcc = 0
|
|
7328
|
+
for (let i = this.endCol; i > -1; i--) {
|
|
7329
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
|
|
7330
|
+
finalAcc += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
7331
|
+
if (finalAcc < this.sizes.scrollableWidth) {
|
|
7332
|
+
this.startCol--
|
|
7333
|
+
}
|
|
7334
|
+
}
|
|
7335
|
+
}
|
|
7261
7336
|
}
|
|
7262
7337
|
this.endCol = Math.max(this.startCol, this.endCol)
|
|
7263
7338
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
@@ -9370,6 +9445,14 @@ symbols
|
|
|
9370
9445
|
if (this.options.data[xAxis].scale === 'Time') {
|
|
9371
9446
|
xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
9372
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
|
+
}
|
|
9373
9456
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9374
9457
|
return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9375
9458
|
}
|
|
@@ -9396,6 +9479,14 @@ symbols.enter()
|
|
|
9396
9479
|
if (this.options.data[xAxis].scale === 'Time') {
|
|
9397
9480
|
xPos = this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
9398
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
|
+
}
|
|
9399
9490
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9400
9491
|
return `translate(${xPos}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9401
9492
|
}
|
|
@@ -9646,8 +9737,12 @@ class WebsyKPI {
|
|
|
9646
9737
|
constructor (elementId, options) {
|
|
9647
9738
|
const DEFAULTS = {
|
|
9648
9739
|
tooltip: {},
|
|
9649
|
-
label: {
|
|
9650
|
-
|
|
9740
|
+
label: {
|
|
9741
|
+
value: ''
|
|
9742
|
+
},
|
|
9743
|
+
value: {
|
|
9744
|
+
value: ''
|
|
9745
|
+
}
|
|
9651
9746
|
}
|
|
9652
9747
|
this.elementId = elementId
|
|
9653
9748
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
@@ -9683,7 +9778,7 @@ class WebsyKPI {
|
|
|
9683
9778
|
html += `
|
|
9684
9779
|
<div class="websy-kpi-info">
|
|
9685
9780
|
<div class="websy-kpi-label ${this.options.label.classes.join(' ') || ''}">
|
|
9686
|
-
${this.options.label.value || ''}
|
|
9781
|
+
${(this.options.label || {}).value || ''}
|
|
9687
9782
|
`
|
|
9688
9783
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
9689
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) {
|
|
@@ -5999,7 +6021,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5999
6021
|
disableInternalLoader: false,
|
|
6000
6022
|
disableTouch: false,
|
|
6001
6023
|
scrollWidth: 10,
|
|
6002
|
-
touchScrollWidth: 30
|
|
6024
|
+
touchScrollWidth: 30,
|
|
6025
|
+
autoFitColumns: true
|
|
6003
6026
|
};
|
|
6004
6027
|
this.options = _extends({}, DEFAULTS, options);
|
|
6005
6028
|
this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
@@ -6122,7 +6145,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6122
6145
|
row.forEach(function (cell, cellIndex) {
|
|
6123
6146
|
var sizeIndex = cell.level || cellIndex;
|
|
6124
6147
|
var colIndex = cell.index || cellIndex;
|
|
6125
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6148
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this40.options.columns[_this40.options.columns.length - 1][colIndex].show === false) {
|
|
6126
6149
|
return; // need to revisit this logic
|
|
6127
6150
|
}
|
|
6128
6151
|
|
|
@@ -6313,7 +6336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6313
6336
|
if (typeof this.options.maxColWidth === 'number') {
|
|
6314
6337
|
maxWidth = this.options.maxColWidth;
|
|
6315
6338
|
} else if (this.options.maxColWidth.indexOf('%') !== -1) {
|
|
6316
|
-
maxWidth = this.sizes.
|
|
6339
|
+
maxWidth = this.sizes.table.width * (+this.options.maxColWidth.replace('%', '') / 100);
|
|
6317
6340
|
} else if (this.options.maxColWidth.indexOf('px') !== -1) {
|
|
6318
6341
|
maxWidth = +this.options.maxColWidth.replace('px', '');
|
|
6319
6342
|
}
|
|
@@ -6325,7 +6348,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6325
6348
|
this.sizes.total = footerEl.getBoundingClientRect();
|
|
6326
6349
|
var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
|
|
6327
6350
|
var totalWidth = 0;
|
|
6328
|
-
this.sizes.scrollableWidth = this.sizes.
|
|
6351
|
+
this.sizes.scrollableWidth = this.sizes.table.width;
|
|
6329
6352
|
var firstNonPinnedColumnWidth = 0;
|
|
6330
6353
|
var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6331
6354
|
return c.show !== false;
|
|
@@ -6336,8 +6359,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6336
6359
|
_this43.sizes.cellHeight = colSize.height;
|
|
6337
6360
|
if (columnsForSizing[colIndex]) {
|
|
6338
6361
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6362
|
+
columnsForSizing[colIndex].potentialWidth = 0;
|
|
6339
6363
|
columnsForSizing[colIndex].actualWidth = 0;
|
|
6340
6364
|
}
|
|
6365
|
+
columnsForSizing[colIndex].potentialWidth = Math.max(columnsForSizing[colIndex].potentialWidth, colSize.width);
|
|
6341
6366
|
columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth);
|
|
6342
6367
|
// if (columnsForSizing[colIndex].width) {
|
|
6343
6368
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
@@ -6363,19 +6388,53 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6363
6388
|
return a + (b.width || b.actualWidth);
|
|
6364
6389
|
}, 0);
|
|
6365
6390
|
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth;
|
|
6366
|
-
// const outerSize = outerEl.getBoundingClientRect()
|
|
6367
|
-
if (this.sizes.totalWidth < this.sizes.
|
|
6368
|
-
var
|
|
6391
|
+
// const outerSize = outerEl.getBoundingClientRect()
|
|
6392
|
+
if (this.sizes.totalWidth < this.sizes.table.width) {
|
|
6393
|
+
var requiredSpace = 0;
|
|
6394
|
+
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6395
|
+
columnsForSizing.forEach(function (c) {
|
|
6396
|
+
c.shouldGrow = true;
|
|
6397
|
+
if (_this43.options.autoFitColumns === false) {
|
|
6398
|
+
c.shouldGrow = false;
|
|
6399
|
+
if (c.potentialWidth > c.actualWidth) {
|
|
6400
|
+
c.shouldGrow = true;
|
|
6401
|
+
c.growDiff = c.potentialWidth - c.actualWidth;
|
|
6402
|
+
c.growDiffPerc = (c.potentialWidth - c.actualWidth) / availableSpace;
|
|
6403
|
+
requiredSpace += c.growDiff;
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
});
|
|
6407
|
+
var equalWidth = (this.sizes.table.width - this.sizes.totalWidth) / columnsForSizing.filter(function (c) {
|
|
6408
|
+
return c.shouldGrow;
|
|
6409
|
+
}).length;
|
|
6369
6410
|
this.sizes.totalWidth = 0;
|
|
6370
6411
|
this.sizes.totalNonPinnedWidth = 0;
|
|
6371
6412
|
columnsForSizing.forEach(function (c, i) {
|
|
6372
6413
|
// if (!c.width) {
|
|
6373
6414
|
// if (c.actualWidth < equalWidth) {
|
|
6374
6415
|
// adjust the width
|
|
6375
|
-
if (
|
|
6376
|
-
c.width
|
|
6416
|
+
if (_this43.options.autoFitColumns === true) {
|
|
6417
|
+
if (c.width) {
|
|
6418
|
+
c.width += equalWidth;
|
|
6419
|
+
}
|
|
6420
|
+
c.actualWidth += equalWidth;
|
|
6421
|
+
} else {
|
|
6422
|
+
if (requiredSpace > 0 && requiredSpace <= availableSpace) {
|
|
6423
|
+
if (c.shouldGrow) {
|
|
6424
|
+
if (c.width) {
|
|
6425
|
+
c.width += c.growDiff;
|
|
6426
|
+
}
|
|
6427
|
+
c.actualWidth += c.growDiff;
|
|
6428
|
+
}
|
|
6429
|
+
} else {
|
|
6430
|
+
if (c.shouldGrow) {
|
|
6431
|
+
if (c.width) {
|
|
6432
|
+
c.width += availableSpace * (c.growDiff / requiredSpace);
|
|
6433
|
+
}
|
|
6434
|
+
c.actualWidth += availableSpace * (c.growDiff / requiredSpace);
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6377
6437
|
}
|
|
6378
|
-
c.actualWidth += equalWidth;
|
|
6379
6438
|
// }
|
|
6380
6439
|
// }
|
|
6381
6440
|
_this43.sizes.totalWidth += c.width || c.actualWidth;
|
|
@@ -6386,9 +6445,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6386
6445
|
});
|
|
6387
6446
|
}
|
|
6388
6447
|
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
6389
|
-
if (this.sizes.pinnedWidth > this.sizes.
|
|
6448
|
+
if (this.sizes.pinnedWidth > this.sizes.table.width - firstNonPinnedColumnWidth) {
|
|
6390
6449
|
this.sizes.totalWidth = 0;
|
|
6391
|
-
var diff = this.sizes.pinnedWidth - (this.sizes.
|
|
6450
|
+
var diff = this.sizes.pinnedWidth - (this.sizes.table.width - firstNonPinnedColumnWidth);
|
|
6392
6451
|
var oldPinnedWidth = this.sizes.pinnedWidth;
|
|
6393
6452
|
this.sizes.pinnedWidth = 0;
|
|
6394
6453
|
// let colDiff = diff / this.pinnedColumns
|
|
@@ -6425,7 +6484,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6425
6484
|
} else {
|
|
6426
6485
|
this.vScrollRequired = false;
|
|
6427
6486
|
}
|
|
6428
|
-
if (this.sizes.totalWidth > this.sizes.
|
|
6487
|
+
if (this.sizes.totalWidth.toFixed(3) > this.sizes.table.width.toFixed(3)) {
|
|
6429
6488
|
this.hScrollRequired = true;
|
|
6430
6489
|
} else {
|
|
6431
6490
|
this.hScrollRequired = false;
|
|
@@ -6814,7 +6873,6 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6814
6873
|
var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
6815
6874
|
if (this.vScrollRequired === true) {
|
|
6816
6875
|
vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
|
|
6817
|
-
// vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
|
|
6818
6876
|
vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
|
|
6819
6877
|
if (this.isTouchDevice === true) {
|
|
6820
6878
|
vScrollEl.style.visibility = "unset";
|
|
@@ -6932,6 +6990,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6932
6990
|
}
|
|
6933
6991
|
}
|
|
6934
6992
|
cumulativeWidth = 0;
|
|
6993
|
+
var lastColWidth = 0;
|
|
6935
6994
|
for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
|
|
6936
6995
|
if (this.options.allColumns[this.options.allColumns.length - 1][_i10].show !== false) {
|
|
6937
6996
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
|
|
@@ -6946,9 +7005,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6946
7005
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
6947
7006
|
this.startCol += 1;
|
|
6948
7007
|
}
|
|
6949
|
-
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth) {
|
|
6950
|
-
this.
|
|
6951
|
-
this.endCol
|
|
7008
|
+
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth - lastColWidth) {
|
|
7009
|
+
this.endCol = this.options.allColumns[this.options.allColumns.length - 1].length - 1;
|
|
7010
|
+
this.startCol = this.endCol + 1;
|
|
7011
|
+
// one last measurement
|
|
7012
|
+
var finalAcc = 0;
|
|
7013
|
+
for (var _i11 = this.endCol; _i11 > -1; _i11--) {
|
|
7014
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][_i11].show !== false) {
|
|
7015
|
+
finalAcc += this.options.allColumns[this.options.allColumns.length - 1][_i11].actualWidth;
|
|
7016
|
+
if (finalAcc < this.sizes.scrollableWidth) {
|
|
7017
|
+
this.startCol--;
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
}
|
|
6952
7021
|
}
|
|
6953
7022
|
this.endCol = Math.max(this.startCol, this.endCol);
|
|
6954
7023
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
|
|
@@ -8842,6 +8911,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8842
8911
|
} else {
|
|
8843
8912
|
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8844
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
|
|
8845
8921
|
}
|
|
8846
8922
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8847
8923
|
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
@@ -8870,6 +8946,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8870
8946
|
} else {
|
|
8871
8947
|
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8872
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
|
|
8873
8956
|
}
|
|
8874
8957
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8875
8958
|
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
@@ -9115,8 +9198,12 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
9115
9198
|
_classCallCheck(this, WebsyKPI);
|
|
9116
9199
|
var DEFAULTS = {
|
|
9117
9200
|
tooltip: {},
|
|
9118
|
-
label: {
|
|
9119
|
-
|
|
9201
|
+
label: {
|
|
9202
|
+
value: ''
|
|
9203
|
+
},
|
|
9204
|
+
value: {
|
|
9205
|
+
value: ''
|
|
9206
|
+
}
|
|
9120
9207
|
};
|
|
9121
9208
|
this.elementId = elementId;
|
|
9122
9209
|
this.options = _extends({}, DEFAULTS, options);
|
|
@@ -9149,7 +9236,7 @@ var WebsyKPI = /*#__PURE__*/function () {
|
|
|
9149
9236
|
if (this.options.icon) {
|
|
9150
9237
|
html += "\n <div class=\"websy-kpi-icon\"><img src=\"".concat(this.options.icon, "\"></div> \n ");
|
|
9151
9238
|
}
|
|
9152
|
-
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 ");
|
|
9153
9240
|
if (this.options.tooltip && this.options.tooltip.value) {
|
|
9154
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 ");
|
|
9155
9242
|
}
|