@websy/websy-designs 1.11.15 → 1.11.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/websy-designs.js
CHANGED
|
@@ -2427,23 +2427,30 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2427
2427
|
}, {
|
|
2428
2428
|
key: "clear",
|
|
2429
2429
|
value: function clear() {
|
|
2430
|
+
var _this16 = this;
|
|
2430
2431
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2431
2432
|
formEl.reset();
|
|
2433
|
+
if (!this.options.fields) {
|
|
2434
|
+
this.options.fields = [];
|
|
2435
|
+
}
|
|
2436
|
+
this.options.fields.forEach(function (f) {
|
|
2437
|
+
_this16.setValue(f.field, '');
|
|
2438
|
+
});
|
|
2432
2439
|
this.loader.hide();
|
|
2433
2440
|
}
|
|
2434
2441
|
}, {
|
|
2435
2442
|
key: "data",
|
|
2436
2443
|
get: function get() {
|
|
2437
|
-
var
|
|
2444
|
+
var _this17 = this;
|
|
2438
2445
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2439
2446
|
var data = {};
|
|
2440
2447
|
var temp = new FormData(formEl);
|
|
2441
2448
|
temp.forEach(function (value, key) {
|
|
2442
|
-
if (
|
|
2449
|
+
if (_this17.fieldMap[key] && _this17.fieldMap[key].type === 'checkbox') {
|
|
2443
2450
|
data[key] = true;
|
|
2444
2451
|
}
|
|
2445
|
-
if (
|
|
2446
|
-
data[key] =
|
|
2452
|
+
if (_this17.fieldMap[key] && _this17.fieldMap[key].instance && _this17.fieldMap[key].instance.value) {
|
|
2453
|
+
data[key] = _this17.fieldMap[key].instance.value;
|
|
2447
2454
|
} else {
|
|
2448
2455
|
data[key] = value;
|
|
2449
2456
|
}
|
|
@@ -2463,14 +2470,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2463
2470
|
return data;
|
|
2464
2471
|
},
|
|
2465
2472
|
set: function set(d) {
|
|
2466
|
-
var
|
|
2473
|
+
var _this18 = this;
|
|
2467
2474
|
if (!this.options.fields) {
|
|
2468
2475
|
this.options.fields = [];
|
|
2469
2476
|
}
|
|
2470
2477
|
var _loop = function _loop(key) {
|
|
2471
|
-
|
|
2478
|
+
_this18.options.fields.forEach(function (f) {
|
|
2472
2479
|
if (f.field === key) {
|
|
2473
|
-
|
|
2480
|
+
_this18.setValue(key, d[key]);
|
|
2474
2481
|
// f.value = d[key]
|
|
2475
2482
|
// const el = document.getElementById(`${this.elementId}_input_${f.field}`)
|
|
2476
2483
|
// if (el) {
|
|
@@ -2671,7 +2678,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2671
2678
|
}, {
|
|
2672
2679
|
key: "processComponents",
|
|
2673
2680
|
value: function processComponents(components, callbackFn) {
|
|
2674
|
-
var
|
|
2681
|
+
var _this19 = this;
|
|
2675
2682
|
if (components.length === 0) {
|
|
2676
2683
|
callbackFn();
|
|
2677
2684
|
} else {
|
|
@@ -2680,11 +2687,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2680
2687
|
if (!c.options.onChange) {
|
|
2681
2688
|
c.options.onChange = function () {
|
|
2682
2689
|
if (c.required || c.validate) {
|
|
2683
|
-
|
|
2690
|
+
_this19.validateField(c, c.instance.value);
|
|
2684
2691
|
}
|
|
2685
2692
|
};
|
|
2686
2693
|
}
|
|
2687
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2694
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this19.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2688
2695
|
} else {
|
|
2689
2696
|
// some user feedback here
|
|
2690
2697
|
}
|
|
@@ -2694,13 +2701,13 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2694
2701
|
}, {
|
|
2695
2702
|
key: "recaptchaReady",
|
|
2696
2703
|
value: function recaptchaReady() {
|
|
2697
|
-
var
|
|
2704
|
+
var _this20 = this;
|
|
2698
2705
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2699
2706
|
if (el) {
|
|
2700
2707
|
grecaptcha.ready(function () {
|
|
2701
|
-
grecaptcha.render("".concat(
|
|
2708
|
+
grecaptcha.render("".concat(_this20.elementId, "_recaptcha"), {
|
|
2702
2709
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2703
|
-
callback:
|
|
2710
|
+
callback: _this20.validateRecaptcha.bind(_this20)
|
|
2704
2711
|
});
|
|
2705
2712
|
});
|
|
2706
2713
|
}
|
|
@@ -2708,16 +2715,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2708
2715
|
}, {
|
|
2709
2716
|
key: "render",
|
|
2710
2717
|
value: function render(update, data) {
|
|
2711
|
-
var
|
|
2718
|
+
var _this21 = this;
|
|
2712
2719
|
var el = document.getElementById(this.elementId);
|
|
2713
2720
|
var componentsToProcess = [];
|
|
2714
2721
|
if (el) {
|
|
2715
2722
|
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
|
|
2716
2723
|
this.options.fields.forEach(function (f, i) {
|
|
2717
|
-
|
|
2718
|
-
f.owningElement =
|
|
2724
|
+
_this21.fieldMap[f.field] = f;
|
|
2725
|
+
f.owningElement = _this21.elementId;
|
|
2719
2726
|
var inputValue = typeof f.value === 'function' ? f.value() : f.value;
|
|
2720
|
-
if (f.disabled || f.readOnly ||
|
|
2727
|
+
if (f.disabled || f.readOnly || _this21.options.readOnly) {
|
|
2721
2728
|
if (!f.options) {
|
|
2722
2729
|
f.options = {};
|
|
2723
2730
|
}
|
|
@@ -2731,18 +2738,18 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2731
2738
|
}
|
|
2732
2739
|
f.classes.push('disabled');
|
|
2733
2740
|
f.options.classes.push('disabled');
|
|
2734
|
-
if (f.readOnly ||
|
|
2741
|
+
if (f.readOnly || _this21.options.readOnly) {
|
|
2735
2742
|
f.classes.push('websy-input-readonly');
|
|
2736
2743
|
f.options.classes.push('websy-input-readonly');
|
|
2737
2744
|
}
|
|
2738
2745
|
}
|
|
2739
2746
|
if (f.component) {
|
|
2740
2747
|
componentsToProcess.push(f);
|
|
2741
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2748
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this21.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', " ").concat(f.component === 'MediaUpload' ? 'media-upload' : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this21.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this21.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2742
2749
|
} else if (f.type === 'longtext') {
|
|
2743
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2750
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this21.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this21.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat(f.disabled || f.readOnly || _this21.options.readOnly ? 'disabled' : '', "\n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea ").concat(f.readOnly || _this21.options.readOnly ? 'websy-input-readonly' : '', "\"\n >").concat(inputValue || '', "</textarea>\n <span id='").concat(_this21.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2744
2751
|
} else {
|
|
2745
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2752
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this21.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this21.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input ").concat(f.readOnly || _this21.options.readOnly ? 'websy-input-readonly' : '', "\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.type === 'date' ? '' : inputValue || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? inputValue : '', "\"\n ").concat(f.disabled || f.readOnly || _this21.options.readOnly ? 'disabled' : '', "\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this21.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2746
2753
|
}
|
|
2747
2754
|
});
|
|
2748
2755
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2764,8 +2771,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2764
2771
|
});
|
|
2765
2772
|
}
|
|
2766
2773
|
this.processComponents(componentsToProcess, function () {
|
|
2767
|
-
if ((
|
|
2768
|
-
|
|
2774
|
+
if ((_this21.options.useRecaptcha === true || _this21.options.useRecaptchaV3 === true) && typeof grecaptcha !== 'undefined') {
|
|
2775
|
+
_this21.recaptchaReady();
|
|
2769
2776
|
}
|
|
2770
2777
|
});
|
|
2771
2778
|
}
|
|
@@ -2798,7 +2805,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2798
2805
|
}, {
|
|
2799
2806
|
key: "submitForm",
|
|
2800
2807
|
value: function submitForm() {
|
|
2801
|
-
var
|
|
2808
|
+
var _this22 = this;
|
|
2802
2809
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2803
2810
|
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2804
2811
|
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
@@ -2817,8 +2824,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2817
2824
|
if (recaptchErrEl) {
|
|
2818
2825
|
recaptchErrEl.classList.add('websy-hidden');
|
|
2819
2826
|
}
|
|
2820
|
-
if (
|
|
2821
|
-
|
|
2827
|
+
if (_this22.options.useLoader) {
|
|
2828
|
+
_this22.loader.show();
|
|
2822
2829
|
}
|
|
2823
2830
|
var formData = new FormData(formEl);
|
|
2824
2831
|
var data = {};
|
|
@@ -2826,33 +2833,33 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2826
2833
|
temp.forEach(function (value, key) {
|
|
2827
2834
|
data[key] = value;
|
|
2828
2835
|
});
|
|
2829
|
-
if (
|
|
2830
|
-
var
|
|
2831
|
-
var params = [
|
|
2832
|
-
if (
|
|
2833
|
-
params.push(
|
|
2836
|
+
if (_this22.options.url) {
|
|
2837
|
+
var _this22$apiService;
|
|
2838
|
+
var params = [_this22.options.url];
|
|
2839
|
+
if (_this22.options.mode === 'update') {
|
|
2840
|
+
params.push(_this22.options.id);
|
|
2834
2841
|
}
|
|
2835
2842
|
params.push(data);
|
|
2836
|
-
(
|
|
2837
|
-
if (
|
|
2843
|
+
(_this22$apiService = _this22.apiService)[_this22.options.mode].apply(_this22$apiService, params).then(function (result) {
|
|
2844
|
+
if (_this22.options.clearAfterSave === true) {
|
|
2838
2845
|
// this.render()
|
|
2839
2846
|
formEl.reset();
|
|
2840
2847
|
}
|
|
2841
2848
|
buttonEl.removeAttribute('disabled');
|
|
2842
|
-
|
|
2849
|
+
_this22.options.onSuccess.call(_this22, result);
|
|
2843
2850
|
}, function (err) {
|
|
2844
2851
|
console.log('Error submitting form data:', err);
|
|
2845
|
-
|
|
2852
|
+
_this22.options.onError.call(_this22, err);
|
|
2846
2853
|
});
|
|
2847
|
-
} else if (
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
if (
|
|
2854
|
+
} else if (_this22.options.submitFn) {
|
|
2855
|
+
_this22.options.submitFn(data, function () {
|
|
2856
|
+
_this22.loader.hide();
|
|
2857
|
+
if (_this22.options.clearAfterSave === true) {
|
|
2851
2858
|
// this.render()
|
|
2852
2859
|
formEl.reset();
|
|
2853
2860
|
}
|
|
2854
2861
|
}, function () {
|
|
2855
|
-
|
|
2862
|
+
_this22.loader.hide();
|
|
2856
2863
|
});
|
|
2857
2864
|
}
|
|
2858
2865
|
} else {
|
|
@@ -2862,8 +2869,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2862
2869
|
if (recaptchErrEl) {
|
|
2863
2870
|
recaptchErrEl.classList.remove('websy-hidden');
|
|
2864
2871
|
}
|
|
2865
|
-
if (
|
|
2866
|
-
|
|
2872
|
+
if (_this22.options.submitErr) {
|
|
2873
|
+
_this22.options.submitErr();
|
|
2867
2874
|
}
|
|
2868
2875
|
}
|
|
2869
2876
|
});
|
|
@@ -3017,9 +3024,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3017
3024
|
}, {
|
|
3018
3025
|
key: "deleted",
|
|
3019
3026
|
get: function get() {
|
|
3020
|
-
var
|
|
3027
|
+
var _this23 = this;
|
|
3021
3028
|
return this.formData.filter(function (d) {
|
|
3022
|
-
return
|
|
3029
|
+
return _this23.recordsToDelete.includes("".concat(d.id));
|
|
3023
3030
|
});
|
|
3024
3031
|
}
|
|
3025
3032
|
}, {
|
|
@@ -3060,7 +3067,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3060
3067
|
}, {
|
|
3061
3068
|
key: "render",
|
|
3062
3069
|
value: function render() {
|
|
3063
|
-
var
|
|
3070
|
+
var _this24 = this;
|
|
3064
3071
|
this.forms = [];
|
|
3065
3072
|
this.recordsToDelete = [];
|
|
3066
3073
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -3068,9 +3075,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3068
3075
|
var html = '';
|
|
3069
3076
|
this.formData.forEach(function (d) {
|
|
3070
3077
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
3071
|
-
html += "\n <div id='".concat(
|
|
3072
|
-
if (
|
|
3073
|
-
html += "\n <button id='".concat(
|
|
3078
|
+
html += "\n <div id='".concat(_this24.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this24.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
3079
|
+
if (_this24.options.allowDelete === true && !_this24.options.readOnly) {
|
|
3080
|
+
html += "\n <button id='".concat(_this24.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this24.options.deleteIcon).concat(_this24.options.deleteLabel, "\n </button>\n ");
|
|
3074
3081
|
}
|
|
3075
3082
|
html += "\n </div>\n ";
|
|
3076
3083
|
});
|
|
@@ -3078,14 +3085,14 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3078
3085
|
el.innerHTML = html;
|
|
3079
3086
|
this.forms = new Array(this.formData.length);
|
|
3080
3087
|
this.formData.forEach(function (d, i) {
|
|
3081
|
-
var formOptions = _extends({},
|
|
3082
|
-
fields: _toConsumableArray(
|
|
3088
|
+
var formOptions = _extends({}, _this24.options, {
|
|
3089
|
+
fields: _toConsumableArray(_this24.options.fields.map(function (f) {
|
|
3083
3090
|
return _extends({}, f);
|
|
3084
3091
|
}))
|
|
3085
3092
|
});
|
|
3086
|
-
var formObject = new WebsyDesigns.Form("".concat(
|
|
3093
|
+
var formObject = new WebsyDesigns.Form("".concat(_this24.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
3087
3094
|
formObject.data = d;
|
|
3088
|
-
|
|
3095
|
+
_this24.forms[i] = formObject;
|
|
3089
3096
|
});
|
|
3090
3097
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
3091
3098
|
if (addEl) {
|
|
@@ -3381,7 +3388,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3381
3388
|
}, {
|
|
3382
3389
|
key: "handleSearch",
|
|
3383
3390
|
value: function handleSearch(searchText) {
|
|
3384
|
-
var
|
|
3391
|
+
var _this25 = this;
|
|
3385
3392
|
var el = document.getElementById(this.elementId);
|
|
3386
3393
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3387
3394
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -3392,7 +3399,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3392
3399
|
if (searchText && searchText.length > 1) {
|
|
3393
3400
|
defaultMethod = 'add';
|
|
3394
3401
|
visibleItems = lowestItems.filter(function (d) {
|
|
3395
|
-
return d[
|
|
3402
|
+
return d[_this25.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3396
3403
|
});
|
|
3397
3404
|
}
|
|
3398
3405
|
// hide everything
|
|
@@ -3643,7 +3650,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3643
3650
|
}, {
|
|
3644
3651
|
key: "handleChange",
|
|
3645
3652
|
value: function handleChange(event) {
|
|
3646
|
-
var
|
|
3653
|
+
var _this26 = this;
|
|
3647
3654
|
this.fileList = [];
|
|
3648
3655
|
var uploadForm = document.getElementById("".concat(this.elementId, "_form"));
|
|
3649
3656
|
if (!uploadForm) {
|
|
@@ -3656,8 +3663,8 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3656
3663
|
var formData = new FormData(uploadForm);
|
|
3657
3664
|
var html = this.createHtml(formData.length);
|
|
3658
3665
|
formData.forEach(function (value, key) {
|
|
3659
|
-
if (key === (
|
|
3660
|
-
|
|
3666
|
+
if (key === (_this26.options.name || 'media')) {
|
|
3667
|
+
_this26.fileList.push({
|
|
3661
3668
|
name: key,
|
|
3662
3669
|
file: value
|
|
3663
3670
|
});
|
|
@@ -3670,12 +3677,12 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3670
3677
|
}, {
|
|
3671
3678
|
key: "render",
|
|
3672
3679
|
value: function render() {
|
|
3673
|
-
var
|
|
3680
|
+
var _this27 = this;
|
|
3674
3681
|
if (this.media.length > 0) {
|
|
3675
3682
|
var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
|
|
3676
3683
|
resultEl.innerHTML = this.createHtml(this.media.length);
|
|
3677
3684
|
this.media.forEach(function (m, i) {
|
|
3678
|
-
var imgEl = document.getElementById("".concat(
|
|
3685
|
+
var imgEl = document.getElementById("".concat(_this27.elementId, "_media_").concat(i));
|
|
3679
3686
|
imgEl.setAttribute('src', "data:".concat(m.type, ";base64,") + m.data);
|
|
3680
3687
|
});
|
|
3681
3688
|
}
|
|
@@ -3683,7 +3690,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3683
3690
|
}, {
|
|
3684
3691
|
key: "uploadItem",
|
|
3685
3692
|
value: function uploadItem(index, items, callbackFn) {
|
|
3686
|
-
var
|
|
3693
|
+
var _this28 = this;
|
|
3687
3694
|
if (!items[index]) {
|
|
3688
3695
|
callbackFn();
|
|
3689
3696
|
} else {
|
|
@@ -3702,19 +3709,19 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3702
3709
|
img.onload = function () {
|
|
3703
3710
|
var width = img.width;
|
|
3704
3711
|
var height = img.height;
|
|
3705
|
-
if (
|
|
3712
|
+
if (_this28.options.resize === true && _this28.options.imgSize) {
|
|
3706
3713
|
var _ratio = 1;
|
|
3707
3714
|
if (width > height) {
|
|
3708
3715
|
_ratio = width / height;
|
|
3709
|
-
width =
|
|
3710
|
-
height =
|
|
3716
|
+
width = _this28.options.imgSize;
|
|
3717
|
+
height = _this28.options.imgSize / _ratio;
|
|
3711
3718
|
} else if (height > width) {
|
|
3712
3719
|
_ratio = height / width;
|
|
3713
|
-
width =
|
|
3714
|
-
height =
|
|
3720
|
+
width = _this28.options.imgSize / _ratio;
|
|
3721
|
+
height = _this28.options.imgSize;
|
|
3715
3722
|
}
|
|
3716
3723
|
}
|
|
3717
|
-
var fullResEl = document.getElementById("".concat(
|
|
3724
|
+
var fullResEl = document.getElementById("".concat(_this28.elementId, "_media_").concat(index, "_fullres"));
|
|
3718
3725
|
if (fullResEl) {
|
|
3719
3726
|
fullResEl.innerHTML = "".concat(width, " x ").concat(height);
|
|
3720
3727
|
}
|
|
@@ -3724,12 +3731,12 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3724
3731
|
var ratio = 1;
|
|
3725
3732
|
if (width > height) {
|
|
3726
3733
|
ratio = width / height;
|
|
3727
|
-
thumbCanvas.width =
|
|
3728
|
-
thumbCanvas.height =
|
|
3734
|
+
thumbCanvas.width = _this28.options.thumbSize;
|
|
3735
|
+
thumbCanvas.height = _this28.options.thumbSize / ratio;
|
|
3729
3736
|
} else if (height > width) {
|
|
3730
3737
|
ratio = height / width;
|
|
3731
|
-
thumbCanvas.width =
|
|
3732
|
-
thumbCanvas.height =
|
|
3738
|
+
thumbCanvas.width = _this28.options.thumbSize / ratio;
|
|
3739
|
+
thumbCanvas.height = _this28.options.thumbSize;
|
|
3733
3740
|
}
|
|
3734
3741
|
thumbContext.drawImage(img, 0, 0, thumbCanvas.width, thumbCanvas.height);
|
|
3735
3742
|
mediaData.name = items[index].name;
|
|
@@ -3739,10 +3746,10 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3739
3746
|
mediaData.thumbHeight = thumbCanvas.height;
|
|
3740
3747
|
mediaData.data = imgCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3741
3748
|
mediaData.thumbData = thumbCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3742
|
-
|
|
3743
|
-
var imgEl = document.getElementById("".concat(
|
|
3749
|
+
_this28.media.push(mediaData);
|
|
3750
|
+
var imgEl = document.getElementById("".concat(_this28.elementId, "_media_").concat(index));
|
|
3744
3751
|
imgEl.setAttribute('src', imgCanvas.toDataURL(mediaData.type));
|
|
3745
|
-
|
|
3752
|
+
_this28.uploadItem(++index, items, callbackFn);
|
|
3746
3753
|
};
|
|
3747
3754
|
img.src = r.result;
|
|
3748
3755
|
};
|
|
@@ -3755,7 +3762,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3755
3762
|
/* global WebsyDesigns */
|
|
3756
3763
|
var Pager = /*#__PURE__*/function () {
|
|
3757
3764
|
function Pager(elementId, options) {
|
|
3758
|
-
var
|
|
3765
|
+
var _this29 = this;
|
|
3759
3766
|
_classCallCheck(this, Pager);
|
|
3760
3767
|
this.elementId = elementId;
|
|
3761
3768
|
var DEFAULTS = {
|
|
@@ -3802,8 +3809,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3802
3809
|
allowClear: false,
|
|
3803
3810
|
disableSearch: true,
|
|
3804
3811
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3805
|
-
if (
|
|
3806
|
-
|
|
3812
|
+
if (_this29.options.onChangePageSize) {
|
|
3813
|
+
_this29.options.onChangePageSize(selectedItem.value);
|
|
3807
3814
|
}
|
|
3808
3815
|
}
|
|
3809
3816
|
});
|
|
@@ -3824,11 +3831,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3824
3831
|
}, {
|
|
3825
3832
|
key: "render",
|
|
3826
3833
|
value: function render() {
|
|
3827
|
-
var
|
|
3834
|
+
var _this30 = this;
|
|
3828
3835
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3829
3836
|
if (el) {
|
|
3830
3837
|
var pages = this.options.pages.map(function (item, index) {
|
|
3831
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3838
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this30.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3832
3839
|
});
|
|
3833
3840
|
var startIndex = 0;
|
|
3834
3841
|
if (this.options.pages.length > 8) {
|
|
@@ -3890,50 +3897,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3890
3897
|
_createClass(WebsyPDFButton, [{
|
|
3891
3898
|
key: "handleClick",
|
|
3892
3899
|
value: function handleClick(event) {
|
|
3893
|
-
var
|
|
3900
|
+
var _this31 = this;
|
|
3894
3901
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3895
3902
|
this.loader.show();
|
|
3896
3903
|
this.options.preProcess(function (proceed) {
|
|
3897
3904
|
if (proceed === true) {
|
|
3898
3905
|
setTimeout(function () {
|
|
3899
|
-
if (
|
|
3900
|
-
var el = document.getElementById(
|
|
3906
|
+
if (_this31.options.targetId) {
|
|
3907
|
+
var el = document.getElementById(_this31.options.targetId);
|
|
3901
3908
|
if (el) {
|
|
3902
3909
|
var pdfData = {
|
|
3903
3910
|
options: {}
|
|
3904
3911
|
};
|
|
3905
|
-
if (
|
|
3906
|
-
pdfData.options = _extends({},
|
|
3912
|
+
if (_this31.options.pdfOptions) {
|
|
3913
|
+
pdfData.options = _extends({}, _this31.options.pdfOptions);
|
|
3907
3914
|
}
|
|
3908
|
-
if (
|
|
3909
|
-
if (
|
|
3910
|
-
var headerEl = document.getElementById(
|
|
3915
|
+
if (_this31.options.header) {
|
|
3916
|
+
if (_this31.options.header.elementId) {
|
|
3917
|
+
var headerEl = document.getElementById(_this31.options.header.elementId);
|
|
3911
3918
|
if (headerEl) {
|
|
3912
3919
|
pdfData.header = headerEl.outerHTML;
|
|
3913
|
-
if (
|
|
3914
|
-
pdfData.options.headerCSS =
|
|
3920
|
+
if (_this31.options.header.css) {
|
|
3921
|
+
pdfData.options.headerCSS = _this31.options.header.css;
|
|
3915
3922
|
}
|
|
3916
3923
|
}
|
|
3917
|
-
} else if (
|
|
3918
|
-
pdfData.header =
|
|
3919
|
-
if (
|
|
3920
|
-
pdfData.options.headerCSS =
|
|
3924
|
+
} else if (_this31.options.header.html) {
|
|
3925
|
+
pdfData.header = _this31.options.header.html;
|
|
3926
|
+
if (_this31.options.header.css) {
|
|
3927
|
+
pdfData.options.headerCSS = _this31.options.header.css;
|
|
3921
3928
|
}
|
|
3922
3929
|
} else {
|
|
3923
|
-
pdfData.header =
|
|
3930
|
+
pdfData.header = _this31.options.header;
|
|
3924
3931
|
}
|
|
3925
3932
|
}
|
|
3926
|
-
if (
|
|
3927
|
-
if (
|
|
3928
|
-
var footerEl = document.getElementById(
|
|
3933
|
+
if (_this31.options.footer) {
|
|
3934
|
+
if (_this31.options.footer.elementId) {
|
|
3935
|
+
var footerEl = document.getElementById(_this31.options.footer.elementId);
|
|
3929
3936
|
if (footerEl) {
|
|
3930
3937
|
pdfData.footer = footerEl.outerHTML;
|
|
3931
|
-
if (
|
|
3932
|
-
pdfData.options.footerCSS =
|
|
3938
|
+
if (_this31.options.footer.css) {
|
|
3939
|
+
pdfData.options.footerCSS = _this31.options.footer.css;
|
|
3933
3940
|
}
|
|
3934
3941
|
}
|
|
3935
3942
|
} else {
|
|
3936
|
-
pdfData.footer =
|
|
3943
|
+
pdfData.footer = _this31.options.footer;
|
|
3937
3944
|
}
|
|
3938
3945
|
}
|
|
3939
3946
|
pdfData.html = el.outerHTML;
|
|
@@ -3941,25 +3948,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3941
3948
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3942
3949
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3943
3950
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3944
|
-
|
|
3951
|
+
_this31.service.add('', pdfData, {
|
|
3945
3952
|
responseType: 'blob'
|
|
3946
3953
|
}).then(function (response) {
|
|
3947
|
-
|
|
3954
|
+
_this31.loader.hide();
|
|
3948
3955
|
var blob = new Blob([response], {
|
|
3949
3956
|
type: 'application/pdf'
|
|
3950
3957
|
});
|
|
3951
3958
|
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 ");
|
|
3952
|
-
if (
|
|
3959
|
+
if (_this31.options.directDownload === true) {
|
|
3953
3960
|
var fileName;
|
|
3954
|
-
if (typeof
|
|
3955
|
-
fileName =
|
|
3961
|
+
if (typeof _this31.options.fileName === 'function') {
|
|
3962
|
+
fileName = _this31.options.fileName() || 'Export';
|
|
3956
3963
|
} else {
|
|
3957
|
-
fileName =
|
|
3964
|
+
fileName = _this31.options.fileName || 'Export';
|
|
3958
3965
|
}
|
|
3959
3966
|
msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
|
|
3960
3967
|
}
|
|
3961
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3962
|
-
|
|
3968
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this31.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3969
|
+
_this31.popup.show({
|
|
3963
3970
|
message: msg,
|
|
3964
3971
|
mask: true
|
|
3965
3972
|
});
|
|
@@ -3968,10 +3975,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3968
3975
|
});
|
|
3969
3976
|
}
|
|
3970
3977
|
}
|
|
3971
|
-
},
|
|
3978
|
+
}, _this31.options.wait);
|
|
3972
3979
|
} else {
|
|
3973
|
-
|
|
3974
|
-
|
|
3980
|
+
_this31.loader.hide();
|
|
3981
|
+
_this31.options.onError();
|
|
3975
3982
|
}
|
|
3976
3983
|
});
|
|
3977
3984
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -4141,7 +4148,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
4141
4148
|
}();
|
|
4142
4149
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
4143
4150
|
function ResponsiveText(elementId, options) {
|
|
4144
|
-
var
|
|
4151
|
+
var _this32 = this;
|
|
4145
4152
|
_classCallCheck(this, ResponsiveText);
|
|
4146
4153
|
var DEFAULTS = {
|
|
4147
4154
|
textAlign: 'center',
|
|
@@ -4152,7 +4159,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4152
4159
|
this.elementId = elementId;
|
|
4153
4160
|
this.canvas = document.createElement('canvas');
|
|
4154
4161
|
window.addEventListener('resize', function () {
|
|
4155
|
-
return
|
|
4162
|
+
return _this32.render();
|
|
4156
4163
|
});
|
|
4157
4164
|
var el = document.getElementById(this.elementId);
|
|
4158
4165
|
if (el) {
|
|
@@ -4342,7 +4349,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4342
4349
|
/* global WebsyDesigns */
|
|
4343
4350
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
4344
4351
|
function WebsyResultList(elementId, options) {
|
|
4345
|
-
var
|
|
4352
|
+
var _this33 = this;
|
|
4346
4353
|
_classCallCheck(this, WebsyResultList);
|
|
4347
4354
|
var DEFAULTS = {
|
|
4348
4355
|
listeners: {
|
|
@@ -4368,8 +4375,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4368
4375
|
}
|
|
4369
4376
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4370
4377
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4371
|
-
|
|
4372
|
-
|
|
4378
|
+
_this33.options.template = templateString;
|
|
4379
|
+
_this33.render();
|
|
4373
4380
|
});
|
|
4374
4381
|
} else {
|
|
4375
4382
|
this.render();
|
|
@@ -4391,7 +4398,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4391
4398
|
}, {
|
|
4392
4399
|
key: "buildHTML",
|
|
4393
4400
|
value: function buildHTML() {
|
|
4394
|
-
var
|
|
4401
|
+
var _this34 = this;
|
|
4395
4402
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4396
4403
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4397
4404
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -4400,7 +4407,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4400
4407
|
if (this.options.template) {
|
|
4401
4408
|
if (d.length > 0) {
|
|
4402
4409
|
d.forEach(function (row, ix) {
|
|
4403
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4410
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this34.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
4404
4411
|
// find conditional elements
|
|
4405
4412
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4406
4413
|
ifMatches.forEach(function (m) {
|
|
@@ -4488,7 +4495,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4488
4495
|
parts.forEach(function (p) {
|
|
4489
4496
|
items = items[p];
|
|
4490
4497
|
});
|
|
4491
|
-
template = template.replace(m[0],
|
|
4498
|
+
template = template.replace(m[0], _this34.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4492
4499
|
}
|
|
4493
4500
|
});
|
|
4494
4501
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4497,7 +4504,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4497
4504
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4498
4505
|
}
|
|
4499
4506
|
});
|
|
4500
|
-
var flatRow =
|
|
4507
|
+
var flatRow = _this34.flattenObject(row);
|
|
4501
4508
|
for (var key in flatRow) {
|
|
4502
4509
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4503
4510
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4622,15 +4629,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4622
4629
|
}, {
|
|
4623
4630
|
key: "render",
|
|
4624
4631
|
value: function render() {
|
|
4625
|
-
var
|
|
4632
|
+
var _this35 = this;
|
|
4626
4633
|
if (this.options.entity) {
|
|
4627
4634
|
var url = this.options.entity;
|
|
4628
4635
|
if (this.options.sortField) {
|
|
4629
4636
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4630
4637
|
}
|
|
4631
4638
|
this.apiService.get(url).then(function (results) {
|
|
4632
|
-
|
|
4633
|
-
|
|
4639
|
+
_this35.rows = results.rows;
|
|
4640
|
+
_this35.resize();
|
|
4634
4641
|
});
|
|
4635
4642
|
} else {
|
|
4636
4643
|
this.resize();
|
|
@@ -4709,12 +4716,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4709
4716
|
_createClass(WebsyRouter, [{
|
|
4710
4717
|
key: "addGroup",
|
|
4711
4718
|
value: function addGroup(group) {
|
|
4712
|
-
var
|
|
4719
|
+
var _this36 = this;
|
|
4713
4720
|
if (!this.groups[group]) {
|
|
4714
4721
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4715
4722
|
if (els) {
|
|
4716
4723
|
this.getClosestParent(els[0], function (parent) {
|
|
4717
|
-
|
|
4724
|
+
_this36.groups[group] = {
|
|
4718
4725
|
activeView: '',
|
|
4719
4726
|
views: [],
|
|
4720
4727
|
parent: parent.getAttribute('data-view')
|
|
@@ -4778,7 +4785,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4778
4785
|
}, {
|
|
4779
4786
|
key: "removeUrlParams",
|
|
4780
4787
|
value: function removeUrlParams() {
|
|
4781
|
-
var
|
|
4788
|
+
var _this37 = this;
|
|
4782
4789
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4783
4790
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4784
4791
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4786,7 +4793,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4786
4793
|
var path = '';
|
|
4787
4794
|
if (this.currentParams && this.currentParams.items) {
|
|
4788
4795
|
params.forEach(function (p) {
|
|
4789
|
-
delete
|
|
4796
|
+
delete _this37.currentParams.items[p];
|
|
4790
4797
|
});
|
|
4791
4798
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4792
4799
|
}
|
|
@@ -5117,11 +5124,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5117
5124
|
}, {
|
|
5118
5125
|
key: "showComponents",
|
|
5119
5126
|
value: function showComponents(view) {
|
|
5120
|
-
var
|
|
5127
|
+
var _this38 = this;
|
|
5121
5128
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
5122
5129
|
this.options.views[view].components.forEach(function (c) {
|
|
5123
5130
|
if (typeof c.instance === 'undefined') {
|
|
5124
|
-
|
|
5131
|
+
_this38.prepComponent(c.elementId, c.options);
|
|
5125
5132
|
c.instance = new c.Component(c.elementId, c.options);
|
|
5126
5133
|
} else if (c.instance.render) {
|
|
5127
5134
|
c.instance.render();
|
|
@@ -5141,42 +5148,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5141
5148
|
}, {
|
|
5142
5149
|
key: "initView",
|
|
5143
5150
|
value: function initView(view) {
|
|
5144
|
-
var
|
|
5151
|
+
var _this39 = this;
|
|
5145
5152
|
return new Promise(function (resolve, reject) {
|
|
5146
|
-
if (!
|
|
5147
|
-
|
|
5153
|
+
if (!_this39.options.views[view]) {
|
|
5154
|
+
_this39.options.views[view] = {
|
|
5148
5155
|
components: []
|
|
5149
5156
|
};
|
|
5150
5157
|
}
|
|
5151
|
-
if (
|
|
5158
|
+
if (_this39.options.views[view].ready === true) {
|
|
5152
5159
|
resolve();
|
|
5153
|
-
} else if (
|
|
5154
|
-
|
|
5160
|
+
} else if (_this39.options.views[view].template) {
|
|
5161
|
+
_this39.preloadView(view, function () {
|
|
5155
5162
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5156
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
5163
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this39.options.viewClass));
|
|
5157
5164
|
if (viewEl) {
|
|
5158
|
-
|
|
5159
|
-
template:
|
|
5165
|
+
_this39.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
5166
|
+
template: _this39.options.views[view].template,
|
|
5160
5167
|
data: data,
|
|
5161
5168
|
readyCallbackFn: function readyCallbackFn() {
|
|
5162
|
-
|
|
5169
|
+
_this39.options.views[view].ready = true;
|
|
5163
5170
|
resolve();
|
|
5164
5171
|
}
|
|
5165
5172
|
});
|
|
5166
5173
|
} else {
|
|
5167
5174
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
5168
|
-
|
|
5175
|
+
_this39.options.views[view].ready = true;
|
|
5169
5176
|
resolve();
|
|
5170
5177
|
}
|
|
5171
5178
|
});
|
|
5172
|
-
} else if (
|
|
5173
|
-
|
|
5179
|
+
} else if (_this39.options.views[view].ready !== true && _this39.options.views[view].load) {
|
|
5180
|
+
_this39.preloadView(view, function () {
|
|
5174
5181
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5175
|
-
|
|
5182
|
+
_this39.options.views[view].ready = true;
|
|
5176
5183
|
resolve();
|
|
5177
5184
|
});
|
|
5178
5185
|
} else {
|
|
5179
|
-
|
|
5186
|
+
_this39.options.views[view].ready = true;
|
|
5180
5187
|
resolve();
|
|
5181
5188
|
}
|
|
5182
5189
|
});
|
|
@@ -5184,35 +5191,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5184
5191
|
}, {
|
|
5185
5192
|
key: "showView",
|
|
5186
5193
|
value: function showView(view, params, group) {
|
|
5187
|
-
var
|
|
5194
|
+
var _this40 = this;
|
|
5188
5195
|
if (view === '/' || view === '') {
|
|
5189
5196
|
view = this.options.defaultView || '';
|
|
5190
5197
|
}
|
|
5191
5198
|
this.initView(view).then(function () {
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
var children =
|
|
5199
|
+
_this40.activateItem(view, _this40.options.triggerClass);
|
|
5200
|
+
_this40.activateItem(view, _this40.options.viewClass);
|
|
5201
|
+
var children = _this40.getActiveViewsFromParent(view);
|
|
5195
5202
|
for (var c = 0; c < children.length; c++) {
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5203
|
+
_this40.activateItem(children[c].view, _this40.options.triggerClass);
|
|
5204
|
+
_this40.activateItem(children[c].view, _this40.options.viewClass);
|
|
5205
|
+
_this40.showComponents(children[c].view);
|
|
5199
5206
|
if (children[c].show) {
|
|
5200
5207
|
children[c].show.call(children[c]);
|
|
5201
5208
|
}
|
|
5202
|
-
|
|
5209
|
+
_this40.publish('show', [children[c].view, null, group]);
|
|
5203
5210
|
}
|
|
5204
|
-
if (
|
|
5205
|
-
|
|
5206
|
-
if (
|
|
5207
|
-
|
|
5211
|
+
if (_this40.previousView !== _this40.currentView || group !== 'main') {
|
|
5212
|
+
_this40.showComponents(view);
|
|
5213
|
+
if (_this40.options.views[view].show) {
|
|
5214
|
+
_this40.options.views[view].show.call(_this40.options.views[view]);
|
|
5208
5215
|
}
|
|
5209
|
-
|
|
5210
|
-
} else if (
|
|
5211
|
-
|
|
5212
|
-
if (
|
|
5213
|
-
|
|
5216
|
+
_this40.publish('show', [view, params, group]);
|
|
5217
|
+
} else if (_this40.previousView === _this40.currentView && _this40.previousParams.path !== _this40.currentParams.path) {
|
|
5218
|
+
_this40.showComponents(view);
|
|
5219
|
+
if (_this40.options.views[view].show) {
|
|
5220
|
+
_this40.options.views[view].show.call(_this40.options.views[view]);
|
|
5214
5221
|
}
|
|
5215
|
-
|
|
5222
|
+
_this40.publish('show', [view, params, group]);
|
|
5216
5223
|
}
|
|
5217
5224
|
});
|
|
5218
5225
|
}
|
|
@@ -5606,7 +5613,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5606
5613
|
}, {
|
|
5607
5614
|
key: "handleKeyUp",
|
|
5608
5615
|
value: function handleKeyUp(event) {
|
|
5609
|
-
var
|
|
5616
|
+
var _this41 = this;
|
|
5610
5617
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5611
5618
|
this.cursorPosition = event.target.selectionStart;
|
|
5612
5619
|
this.searchText = event.target.value;
|
|
@@ -5629,8 +5636,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5629
5636
|
}
|
|
5630
5637
|
if (event.target.value.length >= this.options.minLength) {
|
|
5631
5638
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5632
|
-
if (
|
|
5633
|
-
|
|
5639
|
+
if (_this41.options.onSearch) {
|
|
5640
|
+
_this41.options.onSearch(event.target.value, event);
|
|
5634
5641
|
}
|
|
5635
5642
|
}, this.options.searchTimeout);
|
|
5636
5643
|
} else {
|
|
@@ -5680,7 +5687,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5680
5687
|
}, {
|
|
5681
5688
|
key: "highlightActiveSuggestion",
|
|
5682
5689
|
value: function highlightActiveSuggestion() {
|
|
5683
|
-
var
|
|
5690
|
+
var _this42 = this;
|
|
5684
5691
|
// remove all previous highlights
|
|
5685
5692
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5686
5693
|
// if (parent) {
|
|
@@ -5699,7 +5706,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5699
5706
|
Array.from(els).forEach(function (e) {
|
|
5700
5707
|
e.classList.remove('active');
|
|
5701
5708
|
var index = e.getAttribute('data-index');
|
|
5702
|
-
if (+index ===
|
|
5709
|
+
if (+index === _this42.activeSuggestion) {
|
|
5703
5710
|
e.classList.add('active');
|
|
5704
5711
|
}
|
|
5705
5712
|
});
|
|
@@ -5819,13 +5826,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5819
5826
|
}, {
|
|
5820
5827
|
key: "startSuggestionTimeout",
|
|
5821
5828
|
value: function startSuggestionTimeout() {
|
|
5822
|
-
var
|
|
5829
|
+
var _this43 = this;
|
|
5823
5830
|
if (this.suggestingTimeoutFn) {
|
|
5824
5831
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5825
5832
|
}
|
|
5826
5833
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5827
5834
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5828
|
-
|
|
5835
|
+
_this43.hideSuggestions(_this43);
|
|
5829
5836
|
}, this.options.suggestingTimeout);
|
|
5830
5837
|
}
|
|
5831
5838
|
}, {
|
|
@@ -5997,7 +6004,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5997
6004
|
/* global WebsyDesigns */
|
|
5998
6005
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5999
6006
|
function WebsyTemplate(elementId, options) {
|
|
6000
|
-
var
|
|
6007
|
+
var _this44 = this;
|
|
6001
6008
|
_classCallCheck(this, WebsyTemplate);
|
|
6002
6009
|
var DEFAULTS = {
|
|
6003
6010
|
listeners: {
|
|
@@ -6026,8 +6033,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6026
6033
|
}
|
|
6027
6034
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
6028
6035
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
6029
|
-
|
|
6030
|
-
|
|
6036
|
+
_this44.options.template = templateString;
|
|
6037
|
+
_this44.render();
|
|
6031
6038
|
});
|
|
6032
6039
|
} else {
|
|
6033
6040
|
this.render();
|
|
@@ -6036,7 +6043,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6036
6043
|
_createClass(WebsyTemplate, [{
|
|
6037
6044
|
key: "buildHTML",
|
|
6038
6045
|
value: function buildHTML() {
|
|
6039
|
-
var
|
|
6046
|
+
var _this45 = this;
|
|
6040
6047
|
var html = "";
|
|
6041
6048
|
if (this.options.template) {
|
|
6042
6049
|
var template = this.options.template;
|
|
@@ -6085,14 +6092,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6085
6092
|
}
|
|
6086
6093
|
}
|
|
6087
6094
|
if (polarity === true) {
|
|
6088
|
-
if (typeof
|
|
6095
|
+
if (typeof _this45.options.data[parts[0]] !== 'undefined' && _this45.options.data[parts[0]] === parts[1]) {
|
|
6089
6096
|
// remove the <if> tags
|
|
6090
6097
|
removeAll = false;
|
|
6091
6098
|
} else if (parts[0] === parts[1]) {
|
|
6092
6099
|
removeAll = false;
|
|
6093
6100
|
}
|
|
6094
6101
|
} else if (polarity === false) {
|
|
6095
|
-
if (typeof
|
|
6102
|
+
if (typeof _this45.options.data[parts[0]] !== 'undefined' && _this45.options.data[parts[0]] !== parts[1]) {
|
|
6096
6103
|
// remove the <if> tags
|
|
6097
6104
|
removeAll = false;
|
|
6098
6105
|
}
|
|
@@ -6411,7 +6418,7 @@ var WebsyUtils = {
|
|
|
6411
6418
|
/* global WebsyDesigns */
|
|
6412
6419
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6413
6420
|
function WebsyTable(elementId, options) {
|
|
6414
|
-
var
|
|
6421
|
+
var _this46 = this;
|
|
6415
6422
|
_classCallCheck(this, WebsyTable);
|
|
6416
6423
|
var DEFAULTS = {
|
|
6417
6424
|
pageSize: 20,
|
|
@@ -6444,8 +6451,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6444
6451
|
allowClear: false,
|
|
6445
6452
|
disableSearch: true,
|
|
6446
6453
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6447
|
-
if (
|
|
6448
|
-
|
|
6454
|
+
if (_this46.options.onChangePageSize) {
|
|
6455
|
+
_this46.options.onChangePageSize(selectedItem.value);
|
|
6449
6456
|
}
|
|
6450
6457
|
}
|
|
6451
6458
|
});
|
|
@@ -6469,20 +6476,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6469
6476
|
}, {
|
|
6470
6477
|
key: "appendRows",
|
|
6471
6478
|
value: function appendRows(data) {
|
|
6472
|
-
var
|
|
6479
|
+
var _this47 = this;
|
|
6473
6480
|
this._isRendered = false;
|
|
6474
6481
|
this.hideError();
|
|
6475
6482
|
var bodyHTML = '';
|
|
6476
6483
|
if (data) {
|
|
6477
6484
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6478
6485
|
return '<tr>' + r.map(function (c, i) {
|
|
6479
|
-
if (
|
|
6486
|
+
if (_this47.options.columns[i].show !== false) {
|
|
6480
6487
|
var style = '';
|
|
6481
6488
|
if (c.style) {
|
|
6482
6489
|
style += c.style;
|
|
6483
6490
|
}
|
|
6484
|
-
if (
|
|
6485
|
-
style += "width: ".concat(
|
|
6491
|
+
if (_this47.options.columns[i].width) {
|
|
6492
|
+
style += "width: ".concat(_this47.options.columns[i].width, "; ");
|
|
6486
6493
|
}
|
|
6487
6494
|
if (c.backgroundColor) {
|
|
6488
6495
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6493,20 +6500,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6493
6500
|
if (c.color) {
|
|
6494
6501
|
style += "color: ".concat(c.color, "; ");
|
|
6495
6502
|
}
|
|
6496
|
-
if (
|
|
6497
|
-
return "\n <td \n data-row-index='".concat(
|
|
6498
|
-
} else if ((
|
|
6499
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6503
|
+
if (_this47.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6504
|
+
return "\n <td \n data-row-index='".concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this47.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(_this47.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this47.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6505
|
+
} else if ((_this47.options.columns[i].showAsNavigatorLink === true || _this47.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6506
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this47.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this47.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this47.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6500
6507
|
} else {
|
|
6501
6508
|
var info = c.value;
|
|
6502
|
-
if (
|
|
6509
|
+
if (_this47.options.columns[i].showAsImage === true) {
|
|
6503
6510
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6504
6511
|
}
|
|
6505
6512
|
var html = "\n <td \n ";
|
|
6506
|
-
if (!
|
|
6513
|
+
if (!_this47.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
6507
6514
|
html += "\n data-info='".concat(info, "'\n ");
|
|
6508
6515
|
}
|
|
6509
|
-
html += "\n data-row-index='".concat(
|
|
6516
|
+
html += "\n data-row-index='".concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this47.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 ");
|
|
6510
6517
|
return html;
|
|
6511
6518
|
}
|
|
6512
6519
|
}
|
|
@@ -6667,7 +6674,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6667
6674
|
}, {
|
|
6668
6675
|
key: "render",
|
|
6669
6676
|
value: function render(data) {
|
|
6670
|
-
var
|
|
6677
|
+
var _this48 = this;
|
|
6671
6678
|
this._isRendered = false;
|
|
6672
6679
|
if (!this.options.columns) {
|
|
6673
6680
|
return;
|
|
@@ -6695,7 +6702,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6695
6702
|
if (c.width) {
|
|
6696
6703
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6697
6704
|
}
|
|
6698
|
-
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 ?
|
|
6705
|
+
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 ? _this48.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
6699
6706
|
}
|
|
6700
6707
|
}).join('') + '</tr>';
|
|
6701
6708
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6713,7 +6720,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6713
6720
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6714
6721
|
if (pagingEl) {
|
|
6715
6722
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6716
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6723
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this48.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6717
6724
|
});
|
|
6718
6725
|
var startIndex = 0;
|
|
6719
6726
|
if (this.options.pageCount > 8) {
|
|
@@ -6769,7 +6776,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6769
6776
|
/* global WebsyDesigns */
|
|
6770
6777
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6771
6778
|
function WebsyTable2(elementId, options) {
|
|
6772
|
-
var
|
|
6779
|
+
var _this49 = this;
|
|
6773
6780
|
_classCallCheck(this, WebsyTable2);
|
|
6774
6781
|
var DEFAULTS = {
|
|
6775
6782
|
pageSize: 20,
|
|
@@ -6804,8 +6811,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6804
6811
|
allowClear: false,
|
|
6805
6812
|
disableSearch: true,
|
|
6806
6813
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6807
|
-
if (
|
|
6808
|
-
|
|
6814
|
+
if (_this49.options.onChangePageSize) {
|
|
6815
|
+
_this49.options.onChangePageSize(selectedItem.value);
|
|
6809
6816
|
}
|
|
6810
6817
|
}
|
|
6811
6818
|
});
|
|
@@ -6827,20 +6834,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6827
6834
|
_createClass(WebsyTable2, [{
|
|
6828
6835
|
key: "appendRows",
|
|
6829
6836
|
value: function appendRows(data) {
|
|
6830
|
-
var
|
|
6837
|
+
var _this50 = this;
|
|
6831
6838
|
this.hideError();
|
|
6832
6839
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6833
6840
|
var bodyHTML = '';
|
|
6834
6841
|
if (data) {
|
|
6835
6842
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6836
6843
|
return '<tr>' + r.map(function (c, i) {
|
|
6837
|
-
if (
|
|
6838
|
-
var style = "height: ".concat(
|
|
6844
|
+
if (_this50.options.columns[i].show !== false) {
|
|
6845
|
+
var style = "height: ".concat(_this50.options.cellSize, "px; line-height: ").concat(_this50.options.cellSize, "px;");
|
|
6839
6846
|
if (c.style) {
|
|
6840
6847
|
style += c.style;
|
|
6841
6848
|
}
|
|
6842
|
-
if (
|
|
6843
|
-
style += "width: ".concat(
|
|
6849
|
+
if (_this50.options.columns[i].width) {
|
|
6850
|
+
style += "width: ".concat(_this50.options.columns[i].width, "; ");
|
|
6844
6851
|
}
|
|
6845
6852
|
if (c.backgroundColor) {
|
|
6846
6853
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6851,16 +6858,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6851
6858
|
if (c.color) {
|
|
6852
6859
|
style += "color: ".concat(c.color, "; ");
|
|
6853
6860
|
}
|
|
6854
|
-
if (
|
|
6855
|
-
return "\n <td \n data-row-index='".concat(
|
|
6856
|
-
} else if ((
|
|
6857
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6861
|
+
if (_this50.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6862
|
+
return "\n <td \n data-row-index='".concat(_this50.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this50.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(_this50.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this50.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6863
|
+
} else if ((_this50.options.columns[i].showAsNavigatorLink === true || _this50.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6864
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this50.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this50.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this50.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this50.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6858
6865
|
} else {
|
|
6859
6866
|
var info = c.value;
|
|
6860
|
-
if (
|
|
6867
|
+
if (_this50.options.columns[i].showAsImage === true) {
|
|
6861
6868
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6862
6869
|
}
|
|
6863
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6870
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this50.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this50.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 ");
|
|
6864
6871
|
}
|
|
6865
6872
|
}
|
|
6866
6873
|
}).join('') + '</tr>';
|
|
@@ -7094,7 +7101,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7094
7101
|
}, {
|
|
7095
7102
|
key: "render",
|
|
7096
7103
|
value: function render(data) {
|
|
7097
|
-
var
|
|
7104
|
+
var _this51 = this;
|
|
7098
7105
|
if (!this.options.columns) {
|
|
7099
7106
|
return;
|
|
7100
7107
|
}
|
|
@@ -7122,7 +7129,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7122
7129
|
if (c.width) {
|
|
7123
7130
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
7124
7131
|
}
|
|
7125
|
-
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 ?
|
|
7132
|
+
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 ? _this51.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
7126
7133
|
}
|
|
7127
7134
|
}).join('') + '</tr>';
|
|
7128
7135
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -7132,7 +7139,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7132
7139
|
var dropdownHTML = "";
|
|
7133
7140
|
this.options.columns.forEach(function (c, i) {
|
|
7134
7141
|
if (c.searchable && c.searchField) {
|
|
7135
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
7142
|
+
dropdownHTML += "\n <div id=\"".concat(_this51.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
7136
7143
|
}
|
|
7137
7144
|
});
|
|
7138
7145
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -7152,7 +7159,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7152
7159
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
7153
7160
|
if (pagingEl) {
|
|
7154
7161
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
7155
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
7162
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this51.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
7156
7163
|
});
|
|
7157
7164
|
var startIndex = 0;
|
|
7158
7165
|
if (this.options.pageCount > 8) {
|
|
@@ -7229,17 +7236,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7229
7236
|
}, {
|
|
7230
7237
|
key: "getColumnParameters",
|
|
7231
7238
|
value: function getColumnParameters(values) {
|
|
7232
|
-
var
|
|
7239
|
+
var _this52 = this;
|
|
7233
7240
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
7234
7241
|
tableEl.style.tableLayout = 'auto';
|
|
7235
7242
|
tableEl.style.width = 'auto';
|
|
7236
7243
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
7237
7244
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
7238
7245
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
7239
|
-
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 ?
|
|
7246
|
+
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 ? _this52.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
7240
7247
|
}).join('') + '</tr>';
|
|
7241
7248
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
7242
|
-
return "\n <td \n style='height: ".concat(
|
|
7249
|
+
return "\n <td \n style='height: ".concat(_this52.options.cellSize, "px; line-height: ").concat(_this52.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
7243
7250
|
}).join('') + '</tr>';
|
|
7244
7251
|
// get height of the first data cell
|
|
7245
7252
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7403,7 +7410,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7403
7410
|
}, {
|
|
7404
7411
|
key: "buildBodyHtml",
|
|
7405
7412
|
value: function buildBodyHtml() {
|
|
7406
|
-
var
|
|
7413
|
+
var _this53 = this;
|
|
7407
7414
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7408
7415
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7409
7416
|
if (!this.options.columns) {
|
|
@@ -7428,7 +7435,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7428
7435
|
row.forEach(function (cell, cellIndex) {
|
|
7429
7436
|
var sizeIndex = cell.level || cellIndex;
|
|
7430
7437
|
var colIndex = cell.index || cellIndex;
|
|
7431
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7438
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this53.options.columns[_this53.options.columns.length - 1][colIndex].show === false) {
|
|
7432
7439
|
return; // need to revisit this logic
|
|
7433
7440
|
}
|
|
7434
7441
|
|
|
@@ -7455,7 +7462,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7455
7462
|
style += "color: ".concat(cell.color, "; ");
|
|
7456
7463
|
}
|
|
7457
7464
|
// console.log('rowspan', cell.rowspan)
|
|
7458
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
7465
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this53.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n ");
|
|
7459
7466
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
7460
7467
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
7461
7468
|
}
|
|
@@ -7468,10 +7475,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7468
7475
|
// }
|
|
7469
7476
|
bodyHtml += "\n ><div \n style='".concat(divStyle, "' \n class='websy-table-cell-content'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n >");
|
|
7470
7477
|
if (cell.expandable === true) {
|
|
7471
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
7478
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this53.options.plusIcon, "</i>");
|
|
7472
7479
|
}
|
|
7473
7480
|
if (cell.collapsable === true) {
|
|
7474
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
7481
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this53.options.minusIcon, "</i>");
|
|
7475
7482
|
}
|
|
7476
7483
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7477
7484
|
cell.value = "\n <a href=\"".concat(encodeURI(cell.value), "\" target='").concat(sizingColumns[sizeIndex].openInNewTab === true ? '_blank' : '_self', "'>").concat(cell.displayText || sizingColumns[sizeIndex].linkText || cell.value, "</a>\n ");
|
|
@@ -7492,7 +7499,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7492
7499
|
}, {
|
|
7493
7500
|
key: "buildHeaderHtml",
|
|
7494
7501
|
value: function buildHeaderHtml() {
|
|
7495
|
-
var
|
|
7502
|
+
var _this54 = this;
|
|
7496
7503
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7497
7504
|
if (!this.options.columns) {
|
|
7498
7505
|
return '';
|
|
@@ -7513,7 +7520,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7513
7520
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7514
7521
|
// return
|
|
7515
7522
|
// }
|
|
7516
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
7523
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this54.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
7517
7524
|
row.filter(function (c) {
|
|
7518
7525
|
return c.show !== false;
|
|
7519
7526
|
}).forEach(function (col, colIndex) {
|
|
@@ -7533,24 +7540,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7533
7540
|
if (col.style) {
|
|
7534
7541
|
style += col.style;
|
|
7535
7542
|
}
|
|
7536
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7543
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this54.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7537
7544
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7538
7545
|
// headerHtml += `
|
|
7539
7546
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7540
7547
|
// width='${col.width || col.actualWidth}'
|
|
7541
7548
|
// `
|
|
7542
7549
|
// }
|
|
7543
|
-
headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ?
|
|
7550
|
+
headerHtml += ">\n <div \n style='".concat(divStyle, "'\n data-col-index=\"").concat(colIndex, "\"\n class='").concat(['asc', 'desc'].indexOf(col.sort) !== -1 ? 'sortable-column' : '', "'\n >\n ").concat(col.name).concat(col.activeSort ? _this54.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this54.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
7544
7551
|
});
|
|
7545
7552
|
headerHtml += "</tr>";
|
|
7546
7553
|
});
|
|
7547
7554
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7548
7555
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7549
7556
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7550
|
-
var testEl = document.getElementById("".concat(
|
|
7557
|
+
var testEl = document.getElementById("".concat(_this54.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7551
7558
|
if (!testEl) {
|
|
7552
7559
|
var newE = document.createElement('div');
|
|
7553
|
-
newE.id = "".concat(
|
|
7560
|
+
newE.id = "".concat(_this54.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7554
7561
|
newE.className = 'websy-modal-dropdown';
|
|
7555
7562
|
dropdownEl.appendChild(newE);
|
|
7556
7563
|
}
|
|
@@ -7573,7 +7580,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7573
7580
|
}, {
|
|
7574
7581
|
key: "buildTotalHtml",
|
|
7575
7582
|
value: function buildTotalHtml() {
|
|
7576
|
-
var
|
|
7583
|
+
var _this55 = this;
|
|
7577
7584
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7578
7585
|
if (!this.options.totals) {
|
|
7579
7586
|
return '';
|
|
@@ -7589,7 +7596,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7589
7596
|
|
|
7590
7597
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7591
7598
|
if (useWidths === true) {
|
|
7592
|
-
totalHtml += "\n style='width: ".concat(
|
|
7599
|
+
totalHtml += "\n style='width: ".concat(_this55.options.columns[_this55.options.columns.length - 1][colIndex].width || _this55.options.columns[_this55.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
7593
7600
|
}
|
|
7594
7601
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7595
7602
|
});
|
|
@@ -7599,7 +7606,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7599
7606
|
}, {
|
|
7600
7607
|
key: "calculateSizes",
|
|
7601
7608
|
value: function calculateSizes() {
|
|
7602
|
-
var
|
|
7609
|
+
var _this56 = this;
|
|
7603
7610
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7604
7611
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7605
7612
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7643,7 +7650,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7643
7650
|
rows.forEach(function (row, rowIndex) {
|
|
7644
7651
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7645
7652
|
var colSize = col.getBoundingClientRect();
|
|
7646
|
-
|
|
7653
|
+
_this56.sizes.cellHeight = colSize.height;
|
|
7647
7654
|
if (columnsForSizing[colIndex]) {
|
|
7648
7655
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7649
7656
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7655,7 +7662,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7655
7662
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7656
7663
|
// }
|
|
7657
7664
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7658
|
-
if (colIndex >=
|
|
7665
|
+
if (colIndex >= _this56.pinnedColumns) {
|
|
7659
7666
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7660
7667
|
}
|
|
7661
7668
|
}
|
|
@@ -7670,7 +7677,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7670
7677
|
return a + (b.width || b.actualWidth);
|
|
7671
7678
|
}, 0);
|
|
7672
7679
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7673
|
-
return i >=
|
|
7680
|
+
return i >= _this56.pinnedColumns;
|
|
7674
7681
|
}).reduce(function (a, b) {
|
|
7675
7682
|
return a + (b.width || b.actualWidth);
|
|
7676
7683
|
}, 0);
|
|
@@ -7681,7 +7688,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7681
7688
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7682
7689
|
columnsForSizing.forEach(function (c) {
|
|
7683
7690
|
c.shouldGrow = true;
|
|
7684
|
-
if (
|
|
7691
|
+
if (_this56.options.autoFitColumns === false) {
|
|
7685
7692
|
c.shouldGrow = false;
|
|
7686
7693
|
if (c.potentialWidth > c.actualWidth) {
|
|
7687
7694
|
c.shouldGrow = true;
|
|
@@ -7700,7 +7707,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7700
7707
|
// if (!c.width) {
|
|
7701
7708
|
// if (c.actualWidth < equalWidth) {
|
|
7702
7709
|
// adjust the width
|
|
7703
|
-
if (
|
|
7710
|
+
if (_this56.options.autoFitColumns === true) {
|
|
7704
7711
|
if (c.width) {
|
|
7705
7712
|
c.width += equalWidth;
|
|
7706
7713
|
}
|
|
@@ -7724,9 +7731,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7724
7731
|
}
|
|
7725
7732
|
// }
|
|
7726
7733
|
// }
|
|
7727
|
-
|
|
7728
|
-
if (i >
|
|
7729
|
-
|
|
7734
|
+
_this56.sizes.totalWidth += c.width || c.actualWidth;
|
|
7735
|
+
if (i > _this56.pinnedColumns) {
|
|
7736
|
+
_this56.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7730
7737
|
}
|
|
7731
7738
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7732
7739
|
});
|
|
@@ -7785,7 +7792,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7785
7792
|
}, {
|
|
7786
7793
|
key: "createSample",
|
|
7787
7794
|
value: function createSample(data) {
|
|
7788
|
-
var
|
|
7795
|
+
var _this57 = this;
|
|
7789
7796
|
var output = [];
|
|
7790
7797
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7791
7798
|
if (col.maxLength) {
|
|
@@ -7795,7 +7802,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7795
7802
|
} else if (data) {
|
|
7796
7803
|
var longest = '';
|
|
7797
7804
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7798
|
-
if (data[i].length ===
|
|
7805
|
+
if (data[i].length === _this57.options.columns[_this57.options.columns.length - 1].length) {
|
|
7799
7806
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7800
7807
|
longest = data[i][colIndex].value;
|
|
7801
7808
|
}
|
|
@@ -8067,7 +8074,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8067
8074
|
}, {
|
|
8068
8075
|
key: "perpetualScroll",
|
|
8069
8076
|
value: function perpetualScroll() {
|
|
8070
|
-
var
|
|
8077
|
+
var _this58 = this;
|
|
8071
8078
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
8072
8079
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
8073
8080
|
return;
|
|
@@ -8086,17 +8093,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8086
8093
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
8087
8094
|
var _loop2 = function _loop2(i) {
|
|
8088
8095
|
setTimeout(function () {
|
|
8089
|
-
var delta =
|
|
8096
|
+
var delta = _this58.mouseYStart - _this58.currentClientY + _this58.sizes.cellHeight * (i + 1) * direction;
|
|
8090
8097
|
delta = Math.min(10, delta);
|
|
8091
8098
|
delta = Math.max(-10, delta);
|
|
8092
8099
|
// only run this if isPerpetual === true
|
|
8093
8100
|
// this value is reset to false on touchStart
|
|
8094
|
-
if (
|
|
8101
|
+
if (_this58.isPerpetual === true) {
|
|
8095
8102
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
8096
8103
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
8097
|
-
|
|
8098
|
-
if (
|
|
8099
|
-
clearTimeout(
|
|
8104
|
+
_this58.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
8105
|
+
if (_this58.scrollTimeout) {
|
|
8106
|
+
clearTimeout(_this58.scrollTimeout);
|
|
8100
8107
|
}
|
|
8101
8108
|
}
|
|
8102
8109
|
}, 1000 / fps * i);
|
|
@@ -8364,7 +8371,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8364
8371
|
/* global d3 include WebsyDesigns */
|
|
8365
8372
|
var WebsyChart = /*#__PURE__*/function () {
|
|
8366
8373
|
function WebsyChart(elementId, options) {
|
|
8367
|
-
var
|
|
8374
|
+
var _this59 = this;
|
|
8368
8375
|
_classCallCheck(this, WebsyChart);
|
|
8369
8376
|
var DEFAULTS = {
|
|
8370
8377
|
margin: {
|
|
@@ -8423,7 +8430,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8423
8430
|
this.invertOverride = function (input, input2) {
|
|
8424
8431
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8425
8432
|
var xAxis = 'bottom';
|
|
8426
|
-
if (
|
|
8433
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
8427
8434
|
xAxis = 'left';
|
|
8428
8435
|
}
|
|
8429
8436
|
if (forBrush === true) {
|
|
@@ -8431,12 +8438,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8431
8438
|
}
|
|
8432
8439
|
xAxis += 'Axis';
|
|
8433
8440
|
var output;
|
|
8434
|
-
var width =
|
|
8441
|
+
var width = _this59.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8435
8442
|
// if (this.customBottomRange) {
|
|
8436
|
-
for (var index = 0; index <
|
|
8437
|
-
if (input >
|
|
8438
|
-
if (
|
|
8439
|
-
if (input <
|
|
8443
|
+
for (var index = 0; index < _this59.customBottomRange.length; index++) {
|
|
8444
|
+
if (input > _this59.customBottomRange[index]) {
|
|
8445
|
+
if (_this59.customBottomRange[index + 1]) {
|
|
8446
|
+
if (input < _this59.customBottomRange[index + 1]) {
|
|
8440
8447
|
output = index;
|
|
8441
8448
|
break;
|
|
8442
8449
|
}
|
|
@@ -8601,9 +8608,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8601
8608
|
}, {
|
|
8602
8609
|
key: "handleEventMouseMove",
|
|
8603
8610
|
value: function handleEventMouseMove(event, d) {
|
|
8604
|
-
var
|
|
8611
|
+
var _this60 = this;
|
|
8605
8612
|
var bisectDate = d3.bisector(function (d) {
|
|
8606
|
-
return
|
|
8613
|
+
return _this60.parseX(d.x.value);
|
|
8607
8614
|
}).left;
|
|
8608
8615
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8609
8616
|
var xAxis = 'bottomAxis';
|
|
@@ -8636,9 +8643,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8636
8643
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8637
8644
|
}
|
|
8638
8645
|
this.options.data.series.forEach(function (s) {
|
|
8639
|
-
if (
|
|
8646
|
+
if (_this60.options.data[xData].scale !== 'Time') {
|
|
8640
8647
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8641
|
-
xPoint =
|
|
8648
|
+
xPoint = _this60.customBottomRange[x0] + (_this60.customBottomRange[x0 + 1] - _this60.customBottomRange[x0]) / 2;
|
|
8642
8649
|
// }
|
|
8643
8650
|
// else {
|
|
8644
8651
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8658,41 +8665,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8658
8665
|
var index = bisectDate(s.data, x0, 1);
|
|
8659
8666
|
var pointA = s.data[index - 1];
|
|
8660
8667
|
var pointB = s.data[index];
|
|
8661
|
-
if (
|
|
8668
|
+
if (_this60.options.orientation === 'horizontal') {
|
|
8662
8669
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8663
8670
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8664
8671
|
}
|
|
8665
8672
|
if (pointA && !pointB) {
|
|
8666
|
-
xPoint =
|
|
8673
|
+
xPoint = _this60[xAxis](_this60.parseX(pointA.x.value));
|
|
8667
8674
|
tooltipTitle = pointA.x.value;
|
|
8668
8675
|
if (!pointA.y.color) {
|
|
8669
8676
|
pointA.y.color = s.color;
|
|
8670
8677
|
}
|
|
8671
8678
|
tooltipData.push(pointA);
|
|
8672
8679
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8673
|
-
tooltipTitle = d3.timeFormat(
|
|
8680
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8674
8681
|
}
|
|
8675
8682
|
}
|
|
8676
8683
|
if (pointB && !pointA) {
|
|
8677
|
-
xPoint =
|
|
8684
|
+
xPoint = _this60[xAxis](_this60.parseX(pointB.x.value));
|
|
8678
8685
|
tooltipTitle = pointB.x.value;
|
|
8679
8686
|
if (!pointB.y.color) {
|
|
8680
8687
|
pointB.y.color = s.color;
|
|
8681
8688
|
}
|
|
8682
8689
|
tooltipData.push(pointB);
|
|
8683
8690
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8684
|
-
tooltipTitle = d3.timeFormat(
|
|
8691
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8685
8692
|
}
|
|
8686
8693
|
}
|
|
8687
8694
|
if (pointA && pointB) {
|
|
8688
|
-
var d0 =
|
|
8689
|
-
var d1 =
|
|
8695
|
+
var d0 = _this60[xAxis](_this60.parseX(pointA.x.value));
|
|
8696
|
+
var d1 = _this60[xAxis](_this60.parseX(pointB.x.value));
|
|
8690
8697
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8691
8698
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8692
8699
|
xPoint = d1;
|
|
8693
8700
|
tooltipTitle = pointB.x.value;
|
|
8694
8701
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8695
|
-
tooltipTitle = d3.timeFormat(
|
|
8702
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8696
8703
|
}
|
|
8697
8704
|
if (!pointB.y.color) {
|
|
8698
8705
|
pointB.y.color = s.color;
|
|
@@ -8702,7 +8709,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8702
8709
|
xPoint = d0;
|
|
8703
8710
|
tooltipTitle = pointA.x.value;
|
|
8704
8711
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8705
|
-
tooltipTitle = d3.timeFormat(
|
|
8712
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8706
8713
|
}
|
|
8707
8714
|
if (!pointA.y.color) {
|
|
8708
8715
|
pointA.y.color = s.color;
|
|
@@ -8828,7 +8835,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8828
8835
|
}, {
|
|
8829
8836
|
key: "render",
|
|
8830
8837
|
value: function render(options) {
|
|
8831
|
-
var
|
|
8838
|
+
var _this61 = this;
|
|
8832
8839
|
/* global d3 options WebsyUtils */
|
|
8833
8840
|
this._isRendered = false;
|
|
8834
8841
|
if (typeof options !== 'undefined') {
|
|
@@ -8897,7 +8904,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8897
8904
|
this.options.data.series.map(function (s, i) {
|
|
8898
8905
|
return {
|
|
8899
8906
|
value: s.label || s.key,
|
|
8900
|
-
color: s.color ||
|
|
8907
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
8901
8908
|
};
|
|
8902
8909
|
});
|
|
8903
8910
|
}
|
|
@@ -9254,25 +9261,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9254
9261
|
if (this.options.data[customRangeSideLC].data && this.options.data[customRangeSideLC].data[0] && (this.options.data[customRangeSideLC].data[0].valueCount || 1) && this.options.data[customRangeSideLC].scale === 'Ordinal') {
|
|
9255
9262
|
var acc = 0;
|
|
9256
9263
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9257
|
-
var adjustment =
|
|
9264
|
+
var adjustment = _this61.bandPadding * index + _this61.bandPadding;
|
|
9258
9265
|
// if (this.options.data.bottom.padding) {
|
|
9259
9266
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9260
9267
|
// }
|
|
9261
|
-
var start =
|
|
9268
|
+
var start = _this61.widthForCalc / noOfPoints * acc;
|
|
9262
9269
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9263
9270
|
var pos = i * proposedBandWidth;
|
|
9264
|
-
|
|
9271
|
+
_this61["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9265
9272
|
}
|
|
9266
|
-
acc +=
|
|
9267
|
-
var end =
|
|
9273
|
+
acc += _this61.options.grouping !== 'stacked' && _this61.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9274
|
+
var end = _this61.widthForCalc / noOfPoints * acc;
|
|
9268
9275
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9269
9276
|
return end + adjustment;
|
|
9270
9277
|
})));
|
|
9271
9278
|
acc = 0;
|
|
9272
9279
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9273
|
-
var adjustment =
|
|
9274
|
-
acc +=
|
|
9275
|
-
return (
|
|
9280
|
+
var adjustment = _this61.brushBandPadding * index + _this61.brushBandPadding;
|
|
9281
|
+
acc += _this61.options.grouping !== 'stacked' && _this61.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9282
|
+
return (_this61.options.orientation === 'vertical' ? _this61.plotWidth : _this61.plotHeight) / noOfPoints * acc;
|
|
9276
9283
|
})));
|
|
9277
9284
|
}
|
|
9278
9285
|
// }
|
|
@@ -9445,7 +9452,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9445
9452
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9446
9453
|
if (this.options.data.bottom.formatter) {
|
|
9447
9454
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9448
|
-
return
|
|
9455
|
+
return _this61.options.data.bottom.formatter(d);
|
|
9449
9456
|
});
|
|
9450
9457
|
}
|
|
9451
9458
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9455,7 +9462,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9455
9462
|
}
|
|
9456
9463
|
if (this.customBottomRange.length > 0) {
|
|
9457
9464
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9458
|
-
return "translate(".concat(
|
|
9465
|
+
return "translate(".concat(_this61.customBottomRange[i] + (_this61.customBottomRange[i + 1] - _this61.customBottomRange[i]) / 2, ", 0)");
|
|
9459
9466
|
});
|
|
9460
9467
|
}
|
|
9461
9468
|
}
|
|
@@ -9474,14 +9481,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9474
9481
|
}
|
|
9475
9482
|
if (this.options.margin.axisLeft > 0) {
|
|
9476
9483
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9477
|
-
if (
|
|
9478
|
-
d =
|
|
9484
|
+
if (_this61.options.data.left.formatter) {
|
|
9485
|
+
d = _this61.options.data.left.formatter(d);
|
|
9479
9486
|
}
|
|
9480
9487
|
return d;
|
|
9481
9488
|
}));
|
|
9482
9489
|
if (this.customLeftRange.length > 0) {
|
|
9483
9490
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9484
|
-
return "translate(0, ".concat(
|
|
9491
|
+
return "translate(0, ".concat(_this61.customLeftRange[i] + (_this61.customLeftRange[i + 1] - _this61.customLeftRange[i]) / 2, ")");
|
|
9485
9492
|
});
|
|
9486
9493
|
}
|
|
9487
9494
|
}
|
|
@@ -9509,8 +9516,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9509
9516
|
}
|
|
9510
9517
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9511
9518
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9512
|
-
if (
|
|
9513
|
-
d =
|
|
9519
|
+
if (_this61.options.data.right.formatter) {
|
|
9520
|
+
d = _this61.options.data.right.formatter(d);
|
|
9514
9521
|
}
|
|
9515
9522
|
return d;
|
|
9516
9523
|
}));
|
|
@@ -9550,25 +9557,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9550
9557
|
}, {
|
|
9551
9558
|
key: "renderComponents",
|
|
9552
9559
|
value: function renderComponents() {
|
|
9553
|
-
var
|
|
9560
|
+
var _this62 = this;
|
|
9554
9561
|
// Draw the series data
|
|
9555
9562
|
this.renderedKeys = {};
|
|
9556
9563
|
this.options.data.series.forEach(function (series, index) {
|
|
9557
9564
|
if (!series.key) {
|
|
9558
|
-
series.key =
|
|
9565
|
+
series.key = _this62.createIdentity();
|
|
9559
9566
|
}
|
|
9560
9567
|
if (!series.color) {
|
|
9561
|
-
series.color =
|
|
9568
|
+
series.color = _this62.options.colors[index % _this62.options.colors.length];
|
|
9562
9569
|
}
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9570
|
+
_this62["render".concat(series.type || 'bar')](series, index);
|
|
9571
|
+
_this62.renderLabels(series, index);
|
|
9572
|
+
_this62.renderedKeys[series.key] = series.type;
|
|
9566
9573
|
});
|
|
9567
9574
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9568
9575
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9569
9576
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9570
9577
|
this.options.refLines.forEach(function (l) {
|
|
9571
|
-
return
|
|
9578
|
+
return _this62.renderRefLine(l);
|
|
9572
9579
|
});
|
|
9573
9580
|
}
|
|
9574
9581
|
this._isRendered = true;
|
|
@@ -9576,25 +9583,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9576
9583
|
}, {
|
|
9577
9584
|
key: "renderarea",
|
|
9578
9585
|
value: function renderarea(series, index) {
|
|
9579
|
-
var
|
|
9586
|
+
var _this63 = this;
|
|
9580
9587
|
/* global d3 series index */
|
|
9581
9588
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9582
9589
|
return d3.area().x(function (d) {
|
|
9583
|
-
if (
|
|
9584
|
-
return
|
|
9590
|
+
if (_this63.options.data[xAxis].scale === 'Time') {
|
|
9591
|
+
return _this63["".concat(xAxis, "Axis")](_this63.parseX(d.x.value));
|
|
9585
9592
|
} else {
|
|
9586
|
-
var xIndex =
|
|
9587
|
-
var xPos =
|
|
9588
|
-
if (
|
|
9589
|
-
xPos = xPos + (
|
|
9593
|
+
var xIndex = _this63[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9594
|
+
var xPos = _this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9595
|
+
if (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9596
|
+
xPos = xPos + (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9590
9597
|
}
|
|
9591
9598
|
return xPos;
|
|
9592
9599
|
}
|
|
9593
9600
|
}).y0(function (d) {
|
|
9594
|
-
return
|
|
9601
|
+
return _this63["".concat(yAxis, "Axis")](0);
|
|
9595
9602
|
}).y1(function (d) {
|
|
9596
|
-
return
|
|
9597
|
-
}).curve(d3[curveStyle ||
|
|
9603
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9604
|
+
}).curve(d3[curveStyle || _this63.options.curveStyle]);
|
|
9598
9605
|
};
|
|
9599
9606
|
var xAxis = 'bottom';
|
|
9600
9607
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9634,7 +9641,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9634
9641
|
}, {
|
|
9635
9642
|
key: "renderbar",
|
|
9636
9643
|
value: function renderbar(series, index) {
|
|
9637
|
-
var
|
|
9644
|
+
var _this64 = this;
|
|
9638
9645
|
/* global series index d3 */
|
|
9639
9646
|
var xAxis = 'bottom';
|
|
9640
9647
|
var yAxis = 'left';
|
|
@@ -9801,26 +9808,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9801
9808
|
}
|
|
9802
9809
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9803
9810
|
bars.attr('width', function (d, i) {
|
|
9804
|
-
return Math.abs(getBarWidth.call(
|
|
9811
|
+
return Math.abs(getBarWidth.call(_this64, d, i, yAxis, xAxis));
|
|
9805
9812
|
}).attr('height', function (d, i) {
|
|
9806
|
-
return getBarHeight.call(
|
|
9813
|
+
return getBarHeight.call(_this64, d, i, yAxis, xAxis);
|
|
9807
9814
|
}).attr('x', function (d, i) {
|
|
9808
|
-
return getBarX.call(
|
|
9815
|
+
return getBarX.call(_this64, d, i, yAxis, xAxis);
|
|
9809
9816
|
}).attr('y', function (d, i) {
|
|
9810
|
-
return getBarY.call(
|
|
9817
|
+
return getBarY.call(_this64, d, i, yAxis, xAxis);
|
|
9811
9818
|
})
|
|
9812
9819
|
// .transition(this.transition)
|
|
9813
9820
|
.attr('fill', function (d) {
|
|
9814
9821
|
return d.y.color || d.color || series.color;
|
|
9815
9822
|
});
|
|
9816
9823
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9817
|
-
return Math.abs(getBarWidth.call(
|
|
9824
|
+
return Math.abs(getBarWidth.call(_this64, d, i, yAxis, xAxis));
|
|
9818
9825
|
}).attr('height', function (d, i) {
|
|
9819
|
-
return getBarHeight.call(
|
|
9826
|
+
return getBarHeight.call(_this64, d, i, yAxis, xAxis);
|
|
9820
9827
|
}).attr('x', function (d, i) {
|
|
9821
|
-
return getBarX.call(
|
|
9828
|
+
return getBarX.call(_this64, d, i, yAxis, xAxis);
|
|
9822
9829
|
}).attr('y', function (d, i) {
|
|
9823
|
-
return getBarY.call(
|
|
9830
|
+
return getBarY.call(_this64, d, i, yAxis, xAxis);
|
|
9824
9831
|
})
|
|
9825
9832
|
// .transition(this.transition)
|
|
9826
9833
|
.attr('fill', function (d) {
|
|
@@ -9832,26 +9839,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9832
9839
|
this.brushBarsInitialized[series.key] = true;
|
|
9833
9840
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9834
9841
|
brushBars.attr('width', function (d, i) {
|
|
9835
|
-
return Math.abs(getBarWidth.call(
|
|
9842
|
+
return Math.abs(getBarWidth.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9836
9843
|
}).attr('height', function (d, i) {
|
|
9837
|
-
return getBarHeight.call(
|
|
9844
|
+
return getBarHeight.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9838
9845
|
}).attr('x', function (d, i) {
|
|
9839
|
-
return getBarX.call(
|
|
9846
|
+
return getBarX.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9840
9847
|
}).attr('y', function (d, i) {
|
|
9841
|
-
return getBarY.call(
|
|
9848
|
+
return getBarY.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9842
9849
|
})
|
|
9843
9850
|
// .transition(this.transition)
|
|
9844
9851
|
.attr('fill', function (d) {
|
|
9845
9852
|
return d.y.color || d.color || series.color;
|
|
9846
9853
|
});
|
|
9847
9854
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9848
|
-
return Math.abs(getBarWidth.call(
|
|
9855
|
+
return Math.abs(getBarWidth.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9849
9856
|
}).attr('height', function (d, i) {
|
|
9850
|
-
return getBarHeight.call(
|
|
9857
|
+
return getBarHeight.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9851
9858
|
}).attr('x', function (d, i) {
|
|
9852
|
-
return getBarX.call(
|
|
9859
|
+
return getBarX.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9853
9860
|
}).attr('y', function (d, i) {
|
|
9854
|
-
return getBarY.call(
|
|
9861
|
+
return getBarY.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9855
9862
|
})
|
|
9856
9863
|
// .transition(this.transition)
|
|
9857
9864
|
.attr('fill', function (d) {
|
|
@@ -9872,7 +9879,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9872
9879
|
}, {
|
|
9873
9880
|
key: "renderLabels",
|
|
9874
9881
|
value: function renderLabels(series, index) {
|
|
9875
|
-
var
|
|
9882
|
+
var _this65 = this;
|
|
9876
9883
|
/* global series index d3 WebsyDesigns */
|
|
9877
9884
|
var xAxis = 'bottom';
|
|
9878
9885
|
var yAxis = 'left';
|
|
@@ -9888,14 +9895,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9888
9895
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9889
9896
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9890
9897
|
labels.attr('x', function (d) {
|
|
9891
|
-
return getLabelX.call(
|
|
9898
|
+
return getLabelX.call(_this65, d, series.labelPosition);
|
|
9892
9899
|
}).attr('y', function (d) {
|
|
9893
|
-
return getLabelY.call(
|
|
9900
|
+
return getLabelY.call(_this65, d, series.labelPosition);
|
|
9894
9901
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9895
|
-
if (
|
|
9902
|
+
if (_this65.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9896
9903
|
return 'transparent';
|
|
9897
9904
|
}
|
|
9898
|
-
return
|
|
9905
|
+
return _this65.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9899
9906
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9900
9907
|
return d.y.label || d.y.value;
|
|
9901
9908
|
}).each(function (d, i) {
|
|
@@ -9929,14 +9936,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9929
9936
|
}
|
|
9930
9937
|
});
|
|
9931
9938
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9932
|
-
return getLabelX.call(
|
|
9939
|
+
return getLabelX.call(_this65, d, series.labelPosition);
|
|
9933
9940
|
}).attr('y', function (d) {
|
|
9934
|
-
return getLabelY.call(
|
|
9941
|
+
return getLabelY.call(_this65, d, series.labelPosition);
|
|
9935
9942
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9936
|
-
if (
|
|
9943
|
+
if (_this65.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9937
9944
|
return 'transparent';
|
|
9938
9945
|
}
|
|
9939
|
-
return
|
|
9946
|
+
return _this65.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9940
9947
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9941
9948
|
return d.y.label || d.y.value;
|
|
9942
9949
|
}).each(function (d, i) {
|
|
@@ -10014,32 +10021,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10014
10021
|
}, {
|
|
10015
10022
|
key: "renderline",
|
|
10016
10023
|
value: function renderline(series, index) {
|
|
10017
|
-
var
|
|
10024
|
+
var _this66 = this;
|
|
10018
10025
|
/* global series index d3 */
|
|
10019
10026
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
10020
10027
|
return d3.line().x(function (d) {
|
|
10021
|
-
if (
|
|
10022
|
-
return
|
|
10028
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10029
|
+
return _this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10023
10030
|
} else {
|
|
10024
|
-
if (
|
|
10025
|
-
return
|
|
10031
|
+
if (_this66.options.data[xAxis].scale === 'Time') {
|
|
10032
|
+
return _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
|
|
10026
10033
|
} else {
|
|
10027
|
-
var xIndex =
|
|
10028
|
-
var xPos =
|
|
10029
|
-
if (
|
|
10030
|
-
xPos = xPos + (
|
|
10034
|
+
var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10035
|
+
var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10036
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10037
|
+
xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10031
10038
|
}
|
|
10032
10039
|
return xPos;
|
|
10033
10040
|
}
|
|
10034
10041
|
}
|
|
10035
10042
|
}).y(function (d) {
|
|
10036
|
-
if (
|
|
10037
|
-
var adjustment =
|
|
10038
|
-
return
|
|
10043
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10044
|
+
var adjustment = _this66.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
|
|
10045
|
+
return _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value)) + adjustment;
|
|
10039
10046
|
} else {
|
|
10040
|
-
return
|
|
10047
|
+
return _this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10041
10048
|
}
|
|
10042
|
-
}).curve(d3[curveStyle ||
|
|
10049
|
+
}).curve(d3[curveStyle || _this66.options.curveStyle]);
|
|
10043
10050
|
};
|
|
10044
10051
|
var xAxis = 'bottom';
|
|
10045
10052
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10148,14 +10155,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10148
10155
|
}, {
|
|
10149
10156
|
key: "rendersymbol",
|
|
10150
10157
|
value: function rendersymbol(series, index) {
|
|
10151
|
-
var
|
|
10158
|
+
var _this67 = this;
|
|
10152
10159
|
/* global d3 series index series.key */
|
|
10153
10160
|
var drawSymbol = function drawSymbol(size) {
|
|
10154
10161
|
return d3.symbol()
|
|
10155
10162
|
// .type(d => {
|
|
10156
10163
|
// return d3.symbols[0]
|
|
10157
10164
|
// })
|
|
10158
|
-
.size(size ||
|
|
10165
|
+
.size(size || _this67.options.symbolSize);
|
|
10159
10166
|
};
|
|
10160
10167
|
var xAxis = 'bottom';
|
|
10161
10168
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10181,27 +10188,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10181
10188
|
// else {
|
|
10182
10189
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10183
10190
|
// }
|
|
10184
|
-
var xIndex =
|
|
10185
|
-
var xPos =
|
|
10186
|
-
if (
|
|
10187
|
-
xPos = xPos + (
|
|
10188
|
-
}
|
|
10189
|
-
var adjustment =
|
|
10190
|
-
if (
|
|
10191
|
-
return "translate(".concat(
|
|
10191
|
+
var xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10192
|
+
var xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10193
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10194
|
+
xPos = xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10195
|
+
}
|
|
10196
|
+
var adjustment = _this67.options.data[xAxis].scale === 'Time' || _this67.options.data[xAxis].scale === 'Linear' ? 0 : _this67.options.data[xAxis].bandWidth / 2;
|
|
10197
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10198
|
+
return "translate(".concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10192
10199
|
} else {
|
|
10193
|
-
if (
|
|
10194
|
-
xPos =
|
|
10200
|
+
if (_this67.options.data[xAxis].scale === 'Time') {
|
|
10201
|
+
xPos = _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value));
|
|
10195
10202
|
} else {
|
|
10196
|
-
var _xIndex =
|
|
10197
|
-
var _xPos =
|
|
10198
|
-
if (
|
|
10199
|
-
_xPos = _xPos + (
|
|
10203
|
+
var _xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10204
|
+
var _xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
10205
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
10206
|
+
_xPos = _xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
10200
10207
|
}
|
|
10201
10208
|
// return xPos
|
|
10202
10209
|
}
|
|
10203
10210
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10204
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10211
|
+
return "translate(".concat(xPos, ", ").concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10205
10212
|
}
|
|
10206
10213
|
});
|
|
10207
10214
|
// Enter
|
|
@@ -10216,27 +10223,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10216
10223
|
}).attr('class', function (d) {
|
|
10217
10224
|
return "symbol symbol_".concat(series.key);
|
|
10218
10225
|
}).attr('transform', function (d) {
|
|
10219
|
-
var xIndex =
|
|
10220
|
-
var xPos =
|
|
10221
|
-
if (
|
|
10222
|
-
xPos = xPos + (
|
|
10223
|
-
}
|
|
10224
|
-
var adjustment =
|
|
10225
|
-
if (
|
|
10226
|
-
return "translate(".concat(
|
|
10226
|
+
var xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10227
|
+
var xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10228
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10229
|
+
xPos = xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10230
|
+
}
|
|
10231
|
+
var adjustment = _this67.options.data[xAxis].scale === 'Time' || _this67.options.data[xAxis].scale === 'Linear' ? 0 : _this67.options.data[xAxis].bandWidth / 2;
|
|
10232
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10233
|
+
return "translate(".concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10227
10234
|
} else {
|
|
10228
|
-
if (
|
|
10229
|
-
xPos =
|
|
10235
|
+
if (_this67.options.data[xAxis].scale === 'Time') {
|
|
10236
|
+
xPos = _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value));
|
|
10230
10237
|
} else {
|
|
10231
|
-
var _xIndex2 =
|
|
10232
|
-
var _xPos2 =
|
|
10233
|
-
if (
|
|
10234
|
-
_xPos2 = _xPos2 + (
|
|
10238
|
+
var _xIndex2 = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10239
|
+
var _xPos2 = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
10240
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
10241
|
+
_xPos2 = _xPos2 + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
10235
10242
|
}
|
|
10236
10243
|
// return xPos
|
|
10237
10244
|
}
|
|
10238
10245
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10239
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10246
|
+
return "translate(".concat(xPos, ", ").concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10240
10247
|
}
|
|
10241
10248
|
});
|
|
10242
10249
|
}
|
|
@@ -10859,7 +10866,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10859
10866
|
}, {
|
|
10860
10867
|
key: "resize",
|
|
10861
10868
|
value: function resize() {
|
|
10862
|
-
var
|
|
10869
|
+
var _this68 = this;
|
|
10863
10870
|
var el = document.getElementById(this.elementId);
|
|
10864
10871
|
if (el) {
|
|
10865
10872
|
// if (this.options.width) {
|
|
@@ -10870,7 +10877,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10870
10877
|
// }
|
|
10871
10878
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10872
10879
|
html += this._data.map(function (d, i) {
|
|
10873
|
-
return
|
|
10880
|
+
return _this68.getLegendItemHTML(d);
|
|
10874
10881
|
}).join('');
|
|
10875
10882
|
html += "\n <div>\n ";
|
|
10876
10883
|
el.innerHTML = html;
|
|
@@ -11028,7 +11035,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11028
11035
|
}, {
|
|
11029
11036
|
key: "render",
|
|
11030
11037
|
value: function render() {
|
|
11031
|
-
var
|
|
11038
|
+
var _this69 = this;
|
|
11032
11039
|
this._isRendered = false;
|
|
11033
11040
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
11034
11041
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -11036,7 +11043,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11036
11043
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
11037
11044
|
return {
|
|
11038
11045
|
value: s.label || s.key,
|
|
11039
|
-
color: s.color ||
|
|
11046
|
+
color: s.color || _this69.options.colors[i % _this69.options.colors.length]
|
|
11040
11047
|
};
|
|
11041
11048
|
});
|
|
11042
11049
|
var longestValue = legendData.map(function (s) {
|
|
@@ -11090,7 +11097,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11090
11097
|
}
|
|
11091
11098
|
if (this.polygons) {
|
|
11092
11099
|
this.polygons.forEach(function (p) {
|
|
11093
|
-
return
|
|
11100
|
+
return _this69.map.removeLayer(p);
|
|
11094
11101
|
});
|
|
11095
11102
|
}
|
|
11096
11103
|
this.polygons = [];
|
|
@@ -11144,15 +11151,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11144
11151
|
p.options = {};
|
|
11145
11152
|
}
|
|
11146
11153
|
if (!p.options.color) {
|
|
11147
|
-
p.options.color =
|
|
11154
|
+
p.options.color = _this69.options.colors[i % _this69.options.colors.length];
|
|
11148
11155
|
}
|
|
11149
11156
|
var pol = L.polygon(p.data.map(function (c) {
|
|
11150
11157
|
return c.map(function (d) {
|
|
11151
11158
|
return [d.Latitude, d.Longitude];
|
|
11152
11159
|
});
|
|
11153
|
-
}), p.options).addTo(
|
|
11154
|
-
|
|
11155
|
-
|
|
11160
|
+
}), p.options).addTo(_this69.map);
|
|
11161
|
+
_this69.polygons.push(pol);
|
|
11162
|
+
_this69.map.fitBounds(pol.getBounds());
|
|
11156
11163
|
});
|
|
11157
11164
|
}
|
|
11158
11165
|
// if (this.data.markers.length > 0) {
|