@websy/websy-designs 1.3.12 → 1.4.0
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 +178 -76
- package/dist/websy-designs-es6.js +170 -71
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +187 -76
- package/dist/websy-designs.js +181 -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,
|
|
@@ -6352,11 +6416,18 @@ if (this.options.data[side].scale === 'Time') {
|
|
|
6352
6416
|
onLeft: xPoint > this.plotWidth / 2
|
|
6353
6417
|
}
|
|
6354
6418
|
if (xPoint > this.plotWidth / 2) {
|
|
6355
|
-
posOptions.left = xPoint - this.options.tooltipWidth
|
|
6419
|
+
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6420
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6421
|
+
// posOptions.left -= (this[xAxis].bandwidth())
|
|
6422
|
+
posOptions.left += 10
|
|
6423
|
+
}
|
|
6356
6424
|
}
|
|
6357
6425
|
else {
|
|
6358
6426
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6359
|
-
|
|
6427
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6428
|
+
posOptions.left += (this[xAxis].bandwidth() / 2)
|
|
6429
|
+
}
|
|
6430
|
+
}
|
|
6360
6431
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop
|
|
6361
6432
|
if (this.options.orientation === 'horizontal') {
|
|
6362
6433
|
delete posOptions.onLeft
|
|
@@ -6490,8 +6561,10 @@ else {
|
|
|
6490
6561
|
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
6562
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
6492
6563
|
this.legendArea.style('width', '100%')
|
|
6564
|
+
this.legend.options.align = 'center'
|
|
6493
6565
|
}
|
|
6494
6566
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
6567
|
+
this.legend.options.align = 'left'
|
|
6495
6568
|
this.legendArea.style('height', '100%')
|
|
6496
6569
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(d => d.value))) + 'px')
|
|
6497
6570
|
}
|
|
@@ -6525,6 +6598,7 @@ else {
|
|
|
6525
6598
|
this.longestLeft = 0
|
|
6526
6599
|
this.longestRight = 0
|
|
6527
6600
|
this.longestBottom = 0
|
|
6601
|
+
let firstBottom = ''
|
|
6528
6602
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
6529
6603
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6530
6604
|
// 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 +6609,17 @@ else {
|
|
|
6535
6609
|
this.longestBottom = this.options.data.bottom.max.toString()
|
|
6536
6610
|
if (this.options.data.bottom.formatter) {
|
|
6537
6611
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString()
|
|
6612
|
+
firstBottom = this.longestBottom
|
|
6538
6613
|
}
|
|
6539
6614
|
else {
|
|
6540
|
-
this.
|
|
6615
|
+
if (this.options.data.bottom.scale === 'Time') {
|
|
6616
|
+
this.longestBottom = '01/01/2000'
|
|
6617
|
+
firstBottom = '01/01/2000'
|
|
6618
|
+
}
|
|
6619
|
+
else {
|
|
6620
|
+
this.longestBottom = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6621
|
+
firstBottom = this.options.data.bottom.data[0].value
|
|
6622
|
+
}
|
|
6541
6623
|
}
|
|
6542
6624
|
}
|
|
6543
6625
|
if (this.options.data.left && this.options.data.left.data && this.options.data.left.max === 'undefined') {
|
|
@@ -6573,7 +6655,20 @@ else {
|
|
|
6573
6655
|
let longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize))
|
|
6574
6656
|
let longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize))
|
|
6575
6657
|
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
|
-
|
|
6658
|
+
let firstBottomWidth = 0
|
|
6659
|
+
if (this.options.orientation === 'vertical') {
|
|
6660
|
+
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
|
|
6661
|
+
if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) !== 90) {
|
|
6662
|
+
firstBottomWidth = firstBottomWidth / 2
|
|
6663
|
+
}
|
|
6664
|
+
else if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) === 90) {
|
|
6665
|
+
firstBottomWidth = 0
|
|
6666
|
+
}
|
|
6667
|
+
if (this.options.data.bottom.scale !== 'Time') {
|
|
6668
|
+
firstBottom = Math.max(0, firstBottomWidth)
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth)
|
|
6577
6672
|
this.options.margin.axisRight = longestRightBounds.width
|
|
6578
6673
|
this.options.margin.axisBottom = longestBottomBounds.height + 10
|
|
6579
6674
|
this.options.margin.axisTop = 0
|
|
@@ -6789,7 +6884,7 @@ else {
|
|
|
6789
6884
|
.append('text')
|
|
6790
6885
|
.attr('class', 'title')
|
|
6791
6886
|
.attr('x', (1 - this.plotHeight / 2))
|
|
6792
|
-
.attr('y',
|
|
6887
|
+
.attr('y', (this.options.data.left.titleFontSize || 10) / 2 + 2)
|
|
6793
6888
|
.attr('font-size', this.options.data.left.titleFontSize || 10)
|
|
6794
6889
|
.attr('fill', this.options.data.left.titleColor || '#888888')
|
|
6795
6890
|
.attr('text-anchor', 'middle')
|
|
@@ -6939,69 +7034,75 @@ areas.enter().append('path')
|
|
|
6939
7034
|
}
|
|
6940
7035
|
renderbar (series, index) {
|
|
6941
7036
|
/* global series index d3 */
|
|
6942
|
-
let xAxis = '
|
|
6943
|
-
let yAxis = '
|
|
7037
|
+
let xAxis = 'bottom'
|
|
7038
|
+
let yAxis = 'left'
|
|
6944
7039
|
let bars = this.barLayer.selectAll(`.bar_${series.key}`).data(series.data)
|
|
6945
7040
|
let acummulativeY = new Array(this.options.data.series.length).fill(0)
|
|
6946
7041
|
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
|
|
7042
|
+
xAxis = 'left'
|
|
7043
|
+
yAxis = 'bottom'
|
|
6953
7044
|
}
|
|
7045
|
+
let barWidth = this[`${xAxis}Axis`].bandwidth()
|
|
7046
|
+
let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
|
|
7047
|
+
// if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
7048
|
+
// barWidth = barWidth / this.options.data.series.length - 4
|
|
7049
|
+
// }
|
|
6954
7050
|
function getBarHeight (d, i) {
|
|
6955
7051
|
if (this.options.orientation === 'horizontal') {
|
|
6956
7052
|
return barWidth
|
|
6957
7053
|
}
|
|
6958
7054
|
else {
|
|
6959
|
-
return this[yAxis](d.y.value)
|
|
7055
|
+
return this[`${yAxis}Axis`](d.y.value)
|
|
6960
7056
|
}
|
|
6961
7057
|
}
|
|
6962
7058
|
function getBarWidth (d, i) {
|
|
6963
7059
|
if (this.options.orientation === 'horizontal') {
|
|
6964
|
-
let width = this[yAxis](d.y.value)
|
|
7060
|
+
let width = this[`${yAxis}Axis`](d.y.value)
|
|
6965
7061
|
acummulativeY[d.y.index] += width
|
|
6966
7062
|
return width
|
|
6967
7063
|
}
|
|
6968
7064
|
else {
|
|
7065
|
+
if (this.options.grouping === 'grouped') {
|
|
7066
|
+
return groupedBarWidth
|
|
7067
|
+
}
|
|
6969
7068
|
return barWidth
|
|
6970
7069
|
}
|
|
6971
7070
|
}
|
|
6972
7071
|
function getBarX (d, i) {
|
|
6973
7072
|
if (this.options.orientation === 'horizontal') {
|
|
6974
7073
|
if (this.options.grouping === 'stacked') {
|
|
6975
|
-
return this[yAxis](d.y.accumulative)
|
|
7074
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
6976
7075
|
}
|
|
6977
7076
|
else {
|
|
6978
7077
|
return 0
|
|
6979
7078
|
}
|
|
6980
7079
|
}
|
|
6981
7080
|
else {
|
|
6982
|
-
|
|
6983
|
-
|
|
7081
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7082
|
+
if (this.options.grouping === 'grouped') {
|
|
7083
|
+
let barAdjustment = groupedBarWidth * index + 5 // + (index > 0 ? 4 : 0)
|
|
7084
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + barAdjustment
|
|
6984
7085
|
}
|
|
6985
7086
|
else {
|
|
6986
|
-
return this[xAxis](this.parseX(d.x.value)) + (i * barWidth)
|
|
7087
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
|
|
6987
7088
|
}
|
|
6988
7089
|
}
|
|
6989
7090
|
}
|
|
6990
7091
|
function getBarY (d, i) {
|
|
6991
7092
|
if (this.options.orientation === 'horizontal') {
|
|
6992
7093
|
if (this.options.grouping !== 'grouped') {
|
|
6993
|
-
return this[xAxis](this.parseX(d.x.value))
|
|
7094
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
6994
7095
|
}
|
|
6995
7096
|
else {
|
|
6996
|
-
return this[xAxis](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
7097
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
6997
7098
|
}
|
|
6998
7099
|
}
|
|
6999
7100
|
else {
|
|
7000
7101
|
if (this.options.grouping === 'stacked') {
|
|
7001
|
-
return this[yAxis](d.y.accumulative)
|
|
7102
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
7002
7103
|
}
|
|
7003
7104
|
else {
|
|
7004
|
-
return
|
|
7105
|
+
return this.plotHeight - getBarHeight.call(this, d, i)
|
|
7005
7106
|
}
|
|
7006
7107
|
}
|
|
7007
7108
|
}
|
|
@@ -7158,18 +7259,19 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
|
|
|
7158
7259
|
return d3
|
|
7159
7260
|
.line()
|
|
7160
7261
|
.x(d => {
|
|
7161
|
-
|
|
7262
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7263
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
7162
7264
|
})
|
|
7163
7265
|
.y(d => {
|
|
7164
|
-
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7266
|
+
return this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7165
7267
|
})
|
|
7166
7268
|
.curve(d3[curveStyle || this.options.curveStyle])
|
|
7167
7269
|
}
|
|
7168
|
-
let xAxis = '
|
|
7169
|
-
let yAxis = series.axis === 'secondary' ? '
|
|
7270
|
+
let xAxis = 'bottom'
|
|
7271
|
+
let yAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7170
7272
|
if (this.options.orienation === 'horizontal') {
|
|
7171
|
-
xAxis = series.axis === 'secondary' ? '
|
|
7172
|
-
yAxis = '
|
|
7273
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7274
|
+
yAxis = 'bottom'
|
|
7173
7275
|
}
|
|
7174
7276
|
let lines = this.lineLayer.selectAll(`.line_${series.key}`)
|
|
7175
7277
|
.data([series.data])
|