@websy/websy-designs 1.9.11 → 1.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/routes/v1/shop.js +2 -1
- package/dist/websy-designs-es6.debug.js +106 -36
- package/dist/websy-designs-es6.js +86 -23
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +106 -36
- package/dist/websy-designs.js +86 -23
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
- package/dist/server/helpers/v1/puppeteer-report/examples/package-lock.json +0 -972
|
@@ -2783,7 +2783,9 @@ class MultiForm {
|
|
|
2783
2783
|
this.elementId = elementId
|
|
2784
2784
|
const DEFAULTS = {
|
|
2785
2785
|
addButton: `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 512 512"><line x1="256" y1="112" x2="256" y2="400" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="400" y1="256" x2="112" y2="256" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`,
|
|
2786
|
-
deleteButton: `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 512 512"><line x1="368" y1="368" x2="144" y2="144" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="368" y1="144" x2="144" y2="368" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg
|
|
2786
|
+
deleteButton: `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 512 512"><line x1="368" y1="368" x2="144" y2="144" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="368" y1="144" x2="144" y2="368" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>`,
|
|
2787
|
+
allowAdd: true,
|
|
2788
|
+
allowDelete: true
|
|
2787
2789
|
}
|
|
2788
2790
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
2789
2791
|
this.formData = []
|
|
@@ -2848,7 +2850,9 @@ class MultiForm {
|
|
|
2848
2850
|
deleteButtonEl.classList.remove('hidden')
|
|
2849
2851
|
}
|
|
2850
2852
|
// add new form
|
|
2851
|
-
this.
|
|
2853
|
+
if (this.options.allowAdd === true) {
|
|
2854
|
+
this.addEntry()
|
|
2855
|
+
}
|
|
2852
2856
|
}
|
|
2853
2857
|
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2854
2858
|
// delete form based on index
|
|
@@ -2884,25 +2888,33 @@ class MultiForm {
|
|
|
2884
2888
|
<div id='${this.elementId}_${d.formId}_formContainer' class='websy-multi-form-form-container'>
|
|
2885
2889
|
<div id='${this.elementId}_${d.formId}_form' class='websy-multi-form-form'>
|
|
2886
2890
|
</div>
|
|
2891
|
+
`
|
|
2892
|
+
if (this.options.allowDelete === true) {
|
|
2893
|
+
html += `
|
|
2887
2894
|
<button id='${this.elementId}_${d.formId}_deleteButton' data-formid='${d.formId}' data-rowid='${d.id}' class='websy-multi-form-delete'>
|
|
2888
2895
|
${this.options.deleteButton}
|
|
2889
|
-
</button>
|
|
2896
|
+
</button>
|
|
2897
|
+
`
|
|
2898
|
+
}
|
|
2899
|
+
html += `
|
|
2890
2900
|
</div>
|
|
2891
2901
|
`
|
|
2892
2902
|
})
|
|
2893
2903
|
let id = WebsyDesigns.Utils.createIdentity()
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
<div id='${this.elementId}_${id}
|
|
2904
|
+
if (this.options.allowAdd === true) {
|
|
2905
|
+
html += `
|
|
2906
|
+
<div id='${this.elementId}_${id}_formContainer' class='websy-multi-form-form-container'>
|
|
2907
|
+
<div id='${this.elementId}_${id}_form' class='websy-multi-form-form'>
|
|
2908
|
+
</div>
|
|
2909
|
+
<button id='${this.elementId}_${id}_deleteButton' data-formid='${id}' class='hidden websy-multi-form-delete'>
|
|
2910
|
+
${this.options.deleteButton}
|
|
2911
|
+
</button>
|
|
2912
|
+
<button id='${this.elementId}_${id}_addButton' data-formid='${id}' class='websy-multi-form-add'>
|
|
2913
|
+
${this.options.addButton}
|
|
2914
|
+
</button>
|
|
2897
2915
|
</div>
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
</button>
|
|
2901
|
-
<button id='${this.elementId}_${id}_addButton' data-formid='${id}' class='websy-multi-form-add'>
|
|
2902
|
-
${this.options.addButton}
|
|
2903
|
-
</button>
|
|
2904
|
-
</div>
|
|
2905
|
-
`
|
|
2916
|
+
`
|
|
2917
|
+
}
|
|
2906
2918
|
el.innerHTML = html
|
|
2907
2919
|
this.formData.forEach(d => {
|
|
2908
2920
|
let formOptions = Object.assign({}, this.options)
|
|
@@ -2910,8 +2922,10 @@ class MultiForm {
|
|
|
2910
2922
|
formObject.data = d
|
|
2911
2923
|
this.forms.push(formObject)
|
|
2912
2924
|
})
|
|
2913
|
-
|
|
2914
|
-
|
|
2925
|
+
if (this.options.allowAdd === true) {
|
|
2926
|
+
let formOptions = Object.assign({}, this.options)
|
|
2927
|
+
this.forms.push(new WebsyDesigns.Form(`${this.elementId}_${id}_form`, formOptions))
|
|
2928
|
+
}
|
|
2915
2929
|
}
|
|
2916
2930
|
}
|
|
2917
2931
|
validateForm () {
|
|
@@ -6680,7 +6694,8 @@ class WebsyTable3 {
|
|
|
6680
6694
|
disableInternalLoader: false,
|
|
6681
6695
|
disableTouch: false,
|
|
6682
6696
|
scrollWidth: 10,
|
|
6683
|
-
touchScrollWidth: 30
|
|
6697
|
+
touchScrollWidth: 30,
|
|
6698
|
+
autoFitColumns: true
|
|
6684
6699
|
}
|
|
6685
6700
|
this.options = Object.assign({}, DEFAULTS, options)
|
|
6686
6701
|
this.isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
|
|
@@ -7058,7 +7073,7 @@ class WebsyTable3 {
|
|
|
7058
7073
|
maxWidth = this.options.maxColWidth
|
|
7059
7074
|
}
|
|
7060
7075
|
else if (this.options.maxColWidth.indexOf('%') !== -1) {
|
|
7061
|
-
maxWidth = this.sizes.
|
|
7076
|
+
maxWidth = this.sizes.table.width * (+(this.options.maxColWidth.replace('%', '')) / 100)
|
|
7062
7077
|
}
|
|
7063
7078
|
else if (this.options.maxColWidth.indexOf('px') !== -1) {
|
|
7064
7079
|
maxWidth = +this.options.maxColWidth.replace('px', '')
|
|
@@ -7071,7 +7086,7 @@ class WebsyTable3 {
|
|
|
7071
7086
|
this.sizes.total = footerEl.getBoundingClientRect()
|
|
7072
7087
|
const rows = Array.from(tableEl.querySelectorAll('.websy-table-row'))
|
|
7073
7088
|
let totalWidth = 0
|
|
7074
|
-
this.sizes.scrollableWidth = this.sizes.
|
|
7089
|
+
this.sizes.scrollableWidth = this.sizes.table.width
|
|
7075
7090
|
let firstNonPinnedColumnWidth = 0
|
|
7076
7091
|
let columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(c => c.show !== false)
|
|
7077
7092
|
rows.forEach((row, rowIndex) => {
|
|
@@ -7080,8 +7095,10 @@ class WebsyTable3 {
|
|
|
7080
7095
|
this.sizes.cellHeight = colSize.height
|
|
7081
7096
|
if (columnsForSizing[colIndex]) {
|
|
7082
7097
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7098
|
+
columnsForSizing[colIndex].potentialWidth = 0
|
|
7083
7099
|
columnsForSizing[colIndex].actualWidth = 0
|
|
7084
7100
|
}
|
|
7101
|
+
columnsForSizing[colIndex].potentialWidth = Math.max(columnsForSizing[colIndex].potentialWidth, colSize.width)
|
|
7085
7102
|
columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth)
|
|
7086
7103
|
// if (columnsForSizing[colIndex].width) {
|
|
7087
7104
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
@@ -7101,19 +7118,53 @@ class WebsyTable3 {
|
|
|
7101
7118
|
this.sizes.totalWidth = columnsForSizing.reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
7102
7119
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter((c, i) => i >= this.pinnedColumns).reduce((a, b) => a + (b.width || b.actualWidth), 0)
|
|
7103
7120
|
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth
|
|
7104
|
-
// const outerSize = outerEl.getBoundingClientRect()
|
|
7105
|
-
if (this.sizes.totalWidth < this.sizes.
|
|
7106
|
-
let
|
|
7121
|
+
// const outerSize = outerEl.getBoundingClientRect()
|
|
7122
|
+
if (this.sizes.totalWidth < this.sizes.table.width) {
|
|
7123
|
+
let requiredSpace = 0
|
|
7124
|
+
let availableSpace = (this.sizes.table.width - this.sizes.totalWidth)
|
|
7125
|
+
columnsForSizing.forEach(c => {
|
|
7126
|
+
c.shouldGrow = true
|
|
7127
|
+
if (this.options.autoFitColumns === false) {
|
|
7128
|
+
c.shouldGrow = false
|
|
7129
|
+
if (c.potentialWidth > c.actualWidth) {
|
|
7130
|
+
c.shouldGrow = true
|
|
7131
|
+
c.growDiff = c.potentialWidth - c.actualWidth
|
|
7132
|
+
c.growDiffPerc = (c.potentialWidth - c.actualWidth) / availableSpace
|
|
7133
|
+
requiredSpace += c.growDiff
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
})
|
|
7137
|
+
let equalWidth = (this.sizes.table.width - this.sizes.totalWidth) / columnsForSizing.filter(c => c.shouldGrow).length
|
|
7107
7138
|
this.sizes.totalWidth = 0
|
|
7108
7139
|
this.sizes.totalNonPinnedWidth = 0
|
|
7109
7140
|
columnsForSizing.forEach((c, i) => {
|
|
7110
7141
|
// if (!c.width) {
|
|
7111
7142
|
// if (c.actualWidth < equalWidth) {
|
|
7112
7143
|
// adjust the width
|
|
7113
|
-
if (
|
|
7114
|
-
c.width
|
|
7144
|
+
if (this.options.autoFitColumns === true) {
|
|
7145
|
+
if (c.width) {
|
|
7146
|
+
c.width += equalWidth
|
|
7147
|
+
}
|
|
7148
|
+
c.actualWidth += equalWidth
|
|
7149
|
+
}
|
|
7150
|
+
else {
|
|
7151
|
+
if (requiredSpace > 0 && requiredSpace <= availableSpace) {
|
|
7152
|
+
if (c.shouldGrow) {
|
|
7153
|
+
if (c.width) {
|
|
7154
|
+
c.width += c.growDiff
|
|
7155
|
+
}
|
|
7156
|
+
c.actualWidth += c.growDiff
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
else {
|
|
7160
|
+
if (c.shouldGrow) {
|
|
7161
|
+
if (c.width) {
|
|
7162
|
+
c.width += availableSpace * (c.growDiff / requiredSpace)
|
|
7163
|
+
}
|
|
7164
|
+
c.actualWidth += availableSpace * (c.growDiff / requiredSpace)
|
|
7165
|
+
}
|
|
7166
|
+
}
|
|
7115
7167
|
}
|
|
7116
|
-
c.actualWidth += equalWidth
|
|
7117
7168
|
// }
|
|
7118
7169
|
// }
|
|
7119
7170
|
this.sizes.totalWidth += c.width || c.actualWidth
|
|
@@ -7124,9 +7175,9 @@ class WebsyTable3 {
|
|
|
7124
7175
|
})
|
|
7125
7176
|
}
|
|
7126
7177
|
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
7127
|
-
if (this.sizes.pinnedWidth > (this.sizes.
|
|
7178
|
+
if (this.sizes.pinnedWidth > (this.sizes.table.width - firstNonPinnedColumnWidth)) {
|
|
7128
7179
|
this.sizes.totalWidth = 0
|
|
7129
|
-
let diff = this.sizes.pinnedWidth - (this.sizes.
|
|
7180
|
+
let diff = this.sizes.pinnedWidth - (this.sizes.table.width - firstNonPinnedColumnWidth)
|
|
7130
7181
|
let oldPinnedWidth = this.sizes.pinnedWidth
|
|
7131
7182
|
this.sizes.pinnedWidth = 0
|
|
7132
7183
|
// let colDiff = diff / this.pinnedColumns
|
|
@@ -7164,7 +7215,7 @@ class WebsyTable3 {
|
|
|
7164
7215
|
else {
|
|
7165
7216
|
this.vScrollRequired = false
|
|
7166
7217
|
}
|
|
7167
|
-
if (this.sizes.totalWidth > this.sizes.
|
|
7218
|
+
if (this.sizes.totalWidth.toFixed(3) > this.sizes.table.width.toFixed(3)) {
|
|
7168
7219
|
this.hScrollRequired = true
|
|
7169
7220
|
}
|
|
7170
7221
|
else {
|
|
@@ -7529,7 +7580,6 @@ class WebsyTable3 {
|
|
|
7529
7580
|
let vHandleEl = document.getElementById(`${this.elementId}_vScrollHandle`)
|
|
7530
7581
|
if (this.vScrollRequired === true) {
|
|
7531
7582
|
vScrollEl.style.top = `${this.sizes.header.height + this.sizes.total.height}px`
|
|
7532
|
-
// vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
|
|
7533
7583
|
vScrollEl.style.height = `${this.sizes.bodyHeight}px`
|
|
7534
7584
|
if (this.isTouchDevice === true) {
|
|
7535
7585
|
vScrollEl.style.visibility = `unset`
|
|
@@ -7642,7 +7692,8 @@ class WebsyTable3 {
|
|
|
7642
7692
|
}
|
|
7643
7693
|
}
|
|
7644
7694
|
}
|
|
7645
|
-
cumulativeWidth = 0
|
|
7695
|
+
cumulativeWidth = 0
|
|
7696
|
+
let lastColWidth = 0
|
|
7646
7697
|
for (let i = this.startCol; i < this.options.allColumns[this.options.allColumns.length - 1].length; i++) {
|
|
7647
7698
|
if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
|
|
7648
7699
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
@@ -7657,9 +7708,22 @@ class WebsyTable3 {
|
|
|
7657
7708
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
7658
7709
|
this.startCol += 1
|
|
7659
7710
|
}
|
|
7660
|
-
if (
|
|
7661
|
-
|
|
7662
|
-
|
|
7711
|
+
if (
|
|
7712
|
+
scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >=
|
|
7713
|
+
scrollContainerEl.offsetWidth - lastColWidth
|
|
7714
|
+
) {
|
|
7715
|
+
this.endCol = this.options.allColumns[this.options.allColumns.length - 1].length - 1
|
|
7716
|
+
this.startCol = this.endCol + 1
|
|
7717
|
+
// one last measurement
|
|
7718
|
+
let finalAcc = 0
|
|
7719
|
+
for (let i = this.endCol; i > -1; i--) {
|
|
7720
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][i].show !== false) {
|
|
7721
|
+
finalAcc += this.options.allColumns[this.options.allColumns.length - 1][i].actualWidth
|
|
7722
|
+
if (finalAcc < this.sizes.scrollableWidth) {
|
|
7723
|
+
this.startCol--
|
|
7724
|
+
}
|
|
7725
|
+
}
|
|
7726
|
+
}
|
|
7663
7727
|
}
|
|
7664
7728
|
this.endCol = Math.max(this.startCol, this.endCol)
|
|
7665
7729
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns)
|
|
@@ -8700,6 +8764,7 @@ else {
|
|
|
8700
8764
|
let rangeLength = bottomDomain.length
|
|
8701
8765
|
this.options.data.bottomBrush = {}
|
|
8702
8766
|
this.options.data.leftBrush = {}
|
|
8767
|
+
this.options.data.rightBrush = {}
|
|
8703
8768
|
if (this.options.orientation === 'vertical') {
|
|
8704
8769
|
this.options.data.bottom.bandWidth = proposedBandWidth
|
|
8705
8770
|
this.options.data.bottomBrush.bandWidth = (this.plotWidth - this.totalBandPadding) / noOfPoints
|
|
@@ -8707,6 +8772,7 @@ else {
|
|
|
8707
8772
|
else {
|
|
8708
8773
|
this.options.data.left.bandWidth = proposedBandWidth
|
|
8709
8774
|
this.options.data.leftBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints
|
|
8775
|
+
this.options.data.rightBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints
|
|
8710
8776
|
}
|
|
8711
8777
|
this.brushBandPadding = this.totalBandPadding / noOfGroups
|
|
8712
8778
|
if (this.options.orientation === 'vertical') {
|
|
@@ -8910,7 +8976,8 @@ else {
|
|
|
8910
8976
|
// Configure the left axis
|
|
8911
8977
|
let leftDomain = this.createDomain('left')
|
|
8912
8978
|
let leftBrushDomain = this.createDomain('left')
|
|
8913
|
-
let rightDomain = this.createDomain('right')
|
|
8979
|
+
let rightDomain = this.createDomain('right')
|
|
8980
|
+
let rightBrushDomain = this.createDomain('right')
|
|
8914
8981
|
this.leftAxis = d3[`scale${this.options.data.left.scale || 'Linear'}`]()
|
|
8915
8982
|
.domain(leftDomain)
|
|
8916
8983
|
.range(leftRange)
|
|
@@ -8983,6 +9050,9 @@ else {
|
|
|
8983
9050
|
this.rightAxis = d3[`scale${this.options.data.right.scale || 'Linear'}`]()
|
|
8984
9051
|
.domain(rightDomain)
|
|
8985
9052
|
.range([this.plotHeight, 0])
|
|
9053
|
+
this.rightBrushAxis = d3[`scale${this.options.data.right.scale || 'Linear'}`]()
|
|
9054
|
+
.domain(rightBrushDomain)
|
|
9055
|
+
.range(leftBrushRange)
|
|
8986
9056
|
if (this.rightAxis.nice) {
|
|
8987
9057
|
this.rightAxis.nice()
|
|
8988
9058
|
}
|
|
@@ -9573,10 +9643,10 @@ if (this.options.orientation === 'horizontal') {
|
|
|
9573
9643
|
yAxis = 'bottom'
|
|
9574
9644
|
}
|
|
9575
9645
|
let xBrushAxis = 'bottomBrush'
|
|
9576
|
-
let yBrushAxis = 'leftBrush'
|
|
9646
|
+
let yBrushAxis = series.axis === 'secondary' ? 'rightBrush' : 'leftBrush'
|
|
9577
9647
|
if (this.options.orientation === 'horizontal') {
|
|
9578
9648
|
xBrushAxis = 'leftBrush'
|
|
9579
|
-
yBrushAxis = 'bottomBrush'
|
|
9649
|
+
yBrushAxis = 'bottomBrush'
|
|
9580
9650
|
}
|
|
9581
9651
|
let lines = this.lineLayer.selectAll(`.line_${series.key}`)
|
|
9582
9652
|
.data([series.data])
|
package/dist/websy-designs.js
CHANGED
|
@@ -2742,7 +2742,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2742
2742
|
this.elementId = elementId;
|
|
2743
2743
|
var DEFAULTS = {
|
|
2744
2744
|
addButton: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"256\" y1=\"112\" x2=\"256\" y2=\"400\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"400\" y1=\"256\" x2=\"112\" y2=\"256\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
2745
|
-
deleteButton: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>"
|
|
2745
|
+
deleteButton: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
2746
|
+
allowAdd: true,
|
|
2747
|
+
allowDelete: true
|
|
2746
2748
|
};
|
|
2747
2749
|
this.options = _extends({}, DEFAULTS, options);
|
|
2748
2750
|
this.formData = [];
|
|
@@ -2808,7 +2810,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2808
2810
|
deleteButtonEl.classList.remove('hidden');
|
|
2809
2811
|
}
|
|
2810
2812
|
// add new form
|
|
2811
|
-
this.
|
|
2813
|
+
if (this.options.allowAdd === true) {
|
|
2814
|
+
this.addEntry();
|
|
2815
|
+
}
|
|
2812
2816
|
}
|
|
2813
2817
|
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2814
2818
|
// delete form based on index
|
|
@@ -2843,10 +2847,16 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2843
2847
|
var html = '';
|
|
2844
2848
|
this.formData.forEach(function (d) {
|
|
2845
2849
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2846
|
-
html += "\n <div id='".concat(_this21.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this21.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n
|
|
2850
|
+
html += "\n <div id='".concat(_this21.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this21.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
2851
|
+
if (_this21.options.allowDelete === true) {
|
|
2852
|
+
html += "\n <button id='".concat(_this21.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this21.options.deleteButton, "\n </button>\n ");
|
|
2853
|
+
}
|
|
2854
|
+
html += "\n </div>\n ";
|
|
2847
2855
|
});
|
|
2848
2856
|
var id = WebsyDesigns.Utils.createIdentity();
|
|
2849
|
-
|
|
2857
|
+
if (this.options.allowAdd === true) {
|
|
2858
|
+
html += "\n <div id='".concat(this.elementId, "_").concat(id, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(this.elementId, "_").concat(id, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(id, "_deleteButton' data-formid='").concat(id, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(id, "_addButton' data-formid='").concat(id, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n </div>\n ");
|
|
2859
|
+
}
|
|
2850
2860
|
el.innerHTML = html;
|
|
2851
2861
|
this.formData.forEach(function (d) {
|
|
2852
2862
|
var formOptions = _extends({}, _this21.options);
|
|
@@ -2854,8 +2864,10 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2854
2864
|
formObject.data = d;
|
|
2855
2865
|
_this21.forms.push(formObject);
|
|
2856
2866
|
});
|
|
2857
|
-
|
|
2858
|
-
|
|
2867
|
+
if (this.options.allowAdd === true) {
|
|
2868
|
+
var formOptions = _extends({}, this.options);
|
|
2869
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions));
|
|
2870
|
+
}
|
|
2859
2871
|
}
|
|
2860
2872
|
}
|
|
2861
2873
|
}, {
|
|
@@ -6380,7 +6392,8 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6380
6392
|
disableInternalLoader: false,
|
|
6381
6393
|
disableTouch: false,
|
|
6382
6394
|
scrollWidth: 10,
|
|
6383
|
-
touchScrollWidth: 30
|
|
6395
|
+
touchScrollWidth: 30,
|
|
6396
|
+
autoFitColumns: true
|
|
6384
6397
|
};
|
|
6385
6398
|
this.options = _extends({}, DEFAULTS, options);
|
|
6386
6399
|
this.isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
@@ -6694,7 +6707,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6694
6707
|
if (typeof this.options.maxColWidth === 'number') {
|
|
6695
6708
|
maxWidth = this.options.maxColWidth;
|
|
6696
6709
|
} else if (this.options.maxColWidth.indexOf('%') !== -1) {
|
|
6697
|
-
maxWidth = this.sizes.
|
|
6710
|
+
maxWidth = this.sizes.table.width * (+this.options.maxColWidth.replace('%', '') / 100);
|
|
6698
6711
|
} else if (this.options.maxColWidth.indexOf('px') !== -1) {
|
|
6699
6712
|
maxWidth = +this.options.maxColWidth.replace('px', '');
|
|
6700
6713
|
}
|
|
@@ -6706,7 +6719,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6706
6719
|
this.sizes.total = footerEl.getBoundingClientRect();
|
|
6707
6720
|
var rows = Array.from(tableEl.querySelectorAll('.websy-table-row'));
|
|
6708
6721
|
var totalWidth = 0;
|
|
6709
|
-
this.sizes.scrollableWidth = this.sizes.
|
|
6722
|
+
this.sizes.scrollableWidth = this.sizes.table.width;
|
|
6710
6723
|
var firstNonPinnedColumnWidth = 0;
|
|
6711
6724
|
var columnsForSizing = this.options.columns[this.options.columns.length - 1].filter(function (c) {
|
|
6712
6725
|
return c.show !== false;
|
|
@@ -6717,8 +6730,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6717
6730
|
_this46.sizes.cellHeight = colSize.height;
|
|
6718
6731
|
if (columnsForSizing[colIndex]) {
|
|
6719
6732
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6733
|
+
columnsForSizing[colIndex].potentialWidth = 0;
|
|
6720
6734
|
columnsForSizing[colIndex].actualWidth = 0;
|
|
6721
6735
|
}
|
|
6736
|
+
columnsForSizing[colIndex].potentialWidth = Math.max(columnsForSizing[colIndex].potentialWidth, colSize.width);
|
|
6722
6737
|
columnsForSizing[colIndex].actualWidth = Math.min(Math.max(columnsForSizing[colIndex].actualWidth, colSize.width), maxWidth);
|
|
6723
6738
|
// if (columnsForSizing[colIndex].width) {
|
|
6724
6739
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
@@ -6744,19 +6759,53 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6744
6759
|
return a + (b.width || b.actualWidth);
|
|
6745
6760
|
}, 0);
|
|
6746
6761
|
this.sizes.pinnedWidth = this.sizes.totalWidth - this.sizes.totalNonPinnedWidth;
|
|
6747
|
-
// const outerSize = outerEl.getBoundingClientRect()
|
|
6748
|
-
if (this.sizes.totalWidth < this.sizes.
|
|
6749
|
-
var
|
|
6762
|
+
// const outerSize = outerEl.getBoundingClientRect()
|
|
6763
|
+
if (this.sizes.totalWidth < this.sizes.table.width) {
|
|
6764
|
+
var requiredSpace = 0;
|
|
6765
|
+
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6766
|
+
columnsForSizing.forEach(function (c) {
|
|
6767
|
+
c.shouldGrow = true;
|
|
6768
|
+
if (_this46.options.autoFitColumns === false) {
|
|
6769
|
+
c.shouldGrow = false;
|
|
6770
|
+
if (c.potentialWidth > c.actualWidth) {
|
|
6771
|
+
c.shouldGrow = true;
|
|
6772
|
+
c.growDiff = c.potentialWidth - c.actualWidth;
|
|
6773
|
+
c.growDiffPerc = (c.potentialWidth - c.actualWidth) / availableSpace;
|
|
6774
|
+
requiredSpace += c.growDiff;
|
|
6775
|
+
}
|
|
6776
|
+
}
|
|
6777
|
+
});
|
|
6778
|
+
var equalWidth = (this.sizes.table.width - this.sizes.totalWidth) / columnsForSizing.filter(function (c) {
|
|
6779
|
+
return c.shouldGrow;
|
|
6780
|
+
}).length;
|
|
6750
6781
|
this.sizes.totalWidth = 0;
|
|
6751
6782
|
this.sizes.totalNonPinnedWidth = 0;
|
|
6752
6783
|
columnsForSizing.forEach(function (c, i) {
|
|
6753
6784
|
// if (!c.width) {
|
|
6754
6785
|
// if (c.actualWidth < equalWidth) {
|
|
6755
6786
|
// adjust the width
|
|
6756
|
-
if (
|
|
6757
|
-
c.width
|
|
6787
|
+
if (_this46.options.autoFitColumns === true) {
|
|
6788
|
+
if (c.width) {
|
|
6789
|
+
c.width += equalWidth;
|
|
6790
|
+
}
|
|
6791
|
+
c.actualWidth += equalWidth;
|
|
6792
|
+
} else {
|
|
6793
|
+
if (requiredSpace > 0 && requiredSpace <= availableSpace) {
|
|
6794
|
+
if (c.shouldGrow) {
|
|
6795
|
+
if (c.width) {
|
|
6796
|
+
c.width += c.growDiff;
|
|
6797
|
+
}
|
|
6798
|
+
c.actualWidth += c.growDiff;
|
|
6799
|
+
}
|
|
6800
|
+
} else {
|
|
6801
|
+
if (c.shouldGrow) {
|
|
6802
|
+
if (c.width) {
|
|
6803
|
+
c.width += availableSpace * (c.growDiff / requiredSpace);
|
|
6804
|
+
}
|
|
6805
|
+
c.actualWidth += availableSpace * (c.growDiff / requiredSpace);
|
|
6806
|
+
}
|
|
6807
|
+
}
|
|
6758
6808
|
}
|
|
6759
|
-
c.actualWidth += equalWidth;
|
|
6760
6809
|
// }
|
|
6761
6810
|
// }
|
|
6762
6811
|
_this46.sizes.totalWidth += c.width || c.actualWidth;
|
|
@@ -6767,9 +6816,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6767
6816
|
});
|
|
6768
6817
|
}
|
|
6769
6818
|
// check that we have enough from for all of the pinned columns plus 1 non pinned column
|
|
6770
|
-
if (this.sizes.pinnedWidth > this.sizes.
|
|
6819
|
+
if (this.sizes.pinnedWidth > this.sizes.table.width - firstNonPinnedColumnWidth) {
|
|
6771
6820
|
this.sizes.totalWidth = 0;
|
|
6772
|
-
var diff = this.sizes.pinnedWidth - (this.sizes.
|
|
6821
|
+
var diff = this.sizes.pinnedWidth - (this.sizes.table.width - firstNonPinnedColumnWidth);
|
|
6773
6822
|
var oldPinnedWidth = this.sizes.pinnedWidth;
|
|
6774
6823
|
this.sizes.pinnedWidth = 0;
|
|
6775
6824
|
// let colDiff = diff / this.pinnedColumns
|
|
@@ -6806,7 +6855,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6806
6855
|
} else {
|
|
6807
6856
|
this.vScrollRequired = false;
|
|
6808
6857
|
}
|
|
6809
|
-
if (this.sizes.totalWidth > this.sizes.
|
|
6858
|
+
if (this.sizes.totalWidth.toFixed(3) > this.sizes.table.width.toFixed(3)) {
|
|
6810
6859
|
this.hScrollRequired = true;
|
|
6811
6860
|
} else {
|
|
6812
6861
|
this.hScrollRequired = false;
|
|
@@ -7195,7 +7244,6 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7195
7244
|
var vHandleEl = document.getElementById("".concat(this.elementId, "_vScrollHandle"));
|
|
7196
7245
|
if (this.vScrollRequired === true) {
|
|
7197
7246
|
vScrollEl.style.top = "".concat(this.sizes.header.height + this.sizes.total.height, "px");
|
|
7198
|
-
// vScrollEl.style.left = `${this.sizes.outer.width - (this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth)}px`
|
|
7199
7247
|
vScrollEl.style.height = "".concat(this.sizes.bodyHeight, "px");
|
|
7200
7248
|
if (this.isTouchDevice === true) {
|
|
7201
7249
|
vScrollEl.style.visibility = "unset";
|
|
@@ -7313,6 +7361,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7313
7361
|
}
|
|
7314
7362
|
}
|
|
7315
7363
|
cumulativeWidth = 0;
|
|
7364
|
+
var lastColWidth = 0;
|
|
7316
7365
|
for (var _i10 = this.startCol; _i10 < this.options.allColumns[this.options.allColumns.length - 1].length; _i10++) {
|
|
7317
7366
|
if (this.options.allColumns[this.options.allColumns.length - 1][_i10].show !== false) {
|
|
7318
7367
|
cumulativeWidth += this.options.allColumns[this.options.allColumns.length - 1][_i10].actualWidth;
|
|
@@ -7327,9 +7376,19 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7327
7376
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
7328
7377
|
this.startCol += 1;
|
|
7329
7378
|
}
|
|
7330
|
-
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth) {
|
|
7331
|
-
this.
|
|
7332
|
-
this.endCol
|
|
7379
|
+
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth - lastColWidth) {
|
|
7380
|
+
this.endCol = this.options.allColumns[this.options.allColumns.length - 1].length - 1;
|
|
7381
|
+
this.startCol = this.endCol + 1;
|
|
7382
|
+
// one last measurement
|
|
7383
|
+
var finalAcc = 0;
|
|
7384
|
+
for (var _i11 = this.endCol; _i11 > -1; _i11--) {
|
|
7385
|
+
if (this.options.allColumns[this.options.allColumns.length - 1][_i11].show !== false) {
|
|
7386
|
+
finalAcc += this.options.allColumns[this.options.allColumns.length - 1][_i11].actualWidth;
|
|
7387
|
+
if (finalAcc < this.sizes.scrollableWidth) {
|
|
7388
|
+
this.startCol--;
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
}
|
|
7333
7392
|
}
|
|
7334
7393
|
this.endCol = Math.max(this.startCol, this.endCol);
|
|
7335
7394
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
|
|
@@ -8311,12 +8370,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8311
8370
|
var rangeLength = bottomDomain.length;
|
|
8312
8371
|
this.options.data.bottomBrush = {};
|
|
8313
8372
|
this.options.data.leftBrush = {};
|
|
8373
|
+
this.options.data.rightBrush = {};
|
|
8314
8374
|
if (this.options.orientation === 'vertical') {
|
|
8315
8375
|
this.options.data.bottom.bandWidth = proposedBandWidth;
|
|
8316
8376
|
this.options.data.bottomBrush.bandWidth = (this.plotWidth - this.totalBandPadding) / noOfPoints;
|
|
8317
8377
|
} else {
|
|
8318
8378
|
this.options.data.left.bandWidth = proposedBandWidth;
|
|
8319
8379
|
this.options.data.leftBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints;
|
|
8380
|
+
this.options.data.rightBrush.bandWidth = (this.plotHeight - this.totalBandPadding) / noOfPoints;
|
|
8320
8381
|
}
|
|
8321
8382
|
this.brushBandPadding = this.totalBandPadding / noOfGroups;
|
|
8322
8383
|
if (this.options.orientation === 'vertical') {
|
|
@@ -8493,6 +8554,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8493
8554
|
var leftDomain = this.createDomain('left');
|
|
8494
8555
|
var leftBrushDomain = this.createDomain('left');
|
|
8495
8556
|
var rightDomain = this.createDomain('right');
|
|
8557
|
+
var rightBrushDomain = this.createDomain('right');
|
|
8496
8558
|
this.leftAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftDomain).range(leftRange);
|
|
8497
8559
|
this.leftBrushAxis = d3["scale".concat(this.options.data.left.scale || 'Linear')]().domain(leftBrushDomain).range(leftBrushRange);
|
|
8498
8560
|
if (this.leftAxis.padding && this.options.data.left.padding) {
|
|
@@ -8532,6 +8594,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8532
8594
|
// Configure the right axis
|
|
8533
8595
|
if (rightDomain.length > 0) {
|
|
8534
8596
|
this.rightAxis = d3["scale".concat(this.options.data.right.scale || 'Linear')]().domain(rightDomain).range([this.plotHeight, 0]);
|
|
8597
|
+
this.rightBrushAxis = d3["scale".concat(this.options.data.right.scale || 'Linear')]().domain(rightBrushDomain).range(leftBrushRange);
|
|
8535
8598
|
if (this.rightAxis.nice) {
|
|
8536
8599
|
this.rightAxis.nice();
|
|
8537
8600
|
}
|
|
@@ -9075,7 +9138,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9075
9138
|
yAxis = 'bottom';
|
|
9076
9139
|
}
|
|
9077
9140
|
var xBrushAxis = 'bottomBrush';
|
|
9078
|
-
var yBrushAxis = 'leftBrush';
|
|
9141
|
+
var yBrushAxis = series.axis === 'secondary' ? 'rightBrush' : 'leftBrush';
|
|
9079
9142
|
if (this.options.orientation === 'horizontal') {
|
|
9080
9143
|
xBrushAxis = 'leftBrush';
|
|
9081
9144
|
yBrushAxis = 'bottomBrush';
|