@websy/websy-designs 1.3.12 → 1.4.1
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/websy-designs-es6.debug.js +197 -76
- package/dist/websy-designs-es6.js +192 -71
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +206 -76
- package/dist/websy-designs.js +203 -71
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2278,6 +2278,33 @@ const WebsyIcons = {
|
|
|
2278
2278
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 500 500">
|
|
2279
2279
|
<path d="M15,255.1v-10.3c0-5.5,4.5-10,10-10h450c5.5,0,10,4.5,10,10v10.3c0,5.5-4.5,10-10,10H25C19.5,265.1,15,260.7,15,255.1z"/>
|
|
2280
2280
|
</svg>
|
|
2281
|
+
`,
|
|
2282
|
+
'PlusFilled': `
|
|
2283
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2284
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2285
|
+
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
|
|
2286
|
+
<style type="text/css">
|
|
2287
|
+
.st0{fill:#FFFFFF;}
|
|
2288
|
+
</style>
|
|
2289
|
+
<circle cx="249.6" cy="251" r="235"/>
|
|
2290
|
+
<path class="st0" d="M422.3,234.8H264.7V78.7c0-4.2-4.5-7.7-10-7.7h-10.3c-5.5,0-10,3.4-10,7.7v156.1H77.7c-4.2,0-7.7,4.5-7.7,10
|
|
2291
|
+
v10.3c0,5.6,3.4,10,7.7,10h156.7v158.2c0,4.2,4.5,7.7,10,7.7h10.3c5.5,0,9.9-3.4,10-7.7V265.1h157.6c4.2,0,7.7-4.5,7.7-10v-10.3
|
|
2292
|
+
C430,239.3,426.6,234.8,422.3,234.8z"/>
|
|
2293
|
+
</svg>
|
|
2294
|
+
|
|
2295
|
+
`,
|
|
2296
|
+
'MinusFilled': `
|
|
2297
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2298
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2299
|
+
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
|
|
2300
|
+
<style type="text/css">
|
|
2301
|
+
.st0{fill:#FFFFFF;}
|
|
2302
|
+
</style>
|
|
2303
|
+
<circle cx="250.1" cy="255.4" r="235"/>
|
|
2304
|
+
<path class="st0" d="M70,255.1v-10.3c0-5.5,3.4-10,7.7-10h344.7c4.2,0,7.7,4.5,7.7,10v10.3c0,5.5-3.4,10-7.7,10H77.7
|
|
2305
|
+
C73.4,265.1,70,260.7,70,255.1z"/>
|
|
2306
|
+
</svg>
|
|
2307
|
+
|
|
2281
2308
|
`
|
|
2282
2309
|
}
|
|
2283
2310
|
|
|
@@ -3622,7 +3649,9 @@ class WebsyRouter {
|
|
|
3622
3649
|
const parts = params.split('&')
|
|
3623
3650
|
for (let i = 0; i < parts.length; i++) {
|
|
3624
3651
|
const bits = parts[i].split('=')
|
|
3625
|
-
|
|
3652
|
+
if (bits[0] && bits[0] !== '' && bits[1] && bits[1] !== '') {
|
|
3653
|
+
output.items[bits[0]] = bits[1]
|
|
3654
|
+
}
|
|
3626
3655
|
}
|
|
3627
3656
|
this.currentParams = output
|
|
3628
3657
|
return output
|
|
@@ -3709,18 +3738,30 @@ class WebsyRouter {
|
|
|
3709
3738
|
this.publish('hide', [children[c].view])
|
|
3710
3739
|
}
|
|
3711
3740
|
}
|
|
3712
|
-
hideView (view, group) {
|
|
3741
|
+
hideView (view, group) {
|
|
3742
|
+
if (view === '/' || view === '') {
|
|
3743
|
+
view = this.options.defaultView
|
|
3744
|
+
}
|
|
3713
3745
|
this.hideChildren(view, group)
|
|
3714
|
-
if (this.previousView !== this.currentView) {
|
|
3746
|
+
if (this.previousView !== this.currentView || group !== this.options.defaultGroup) {
|
|
3715
3747
|
this.hideTriggerItems(view, group)
|
|
3716
3748
|
this.hideViewItems(view, group)
|
|
3717
3749
|
this.publish('hide', [view])
|
|
3750
|
+
if (this.options.views && this.options.views[view]) {
|
|
3751
|
+
this.options.views[view].components.forEach(c => {
|
|
3752
|
+
if (typeof c.instance !== 'undefined') {
|
|
3753
|
+
if (c.instance.close) {
|
|
3754
|
+
c.instance.close()
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
})
|
|
3758
|
+
}
|
|
3718
3759
|
}
|
|
3719
|
-
else if (group !== this.options.defaultGroup) {
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
}
|
|
3760
|
+
// else if (group !== this.options.defaultGroup) {
|
|
3761
|
+
// this.hideTriggerItems(view, group)
|
|
3762
|
+
// this.hideViewItems(view, group)
|
|
3763
|
+
// this.publish('hide', [view])
|
|
3764
|
+
// }
|
|
3724
3765
|
}
|
|
3725
3766
|
// registerElements (root) {
|
|
3726
3767
|
// if (root.nodeName === '#document') {
|
|
@@ -5535,16 +5576,19 @@ class WebsyTable3 {
|
|
|
5535
5576
|
data.forEach((row, rowIndex) => {
|
|
5536
5577
|
bodyHtml += `<tr class="websy-table-row">`
|
|
5537
5578
|
row.forEach((cell, cellIndex) => {
|
|
5538
|
-
|
|
5579
|
+
let sizeIndex = cell.level || cellIndex
|
|
5580
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
5539
5581
|
return // need to revisit this logic
|
|
5540
5582
|
}
|
|
5541
|
-
let style =
|
|
5583
|
+
let style = `width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important; `
|
|
5584
|
+
let divStyle = style
|
|
5542
5585
|
if (cell.style) {
|
|
5543
5586
|
style += cell.style
|
|
5544
5587
|
}
|
|
5545
5588
|
if (useWidths === true) {
|
|
5546
|
-
style += `max-width: ${sizingColumns[
|
|
5547
|
-
|
|
5589
|
+
style += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5590
|
+
divStyle += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5591
|
+
}
|
|
5548
5592
|
if (cell.backgroundColor) {
|
|
5549
5593
|
style += `background-color: ${cell.backgroundColor}; `
|
|
5550
5594
|
if (!cell.color) {
|
|
@@ -5554,7 +5598,7 @@ class WebsyTable3 {
|
|
|
5554
5598
|
if (cell.color) {
|
|
5555
5599
|
style += `color: ${cell.color}; `
|
|
5556
5600
|
}
|
|
5557
|
-
console.log('rowspan', cell.rowspan)
|
|
5601
|
+
// console.log('rowspan', cell.rowspan)
|
|
5558
5602
|
bodyHtml += `<td
|
|
5559
5603
|
class='websy-table-cell ${(cell.classes || []).join(' ')}'
|
|
5560
5604
|
style='${style}'
|
|
@@ -5571,24 +5615,24 @@ class WebsyTable3 {
|
|
|
5571
5615
|
// `
|
|
5572
5616
|
// }
|
|
5573
5617
|
bodyHtml += `
|
|
5574
|
-
>`
|
|
5618
|
+
><div style='${divStyle}'>`
|
|
5575
5619
|
if (cell.expandable === true) {
|
|
5576
5620
|
bodyHtml += `<i
|
|
5577
5621
|
data-row-index='${rowIndex}'
|
|
5578
|
-
data-col-index='${cellIndex}'
|
|
5622
|
+
data-col-index='${cell.level || cellIndex}'
|
|
5579
5623
|
class='websy-table-cell-expand'
|
|
5580
|
-
>${WebsyDesigns.Icons.
|
|
5624
|
+
>${WebsyDesigns.Icons.PlusFilled}</i>`
|
|
5581
5625
|
}
|
|
5582
5626
|
if (cell.collapsable === true) {
|
|
5583
5627
|
bodyHtml += `<i
|
|
5584
5628
|
data-row-index='${rowIndex}'
|
|
5585
|
-
data-col-index='${cellIndex}'
|
|
5629
|
+
data-col-index='${cell.level || cellIndex}'
|
|
5586
5630
|
class='websy-table-cell-collapse'
|
|
5587
|
-
>${WebsyDesigns.Icons.
|
|
5631
|
+
>${WebsyDesigns.Icons.MinusFilled}</i>`
|
|
5588
5632
|
}
|
|
5589
5633
|
bodyHtml += `
|
|
5590
5634
|
${cell.value}
|
|
5591
|
-
</td>`
|
|
5635
|
+
</div></td>`
|
|
5592
5636
|
})
|
|
5593
5637
|
bodyHtml += `</tr>`
|
|
5594
5638
|
})
|
|
@@ -5614,9 +5658,18 @@ class WebsyTable3 {
|
|
|
5614
5658
|
}
|
|
5615
5659
|
headerHtml += `<tr class="websy-table-row websy-table-header-row">`
|
|
5616
5660
|
row.forEach((col, colIndex) => {
|
|
5661
|
+
let style = `width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important; `
|
|
5662
|
+
let divStyle = style
|
|
5663
|
+
if (useWidths === true) {
|
|
5664
|
+
style += `max-width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important;`
|
|
5665
|
+
divStyle += `max-width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important;`
|
|
5666
|
+
}
|
|
5667
|
+
if (col.style) {
|
|
5668
|
+
style += col.style
|
|
5669
|
+
}
|
|
5617
5670
|
headerHtml += `<td
|
|
5618
5671
|
class='websy-table-cell'
|
|
5619
|
-
style='${
|
|
5672
|
+
style='${style}'
|
|
5620
5673
|
colspan='${col.colspan || 1}'
|
|
5621
5674
|
rowspan='${col.rowspan || 1}'
|
|
5622
5675
|
`
|
|
@@ -5626,13 +5679,7 @@ class WebsyTable3 {
|
|
|
5626
5679
|
// width='${col.width || col.actualWidth}'
|
|
5627
5680
|
// `
|
|
5628
5681
|
// }
|
|
5629
|
-
headerHtml +=
|
|
5630
|
-
>
|
|
5631
|
-
<div>
|
|
5632
|
-
${col.name}
|
|
5633
|
-
${col.searchable === true ? this.buildSearchIcon(col, colIndex) : ''}
|
|
5634
|
-
</div>
|
|
5635
|
-
</td>`
|
|
5682
|
+
headerHtml += `><div style='${divStyle}'>${col.name}${col.searchable === true ? this.buildSearchIcon(col, colIndex) : ''}</div></td>`
|
|
5636
5683
|
})
|
|
5637
5684
|
headerHtml += `</tr>`
|
|
5638
5685
|
})
|
|
@@ -5651,11 +5698,9 @@ class WebsyTable3 {
|
|
|
5651
5698
|
return headerHtml
|
|
5652
5699
|
}
|
|
5653
5700
|
buildSearchIcon (col, index) {
|
|
5654
|
-
return
|
|
5655
|
-
<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
|
|
5701
|
+
return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
|
|
5656
5702
|
<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>
|
|
5657
|
-
</div
|
|
5658
|
-
`
|
|
5703
|
+
</div>`
|
|
5659
5704
|
}
|
|
5660
5705
|
buildTotalHtml (useWidths = false) {
|
|
5661
5706
|
if (!this.options.totals) {
|
|
@@ -5713,6 +5758,7 @@ class WebsyTable3 {
|
|
|
5713
5758
|
const rows = Array.from(tableEl.querySelectorAll('.websy-table-row'))
|
|
5714
5759
|
let totalWidth = 0
|
|
5715
5760
|
this.sizes.scrollableWidth = this.sizes.outer.width
|
|
5761
|
+
let firstNonPinnedColumnWidth = 0
|
|
5716
5762
|
rows.forEach((row, rowIndex) => {
|
|
5717
5763
|
Array.from(row.children).forEach((col, colIndex) => {
|
|
5718
5764
|
let colSize = col.getBoundingClientRect()
|
|
@@ -5722,7 +5768,10 @@ class WebsyTable3 {
|
|
|
5722
5768
|
this.options.columns[this.options.columns.length - 1][colIndex].actualWidth = 0
|
|
5723
5769
|
}
|
|
5724
5770
|
this.options.columns[this.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(this.options.columns[this.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth)
|
|
5725
|
-
this.options.columns[this.options.columns.length - 1][colIndex].cellHeight = colSize.height
|
|
5771
|
+
this.options.columns[this.options.columns.length - 1][colIndex].cellHeight = colSize.height
|
|
5772
|
+
if (colIndex >= this.pinnedColumns) {
|
|
5773
|
+
firstNonPinnedColumnWidth = this.options.columns[this.options.columns.length - 1][colIndex].actualWidth
|
|
5774
|
+
}
|
|
5726
5775
|
}
|
|
5727
5776
|
})
|
|
5728
5777
|
})
|
|
@@ -5731,8 +5780,9 @@ class WebsyTable3 {
|
|
|
5731
5780
|
this.sizes.scrollableWidth -= col.actualWidth
|
|
5732
5781
|
}
|
|
5733
5782
|
})
|
|
5734
|
-
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
5783
|
+
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
5735
5784
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
5785
|
+
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
|
|
5736
5786
|
// const outerSize = outerEl.getBoundingClientRect()
|
|
5737
5787
|
if (this.sizes.totalWidth < this.sizes.outer.width) {
|
|
5738
5788
|
let equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length
|
|
@@ -5755,6 +5805,19 @@ class WebsyTable3 {
|
|
|
5755
5805
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
5756
5806
|
})
|
|
5757
5807
|
}
|
|
5808
|
+
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
5809
|
+
if (this.sizes.pinnedWidth > (this.sizes.outer.width - firstNonPinnedColumnWidth)) {
|
|
5810
|
+
this.sizes.totalWidth = 0
|
|
5811
|
+
let diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth)
|
|
5812
|
+
// let colDiff = diff / this.pinnedColumns
|
|
5813
|
+
for (let i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
|
|
5814
|
+
if (i < this.pinnedColumns) {
|
|
5815
|
+
let colDiff = (this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth) * diff
|
|
5816
|
+
this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff
|
|
5817
|
+
}
|
|
5818
|
+
this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth
|
|
5819
|
+
}
|
|
5820
|
+
}
|
|
5758
5821
|
// take the height of the last cell as the official height for data cells
|
|
5759
5822
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
5760
5823
|
headEl.innerHTML = ''
|
|
@@ -5782,7 +5845,7 @@ class WebsyTable3 {
|
|
|
5782
5845
|
this.hScrollRequired = false
|
|
5783
5846
|
}
|
|
5784
5847
|
this.options.allColumns = this.options.columns.map(c => c)
|
|
5785
|
-
console.log('sizes', this.sizes)
|
|
5848
|
+
// console.log('sizes', this.sizes)
|
|
5786
5849
|
return this.sizes
|
|
5787
5850
|
}
|
|
5788
5851
|
createSample (data) {
|
|
@@ -5810,7 +5873,7 @@ class WebsyTable3 {
|
|
|
5810
5873
|
const colIndex = +event.target.getAttribute('data-col-index')
|
|
5811
5874
|
const rowIndex = +event.target.getAttribute('data-row-index')
|
|
5812
5875
|
if (event.target.classList.contains('websy-table-search-icon')) {
|
|
5813
|
-
console.log('clicked on search icon')
|
|
5876
|
+
// console.log('clicked on search icon')
|
|
5814
5877
|
if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
|
|
5815
5878
|
this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex])
|
|
5816
5879
|
}
|
|
@@ -5840,8 +5903,8 @@ class WebsyTable3 {
|
|
|
5840
5903
|
const scrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
5841
5904
|
this.handleYStart = scrollHandleEl.offsetTop
|
|
5842
5905
|
this.mouseYStart = event.pageY
|
|
5843
|
-
console.log('mouse down', this.handleYStart, this.mouseYStart)
|
|
5844
|
-
console.log(scrollHandleEl.offsetTop)
|
|
5906
|
+
// console.log('mouse down', this.handleYStart, this.mouseYStart)
|
|
5907
|
+
// console.log(scrollHandleEl.offsetTop)
|
|
5845
5908
|
}
|
|
5846
5909
|
else if (event.target.classList.contains('websy-scroll-handle-x')) {
|
|
5847
5910
|
this.scrollDragging = true
|
|
@@ -5874,7 +5937,7 @@ class WebsyTable3 {
|
|
|
5874
5937
|
}
|
|
5875
5938
|
handleScrollWheel (event) {
|
|
5876
5939
|
event.preventDefault()
|
|
5877
|
-
console.log('scrollwheel', event)
|
|
5940
|
+
// console.log('scrollwheel', event)
|
|
5878
5941
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
5879
5942
|
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
|
|
5880
5943
|
}
|
|
@@ -5912,7 +5975,7 @@ class WebsyTable3 {
|
|
|
5912
5975
|
const sample = this.createSample(data)
|
|
5913
5976
|
this.calculateSizes(sample, data.length, (data[0] || []).length, 0)
|
|
5914
5977
|
}
|
|
5915
|
-
console.log(this.options.columns)
|
|
5978
|
+
// console.log(this.options.columns)
|
|
5916
5979
|
const tableInnerEl = document.getElementById(`${this.elementId}_tableInner`)
|
|
5917
5980
|
if (tableInnerEl) {
|
|
5918
5981
|
tableInnerEl.style.width = `${this.sizes.totalWidth}px`
|
|
@@ -6017,7 +6080,7 @@ class WebsyTable3 {
|
|
|
6017
6080
|
handlePos = scrollHandleEl.offsetLeft + diff
|
|
6018
6081
|
}
|
|
6019
6082
|
const scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width
|
|
6020
|
-
console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
6083
|
+
// console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
6021
6084
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px'
|
|
6022
6085
|
if (this.options.onScroll) {
|
|
6023
6086
|
let actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace)
|
|
@@ -6026,7 +6089,7 @@ class WebsyTable3 {
|
|
|
6026
6089
|
this.endCol = 0
|
|
6027
6090
|
for (let i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6028
6091
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
6029
|
-
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
6092
|
+
// console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
6030
6093
|
if (actualLeft < cumulativeWidth) {
|
|
6031
6094
|
this.startCol = i
|
|
6032
6095
|
break
|
|
@@ -6042,11 +6105,11 @@ class WebsyTable3 {
|
|
|
6042
6105
|
if (this.endCol < this.options.allColumns[this.options.allColumns.length - 1].length - 1) {
|
|
6043
6106
|
this.endCol += 1
|
|
6044
6107
|
}
|
|
6045
|
-
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.
|
|
6108
|
+
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
6046
6109
|
this.startCol += 1
|
|
6047
6110
|
}
|
|
6048
6111
|
this.endCol = Math.max(this.startCol, this.endCol)
|
|
6049
|
-
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol)
|
|
6112
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
6050
6113
|
}
|
|
6051
6114
|
}
|
|
6052
6115
|
scrollY (diff) {
|
|
@@ -6070,11 +6133,11 @@ class WebsyTable3 {
|
|
|
6070
6133
|
handlePos = this.handleYStart + diff
|
|
6071
6134
|
}
|
|
6072
6135
|
else {
|
|
6073
|
-
console.log('appending not resetting')
|
|
6136
|
+
// console.log('appending not resetting')
|
|
6074
6137
|
handlePos = scrollHandleEl.offsetTop + diff
|
|
6075
6138
|
}
|
|
6076
6139
|
const scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height
|
|
6077
|
-
console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
|
|
6140
|
+
// console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
|
|
6078
6141
|
scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px'
|
|
6079
6142
|
if (this.options.onScroll) {
|
|
6080
6143
|
this.startRow = Math.min(this.totalRowCount - this.sizes.rowsToRender, Math.max(0, Math.round((this.totalRowCount - this.sizes.rowsToRender) * (handlePos / scrollableSpace))))
|
|
@@ -6082,7 +6145,7 @@ class WebsyTable3 {
|
|
|
6082
6145
|
if (this.endRow === this.totalRowCount) {
|
|
6083
6146
|
this.startRow += 1
|
|
6084
6147
|
}
|
|
6085
|
-
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol)
|
|
6148
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
6086
6149
|
}
|
|
6087
6150
|
}
|
|
6088
6151
|
showLoading (options) {
|
|
@@ -6115,8 +6178,9 @@ class WebsyChart {
|
|
|
6115
6178
|
curveStyle: 'curveLinear',
|
|
6116
6179
|
lineWidth: 2,
|
|
6117
6180
|
forceZero: true,
|
|
6181
|
+
grouping: 'grouped',
|
|
6118
6182
|
fontSize: 14,
|
|
6119
|
-
symbolSize: 20,
|
|
6183
|
+
symbolSize: 20,
|
|
6120
6184
|
showTrackingLine: true,
|
|
6121
6185
|
showTooltip: true,
|
|
6122
6186
|
showLegend: false,
|
|
@@ -6129,6 +6193,7 @@ class WebsyChart {
|
|
|
6129
6193
|
this.rightAxis = null
|
|
6130
6194
|
this.topAxis = null
|
|
6131
6195
|
this.bottomAxis = null
|
|
6196
|
+
this.renderedKeys = {}
|
|
6132
6197
|
if (!elementId) {
|
|
6133
6198
|
console.log('No element Id provided for Websy Chart')
|
|
6134
6199
|
return
|
|
@@ -6352,11 +6417,18 @@ if (this.options.data[side].scale === 'Time') {
|
|
|
6352
6417
|
onLeft: xPoint > this.plotWidth / 2
|
|
6353
6418
|
}
|
|
6354
6419
|
if (xPoint > this.plotWidth / 2) {
|
|
6355
|
-
posOptions.left = xPoint - this.options.tooltipWidth
|
|
6420
|
+
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6421
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6422
|
+
// posOptions.left -= (this[xAxis].bandwidth())
|
|
6423
|
+
posOptions.left += 10
|
|
6424
|
+
}
|
|
6356
6425
|
}
|
|
6357
6426
|
else {
|
|
6358
6427
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6359
|
-
|
|
6428
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6429
|
+
posOptions.left += (this[xAxis].bandwidth() / 2)
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6360
6432
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop
|
|
6361
6433
|
if (this.options.orientation === 'horizontal') {
|
|
6362
6434
|
delete posOptions.onLeft
|
|
@@ -6490,8 +6562,10 @@ else {
|
|
|
6490
6562
|
let legendData = this.options.data.series.map((s, i) => ({value: s.label || s.key, color: s.color || this.options.colors[i % this.options.colors.length]}))
|
|
6491
6563
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
6492
6564
|
this.legendArea.style('width', '100%')
|
|
6565
|
+
this.legend.options.align = 'center'
|
|
6493
6566
|
}
|
|
6494
6567
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
6568
|
+
this.legend.options.align = 'left'
|
|
6495
6569
|
this.legendArea.style('height', '100%')
|
|
6496
6570
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(d => d.value))) + 'px')
|
|
6497
6571
|
}
|
|
@@ -6525,6 +6599,7 @@ else {
|
|
|
6525
6599
|
this.longestLeft = 0
|
|
6526
6600
|
this.longestRight = 0
|
|
6527
6601
|
this.longestBottom = 0
|
|
6602
|
+
let firstBottom = ''
|
|
6528
6603
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
6529
6604
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6530
6605
|
// this.options.data.bottom.min = this.options.data.bottom.data.reduce((a, b) => a.length < b.value.length ? a : b.value, this.options.data.bottom.max)
|
|
@@ -6535,9 +6610,17 @@ else {
|
|
|
6535
6610
|
this.longestBottom = this.options.data.bottom.max.toString()
|
|
6536
6611
|
if (this.options.data.bottom.formatter) {
|
|
6537
6612
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString()
|
|
6613
|
+
firstBottom = this.longestBottom
|
|
6538
6614
|
}
|
|
6539
6615
|
else {
|
|
6540
|
-
this.
|
|
6616
|
+
if (this.options.data.bottom.scale === 'Time') {
|
|
6617
|
+
this.longestBottom = '01/01/2000'
|
|
6618
|
+
firstBottom = '01/01/2000'
|
|
6619
|
+
}
|
|
6620
|
+
else {
|
|
6621
|
+
this.longestBottom = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6622
|
+
firstBottom = this.options.data.bottom.data[0].value
|
|
6623
|
+
}
|
|
6541
6624
|
}
|
|
6542
6625
|
}
|
|
6543
6626
|
if (this.options.data.left && this.options.data.left.data && this.options.data.left.max === 'undefined') {
|
|
@@ -6573,7 +6656,20 @@ else {
|
|
|
6573
6656
|
let longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize))
|
|
6574
6657
|
let longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize))
|
|
6575
6658
|
let longestBottomBounds = WebsyUtils.measureText(this.longestBottom, ((this.options.data.bottom && this.options.data.bottom.rotate) || 0), ((this.options.data.bottom && this.options.data.bottom.fontSize) || this.options.fontSize))
|
|
6576
|
-
|
|
6659
|
+
let firstBottomWidth = 0
|
|
6660
|
+
if (this.options.orientation === 'vertical') {
|
|
6661
|
+
firstBottomWidth = WebsyUtils.measureText(firstBottom, ((this.options.data.bottom && this.options.data.bottom.rotate) || 0), ((this.options.data.bottom && this.options.data.bottom.fontSize) || this.options.fontSize)).width
|
|
6662
|
+
if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) !== 90) {
|
|
6663
|
+
firstBottomWidth = firstBottomWidth / 2
|
|
6664
|
+
}
|
|
6665
|
+
else if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) === 90) {
|
|
6666
|
+
firstBottomWidth = 0
|
|
6667
|
+
}
|
|
6668
|
+
if (this.options.data.bottom.scale !== 'Time') {
|
|
6669
|
+
firstBottom = Math.max(0, firstBottomWidth)
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth)
|
|
6577
6673
|
this.options.margin.axisRight = longestRightBounds.width
|
|
6578
6674
|
this.options.margin.axisBottom = longestBottomBounds.height + 10
|
|
6579
6675
|
this.options.margin.axisTop = 0
|
|
@@ -6789,7 +6885,7 @@ else {
|
|
|
6789
6885
|
.append('text')
|
|
6790
6886
|
.attr('class', 'title')
|
|
6791
6887
|
.attr('x', (1 - this.plotHeight / 2))
|
|
6792
|
-
.attr('y',
|
|
6888
|
+
.attr('y', (this.options.data.left.titleFontSize || 10) / 2 + 2)
|
|
6793
6889
|
.attr('font-size', this.options.data.left.titleFontSize || 10)
|
|
6794
6890
|
.attr('fill', this.options.data.left.titleColor || '#888888')
|
|
6795
6891
|
.attr('text-anchor', 'middle')
|
|
@@ -6870,7 +6966,16 @@ else {
|
|
|
6870
6966
|
// put the title horizontally on the top
|
|
6871
6967
|
}
|
|
6872
6968
|
}
|
|
6969
|
+
// Remove the unnecessary series
|
|
6970
|
+
let newKeys = this.options.data.series.map(s => s.key)
|
|
6971
|
+
for (const key in this.renderedKeys) {
|
|
6972
|
+
if (newKeys.indexOf(key) === -1) {
|
|
6973
|
+
// remove the components
|
|
6974
|
+
this[`remove${this.renderedKeys[key]}`](key)
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6873
6977
|
// Draw the series data
|
|
6978
|
+
this.renderedKeys = {}
|
|
6874
6979
|
this.options.data.series.forEach((series, index) => {
|
|
6875
6980
|
if (!series.key) {
|
|
6876
6981
|
series.key = this.createIdentity()
|
|
@@ -6880,6 +6985,7 @@ else {
|
|
|
6880
6985
|
}
|
|
6881
6986
|
this[`render${series.type || 'bar'}`](series, index)
|
|
6882
6987
|
this.renderLabels(series, index)
|
|
6988
|
+
this.renderedKeys[series.key] = series.type
|
|
6883
6989
|
})
|
|
6884
6990
|
}
|
|
6885
6991
|
}
|
|
@@ -6939,69 +7045,75 @@ areas.enter().append('path')
|
|
|
6939
7045
|
}
|
|
6940
7046
|
renderbar (series, index) {
|
|
6941
7047
|
/* global series index d3 */
|
|
6942
|
-
let xAxis = '
|
|
6943
|
-
let yAxis = '
|
|
7048
|
+
let xAxis = 'bottom'
|
|
7049
|
+
let yAxis = 'left'
|
|
6944
7050
|
let bars = this.barLayer.selectAll(`.bar_${series.key}`).data(series.data)
|
|
6945
7051
|
let acummulativeY = new Array(this.options.data.series.length).fill(0)
|
|
6946
7052
|
if (this.options.orientation === 'horizontal') {
|
|
6947
|
-
xAxis = '
|
|
6948
|
-
yAxis = '
|
|
6949
|
-
}
|
|
6950
|
-
let barWidth = this[xAxis].bandwidth()
|
|
6951
|
-
if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
6952
|
-
barWidth = barWidth / this.options.data.series.length - 4
|
|
7053
|
+
xAxis = 'left'
|
|
7054
|
+
yAxis = 'bottom'
|
|
6953
7055
|
}
|
|
7056
|
+
let barWidth = this[`${xAxis}Axis`].bandwidth()
|
|
7057
|
+
let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
|
|
7058
|
+
// if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
7059
|
+
// barWidth = barWidth / this.options.data.series.length - 4
|
|
7060
|
+
// }
|
|
6954
7061
|
function getBarHeight (d, i) {
|
|
6955
7062
|
if (this.options.orientation === 'horizontal') {
|
|
6956
7063
|
return barWidth
|
|
6957
7064
|
}
|
|
6958
7065
|
else {
|
|
6959
|
-
return this[yAxis](d.y.value)
|
|
7066
|
+
return this[`${yAxis}Axis`](d.y.value)
|
|
6960
7067
|
}
|
|
6961
7068
|
}
|
|
6962
7069
|
function getBarWidth (d, i) {
|
|
6963
7070
|
if (this.options.orientation === 'horizontal') {
|
|
6964
|
-
let width = this[yAxis](d.y.value)
|
|
7071
|
+
let width = this[`${yAxis}Axis`](d.y.value)
|
|
6965
7072
|
acummulativeY[d.y.index] += width
|
|
6966
7073
|
return width
|
|
6967
7074
|
}
|
|
6968
7075
|
else {
|
|
7076
|
+
if (this.options.grouping === 'grouped') {
|
|
7077
|
+
return groupedBarWidth
|
|
7078
|
+
}
|
|
6969
7079
|
return barWidth
|
|
6970
7080
|
}
|
|
6971
7081
|
}
|
|
6972
7082
|
function getBarX (d, i) {
|
|
6973
7083
|
if (this.options.orientation === 'horizontal') {
|
|
6974
7084
|
if (this.options.grouping === 'stacked') {
|
|
6975
|
-
return this[yAxis](d.y.accumulative)
|
|
7085
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
6976
7086
|
}
|
|
6977
7087
|
else {
|
|
6978
7088
|
return 0
|
|
6979
7089
|
}
|
|
6980
7090
|
}
|
|
6981
7091
|
else {
|
|
6982
|
-
|
|
6983
|
-
|
|
7092
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7093
|
+
if (this.options.grouping === 'grouped') {
|
|
7094
|
+
let barAdjustment = groupedBarWidth * index + 5 // + (index > 0 ? 4 : 0)
|
|
7095
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + barAdjustment
|
|
6984
7096
|
}
|
|
6985
7097
|
else {
|
|
6986
|
-
return this[xAxis](this.parseX(d.x.value)) + (i * barWidth)
|
|
7098
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
|
|
6987
7099
|
}
|
|
6988
7100
|
}
|
|
6989
7101
|
}
|
|
6990
7102
|
function getBarY (d, i) {
|
|
6991
7103
|
if (this.options.orientation === 'horizontal') {
|
|
6992
7104
|
if (this.options.grouping !== 'grouped') {
|
|
6993
|
-
return this[xAxis](this.parseX(d.x.value))
|
|
7105
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
6994
7106
|
}
|
|
6995
7107
|
else {
|
|
6996
|
-
return this[xAxis](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
7108
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
6997
7109
|
}
|
|
6998
7110
|
}
|
|
6999
7111
|
else {
|
|
7000
7112
|
if (this.options.grouping === 'stacked') {
|
|
7001
|
-
return this[yAxis](d.y.accumulative)
|
|
7113
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
7002
7114
|
}
|
|
7003
7115
|
else {
|
|
7004
|
-
return
|
|
7116
|
+
return this.plotHeight - getBarHeight.call(this, d, i)
|
|
7005
7117
|
}
|
|
7006
7118
|
}
|
|
7007
7119
|
}
|
|
@@ -7158,18 +7270,19 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
|
|
|
7158
7270
|
return d3
|
|
7159
7271
|
.line()
|
|
7160
7272
|
.x(d => {
|
|
7161
|
-
|
|
7273
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7274
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
7162
7275
|
})
|
|
7163
7276
|
.y(d => {
|
|
7164
|
-
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7277
|
+
return this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7165
7278
|
})
|
|
7166
7279
|
.curve(d3[curveStyle || this.options.curveStyle])
|
|
7167
7280
|
}
|
|
7168
|
-
let xAxis = '
|
|
7169
|
-
let yAxis = series.axis === 'secondary' ? '
|
|
7281
|
+
let xAxis = 'bottom'
|
|
7282
|
+
let yAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7170
7283
|
if (this.options.orienation === 'horizontal') {
|
|
7171
|
-
xAxis = series.axis === 'secondary' ? '
|
|
7172
|
-
yAxis = '
|
|
7284
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7285
|
+
yAxis = 'bottom'
|
|
7173
7286
|
}
|
|
7174
7287
|
let lines = this.lineLayer.selectAll(`.line_${series.key}`)
|
|
7175
7288
|
.data([series.data])
|
|
@@ -7206,6 +7319,14 @@ if (series.showSymbols === true) {
|
|
|
7206
7319
|
this.rendersymbol(series, index)
|
|
7207
7320
|
}
|
|
7208
7321
|
|
|
7322
|
+
}
|
|
7323
|
+
removeline (key) {
|
|
7324
|
+
/* global key d3 */
|
|
7325
|
+
let lines = this.lineLayer.selectAll(`.line_${key}`)
|
|
7326
|
+
.transition(this.transition)
|
|
7327
|
+
.style('stroke-opacity', 1e-6)
|
|
7328
|
+
.remove()
|
|
7329
|
+
|
|
7209
7330
|
}
|
|
7210
7331
|
rendersymbol (series, index) {
|
|
7211
7332
|
/* global d3 series index series.key */
|