@websy/websy-designs 1.11.15 → 1.11.17
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')) {
|
|
@@ -4104,6 +4111,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
4104
4111
|
_createClass(WebsyPubSub, [{
|
|
4105
4112
|
key: "publish",
|
|
4106
4113
|
value: function publish(id, method, data) {
|
|
4114
|
+
if (!this.subscriptions) {
|
|
4115
|
+
return;
|
|
4116
|
+
}
|
|
4107
4117
|
if (arguments.length === 3) {
|
|
4108
4118
|
if (this.subscriptions[id] && this.subscriptions[id][method]) {
|
|
4109
4119
|
this.subscriptions[id][method](data);
|
|
@@ -4141,7 +4151,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
4141
4151
|
}();
|
|
4142
4152
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
4143
4153
|
function ResponsiveText(elementId, options) {
|
|
4144
|
-
var
|
|
4154
|
+
var _this32 = this;
|
|
4145
4155
|
_classCallCheck(this, ResponsiveText);
|
|
4146
4156
|
var DEFAULTS = {
|
|
4147
4157
|
textAlign: 'center',
|
|
@@ -4152,7 +4162,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4152
4162
|
this.elementId = elementId;
|
|
4153
4163
|
this.canvas = document.createElement('canvas');
|
|
4154
4164
|
window.addEventListener('resize', function () {
|
|
4155
|
-
return
|
|
4165
|
+
return _this32.render();
|
|
4156
4166
|
});
|
|
4157
4167
|
var el = document.getElementById(this.elementId);
|
|
4158
4168
|
if (el) {
|
|
@@ -4342,7 +4352,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4342
4352
|
/* global WebsyDesigns */
|
|
4343
4353
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
4344
4354
|
function WebsyResultList(elementId, options) {
|
|
4345
|
-
var
|
|
4355
|
+
var _this33 = this;
|
|
4346
4356
|
_classCallCheck(this, WebsyResultList);
|
|
4347
4357
|
var DEFAULTS = {
|
|
4348
4358
|
listeners: {
|
|
@@ -4368,8 +4378,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4368
4378
|
}
|
|
4369
4379
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4370
4380
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4371
|
-
|
|
4372
|
-
|
|
4381
|
+
_this33.options.template = templateString;
|
|
4382
|
+
_this33.render();
|
|
4373
4383
|
});
|
|
4374
4384
|
} else {
|
|
4375
4385
|
this.render();
|
|
@@ -4391,7 +4401,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4391
4401
|
}, {
|
|
4392
4402
|
key: "buildHTML",
|
|
4393
4403
|
value: function buildHTML() {
|
|
4394
|
-
var
|
|
4404
|
+
var _this34 = this;
|
|
4395
4405
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4396
4406
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4397
4407
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -4400,7 +4410,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4400
4410
|
if (this.options.template) {
|
|
4401
4411
|
if (d.length > 0) {
|
|
4402
4412
|
d.forEach(function (row, ix) {
|
|
4403
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4413
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this34.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
4404
4414
|
// find conditional elements
|
|
4405
4415
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4406
4416
|
ifMatches.forEach(function (m) {
|
|
@@ -4488,7 +4498,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4488
4498
|
parts.forEach(function (p) {
|
|
4489
4499
|
items = items[p];
|
|
4490
4500
|
});
|
|
4491
|
-
template = template.replace(m[0],
|
|
4501
|
+
template = template.replace(m[0], _this34.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4492
4502
|
}
|
|
4493
4503
|
});
|
|
4494
4504
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4497,7 +4507,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4497
4507
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4498
4508
|
}
|
|
4499
4509
|
});
|
|
4500
|
-
var flatRow =
|
|
4510
|
+
var flatRow = _this34.flattenObject(row);
|
|
4501
4511
|
for (var key in flatRow) {
|
|
4502
4512
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4503
4513
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4622,15 +4632,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4622
4632
|
}, {
|
|
4623
4633
|
key: "render",
|
|
4624
4634
|
value: function render() {
|
|
4625
|
-
var
|
|
4635
|
+
var _this35 = this;
|
|
4626
4636
|
if (this.options.entity) {
|
|
4627
4637
|
var url = this.options.entity;
|
|
4628
4638
|
if (this.options.sortField) {
|
|
4629
4639
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4630
4640
|
}
|
|
4631
4641
|
this.apiService.get(url).then(function (results) {
|
|
4632
|
-
|
|
4633
|
-
|
|
4642
|
+
_this35.rows = results.rows;
|
|
4643
|
+
_this35.resize();
|
|
4634
4644
|
});
|
|
4635
4645
|
} else {
|
|
4636
4646
|
this.resize();
|
|
@@ -4709,12 +4719,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4709
4719
|
_createClass(WebsyRouter, [{
|
|
4710
4720
|
key: "addGroup",
|
|
4711
4721
|
value: function addGroup(group) {
|
|
4712
|
-
var
|
|
4722
|
+
var _this36 = this;
|
|
4713
4723
|
if (!this.groups[group]) {
|
|
4714
4724
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4715
4725
|
if (els) {
|
|
4716
4726
|
this.getClosestParent(els[0], function (parent) {
|
|
4717
|
-
|
|
4727
|
+
_this36.groups[group] = {
|
|
4718
4728
|
activeView: '',
|
|
4719
4729
|
views: [],
|
|
4720
4730
|
parent: parent.getAttribute('data-view')
|
|
@@ -4778,7 +4788,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4778
4788
|
}, {
|
|
4779
4789
|
key: "removeUrlParams",
|
|
4780
4790
|
value: function removeUrlParams() {
|
|
4781
|
-
var
|
|
4791
|
+
var _this37 = this;
|
|
4782
4792
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4783
4793
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4784
4794
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4786,7 +4796,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4786
4796
|
var path = '';
|
|
4787
4797
|
if (this.currentParams && this.currentParams.items) {
|
|
4788
4798
|
params.forEach(function (p) {
|
|
4789
|
-
delete
|
|
4799
|
+
delete _this37.currentParams.items[p];
|
|
4790
4800
|
});
|
|
4791
4801
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4792
4802
|
}
|
|
@@ -5117,11 +5127,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5117
5127
|
}, {
|
|
5118
5128
|
key: "showComponents",
|
|
5119
5129
|
value: function showComponents(view) {
|
|
5120
|
-
var
|
|
5130
|
+
var _this38 = this;
|
|
5121
5131
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
5122
5132
|
this.options.views[view].components.forEach(function (c) {
|
|
5123
5133
|
if (typeof c.instance === 'undefined') {
|
|
5124
|
-
|
|
5134
|
+
_this38.prepComponent(c.elementId, c.options);
|
|
5125
5135
|
c.instance = new c.Component(c.elementId, c.options);
|
|
5126
5136
|
} else if (c.instance.render) {
|
|
5127
5137
|
c.instance.render();
|
|
@@ -5141,42 +5151,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5141
5151
|
}, {
|
|
5142
5152
|
key: "initView",
|
|
5143
5153
|
value: function initView(view) {
|
|
5144
|
-
var
|
|
5154
|
+
var _this39 = this;
|
|
5145
5155
|
return new Promise(function (resolve, reject) {
|
|
5146
|
-
if (!
|
|
5147
|
-
|
|
5156
|
+
if (!_this39.options.views[view]) {
|
|
5157
|
+
_this39.options.views[view] = {
|
|
5148
5158
|
components: []
|
|
5149
5159
|
};
|
|
5150
5160
|
}
|
|
5151
|
-
if (
|
|
5161
|
+
if (_this39.options.views[view].ready === true) {
|
|
5152
5162
|
resolve();
|
|
5153
|
-
} else if (
|
|
5154
|
-
|
|
5163
|
+
} else if (_this39.options.views[view].template) {
|
|
5164
|
+
_this39.preloadView(view, function () {
|
|
5155
5165
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5156
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
5166
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this39.options.viewClass));
|
|
5157
5167
|
if (viewEl) {
|
|
5158
|
-
|
|
5159
|
-
template:
|
|
5168
|
+
_this39.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
5169
|
+
template: _this39.options.views[view].template,
|
|
5160
5170
|
data: data,
|
|
5161
5171
|
readyCallbackFn: function readyCallbackFn() {
|
|
5162
|
-
|
|
5172
|
+
_this39.options.views[view].ready = true;
|
|
5163
5173
|
resolve();
|
|
5164
5174
|
}
|
|
5165
5175
|
});
|
|
5166
5176
|
} else {
|
|
5167
5177
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
5168
|
-
|
|
5178
|
+
_this39.options.views[view].ready = true;
|
|
5169
5179
|
resolve();
|
|
5170
5180
|
}
|
|
5171
5181
|
});
|
|
5172
|
-
} else if (
|
|
5173
|
-
|
|
5182
|
+
} else if (_this39.options.views[view].ready !== true && _this39.options.views[view].load) {
|
|
5183
|
+
_this39.preloadView(view, function () {
|
|
5174
5184
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5175
|
-
|
|
5185
|
+
_this39.options.views[view].ready = true;
|
|
5176
5186
|
resolve();
|
|
5177
5187
|
});
|
|
5178
5188
|
} else {
|
|
5179
|
-
|
|
5189
|
+
_this39.options.views[view].ready = true;
|
|
5180
5190
|
resolve();
|
|
5181
5191
|
}
|
|
5182
5192
|
});
|
|
@@ -5184,35 +5194,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5184
5194
|
}, {
|
|
5185
5195
|
key: "showView",
|
|
5186
5196
|
value: function showView(view, params, group) {
|
|
5187
|
-
var
|
|
5197
|
+
var _this40 = this;
|
|
5188
5198
|
if (view === '/' || view === '') {
|
|
5189
5199
|
view = this.options.defaultView || '';
|
|
5190
5200
|
}
|
|
5191
5201
|
this.initView(view).then(function () {
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
var children =
|
|
5202
|
+
_this40.activateItem(view, _this40.options.triggerClass);
|
|
5203
|
+
_this40.activateItem(view, _this40.options.viewClass);
|
|
5204
|
+
var children = _this40.getActiveViewsFromParent(view);
|
|
5195
5205
|
for (var c = 0; c < children.length; c++) {
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5206
|
+
_this40.activateItem(children[c].view, _this40.options.triggerClass);
|
|
5207
|
+
_this40.activateItem(children[c].view, _this40.options.viewClass);
|
|
5208
|
+
_this40.showComponents(children[c].view);
|
|
5199
5209
|
if (children[c].show) {
|
|
5200
5210
|
children[c].show.call(children[c]);
|
|
5201
5211
|
}
|
|
5202
|
-
|
|
5212
|
+
_this40.publish('show', [children[c].view, null, group]);
|
|
5203
5213
|
}
|
|
5204
|
-
if (
|
|
5205
|
-
|
|
5206
|
-
if (
|
|
5207
|
-
|
|
5214
|
+
if (_this40.previousView !== _this40.currentView || group !== 'main') {
|
|
5215
|
+
_this40.showComponents(view);
|
|
5216
|
+
if (_this40.options.views[view].show) {
|
|
5217
|
+
_this40.options.views[view].show.call(_this40.options.views[view]);
|
|
5208
5218
|
}
|
|
5209
|
-
|
|
5210
|
-
} else if (
|
|
5211
|
-
|
|
5212
|
-
if (
|
|
5213
|
-
|
|
5219
|
+
_this40.publish('show', [view, params, group]);
|
|
5220
|
+
} else if (_this40.previousView === _this40.currentView && _this40.previousParams.path !== _this40.currentParams.path) {
|
|
5221
|
+
_this40.showComponents(view);
|
|
5222
|
+
if (_this40.options.views[view].show) {
|
|
5223
|
+
_this40.options.views[view].show.call(_this40.options.views[view]);
|
|
5214
5224
|
}
|
|
5215
|
-
|
|
5225
|
+
_this40.publish('show', [view, params, group]);
|
|
5216
5226
|
}
|
|
5217
5227
|
});
|
|
5218
5228
|
}
|
|
@@ -5606,7 +5616,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5606
5616
|
}, {
|
|
5607
5617
|
key: "handleKeyUp",
|
|
5608
5618
|
value: function handleKeyUp(event) {
|
|
5609
|
-
var
|
|
5619
|
+
var _this41 = this;
|
|
5610
5620
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5611
5621
|
this.cursorPosition = event.target.selectionStart;
|
|
5612
5622
|
this.searchText = event.target.value;
|
|
@@ -5629,8 +5639,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5629
5639
|
}
|
|
5630
5640
|
if (event.target.value.length >= this.options.minLength) {
|
|
5631
5641
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5632
|
-
if (
|
|
5633
|
-
|
|
5642
|
+
if (_this41.options.onSearch) {
|
|
5643
|
+
_this41.options.onSearch(event.target.value, event);
|
|
5634
5644
|
}
|
|
5635
5645
|
}, this.options.searchTimeout);
|
|
5636
5646
|
} else {
|
|
@@ -5680,7 +5690,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5680
5690
|
}, {
|
|
5681
5691
|
key: "highlightActiveSuggestion",
|
|
5682
5692
|
value: function highlightActiveSuggestion() {
|
|
5683
|
-
var
|
|
5693
|
+
var _this42 = this;
|
|
5684
5694
|
// remove all previous highlights
|
|
5685
5695
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5686
5696
|
// if (parent) {
|
|
@@ -5699,7 +5709,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5699
5709
|
Array.from(els).forEach(function (e) {
|
|
5700
5710
|
e.classList.remove('active');
|
|
5701
5711
|
var index = e.getAttribute('data-index');
|
|
5702
|
-
if (+index ===
|
|
5712
|
+
if (+index === _this42.activeSuggestion) {
|
|
5703
5713
|
e.classList.add('active');
|
|
5704
5714
|
}
|
|
5705
5715
|
});
|
|
@@ -5819,13 +5829,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5819
5829
|
}, {
|
|
5820
5830
|
key: "startSuggestionTimeout",
|
|
5821
5831
|
value: function startSuggestionTimeout() {
|
|
5822
|
-
var
|
|
5832
|
+
var _this43 = this;
|
|
5823
5833
|
if (this.suggestingTimeoutFn) {
|
|
5824
5834
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5825
5835
|
}
|
|
5826
5836
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5827
5837
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5828
|
-
|
|
5838
|
+
_this43.hideSuggestions(_this43);
|
|
5829
5839
|
}, this.options.suggestingTimeout);
|
|
5830
5840
|
}
|
|
5831
5841
|
}, {
|
|
@@ -5997,7 +6007,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5997
6007
|
/* global WebsyDesigns */
|
|
5998
6008
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5999
6009
|
function WebsyTemplate(elementId, options) {
|
|
6000
|
-
var
|
|
6010
|
+
var _this44 = this;
|
|
6001
6011
|
_classCallCheck(this, WebsyTemplate);
|
|
6002
6012
|
var DEFAULTS = {
|
|
6003
6013
|
listeners: {
|
|
@@ -6026,8 +6036,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6026
6036
|
}
|
|
6027
6037
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
6028
6038
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
6029
|
-
|
|
6030
|
-
|
|
6039
|
+
_this44.options.template = templateString;
|
|
6040
|
+
_this44.render();
|
|
6031
6041
|
});
|
|
6032
6042
|
} else {
|
|
6033
6043
|
this.render();
|
|
@@ -6036,7 +6046,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6036
6046
|
_createClass(WebsyTemplate, [{
|
|
6037
6047
|
key: "buildHTML",
|
|
6038
6048
|
value: function buildHTML() {
|
|
6039
|
-
var
|
|
6049
|
+
var _this45 = this;
|
|
6040
6050
|
var html = "";
|
|
6041
6051
|
if (this.options.template) {
|
|
6042
6052
|
var template = this.options.template;
|
|
@@ -6085,14 +6095,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6085
6095
|
}
|
|
6086
6096
|
}
|
|
6087
6097
|
if (polarity === true) {
|
|
6088
|
-
if (typeof
|
|
6098
|
+
if (typeof _this45.options.data[parts[0]] !== 'undefined' && _this45.options.data[parts[0]] === parts[1]) {
|
|
6089
6099
|
// remove the <if> tags
|
|
6090
6100
|
removeAll = false;
|
|
6091
6101
|
} else if (parts[0] === parts[1]) {
|
|
6092
6102
|
removeAll = false;
|
|
6093
6103
|
}
|
|
6094
6104
|
} else if (polarity === false) {
|
|
6095
|
-
if (typeof
|
|
6105
|
+
if (typeof _this45.options.data[parts[0]] !== 'undefined' && _this45.options.data[parts[0]] !== parts[1]) {
|
|
6096
6106
|
// remove the <if> tags
|
|
6097
6107
|
removeAll = false;
|
|
6098
6108
|
}
|
|
@@ -6411,7 +6421,7 @@ var WebsyUtils = {
|
|
|
6411
6421
|
/* global WebsyDesigns */
|
|
6412
6422
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6413
6423
|
function WebsyTable(elementId, options) {
|
|
6414
|
-
var
|
|
6424
|
+
var _this46 = this;
|
|
6415
6425
|
_classCallCheck(this, WebsyTable);
|
|
6416
6426
|
var DEFAULTS = {
|
|
6417
6427
|
pageSize: 20,
|
|
@@ -6444,8 +6454,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6444
6454
|
allowClear: false,
|
|
6445
6455
|
disableSearch: true,
|
|
6446
6456
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6447
|
-
if (
|
|
6448
|
-
|
|
6457
|
+
if (_this46.options.onChangePageSize) {
|
|
6458
|
+
_this46.options.onChangePageSize(selectedItem.value);
|
|
6449
6459
|
}
|
|
6450
6460
|
}
|
|
6451
6461
|
});
|
|
@@ -6469,20 +6479,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6469
6479
|
}, {
|
|
6470
6480
|
key: "appendRows",
|
|
6471
6481
|
value: function appendRows(data) {
|
|
6472
|
-
var
|
|
6482
|
+
var _this47 = this;
|
|
6473
6483
|
this._isRendered = false;
|
|
6474
6484
|
this.hideError();
|
|
6475
6485
|
var bodyHTML = '';
|
|
6476
6486
|
if (data) {
|
|
6477
6487
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6478
6488
|
return '<tr>' + r.map(function (c, i) {
|
|
6479
|
-
if (
|
|
6489
|
+
if (_this47.options.columns[i].show !== false) {
|
|
6480
6490
|
var style = '';
|
|
6481
6491
|
if (c.style) {
|
|
6482
6492
|
style += c.style;
|
|
6483
6493
|
}
|
|
6484
|
-
if (
|
|
6485
|
-
style += "width: ".concat(
|
|
6494
|
+
if (_this47.options.columns[i].width) {
|
|
6495
|
+
style += "width: ".concat(_this47.options.columns[i].width, "; ");
|
|
6486
6496
|
}
|
|
6487
6497
|
if (c.backgroundColor) {
|
|
6488
6498
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6493,20 +6503,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6493
6503
|
if (c.color) {
|
|
6494
6504
|
style += "color: ".concat(c.color, "; ");
|
|
6495
6505
|
}
|
|
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(
|
|
6506
|
+
if (_this47.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6507
|
+
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 ");
|
|
6508
|
+
} else if ((_this47.options.columns[i].showAsNavigatorLink === true || _this47.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6509
|
+
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
6510
|
} else {
|
|
6501
6511
|
var info = c.value;
|
|
6502
|
-
if (
|
|
6512
|
+
if (_this47.options.columns[i].showAsImage === true) {
|
|
6503
6513
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6504
6514
|
}
|
|
6505
6515
|
var html = "\n <td \n ";
|
|
6506
|
-
if (!
|
|
6516
|
+
if (!_this47.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
6507
6517
|
html += "\n data-info='".concat(info, "'\n ");
|
|
6508
6518
|
}
|
|
6509
|
-
html += "\n data-row-index='".concat(
|
|
6519
|
+
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
6520
|
return html;
|
|
6511
6521
|
}
|
|
6512
6522
|
}
|
|
@@ -6667,7 +6677,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6667
6677
|
}, {
|
|
6668
6678
|
key: "render",
|
|
6669
6679
|
value: function render(data) {
|
|
6670
|
-
var
|
|
6680
|
+
var _this48 = this;
|
|
6671
6681
|
this._isRendered = false;
|
|
6672
6682
|
if (!this.options.columns) {
|
|
6673
6683
|
return;
|
|
@@ -6695,7 +6705,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6695
6705
|
if (c.width) {
|
|
6696
6706
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6697
6707
|
}
|
|
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 ?
|
|
6708
|
+
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
6709
|
}
|
|
6700
6710
|
}).join('') + '</tr>';
|
|
6701
6711
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6713,7 +6723,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6713
6723
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6714
6724
|
if (pagingEl) {
|
|
6715
6725
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6716
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6726
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this48.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6717
6727
|
});
|
|
6718
6728
|
var startIndex = 0;
|
|
6719
6729
|
if (this.options.pageCount > 8) {
|
|
@@ -6769,7 +6779,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6769
6779
|
/* global WebsyDesigns */
|
|
6770
6780
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6771
6781
|
function WebsyTable2(elementId, options) {
|
|
6772
|
-
var
|
|
6782
|
+
var _this49 = this;
|
|
6773
6783
|
_classCallCheck(this, WebsyTable2);
|
|
6774
6784
|
var DEFAULTS = {
|
|
6775
6785
|
pageSize: 20,
|
|
@@ -6804,8 +6814,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6804
6814
|
allowClear: false,
|
|
6805
6815
|
disableSearch: true,
|
|
6806
6816
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6807
|
-
if (
|
|
6808
|
-
|
|
6817
|
+
if (_this49.options.onChangePageSize) {
|
|
6818
|
+
_this49.options.onChangePageSize(selectedItem.value);
|
|
6809
6819
|
}
|
|
6810
6820
|
}
|
|
6811
6821
|
});
|
|
@@ -6827,20 +6837,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6827
6837
|
_createClass(WebsyTable2, [{
|
|
6828
6838
|
key: "appendRows",
|
|
6829
6839
|
value: function appendRows(data) {
|
|
6830
|
-
var
|
|
6840
|
+
var _this50 = this;
|
|
6831
6841
|
this.hideError();
|
|
6832
6842
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6833
6843
|
var bodyHTML = '';
|
|
6834
6844
|
if (data) {
|
|
6835
6845
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6836
6846
|
return '<tr>' + r.map(function (c, i) {
|
|
6837
|
-
if (
|
|
6838
|
-
var style = "height: ".concat(
|
|
6847
|
+
if (_this50.options.columns[i].show !== false) {
|
|
6848
|
+
var style = "height: ".concat(_this50.options.cellSize, "px; line-height: ").concat(_this50.options.cellSize, "px;");
|
|
6839
6849
|
if (c.style) {
|
|
6840
6850
|
style += c.style;
|
|
6841
6851
|
}
|
|
6842
|
-
if (
|
|
6843
|
-
style += "width: ".concat(
|
|
6852
|
+
if (_this50.options.columns[i].width) {
|
|
6853
|
+
style += "width: ".concat(_this50.options.columns[i].width, "; ");
|
|
6844
6854
|
}
|
|
6845
6855
|
if (c.backgroundColor) {
|
|
6846
6856
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6851,16 +6861,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6851
6861
|
if (c.color) {
|
|
6852
6862
|
style += "color: ".concat(c.color, "; ");
|
|
6853
6863
|
}
|
|
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(
|
|
6864
|
+
if (_this50.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6865
|
+
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 ");
|
|
6866
|
+
} else if ((_this50.options.columns[i].showAsNavigatorLink === true || _this50.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6867
|
+
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
6868
|
} else {
|
|
6859
6869
|
var info = c.value;
|
|
6860
|
-
if (
|
|
6870
|
+
if (_this50.options.columns[i].showAsImage === true) {
|
|
6861
6871
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6862
6872
|
}
|
|
6863
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6873
|
+
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
6874
|
}
|
|
6865
6875
|
}
|
|
6866
6876
|
}).join('') + '</tr>';
|
|
@@ -7094,7 +7104,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7094
7104
|
}, {
|
|
7095
7105
|
key: "render",
|
|
7096
7106
|
value: function render(data) {
|
|
7097
|
-
var
|
|
7107
|
+
var _this51 = this;
|
|
7098
7108
|
if (!this.options.columns) {
|
|
7099
7109
|
return;
|
|
7100
7110
|
}
|
|
@@ -7122,7 +7132,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7122
7132
|
if (c.width) {
|
|
7123
7133
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
7124
7134
|
}
|
|
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 ?
|
|
7135
|
+
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
7136
|
}
|
|
7127
7137
|
}).join('') + '</tr>';
|
|
7128
7138
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -7132,7 +7142,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7132
7142
|
var dropdownHTML = "";
|
|
7133
7143
|
this.options.columns.forEach(function (c, i) {
|
|
7134
7144
|
if (c.searchable && c.searchField) {
|
|
7135
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
7145
|
+
dropdownHTML += "\n <div id=\"".concat(_this51.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
7136
7146
|
}
|
|
7137
7147
|
});
|
|
7138
7148
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -7152,7 +7162,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7152
7162
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
7153
7163
|
if (pagingEl) {
|
|
7154
7164
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
7155
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
7165
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this51.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
7156
7166
|
});
|
|
7157
7167
|
var startIndex = 0;
|
|
7158
7168
|
if (this.options.pageCount > 8) {
|
|
@@ -7229,17 +7239,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7229
7239
|
}, {
|
|
7230
7240
|
key: "getColumnParameters",
|
|
7231
7241
|
value: function getColumnParameters(values) {
|
|
7232
|
-
var
|
|
7242
|
+
var _this52 = this;
|
|
7233
7243
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
7234
7244
|
tableEl.style.tableLayout = 'auto';
|
|
7235
7245
|
tableEl.style.width = 'auto';
|
|
7236
7246
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
7237
7247
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
7238
7248
|
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 ?
|
|
7249
|
+
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
7250
|
}).join('') + '</tr>';
|
|
7241
7251
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
7242
|
-
return "\n <td \n style='height: ".concat(
|
|
7252
|
+
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
7253
|
}).join('') + '</tr>';
|
|
7244
7254
|
// get height of the first data cell
|
|
7245
7255
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7403,7 +7413,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7403
7413
|
}, {
|
|
7404
7414
|
key: "buildBodyHtml",
|
|
7405
7415
|
value: function buildBodyHtml() {
|
|
7406
|
-
var
|
|
7416
|
+
var _this53 = this;
|
|
7407
7417
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7408
7418
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7409
7419
|
if (!this.options.columns) {
|
|
@@ -7428,7 +7438,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7428
7438
|
row.forEach(function (cell, cellIndex) {
|
|
7429
7439
|
var sizeIndex = cell.level || cellIndex;
|
|
7430
7440
|
var colIndex = cell.index || cellIndex;
|
|
7431
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7441
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this53.options.columns[_this53.options.columns.length - 1][colIndex].show === false) {
|
|
7432
7442
|
return; // need to revisit this logic
|
|
7433
7443
|
}
|
|
7434
7444
|
|
|
@@ -7455,7 +7465,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7455
7465
|
style += "color: ".concat(cell.color, "; ");
|
|
7456
7466
|
}
|
|
7457
7467
|
// console.log('rowspan', cell.rowspan)
|
|
7458
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
7468
|
+
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
7469
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
7460
7470
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
7461
7471
|
}
|
|
@@ -7468,10 +7478,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7468
7478
|
// }
|
|
7469
7479
|
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
7480
|
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(
|
|
7481
|
+
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
7482
|
}
|
|
7473
7483
|
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(
|
|
7484
|
+
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
7485
|
}
|
|
7476
7486
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7477
7487
|
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 +7502,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7492
7502
|
}, {
|
|
7493
7503
|
key: "buildHeaderHtml",
|
|
7494
7504
|
value: function buildHeaderHtml() {
|
|
7495
|
-
var
|
|
7505
|
+
var _this54 = this;
|
|
7496
7506
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7497
7507
|
if (!this.options.columns) {
|
|
7498
7508
|
return '';
|
|
@@ -7513,7 +7523,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7513
7523
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7514
7524
|
// return
|
|
7515
7525
|
// }
|
|
7516
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
7526
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this54.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
7517
7527
|
row.filter(function (c) {
|
|
7518
7528
|
return c.show !== false;
|
|
7519
7529
|
}).forEach(function (col, colIndex) {
|
|
@@ -7533,24 +7543,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7533
7543
|
if (col.style) {
|
|
7534
7544
|
style += col.style;
|
|
7535
7545
|
}
|
|
7536
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7546
|
+
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
7547
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7538
7548
|
// headerHtml += `
|
|
7539
7549
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7540
7550
|
// width='${col.width || col.actualWidth}'
|
|
7541
7551
|
// `
|
|
7542
7552
|
// }
|
|
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 ?
|
|
7553
|
+
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
7554
|
});
|
|
7545
7555
|
headerHtml += "</tr>";
|
|
7546
7556
|
});
|
|
7547
7557
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7548
7558
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7549
7559
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7550
|
-
var testEl = document.getElementById("".concat(
|
|
7560
|
+
var testEl = document.getElementById("".concat(_this54.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7551
7561
|
if (!testEl) {
|
|
7552
7562
|
var newE = document.createElement('div');
|
|
7553
|
-
newE.id = "".concat(
|
|
7563
|
+
newE.id = "".concat(_this54.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7554
7564
|
newE.className = 'websy-modal-dropdown';
|
|
7555
7565
|
dropdownEl.appendChild(newE);
|
|
7556
7566
|
}
|
|
@@ -7573,7 +7583,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7573
7583
|
}, {
|
|
7574
7584
|
key: "buildTotalHtml",
|
|
7575
7585
|
value: function buildTotalHtml() {
|
|
7576
|
-
var
|
|
7586
|
+
var _this55 = this;
|
|
7577
7587
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7578
7588
|
if (!this.options.totals) {
|
|
7579
7589
|
return '';
|
|
@@ -7589,7 +7599,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7589
7599
|
|
|
7590
7600
|
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
7601
|
if (useWidths === true) {
|
|
7592
|
-
totalHtml += "\n style='width: ".concat(
|
|
7602
|
+
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
7603
|
}
|
|
7594
7604
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7595
7605
|
});
|
|
@@ -7599,7 +7609,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7599
7609
|
}, {
|
|
7600
7610
|
key: "calculateSizes",
|
|
7601
7611
|
value: function calculateSizes() {
|
|
7602
|
-
var
|
|
7612
|
+
var _this56 = this;
|
|
7603
7613
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7604
7614
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7605
7615
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7643,7 +7653,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7643
7653
|
rows.forEach(function (row, rowIndex) {
|
|
7644
7654
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7645
7655
|
var colSize = col.getBoundingClientRect();
|
|
7646
|
-
|
|
7656
|
+
_this56.sizes.cellHeight = colSize.height;
|
|
7647
7657
|
if (columnsForSizing[colIndex]) {
|
|
7648
7658
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7649
7659
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7655,7 +7665,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7655
7665
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7656
7666
|
// }
|
|
7657
7667
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7658
|
-
if (colIndex >=
|
|
7668
|
+
if (colIndex >= _this56.pinnedColumns) {
|
|
7659
7669
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7660
7670
|
}
|
|
7661
7671
|
}
|
|
@@ -7670,7 +7680,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7670
7680
|
return a + (b.width || b.actualWidth);
|
|
7671
7681
|
}, 0);
|
|
7672
7682
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7673
|
-
return i >=
|
|
7683
|
+
return i >= _this56.pinnedColumns;
|
|
7674
7684
|
}).reduce(function (a, b) {
|
|
7675
7685
|
return a + (b.width || b.actualWidth);
|
|
7676
7686
|
}, 0);
|
|
@@ -7681,7 +7691,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7681
7691
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7682
7692
|
columnsForSizing.forEach(function (c) {
|
|
7683
7693
|
c.shouldGrow = true;
|
|
7684
|
-
if (
|
|
7694
|
+
if (_this56.options.autoFitColumns === false) {
|
|
7685
7695
|
c.shouldGrow = false;
|
|
7686
7696
|
if (c.potentialWidth > c.actualWidth) {
|
|
7687
7697
|
c.shouldGrow = true;
|
|
@@ -7700,7 +7710,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7700
7710
|
// if (!c.width) {
|
|
7701
7711
|
// if (c.actualWidth < equalWidth) {
|
|
7702
7712
|
// adjust the width
|
|
7703
|
-
if (
|
|
7713
|
+
if (_this56.options.autoFitColumns === true) {
|
|
7704
7714
|
if (c.width) {
|
|
7705
7715
|
c.width += equalWidth;
|
|
7706
7716
|
}
|
|
@@ -7724,9 +7734,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7724
7734
|
}
|
|
7725
7735
|
// }
|
|
7726
7736
|
// }
|
|
7727
|
-
|
|
7728
|
-
if (i >
|
|
7729
|
-
|
|
7737
|
+
_this56.sizes.totalWidth += c.width || c.actualWidth;
|
|
7738
|
+
if (i > _this56.pinnedColumns) {
|
|
7739
|
+
_this56.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7730
7740
|
}
|
|
7731
7741
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7732
7742
|
});
|
|
@@ -7785,7 +7795,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7785
7795
|
}, {
|
|
7786
7796
|
key: "createSample",
|
|
7787
7797
|
value: function createSample(data) {
|
|
7788
|
-
var
|
|
7798
|
+
var _this57 = this;
|
|
7789
7799
|
var output = [];
|
|
7790
7800
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7791
7801
|
if (col.maxLength) {
|
|
@@ -7795,7 +7805,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7795
7805
|
} else if (data) {
|
|
7796
7806
|
var longest = '';
|
|
7797
7807
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7798
|
-
if (data[i].length ===
|
|
7808
|
+
if (data[i].length === _this57.options.columns[_this57.options.columns.length - 1].length) {
|
|
7799
7809
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7800
7810
|
longest = data[i][colIndex].value;
|
|
7801
7811
|
}
|
|
@@ -8067,7 +8077,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8067
8077
|
}, {
|
|
8068
8078
|
key: "perpetualScroll",
|
|
8069
8079
|
value: function perpetualScroll() {
|
|
8070
|
-
var
|
|
8080
|
+
var _this58 = this;
|
|
8071
8081
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
8072
8082
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
8073
8083
|
return;
|
|
@@ -8086,17 +8096,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8086
8096
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
8087
8097
|
var _loop2 = function _loop2(i) {
|
|
8088
8098
|
setTimeout(function () {
|
|
8089
|
-
var delta =
|
|
8099
|
+
var delta = _this58.mouseYStart - _this58.currentClientY + _this58.sizes.cellHeight * (i + 1) * direction;
|
|
8090
8100
|
delta = Math.min(10, delta);
|
|
8091
8101
|
delta = Math.max(-10, delta);
|
|
8092
8102
|
// only run this if isPerpetual === true
|
|
8093
8103
|
// this value is reset to false on touchStart
|
|
8094
|
-
if (
|
|
8104
|
+
if (_this58.isPerpetual === true) {
|
|
8095
8105
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
8096
8106
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
8097
|
-
|
|
8098
|
-
if (
|
|
8099
|
-
clearTimeout(
|
|
8107
|
+
_this58.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
8108
|
+
if (_this58.scrollTimeout) {
|
|
8109
|
+
clearTimeout(_this58.scrollTimeout);
|
|
8100
8110
|
}
|
|
8101
8111
|
}
|
|
8102
8112
|
}, 1000 / fps * i);
|
|
@@ -8364,7 +8374,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8364
8374
|
/* global d3 include WebsyDesigns */
|
|
8365
8375
|
var WebsyChart = /*#__PURE__*/function () {
|
|
8366
8376
|
function WebsyChart(elementId, options) {
|
|
8367
|
-
var
|
|
8377
|
+
var _this59 = this;
|
|
8368
8378
|
_classCallCheck(this, WebsyChart);
|
|
8369
8379
|
var DEFAULTS = {
|
|
8370
8380
|
margin: {
|
|
@@ -8423,7 +8433,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8423
8433
|
this.invertOverride = function (input, input2) {
|
|
8424
8434
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8425
8435
|
var xAxis = 'bottom';
|
|
8426
|
-
if (
|
|
8436
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
8427
8437
|
xAxis = 'left';
|
|
8428
8438
|
}
|
|
8429
8439
|
if (forBrush === true) {
|
|
@@ -8431,12 +8441,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8431
8441
|
}
|
|
8432
8442
|
xAxis += 'Axis';
|
|
8433
8443
|
var output;
|
|
8434
|
-
var width =
|
|
8444
|
+
var width = _this59.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8435
8445
|
// if (this.customBottomRange) {
|
|
8436
|
-
for (var index = 0; index <
|
|
8437
|
-
if (input >
|
|
8438
|
-
if (
|
|
8439
|
-
if (input <
|
|
8446
|
+
for (var index = 0; index < _this59.customBottomRange.length; index++) {
|
|
8447
|
+
if (input > _this59.customBottomRange[index]) {
|
|
8448
|
+
if (_this59.customBottomRange[index + 1]) {
|
|
8449
|
+
if (input < _this59.customBottomRange[index + 1]) {
|
|
8440
8450
|
output = index;
|
|
8441
8451
|
break;
|
|
8442
8452
|
}
|
|
@@ -8601,9 +8611,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8601
8611
|
}, {
|
|
8602
8612
|
key: "handleEventMouseMove",
|
|
8603
8613
|
value: function handleEventMouseMove(event, d) {
|
|
8604
|
-
var
|
|
8614
|
+
var _this60 = this;
|
|
8605
8615
|
var bisectDate = d3.bisector(function (d) {
|
|
8606
|
-
return
|
|
8616
|
+
return _this60.parseX(d.x.value);
|
|
8607
8617
|
}).left;
|
|
8608
8618
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8609
8619
|
var xAxis = 'bottomAxis';
|
|
@@ -8636,9 +8646,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8636
8646
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8637
8647
|
}
|
|
8638
8648
|
this.options.data.series.forEach(function (s) {
|
|
8639
|
-
if (
|
|
8649
|
+
if (_this60.options.data[xData].scale !== 'Time') {
|
|
8640
8650
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8641
|
-
xPoint =
|
|
8651
|
+
xPoint = _this60.customBottomRange[x0] + (_this60.customBottomRange[x0 + 1] - _this60.customBottomRange[x0]) / 2;
|
|
8642
8652
|
// }
|
|
8643
8653
|
// else {
|
|
8644
8654
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8658,41 +8668,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8658
8668
|
var index = bisectDate(s.data, x0, 1);
|
|
8659
8669
|
var pointA = s.data[index - 1];
|
|
8660
8670
|
var pointB = s.data[index];
|
|
8661
|
-
if (
|
|
8671
|
+
if (_this60.options.orientation === 'horizontal') {
|
|
8662
8672
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8663
8673
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8664
8674
|
}
|
|
8665
8675
|
if (pointA && !pointB) {
|
|
8666
|
-
xPoint =
|
|
8676
|
+
xPoint = _this60[xAxis](_this60.parseX(pointA.x.value));
|
|
8667
8677
|
tooltipTitle = pointA.x.value;
|
|
8668
8678
|
if (!pointA.y.color) {
|
|
8669
8679
|
pointA.y.color = s.color;
|
|
8670
8680
|
}
|
|
8671
8681
|
tooltipData.push(pointA);
|
|
8672
8682
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8673
|
-
tooltipTitle = d3.timeFormat(
|
|
8683
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8674
8684
|
}
|
|
8675
8685
|
}
|
|
8676
8686
|
if (pointB && !pointA) {
|
|
8677
|
-
xPoint =
|
|
8687
|
+
xPoint = _this60[xAxis](_this60.parseX(pointB.x.value));
|
|
8678
8688
|
tooltipTitle = pointB.x.value;
|
|
8679
8689
|
if (!pointB.y.color) {
|
|
8680
8690
|
pointB.y.color = s.color;
|
|
8681
8691
|
}
|
|
8682
8692
|
tooltipData.push(pointB);
|
|
8683
8693
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8684
|
-
tooltipTitle = d3.timeFormat(
|
|
8694
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8685
8695
|
}
|
|
8686
8696
|
}
|
|
8687
8697
|
if (pointA && pointB) {
|
|
8688
|
-
var d0 =
|
|
8689
|
-
var d1 =
|
|
8698
|
+
var d0 = _this60[xAxis](_this60.parseX(pointA.x.value));
|
|
8699
|
+
var d1 = _this60[xAxis](_this60.parseX(pointB.x.value));
|
|
8690
8700
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8691
8701
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8692
8702
|
xPoint = d1;
|
|
8693
8703
|
tooltipTitle = pointB.x.value;
|
|
8694
8704
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8695
|
-
tooltipTitle = d3.timeFormat(
|
|
8705
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8696
8706
|
}
|
|
8697
8707
|
if (!pointB.y.color) {
|
|
8698
8708
|
pointB.y.color = s.color;
|
|
@@ -8702,7 +8712,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8702
8712
|
xPoint = d0;
|
|
8703
8713
|
tooltipTitle = pointA.x.value;
|
|
8704
8714
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8705
|
-
tooltipTitle = d3.timeFormat(
|
|
8715
|
+
tooltipTitle = d3.timeFormat(_this60.options.dateFormat || _this60.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8706
8716
|
}
|
|
8707
8717
|
if (!pointA.y.color) {
|
|
8708
8718
|
pointA.y.color = s.color;
|
|
@@ -8828,7 +8838,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8828
8838
|
}, {
|
|
8829
8839
|
key: "render",
|
|
8830
8840
|
value: function render(options) {
|
|
8831
|
-
var
|
|
8841
|
+
var _this61 = this;
|
|
8832
8842
|
/* global d3 options WebsyUtils */
|
|
8833
8843
|
this._isRendered = false;
|
|
8834
8844
|
if (typeof options !== 'undefined') {
|
|
@@ -8897,7 +8907,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8897
8907
|
this.options.data.series.map(function (s, i) {
|
|
8898
8908
|
return {
|
|
8899
8909
|
value: s.label || s.key,
|
|
8900
|
-
color: s.color ||
|
|
8910
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
8901
8911
|
};
|
|
8902
8912
|
});
|
|
8903
8913
|
}
|
|
@@ -9254,25 +9264,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9254
9264
|
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
9265
|
var acc = 0;
|
|
9256
9266
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9257
|
-
var adjustment =
|
|
9267
|
+
var adjustment = _this61.bandPadding * index + _this61.bandPadding;
|
|
9258
9268
|
// if (this.options.data.bottom.padding) {
|
|
9259
9269
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9260
9270
|
// }
|
|
9261
|
-
var start =
|
|
9271
|
+
var start = _this61.widthForCalc / noOfPoints * acc;
|
|
9262
9272
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9263
9273
|
var pos = i * proposedBandWidth;
|
|
9264
|
-
|
|
9274
|
+
_this61["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9265
9275
|
}
|
|
9266
|
-
acc +=
|
|
9267
|
-
var end =
|
|
9276
|
+
acc += _this61.options.grouping !== 'stacked' && _this61.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9277
|
+
var end = _this61.widthForCalc / noOfPoints * acc;
|
|
9268
9278
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9269
9279
|
return end + adjustment;
|
|
9270
9280
|
})));
|
|
9271
9281
|
acc = 0;
|
|
9272
9282
|
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 (
|
|
9283
|
+
var adjustment = _this61.brushBandPadding * index + _this61.brushBandPadding;
|
|
9284
|
+
acc += _this61.options.grouping !== 'stacked' && _this61.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9285
|
+
return (_this61.options.orientation === 'vertical' ? _this61.plotWidth : _this61.plotHeight) / noOfPoints * acc;
|
|
9276
9286
|
})));
|
|
9277
9287
|
}
|
|
9278
9288
|
// }
|
|
@@ -9445,7 +9455,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9445
9455
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9446
9456
|
if (this.options.data.bottom.formatter) {
|
|
9447
9457
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9448
|
-
return
|
|
9458
|
+
return _this61.options.data.bottom.formatter(d);
|
|
9449
9459
|
});
|
|
9450
9460
|
}
|
|
9451
9461
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9455,7 +9465,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9455
9465
|
}
|
|
9456
9466
|
if (this.customBottomRange.length > 0) {
|
|
9457
9467
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9458
|
-
return "translate(".concat(
|
|
9468
|
+
return "translate(".concat(_this61.customBottomRange[i] + (_this61.customBottomRange[i + 1] - _this61.customBottomRange[i]) / 2, ", 0)");
|
|
9459
9469
|
});
|
|
9460
9470
|
}
|
|
9461
9471
|
}
|
|
@@ -9474,14 +9484,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9474
9484
|
}
|
|
9475
9485
|
if (this.options.margin.axisLeft > 0) {
|
|
9476
9486
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9477
|
-
if (
|
|
9478
|
-
d =
|
|
9487
|
+
if (_this61.options.data.left.formatter) {
|
|
9488
|
+
d = _this61.options.data.left.formatter(d);
|
|
9479
9489
|
}
|
|
9480
9490
|
return d;
|
|
9481
9491
|
}));
|
|
9482
9492
|
if (this.customLeftRange.length > 0) {
|
|
9483
9493
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9484
|
-
return "translate(0, ".concat(
|
|
9494
|
+
return "translate(0, ".concat(_this61.customLeftRange[i] + (_this61.customLeftRange[i + 1] - _this61.customLeftRange[i]) / 2, ")");
|
|
9485
9495
|
});
|
|
9486
9496
|
}
|
|
9487
9497
|
}
|
|
@@ -9509,8 +9519,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9509
9519
|
}
|
|
9510
9520
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9511
9521
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9512
|
-
if (
|
|
9513
|
-
d =
|
|
9522
|
+
if (_this61.options.data.right.formatter) {
|
|
9523
|
+
d = _this61.options.data.right.formatter(d);
|
|
9514
9524
|
}
|
|
9515
9525
|
return d;
|
|
9516
9526
|
}));
|
|
@@ -9550,25 +9560,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9550
9560
|
}, {
|
|
9551
9561
|
key: "renderComponents",
|
|
9552
9562
|
value: function renderComponents() {
|
|
9553
|
-
var
|
|
9563
|
+
var _this62 = this;
|
|
9554
9564
|
// Draw the series data
|
|
9555
9565
|
this.renderedKeys = {};
|
|
9556
9566
|
this.options.data.series.forEach(function (series, index) {
|
|
9557
9567
|
if (!series.key) {
|
|
9558
|
-
series.key =
|
|
9568
|
+
series.key = _this62.createIdentity();
|
|
9559
9569
|
}
|
|
9560
9570
|
if (!series.color) {
|
|
9561
|
-
series.color =
|
|
9571
|
+
series.color = _this62.options.colors[index % _this62.options.colors.length];
|
|
9562
9572
|
}
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9573
|
+
_this62["render".concat(series.type || 'bar')](series, index);
|
|
9574
|
+
_this62.renderLabels(series, index);
|
|
9575
|
+
_this62.renderedKeys[series.key] = series.type;
|
|
9566
9576
|
});
|
|
9567
9577
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9568
9578
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9569
9579
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9570
9580
|
this.options.refLines.forEach(function (l) {
|
|
9571
|
-
return
|
|
9581
|
+
return _this62.renderRefLine(l);
|
|
9572
9582
|
});
|
|
9573
9583
|
}
|
|
9574
9584
|
this._isRendered = true;
|
|
@@ -9576,25 +9586,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9576
9586
|
}, {
|
|
9577
9587
|
key: "renderarea",
|
|
9578
9588
|
value: function renderarea(series, index) {
|
|
9579
|
-
var
|
|
9589
|
+
var _this63 = this;
|
|
9580
9590
|
/* global d3 series index */
|
|
9581
9591
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9582
9592
|
return d3.area().x(function (d) {
|
|
9583
|
-
if (
|
|
9584
|
-
return
|
|
9593
|
+
if (_this63.options.data[xAxis].scale === 'Time') {
|
|
9594
|
+
return _this63["".concat(xAxis, "Axis")](_this63.parseX(d.x.value));
|
|
9585
9595
|
} else {
|
|
9586
|
-
var xIndex =
|
|
9587
|
-
var xPos =
|
|
9588
|
-
if (
|
|
9589
|
-
xPos = xPos + (
|
|
9596
|
+
var xIndex = _this63[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9597
|
+
var xPos = _this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9598
|
+
if (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9599
|
+
xPos = xPos + (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9590
9600
|
}
|
|
9591
9601
|
return xPos;
|
|
9592
9602
|
}
|
|
9593
9603
|
}).y0(function (d) {
|
|
9594
|
-
return
|
|
9604
|
+
return _this63["".concat(yAxis, "Axis")](0);
|
|
9595
9605
|
}).y1(function (d) {
|
|
9596
|
-
return
|
|
9597
|
-
}).curve(d3[curveStyle ||
|
|
9606
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9607
|
+
}).curve(d3[curveStyle || _this63.options.curveStyle]);
|
|
9598
9608
|
};
|
|
9599
9609
|
var xAxis = 'bottom';
|
|
9600
9610
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9634,7 +9644,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9634
9644
|
}, {
|
|
9635
9645
|
key: "renderbar",
|
|
9636
9646
|
value: function renderbar(series, index) {
|
|
9637
|
-
var
|
|
9647
|
+
var _this64 = this;
|
|
9638
9648
|
/* global series index d3 */
|
|
9639
9649
|
var xAxis = 'bottom';
|
|
9640
9650
|
var yAxis = 'left';
|
|
@@ -9801,26 +9811,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9801
9811
|
}
|
|
9802
9812
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9803
9813
|
bars.attr('width', function (d, i) {
|
|
9804
|
-
return Math.abs(getBarWidth.call(
|
|
9814
|
+
return Math.abs(getBarWidth.call(_this64, d, i, yAxis, xAxis));
|
|
9805
9815
|
}).attr('height', function (d, i) {
|
|
9806
|
-
return getBarHeight.call(
|
|
9816
|
+
return getBarHeight.call(_this64, d, i, yAxis, xAxis);
|
|
9807
9817
|
}).attr('x', function (d, i) {
|
|
9808
|
-
return getBarX.call(
|
|
9818
|
+
return getBarX.call(_this64, d, i, yAxis, xAxis);
|
|
9809
9819
|
}).attr('y', function (d, i) {
|
|
9810
|
-
return getBarY.call(
|
|
9820
|
+
return getBarY.call(_this64, d, i, yAxis, xAxis);
|
|
9811
9821
|
})
|
|
9812
9822
|
// .transition(this.transition)
|
|
9813
9823
|
.attr('fill', function (d) {
|
|
9814
9824
|
return d.y.color || d.color || series.color;
|
|
9815
9825
|
});
|
|
9816
9826
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9817
|
-
return Math.abs(getBarWidth.call(
|
|
9827
|
+
return Math.abs(getBarWidth.call(_this64, d, i, yAxis, xAxis));
|
|
9818
9828
|
}).attr('height', function (d, i) {
|
|
9819
|
-
return getBarHeight.call(
|
|
9829
|
+
return getBarHeight.call(_this64, d, i, yAxis, xAxis);
|
|
9820
9830
|
}).attr('x', function (d, i) {
|
|
9821
|
-
return getBarX.call(
|
|
9831
|
+
return getBarX.call(_this64, d, i, yAxis, xAxis);
|
|
9822
9832
|
}).attr('y', function (d, i) {
|
|
9823
|
-
return getBarY.call(
|
|
9833
|
+
return getBarY.call(_this64, d, i, yAxis, xAxis);
|
|
9824
9834
|
})
|
|
9825
9835
|
// .transition(this.transition)
|
|
9826
9836
|
.attr('fill', function (d) {
|
|
@@ -9832,26 +9842,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9832
9842
|
this.brushBarsInitialized[series.key] = true;
|
|
9833
9843
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9834
9844
|
brushBars.attr('width', function (d, i) {
|
|
9835
|
-
return Math.abs(getBarWidth.call(
|
|
9845
|
+
return Math.abs(getBarWidth.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9836
9846
|
}).attr('height', function (d, i) {
|
|
9837
|
-
return getBarHeight.call(
|
|
9847
|
+
return getBarHeight.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9838
9848
|
}).attr('x', function (d, i) {
|
|
9839
|
-
return getBarX.call(
|
|
9849
|
+
return getBarX.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9840
9850
|
}).attr('y', function (d, i) {
|
|
9841
|
-
return getBarY.call(
|
|
9851
|
+
return getBarY.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9842
9852
|
})
|
|
9843
9853
|
// .transition(this.transition)
|
|
9844
9854
|
.attr('fill', function (d) {
|
|
9845
9855
|
return d.y.color || d.color || series.color;
|
|
9846
9856
|
});
|
|
9847
9857
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9848
|
-
return Math.abs(getBarWidth.call(
|
|
9858
|
+
return Math.abs(getBarWidth.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9849
9859
|
}).attr('height', function (d, i) {
|
|
9850
|
-
return getBarHeight.call(
|
|
9860
|
+
return getBarHeight.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9851
9861
|
}).attr('x', function (d, i) {
|
|
9852
|
-
return getBarX.call(
|
|
9862
|
+
return getBarX.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9853
9863
|
}).attr('y', function (d, i) {
|
|
9854
|
-
return getBarY.call(
|
|
9864
|
+
return getBarY.call(_this64, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9855
9865
|
})
|
|
9856
9866
|
// .transition(this.transition)
|
|
9857
9867
|
.attr('fill', function (d) {
|
|
@@ -9872,7 +9882,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9872
9882
|
}, {
|
|
9873
9883
|
key: "renderLabels",
|
|
9874
9884
|
value: function renderLabels(series, index) {
|
|
9875
|
-
var
|
|
9885
|
+
var _this65 = this;
|
|
9876
9886
|
/* global series index d3 WebsyDesigns */
|
|
9877
9887
|
var xAxis = 'bottom';
|
|
9878
9888
|
var yAxis = 'left';
|
|
@@ -9888,14 +9898,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9888
9898
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9889
9899
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9890
9900
|
labels.attr('x', function (d) {
|
|
9891
|
-
return getLabelX.call(
|
|
9901
|
+
return getLabelX.call(_this65, d, series.labelPosition);
|
|
9892
9902
|
}).attr('y', function (d) {
|
|
9893
|
-
return getLabelY.call(
|
|
9903
|
+
return getLabelY.call(_this65, d, series.labelPosition);
|
|
9894
9904
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9895
|
-
if (
|
|
9905
|
+
if (_this65.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9896
9906
|
return 'transparent';
|
|
9897
9907
|
}
|
|
9898
|
-
return
|
|
9908
|
+
return _this65.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9899
9909
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9900
9910
|
return d.y.label || d.y.value;
|
|
9901
9911
|
}).each(function (d, i) {
|
|
@@ -9929,14 +9939,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9929
9939
|
}
|
|
9930
9940
|
});
|
|
9931
9941
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9932
|
-
return getLabelX.call(
|
|
9942
|
+
return getLabelX.call(_this65, d, series.labelPosition);
|
|
9933
9943
|
}).attr('y', function (d) {
|
|
9934
|
-
return getLabelY.call(
|
|
9944
|
+
return getLabelY.call(_this65, d, series.labelPosition);
|
|
9935
9945
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9936
|
-
if (
|
|
9946
|
+
if (_this65.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9937
9947
|
return 'transparent';
|
|
9938
9948
|
}
|
|
9939
|
-
return
|
|
9949
|
+
return _this65.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9940
9950
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9941
9951
|
return d.y.label || d.y.value;
|
|
9942
9952
|
}).each(function (d, i) {
|
|
@@ -10014,32 +10024,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10014
10024
|
}, {
|
|
10015
10025
|
key: "renderline",
|
|
10016
10026
|
value: function renderline(series, index) {
|
|
10017
|
-
var
|
|
10027
|
+
var _this66 = this;
|
|
10018
10028
|
/* global series index d3 */
|
|
10019
10029
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
10020
10030
|
return d3.line().x(function (d) {
|
|
10021
|
-
if (
|
|
10022
|
-
return
|
|
10031
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10032
|
+
return _this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10023
10033
|
} else {
|
|
10024
|
-
if (
|
|
10025
|
-
return
|
|
10034
|
+
if (_this66.options.data[xAxis].scale === 'Time') {
|
|
10035
|
+
return _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value));
|
|
10026
10036
|
} else {
|
|
10027
|
-
var xIndex =
|
|
10028
|
-
var xPos =
|
|
10029
|
-
if (
|
|
10030
|
-
xPos = xPos + (
|
|
10037
|
+
var xIndex = _this66[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10038
|
+
var xPos = _this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10039
|
+
if (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10040
|
+
xPos = xPos + (_this66["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10031
10041
|
}
|
|
10032
10042
|
return xPos;
|
|
10033
10043
|
}
|
|
10034
10044
|
}
|
|
10035
10045
|
}).y(function (d) {
|
|
10036
|
-
if (
|
|
10037
|
-
var adjustment =
|
|
10038
|
-
return
|
|
10046
|
+
if (_this66.options.orientation === 'horizontal') {
|
|
10047
|
+
var adjustment = _this66.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this66.options.data[xAxis].bandWidth / 2;
|
|
10048
|
+
return _this66["".concat(xAxis, "Axis")](_this66.parseX(d.x.value)) + adjustment;
|
|
10039
10049
|
} else {
|
|
10040
|
-
return
|
|
10050
|
+
return _this66["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10041
10051
|
}
|
|
10042
|
-
}).curve(d3[curveStyle ||
|
|
10052
|
+
}).curve(d3[curveStyle || _this66.options.curveStyle]);
|
|
10043
10053
|
};
|
|
10044
10054
|
var xAxis = 'bottom';
|
|
10045
10055
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10148,14 +10158,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10148
10158
|
}, {
|
|
10149
10159
|
key: "rendersymbol",
|
|
10150
10160
|
value: function rendersymbol(series, index) {
|
|
10151
|
-
var
|
|
10161
|
+
var _this67 = this;
|
|
10152
10162
|
/* global d3 series index series.key */
|
|
10153
10163
|
var drawSymbol = function drawSymbol(size) {
|
|
10154
10164
|
return d3.symbol()
|
|
10155
10165
|
// .type(d => {
|
|
10156
10166
|
// return d3.symbols[0]
|
|
10157
10167
|
// })
|
|
10158
|
-
.size(size ||
|
|
10168
|
+
.size(size || _this67.options.symbolSize);
|
|
10159
10169
|
};
|
|
10160
10170
|
var xAxis = 'bottom';
|
|
10161
10171
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10181,27 +10191,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10181
10191
|
// else {
|
|
10182
10192
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10183
10193
|
// }
|
|
10184
|
-
var xIndex =
|
|
10185
|
-
var xPos =
|
|
10186
|
-
if (
|
|
10187
|
-
xPos = xPos + (
|
|
10188
|
-
}
|
|
10189
|
-
var adjustment =
|
|
10190
|
-
if (
|
|
10191
|
-
return "translate(".concat(
|
|
10194
|
+
var xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10195
|
+
var xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10196
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10197
|
+
xPos = xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10198
|
+
}
|
|
10199
|
+
var adjustment = _this67.options.data[xAxis].scale === 'Time' || _this67.options.data[xAxis].scale === 'Linear' ? 0 : _this67.options.data[xAxis].bandWidth / 2;
|
|
10200
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10201
|
+
return "translate(".concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10192
10202
|
} else {
|
|
10193
|
-
if (
|
|
10194
|
-
xPos =
|
|
10203
|
+
if (_this67.options.data[xAxis].scale === 'Time') {
|
|
10204
|
+
xPos = _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value));
|
|
10195
10205
|
} else {
|
|
10196
|
-
var _xIndex =
|
|
10197
|
-
var _xPos =
|
|
10198
|
-
if (
|
|
10199
|
-
_xPos = _xPos + (
|
|
10206
|
+
var _xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10207
|
+
var _xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
10208
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
10209
|
+
_xPos = _xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
10200
10210
|
}
|
|
10201
10211
|
// return xPos
|
|
10202
10212
|
}
|
|
10203
10213
|
// 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(
|
|
10214
|
+
return "translate(".concat(xPos, ", ").concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10205
10215
|
}
|
|
10206
10216
|
});
|
|
10207
10217
|
// Enter
|
|
@@ -10216,27 +10226,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10216
10226
|
}).attr('class', function (d) {
|
|
10217
10227
|
return "symbol symbol_".concat(series.key);
|
|
10218
10228
|
}).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(
|
|
10229
|
+
var xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10230
|
+
var xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10231
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10232
|
+
xPos = xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10233
|
+
}
|
|
10234
|
+
var adjustment = _this67.options.data[xAxis].scale === 'Time' || _this67.options.data[xAxis].scale === 'Linear' ? 0 : _this67.options.data[xAxis].bandWidth / 2;
|
|
10235
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10236
|
+
return "translate(".concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10227
10237
|
} else {
|
|
10228
|
-
if (
|
|
10229
|
-
xPos =
|
|
10238
|
+
if (_this67.options.data[xAxis].scale === 'Time') {
|
|
10239
|
+
xPos = _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value));
|
|
10230
10240
|
} else {
|
|
10231
|
-
var _xIndex2 =
|
|
10232
|
-
var _xPos2 =
|
|
10233
|
-
if (
|
|
10234
|
-
_xPos2 = _xPos2 + (
|
|
10241
|
+
var _xIndex2 = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10242
|
+
var _xPos2 = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
10243
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
10244
|
+
_xPos2 = _xPos2 + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
10235
10245
|
}
|
|
10236
10246
|
// return xPos
|
|
10237
10247
|
}
|
|
10238
10248
|
// 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(
|
|
10249
|
+
return "translate(".concat(xPos, ", ").concat(_this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10240
10250
|
}
|
|
10241
10251
|
});
|
|
10242
10252
|
}
|
|
@@ -10859,7 +10869,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10859
10869
|
}, {
|
|
10860
10870
|
key: "resize",
|
|
10861
10871
|
value: function resize() {
|
|
10862
|
-
var
|
|
10872
|
+
var _this68 = this;
|
|
10863
10873
|
var el = document.getElementById(this.elementId);
|
|
10864
10874
|
if (el) {
|
|
10865
10875
|
// if (this.options.width) {
|
|
@@ -10870,7 +10880,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10870
10880
|
// }
|
|
10871
10881
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10872
10882
|
html += this._data.map(function (d, i) {
|
|
10873
|
-
return
|
|
10883
|
+
return _this68.getLegendItemHTML(d);
|
|
10874
10884
|
}).join('');
|
|
10875
10885
|
html += "\n <div>\n ";
|
|
10876
10886
|
el.innerHTML = html;
|
|
@@ -11028,7 +11038,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11028
11038
|
}, {
|
|
11029
11039
|
key: "render",
|
|
11030
11040
|
value: function render() {
|
|
11031
|
-
var
|
|
11041
|
+
var _this69 = this;
|
|
11032
11042
|
this._isRendered = false;
|
|
11033
11043
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
11034
11044
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -11036,7 +11046,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11036
11046
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
11037
11047
|
return {
|
|
11038
11048
|
value: s.label || s.key,
|
|
11039
|
-
color: s.color ||
|
|
11049
|
+
color: s.color || _this69.options.colors[i % _this69.options.colors.length]
|
|
11040
11050
|
};
|
|
11041
11051
|
});
|
|
11042
11052
|
var longestValue = legendData.map(function (s) {
|
|
@@ -11090,7 +11100,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11090
11100
|
}
|
|
11091
11101
|
if (this.polygons) {
|
|
11092
11102
|
this.polygons.forEach(function (p) {
|
|
11093
|
-
return
|
|
11103
|
+
return _this69.map.removeLayer(p);
|
|
11094
11104
|
});
|
|
11095
11105
|
}
|
|
11096
11106
|
this.polygons = [];
|
|
@@ -11144,15 +11154,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11144
11154
|
p.options = {};
|
|
11145
11155
|
}
|
|
11146
11156
|
if (!p.options.color) {
|
|
11147
|
-
p.options.color =
|
|
11157
|
+
p.options.color = _this69.options.colors[i % _this69.options.colors.length];
|
|
11148
11158
|
}
|
|
11149
11159
|
var pol = L.polygon(p.data.map(function (c) {
|
|
11150
11160
|
return c.map(function (d) {
|
|
11151
11161
|
return [d.Latitude, d.Longitude];
|
|
11152
11162
|
});
|
|
11153
|
-
}), p.options).addTo(
|
|
11154
|
-
|
|
11155
|
-
|
|
11163
|
+
}), p.options).addTo(_this69.map);
|
|
11164
|
+
_this69.polygons.push(pol);
|
|
11165
|
+
_this69.map.fitBounds(pol.getBounds());
|
|
11156
11166
|
});
|
|
11157
11167
|
}
|
|
11158
11168
|
// if (this.data.markers.length > 0) {
|