@websy/websy-designs 1.4.14 → 1.4.15

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.
@@ -346,6 +346,7 @@ class PGHelper {
346
346
  if (err) {
347
347
  console.log('Error creating request')
348
348
  console.log(err)
349
+ console.log(query)
349
350
  this.rollback(err, reject)
350
351
  }
351
352
  else {
@@ -2527,7 +2527,7 @@ class WebsyNavigationMenu {
2527
2527
  let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
2528
2528
  let visibleItems = lowestItems
2529
2529
  let defaultMethod = 'remove'
2530
- if (searchText.length > 1) {
2530
+ if (searchText && searchText.length > 1) {
2531
2531
  defaultMethod = 'add'
2532
2532
  visibleItems = lowestItems.filter(d => d[this.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1)
2533
2533
  }
@@ -2540,7 +2540,7 @@ class WebsyNavigationMenu {
2540
2540
  for (let l = 0; l < listEls.length; l++) {
2541
2541
  listEls[l].classList.add('websy-menu-collapsed')
2542
2542
  }
2543
- if (searchText.length > 1) {
2543
+ if (searchText && searchText.length > 1) {
2544
2544
  visibleItems.forEach(d => {
2545
2545
  // show the item and open the list
2546
2546
  let pathParts = d.path.split('::')
@@ -2594,10 +2594,16 @@ class WebsyNavigationMenu {
2594
2594
  }
2595
2595
  html += this.renderBlock(this.elementId, this.elementId, this.options.items, 'main', 0)
2596
2596
  html += `</div>`
2597
+ if (this.options.secondaryItems) {
2598
+ html += `<div class='websy-menu-secondary' style='height: ${this.options.secondaryHeight || '100%'}; width: ${this.options.secondaryWidth || '100%'}'>`
2599
+ html += this.renderBlock(this.elementId, this.elementId, this.options.secondaryItems, 'main', 0)
2600
+ html += `</div>`
2601
+ }
2597
2602
  el.innerHTML = html
2598
2603
  if (this.options.enableSearch === true) {
2599
2604
  this.search = new WebsyDesigns.Search(`${this.elementId}_search`, Object.assign({}, {
2600
- onSearch: this.handleSearch.bind(this)
2605
+ onSearch: this.handleSearch.bind(this),
2606
+ onClear: this.handleSearch.bind(this)
2601
2607
  }, this.options.searchOptions))
2602
2608
  }
2603
2609
  }
@@ -2632,7 +2638,7 @@ class WebsyNavigationMenu {
2632
2638
  style='padding-left: ${level * this.options.childIndentation}px'
2633
2639
  ${(items[i].attributes && items[i].attributes.join(' ')) || ''}
2634
2640
  >
2635
- `
2641
+ `
2636
2642
  if (this.options.orientation === 'horizontal') {
2637
2643
  html += items[i].text
2638
2644
  }
@@ -2641,22 +2647,33 @@ class WebsyNavigationMenu {
2641
2647
  <span class='selected-bar'></span>
2642
2648
  `
2643
2649
  }
2644
- if (this.options.activeSymbol === 'triangle') {
2645
- html += `
2646
- <span class='active-square'></span>
2647
- `
2648
- }
2649
- html += `
2650
- <span class='${items[i].items && items[i].items.length > 0 ? 'menu-carat' : ''}'></span>
2651
- `
2652
2650
  if (this.options.orientation === 'vertical') {
2653
2651
  // html += `
2654
2652
  // &nbsp;
2655
2653
  // `
2656
2654
  }
2657
2655
  if (items[i].isLink === true && items[i].href) {
2658
- html += `<a href='${items[i].href}'>${items[i].text}</a>`
2659
- }
2656
+ html += `<a href='${items[i].href}' target='${items[i].openInNewTab ? 'blank' : '_self'}'>`
2657
+ }
2658
+ if (items[i].icon) {
2659
+ html += `
2660
+ <div class='websy-menu-item-icon'>${items[i].icon}</div>
2661
+ `
2662
+ }
2663
+ html += `<span>${items[i].text}</span>`
2664
+ if (items[i].isLink === true && items[i].href) {
2665
+ html += `</a>`
2666
+ }
2667
+ if (items[i].items && items[i].items.length > 0) {
2668
+ html += `
2669
+ <span class='menu-carat'></span>
2670
+ `
2671
+ }
2672
+ if (this.options.activeSymbol === 'triangle') {
2673
+ html += `
2674
+ <span class='active-square'></span>
2675
+ `
2676
+ }
2660
2677
  html += `
2661
2678
  </div>
2662
2679
  `
@@ -2671,7 +2671,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2671
2671
  var visibleItems = lowestItems;
2672
2672
  var defaultMethod = 'remove';
2673
2673
 
2674
- if (searchText.length > 1) {
2674
+ if (searchText && searchText.length > 1) {
2675
2675
  defaultMethod = 'add';
2676
2676
  visibleItems = lowestItems.filter(function (d) {
2677
2677
  return d[_this16.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
@@ -2691,7 +2691,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2691
2691
  listEls[l].classList.add('websy-menu-collapsed');
2692
2692
  }
2693
2693
 
2694
- if (searchText.length > 1) {
2694
+ if (searchText && searchText.length > 1) {
2695
2695
  visibleItems.forEach(function (d) {
2696
2696
  // show the item and open the list
2697
2697
  var pathParts = d.path.split('::');
@@ -2744,11 +2744,19 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2744
2744
 
2745
2745
  html += this.renderBlock(this.elementId, this.elementId, this.options.items, 'main', 0);
2746
2746
  html += "</div>";
2747
+
2748
+ if (this.options.secondaryItems) {
2749
+ html += "<div class='websy-menu-secondary' style='height: ".concat(this.options.secondaryHeight || '100%', "; width: ").concat(this.options.secondaryWidth || '100%', "'>");
2750
+ html += this.renderBlock(this.elementId, this.elementId, this.options.secondaryItems, 'main', 0);
2751
+ html += "</div>";
2752
+ }
2753
+
2747
2754
  el.innerHTML = html;
2748
2755
 
2749
2756
  if (this.options.enableSearch === true) {
2750
2757
  this.search = new WebsyDesigns.Search("".concat(this.elementId, "_search"), _extends({}, {
2751
- onSearch: this.handleSearch.bind(this)
2758
+ onSearch: this.handleSearch.bind(this),
2759
+ onClear: this.handleSearch.bind(this)
2752
2760
  }, this.options.searchOptions));
2753
2761
  }
2754
2762
  }
@@ -2788,19 +2796,31 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2788
2796
  html += "\n <span class='selected-bar'></span>\n ";
2789
2797
  }
2790
2798
 
2791
- if (this.options.activeSymbol === 'triangle') {
2792
- html += "\n <span class='active-square'></span>\n ";
2793
- }
2794
-
2795
- html += " \n <span class='".concat(items[i].items && items[i].items.length > 0 ? 'menu-carat' : '', "'></span>\n ");
2796
-
2797
2799
  if (this.options.orientation === 'vertical') {// html += `
2798
2800
  // &nbsp;
2799
2801
  // `
2800
2802
  }
2801
2803
 
2802
2804
  if (items[i].isLink === true && items[i].href) {
2803
- html += "<a href='".concat(items[i].href, "'>").concat(items[i].text, "</a>");
2805
+ html += "<a href='".concat(items[i].href, "' target='").concat(items[i].openInNewTab ? 'blank' : '_self', "'>");
2806
+ }
2807
+
2808
+ if (items[i].icon) {
2809
+ html += "\n <div class='websy-menu-item-icon'>".concat(items[i].icon, "</div>\n ");
2810
+ }
2811
+
2812
+ html += "<span>".concat(items[i].text, "</span>");
2813
+
2814
+ if (items[i].isLink === true && items[i].href) {
2815
+ html += "</a>";
2816
+ }
2817
+
2818
+ if (items[i].items && items[i].items.length > 0) {
2819
+ html += " \n <span class='menu-carat'></span>\n ";
2820
+ }
2821
+
2822
+ if (this.options.activeSymbol === 'triangle') {
2823
+ html += "\n <span class='active-square'></span>\n ";
2804
2824
  }
2805
2825
 
2806
2826
  html += " \n\t\t\t\t</div>\n\t\t ";