@websy/websy-designs 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/helpers/v1/pgHelper.js +2 -2
- package/dist/server/websy-designs-server.js +1 -2
- package/dist/websy-designs-es6.debug.js +12 -2
- package/dist/websy-designs-es6.js +321 -311
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +12 -2
- package/dist/websy-designs.js +347 -337
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -2979,6 +2979,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2979
2979
|
}, {
|
|
2980
2980
|
key: "addEntry",
|
|
2981
2981
|
value: function addEntry() {
|
|
2982
|
+
var _this23 = this;
|
|
2982
2983
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2983
2984
|
if (typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows) {
|
|
2984
2985
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2990,8 +2991,11 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2990
2991
|
newFormEl.innerHTML = html;
|
|
2991
2992
|
el.appendChild(newFormEl);
|
|
2992
2993
|
var formOptions = _extends({}, this.options, {
|
|
2994
|
+
rowIndex: this.forms.length,
|
|
2993
2995
|
fields: _toConsumableArray(this.options.fields.map(function (f) {
|
|
2994
|
-
return _extends({}, f
|
|
2996
|
+
return _extends({}, f, {
|
|
2997
|
+
rowIndex: _this23.forms.length
|
|
2998
|
+
});
|
|
2995
2999
|
}))
|
|
2996
3000
|
});
|
|
2997
3001
|
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
@@ -3026,9 +3030,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3026
3030
|
}, {
|
|
3027
3031
|
key: "deleted",
|
|
3028
3032
|
get: function get() {
|
|
3029
|
-
var
|
|
3033
|
+
var _this24 = this;
|
|
3030
3034
|
return this.formData.filter(function (d) {
|
|
3031
|
-
return
|
|
3035
|
+
return _this24.recordsToDelete.includes("".concat(d.id));
|
|
3032
3036
|
});
|
|
3033
3037
|
}
|
|
3034
3038
|
}, {
|
|
@@ -3069,7 +3073,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3069
3073
|
}, {
|
|
3070
3074
|
key: "render",
|
|
3071
3075
|
value: function render() {
|
|
3072
|
-
var
|
|
3076
|
+
var _this25 = this;
|
|
3073
3077
|
this.forms = [];
|
|
3074
3078
|
this.recordsToDelete = [];
|
|
3075
3079
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -3077,9 +3081,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3077
3081
|
var html = '';
|
|
3078
3082
|
this.formData.forEach(function (d) {
|
|
3079
3083
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
3080
|
-
html += "\n <div id='".concat(
|
|
3081
|
-
if (
|
|
3082
|
-
html += "\n <button id='".concat(
|
|
3084
|
+
html += "\n <div id='".concat(_this25.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this25.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
3085
|
+
if (_this25.options.allowDelete === true && !_this25.options.readOnly) {
|
|
3086
|
+
html += "\n <button id='".concat(_this25.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this25.options.deleteIcon).concat(_this25.options.deleteLabel, "\n </button>\n ");
|
|
3083
3087
|
}
|
|
3084
3088
|
html += "\n </div>\n ";
|
|
3085
3089
|
});
|
|
@@ -3087,14 +3091,20 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3087
3091
|
el.innerHTML = html;
|
|
3088
3092
|
this.forms = new Array(this.formData.length);
|
|
3089
3093
|
this.formData.forEach(function (d, i) {
|
|
3090
|
-
var formOptions = _extends({},
|
|
3091
|
-
|
|
3092
|
-
|
|
3094
|
+
var formOptions = _extends({}, _this25.options, {
|
|
3095
|
+
rowIndex: i,
|
|
3096
|
+
fields: _toConsumableArray(_this25.options.fields.map(function (f) {
|
|
3097
|
+
var newF = _extends({}, f);
|
|
3098
|
+
if (!newF.options) {
|
|
3099
|
+
newF.options = {};
|
|
3100
|
+
}
|
|
3101
|
+
newF.options.rowIndex = i;
|
|
3102
|
+
return newF;
|
|
3093
3103
|
}))
|
|
3094
3104
|
});
|
|
3095
|
-
var formObject = new WebsyDesigns.Form("".concat(
|
|
3105
|
+
var formObject = new WebsyDesigns.Form("".concat(_this25.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
3096
3106
|
formObject.data = d;
|
|
3097
|
-
|
|
3107
|
+
_this25.forms[i] = formObject;
|
|
3098
3108
|
});
|
|
3099
3109
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
3100
3110
|
if (addEl) {
|
|
@@ -3390,7 +3400,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3390
3400
|
}, {
|
|
3391
3401
|
key: "handleSearch",
|
|
3392
3402
|
value: function handleSearch(searchText) {
|
|
3393
|
-
var
|
|
3403
|
+
var _this26 = this;
|
|
3394
3404
|
var el = document.getElementById(this.elementId);
|
|
3395
3405
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3396
3406
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -3401,7 +3411,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3401
3411
|
if (searchText && searchText.length > 1) {
|
|
3402
3412
|
defaultMethod = 'add';
|
|
3403
3413
|
visibleItems = lowestItems.filter(function (d) {
|
|
3404
|
-
return d[
|
|
3414
|
+
return d[_this26.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3405
3415
|
});
|
|
3406
3416
|
}
|
|
3407
3417
|
// hide everything
|
|
@@ -3652,7 +3662,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3652
3662
|
}, {
|
|
3653
3663
|
key: "handleChange",
|
|
3654
3664
|
value: function handleChange(event) {
|
|
3655
|
-
var
|
|
3665
|
+
var _this27 = this;
|
|
3656
3666
|
this.fileList = [];
|
|
3657
3667
|
var uploadForm = document.getElementById("".concat(this.elementId, "_form"));
|
|
3658
3668
|
if (!uploadForm) {
|
|
@@ -3665,8 +3675,8 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3665
3675
|
var formData = new FormData(uploadForm);
|
|
3666
3676
|
var html = this.createHtml(formData.length);
|
|
3667
3677
|
formData.forEach(function (value, key) {
|
|
3668
|
-
if (key === (
|
|
3669
|
-
|
|
3678
|
+
if (key === (_this27.options.name || 'media')) {
|
|
3679
|
+
_this27.fileList.push({
|
|
3670
3680
|
name: key,
|
|
3671
3681
|
file: value
|
|
3672
3682
|
});
|
|
@@ -3679,12 +3689,12 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3679
3689
|
}, {
|
|
3680
3690
|
key: "render",
|
|
3681
3691
|
value: function render() {
|
|
3682
|
-
var
|
|
3692
|
+
var _this28 = this;
|
|
3683
3693
|
if (this.media.length > 0) {
|
|
3684
3694
|
var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
|
|
3685
3695
|
resultEl.innerHTML = this.createHtml(this.media.length);
|
|
3686
3696
|
this.media.forEach(function (m, i) {
|
|
3687
|
-
var imgEl = document.getElementById("".concat(
|
|
3697
|
+
var imgEl = document.getElementById("".concat(_this28.elementId, "_media_").concat(i));
|
|
3688
3698
|
imgEl.setAttribute('src', "data:".concat(m.type, ";base64,") + m.data);
|
|
3689
3699
|
});
|
|
3690
3700
|
}
|
|
@@ -3692,7 +3702,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3692
3702
|
}, {
|
|
3693
3703
|
key: "uploadItem",
|
|
3694
3704
|
value: function uploadItem(index, items, callbackFn) {
|
|
3695
|
-
var
|
|
3705
|
+
var _this29 = this;
|
|
3696
3706
|
if (!items[index]) {
|
|
3697
3707
|
callbackFn();
|
|
3698
3708
|
} else {
|
|
@@ -3711,19 +3721,19 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3711
3721
|
img.onload = function () {
|
|
3712
3722
|
var width = img.width;
|
|
3713
3723
|
var height = img.height;
|
|
3714
|
-
if (
|
|
3724
|
+
if (_this29.options.resize === true && _this29.options.imgSize) {
|
|
3715
3725
|
var _ratio = 1;
|
|
3716
3726
|
if (width > height) {
|
|
3717
3727
|
_ratio = width / height;
|
|
3718
|
-
width =
|
|
3719
|
-
height =
|
|
3728
|
+
width = _this29.options.imgSize;
|
|
3729
|
+
height = _this29.options.imgSize / _ratio;
|
|
3720
3730
|
} else if (height > width) {
|
|
3721
3731
|
_ratio = height / width;
|
|
3722
|
-
width =
|
|
3723
|
-
height =
|
|
3732
|
+
width = _this29.options.imgSize / _ratio;
|
|
3733
|
+
height = _this29.options.imgSize;
|
|
3724
3734
|
}
|
|
3725
3735
|
}
|
|
3726
|
-
var fullResEl = document.getElementById("".concat(
|
|
3736
|
+
var fullResEl = document.getElementById("".concat(_this29.elementId, "_media_").concat(index, "_fullres"));
|
|
3727
3737
|
if (fullResEl) {
|
|
3728
3738
|
fullResEl.innerHTML = "".concat(width, " x ").concat(height);
|
|
3729
3739
|
}
|
|
@@ -3733,12 +3743,12 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3733
3743
|
var ratio = 1;
|
|
3734
3744
|
if (width > height) {
|
|
3735
3745
|
ratio = width / height;
|
|
3736
|
-
thumbCanvas.width =
|
|
3737
|
-
thumbCanvas.height =
|
|
3746
|
+
thumbCanvas.width = _this29.options.thumbSize;
|
|
3747
|
+
thumbCanvas.height = _this29.options.thumbSize / ratio;
|
|
3738
3748
|
} else if (height > width) {
|
|
3739
3749
|
ratio = height / width;
|
|
3740
|
-
thumbCanvas.width =
|
|
3741
|
-
thumbCanvas.height =
|
|
3750
|
+
thumbCanvas.width = _this29.options.thumbSize / ratio;
|
|
3751
|
+
thumbCanvas.height = _this29.options.thumbSize;
|
|
3742
3752
|
}
|
|
3743
3753
|
thumbContext.drawImage(img, 0, 0, thumbCanvas.width, thumbCanvas.height);
|
|
3744
3754
|
mediaData.name = items[index].name;
|
|
@@ -3748,10 +3758,10 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3748
3758
|
mediaData.thumbHeight = thumbCanvas.height;
|
|
3749
3759
|
mediaData.data = imgCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3750
3760
|
mediaData.thumbData = thumbCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3751
|
-
|
|
3752
|
-
var imgEl = document.getElementById("".concat(
|
|
3761
|
+
_this29.media.push(mediaData);
|
|
3762
|
+
var imgEl = document.getElementById("".concat(_this29.elementId, "_media_").concat(index));
|
|
3753
3763
|
imgEl.setAttribute('src', imgCanvas.toDataURL(mediaData.type));
|
|
3754
|
-
|
|
3764
|
+
_this29.uploadItem(++index, items, callbackFn);
|
|
3755
3765
|
};
|
|
3756
3766
|
img.src = r.result;
|
|
3757
3767
|
};
|
|
@@ -3764,7 +3774,7 @@ var MediaUpload = /*#__PURE__*/function () {
|
|
|
3764
3774
|
/* global WebsyDesigns */
|
|
3765
3775
|
var Pager = /*#__PURE__*/function () {
|
|
3766
3776
|
function Pager(elementId, options) {
|
|
3767
|
-
var
|
|
3777
|
+
var _this30 = this;
|
|
3768
3778
|
_classCallCheck(this, Pager);
|
|
3769
3779
|
this.elementId = elementId;
|
|
3770
3780
|
var DEFAULTS = {
|
|
@@ -3811,8 +3821,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3811
3821
|
allowClear: false,
|
|
3812
3822
|
disableSearch: true,
|
|
3813
3823
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3814
|
-
if (
|
|
3815
|
-
|
|
3824
|
+
if (_this30.options.onChangePageSize) {
|
|
3825
|
+
_this30.options.onChangePageSize(selectedItem.value);
|
|
3816
3826
|
}
|
|
3817
3827
|
}
|
|
3818
3828
|
});
|
|
@@ -3833,11 +3843,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3833
3843
|
}, {
|
|
3834
3844
|
key: "render",
|
|
3835
3845
|
value: function render() {
|
|
3836
|
-
var
|
|
3846
|
+
var _this31 = this;
|
|
3837
3847
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3838
3848
|
if (el) {
|
|
3839
3849
|
var pages = this.options.pages.map(function (item, index) {
|
|
3840
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3850
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this31.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3841
3851
|
});
|
|
3842
3852
|
var startIndex = 0;
|
|
3843
3853
|
if (this.options.pages.length > 8) {
|
|
@@ -3899,50 +3909,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3899
3909
|
_createClass(WebsyPDFButton, [{
|
|
3900
3910
|
key: "handleClick",
|
|
3901
3911
|
value: function handleClick(event) {
|
|
3902
|
-
var
|
|
3912
|
+
var _this32 = this;
|
|
3903
3913
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3904
3914
|
this.loader.show();
|
|
3905
3915
|
this.options.preProcess(function (proceed) {
|
|
3906
3916
|
if (proceed === true) {
|
|
3907
3917
|
setTimeout(function () {
|
|
3908
|
-
if (
|
|
3909
|
-
var el = document.getElementById(
|
|
3918
|
+
if (_this32.options.targetId) {
|
|
3919
|
+
var el = document.getElementById(_this32.options.targetId);
|
|
3910
3920
|
if (el) {
|
|
3911
3921
|
var pdfData = {
|
|
3912
3922
|
options: {}
|
|
3913
3923
|
};
|
|
3914
|
-
if (
|
|
3915
|
-
pdfData.options = _extends({},
|
|
3924
|
+
if (_this32.options.pdfOptions) {
|
|
3925
|
+
pdfData.options = _extends({}, _this32.options.pdfOptions);
|
|
3916
3926
|
}
|
|
3917
|
-
if (
|
|
3918
|
-
if (
|
|
3919
|
-
var headerEl = document.getElementById(
|
|
3927
|
+
if (_this32.options.header) {
|
|
3928
|
+
if (_this32.options.header.elementId) {
|
|
3929
|
+
var headerEl = document.getElementById(_this32.options.header.elementId);
|
|
3920
3930
|
if (headerEl) {
|
|
3921
3931
|
pdfData.header = headerEl.outerHTML;
|
|
3922
|
-
if (
|
|
3923
|
-
pdfData.options.headerCSS =
|
|
3932
|
+
if (_this32.options.header.css) {
|
|
3933
|
+
pdfData.options.headerCSS = _this32.options.header.css;
|
|
3924
3934
|
}
|
|
3925
3935
|
}
|
|
3926
|
-
} else if (
|
|
3927
|
-
pdfData.header =
|
|
3928
|
-
if (
|
|
3929
|
-
pdfData.options.headerCSS =
|
|
3936
|
+
} else if (_this32.options.header.html) {
|
|
3937
|
+
pdfData.header = _this32.options.header.html;
|
|
3938
|
+
if (_this32.options.header.css) {
|
|
3939
|
+
pdfData.options.headerCSS = _this32.options.header.css;
|
|
3930
3940
|
}
|
|
3931
3941
|
} else {
|
|
3932
|
-
pdfData.header =
|
|
3942
|
+
pdfData.header = _this32.options.header;
|
|
3933
3943
|
}
|
|
3934
3944
|
}
|
|
3935
|
-
if (
|
|
3936
|
-
if (
|
|
3937
|
-
var footerEl = document.getElementById(
|
|
3945
|
+
if (_this32.options.footer) {
|
|
3946
|
+
if (_this32.options.footer.elementId) {
|
|
3947
|
+
var footerEl = document.getElementById(_this32.options.footer.elementId);
|
|
3938
3948
|
if (footerEl) {
|
|
3939
3949
|
pdfData.footer = footerEl.outerHTML;
|
|
3940
|
-
if (
|
|
3941
|
-
pdfData.options.footerCSS =
|
|
3950
|
+
if (_this32.options.footer.css) {
|
|
3951
|
+
pdfData.options.footerCSS = _this32.options.footer.css;
|
|
3942
3952
|
}
|
|
3943
3953
|
}
|
|
3944
3954
|
} else {
|
|
3945
|
-
pdfData.footer =
|
|
3955
|
+
pdfData.footer = _this32.options.footer;
|
|
3946
3956
|
}
|
|
3947
3957
|
}
|
|
3948
3958
|
pdfData.html = el.outerHTML;
|
|
@@ -3950,25 +3960,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3950
3960
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3951
3961
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3952
3962
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3953
|
-
|
|
3963
|
+
_this32.service.add('', pdfData, {
|
|
3954
3964
|
responseType: 'blob'
|
|
3955
3965
|
}).then(function (response) {
|
|
3956
|
-
|
|
3966
|
+
_this32.loader.hide();
|
|
3957
3967
|
var blob = new Blob([response], {
|
|
3958
3968
|
type: 'application/pdf'
|
|
3959
3969
|
});
|
|
3960
3970
|
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 ");
|
|
3961
|
-
if (
|
|
3971
|
+
if (_this32.options.directDownload === true) {
|
|
3962
3972
|
var fileName;
|
|
3963
|
-
if (typeof
|
|
3964
|
-
fileName =
|
|
3973
|
+
if (typeof _this32.options.fileName === 'function') {
|
|
3974
|
+
fileName = _this32.options.fileName() || 'Export';
|
|
3965
3975
|
} else {
|
|
3966
|
-
fileName =
|
|
3976
|
+
fileName = _this32.options.fileName || 'Export';
|
|
3967
3977
|
}
|
|
3968
3978
|
msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
|
|
3969
3979
|
}
|
|
3970
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3971
|
-
|
|
3980
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this32.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3981
|
+
_this32.popup.show({
|
|
3972
3982
|
message: msg,
|
|
3973
3983
|
mask: true
|
|
3974
3984
|
});
|
|
@@ -3977,10 +3987,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3977
3987
|
});
|
|
3978
3988
|
}
|
|
3979
3989
|
}
|
|
3980
|
-
},
|
|
3990
|
+
}, _this32.options.wait);
|
|
3981
3991
|
} else {
|
|
3982
|
-
|
|
3983
|
-
|
|
3992
|
+
_this32.loader.hide();
|
|
3993
|
+
_this32.options.onError();
|
|
3984
3994
|
}
|
|
3985
3995
|
});
|
|
3986
3996
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -4153,7 +4163,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
4153
4163
|
}();
|
|
4154
4164
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
4155
4165
|
function ResponsiveText(elementId, options) {
|
|
4156
|
-
var
|
|
4166
|
+
var _this33 = this;
|
|
4157
4167
|
_classCallCheck(this, ResponsiveText);
|
|
4158
4168
|
var DEFAULTS = {
|
|
4159
4169
|
textAlign: 'center',
|
|
@@ -4164,7 +4174,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4164
4174
|
this.elementId = elementId;
|
|
4165
4175
|
this.canvas = document.createElement('canvas');
|
|
4166
4176
|
window.addEventListener('resize', function () {
|
|
4167
|
-
return
|
|
4177
|
+
return _this33.render();
|
|
4168
4178
|
});
|
|
4169
4179
|
var el = document.getElementById(this.elementId);
|
|
4170
4180
|
if (el) {
|
|
@@ -4354,7 +4364,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4354
4364
|
/* global WebsyDesigns */
|
|
4355
4365
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
4356
4366
|
function WebsyResultList(elementId, options) {
|
|
4357
|
-
var
|
|
4367
|
+
var _this34 = this;
|
|
4358
4368
|
_classCallCheck(this, WebsyResultList);
|
|
4359
4369
|
var DEFAULTS = {
|
|
4360
4370
|
listeners: {
|
|
@@ -4380,8 +4390,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4380
4390
|
}
|
|
4381
4391
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4382
4392
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4383
|
-
|
|
4384
|
-
|
|
4393
|
+
_this34.options.template = templateString;
|
|
4394
|
+
_this34.render();
|
|
4385
4395
|
});
|
|
4386
4396
|
} else {
|
|
4387
4397
|
this.render();
|
|
@@ -4403,7 +4413,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4403
4413
|
}, {
|
|
4404
4414
|
key: "buildHTML",
|
|
4405
4415
|
value: function buildHTML() {
|
|
4406
|
-
var
|
|
4416
|
+
var _this35 = this;
|
|
4407
4417
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4408
4418
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4409
4419
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -4412,7 +4422,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4412
4422
|
if (this.options.template) {
|
|
4413
4423
|
if (d.length > 0) {
|
|
4414
4424
|
d.forEach(function (row, ix) {
|
|
4415
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4425
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this35.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
4416
4426
|
// find conditional elements
|
|
4417
4427
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4418
4428
|
ifMatches.forEach(function (m) {
|
|
@@ -4500,7 +4510,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4500
4510
|
parts.forEach(function (p) {
|
|
4501
4511
|
items = items[p];
|
|
4502
4512
|
});
|
|
4503
|
-
template = template.replace(m[0],
|
|
4513
|
+
template = template.replace(m[0], _this35.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4504
4514
|
}
|
|
4505
4515
|
});
|
|
4506
4516
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4509,7 +4519,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4509
4519
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4510
4520
|
}
|
|
4511
4521
|
});
|
|
4512
|
-
var flatRow =
|
|
4522
|
+
var flatRow = _this35.flattenObject(row);
|
|
4513
4523
|
for (var key in flatRow) {
|
|
4514
4524
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4515
4525
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4634,15 +4644,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4634
4644
|
}, {
|
|
4635
4645
|
key: "render",
|
|
4636
4646
|
value: function render() {
|
|
4637
|
-
var
|
|
4647
|
+
var _this36 = this;
|
|
4638
4648
|
if (this.options.entity) {
|
|
4639
4649
|
var url = this.options.entity;
|
|
4640
4650
|
if (this.options.sortField) {
|
|
4641
4651
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4642
4652
|
}
|
|
4643
4653
|
this.apiService.get(url).then(function (results) {
|
|
4644
|
-
|
|
4645
|
-
|
|
4654
|
+
_this36.rows = results.rows;
|
|
4655
|
+
_this36.resize();
|
|
4646
4656
|
});
|
|
4647
4657
|
} else {
|
|
4648
4658
|
this.resize();
|
|
@@ -4721,12 +4731,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4721
4731
|
_createClass(WebsyRouter, [{
|
|
4722
4732
|
key: "addGroup",
|
|
4723
4733
|
value: function addGroup(group) {
|
|
4724
|
-
var
|
|
4734
|
+
var _this37 = this;
|
|
4725
4735
|
if (!this.groups[group]) {
|
|
4726
4736
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4727
4737
|
if (els) {
|
|
4728
4738
|
this.getClosestParent(els[0], function (parent) {
|
|
4729
|
-
|
|
4739
|
+
_this37.groups[group] = {
|
|
4730
4740
|
activeView: '',
|
|
4731
4741
|
views: [],
|
|
4732
4742
|
parent: parent.getAttribute('data-view')
|
|
@@ -4790,7 +4800,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4790
4800
|
}, {
|
|
4791
4801
|
key: "removeUrlParams",
|
|
4792
4802
|
value: function removeUrlParams() {
|
|
4793
|
-
var
|
|
4803
|
+
var _this38 = this;
|
|
4794
4804
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4795
4805
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4796
4806
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4798,7 +4808,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4798
4808
|
var path = '';
|
|
4799
4809
|
if (this.currentParams && this.currentParams.items) {
|
|
4800
4810
|
params.forEach(function (p) {
|
|
4801
|
-
delete
|
|
4811
|
+
delete _this38.currentParams.items[p];
|
|
4802
4812
|
});
|
|
4803
4813
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4804
4814
|
}
|
|
@@ -5129,11 +5139,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5129
5139
|
}, {
|
|
5130
5140
|
key: "showComponents",
|
|
5131
5141
|
value: function showComponents(view) {
|
|
5132
|
-
var
|
|
5142
|
+
var _this39 = this;
|
|
5133
5143
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
5134
5144
|
this.options.views[view].components.forEach(function (c) {
|
|
5135
5145
|
if (typeof c.instance === 'undefined') {
|
|
5136
|
-
|
|
5146
|
+
_this39.prepComponent(c.elementId, c.options);
|
|
5137
5147
|
c.instance = new c.Component(c.elementId, c.options);
|
|
5138
5148
|
} else if (c.instance.render) {
|
|
5139
5149
|
c.instance.render();
|
|
@@ -5153,42 +5163,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5153
5163
|
}, {
|
|
5154
5164
|
key: "initView",
|
|
5155
5165
|
value: function initView(view) {
|
|
5156
|
-
var
|
|
5166
|
+
var _this40 = this;
|
|
5157
5167
|
return new Promise(function (resolve, reject) {
|
|
5158
|
-
if (!
|
|
5159
|
-
|
|
5168
|
+
if (!_this40.options.views[view]) {
|
|
5169
|
+
_this40.options.views[view] = {
|
|
5160
5170
|
components: []
|
|
5161
5171
|
};
|
|
5162
5172
|
}
|
|
5163
|
-
if (
|
|
5173
|
+
if (_this40.options.views[view].ready === true) {
|
|
5164
5174
|
resolve();
|
|
5165
|
-
} else if (
|
|
5166
|
-
|
|
5175
|
+
} else if (_this40.options.views[view].template) {
|
|
5176
|
+
_this40.preloadView(view, function () {
|
|
5167
5177
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5168
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
5178
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this40.options.viewClass));
|
|
5169
5179
|
if (viewEl) {
|
|
5170
|
-
|
|
5171
|
-
template:
|
|
5180
|
+
_this40.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
5181
|
+
template: _this40.options.views[view].template,
|
|
5172
5182
|
data: data,
|
|
5173
5183
|
readyCallbackFn: function readyCallbackFn() {
|
|
5174
|
-
|
|
5184
|
+
_this40.options.views[view].ready = true;
|
|
5175
5185
|
resolve();
|
|
5176
5186
|
}
|
|
5177
5187
|
});
|
|
5178
5188
|
} else {
|
|
5179
5189
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
5180
|
-
|
|
5190
|
+
_this40.options.views[view].ready = true;
|
|
5181
5191
|
resolve();
|
|
5182
5192
|
}
|
|
5183
5193
|
});
|
|
5184
|
-
} else if (
|
|
5185
|
-
|
|
5194
|
+
} else if (_this40.options.views[view].ready !== true && _this40.options.views[view].load) {
|
|
5195
|
+
_this40.preloadView(view, function () {
|
|
5186
5196
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5187
|
-
|
|
5197
|
+
_this40.options.views[view].ready = true;
|
|
5188
5198
|
resolve();
|
|
5189
5199
|
});
|
|
5190
5200
|
} else {
|
|
5191
|
-
|
|
5201
|
+
_this40.options.views[view].ready = true;
|
|
5192
5202
|
resolve();
|
|
5193
5203
|
}
|
|
5194
5204
|
});
|
|
@@ -5196,35 +5206,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
5196
5206
|
}, {
|
|
5197
5207
|
key: "showView",
|
|
5198
5208
|
value: function showView(view, params, group) {
|
|
5199
|
-
var
|
|
5209
|
+
var _this41 = this;
|
|
5200
5210
|
if (view === '/' || view === '') {
|
|
5201
5211
|
view = this.options.defaultView || '';
|
|
5202
5212
|
}
|
|
5203
5213
|
this.initView(view).then(function () {
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
var children =
|
|
5214
|
+
_this41.activateItem(view, _this41.options.triggerClass);
|
|
5215
|
+
_this41.activateItem(view, _this41.options.viewClass);
|
|
5216
|
+
var children = _this41.getActiveViewsFromParent(view);
|
|
5207
5217
|
for (var c = 0; c < children.length; c++) {
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5218
|
+
_this41.activateItem(children[c].view, _this41.options.triggerClass);
|
|
5219
|
+
_this41.activateItem(children[c].view, _this41.options.viewClass);
|
|
5220
|
+
_this41.showComponents(children[c].view);
|
|
5211
5221
|
if (children[c].show) {
|
|
5212
5222
|
children[c].show.call(children[c]);
|
|
5213
5223
|
}
|
|
5214
|
-
|
|
5224
|
+
_this41.publish('show', [children[c].view, null, group]);
|
|
5215
5225
|
}
|
|
5216
|
-
if (
|
|
5217
|
-
|
|
5218
|
-
if (
|
|
5219
|
-
|
|
5226
|
+
if (_this41.previousView !== _this41.currentView || group !== 'main') {
|
|
5227
|
+
_this41.showComponents(view);
|
|
5228
|
+
if (_this41.options.views[view].show) {
|
|
5229
|
+
_this41.options.views[view].show.call(_this41.options.views[view]);
|
|
5220
5230
|
}
|
|
5221
|
-
|
|
5222
|
-
} else if (
|
|
5223
|
-
|
|
5224
|
-
if (
|
|
5225
|
-
|
|
5231
|
+
_this41.publish('show', [view, params, group]);
|
|
5232
|
+
} else if (_this41.previousView === _this41.currentView && _this41.previousParams.path !== _this41.currentParams.path) {
|
|
5233
|
+
_this41.showComponents(view);
|
|
5234
|
+
if (_this41.options.views[view].show) {
|
|
5235
|
+
_this41.options.views[view].show.call(_this41.options.views[view]);
|
|
5226
5236
|
}
|
|
5227
|
-
|
|
5237
|
+
_this41.publish('show', [view, params, group]);
|
|
5228
5238
|
}
|
|
5229
5239
|
});
|
|
5230
5240
|
}
|
|
@@ -5618,7 +5628,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5618
5628
|
}, {
|
|
5619
5629
|
key: "handleKeyUp",
|
|
5620
5630
|
value: function handleKeyUp(event) {
|
|
5621
|
-
var
|
|
5631
|
+
var _this42 = this;
|
|
5622
5632
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5623
5633
|
this.cursorPosition = event.target.selectionStart;
|
|
5624
5634
|
this.searchText = event.target.value;
|
|
@@ -5641,8 +5651,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5641
5651
|
}
|
|
5642
5652
|
if (event.target.value.length >= this.options.minLength) {
|
|
5643
5653
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5644
|
-
if (
|
|
5645
|
-
|
|
5654
|
+
if (_this42.options.onSearch) {
|
|
5655
|
+
_this42.options.onSearch(event.target.value, event);
|
|
5646
5656
|
}
|
|
5647
5657
|
}, this.options.searchTimeout);
|
|
5648
5658
|
} else {
|
|
@@ -5692,7 +5702,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5692
5702
|
}, {
|
|
5693
5703
|
key: "highlightActiveSuggestion",
|
|
5694
5704
|
value: function highlightActiveSuggestion() {
|
|
5695
|
-
var
|
|
5705
|
+
var _this43 = this;
|
|
5696
5706
|
// remove all previous highlights
|
|
5697
5707
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5698
5708
|
// if (parent) {
|
|
@@ -5711,7 +5721,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5711
5721
|
Array.from(els).forEach(function (e) {
|
|
5712
5722
|
e.classList.remove('active');
|
|
5713
5723
|
var index = e.getAttribute('data-index');
|
|
5714
|
-
if (+index ===
|
|
5724
|
+
if (+index === _this43.activeSuggestion) {
|
|
5715
5725
|
e.classList.add('active');
|
|
5716
5726
|
}
|
|
5717
5727
|
});
|
|
@@ -5831,13 +5841,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5831
5841
|
}, {
|
|
5832
5842
|
key: "startSuggestionTimeout",
|
|
5833
5843
|
value: function startSuggestionTimeout() {
|
|
5834
|
-
var
|
|
5844
|
+
var _this44 = this;
|
|
5835
5845
|
if (this.suggestingTimeoutFn) {
|
|
5836
5846
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5837
5847
|
}
|
|
5838
5848
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5839
5849
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5840
|
-
|
|
5850
|
+
_this44.hideSuggestions(_this44);
|
|
5841
5851
|
}, this.options.suggestingTimeout);
|
|
5842
5852
|
}
|
|
5843
5853
|
}, {
|
|
@@ -6009,7 +6019,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
6009
6019
|
/* global WebsyDesigns */
|
|
6010
6020
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
6011
6021
|
function WebsyTemplate(elementId, options) {
|
|
6012
|
-
var
|
|
6022
|
+
var _this45 = this;
|
|
6013
6023
|
_classCallCheck(this, WebsyTemplate);
|
|
6014
6024
|
var DEFAULTS = {
|
|
6015
6025
|
listeners: {
|
|
@@ -6038,8 +6048,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6038
6048
|
}
|
|
6039
6049
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
6040
6050
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
6041
|
-
|
|
6042
|
-
|
|
6051
|
+
_this45.options.template = templateString;
|
|
6052
|
+
_this45.render();
|
|
6043
6053
|
});
|
|
6044
6054
|
} else {
|
|
6045
6055
|
this.render();
|
|
@@ -6048,7 +6058,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6048
6058
|
_createClass(WebsyTemplate, [{
|
|
6049
6059
|
key: "buildHTML",
|
|
6050
6060
|
value: function buildHTML() {
|
|
6051
|
-
var
|
|
6061
|
+
var _this46 = this;
|
|
6052
6062
|
var html = "";
|
|
6053
6063
|
if (this.options.template) {
|
|
6054
6064
|
var template = this.options.template;
|
|
@@ -6097,14 +6107,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
6097
6107
|
}
|
|
6098
6108
|
}
|
|
6099
6109
|
if (polarity === true) {
|
|
6100
|
-
if (typeof
|
|
6110
|
+
if (typeof _this46.options.data[parts[0]] !== 'undefined' && _this46.options.data[parts[0]] === parts[1]) {
|
|
6101
6111
|
// remove the <if> tags
|
|
6102
6112
|
removeAll = false;
|
|
6103
6113
|
} else if (parts[0] === parts[1]) {
|
|
6104
6114
|
removeAll = false;
|
|
6105
6115
|
}
|
|
6106
6116
|
} else if (polarity === false) {
|
|
6107
|
-
if (typeof
|
|
6117
|
+
if (typeof _this46.options.data[parts[0]] !== 'undefined' && _this46.options.data[parts[0]] !== parts[1]) {
|
|
6108
6118
|
// remove the <if> tags
|
|
6109
6119
|
removeAll = false;
|
|
6110
6120
|
}
|
|
@@ -6423,7 +6433,7 @@ var WebsyUtils = {
|
|
|
6423
6433
|
/* global WebsyDesigns */
|
|
6424
6434
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6425
6435
|
function WebsyTable(elementId, options) {
|
|
6426
|
-
var
|
|
6436
|
+
var _this47 = this;
|
|
6427
6437
|
_classCallCheck(this, WebsyTable);
|
|
6428
6438
|
var DEFAULTS = {
|
|
6429
6439
|
pageSize: 20,
|
|
@@ -6456,8 +6466,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6456
6466
|
allowClear: false,
|
|
6457
6467
|
disableSearch: true,
|
|
6458
6468
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6459
|
-
if (
|
|
6460
|
-
|
|
6469
|
+
if (_this47.options.onChangePageSize) {
|
|
6470
|
+
_this47.options.onChangePageSize(selectedItem.value);
|
|
6461
6471
|
}
|
|
6462
6472
|
}
|
|
6463
6473
|
});
|
|
@@ -6481,20 +6491,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6481
6491
|
}, {
|
|
6482
6492
|
key: "appendRows",
|
|
6483
6493
|
value: function appendRows(data) {
|
|
6484
|
-
var
|
|
6494
|
+
var _this48 = this;
|
|
6485
6495
|
this._isRendered = false;
|
|
6486
6496
|
this.hideError();
|
|
6487
6497
|
var bodyHTML = '';
|
|
6488
6498
|
if (data) {
|
|
6489
6499
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6490
6500
|
return '<tr>' + r.map(function (c, i) {
|
|
6491
|
-
if (
|
|
6501
|
+
if (_this48.options.columns[i].show !== false) {
|
|
6492
6502
|
var style = '';
|
|
6493
6503
|
if (c.style) {
|
|
6494
6504
|
style += c.style;
|
|
6495
6505
|
}
|
|
6496
|
-
if (
|
|
6497
|
-
style += "width: ".concat(
|
|
6506
|
+
if (_this48.options.columns[i].width) {
|
|
6507
|
+
style += "width: ".concat(_this48.options.columns[i].width, "; ");
|
|
6498
6508
|
}
|
|
6499
6509
|
if (c.backgroundColor) {
|
|
6500
6510
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6505,20 +6515,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6505
6515
|
if (c.color) {
|
|
6506
6516
|
style += "color: ".concat(c.color, "; ");
|
|
6507
6517
|
}
|
|
6508
|
-
if (
|
|
6509
|
-
return "\n <td \n data-row-index='".concat(
|
|
6510
|
-
} else if ((
|
|
6511
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6518
|
+
if (_this48.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6519
|
+
return "\n <td \n data-row-index='".concat(_this48.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this48.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(_this48.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this48.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6520
|
+
} else if ((_this48.options.columns[i].showAsNavigatorLink === true || _this48.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6521
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this48.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this48.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this48.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this48.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6512
6522
|
} else {
|
|
6513
6523
|
var info = c.value;
|
|
6514
|
-
if (
|
|
6524
|
+
if (_this48.options.columns[i].showAsImage === true) {
|
|
6515
6525
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6516
6526
|
}
|
|
6517
6527
|
var html = "\n <td \n ";
|
|
6518
|
-
if (!
|
|
6528
|
+
if (!_this48.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
6519
6529
|
html += "\n data-info='".concat(info, "'\n ");
|
|
6520
6530
|
}
|
|
6521
|
-
html += "\n data-row-index='".concat(
|
|
6531
|
+
html += "\n data-row-index='".concat(_this48.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this48.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 ");
|
|
6522
6532
|
return html;
|
|
6523
6533
|
}
|
|
6524
6534
|
}
|
|
@@ -6679,7 +6689,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6679
6689
|
}, {
|
|
6680
6690
|
key: "render",
|
|
6681
6691
|
value: function render(data) {
|
|
6682
|
-
var
|
|
6692
|
+
var _this49 = this;
|
|
6683
6693
|
this._isRendered = false;
|
|
6684
6694
|
if (!this.options.columns) {
|
|
6685
6695
|
return;
|
|
@@ -6707,7 +6717,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6707
6717
|
if (c.width) {
|
|
6708
6718
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6709
6719
|
}
|
|
6710
|
-
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 ?
|
|
6720
|
+
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 ? _this49.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
6711
6721
|
}
|
|
6712
6722
|
}).join('') + '</tr>';
|
|
6713
6723
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6725,7 +6735,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6725
6735
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6726
6736
|
if (pagingEl) {
|
|
6727
6737
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6728
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6738
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this49.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6729
6739
|
});
|
|
6730
6740
|
var startIndex = 0;
|
|
6731
6741
|
if (this.options.pageCount > 8) {
|
|
@@ -6781,7 +6791,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6781
6791
|
/* global WebsyDesigns */
|
|
6782
6792
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6783
6793
|
function WebsyTable2(elementId, options) {
|
|
6784
|
-
var
|
|
6794
|
+
var _this50 = this;
|
|
6785
6795
|
_classCallCheck(this, WebsyTable2);
|
|
6786
6796
|
var DEFAULTS = {
|
|
6787
6797
|
pageSize: 20,
|
|
@@ -6816,8 +6826,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6816
6826
|
allowClear: false,
|
|
6817
6827
|
disableSearch: true,
|
|
6818
6828
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6819
|
-
if (
|
|
6820
|
-
|
|
6829
|
+
if (_this50.options.onChangePageSize) {
|
|
6830
|
+
_this50.options.onChangePageSize(selectedItem.value);
|
|
6821
6831
|
}
|
|
6822
6832
|
}
|
|
6823
6833
|
});
|
|
@@ -6839,20 +6849,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6839
6849
|
_createClass(WebsyTable2, [{
|
|
6840
6850
|
key: "appendRows",
|
|
6841
6851
|
value: function appendRows(data) {
|
|
6842
|
-
var
|
|
6852
|
+
var _this51 = this;
|
|
6843
6853
|
this.hideError();
|
|
6844
6854
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6845
6855
|
var bodyHTML = '';
|
|
6846
6856
|
if (data) {
|
|
6847
6857
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6848
6858
|
return '<tr>' + r.map(function (c, i) {
|
|
6849
|
-
if (
|
|
6850
|
-
var style = "height: ".concat(
|
|
6859
|
+
if (_this51.options.columns[i].show !== false) {
|
|
6860
|
+
var style = "height: ".concat(_this51.options.cellSize, "px; line-height: ").concat(_this51.options.cellSize, "px;");
|
|
6851
6861
|
if (c.style) {
|
|
6852
6862
|
style += c.style;
|
|
6853
6863
|
}
|
|
6854
|
-
if (
|
|
6855
|
-
style += "width: ".concat(
|
|
6864
|
+
if (_this51.options.columns[i].width) {
|
|
6865
|
+
style += "width: ".concat(_this51.options.columns[i].width, "; ");
|
|
6856
6866
|
}
|
|
6857
6867
|
if (c.backgroundColor) {
|
|
6858
6868
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6863,16 +6873,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6863
6873
|
if (c.color) {
|
|
6864
6874
|
style += "color: ".concat(c.color, "; ");
|
|
6865
6875
|
}
|
|
6866
|
-
if (
|
|
6867
|
-
return "\n <td \n data-row-index='".concat(
|
|
6868
|
-
} else if ((
|
|
6869
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6876
|
+
if (_this51.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6877
|
+
return "\n <td \n data-row-index='".concat(_this51.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this51.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(_this51.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this51.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6878
|
+
} else if ((_this51.options.columns[i].showAsNavigatorLink === true || _this51.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6879
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this51.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this51.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this51.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this51.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6870
6880
|
} else {
|
|
6871
6881
|
var info = c.value;
|
|
6872
|
-
if (
|
|
6882
|
+
if (_this51.options.columns[i].showAsImage === true) {
|
|
6873
6883
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6874
6884
|
}
|
|
6875
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6885
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this51.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this51.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 ");
|
|
6876
6886
|
}
|
|
6877
6887
|
}
|
|
6878
6888
|
}).join('') + '</tr>';
|
|
@@ -7106,7 +7116,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7106
7116
|
}, {
|
|
7107
7117
|
key: "render",
|
|
7108
7118
|
value: function render(data) {
|
|
7109
|
-
var
|
|
7119
|
+
var _this52 = this;
|
|
7110
7120
|
if (!this.options.columns) {
|
|
7111
7121
|
return;
|
|
7112
7122
|
}
|
|
@@ -7134,7 +7144,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7134
7144
|
if (c.width) {
|
|
7135
7145
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
7136
7146
|
}
|
|
7137
|
-
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 ?
|
|
7147
|
+
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 ? _this52.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
7138
7148
|
}
|
|
7139
7149
|
}).join('') + '</tr>';
|
|
7140
7150
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -7144,7 +7154,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7144
7154
|
var dropdownHTML = "";
|
|
7145
7155
|
this.options.columns.forEach(function (c, i) {
|
|
7146
7156
|
if (c.searchable && c.searchField) {
|
|
7147
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
7157
|
+
dropdownHTML += "\n <div id=\"".concat(_this52.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
7148
7158
|
}
|
|
7149
7159
|
});
|
|
7150
7160
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -7164,7 +7174,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7164
7174
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
7165
7175
|
if (pagingEl) {
|
|
7166
7176
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
7167
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
7177
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this52.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
7168
7178
|
});
|
|
7169
7179
|
var startIndex = 0;
|
|
7170
7180
|
if (this.options.pageCount > 8) {
|
|
@@ -7241,17 +7251,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
7241
7251
|
}, {
|
|
7242
7252
|
key: "getColumnParameters",
|
|
7243
7253
|
value: function getColumnParameters(values) {
|
|
7244
|
-
var
|
|
7254
|
+
var _this53 = this;
|
|
7245
7255
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
7246
7256
|
tableEl.style.tableLayout = 'auto';
|
|
7247
7257
|
tableEl.style.width = 'auto';
|
|
7248
7258
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
7249
7259
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
7250
7260
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
7251
|
-
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 ?
|
|
7261
|
+
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 ? _this53.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
7252
7262
|
}).join('') + '</tr>';
|
|
7253
7263
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
7254
|
-
return "\n <td \n style='height: ".concat(
|
|
7264
|
+
return "\n <td \n style='height: ".concat(_this53.options.cellSize, "px; line-height: ").concat(_this53.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
7255
7265
|
}).join('') + '</tr>';
|
|
7256
7266
|
// get height of the first data cell
|
|
7257
7267
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7415,7 +7425,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7415
7425
|
}, {
|
|
7416
7426
|
key: "buildBodyHtml",
|
|
7417
7427
|
value: function buildBodyHtml() {
|
|
7418
|
-
var
|
|
7428
|
+
var _this54 = this;
|
|
7419
7429
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7420
7430
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7421
7431
|
if (!this.options.columns) {
|
|
@@ -7440,7 +7450,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7440
7450
|
row.forEach(function (cell, cellIndex) {
|
|
7441
7451
|
var sizeIndex = cell.level || cellIndex;
|
|
7442
7452
|
var colIndex = cell.index || cellIndex;
|
|
7443
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7453
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this54.options.columns[_this54.options.columns.length - 1][colIndex].show === false) {
|
|
7444
7454
|
return; // need to revisit this logic
|
|
7445
7455
|
}
|
|
7446
7456
|
|
|
@@ -7467,7 +7477,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7467
7477
|
style += "color: ".concat(cell.color, "; ");
|
|
7468
7478
|
}
|
|
7469
7479
|
// console.log('rowspan', cell.rowspan)
|
|
7470
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
7480
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this54.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n ");
|
|
7471
7481
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
7472
7482
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
7473
7483
|
}
|
|
@@ -7480,10 +7490,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7480
7490
|
// }
|
|
7481
7491
|
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 >");
|
|
7482
7492
|
if (cell.expandable === true) {
|
|
7483
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
7493
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this54.options.plusIcon, "</i>");
|
|
7484
7494
|
}
|
|
7485
7495
|
if (cell.collapsable === true) {
|
|
7486
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
7496
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this54.options.minusIcon, "</i>");
|
|
7487
7497
|
}
|
|
7488
7498
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7489
7499
|
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 ");
|
|
@@ -7504,7 +7514,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7504
7514
|
}, {
|
|
7505
7515
|
key: "buildHeaderHtml",
|
|
7506
7516
|
value: function buildHeaderHtml() {
|
|
7507
|
-
var
|
|
7517
|
+
var _this55 = this;
|
|
7508
7518
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7509
7519
|
if (!this.options.columns) {
|
|
7510
7520
|
return '';
|
|
@@ -7525,7 +7535,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7525
7535
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7526
7536
|
// return
|
|
7527
7537
|
// }
|
|
7528
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
7538
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this55.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
7529
7539
|
row.filter(function (c) {
|
|
7530
7540
|
return c.show !== false;
|
|
7531
7541
|
}).forEach(function (col, colIndex) {
|
|
@@ -7545,24 +7555,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7545
7555
|
if (col.style) {
|
|
7546
7556
|
style += col.style;
|
|
7547
7557
|
}
|
|
7548
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7558
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this55.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7549
7559
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7550
7560
|
// headerHtml += `
|
|
7551
7561
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7552
7562
|
// width='${col.width || col.actualWidth}'
|
|
7553
7563
|
// `
|
|
7554
7564
|
// }
|
|
7555
|
-
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 ?
|
|
7565
|
+
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 ? _this55.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this55.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
7556
7566
|
});
|
|
7557
7567
|
headerHtml += "</tr>";
|
|
7558
7568
|
});
|
|
7559
7569
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7560
7570
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7561
7571
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7562
|
-
var testEl = document.getElementById("".concat(
|
|
7572
|
+
var testEl = document.getElementById("".concat(_this55.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7563
7573
|
if (!testEl) {
|
|
7564
7574
|
var newE = document.createElement('div');
|
|
7565
|
-
newE.id = "".concat(
|
|
7575
|
+
newE.id = "".concat(_this55.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7566
7576
|
newE.className = 'websy-modal-dropdown';
|
|
7567
7577
|
dropdownEl.appendChild(newE);
|
|
7568
7578
|
}
|
|
@@ -7585,7 +7595,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7585
7595
|
}, {
|
|
7586
7596
|
key: "buildTotalHtml",
|
|
7587
7597
|
value: function buildTotalHtml() {
|
|
7588
|
-
var
|
|
7598
|
+
var _this56 = this;
|
|
7589
7599
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7590
7600
|
if (!this.options.totals) {
|
|
7591
7601
|
return '';
|
|
@@ -7601,7 +7611,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7601
7611
|
|
|
7602
7612
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7603
7613
|
if (useWidths === true) {
|
|
7604
|
-
totalHtml += "\n style='width: ".concat(
|
|
7614
|
+
totalHtml += "\n style='width: ".concat(_this56.options.columns[_this56.options.columns.length - 1][colIndex].width || _this56.options.columns[_this56.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
7605
7615
|
}
|
|
7606
7616
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7607
7617
|
});
|
|
@@ -7611,7 +7621,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7611
7621
|
}, {
|
|
7612
7622
|
key: "calculateSizes",
|
|
7613
7623
|
value: function calculateSizes() {
|
|
7614
|
-
var
|
|
7624
|
+
var _this57 = this;
|
|
7615
7625
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7616
7626
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7617
7627
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7655,7 +7665,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7655
7665
|
rows.forEach(function (row, rowIndex) {
|
|
7656
7666
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7657
7667
|
var colSize = col.getBoundingClientRect();
|
|
7658
|
-
|
|
7668
|
+
_this57.sizes.cellHeight = colSize.height;
|
|
7659
7669
|
if (columnsForSizing[colIndex]) {
|
|
7660
7670
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7661
7671
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7667,7 +7677,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7667
7677
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7668
7678
|
// }
|
|
7669
7679
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7670
|
-
if (colIndex >=
|
|
7680
|
+
if (colIndex >= _this57.pinnedColumns) {
|
|
7671
7681
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7672
7682
|
}
|
|
7673
7683
|
}
|
|
@@ -7682,7 +7692,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7682
7692
|
return a + (b.width || b.actualWidth);
|
|
7683
7693
|
}, 0);
|
|
7684
7694
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7685
|
-
return i >=
|
|
7695
|
+
return i >= _this57.pinnedColumns;
|
|
7686
7696
|
}).reduce(function (a, b) {
|
|
7687
7697
|
return a + (b.width || b.actualWidth);
|
|
7688
7698
|
}, 0);
|
|
@@ -7693,7 +7703,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7693
7703
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7694
7704
|
columnsForSizing.forEach(function (c) {
|
|
7695
7705
|
c.shouldGrow = true;
|
|
7696
|
-
if (
|
|
7706
|
+
if (_this57.options.autoFitColumns === false) {
|
|
7697
7707
|
c.shouldGrow = false;
|
|
7698
7708
|
if (c.potentialWidth > c.actualWidth) {
|
|
7699
7709
|
c.shouldGrow = true;
|
|
@@ -7712,7 +7722,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7712
7722
|
// if (!c.width) {
|
|
7713
7723
|
// if (c.actualWidth < equalWidth) {
|
|
7714
7724
|
// adjust the width
|
|
7715
|
-
if (
|
|
7725
|
+
if (_this57.options.autoFitColumns === true) {
|
|
7716
7726
|
if (c.width) {
|
|
7717
7727
|
c.width += equalWidth;
|
|
7718
7728
|
}
|
|
@@ -7736,9 +7746,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7736
7746
|
}
|
|
7737
7747
|
// }
|
|
7738
7748
|
// }
|
|
7739
|
-
|
|
7740
|
-
if (i >
|
|
7741
|
-
|
|
7749
|
+
_this57.sizes.totalWidth += c.width || c.actualWidth;
|
|
7750
|
+
if (i > _this57.pinnedColumns) {
|
|
7751
|
+
_this57.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7742
7752
|
}
|
|
7743
7753
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7744
7754
|
});
|
|
@@ -7797,7 +7807,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7797
7807
|
}, {
|
|
7798
7808
|
key: "createSample",
|
|
7799
7809
|
value: function createSample(data) {
|
|
7800
|
-
var
|
|
7810
|
+
var _this58 = this;
|
|
7801
7811
|
var output = [];
|
|
7802
7812
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7803
7813
|
if (col.maxLength) {
|
|
@@ -7807,7 +7817,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7807
7817
|
} else if (data) {
|
|
7808
7818
|
var longest = '';
|
|
7809
7819
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7810
|
-
if (data[i].length ===
|
|
7820
|
+
if (data[i].length === _this58.options.columns[_this58.options.columns.length - 1].length) {
|
|
7811
7821
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7812
7822
|
longest = data[i][colIndex].value;
|
|
7813
7823
|
}
|
|
@@ -8079,7 +8089,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8079
8089
|
}, {
|
|
8080
8090
|
key: "perpetualScroll",
|
|
8081
8091
|
value: function perpetualScroll() {
|
|
8082
|
-
var
|
|
8092
|
+
var _this59 = this;
|
|
8083
8093
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
8084
8094
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
8085
8095
|
return;
|
|
@@ -8098,17 +8108,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8098
8108
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
8099
8109
|
var _loop2 = function _loop2(i) {
|
|
8100
8110
|
setTimeout(function () {
|
|
8101
|
-
var delta =
|
|
8111
|
+
var delta = _this59.mouseYStart - _this59.currentClientY + _this59.sizes.cellHeight * (i + 1) * direction;
|
|
8102
8112
|
delta = Math.min(10, delta);
|
|
8103
8113
|
delta = Math.max(-10, delta);
|
|
8104
8114
|
// only run this if isPerpetual === true
|
|
8105
8115
|
// this value is reset to false on touchStart
|
|
8106
|
-
if (
|
|
8116
|
+
if (_this59.isPerpetual === true) {
|
|
8107
8117
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
8108
8118
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
8109
|
-
|
|
8110
|
-
if (
|
|
8111
|
-
clearTimeout(
|
|
8119
|
+
_this59.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
8120
|
+
if (_this59.scrollTimeout) {
|
|
8121
|
+
clearTimeout(_this59.scrollTimeout);
|
|
8112
8122
|
}
|
|
8113
8123
|
}
|
|
8114
8124
|
}, 1000 / fps * i);
|
|
@@ -8382,7 +8392,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8382
8392
|
/* global d3 include WebsyDesigns */
|
|
8383
8393
|
var WebsyChart = /*#__PURE__*/function () {
|
|
8384
8394
|
function WebsyChart(elementId, options) {
|
|
8385
|
-
var
|
|
8395
|
+
var _this60 = this;
|
|
8386
8396
|
_classCallCheck(this, WebsyChart);
|
|
8387
8397
|
var DEFAULTS = {
|
|
8388
8398
|
margin: {
|
|
@@ -8442,7 +8452,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8442
8452
|
this.invertOverride = function (input, input2) {
|
|
8443
8453
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8444
8454
|
var xAxis = 'bottom';
|
|
8445
|
-
if (
|
|
8455
|
+
if (_this60.options.orientation === 'horizontal') {
|
|
8446
8456
|
xAxis = 'left';
|
|
8447
8457
|
}
|
|
8448
8458
|
if (forBrush === true) {
|
|
@@ -8450,12 +8460,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8450
8460
|
}
|
|
8451
8461
|
xAxis += 'Axis';
|
|
8452
8462
|
var output;
|
|
8453
|
-
var width =
|
|
8463
|
+
var width = _this60.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8454
8464
|
// if (this.customBottomRange) {
|
|
8455
|
-
for (var index = 0; index <
|
|
8456
|
-
if (input >
|
|
8457
|
-
if (
|
|
8458
|
-
if (input <
|
|
8465
|
+
for (var index = 0; index < _this60.customBottomRange.length; index++) {
|
|
8466
|
+
if (input > _this60.customBottomRange[index]) {
|
|
8467
|
+
if (_this60.customBottomRange[index + 1]) {
|
|
8468
|
+
if (input < _this60.customBottomRange[index + 1]) {
|
|
8459
8469
|
output = index;
|
|
8460
8470
|
break;
|
|
8461
8471
|
}
|
|
@@ -8620,9 +8630,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8620
8630
|
}, {
|
|
8621
8631
|
key: "handleEventMouseMove",
|
|
8622
8632
|
value: function handleEventMouseMove(event, d) {
|
|
8623
|
-
var
|
|
8633
|
+
var _this61 = this;
|
|
8624
8634
|
var bisectDate = d3.bisector(function (d) {
|
|
8625
|
-
return
|
|
8635
|
+
return _this61.parseX(d.x.value);
|
|
8626
8636
|
}).left;
|
|
8627
8637
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8628
8638
|
var xAxis = 'bottomAxis';
|
|
@@ -8655,9 +8665,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8655
8665
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8656
8666
|
}
|
|
8657
8667
|
this.options.data.series.forEach(function (s) {
|
|
8658
|
-
if (
|
|
8668
|
+
if (_this61.options.data[xData].scale !== 'Time') {
|
|
8659
8669
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8660
|
-
xPoint =
|
|
8670
|
+
xPoint = _this61.customBottomRange[x0] + (_this61.customBottomRange[x0 + 1] - _this61.customBottomRange[x0]) / 2;
|
|
8661
8671
|
// }
|
|
8662
8672
|
// else {
|
|
8663
8673
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8677,41 +8687,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8677
8687
|
var index = bisectDate(s.data, x0, 1);
|
|
8678
8688
|
var pointA = s.data[index - 1];
|
|
8679
8689
|
var pointB = s.data[index];
|
|
8680
|
-
if (
|
|
8690
|
+
if (_this61.options.orientation === 'horizontal') {
|
|
8681
8691
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8682
8692
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8683
8693
|
}
|
|
8684
8694
|
if (pointA && !pointB) {
|
|
8685
|
-
xPoint =
|
|
8695
|
+
xPoint = _this61[xAxis](_this61.parseX(pointA.x.value));
|
|
8686
8696
|
tooltipTitle = pointA.x.value;
|
|
8687
8697
|
if (!pointA.y.color) {
|
|
8688
8698
|
pointA.y.color = s.color;
|
|
8689
8699
|
}
|
|
8690
8700
|
tooltipData.push(pointA);
|
|
8691
8701
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8692
|
-
tooltipTitle = d3.timeFormat(
|
|
8702
|
+
tooltipTitle = d3.timeFormat(_this61.options.dateFormat || _this61.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8693
8703
|
}
|
|
8694
8704
|
}
|
|
8695
8705
|
if (pointB && !pointA) {
|
|
8696
|
-
xPoint =
|
|
8706
|
+
xPoint = _this61[xAxis](_this61.parseX(pointB.x.value));
|
|
8697
8707
|
tooltipTitle = pointB.x.value;
|
|
8698
8708
|
if (!pointB.y.color) {
|
|
8699
8709
|
pointB.y.color = s.color;
|
|
8700
8710
|
}
|
|
8701
8711
|
tooltipData.push(pointB);
|
|
8702
8712
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8703
|
-
tooltipTitle = d3.timeFormat(
|
|
8713
|
+
tooltipTitle = d3.timeFormat(_this61.options.dateFormat || _this61.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8704
8714
|
}
|
|
8705
8715
|
}
|
|
8706
8716
|
if (pointA && pointB) {
|
|
8707
|
-
var d0 =
|
|
8708
|
-
var d1 =
|
|
8717
|
+
var d0 = _this61[xAxis](_this61.parseX(pointA.x.value));
|
|
8718
|
+
var d1 = _this61[xAxis](_this61.parseX(pointB.x.value));
|
|
8709
8719
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8710
8720
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8711
8721
|
xPoint = d1;
|
|
8712
8722
|
tooltipTitle = pointB.x.value;
|
|
8713
8723
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8714
|
-
tooltipTitle = d3.timeFormat(
|
|
8724
|
+
tooltipTitle = d3.timeFormat(_this61.options.dateFormat || _this61.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8715
8725
|
}
|
|
8716
8726
|
if (!pointB.y.color) {
|
|
8717
8727
|
pointB.y.color = s.color;
|
|
@@ -8721,7 +8731,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8721
8731
|
xPoint = d0;
|
|
8722
8732
|
tooltipTitle = pointA.x.value;
|
|
8723
8733
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8724
|
-
tooltipTitle = d3.timeFormat(
|
|
8734
|
+
tooltipTitle = d3.timeFormat(_this61.options.dateFormat || _this61.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8725
8735
|
}
|
|
8726
8736
|
if (!pointA.y.color) {
|
|
8727
8737
|
pointA.y.color = s.color;
|
|
@@ -8847,7 +8857,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8847
8857
|
}, {
|
|
8848
8858
|
key: "render",
|
|
8849
8859
|
value: function render(options) {
|
|
8850
|
-
var
|
|
8860
|
+
var _this62 = this;
|
|
8851
8861
|
/* global d3 options WebsyUtils */
|
|
8852
8862
|
this._isRendered = false;
|
|
8853
8863
|
if (typeof options !== 'undefined') {
|
|
@@ -8916,7 +8926,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8916
8926
|
this.options.data.series.map(function (s, i) {
|
|
8917
8927
|
return {
|
|
8918
8928
|
value: s.label || s.key,
|
|
8919
|
-
color: s.color ||
|
|
8929
|
+
color: s.color || _this62.options.colors[i % _this62.options.colors.length]
|
|
8920
8930
|
};
|
|
8921
8931
|
});
|
|
8922
8932
|
}
|
|
@@ -9273,25 +9283,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9273
9283
|
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') {
|
|
9274
9284
|
var acc = 0;
|
|
9275
9285
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9276
|
-
var adjustment =
|
|
9286
|
+
var adjustment = _this62.bandPadding * index + _this62.bandPadding;
|
|
9277
9287
|
// if (this.options.data.bottom.padding) {
|
|
9278
9288
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
9279
9289
|
// }
|
|
9280
|
-
var start =
|
|
9290
|
+
var start = _this62.widthForCalc / noOfPoints * acc;
|
|
9281
9291
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
9282
9292
|
var pos = i * proposedBandWidth;
|
|
9283
|
-
|
|
9293
|
+
_this62["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
9284
9294
|
}
|
|
9285
|
-
acc +=
|
|
9286
|
-
var end =
|
|
9295
|
+
acc += _this62.options.grouping !== 'stacked' && _this62.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9296
|
+
var end = _this62.widthForCalc / noOfPoints * acc;
|
|
9287
9297
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
9288
9298
|
return end + adjustment;
|
|
9289
9299
|
})));
|
|
9290
9300
|
acc = 0;
|
|
9291
9301
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
9292
|
-
var adjustment =
|
|
9293
|
-
acc +=
|
|
9294
|
-
return (
|
|
9302
|
+
var adjustment = _this62.brushBandPadding * index + _this62.brushBandPadding;
|
|
9303
|
+
acc += _this62.options.grouping !== 'stacked' && _this62.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9304
|
+
return (_this62.options.orientation === 'vertical' ? _this62.plotWidth : _this62.plotHeight) / noOfPoints * acc;
|
|
9295
9305
|
})));
|
|
9296
9306
|
}
|
|
9297
9307
|
// }
|
|
@@ -9464,7 +9474,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9464
9474
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9465
9475
|
if (this.options.data.bottom.formatter) {
|
|
9466
9476
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9467
|
-
return
|
|
9477
|
+
return _this62.options.data.bottom.formatter(d);
|
|
9468
9478
|
});
|
|
9469
9479
|
}
|
|
9470
9480
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9474,7 +9484,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9474
9484
|
}
|
|
9475
9485
|
if (this.customBottomRange.length > 0) {
|
|
9476
9486
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9477
|
-
return "translate(".concat(
|
|
9487
|
+
return "translate(".concat(_this62.customBottomRange[i] + (_this62.customBottomRange[i + 1] - _this62.customBottomRange[i]) / 2, ", 0)");
|
|
9478
9488
|
});
|
|
9479
9489
|
}
|
|
9480
9490
|
}
|
|
@@ -9493,14 +9503,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9493
9503
|
}
|
|
9494
9504
|
if (this.options.margin.axisLeft > 0) {
|
|
9495
9505
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9496
|
-
if (
|
|
9497
|
-
d =
|
|
9506
|
+
if (_this62.options.data.left.formatter) {
|
|
9507
|
+
d = _this62.options.data.left.formatter(d);
|
|
9498
9508
|
}
|
|
9499
9509
|
return d;
|
|
9500
9510
|
}));
|
|
9501
9511
|
if (this.customLeftRange.length > 0) {
|
|
9502
9512
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9503
|
-
return "translate(0, ".concat(
|
|
9513
|
+
return "translate(0, ".concat(_this62.customLeftRange[i] + (_this62.customLeftRange[i + 1] - _this62.customLeftRange[i]) / 2, ")");
|
|
9504
9514
|
});
|
|
9505
9515
|
}
|
|
9506
9516
|
}
|
|
@@ -9528,8 +9538,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9528
9538
|
}
|
|
9529
9539
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9530
9540
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9531
|
-
if (
|
|
9532
|
-
d =
|
|
9541
|
+
if (_this62.options.data.right.formatter) {
|
|
9542
|
+
d = _this62.options.data.right.formatter(d);
|
|
9533
9543
|
}
|
|
9534
9544
|
return d;
|
|
9535
9545
|
}));
|
|
@@ -9569,25 +9579,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9569
9579
|
}, {
|
|
9570
9580
|
key: "renderComponents",
|
|
9571
9581
|
value: function renderComponents() {
|
|
9572
|
-
var
|
|
9582
|
+
var _this63 = this;
|
|
9573
9583
|
// Draw the series data
|
|
9574
9584
|
this.renderedKeys = {};
|
|
9575
9585
|
this.options.data.series.forEach(function (series, index) {
|
|
9576
9586
|
if (!series.key) {
|
|
9577
|
-
series.key =
|
|
9587
|
+
series.key = _this63.createIdentity();
|
|
9578
9588
|
}
|
|
9579
9589
|
if (!series.color) {
|
|
9580
|
-
series.color =
|
|
9590
|
+
series.color = _this63.options.colors[index % _this63.options.colors.length];
|
|
9581
9591
|
}
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9592
|
+
_this63["render".concat(series.type || 'bar')](series, index);
|
|
9593
|
+
_this63.renderLabels(series, index);
|
|
9594
|
+
_this63.renderedKeys[series.key] = series.type;
|
|
9585
9595
|
});
|
|
9586
9596
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9587
9597
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9588
9598
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9589
9599
|
this.options.refLines.forEach(function (l) {
|
|
9590
|
-
return
|
|
9600
|
+
return _this63.renderRefLine(l);
|
|
9591
9601
|
});
|
|
9592
9602
|
}
|
|
9593
9603
|
this._isRendered = true;
|
|
@@ -9595,25 +9605,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9595
9605
|
}, {
|
|
9596
9606
|
key: "renderarea",
|
|
9597
9607
|
value: function renderarea(series, index) {
|
|
9598
|
-
var
|
|
9608
|
+
var _this64 = this;
|
|
9599
9609
|
/* global d3 series index */
|
|
9600
9610
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9601
9611
|
return d3.area().x(function (d) {
|
|
9602
|
-
if (
|
|
9603
|
-
return
|
|
9612
|
+
if (_this64.options.data[xAxis].scale === 'Time') {
|
|
9613
|
+
return _this64["".concat(xAxis, "Axis")](_this64.parseX(d.x.value));
|
|
9604
9614
|
} else {
|
|
9605
|
-
var xIndex =
|
|
9606
|
-
var xPos =
|
|
9607
|
-
if (
|
|
9608
|
-
xPos = xPos + (
|
|
9615
|
+
var xIndex = _this64[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9616
|
+
var xPos = _this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9617
|
+
if (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9618
|
+
xPos = xPos + (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9609
9619
|
}
|
|
9610
9620
|
return xPos;
|
|
9611
9621
|
}
|
|
9612
9622
|
}).y0(function (d) {
|
|
9613
|
-
return
|
|
9623
|
+
return _this64["".concat(yAxis, "Axis")](0);
|
|
9614
9624
|
}).y1(function (d) {
|
|
9615
|
-
return
|
|
9616
|
-
}).curve(d3[curveStyle ||
|
|
9625
|
+
return _this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9626
|
+
}).curve(d3[curveStyle || _this64.options.curveStyle]);
|
|
9617
9627
|
};
|
|
9618
9628
|
var xAxis = 'bottom';
|
|
9619
9629
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9653,7 +9663,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9653
9663
|
}, {
|
|
9654
9664
|
key: "renderbar",
|
|
9655
9665
|
value: function renderbar(series, index) {
|
|
9656
|
-
var
|
|
9666
|
+
var _this65 = this;
|
|
9657
9667
|
/* global series index d3 */
|
|
9658
9668
|
var xAxis = 'bottom';
|
|
9659
9669
|
var yAxis = 'left';
|
|
@@ -9820,24 +9830,24 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9820
9830
|
}
|
|
9821
9831
|
bars.exit().transition().duration(this.options.transitionDuration).style('fill-opacity', 1e-6).remove();
|
|
9822
9832
|
bars.attr('width', function (d, i) {
|
|
9823
|
-
return Math.abs(getBarWidth.call(
|
|
9833
|
+
return Math.abs(getBarWidth.call(_this65, d, i, yAxis, xAxis));
|
|
9824
9834
|
}).attr('height', function (d, i) {
|
|
9825
|
-
return getBarHeight.call(
|
|
9835
|
+
return getBarHeight.call(_this65, d, i, yAxis, xAxis);
|
|
9826
9836
|
}).attr('x', function (d, i) {
|
|
9827
|
-
return getBarX.call(
|
|
9837
|
+
return getBarX.call(_this65, d, i, yAxis, xAxis);
|
|
9828
9838
|
}).attr('y', function (d, i) {
|
|
9829
|
-
return getBarY.call(
|
|
9839
|
+
return getBarY.call(_this65, d, i, yAxis, xAxis);
|
|
9830
9840
|
}).transition().duration(this.options.transitionDuration).attr('fill', function (d) {
|
|
9831
9841
|
return d.y.color || d.color || series.color;
|
|
9832
9842
|
});
|
|
9833
9843
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9834
|
-
return Math.abs(getBarWidth.call(
|
|
9844
|
+
return Math.abs(getBarWidth.call(_this65, d, i, yAxis, xAxis));
|
|
9835
9845
|
}).attr('height', function (d, i) {
|
|
9836
|
-
return getBarHeight.call(
|
|
9846
|
+
return getBarHeight.call(_this65, d, i, yAxis, xAxis);
|
|
9837
9847
|
}).attr('x', function (d, i) {
|
|
9838
|
-
return getBarX.call(
|
|
9848
|
+
return getBarX.call(_this65, d, i, yAxis, xAxis);
|
|
9839
9849
|
}).attr('y', function (d, i) {
|
|
9840
|
-
return getBarY.call(
|
|
9850
|
+
return getBarY.call(_this65, d, i, yAxis, xAxis);
|
|
9841
9851
|
})
|
|
9842
9852
|
// .transition(this.transition)
|
|
9843
9853
|
.attr('fill', function (d) {
|
|
@@ -9849,24 +9859,24 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9849
9859
|
this.brushBarsInitialized[series.key] = true;
|
|
9850
9860
|
brushBars.exit().transition().duration(this.options.transitionDuration).style('fill-opacity', 1e-6).remove();
|
|
9851
9861
|
brushBars.attr('width', function (d, i) {
|
|
9852
|
-
return Math.abs(getBarWidth.call(
|
|
9862
|
+
return Math.abs(getBarWidth.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9853
9863
|
}).attr('height', function (d, i) {
|
|
9854
|
-
return getBarHeight.call(
|
|
9864
|
+
return getBarHeight.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9855
9865
|
}).attr('x', function (d, i) {
|
|
9856
|
-
return getBarX.call(
|
|
9866
|
+
return getBarX.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9857
9867
|
}).attr('y', function (d, i) {
|
|
9858
|
-
return getBarY.call(
|
|
9868
|
+
return getBarY.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9859
9869
|
}).transition().duration(this.options.transitionDuration).attr('fill', function (d) {
|
|
9860
9870
|
return d.y.color || d.color || series.color;
|
|
9861
9871
|
});
|
|
9862
9872
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9863
|
-
return Math.abs(getBarWidth.call(
|
|
9873
|
+
return Math.abs(getBarWidth.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9864
9874
|
}).attr('height', function (d, i) {
|
|
9865
|
-
return getBarHeight.call(
|
|
9875
|
+
return getBarHeight.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9866
9876
|
}).attr('x', function (d, i) {
|
|
9867
|
-
return getBarX.call(
|
|
9877
|
+
return getBarX.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9868
9878
|
}).attr('y', function (d, i) {
|
|
9869
|
-
return getBarY.call(
|
|
9879
|
+
return getBarY.call(_this65, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9870
9880
|
})
|
|
9871
9881
|
// .transition(this.transition)
|
|
9872
9882
|
.attr('fill', function (d) {
|
|
@@ -9893,7 +9903,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9893
9903
|
}, {
|
|
9894
9904
|
key: "renderLabels",
|
|
9895
9905
|
value: function renderLabels(series, index) {
|
|
9896
|
-
var
|
|
9906
|
+
var _this66 = this;
|
|
9897
9907
|
/* global series index d3 WebsyDesigns */
|
|
9898
9908
|
var xAxis = 'bottom';
|
|
9899
9909
|
var yAxis = 'left';
|
|
@@ -9909,14 +9919,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9909
9919
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9910
9920
|
labels.exit().transition().duration(this.options.transitionDuration).style('stroke-opacity', 1e-6).remove();
|
|
9911
9921
|
labels.attr('x', function (d) {
|
|
9912
|
-
return getLabelX.call(
|
|
9922
|
+
return getLabelX.call(_this66, d, series.labelPosition);
|
|
9913
9923
|
}).attr('y', function (d) {
|
|
9914
|
-
return getLabelY.call(
|
|
9924
|
+
return getLabelY.call(_this66, d, series.labelPosition);
|
|
9915
9925
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9916
|
-
if (
|
|
9926
|
+
if (_this66.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9917
9927
|
return 'transparent';
|
|
9918
9928
|
}
|
|
9919
|
-
return
|
|
9929
|
+
return _this66.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9920
9930
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition().duration(this.options.transitionDuration).text(function (d) {
|
|
9921
9931
|
return d.y.label || d.y.value;
|
|
9922
9932
|
}).each(function (d, i) {
|
|
@@ -9950,14 +9960,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9950
9960
|
}
|
|
9951
9961
|
});
|
|
9952
9962
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9953
|
-
return getLabelX.call(
|
|
9963
|
+
return getLabelX.call(_this66, d, series.labelPosition);
|
|
9954
9964
|
}).attr('y', function (d) {
|
|
9955
|
-
return getLabelY.call(
|
|
9965
|
+
return getLabelY.call(_this66, d, series.labelPosition);
|
|
9956
9966
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9957
|
-
if (
|
|
9967
|
+
if (_this66.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9958
9968
|
return 'transparent';
|
|
9959
9969
|
}
|
|
9960
|
-
return
|
|
9970
|
+
return _this66.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9961
9971
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9962
9972
|
return d.y.label || d.y.value;
|
|
9963
9973
|
}).each(function (d, i) {
|
|
@@ -10035,32 +10045,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10035
10045
|
}, {
|
|
10036
10046
|
key: "renderline",
|
|
10037
10047
|
value: function renderline(series, index) {
|
|
10038
|
-
var
|
|
10048
|
+
var _this67 = this;
|
|
10039
10049
|
/* global series index d3 */
|
|
10040
10050
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
10041
10051
|
return d3.line().x(function (d) {
|
|
10042
|
-
if (
|
|
10043
|
-
return
|
|
10052
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10053
|
+
return _this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10044
10054
|
} else {
|
|
10045
|
-
if (
|
|
10046
|
-
return
|
|
10055
|
+
if (_this67.options.data[xAxis].scale === 'Time') {
|
|
10056
|
+
return _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value));
|
|
10047
10057
|
} else {
|
|
10048
|
-
var xIndex =
|
|
10049
|
-
var xPos =
|
|
10050
|
-
if (
|
|
10051
|
-
xPos = xPos + (
|
|
10058
|
+
var xIndex = _this67[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10059
|
+
var xPos = _this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10060
|
+
if (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10061
|
+
xPos = xPos + (_this67["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10052
10062
|
}
|
|
10053
10063
|
return xPos;
|
|
10054
10064
|
}
|
|
10055
10065
|
}
|
|
10056
10066
|
}).y(function (d) {
|
|
10057
|
-
if (
|
|
10058
|
-
var adjustment =
|
|
10059
|
-
return
|
|
10067
|
+
if (_this67.options.orientation === 'horizontal') {
|
|
10068
|
+
var adjustment = _this67.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this67.options.data[xAxis].bandWidth / 2;
|
|
10069
|
+
return _this67["".concat(xAxis, "Axis")](_this67.parseX(d.x.value)) + adjustment;
|
|
10060
10070
|
} else {
|
|
10061
|
-
return
|
|
10071
|
+
return _this67["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
10062
10072
|
}
|
|
10063
|
-
}).curve(d3[curveStyle ||
|
|
10073
|
+
}).curve(d3[curveStyle || _this67.options.curveStyle]);
|
|
10064
10074
|
};
|
|
10065
10075
|
var xAxis = 'bottom';
|
|
10066
10076
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10181,14 +10191,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10181
10191
|
}, {
|
|
10182
10192
|
key: "rendersymbol",
|
|
10183
10193
|
value: function rendersymbol(series, index) {
|
|
10184
|
-
var
|
|
10194
|
+
var _this68 = this;
|
|
10185
10195
|
/* global d3 series index series.key */
|
|
10186
10196
|
var drawSymbol = function drawSymbol(size) {
|
|
10187
10197
|
return d3.symbol()
|
|
10188
10198
|
// .type(d => {
|
|
10189
10199
|
// return d3.symbols[0]
|
|
10190
10200
|
// })
|
|
10191
|
-
.size(size ||
|
|
10201
|
+
.size(size || _this68.options.symbolSize);
|
|
10192
10202
|
};
|
|
10193
10203
|
var xAxis = 'bottom';
|
|
10194
10204
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -10218,27 +10228,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10218
10228
|
// else {
|
|
10219
10229
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10220
10230
|
// }
|
|
10221
|
-
var xIndex =
|
|
10222
|
-
var xPos =
|
|
10223
|
-
if (
|
|
10224
|
-
xPos = xPos + (
|
|
10225
|
-
}
|
|
10226
|
-
var adjustment =
|
|
10227
|
-
if (
|
|
10228
|
-
return "translate(".concat(
|
|
10231
|
+
var xIndex = _this68[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10232
|
+
var xPos = _this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10233
|
+
if (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10234
|
+
xPos = xPos + (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10235
|
+
}
|
|
10236
|
+
var adjustment = _this68.options.data[xAxis].scale === 'Time' || _this68.options.data[xAxis].scale === 'Linear' ? 0 : _this68.options.data[xAxis].bandWidth / 2;
|
|
10237
|
+
if (_this68.options.orientation === 'horizontal') {
|
|
10238
|
+
return "translate(".concat(_this68["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10229
10239
|
} else {
|
|
10230
|
-
if (
|
|
10231
|
-
xPos =
|
|
10240
|
+
if (_this68.options.data[xAxis].scale === 'Time') {
|
|
10241
|
+
xPos = _this68["".concat(xAxis, "Axis")](_this68.parseX(d.x.value));
|
|
10232
10242
|
} else {
|
|
10233
|
-
var _xIndex =
|
|
10234
|
-
var _xPos =
|
|
10235
|
-
if (
|
|
10236
|
-
_xPos = _xPos + (
|
|
10243
|
+
var _xIndex = _this68[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10244
|
+
var _xPos = _this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
10245
|
+
if (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
10246
|
+
_xPos = _xPos + (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
10237
10247
|
}
|
|
10238
10248
|
// return xPos
|
|
10239
10249
|
}
|
|
10240
10250
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10241
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10251
|
+
return "translate(".concat(xPos, ", ").concat(_this68["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10242
10252
|
}
|
|
10243
10253
|
});
|
|
10244
10254
|
// Enter
|
|
@@ -10253,27 +10263,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
10253
10263
|
}).attr('class', function (d) {
|
|
10254
10264
|
return "symbol symbol_".concat(series.key);
|
|
10255
10265
|
}).attr('transform', function (d) {
|
|
10256
|
-
var xIndex =
|
|
10257
|
-
var xPos =
|
|
10258
|
-
if (
|
|
10259
|
-
xPos = xPos + (
|
|
10260
|
-
}
|
|
10261
|
-
var adjustment =
|
|
10262
|
-
if (
|
|
10263
|
-
return "translate(".concat(
|
|
10266
|
+
var xIndex = _this68[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10267
|
+
var xPos = _this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10268
|
+
if (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10269
|
+
xPos = xPos + (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10270
|
+
}
|
|
10271
|
+
var adjustment = _this68.options.data[xAxis].scale === 'Time' || _this68.options.data[xAxis].scale === 'Linear' ? 0 : _this68.options.data[xAxis].bandWidth / 2;
|
|
10272
|
+
if (_this68.options.orientation === 'horizontal') {
|
|
10273
|
+
return "translate(".concat(_this68["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
10264
10274
|
} else {
|
|
10265
|
-
if (
|
|
10266
|
-
xPos =
|
|
10275
|
+
if (_this68.options.data[xAxis].scale === 'Time') {
|
|
10276
|
+
xPos = _this68["".concat(xAxis, "Axis")](_this68.parseX(d.x.value));
|
|
10267
10277
|
} else {
|
|
10268
|
-
var _xIndex2 =
|
|
10269
|
-
var _xPos2 =
|
|
10270
|
-
if (
|
|
10271
|
-
_xPos2 = _xPos2 + (
|
|
10278
|
+
var _xIndex2 = _this68[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10279
|
+
var _xPos2 = _this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
10280
|
+
if (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
10281
|
+
_xPos2 = _xPos2 + (_this68["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
10272
10282
|
}
|
|
10273
10283
|
// return xPos
|
|
10274
10284
|
}
|
|
10275
10285
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
10276
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10286
|
+
return "translate(".concat(xPos, ", ").concat(_this68["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
10277
10287
|
}
|
|
10278
10288
|
});
|
|
10279
10289
|
}
|
|
@@ -10896,7 +10906,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10896
10906
|
}, {
|
|
10897
10907
|
key: "resize",
|
|
10898
10908
|
value: function resize() {
|
|
10899
|
-
var
|
|
10909
|
+
var _this69 = this;
|
|
10900
10910
|
var el = document.getElementById(this.elementId);
|
|
10901
10911
|
if (el) {
|
|
10902
10912
|
// if (this.options.width) {
|
|
@@ -10907,7 +10917,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10907
10917
|
// }
|
|
10908
10918
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10909
10919
|
html += this._data.map(function (d, i) {
|
|
10910
|
-
return
|
|
10920
|
+
return _this69.getLegendItemHTML(d);
|
|
10911
10921
|
}).join('');
|
|
10912
10922
|
html += "\n <div>\n ";
|
|
10913
10923
|
el.innerHTML = html;
|
|
@@ -11068,7 +11078,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11068
11078
|
}, {
|
|
11069
11079
|
key: "render",
|
|
11070
11080
|
value: function render() {
|
|
11071
|
-
var
|
|
11081
|
+
var _this70 = this;
|
|
11072
11082
|
this._isRendered = false;
|
|
11073
11083
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
11074
11084
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -11076,7 +11086,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11076
11086
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
11077
11087
|
return {
|
|
11078
11088
|
value: s.label || s.key,
|
|
11079
|
-
color: s.color ||
|
|
11089
|
+
color: s.color || _this70.options.colors[i % _this70.options.colors.length]
|
|
11080
11090
|
};
|
|
11081
11091
|
});
|
|
11082
11092
|
var longestValue = legendData.map(function (s) {
|
|
@@ -11130,7 +11140,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11130
11140
|
}
|
|
11131
11141
|
if (this.polygons) {
|
|
11132
11142
|
this.polygons.forEach(function (p) {
|
|
11133
|
-
return
|
|
11143
|
+
return _this70.map.removeLayer(p);
|
|
11134
11144
|
});
|
|
11135
11145
|
}
|
|
11136
11146
|
this.polygons = [];
|
|
@@ -11184,15 +11194,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
11184
11194
|
p.options = {};
|
|
11185
11195
|
}
|
|
11186
11196
|
if (!p.options.color) {
|
|
11187
|
-
p.options.color =
|
|
11197
|
+
p.options.color = _this70.options.colors[i % _this70.options.colors.length];
|
|
11188
11198
|
}
|
|
11189
11199
|
var pol = L.polygon(p.data.map(function (c) {
|
|
11190
11200
|
return c.map(function (d) {
|
|
11191
11201
|
return [d.Latitude, d.Longitude];
|
|
11192
11202
|
});
|
|
11193
|
-
}), p.options).addTo(
|
|
11194
|
-
|
|
11195
|
-
|
|
11203
|
+
}), p.options).addTo(_this70.map);
|
|
11204
|
+
_this70.polygons.push(pol);
|
|
11205
|
+
_this70.map.fitBounds(pol.getBounds());
|
|
11196
11206
|
});
|
|
11197
11207
|
}
|
|
11198
11208
|
// if (this.data.markers.length > 0) {
|