@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
package/dist/websy-designs.js
CHANGED
|
@@ -2719,7 +2719,7 @@ var WebsyLogin = /*#__PURE__*/function () {
|
|
|
2719
2719
|
|
|
2720
2720
|
return WebsyLogin;
|
|
2721
2721
|
}();
|
|
2722
|
-
/* global */
|
|
2722
|
+
/* global WebsyDesigns */
|
|
2723
2723
|
|
|
2724
2724
|
|
|
2725
2725
|
var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
@@ -2731,7 +2731,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2731
2731
|
orientation: 'horizontal',
|
|
2732
2732
|
parentMap: {},
|
|
2733
2733
|
childIndentation: 10,
|
|
2734
|
-
activeSymbol: 'none'
|
|
2734
|
+
activeSymbol: 'none',
|
|
2735
|
+
enableSearch: false,
|
|
2736
|
+
searchProp: 'text',
|
|
2737
|
+
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>",
|
|
2738
|
+
searchOptions: {}
|
|
2735
2739
|
}, options);
|
|
2736
2740
|
|
|
2737
2741
|
if (!elementId) {
|
|
@@ -2739,6 +2743,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2739
2743
|
return;
|
|
2740
2744
|
}
|
|
2741
2745
|
|
|
2746
|
+
this.maxLevel = 0;
|
|
2742
2747
|
var el = document.getElementById(elementId);
|
|
2743
2748
|
|
|
2744
2749
|
if (el) {
|
|
@@ -2747,7 +2752,6 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2747
2752
|
this.flatItems = [];
|
|
2748
2753
|
this.itemMap = {};
|
|
2749
2754
|
this.flattenItems(0, this.options.items);
|
|
2750
|
-
console.log(this.flatItems);
|
|
2751
2755
|
el.classList.add("websy-".concat(this.options.orientation, "-list-container"));
|
|
2752
2756
|
el.classList.add('websy-menu');
|
|
2753
2757
|
|
|
@@ -2774,25 +2778,28 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2774
2778
|
key: "flattenItems",
|
|
2775
2779
|
value: function flattenItems(index, items) {
|
|
2776
2780
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2781
|
+
var path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
2777
2782
|
|
|
2778
2783
|
if (items[index]) {
|
|
2779
2784
|
this.lowestLevel = Math.max(level, this.lowestLevel);
|
|
2780
2785
|
items[index].id = items[index].id || "".concat(this.elementId, "_").concat(this.normaliseString(items[index].text));
|
|
2781
|
-
this.itemMap[items[index].id] = items[index];
|
|
2782
2786
|
items[index].level = level;
|
|
2787
|
+
items[index].hasChildren = items[index].items && items[index].items.length > 0;
|
|
2788
|
+
items[index].path = path !== '' ? "".concat(path, "::").concat(items[index].id) : items[index].id;
|
|
2789
|
+
this.itemMap[items[index].id] = _extends({}, items[index]);
|
|
2783
2790
|
this.flatItems.push(items[index]);
|
|
2784
2791
|
|
|
2785
2792
|
if (items[index].items) {
|
|
2786
|
-
this.flattenItems(0, items[index].items, level + 1);
|
|
2793
|
+
this.flattenItems(0, items[index].items, level + 1, items[index].path);
|
|
2787
2794
|
}
|
|
2788
2795
|
|
|
2789
|
-
this.flattenItems(++index, items, level);
|
|
2796
|
+
this.flattenItems(++index, items, level, path);
|
|
2790
2797
|
}
|
|
2791
2798
|
}
|
|
2792
2799
|
}, {
|
|
2793
2800
|
key: "handleClick",
|
|
2794
2801
|
value: function handleClick(event) {
|
|
2795
|
-
if (event.target.classList.contains('websy-menu-icon')
|
|
2802
|
+
if (event.target.classList.contains('websy-menu-icon')) {
|
|
2796
2803
|
this.toggleMobileMenu();
|
|
2797
2804
|
}
|
|
2798
2805
|
|
|
@@ -2803,7 +2810,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2803
2810
|
this.toggleMobileMenu('remove');
|
|
2804
2811
|
}
|
|
2805
2812
|
|
|
2806
|
-
if (item.
|
|
2813
|
+
if (item.hasChildren === true) {
|
|
2807
2814
|
event.target.classList.toggle('menu-open');
|
|
2808
2815
|
this.toggleMenu(item.id);
|
|
2809
2816
|
}
|
|
@@ -2813,6 +2820,60 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2813
2820
|
this.toggleMobileMenu();
|
|
2814
2821
|
}
|
|
2815
2822
|
}
|
|
2823
|
+
}, {
|
|
2824
|
+
key: "handleSearch",
|
|
2825
|
+
value: function handleSearch(searchText) {
|
|
2826
|
+
var _this18 = this;
|
|
2827
|
+
|
|
2828
|
+
var el = document.getElementById(this.elementId);
|
|
2829
|
+
var lowestItems = this.flatItems.filter(function (d) {
|
|
2830
|
+
return d.level === _this18.maxLevel;
|
|
2831
|
+
});
|
|
2832
|
+
var visibleItems = lowestItems;
|
|
2833
|
+
var defaultMethod = 'remove';
|
|
2834
|
+
|
|
2835
|
+
if (searchText.length > 1) {
|
|
2836
|
+
defaultMethod = 'add';
|
|
2837
|
+
visibleItems = lowestItems.filter(function (d) {
|
|
2838
|
+
return d[_this18.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2839
|
+
});
|
|
2840
|
+
} // hide everything
|
|
2841
|
+
|
|
2842
|
+
|
|
2843
|
+
var textEls = el.querySelectorAll("div.websy-menu-header");
|
|
2844
|
+
|
|
2845
|
+
for (var t = 0; t < textEls.length; t++) {
|
|
2846
|
+
textEls[t].classList[defaultMethod]('websy-hidden');
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
var listEls = el.querySelectorAll("ul.websy-child-list");
|
|
2850
|
+
|
|
2851
|
+
for (var l = 0; l < listEls.length; l++) {
|
|
2852
|
+
listEls[l].classList.add('websy-menu-collapsed');
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
if (searchText.length > 1) {
|
|
2856
|
+
visibleItems.forEach(function (d) {
|
|
2857
|
+
// show the item and open the list
|
|
2858
|
+
var pathParts = d.path.split('::');
|
|
2859
|
+
pathParts.forEach(function (p) {
|
|
2860
|
+
var textEl = document.getElementById(p);
|
|
2861
|
+
|
|
2862
|
+
if (textEl) {
|
|
2863
|
+
textEl.classList.remove('websy-hidden');
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
var listEl = document.getElementById("".concat(p, "_list"));
|
|
2867
|
+
|
|
2868
|
+
if (listEl) {
|
|
2869
|
+
listEl.classList.remove('websy-menu-collapsed');
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
});
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
console.log('visibleItems', visibleItems);
|
|
2876
|
+
}
|
|
2816
2877
|
}, {
|
|
2817
2878
|
key: "normaliseString",
|
|
2818
2879
|
value: function normaliseString(text) {
|
|
@@ -2827,7 +2888,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2827
2888
|
var html = "";
|
|
2828
2889
|
|
|
2829
2890
|
if (this.options.collapsible === true) {
|
|
2830
|
-
html += "\n <div id='".concat(this.elementId, "_menuIcon' class='websy-menu-icon'>\n
|
|
2891
|
+
html += "\n <div id='".concat(this.elementId, "_menuIcon' class='websy-menu-icon'>\n ").concat(this.options.menuIcon, "\n </div>\n ");
|
|
2831
2892
|
}
|
|
2832
2893
|
|
|
2833
2894
|
if (this.options.logo) {
|
|
@@ -2838,16 +2899,27 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2838
2899
|
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 ");
|
|
2839
2900
|
}
|
|
2840
2901
|
|
|
2841
|
-
|
|
2902
|
+
if (this.options.enableSearch === true) {
|
|
2903
|
+
html += "\n <div id='".concat(this.elementId, "_search' class='websy-menu-search'></div>\n ");
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
html += this.renderBlock(this.elementId, this.elementId, this.options.items, 'main', 0);
|
|
2842
2907
|
html += "</div>";
|
|
2843
2908
|
el.innerHTML = html;
|
|
2909
|
+
|
|
2910
|
+
if (this.options.enableSearch === true) {
|
|
2911
|
+
this.search = new WebsyDesigns.Search("".concat(this.elementId, "_search"), _extends({}, {
|
|
2912
|
+
onSearch: this.handleSearch.bind(this)
|
|
2913
|
+
}, this.options.searchOptions));
|
|
2914
|
+
}
|
|
2844
2915
|
}
|
|
2845
2916
|
}
|
|
2846
2917
|
}, {
|
|
2847
2918
|
key: "renderBlock",
|
|
2848
|
-
value: function renderBlock(items, block) {
|
|
2849
|
-
var level = arguments.length >
|
|
2850
|
-
|
|
2919
|
+
value: function renderBlock(id, path, items, block) {
|
|
2920
|
+
var level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
2921
|
+
this.maxLevel = Math.max(this.maxLevel, level);
|
|
2922
|
+
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 ");
|
|
2851
2923
|
|
|
2852
2924
|
if (block !== 'main') {
|
|
2853
2925
|
html += " data-collapsed='".concat(block !== 'main' ? 'true' : 'false', "'");
|
|
@@ -2867,7 +2939,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2867
2939
|
items[i].classes = items[i].classes.join(' ');
|
|
2868
2940
|
}
|
|
2869
2941
|
|
|
2870
|
-
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
|
|
2942
|
+
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 ");
|
|
2871
2943
|
|
|
2872
2944
|
if (this.options.orientation === 'horizontal') {
|
|
2873
2945
|
html += items[i].text;
|
|
@@ -2883,8 +2955,9 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2883
2955
|
|
|
2884
2956
|
html += " \n <span class='".concat(items[i].items && items[i].items.length > 0 ? 'menu-carat' : '', "'></span>\n ");
|
|
2885
2957
|
|
|
2886
|
-
if (this.options.orientation === 'vertical') {
|
|
2887
|
-
|
|
2958
|
+
if (this.options.orientation === 'vertical') {// html += `
|
|
2959
|
+
//
|
|
2960
|
+
// `
|
|
2888
2961
|
}
|
|
2889
2962
|
|
|
2890
2963
|
if (items[i].isLink === true && items[i].href) {
|
|
@@ -2894,7 +2967,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2894
2967
|
html += " \n\t\t\t\t</div>\n\t\t ";
|
|
2895
2968
|
|
|
2896
2969
|
if (items[i].items) {
|
|
2897
|
-
html += this.renderBlock(items[i].items, currentBlock, items[i].level + 1);
|
|
2970
|
+
html += this.renderBlock(blockId, items[i].path, items[i].items, currentBlock, items[i].level + 1);
|
|
2898
2971
|
} // map the item to it's parent
|
|
2899
2972
|
|
|
2900
2973
|
|
|
@@ -2913,7 +2986,8 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2913
2986
|
}, {
|
|
2914
2987
|
key: "toggleMenu",
|
|
2915
2988
|
value: function toggleMenu(id) {
|
|
2916
|
-
var el = document.getElementById("".concat(id, "_list"));
|
|
2989
|
+
var el = document.getElementById("".concat(id, "_list")); // const menuId = el.getAttribute('data-menu-id')
|
|
2990
|
+
// const menuEl = document.getElementById(menuId)
|
|
2917
2991
|
|
|
2918
2992
|
if (el) {
|
|
2919
2993
|
el.classList.toggle('websy-menu-collapsed');
|
|
@@ -2945,7 +3019,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2945
3019
|
|
|
2946
3020
|
var Pager = /*#__PURE__*/function () {
|
|
2947
3021
|
function Pager(elementId, options) {
|
|
2948
|
-
var
|
|
3022
|
+
var _this19 = this;
|
|
2949
3023
|
|
|
2950
3024
|
_classCallCheck(this, Pager);
|
|
2951
3025
|
|
|
@@ -2998,8 +3072,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2998
3072
|
allowClear: false,
|
|
2999
3073
|
disableSearch: true,
|
|
3000
3074
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3001
|
-
if (
|
|
3002
|
-
|
|
3075
|
+
if (_this19.options.onChangePageSize) {
|
|
3076
|
+
_this19.options.onChangePageSize(selectedItem.value);
|
|
3003
3077
|
}
|
|
3004
3078
|
}
|
|
3005
3079
|
});
|
|
@@ -3023,13 +3097,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3023
3097
|
}, {
|
|
3024
3098
|
key: "render",
|
|
3025
3099
|
value: function render() {
|
|
3026
|
-
var
|
|
3100
|
+
var _this20 = this;
|
|
3027
3101
|
|
|
3028
3102
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3029
3103
|
|
|
3030
3104
|
if (el) {
|
|
3031
3105
|
var pages = this.options.pages.map(function (item, index) {
|
|
3032
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3106
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this20.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3033
3107
|
});
|
|
3034
3108
|
var startIndex = 0;
|
|
3035
3109
|
|
|
@@ -3097,58 +3171,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3097
3171
|
_createClass(WebsyPDFButton, [{
|
|
3098
3172
|
key: "handleClick",
|
|
3099
3173
|
value: function handleClick(event) {
|
|
3100
|
-
var
|
|
3174
|
+
var _this21 = this;
|
|
3101
3175
|
|
|
3102
3176
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3103
3177
|
this.loader.show();
|
|
3104
3178
|
setTimeout(function () {
|
|
3105
|
-
if (
|
|
3106
|
-
var el = document.getElementById(
|
|
3179
|
+
if (_this21.options.targetId) {
|
|
3180
|
+
var el = document.getElementById(_this21.options.targetId);
|
|
3107
3181
|
|
|
3108
3182
|
if (el) {
|
|
3109
3183
|
var pdfData = {
|
|
3110
3184
|
options: {}
|
|
3111
3185
|
};
|
|
3112
3186
|
|
|
3113
|
-
if (
|
|
3114
|
-
pdfData.options = _extends({},
|
|
3187
|
+
if (_this21.options.pdfOptions) {
|
|
3188
|
+
pdfData.options = _extends({}, _this21.options.pdfOptions);
|
|
3115
3189
|
}
|
|
3116
3190
|
|
|
3117
|
-
if (
|
|
3118
|
-
if (
|
|
3119
|
-
var headerEl = document.getElementById(
|
|
3191
|
+
if (_this21.options.header) {
|
|
3192
|
+
if (_this21.options.header.elementId) {
|
|
3193
|
+
var headerEl = document.getElementById(_this21.options.header.elementId);
|
|
3120
3194
|
|
|
3121
3195
|
if (headerEl) {
|
|
3122
3196
|
pdfData.header = headerEl.outerHTML;
|
|
3123
3197
|
|
|
3124
|
-
if (
|
|
3125
|
-
pdfData.options.headerCSS =
|
|
3198
|
+
if (_this21.options.header.css) {
|
|
3199
|
+
pdfData.options.headerCSS = _this21.options.header.css;
|
|
3126
3200
|
}
|
|
3127
3201
|
}
|
|
3128
|
-
} else if (
|
|
3129
|
-
pdfData.header =
|
|
3202
|
+
} else if (_this21.options.header.html) {
|
|
3203
|
+
pdfData.header = _this21.options.header.html;
|
|
3130
3204
|
|
|
3131
|
-
if (
|
|
3132
|
-
pdfData.options.headerCSS =
|
|
3205
|
+
if (_this21.options.header.css) {
|
|
3206
|
+
pdfData.options.headerCSS = _this21.options.header.css;
|
|
3133
3207
|
}
|
|
3134
3208
|
} else {
|
|
3135
|
-
pdfData.header =
|
|
3209
|
+
pdfData.header = _this21.options.header;
|
|
3136
3210
|
}
|
|
3137
3211
|
}
|
|
3138
3212
|
|
|
3139
|
-
if (
|
|
3140
|
-
if (
|
|
3141
|
-
var footerEl = document.getElementById(
|
|
3213
|
+
if (_this21.options.footer) {
|
|
3214
|
+
if (_this21.options.footer.elementId) {
|
|
3215
|
+
var footerEl = document.getElementById(_this21.options.footer.elementId);
|
|
3142
3216
|
|
|
3143
3217
|
if (footerEl) {
|
|
3144
3218
|
pdfData.footer = footerEl.outerHTML;
|
|
3145
3219
|
|
|
3146
|
-
if (
|
|
3147
|
-
pdfData.options.footerCSS =
|
|
3220
|
+
if (_this21.options.footer.css) {
|
|
3221
|
+
pdfData.options.footerCSS = _this21.options.footer.css;
|
|
3148
3222
|
}
|
|
3149
3223
|
}
|
|
3150
3224
|
} else {
|
|
3151
|
-
pdfData.footer =
|
|
3225
|
+
pdfData.footer = _this21.options.footer;
|
|
3152
3226
|
}
|
|
3153
3227
|
}
|
|
3154
3228
|
|
|
@@ -3157,31 +3231,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3157
3231
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3158
3232
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3159
3233
|
|
|
3160
|
-
|
|
3234
|
+
_this21.service.add('', pdfData, {
|
|
3161
3235
|
responseType: 'blob'
|
|
3162
3236
|
}).then(function (response) {
|
|
3163
|
-
|
|
3237
|
+
_this21.loader.hide();
|
|
3164
3238
|
|
|
3165
3239
|
var blob = new Blob([response], {
|
|
3166
3240
|
type: 'application/pdf'
|
|
3167
3241
|
});
|
|
3168
3242
|
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 ");
|
|
3169
3243
|
|
|
3170
|
-
if (
|
|
3244
|
+
if (_this21.options.directDownload === true) {
|
|
3171
3245
|
var fileName;
|
|
3172
3246
|
|
|
3173
|
-
if (typeof
|
|
3174
|
-
fileName =
|
|
3247
|
+
if (typeof _this21.options.fileName === 'function') {
|
|
3248
|
+
fileName = _this21.options.fileName() || 'Export';
|
|
3175
3249
|
} else {
|
|
3176
|
-
fileName =
|
|
3250
|
+
fileName = _this21.options.fileName || 'Export';
|
|
3177
3251
|
}
|
|
3178
3252
|
|
|
3179
3253
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3180
3254
|
}
|
|
3181
3255
|
|
|
3182
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3256
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this21.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3183
3257
|
|
|
3184
|
-
|
|
3258
|
+
_this21.popup.show({
|
|
3185
3259
|
message: msg,
|
|
3186
3260
|
mask: true
|
|
3187
3261
|
});
|
|
@@ -3382,7 +3456,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3382
3456
|
|
|
3383
3457
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3384
3458
|
function ResponsiveText(elementId, options) {
|
|
3385
|
-
var
|
|
3459
|
+
var _this22 = this;
|
|
3386
3460
|
|
|
3387
3461
|
_classCallCheck(this, ResponsiveText);
|
|
3388
3462
|
|
|
@@ -3395,7 +3469,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3395
3469
|
this.elementId = elementId;
|
|
3396
3470
|
this.canvas = document.createElement('canvas');
|
|
3397
3471
|
window.addEventListener('resize', function () {
|
|
3398
|
-
return
|
|
3472
|
+
return _this22.render();
|
|
3399
3473
|
});
|
|
3400
3474
|
var el = document.getElementById(this.elementId);
|
|
3401
3475
|
|
|
@@ -3614,7 +3688,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3614
3688
|
|
|
3615
3689
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3616
3690
|
function WebsyResultList(elementId, options) {
|
|
3617
|
-
var
|
|
3691
|
+
var _this23 = this;
|
|
3618
3692
|
|
|
3619
3693
|
_classCallCheck(this, WebsyResultList);
|
|
3620
3694
|
|
|
@@ -3643,9 +3717,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3643
3717
|
|
|
3644
3718
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3645
3719
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3646
|
-
|
|
3720
|
+
_this23.options.template = templateString;
|
|
3647
3721
|
|
|
3648
|
-
|
|
3722
|
+
_this23.render();
|
|
3649
3723
|
});
|
|
3650
3724
|
} else {
|
|
3651
3725
|
this.render();
|
|
@@ -3665,7 +3739,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3665
3739
|
}, {
|
|
3666
3740
|
key: "buildHTML",
|
|
3667
3741
|
value: function buildHTML(d) {
|
|
3668
|
-
var
|
|
3742
|
+
var _this24 = this;
|
|
3669
3743
|
|
|
3670
3744
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3671
3745
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3675,7 +3749,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3675
3749
|
if (this.options.template) {
|
|
3676
3750
|
if (d.length > 0) {
|
|
3677
3751
|
d.forEach(function (row, ix) {
|
|
3678
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3752
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this24.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3679
3753
|
|
|
3680
3754
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3681
3755
|
|
|
@@ -3780,7 +3854,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3780
3854
|
parts.forEach(function (p) {
|
|
3781
3855
|
items = items[p];
|
|
3782
3856
|
});
|
|
3783
|
-
template = template.replace(m[0],
|
|
3857
|
+
template = template.replace(m[0], _this24.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3784
3858
|
}
|
|
3785
3859
|
});
|
|
3786
3860
|
|
|
@@ -3792,7 +3866,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3792
3866
|
}
|
|
3793
3867
|
});
|
|
3794
3868
|
|
|
3795
|
-
var flatRow =
|
|
3869
|
+
var flatRow = _this24.flattenObject(row);
|
|
3796
3870
|
|
|
3797
3871
|
for (var key in flatRow) {
|
|
3798
3872
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -3907,13 +3981,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3907
3981
|
}, {
|
|
3908
3982
|
key: "render",
|
|
3909
3983
|
value: function render() {
|
|
3910
|
-
var
|
|
3984
|
+
var _this25 = this;
|
|
3911
3985
|
|
|
3912
3986
|
if (this.options.entity) {
|
|
3913
3987
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3914
|
-
|
|
3988
|
+
_this25.rows = results.rows;
|
|
3915
3989
|
|
|
3916
|
-
|
|
3990
|
+
_this25.resize();
|
|
3917
3991
|
});
|
|
3918
3992
|
} else {
|
|
3919
3993
|
this.resize();
|
|
@@ -3968,7 +4042,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3968
4042
|
this.previousView = '';
|
|
3969
4043
|
this.currentView = '';
|
|
3970
4044
|
this.currentViewMain = '';
|
|
3971
|
-
this.currentParams = {
|
|
4045
|
+
this.currentParams = {
|
|
4046
|
+
path: '',
|
|
4047
|
+
items: {}
|
|
4048
|
+
};
|
|
4049
|
+
this.previousParams = {
|
|
4050
|
+
path: '',
|
|
4051
|
+
items: {}
|
|
4052
|
+
};
|
|
3972
4053
|
this.controlPressed = false;
|
|
3973
4054
|
this.usesHTMLSuffix = window.location.pathname.indexOf('.htm') !== -1;
|
|
3974
4055
|
window.addEventListener('popstate', this.onPopState.bind(this));
|
|
@@ -3991,14 +4072,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3991
4072
|
_createClass(WebsyRouter, [{
|
|
3992
4073
|
key: "addGroup",
|
|
3993
4074
|
value: function addGroup(group) {
|
|
3994
|
-
var
|
|
4075
|
+
var _this26 = this;
|
|
3995
4076
|
|
|
3996
4077
|
if (!this.groups[group]) {
|
|
3997
4078
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3998
4079
|
|
|
3999
4080
|
if (els) {
|
|
4000
4081
|
this.getClosestParent(els[0], function (parent) {
|
|
4001
|
-
|
|
4082
|
+
_this26.groups[group] = {
|
|
4002
4083
|
activeView: '',
|
|
4003
4084
|
views: [],
|
|
4004
4085
|
parent: parent.getAttribute('data-view')
|
|
@@ -4021,10 +4102,13 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4021
4102
|
}, {
|
|
4022
4103
|
key: "addUrlParams",
|
|
4023
4104
|
value: function addUrlParams(params) {
|
|
4105
|
+
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4106
|
+
|
|
4024
4107
|
if (typeof params === 'undefined') {
|
|
4025
4108
|
return;
|
|
4026
4109
|
}
|
|
4027
4110
|
|
|
4111
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
4028
4112
|
var output = {
|
|
4029
4113
|
path: '',
|
|
4030
4114
|
items: {}
|
|
@@ -4049,6 +4133,10 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4049
4133
|
history.pushState({
|
|
4050
4134
|
inputPath: inputPath
|
|
4051
4135
|
}, inputPath, "".concat(inputPath, "?").concat(path));
|
|
4136
|
+
|
|
4137
|
+
if (reloadView === true) {
|
|
4138
|
+
this.showView(this.currentView, this.currentParams, 'main');
|
|
4139
|
+
}
|
|
4052
4140
|
}
|
|
4053
4141
|
}, {
|
|
4054
4142
|
key: "buildUrlPath",
|
|
@@ -4090,6 +4178,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4090
4178
|
}, {
|
|
4091
4179
|
key: "formatParams",
|
|
4092
4180
|
value: function formatParams(params) {
|
|
4181
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
4093
4182
|
var output = {
|
|
4094
4183
|
path: params,
|
|
4095
4184
|
items: {}
|
|
@@ -4323,12 +4412,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4323
4412
|
}, {
|
|
4324
4413
|
key: "showComponents",
|
|
4325
4414
|
value: function showComponents(view) {
|
|
4326
|
-
var
|
|
4415
|
+
var _this27 = this;
|
|
4327
4416
|
|
|
4328
4417
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4329
4418
|
this.options.views[view].components.forEach(function (c) {
|
|
4330
4419
|
if (typeof c.instance === 'undefined') {
|
|
4331
|
-
|
|
4420
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
4332
4421
|
|
|
4333
4422
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4334
4423
|
} else if (c.instance.render) {
|
|
@@ -4355,6 +4444,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4355
4444
|
this.showComponents(view);
|
|
4356
4445
|
this.publish('show', [view, params, group]);
|
|
4357
4446
|
}
|
|
4447
|
+
|
|
4448
|
+
if (this.previousView === this.currentView && this.previousParams.path !== this.currentParams.path) {
|
|
4449
|
+
this.showComponents(view);
|
|
4450
|
+
this.publish('show', [view, params, group]);
|
|
4451
|
+
}
|
|
4358
4452
|
}
|
|
4359
4453
|
}, {
|
|
4360
4454
|
key: "reloadCurrentView",
|
|
@@ -4379,7 +4473,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4379
4473
|
var params = {};
|
|
4380
4474
|
var newPath = inputPath;
|
|
4381
4475
|
|
|
4382
|
-
if (inputPath === this.options.defaultView && this.usesHTMLSuffix === false) {
|
|
4476
|
+
if (inputPath.split('?')[0] === this.options.defaultView && this.usesHTMLSuffix === false) {
|
|
4383
4477
|
inputPath = inputPath.replace(this.options.defaultView, '/');
|
|
4384
4478
|
}
|
|
4385
4479
|
|
|
@@ -4387,8 +4481,6 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4387
4481
|
if (inputPath.indexOf('?') === -1 && this.queryParams) {
|
|
4388
4482
|
inputPath += "?".concat(this.queryParams);
|
|
4389
4483
|
}
|
|
4390
|
-
} else {
|
|
4391
|
-
this.currentParams = {};
|
|
4392
4484
|
}
|
|
4393
4485
|
|
|
4394
4486
|
if (this.usesHTMLSuffix === true) {
|
|
@@ -4412,7 +4504,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4412
4504
|
params = this.formatParams(parts[1]);
|
|
4413
4505
|
inputPath = parts[0];
|
|
4414
4506
|
} else if (group === this.options.defaultGroup) {
|
|
4415
|
-
this.
|
|
4507
|
+
this.previousParams = _extends({}, this.currentParams);
|
|
4508
|
+
this.currentParams = {
|
|
4509
|
+
path: '',
|
|
4510
|
+
items: {}
|
|
4511
|
+
};
|
|
4416
4512
|
}
|
|
4417
4513
|
|
|
4418
4514
|
if (event) {
|
|
@@ -4627,7 +4723,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4627
4723
|
this.elementId = elementId;
|
|
4628
4724
|
var DEFAULTS = {
|
|
4629
4725
|
searchIcon: "<svg class='search' width=\"20\" height=\"20\" viewBox=\"0 0 512 512\"><path d=\"M221.09,64A157.09,157.09,0,1,0,378.18,221.09,157.1,157.1,0,0,0,221.09,64Z\" style=\"fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:32px\"/><line x1=\"338.29\" y1=\"338.29\" x2=\"448\" y2=\"448\" style=\"fill:none;stroke:#000;stroke-linecap:round;stroke-miterlimit:10;stroke-width:32px\"/></svg>",
|
|
4630
|
-
clearIcon: "<svg
|
|
4726
|
+
clearIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 512 512\"><title>ionicons-v5-l</title><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
4631
4727
|
placeholder: 'Search',
|
|
4632
4728
|
searchTimeout: 500,
|
|
4633
4729
|
minLength: 2
|
|
@@ -4638,27 +4734,45 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4638
4734
|
|
|
4639
4735
|
if (el) {
|
|
4640
4736
|
// el.addEventListener('click', this.handleClick.bind(this))
|
|
4737
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
4641
4738
|
el.addEventListener('keyup', this.handleKeyUp.bind(this));
|
|
4642
|
-
el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "'>\n ").concat(this.options.clearIcon, "\n </div>\n ");
|
|
4739
|
+
el.innerHTML = "\n <div class='websy-search-input-container'>\n ".concat(this.options.searchIcon, "\n <input id='").concat(this.elementId, "_search' class='websy-search-input' placeholder='").concat(this.options.placeholder || 'Search', "'>\n <div class='clear websy-hidden' id='").concat(this.elementId, "_clear'>\n ").concat(this.options.clearIcon, "\n </div>\n </div>\n ");
|
|
4643
4740
|
} else {
|
|
4644
4741
|
console.log('No element found with Id', elementId);
|
|
4645
4742
|
}
|
|
4646
4743
|
}
|
|
4647
4744
|
|
|
4648
4745
|
_createClass(WebsySearch, [{
|
|
4746
|
+
key: "handleClick",
|
|
4747
|
+
value: function handleClick(event) {
|
|
4748
|
+
if (event.target.classList.contains('clear')) {
|
|
4749
|
+
var inputEl = document.getElementById("".concat(this.elementId, "_search"));
|
|
4750
|
+
inputEl.value = '';
|
|
4751
|
+
this.options.onSearch('');
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
}, {
|
|
4649
4755
|
key: "handleKeyUp",
|
|
4650
4756
|
value: function handleKeyUp(event) {
|
|
4651
|
-
var
|
|
4757
|
+
var _this28 = this;
|
|
4652
4758
|
|
|
4653
4759
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4654
4760
|
if (this.searchTimeoutFn) {
|
|
4655
4761
|
clearTimeout(this.searchTimeoutFn);
|
|
4656
4762
|
}
|
|
4657
4763
|
|
|
4764
|
+
var clearEl = document.getElementById("".concat(this.elementId, "_clear"));
|
|
4765
|
+
|
|
4766
|
+
if (event.target.value.length > 0) {
|
|
4767
|
+
clearEl.classList.remove('websy-hidden');
|
|
4768
|
+
} else {
|
|
4769
|
+
clearEl.classList.add('websy-hidden');
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4658
4772
|
if (event.target.value.length >= this.options.minLength) {
|
|
4659
4773
|
this.searchTimeoutFn = setTimeout(function () {
|
|
4660
|
-
if (
|
|
4661
|
-
|
|
4774
|
+
if (_this28.options.onSearch) {
|
|
4775
|
+
_this28.options.onSearch(event.target.value);
|
|
4662
4776
|
}
|
|
4663
4777
|
}, this.options.searchTimeout);
|
|
4664
4778
|
} else {
|
|
@@ -4809,7 +4923,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4809
4923
|
|
|
4810
4924
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4811
4925
|
function WebsyTemplate(elementId, options) {
|
|
4812
|
-
var
|
|
4926
|
+
var _this29 = this;
|
|
4813
4927
|
|
|
4814
4928
|
_classCallCheck(this, WebsyTemplate);
|
|
4815
4929
|
|
|
@@ -4835,9 +4949,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4835
4949
|
|
|
4836
4950
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4837
4951
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4838
|
-
|
|
4952
|
+
_this29.options.template = templateString;
|
|
4839
4953
|
|
|
4840
|
-
|
|
4954
|
+
_this29.render();
|
|
4841
4955
|
});
|
|
4842
4956
|
} else {
|
|
4843
4957
|
this.render();
|
|
@@ -4847,7 +4961,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4847
4961
|
_createClass(WebsyTemplate, [{
|
|
4848
4962
|
key: "buildHTML",
|
|
4849
4963
|
value: function buildHTML() {
|
|
4850
|
-
var
|
|
4964
|
+
var _this30 = this;
|
|
4851
4965
|
|
|
4852
4966
|
var html = "";
|
|
4853
4967
|
|
|
@@ -4909,14 +5023,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4909
5023
|
}
|
|
4910
5024
|
|
|
4911
5025
|
if (polarity === true) {
|
|
4912
|
-
if (typeof
|
|
5026
|
+
if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] === parts[1]) {
|
|
4913
5027
|
// remove the <if> tags
|
|
4914
5028
|
removeAll = false;
|
|
4915
5029
|
} else if (parts[0] === parts[1]) {
|
|
4916
5030
|
removeAll = false;
|
|
4917
5031
|
}
|
|
4918
5032
|
} else if (polarity === false) {
|
|
4919
|
-
if (typeof
|
|
5033
|
+
if (typeof _this30.options.data[parts[0]] !== 'undefined' && _this30.options.data[parts[0]] !== parts[1]) {
|
|
4920
5034
|
// remove the <if> tags
|
|
4921
5035
|
removeAll = false;
|
|
4922
5036
|
}
|
|
@@ -5206,7 +5320,7 @@ var WebsyUtils = {
|
|
|
5206
5320
|
|
|
5207
5321
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5208
5322
|
function WebsyTable(elementId, options) {
|
|
5209
|
-
var
|
|
5323
|
+
var _this31 = this;
|
|
5210
5324
|
|
|
5211
5325
|
_classCallCheck(this, WebsyTable);
|
|
5212
5326
|
|
|
@@ -5244,8 +5358,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5244
5358
|
allowClear: false,
|
|
5245
5359
|
disableSearch: true,
|
|
5246
5360
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5247
|
-
if (
|
|
5248
|
-
|
|
5361
|
+
if (_this31.options.onChangePageSize) {
|
|
5362
|
+
_this31.options.onChangePageSize(selectedItem.value);
|
|
5249
5363
|
}
|
|
5250
5364
|
}
|
|
5251
5365
|
});
|
|
@@ -5266,7 +5380,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5266
5380
|
_createClass(WebsyTable, [{
|
|
5267
5381
|
key: "appendRows",
|
|
5268
5382
|
value: function appendRows(data) {
|
|
5269
|
-
var
|
|
5383
|
+
var _this32 = this;
|
|
5270
5384
|
|
|
5271
5385
|
this.hideError();
|
|
5272
5386
|
var bodyHTML = '';
|
|
@@ -5274,15 +5388,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5274
5388
|
if (data) {
|
|
5275
5389
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5276
5390
|
return '<tr>' + r.map(function (c, i) {
|
|
5277
|
-
if (
|
|
5391
|
+
if (_this32.options.columns[i].show !== false) {
|
|
5278
5392
|
var style = '';
|
|
5279
5393
|
|
|
5280
5394
|
if (c.style) {
|
|
5281
5395
|
style += c.style;
|
|
5282
5396
|
}
|
|
5283
5397
|
|
|
5284
|
-
if (
|
|
5285
|
-
style += "width: ".concat(
|
|
5398
|
+
if (_this32.options.columns[i].width) {
|
|
5399
|
+
style += "width: ".concat(_this32.options.columns[i].width, "; ");
|
|
5286
5400
|
}
|
|
5287
5401
|
|
|
5288
5402
|
if (c.backgroundColor) {
|
|
@@ -5297,18 +5411,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5297
5411
|
style += "color: ".concat(c.color, "; ");
|
|
5298
5412
|
}
|
|
5299
5413
|
|
|
5300
|
-
if (
|
|
5301
|
-
return "\n <td \n data-row-index='".concat(
|
|
5302
|
-
} else if ((
|
|
5303
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5414
|
+
if (_this32.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5415
|
+
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 ");
|
|
5416
|
+
} else if ((_this32.options.columns[i].showAsNavigatorLink === true || _this32.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5417
|
+
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 ");
|
|
5304
5418
|
} else {
|
|
5305
5419
|
var info = c.value;
|
|
5306
5420
|
|
|
5307
|
-
if (
|
|
5421
|
+
if (_this32.options.columns[i].showAsImage === true) {
|
|
5308
5422
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5309
5423
|
}
|
|
5310
5424
|
|
|
5311
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5425
|
+
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 ");
|
|
5312
5426
|
}
|
|
5313
5427
|
}
|
|
5314
5428
|
}).join('') + '</tr>';
|
|
@@ -5480,7 +5594,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5480
5594
|
}, {
|
|
5481
5595
|
key: "render",
|
|
5482
5596
|
value: function render(data) {
|
|
5483
|
-
var
|
|
5597
|
+
var _this33 = this;
|
|
5484
5598
|
|
|
5485
5599
|
if (!this.options.columns) {
|
|
5486
5600
|
return;
|
|
@@ -5515,7 +5629,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5515
5629
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5516
5630
|
}
|
|
5517
5631
|
|
|
5518
|
-
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 ?
|
|
5632
|
+
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 ? _this33.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5519
5633
|
}
|
|
5520
5634
|
}).join('') + '</tr>';
|
|
5521
5635
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5534,7 +5648,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5534
5648
|
|
|
5535
5649
|
if (pagingEl) {
|
|
5536
5650
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5537
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5651
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this33.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5538
5652
|
});
|
|
5539
5653
|
var startIndex = 0;
|
|
5540
5654
|
|
|
@@ -5602,7 +5716,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5602
5716
|
|
|
5603
5717
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5604
5718
|
function WebsyTable2(elementId, options) {
|
|
5605
|
-
var
|
|
5719
|
+
var _this34 = this;
|
|
5606
5720
|
|
|
5607
5721
|
_classCallCheck(this, WebsyTable2);
|
|
5608
5722
|
|
|
@@ -5643,8 +5757,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5643
5757
|
allowClear: false,
|
|
5644
5758
|
disableSearch: true,
|
|
5645
5759
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5646
|
-
if (
|
|
5647
|
-
|
|
5760
|
+
if (_this34.options.onChangePageSize) {
|
|
5761
|
+
_this34.options.onChangePageSize(selectedItem.value);
|
|
5648
5762
|
}
|
|
5649
5763
|
}
|
|
5650
5764
|
});
|
|
@@ -5668,7 +5782,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5668
5782
|
_createClass(WebsyTable2, [{
|
|
5669
5783
|
key: "appendRows",
|
|
5670
5784
|
value: function appendRows(data) {
|
|
5671
|
-
var
|
|
5785
|
+
var _this35 = this;
|
|
5672
5786
|
|
|
5673
5787
|
this.hideError();
|
|
5674
5788
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5677,15 +5791,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5677
5791
|
if (data) {
|
|
5678
5792
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5679
5793
|
return '<tr>' + r.map(function (c, i) {
|
|
5680
|
-
if (
|
|
5681
|
-
var style = "height: ".concat(
|
|
5794
|
+
if (_this35.options.columns[i].show !== false) {
|
|
5795
|
+
var style = "height: ".concat(_this35.options.cellSize, "px; line-height: ").concat(_this35.options.cellSize, "px;");
|
|
5682
5796
|
|
|
5683
5797
|
if (c.style) {
|
|
5684
5798
|
style += c.style;
|
|
5685
5799
|
}
|
|
5686
5800
|
|
|
5687
|
-
if (
|
|
5688
|
-
style += "width: ".concat(
|
|
5801
|
+
if (_this35.options.columns[i].width) {
|
|
5802
|
+
style += "width: ".concat(_this35.options.columns[i].width, "; ");
|
|
5689
5803
|
}
|
|
5690
5804
|
|
|
5691
5805
|
if (c.backgroundColor) {
|
|
@@ -5700,18 +5814,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5700
5814
|
style += "color: ".concat(c.color, "; ");
|
|
5701
5815
|
}
|
|
5702
5816
|
|
|
5703
|
-
if (
|
|
5704
|
-
return "\n <td \n data-row-index='".concat(
|
|
5705
|
-
} else if ((
|
|
5706
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5817
|
+
if (_this35.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5818
|
+
return "\n <td \n data-row-index='".concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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(_this35.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5819
|
+
} else if ((_this35.options.columns[i].showAsNavigatorLink === true || _this35.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5820
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this35.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this35.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this35.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5707
5821
|
} else {
|
|
5708
5822
|
var info = c.value;
|
|
5709
5823
|
|
|
5710
|
-
if (
|
|
5824
|
+
if (_this35.options.columns[i].showAsImage === true) {
|
|
5711
5825
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5712
5826
|
}
|
|
5713
5827
|
|
|
5714
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5828
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this35.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this35.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 ");
|
|
5715
5829
|
}
|
|
5716
5830
|
}
|
|
5717
5831
|
}).join('') + '</tr>';
|
|
@@ -5974,7 +6088,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5974
6088
|
}, {
|
|
5975
6089
|
key: "render",
|
|
5976
6090
|
value: function render(data) {
|
|
5977
|
-
var
|
|
6091
|
+
var _this36 = this;
|
|
5978
6092
|
|
|
5979
6093
|
if (!this.options.columns) {
|
|
5980
6094
|
return;
|
|
@@ -6010,7 +6124,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6010
6124
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6011
6125
|
}
|
|
6012
6126
|
|
|
6013
|
-
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 ?
|
|
6127
|
+
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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6014
6128
|
}
|
|
6015
6129
|
}).join('') + '</tr>';
|
|
6016
6130
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6021,7 +6135,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6021
6135
|
var dropdownHTML = "";
|
|
6022
6136
|
this.options.columns.forEach(function (c, i) {
|
|
6023
6137
|
if (c.searchable && c.searchField) {
|
|
6024
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6138
|
+
dropdownHTML += "\n <div id=\"".concat(_this36.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6025
6139
|
}
|
|
6026
6140
|
});
|
|
6027
6141
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6043,7 +6157,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6043
6157
|
|
|
6044
6158
|
if (pagingEl) {
|
|
6045
6159
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6046
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6160
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this36.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6047
6161
|
});
|
|
6048
6162
|
var startIndex = 0;
|
|
6049
6163
|
|
|
@@ -6134,7 +6248,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6134
6248
|
}, {
|
|
6135
6249
|
key: "getColumnParameters",
|
|
6136
6250
|
value: function getColumnParameters(values) {
|
|
6137
|
-
var
|
|
6251
|
+
var _this37 = this;
|
|
6138
6252
|
|
|
6139
6253
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6140
6254
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6142,10 +6256,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6142
6256
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6143
6257
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6144
6258
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6145
|
-
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 ?
|
|
6259
|
+
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 ? _this37.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6146
6260
|
}).join('') + '</tr>';
|
|
6147
6261
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6148
|
-
return "\n <td \n style='height: ".concat(
|
|
6262
|
+
return "\n <td \n style='height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6149
6263
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6150
6264
|
|
|
6151
6265
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6336,7 +6450,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6336
6450
|
}, {
|
|
6337
6451
|
key: "buildHeaderHtml",
|
|
6338
6452
|
value: function buildHeaderHtml() {
|
|
6339
|
-
var
|
|
6453
|
+
var _this38 = this;
|
|
6340
6454
|
|
|
6341
6455
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6342
6456
|
var headerHtml = '';
|
|
@@ -6351,7 +6465,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6351
6465
|
}
|
|
6352
6466
|
|
|
6353
6467
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6354
|
-
if (useWidths === false && rowIndex !==
|
|
6468
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6355
6469
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6356
6470
|
return;
|
|
6357
6471
|
}
|
|
@@ -6365,18 +6479,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6365
6479
|
// `
|
|
6366
6480
|
// }
|
|
6367
6481
|
|
|
6368
|
-
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ?
|
|
6482
|
+
headerHtml += " \n >\n <div>\n ".concat(col.name, "\n ").concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6369
6483
|
});
|
|
6370
6484
|
headerHtml += "</tr>";
|
|
6371
6485
|
});
|
|
6372
6486
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6373
6487
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6374
6488
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6375
|
-
var testEl = document.getElementById("".concat(
|
|
6489
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6376
6490
|
|
|
6377
6491
|
if (!testEl) {
|
|
6378
6492
|
var newE = document.createElement('div');
|
|
6379
|
-
newE.id = "".concat(
|
|
6493
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6380
6494
|
newE.className = 'websy-modal-dropdown';
|
|
6381
6495
|
dropdownEl.appendChild(newE);
|
|
6382
6496
|
}
|
|
@@ -6392,7 +6506,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6392
6506
|
}, {
|
|
6393
6507
|
key: "buildTotalHtml",
|
|
6394
6508
|
value: function buildTotalHtml() {
|
|
6395
|
-
var
|
|
6509
|
+
var _this39 = this;
|
|
6396
6510
|
|
|
6397
6511
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6398
6512
|
|
|
@@ -6405,7 +6519,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6405
6519
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6406
6520
|
|
|
6407
6521
|
if (useWidths === true) {
|
|
6408
|
-
totalHtml += "\n style='width: ".concat(
|
|
6522
|
+
totalHtml += "\n style='width: ".concat(_this39.options.columns[_this39.options.columns.length - 1][colIndex].width || _this39.options.columns[_this39.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6409
6523
|
}
|
|
6410
6524
|
|
|
6411
6525
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6416,7 +6530,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6416
6530
|
}, {
|
|
6417
6531
|
key: "calculateSizes",
|
|
6418
6532
|
value: function calculateSizes() {
|
|
6419
|
-
var
|
|
6533
|
+
var _this40 = this;
|
|
6420
6534
|
|
|
6421
6535
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6422
6536
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6458,28 +6572,28 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6458
6572
|
rows.forEach(function (row, rowIndex) {
|
|
6459
6573
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6460
6574
|
var colSize = col.getBoundingClientRect();
|
|
6461
|
-
|
|
6575
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6462
6576
|
|
|
6463
|
-
if (
|
|
6464
|
-
if (!
|
|
6465
|
-
|
|
6577
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6578
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6579
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6466
6580
|
}
|
|
6467
6581
|
|
|
6468
|
-
|
|
6469
|
-
|
|
6582
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6583
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6470
6584
|
}
|
|
6471
6585
|
});
|
|
6472
6586
|
});
|
|
6473
6587
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6474
|
-
if (colIndex <
|
|
6475
|
-
|
|
6588
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6589
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6476
6590
|
}
|
|
6477
6591
|
});
|
|
6478
6592
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6479
6593
|
return a + (b.width || b.actualWidth);
|
|
6480
6594
|
}, 0);
|
|
6481
6595
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6482
|
-
return i >=
|
|
6596
|
+
return i >= _this40.pinnedColumns;
|
|
6483
6597
|
}).reduce(function (a, b) {
|
|
6484
6598
|
return a + (b.width || b.actualWidth);
|
|
6485
6599
|
}, 0);
|
|
@@ -6497,13 +6611,13 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6497
6611
|
}
|
|
6498
6612
|
}
|
|
6499
6613
|
|
|
6500
|
-
|
|
6614
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6501
6615
|
|
|
6502
|
-
if (i <
|
|
6503
|
-
|
|
6616
|
+
if (i < _this40.pinnedColumns) {
|
|
6617
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6504
6618
|
}
|
|
6505
6619
|
|
|
6506
|
-
equalWidth = (outerSize.width -
|
|
6620
|
+
equalWidth = (outerSize.width - _this40.sizes.totalWidth) / (_this40.options.columns[_this40.options.columns.length - 1].length - (i + 1));
|
|
6507
6621
|
});
|
|
6508
6622
|
} // take the height of the last cell as the official height for data cells
|
|
6509
6623
|
// this.sizes.dataCellHeight = this.options.columns[this.options.columns.length - 1].cellHeight
|
|
@@ -6932,7 +7046,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6932
7046
|
|
|
6933
7047
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6934
7048
|
function WebsyChart(elementId, options) {
|
|
6935
|
-
var
|
|
7049
|
+
var _this41 = this;
|
|
6936
7050
|
|
|
6937
7051
|
_classCallCheck(this, WebsyChart);
|
|
6938
7052
|
|
|
@@ -6981,22 +7095,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6981
7095
|
this.invertOverride = function (input, input2) {
|
|
6982
7096
|
var xAxis = 'bottomAxis';
|
|
6983
7097
|
|
|
6984
|
-
if (
|
|
7098
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
6985
7099
|
xAxis = 'leftAxis';
|
|
6986
7100
|
}
|
|
6987
7101
|
|
|
6988
|
-
var width =
|
|
7102
|
+
var width = _this41[xAxis].step();
|
|
6989
7103
|
|
|
6990
7104
|
var output;
|
|
6991
7105
|
|
|
6992
|
-
var domain = _toConsumableArray(
|
|
7106
|
+
var domain = _toConsumableArray(_this41[xAxis].domain());
|
|
6993
7107
|
|
|
6994
|
-
if (
|
|
7108
|
+
if (_this41.options.orientation === 'horizontal') {
|
|
6995
7109
|
domain = domain.reverse();
|
|
6996
7110
|
}
|
|
6997
7111
|
|
|
6998
7112
|
for (var j = 0; j < domain.length; j++) {
|
|
6999
|
-
var breakA =
|
|
7113
|
+
var breakA = _this41[xAxis](domain[j]) - width / 2;
|
|
7000
7114
|
var breakB = breakA + width;
|
|
7001
7115
|
|
|
7002
7116
|
if (input > breakA && input <= breakB) {
|
|
@@ -7096,10 +7210,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7096
7210
|
}, {
|
|
7097
7211
|
key: "handleEventMouseMove",
|
|
7098
7212
|
value: function handleEventMouseMove(event, d) {
|
|
7099
|
-
var
|
|
7213
|
+
var _this42 = this;
|
|
7100
7214
|
|
|
7101
7215
|
var bisectDate = d3.bisector(function (d) {
|
|
7102
|
-
return
|
|
7216
|
+
return _this42.parseX(d.x.value);
|
|
7103
7217
|
}).left;
|
|
7104
7218
|
|
|
7105
7219
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7138,8 +7252,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7138
7252
|
}
|
|
7139
7253
|
|
|
7140
7254
|
this.options.data.series.forEach(function (s) {
|
|
7141
|
-
if (
|
|
7142
|
-
xPoint =
|
|
7255
|
+
if (_this42.options.data[xData].scale !== 'Time') {
|
|
7256
|
+
xPoint = _this42[xAxis](_this42.parseX(xLabel));
|
|
7143
7257
|
s.data.forEach(function (d) {
|
|
7144
7258
|
if (d.x.value === xLabel) {
|
|
7145
7259
|
if (!tooltipTitle) {
|
|
@@ -7158,13 +7272,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7158
7272
|
var pointA = s.data[index - 1];
|
|
7159
7273
|
var pointB = s.data[index];
|
|
7160
7274
|
|
|
7161
|
-
if (
|
|
7275
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7162
7276
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7163
7277
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7164
7278
|
}
|
|
7165
7279
|
|
|
7166
7280
|
if (pointA && !pointB) {
|
|
7167
|
-
xPoint =
|
|
7281
|
+
xPoint = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
7168
7282
|
tooltipTitle = pointA.x.value;
|
|
7169
7283
|
|
|
7170
7284
|
if (!pointA.y.color) {
|
|
@@ -7174,12 +7288,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7174
7288
|
tooltipData.push(pointA.y);
|
|
7175
7289
|
|
|
7176
7290
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7177
|
-
tooltipTitle = d3.timeFormat(
|
|
7291
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7178
7292
|
}
|
|
7179
7293
|
}
|
|
7180
7294
|
|
|
7181
7295
|
if (pointB && !pointA) {
|
|
7182
|
-
xPoint =
|
|
7296
|
+
xPoint = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
7183
7297
|
tooltipTitle = pointB.x.value;
|
|
7184
7298
|
|
|
7185
7299
|
if (!pointB.y.color) {
|
|
@@ -7189,14 +7303,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7189
7303
|
tooltipData.push(pointB.y);
|
|
7190
7304
|
|
|
7191
7305
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7192
|
-
tooltipTitle = d3.timeFormat(
|
|
7306
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7193
7307
|
}
|
|
7194
7308
|
}
|
|
7195
7309
|
|
|
7196
7310
|
if (pointA && pointB) {
|
|
7197
|
-
var d0 =
|
|
7311
|
+
var d0 = _this42[xAxis](_this42.parseX(pointA.x.value));
|
|
7198
7312
|
|
|
7199
|
-
var d1 =
|
|
7313
|
+
var d1 = _this42[xAxis](_this42.parseX(pointB.x.value));
|
|
7200
7314
|
|
|
7201
7315
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7202
7316
|
|
|
@@ -7205,7 +7319,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7205
7319
|
tooltipTitle = pointB.x.value;
|
|
7206
7320
|
|
|
7207
7321
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7208
|
-
tooltipTitle = d3.timeFormat(
|
|
7322
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7209
7323
|
}
|
|
7210
7324
|
|
|
7211
7325
|
if (!pointB.y.color) {
|
|
@@ -7218,7 +7332,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7218
7332
|
tooltipTitle = pointA.x.value;
|
|
7219
7333
|
|
|
7220
7334
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7221
|
-
tooltipTitle = d3.timeFormat(
|
|
7335
|
+
tooltipTitle = d3.timeFormat(_this42.options.dateFormat || _this42.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7222
7336
|
}
|
|
7223
7337
|
|
|
7224
7338
|
if (!pointA.y.color) {
|
|
@@ -7323,7 +7437,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7323
7437
|
}, {
|
|
7324
7438
|
key: "render",
|
|
7325
7439
|
value: function render(options) {
|
|
7326
|
-
var
|
|
7440
|
+
var _this43 = this;
|
|
7327
7441
|
|
|
7328
7442
|
/* global d3 options WebsyUtils */
|
|
7329
7443
|
if (typeof options !== 'undefined') {
|
|
@@ -7392,7 +7506,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7392
7506
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7393
7507
|
return {
|
|
7394
7508
|
value: s.label || s.key,
|
|
7395
|
-
color: s.color ||
|
|
7509
|
+
color: s.color || _this43.options.colors[i % _this43.options.colors.length]
|
|
7396
7510
|
};
|
|
7397
7511
|
});
|
|
7398
7512
|
|
|
@@ -7644,7 +7758,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7644
7758
|
|
|
7645
7759
|
if (this.options.data.bottom.formatter) {
|
|
7646
7760
|
bAxisFunc.tickFormat(function (d) {
|
|
7647
|
-
return
|
|
7761
|
+
return _this43.options.data.bottom.formatter(d);
|
|
7648
7762
|
});
|
|
7649
7763
|
}
|
|
7650
7764
|
|
|
@@ -7670,8 +7784,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7670
7784
|
|
|
7671
7785
|
if (this.options.margin.axisLeft > 0) {
|
|
7672
7786
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7673
|
-
if (
|
|
7674
|
-
d =
|
|
7787
|
+
if (_this43.options.data.left.formatter) {
|
|
7788
|
+
d = _this43.options.data.left.formatter(d);
|
|
7675
7789
|
}
|
|
7676
7790
|
|
|
7677
7791
|
return d;
|
|
@@ -7708,8 +7822,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7708
7822
|
|
|
7709
7823
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7710
7824
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7711
|
-
if (
|
|
7712
|
-
d =
|
|
7825
|
+
if (_this43.options.data.right.formatter) {
|
|
7826
|
+
d = _this43.options.data.right.formatter(d);
|
|
7713
7827
|
}
|
|
7714
7828
|
|
|
7715
7829
|
return d;
|
|
@@ -7735,16 +7849,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7735
7849
|
|
|
7736
7850
|
this.options.data.series.forEach(function (series, index) {
|
|
7737
7851
|
if (!series.key) {
|
|
7738
|
-
series.key =
|
|
7852
|
+
series.key = _this43.createIdentity();
|
|
7739
7853
|
}
|
|
7740
7854
|
|
|
7741
7855
|
if (!series.color) {
|
|
7742
|
-
series.color =
|
|
7856
|
+
series.color = _this43.options.colors[index % _this43.options.colors.length];
|
|
7743
7857
|
}
|
|
7744
7858
|
|
|
7745
|
-
|
|
7859
|
+
_this43["render".concat(series.type || 'bar')](series, index);
|
|
7746
7860
|
|
|
7747
|
-
|
|
7861
|
+
_this43.renderLabels(series, index);
|
|
7748
7862
|
});
|
|
7749
7863
|
}
|
|
7750
7864
|
}
|
|
@@ -7752,17 +7866,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7752
7866
|
}, {
|
|
7753
7867
|
key: "renderarea",
|
|
7754
7868
|
value: function renderarea(series, index) {
|
|
7755
|
-
var
|
|
7869
|
+
var _this44 = this;
|
|
7756
7870
|
|
|
7757
7871
|
/* global d3 series index */
|
|
7758
7872
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7759
7873
|
return d3.area().x(function (d) {
|
|
7760
|
-
return
|
|
7874
|
+
return _this44[xAxis](_this44.parseX(d.x.value));
|
|
7761
7875
|
}).y0(function (d) {
|
|
7762
|
-
return
|
|
7876
|
+
return _this44[yAxis](0);
|
|
7763
7877
|
}).y1(function (d) {
|
|
7764
|
-
return
|
|
7765
|
-
}).curve(d3[curveStyle ||
|
|
7878
|
+
return _this44[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7879
|
+
}).curve(d3[curveStyle || _this44.options.curveStyle]);
|
|
7766
7880
|
};
|
|
7767
7881
|
|
|
7768
7882
|
var xAxis = 'bottomAxis';
|
|
@@ -7878,7 +7992,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7878
7992
|
}, {
|
|
7879
7993
|
key: "renderLabels",
|
|
7880
7994
|
value: function renderLabels(series, index) {
|
|
7881
|
-
var
|
|
7995
|
+
var _this45 = this;
|
|
7882
7996
|
|
|
7883
7997
|
/* global series index d3 WebsyDesigns */
|
|
7884
7998
|
var xAxis = 'bottomAxis';
|
|
@@ -7897,7 +8011,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7897
8011
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
7898
8012
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
7899
8013
|
labels.attr('x', getLabelX.bind(this)).attr('y', getLabelY.bind(this)).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
7900
|
-
return
|
|
8014
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7901
8015
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
7902
8016
|
return d.y.label || d.y.value;
|
|
7903
8017
|
}).each(function (d, i) {
|
|
@@ -7922,7 +8036,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7922
8036
|
}
|
|
7923
8037
|
});
|
|
7924
8038
|
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) {
|
|
7925
|
-
return
|
|
8039
|
+
return _this45.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
7926
8040
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
7927
8041
|
return d.y.label || d.y.value;
|
|
7928
8042
|
}).each(function (d, i) {
|
|
@@ -7979,15 +8093,15 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7979
8093
|
}, {
|
|
7980
8094
|
key: "renderline",
|
|
7981
8095
|
value: function renderline(series, index) {
|
|
7982
|
-
var
|
|
8096
|
+
var _this46 = this;
|
|
7983
8097
|
|
|
7984
8098
|
/* global series index d3 */
|
|
7985
8099
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
7986
8100
|
return d3.line().x(function (d) {
|
|
7987
|
-
return
|
|
8101
|
+
return _this46[xAxis](_this46.parseX(d.x.value));
|
|
7988
8102
|
}).y(function (d) {
|
|
7989
|
-
return
|
|
7990
|
-
}).curve(d3[curveStyle ||
|
|
8103
|
+
return _this46[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8104
|
+
}).curve(d3[curveStyle || _this46.options.curveStyle]);
|
|
7991
8105
|
};
|
|
7992
8106
|
|
|
7993
8107
|
var xAxis = 'bottomAxis';
|
|
@@ -8025,14 +8139,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8025
8139
|
}, {
|
|
8026
8140
|
key: "rendersymbol",
|
|
8027
8141
|
value: function rendersymbol(series, index) {
|
|
8028
|
-
var
|
|
8142
|
+
var _this47 = this;
|
|
8029
8143
|
|
|
8030
8144
|
/* global d3 series index series.key */
|
|
8031
8145
|
var drawSymbol = function drawSymbol(size) {
|
|
8032
8146
|
return d3.symbol() // .type(d => {
|
|
8033
8147
|
// return d3.symbols[0]
|
|
8034
8148
|
// })
|
|
8035
|
-
.size(size ||
|
|
8149
|
+
.size(size || _this47.options.symbolSize);
|
|
8036
8150
|
};
|
|
8037
8151
|
|
|
8038
8152
|
var xAxis = 'bottomAxis';
|
|
@@ -8050,7 +8164,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8050
8164
|
symbols.attr('d', function (d) {
|
|
8051
8165
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8052
8166
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8053
|
-
return "translate(".concat(
|
|
8167
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8054
8168
|
}); // Enter
|
|
8055
8169
|
|
|
8056
8170
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8059,7 +8173,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8059
8173
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8060
8174
|
return "symbol symbol_".concat(series.key);
|
|
8061
8175
|
}).attr('transform', function (d) {
|
|
8062
|
-
return "translate(".concat(
|
|
8176
|
+
return "translate(".concat(_this47[xAxis](_this47.parseX(d.x.value)), ", ").concat(_this47[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8063
8177
|
});
|
|
8064
8178
|
}
|
|
8065
8179
|
}, {
|
|
@@ -8214,7 +8328,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8214
8328
|
}, {
|
|
8215
8329
|
key: "resize",
|
|
8216
8330
|
value: function resize() {
|
|
8217
|
-
var
|
|
8331
|
+
var _this48 = this;
|
|
8218
8332
|
|
|
8219
8333
|
var el = document.getElementById(this.elementId);
|
|
8220
8334
|
|
|
@@ -8227,7 +8341,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8227
8341
|
// }
|
|
8228
8342
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8229
8343
|
html += this._data.map(function (d, i) {
|
|
8230
|
-
return
|
|
8344
|
+
return _this48.getLegendItemHTML(d);
|
|
8231
8345
|
}).join('');
|
|
8232
8346
|
html += "\n <div>\n ";
|
|
8233
8347
|
el.innerHTML = html;
|
|
@@ -8399,7 +8513,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8399
8513
|
}, {
|
|
8400
8514
|
key: "render",
|
|
8401
8515
|
value: function render() {
|
|
8402
|
-
var
|
|
8516
|
+
var _this49 = this;
|
|
8403
8517
|
|
|
8404
8518
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8405
8519
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8408,7 +8522,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8408
8522
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8409
8523
|
return {
|
|
8410
8524
|
value: s.label || s.key,
|
|
8411
|
-
color: s.color ||
|
|
8525
|
+
color: s.color || _this49.options.colors[i % _this49.options.colors.length]
|
|
8412
8526
|
};
|
|
8413
8527
|
});
|
|
8414
8528
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8472,7 +8586,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8472
8586
|
|
|
8473
8587
|
if (this.polygons) {
|
|
8474
8588
|
this.polygons.forEach(function (p) {
|
|
8475
|
-
return
|
|
8589
|
+
return _this49.map.removeLayer(p);
|
|
8476
8590
|
});
|
|
8477
8591
|
}
|
|
8478
8592
|
|
|
@@ -8530,18 +8644,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8530
8644
|
}
|
|
8531
8645
|
|
|
8532
8646
|
if (!p.options.color) {
|
|
8533
|
-
p.options.color =
|
|
8647
|
+
p.options.color = _this49.options.colors[i % _this49.options.colors.length];
|
|
8534
8648
|
}
|
|
8535
8649
|
|
|
8536
8650
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8537
8651
|
return c.map(function (d) {
|
|
8538
8652
|
return [d.Latitude, d.Longitude];
|
|
8539
8653
|
});
|
|
8540
|
-
}), p.options).addTo(
|
|
8654
|
+
}), p.options).addTo(_this49.map);
|
|
8541
8655
|
|
|
8542
|
-
|
|
8656
|
+
_this49.polygons.push(pol);
|
|
8543
8657
|
|
|
8544
|
-
|
|
8658
|
+
_this49.map.fitBounds(pol.getBounds());
|
|
8545
8659
|
});
|
|
8546
8660
|
} // if (this.data.markers.length > 0) {
|
|
8547
8661
|
// el.classList.remove('hidden')
|