@websy/websy-designs 1.3.4 → 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.
- package/dist/server/helpers/v1/pgHelper.js +7 -1
- package/dist/websy-designs-es6.debug.js +112 -41
- package/dist/websy-designs-es6.js +288 -192
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +131 -43
- package/dist/websy-designs.js +311 -197
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -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')
|
|
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.
|
|
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
|
|
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
|
-
|
|
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 >
|
|
2568
|
-
|
|
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
|
|
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
|
-
|
|
2676
|
+
if (this.options.orientation === 'vertical') {// html += `
|
|
2677
|
+
//
|
|
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
|
|
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 (
|
|
2720
|
-
|
|
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
|
|
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(
|
|
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
|
|
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 (
|
|
2824
|
-
var el = document.getElementById(
|
|
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 (
|
|
2832
|
-
pdfData.options = _extends({},
|
|
2905
|
+
if (_this19.options.pdfOptions) {
|
|
2906
|
+
pdfData.options = _extends({}, _this19.options.pdfOptions);
|
|
2833
2907
|
}
|
|
2834
2908
|
|
|
2835
|
-
if (
|
|
2836
|
-
if (
|
|
2837
|
-
var headerEl = document.getElementById(
|
|
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 (
|
|
2843
|
-
pdfData.options.headerCSS =
|
|
2916
|
+
if (_this19.options.header.css) {
|
|
2917
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2844
2918
|
}
|
|
2845
2919
|
}
|
|
2846
|
-
} else if (
|
|
2847
|
-
pdfData.header =
|
|
2920
|
+
} else if (_this19.options.header.html) {
|
|
2921
|
+
pdfData.header = _this19.options.header.html;
|
|
2848
2922
|
|
|
2849
|
-
if (
|
|
2850
|
-
pdfData.options.headerCSS =
|
|
2923
|
+
if (_this19.options.header.css) {
|
|
2924
|
+
pdfData.options.headerCSS = _this19.options.header.css;
|
|
2851
2925
|
}
|
|
2852
2926
|
} else {
|
|
2853
|
-
pdfData.header =
|
|
2927
|
+
pdfData.header = _this19.options.header;
|
|
2854
2928
|
}
|
|
2855
2929
|
}
|
|
2856
2930
|
|
|
2857
|
-
if (
|
|
2858
|
-
if (
|
|
2859
|
-
var footerEl = document.getElementById(
|
|
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 (
|
|
2865
|
-
pdfData.options.footerCSS =
|
|
2938
|
+
if (_this19.options.footer.css) {
|
|
2939
|
+
pdfData.options.footerCSS = _this19.options.footer.css;
|
|
2866
2940
|
}
|
|
2867
2941
|
}
|
|
2868
2942
|
} else {
|
|
2869
|
-
pdfData.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
|
-
|
|
2952
|
+
_this19.service.add('', pdfData, {
|
|
2879
2953
|
responseType: 'blob'
|
|
2880
2954
|
}).then(function (response) {
|
|
2881
|
-
|
|
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 (
|
|
2962
|
+
if (_this19.options.directDownload === true) {
|
|
2889
2963
|
var fileName;
|
|
2890
2964
|
|
|
2891
|
-
if (typeof
|
|
2892
|
-
fileName =
|
|
2965
|
+
if (typeof _this19.options.fileName === 'function') {
|
|
2966
|
+
fileName = _this19.options.fileName() || 'Export';
|
|
2893
2967
|
} else {
|
|
2894
|
-
fileName =
|
|
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(
|
|
2974
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this19.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
2901
2975
|
|
|
2902
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
3438
|
+
_this21.options.template = templateString;
|
|
3365
3439
|
|
|
3366
|
-
|
|
3440
|
+
_this21.render();
|
|
3367
3441
|
});
|
|
3368
3442
|
} else {
|
|
3369
3443
|
this.render();
|
|
@@ -3383,7 +3457,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3383
3457
|
}, {
|
|
3384
3458
|
key: "buildHTML",
|
|
3385
3459
|
value: function buildHTML(d) {
|
|
3386
|
-
var
|
|
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;
|
|
@@ -3393,7 +3467,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3393
3467
|
if (this.options.template) {
|
|
3394
3468
|
if (d.length > 0) {
|
|
3395
3469
|
d.forEach(function (row, ix) {
|
|
3396
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3470
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this22.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3397
3471
|
|
|
3398
3472
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3399
3473
|
|
|
@@ -3498,7 +3572,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3498
3572
|
parts.forEach(function (p) {
|
|
3499
3573
|
items = items[p];
|
|
3500
3574
|
});
|
|
3501
|
-
template = template.replace(m[0],
|
|
3575
|
+
template = template.replace(m[0], _this22.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3502
3576
|
}
|
|
3503
3577
|
});
|
|
3504
3578
|
|
|
@@ -3510,7 +3584,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3510
3584
|
}
|
|
3511
3585
|
});
|
|
3512
3586
|
|
|
3513
|
-
var flatRow =
|
|
3587
|
+
var flatRow = _this22.flattenObject(row);
|
|
3514
3588
|
|
|
3515
3589
|
for (var key in flatRow) {
|
|
3516
3590
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -3625,13 +3699,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3625
3699
|
}, {
|
|
3626
3700
|
key: "render",
|
|
3627
3701
|
value: function render() {
|
|
3628
|
-
var
|
|
3702
|
+
var _this23 = this;
|
|
3629
3703
|
|
|
3630
3704
|
if (this.options.entity) {
|
|
3631
3705
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3632
|
-
|
|
3706
|
+
_this23.rows = results.rows;
|
|
3633
3707
|
|
|
3634
|
-
|
|
3708
|
+
_this23.resize();
|
|
3635
3709
|
});
|
|
3636
3710
|
} else {
|
|
3637
3711
|
this.resize();
|
|
@@ -3686,7 +3760,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3686
3760
|
this.previousView = '';
|
|
3687
3761
|
this.currentView = '';
|
|
3688
3762
|
this.currentViewMain = '';
|
|
3689
|
-
this.currentParams = {
|
|
3763
|
+
this.currentParams = {
|
|
3764
|
+
path: '',
|
|
3765
|
+
items: {}
|
|
3766
|
+
};
|
|
3767
|
+
this.previousParams = {
|
|
3768
|
+
path: '',
|
|
3769
|
+
items: {}
|
|
3770
|
+
};
|
|
3690
3771
|
this.controlPressed = false;
|
|
3691
3772
|
this.usesHTMLSuffix = window.location.pathname.indexOf('.htm') !== -1;
|
|
3692
3773
|
window.addEventListener('popstate', this.onPopState.bind(this));
|
|
@@ -3709,14 +3790,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3709
3790
|
_createClass(WebsyRouter, [{
|
|
3710
3791
|
key: "addGroup",
|
|
3711
3792
|
value: function addGroup(group) {
|
|
3712
|
-
var
|
|
3793
|
+
var _this24 = this;
|
|
3713
3794
|
|
|
3714
3795
|
if (!this.groups[group]) {
|
|
3715
3796
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3716
3797
|
|
|
3717
3798
|
if (els) {
|
|
3718
3799
|
this.getClosestParent(els[0], function (parent) {
|
|
3719
|
-
|
|
3800
|
+
_this24.groups[group] = {
|
|
3720
3801
|
activeView: '',
|
|
3721
3802
|
views: [],
|
|
3722
3803
|
parent: parent.getAttribute('data-view')
|
|
@@ -3739,10 +3820,13 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3739
3820
|
}, {
|
|
3740
3821
|
key: "addUrlParams",
|
|
3741
3822
|
value: function addUrlParams(params) {
|
|
3823
|
+
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3824
|
+
|
|
3742
3825
|
if (typeof params === 'undefined') {
|
|
3743
3826
|
return;
|
|
3744
3827
|
}
|
|
3745
3828
|
|
|
3829
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
3746
3830
|
var output = {
|
|
3747
3831
|
path: '',
|
|
3748
3832
|
items: {}
|
|
@@ -3767,6 +3851,10 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3767
3851
|
history.pushState({
|
|
3768
3852
|
inputPath: inputPath
|
|
3769
3853
|
}, inputPath, "".concat(inputPath, "?").concat(path));
|
|
3854
|
+
|
|
3855
|
+
if (reloadView === true) {
|
|
3856
|
+
this.showView(this.currentView, this.currentParams, 'main');
|
|
3857
|
+
}
|
|
3770
3858
|
}
|
|
3771
3859
|
}, {
|
|
3772
3860
|
key: "buildUrlPath",
|
|
@@ -3808,6 +3896,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3808
3896
|
}, {
|
|
3809
3897
|
key: "formatParams",
|
|
3810
3898
|
value: function formatParams(params) {
|
|
3899
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
3811
3900
|
var output = {
|
|
3812
3901
|
path: params,
|
|
3813
3902
|
items: {}
|
|
@@ -4041,12 +4130,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4041
4130
|
}, {
|
|
4042
4131
|
key: "showComponents",
|
|
4043
4132
|
value: function showComponents(view) {
|
|
4044
|
-
var
|
|
4133
|
+
var _this25 = this;
|
|
4045
4134
|
|
|
4046
4135
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4047
4136
|
this.options.views[view].components.forEach(function (c) {
|
|
4048
4137
|
if (typeof c.instance === 'undefined') {
|
|
4049
|
-
|
|
4138
|
+
_this25.prepComponent(c.elementId, c.options);
|
|
4050
4139
|
|
|
4051
4140
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4052
4141
|
} else if (c.instance.render) {
|
|
@@ -4073,6 +4162,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4073
4162
|
this.showComponents(view);
|
|
4074
4163
|
this.publish('show', [view, params, group]);
|
|
4075
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
|
+
}
|
|
4076
4170
|
}
|
|
4077
4171
|
}, {
|
|
4078
4172
|
key: "reloadCurrentView",
|
|
@@ -4097,7 +4191,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4097
4191
|
var params = {};
|
|
4098
4192
|
var newPath = inputPath;
|
|
4099
4193
|
|
|
4100
|
-
if (inputPath === this.options.defaultView && this.usesHTMLSuffix === false) {
|
|
4194
|
+
if (inputPath.split('?')[0] === this.options.defaultView && this.usesHTMLSuffix === false) {
|
|
4101
4195
|
inputPath = inputPath.replace(this.options.defaultView, '/');
|
|
4102
4196
|
}
|
|
4103
4197
|
|
|
@@ -4105,8 +4199,6 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4105
4199
|
if (inputPath.indexOf('?') === -1 && this.queryParams) {
|
|
4106
4200
|
inputPath += "?".concat(this.queryParams);
|
|
4107
4201
|
}
|
|
4108
|
-
} else {
|
|
4109
|
-
this.currentParams = {};
|
|
4110
4202
|
}
|
|
4111
4203
|
|
|
4112
4204
|
if (this.usesHTMLSuffix === true) {
|
|
@@ -4130,7 +4222,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4130
4222
|
params = this.formatParams(parts[1]);
|
|
4131
4223
|
inputPath = parts[0];
|
|
4132
4224
|
} else if (group === this.options.defaultGroup) {
|
|
4133
|
-
this.
|
|
4225
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
4226
|
+
this.currentParams = {
|
|
4227
|
+
path: '',
|
|
4228
|
+
items: {}
|
|
4229
|
+
};
|
|
4134
4230
|
}
|
|
4135
4231
|
|
|
4136
4232
|
if (event) {
|
|
@@ -4415,7 +4511,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4415
4511
|
|
|
4416
4512
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4417
4513
|
function WebsyTemplate(elementId, options) {
|
|
4418
|
-
var
|
|
4514
|
+
var _this26 = this;
|
|
4419
4515
|
|
|
4420
4516
|
_classCallCheck(this, WebsyTemplate);
|
|
4421
4517
|
|
|
@@ -4441,9 +4537,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4441
4537
|
|
|
4442
4538
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4443
4539
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4444
|
-
|
|
4540
|
+
_this26.options.template = templateString;
|
|
4445
4541
|
|
|
4446
|
-
|
|
4542
|
+
_this26.render();
|
|
4447
4543
|
});
|
|
4448
4544
|
} else {
|
|
4449
4545
|
this.render();
|
|
@@ -4453,7 +4549,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4453
4549
|
_createClass(WebsyTemplate, [{
|
|
4454
4550
|
key: "buildHTML",
|
|
4455
4551
|
value: function buildHTML() {
|
|
4456
|
-
var
|
|
4552
|
+
var _this27 = this;
|
|
4457
4553
|
|
|
4458
4554
|
var html = "";
|
|
4459
4555
|
|
|
@@ -4515,14 +4611,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4515
4611
|
}
|
|
4516
4612
|
|
|
4517
4613
|
if (polarity === true) {
|
|
4518
|
-
if (typeof
|
|
4614
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] === parts[1]) {
|
|
4519
4615
|
// remove the <if> tags
|
|
4520
4616
|
removeAll = false;
|
|
4521
4617
|
} else if (parts[0] === parts[1]) {
|
|
4522
4618
|
removeAll = false;
|
|
4523
4619
|
}
|
|
4524
4620
|
} else if (polarity === false) {
|
|
4525
|
-
if (typeof
|
|
4621
|
+
if (typeof _this27.options.data[parts[0]] !== 'undefined' && _this27.options.data[parts[0]] !== parts[1]) {
|
|
4526
4622
|
// remove the <if> tags
|
|
4527
4623
|
removeAll = false;
|
|
4528
4624
|
}
|
|
@@ -4812,7 +4908,7 @@ var WebsyUtils = {
|
|
|
4812
4908
|
|
|
4813
4909
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4814
4910
|
function WebsyTable(elementId, options) {
|
|
4815
|
-
var
|
|
4911
|
+
var _this28 = this;
|
|
4816
4912
|
|
|
4817
4913
|
_classCallCheck(this, WebsyTable);
|
|
4818
4914
|
|
|
@@ -4850,8 +4946,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4850
4946
|
allowClear: false,
|
|
4851
4947
|
disableSearch: true,
|
|
4852
4948
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4853
|
-
if (
|
|
4854
|
-
|
|
4949
|
+
if (_this28.options.onChangePageSize) {
|
|
4950
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
4855
4951
|
}
|
|
4856
4952
|
}
|
|
4857
4953
|
});
|
|
@@ -4872,7 +4968,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4872
4968
|
_createClass(WebsyTable, [{
|
|
4873
4969
|
key: "appendRows",
|
|
4874
4970
|
value: function appendRows(data) {
|
|
4875
|
-
var
|
|
4971
|
+
var _this29 = this;
|
|
4876
4972
|
|
|
4877
4973
|
this.hideError();
|
|
4878
4974
|
var bodyHTML = '';
|
|
@@ -4880,15 +4976,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4880
4976
|
if (data) {
|
|
4881
4977
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
4882
4978
|
return '<tr>' + r.map(function (c, i) {
|
|
4883
|
-
if (
|
|
4979
|
+
if (_this29.options.columns[i].show !== false) {
|
|
4884
4980
|
var style = '';
|
|
4885
4981
|
|
|
4886
4982
|
if (c.style) {
|
|
4887
4983
|
style += c.style;
|
|
4888
4984
|
}
|
|
4889
4985
|
|
|
4890
|
-
if (
|
|
4891
|
-
style += "width: ".concat(
|
|
4986
|
+
if (_this29.options.columns[i].width) {
|
|
4987
|
+
style += "width: ".concat(_this29.options.columns[i].width, "; ");
|
|
4892
4988
|
}
|
|
4893
4989
|
|
|
4894
4990
|
if (c.backgroundColor) {
|
|
@@ -4903,18 +4999,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4903
4999
|
style += "color: ".concat(c.color, "; ");
|
|
4904
5000
|
}
|
|
4905
5001
|
|
|
4906
|
-
if (
|
|
4907
|
-
return "\n <td \n data-row-index='".concat(
|
|
4908
|
-
} else if ((
|
|
4909
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5002
|
+
if (_this29.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5003
|
+
return "\n <td \n data-row-index='".concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this29.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5004
|
+
} else if ((_this29.options.columns[i].showAsNavigatorLink === true || _this29.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5005
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this29.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this29.options.columns[i].linkText || c.value, "</td>\n ");
|
|
4910
5006
|
} else {
|
|
4911
5007
|
var info = c.value;
|
|
4912
5008
|
|
|
4913
|
-
if (
|
|
5009
|
+
if (_this29.options.columns[i].showAsImage === true) {
|
|
4914
5010
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
4915
5011
|
}
|
|
4916
5012
|
|
|
4917
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5013
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this29.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this29.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
4918
5014
|
}
|
|
4919
5015
|
}
|
|
4920
5016
|
}).join('') + '</tr>';
|
|
@@ -5086,7 +5182,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5086
5182
|
}, {
|
|
5087
5183
|
key: "render",
|
|
5088
5184
|
value: function render(data) {
|
|
5089
|
-
var
|
|
5185
|
+
var _this30 = this;
|
|
5090
5186
|
|
|
5091
5187
|
if (!this.options.columns) {
|
|
5092
5188
|
return;
|
|
@@ -5121,7 +5217,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5121
5217
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5122
5218
|
}
|
|
5123
5219
|
|
|
5124
|
-
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ?
|
|
5220
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-index=\"").concat(i, "\" \n data-sort=\"").concat(c.sort, "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n <!--").concat(c.searchable === true ? _this30.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5125
5221
|
}
|
|
5126
5222
|
}).join('') + '</tr>';
|
|
5127
5223
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5140,7 +5236,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5140
5236
|
|
|
5141
5237
|
if (pagingEl) {
|
|
5142
5238
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5143
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5239
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5144
5240
|
});
|
|
5145
5241
|
var startIndex = 0;
|
|
5146
5242
|
|
|
@@ -5208,7 +5304,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5208
5304
|
|
|
5209
5305
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5210
5306
|
function WebsyTable2(elementId, options) {
|
|
5211
|
-
var
|
|
5307
|
+
var _this31 = this;
|
|
5212
5308
|
|
|
5213
5309
|
_classCallCheck(this, WebsyTable2);
|
|
5214
5310
|
|
|
@@ -5249,8 +5345,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5249
5345
|
allowClear: false,
|
|
5250
5346
|
disableSearch: true,
|
|
5251
5347
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5252
|
-
if (
|
|
5253
|
-
|
|
5348
|
+
if (_this31.options.onChangePageSize) {
|
|
5349
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
5254
5350
|
}
|
|
5255
5351
|
}
|
|
5256
5352
|
});
|
|
@@ -5274,7 +5370,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5274
5370
|
_createClass(WebsyTable2, [{
|
|
5275
5371
|
key: "appendRows",
|
|
5276
5372
|
value: function appendRows(data) {
|
|
5277
|
-
var
|
|
5373
|
+
var _this32 = this;
|
|
5278
5374
|
|
|
5279
5375
|
this.hideError();
|
|
5280
5376
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5283,15 +5379,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5283
5379
|
if (data) {
|
|
5284
5380
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5285
5381
|
return '<tr>' + r.map(function (c, i) {
|
|
5286
|
-
if (
|
|
5287
|
-
var style = "height: ".concat(
|
|
5382
|
+
if (_this32.options.columns[i].show !== false) {
|
|
5383
|
+
var style = "height: ".concat(_this32.options.cellSize, "px; line-height: ").concat(_this32.options.cellSize, "px;");
|
|
5288
5384
|
|
|
5289
5385
|
if (c.style) {
|
|
5290
5386
|
style += c.style;
|
|
5291
5387
|
}
|
|
5292
5388
|
|
|
5293
|
-
if (
|
|
5294
|
-
style += "width: ".concat(
|
|
5389
|
+
if (_this32.options.columns[i].width) {
|
|
5390
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
5295
5391
|
}
|
|
5296
5392
|
|
|
5297
5393
|
if (c.backgroundColor) {
|
|
@@ -5306,18 +5402,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5306
5402
|
style += "color: ".concat(c.color, "; ");
|
|
5307
5403
|
}
|
|
5308
5404
|
|
|
5309
|
-
if (
|
|
5310
|
-
return "\n <td \n data-row-index='".concat(
|
|
5311
|
-
} else if ((
|
|
5312
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5405
|
+
if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5406
|
+
return "\n <td \n data-row-index='".concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this32.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5407
|
+
} else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5408
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this32.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this32.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5313
5409
|
} else {
|
|
5314
5410
|
var info = c.value;
|
|
5315
5411
|
|
|
5316
|
-
if (
|
|
5412
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
5317
5413
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5318
5414
|
}
|
|
5319
5415
|
|
|
5320
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5416
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this32.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this32.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
5321
5417
|
}
|
|
5322
5418
|
}
|
|
5323
5419
|
}).join('') + '</tr>';
|
|
@@ -5580,7 +5676,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5580
5676
|
}, {
|
|
5581
5677
|
key: "render",
|
|
5582
5678
|
value: function render(data) {
|
|
5583
|
-
var
|
|
5679
|
+
var _this33 = this;
|
|
5584
5680
|
|
|
5585
5681
|
if (!this.options.columns) {
|
|
5586
5682
|
return;
|
|
@@ -5616,7 +5712,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5616
5712
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5617
5713
|
}
|
|
5618
5714
|
|
|
5619
|
-
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ?
|
|
5715
|
+
return "\n <th style=\"".concat(style, "\">\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField ").concat(['asc', 'desc'].indexOf(c.sort) !== -1 ? 'sortable-column' : '', "\"\n data-sort-index=\"").concat(c.sortIndex || i, "\"\n data-index=\"").concat(i, "\"\n data-sort=\"").concat(c.sort, "\"\n style=\"").concat(c.style || '', "\" \n >\n ").concat(c.name, "\n </div>\n </div>\n <div class=\"").concat(c.activeSort ? c.sort + ' sortOrder' : '', "\"></div>\n ").concat(c.searchable === true ? _this33.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5620
5716
|
}
|
|
5621
5717
|
}).join('') + '</tr>';
|
|
5622
5718
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5627,7 +5723,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5627
5723
|
var dropdownHTML = "";
|
|
5628
5724
|
this.options.columns.forEach(function (c, i) {
|
|
5629
5725
|
if (c.searchable && c.searchField) {
|
|
5630
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5726
|
+
dropdownHTML += "\n <div id=\"".concat(_this33.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5631
5727
|
}
|
|
5632
5728
|
});
|
|
5633
5729
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5649,7 +5745,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5649
5745
|
|
|
5650
5746
|
if (pagingEl) {
|
|
5651
5747
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5652
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5748
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5653
5749
|
});
|
|
5654
5750
|
var startIndex = 0;
|
|
5655
5751
|
|
|
@@ -5740,7 +5836,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5740
5836
|
}, {
|
|
5741
5837
|
key: "getColumnParameters",
|
|
5742
5838
|
value: function getColumnParameters(values) {
|
|
5743
|
-
var
|
|
5839
|
+
var _this34 = this;
|
|
5744
5840
|
|
|
5745
5841
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5746
5842
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -5748,10 +5844,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5748
5844
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5749
5845
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5750
5846
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5751
|
-
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ?
|
|
5847
|
+
return "\n <th>\n <div class =\"tableHeader\">\n <div class=\"leftSection\">\n <div\n class=\"tableHeaderField\" \n >\n ".concat(c.value || 'nbsp;', "\n </div>\n </div> \n ").concat(c.searchable === true ? _this34.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5752
5848
|
}).join('') + '</tr>';
|
|
5753
5849
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5754
|
-
return "\n <td \n style='height: ".concat(
|
|
5850
|
+
return "\n <td \n style='height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5755
5851
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
5756
5852
|
|
|
5757
5853
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5942,7 +6038,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5942
6038
|
}, {
|
|
5943
6039
|
key: "buildHeaderHtml",
|
|
5944
6040
|
value: function buildHeaderHtml() {
|
|
5945
|
-
var
|
|
6041
|
+
var _this35 = this;
|
|
5946
6042
|
|
|
5947
6043
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5948
6044
|
var headerHtml = '';
|
|
@@ -5957,7 +6053,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5957
6053
|
}
|
|
5958
6054
|
|
|
5959
6055
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
5960
|
-
if (useWidths === false && rowIndex !==
|
|
6056
|
+
if (useWidths === false && rowIndex !== _this35.options.columns.length - 1) {
|
|
5961
6057
|
// if we're calculating the size we only want to render the last row of column headers
|
|
5962
6058
|
return;
|
|
5963
6059
|
}
|
|
@@ -5971,18 +6067,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5971
6067
|
// `
|
|
5972
6068
|
// }
|
|
5973
6069
|
|
|
5974
|
-
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ?
|
|
6070
|
+
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this35.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
5975
6071
|
});
|
|
5976
6072
|
headerHtml += "</tr>";
|
|
5977
6073
|
});
|
|
5978
6074
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
5979
6075
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
5980
6076
|
if (c.searchable && c.isExternalSearch === true) {
|
|
5981
|
-
var testEl = document.getElementById("".concat(
|
|
6077
|
+
var testEl = document.getElementById("".concat(_this35.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
5982
6078
|
|
|
5983
6079
|
if (!testEl) {
|
|
5984
6080
|
var newE = document.createElement('div');
|
|
5985
|
-
newE.id = "".concat(
|
|
6081
|
+
newE.id = "".concat(_this35.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
5986
6082
|
newE.className = 'websy-modal-dropdown';
|
|
5987
6083
|
dropdownEl.appendChild(newE);
|
|
5988
6084
|
}
|
|
@@ -5998,7 +6094,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5998
6094
|
}, {
|
|
5999
6095
|
key: "buildTotalHtml",
|
|
6000
6096
|
value: function buildTotalHtml() {
|
|
6001
|
-
var
|
|
6097
|
+
var _this36 = this;
|
|
6002
6098
|
|
|
6003
6099
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6004
6100
|
|
|
@@ -6011,7 +6107,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6011
6107
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6012
6108
|
|
|
6013
6109
|
if (useWidths === true) {
|
|
6014
|
-
totalHtml += "\n style='width: ".concat(
|
|
6110
|
+
totalHtml += "\n style='width: ".concat(_this36.options.columns[_this36.options.columns.length - 1][colIndex].width || _this36.options.columns[_this36.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6015
6111
|
}
|
|
6016
6112
|
|
|
6017
6113
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6022,7 +6118,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6022
6118
|
}, {
|
|
6023
6119
|
key: "calculateSizes",
|
|
6024
6120
|
value: function calculateSizes() {
|
|
6025
|
-
var
|
|
6121
|
+
var _this37 = this;
|
|
6026
6122
|
|
|
6027
6123
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6028
6124
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6064,28 +6160,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6064
6160
|
rows.forEach(function (row, rowIndex) {
|
|
6065
6161
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6066
6162
|
var colSize = col.getBoundingClientRect();
|
|
6067
|
-
|
|
6163
|
+
_this37.sizes.cellHeight = colSize.height;
|
|
6068
6164
|
|
|
6069
|
-
if (
|
|
6070
|
-
if (!
|
|
6071
|
-
|
|
6165
|
+
if (_this37.options.columns[_this37.options.columns.length - 1][colIndex]) {
|
|
6166
|
+
if (!_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth) {
|
|
6167
|
+
_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6072
6168
|
}
|
|
6073
6169
|
|
|
6074
|
-
|
|
6075
|
-
|
|
6170
|
+
_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this37.options.columns[_this37.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6171
|
+
_this37.options.columns[_this37.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6076
6172
|
}
|
|
6077
6173
|
});
|
|
6078
6174
|
});
|
|
6079
6175
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6080
|
-
if (colIndex <
|
|
6081
|
-
|
|
6176
|
+
if (colIndex < _this37.pinnedColumns) {
|
|
6177
|
+
_this37.sizes.scrollableWidth -= col.actualWidth;
|
|
6082
6178
|
}
|
|
6083
6179
|
});
|
|
6084
6180
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6085
6181
|
return a + (b.width || b.actualWidth);
|
|
6086
6182
|
}, 0);
|
|
6087
6183
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6088
|
-
return i >=
|
|
6184
|
+
return i >= _this37.pinnedColumns;
|
|
6089
6185
|
}).reduce(function (a, b) {
|
|
6090
6186
|
return a + (b.width || b.actualWidth);
|
|
6091
6187
|
}, 0);
|
|
@@ -6103,13 +6199,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6103
6199
|
}
|
|
6104
6200
|
}
|
|
6105
6201
|
|
|
6106
|
-
|
|
6202
|
+
_this37.sizes.totalWidth += c.width || c.actualWidth;
|
|
6107
6203
|
|
|
6108
|
-
if (i <
|
|
6109
|
-
|
|
6204
|
+
if (i < _this37.pinnedColumns) {
|
|
6205
|
+
_this37.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6110
6206
|
}
|
|
6111
6207
|
|
|
6112
|
-
equalWidth = (outerSize.width -
|
|
6208
|
+
equalWidth = (outerSize.width - _this37.sizes.totalWidth) / (_this37.options.columns[_this37.options.columns.length - 1].length - (i + 1));
|
|
6113
6209
|
});
|
|
6114
6210
|
} // take the height of the last cell as the official height for data cells
|
|
6115
6211
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6538,7 +6634,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6538
6634
|
|
|
6539
6635
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6540
6636
|
function WebsyChart(elementId, options) {
|
|
6541
|
-
var
|
|
6637
|
+
var _this38 = this;
|
|
6542
6638
|
|
|
6543
6639
|
_classCallCheck(this, WebsyChart);
|
|
6544
6640
|
|
|
@@ -6587,22 +6683,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6587
6683
|
this.invertOverride = function (input, input2) {
|
|
6588
6684
|
var xAxis = 'bottomAxis';
|
|
6589
6685
|
|
|
6590
|
-
if (
|
|
6686
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
6591
6687
|
xAxis = 'leftAxis';
|
|
6592
6688
|
}
|
|
6593
6689
|
|
|
6594
|
-
var width =
|
|
6690
|
+
var width = _this38[xAxis].step();
|
|
6595
6691
|
|
|
6596
6692
|
var output;
|
|
6597
6693
|
|
|
6598
|
-
var domain = _toConsumableArray(
|
|
6694
|
+
var domain = _toConsumableArray(_this38[xAxis].domain());
|
|
6599
6695
|
|
|
6600
|
-
if (
|
|
6696
|
+
if (_this38.options.orientation === 'horizontal') {
|
|
6601
6697
|
domain = domain.reverse();
|
|
6602
6698
|
}
|
|
6603
6699
|
|
|
6604
6700
|
for (var j = 0; j < domain.length; j++) {
|
|
6605
|
-
var breakA =
|
|
6701
|
+
var breakA = _this38[xAxis](domain[j]) - width / 2;
|
|
6606
6702
|
var breakB = breakA + width;
|
|
6607
6703
|
|
|
6608
6704
|
if (input > breakA && input <= breakB) {
|
|
@@ -6702,10 +6798,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6702
6798
|
}, {
|
|
6703
6799
|
key: "handleEventMouseMove",
|
|
6704
6800
|
value: function handleEventMouseMove(event, d) {
|
|
6705
|
-
var
|
|
6801
|
+
var _this39 = this;
|
|
6706
6802
|
|
|
6707
6803
|
var bisectDate = d3.bisector(function (d) {
|
|
6708
|
-
return
|
|
6804
|
+
return _this39.parseX(d.x.value);
|
|
6709
6805
|
}).left;
|
|
6710
6806
|
|
|
6711
6807
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -6744,8 +6840,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6744
6840
|
}
|
|
6745
6841
|
|
|
6746
6842
|
this.options.data.series.forEach(function (s) {
|
|
6747
|
-
if (
|
|
6748
|
-
xPoint =
|
|
6843
|
+
if (_this39.options.data[xData].scale !== 'Time') {
|
|
6844
|
+
xPoint = _this39[xAxis](_this39.parseX(xLabel));
|
|
6749
6845
|
s.data.forEach(function (d) {
|
|
6750
6846
|
if (d.x.value === xLabel) {
|
|
6751
6847
|
if (!tooltipTitle) {
|
|
@@ -6764,13 +6860,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6764
6860
|
var pointA = s.data[index - 1];
|
|
6765
6861
|
var pointB = s.data[index];
|
|
6766
6862
|
|
|
6767
|
-
if (
|
|
6863
|
+
if (_this39.options.orientation === 'horizontal') {
|
|
6768
6864
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
6769
6865
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
6770
6866
|
}
|
|
6771
6867
|
|
|
6772
6868
|
if (pointA && !pointB) {
|
|
6773
|
-
xPoint =
|
|
6869
|
+
xPoint = _this39[xAxis](_this39.parseX(pointA.x.value));
|
|
6774
6870
|
tooltipTitle = pointA.x.value;
|
|
6775
6871
|
|
|
6776
6872
|
if (!pointA.y.color) {
|
|
@@ -6780,12 +6876,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6780
6876
|
tooltipData.push(pointA.y);
|
|
6781
6877
|
|
|
6782
6878
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
6783
|
-
tooltipTitle = d3.timeFormat(
|
|
6879
|
+
tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
6784
6880
|
}
|
|
6785
6881
|
}
|
|
6786
6882
|
|
|
6787
6883
|
if (pointB && !pointA) {
|
|
6788
|
-
xPoint =
|
|
6884
|
+
xPoint = _this39[xAxis](_this39.parseX(pointB.x.value));
|
|
6789
6885
|
tooltipTitle = pointB.x.value;
|
|
6790
6886
|
|
|
6791
6887
|
if (!pointB.y.color) {
|
|
@@ -6795,14 +6891,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6795
6891
|
tooltipData.push(pointB.y);
|
|
6796
6892
|
|
|
6797
6893
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6798
|
-
tooltipTitle = d3.timeFormat(
|
|
6894
|
+
tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6799
6895
|
}
|
|
6800
6896
|
}
|
|
6801
6897
|
|
|
6802
6898
|
if (pointA && pointB) {
|
|
6803
|
-
var d0 =
|
|
6899
|
+
var d0 = _this39[xAxis](_this39.parseX(pointA.x.value));
|
|
6804
6900
|
|
|
6805
|
-
var d1 =
|
|
6901
|
+
var d1 = _this39[xAxis](_this39.parseX(pointB.x.value));
|
|
6806
6902
|
|
|
6807
6903
|
var mid = Math.abs(d0 - d1) / 2;
|
|
6808
6904
|
|
|
@@ -6811,7 +6907,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6811
6907
|
tooltipTitle = pointB.x.value;
|
|
6812
6908
|
|
|
6813
6909
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6814
|
-
tooltipTitle = d3.timeFormat(
|
|
6910
|
+
tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6815
6911
|
}
|
|
6816
6912
|
|
|
6817
6913
|
if (!pointB.y.color) {
|
|
@@ -6824,7 +6920,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6824
6920
|
tooltipTitle = pointA.x.value;
|
|
6825
6921
|
|
|
6826
6922
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
6827
|
-
tooltipTitle = d3.timeFormat(
|
|
6923
|
+
tooltipTitle = d3.timeFormat(_this39.options.dateFormat || _this39.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
6828
6924
|
}
|
|
6829
6925
|
|
|
6830
6926
|
if (!pointA.y.color) {
|
|
@@ -6929,7 +7025,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6929
7025
|
}, {
|
|
6930
7026
|
key: "render",
|
|
6931
7027
|
value: function render(options) {
|
|
6932
|
-
var
|
|
7028
|
+
var _this40 = this;
|
|
6933
7029
|
|
|
6934
7030
|
/* global d3 options WebsyUtils */
|
|
6935
7031
|
if (typeof options !== 'undefined') {
|
|
@@ -6998,7 +7094,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6998
7094
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
6999
7095
|
return {
|
|
7000
7096
|
value: s.label || s.key,
|
|
7001
|
-
color: s.color ||
|
|
7097
|
+
color: s.color || _this40.options.colors[i % _this40.options.colors.length]
|
|
7002
7098
|
};
|
|
7003
7099
|
});
|
|
7004
7100
|
|
|
@@ -7250,7 +7346,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7250
7346
|
|
|
7251
7347
|
if (this.options.data.bottom.formatter) {
|
|
7252
7348
|
bAxisFunc.tickFormat(function (d) {
|
|
7253
|
-
return
|
|
7349
|
+
return _this40.options.data.bottom.formatter(d);
|
|
7254
7350
|
});
|
|
7255
7351
|
}
|
|
7256
7352
|
|
|
@@ -7276,8 +7372,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7276
7372
|
|
|
7277
7373
|
if (this.options.margin.axisLeft > 0) {
|
|
7278
7374
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7279
|
-
if (
|
|
7280
|
-
d =
|
|
7375
|
+
if (_this40.options.data.left.formatter) {
|
|
7376
|
+
d = _this40.options.data.left.formatter(d);
|
|
7281
7377
|
}
|
|
7282
7378
|
|
|
7283
7379
|
return d;
|
|
@@ -7314,8 +7410,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7314
7410
|
|
|
7315
7411
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7316
7412
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7317
|
-
if (
|
|
7318
|
-
d =
|
|
7413
|
+
if (_this40.options.data.right.formatter) {
|
|
7414
|
+
d = _this40.options.data.right.formatter(d);
|
|
7319
7415
|
}
|
|
7320
7416
|
|
|
7321
7417
|
return d;
|
|
@@ -7341,16 +7437,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7341
7437
|
|
|
7342
7438
|
this.options.data.series.forEach(function (series, index) {
|
|
7343
7439
|
if (!series.key) {
|
|
7344
|
-
series.key =
|
|
7440
|
+
series.key = _this40.createIdentity();
|
|
7345
7441
|
}
|
|
7346
7442
|
|
|
7347
7443
|
if (!series.color) {
|
|
7348
|
-
series.color =
|
|
7444
|
+
series.color = _this40.options.colors[index % _this40.options.colors.length];
|
|
7349
7445
|
}
|
|
7350
7446
|
|
|
7351
|
-
|
|
7447
|
+
_this40["render".concat(series.type || 'bar')](series, index);
|
|
7352
7448
|
|
|
7353
|
-
|
|
7449
|
+
_this40.renderLabels(series, index);
|
|
7354
7450
|
});
|
|
7355
7451
|
}
|
|
7356
7452
|
}
|
|
@@ -7358,17 +7454,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7358
7454
|
}, {
|
|
7359
7455
|
key: "renderarea",
|
|
7360
7456
|
value: function renderarea(series, index) {
|
|
7361
|
-
var
|
|
7457
|
+
var _this41 = this;
|
|
7362
7458
|
|
|
7363
7459
|
/* global d3 series index */
|
|
7364
7460
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7365
7461
|
return d3.area().x(function (d) {
|
|
7366
|
-
return
|
|
7462
|
+
return _this41[xAxis](_this41.parseX(d.x.value));
|
|
7367
7463
|
}).y0(function (d) {
|
|
7368
|
-
return
|
|
7464
|
+
return _this41[yAxis](0);
|
|
7369
7465
|
}).y1(function (d) {
|
|
7370
|
-
return
|
|
7371
|
-
}).curve(d3[curveStyle ||
|
|
7466
|
+
return _this41[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7467
|
+
}).curve(d3[curveStyle || _this41.options.curveStyle]);
|
|
7372
7468
|
};
|
|
7373
7469
|
|
|
7374
7470
|
var xAxis = 'bottomAxis';
|
|
@@ -7484,7 +7580,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7484
7580
|
}, {
|
|
7485
7581
|
key: "renderLabels",
|
|
7486
7582
|
value: function renderLabels(series, index) {
|
|
7487
|
-
var
|
|
7583
|
+
var _this42 = this;
|
|
7488
7584
|
|
|
7489
7585
|
/* global series index d3 WebsyDesigns */
|
|
7490
7586
|
var xAxis = 'bottomAxis';
|
|
@@ -7503,7 +7599,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7503
7599
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7504
7600
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7505
7601
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7506
|
-
return
|
|
7602
|
+
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7507
7603
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7508
7604
|
return d.y.label || d.y.value;
|
|
7509
7605
|
}).each(function (d, i) {
|
|
@@ -7528,7 +7624,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7528
7624
|
}
|
|
7529
7625
|
});
|
|
7530
7626
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
7531
|
-
return
|
|
7627
|
+
return _this42.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7532
7628
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7533
7629
|
return d.y.label || d.y.value;
|
|
7534
7630
|
}).each(function (d, i) {
|
|
@@ -7585,15 +7681,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7585
7681
|
}, {
|
|
7586
7682
|
key: "renderline",
|
|
7587
7683
|
value: function renderline(series, index) {
|
|
7588
|
-
var
|
|
7684
|
+
var _this43 = this;
|
|
7589
7685
|
|
|
7590
7686
|
/* global series index d3 */
|
|
7591
7687
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7592
7688
|
return d3.line().x(function (d) {
|
|
7593
|
-
return
|
|
7689
|
+
return _this43[xAxis](_this43.parseX(d.x.value));
|
|
7594
7690
|
}).y(function (d) {
|
|
7595
|
-
return
|
|
7596
|
-
}).curve(d3[curveStyle ||
|
|
7691
|
+
return _this43[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7692
|
+
}).curve(d3[curveStyle || _this43.options.curveStyle]);
|
|
7597
7693
|
};
|
|
7598
7694
|
|
|
7599
7695
|
var xAxis = 'bottomAxis';
|
|
@@ -7631,14 +7727,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7631
7727
|
}, {
|
|
7632
7728
|
key: "rendersymbol",
|
|
7633
7729
|
value: function rendersymbol(series, index) {
|
|
7634
|
-
var
|
|
7730
|
+
var _this44 = this;
|
|
7635
7731
|
|
|
7636
7732
|
/* global d3 series index series.key */
|
|
7637
7733
|
var drawSymbol = function drawSymbol(size) {
|
|
7638
7734
|
return d3.symbol() // .type(d => {
|
|
7639
7735
|
// return d3.symbols[0]
|
|
7640
7736
|
// })
|
|
7641
|
-
.size(size ||
|
|
7737
|
+
.size(size || _this44.options.symbolSize);
|
|
7642
7738
|
};
|
|
7643
7739
|
|
|
7644
7740
|
var xAxis = 'bottomAxis';
|
|
@@ -7656,7 +7752,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7656
7752
|
symbols.attr('d', function (d) {
|
|
7657
7753
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
7658
7754
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
7659
|
-
return "translate(".concat(
|
|
7755
|
+
return "translate(".concat(_this44[xAxis](_this44.parseX(d.x.value)), ", ").concat(_this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7660
7756
|
}); // Enter
|
|
7661
7757
|
|
|
7662
7758
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -7665,7 +7761,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7665
7761
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
7666
7762
|
return "symbol symbol_".concat(series.key);
|
|
7667
7763
|
}).attr('transform', function (d) {
|
|
7668
|
-
return "translate(".concat(
|
|
7764
|
+
return "translate(".concat(_this44[xAxis](_this44.parseX(d.x.value)), ", ").concat(_this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
7669
7765
|
});
|
|
7670
7766
|
}
|
|
7671
7767
|
}, {
|
|
@@ -7820,7 +7916,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7820
7916
|
}, {
|
|
7821
7917
|
key: "resize",
|
|
7822
7918
|
value: function resize() {
|
|
7823
|
-
var
|
|
7919
|
+
var _this45 = this;
|
|
7824
7920
|
|
|
7825
7921
|
var el = document.getElementById(this.elementId);
|
|
7826
7922
|
|
|
@@ -7833,7 +7929,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
7833
7929
|
// }
|
|
7834
7930
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
7835
7931
|
html += this._data.map(function (d, i) {
|
|
7836
|
-
return
|
|
7932
|
+
return _this45.getLegendItemHTML(d);
|
|
7837
7933
|
}).join('');
|
|
7838
7934
|
html += "\n <div>\n ";
|
|
7839
7935
|
el.innerHTML = html;
|
|
@@ -8005,7 +8101,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8005
8101
|
}, {
|
|
8006
8102
|
key: "render",
|
|
8007
8103
|
value: function render() {
|
|
8008
|
-
var
|
|
8104
|
+
var _this46 = this;
|
|
8009
8105
|
|
|
8010
8106
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8011
8107
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8014,7 +8110,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8014
8110
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8015
8111
|
return {
|
|
8016
8112
|
value: s.label || s.key,
|
|
8017
|
-
color: s.color ||
|
|
8113
|
+
color: s.color || _this46.options.colors[i % _this46.options.colors.length]
|
|
8018
8114
|
};
|
|
8019
8115
|
});
|
|
8020
8116
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8078,7 +8174,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8078
8174
|
|
|
8079
8175
|
if (this.polygons) {
|
|
8080
8176
|
this.polygons.forEach(function (p) {
|
|
8081
|
-
return
|
|
8177
|
+
return _this46.map.removeLayer(p);
|
|
8082
8178
|
});
|
|
8083
8179
|
}
|
|
8084
8180
|
|
|
@@ -8136,18 +8232,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8136
8232
|
}
|
|
8137
8233
|
|
|
8138
8234
|
if (!p.options.color) {
|
|
8139
|
-
p.options.color =
|
|
8235
|
+
p.options.color = _this46.options.colors[i % _this46.options.colors.length];
|
|
8140
8236
|
}
|
|
8141
8237
|
|
|
8142
8238
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8143
8239
|
return c.map(function (d) {
|
|
8144
8240
|
return [d.Latitude, d.Longitude];
|
|
8145
8241
|
});
|
|
8146
|
-
}), p.options).addTo(
|
|
8242
|
+
}), p.options).addTo(_this46.map);
|
|
8147
8243
|
|
|
8148
|
-
|
|
8244
|
+
_this46.polygons.push(pol);
|
|
8149
8245
|
|
|
8150
|
-
|
|
8246
|
+
_this46.map.fitBounds(pol.getBounds());
|
|
8151
8247
|
});
|
|
8152
8248
|
} // if (this.data.markers.length > 0) {
|
|
8153
8249
|
// el.classList.remove('hidden')
|