@websy/websy-designs 1.4.4 → 1.4.6

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.
@@ -337,7 +337,6 @@ class PGHelper {
337
337
  })
338
338
  }
339
339
  execute (query) {
340
- console.log(query)
341
340
  return new Promise((resolve, reject) => {
342
341
  if (query !== null) {
343
342
  this.client.query(query, (err, queryResponse) => {
@@ -3697,6 +3697,26 @@ class WebsyRouter {
3697
3697
  this.navigate(`${inputPath}?${path}`, 'main', null, noHistory)
3698
3698
  }
3699
3699
  }
3700
+ removeAllUrlParams (reloadView = false, noHistory = true) {
3701
+ // const output = {
3702
+ // path: '',
3703
+ // items: {}
3704
+ // }
3705
+ // this.currentParams = output
3706
+ let inputPath = this.currentView
3707
+ if (this.options.urlPrefix) {
3708
+ inputPath = `/${this.options.urlPrefix}/${inputPath}`
3709
+ }
3710
+ if (reloadView === true) {
3711
+ this.navigate(`${inputPath}`, 'main', null, noHistory)
3712
+ }
3713
+ else {
3714
+ this.currentParams = {
3715
+ path: '',
3716
+ items: {}
3717
+ }
3718
+ }
3719
+ }
3700
3720
  buildUrlPath (params) {
3701
3721
  let path = []
3702
3722
  for (let key in params) {
@@ -3717,6 +3737,9 @@ class WebsyRouter {
3717
3737
  if (!this.groups[g]) {
3718
3738
  this.addGroup(g)
3719
3739
  }
3740
+ if (els[i].classList.contains(this.options.activeClass)) {
3741
+ this.groups[g].activeView = v
3742
+ }
3720
3743
  if (this.groups[g].views.indexOf(v) === -1) {
3721
3744
  this.groups[g].views.push(v)
3722
3745
  }
@@ -3760,9 +3783,9 @@ class WebsyRouter {
3760
3783
  if (this.groups[g].activeView) {
3761
3784
  views.push({view: this.groups[g].activeView, group: g})
3762
3785
  }
3763
- else {
3764
- views.push({view: this.groups[g].views[0], group: g})
3765
- }
3786
+ // else {
3787
+ // views.push({view: this.groups[g].views[0], group: g})
3788
+ // }
3766
3789
  }
3767
3790
  }
3768
3791
  return views
@@ -3935,12 +3958,12 @@ class WebsyRouter {
3935
3958
  <article id='${elementId}_content' class='websy-content-article'></article>
3936
3959
  <div id='${elementId}_loading' class='websy-loading-container'><div class='websy-ripple'><div></div><div></div></div></div>
3937
3960
  `
3938
- if (options.help && options.help !== '') {
3961
+ if (options && options.help && options.help !== '') {
3939
3962
  html += `
3940
3963
  <Help not yet supported>
3941
3964
  `
3942
3965
  }
3943
- if (options.tooltip && options.tooltip.value && options.tooltip.value !== '') {
3966
+ if (options && options.tooltip && options.tooltip.value && options.tooltip.value !== '') {
3944
3967
  html += `
3945
3968
  <div class="websy-info ${this.options.tooltip.classes.join(' ') || ''}" data-info="${this.options.tooltip.value}">
3946
3969
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 512 512"><title>ionicons-v5-e</title><path d="M256,56C145.72,56,56,145.72,56,256s89.72,200,200,200,200-89.72,200-200S366.28,56,256,56Zm0,82a26,26,0,1,1-26,26A26,26,0,0,1,256,138Zm48,226H216a16,16,0,0,1,0-32h28V244H228a16,16,0,0,1,0-32h32a16,16,0,0,1,16,16V332h28a16,16,0,0,1,0,32Z"/></svg>
@@ -4046,7 +4069,7 @@ class WebsyRouter {
4046
4069
  this.addGroup(group)
4047
4070
  }
4048
4071
  if (toggle === true && this.groups[group].activeView !== '') {
4049
- newPath = ''
4072
+ newPath = inputPath === this.groups[group].activeView ? '' : inputPath
4050
4073
  }
4051
4074
  this.previousView = this.currentView
4052
4075
  this.previousPath = this.currentPath
@@ -3994,6 +3994,31 @@ var WebsyRouter = /*#__PURE__*/function () {
3994
3994
  this.navigate("".concat(inputPath, "?").concat(path), 'main', null, noHistory);
3995
3995
  }
3996
3996
  }
3997
+ }, {
3998
+ key: "removeAllUrlParams",
3999
+ value: function removeAllUrlParams() {
4000
+ var reloadView = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4001
+ var noHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4002
+ // const output = {
4003
+ // path: '',
4004
+ // items: {}
4005
+ // }
4006
+ // this.currentParams = output
4007
+ var inputPath = this.currentView;
4008
+
4009
+ if (this.options.urlPrefix) {
4010
+ inputPath = "/".concat(this.options.urlPrefix, "/").concat(inputPath);
4011
+ }
4012
+
4013
+ if (reloadView === true) {
4014
+ this.navigate("".concat(inputPath), 'main', null, noHistory);
4015
+ } else {
4016
+ this.currentParams = {
4017
+ path: '',
4018
+ items: {}
4019
+ };
4020
+ }
4021
+ }
3997
4022
  }, {
3998
4023
  key: "buildUrlPath",
3999
4024
  value: function buildUrlPath(params) {
@@ -4025,6 +4050,10 @@ var WebsyRouter = /*#__PURE__*/function () {
4025
4050
  this.addGroup(g);
4026
4051
  }
4027
4052
 
4053
+ if (els[i].classList.contains(this.options.activeClass)) {
4054
+ this.groups[g].activeView = v;
4055
+ }
4056
+
4028
4057
  if (this.groups[g].views.indexOf(v) === -1) {
4029
4058
  this.groups[g].views.push(v);
4030
4059
  }
@@ -4084,12 +4113,10 @@ var WebsyRouter = /*#__PURE__*/function () {
4084
4113
  view: this.groups[g].activeView,
4085
4114
  group: g
4086
4115
  });
4087
- } else {
4088
- views.push({
4089
- view: this.groups[g].views[0],
4090
- group: g
4091
- });
4092
- }
4116
+ } // else {
4117
+ // views.push({view: this.groups[g].views[0], group: g})
4118
+ // }
4119
+
4093
4120
  }
4094
4121
  }
4095
4122
 
@@ -4298,11 +4325,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4298
4325
 
4299
4326
  var html = "\n <article id='".concat(elementId, "_content' class='websy-content-article'></article>\n <div id='").concat(elementId, "_loading' class='websy-loading-container'><div class='websy-ripple'><div></div><div></div></div></div>\n ");
4300
4327
 
4301
- if (options.help && options.help !== '') {
4328
+ if (options && options.help && options.help !== '') {
4302
4329
  html += "\n <Help not yet supported>\n ";
4303
4330
  }
4304
4331
 
4305
- if (options.tooltip && options.tooltip.value && options.tooltip.value !== '') {
4332
+ if (options && options.tooltip && options.tooltip.value && options.tooltip.value !== '') {
4306
4333
  html += "\n <div class=\"websy-info ".concat(this.options.tooltip.classes.join(' ') || '', "\" data-info=\"").concat(this.options.tooltip.value, "\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><title>ionicons-v5-e</title><path d=\"M256,56C145.72,56,56,145.72,56,256s89.72,200,200,200,200-89.72,200-200S366.28,56,256,56Zm0,82a26,26,0,1,1-26,26A26,26,0,0,1,256,138Zm48,226H216a16,16,0,0,1,0-32h28V244H228a16,16,0,0,1,0-32h32a16,16,0,0,1,16,16V332h28a16,16,0,0,1,0,32Z\"/></svg>\n </div> \n ");
4307
4334
  }
4308
4335
 
@@ -4429,7 +4456,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4429
4456
  }
4430
4457
 
4431
4458
  if (toggle === true && this.groups[group].activeView !== '') {
4432
- newPath = '';
4459
+ newPath = inputPath === this.groups[group].activeView ? '' : inputPath;
4433
4460
  }
4434
4461
 
4435
4462
  this.previousView = this.currentView;