@websy/websy-designs 1.1.9 → 1.1.12
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 +77 -34
- package/dist/websy-designs-es6.js +77 -29
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +79 -36
- package/dist/websy-designs.js +79 -31
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -318,7 +318,7 @@ class WebsyCarousel {
|
|
|
318
318
|
html += `<div class="websy-btn-parent">`
|
|
319
319
|
this.options.frames.forEach((frame, frameIndex) => {
|
|
320
320
|
html += `
|
|
321
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-index="${frameIndex}" id="${this.elementId}_selector_${frameIndex}"
|
|
321
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 512 512" data-index="${frameIndex}" id="${this.elementId}_selector_${frameIndex}"
|
|
322
322
|
class="websy-progress-btn ${this.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : ''}">
|
|
323
323
|
<title>Ellipse</title><circle cx="256" cy="256" r="192" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/>
|
|
324
324
|
</svg>
|
|
@@ -333,7 +333,7 @@ class WebsyCarousel {
|
|
|
333
333
|
<title>Caret Back</title>
|
|
334
334
|
<path d="M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z"/>
|
|
335
335
|
</svg>
|
|
336
|
-
|
|
336
|
+
|
|
337
337
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="websy-next-arrow">
|
|
338
338
|
<title>Caret Forward</title>
|
|
339
339
|
<path d="M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z"/>
|
|
@@ -390,6 +390,7 @@ class WebsyDatePicker {
|
|
|
390
390
|
this.validDates = []
|
|
391
391
|
this.validYears = []
|
|
392
392
|
this.customRangeSelected = true
|
|
393
|
+
this.shiftPressed = false
|
|
393
394
|
const DEFAULTS = {
|
|
394
395
|
defaultRange: 0,
|
|
395
396
|
minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
|
|
@@ -481,6 +482,8 @@ class WebsyDatePicker {
|
|
|
481
482
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this))
|
|
482
483
|
el.addEventListener('mouseover', this.handleMouseOver.bind(this))
|
|
483
484
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this))
|
|
485
|
+
document.addEventListener('keydown', this.handleKeyDown.bind(this))
|
|
486
|
+
document.addEventListener('keyup', this.handleKeyUp.bind(this))
|
|
484
487
|
let html = `
|
|
485
488
|
<div class='websy-date-picker-container'>
|
|
486
489
|
<span class='websy-dropdown-header-label'>${this.options.label || 'Date'}</span>
|
|
@@ -497,6 +500,7 @@ class WebsyDatePicker {
|
|
|
497
500
|
</div><!--
|
|
498
501
|
--><div id='${this.elementId}_datelist' class='websy-date-picker-custom'>${this.renderDates()}</div>
|
|
499
502
|
<div class='websy-dp-button-container'>
|
|
503
|
+
<span class="dp-footnote">Click and drag or hold Shift and click to select a range of values</span>
|
|
500
504
|
<button class='${this.options.cancelBtnClasses || ''} websy-btn websy-dp-cancel'>
|
|
501
505
|
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 512 512"><line x1="368" y1="368" x2="144" y2="144" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/><line x1="368" y1="144" x2="144" y2="368" style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px"/></svg>
|
|
502
506
|
</button>
|
|
@@ -573,20 +577,37 @@ class WebsyDatePicker {
|
|
|
573
577
|
this.close()
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
580
|
+
handleKeyDown (event) {
|
|
581
|
+
console.log('key down', event)
|
|
582
|
+
if (event.key === 'Shift') {
|
|
583
|
+
this.dragging = true
|
|
584
|
+
this.shiftPressed = true
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
handleKeyUp (event) {
|
|
588
|
+
this.dragging = false
|
|
589
|
+
this.shiftPressed = false
|
|
590
|
+
}
|
|
591
|
+
handleMouseDown (event) {
|
|
592
|
+
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
593
|
+
this.mouseDownId = this.currentselection[this.currentselection.length - 1]
|
|
594
|
+
this.selectDate(+event.target.id.split('_')[0])
|
|
589
595
|
}
|
|
596
|
+
else {
|
|
597
|
+
this.mouseDown = true
|
|
598
|
+
this.dragging = false
|
|
599
|
+
if (event.target.classList.contains('websy-dp-date')) {
|
|
600
|
+
if (event.target.classList.contains('websy-disabled-date')) {
|
|
601
|
+
return
|
|
602
|
+
}
|
|
603
|
+
if (this.customRangeSelected === true) {
|
|
604
|
+
this.currentselection = []
|
|
605
|
+
this.customRangeSelected = false
|
|
606
|
+
}
|
|
607
|
+
this.mouseDownId = +event.target.id.split('_')[0]
|
|
608
|
+
this.selectDate(this.mouseDownId)
|
|
609
|
+
}
|
|
610
|
+
}
|
|
590
611
|
}
|
|
591
612
|
handleMouseOver (event) {
|
|
592
613
|
if (this.mouseDown === true) {
|
|
@@ -635,8 +656,8 @@ class WebsyDatePicker {
|
|
|
635
656
|
let d
|
|
636
657
|
let rangeStart
|
|
637
658
|
let rangeEnd
|
|
638
|
-
if (this.options.mode === 'date') {
|
|
639
|
-
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
|
|
659
|
+
if (this.options.mode === 'date') {
|
|
660
|
+
d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
|
|
640
661
|
d = d.getTime()
|
|
641
662
|
rangeStart = this.selectedRangeDates[0].getTime()
|
|
642
663
|
rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
|
|
@@ -648,7 +669,7 @@ class WebsyDatePicker {
|
|
|
648
669
|
}
|
|
649
670
|
let dateEl
|
|
650
671
|
if (this.options.mode === 'date') {
|
|
651
|
-
dateEl = document.getElementById(`${d
|
|
672
|
+
dateEl = document.getElementById(`${d}_date`)
|
|
652
673
|
}
|
|
653
674
|
else if (this.options.mode === 'year') {
|
|
654
675
|
dateEl = document.getElementById(`${d}_year`)
|
|
@@ -942,7 +963,10 @@ class WebsyDatePicker {
|
|
|
942
963
|
let range
|
|
943
964
|
if (this.selectedRange === -1) {
|
|
944
965
|
const list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(d => {
|
|
945
|
-
if (this.options.mode === 'date') {
|
|
966
|
+
if (this.options.mode === 'date') {
|
|
967
|
+
if (!d.toLocaleDateString) {
|
|
968
|
+
d = new Date(d)
|
|
969
|
+
}
|
|
946
970
|
return d.toLocaleDateString()
|
|
947
971
|
}
|
|
948
972
|
else if (this.options.mode === 'year') {
|
|
@@ -1087,9 +1111,11 @@ class WebsyDropdown {
|
|
|
1087
1111
|
close () {
|
|
1088
1112
|
const maskEl = document.getElementById(`${this.elementId}_mask`)
|
|
1089
1113
|
const contentEl = document.getElementById(`${this.elementId}_content`)
|
|
1114
|
+
const scrollEl = document.getElementById(`${this.elementId}_itemsContainer`)
|
|
1115
|
+
scrollEl.scrollTop = 0
|
|
1090
1116
|
maskEl.classList.remove('active')
|
|
1091
1117
|
contentEl.classList.remove('active')
|
|
1092
|
-
contentEl.classList.remove('on-top')
|
|
1118
|
+
contentEl.classList.remove('on-top')
|
|
1093
1119
|
const searchEl = document.getElementById(`${this.elementId}_search`)
|
|
1094
1120
|
if (searchEl) {
|
|
1095
1121
|
if (searchEl.value.length > 0 && this.options.onCancelSearch) {
|
|
@@ -1097,6 +1123,9 @@ class WebsyDropdown {
|
|
|
1097
1123
|
searchEl.value = ''
|
|
1098
1124
|
}
|
|
1099
1125
|
}
|
|
1126
|
+
if (this.options.onClose) {
|
|
1127
|
+
this.options.onClose(this.elementId)
|
|
1128
|
+
}
|
|
1100
1129
|
}
|
|
1101
1130
|
handleClick (event) {
|
|
1102
1131
|
if (this.options.disabled === true) {
|
|
@@ -1209,6 +1238,9 @@ class WebsyDropdown {
|
|
|
1209
1238
|
searchEl.focus()
|
|
1210
1239
|
}
|
|
1211
1240
|
}
|
|
1241
|
+
if (this.options.onOpen) {
|
|
1242
|
+
this.options.onOpen(this.elementId)
|
|
1243
|
+
}
|
|
1212
1244
|
}
|
|
1213
1245
|
render () {
|
|
1214
1246
|
if (!this.elementId) {
|
|
@@ -2611,7 +2643,7 @@ class WebsyRouter {
|
|
|
2611
2643
|
this.currentViewMain = this.options.defaultView
|
|
2612
2644
|
}
|
|
2613
2645
|
if (view !== '') {
|
|
2614
|
-
this.showView(view, params)
|
|
2646
|
+
this.showView(view, params, 'main')
|
|
2615
2647
|
}
|
|
2616
2648
|
}
|
|
2617
2649
|
handleFocus (event) {
|
|
@@ -2642,6 +2674,11 @@ class WebsyRouter {
|
|
|
2642
2674
|
this.hideTriggerItems(view, group)
|
|
2643
2675
|
this.hideViewItems(view, group)
|
|
2644
2676
|
this.publish('hide', [view])
|
|
2677
|
+
}
|
|
2678
|
+
else if (group !== this.options.defaultGroup) {
|
|
2679
|
+
this.hideTriggerItems(view, group)
|
|
2680
|
+
this.hideViewItems(view, group)
|
|
2681
|
+
this.publish('hide', [view])
|
|
2645
2682
|
}
|
|
2646
2683
|
}
|
|
2647
2684
|
// registerElements (root) {
|
|
@@ -2740,7 +2777,7 @@ class WebsyRouter {
|
|
|
2740
2777
|
})
|
|
2741
2778
|
}
|
|
2742
2779
|
}
|
|
2743
|
-
showView (view, params) {
|
|
2780
|
+
showView (view, params, group) {
|
|
2744
2781
|
this.activateItem(view, this.options.triggerClass)
|
|
2745
2782
|
this.activateItem(view, this.options.viewClass)
|
|
2746
2783
|
let children = this.getActiveViewsFromParent(view)
|
|
@@ -2748,15 +2785,15 @@ class WebsyRouter {
|
|
|
2748
2785
|
this.activateItem(children[c].view, this.options.triggerClass)
|
|
2749
2786
|
this.activateItem(children[c].view, this.options.viewClass)
|
|
2750
2787
|
this.showComponents(children[c].view)
|
|
2751
|
-
this.publish('show', [children[c].view])
|
|
2788
|
+
this.publish('show', [children[c].view, null, group])
|
|
2752
2789
|
}
|
|
2753
|
-
if (this.previousView !== this.currentView) {
|
|
2790
|
+
if (this.previousView !== this.currentView || group !== 'main') {
|
|
2754
2791
|
this.showComponents(view)
|
|
2755
|
-
this.publish('show', [view, params])
|
|
2792
|
+
this.publish('show', [view, params, group])
|
|
2756
2793
|
}
|
|
2757
2794
|
}
|
|
2758
2795
|
reloadCurrentView () {
|
|
2759
|
-
this.showView(this.currentView, this.currentParams)
|
|
2796
|
+
this.showView(this.currentView, this.currentParams, 'main')
|
|
2760
2797
|
}
|
|
2761
2798
|
navigate (inputPath, group = 'main', event, popped) {
|
|
2762
2799
|
if (typeof popped === 'undefined') {
|
|
@@ -2853,10 +2890,10 @@ class WebsyRouter {
|
|
|
2853
2890
|
return
|
|
2854
2891
|
}
|
|
2855
2892
|
if (toggle === false) {
|
|
2856
|
-
this.showView(this.currentView, this.currentParams)
|
|
2893
|
+
this.showView(this.currentView, this.currentParams, group)
|
|
2857
2894
|
}
|
|
2858
2895
|
else if (newPath && newPath !== '') {
|
|
2859
|
-
this.showView(newPath)
|
|
2896
|
+
this.showView(newPath, null, group)
|
|
2860
2897
|
}
|
|
2861
2898
|
if (this.usesHTMLSuffix === true) {
|
|
2862
2899
|
inputPath = window.location.pathname.split('/').pop() + inputPath
|
|
@@ -2975,7 +3012,7 @@ class Switch {
|
|
|
2975
3012
|
this.render()
|
|
2976
3013
|
}
|
|
2977
3014
|
}
|
|
2978
|
-
|
|
3015
|
+
disable () {
|
|
2979
3016
|
this.options.enabled = false
|
|
2980
3017
|
this.render()
|
|
2981
3018
|
}
|
|
@@ -3774,7 +3811,7 @@ class WebsyTable2 {
|
|
|
3774
3811
|
selectedItems: [pageOptions.indexOf(this.options.pageSize)],
|
|
3775
3812
|
items: pageOptions.map(p => ({ label: p.toString(), value: p })),
|
|
3776
3813
|
allowClear: false,
|
|
3777
|
-
disableSearch: true,
|
|
3814
|
+
disableSearch: true,
|
|
3778
3815
|
onItemSelected: (selectedItem) => {
|
|
3779
3816
|
if (this.options.onChangePageSize) {
|
|
3780
3817
|
this.options.onChangePageSize(selectedItem.value)
|
|
@@ -4413,8 +4450,11 @@ if (this.options.data[side].scale === 'Time') {
|
|
|
4413
4450
|
this.options.data.series.forEach(s => {
|
|
4414
4451
|
if (this.options.data[xData].scale !== 'Time') {
|
|
4415
4452
|
xPoint = this[xAxis](this.parseX(xLabel))
|
|
4416
|
-
s.data.forEach(d => {
|
|
4453
|
+
s.data.forEach(d => {
|
|
4417
4454
|
if (d.x.value === xLabel) {
|
|
4455
|
+
if (!tooltipTitle) {
|
|
4456
|
+
tooltipTitle = d.x.value
|
|
4457
|
+
}
|
|
4418
4458
|
if (!d.y.color) {
|
|
4419
4459
|
d.y.color = s.color
|
|
4420
4460
|
}
|
|
@@ -5075,7 +5115,7 @@ if (this.options.orientation === 'horizontal') {
|
|
|
5075
5115
|
yAxis = 'bottomAxis'
|
|
5076
5116
|
}
|
|
5077
5117
|
let barWidth = this[xAxis].bandwidth()
|
|
5078
|
-
if (this.options.data.series.length > 1 && this.options.grouping
|
|
5118
|
+
if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
5079
5119
|
barWidth = barWidth / this.options.data.series.length - 4
|
|
5080
5120
|
}
|
|
5081
5121
|
function getBarHeight (d, i) {
|
|
@@ -5106,7 +5146,7 @@ function getBarX (d, i) {
|
|
|
5106
5146
|
}
|
|
5107
5147
|
}
|
|
5108
5148
|
else {
|
|
5109
|
-
if (this.options.grouping !== '
|
|
5149
|
+
if (this.options.grouping !== 'grouped') {
|
|
5110
5150
|
return this[xAxis](this.parseX(d.x.value))
|
|
5111
5151
|
}
|
|
5112
5152
|
else {
|
|
@@ -5116,7 +5156,7 @@ function getBarX (d, i) {
|
|
|
5116
5156
|
}
|
|
5117
5157
|
function getBarY (d, i) {
|
|
5118
5158
|
if (this.options.orientation === 'horizontal') {
|
|
5119
|
-
if (this.options.grouping !== '
|
|
5159
|
+
if (this.options.grouping !== 'grouped') {
|
|
5120
5160
|
return this[xAxis](this.parseX(d.x.value))
|
|
5121
5161
|
}
|
|
5122
5162
|
else {
|
|
@@ -5201,7 +5241,10 @@ if (this.options.showLabels) {
|
|
|
5201
5241
|
.text(d => d.y.label || d.y.value)
|
|
5202
5242
|
.each(function (d, i) {
|
|
5203
5243
|
if (that.options.orientation === 'horizontal') {
|
|
5204
|
-
if (that.
|
|
5244
|
+
if (that.options.grouping === 'stacked') {
|
|
5245
|
+
this.setAttribute('text-anchor', 'middle')
|
|
5246
|
+
}
|
|
5247
|
+
else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
5205
5248
|
this.setAttribute('text-anchor', 'end')
|
|
5206
5249
|
this.setAttribute('x', +(this.getAttribute('x')) - 8)
|
|
5207
5250
|
}
|
|
@@ -5657,7 +5700,7 @@ class WebsyMap {
|
|
|
5657
5700
|
render () {
|
|
5658
5701
|
const mapEl = document.getElementById(`${this.elementId}_map`)
|
|
5659
5702
|
const legendEl = document.getElementById(`${this.elementId}_map`)
|
|
5660
|
-
if (this.options.showLegend === true) {
|
|
5703
|
+
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
5661
5704
|
let legendData = this.options.data.polygons.map((s, i) => ({value: s.label || s.key, color: s.color || this.options.colors[i % this.options.colors.length]}))
|
|
5662
5705
|
let longestValue = legendData.map(s => s.value).reduce((a, b) => a.length > b.length ? a : b)
|
|
5663
5706
|
if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
|
package/dist/websy-designs.js
CHANGED
|
@@ -424,13 +424,13 @@ var WebsyCarousel = /*#__PURE__*/function () {
|
|
|
424
424
|
if (this.options.showFrameSelector === true) {
|
|
425
425
|
html += "<div class=\"websy-btn-parent\">";
|
|
426
426
|
this.options.frames.forEach(function (frame, frameIndex) {
|
|
427
|
-
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n <title>Ellipse</title><circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n ");
|
|
427
|
+
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 512 512\" data-index=\"".concat(frameIndex, "\" id=\"").concat(_this3.elementId, "_selector_").concat(frameIndex, "\" \n class=\"websy-progress-btn ").concat(_this3.options.currentFrame === frameIndex ? 'websy-progress-btn-active' : '', "\">\n <title>Ellipse</title><circle cx=\"256\" cy=\"256\" r=\"192\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"32\"/>\n </svg>\n ");
|
|
428
428
|
});
|
|
429
429
|
html += "</div>";
|
|
430
430
|
}
|
|
431
431
|
|
|
432
432
|
if (this.options.showPrevNext === true) {
|
|
433
|
-
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n
|
|
433
|
+
html += "\n <svg xmlns=\"http://www.w3.org/2000/svg\" class=\"websy-prev-arrow\"\n viewBox=\"0 0 512 512\">\n <title>Caret Back</title>\n <path d=\"M321.94 98L158.82 237.78a24 24 0 000 36.44L321.94 414c15.57 13.34 39.62 2.28 39.62-18.22v-279.6c0-20.5-24.05-31.56-39.62-18.18z\"/>\n </svg>\n \n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"websy-next-arrow\">\n <title>Caret Forward</title>\n <path d=\"M190.06 414l163.12-139.78a24 24 0 000-36.44L190.06 98c-15.57-13.34-39.62-2.28-39.62 18.22v279.6c0 20.5 24.05 31.56 39.62 18.18z\"/>\n </svg>\n ";
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
html += "\n </div>\n ";
|
|
@@ -485,6 +485,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
485
485
|
this.validDates = [];
|
|
486
486
|
this.validYears = [];
|
|
487
487
|
this.customRangeSelected = true;
|
|
488
|
+
this.shiftPressed = false;
|
|
488
489
|
var DEFAULTS = {
|
|
489
490
|
defaultRange: 0,
|
|
490
491
|
minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
|
|
@@ -566,7 +567,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
566
567
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
567
568
|
el.addEventListener('mouseover', this.handleMouseOver.bind(this));
|
|
568
569
|
el.addEventListener('mouseup', this.handleMouseUp.bind(this));
|
|
569
|
-
|
|
570
|
+
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
571
|
+
document.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
572
|
+
var html = "\n <div class='websy-date-picker-container'>\n <span class='websy-dropdown-header-label'>".concat(this.options.label || 'Date', "</span>\n <div class='websy-date-picker-header'>\n <span id='").concat(this.elementId, "_selectedRange'>").concat(this.options.ranges[this.options.mode][this.selectedRange].label, "</span>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M23.677 18.52c.914 1.523-.183 3.472-1.967 3.472h-19.414c-1.784 0-2.881-1.949-1.967-3.472l9.709-16.18c.891-1.483 3.041-1.48 3.93 0l9.709 16.18z\"/></svg>\n </div>\n <div id='").concat(this.elementId, "_mask' class='websy-date-picker-mask'></div>\n <div id='").concat(this.elementId, "_content' class='websy-date-picker-content'>\n <div class='websy-date-picker-ranges'>\n <ul id='").concat(this.elementId, "_rangelist'>\n ").concat(this.renderRanges(), "\n </ul>\n </div><!--\n --><div id='").concat(this.elementId, "_datelist' class='websy-date-picker-custom'>").concat(this.renderDates(), "</div>\n <div class='websy-dp-button-container'>\n <span class=\"dp-footnote\">Click and drag or hold Shift and click to select a range of values</span>\n <button class='").concat(this.options.cancelBtnClasses || '', " websy-btn websy-dp-cancel'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n <button class='").concat(this.options.confirmBtnClasses || '', " websy-btn websy-dp-confirm'>\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 512 512\"><polyline points=\"416 128 192 384 96 288\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>\n </button>\n </div>\n </div> \n </div>\n ");
|
|
570
573
|
el.innerHTML = html;
|
|
571
574
|
this.render();
|
|
572
575
|
} else {
|
|
@@ -635,24 +638,45 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
635
638
|
this.close();
|
|
636
639
|
}
|
|
637
640
|
}
|
|
641
|
+
}, {
|
|
642
|
+
key: "handleKeyDown",
|
|
643
|
+
value: function handleKeyDown(event) {
|
|
644
|
+
console.log('key down', event);
|
|
645
|
+
|
|
646
|
+
if (event.key === 'Shift') {
|
|
647
|
+
this.dragging = true;
|
|
648
|
+
this.shiftPressed = true;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}, {
|
|
652
|
+
key: "handleKeyUp",
|
|
653
|
+
value: function handleKeyUp(event) {
|
|
654
|
+
this.dragging = false;
|
|
655
|
+
this.shiftPressed = false;
|
|
656
|
+
}
|
|
638
657
|
}, {
|
|
639
658
|
key: "handleMouseDown",
|
|
640
659
|
value: function handleMouseDown(event) {
|
|
641
|
-
this.
|
|
642
|
-
|
|
660
|
+
if (this.shiftPressed === true && this.currentselection.length > 0) {
|
|
661
|
+
this.mouseDownId = this.currentselection[this.currentselection.length - 1];
|
|
662
|
+
this.selectDate(+event.target.id.split('_')[0]);
|
|
663
|
+
} else {
|
|
664
|
+
this.mouseDown = true;
|
|
665
|
+
this.dragging = false;
|
|
643
666
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
667
|
+
if (event.target.classList.contains('websy-dp-date')) {
|
|
668
|
+
if (event.target.classList.contains('websy-disabled-date')) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
648
671
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
672
|
+
if (this.customRangeSelected === true) {
|
|
673
|
+
this.currentselection = [];
|
|
674
|
+
this.customRangeSelected = false;
|
|
675
|
+
}
|
|
653
676
|
|
|
654
|
-
|
|
655
|
-
|
|
677
|
+
this.mouseDownId = +event.target.id.split('_')[0];
|
|
678
|
+
this.selectDate(this.mouseDownId);
|
|
679
|
+
}
|
|
656
680
|
}
|
|
657
681
|
}
|
|
658
682
|
}, {
|
|
@@ -731,7 +755,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
731
755
|
var dateEl = void 0;
|
|
732
756
|
|
|
733
757
|
if (this.options.mode === 'date') {
|
|
734
|
-
dateEl = document.getElementById("".concat(d
|
|
758
|
+
dateEl = document.getElementById("".concat(d, "_date"));
|
|
735
759
|
} else if (this.options.mode === 'year') {
|
|
736
760
|
dateEl = document.getElementById("".concat(d, "_year"));
|
|
737
761
|
}
|
|
@@ -1085,6 +1109,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
|
|
|
1085
1109
|
if (this.selectedRange === -1) {
|
|
1086
1110
|
var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
|
|
1087
1111
|
if (_this7.options.mode === 'date') {
|
|
1112
|
+
if (!d.toLocaleDateString) {
|
|
1113
|
+
d = new Date(d);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1088
1116
|
return d.toLocaleDateString();
|
|
1089
1117
|
} else if (_this7.options.mode === 'year') {
|
|
1090
1118
|
return d;
|
|
@@ -1215,6 +1243,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1215
1243
|
value: function close() {
|
|
1216
1244
|
var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
|
|
1217
1245
|
var contentEl = document.getElementById("".concat(this.elementId, "_content"));
|
|
1246
|
+
var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
|
|
1247
|
+
scrollEl.scrollTop = 0;
|
|
1218
1248
|
maskEl.classList.remove('active');
|
|
1219
1249
|
contentEl.classList.remove('active');
|
|
1220
1250
|
contentEl.classList.remove('on-top');
|
|
@@ -1226,6 +1256,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1226
1256
|
searchEl.value = '';
|
|
1227
1257
|
}
|
|
1228
1258
|
}
|
|
1259
|
+
|
|
1260
|
+
if (this.options.onClose) {
|
|
1261
|
+
this.options.onClose(this.elementId);
|
|
1262
|
+
}
|
|
1229
1263
|
}
|
|
1230
1264
|
}, {
|
|
1231
1265
|
key: "handleClick",
|
|
@@ -1355,6 +1389,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1355
1389
|
searchEl.focus();
|
|
1356
1390
|
}
|
|
1357
1391
|
}
|
|
1392
|
+
|
|
1393
|
+
if (this.options.onOpen) {
|
|
1394
|
+
this.options.onOpen(this.elementId);
|
|
1395
|
+
}
|
|
1358
1396
|
}
|
|
1359
1397
|
}, {
|
|
1360
1398
|
key: "render",
|
|
@@ -3026,7 +3064,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3026
3064
|
}
|
|
3027
3065
|
|
|
3028
3066
|
if (view !== '') {
|
|
3029
|
-
this.showView(view, params);
|
|
3067
|
+
this.showView(view, params, 'main');
|
|
3030
3068
|
}
|
|
3031
3069
|
}
|
|
3032
3070
|
}, {
|
|
@@ -3069,6 +3107,10 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3069
3107
|
this.hideTriggerItems(view, group);
|
|
3070
3108
|
this.hideViewItems(view, group);
|
|
3071
3109
|
this.publish('hide', [view]);
|
|
3110
|
+
} else if (group !== this.options.defaultGroup) {
|
|
3111
|
+
this.hideTriggerItems(view, group);
|
|
3112
|
+
this.hideViewItems(view, group);
|
|
3113
|
+
this.publish('hide', [view]);
|
|
3072
3114
|
}
|
|
3073
3115
|
} // registerElements (root) {
|
|
3074
3116
|
// if (root.nodeName === '#document') {
|
|
@@ -3172,7 +3214,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3172
3214
|
}
|
|
3173
3215
|
}, {
|
|
3174
3216
|
key: "showView",
|
|
3175
|
-
value: function showView(view, params) {
|
|
3217
|
+
value: function showView(view, params, group) {
|
|
3176
3218
|
this.activateItem(view, this.options.triggerClass);
|
|
3177
3219
|
this.activateItem(view, this.options.viewClass);
|
|
3178
3220
|
var children = this.getActiveViewsFromParent(view);
|
|
@@ -3181,18 +3223,18 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3181
3223
|
this.activateItem(children[c].view, this.options.triggerClass);
|
|
3182
3224
|
this.activateItem(children[c].view, this.options.viewClass);
|
|
3183
3225
|
this.showComponents(children[c].view);
|
|
3184
|
-
this.publish('show', [children[c].view]);
|
|
3226
|
+
this.publish('show', [children[c].view, null, group]);
|
|
3185
3227
|
}
|
|
3186
3228
|
|
|
3187
|
-
if (this.previousView !== this.currentView) {
|
|
3229
|
+
if (this.previousView !== this.currentView || group !== 'main') {
|
|
3188
3230
|
this.showComponents(view);
|
|
3189
|
-
this.publish('show', [view, params]);
|
|
3231
|
+
this.publish('show', [view, params, group]);
|
|
3190
3232
|
}
|
|
3191
3233
|
}
|
|
3192
3234
|
}, {
|
|
3193
3235
|
key: "reloadCurrentView",
|
|
3194
3236
|
value: function reloadCurrentView() {
|
|
3195
|
-
this.showView(this.currentView, this.currentParams);
|
|
3237
|
+
this.showView(this.currentView, this.currentParams, 'main');
|
|
3196
3238
|
}
|
|
3197
3239
|
}, {
|
|
3198
3240
|
key: "navigate",
|
|
@@ -3312,9 +3354,9 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3312
3354
|
}
|
|
3313
3355
|
|
|
3314
3356
|
if (toggle === false) {
|
|
3315
|
-
this.showView(this.currentView, this.currentParams);
|
|
3357
|
+
this.showView(this.currentView, this.currentParams, group);
|
|
3316
3358
|
} else if (newPath && newPath !== '') {
|
|
3317
|
-
this.showView(newPath);
|
|
3359
|
+
this.showView(newPath, null, group);
|
|
3318
3360
|
}
|
|
3319
3361
|
|
|
3320
3362
|
if (this.usesHTMLSuffix === true) {
|
|
@@ -3471,8 +3513,8 @@ var Switch = /*#__PURE__*/function () {
|
|
|
3471
3513
|
}
|
|
3472
3514
|
|
|
3473
3515
|
_createClass(Switch, [{
|
|
3474
|
-
key: "
|
|
3475
|
-
value: function
|
|
3516
|
+
key: "disable",
|
|
3517
|
+
value: function disable() {
|
|
3476
3518
|
this.options.enabled = false;
|
|
3477
3519
|
this.render();
|
|
3478
3520
|
}
|
|
@@ -5031,6 +5073,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5031
5073
|
xPoint = _this35[xAxis](_this35.parseX(xLabel));
|
|
5032
5074
|
s.data.forEach(function (d) {
|
|
5033
5075
|
if (d.x.value === xLabel) {
|
|
5076
|
+
if (!tooltipTitle) {
|
|
5077
|
+
tooltipTitle = d.x.value;
|
|
5078
|
+
}
|
|
5079
|
+
|
|
5034
5080
|
if (!d.y.color) {
|
|
5035
5081
|
d.y.color = s.color;
|
|
5036
5082
|
}
|
|
@@ -5683,7 +5729,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5683
5729
|
|
|
5684
5730
|
var barWidth = this[xAxis].bandwidth();
|
|
5685
5731
|
|
|
5686
|
-
if (this.options.data.series.length > 1 && this.options.grouping
|
|
5732
|
+
if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
|
|
5687
5733
|
barWidth = barWidth / this.options.data.series.length - 4;
|
|
5688
5734
|
}
|
|
5689
5735
|
|
|
@@ -5713,7 +5759,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5713
5759
|
return 0;
|
|
5714
5760
|
}
|
|
5715
5761
|
} else {
|
|
5716
|
-
if (this.options.grouping !== '
|
|
5762
|
+
if (this.options.grouping !== 'grouped') {
|
|
5717
5763
|
return this[xAxis](this.parseX(d.x.value));
|
|
5718
5764
|
} else {
|
|
5719
5765
|
return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
|
|
@@ -5723,7 +5769,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5723
5769
|
|
|
5724
5770
|
function getBarY(d, i) {
|
|
5725
5771
|
if (this.options.orientation === 'horizontal') {
|
|
5726
|
-
if (this.options.grouping !== '
|
|
5772
|
+
if (this.options.grouping !== 'grouped') {
|
|
5727
5773
|
return this[xAxis](this.parseX(d.x.value));
|
|
5728
5774
|
} else {
|
|
5729
5775
|
return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
|
|
@@ -5770,7 +5816,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
5770
5816
|
return d.y.label || d.y.value;
|
|
5771
5817
|
}).each(function (d, i) {
|
|
5772
5818
|
if (that.options.orientation === 'horizontal') {
|
|
5773
|
-
if (that.
|
|
5819
|
+
if (that.options.grouping === 'stacked') {
|
|
5820
|
+
this.setAttribute('text-anchor', 'middle');
|
|
5821
|
+
} else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
|
|
5774
5822
|
this.setAttribute('text-anchor', 'end');
|
|
5775
5823
|
this.setAttribute('x', +this.getAttribute('x') - 8);
|
|
5776
5824
|
}
|
|
@@ -6234,7 +6282,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
6234
6282
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6235
6283
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
6236
6284
|
|
|
6237
|
-
if (this.options.showLegend === true) {
|
|
6285
|
+
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
6238
6286
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
6239
6287
|
return {
|
|
6240
6288
|
value: s.label || s.key,
|