@websy/websy-designs 1.4.14 → 1.4.16
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 +1 -0
- package/dist/server/routes/v1/recaptcha.js +2 -1
- package/dist/websy-designs-es6.debug.js +82 -44
- package/dist/websy-designs-es6.js +296 -248
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +83 -45
- package/dist/websy-designs.js +300 -252
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -2254,27 +2254,28 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2254
2254
|
|
|
2255
2255
|
return new Promise(function (resolve, reject) {
|
|
2256
2256
|
if (_this11.options.useRecaptcha === true) {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
grecaptcha.execute(
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
}
|
|
2271
|
-
},
|
|
2272
|
-
|
|
2273
|
-
})
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2257
|
+
if (_this11.recaptchaValue) {
|
|
2258
|
+
// grecaptcha.ready(() => {
|
|
2259
|
+
// grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
|
|
2260
|
+
_this11.apiService.add('google/checkrecaptcha', {
|
|
2261
|
+
grecaptcharesponse: _this11.recaptchaValue
|
|
2262
|
+
}).then(function (response) {
|
|
2263
|
+
if (response.success && response.success === true) {
|
|
2264
|
+
resolve(true);
|
|
2265
|
+
grecaptcha.reset("".concat(_this11.elementId, "_recaptcha"), {
|
|
2266
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2267
|
+
});
|
|
2268
|
+
} else {
|
|
2269
|
+
resolve(false);
|
|
2270
|
+
}
|
|
2271
|
+
}); // }, err => {
|
|
2272
|
+
// reject(err)
|
|
2273
|
+
// })
|
|
2274
|
+
// })
|
|
2275
|
+
|
|
2276
|
+
} else {
|
|
2277
|
+
resolve(false);
|
|
2278
|
+
}
|
|
2278
2279
|
} else {
|
|
2279
2280
|
resolve(true);
|
|
2280
2281
|
}
|
|
@@ -2338,19 +2339,23 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2338
2339
|
}, {
|
|
2339
2340
|
key: "recaptchaReady",
|
|
2340
2341
|
value: function recaptchaReady() {
|
|
2342
|
+
var _this13 = this;
|
|
2343
|
+
|
|
2341
2344
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2342
2345
|
|
|
2343
2346
|
if (el) {
|
|
2344
|
-
grecaptcha.
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
+
grecaptcha.ready(function () {
|
|
2348
|
+
grecaptcha.render("".concat(_this13.elementId, "_recaptcha"), {
|
|
2349
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2350
|
+
callback: _this13.validateRecaptcha.bind(_this13)
|
|
2351
|
+
});
|
|
2347
2352
|
});
|
|
2348
2353
|
}
|
|
2349
2354
|
}
|
|
2350
2355
|
}, {
|
|
2351
2356
|
key: "render",
|
|
2352
2357
|
value: function render(update, data) {
|
|
2353
|
-
var
|
|
2358
|
+
var _this14 = this;
|
|
2354
2359
|
|
|
2355
2360
|
var el = document.getElementById(this.elementId);
|
|
2356
2361
|
var componentsToProcess = [];
|
|
@@ -2360,13 +2365,18 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2360
2365
|
this.options.fields.forEach(function (f, i) {
|
|
2361
2366
|
if (f.component) {
|
|
2362
2367
|
componentsToProcess.push(f);
|
|
2363
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(
|
|
2368
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <div id='").concat(_this14.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2364
2369
|
} else if (f.type === 'longtext') {
|
|
2365
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(
|
|
2370
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <textarea\n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n ></textarea>\n </div><!--\n ");
|
|
2366
2371
|
} else {
|
|
2367
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(
|
|
2372
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div class='").concat(f.classes || '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '', "\n <input \n id=\"").concat(_this14.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat(f.type || 'text', "\" \n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n </div><!--\n ");
|
|
2368
2373
|
}
|
|
2369
2374
|
});
|
|
2375
|
+
|
|
2376
|
+
if (this.options.useRecaptcha === true) {
|
|
2377
|
+
html += "\n --><div id='".concat(this.elementId, "_recaptcha' data-sitekey='").concat(ENVIRONMENT.RECAPTCHA_KEY, "' class='websy-form-recaptcha'></div>\n <div id='").concat(this.elementId, "_recaptchaError' class='websy-alert websy-alert-error websy-hidden'>Invalid recaptcha response</div><!--\n ");
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2370
2380
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
2371
2381
|
|
|
2372
2382
|
if (this.options.cancel) {
|
|
@@ -2374,14 +2384,10 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2374
2384
|
}
|
|
2375
2385
|
|
|
2376
2386
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2377
|
-
|
|
2378
|
-
if (this.options.useRecaptcha === true) {
|
|
2379
|
-
html += "\n <div id='".concat(this.elementId, "_recaptcha'></div>\n ");
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
2387
|
el.innerHTML = html;
|
|
2383
2388
|
this.processComponents(componentsToProcess, function () {
|
|
2384
|
-
if (
|
|
2389
|
+
if (_this14.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2390
|
+
_this14.recaptchaReady();
|
|
2385
2391
|
}
|
|
2386
2392
|
});
|
|
2387
2393
|
}
|
|
@@ -2389,13 +2395,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2389
2395
|
}, {
|
|
2390
2396
|
key: "submitForm",
|
|
2391
2397
|
value: function submitForm() {
|
|
2392
|
-
var
|
|
2398
|
+
var _this15 = this;
|
|
2393
2399
|
|
|
2394
2400
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2401
|
+
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2402
|
+
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
2395
2403
|
|
|
2396
2404
|
if (formEl.reportValidity() === true) {
|
|
2405
|
+
if (buttonEl) {
|
|
2406
|
+
buttonEl.setAttribute('disabled', true);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2397
2409
|
this.checkRecaptcha().then(function (result) {
|
|
2410
|
+
if (buttonEl) {
|
|
2411
|
+
buttonEl.removeAttribute('disabled');
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2398
2414
|
if (result === true) {
|
|
2415
|
+
if (recaptchErrEl) {
|
|
2416
|
+
recaptchErrEl.classList.add('websy-hidden');
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2399
2419
|
var formData = new FormData(formEl);
|
|
2400
2420
|
var data = {};
|
|
2401
2421
|
var temp = new FormData(formEl);
|
|
@@ -2403,39 +2423,47 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2403
2423
|
data[key] = value;
|
|
2404
2424
|
});
|
|
2405
2425
|
|
|
2406
|
-
if (
|
|
2407
|
-
var
|
|
2426
|
+
if (_this15.options.url) {
|
|
2427
|
+
var _this15$apiService;
|
|
2408
2428
|
|
|
2409
|
-
var params = [
|
|
2429
|
+
var params = [_this15.options.url];
|
|
2410
2430
|
|
|
2411
|
-
if (
|
|
2412
|
-
params.push(
|
|
2431
|
+
if (_this15.options.mode === 'update') {
|
|
2432
|
+
params.push(_this15.options.id);
|
|
2413
2433
|
}
|
|
2414
2434
|
|
|
2415
2435
|
params.push(data);
|
|
2416
2436
|
|
|
2417
|
-
(
|
|
2418
|
-
if (
|
|
2437
|
+
(_this15$apiService = _this15.apiService)[_this15.options.mode].apply(_this15$apiService, params).then(function (result) {
|
|
2438
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2419
2439
|
// this.render()
|
|
2420
2440
|
formEl.reset();
|
|
2421
2441
|
}
|
|
2422
2442
|
|
|
2423
|
-
|
|
2443
|
+
buttonEl.removeAttribute('disabled');
|
|
2444
|
+
|
|
2445
|
+
_this15.options.onSuccess.call(_this15, result);
|
|
2424
2446
|
}, function (err) {
|
|
2425
2447
|
console.log('Error submitting form data:', err);
|
|
2426
2448
|
|
|
2427
|
-
|
|
2449
|
+
_this15.options.onError.call(_this15, err);
|
|
2428
2450
|
});
|
|
2429
|
-
} else if (
|
|
2430
|
-
|
|
2431
|
-
if (
|
|
2451
|
+
} else if (_this15.options.submitFn) {
|
|
2452
|
+
_this15.options.submitFn(data, function () {
|
|
2453
|
+
if (_this15.options.clearAfterSave === true) {
|
|
2432
2454
|
// this.render()
|
|
2433
2455
|
formEl.reset();
|
|
2434
2456
|
}
|
|
2435
2457
|
});
|
|
2436
2458
|
}
|
|
2437
2459
|
} else {
|
|
2438
|
-
|
|
2460
|
+
if (buttonEl) {
|
|
2461
|
+
buttonEl.removeAttribute('disabled');
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
if (recaptchErrEl) {
|
|
2465
|
+
recaptchErrEl.classList.remove('websy-hidden');
|
|
2466
|
+
}
|
|
2439
2467
|
}
|
|
2440
2468
|
});
|
|
2441
2469
|
}
|
|
@@ -2448,17 +2476,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2448
2476
|
}, {
|
|
2449
2477
|
key: "data",
|
|
2450
2478
|
set: function set(d) {
|
|
2451
|
-
var
|
|
2479
|
+
var _this16 = this;
|
|
2452
2480
|
|
|
2453
2481
|
if (!this.options.fields) {
|
|
2454
2482
|
this.options.fields = [];
|
|
2455
2483
|
}
|
|
2456
2484
|
|
|
2457
2485
|
var _loop = function _loop(key) {
|
|
2458
|
-
|
|
2486
|
+
_this16.options.fields.forEach(function (f) {
|
|
2459
2487
|
if (f.field === key) {
|
|
2460
2488
|
f.value = d[key];
|
|
2461
|
-
var el = document.getElementById("".concat(
|
|
2489
|
+
var el = document.getElementById("".concat(_this16.elementId, "_input_").concat(f.field));
|
|
2462
2490
|
el.value = f.value;
|
|
2463
2491
|
}
|
|
2464
2492
|
});
|
|
@@ -2662,19 +2690,19 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2662
2690
|
}, {
|
|
2663
2691
|
key: "handleSearch",
|
|
2664
2692
|
value: function handleSearch(searchText) {
|
|
2665
|
-
var
|
|
2693
|
+
var _this17 = this;
|
|
2666
2694
|
|
|
2667
2695
|
var el = document.getElementById(this.elementId);
|
|
2668
2696
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
2669
|
-
return d.level ===
|
|
2697
|
+
return d.level === _this17.maxLevel;
|
|
2670
2698
|
});
|
|
2671
2699
|
var visibleItems = lowestItems;
|
|
2672
2700
|
var defaultMethod = 'remove';
|
|
2673
2701
|
|
|
2674
|
-
if (searchText.length > 1) {
|
|
2702
|
+
if (searchText && searchText.length > 1) {
|
|
2675
2703
|
defaultMethod = 'add';
|
|
2676
2704
|
visibleItems = lowestItems.filter(function (d) {
|
|
2677
|
-
return d[
|
|
2705
|
+
return d[_this17.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2678
2706
|
});
|
|
2679
2707
|
} // hide everything
|
|
2680
2708
|
|
|
@@ -2691,7 +2719,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2691
2719
|
listEls[l].classList.add('websy-menu-collapsed');
|
|
2692
2720
|
}
|
|
2693
2721
|
|
|
2694
|
-
if (searchText.length > 1) {
|
|
2722
|
+
if (searchText && searchText.length > 1) {
|
|
2695
2723
|
visibleItems.forEach(function (d) {
|
|
2696
2724
|
// show the item and open the list
|
|
2697
2725
|
var pathParts = d.path.split('::');
|
|
@@ -2744,11 +2772,19 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2744
2772
|
|
|
2745
2773
|
html += this.renderBlock(this.elementId, this.elementId, this.options.items, 'main', 0);
|
|
2746
2774
|
html += "</div>";
|
|
2775
|
+
|
|
2776
|
+
if (this.options.secondaryItems) {
|
|
2777
|
+
html += "<div class='websy-menu-secondary' style='height: ".concat(this.options.secondaryHeight || '100%', "; width: ").concat(this.options.secondaryWidth || '100%', "'>");
|
|
2778
|
+
html += this.renderBlock(this.elementId, this.elementId, this.options.secondaryItems, 'main', 0);
|
|
2779
|
+
html += "</div>";
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2747
2782
|
el.innerHTML = html;
|
|
2748
2783
|
|
|
2749
2784
|
if (this.options.enableSearch === true) {
|
|
2750
2785
|
this.search = new WebsyDesigns.Search("".concat(this.elementId, "_search"), _extends({}, {
|
|
2751
|
-
onSearch: this.handleSearch.bind(this)
|
|
2786
|
+
onSearch: this.handleSearch.bind(this),
|
|
2787
|
+
onClear: this.handleSearch.bind(this)
|
|
2752
2788
|
}, this.options.searchOptions));
|
|
2753
2789
|
}
|
|
2754
2790
|
}
|
|
@@ -2788,19 +2824,31 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2788
2824
|
html += "\n <span class='selected-bar'></span>\n ";
|
|
2789
2825
|
}
|
|
2790
2826
|
|
|
2791
|
-
if (this.options.activeSymbol === 'triangle') {
|
|
2792
|
-
html += "\n <span class='active-square'></span>\n ";
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
html += " \n <span class='".concat(items[i].items && items[i].items.length > 0 ? 'menu-carat' : '', "'></span>\n ");
|
|
2796
|
-
|
|
2797
2827
|
if (this.options.orientation === 'vertical') {// html += `
|
|
2798
2828
|
//
|
|
2799
2829
|
// `
|
|
2800
2830
|
}
|
|
2801
2831
|
|
|
2802
2832
|
if (items[i].isLink === true && items[i].href) {
|
|
2803
|
-
html += "<a href='".concat(items[i].href, "'
|
|
2833
|
+
html += "<a href='".concat(items[i].href, "' target='").concat(items[i].openInNewTab ? 'blank' : '_self', "'>");
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
if (items[i].icon) {
|
|
2837
|
+
html += "\n <div class='websy-menu-item-icon'>".concat(items[i].icon, "</div>\n ");
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
html += "<span>".concat(items[i].text, "</span>");
|
|
2841
|
+
|
|
2842
|
+
if (items[i].isLink === true && items[i].href) {
|
|
2843
|
+
html += "</a>";
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
if (items[i].items && items[i].items.length > 0) {
|
|
2847
|
+
html += " \n <span class='menu-carat'></span>\n ";
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
if (this.options.activeSymbol === 'triangle') {
|
|
2851
|
+
html += "\n <span class='active-square'></span>\n ";
|
|
2804
2852
|
}
|
|
2805
2853
|
|
|
2806
2854
|
html += " \n\t\t\t\t</div>\n\t\t ";
|
|
@@ -2858,7 +2906,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2858
2906
|
|
|
2859
2907
|
var Pager = /*#__PURE__*/function () {
|
|
2860
2908
|
function Pager(elementId, options) {
|
|
2861
|
-
var
|
|
2909
|
+
var _this18 = this;
|
|
2862
2910
|
|
|
2863
2911
|
_classCallCheck(this, Pager);
|
|
2864
2912
|
|
|
@@ -2911,8 +2959,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2911
2959
|
allowClear: false,
|
|
2912
2960
|
disableSearch: true,
|
|
2913
2961
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2914
|
-
if (
|
|
2915
|
-
|
|
2962
|
+
if (_this18.options.onChangePageSize) {
|
|
2963
|
+
_this18.options.onChangePageSize(selectedItem.value);
|
|
2916
2964
|
}
|
|
2917
2965
|
}
|
|
2918
2966
|
});
|
|
@@ -2936,13 +2984,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2936
2984
|
}, {
|
|
2937
2985
|
key: "render",
|
|
2938
2986
|
value: function render() {
|
|
2939
|
-
var
|
|
2987
|
+
var _this19 = this;
|
|
2940
2988
|
|
|
2941
2989
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
2942
2990
|
|
|
2943
2991
|
if (el) {
|
|
2944
2992
|
var pages = this.options.pages.map(function (item, index) {
|
|
2945
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
2993
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this19.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
2946
2994
|
});
|
|
2947
2995
|
var startIndex = 0;
|
|
2948
2996
|
|
|
@@ -3010,58 +3058,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3010
3058
|
_createClass(WebsyPDFButton, [{
|
|
3011
3059
|
key: "handleClick",
|
|
3012
3060
|
value: function handleClick(event) {
|
|
3013
|
-
var
|
|
3061
|
+
var _this20 = this;
|
|
3014
3062
|
|
|
3015
3063
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3016
3064
|
this.loader.show();
|
|
3017
3065
|
setTimeout(function () {
|
|
3018
|
-
if (
|
|
3019
|
-
var el = document.getElementById(
|
|
3066
|
+
if (_this20.options.targetId) {
|
|
3067
|
+
var el = document.getElementById(_this20.options.targetId);
|
|
3020
3068
|
|
|
3021
3069
|
if (el) {
|
|
3022
3070
|
var pdfData = {
|
|
3023
3071
|
options: {}
|
|
3024
3072
|
};
|
|
3025
3073
|
|
|
3026
|
-
if (
|
|
3027
|
-
pdfData.options = _extends({},
|
|
3074
|
+
if (_this20.options.pdfOptions) {
|
|
3075
|
+
pdfData.options = _extends({}, _this20.options.pdfOptions);
|
|
3028
3076
|
}
|
|
3029
3077
|
|
|
3030
|
-
if (
|
|
3031
|
-
if (
|
|
3032
|
-
var headerEl = document.getElementById(
|
|
3078
|
+
if (_this20.options.header) {
|
|
3079
|
+
if (_this20.options.header.elementId) {
|
|
3080
|
+
var headerEl = document.getElementById(_this20.options.header.elementId);
|
|
3033
3081
|
|
|
3034
3082
|
if (headerEl) {
|
|
3035
3083
|
pdfData.header = headerEl.outerHTML;
|
|
3036
3084
|
|
|
3037
|
-
if (
|
|
3038
|
-
pdfData.options.headerCSS =
|
|
3085
|
+
if (_this20.options.header.css) {
|
|
3086
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3039
3087
|
}
|
|
3040
3088
|
}
|
|
3041
|
-
} else if (
|
|
3042
|
-
pdfData.header =
|
|
3089
|
+
} else if (_this20.options.header.html) {
|
|
3090
|
+
pdfData.header = _this20.options.header.html;
|
|
3043
3091
|
|
|
3044
|
-
if (
|
|
3045
|
-
pdfData.options.headerCSS =
|
|
3092
|
+
if (_this20.options.header.css) {
|
|
3093
|
+
pdfData.options.headerCSS = _this20.options.header.css;
|
|
3046
3094
|
}
|
|
3047
3095
|
} else {
|
|
3048
|
-
pdfData.header =
|
|
3096
|
+
pdfData.header = _this20.options.header;
|
|
3049
3097
|
}
|
|
3050
3098
|
}
|
|
3051
3099
|
|
|
3052
|
-
if (
|
|
3053
|
-
if (
|
|
3054
|
-
var footerEl = document.getElementById(
|
|
3100
|
+
if (_this20.options.footer) {
|
|
3101
|
+
if (_this20.options.footer.elementId) {
|
|
3102
|
+
var footerEl = document.getElementById(_this20.options.footer.elementId);
|
|
3055
3103
|
|
|
3056
3104
|
if (footerEl) {
|
|
3057
3105
|
pdfData.footer = footerEl.outerHTML;
|
|
3058
3106
|
|
|
3059
|
-
if (
|
|
3060
|
-
pdfData.options.footerCSS =
|
|
3107
|
+
if (_this20.options.footer.css) {
|
|
3108
|
+
pdfData.options.footerCSS = _this20.options.footer.css;
|
|
3061
3109
|
}
|
|
3062
3110
|
}
|
|
3063
3111
|
} else {
|
|
3064
|
-
pdfData.footer =
|
|
3112
|
+
pdfData.footer = _this20.options.footer;
|
|
3065
3113
|
}
|
|
3066
3114
|
}
|
|
3067
3115
|
|
|
@@ -3070,31 +3118,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3070
3118
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3071
3119
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3072
3120
|
|
|
3073
|
-
|
|
3121
|
+
_this20.service.add('', pdfData, {
|
|
3074
3122
|
responseType: 'blob'
|
|
3075
3123
|
}).then(function (response) {
|
|
3076
|
-
|
|
3124
|
+
_this20.loader.hide();
|
|
3077
3125
|
|
|
3078
3126
|
var blob = new Blob([response], {
|
|
3079
3127
|
type: 'application/pdf'
|
|
3080
3128
|
});
|
|
3081
3129
|
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 ");
|
|
3082
3130
|
|
|
3083
|
-
if (
|
|
3131
|
+
if (_this20.options.directDownload === true) {
|
|
3084
3132
|
var fileName;
|
|
3085
3133
|
|
|
3086
|
-
if (typeof
|
|
3087
|
-
fileName =
|
|
3134
|
+
if (typeof _this20.options.fileName === 'function') {
|
|
3135
|
+
fileName = _this20.options.fileName() || 'Export';
|
|
3088
3136
|
} else {
|
|
3089
|
-
fileName =
|
|
3137
|
+
fileName = _this20.options.fileName || 'Export';
|
|
3090
3138
|
}
|
|
3091
3139
|
|
|
3092
3140
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3093
3141
|
}
|
|
3094
3142
|
|
|
3095
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3143
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this20.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3096
3144
|
|
|
3097
|
-
|
|
3145
|
+
_this20.popup.show({
|
|
3098
3146
|
message: msg,
|
|
3099
3147
|
mask: true
|
|
3100
3148
|
});
|
|
@@ -3295,7 +3343,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3295
3343
|
|
|
3296
3344
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3297
3345
|
function ResponsiveText(elementId, options) {
|
|
3298
|
-
var
|
|
3346
|
+
var _this21 = this;
|
|
3299
3347
|
|
|
3300
3348
|
_classCallCheck(this, ResponsiveText);
|
|
3301
3349
|
|
|
@@ -3308,7 +3356,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3308
3356
|
this.elementId = elementId;
|
|
3309
3357
|
this.canvas = document.createElement('canvas');
|
|
3310
3358
|
window.addEventListener('resize', function () {
|
|
3311
|
-
return
|
|
3359
|
+
return _this21.render();
|
|
3312
3360
|
});
|
|
3313
3361
|
var el = document.getElementById(this.elementId);
|
|
3314
3362
|
|
|
@@ -3527,7 +3575,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3527
3575
|
|
|
3528
3576
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3529
3577
|
function WebsyResultList(elementId, options) {
|
|
3530
|
-
var
|
|
3578
|
+
var _this22 = this;
|
|
3531
3579
|
|
|
3532
3580
|
_classCallCheck(this, WebsyResultList);
|
|
3533
3581
|
|
|
@@ -3559,9 +3607,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3559
3607
|
|
|
3560
3608
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3561
3609
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3562
|
-
|
|
3610
|
+
_this22.options.template = templateString;
|
|
3563
3611
|
|
|
3564
|
-
|
|
3612
|
+
_this22.render();
|
|
3565
3613
|
});
|
|
3566
3614
|
} else {
|
|
3567
3615
|
this.render();
|
|
@@ -3581,7 +3629,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3581
3629
|
}, {
|
|
3582
3630
|
key: "buildHTML",
|
|
3583
3631
|
value: function buildHTML(d) {
|
|
3584
|
-
var
|
|
3632
|
+
var _this23 = this;
|
|
3585
3633
|
|
|
3586
3634
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3587
3635
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3591,7 +3639,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3591
3639
|
if (this.options.template) {
|
|
3592
3640
|
if (d.length > 0) {
|
|
3593
3641
|
d.forEach(function (row, ix) {
|
|
3594
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3642
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this23.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3595
3643
|
|
|
3596
3644
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3597
3645
|
|
|
@@ -3696,7 +3744,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3696
3744
|
parts.forEach(function (p) {
|
|
3697
3745
|
items = items[p];
|
|
3698
3746
|
});
|
|
3699
|
-
template = template.replace(m[0],
|
|
3747
|
+
template = template.replace(m[0], _this23.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3700
3748
|
}
|
|
3701
3749
|
});
|
|
3702
3750
|
|
|
@@ -3708,7 +3756,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3708
3756
|
}
|
|
3709
3757
|
});
|
|
3710
3758
|
|
|
3711
|
-
var flatRow =
|
|
3759
|
+
var flatRow = _this23.flattenObject(row);
|
|
3712
3760
|
|
|
3713
3761
|
for (var key in flatRow) {
|
|
3714
3762
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -3843,13 +3891,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3843
3891
|
}, {
|
|
3844
3892
|
key: "render",
|
|
3845
3893
|
value: function render() {
|
|
3846
|
-
var
|
|
3894
|
+
var _this24 = this;
|
|
3847
3895
|
|
|
3848
3896
|
if (this.options.entity) {
|
|
3849
3897
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
3850
|
-
|
|
3898
|
+
_this24.rows = results.rows;
|
|
3851
3899
|
|
|
3852
|
-
|
|
3900
|
+
_this24.resize();
|
|
3853
3901
|
});
|
|
3854
3902
|
} else {
|
|
3855
3903
|
this.resize();
|
|
@@ -3935,14 +3983,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3935
3983
|
_createClass(WebsyRouter, [{
|
|
3936
3984
|
key: "addGroup",
|
|
3937
3985
|
value: function addGroup(group) {
|
|
3938
|
-
var
|
|
3986
|
+
var _this25 = this;
|
|
3939
3987
|
|
|
3940
3988
|
if (!this.groups[group]) {
|
|
3941
3989
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3942
3990
|
|
|
3943
3991
|
if (els) {
|
|
3944
3992
|
this.getClosestParent(els[0], function (parent) {
|
|
3945
|
-
|
|
3993
|
+
_this25.groups[group] = {
|
|
3946
3994
|
activeView: '',
|
|
3947
3995
|
views: [],
|
|
3948
3996
|
parent: parent.getAttribute('data-view')
|
|
@@ -4005,7 +4053,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4005
4053
|
}, {
|
|
4006
4054
|
key: "removeUrlParams",
|
|
4007
4055
|
value: function removeUrlParams() {
|
|
4008
|
-
var
|
|
4056
|
+
var _this26 = this;
|
|
4009
4057
|
|
|
4010
4058
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4011
4059
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4019,7 +4067,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4019
4067
|
|
|
4020
4068
|
if (this.currentParams && this.currentParams.items) {
|
|
4021
4069
|
params.forEach(function (p) {
|
|
4022
|
-
delete
|
|
4070
|
+
delete _this26.currentParams.items[p];
|
|
4023
4071
|
});
|
|
4024
4072
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4025
4073
|
}
|
|
@@ -4383,12 +4431,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4383
4431
|
}, {
|
|
4384
4432
|
key: "showComponents",
|
|
4385
4433
|
value: function showComponents(view) {
|
|
4386
|
-
var
|
|
4434
|
+
var _this27 = this;
|
|
4387
4435
|
|
|
4388
4436
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4389
4437
|
this.options.views[view].components.forEach(function (c) {
|
|
4390
4438
|
if (typeof c.instance === 'undefined') {
|
|
4391
|
-
|
|
4439
|
+
_this27.prepComponent(c.elementId, c.options);
|
|
4392
4440
|
|
|
4393
4441
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4394
4442
|
} else if (c.instance.render) {
|
|
@@ -4765,7 +4813,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4765
4813
|
|
|
4766
4814
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4767
4815
|
function WebsyTemplate(elementId, options) {
|
|
4768
|
-
var
|
|
4816
|
+
var _this28 = this;
|
|
4769
4817
|
|
|
4770
4818
|
_classCallCheck(this, WebsyTemplate);
|
|
4771
4819
|
|
|
@@ -4791,9 +4839,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4791
4839
|
|
|
4792
4840
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4793
4841
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4794
|
-
|
|
4842
|
+
_this28.options.template = templateString;
|
|
4795
4843
|
|
|
4796
|
-
|
|
4844
|
+
_this28.render();
|
|
4797
4845
|
});
|
|
4798
4846
|
} else {
|
|
4799
4847
|
this.render();
|
|
@@ -4803,7 +4851,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4803
4851
|
_createClass(WebsyTemplate, [{
|
|
4804
4852
|
key: "buildHTML",
|
|
4805
4853
|
value: function buildHTML() {
|
|
4806
|
-
var
|
|
4854
|
+
var _this29 = this;
|
|
4807
4855
|
|
|
4808
4856
|
var html = "";
|
|
4809
4857
|
|
|
@@ -4865,14 +4913,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4865
4913
|
}
|
|
4866
4914
|
|
|
4867
4915
|
if (polarity === true) {
|
|
4868
|
-
if (typeof
|
|
4916
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] === parts[1]) {
|
|
4869
4917
|
// remove the <if> tags
|
|
4870
4918
|
removeAll = false;
|
|
4871
4919
|
} else if (parts[0] === parts[1]) {
|
|
4872
4920
|
removeAll = false;
|
|
4873
4921
|
}
|
|
4874
4922
|
} else if (polarity === false) {
|
|
4875
|
-
if (typeof
|
|
4923
|
+
if (typeof _this29.options.data[parts[0]] !== 'undefined' && _this29.options.data[parts[0]] !== parts[1]) {
|
|
4876
4924
|
// remove the <if> tags
|
|
4877
4925
|
removeAll = false;
|
|
4878
4926
|
}
|
|
@@ -5162,7 +5210,7 @@ var WebsyUtils = {
|
|
|
5162
5210
|
|
|
5163
5211
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5164
5212
|
function WebsyTable(elementId, options) {
|
|
5165
|
-
var
|
|
5213
|
+
var _this30 = this;
|
|
5166
5214
|
|
|
5167
5215
|
_classCallCheck(this, WebsyTable);
|
|
5168
5216
|
|
|
@@ -5200,8 +5248,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5200
5248
|
allowClear: false,
|
|
5201
5249
|
disableSearch: true,
|
|
5202
5250
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5203
|
-
if (
|
|
5204
|
-
|
|
5251
|
+
if (_this30.options.onChangePageSize) {
|
|
5252
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
5205
5253
|
}
|
|
5206
5254
|
}
|
|
5207
5255
|
});
|
|
@@ -5222,7 +5270,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5222
5270
|
_createClass(WebsyTable, [{
|
|
5223
5271
|
key: "appendRows",
|
|
5224
5272
|
value: function appendRows(data) {
|
|
5225
|
-
var
|
|
5273
|
+
var _this31 = this;
|
|
5226
5274
|
|
|
5227
5275
|
this.hideError();
|
|
5228
5276
|
var bodyHTML = '';
|
|
@@ -5230,15 +5278,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5230
5278
|
if (data) {
|
|
5231
5279
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5232
5280
|
return '<tr>' + r.map(function (c, i) {
|
|
5233
|
-
if (
|
|
5281
|
+
if (_this31.options.columns[i].show !== false) {
|
|
5234
5282
|
var style = '';
|
|
5235
5283
|
|
|
5236
5284
|
if (c.style) {
|
|
5237
5285
|
style += c.style;
|
|
5238
5286
|
}
|
|
5239
5287
|
|
|
5240
|
-
if (
|
|
5241
|
-
style += "width: ".concat(
|
|
5288
|
+
if (_this31.options.columns[i].width) {
|
|
5289
|
+
style += "width: ".concat(_this31.options.columns[i].width, "; ");
|
|
5242
5290
|
}
|
|
5243
5291
|
|
|
5244
5292
|
if (c.backgroundColor) {
|
|
@@ -5253,18 +5301,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5253
5301
|
style += "color: ".concat(c.color, "; ");
|
|
5254
5302
|
}
|
|
5255
5303
|
|
|
5256
|
-
if (
|
|
5257
|
-
return "\n <td \n data-row-index='".concat(
|
|
5258
|
-
} else if ((
|
|
5259
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5304
|
+
if (_this31.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5305
|
+
return "\n <td \n data-row-index='".concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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(_this31.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5306
|
+
} else if ((_this31.options.columns[i].showAsNavigatorLink === true || _this31.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5307
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this31.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this31.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this31.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5260
5308
|
} else {
|
|
5261
5309
|
var info = c.value;
|
|
5262
5310
|
|
|
5263
|
-
if (
|
|
5311
|
+
if (_this31.options.columns[i].showAsImage === true) {
|
|
5264
5312
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5265
5313
|
}
|
|
5266
5314
|
|
|
5267
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5315
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this31.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this31.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 ");
|
|
5268
5316
|
}
|
|
5269
5317
|
}
|
|
5270
5318
|
}).join('') + '</tr>';
|
|
@@ -5436,7 +5484,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5436
5484
|
}, {
|
|
5437
5485
|
key: "render",
|
|
5438
5486
|
value: function render(data) {
|
|
5439
|
-
var
|
|
5487
|
+
var _this32 = this;
|
|
5440
5488
|
|
|
5441
5489
|
if (!this.options.columns) {
|
|
5442
5490
|
return;
|
|
@@ -5471,7 +5519,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5471
5519
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5472
5520
|
}
|
|
5473
5521
|
|
|
5474
|
-
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 ?
|
|
5522
|
+
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 ? _this32.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5475
5523
|
}
|
|
5476
5524
|
}).join('') + '</tr>';
|
|
5477
5525
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5490,7 +5538,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5490
5538
|
|
|
5491
5539
|
if (pagingEl) {
|
|
5492
5540
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5493
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5541
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this32.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5494
5542
|
});
|
|
5495
5543
|
var startIndex = 0;
|
|
5496
5544
|
|
|
@@ -5558,7 +5606,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5558
5606
|
|
|
5559
5607
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5560
5608
|
function WebsyTable2(elementId, options) {
|
|
5561
|
-
var
|
|
5609
|
+
var _this33 = this;
|
|
5562
5610
|
|
|
5563
5611
|
_classCallCheck(this, WebsyTable2);
|
|
5564
5612
|
|
|
@@ -5599,8 +5647,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5599
5647
|
allowClear: false,
|
|
5600
5648
|
disableSearch: true,
|
|
5601
5649
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5602
|
-
if (
|
|
5603
|
-
|
|
5650
|
+
if (_this33.options.onChangePageSize) {
|
|
5651
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5604
5652
|
}
|
|
5605
5653
|
}
|
|
5606
5654
|
});
|
|
@@ -5624,7 +5672,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5624
5672
|
_createClass(WebsyTable2, [{
|
|
5625
5673
|
key: "appendRows",
|
|
5626
5674
|
value: function appendRows(data) {
|
|
5627
|
-
var
|
|
5675
|
+
var _this34 = this;
|
|
5628
5676
|
|
|
5629
5677
|
this.hideError();
|
|
5630
5678
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -5633,15 +5681,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5633
5681
|
if (data) {
|
|
5634
5682
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5635
5683
|
return '<tr>' + r.map(function (c, i) {
|
|
5636
|
-
if (
|
|
5637
|
-
var style = "height: ".concat(
|
|
5684
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5685
|
+
var style = "height: ".concat(_this34.options.cellSize, "px; line-height: ").concat(_this34.options.cellSize, "px;");
|
|
5638
5686
|
|
|
5639
5687
|
if (c.style) {
|
|
5640
5688
|
style += c.style;
|
|
5641
5689
|
}
|
|
5642
5690
|
|
|
5643
|
-
if (
|
|
5644
|
-
style += "width: ".concat(
|
|
5691
|
+
if (_this34.options.columns[i].width) {
|
|
5692
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5645
5693
|
}
|
|
5646
5694
|
|
|
5647
5695
|
if (c.backgroundColor) {
|
|
@@ -5656,18 +5704,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5656
5704
|
style += "color: ".concat(c.color, "; ");
|
|
5657
5705
|
}
|
|
5658
5706
|
|
|
5659
|
-
if (
|
|
5660
|
-
return "\n <td \n data-row-index='".concat(
|
|
5661
|
-
} else if ((
|
|
5662
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5707
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5708
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5709
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5710
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5663
5711
|
} else {
|
|
5664
5712
|
var info = c.value;
|
|
5665
5713
|
|
|
5666
|
-
if (
|
|
5714
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5667
5715
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5668
5716
|
}
|
|
5669
5717
|
|
|
5670
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5718
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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 ");
|
|
5671
5719
|
}
|
|
5672
5720
|
}
|
|
5673
5721
|
}).join('') + '</tr>';
|
|
@@ -5930,7 +5978,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5930
5978
|
}, {
|
|
5931
5979
|
key: "render",
|
|
5932
5980
|
value: function render(data) {
|
|
5933
|
-
var
|
|
5981
|
+
var _this35 = this;
|
|
5934
5982
|
|
|
5935
5983
|
if (!this.options.columns) {
|
|
5936
5984
|
return;
|
|
@@ -5966,7 +6014,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5966
6014
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5967
6015
|
}
|
|
5968
6016
|
|
|
5969
|
-
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 ?
|
|
6017
|
+
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 ? _this35.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5970
6018
|
}
|
|
5971
6019
|
}).join('') + '</tr>';
|
|
5972
6020
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5977,7 +6025,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5977
6025
|
var dropdownHTML = "";
|
|
5978
6026
|
this.options.columns.forEach(function (c, i) {
|
|
5979
6027
|
if (c.searchable && c.searchField) {
|
|
5980
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6028
|
+
dropdownHTML += "\n <div id=\"".concat(_this35.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5981
6029
|
}
|
|
5982
6030
|
});
|
|
5983
6031
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5999,7 +6047,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5999
6047
|
|
|
6000
6048
|
if (pagingEl) {
|
|
6001
6049
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6002
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6050
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6003
6051
|
});
|
|
6004
6052
|
var startIndex = 0;
|
|
6005
6053
|
|
|
@@ -6090,7 +6138,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6090
6138
|
}, {
|
|
6091
6139
|
key: "getColumnParameters",
|
|
6092
6140
|
value: function getColumnParameters(values) {
|
|
6093
|
-
var
|
|
6141
|
+
var _this36 = this;
|
|
6094
6142
|
|
|
6095
6143
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6096
6144
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6098,10 +6146,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6098
6146
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6099
6147
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6100
6148
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6101
|
-
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 ?
|
|
6149
|
+
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 ? _this36.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6102
6150
|
}).join('') + '</tr>';
|
|
6103
6151
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6104
|
-
return "\n <td \n style='height: ".concat(
|
|
6152
|
+
return "\n <td \n style='height: ".concat(_this36.options.cellSize, "px; line-height: ").concat(_this36.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6105
6153
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6106
6154
|
|
|
6107
6155
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6229,7 +6277,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6229
6277
|
}, {
|
|
6230
6278
|
key: "buildBodyHtml",
|
|
6231
6279
|
value: function buildBodyHtml() {
|
|
6232
|
-
var
|
|
6280
|
+
var _this37 = this;
|
|
6233
6281
|
|
|
6234
6282
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6235
6283
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6288,7 +6336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6288
6336
|
} // console.log('rowspan', cell.rowspan)
|
|
6289
6337
|
|
|
6290
6338
|
|
|
6291
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6339
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this37.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-col-index='").concat(cellIndex, "'\n "); // if (useWidths === true) {
|
|
6292
6340
|
// bodyHtml += `
|
|
6293
6341
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6294
6342
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6298,11 +6346,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6298
6346
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6299
6347
|
|
|
6300
6348
|
if (cell.expandable === true) {
|
|
6301
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6349
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this37.options.plusIcon, "</i>");
|
|
6302
6350
|
}
|
|
6303
6351
|
|
|
6304
6352
|
if (cell.collapsable === true) {
|
|
6305
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6353
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this37.options.minusIcon, "</i>");
|
|
6306
6354
|
}
|
|
6307
6355
|
|
|
6308
6356
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6327,7 +6375,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6327
6375
|
}, {
|
|
6328
6376
|
key: "buildHeaderHtml",
|
|
6329
6377
|
value: function buildHeaderHtml() {
|
|
6330
|
-
var
|
|
6378
|
+
var _this38 = this;
|
|
6331
6379
|
|
|
6332
6380
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6333
6381
|
var headerHtml = '';
|
|
@@ -6342,7 +6390,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6342
6390
|
}
|
|
6343
6391
|
|
|
6344
6392
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6345
|
-
if (useWidths === false && rowIndex !==
|
|
6393
|
+
if (useWidths === false && rowIndex !== _this38.options.columns.length - 1) {
|
|
6346
6394
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6347
6395
|
return;
|
|
6348
6396
|
}
|
|
@@ -6368,18 +6416,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6368
6416
|
// `
|
|
6369
6417
|
// }
|
|
6370
6418
|
|
|
6371
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6419
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this38.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6372
6420
|
});
|
|
6373
6421
|
headerHtml += "</tr>";
|
|
6374
6422
|
});
|
|
6375
6423
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6376
6424
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6377
6425
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6378
|
-
var testEl = document.getElementById("".concat(
|
|
6426
|
+
var testEl = document.getElementById("".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6379
6427
|
|
|
6380
6428
|
if (!testEl) {
|
|
6381
6429
|
var newE = document.createElement('div');
|
|
6382
|
-
newE.id = "".concat(
|
|
6430
|
+
newE.id = "".concat(_this38.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6383
6431
|
newE.className = 'websy-modal-dropdown';
|
|
6384
6432
|
dropdownEl.appendChild(newE);
|
|
6385
6433
|
}
|
|
@@ -6395,7 +6443,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6395
6443
|
}, {
|
|
6396
6444
|
key: "buildTotalHtml",
|
|
6397
6445
|
value: function buildTotalHtml() {
|
|
6398
|
-
var
|
|
6446
|
+
var _this39 = this;
|
|
6399
6447
|
|
|
6400
6448
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6401
6449
|
|
|
@@ -6408,7 +6456,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6408
6456
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6409
6457
|
|
|
6410
6458
|
if (useWidths === true) {
|
|
6411
|
-
totalHtml += "\n style='width: ".concat(
|
|
6459
|
+
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 ");
|
|
6412
6460
|
}
|
|
6413
6461
|
|
|
6414
6462
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6419,7 +6467,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6419
6467
|
}, {
|
|
6420
6468
|
key: "calculateSizes",
|
|
6421
6469
|
value: function calculateSizes() {
|
|
6422
|
-
var
|
|
6470
|
+
var _this40 = this;
|
|
6423
6471
|
|
|
6424
6472
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6425
6473
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6462,32 +6510,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6462
6510
|
rows.forEach(function (row, rowIndex) {
|
|
6463
6511
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6464
6512
|
var colSize = col.getBoundingClientRect();
|
|
6465
|
-
|
|
6513
|
+
_this40.sizes.cellHeight = colSize.height;
|
|
6466
6514
|
|
|
6467
|
-
if (
|
|
6468
|
-
if (!
|
|
6469
|
-
|
|
6515
|
+
if (_this40.options.columns[_this40.options.columns.length - 1][colIndex]) {
|
|
6516
|
+
if (!_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth) {
|
|
6517
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6470
6518
|
}
|
|
6471
6519
|
|
|
6472
|
-
|
|
6473
|
-
|
|
6520
|
+
_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);
|
|
6521
|
+
_this40.options.columns[_this40.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6474
6522
|
|
|
6475
|
-
if (colIndex >=
|
|
6476
|
-
firstNonPinnedColumnWidth =
|
|
6523
|
+
if (colIndex >= _this40.pinnedColumns) {
|
|
6524
|
+
firstNonPinnedColumnWidth = _this40.options.columns[_this40.options.columns.length - 1][colIndex].actualWidth;
|
|
6477
6525
|
}
|
|
6478
6526
|
}
|
|
6479
6527
|
});
|
|
6480
6528
|
});
|
|
6481
6529
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6482
|
-
if (colIndex <
|
|
6483
|
-
|
|
6530
|
+
if (colIndex < _this40.pinnedColumns) {
|
|
6531
|
+
_this40.sizes.scrollableWidth -= col.actualWidth;
|
|
6484
6532
|
}
|
|
6485
6533
|
});
|
|
6486
6534
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6487
6535
|
return a + (b.width || b.actualWidth);
|
|
6488
6536
|
}, 0);
|
|
6489
6537
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6490
|
-
return i >=
|
|
6538
|
+
return i >= _this40.pinnedColumns;
|
|
6491
6539
|
}).reduce(function (a, b) {
|
|
6492
6540
|
return a + (b.width || b.actualWidth);
|
|
6493
6541
|
}, 0);
|
|
@@ -6508,10 +6556,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6508
6556
|
c.actualWidth += equalWidth; // }
|
|
6509
6557
|
// }
|
|
6510
6558
|
|
|
6511
|
-
|
|
6559
|
+
_this40.sizes.totalWidth += c.width || c.actualWidth;
|
|
6512
6560
|
|
|
6513
|
-
if (i <
|
|
6514
|
-
|
|
6561
|
+
if (i < _this40.pinnedColumns) {
|
|
6562
|
+
_this40.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6515
6563
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6516
6564
|
|
|
6517
6565
|
});
|
|
@@ -6568,7 +6616,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6568
6616
|
}, {
|
|
6569
6617
|
key: "createSample",
|
|
6570
6618
|
value: function createSample(data) {
|
|
6571
|
-
var
|
|
6619
|
+
var _this41 = this;
|
|
6572
6620
|
|
|
6573
6621
|
var output = [];
|
|
6574
6622
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -6580,7 +6628,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6580
6628
|
var longest = '';
|
|
6581
6629
|
|
|
6582
6630
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6583
|
-
if (data[i].length ===
|
|
6631
|
+
if (data[i].length === _this41.options.columns[_this41.options.columns.length - 1].length) {
|
|
6584
6632
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6585
6633
|
longest = data[i][colIndex].value;
|
|
6586
6634
|
}
|
|
@@ -6975,7 +7023,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6975
7023
|
|
|
6976
7024
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6977
7025
|
function WebsyChart(elementId, options) {
|
|
6978
|
-
var
|
|
7026
|
+
var _this42 = this;
|
|
6979
7027
|
|
|
6980
7028
|
_classCallCheck(this, WebsyChart);
|
|
6981
7029
|
|
|
@@ -7026,22 +7074,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7026
7074
|
this.invertOverride = function (input, input2) {
|
|
7027
7075
|
var xAxis = 'bottomAxis';
|
|
7028
7076
|
|
|
7029
|
-
if (
|
|
7077
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7030
7078
|
xAxis = 'leftAxis';
|
|
7031
7079
|
}
|
|
7032
7080
|
|
|
7033
|
-
var width =
|
|
7081
|
+
var width = _this42[xAxis].step();
|
|
7034
7082
|
|
|
7035
7083
|
var output;
|
|
7036
7084
|
|
|
7037
|
-
var domain = _toConsumableArray(
|
|
7085
|
+
var domain = _toConsumableArray(_this42[xAxis].domain());
|
|
7038
7086
|
|
|
7039
|
-
if (
|
|
7087
|
+
if (_this42.options.orientation === 'horizontal') {
|
|
7040
7088
|
domain = domain.reverse();
|
|
7041
7089
|
}
|
|
7042
7090
|
|
|
7043
7091
|
for (var j = 0; j < domain.length; j++) {
|
|
7044
|
-
var breakA =
|
|
7092
|
+
var breakA = _this42[xAxis](domain[j]) - width / 2;
|
|
7045
7093
|
var breakB = breakA + width;
|
|
7046
7094
|
|
|
7047
7095
|
if (input > breakA && input <= breakB) {
|
|
@@ -7141,10 +7189,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7141
7189
|
}, {
|
|
7142
7190
|
key: "handleEventMouseMove",
|
|
7143
7191
|
value: function handleEventMouseMove(event, d) {
|
|
7144
|
-
var
|
|
7192
|
+
var _this43 = this;
|
|
7145
7193
|
|
|
7146
7194
|
var bisectDate = d3.bisector(function (d) {
|
|
7147
|
-
return
|
|
7195
|
+
return _this43.parseX(d.x.value);
|
|
7148
7196
|
}).left;
|
|
7149
7197
|
|
|
7150
7198
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7183,8 +7231,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7183
7231
|
}
|
|
7184
7232
|
|
|
7185
7233
|
this.options.data.series.forEach(function (s) {
|
|
7186
|
-
if (
|
|
7187
|
-
xPoint =
|
|
7234
|
+
if (_this43.options.data[xData].scale !== 'Time') {
|
|
7235
|
+
xPoint = _this43[xAxis](_this43.parseX(xLabel));
|
|
7188
7236
|
s.data.forEach(function (d) {
|
|
7189
7237
|
if (d.x.value === xLabel) {
|
|
7190
7238
|
if (!tooltipTitle) {
|
|
@@ -7203,13 +7251,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7203
7251
|
var pointA = s.data[index - 1];
|
|
7204
7252
|
var pointB = s.data[index];
|
|
7205
7253
|
|
|
7206
|
-
if (
|
|
7254
|
+
if (_this43.options.orientation === 'horizontal') {
|
|
7207
7255
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7208
7256
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7209
7257
|
}
|
|
7210
7258
|
|
|
7211
7259
|
if (pointA && !pointB) {
|
|
7212
|
-
xPoint =
|
|
7260
|
+
xPoint = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7213
7261
|
tooltipTitle = pointA.x.value;
|
|
7214
7262
|
|
|
7215
7263
|
if (!pointA.y.color) {
|
|
@@ -7219,12 +7267,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7219
7267
|
tooltipData.push(pointA.y);
|
|
7220
7268
|
|
|
7221
7269
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7222
|
-
tooltipTitle = d3.timeFormat(
|
|
7270
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7223
7271
|
}
|
|
7224
7272
|
}
|
|
7225
7273
|
|
|
7226
7274
|
if (pointB && !pointA) {
|
|
7227
|
-
xPoint =
|
|
7275
|
+
xPoint = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7228
7276
|
tooltipTitle = pointB.x.value;
|
|
7229
7277
|
|
|
7230
7278
|
if (!pointB.y.color) {
|
|
@@ -7234,14 +7282,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7234
7282
|
tooltipData.push(pointB.y);
|
|
7235
7283
|
|
|
7236
7284
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7237
|
-
tooltipTitle = d3.timeFormat(
|
|
7285
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7238
7286
|
}
|
|
7239
7287
|
}
|
|
7240
7288
|
|
|
7241
7289
|
if (pointA && pointB) {
|
|
7242
|
-
var d0 =
|
|
7290
|
+
var d0 = _this43[xAxis](_this43.parseX(pointA.x.value));
|
|
7243
7291
|
|
|
7244
|
-
var d1 =
|
|
7292
|
+
var d1 = _this43[xAxis](_this43.parseX(pointB.x.value));
|
|
7245
7293
|
|
|
7246
7294
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7247
7295
|
|
|
@@ -7250,7 +7298,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7250
7298
|
tooltipTitle = pointB.x.value;
|
|
7251
7299
|
|
|
7252
7300
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7253
|
-
tooltipTitle = d3.timeFormat(
|
|
7301
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7254
7302
|
}
|
|
7255
7303
|
|
|
7256
7304
|
if (!pointB.y.color) {
|
|
@@ -7263,7 +7311,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7263
7311
|
tooltipTitle = pointA.x.value;
|
|
7264
7312
|
|
|
7265
7313
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7266
|
-
tooltipTitle = d3.timeFormat(
|
|
7314
|
+
tooltipTitle = d3.timeFormat(_this43.options.dateFormat || _this43.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7267
7315
|
}
|
|
7268
7316
|
|
|
7269
7317
|
if (!pointA.y.color) {
|
|
@@ -7377,7 +7425,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7377
7425
|
}, {
|
|
7378
7426
|
key: "render",
|
|
7379
7427
|
value: function render(options) {
|
|
7380
|
-
var
|
|
7428
|
+
var _this44 = this;
|
|
7381
7429
|
|
|
7382
7430
|
/* global d3 options WebsyUtils */
|
|
7383
7431
|
if (typeof options !== 'undefined') {
|
|
@@ -7446,7 +7494,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7446
7494
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7447
7495
|
return {
|
|
7448
7496
|
value: s.label || s.key,
|
|
7449
|
-
color: s.color ||
|
|
7497
|
+
color: s.color || _this44.options.colors[i % _this44.options.colors.length]
|
|
7450
7498
|
};
|
|
7451
7499
|
});
|
|
7452
7500
|
|
|
@@ -7728,7 +7776,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7728
7776
|
|
|
7729
7777
|
if (this.options.data.bottom.formatter) {
|
|
7730
7778
|
bAxisFunc.tickFormat(function (d) {
|
|
7731
|
-
return
|
|
7779
|
+
return _this44.options.data.bottom.formatter(d);
|
|
7732
7780
|
});
|
|
7733
7781
|
}
|
|
7734
7782
|
|
|
@@ -7754,8 +7802,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7754
7802
|
|
|
7755
7803
|
if (this.options.margin.axisLeft > 0) {
|
|
7756
7804
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7757
|
-
if (
|
|
7758
|
-
d =
|
|
7805
|
+
if (_this44.options.data.left.formatter) {
|
|
7806
|
+
d = _this44.options.data.left.formatter(d);
|
|
7759
7807
|
}
|
|
7760
7808
|
|
|
7761
7809
|
return d;
|
|
@@ -7792,8 +7840,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7792
7840
|
|
|
7793
7841
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7794
7842
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7795
|
-
if (
|
|
7796
|
-
d =
|
|
7843
|
+
if (_this44.options.data.right.formatter) {
|
|
7844
|
+
d = _this44.options.data.right.formatter(d);
|
|
7797
7845
|
}
|
|
7798
7846
|
|
|
7799
7847
|
return d;
|
|
@@ -7832,18 +7880,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7832
7880
|
this.renderedKeys = {};
|
|
7833
7881
|
this.options.data.series.forEach(function (series, index) {
|
|
7834
7882
|
if (!series.key) {
|
|
7835
|
-
series.key =
|
|
7883
|
+
series.key = _this44.createIdentity();
|
|
7836
7884
|
}
|
|
7837
7885
|
|
|
7838
7886
|
if (!series.color) {
|
|
7839
|
-
series.color =
|
|
7887
|
+
series.color = _this44.options.colors[index % _this44.options.colors.length];
|
|
7840
7888
|
}
|
|
7841
7889
|
|
|
7842
|
-
|
|
7890
|
+
_this44["render".concat(series.type || 'bar')](series, index);
|
|
7843
7891
|
|
|
7844
|
-
|
|
7892
|
+
_this44.renderLabels(series, index);
|
|
7845
7893
|
|
|
7846
|
-
|
|
7894
|
+
_this44.renderedKeys[series.key] = series.type;
|
|
7847
7895
|
});
|
|
7848
7896
|
}
|
|
7849
7897
|
}
|
|
@@ -7851,17 +7899,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7851
7899
|
}, {
|
|
7852
7900
|
key: "renderarea",
|
|
7853
7901
|
value: function renderarea(series, index) {
|
|
7854
|
-
var
|
|
7902
|
+
var _this45 = this;
|
|
7855
7903
|
|
|
7856
7904
|
/* global d3 series index */
|
|
7857
7905
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
7858
7906
|
return d3.area().x(function (d) {
|
|
7859
|
-
return
|
|
7907
|
+
return _this45[xAxis](_this45.parseX(d.x.value));
|
|
7860
7908
|
}).y0(function (d) {
|
|
7861
|
-
return
|
|
7909
|
+
return _this45[yAxis](0);
|
|
7862
7910
|
}).y1(function (d) {
|
|
7863
|
-
return
|
|
7864
|
-
}).curve(d3[curveStyle ||
|
|
7911
|
+
return _this45[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
7912
|
+
}).curve(d3[curveStyle || _this45.options.curveStyle]);
|
|
7865
7913
|
};
|
|
7866
7914
|
|
|
7867
7915
|
var xAxis = 'bottomAxis';
|
|
@@ -7990,7 +8038,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7990
8038
|
}, {
|
|
7991
8039
|
key: "renderLabels",
|
|
7992
8040
|
value: function renderLabels(series, index) {
|
|
7993
|
-
var
|
|
8041
|
+
var _this46 = this;
|
|
7994
8042
|
|
|
7995
8043
|
/* global series index d3 WebsyDesigns */
|
|
7996
8044
|
var xAxis = 'bottomAxis';
|
|
@@ -8009,11 +8057,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8009
8057
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8010
8058
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8011
8059
|
labels.attr('x', function (d) {
|
|
8012
|
-
return getLabelX.call(
|
|
8060
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8013
8061
|
}).attr('y', function (d) {
|
|
8014
|
-
return getLabelY.call(
|
|
8062
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8015
8063
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8016
|
-
return
|
|
8064
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8017
8065
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8018
8066
|
return d.y.label || d.y.value;
|
|
8019
8067
|
}).each(function (d, i) {
|
|
@@ -8038,11 +8086,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8038
8086
|
}
|
|
8039
8087
|
});
|
|
8040
8088
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8041
|
-
return getLabelX.call(
|
|
8089
|
+
return getLabelX.call(_this46, d, series.labelPosition);
|
|
8042
8090
|
}).attr('y', function (d) {
|
|
8043
|
-
return getLabelY.call(
|
|
8091
|
+
return getLabelY.call(_this46, d, series.labelPosition);
|
|
8044
8092
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8045
|
-
return
|
|
8093
|
+
return _this46.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8046
8094
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8047
8095
|
return d.y.label || d.y.value;
|
|
8048
8096
|
}).each(function (d, i) {
|
|
@@ -8099,16 +8147,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8099
8147
|
}, {
|
|
8100
8148
|
key: "renderline",
|
|
8101
8149
|
value: function renderline(series, index) {
|
|
8102
|
-
var
|
|
8150
|
+
var _this47 = this;
|
|
8103
8151
|
|
|
8104
8152
|
/* global series index d3 */
|
|
8105
8153
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8106
8154
|
return d3.line().x(function (d) {
|
|
8107
|
-
var adjustment =
|
|
8108
|
-
return
|
|
8155
|
+
var adjustment = _this47.options.data[xAxis].scale === 'Time' ? 0 : _this47["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8156
|
+
return _this47["".concat(xAxis, "Axis")](_this47.parseX(d.x.value)) + adjustment;
|
|
8109
8157
|
}).y(function (d) {
|
|
8110
|
-
return
|
|
8111
|
-
}).curve(d3[curveStyle ||
|
|
8158
|
+
return _this47["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8159
|
+
}).curve(d3[curveStyle || _this47.options.curveStyle]);
|
|
8112
8160
|
};
|
|
8113
8161
|
|
|
8114
8162
|
var xAxis = 'bottom';
|
|
@@ -8152,14 +8200,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8152
8200
|
}, {
|
|
8153
8201
|
key: "rendersymbol",
|
|
8154
8202
|
value: function rendersymbol(series, index) {
|
|
8155
|
-
var
|
|
8203
|
+
var _this48 = this;
|
|
8156
8204
|
|
|
8157
8205
|
/* global d3 series index series.key */
|
|
8158
8206
|
var drawSymbol = function drawSymbol(size) {
|
|
8159
8207
|
return d3.symbol() // .type(d => {
|
|
8160
8208
|
// return d3.symbols[0]
|
|
8161
8209
|
// })
|
|
8162
|
-
.size(size ||
|
|
8210
|
+
.size(size || _this48.options.symbolSize);
|
|
8163
8211
|
};
|
|
8164
8212
|
|
|
8165
8213
|
var xAxis = 'bottomAxis';
|
|
@@ -8177,7 +8225,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8177
8225
|
symbols.attr('d', function (d) {
|
|
8178
8226
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8179
8227
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8180
|
-
return "translate(".concat(
|
|
8228
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8181
8229
|
}); // Enter
|
|
8182
8230
|
|
|
8183
8231
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8186,7 +8234,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8186
8234
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8187
8235
|
return "symbol symbol_".concat(series.key);
|
|
8188
8236
|
}).attr('transform', function (d) {
|
|
8189
|
-
return "translate(".concat(
|
|
8237
|
+
return "translate(".concat(_this48[xAxis](_this48.parseX(d.x.value)), ", ").concat(_this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8190
8238
|
});
|
|
8191
8239
|
}
|
|
8192
8240
|
}, {
|
|
@@ -8341,7 +8389,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8341
8389
|
}, {
|
|
8342
8390
|
key: "resize",
|
|
8343
8391
|
value: function resize() {
|
|
8344
|
-
var
|
|
8392
|
+
var _this49 = this;
|
|
8345
8393
|
|
|
8346
8394
|
var el = document.getElementById(this.elementId);
|
|
8347
8395
|
|
|
@@ -8354,7 +8402,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8354
8402
|
// }
|
|
8355
8403
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8356
8404
|
html += this._data.map(function (d, i) {
|
|
8357
|
-
return
|
|
8405
|
+
return _this49.getLegendItemHTML(d);
|
|
8358
8406
|
}).join('');
|
|
8359
8407
|
html += "\n <div>\n ";
|
|
8360
8408
|
el.innerHTML = html;
|
|
@@ -8526,7 +8574,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8526
8574
|
}, {
|
|
8527
8575
|
key: "render",
|
|
8528
8576
|
value: function render() {
|
|
8529
|
-
var
|
|
8577
|
+
var _this50 = this;
|
|
8530
8578
|
|
|
8531
8579
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
8532
8580
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -8535,7 +8583,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8535
8583
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
8536
8584
|
return {
|
|
8537
8585
|
value: s.label || s.key,
|
|
8538
|
-
color: s.color ||
|
|
8586
|
+
color: s.color || _this50.options.colors[i % _this50.options.colors.length]
|
|
8539
8587
|
};
|
|
8540
8588
|
});
|
|
8541
8589
|
var longestValue = legendData.map(function (s) {
|
|
@@ -8599,7 +8647,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8599
8647
|
|
|
8600
8648
|
if (this.polygons) {
|
|
8601
8649
|
this.polygons.forEach(function (p) {
|
|
8602
|
-
return
|
|
8650
|
+
return _this50.map.removeLayer(p);
|
|
8603
8651
|
});
|
|
8604
8652
|
}
|
|
8605
8653
|
|
|
@@ -8657,18 +8705,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
8657
8705
|
}
|
|
8658
8706
|
|
|
8659
8707
|
if (!p.options.color) {
|
|
8660
|
-
p.options.color =
|
|
8708
|
+
p.options.color = _this50.options.colors[i % _this50.options.colors.length];
|
|
8661
8709
|
}
|
|
8662
8710
|
|
|
8663
8711
|
var pol = L.polygon(p.data.map(function (c) {
|
|
8664
8712
|
return c.map(function (d) {
|
|
8665
8713
|
return [d.Latitude, d.Longitude];
|
|
8666
8714
|
});
|
|
8667
|
-
}), p.options).addTo(
|
|
8715
|
+
}), p.options).addTo(_this50.map);
|
|
8668
8716
|
|
|
8669
|
-
|
|
8717
|
+
_this50.polygons.push(pol);
|
|
8670
8718
|
|
|
8671
|
-
|
|
8719
|
+
_this50.map.fitBounds(pol.getBounds());
|
|
8672
8720
|
});
|
|
8673
8721
|
} // if (this.data.markers.length > 0) {
|
|
8674
8722
|
// el.classList.remove('hidden')
|