@websy/websy-designs 1.3.3 → 1.3.5

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.
@@ -2437,7 +2437,7 @@ var WebsyLoadingDialog = /*#__PURE__*/function () {
2437
2437
 
2438
2438
  return WebsyLoadingDialog;
2439
2439
  }();
2440
- /* global */
2440
+ /* global WebsyDesigns */
2441
2441
 
2442
2442
 
2443
2443
  var WebsyNavigationMenu = /*#__PURE__*/function () {
@@ -2449,7 +2449,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2449
2449
  orientation: 'horizontal',
2450
2450
  parentMap: {},
2451
2451
  childIndentation: 10,
2452
- activeSymbol: 'none'
2452
+ activeSymbol: 'none',
2453
+ enableSearch: false,
2454
+ searchProp: 'text',
2455
+ menuIcon: "<svg viewbox=\"0 0 40 40\" width=\"30\" height=\"40\"> \n <rect x=\"0\" y=\"0\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"12\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"24\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n </svg>",
2456
+ searchOptions: {}
2453
2457
  }, options);
2454
2458
 
2455
2459
  if (!elementId) {
@@ -2457,6 +2461,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2457
2461
  return;
2458
2462
  }
2459
2463
 
2464
+ this.maxLevel = 0;
2460
2465
  var el = document.getElementById(elementId);
2461
2466
 
