@websy/websy-designs 1.3.11 → 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 +181 -79
- package/dist/websy-designs-es6.js +171 -73
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +190 -79
- package/dist/websy-designs.js +182 -73
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2465,6 +2465,33 @@ const WebsyIcons = {
|
|
|
2465
2465
|
<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">
|
|
2466
2466
|
<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"/>
|
|
2467
2467
|
</svg>
|
|
2468
|
+
`,
|
|
2469
|
+
'PlusFilled': `
|
|
2470
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2471
|
+
<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"
|
|
2472
|
+
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
|
|
2473
|
+
<style type="text/css">
|
|
2474
|
+
.st0{fill:#FFFFFF;}
|
|
2475
|
+
</style>
|
|
2476
|
+
<circle cx="249.6" cy="251" r="235"/>
|
|
2477
|
+
<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
|
|
2478
|
+
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
|
|
2479
|
+
C430,239.3,426.6,234.8,422.3,234.8z"/>
|
|
2480
|
+
</svg>
|
|
2481
|
+
|
|
2482
|
+
`,
|
|
2483
|
+
'MinusFilled': `
|
|
2484
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2485
|
+
<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"
|
|
2486
|
+
viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
|
|
2487
|
+
<style type="text/css">
|
|
2488
|
+
.st0{fill:#FFFFFF;}
|
|
2489
|
+
</style>
|
|
2490
|
+
<circle cx="250.1" cy="255.4" r="235"/>
|
|
2491
|
+
<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
|
|
2492
|
+
C73.4,265.1,70,260.7,70,255.1z"/>
|
|
2493
|
+
</svg>
|
|
2494
|
+
|
|
2468
2495
|
`
|
|
2469
2496
|
}
|
|
2470
2497
|
|
|
@@ -3870,7 +3897,9 @@ class WebsyRouter {
|
|
|
3870
3897
|
const parts = params.split('&')
|
|
3871
3898
|
for (let i = 0; i < parts.length; i++) {
|
|
3872
3899
|
const bits = parts[i].split('=')
|
|
3873
|
-
|
|
3900
|
+
if (bits[0] && bits[0] !== '' && bits[1] && bits[1] !== '') {
|
|
3901
|
+
output.items[bits[0]] = bits[1]
|
|
3902
|
+
}
|
|
3874
3903
|
}
|
|
3875
3904
|
this.currentParams = output
|
|
3876
3905
|
return output
|
|
@@ -3957,18 +3986,30 @@ class WebsyRouter {
|
|
|
3957
3986
|
this.publish('hide', [children[c].view])
|
|
3958
3987
|
}
|
|
3959
3988
|
}
|
|
3960
|
-
hideView (view, group) {
|
|
3989
|
+
hideView (view, group) {
|
|
3990
|
+
if (view === '/' || view === '') {
|
|
3991
|
+
view = this.options.defaultView
|
|
3992
|
+
}
|
|
3961
3993
|
this.hideChildren(view, group)
|
|
3962
|
-
if (this.previousView !== this.currentView) {
|
|
3994
|
+
if (this.previousView !== this.currentView || group !== this.options.defaultGroup) {
|
|
3963
3995
|
this.hideTriggerItems(view, group)
|
|
3964
3996
|
this.hideViewItems(view, group)
|
|
3965
3997
|
this.publish('hide', [view])
|
|
3998
|
+
if (this.options.views && this.options.views[view]) {
|
|
3999
|
+
this.options.views[view].components.forEach(c => {
|
|
4000
|
+
if (typeof c.instance !== 'undefined') {
|
|
4001
|
+
if (c.instance.close) {
|
|
4002
|
+
c.instance.close()
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
})
|
|
4006
|
+
}
|
|
3966
4007
|
}
|
|
3967
|
-
else if (group !== this.options.defaultGroup) {
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
}
|
|
4008
|
+
// else if (group !== this.options.defaultGroup) {
|
|
4009
|
+
// this.hideTriggerItems(view, group)
|
|
4010
|
+
// this.hideViewItems(view, group)
|
|
4011
|
+
// this.publish('hide', [view])
|
|
4012
|
+
// }
|
|
3972
4013
|
}
|
|
3973
4014
|
// registerElements (root) {
|
|
3974
4015
|
// if (root.nodeName === '#document') {
|
|
@@ -4311,6 +4352,7 @@ class WebsySearch {
|
|
|
4311
4352
|
// el.addEventListener('click', this.handleClick.bind(this))
|
|
4312
4353
|
el.addEventListener('click', this.handleClick.bind(this))
|
|
4313
4354
|
el.addEventListener('keyup', this.handleKeyUp.bind(this))
|
|
4355
|
+
el.addEventListener('keyup', this.handleKeyDown.bind(this))
|
|
4314
4356
|
el.innerHTML = `
|
|
4315
4357
|
<div class='websy-search-input-container'>
|
|
4316
4358
|
${this.options.searchIcon}
|
|
@@ -4332,6 +4374,14 @@ class WebsySearch {
|
|
|
4332
4374
|
this.options.onSearch('')
|
|
4333
4375
|
}
|
|
4334
4376
|
}
|
|
4377
|
+
handleKeyDown (event) {
|
|
4378
|
+
if (event.key === 'Enter') {
|
|
4379
|
+
if (this.options.onSubmit) {
|
|
4380
|
+
this.options.onSubmit(event.target.value)
|
|
4381
|
+
return false
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4335
4385
|
handleKeyUp (event) {
|
|
4336
4386
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4337
4387
|
if (this.searchTimeoutFn) {
|
|
@@ -5900,16 +5950,19 @@ class WebsyTable3 {
|
|
|
5900
5950
|
data.forEach((row, rowIndex) => {
|
|
5901
5951
|
bodyHtml += `<tr class="websy-table-row">`
|
|
5902
5952
|
row.forEach((cell, cellIndex) => {
|
|
5903
|
-
|
|
5953
|
+
let sizeIndex = cell.level || cellIndex
|
|
5954
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined') {
|
|
5904
5955
|
return // need to revisit this logic
|
|
5905
5956
|
}
|
|
5906
|
-
let style =
|
|
5957
|
+
let style = `width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important; `
|
|
5958
|
+
let divStyle = style
|
|
5907
5959
|
if (cell.style) {
|
|
5908
5960
|
style += cell.style
|
|
5909
5961
|
}
|
|
5910
5962
|
if (useWidths === true) {
|
|
5911
|
-
style += `max-width: ${sizingColumns[
|
|
5912
|
-
|
|
5963
|
+
style += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5964
|
+
divStyle += `max-width: ${sizingColumns[sizeIndex].width || sizingColumns[sizeIndex].actualWidth}px!important;`
|
|
5965
|
+
}
|
|
5913
5966
|
if (cell.backgroundColor) {
|
|
5914
5967
|
style += `background-color: ${cell.backgroundColor}; `
|
|
5915
5968
|
if (!cell.color) {
|
|
@@ -5919,7 +5972,7 @@ class WebsyTable3 {
|
|
|
5919
5972
|
if (cell.color) {
|
|
5920
5973
|
style += `color: ${cell.color}; `
|
|
5921
5974
|
}
|
|
5922
|
-
console.log('rowspan', cell.rowspan)
|
|
5975
|
+
// console.log('rowspan', cell.rowspan)
|
|
5923
5976
|
bodyHtml += `<td
|
|
5924
5977
|
class='websy-table-cell ${(cell.classes || []).join(' ')}'
|
|
5925
5978
|
style='${style}'
|
|
@@ -5936,24 +5989,24 @@ class WebsyTable3 {
|
|
|
5936
5989
|
// `
|
|
5937
5990
|
// }
|
|
5938
5991
|
bodyHtml += `
|
|
5939
|
-
>`
|
|
5992
|
+
><div style='${divStyle}'>`
|
|
5940
5993
|
if (cell.expandable === true) {
|
|
5941
5994
|
bodyHtml += `<i
|
|
5942
5995
|
data-row-index='${rowIndex}'
|
|
5943
|
-
data-col-index='${cellIndex}'
|
|
5996
|
+
data-col-index='${cell.level || cellIndex}'
|
|
5944
5997
|
class='websy-table-cell-expand'
|
|
5945
|
-
>${WebsyDesigns.Icons.
|
|
5998
|
+
>${WebsyDesigns.Icons.PlusFilled}</i>`
|
|
5946
5999
|
}
|
|
5947
6000
|
if (cell.collapsable === true) {
|
|
5948
6001
|
bodyHtml += `<i
|
|
5949
6002
|
data-row-index='${rowIndex}'
|
|
5950
|
-
data-col-index='${cellIndex}'
|
|
6003
|
+
data-col-index='${cell.level || cellIndex}'
|
|
5951
6004
|
class='websy-table-cell-collapse'
|
|
5952
|
-
>${WebsyDesigns.Icons.
|
|
6005
|
+
>${WebsyDesigns.Icons.MinusFilled}</i>`
|
|
5953
6006
|
}
|
|
5954
6007
|
bodyHtml += `
|
|
5955
6008
|
${cell.value}
|
|
5956
|
-
</td>`
|
|
6009
|
+
</div></td>`
|
|
5957
6010
|
})
|
|
5958
6011
|
bodyHtml += `</tr>`
|
|
5959
6012
|
})
|
|
@@ -5979,9 +6032,18 @@ class WebsyTable3 {
|
|
|
5979
6032
|
}
|
|
5980
6033
|
headerHtml += `<tr class="websy-table-row websy-table-header-row">`
|
|
5981
6034
|
row.forEach((col, colIndex) => {
|
|
6035
|
+
let style = `width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important; `
|
|
6036
|
+
let divStyle = style
|
|
6037
|
+
if (useWidths === true) {
|
|
6038
|
+
style += `max-width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important;`
|
|
6039
|
+
divStyle += `max-width: ${sizingColumns[colIndex].width || sizingColumns[colIndex].actualWidth}px!important;`
|
|
6040
|
+
}
|
|
6041
|
+
if (col.style) {
|
|
6042
|
+
style += col.style
|
|
6043
|
+
}
|
|
5982
6044
|
headerHtml += `<td
|
|
5983
6045
|
class='websy-table-cell'
|
|
5984
|
-
style='${
|
|
6046
|
+
style='${style}'
|
|
5985
6047
|
colspan='${col.colspan || 1}'
|
|
5986
6048
|
rowspan='${col.rowspan || 1}'
|
|
5987
6049
|
`
|
|
@@ -5991,13 +6053,7 @@ class WebsyTable3 {
|
|
|
5991
6053
|
// width='${col.width || col.actualWidth}'
|
|
5992
6054
|
// `
|
|
5993
6055
|
// }
|
|
5994
|
-
headerHtml +=
|
|
5995
|
-
>
|
|
5996
|
-
<div>
|
|
5997
|
-
${col.name}
|
|
5998
|
-
${col.searchable === true ? this.buildSearchIcon(col, colIndex) : ''}
|
|
5999
|
-
</div>
|
|
6000
|
-
</td>`
|
|
6056
|
+
headerHtml += `><div style='${divStyle}'>${col.name}${col.searchable === true ? this.buildSearchIcon(col, colIndex) : ''}</div></td>`
|
|
6001
6057
|
})
|
|
6002
6058
|
headerHtml += `</tr>`
|
|
6003
6059
|
})
|
|
@@ -6016,11 +6072,9 @@ class WebsyTable3 {
|
|
|
6016
6072
|
return headerHtml
|
|
6017
6073
|
}
|
|
6018
6074
|
buildSearchIcon (col, index) {
|
|
6019
|
-
return
|
|
6020
|
-
<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
|
|
6075
|
+
return `<div class="websy-table-search-icon" data-col-id="${col.dimId}" data-col-index="${index}">
|
|
6021
6076
|
<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>
|
|
6022
|
-
</div
|
|
6023
|
-
`
|
|
6077
|
+
</div>`
|
|
6024
6078
|
}
|
|
6025
6079
|
buildTotalHtml (useWidths = false) {
|
|
6026
6080
|
if (!this.options.totals) {
|
|
@@ -6078,6 +6132,7 @@ class WebsyTable3 {
|
|
|
6078
6132
|
const rows = Array.from(tableEl.querySelectorAll('.websy-table-row'))
|
|
6079
6133
|
let totalWidth = 0
|
|
6080
6134
|
this.sizes.scrollableWidth = this.sizes.outer.width
|
|
6135
|
+
let firstNonPinnedColumnWidth = 0
|
|
6081
6136
|
rows.forEach((row, rowIndex) => {
|
|
6082
6137
|
Array.from(row.children).forEach((col, colIndex) => {
|
|
6083
6138
|
let colSize = col.getBoundingClientRect()
|
|
@@ -6087,7 +6142,10 @@ class WebsyTable3 {
|
|
|
6087
6142
|
this.options.columns[this.options.columns.length - 1][colIndex].actualWidth = 0
|
|
6088
6143
|
}
|
|
6089
6144
|
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)
|
|
6090
|
-
this.options.columns[this.options.columns.length - 1][colIndex].cellHeight = colSize.height
|
|
6145
|
+
this.options.columns[this.options.columns.length - 1][colIndex].cellHeight = colSize.height
|
|
6146
|
+
if (colIndex >= this.pinnedColumns) {
|
|
6147
|
+
firstNonPinnedColumnWidth = this.options.columns[this.options.columns.length - 1][colIndex].actualWidth
|
|
6148
|
+
}
|
|
6091
6149
|
}
|
|
6092
6150
|
})
|
|
6093
6151
|
})
|
|
@@ -6096,11 +6154,12 @@ class WebsyTable3 {
|
|
|
6096
6154
|
this.sizes.scrollableWidth -= col.actualWidth
|
|
6097
6155
|
}
|
|
6098
6156
|
})
|
|
6099
|
-
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
6157
|
+
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
6100
6158
|
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)
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6159
|
+
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
|
|
6160
|
+
// const outerSize = outerEl.getBoundingClientRect()
|
|
6161
|
+
if (this.sizes.totalWidth < this.sizes.outer.width) {
|
|
6162
|
+
let equalWidth = (this.sizes.outer.width - this.sizes.totalWidth) / this.options.columns[this.options.columns.length - 1].length
|
|
6104
6163
|
this.sizes.totalWidth = 0
|
|
6105
6164
|
this.sizes.totalNonPinnedWidth = 0
|
|
6106
6165
|
this.options.columns[this.options.columns.length - 1].forEach((c, i) => {
|
|
@@ -6120,6 +6179,19 @@ class WebsyTable3 {
|
|
|
6120
6179
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6121
6180
|
})
|
|
6122
6181
|
}
|
|
6182
|
+
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
6183
|
+
if (this.sizes.pinnedWidth > (this.sizes.outer.width - firstNonPinnedColumnWidth)) {
|
|
6184
|
+
this.sizes.totalWidth = 0
|
|
6185
|
+
let diff = this.sizes.pinnedWidth - (this.sizes.outer.width - firstNonPinnedColumnWidth)
|
|
6186
|
+
// let colDiff = diff / this.pinnedColumns
|
|
6187
|
+
for (let i = 0; i < this.options.columns[this.options.columns.length - 1].length; i++) {
|
|
6188
|
+
if (i < this.pinnedColumns) {
|
|
6189
|
+
let colDiff = (this.options.columns[this.options.columns.length - 1][i].actualWidth / this.sizes.pinnedWidth) * diff
|
|
6190
|
+
this.options.columns[this.options.columns.length - 1][i].actualWidth -= colDiff
|
|
6191
|
+
}
|
|
6192
|
+
this.sizes.totalWidth += this.options.columns[this.options.columns.length - 1][i].width || this.options.columns[this.options.columns.length - 1][i].actualWidth
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6123
6195
|
// take the height of the last cell as the official height for data cells
|
|
6124
6196
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
6125
6197
|
headEl.innerHTML = ''
|
|
@@ -6147,7 +6219,7 @@ class WebsyTable3 {
|
|
|
6147
6219
|
this.hScrollRequired = false
|
|
6148
6220
|
}
|
|
6149
6221
|
this.options.allColumns = this.options.columns.map(c => c)
|
|
6150
|
-
console.log('sizes', this.sizes)
|
|
6222
|
+
// console.log('sizes', this.sizes)
|
|
6151
6223
|
return this.sizes
|
|
6152
6224
|
}
|
|
6153
6225
|
createSample (data) {
|
|
@@ -6175,7 +6247,7 @@ class WebsyTable3 {
|
|
|
6175
6247
|
const colIndex = +event.target.getAttribute('data-col-index')
|
|
6176
6248
|
const rowIndex = +event.target.getAttribute('data-row-index')
|
|
6177
6249
|
if (event.target.classList.contains('websy-table-search-icon')) {
|
|
6178
|
-
console.log('clicked on search icon')
|
|
6250
|
+
// console.log('clicked on search icon')
|
|
6179
6251
|
if (this.options.columns[this.options.columns.length - 1][colIndex].onSearch) {
|
|
6180
6252
|
this.options.columns[this.options.columns.length - 1][colIndex].onSearch(event, this.options.columns[this.options.columns.length - 1][colIndex])
|
|
6181
6253
|
}
|
|
@@ -6205,8 +6277,8 @@ class WebsyTable3 {
|
|
|
6205
6277
|
const scrollHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
6206
6278
|
this.handleYStart = scrollHandleEl.offsetTop
|
|
6207
6279
|
this.mouseYStart = event.pageY
|
|
6208
|
-
console.log('mouse down', this.handleYStart, this.mouseYStart)
|
|
6209
|
-
console.log(scrollHandleEl.offsetTop)
|
|
6280
|
+
// console.log('mouse down', this.handleYStart, this.mouseYStart)
|
|
6281
|
+
// console.log(scrollHandleEl.offsetTop)
|
|
6210
6282
|
}
|
|
6211
6283
|
else if (event.target.classList.contains('websy-scroll-handle-x')) {
|
|
6212
6284
|
this.scrollDragging = true
|
|
@@ -6239,7 +6311,7 @@ class WebsyTable3 {
|
|
|
6239
6311
|
}
|
|
6240
6312
|
handleScrollWheel (event) {
|
|
6241
6313
|
event.preventDefault()
|
|
6242
|
-
console.log('scrollwheel', event)
|
|
6314
|
+
// console.log('scrollwheel', event)
|
|
6243
6315
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
6244
6316
|
this.scrollX(Math.max(-5, Math.min(5, event.deltaX)))
|
|
6245
6317
|
}
|
|
@@ -6277,7 +6349,7 @@ class WebsyTable3 {
|
|
|
6277
6349
|
const sample = this.createSample(data)
|
|
6278
6350
|
this.calculateSizes(sample, data.length, (data[0] || []).length, 0)
|
|
6279
6351
|
}
|
|
6280
|
-
console.log(this.options.columns)
|
|
6352
|
+
// console.log(this.options.columns)
|
|
6281
6353
|
const tableInnerEl = document.getElementById(`${this.elementId}_tableInner`)
|
|
6282
6354
|
if (tableInnerEl) {
|
|
6283
6355
|
tableInnerEl.style.width = `${this.sizes.totalWidth}px`
|
|
@@ -6382,7 +6454,7 @@ class WebsyTable3 {
|
|
|
6382
6454
|
handlePos = scrollHandleEl.offsetLeft + diff
|
|
6383
6455
|
}
|
|
6384
6456
|
const scrollableSpace = scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width
|
|
6385
|
-
console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
6457
|
+
// console.log('dragging x', diff, scrollContainerEl.getBoundingClientRect().width - scrollHandleEl.getBoundingClientRect().width)
|
|
6386
6458
|
scrollHandleEl.style.left = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px'
|
|
6387
6459
|
if (this.options.onScroll) {
|
|
6388
6460
|
let actualLeft = (this.sizes.totalNonPinnedWidth - this.sizes.scrollableWidth) * (Math.min(scrollableSpace, Math.max(0, handlePos)) / scrollableSpace)
|
|
@@ -6391,7 +6463,7 @@ class WebsyTable3 {
|
|
|
6391
6463
|
this.endCol = 0
|
|
6392
6464
|
for (let i = this.pinnedColumns; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
6393
6465
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
6394
|
-
console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
6466
|
+
// console.log('actualLeft', actualLeft, this.sizes.totalWidth, cumulativeWidth, cumulativeWidth + this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth)
|
|
6395
6467
|
if (actualLeft < cumulativeWidth) {
|
|
6396
6468
|
this.startCol = i
|
|
6397
6469
|
break
|
|
@@ -6407,11 +6479,11 @@ class WebsyTable3 {
|
|
|
6407
6479
|
if (this.endCol < this.options.allColumns[this.options.allColumns.length - 1].length - 1) {
|
|
6408
6480
|
this.endCol += 1
|
|
6409
6481
|
}
|
|
6410
|
-
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.
|
|
6482
|
+
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
6411
6483
|
this.startCol += 1
|
|
6412
6484
|
}
|
|
6413
6485
|
this.endCol = Math.max(this.startCol, this.endCol)
|
|
6414
|
-
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol)
|
|
6486
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
6415
6487
|
}
|
|
6416
6488
|
}
|
|
6417
6489
|
scrollY (diff) {
|
|
@@ -6435,11 +6507,11 @@ class WebsyTable3 {
|
|
|
6435
6507
|
handlePos = this.handleYStart + diff
|
|
6436
6508
|
}
|
|
6437
6509
|
else {
|
|
6438
|
-
console.log('appending not resetting')
|
|
6510
|
+
// console.log('appending not resetting')
|
|
6439
6511
|
handlePos = scrollHandleEl.offsetTop + diff
|
|
6440
6512
|
}
|
|
6441
6513
|
const scrollableSpace = scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height
|
|
6442
|
-
console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
|
|
6514
|
+
// console.log('dragging y', (diff), scrollContainerEl.getBoundingClientRect().height - scrollHandleEl.getBoundingClientRect().height)
|
|
6443
6515
|
scrollHandleEl.style.top = Math.min(scrollableSpace, Math.max(0, handlePos)) + 'px'
|
|
6444
6516
|
if (this.options.onScroll) {
|
|
6445
6517
|
this.startRow = Math.min(this.totalRowCount - this.sizes.rowsToRender, Math.max(0, Math.round((this.totalRowCount - this.sizes.rowsToRender) * (handlePos / scrollableSpace))))
|
|
@@ -6447,7 +6519,7 @@ class WebsyTable3 {
|
|
|
6447
6519
|
if (this.endRow === this.totalRowCount) {
|
|
6448
6520
|
this.startRow += 1
|
|
6449
6521
|
}
|
|
6450
|
-
this.options.onScroll('y', this.startRow, this.endRow, this.startCol, this.endCol)
|
|
6522
|
+
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
6451
6523
|
}
|
|
6452
6524
|
}
|
|
6453
6525
|
showLoading (options) {
|
|
@@ -6480,8 +6552,9 @@ class WebsyChart {
|
|
|
6480
6552
|
curveStyle: 'curveLinear',
|
|
6481
6553
|
lineWidth: 2,
|
|
6482
6554
|
forceZero: true,
|
|
6555
|
+
grouping: 'grouped',
|
|
6483
6556
|
fontSize: 14,
|
|
6484
|
-
symbolSize: 20,
|
|
6557
|
+
symbolSize: 20,
|
|
6485
6558
|
showTrackingLine: true,
|
|
6486
6559
|
showTooltip: true,
|
|
6487
6560
|
showLegend: false,
|
|
@@ -6717,11 +6790,18 @@ if (this.options.data[side].scale === 'Time') {
|
|
|
6717
6790
|
onLeft: xPoint > this.plotWidth / 2
|
|
6718
6791
|
}
|
|
6719
6792
|
if (xPoint > this.plotWidth / 2) {
|
|
6720
|
-
posOptions.left = xPoint - this.options.tooltipWidth
|
|
6793
|
+
posOptions.left = xPoint - this.options.tooltipWidth + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6794
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6795
|
+
// posOptions.left -= (this[xAxis].bandwidth())
|
|
6796
|
+
posOptions.left += 10
|
|
6797
|
+
}
|
|
6721
6798
|
}
|
|
6722
6799
|
else {
|
|
6723
6800
|
posOptions.left = xPoint + this.options.margin.left + this.options.margin.axisLeft + 15
|
|
6724
|
-
|
|
6801
|
+
if (this.options.data[xData].scale !== 'Time') {
|
|
6802
|
+
posOptions.left += (this[xAxis].bandwidth() / 2)
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6725
6805
|
posOptions.top = this.options.margin.top + this.options.margin.axisTop
|
|
6726
6806
|
if (this.options.orientation === 'horizontal') {
|
|
6727
6807
|
delete posOptions.onLeft
|
|
@@ -6855,8 +6935,10 @@ else {
|
|
|
6855
6935
|
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]}))
|
|
6856
6936
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
|
6857
6937
|
this.legendArea.style('width', '100%')
|
|
6938
|
+
this.legend.options.align = 'center'
|
|
6858
6939
|
}
|
|
6859
6940
|
if (this.options.legendPosition === 'left' || this.options.legendPosition === 'right') {
|
|
6941
|
+
this.legend.options.align = 'left'
|
|
6860
6942
|
this.legendArea.style('height', '100%')
|
|
6861
6943
|
this.legendArea.style('width', this.legend.testWidth(d3.max(legendData.map(d => d.value))) + 'px')
|
|
6862
6944
|
}
|
|
@@ -6890,6 +6972,7 @@ else {
|
|
|
6890
6972
|
this.longestLeft = 0
|
|
6891
6973
|
this.longestRight = 0
|
|
6892
6974
|
this.longestBottom = 0
|
|
6975
|
+
let firstBottom = ''
|
|
6893
6976
|
if (this.options.data.bottom && this.options.data.bottom.data && typeof this.options.data.bottom.max === 'undefined') {
|
|
6894
6977
|
// this.options.data.bottom.max = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6895
6978
|
// 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)
|
|
@@ -6900,9 +6983,17 @@ else {
|
|
|
6900
6983
|
this.longestBottom = this.options.data.bottom.max.toString()
|
|
6901
6984
|
if (this.options.data.bottom.formatter) {
|
|
6902
6985
|
this.longestBottom = this.options.data.bottom.formatter(this.options.data.bottom.max).toString()
|
|
6986
|
+
firstBottom = this.longestBottom
|
|
6903
6987
|
}
|
|
6904
6988
|
else {
|
|
6905
|
-
this.
|
|
6989
|
+
if (this.options.data.bottom.scale === 'Time') {
|
|
6990
|
+
this.longestBottom = '01/01/2000'
|
|
6991
|
+
firstBottom = '01/01/2000'
|
|
6992
|
+
}
|
|
6993
|
+
else {
|
|
6994
|
+
this.longestBottom = this.options.data.bottom.data.reduce((a, b) => a.length > b.value.length ? a : b.value, '')
|
|
6995
|
+
firstBottom = this.options.data.bottom.data[0].value
|
|
6996
|
+
}
|
|
6906
6997
|
}
|
|
6907
6998
|
}
|
|
6908
6999
|
if (this.options.data.left && this.options.data.left.data && this.options.data.left.max === 'undefined') {
|
|
@@ -6938,7 +7029,20 @@ else {
|
|
|
6938
7029
|
let longestLeftBounds = WebsyUtils.measureText(this.longestLeft, 0, ((this.options.data.left && this.options.data.left.fontSize) || this.options.fontSize))
|
|
6939
7030
|
let longestRightBounds = WebsyUtils.measureText(this.longestRight, 0, ((this.options.data.right && this.options.data.right.fontSize) || this.options.fontSize))
|
|
6940
7031
|
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))
|
|
6941
|
-
|
|
7032
|
+
let firstBottomWidth = 0
|
|
7033
|
+
if (this.options.orientation === 'vertical') {
|
|
7034
|
+
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
|
|
7035
|
+
if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) !== 90) {
|
|
7036
|
+
firstBottomWidth = firstBottomWidth / 2
|
|
7037
|
+
}
|
|
7038
|
+
else if (Math.abs((this.options.data.bottom && this.options.data.bottom.rotate) || 0) === 90) {
|
|
7039
|
+
firstBottomWidth = 0
|
|
7040
|
+
}
|
|
7041
|
+
if (this.options.data.bottom.scale !== 'Time') {
|
|
7042
|
+
firstBottom = Math.max(0, firstBottomWidth)
|
|
7043
|
+
}
|
|
7044
|
+
}
|
|
7045
|
+
this.options.margin.axisLeft = Math.max(longestLeftBounds.width, firstBottomWidth)
|
|
6942
7046
|
this.options.margin.axisRight = longestRightBounds.width
|
|
6943
7047
|
this.options.margin.axisBottom = longestBottomBounds.height + 10
|
|
6944
7048
|
this.options.margin.axisTop = 0
|
|
@@ -7154,7 +7258,7 @@ else {
|
|
|
7154
7258
|
.append('text')
|
|
7155
7259
|
.attr('class', 'title')
|
|
7156
7260
|
.attr('x', (1 - this.plotHeight / 2))
|
|
7157
|
-
.attr('y',
|
|
7261
|
+
.attr('y', (this.options.data.left.titleFontSize || 10) / 2 + 2)
|
|
7158
7262
|
.attr('font-size', this.options.data.left.titleFontSize || 10)
|
|
7159
7263
|
.attr('fill', this.options.data.left.titleColor || '#888888')
|
|
7160
7264
|
.attr('text-anchor', 'middle')
|
|
@@ -7304,69 +7408,75 @@ areas.enter().append('path')
|
|
|
7304
7408
|
}
|
|
7305
7409
|
renderbar (series, index) {
|
|
7306
7410
|
/* global series index d3 */
|
|
7307
|
-
let xAxis = '
|
|
7308
|
-
let yAxis = '
|
|
7411
|
+
let xAxis = 'bottom'
|
|
7412
|
+
let yAxis = 'left'
|
|
7309
7413
|
let bars = this.barLayer.selectAll(`.bar_${series.key}`).data(series.data)
|
|
7310
7414
|
let acummulativeY = new Array(this.options.data.series.length).fill(0)
|
|
7311
7415
|
if (this.options.orientation === 'horizontal') {
|
|
7312
|
-
xAxis = '
|
|
7313
|
-
yAxis = '
|
|
7314
|
-
}
|
|
7315
|
-
let barWidth = this[xAxis].bandwidth()
|
|
7316
|
-
if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
7317
|
-
barWidth = barWidth / this.options.data.series.length - 4
|
|
7416
|
+
xAxis = 'left'
|
|
7417
|
+
yAxis = 'bottom'
|
|
7318
7418
|
}
|
|
7419
|
+
let barWidth = this[`${xAxis}Axis`].bandwidth()
|
|
7420
|
+
let groupedBarWidth = (barWidth - 10) / this.options.data.series.length
|
|
7421
|
+
// if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
7422
|
+
// barWidth = barWidth / this.options.data.series.length - 4
|
|
7423
|
+
// }
|
|
7319
7424
|
function getBarHeight (d, i) {
|
|
7320
7425
|
if (this.options.orientation === 'horizontal') {
|
|
7321
7426
|
return barWidth
|
|
7322
7427
|
}
|
|
7323
7428
|
else {
|
|
7324
|
-
return this[yAxis](d.y.value)
|
|
7429
|
+
return this[`${yAxis}Axis`](d.y.value)
|
|
7325
7430
|
}
|
|
7326
7431
|
}
|
|
7327
7432
|
function getBarWidth (d, i) {
|
|
7328
7433
|
if (this.options.orientation === 'horizontal') {
|
|
7329
|
-
let width = this[yAxis](d.y.value)
|
|
7434
|
+
let width = this[`${yAxis}Axis`](d.y.value)
|
|
7330
7435
|
acummulativeY[d.y.index] += width
|
|
7331
7436
|
return width
|
|
7332
7437
|
}
|
|
7333
7438
|
else {
|
|
7439
|
+
if (this.options.grouping === 'grouped') {
|
|
7440
|
+
return groupedBarWidth
|
|
7441
|
+
}
|
|
7334
7442
|
return barWidth
|
|
7335
7443
|
}
|
|
7336
7444
|
}
|
|
7337
7445
|
function getBarX (d, i) {
|
|
7338
7446
|
if (this.options.orientation === 'horizontal') {
|
|
7339
7447
|
if (this.options.grouping === 'stacked') {
|
|
7340
|
-
return this[yAxis](d.y.accumulative)
|
|
7448
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
7341
7449
|
}
|
|
7342
7450
|
else {
|
|
7343
7451
|
return 0
|
|
7344
7452
|
}
|
|
7345
7453
|
}
|
|
7346
7454
|
else {
|
|
7347
|
-
|
|
7348
|
-
|
|
7455
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7456
|
+
if (this.options.grouping === 'grouped') {
|
|
7457
|
+
let barAdjustment = groupedBarWidth * index + 5 // + (index > 0 ? 4 : 0)
|
|
7458
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + barAdjustment
|
|
7349
7459
|
}
|
|
7350
7460
|
else {
|
|
7351
|
-
return this[xAxis](this.parseX(d.x.value)) + (i * barWidth)
|
|
7461
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + (i * barWidth) + adjustment
|
|
7352
7462
|
}
|
|
7353
7463
|
}
|
|
7354
7464
|
}
|
|
7355
7465
|
function getBarY (d, i) {
|
|
7356
7466
|
if (this.options.orientation === 'horizontal') {
|
|
7357
7467
|
if (this.options.grouping !== 'grouped') {
|
|
7358
|
-
return this[xAxis](this.parseX(d.x.value))
|
|
7468
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value))
|
|
7359
7469
|
}
|
|
7360
7470
|
else {
|
|
7361
|
-
return this[xAxis](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
7471
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + ((d.y.index || i) * barWidth)
|
|
7362
7472
|
}
|
|
7363
7473
|
}
|
|
7364
7474
|
else {
|
|
7365
7475
|
if (this.options.grouping === 'stacked') {
|
|
7366
|
-
return this[yAxis](d.y.accumulative)
|
|
7476
|
+
return this[`${yAxis}Axis`](d.y.accumulative)
|
|
7367
7477
|
}
|
|
7368
7478
|
else {
|
|
7369
|
-
return
|
|
7479
|
+
return this.plotHeight - getBarHeight.call(this, d, i)
|
|
7370
7480
|
}
|
|
7371
7481
|
}
|
|
7372
7482
|
}
|
|
@@ -7523,18 +7633,19 @@ const drawLine = (xAxis, yAxis, curveStyle) => {
|
|
|
7523
7633
|
return d3
|
|
7524
7634
|
.line()
|
|
7525
7635
|
.x(d => {
|
|
7526
|
-
|
|
7636
|
+
let adjustment = this.options.data[xAxis].scale === 'Time' ? 0 : this[`${xAxis}Axis`].bandwidth() / 2
|
|
7637
|
+
return this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment
|
|
7527
7638
|
})
|
|
7528
7639
|
.y(d => {
|
|
7529
|
-
return this[yAxis](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7640
|
+
return this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)
|
|
7530
7641
|
})
|
|
7531
7642
|
.curve(d3[curveStyle || this.options.curveStyle])
|
|
7532
7643
|
}
|
|
7533
|
-
let xAxis = '
|
|
7534
|
-
let yAxis = series.axis === 'secondary' ? '
|
|
7644
|
+
let xAxis = 'bottom'
|
|
7645
|
+
let yAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7535
7646
|
if (this.options.orienation === 'horizontal') {
|
|
7536
|
-
xAxis = series.axis === 'secondary' ? '
|
|
7537
|
-
yAxis = '
|
|
7647
|
+
xAxis = series.axis === 'secondary' ? 'right' : 'left'
|
|
7648
|
+
yAxis = 'bottom'
|
|
7538
7649
|
}
|
|
7539
7650
|
let lines = this.lineLayer.selectAll(`.line_${series.key}`)
|
|
7540
7651
|
.data([series.data])
|