@websy/websy-designs 1.4.15 → 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/routes/v1/recaptcha.js +2 -1
- package/dist/websy-designs-es6.debug.js +51 -30
- package/dist/websy-designs-es6.js +266 -238
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +52 -31
- package/dist/websy-designs.js +270 -242
- 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
|
@@ -2489,27 +2489,28 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2489
2489
|
|
|
2490
2490
|
return new Promise(function (resolve, reject) {
|
|
2491
2491
|
if (_this13.options.useRecaptcha === true) {
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
grecaptcha.execute(
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
}
|
|
2506
|
-
},
|
|
2507
|
-
|
|
2508
|
-
})
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2492
|
+
if (_this13.recaptchaValue) {
|
|
2493
|
+
// grecaptcha.ready(() => {
|
|
2494
|
+
// grecaptcha.execute(this.recaptchaValue, { action: 'submit' }).then(token => {
|
|
2495
|
+
_this13.apiService.add('google/checkrecaptcha', {
|
|
2496
|
+
grecaptcharesponse: _this13.recaptchaValue
|
|
2497
|
+
}).then(function (response) {
|
|
2498
|
+
if (response.success && response.success === true) {
|
|
2499
|
+
resolve(true);
|
|
2500
|
+
grecaptcha.reset("".concat(_this13.elementId, "_recaptcha"), {
|
|
2501
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2502
|
+
});
|
|
2503
|
+
} else {
|
|
2504
|
+
resolve(false);
|
|
2505
|
+
}
|
|
2506
|
+
}); // }, err => {
|
|
2507
|
+
// reject(err)
|
|
2508
|
+
// })
|
|
2509
|
+
// })
|
|
2510
|
+
|
|
2511
|
+
} else {
|
|
2512
|
+
resolve(false);
|
|
2513
|
+
}
|
|
2513
2514
|
} else {
|
|
2514
2515
|
resolve(true);
|
|
2515
2516
|
}
|
|
@@ -2573,19 +2574,23 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2573
2574
|
}, {
|
|
2574
2575
|
key: "recaptchaReady",
|
|
2575
2576
|
value: function recaptchaReady() {
|
|
2577
|
+
var _this15 = this;
|
|
2578
|
+
|
|
2576
2579
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2577
2580
|
|
|
2578
2581
|
if (el) {
|
|
2579
|
-
grecaptcha.
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
+
grecaptcha.ready(function () {
|
|
2583
|
+
grecaptcha.render("".concat(_this15.elementId, "_recaptcha"), {
|
|
2584
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2585
|
+
callback: _this15.validateRecaptcha.bind(_this15)
|
|
2586
|
+
});
|
|
2582
2587
|
});
|
|
2583
2588
|
}
|
|
2584
2589
|
}
|
|
2585
2590
|
}, {
|
|
2586
2591
|
key: "render",
|
|
2587
2592
|
value: function render(update, data) {
|
|
2588
|
-
var
|
|
2593
|
+
var _this16 = this;
|
|
2589
2594
|
|
|
2590
2595
|
var el = document.getElementById(this.elementId);
|
|
2591
2596
|
var componentsToProcess = [];
|
|
@@ -2595,13 +2600,18 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2595
2600
|
this.options.fields.forEach(function (f, i) {
|
|
2596
2601
|
if (f.component) {
|
|
2597
2602
|
componentsToProcess.push(f);
|
|
2598
|
-
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(
|
|
2603
|
+
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(_this16.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n </div><!--\n ");
|
|
2599
2604
|
} else if (f.type === 'longtext') {
|
|
2600
|
-
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(
|
|
2605
|
+
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(_this16.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 ");
|
|
2601
2606
|
} else {
|
|
2602
|
-
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(
|
|
2607
|
+
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(_this16.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 ");
|
|
2603
2608
|
}
|
|
2604
2609
|
});
|
|
2610
|
+
|
|
2611
|
+
if (this.options.useRecaptcha === true) {
|
|
2612
|
+
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 ");
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2605
2615
|
html += "\n --><button class=\"websy-btn submit ".concat(this.options.submit.classes || '', "\">").concat(this.options.submit.text || 'Save', "</button>").concat(this.options.cancel ? '<!--' : '', "\n ");
|
|
2606
2616
|
|
|
2607
2617
|
if (this.options.cancel) {
|
|
@@ -2609,14 +2619,10 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2609
2619
|
}
|
|
2610
2620
|
|
|
2611
2621
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2612
|
-
|
|
2613
|
-
if (this.options.useRecaptcha === true) {
|
|
2614
|
-
html += "\n <div id='".concat(this.elementId, "_recaptcha'></div>\n ");
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
2622
|
el.innerHTML = html;
|
|
2618
2623
|
this.processComponents(componentsToProcess, function () {
|
|
2619
|
-
if (
|
|
2624
|
+
if (_this16.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2625
|
+
_this16.recaptchaReady();
|
|
2620
2626
|
}
|
|
2621
2627
|
});
|
|
2622
2628
|
}
|
|
@@ -2624,13 +2630,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2624
2630
|
}, {
|
|
2625
2631
|
key: "submitForm",
|
|
2626
2632
|
value: function submitForm() {
|
|
2627
|
-
var
|
|
2633
|
+
var _this17 = this;
|
|
2628
2634
|
|
|
2629
2635
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2636
|
+
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2637
|
+
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
2630
2638
|
|
|
2631
2639
|
if (formEl.reportValidity() === true) {
|
|
2640
|
+
if (buttonEl) {
|
|
2641
|
+
buttonEl.setAttribute('disabled', true);
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2632
2644
|
this.checkRecaptcha().then(function (result) {
|
|
2645
|
+
if (buttonEl) {
|
|
2646
|
+
buttonEl.removeAttribute('disabled');
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2633
2649
|
if (result === true) {
|
|
2650
|
+
if (recaptchErrEl) {
|
|
2651
|
+
recaptchErrEl.classList.add('websy-hidden');
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2634
2654
|
var formData = new FormData(formEl);
|
|
2635
2655
|
var data = {};
|
|
2636
2656
|
var temp = new FormData(formEl);
|
|
@@ -2638,39 +2658,47 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2638
2658
|
data[key] = value;
|
|
2639
2659
|
});
|
|
2640
2660
|
|
|
2641
|
-
if (
|
|
2642
|
-
var
|
|
2661
|
+
if (_this17.options.url) {
|
|
2662
|
+
var _this17$apiService;
|
|
2643
2663
|
|
|
2644
|
-
var params = [
|
|
2664
|
+
var params = [_this17.options.url];
|
|
2645
2665
|
|
|
2646
|
-
if (
|
|
2647
|
-
params.push(
|
|
2666
|
+
if (_this17.options.mode === 'update') {
|
|
2667
|
+
params.push(_this17.options.id);
|
|
2648
2668
|
}
|
|
2649
2669
|
|
|
2650
2670
|
params.push(data);
|
|
2651
2671
|
|
|
2652
|
-
(
|
|
2653
|
-
if (
|
|
2672
|
+
(_this17$apiService = _this17.apiService)[_this17.options.mode].apply(_this17$apiService, params).then(function (result) {
|
|
2673
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2654
2674
|
// this.render()
|
|
2655
2675
|
formEl.reset();
|
|
2656
2676
|
}
|
|
2657
2677
|
|
|
2658
|
-
|
|
2678
|
+
buttonEl.removeAttribute('disabled');
|
|
2679
|
+
|
|
2680
|
+
_this17.options.onSuccess.call(_this17, result);
|
|
2659
2681
|
}, function (err) {
|
|
2660
2682
|
console.log('Error submitting form data:', err);
|
|
2661
2683
|
|
|
2662
|
-
|
|
2684
|
+
_this17.options.onError.call(_this17, err);
|
|
2663
2685
|
});
|
|
2664
|
-
} else if (
|
|
2665
|
-
|
|
2666
|
-
if (
|
|
2686
|
+
} else if (_this17.options.submitFn) {
|
|
2687
|
+
_this17.options.submitFn(data, function () {
|
|
2688
|
+
if (_this17.options.clearAfterSave === true) {
|
|
2667
2689
|
// this.render()
|
|
2668
2690
|
formEl.reset();
|
|
2669
2691
|
}
|
|
2670
2692
|
});
|
|
2671
2693
|
}
|
|
2672
2694
|
} else {
|
|
2673
|
-
|
|
2695
|
+
if (buttonEl) {
|
|
2696
|
+
buttonEl.removeAttribute('disabled');
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
if (recaptchErrEl) {
|
|
2700
|
+
recaptchErrEl.classList.remove('websy-hidden');
|
|
2701
|
+
}
|
|
2674
2702
|
}
|
|
2675
2703
|
});
|
|
2676
2704
|
}
|
|
@@ -2683,17 +2711,17 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2683
2711
|
}, {
|
|
2684
2712
|
key: "data",
|
|
2685
2713
|
set: function set(d) {
|
|
2686
|
-
var
|
|
2714
|
+
var _this18 = this;
|
|
2687
2715
|
|
|
2688
2716
|
if (!this.options.fields) {
|
|
2689
2717
|
this.options.fields = [];
|
|
2690
2718
|
}
|
|
2691
2719
|
|
|
2692
2720
|
var _loop = function _loop(key) {
|
|
2693
|
-
|
|
2721
|
+
_this18.options.fields.forEach(function (f) {
|
|
2694
2722
|
if (f.field === key) {
|
|
2695
2723
|
f.value = d[key];
|
|
2696
|
-
var el = document.getElementById("".concat(
|
|
2724
|
+
var el = document.getElementById("".concat(_this18.elementId, "_input_").concat(f.field));
|
|
2697
2725
|
el.value = f.value;
|
|
2698
2726
|
}
|
|
2699
2727
|
});
|
|
@@ -2964,11 +2992,11 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2964
2992
|
}, {
|
|
2965
2993
|
key: "handleSearch",
|
|
2966
2994
|
value: function handleSearch(searchText) {
|
|
2967
|
-
var
|
|
2995
|
+
var _this19 = this;
|
|
2968
2996
|
|
|
2969
2997
|
var el = document.getElementById(this.elementId);
|
|
2970
2998
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
2971
|
-
return d.level ===
|
|
2999
|
+
return d.level === _this19.maxLevel;
|
|
2972
3000
|
});
|
|
2973
3001
|
var visibleItems = lowestItems;
|
|
2974
3002
|
var defaultMethod = 'remove';
|
|
@@ -2976,7 +3004,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2976
3004
|
if (searchText && searchText.length > 1) {
|
|
2977
3005
|
defaultMethod = 'add';
|
|
2978
3006
|
visibleItems = lowestItems.filter(function (d) {
|
|
2979
|
-
return d[
|
|
3007
|
+
return d[_this19.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2980
3008
|
});
|
|
2981
3009
|
} // hide everything
|
|
2982
3010
|
|
|
@@ -3180,7 +3208,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3180
3208
|
|
|
3181
3209
|
var Pager = /*#__PURE__*/function () {
|
|
3182
3210
|
function Pager(elementId, options) {
|
|
3183
|
-
var
|
|
3211
|
+
var _this20 = this;
|
|
3184
3212
|
|
|
3185
3213
|
_classCallCheck(this, Pager);
|
|
3186
3214
|
|
|
@@ -3233,8 +3261,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3233
3261
|
allowClear: false,
|
|
3234
3262
|
disableSearch: true,
|
|
3235
3263
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3236
|
-
if (
|
|
3237
|
-
|
|
3264
|
+
if (_this20.options.onChangePageSize) {
|
|
3265
|
+
_this20.options.onChangePageSize(selectedItem.value);
|
|
3238
3266
|
}
|
|
3239
3267
|
}
|
|
3240
3268
|
});
|
|
@@ -3258,13 +3286,13 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3258
3286
|
}, {
|
|
3259
3287
|
key: "render",
|
|
3260
3288
|
value: function render() {
|
|
3261
|
-
var
|
|
3289
|
+
var _this21 = this;
|
|
3262
3290
|
|
|
3263
3291
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3264
3292
|
|
|
3265
3293
|
if (el) {
|
|
3266
3294
|
var pages = this.options.pages.map(function (item, index) {
|
|
3267
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3295
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this21.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3268
3296
|
});
|
|
3269
3297
|
var startIndex = 0;
|
|
3270
3298
|
|
|
@@ -3332,58 +3360,58 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3332
3360
|
_createClass(WebsyPDFButton, [{
|
|
3333
3361
|
key: "handleClick",
|
|
3334
3362
|
value: function handleClick(event) {
|
|
3335
|
-
var
|
|
3363
|
+
var _this22 = this;
|
|
3336
3364
|
|
|
3337
3365
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3338
3366
|
this.loader.show();
|
|
3339
3367
|
setTimeout(function () {
|
|
3340
|
-
if (
|
|
3341
|
-
var el = document.getElementById(
|
|
3368
|
+
if (_this22.options.targetId) {
|
|
3369
|
+
var el = document.getElementById(_this22.options.targetId);
|
|
3342
3370
|
|
|
3343
3371
|
if (el) {
|
|
3344
3372
|
var pdfData = {
|
|
3345
3373
|
options: {}
|
|
3346
3374
|
};
|
|
3347
3375
|
|
|
3348
|
-
if (
|
|
3349
|
-
pdfData.options = _extends({},
|
|
3376
|
+
if (_this22.options.pdfOptions) {
|
|
3377
|
+
pdfData.options = _extends({}, _this22.options.pdfOptions);
|
|
3350
3378
|
}
|
|
3351
3379
|
|
|
3352
|
-
if (
|
|
3353
|
-
if (
|
|
3354
|
-
var headerEl = document.getElementById(
|
|
3380
|
+
if (_this22.options.header) {
|
|
3381
|
+
if (_this22.options.header.elementId) {
|
|
3382
|
+
var headerEl = document.getElementById(_this22.options.header.elementId);
|
|
3355
3383
|
|
|
3356
3384
|
if (headerEl) {
|
|
3357
3385
|
pdfData.header = headerEl.outerHTML;
|
|
3358
3386
|
|
|
3359
|
-
if (
|
|
3360
|
-
pdfData.options.headerCSS =
|
|
3387
|
+
if (_this22.options.header.css) {
|
|
3388
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3361
3389
|
}
|
|
3362
3390
|
}
|
|
3363
|
-
} else if (
|
|
3364
|
-
pdfData.header =
|
|
3391
|
+
} else if (_this22.options.header.html) {
|
|
3392
|
+
pdfData.header = _this22.options.header.html;
|
|
3365
3393
|
|
|
3366
|
-
if (
|
|
3367
|
-
pdfData.options.headerCSS =
|
|
3394
|
+
if (_this22.options.header.css) {
|
|
3395
|
+
pdfData.options.headerCSS = _this22.options.header.css;
|
|
3368
3396
|
}
|
|
3369
3397
|
} else {
|
|
3370
|
-
pdfData.header =
|
|
3398
|
+
pdfData.header = _this22.options.header;
|
|
3371
3399
|
}
|
|
3372
3400
|
}
|
|
3373
3401
|
|
|
3374
|
-
if (
|
|
3375
|
-
if (
|
|
3376
|
-
var footerEl = document.getElementById(
|
|
3402
|
+
if (_this22.options.footer) {
|
|
3403
|
+
if (_this22.options.footer.elementId) {
|
|
3404
|
+
var footerEl = document.getElementById(_this22.options.footer.elementId);
|
|
3377
3405
|
|
|
3378
3406
|
if (footerEl) {
|
|
3379
3407
|
pdfData.footer = footerEl.outerHTML;
|
|
3380
3408
|
|
|
3381
|
-
if (
|
|
3382
|
-
pdfData.options.footerCSS =
|
|
3409
|
+
if (_this22.options.footer.css) {
|
|
3410
|
+
pdfData.options.footerCSS = _this22.options.footer.css;
|
|
3383
3411
|
}
|
|
3384
3412
|
}
|
|
3385
3413
|
} else {
|
|
3386
|
-
pdfData.footer =
|
|
3414
|
+
pdfData.footer = _this22.options.footer;
|
|
3387
3415
|
}
|
|
3388
3416
|
}
|
|
3389
3417
|
|
|
@@ -3392,31 +3420,31 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3392
3420
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3393
3421
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3394
3422
|
|
|
3395
|
-
|
|
3423
|
+
_this22.service.add('', pdfData, {
|
|
3396
3424
|
responseType: 'blob'
|
|
3397
3425
|
}).then(function (response) {
|
|
3398
|
-
|
|
3426
|
+
_this22.loader.hide();
|
|
3399
3427
|
|
|
3400
3428
|
var blob = new Blob([response], {
|
|
3401
3429
|
type: 'application/pdf'
|
|
3402
3430
|
});
|
|
3403
3431
|
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 ");
|
|
3404
3432
|
|
|
3405
|
-
if (
|
|
3433
|
+
if (_this22.options.directDownload === true) {
|
|
3406
3434
|
var fileName;
|
|
3407
3435
|
|
|
3408
|
-
if (typeof
|
|
3409
|
-
fileName =
|
|
3436
|
+
if (typeof _this22.options.fileName === 'function') {
|
|
3437
|
+
fileName = _this22.options.fileName() || 'Export';
|
|
3410
3438
|
} else {
|
|
3411
|
-
fileName =
|
|
3439
|
+
fileName = _this22.options.fileName || 'Export';
|
|
3412
3440
|
}
|
|
3413
3441
|
|
|
3414
3442
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3415
3443
|
}
|
|
3416
3444
|
|
|
3417
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3445
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this22.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3418
3446
|
|
|
3419
|
-
|
|
3447
|
+
_this22.popup.show({
|
|
3420
3448
|
message: msg,
|
|
3421
3449
|
mask: true
|
|
3422
3450
|
});
|
|
@@ -3617,7 +3645,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3617
3645
|
|
|
3618
3646
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3619
3647
|
function ResponsiveText(elementId, options) {
|
|
3620
|
-
var
|
|
3648
|
+
var _this23 = this;
|
|
3621
3649
|
|
|
3622
3650
|
_classCallCheck(this, ResponsiveText);
|
|
3623
3651
|
|
|
@@ -3630,7 +3658,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3630
3658
|
this.elementId = elementId;
|
|
3631
3659
|
this.canvas = document.createElement('canvas');
|
|
3632
3660
|
window.addEventListener('resize', function () {
|
|
3633
|
-
return
|
|
3661
|
+
return _this23.render();
|
|
3634
3662
|
});
|
|
3635
3663
|
var el = document.getElementById(this.elementId);
|
|
3636
3664
|
|
|
@@ -3849,7 +3877,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3849
3877
|
|
|
3850
3878
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3851
3879
|
function WebsyResultList(elementId, options) {
|
|
3852
|
-
var
|
|
3880
|
+
var _this24 = this;
|
|
3853
3881
|
|
|
3854
3882
|
_classCallCheck(this, WebsyResultList);
|
|
3855
3883
|
|
|
@@ -3881,9 +3909,9 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3881
3909
|
|
|
3882
3910
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3883
3911
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3884
|
-
|
|
3912
|
+
_this24.options.template = templateString;
|
|
3885
3913
|
|
|
3886
|
-
|
|
3914
|
+
_this24.render();
|
|
3887
3915
|
});
|
|
3888
3916
|
} else {
|
|
3889
3917
|
this.render();
|
|
@@ -3903,7 +3931,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3903
3931
|
}, {
|
|
3904
3932
|
key: "buildHTML",
|
|
3905
3933
|
value: function buildHTML(d) {
|
|
3906
|
-
var
|
|
3934
|
+
var _this25 = this;
|
|
3907
3935
|
|
|
3908
3936
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3909
3937
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3913,7 +3941,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3913
3941
|
if (this.options.template) {
|
|
3914
3942
|
if (d.length > 0) {
|
|
3915
3943
|
d.forEach(function (row, ix) {
|
|
3916
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3944
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this25.options.template).concat(ix < d.length - 1 ? '<!--' : ''); // find conditional elements
|
|
3917
3945
|
|
|
3918
3946
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3919
3947
|
|
|
@@ -4018,7 +4046,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4018
4046
|
parts.forEach(function (p) {
|
|
4019
4047
|
items = items[p];
|
|
4020
4048
|
});
|
|
4021
|
-
template = template.replace(m[0],
|
|
4049
|
+
template = template.replace(m[0], _this25.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4022
4050
|
}
|
|
4023
4051
|
});
|
|
4024
4052
|
|
|
@@ -4030,7 +4058,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4030
4058
|
}
|
|
4031
4059
|
});
|
|
4032
4060
|
|
|
4033
|
-
var flatRow =
|
|
4061
|
+
var flatRow = _this25.flattenObject(row);
|
|
4034
4062
|
|
|
4035
4063
|
for (var key in flatRow) {
|
|
4036
4064
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
@@ -4165,13 +4193,13 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4165
4193
|
}, {
|
|
4166
4194
|
key: "render",
|
|
4167
4195
|
value: function render() {
|
|
4168
|
-
var
|
|
4196
|
+
var _this26 = this;
|
|
4169
4197
|
|
|
4170
4198
|
if (this.options.entity) {
|
|
4171
4199
|
this.apiService.get(this.options.entity).then(function (results) {
|
|
4172
|
-
|
|
4200
|
+
_this26.rows = results.rows;
|
|
4173
4201
|
|
|
4174
|
-
|
|
4202
|
+
_this26.resize();
|
|
4175
4203
|
});
|
|
4176
4204
|
} else {
|
|
4177
4205
|
this.resize();
|
|
@@ -4257,14 +4285,14 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4257
4285
|
_createClass(WebsyRouter, [{
|
|
4258
4286
|
key: "addGroup",
|
|
4259
4287
|
value: function addGroup(group) {
|
|
4260
|
-
var
|
|
4288
|
+
var _this27 = this;
|
|
4261
4289
|
|
|
4262
4290
|
if (!this.groups[group]) {
|
|
4263
4291
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4264
4292
|
|
|
4265
4293
|
if (els) {
|
|
4266
4294
|
this.getClosestParent(els[0], function (parent) {
|
|
4267
|
-
|
|
4295
|
+
_this27.groups[group] = {
|
|
4268
4296
|
activeView: '',
|
|
4269
4297
|
views: [],
|
|
4270
4298
|
parent: parent.getAttribute('data-view')
|
|
@@ -4327,7 +4355,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4327
4355
|
}, {
|
|
4328
4356
|
key: "removeUrlParams",
|
|
4329
4357
|
value: function removeUrlParams() {
|
|
4330
|
-
var
|
|
4358
|
+
var _this28 = this;
|
|
4331
4359
|
|
|
4332
4360
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4333
4361
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -4341,7 +4369,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4341
4369
|
|
|
4342
4370
|
if (this.currentParams && this.currentParams.items) {
|
|
4343
4371
|
params.forEach(function (p) {
|
|
4344
|
-
delete
|
|
4372
|
+
delete _this28.currentParams.items[p];
|
|
4345
4373
|
});
|
|
4346
4374
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4347
4375
|
}
|
|
@@ -4705,12 +4733,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4705
4733
|
}, {
|
|
4706
4734
|
key: "showComponents",
|
|
4707
4735
|
value: function showComponents(view) {
|
|
4708
|
-
var
|
|
4736
|
+
var _this29 = this;
|
|
4709
4737
|
|
|
4710
4738
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4711
4739
|
this.options.views[view].components.forEach(function (c) {
|
|
4712
4740
|
if (typeof c.instance === 'undefined') {
|
|
4713
|
-
|
|
4741
|
+
_this29.prepComponent(c.elementId, c.options);
|
|
4714
4742
|
|
|
4715
4743
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4716
4744
|
} else if (c.instance.render) {
|
|
@@ -5065,7 +5093,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5065
5093
|
}, {
|
|
5066
5094
|
key: "handleKeyUp",
|
|
5067
5095
|
value: function handleKeyUp(event) {
|
|
5068
|
-
var
|
|
5096
|
+
var _this30 = this;
|
|
5069
5097
|
|
|
5070
5098
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5071
5099
|
if (this.searchTimeoutFn) {
|
|
@@ -5084,8 +5112,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5084
5112
|
|
|
5085
5113
|
if (event.target.value.length >= this.options.minLength) {
|
|
5086
5114
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5087
|
-
if (
|
|
5088
|
-
|
|
5115
|
+
if (_this30.options.onSearch) {
|
|
5116
|
+
_this30.options.onSearch(event.target.value);
|
|
5089
5117
|
}
|
|
5090
5118
|
}, this.options.searchTimeout);
|
|
5091
5119
|
} else {
|
|
@@ -5247,7 +5275,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5247
5275
|
|
|
5248
5276
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5249
5277
|
function WebsyTemplate(elementId, options) {
|
|
5250
|
-
var
|
|
5278
|
+
var _this31 = this;
|
|
5251
5279
|
|
|
5252
5280
|
_classCallCheck(this, WebsyTemplate);
|
|
5253
5281
|
|
|
@@ -5273,9 +5301,9 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5273
5301
|
|
|
5274
5302
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5275
5303
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5276
|
-
|
|
5304
|
+
_this31.options.template = templateString;
|
|
5277
5305
|
|
|
5278
|
-
|
|
5306
|
+
_this31.render();
|
|
5279
5307
|
});
|
|
5280
5308
|
} else {
|
|
5281
5309
|
this.render();
|
|
@@ -5285,7 +5313,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5285
5313
|
_createClass(WebsyTemplate, [{
|
|
5286
5314
|
key: "buildHTML",
|
|
5287
5315
|
value: function buildHTML() {
|
|
5288
|
-
var
|
|
5316
|
+
var _this32 = this;
|
|
5289
5317
|
|
|
5290
5318
|
var html = "";
|
|
5291
5319
|
|
|
@@ -5347,14 +5375,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5347
5375
|
}
|
|
5348
5376
|
|
|
5349
5377
|
if (polarity === true) {
|
|
5350
|
-
if (typeof
|
|
5378
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] === parts[1]) {
|
|
5351
5379
|
// remove the <if> tags
|
|
5352
5380
|
removeAll = false;
|
|
5353
5381
|
} else if (parts[0] === parts[1]) {
|
|
5354
5382
|
removeAll = false;
|
|
5355
5383
|
}
|
|
5356
5384
|
} else if (polarity === false) {
|
|
5357
|
-
if (typeof
|
|
5385
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] !== parts[1]) {
|
|
5358
5386
|
// remove the <if> tags
|
|
5359
5387
|
removeAll = false;
|
|
5360
5388
|
}
|
|
@@ -5644,7 +5672,7 @@ var WebsyUtils = {
|
|
|
5644
5672
|
|
|
5645
5673
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5646
5674
|
function WebsyTable(elementId, options) {
|
|
5647
|
-
var
|
|
5675
|
+
var _this33 = this;
|
|
5648
5676
|
|
|
5649
5677
|
_classCallCheck(this, WebsyTable);
|
|
5650
5678
|
|
|
@@ -5682,8 +5710,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5682
5710
|
allowClear: false,
|
|
5683
5711
|
disableSearch: true,
|
|
5684
5712
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5685
|
-
if (
|
|
5686
|
-
|
|
5713
|
+
if (_this33.options.onChangePageSize) {
|
|
5714
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
5687
5715
|
}
|
|
5688
5716
|
}
|
|
5689
5717
|
});
|
|
@@ -5704,7 +5732,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5704
5732
|
_createClass(WebsyTable, [{
|
|
5705
5733
|
key: "appendRows",
|
|
5706
5734
|
value: function appendRows(data) {
|
|
5707
|
-
var
|
|
5735
|
+
var _this34 = this;
|
|
5708
5736
|
|
|
5709
5737
|
this.hideError();
|
|
5710
5738
|
var bodyHTML = '';
|
|
@@ -5712,15 +5740,15 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5712
5740
|
if (data) {
|
|
5713
5741
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5714
5742
|
return '<tr>' + r.map(function (c, i) {
|
|
5715
|
-
if (
|
|
5743
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5716
5744
|
var style = '';
|
|
5717
5745
|
|
|
5718
5746
|
if (c.style) {
|
|
5719
5747
|
style += c.style;
|
|
5720
5748
|
}
|
|
5721
5749
|
|
|
5722
|
-
if (
|
|
5723
|
-
style += "width: ".concat(
|
|
5750
|
+
if (_this34.options.columns[i].width) {
|
|
5751
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5724
5752
|
}
|
|
5725
5753
|
|
|
5726
5754
|
if (c.backgroundColor) {
|
|
@@ -5735,18 +5763,18 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5735
5763
|
style += "color: ".concat(c.color, "; ");
|
|
5736
5764
|
}
|
|
5737
5765
|
|
|
5738
|
-
if (
|
|
5739
|
-
return "\n <td \n data-row-index='".concat(
|
|
5740
|
-
} else if ((
|
|
5741
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5766
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5767
|
+
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 ");
|
|
5768
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5769
|
+
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 ");
|
|
5742
5770
|
} else {
|
|
5743
5771
|
var info = c.value;
|
|
5744
5772
|
|
|
5745
|
-
if (
|
|
5773
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5746
5774
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5747
5775
|
}
|
|
5748
5776
|
|
|
5749
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5777
|
+
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 ");
|
|
5750
5778
|
}
|
|
5751
5779
|
}
|
|
5752
5780
|
}).join('') + '</tr>';
|
|
@@ -5918,7 +5946,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5918
5946
|
}, {
|
|
5919
5947
|
key: "render",
|
|
5920
5948
|
value: function render(data) {
|
|
5921
|
-
var
|
|
5949
|
+
var _this35 = this;
|
|
5922
5950
|
|
|
5923
5951
|
if (!this.options.columns) {
|
|
5924
5952
|
return;
|
|
@@ -5953,7 +5981,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5953
5981
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5954
5982
|
}
|
|
5955
5983
|
|
|
5956
|
-
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 ?
|
|
5984
|
+
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 ? _this35.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5957
5985
|
}
|
|
5958
5986
|
}).join('') + '</tr>';
|
|
5959
5987
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5972,7 +6000,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5972
6000
|
|
|
5973
6001
|
if (pagingEl) {
|
|
5974
6002
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5975
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6003
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5976
6004
|
});
|
|
5977
6005
|
var startIndex = 0;
|
|
5978
6006
|
|
|
@@ -6040,7 +6068,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6040
6068
|
|
|
6041
6069
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6042
6070
|
function WebsyTable2(elementId, options) {
|
|
6043
|
-
var
|
|
6071
|
+
var _this36 = this;
|
|
6044
6072
|
|
|
6045
6073
|
_classCallCheck(this, WebsyTable2);
|
|
6046
6074
|
|
|
@@ -6081,8 +6109,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6081
6109
|
allowClear: false,
|
|
6082
6110
|
disableSearch: true,
|
|
6083
6111
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6084
|
-
if (
|
|
6085
|
-
|
|
6112
|
+
if (_this36.options.onChangePageSize) {
|
|
6113
|
+
_this36.options.onChangePageSize(selectedItem.value);
|
|
6086
6114
|
}
|
|
6087
6115
|
}
|
|
6088
6116
|
});
|
|
@@ -6106,7 +6134,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6106
6134
|
_createClass(WebsyTable2, [{
|
|
6107
6135
|
key: "appendRows",
|
|
6108
6136
|
value: function appendRows(data) {
|
|
6109
|
-
var
|
|
6137
|
+
var _this37 = this;
|
|
6110
6138
|
|
|
6111
6139
|
this.hideError();
|
|
6112
6140
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
@@ -6115,15 +6143,15 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6115
6143
|
if (data) {
|
|
6116
6144
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6117
6145
|
return '<tr>' + r.map(function (c, i) {
|
|
6118
|
-
if (
|
|
6119
|
-
var style = "height: ".concat(
|
|
6146
|
+
if (_this37.options.columns[i].show !== false) {
|
|
6147
|
+
var style = "height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px;");
|
|
6120
6148
|
|
|
6121
6149
|
if (c.style) {
|
|
6122
6150
|
style += c.style;
|
|
6123
6151
|
}
|
|
6124
6152
|
|
|
6125
|
-
if (
|
|
6126
|
-
style += "width: ".concat(
|
|
6153
|
+
if (_this37.options.columns[i].width) {
|
|
6154
|
+
style += "width: ".concat(_this37.options.columns[i].width, "; ");
|
|
6127
6155
|
}
|
|
6128
6156
|
|
|
6129
6157
|
if (c.backgroundColor) {
|
|
@@ -6138,18 +6166,18 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6138
6166
|
style += "color: ".concat(c.color, "; ");
|
|
6139
6167
|
}
|
|
6140
6168
|
|
|
6141
|
-
if (
|
|
6142
|
-
return "\n <td \n data-row-index='".concat(
|
|
6143
|
-
} else if ((
|
|
6144
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6169
|
+
if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6170
|
+
return "\n <td \n data-row-index='".concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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(_this37.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6171
|
+
} else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6172
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this37.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6145
6173
|
} else {
|
|
6146
6174
|
var info = c.value;
|
|
6147
6175
|
|
|
6148
|
-
if (
|
|
6176
|
+
if (_this37.options.columns[i].showAsImage === true) {
|
|
6149
6177
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6150
6178
|
}
|
|
6151
6179
|
|
|
6152
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6180
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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 ");
|
|
6153
6181
|
}
|
|
6154
6182
|
}
|
|
6155
6183
|
}).join('') + '</tr>';
|
|
@@ -6412,7 +6440,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6412
6440
|
}, {
|
|
6413
6441
|
key: "render",
|
|
6414
6442
|
value: function render(data) {
|
|
6415
|
-
var
|
|
6443
|
+
var _this38 = this;
|
|
6416
6444
|
|
|
6417
6445
|
if (!this.options.columns) {
|
|
6418
6446
|
return;
|
|
@@ -6448,7 +6476,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6448
6476
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6449
6477
|
}
|
|
6450
6478
|
|
|
6451
|
-
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 ?
|
|
6479
|
+
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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6452
6480
|
}
|
|
6453
6481
|
}).join('') + '</tr>';
|
|
6454
6482
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6459,7 +6487,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6459
6487
|
var dropdownHTML = "";
|
|
6460
6488
|
this.options.columns.forEach(function (c, i) {
|
|
6461
6489
|
if (c.searchable && c.searchField) {
|
|
6462
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6490
|
+
dropdownHTML += "\n <div id=\"".concat(_this38.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6463
6491
|
}
|
|
6464
6492
|
});
|
|
6465
6493
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6481,7 +6509,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6481
6509
|
|
|
6482
6510
|
if (pagingEl) {
|
|
6483
6511
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6484
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6512
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6485
6513
|
});
|
|
6486
6514
|
var startIndex = 0;
|
|
6487
6515
|
|
|
@@ -6572,7 +6600,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6572
6600
|
}, {
|
|
6573
6601
|
key: "getColumnParameters",
|
|
6574
6602
|
value: function getColumnParameters(values) {
|
|
6575
|
-
var
|
|
6603
|
+
var _this39 = this;
|
|
6576
6604
|
|
|
6577
6605
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6578
6606
|
tableEl.style.tableLayout = 'auto';
|
|
@@ -6580,10 +6608,10 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6580
6608
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6581
6609
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6582
6610
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6583
|
-
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 ?
|
|
6611
|
+
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 ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6584
6612
|
}).join('') + '</tr>';
|
|
6585
6613
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6586
|
-
return "\n <td \n style='height: ".concat(
|
|
6614
|
+
return "\n <td \n style='height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6587
6615
|
}).join('') + '</tr>'; // get height of the first data cell
|
|
6588
6616
|
|
|
6589
6617
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6711,7 +6739,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6711
6739
|
}, {
|
|
6712
6740
|
key: "buildBodyHtml",
|
|
6713
6741
|
value: function buildBodyHtml() {
|
|
6714
|
-
var
|
|
6742
|
+
var _this40 = this;
|
|
6715
6743
|
|
|
6716
6744
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6717
6745
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -6770,7 +6798,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6770
6798
|
} // console.log('rowspan', cell.rowspan)
|
|
6771
6799
|
|
|
6772
6800
|
|
|
6773
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6801
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.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) {
|
|
6774
6802
|
// bodyHtml += `
|
|
6775
6803
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
6776
6804
|
// width='${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}'
|
|
@@ -6780,11 +6808,11 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6780
6808
|
bodyHtml += "\n ><div style='".concat(divStyle, "'>");
|
|
6781
6809
|
|
|
6782
6810
|
if (cell.expandable === true) {
|
|
6783
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6811
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
|
|
6784
6812
|
}
|
|
6785
6813
|
|
|
6786
6814
|
if (cell.collapsable === true) {
|
|
6787
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6815
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
|
|
6788
6816
|
}
|
|
6789
6817
|
|
|
6790
6818
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
@@ -6809,7 +6837,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6809
6837
|
}, {
|
|
6810
6838
|
key: "buildHeaderHtml",
|
|
6811
6839
|
value: function buildHeaderHtml() {
|
|
6812
|
-
var
|
|
6840
|
+
var _this41 = this;
|
|
6813
6841
|
|
|
6814
6842
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6815
6843
|
var headerHtml = '';
|
|
@@ -6824,7 +6852,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6824
6852
|
}
|
|
6825
6853
|
|
|
6826
6854
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6827
|
-
if (useWidths === false && rowIndex !==
|
|
6855
|
+
if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
|
|
6828
6856
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6829
6857
|
return;
|
|
6830
6858
|
}
|
|
@@ -6850,18 +6878,18 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6850
6878
|
// `
|
|
6851
6879
|
// }
|
|
6852
6880
|
|
|
6853
|
-
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ?
|
|
6881
|
+
headerHtml += "><div style='".concat(divStyle, "'>").concat(col.name).concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "</div></td>");
|
|
6854
6882
|
});
|
|
6855
6883
|
headerHtml += "</tr>";
|
|
6856
6884
|
});
|
|
6857
6885
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6858
6886
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6859
6887
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6860
|
-
var testEl = document.getElementById("".concat(
|
|
6888
|
+
var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6861
6889
|
|
|
6862
6890
|
if (!testEl) {
|
|
6863
6891
|
var newE = document.createElement('div');
|
|
6864
|
-
newE.id = "".concat(
|
|
6892
|
+
newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6865
6893
|
newE.className = 'websy-modal-dropdown';
|
|
6866
6894
|
dropdownEl.appendChild(newE);
|
|
6867
6895
|
}
|
|
@@ -6877,7 +6905,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6877
6905
|
}, {
|
|
6878
6906
|
key: "buildTotalHtml",
|
|
6879
6907
|
value: function buildTotalHtml() {
|
|
6880
|
-
var
|
|
6908
|
+
var _this42 = this;
|
|
6881
6909
|
|
|
6882
6910
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6883
6911
|
|
|
@@ -6890,7 +6918,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6890
6918
|
totalHtml += "<td \n class='websy-table-cell'\n colspan='".concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6891
6919
|
|
|
6892
6920
|
if (useWidths === true) {
|
|
6893
|
-
totalHtml += "\n style='width: ".concat(
|
|
6921
|
+
totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6894
6922
|
}
|
|
6895
6923
|
|
|
6896
6924
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
@@ -6901,7 +6929,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6901
6929
|
}, {
|
|
6902
6930
|
key: "calculateSizes",
|
|
6903
6931
|
value: function calculateSizes() {
|
|
6904
|
-
var
|
|
6932
|
+
var _this43 = this;
|
|
6905
6933
|
|
|
6906
6934
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6907
6935
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -6944,32 +6972,32 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6944
6972
|
rows.forEach(function (row, rowIndex) {
|
|
6945
6973
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6946
6974
|
var colSize = col.getBoundingClientRect();
|
|
6947
|
-
|
|
6975
|
+
_this43.sizes.cellHeight = colSize.height;
|
|
6948
6976
|
|
|
6949
|
-
if (
|
|
6950
|
-
if (!
|
|
6951
|
-
|
|
6977
|
+
if (_this43.options.columns[_this43.options.columns.length - 1][colIndex]) {
|
|
6978
|
+
if (!_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth) {
|
|
6979
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = 0;
|
|
6952
6980
|
}
|
|
6953
6981
|
|
|
6954
|
-
|
|
6955
|
-
|
|
6982
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth = Math.min(Math.max(_this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth, colSize.width), maxWidth);
|
|
6983
|
+
_this43.options.columns[_this43.options.columns.length - 1][colIndex].cellHeight = colSize.height;
|
|
6956
6984
|
|
|
6957
|
-
if (colIndex >=
|
|
6958
|
-
firstNonPinnedColumnWidth =
|
|
6985
|
+
if (colIndex >= _this43.pinnedColumns) {
|
|
6986
|
+
firstNonPinnedColumnWidth = _this43.options.columns[_this43.options.columns.length - 1][colIndex].actualWidth;
|
|
6959
6987
|
}
|
|
6960
6988
|
}
|
|
6961
6989
|
});
|
|
6962
6990
|
});
|
|
6963
6991
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6964
|
-
if (colIndex <
|
|
6965
|
-
|
|
6992
|
+
if (colIndex < _this43.pinnedColumns) {
|
|
6993
|
+
_this43.sizes.scrollableWidth -= col.actualWidth;
|
|
6966
6994
|
}
|
|
6967
6995
|
});
|
|
6968
6996
|
this.sizes.totalWidth = this.options.columns[this.options.columns.length - 1].reduce(function (a, b) {
|
|
6969
6997
|
return a + (b.width || b.actualWidth);
|
|
6970
6998
|
}, 0);
|
|
6971
6999
|
this.sizes.totalNonPinnedWidth = this.options.columns[this.options.columns.length - 1].filter(function (c, i) {
|
|
6972
|
-
return i >=
|
|
7000
|
+
return i >= _this43.pinnedColumns;
|
|
6973
7001
|
}).reduce(function (a, b) {
|
|
6974
7002
|
return a + (b.width || b.actualWidth);
|
|
6975
7003
|
}, 0);
|
|
@@ -6990,10 +7018,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6990
7018
|
c.actualWidth += equalWidth; // }
|
|
6991
7019
|
// }
|
|
6992
7020
|
|
|
6993
|
-
|
|
7021
|
+
_this43.sizes.totalWidth += c.width || c.actualWidth;
|
|
6994
7022
|
|
|
6995
|
-
if (i <
|
|
6996
|
-
|
|
7023
|
+
if (i < _this43.pinnedColumns) {
|
|
7024
|
+
_this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6997
7025
|
} // equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6998
7026
|
|
|
6999
7027
|
});
|
|
@@ -7050,7 +7078,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7050
7078
|
}, {
|
|
7051
7079
|
key: "createSample",
|
|
7052
7080
|
value: function createSample(data) {
|
|
7053
|
-
var
|
|
7081
|
+
var _this44 = this;
|
|
7054
7082
|
|
|
7055
7083
|
var output = [];
|
|
7056
7084
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
@@ -7062,7 +7090,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7062
7090
|
var longest = '';
|
|
7063
7091
|
|
|
7064
7092
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7065
|
-
if (data[i].length ===
|
|
7093
|
+
if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
|
|
7066
7094
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7067
7095
|
longest = data[i][colIndex].value;
|
|
7068
7096
|
}
|
|
@@ -7457,7 +7485,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7457
7485
|
|
|
7458
7486
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7459
7487
|
function WebsyChart(elementId, options) {
|
|
7460
|
-
var
|
|
7488
|
+
var _this45 = this;
|
|
7461
7489
|
|
|
7462
7490
|
_classCallCheck(this, WebsyChart);
|
|
7463
7491
|
|
|
@@ -7508,22 +7536,22 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7508
7536
|
this.invertOverride = function (input, input2) {
|
|
7509
7537
|
var xAxis = 'bottomAxis';
|
|
7510
7538
|
|
|
7511
|
-
if (
|
|
7539
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7512
7540
|
xAxis = 'leftAxis';
|
|
7513
7541
|
}
|
|
7514
7542
|
|
|
7515
|
-
var width =
|
|
7543
|
+
var width = _this45[xAxis].step();
|
|
7516
7544
|
|
|
7517
7545
|
var output;
|
|
7518
7546
|
|
|
7519
|
-
var domain = _toConsumableArray(
|
|
7547
|
+
var domain = _toConsumableArray(_this45[xAxis].domain());
|
|
7520
7548
|
|
|
7521
|
-
if (
|
|
7549
|
+
if (_this45.options.orientation === 'horizontal') {
|
|
7522
7550
|
domain = domain.reverse();
|
|
7523
7551
|
}
|
|
7524
7552
|
|
|
7525
7553
|
for (var j = 0; j < domain.length; j++) {
|
|
7526
|
-
var breakA =
|
|
7554
|
+
var breakA = _this45[xAxis](domain[j]) - width / 2;
|
|
7527
7555
|
var breakB = breakA + width;
|
|
7528
7556
|
|
|
7529
7557
|
if (input > breakA && input <= breakB) {
|
|
@@ -7623,10 +7651,10 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7623
7651
|
}, {
|
|
7624
7652
|
key: "handleEventMouseMove",
|
|
7625
7653
|
value: function handleEventMouseMove(event, d) {
|
|
7626
|
-
var
|
|
7654
|
+
var _this46 = this;
|
|
7627
7655
|
|
|
7628
7656
|
var bisectDate = d3.bisector(function (d) {
|
|
7629
|
-
return
|
|
7657
|
+
return _this46.parseX(d.x.value);
|
|
7630
7658
|
}).left;
|
|
7631
7659
|
|
|
7632
7660
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
@@ -7665,8 +7693,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7665
7693
|
}
|
|
7666
7694
|
|
|
7667
7695
|
this.options.data.series.forEach(function (s) {
|
|
7668
|
-
if (
|
|
7669
|
-
xPoint =
|
|
7696
|
+
if (_this46.options.data[xData].scale !== 'Time') {
|
|
7697
|
+
xPoint = _this46[xAxis](_this46.parseX(xLabel));
|
|
7670
7698
|
s.data.forEach(function (d) {
|
|
7671
7699
|
if (d.x.value === xLabel) {
|
|
7672
7700
|
if (!tooltipTitle) {
|
|
@@ -7685,13 +7713,13 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7685
7713
|
var pointA = s.data[index - 1];
|
|
7686
7714
|
var pointB = s.data[index];
|
|
7687
7715
|
|
|
7688
|
-
if (
|
|
7716
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
7689
7717
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7690
7718
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7691
7719
|
}
|
|
7692
7720
|
|
|
7693
7721
|
if (pointA && !pointB) {
|
|
7694
|
-
xPoint =
|
|
7722
|
+
xPoint = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7695
7723
|
tooltipTitle = pointA.x.value;
|
|
7696
7724
|
|
|
7697
7725
|
if (!pointA.y.color) {
|
|
@@ -7701,12 +7729,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7701
7729
|
tooltipData.push(pointA.y);
|
|
7702
7730
|
|
|
7703
7731
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7704
|
-
tooltipTitle = d3.timeFormat(
|
|
7732
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7705
7733
|
}
|
|
7706
7734
|
}
|
|
7707
7735
|
|
|
7708
7736
|
if (pointB && !pointA) {
|
|
7709
|
-
xPoint =
|
|
7737
|
+
xPoint = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7710
7738
|
tooltipTitle = pointB.x.value;
|
|
7711
7739
|
|
|
7712
7740
|
if (!pointB.y.color) {
|
|
@@ -7716,14 +7744,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7716
7744
|
tooltipData.push(pointB.y);
|
|
7717
7745
|
|
|
7718
7746
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7719
|
-
tooltipTitle = d3.timeFormat(
|
|
7747
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7720
7748
|
}
|
|
7721
7749
|
}
|
|
7722
7750
|
|
|
7723
7751
|
if (pointA && pointB) {
|
|
7724
|
-
var d0 =
|
|
7752
|
+
var d0 = _this46[xAxis](_this46.parseX(pointA.x.value));
|
|
7725
7753
|
|
|
7726
|
-
var d1 =
|
|
7754
|
+
var d1 = _this46[xAxis](_this46.parseX(pointB.x.value));
|
|
7727
7755
|
|
|
7728
7756
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7729
7757
|
|
|
@@ -7732,7 +7760,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7732
7760
|
tooltipTitle = pointB.x.value;
|
|
7733
7761
|
|
|
7734
7762
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7735
|
-
tooltipTitle = d3.timeFormat(
|
|
7763
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7736
7764
|
}
|
|
7737
7765
|
|
|
7738
7766
|
if (!pointB.y.color) {
|
|
@@ -7745,7 +7773,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7745
7773
|
tooltipTitle = pointA.x.value;
|
|
7746
7774
|
|
|
7747
7775
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7748
|
-
tooltipTitle = d3.timeFormat(
|
|
7776
|
+
tooltipTitle = d3.timeFormat(_this46.options.dateFormat || _this46.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7749
7777
|
}
|
|
7750
7778
|
|
|
7751
7779
|
if (!pointA.y.color) {
|
|
@@ -7859,7 +7887,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7859
7887
|
}, {
|
|
7860
7888
|
key: "render",
|
|
7861
7889
|
value: function render(options) {
|
|
7862
|
-
var
|
|
7890
|
+
var _this47 = this;
|
|
7863
7891
|
|
|
7864
7892
|
/* global d3 options WebsyUtils */
|
|
7865
7893
|
if (typeof options !== 'undefined') {
|
|
@@ -7928,7 +7956,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7928
7956
|
var legendData = this.options.data.series.map(function (s, i) {
|
|
7929
7957
|
return {
|
|
7930
7958
|
value: s.label || s.key,
|
|
7931
|
-
color: s.color ||
|
|
7959
|
+
color: s.color || _this47.options.colors[i % _this47.options.colors.length]
|
|
7932
7960
|
};
|
|
7933
7961
|
});
|
|
7934
7962
|
|
|
@@ -8210,7 +8238,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8210
8238
|
|
|
8211
8239
|
if (this.options.data.bottom.formatter) {
|
|
8212
8240
|
bAxisFunc.tickFormat(function (d) {
|
|
8213
|
-
return
|
|
8241
|
+
return _this47.options.data.bottom.formatter(d);
|
|
8214
8242
|
});
|
|
8215
8243
|
}
|
|
8216
8244
|
|
|
@@ -8236,8 +8264,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8236
8264
|
|
|
8237
8265
|
if (this.options.margin.axisLeft > 0) {
|
|
8238
8266
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8239
|
-
if (
|
|
8240
|
-
d =
|
|
8267
|
+
if (_this47.options.data.left.formatter) {
|
|
8268
|
+
d = _this47.options.data.left.formatter(d);
|
|
8241
8269
|
}
|
|
8242
8270
|
|
|
8243
8271
|
return d;
|
|
@@ -8274,8 +8302,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8274
8302
|
|
|
8275
8303
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8276
8304
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8277
|
-
if (
|
|
8278
|
-
d =
|
|
8305
|
+
if (_this47.options.data.right.formatter) {
|
|
8306
|
+
d = _this47.options.data.right.formatter(d);
|
|
8279
8307
|
}
|
|
8280
8308
|
|
|
8281
8309
|
return d;
|
|
@@ -8314,18 +8342,18 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8314
8342
|
this.renderedKeys = {};
|
|
8315
8343
|
this.options.data.series.forEach(function (series, index) {
|
|
8316
8344
|
if (!series.key) {
|
|
8317
|
-
series.key =
|
|
8345
|
+
series.key = _this47.createIdentity();
|
|
8318
8346
|
}
|
|
8319
8347
|
|
|
8320
8348
|
if (!series.color) {
|
|
8321
|
-
series.color =
|
|
8349
|
+
series.color = _this47.options.colors[index % _this47.options.colors.length];
|
|
8322
8350
|
}
|
|
8323
8351
|
|
|
8324
|
-
|
|
8352
|
+
_this47["render".concat(series.type || 'bar')](series, index);
|
|
8325
8353
|
|
|
8326
|
-
|
|
8354
|
+
_this47.renderLabels(series, index);
|
|
8327
8355
|
|
|
8328
|
-
|
|
8356
|
+
_this47.renderedKeys[series.key] = series.type;
|
|
8329
8357
|
});
|
|
8330
8358
|
}
|
|
8331
8359
|
}
|
|
@@ -8333,17 +8361,17 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8333
8361
|
}, {
|
|
8334
8362
|
key: "renderarea",
|
|
8335
8363
|
value: function renderarea(series, index) {
|
|
8336
|
-
var
|
|
8364
|
+
var _this48 = this;
|
|
8337
8365
|
|
|
8338
8366
|
/* global d3 series index */
|
|
8339
8367
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8340
8368
|
return d3.area().x(function (d) {
|
|
8341
|
-
return
|
|
8369
|
+
return _this48[xAxis](_this48.parseX(d.x.value));
|
|
8342
8370
|
}).y0(function (d) {
|
|
8343
|
-
return
|
|
8371
|
+
return _this48[yAxis](0);
|
|
8344
8372
|
}).y1(function (d) {
|
|
8345
|
-
return
|
|
8346
|
-
}).curve(d3[curveStyle ||
|
|
8373
|
+
return _this48[yAxis](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8374
|
+
}).curve(d3[curveStyle || _this48.options.curveStyle]);
|
|
8347
8375
|
};
|
|
8348
8376
|
|
|
8349
8377
|
var xAxis = 'bottomAxis';
|
|
@@ -8472,7 +8500,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8472
8500
|
}, {
|
|
8473
8501
|
key: "renderLabels",
|
|
8474
8502
|
value: function renderLabels(series, index) {
|
|
8475
|
-
var
|
|
8503
|
+
var _this49 = this;
|
|
8476
8504
|
|
|
8477
8505
|
/* global series index d3 WebsyDesigns */
|
|
8478
8506
|
var xAxis = 'bottomAxis';
|
|
@@ -8491,11 +8519,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8491
8519
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8492
8520
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8493
8521
|
labels.attr('x', function (d) {
|
|
8494
|
-
return getLabelX.call(
|
|
8522
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8495
8523
|
}).attr('y', function (d) {
|
|
8496
|
-
return getLabelY.call(
|
|
8524
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8497
8525
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8498
|
-
return
|
|
8526
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8499
8527
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8500
8528
|
return d.y.label || d.y.value;
|
|
8501
8529
|
}).each(function (d, i) {
|
|
@@ -8520,11 +8548,11 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8520
8548
|
}
|
|
8521
8549
|
});
|
|
8522
8550
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8523
|
-
return getLabelX.call(
|
|
8551
|
+
return getLabelX.call(_this49, d, series.labelPosition);
|
|
8524
8552
|
}).attr('y', function (d) {
|
|
8525
|
-
return getLabelY.call(
|
|
8553
|
+
return getLabelY.call(_this49, d, series.labelPosition);
|
|
8526
8554
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8527
|
-
return
|
|
8555
|
+
return _this49.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8528
8556
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8529
8557
|
return d.y.label || d.y.value;
|
|
8530
8558
|
}).each(function (d, i) {
|
|
@@ -8581,16 +8609,16 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8581
8609
|
}, {
|
|
8582
8610
|
key: "renderline",
|
|
8583
8611
|
value: function renderline(series, index) {
|
|
8584
|
-
var
|
|
8612
|
+
var _this50 = this;
|
|
8585
8613
|
|
|
8586
8614
|
/* global series index d3 */
|
|
8587
8615
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8588
8616
|
return d3.line().x(function (d) {
|
|
8589
|
-
var adjustment =
|
|
8590
|
-
return
|
|
8617
|
+
var adjustment = _this50.options.data[xAxis].scale === 'Time' ? 0 : _this50["".concat(xAxis, "Axis")].bandwidth() / 2;
|
|
8618
|
+
return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value)) + adjustment;
|
|
8591
8619
|
}).y(function (d) {
|
|
8592
|
-
return
|
|
8593
|
-
}).curve(d3[curveStyle ||
|
|
8620
|
+
return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8621
|
+
}).curve(d3[curveStyle || _this50.options.curveStyle]);
|
|
8594
8622
|
};
|
|
8595
8623
|
|
|
8596
8624
|
var xAxis = 'bottom';
|
|
@@ -8634,14 +8662,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8634
8662
|
}, {
|
|
8635
8663
|
key: "rendersymbol",
|
|
8636
8664
|
value: function rendersymbol(series, index) {
|
|
8637
|
-
var
|
|
8665
|
+
var _this51 = this;
|
|
8638
8666
|
|
|
8639
8667
|
/* global d3 series index series.key */
|
|
8640
8668
|
var drawSymbol = function drawSymbol(size) {
|
|
8641
8669
|
return d3.symbol() // .type(d => {
|
|
8642
8670
|
// return d3.symbols[0]
|
|
8643
8671
|
// })
|
|
8644
|
-
.size(size ||
|
|
8672
|
+
.size(size || _this51.options.symbolSize);
|
|
8645
8673
|
};
|
|
8646
8674
|
|
|
8647
8675
|
var xAxis = 'bottomAxis';
|
|
@@ -8659,7 +8687,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8659
8687
|
symbols.attr('d', function (d) {
|
|
8660
8688
|
return drawSymbol(d.y.size || series.symbolSize)(d);
|
|
8661
8689
|
}).transition(this.transition).attr('fill', 'white').attr('stroke', series.color).attr('transform', function (d) {
|
|
8662
|
-
return "translate(".concat(
|
|
8690
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8663
8691
|
}); // Enter
|
|
8664
8692
|
|
|
8665
8693
|
symbols.enter().append('path').attr('d', function (d) {
|
|
@@ -8668,7 +8696,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8668
8696
|
.attr('fill', 'white').attr('stroke', series.color).attr('class', function (d) {
|
|
8669
8697
|
return "symbol symbol_".concat(series.key);
|
|
8670
8698
|
}).attr('transform', function (d) {
|
|
8671
|
-
return "translate(".concat(
|
|
8699
|
+
return "translate(".concat(_this51[xAxis](_this51.parseX(d.x.value)), ", ").concat(_this51[yAxis](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8672
8700
|
});
|
|
8673
8701
|
}
|
|
8674
8702
|
}, {
|
|
@@ -8823,7 +8851,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8823
8851
|
}, {
|
|
8824
8852
|
key: "resize",
|
|
8825
8853
|
value: function resize() {
|
|
8826
|
-
var
|
|
8854
|
+
var _this52 = this;
|
|
8827
8855
|
|
|
8828
8856
|
var el = document.getElementById(this.elementId);
|
|
8829
8857
|
|
|
@@ -8836,7 +8864,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8836
8864
|
// }
|
|
8837
8865
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8838
8866
|
html += this._data.map(function (d, i) {
|
|
8839
|
-
return
|
|
8867
|
+
return _this52.getLegendItemHTML(d);
|
|
8840
8868
|
}).join('');
|
|
8841
8869
|
html += "\n <div>\n ";
|
|
8842
8870
|
el.innerHTML = html;
|
|
@@ -9008,7 +9036,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9008
9036
|
}, {
|
|
9009
9037
|
key: "render",
|
|
9010
9038
|
value: function render() {
|
|
9011
|
-
var
|
|
9039
|
+
var _this53 = this;
|
|
9012
9040
|
|
|
9013
9041
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9014
9042
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9017,7 +9045,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9017
9045
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9018
9046
|
return {
|
|
9019
9047
|
value: s.label || s.key,
|
|
9020
|
-
color: s.color ||
|
|
9048
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
9021
9049
|
};
|
|
9022
9050
|
});
|
|
9023
9051
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9081,7 +9109,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9081
9109
|
|
|
9082
9110
|
if (this.polygons) {
|
|
9083
9111
|
this.polygons.forEach(function (p) {
|
|
9084
|
-
return
|
|
9112
|
+
return _this53.map.removeLayer(p);
|
|
9085
9113
|
});
|
|
9086
9114
|
}
|
|
9087
9115
|
|
|
@@ -9139,18 +9167,18 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9139
9167
|
}
|
|
9140
9168
|
|
|
9141
9169
|
if (!p.options.color) {
|
|
9142
|
-
p.options.color =
|
|
9170
|
+
p.options.color = _this53.options.colors[i % _this53.options.colors.length];
|
|
9143
9171
|
}
|
|
9144
9172
|
|
|
9145
9173
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9146
9174
|
return c.map(function (d) {
|
|
9147
9175
|
return [d.Latitude, d.Longitude];
|
|
9148
9176
|
});
|
|
9149
|
-
}), p.options).addTo(
|
|
9177
|
+
}), p.options).addTo(_this53.map);
|
|
9150
9178
|
|
|
9151
|
-
|
|
9179
|
+
_this53.polygons.push(pol);
|
|
9152
9180
|
|
|
9153
|
-
|
|
9181
|
+
_this53.map.fitBounds(pol.getBounds());
|
|
9154
9182
|
});
|
|
9155
9183
|
} // if (this.data.markers.length > 0) {
|
|
9156
9184
|
// el.classList.remove('hidden')
|
|
@@ -9330,7 +9358,7 @@ function recaptchaReadyCallBack() {
|
|
|
9330
9358
|
|
|
9331
9359
|
function useGoogleRecaptcha(key) {
|
|
9332
9360
|
var rcs = document.createElement('script');
|
|
9333
|
-
rcs.src = "//www.google.com/recaptcha/api.js
|
|
9361
|
+
rcs.src = "//www.google.com/recaptcha/api.js";
|
|
9334
9362
|
document.body.appendChild(rcs);
|
|
9335
9363
|
}
|
|
9336
9364
|
|