2462
2467
  if (el) {
@@ -2465,7 +2470,6 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2465
2470
  this.flatItems = [];
2466
2471
  this.itemMap = {};
2467
2472
  this.flattenItems(0, this.options.items);
2468
- console.log(this.flatItems);
2469
2473
  el.classList.add("websy-".concat(this.options.orientation, "-list-container"));
2470
2474
  el.classList.add('websy-menu');
2471
2475
 
@@ -2492,25 +2496,28 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2492
2496
  key: "flattenItems",
2493
2497
  value: function flattenItems(index, items) {
2494
2498
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2499
+ var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
2495
2500
 
2496
2501
  if (items[index]) {
2497
2502
  this.lowestLevel = Math.max(level, this.lowestLevel);
2498
2503
  items[index].id = items[index].id || "".concat(this.elementId, "_").concat(this.normaliseString(items[index].text));
2499
- this.itemMap[items[index].id] = items[index];
2500
2504
  items[index].level = level;
2505
+ items[index].hasChildren = items[index].items && items[index].items.length > 0;
2506
+ items[index].path = path !== '' ? "".concat(path, "::").concat(items[index].id) : items[index].id;
2507
+ this.itemMap[items[index].id] = _extends({}, items[index]);
2501
2508
  this.flatItems.push(items[index]);
2502
2509
 
2503
2510
  if (items[index].items) {
2504
- this.flattenItems(0, items[index].items, level + 1);
2511
+ this.flattenItems(0, items[index].items, level + 1, items[index].path);
2505
2512
  }
2506
2513
 
2507
- this.flattenItems(++index, items, level);
2514
+ this.flattenItems(++index, items, level, path);
2508
2515
  }
2509
2516
  }
2510
2517
  }, {
2511
2518
  key: "handleClick",
2512
2519
  value: function handleClick(event) {
2513
- if (event.target.classList.contains('websy-menu-icon') || event.target.nodeName === 'svg' || event.target.nodeName === 'rect') {
2520
+ if (event.target.classList.contains('websy-menu-icon')) {
2514
2521
  this.toggleMobileMenu();
2515
2522
  }
2516
2523
 
@@ -2521,7 +2528,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2521
2528
  this.toggleMobileMenu('remove');
2522
2529
  }
2523
2530
 
2524
- if (item.items) {
2531
+ if (item.hasChildren === true) {
2525
2532
  event.target.classList.toggle('menu-open');
2526
2533
  this.toggleMenu(item.id);
2527
2534
  }
@@ -2531,6 +2538,60 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2531
2538
  this.toggleMobileMenu();
2532
2539
  }
2533
2540
  }
2541
+ }, {
2542
+ key: "handleSearch",
2543
+ value: function handleSearch(searchText) {
2544
+ var _this16 = this;
2545
+
2546
+ var el = document.getElementById(this.elementId);
2547
+ var lowestItems = this.flatItems.filter(function (d) {
2548
+ return d.level === _this16.maxLevel;
2549
+ });
2550
+ var visibleItems = lowestItems;
2551
+ var defaultMethod = 'remove';
2552
+
2553
+ if (searchText.length > 1) {
2554
+ defaultMethod = 'add';
2555
+ visibleItems = lowestItems.filter(function (d) {
2556
+ return d[_this16.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
2557
+ });
2558
+ } // hide everything
2559
+
2560
+
2561
+ var textEls = el.querySelectorAll("div.websy-menu-header");
2562
+
2563
+ for (var t = 0; t < textEls.length; t++) {
2564
+ textEls[t].classList[defaultMethod]('websy-hidden');
2565
+ }
2566
+
2567
+ var listEls = el.querySelectorAll("ul.websy-child-list");
2568
+
2569
+ for (var l = 0; l < listEls.length; l++) {
2570
+ listEls[l].classList.add('websy-menu-collapsed');
2571
+ }
2572
+
2573
+ if (searchText.length > 1) {
2574
+ visibleItems.forEach(function (d) {
2575
+ // show the item and open the list
2576
+ var pathParts = d.path.split('::');
2577
+ pathParts.forEach(function (p) {
2578
+ var textEl = document.getElementById(p);
2579
+
2580
+ if (textEl) {
2581
+ textEl.classList.remove('websy-hidden');
2582
+ }
2583
+
2584
+ var listEl = document.getElementById("".concat(p, "_list"));
2585
+
2586
+ if (listEl) {
2587
+ listEl.classList.remove('websy-menu-collapsed');
2588
+ }
2589
+ });
2590
+ });
2591
+ }
2592
+
2593
+ console.log('visibleItems', visibleItems);
2594
+ }
2534
2595
  }, {
2535
2596
  key: "normaliseString",
2536
2597
  value: function normaliseString(text) {
@@ -2545,7 +2606,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2545
2606
  var html = "";
2546
2607
 
2547
2608
  if (this.options.collapsible === true) {
2548
- html += "\n <div id='".concat(this.elementId, "_menuIcon' class='websy-menu-icon'>\n <svg viewbox=\"0 0 40 40\" width=\"30\" height=\"40\"> \n <rect x=\"0\" y=\"0\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"12\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n <rect x=\"0\" y=\"24\" width=\"30\" height=\"4\" rx=\"2\"></rect>\n </svg>\n </div>\n ");
2609
+ html += "\n <div id='".concat(this.elementId, "_menuIcon' class='websy-menu-icon'>\n ").concat(this.options.menuIcon, "\n </div>\n ");
2549
2610
  }
2550
2611
 
2551
2612
  if (this.options.logo) {
@@ -2556,16 +2617,27 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2556
2617
  html += " \n <div \n class='logo ".concat(this.options.logo.classes || '', "'\n ").concat(this.options.logo.attributes && this.options.logo.attributes.join(' '), "\n >\n <img src='").concat(this.options.logo.url, "'></img>\n </div>\n <div id='").concat(this.elementId, "_mask' class='websy-menu-mask'></div>\n <div id=\"").concat(this.elementId, "_menuContainer\" class=\"websy-menu-block-container\">\n ");
2557
2618
  }
2558
2619
 
2559
- html += this.renderBlock(this.options.items, 'main', 0);
2620
+ if (this.options.enableSearch === true) {
2621
+ html += "\n <div id='".concat(this.elementId, "_search' class='websy-menu-search'></div>\n ");
2622
+ }
2623
+
2624
+ html += this.renderBlock(this.elementId, this.elementId, this.options.items, 'main', 0);
2560
2625
  html += "</div>";
2561
2626
  el.innerHTML = html;
2627
+
2628
+ if (this.options.enableSearch === true) {
2629
+ this.search = new WebsyDesigns.Search("".concat(this.elementId, "_search"), _extends({}, {
2630
+ onSearch: this.handleSearch.bind(this)
2631
+ }, this.options.searchOptions));
2632
+ }
2562
2633
  }
2563
2634
  }
2564
2635
  }, {
2565
2636
  key: "renderBlock",
2566
- value: function renderBlock(items, block) {
2567
- var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2568
- var html = "\n\t\t <ul class='websy-".concat(this.options.orientation, "-list ").concat(level > 0 ? 'websy-child-list' : '', " ").concat(block !== 'main' ? 'websy-menu-collapsed' : '', "' id='").concat(this.elementId, "_").concat(block, "_list'\n\t ");
2637
+ value: function renderBlock(id, path, items, block) {
2638
+ var level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2639
+ this.maxLevel = Math.max(this.maxLevel, level);
2640
+ var html = "\n\t\t <ul class='websy-".concat(this.options.orientation, "-list ").concat(level > 0 ? 'websy-child-list' : '', " ").concat(block !== 'main' ? 'websy-menu-collapsed' : '', "' id='").concat(id, "_list' data-path='").concat(path, "'\n\t ");
2569
2641
 
2570
2642
  if (block !== 'main') {
2571
2643
  html += " data-collapsed='".concat(block !== 'main' ? 'true' : 'false', "'");
@@ -2585,7 +2657,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2585
2657
  items[i].classes = items[i].classes.join(' ');
2586
2658
  }
2587
2659
 
2588
- html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n\t\t\t\t\t\t id='").concat(blockId, "' \n\t\t\t\t\t\t data-id='").concat(currentBlock, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n\t\t\t\t\t\t data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n\t\t\t\t\t\t data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n\t\t\t\t\t\t style='padding-left: ").concat(level * this.options.childIndentation, "px'\n\t\t\t\t\t\t ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
2660
+ html += "\n\t\t\t<li class='websy-".concat(this.options.orientation, "-list-item ").concat(items[i].alwaysOpen === true ? 'always-open' : '', "'>\n\t\t\t\t<div class='websy-menu-header ").concat(items[i].classes || '', " ").concat(selected, " ").concat(active, "' \n id='").concat(blockId, "' \n data-id='").concat(currentBlock, "'\n data-path='").concat(items[i].path, "'\n data-menu-id='").concat(this.elementId, "_").concat(currentBlock, "_list'\n data-popout-id='").concat(level > 1 ? block : currentBlock, "'\n data-text='").concat(items[i].isLink !== true ? items[i].text : '', "'\n style='padding-left: ").concat(level * this.options.childIndentation, "px'\n ").concat(items[i].attributes && items[i].attributes.join(' ') || '', "\n >\n ");
2589
2661
 
2590
2662
  if (this.options.orientation === 'horizontal') {
2591
2663
  html += items[i].text;
@@ -2601,8 +2673,9 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2601
2673
 
2602
2674
  html += " \n <span class='".concat(items[i].items && items[i].items.length > 0 ? 'menu-carat' : '', "'></span>\n ");
2603
2675
 
2604
- if (this.options.orientation === 'vertical') {
2605
- html += "\n &nbsp;\n ";
2676
+ if (this.options.orientation === 'vertical') {// html += `
2677
+ // &nbsp;
2678
+ // `
2606
2679
  }
2607
2680
 
2608
2681
  if (items[i].isLink === true && items[i].href) {
@@ -2612,7 +2685,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2612
2685
  html += " \n\t\t\t\t</div>\n\t\t ";
2613
2686
 
2614
2687
  if (items[i].items) {
2615
- html += this.renderBlock(items[i].items, currentBlock, items[i].level + 1);
2688
+ html += this.renderBlock(blockId, items[i].path, items[i].items, currentBlock, items[i].level + 1);
2616
2689
  } // map the item to it's parent
2617
2690
 
2618
2691
 
@@ -2631,7 +2704,8 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2631
2704
  }, {
2632
2705
  key: "toggleMenu",
2633
2706
  value: function toggleMenu(id) {
2634
- var el = document.getElementById("".concat(id, "_list"));
2707
+ var el = document.getElementById("".concat(id, "_list")); // const menuId = el.getAttribute('data-menu-id')
2708
+ // const menuEl = document.getElementById(menuId)
2635
2709
 
2636
2710
  if (el) {
2637
2711
  el.classList.toggle('websy-menu-collapsed');
@@ -2663,7 +2737,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
2663
2737
 
2664
2738
  var Pager = /*#__PURE__*/function () {
2665
2739
  function Pager(elementId, options) {
2666
- var _this16 = this;
2740
+ var _this17 = this;
2667
2741
 
2668
2742
  _classCallCheck(this, Pager);
2669
2743
 
@@ -2716,8 +2790,8 @@ var Pager = /*#__PURE__*/function () {
2716
2790
  allowClear: false,
2717
2791
  disableSearch: true,
2718
2792
  onItemSelected: function onItemSelected(selectedItem) {
2719
- if (_this16.options.onChangePageSize) {
2720
- _this16.options.onChangePageSize(selectedItem.value);
2793
+ if (_this17.options.onChangePageSize) {
2794
+ _this17.options.onChangePageSize(selectedItem.value);
2721
2795
  }
2722
2796
  }
2723
2797
  });
@@ -2741,13 +2815,13 @@ var Pager = /*#__PURE__*/function () {
2741
2815
  }, {
2742
2816
  key: "render",
2743
2817
  value: function render() {
2744
- var _this17 = this;
2818
+ var _this18 = this;
2745
2819
 
2746
2820
  var el = document.getElementById("".concat(this.elementId, "_pageList"));
2747
2821
 
2748
2822
  if (el) {
2749
2823
  var pages = this.options.pages.map(function (item, index) {
2750
- return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this17.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2824
+ return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this18.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
2751
2825
  });
2752
2826
  var startIndex = 0;
2753
2827
 
@@ -2815,58 +2889,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2815
2889
  _createClass(WebsyPDFButton, [{
2816
2890
  key: "handleClick",
2817
2891
  value: function handleClick(event) {
2818
- var _this18 = this;
2892
+ var _this19 = this;
2819
2893
 
2820
2894
  if (event.target.classList.contains('websy-pdf-button')) {
2821
2895
  this.loader.show();
2822
2896
  setTimeout(function () {
2823
- if (_this18.options.targetId) {
2824
- var el = document.getElementById(_this18.options.targetId);
2897
+ if (_this19.options.targetId) {
2898
+ var el = document.getElementById(_this19.options.targetId);
2825
2899
 
2826
2900
  if (el) {
2827
2901
  var pdfData = {
2828
2902
  options: {}
2829
2903
  };
2830
2904
 
2831
- if (_this18.options.pdfOptions) {
2832
- pdfData.options = _extends({}, _this18.options.pdfOptions);
2905
+ if (_this19.options.pdfOptions) {
2906
+ pdfData.options = _extends({}, _this19.options.pdfOptions);
2833
2907
  }
2834
2908
 
2835
- if (_this18.options.header) {
2836
- if (_this18.options.header.elementId) {
2837
- var headerEl = document.getElementById(_this18.options.header.elementId);
2909
+ if (_this19.options.header) {
2910
+ if (_this19.options.header.elementId) {
2911
+ var headerEl = document.getElementById(_this19.options.header.elementId);
2838
2912
 
2839
2913
  if (headerEl) {
2840
2914
  pdfData.header = headerEl.outerHTML;
2841
2915
 
2842
- if (_this18.options.header.css) {
2843
- pdfData.options.headerCSS = _this18.options.header.css;
2916
+ if (_this19.options.header.css) {
2917
+ pdfData.options.headerCSS = _this19.options.header.css;
2844
2918
  }
2845
2919
  }
2846
- } else if (_this18.options.header.html) {
2847
- pdfData.header = _this18.options.header.html;
2920
+ } else if (_this19.options.header.html) {
2921
+ pdfData.header = _this19.options.header.html;
2848
2922
 
2849
- if (_this18.options.header.css) {
2850
- pdfData.options.headerCSS = _this18.options.header.css;
2923
+ if (_this19.options.header.css) {
2924
+ pdfData.options.headerCSS = _this19.options.header.css;
2851
2925
  }
2852
2926
  } else {
2853
- pdfData.header = _this18.options.header;
2927
+ pdfData.header = _this19.options.header;
2854
2928
  }
2855
2929
  }
2856
2930
 
2857
- if (_this18.options.footer) {
2858
- if (_this18.options.footer.elementId) {
2859
- var footerEl = document.getElementById(_this18.options.footer.elementId);
2931
+ if (_this19.options.footer) {
2932
+ if (_this19.options.footer.elementId) {
2933
+ var footerEl = document.getElementById(_this19.options.footer.elementId);
2860
2934
 
2861
2935
  if (footerEl) {
2862
2936
  pdfData.footer = footerEl.outerHTML;
2863
2937
 
2864
- if (_this18.options.footer.css) {
2865
- pdfData.options.footerCSS = _this18.options.footer.css;
2938
+ if (_this19.options.footer.css) {
2939
+ pdfData.options.footerCSS = _this19.options.footer.css;
2866
2940
  }
2867
2941
  }
2868
2942
  } else {
2869
- pdfData.footer = _this18.options.footer;
2943
+ pdfData.footer = _this19.options.footer;
2870
2944
  }
2871
2945
  }
2872
2946
 
@@ -2875,31 +2949,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
2875
2949
  // document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
2876
2950
  // document.getElementById(`${this.elementId}_form`).submit()
2877
2951
 
2878
- _this18.service.add('', pdfData, {
2952
+ _this19.service.add('', pdfData, {
2879
2953
  responseType: 'blob'
2880
2954
  }).then(function (response) {
2881
- _this18.loader.hide();
2955
+ _this19.loader.hide();
2882
2956
 
2883
2957
  var blob = new Blob([response], {
2884
2958
  type: 'application/pdf'
2885
2959
  });
2886
2960
  var msg = "\n <div class='text-center websy-pdf-download'>\n <div>Your file is ready to download</div>\n <a href='".concat(URL.createObjectURL(blob), "' target='_blank'\n ");
2887
2961
 
2888
- if (_this18.options.directDownload === true) {
2962
+ if (_this19.options.directDownload === true) {
2889
2963
  var fileName;
2890
2964
 
2891
- if (typeof _this18.options.fileName === 'function') {
2892
- fileName = _this18.options.fileName() || 'Export';
2965
+ if (typeof _this19.options.fileName === 'function') {
2966
+ fileName = _this19.options.fileName() || 'Export';
2893
2967
  } else {
2894
- fileName = _this18.options.fileName || 'Export';
2968
+ fileName = _this19.options.fileName || 'Export';
2895
2969
  }
2896
2970
 
2897
2971
  msg += "download='".concat(fileName, ".pdf'");
2898
2972
  }
2899
2973
 
2900
- msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this18.options.buttonText, "</button>\n </a>\n </div>\n ");
2974
+ msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
2901
2975
 
2902
- _this18.popup.show({
2976
+ _this19.popup.show({
2903
2977
  message: msg,
2904
2978
  mask: true
2905
2979
  });
@@ -3100,7 +3174,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
3100
3174
 
3101
3175
  var ResponsiveText = /*#__PURE__*/function () {
3102
3176
  function ResponsiveText(elementId, options) {
3103
- var _this19 = this;
3177
+ var _this20 = this;
3104
3178
 
3105
3179
  _classCallCheck(this, ResponsiveText);
3106
3180
 
@@ -3113,7 +3187,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3113
3187
  this.elementId = elementId;
3114
3188
  this.canvas = document.createElement('canvas');
3115
3189
  window.addEventListener('resize', function () {
3116
- return _this19.render();
3190
+ return _this20.render();
3117
3191
  });
3118
3192
  var el = document.getElementById(this.elementId);
3119
3193
 
@@ -3332,7 +3406,7 @@ var ResponsiveText = /*#__PURE__*/function () {
3332
3406
 
3333
3407
  var WebsyResultList = /*#__PURE__*/function () {
3334
3408
  function WebsyResultList(elementId, options) {
3335
- var _this20 = this;
3409
+ var _this21 = this;
3336
3410
 
3337
3411
  _classCallCheck(this, WebsyResultList);
3338
3412
 
@@ -3361,9 +3435,9 @@ var WebsyResultList = /*#__PURE__*/function () {
3361
3435
 
3362
3436
  if (_typeof(options.template) === 'object' && options.template.url) {
3363
3437
  this.templateService.get(options.template.url).then(function (templateString) {
3364
- _this20.options.template = templateString;
3438
+ _this21.options.template = templateString;
3365
3439
 
3366
- _this20.render();
3440
+ _this21.render();
3367
3441
  });
3368
3442
  } else {
3369
3443
  this.render();
@@ -3383,16 +3457,17 @@ var WebsyResultList = /*#__PURE__*/function () {
3383
3457
  }, {
3384
3458
  key: "buildHTML",
3385
3459
  value: function buildHTML(d) {
3386
- var _this21 = this;
3460
+ var _this22 = this;
3387
3461
 
3388
3462
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3389
3463
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
3464
+ var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
3390
3465
  var html = "";
3391
3466
 
3392
3467
  if (this.options.template) {
3393
3468
  if (d.length > 0) {
3394
3469
  d.forEach(function (row, ix) {
3395
- var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this21.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3470
+ var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
3396
3471
 
3397
3472
  var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
3398
3473
 
@@ -3497,7 +3572,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3497
3572
  parts.forEach(function (p) {
3498
3573
  items = items[p];
3499
3574
  });
3500
- template = template.replace(m[0], _this21.buildHTML(items, 0, withoutFor));
3575
+ template = template.replace(m[0], _this22.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
3501
3576
  }
3502
3577
  });
3503
3578
 
@@ -3505,11 +3580,11 @@ var WebsyResultList = /*#__PURE__*/function () {
3505
3580
 
3506
3581
  tagMatches.forEach(function (m) {
3507
3582
  if (m[0] && m.index > -1) {
3508
- template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix));
3583
+ template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
3509
3584
  }
3510
3585
  });
3511
3586
 
3512
- var flatRow = _this21.flattenObject(row);
3587
+ var flatRow = _this22.flattenObject(row);
3513
3588
 
3514
3589
  for (var key in flatRow) {
3515
3590
  var rg = new RegExp("{".concat(key, "}"), 'gm');
@@ -3567,8 +3642,6 @@ var WebsyResultList = /*#__PURE__*/function () {
3567
3642
  }, {
3568
3643
  key: "handleClick",
3569
3644
  value: function handleClick(event) {
3570
- var _this22 = this;
3571
-
3572
3645
  if (event.target.classList.contains('clickable')) {
3573
3646
  var l = event.target.getAttribute('data-event');
3574
3647
 
@@ -3576,6 +3649,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3576
3649
  l = l.split('(');
3577
3650
  var params = [];
3578
3651
  var id = event.target.getAttribute('data-id');
3652
+ var locator = event.target.getAttribute('data-locator');
3579
3653
 
3580
3654
  if (l[1]) {
3581
3655
  l[1] = l[1].replace(')', '');
@@ -3583,10 +3657,27 @@ var WebsyResultList = /*#__PURE__*/function () {
3583
3657
  }
3584
3658
 
3585
3659
  l = l[0];
3660
+ var data = this.rows;
3661
+
3662
+ if (locator !== '') {
3663
+ var locatorItems = locator.split(';');
3664
+ locatorItems.forEach(function (loc) {
3665
+ var locatorParts = loc.split(':');
3666
+
3667
+ if (data[locatorParts[0]]) {
3668
+ data = data[locatorParts[0]];
3669
+ var parts = locatorParts[1].split('.');
3670
+ parts.forEach(function (p) {
3671
+ data = data[p];
3672
+ });
3673
+ }
3674
+ });
3675
+ }
3676
+
3586
3677
  params = params.map(function (p) {
3587
3678
  if (typeof p !== 'string' && typeof p !== 'number') {
3588
- if (_this22.rows[+id]) {
3589
- p = _this22.rows[+id][p];
3679
+ if (data[+id]) {
3680
+ p = data[+id][p];
3590
3681
  }
3591
3682
  } else if (typeof p === 'string') {
3592
3683
  p = p.replace(/"/g, '').replace(/'/g, '');
@@ -3600,7 +3691,7 @@ var WebsyResultList = /*#__PURE__*/function () {
3600
3691
 
3601
3692
  event.stopPropagation();
3602
3693
 
3603
- (_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event, this.rows[+id]].concat(_toConsumableArray(params)));
3694
+ (_this$options$listene = this.options.listeners.click[l]).call.apply(_this$options$listene, [this, event, data[+id]].concat(_toConsumableArray(params)));
3604
3695
  }
3605
3696
  }
3606
3697
  }
@@ -3669,7 +3760,14 @@ var WebsyRouter = /*#__PURE__*/function () {
3669
3760
  this.previousView = '';
3670
3761
  this.currentView = '';
3671
3762
  this.currentViewMain = '';
3672
- this.currentParams = {};
3763
+ this.currentParams = {
3764
+ path: '',
3765
+ items: {}
3766
+ };
3767
+ this.previousParams = {
3768
+ path: '',
3769
+ items: {}
3770
+ };
3673
3771
  this.controlPressed = false;
3674
3772
  this.usesHTMLSuffix = window.location.pathname.indexOf('.htm') !== -1;
3675
3773
  window.addEventListener('popstate', this.onPopState.bind(this));
@@ -3722,10 +3820,13 @@ var WebsyRouter = /*#__PURE__*/function () {
3722
3820
  }, {
3723
3821
  key: "addUrlParams",
3724
3822
  value: function addUrlParams(params) {
3823
+ var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3824
+
3725
3825
  if (typeof params === 'undefined') {
3726
3826
  return;
3727
3827
  }
3728
3828
 
3829
+ this.previousParams = _extends({}, this.currentParams);
3729
3830
  var output = {
3730
3831
  path: '',
3731
3832
  items: {}
@@ -3750,6 +3851,10 @@ var WebsyRouter = /*#__PURE__*/function () {
3750
3851
  history.pushState({
3751
3852
  inputPath: inputPath
3752
3853
  }, inputPath, "".concat(inputPath, "?").concat(path));
3854
+
3855
+ if (reloadView === true) {
3856
+ this.showView(this.currentView, this.currentParams, 'main');
3857
+ }
3753
3858
  }
3754
3859
  }, {
3755
3860
  key: "buildUrlPath",
@@ -3791,6 +3896,7 @@ var WebsyRouter = /*#__PURE__*/function () {
3791
3896
  }, {
3792
3897
  key: "formatParams",
3793
3898
  value: function formatParams(params) {
3899
+ this.previousParams = _extends({}, this.currentParams);
3794
3900
  var output = {
3795
3901
  path: params,
3796
3902
  items: {}
@@ -4056,6 +4162,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4056
4162
  this.showComponents(view);
4057
4163
  this.publish('show', [view, params, group]);
4058
4164
  }
4165
+
4166
+ if (this.previousView === this.currentView && this.previousParams.path !== this.currentParams.path) {
4167
+ this.showComponents(view);
4168
+ this.publish('show', [view, params, group]);
4169
+ }
4059
4170
  }
4060
4171
  }, {
4061
4172
  key: "reloadCurrentView",
@@ -4080,7 +4191,7 @@ var WebsyRouter = /*#__PURE__*/function () {
4080
4191
  var params = {};
4081
4192
  var newPath = inputPath;
4082
4193
 
4083
- if (inputPath === this.options.defaultView && this.usesHTMLSuffix === false) {
4194
+ if (inputPath.split('?')[0] === this.options.defaultView && this.usesHTMLSuffix === false) {
4084
4195
  inputPath = inputPath.replace(this.options.defaultView, '/');
4085
4196
  }
4086
4197
 
@@ -4088,8 +4199,6 @@ var WebsyRouter = /*#__PURE__*/function () {
4088
4199
  if (inputPath.indexOf('?') === -1 && this.queryParams) {
4089
4200
  inputPath += "?".concat(this.queryParams);
4090
4201
  }
4091
- } else {
4092
- this.currentParams = {};
4093
4202
  }
4094
4203
 
4095
4204
  if (this.usesHTMLSuffix === true) {
@@ -4113,7 +4222,11 @@ var WebsyRouter = /*#__PURE__*/function () {
4113
4222
  params = this.formatParams(parts[1]);
4114
4223
  inputPath = parts[0];
4115
4224
  } else if (group === this.options.defaultGroup) {
4116
- this.currentParams = {};
4225
+ this.previousParams = _extends({}, this.currentParams);
4226
+ this.currentParams = {
4227
+ path: '',
4228
+ items: {}
4229
+ };
4117
4230
  }
4118
4231
 
4119
4232
  if (event) {