@websy/websy-designs 1.1.8 → 1.1.11

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.
@@ -28,7 +28,7 @@ function APIRoutes (dbHelper) {
28
28
  if (req.session && req.session.language && req.query.notranslate !== 'true') {
29
29
  lang = req.session.language
30
30
  }
31
- console.log(`lang is ${lang}`)
31
+ // console.log(`lang is ${lang}`)
32
32
  const sql = dbHelper.buildSelect(req.params.entity, req.query, req.query.columns, lang)
33
33
  dbHelper.execute(sql).then(response => {
34
34
  res.json(translate(response))
@@ -204,6 +204,7 @@ class WebsyDatePicker {
204
204
  this.validDates = []
205
205
  this.validYears = []
206
206
  this.customRangeSelected = true
207
+ this.shiftPressed = false
207
208
  const DEFAULTS = {
208
209
  defaultRange: 0,
209
210
  minAllowedDate: this.floorDate(new Date(new Date((new Date().setFullYear(new Date().getFullYear() - 1))).setDate(1))),
@@ -295,6 +296,8 @@ class WebsyDatePicker {
295
296
  el.addEventListener('mousedown', this.handleMouseDown.bind(this))
296
297
  el.addEventListener('mouseover', this.handleMouseOver.bind(this))
297
298
  el.addEventListener('mouseup', this.handleMouseUp.bind(this))
299
+ document.addEventListener('keydown', this.handleKeyDown.bind(this))
300
+ document.addEventListener('keyup', this.handleKeyUp.bind(this))
298
301
  let html = `
299
302
  <div class='websy-date-picker-container'>
300
303
  <span class='websy-dropdown-header-label'>${this.options.label || 'Date'}</span>
@@ -311,6 +314,7 @@ class WebsyDatePicker {
311
314
  </div><!--
312
315
  --><div id='${this.elementId}_datelist' class='websy-date-picker-custom'>${this.renderDates()}</div>
313
316
  <div class='websy-dp-button-container'>
317
+ <span class="dp-footnote">Click and drag or hold Shift and click to select a range of values</span>
314
318
  <button class='${this.options.cancelBtnClasses || ''} websy-btn websy-dp-cancel'>
315
319
  <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>
316
320
  </button>
@@ -387,21 +391,38 @@ class WebsyDatePicker {
387
391
  this.close()
388
392
  }
389
393
  }
390
- handleMouseDown (event) {
391
- this.mouseDown = true
392
- this.dragging = false
393
- if (event.target.classList.contains('websy-dp-date')) {
394
- if (event.target.classList.contains('websy-disabled-date')) {
395
- return
396
- }
397
- if (this.customRangeSelected === true) {
398
- this.currentselection = []
399
- this.customRangeSelected = false
400
- }
401
- this.mouseDownId = +event.target.id.split('_')[0]
402
- this.selectDate(this.mouseDownId)
394
+ handleKeyDown (event) {
395
+ console.log('key down', event)
396
+ if (event.key === 'Shift') {
397
+ this.dragging = true
398
+ this.shiftPressed = true
403
399
  }
404
400
  }
401
+ handleKeyUp (event) {
402
+ this.dragging = false
403
+ this.shiftPressed = false
404
+ }
405
+ handleMouseDown (event) {
406
+ if (this.shiftPressed === true && this.currentselection.length > 0) {
407
+ this.mouseDownId = this.currentselection[this.currentselection.length - 1]
408
+ this.selectDate(+event.target.id.split('_')[0])
409
+ }
410
+ else {
411
+ this.mouseDown = true
412
+ this.dragging = false
413
+ if (event.target.classList.contains('websy-dp-date')) {
414
+ if (event.target.classList.contains('websy-disabled-date')) {
415
+ return
416
+ }
417
+ if (this.customRangeSelected === true) {
418
+ this.currentselection = []
419
+ this.customRangeSelected = false
420
+ }
421
+ this.mouseDownId = +event.target.id.split('_')[0]
422
+ this.selectDate(this.mouseDownId)
423
+ }
424
+ }
425
+ }
405
426
  handleMouseOver (event) {
406
427
  if (this.mouseDown === true) {
407
428
  if (event.target.classList.contains('websy-dp-date')) {
@@ -449,8 +470,8 @@ class WebsyDatePicker {
449
470
  let d
450
471
  let rangeStart
451
472
  let rangeEnd
452
- if (this.options.mode === 'date') {
453
- d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
473
+ if (this.options.mode === 'date') {
474
+ d = this.floorDate(new Date(this.selectedRangeDates[0].getTime() + (i * this.oneDay)))
454
475
  d = d.getTime()
455
476
  rangeStart = this.selectedRangeDates[0].getTime()
456
477
  rangeEnd = this.selectedRangeDates[this.selectedRangeDates.length - 1].getTime()
@@ -462,7 +483,7 @@ class WebsyDatePicker {
462
483
  }
463
484
  let dateEl
464
485
  if (this.options.mode === 'date') {
465
- dateEl = document.getElementById(`${d.getTime()}_date`)
486
+ dateEl = document.getElementById(`${d}_date`)
466
487
  }
467
488
  else if (this.options.mode === 'year') {
468
489
  dateEl = document.getElementById(`${d}_year`)
@@ -756,7 +777,10 @@ class WebsyDatePicker {
756
777
  let range
757
778
  if (this.selectedRange === -1) {
758
779
  const list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(d => {
759
- if (this.options.mode === 'date') {
780
+ if (this.options.mode === 'date') {
781
+ if (!d.toLocaleDateString) {
782
+ d = new Date(d)
783
+ }
760
784
  return d.toLocaleDateString()
761
785
  }
762
786
  else if (this.options.mode === 'year') {
@@ -901,9 +925,11 @@ class WebsyDropdown {
901
925
  close () {
902
926
  const maskEl = document.getElementById(`${this.elementId}_mask`)
903
927
  const contentEl = document.getElementById(`${this.elementId}_content`)
928
+ const scrollEl = document.getElementById(`${this.elementId}_itemsContainer`)
929
+ scrollEl.scrollTop = 0
904
930
  maskEl.classList.remove('active')
905
931
  contentEl.classList.remove('active')
906
- contentEl.classList.remove('on-top')
932
+ contentEl.classList.remove('on-top')
907
933
  const searchEl = document.getElementById(`${this.elementId}_search`)
908
934
  if (searchEl) {
909
935
  if (searchEl.value.length > 0 && this.options.onCancelSearch) {
@@ -911,6 +937,9 @@ class WebsyDropdown {
911
937
  searchEl.value = ''
912
938
  }
913
939
  }
940
+ if (this.options.onClose) {
941
+ this.options.onClose(this.elementId)
942
+ }
914
943
  }
915
944
  handleClick (event) {
916
945
  if (this.options.disabled === true) {
@@ -1023,6 +1052,9 @@ class WebsyDropdown {
1023
1052
  searchEl.focus()
1024
1053
  }
1025
1054
  }
1055
+ if (this.options.onOpen) {
1056
+ this.options.onOpen(this.elementId)
1057
+ }
1026
1058
  }
1027
1059
  render () {
1028
1060
  if (!this.elementId) {
@@ -2425,7 +2457,7 @@ class WebsyRouter {
2425
2457
  this.currentViewMain = this.options.defaultView
2426
2458
  }
2427
2459
  if (view !== '') {
2428
- this.showView(view, params)
2460
+ this.showView(view, params, 'main')
2429
2461
  }
2430
2462
  }
2431
2463
  handleFocus (event) {
@@ -2456,6 +2488,11 @@ class WebsyRouter {
2456
2488
  this.hideTriggerItems(view, group)
2457
2489
  this.hideViewItems(view, group)
2458
2490
  this.publish('hide', [view])
2491
+ }
2492
+ else if (group !== this.options.defaultGroup) {
2493
+ this.hideTriggerItems(view, group)
2494
+ this.hideViewItems(view, group)
2495
+ this.publish('hide', [view])
2459
2496
  }
2460
2497
  }
2461
2498
  // registerElements (root) {
@@ -2554,7 +2591,7 @@ class WebsyRouter {
2554
2591
  })
2555
2592
  }
2556
2593
  }
2557
- showView (view, params) {
2594
+ showView (view, params, group) {
2558
2595
  this.activateItem(view, this.options.triggerClass)
2559
2596
  this.activateItem(view, this.options.viewClass)
2560
2597
  let children = this.getActiveViewsFromParent(view)
@@ -2562,15 +2599,15 @@ class WebsyRouter {
2562
2599
  this.activateItem(children[c].view, this.options.triggerClass)
2563
2600
  this.activateItem(children[c].view, this.options.viewClass)
2564
2601
  this.showComponents(children[c].view)
2565
- this.publish('show', [children[c].view])
2602
+ this.publish('show', [children[c].view, null, group])
2566
2603
  }
2567
- if (this.previousView !== this.currentView) {
2604
+ if (this.previousView !== this.currentView || group !== 'main') {
2568
2605
  this.showComponents(view)
2569
- this.publish('show', [view, params])
2606
+ this.publish('show', [view, params, group])
2570
2607
  }
2571
2608
  }
2572
2609
  reloadCurrentView () {
2573
- this.showView(this.currentView, this.currentParams)
2610
+ this.showView(this.currentView, this.currentParams, 'main')
2574
2611
  }
2575
2612
  navigate (inputPath, group = 'main', event, popped) {
2576
2613
  if (typeof popped === 'undefined') {
@@ -2667,10 +2704,10 @@ class WebsyRouter {
2667
2704
  return
2668
2705
  }
2669
2706
  if (toggle === false) {
2670
- this.showView(this.currentView, this.currentParams)
2707
+ this.showView(this.currentView, this.currentParams, group)
2671
2708
  }
2672
2709
  else if (newPath && newPath !== '') {
2673
- this.showView(newPath)
2710
+ this.showView(newPath, null, group)
2674
2711
  }
2675
2712
  if (this.usesHTMLSuffix === true) {
2676
2713
  inputPath = window.location.pathname.split('/').pop() + inputPath
@@ -2789,7 +2826,7 @@ class Switch {
2789
2826
  this.render()
2790
2827
  }
2791
2828
  }
2792
- disabled () {
2829
+ disable () {
2793
2830
  this.options.enabled = false
2794
2831
  this.render()
2795
2832
  }
@@ -3588,7 +3625,7 @@ class WebsyTable2 {
3588
3625
  selectedItems: [pageOptions.indexOf(this.options.pageSize)],
3589
3626
  items: pageOptions.map(p => ({ label: p.toString(), value: p })),
3590
3627
  allowClear: false,
3591
- disableSearch: true,
3628
+ disableSearch: true,
3592
3629
  onItemSelected: (selectedItem) => {
3593
3630
  if (this.options.onChangePageSize) {
3594
3631
  this.options.onChangePageSize(selectedItem.value)
@@ -4227,8 +4264,11 @@ if (this.options.data[side].scale === 'Time') {
4227
4264
  this.options.data.series.forEach(s => {
4228
4265
  if (this.options.data[xData].scale !== 'Time') {
4229
4266
  xPoint = this[xAxis](this.parseX(xLabel))
4230
- s.data.forEach(d => {
4267
+ s.data.forEach(d => {
4231
4268
  if (d.x.value === xLabel) {
4269
+ if (!tooltipTitle) {
4270
+ tooltipTitle = d.x.value
4271
+ }
4232
4272
  if (!d.y.color) {
4233
4273
  d.y.color = s.color
4234
4274
  }
@@ -4889,7 +4929,7 @@ if (this.options.orientation === 'horizontal') {
4889
4929
  yAxis = 'bottomAxis'
4890
4930
  }
4891
4931
  let barWidth = this[xAxis].bandwidth()
4892
- if (this.options.data.series.length > 1 && this.options.grouping !== 'stacked') {
4932
+ if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
4893
4933
  barWidth = barWidth / this.options.data.series.length - 4
4894
4934
  }
4895
4935
  function getBarHeight (d, i) {
@@ -4920,7 +4960,7 @@ function getBarX (d, i) {
4920
4960
  }
4921
4961
  }
4922
4962
  else {
4923
- if (this.options.grouping !== 'stacked') {
4963
+ if (this.options.grouping !== 'grouped') {
4924
4964
  return this[xAxis](this.parseX(d.x.value))
4925
4965
  }
4926
4966
  else {
@@ -4930,7 +4970,7 @@ function getBarX (d, i) {
4930
4970
  }
4931
4971
  function getBarY (d, i) {
4932
4972
  if (this.options.orientation === 'horizontal') {
4933
- if (this.options.grouping !== 'stacked') {
4973
+ if (this.options.grouping !== 'grouped') {
4934
4974
  return this[xAxis](this.parseX(d.x.value))
4935
4975
  }
4936
4976
  else {
@@ -5015,7 +5055,10 @@ if (this.options.showLabels) {
5015
5055
  .text(d => d.y.label || d.y.value)
5016
5056
  .each(function (d, i) {
5017
5057
  if (that.options.orientation === 'horizontal') {
5018
- if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5058
+ if (that.options.grouping === 'stacked') {
5059
+ this.setAttribute('text-anchor', 'middle')
5060
+ }
5061
+ else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5019
5062
  this.setAttribute('text-anchor', 'end')
5020
5063
  this.setAttribute('x', +(this.getAttribute('x')) - 8)
5021
5064
  }
@@ -5471,7 +5514,7 @@ class WebsyMap {
5471
5514
  render () {
5472
5515
  const mapEl = document.getElementById(`${this.elementId}_map`)
5473
5516
  const legendEl = document.getElementById(`${this.elementId}_map`)
5474
- if (this.options.showLegend === true) {
5517
+ if (this.options.showLegend === true && this.options.data.polygons) {
5475
5518
  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]}))
5476
5519
  let longestValue = legendData.map(s => s.value).reduce((a, b) => a.length > b.length ? a : b)
5477
5520
  if (this.options.legendPosition === 'top' || this.options.legendPosition === 'bottom') {
@@ -301,6 +301,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
301
301
  this.validDates = [];
302
302
  this.validYears = [];
303
303
  this.customRangeSelected = true;
304
+ this.shiftPressed = false;
304
305
  var DEFAULTS = {
305
306
  defaultRange: 0,
306
307
  minAllowedDate: this.floorDate(new Date(new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setDate(1))),
@@ -382,7 +383,9 @@ var WebsyDatePicker = /*#__PURE__*/function () {
382
383
  el.addEventListener('mousedown', this.handleMouseDown.bind(this));
383
384
  el.addEventListener('mouseover', this.handleMouseOver.bind(this));
384
385
  el.addEventListener('mouseup', this.handleMouseUp.bind(this));
385
- 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 <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 ");
386
+ document.addEventListener('keydown', this.handleKeyDown.bind(this));
387
+ document.addEventListener('keyup', this.handleKeyUp.bind(this));
388
+ 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 ");
386
389
  el.innerHTML = html;
387
390
  this.render();
388
391
  } else {
@@ -451,24 +454,45 @@ var WebsyDatePicker = /*#__PURE__*/function () {
451
454
  this.close();
452
455
  }
453
456
  }
457
+ }, {
458
+ key: "handleKeyDown",
459
+ value: function handleKeyDown(event) {
460
+ console.log('key down', event);
461
+
462
+ if (event.key === 'Shift') {
463
+ this.dragging = true;
464
+ this.shiftPressed = true;
465
+ }
466
+ }
467
+ }, {
468
+ key: "handleKeyUp",
469
+ value: function handleKeyUp(event) {
470
+ this.dragging = false;
471
+ this.shiftPressed = false;
472
+ }
454
473
  }, {
455
474
  key: "handleMouseDown",
456
475
  value: function handleMouseDown(event) {
457
- this.mouseDown = true;
458
- this.dragging = false;
476
+ if (this.shiftPressed === true && this.currentselection.length > 0) {
477
+ this.mouseDownId = this.currentselection[this.currentselection.length - 1];
478
+ this.selectDate(+event.target.id.split('_')[0]);
479
+ } else {
480
+ this.mouseDown = true;
481
+ this.dragging = false;
459
482
 
460
- if (event.target.classList.contains('websy-dp-date')) {
461
- if (event.target.classList.contains('websy-disabled-date')) {
462
- return;
463
- }
483
+ if (event.target.classList.contains('websy-dp-date')) {
484
+ if (event.target.classList.contains('websy-disabled-date')) {
485
+ return;
486
+ }
464
487
 
465
- if (this.customRangeSelected === true) {
466
- this.currentselection = [];
467
- this.customRangeSelected = false;
468
- }
488
+ if (this.customRangeSelected === true) {
489
+ this.currentselection = [];
490
+ this.customRangeSelected = false;
491
+ }
469
492
 
470
- this.mouseDownId = +event.target.id.split('_')[0];
471
- this.selectDate(this.mouseDownId);
493
+ this.mouseDownId = +event.target.id.split('_')[0];
494
+ this.selectDate(this.mouseDownId);
495
+ }
472
496
  }
473
497
  }
474
498
  }, {
@@ -547,7 +571,7 @@ var WebsyDatePicker = /*#__PURE__*/function () {
547
571
  var dateEl = void 0;
548
572
 
549
573
  if (this.options.mode === 'date') {
550
- dateEl = document.getElementById("".concat(d.getTime(), "_date"));
574
+ dateEl = document.getElementById("".concat(d, "_date"));
551
575
  } else if (this.options.mode === 'year') {
552
576
  dateEl = document.getElementById("".concat(d, "_year"));
553
577
  }
@@ -901,6 +925,10 @@ var WebsyDatePicker = /*#__PURE__*/function () {
901
925
  if (this.selectedRange === -1) {
902
926
  var list = (this.currentselection.length > 0 ? this.currentselection : this.selectedRangeDates).map(function (d) {
903
927
  if (_this5.options.mode === 'date') {
928
+ if (!d.toLocaleDateString) {
929
+ d = new Date(d);
930
+ }
931
+
904
932
  return d.toLocaleDateString();
905
933
  } else if (_this5.options.mode === 'year') {
906
934
  return d;
@@ -1031,6 +1059,8 @@ var WebsyDropdown = /*#__PURE__*/function () {
1031
1059
  value: function close() {
1032
1060
  var maskEl = document.getElementById("".concat(this.elementId, "_mask"));
1033
1061
  var contentEl = document.getElementById("".concat(this.elementId, "_content"));
1062
+ var scrollEl = document.getElementById("".concat(this.elementId, "_itemsContainer"));
1063
+ scrollEl.scrollTop = 0;
1034
1064
  maskEl.classList.remove('active');
1035
1065
  contentEl.classList.remove('active');
1036
1066
  contentEl.classList.remove('on-top');
@@ -1042,6 +1072,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1042
1072
  searchEl.value = '';
1043
1073
  }
1044
1074
  }
1075
+
1076
+ if (this.options.onClose) {
1077
+ this.options.onClose(this.elementId);
1078
+ }
1045
1079
  }
1046
1080
  }, {
1047
1081
  key: "handleClick",
@@ -1171,6 +1205,10 @@ var WebsyDropdown = /*#__PURE__*/function () {
1171
1205
  searchEl.focus();
1172
1206
  }
1173
1207
  }
1208
+
1209
+ if (this.options.onOpen) {
1210
+ this.options.onOpen(this.elementId);
1211
+ }
1174
1212
  }
1175
1213
  }, {
1176
1214
  key: "render",
@@ -2842,7 +2880,7 @@ var WebsyRouter = /*#__PURE__*/function () {
2842
2880
  }
2843
2881
 
2844
2882
  if (view !== '') {
2845
- this.showView(view, params);
2883
+ this.showView(view, params, 'main');
2846
2884
  }
2847
2885
  }
2848
2886
  }, {
@@ -2885,6 +2923,10 @@ var WebsyRouter = /*#__PURE__*/function () {
2885
2923
  this.hideTriggerItems(view, group);
2886
2924
  this.hideViewItems(view, group);
2887
2925
  this.publish('hide', [view]);
2926
+ } else if (group !== this.options.defaultGroup) {
2927
+ this.hideTriggerItems(view, group);
2928
+ this.hideViewItems(view, group);
2929
+ this.publish('hide', [view]);
2888
2930
  }
2889
2931
  } // registerElements (root) {
2890
2932
  // if (root.nodeName === '#document') {
@@ -2988,7 +3030,7 @@ var WebsyRouter = /*#__PURE__*/function () {
2988
3030
  }
2989
3031
  }, {
2990
3032
  key: "showView",
2991
- value: function showView(view, params) {
3033
+ value: function showView(view, params, group) {
2992
3034
  this.activateItem(view, this.options.triggerClass);
2993
3035
  this.activateItem(view, this.options.viewClass);
2994
3036
  var children = this.getActiveViewsFromParent(view);
@@ -2997,18 +3039,18 @@ var WebsyRouter = /*#__PURE__*/function () {
2997
3039
  this.activateItem(children[c].view, this.options.triggerClass);
2998
3040
  this.activateItem(children[c].view, this.options.viewClass);
2999
3041
  this.showComponents(children[c].view);
3000
- this.publish('show', [children[c].view]);
3042
+ this.publish('show', [children[c].view, null, group]);
3001
3043
  }
3002
3044
 
3003
- if (this.previousView !== this.currentView) {
3045
+ if (this.previousView !== this.currentView || group !== 'main') {
3004
3046
  this.showComponents(view);
3005
- this.publish('show', [view, params]);
3047
+ this.publish('show', [view, params, group]);
3006
3048
  }
3007
3049
  }
3008
3050
  }, {
3009
3051
  key: "reloadCurrentView",
3010
3052
  value: function reloadCurrentView() {
3011
- this.showView(this.currentView, this.currentParams);
3053
+ this.showView(this.currentView, this.currentParams, 'main');
3012
3054
  }
3013
3055
  }, {
3014
3056
  key: "navigate",
@@ -3128,9 +3170,9 @@ var WebsyRouter = /*#__PURE__*/function () {
3128
3170
  }
3129
3171
 
3130
3172
  if (toggle === false) {
3131
- this.showView(this.currentView, this.currentParams);
3173
+ this.showView(this.currentView, this.currentParams, group);
3132
3174
  } else if (newPath && newPath !== '') {
3133
- this.showView(newPath);
3175
+ this.showView(newPath, null, group);
3134
3176
  }
3135
3177
 
3136
3178
  if (this.usesHTMLSuffix === true) {
@@ -3287,8 +3329,8 @@ var Switch = /*#__PURE__*/function () {
3287
3329
  }
3288
3330
 
3289
3331
  _createClass(Switch, [{
3290
- key: "disabled",
3291
- value: function disabled() {
3332
+ key: "disable",
3333
+ value: function disable() {
3292
3334
  this.options.enabled = false;
3293
3335
  this.render();
3294
3336
  }
@@ -4847,6 +4889,10 @@ var WebsyChart = /*#__PURE__*/function () {
4847
4889
  xPoint = _this33[xAxis](_this33.parseX(xLabel));
4848
4890
  s.data.forEach(function (d) {
4849
4891
  if (d.x.value === xLabel) {
4892
+ if (!tooltipTitle) {
4893
+ tooltipTitle = d.x.value;
4894
+ }
4895
+
4850
4896
  if (!d.y.color) {
4851
4897
  d.y.color = s.color;
4852
4898
  }
@@ -5499,7 +5545,7 @@ var WebsyChart = /*#__PURE__*/function () {
5499
5545
 
5500
5546
  var barWidth = this[xAxis].bandwidth();
5501
5547
 
5502
- if (this.options.data.series.length > 1 && this.options.grouping !== 'stacked') {
5548
+ if (this.options.data.series.length > 1 && this.options.grouping === 'grouped') {
5503
5549
  barWidth = barWidth / this.options.data.series.length - 4;
5504
5550
  }
5505
5551
 
@@ -5529,7 +5575,7 @@ var WebsyChart = /*#__PURE__*/function () {
5529
5575
  return 0;
5530
5576
  }
5531
5577
  } else {
5532
- if (this.options.grouping !== 'stacked') {
5578
+ if (this.options.grouping !== 'grouped') {
5533
5579
  return this[xAxis](this.parseX(d.x.value));
5534
5580
  } else {
5535
5581
  return this[xAxis](this.parseX(d.x.value)) + i * barWidth;
@@ -5539,7 +5585,7 @@ var WebsyChart = /*#__PURE__*/function () {
5539
5585
 
5540
5586
  function getBarY(d, i) {
5541
5587
  if (this.options.orientation === 'horizontal') {
5542
- if (this.options.grouping !== 'stacked') {
5588
+ if (this.options.grouping !== 'grouped') {
5543
5589
  return this[xAxis](this.parseX(d.x.value));
5544
5590
  } else {
5545
5591
  return this[xAxis](this.parseX(d.x.value)) + (d.y.index || i) * barWidth;
@@ -5586,7 +5632,9 @@ var WebsyChart = /*#__PURE__*/function () {
5586
5632
  return d.y.label || d.y.value;
5587
5633
  }).each(function (d, i) {
5588
5634
  if (that.options.orientation === 'horizontal') {
5589
- if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5635
+ if (that.options.grouping === 'stacked') {
5636
+ this.setAttribute('text-anchor', 'middle');
5637
+ } else if (that.plotWidth - getLabelX.call(that, d) < this.getComputedTextLength()) {
5590
5638
  this.setAttribute('text-anchor', 'end');
5591
5639
  this.setAttribute('x', +this.getAttribute('x') - 8);
5592
5640
  }
@@ -6050,7 +6098,7 @@ var WebsyMap = /*#__PURE__*/function () {
6050
6098
  var mapEl = document.getElementById("".concat(this.elementId, "_map"));
6051
6099
  var legendEl = document.getElementById("".concat(this.elementId, "_map"));
6052
6100
 
6053
- if (this.options.showLegend === true) {
6101
+ if (this.options.showLegend === true && this.options.data.polygons) {
6054
6102
  var legendData = this.options.data.polygons.map(function (s, i) {
6055
6103
  return {
6056
6104
  value: s.label || s.key,