@websy/websy-designs 1.10.7 → 1.11.0
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/noAuthHelper.js +21 -0
- package/dist/server/helpers/v1/pgHelper.js +16 -1
- package/dist/server/websy-designs-server.js +8 -3
- package/dist/websy-designs-es6.debug.js +56 -61
- package/dist/websy-designs-es6.js +49 -50
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +233 -61
- package/dist/websy-designs.js +501 -320
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
package/dist/websy-designs.js
CHANGED
|
@@ -21,6 +21,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
21
21
|
WebsyPubSub
|
|
22
22
|
WebsyForm
|
|
23
23
|
MultiForm
|
|
24
|
+
MediaUpload
|
|
24
25
|
WebsyDatePicker
|
|
25
26
|
WebsyDropdown
|
|
26
27
|
WebsyRouter
|
|
@@ -1776,6 +1777,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1776
1777
|
var headerPos = WebsyUtils.getElementPos(headerEl);
|
|
1777
1778
|
var contentPos = WebsyUtils.getElementPos(contentEl);
|
|
1778
1779
|
if (this.options.style === 'plain' && headerPos.width > 0 && headerPos.height > 0) {
|
|
1780
|
+
contentEl.style.left = 'unset';
|
|
1779
1781
|
contentEl.style.right = "calc(100vw - ".concat(headerPos.right, "px)");
|
|
1780
1782
|
contentEl.style.width = "".concat(Math.max(this.options.minWidth, headerEl.clientWidth), "px");
|
|
1781
1783
|
if (headerPos.bottom + contentPos.height > window.innerHeight) {
|
|
@@ -1786,6 +1788,7 @@ var WebsyDropdown = /*#__PURE__*/function () {
|
|
|
1786
1788
|
}
|
|
1787
1789
|
} else if (this.options.style === 'plain' && headerPos.width === 0 && headerPos.height === 0) {
|
|
1788
1790
|
var targetPos = WebsyUtils.getElementPos(event.target);
|
|
1791
|
+
contentEl.style.left = 'unset';
|
|
1789
1792
|
contentEl.style.right = "calc(100vw - ".concat(targetPos.right, "px)");
|
|
1790
1793
|
contentEl.style.width = "".concat(Math.max(this.options.minWidth, targetPos.width), "px");
|
|
1791
1794
|
}
|
|
@@ -2694,11 +2697,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2694
2697
|
f.owningElement = _this20.elementId;
|
|
2695
2698
|
if (f.component) {
|
|
2696
2699
|
componentsToProcess.push(f);
|
|
2697
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this20.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2700
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', " ").concat(f.component === 'MediaUpload' ? 'media-upload' : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this20.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2698
2701
|
} else if (f.type === 'longtext') {
|
|
2699
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this20.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n
|
|
2702
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this20.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n >").concat(f.value || '', "</textarea>\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2700
2703
|
} else {
|
|
2701
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this20.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2704
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this20.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this20.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.type === 'date' ? '' : f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this20.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2702
2705
|
}
|
|
2703
2706
|
});
|
|
2704
2707
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2731,6 +2734,9 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2731
2734
|
if (this.fieldMap[field].type === 'checkbox') {
|
|
2732
2735
|
el.checked = value;
|
|
2733
2736
|
}
|
|
2737
|
+
if (this.fieldMap[field].type === 'date') {
|
|
2738
|
+
el.valueAsDate = value;
|
|
2739
|
+
}
|
|
2734
2740
|
} else {
|
|
2735
2741
|
console.error("Input for ".concat(field, " does not exist in form."));
|
|
2736
2742
|
}
|
|
@@ -2880,10 +2886,12 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2880
2886
|
_classCallCheck(this, MultiForm);
|
|
2881
2887
|
this.elementId = elementId;
|
|
2882
2888
|
var DEFAULTS = {
|
|
2883
|
-
|
|
2884
|
-
|
|
2889
|
+
addIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"256\" y1=\"112\" x2=\"256\" y2=\"400\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"400\" y1=\"256\" x2=\"112\" y2=\"256\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
2890
|
+
deleteIcon: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 512 512\"><line x1=\"368\" y1=\"368\" x2=\"144\" y2=\"144\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/><line x1=\"368\" y1=\"144\" x2=\"144\" y2=\"368\" style=\"fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px\"/></svg>",
|
|
2885
2891
|
allowAdd: true,
|
|
2886
|
-
allowDelete: true
|
|
2892
|
+
allowDelete: true,
|
|
2893
|
+
addLabel: '',
|
|
2894
|
+
deleteLabel: ''
|
|
2887
2895
|
};
|
|
2888
2896
|
this.options = _extends({}, DEFAULTS, options);
|
|
2889
2897
|
this.formData = [];
|
|
@@ -2892,7 +2900,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2892
2900
|
var el = document.getElementById(elementId);
|
|
2893
2901
|
if (el) {
|
|
2894
2902
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
2895
|
-
el.innerHTML = "<div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>");
|
|
2903
|
+
el.innerHTML = "\n <div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>\n <button id='").concat(this.elementId, "_addButton' class='websy-multi-form-add'>\n ").concat(this.options.addIcon).concat(this.options.addLabel, "\n </button> \n ");
|
|
2896
2904
|
}
|
|
2897
2905
|
this.render();
|
|
2898
2906
|
}
|
|
@@ -2905,19 +2913,26 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2905
2913
|
}, {
|
|
2906
2914
|
key: "addEntry",
|
|
2907
2915
|
value: function addEntry() {
|
|
2908
|
-
var
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2916
|
+
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2917
|
+
if (typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows) {
|
|
2918
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2919
|
+
var newId = WebsyDesigns.Utils.createIdentity();
|
|
2920
|
+
var newFormEl = document.createElement('div');
|
|
2921
|
+
newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
|
|
2922
|
+
newFormEl.classList.add('websy-multi-form-form-container');
|
|
2923
|
+
var html = "\n <div id='".concat(this.elementId, "_").concat(newId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(newId, "_deleteButton' data-formid='").concat(newId, "' class='websy-multi-form-delete'>\n ").concat(this.options.deleteIcon).concat(this.options.deleteLabel, "\n </button>\n ");
|
|
2924
|
+
newFormEl.innerHTML = html;
|
|
2925
|
+
el.appendChild(newFormEl);
|
|
2926
|
+
var formOptions = _extends({}, this.options, {
|
|
2927
|
+
fields: _toConsumableArray(this.options.fields.map(function (f) {
|
|
2928
|
+
return _extends({}, f);
|
|
2929
|
+
}))
|
|
2930
|
+
});
|
|
2931
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
2932
|
+
if (addEl) {
|
|
2933
|
+
addEl.style.display = this.forms.length < this.options.maxRows ? 'flex' : 'none';
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2921
2936
|
}
|
|
2922
2937
|
}, {
|
|
2923
2938
|
key: "clear",
|
|
@@ -2936,11 +2951,6 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2936
2951
|
var d = this.forms.map(function (f) {
|
|
2937
2952
|
return f.data;
|
|
2938
2953
|
});
|
|
2939
|
-
console.log('forms data', d);
|
|
2940
|
-
if (this.options.allowAdd !== false) {
|
|
2941
|
-
// we don't return the last form
|
|
2942
|
-
d.pop();
|
|
2943
|
-
}
|
|
2944
2954
|
return d;
|
|
2945
2955
|
},
|
|
2946
2956
|
set: function set(d) {
|
|
@@ -2959,16 +2969,6 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2959
2969
|
key: "handleClick",
|
|
2960
2970
|
value: function handleClick(event) {
|
|
2961
2971
|
if (event.target.classList.contains('websy-multi-form-add')) {
|
|
2962
|
-
var id = event.target.getAttribute('data-formid');
|
|
2963
|
-
// hide add button and show delete button
|
|
2964
|
-
var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
|
|
2965
|
-
if (addButtonEl) {
|
|
2966
|
-
addButtonEl.classList.add('hidden');
|
|
2967
|
-
}
|
|
2968
|
-
var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
|
|
2969
|
-
if (deleteButtonEl) {
|
|
2970
|
-
deleteButtonEl.classList.remove('hidden');
|
|
2971
|
-
}
|
|
2972
2972
|
// add new form
|
|
2973
2973
|
if (this.options.allowAdd === true) {
|
|
2974
2974
|
this.addEntry();
|
|
@@ -2976,12 +2976,12 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2976
2976
|
}
|
|
2977
2977
|
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2978
2978
|
// delete form based on index
|
|
2979
|
-
var
|
|
2979
|
+
var id = event.target.getAttribute('data-formid');
|
|
2980
2980
|
var rowId = event.target.getAttribute('data-rowid');
|
|
2981
2981
|
this.recordsToDelete.push(rowId);
|
|
2982
2982
|
var indexToDelete = -1;
|
|
2983
2983
|
for (var i = 0; i < this.forms.length; i++) {
|
|
2984
|
-
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(
|
|
2984
|
+
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(id, "_form")) {
|
|
2985
2985
|
indexToDelete = i;
|
|
2986
2986
|
break;
|
|
2987
2987
|
}
|
|
@@ -2989,10 +2989,14 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2989
2989
|
if (indexToDelete !== -1) {
|
|
2990
2990
|
this.forms.splice(indexToDelete, 1);
|
|
2991
2991
|
}
|
|
2992
|
-
var el = document.getElementById("".concat(this.elementId, "_").concat(
|
|
2992
|
+
var el = document.getElementById("".concat(this.elementId, "_").concat(id, "_formContainer"));
|
|
2993
2993
|
if (el) {
|
|
2994
2994
|
el.remove();
|
|
2995
2995
|
}
|
|
2996
|
+
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2997
|
+
if (addEl) {
|
|
2998
|
+
addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
|
|
2999
|
+
}
|
|
2996
3000
|
// delete form element based on id
|
|
2997
3001
|
}
|
|
2998
3002
|
}
|
|
@@ -3009,14 +3013,11 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3009
3013
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
3010
3014
|
html += "\n <div id='".concat(_this23.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this23.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
3011
3015
|
if (_this23.options.allowDelete === true) {
|
|
3012
|
-
html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.
|
|
3016
|
+
html += "\n <button id='".concat(_this23.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this23.options.deleteIcon).concat(_this23.options.deleteLabel, "\n </button>\n ");
|
|
3013
3017
|
}
|
|
3014
3018
|
html += "\n </div>\n ";
|
|
3015
3019
|
});
|
|
3016
3020
|
var id = WebsyDesigns.Utils.createIdentity();
|
|
3017
|
-
if (this.options.allowAdd === true) {
|
|
3018
|
-
html += "\n <div id='".concat(this.elementId, "_").concat(id, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(this.elementId, "_").concat(id, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(this.elementId, "_").concat(id, "_deleteButton' data-formid='").concat(id, "' class='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(id, "_addButton' data-formid='").concat(id, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n </div>\n ");
|
|
3019
|
-
}
|
|
3020
3021
|
el.innerHTML = html;
|
|
3021
3022
|
this.forms = new Array(this.formData.length);
|
|
3022
3023
|
this.formData.forEach(function (d, i) {
|
|
@@ -3029,14 +3030,13 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3029
3030
|
formObject.data = d;
|
|
3030
3031
|
_this23.forms[i] = formObject;
|
|
3031
3032
|
});
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
this.forms.push(formObject);
|
|
3033
|
+
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
3034
|
+
if (addEl) {
|
|
3035
|
+
if (this.options.allowAdd === true) {
|
|
3036
|
+
addEl.style.display = typeof this.options.maxRows === 'undefined' || this.forms.length < this.options.maxRows ? 'flex' : 'none';
|
|
3037
|
+
} else {
|
|
3038
|
+
addEl.style.display = 'none';
|
|
3039
|
+
}
|
|
3040
3040
|
}
|
|
3041
3041
|
}
|
|
3042
3042
|
}
|
|
@@ -3514,10 +3514,190 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3514
3514
|
}]);
|
|
3515
3515
|
return WebsyNavigationMenu;
|
|
3516
3516
|
}();
|
|
3517
|
+
/*
|
|
3518
|
+
global
|
|
3519
|
+
FormData
|
|
3520
|
+
FileReader
|
|
3521
|
+
Image
|
|
3522
|
+
*/
|
|
3523
|
+
var MediaUpload = /*#__PURE__*/function () {
|
|
3524
|
+
function MediaUpload(elementId, options) {
|
|
3525
|
+
_classCallCheck(this, MediaUpload);
|
|
3526
|
+
var defaults = {
|
|
3527
|
+
allowMultiple: false,
|
|
3528
|
+
createThumbnail: false,
|
|
3529
|
+
thumbSize: 300,
|
|
3530
|
+
supportedTypes: ['image/png', 'image/jpg']
|
|
3531
|
+
};
|
|
3532
|
+
this.media = [];
|
|
3533
|
+
this.options = _extends({}, defaults, options);
|
|
3534
|
+
this.elementId = elementId;
|
|
3535
|
+
if (!elementId) {
|
|
3536
|
+
console.log('No element Id provided');
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3539
|
+
var el = document.getElementById(elementId);
|
|
3540
|
+
if (el) {
|
|
3541
|
+
el.addEventListener('change', this.handleChange.bind(this));
|
|
3542
|
+
el.innerHTML = "\n <div class='websy-upload-form-container'>\n <span>Drag and drop a file or click to browse.</span>\n <form id=\"".concat(this.elementId, "_form\" enctype=\"multipart/form-data\"> \n <input id=\"").concat(this.elementId, "_file\" type=\"file\" name=\"").concat(this.options.name || 'media', "\" accept=\"").concat(this.options.supportedTypes.join(' '), "\" multiple>\n </form>\n </div>\n <div id='").concat(this.elementId, "_uploaded' class='websy-uploaded-media'></div> \n ");
|
|
3543
|
+
this.render();
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
_createClass(MediaUpload, [{
|
|
3547
|
+
key: "data",
|
|
3548
|
+
get: function get() {
|
|
3549
|
+
return this.media;
|
|
3550
|
+
},
|
|
3551
|
+
set: function set() {
|
|
3552
|
+
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3553
|
+
if (Array.isArray(d)) {
|
|
3554
|
+
this.media = d;
|
|
3555
|
+
} else {
|
|
3556
|
+
this.media = [d];
|
|
3557
|
+
}
|
|
3558
|
+
this.render();
|
|
3559
|
+
}
|
|
3560
|
+
}, {
|
|
3561
|
+
key: "createHtml",
|
|
3562
|
+
value: function createHtml(count) {
|
|
3563
|
+
var html = '';
|
|
3564
|
+
for (var i = 0; i < count; i++) {
|
|
3565
|
+
html += "\n <div>\n <img id='".concat(this.elementId, "_media_").concat(i, "'/>\n </div> \n ");
|
|
3566
|
+
}
|
|
3567
|
+
return html;
|
|
3568
|
+
}
|
|
3569
|
+
}, {
|
|
3570
|
+
key: "getForm",
|
|
3571
|
+
value: function getForm() {
|
|
3572
|
+
var formFound = false;
|
|
3573
|
+
var el = document.getElementById("".concat(this.elementId, "_file"));
|
|
3574
|
+
if (el) {
|
|
3575
|
+
while (formFound === false && el.tagName !== 'BODY') {
|
|
3576
|
+
el = el.parentElement;
|
|
3577
|
+
if (el.tagName === 'FORM') {
|
|
3578
|
+
formFound = true;
|
|
3579
|
+
return el;
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
return null;
|
|
3584
|
+
}
|
|
3585
|
+
}, {
|
|
3586
|
+
key: "handleChange",
|
|
3587
|
+
value: function handleChange(event) {
|
|
3588
|
+
var _this25 = this;
|
|
3589
|
+
this.fileList = [];
|
|
3590
|
+
var uploadForm = document.getElementById("".concat(this.elementId, "_form"));
|
|
3591
|
+
if (!uploadForm) {
|
|
3592
|
+
uploadForm = this.getForm();
|
|
3593
|
+
}
|
|
3594
|
+
if (!uploadForm) {
|
|
3595
|
+
console.error("The element ".concat(this.elementId, "_file does not belong to a form."));
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3598
|
+
var formData = new FormData(uploadForm);
|
|
3599
|
+
var html = this.createHtml(formData.length);
|
|
3600
|
+
formData.forEach(function (value, key) {
|
|
3601
|
+
if (key === (_this25.options.name || 'media')) {
|
|
3602
|
+
_this25.fileList.push({
|
|
3603
|
+
name: key,
|
|
3604
|
+
file: value
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
});
|
|
3608
|
+
var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
|
|
3609
|
+
resultEl.innerHTML = html;
|
|
3610
|
+
this.uploadItem(0, this.fileList);
|
|
3611
|
+
}
|
|
3612
|
+
}, {
|
|
3613
|
+
key: "render",
|
|
3614
|
+
value: function render() {
|
|
3615
|
+
var _this26 = this;
|
|
3616
|
+
if (this.media.length > 0) {
|
|
3617
|
+
var resultEl = document.getElementById("".concat(this.elementId, "_uploaded"));
|
|
3618
|
+
resultEl.innerHTML = this.createHtml(this.media.length);
|
|
3619
|
+
this.media.forEach(function (m, i) {
|
|
3620
|
+
var imgEl = document.getElementById("".concat(_this26.elementId, "_media_").concat(i));
|
|
3621
|
+
imgEl.setAttribute('src', "data:".concat(m.type, ";base64,") + m.data);
|
|
3622
|
+
});
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
}, {
|
|
3626
|
+
key: "uploadItem",
|
|
3627
|
+
value: function uploadItem(index, items, callbackFn) {
|
|
3628
|
+
var _this27 = this;
|
|
3629
|
+
if (!items[index]) {
|
|
3630
|
+
callbackFn();
|
|
3631
|
+
} else {
|
|
3632
|
+
var r = new FileReader();
|
|
3633
|
+
var mediaData = {
|
|
3634
|
+
type: items[index].file.type,
|
|
3635
|
+
name: items[index].file.name,
|
|
3636
|
+
size: items[index].file.size
|
|
3637
|
+
};
|
|
3638
|
+
r.onloadend = function () {
|
|
3639
|
+
var imgCanvas = document.createElement('canvas');
|
|
3640
|
+
var imgContext = imgCanvas.getContext('2d');
|
|
3641
|
+
var thumbCanvas = document.createElement('canvas');
|
|
3642
|
+
var thumbContext = thumbCanvas.getContext('2d');
|
|
3643
|
+
var img = new Image();
|
|
3644
|
+
img.onload = function () {
|
|
3645
|
+
var width = img.width;
|
|
3646
|
+
var height = img.height;
|
|
3647
|
+
if (_this27.options.resize === true && _this27.options.imgSize) {
|
|
3648
|
+
var _ratio = 1;
|
|
3649
|
+
if (width > height) {
|
|
3650
|
+
_ratio = width / height;
|
|
3651
|
+
width = _this27.options.imgSize;
|
|
3652
|
+
height = _this27.options.imgSize / _ratio;
|
|
3653
|
+
} else if (height > width) {
|
|
3654
|
+
_ratio = height / width;
|
|
3655
|
+
width = _this27.options.imgSize / _ratio;
|
|
3656
|
+
height = _this27.options.imgSize;
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
var fullResEl = document.getElementById("".concat(_this27.elementId, "_media_").concat(index, "_fullres"));
|
|
3660
|
+
if (fullResEl) {
|
|
3661
|
+
fullResEl.innerHTML = "".concat(width, " x ").concat(height);
|
|
3662
|
+
}
|
|
3663
|
+
imgCanvas.width = width;
|
|
3664
|
+
imgCanvas.height = height;
|
|
3665
|
+
imgContext.drawImage(img, 0, 0, width, height);
|
|
3666
|
+
var ratio = 1;
|
|
3667
|
+
if (width > height) {
|
|
3668
|
+
ratio = width / height;
|
|
3669
|
+
thumbCanvas.width = _this27.options.thumbSize;
|
|
3670
|
+
thumbCanvas.height = _this27.options.thumbSize / ratio;
|
|
3671
|
+
} else if (height > width) {
|
|
3672
|
+
ratio = height / width;
|
|
3673
|
+
thumbCanvas.width = _this27.options.thumbSize / ratio;
|
|
3674
|
+
thumbCanvas.height = _this27.options.thumbSize;
|
|
3675
|
+
}
|
|
3676
|
+
thumbContext.drawImage(img, 0, 0, thumbCanvas.width, thumbCanvas.height);
|
|
3677
|
+
mediaData.name = items[index].name;
|
|
3678
|
+
mediaData.fullWidth = imgCanvas.width;
|
|
3679
|
+
mediaData.fullHeight = imgCanvas.height;
|
|
3680
|
+
mediaData.thumbWidth = thumbCanvas.width;
|
|
3681
|
+
mediaData.thumbHeight = thumbCanvas.height;
|
|
3682
|
+
mediaData.data = imgCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3683
|
+
mediaData.thumbData = thumbCanvas.toDataURL(mediaData.type).replace(/^data:image\/(png|jpg);base64,/, '');
|
|
3684
|
+
_this27.media.push(mediaData);
|
|
3685
|
+
var imgEl = document.getElementById("".concat(_this27.elementId, "_media_").concat(index));
|
|
3686
|
+
imgEl.setAttribute('src', imgCanvas.toDataURL(mediaData.type));
|
|
3687
|
+
_this27.uploadItem(++index, items, callbackFn);
|
|
3688
|
+
};
|
|
3689
|
+
img.src = r.result;
|
|
3690
|
+
};
|
|
3691
|
+
r.readAsDataURL(items[index].file);
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
}]);
|
|
3695
|
+
return MediaUpload;
|
|
3696
|
+
}();
|
|
3517
3697
|
/* global WebsyDesigns */
|
|
3518
3698
|
var Pager = /*#__PURE__*/function () {
|
|
3519
3699
|
function Pager(elementId, options) {
|
|
3520
|
-
var
|
|
3700
|
+
var _this28 = this;
|
|
3521
3701
|
_classCallCheck(this, Pager);
|
|
3522
3702
|
this.elementId = elementId;
|
|
3523
3703
|
var DEFAULTS = {
|
|
@@ -3564,8 +3744,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3564
3744
|
allowClear: false,
|
|
3565
3745
|
disableSearch: true,
|
|
3566
3746
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3567
|
-
if (
|
|
3568
|
-
|
|
3747
|
+
if (_this28.options.onChangePageSize) {
|
|
3748
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
3569
3749
|
}
|
|
3570
3750
|
}
|
|
3571
3751
|
});
|
|
@@ -3586,11 +3766,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3586
3766
|
}, {
|
|
3587
3767
|
key: "render",
|
|
3588
3768
|
value: function render() {
|
|
3589
|
-
var
|
|
3769
|
+
var _this29 = this;
|
|
3590
3770
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3591
3771
|
if (el) {
|
|
3592
3772
|
var pages = this.options.pages.map(function (item, index) {
|
|
3593
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3773
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this29.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3594
3774
|
});
|
|
3595
3775
|
var startIndex = 0;
|
|
3596
3776
|
if (this.options.pages.length > 8) {
|
|
@@ -3652,50 +3832,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3652
3832
|
_createClass(WebsyPDFButton, [{
|
|
3653
3833
|
key: "handleClick",
|
|
3654
3834
|
value: function handleClick(event) {
|
|
3655
|
-
var
|
|
3835
|
+
var _this30 = this;
|
|
3656
3836
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3657
3837
|
this.loader.show();
|
|
3658
3838
|
this.options.preProcess(function (proceed) {
|
|
3659
3839
|
if (proceed === true) {
|
|
3660
3840
|
setTimeout(function () {
|
|
3661
|
-
if (
|
|
3662
|
-
var el = document.getElementById(
|
|
3841
|
+
if (_this30.options.targetId) {
|
|
3842
|
+
var el = document.getElementById(_this30.options.targetId);
|
|
3663
3843
|
if (el) {
|
|
3664
3844
|
var pdfData = {
|
|
3665
3845
|
options: {}
|
|
3666
3846
|
};
|
|
3667
|
-
if (
|
|
3668
|
-
pdfData.options = _extends({},
|
|
3847
|
+
if (_this30.options.pdfOptions) {
|
|
3848
|
+
pdfData.options = _extends({}, _this30.options.pdfOptions);
|
|
3669
3849
|
}
|
|
3670
|
-
if (
|
|
3671
|
-
if (
|
|
3672
|
-
var headerEl = document.getElementById(
|
|
3850
|
+
if (_this30.options.header) {
|
|
3851
|
+
if (_this30.options.header.elementId) {
|
|
3852
|
+
var headerEl = document.getElementById(_this30.options.header.elementId);
|
|
3673
3853
|
if (headerEl) {
|
|
3674
3854
|
pdfData.header = headerEl.outerHTML;
|
|
3675
|
-
if (
|
|
3676
|
-
pdfData.options.headerCSS =
|
|
3855
|
+
if (_this30.options.header.css) {
|
|
3856
|
+
pdfData.options.headerCSS = _this30.options.header.css;
|
|
3677
3857
|
}
|
|
3678
3858
|
}
|
|
3679
|
-
} else if (
|
|
3680
|
-
pdfData.header =
|
|
3681
|
-
if (
|
|
3682
|
-
pdfData.options.headerCSS =
|
|
3859
|
+
} else if (_this30.options.header.html) {
|
|
3860
|
+
pdfData.header = _this30.options.header.html;
|
|
3861
|
+
if (_this30.options.header.css) {
|
|
3862
|
+
pdfData.options.headerCSS = _this30.options.header.css;
|
|
3683
3863
|
}
|
|
3684
3864
|
} else {
|
|
3685
|
-
pdfData.header =
|
|
3865
|
+
pdfData.header = _this30.options.header;
|
|
3686
3866
|
}
|
|
3687
3867
|
}
|
|
3688
|
-
if (
|
|
3689
|
-
if (
|
|
3690
|
-
var footerEl = document.getElementById(
|
|
3868
|
+
if (_this30.options.footer) {
|
|
3869
|
+
if (_this30.options.footer.elementId) {
|
|
3870
|
+
var footerEl = document.getElementById(_this30.options.footer.elementId);
|
|
3691
3871
|
if (footerEl) {
|
|
3692
3872
|
pdfData.footer = footerEl.outerHTML;
|
|
3693
|
-
if (
|
|
3694
|
-
pdfData.options.footerCSS =
|
|
3873
|
+
if (_this30.options.footer.css) {
|
|
3874
|
+
pdfData.options.footerCSS = _this30.options.footer.css;
|
|
3695
3875
|
}
|
|
3696
3876
|
}
|
|
3697
3877
|
} else {
|
|
3698
|
-
pdfData.footer =
|
|
3878
|
+
pdfData.footer = _this30.options.footer;
|
|
3699
3879
|
}
|
|
3700
3880
|
}
|
|
3701
3881
|
pdfData.html = el.outerHTML;
|
|
@@ -3703,25 +3883,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3703
3883
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3704
3884
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3705
3885
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3706
|
-
|
|
3886
|
+
_this30.service.add('', pdfData, {
|
|
3707
3887
|
responseType: 'blob'
|
|
3708
3888
|
}).then(function (response) {
|
|
3709
|
-
|
|
3889
|
+
_this30.loader.hide();
|
|
3710
3890
|
var blob = new Blob([response], {
|
|
3711
3891
|
type: 'application/pdf'
|
|
3712
3892
|
});
|
|
3713
3893
|
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 ");
|
|
3714
|
-
if (
|
|
3894
|
+
if (_this30.options.directDownload === true) {
|
|
3715
3895
|
var fileName;
|
|
3716
|
-
if (typeof
|
|
3717
|
-
fileName =
|
|
3896
|
+
if (typeof _this30.options.fileName === 'function') {
|
|
3897
|
+
fileName = _this30.options.fileName() || 'Export';
|
|
3718
3898
|
} else {
|
|
3719
|
-
fileName =
|
|
3899
|
+
fileName = _this30.options.fileName || 'Export';
|
|
3720
3900
|
}
|
|
3721
3901
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3722
3902
|
}
|
|
3723
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3724
|
-
|
|
3903
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this30.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3904
|
+
_this30.popup.show({
|
|
3725
3905
|
message: msg,
|
|
3726
3906
|
mask: true
|
|
3727
3907
|
});
|
|
@@ -3730,10 +3910,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3730
3910
|
});
|
|
3731
3911
|
}
|
|
3732
3912
|
}
|
|
3733
|
-
},
|
|
3913
|
+
}, _this30.options.wait);
|
|
3734
3914
|
} else {
|
|
3735
|
-
|
|
3736
|
-
|
|
3915
|
+
_this30.loader.hide();
|
|
3916
|
+
_this30.options.onError();
|
|
3737
3917
|
}
|
|
3738
3918
|
});
|
|
3739
3919
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -3897,7 +4077,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3897
4077
|
}();
|
|
3898
4078
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3899
4079
|
function ResponsiveText(elementId, options) {
|
|
3900
|
-
var
|
|
4080
|
+
var _this31 = this;
|
|
3901
4081
|
_classCallCheck(this, ResponsiveText);
|
|
3902
4082
|
var DEFAULTS = {
|
|
3903
4083
|
textAlign: 'center',
|
|
@@ -3908,7 +4088,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3908
4088
|
this.elementId = elementId;
|
|
3909
4089
|
this.canvas = document.createElement('canvas');
|
|
3910
4090
|
window.addEventListener('resize', function () {
|
|
3911
|
-
return
|
|
4091
|
+
return _this31.render();
|
|
3912
4092
|
});
|
|
3913
4093
|
var el = document.getElementById(this.elementId);
|
|
3914
4094
|
if (el) {
|
|
@@ -4098,7 +4278,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4098
4278
|
/* global WebsyDesigns */
|
|
4099
4279
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
4100
4280
|
function WebsyResultList(elementId, options) {
|
|
4101
|
-
var
|
|
4281
|
+
var _this32 = this;
|
|
4102
4282
|
_classCallCheck(this, WebsyResultList);
|
|
4103
4283
|
var DEFAULTS = {
|
|
4104
4284
|
listeners: {
|
|
@@ -4124,8 +4304,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4124
4304
|
}
|
|
4125
4305
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4126
4306
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4127
|
-
|
|
4128
|
-
|
|
4307
|
+
_this32.options.template = templateString;
|
|
4308
|
+
_this32.render();
|
|
4129
4309
|
});
|
|
4130
4310
|
} else {
|
|
4131
4311
|
this.render();
|
|
@@ -4144,7 +4324,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4144
4324
|
}, {
|
|
4145
4325
|
key: "buildHTML",
|
|
4146
4326
|
value: function buildHTML(d) {
|
|
4147
|
-
var
|
|
4327
|
+
var _this33 = this;
|
|
4148
4328
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4149
4329
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
4150
4330
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -4152,7 +4332,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4152
4332
|
if (this.options.template) {
|
|
4153
4333
|
if (d.length > 0) {
|
|
4154
4334
|
d.forEach(function (row, ix) {
|
|
4155
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4335
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this33.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
4156
4336
|
// find conditional elements
|
|
4157
4337
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4158
4338
|
ifMatches.forEach(function (m) {
|
|
@@ -4240,7 +4420,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4240
4420
|
parts.forEach(function (p) {
|
|
4241
4421
|
items = items[p];
|
|
4242
4422
|
});
|
|
4243
|
-
template = template.replace(m[0],
|
|
4423
|
+
template = template.replace(m[0], _this33.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4244
4424
|
}
|
|
4245
4425
|
});
|
|
4246
4426
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4249,7 +4429,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4249
4429
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4250
4430
|
}
|
|
4251
4431
|
});
|
|
4252
|
-
var flatRow =
|
|
4432
|
+
var flatRow = _this33.flattenObject(row);
|
|
4253
4433
|
for (var key in flatRow) {
|
|
4254
4434
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4255
4435
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4374,15 +4554,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4374
4554
|
}, {
|
|
4375
4555
|
key: "render",
|
|
4376
4556
|
value: function render() {
|
|
4377
|
-
var
|
|
4557
|
+
var _this34 = this;
|
|
4378
4558
|
if (this.options.entity) {
|
|
4379
4559
|
var url = this.options.entity;
|
|
4380
4560
|
if (this.options.sortField) {
|
|
4381
4561
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4382
4562
|
}
|
|
4383
4563
|
this.apiService.get(url).then(function (results) {
|
|
4384
|
-
|
|
4385
|
-
|
|
4564
|
+
_this34.rows = results.rows;
|
|
4565
|
+
_this34.resize();
|
|
4386
4566
|
});
|
|
4387
4567
|
} else {
|
|
4388
4568
|
this.resize();
|
|
@@ -4452,12 +4632,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4452
4632
|
_createClass(WebsyRouter, [{
|
|
4453
4633
|
key: "addGroup",
|
|
4454
4634
|
value: function addGroup(group) {
|
|
4455
|
-
var
|
|
4635
|
+
var _this35 = this;
|
|
4456
4636
|
if (!this.groups[group]) {
|
|
4457
4637
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4458
4638
|
if (els) {
|
|
4459
4639
|
this.getClosestParent(els[0], function (parent) {
|
|
4460
|
-
|
|
4640
|
+
_this35.groups[group] = {
|
|
4461
4641
|
activeView: '',
|
|
4462
4642
|
views: [],
|
|
4463
4643
|
parent: parent.getAttribute('data-view')
|
|
@@ -4521,7 +4701,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4521
4701
|
}, {
|
|
4522
4702
|
key: "removeUrlParams",
|
|
4523
4703
|
value: function removeUrlParams() {
|
|
4524
|
-
var
|
|
4704
|
+
var _this36 = this;
|
|
4525
4705
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4526
4706
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4527
4707
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4529,7 +4709,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4529
4709
|
var path = '';
|
|
4530
4710
|
if (this.currentParams && this.currentParams.items) {
|
|
4531
4711
|
params.forEach(function (p) {
|
|
4532
|
-
delete
|
|
4712
|
+
delete _this36.currentParams.items[p];
|
|
4533
4713
|
});
|
|
4534
4714
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4535
4715
|
}
|
|
@@ -4860,11 +5040,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4860
5040
|
}, {
|
|
4861
5041
|
key: "showComponents",
|
|
4862
5042
|
value: function showComponents(view) {
|
|
4863
|
-
var
|
|
5043
|
+
var _this37 = this;
|
|
4864
5044
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4865
5045
|
this.options.views[view].components.forEach(function (c) {
|
|
4866
5046
|
if (typeof c.instance === 'undefined') {
|
|
4867
|
-
|
|
5047
|
+
_this37.prepComponent(c.elementId, c.options);
|
|
4868
5048
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4869
5049
|
} else if (c.instance.render) {
|
|
4870
5050
|
c.instance.render();
|
|
@@ -5281,7 +5461,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5281
5461
|
}, {
|
|
5282
5462
|
key: "handleKeyUp",
|
|
5283
5463
|
value: function handleKeyUp(event) {
|
|
5284
|
-
var
|
|
5464
|
+
var _this38 = this;
|
|
5285
5465
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5286
5466
|
this.cursorPosition = event.target.selectionStart;
|
|
5287
5467
|
this.searchText = event.target.value;
|
|
@@ -5304,8 +5484,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5304
5484
|
}
|
|
5305
5485
|
if (event.target.value.length >= this.options.minLength) {
|
|
5306
5486
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5307
|
-
if (
|
|
5308
|
-
|
|
5487
|
+
if (_this38.options.onSearch) {
|
|
5488
|
+
_this38.options.onSearch(event.target.value, event);
|
|
5309
5489
|
}
|
|
5310
5490
|
}, this.options.searchTimeout);
|
|
5311
5491
|
} else {
|
|
@@ -5355,7 +5535,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5355
5535
|
}, {
|
|
5356
5536
|
key: "highlightActiveSuggestion",
|
|
5357
5537
|
value: function highlightActiveSuggestion() {
|
|
5358
|
-
var
|
|
5538
|
+
var _this39 = this;
|
|
5359
5539
|
// remove all previous highlights
|
|
5360
5540
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5361
5541
|
// if (parent) {
|
|
@@ -5374,7 +5554,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5374
5554
|
Array.from(els).forEach(function (e) {
|
|
5375
5555
|
e.classList.remove('active');
|
|
5376
5556
|
var index = e.getAttribute('data-index');
|
|
5377
|
-
if (+index ===
|
|
5557
|
+
if (+index === _this39.activeSuggestion) {
|
|
5378
5558
|
e.classList.add('active');
|
|
5379
5559
|
}
|
|
5380
5560
|
});
|
|
@@ -5494,13 +5674,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5494
5674
|
}, {
|
|
5495
5675
|
key: "startSuggestionTimeout",
|
|
5496
5676
|
value: function startSuggestionTimeout() {
|
|
5497
|
-
var
|
|
5677
|
+
var _this40 = this;
|
|
5498
5678
|
if (this.suggestingTimeoutFn) {
|
|
5499
5679
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5500
5680
|
}
|
|
5501
5681
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5502
5682
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5503
|
-
|
|
5683
|
+
_this40.hideSuggestions(_this40);
|
|
5504
5684
|
}, this.options.suggestingTimeout);
|
|
5505
5685
|
}
|
|
5506
5686
|
}, {
|
|
@@ -5664,7 +5844,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5664
5844
|
/* global WebsyDesigns */
|
|
5665
5845
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5666
5846
|
function WebsyTemplate(elementId, options) {
|
|
5667
|
-
var
|
|
5847
|
+
var _this41 = this;
|
|
5668
5848
|
_classCallCheck(this, WebsyTemplate);
|
|
5669
5849
|
var DEFAULTS = {
|
|
5670
5850
|
listeners: {
|
|
@@ -5684,8 +5864,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5684
5864
|
}
|
|
5685
5865
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5686
5866
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5687
|
-
|
|
5688
|
-
|
|
5867
|
+
_this41.options.template = templateString;
|
|
5868
|
+
_this41.render();
|
|
5689
5869
|
});
|
|
5690
5870
|
} else {
|
|
5691
5871
|
this.render();
|
|
@@ -5694,7 +5874,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5694
5874
|
_createClass(WebsyTemplate, [{
|
|
5695
5875
|
key: "buildHTML",
|
|
5696
5876
|
value: function buildHTML() {
|
|
5697
|
-
var
|
|
5877
|
+
var _this42 = this;
|
|
5698
5878
|
var html = "";
|
|
5699
5879
|
if (this.options.template) {
|
|
5700
5880
|
var template = this.options.template;
|
|
@@ -5743,14 +5923,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5743
5923
|
}
|
|
5744
5924
|
}
|
|
5745
5925
|
if (polarity === true) {
|
|
5746
|
-
if (typeof
|
|
5926
|
+
if (typeof _this42.options.data[parts[0]] !== 'undefined' && _this42.options.data[parts[0]] === parts[1]) {
|
|
5747
5927
|
// remove the <if> tags
|
|
5748
5928
|
removeAll = false;
|
|
5749
5929
|
} else if (parts[0] === parts[1]) {
|
|
5750
5930
|
removeAll = false;
|
|
5751
5931
|
}
|
|
5752
5932
|
} else if (polarity === false) {
|
|
5753
|
-
if (typeof
|
|
5933
|
+
if (typeof _this42.options.data[parts[0]] !== 'undefined' && _this42.options.data[parts[0]] !== parts[1]) {
|
|
5754
5934
|
// remove the <if> tags
|
|
5755
5935
|
removeAll = false;
|
|
5756
5936
|
}
|
|
@@ -6063,7 +6243,7 @@ var WebsyUtils = {
|
|
|
6063
6243
|
/* global WebsyDesigns */
|
|
6064
6244
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6065
6245
|
function WebsyTable(elementId, options) {
|
|
6066
|
-
var
|
|
6246
|
+
var _this43 = this;
|
|
6067
6247
|
_classCallCheck(this, WebsyTable);
|
|
6068
6248
|
var DEFAULTS = {
|
|
6069
6249
|
pageSize: 20,
|
|
@@ -6096,8 +6276,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6096
6276
|
allowClear: false,
|
|
6097
6277
|
disableSearch: true,
|
|
6098
6278
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6099
|
-
if (
|
|
6100
|
-
|
|
6279
|
+
if (_this43.options.onChangePageSize) {
|
|
6280
|
+
_this43.options.onChangePageSize(selectedItem.value);
|
|
6101
6281
|
}
|
|
6102
6282
|
}
|
|
6103
6283
|
});
|
|
@@ -6121,20 +6301,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6121
6301
|
}, {
|
|
6122
6302
|
key: "appendRows",
|
|
6123
6303
|
value: function appendRows(data) {
|
|
6124
|
-
var
|
|
6304
|
+
var _this44 = this;
|
|
6125
6305
|
this._isRendered = false;
|
|
6126
6306
|
this.hideError();
|
|
6127
6307
|
var bodyHTML = '';
|
|
6128
6308
|
if (data) {
|
|
6129
6309
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6130
6310
|
return '<tr>' + r.map(function (c, i) {
|
|
6131
|
-
if (
|
|
6311
|
+
if (_this44.options.columns[i].show !== false) {
|
|
6132
6312
|
var style = '';
|
|
6133
6313
|
if (c.style) {
|
|
6134
6314
|
style += c.style;
|
|
6135
6315
|
}
|
|
6136
|
-
if (
|
|
6137
|
-
style += "width: ".concat(
|
|
6316
|
+
if (_this44.options.columns[i].width) {
|
|
6317
|
+
style += "width: ".concat(_this44.options.columns[i].width, "; ");
|
|
6138
6318
|
}
|
|
6139
6319
|
if (c.backgroundColor) {
|
|
6140
6320
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6145,16 +6325,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6145
6325
|
if (c.color) {
|
|
6146
6326
|
style += "color: ".concat(c.color, "; ");
|
|
6147
6327
|
}
|
|
6148
|
-
if (
|
|
6149
|
-
return "\n <td \n data-row-index='".concat(
|
|
6150
|
-
} else if ((
|
|
6151
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6328
|
+
if (_this44.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6329
|
+
return "\n <td \n data-row-index='".concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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(_this44.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6330
|
+
} else if ((_this44.options.columns[i].showAsNavigatorLink === true || _this44.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6331
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this44.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this44.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this44.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6152
6332
|
} else {
|
|
6153
6333
|
var info = c.value;
|
|
6154
|
-
if (
|
|
6334
|
+
if (_this44.options.columns[i].showAsImage === true) {
|
|
6155
6335
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6156
6336
|
}
|
|
6157
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6337
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this44.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this44.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 ");
|
|
6158
6338
|
}
|
|
6159
6339
|
}
|
|
6160
6340
|
}).join('') + '</tr>';
|
|
@@ -6314,7 +6494,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6314
6494
|
}, {
|
|
6315
6495
|
key: "render",
|
|
6316
6496
|
value: function render(data) {
|
|
6317
|
-
var
|
|
6497
|
+
var _this45 = this;
|
|
6318
6498
|
this._isRendered = false;
|
|
6319
6499
|
if (!this.options.columns) {
|
|
6320
6500
|
return;
|
|
@@ -6342,7 +6522,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6342
6522
|
if (c.width) {
|
|
6343
6523
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6344
6524
|
}
|
|
6345
|
-
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 ?
|
|
6525
|
+
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 ? _this45.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
6346
6526
|
}
|
|
6347
6527
|
}).join('') + '</tr>';
|
|
6348
6528
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6360,7 +6540,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6360
6540
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6361
6541
|
if (pagingEl) {
|
|
6362
6542
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6363
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6543
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this45.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6364
6544
|
});
|
|
6365
6545
|
var startIndex = 0;
|
|
6366
6546
|
if (this.options.pageCount > 8) {
|
|
@@ -6416,7 +6596,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6416
6596
|
/* global WebsyDesigns */
|
|
6417
6597
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6418
6598
|
function WebsyTable2(elementId, options) {
|
|
6419
|
-
var
|
|
6599
|
+
var _this46 = this;
|
|
6420
6600
|
_classCallCheck(this, WebsyTable2);
|
|
6421
6601
|
var DEFAULTS = {
|
|
6422
6602
|
pageSize: 20,
|
|
@@ -6451,8 +6631,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6451
6631
|
allowClear: false,
|
|
6452
6632
|
disableSearch: true,
|
|
6453
6633
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6454
|
-
if (
|
|
6455
|
-
|
|
6634
|
+
if (_this46.options.onChangePageSize) {
|
|
6635
|
+
_this46.options.onChangePageSize(selectedItem.value);
|
|
6456
6636
|
}
|
|
6457
6637
|
}
|
|
6458
6638
|
});
|
|
@@ -6474,20 +6654,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6474
6654
|
_createClass(WebsyTable2, [{
|
|
6475
6655
|
key: "appendRows",
|
|
6476
6656
|
value: function appendRows(data) {
|
|
6477
|
-
var
|
|
6657
|
+
var _this47 = this;
|
|
6478
6658
|
this.hideError();
|
|
6479
6659
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6480
6660
|
var bodyHTML = '';
|
|
6481
6661
|
if (data) {
|
|
6482
6662
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6483
6663
|
return '<tr>' + r.map(function (c, i) {
|
|
6484
|
-
if (
|
|
6485
|
-
var style = "height: ".concat(
|
|
6664
|
+
if (_this47.options.columns[i].show !== false) {
|
|
6665
|
+
var style = "height: ".concat(_this47.options.cellSize, "px; line-height: ").concat(_this47.options.cellSize, "px;");
|
|
6486
6666
|
if (c.style) {
|
|
6487
6667
|
style += c.style;
|
|
6488
6668
|
}
|
|
6489
|
-
if (
|
|
6490
|
-
style += "width: ".concat(
|
|
6669
|
+
if (_this47.options.columns[i].width) {
|
|
6670
|
+
style += "width: ".concat(_this47.options.columns[i].width, "; ");
|
|
6491
6671
|
}
|
|
6492
6672
|
if (c.backgroundColor) {
|
|
6493
6673
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6498,16 +6678,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6498
6678
|
if (c.color) {
|
|
6499
6679
|
style += "color: ".concat(c.color, "; ");
|
|
6500
6680
|
}
|
|
6501
|
-
if (
|
|
6502
|
-
return "\n <td \n data-row-index='".concat(
|
|
6503
|
-
} else if ((
|
|
6504
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
6681
|
+
if (_this47.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
6682
|
+
return "\n <td \n data-row-index='".concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this47.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >\n <a href='").concat(c.value, "' target='").concat(_this47.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this47.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
6683
|
+
} else if ((_this47.options.columns[i].showAsNavigatorLink === true || _this47.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
6684
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this47.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this47.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this47.options.columns[i].linkText || c.value, "</td>\n ");
|
|
6505
6685
|
} else {
|
|
6506
6686
|
var info = c.value;
|
|
6507
|
-
if (
|
|
6687
|
+
if (_this47.options.columns[i].showAsImage === true) {
|
|
6508
6688
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6509
6689
|
}
|
|
6510
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
6690
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this47.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this47.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.value, "</td>\n ");
|
|
6511
6691
|
}
|
|
6512
6692
|
}
|
|
6513
6693
|
}).join('') + '</tr>';
|
|
@@ -6741,7 +6921,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6741
6921
|
}, {
|
|
6742
6922
|
key: "render",
|
|
6743
6923
|
value: function render(data) {
|
|
6744
|
-
var
|
|
6924
|
+
var _this48 = this;
|
|
6745
6925
|
if (!this.options.columns) {
|
|
6746
6926
|
return;
|
|
6747
6927
|
}
|
|
@@ -6769,7 +6949,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6769
6949
|
if (c.width) {
|
|
6770
6950
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6771
6951
|
}
|
|
6772
|
-
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 ?
|
|
6952
|
+
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 ? _this48.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6773
6953
|
}
|
|
6774
6954
|
}).join('') + '</tr>';
|
|
6775
6955
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6779,7 +6959,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6779
6959
|
var dropdownHTML = "";
|
|
6780
6960
|
this.options.columns.forEach(function (c, i) {
|
|
6781
6961
|
if (c.searchable && c.searchField) {
|
|
6782
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6962
|
+
dropdownHTML += "\n <div id=\"".concat(_this48.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6783
6963
|
}
|
|
6784
6964
|
});
|
|
6785
6965
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6799,7 +6979,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6799
6979
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6800
6980
|
if (pagingEl) {
|
|
6801
6981
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6802
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6982
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this48.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6803
6983
|
});
|
|
6804
6984
|
var startIndex = 0;
|
|
6805
6985
|
if (this.options.pageCount > 8) {
|
|
@@ -6876,17 +7056,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6876
7056
|
}, {
|
|
6877
7057
|
key: "getColumnParameters",
|
|
6878
7058
|
value: function getColumnParameters(values) {
|
|
6879
|
-
var
|
|
7059
|
+
var _this49 = this;
|
|
6880
7060
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6881
7061
|
tableEl.style.tableLayout = 'auto';
|
|
6882
7062
|
tableEl.style.width = 'auto';
|
|
6883
7063
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6884
7064
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6885
7065
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6886
|
-
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 ?
|
|
7066
|
+
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 ? _this49.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6887
7067
|
}).join('') + '</tr>';
|
|
6888
7068
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6889
|
-
return "\n <td \n style='height: ".concat(
|
|
7069
|
+
return "\n <td \n style='height: ".concat(_this49.options.cellSize, "px; line-height: ").concat(_this49.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6890
7070
|
}).join('') + '</tr>';
|
|
6891
7071
|
// get height of the first data cell
|
|
6892
7072
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7050,7 +7230,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7050
7230
|
}, {
|
|
7051
7231
|
key: "buildBodyHtml",
|
|
7052
7232
|
value: function buildBodyHtml() {
|
|
7053
|
-
var
|
|
7233
|
+
var _this50 = this;
|
|
7054
7234
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7055
7235
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7056
7236
|
if (!this.options.columns) {
|
|
@@ -7075,7 +7255,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7075
7255
|
row.forEach(function (cell, cellIndex) {
|
|
7076
7256
|
var sizeIndex = cell.level || cellIndex;
|
|
7077
7257
|
var colIndex = cell.index || cellIndex;
|
|
7078
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7258
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this50.options.columns[_this50.options.columns.length - 1][colIndex].show === false) {
|
|
7079
7259
|
return; // need to revisit this logic
|
|
7080
7260
|
}
|
|
7081
7261
|
|
|
@@ -7102,7 +7282,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7102
7282
|
style += "color: ".concat(cell.color, "; ");
|
|
7103
7283
|
}
|
|
7104
7284
|
// console.log('rowspan', cell.rowspan)
|
|
7105
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
7285
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this50.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n data-info='").concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n colspan='").concat(cell.colspan || 1, "'\n rowspan='").concat(cell.rowspan || 1, "'\n data-row-index='").concat(rowIndex, "'\n data-cell-index='").concat(cellIndex, "'\n data-col-index='").concat(colIndex, "'\n ");
|
|
7106
7286
|
// if (useWidths === true) {
|
|
7107
7287
|
// bodyHtml += `
|
|
7108
7288
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -7111,10 +7291,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7111
7291
|
// }
|
|
7112
7292
|
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 >");
|
|
7113
7293
|
if (cell.expandable === true) {
|
|
7114
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
7294
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this50.options.plusIcon, "</i>");
|
|
7115
7295
|
}
|
|
7116
7296
|
if (cell.collapsable === true) {
|
|
7117
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
7297
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this50.options.minusIcon, "</i>");
|
|
7118
7298
|
}
|
|
7119
7299
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7120
7300
|
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 ");
|
|
@@ -7135,7 +7315,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7135
7315
|
}, {
|
|
7136
7316
|
key: "buildHeaderHtml",
|
|
7137
7317
|
value: function buildHeaderHtml() {
|
|
7138
|
-
var
|
|
7318
|
+
var _this51 = this;
|
|
7139
7319
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7140
7320
|
if (!this.options.columns) {
|
|
7141
7321
|
return '';
|
|
@@ -7156,7 +7336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7156
7336
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7157
7337
|
// return
|
|
7158
7338
|
// }
|
|
7159
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
7339
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this51.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
7160
7340
|
row.filter(function (c) {
|
|
7161
7341
|
return c.show !== false;
|
|
7162
7342
|
}).forEach(function (col, colIndex) {
|
|
@@ -7176,24 +7356,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7176
7356
|
if (col.style) {
|
|
7177
7357
|
style += col.style;
|
|
7178
7358
|
}
|
|
7179
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
7359
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this51.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7180
7360
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7181
7361
|
// headerHtml += `
|
|
7182
7362
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7183
7363
|
// width='${col.width || col.actualWidth}'
|
|
7184
7364
|
// `
|
|
7185
7365
|
// }
|
|
7186
|
-
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 ?
|
|
7366
|
+
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 ? _this51.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this51.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
7187
7367
|
});
|
|
7188
7368
|
headerHtml += "</tr>";
|
|
7189
7369
|
});
|
|
7190
7370
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7191
7371
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7192
7372
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7193
|
-
var testEl = document.getElementById("".concat(
|
|
7373
|
+
var testEl = document.getElementById("".concat(_this51.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7194
7374
|
if (!testEl) {
|
|
7195
7375
|
var newE = document.createElement('div');
|
|
7196
|
-
newE.id = "".concat(
|
|
7376
|
+
newE.id = "".concat(_this51.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7197
7377
|
newE.className = 'websy-modal-dropdown';
|
|
7198
7378
|
dropdownEl.appendChild(newE);
|
|
7199
7379
|
}
|
|
@@ -7216,7 +7396,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7216
7396
|
}, {
|
|
7217
7397
|
key: "buildTotalHtml",
|
|
7218
7398
|
value: function buildTotalHtml() {
|
|
7219
|
-
var
|
|
7399
|
+
var _this52 = this;
|
|
7220
7400
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7221
7401
|
if (!this.options.totals) {
|
|
7222
7402
|
return '';
|
|
@@ -7232,7 +7412,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7232
7412
|
|
|
7233
7413
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
7234
7414
|
if (useWidths === true) {
|
|
7235
|
-
totalHtml += "\n style='width: ".concat(
|
|
7415
|
+
totalHtml += "\n style='width: ".concat(_this52.options.columns[_this52.options.columns.length - 1][colIndex].width || _this52.options.columns[_this52.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
7236
7416
|
}
|
|
7237
7417
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7238
7418
|
});
|
|
@@ -7242,7 +7422,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7242
7422
|
}, {
|
|
7243
7423
|
key: "calculateSizes",
|
|
7244
7424
|
value: function calculateSizes() {
|
|
7245
|
-
var
|
|
7425
|
+
var _this53 = this;
|
|
7246
7426
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7247
7427
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7248
7428
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7286,7 +7466,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7286
7466
|
rows.forEach(function (row, rowIndex) {
|
|
7287
7467
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7288
7468
|
var colSize = col.getBoundingClientRect();
|
|
7289
|
-
|
|
7469
|
+
_this53.sizes.cellHeight = colSize.height;
|
|
7290
7470
|
if (columnsForSizing[colIndex]) {
|
|
7291
7471
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7292
7472
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7298,7 +7478,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7298
7478
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7299
7479
|
// }
|
|
7300
7480
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7301
|
-
if (colIndex >=
|
|
7481
|
+
if (colIndex >= _this53.pinnedColumns) {
|
|
7302
7482
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7303
7483
|
}
|
|
7304
7484
|
}
|
|
@@ -7313,7 +7493,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7313
7493
|
return a + (b.width || b.actualWidth);
|
|
7314
7494
|
}, 0);
|
|
7315
7495
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7316
|
-
return i >=
|
|
7496
|
+
return i >= _this53.pinnedColumns;
|
|
7317
7497
|
}).reduce(function (a, b) {
|
|
7318
7498
|
return a + (b.width || b.actualWidth);
|
|
7319
7499
|
}, 0);
|
|
@@ -7324,7 +7504,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7324
7504
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7325
7505
|
columnsForSizing.forEach(function (c) {
|
|
7326
7506
|
c.shouldGrow = true;
|
|
7327
|
-
if (
|
|
7507
|
+
if (_this53.options.autoFitColumns === false) {
|
|
7328
7508
|
c.shouldGrow = false;
|
|
7329
7509
|
if (c.potentialWidth > c.actualWidth) {
|
|
7330
7510
|
c.shouldGrow = true;
|
|
@@ -7343,7 +7523,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7343
7523
|
// if (!c.width) {
|
|
7344
7524
|
// if (c.actualWidth < equalWidth) {
|
|
7345
7525
|
// adjust the width
|
|
7346
|
-
if (
|
|
7526
|
+
if (_this53.options.autoFitColumns === true) {
|
|
7347
7527
|
if (c.width) {
|
|
7348
7528
|
c.width += equalWidth;
|
|
7349
7529
|
}
|
|
@@ -7367,9 +7547,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7367
7547
|
}
|
|
7368
7548
|
// }
|
|
7369
7549
|
// }
|
|
7370
|
-
|
|
7371
|
-
if (i >
|
|
7372
|
-
|
|
7550
|
+
_this53.sizes.totalWidth += c.width || c.actualWidth;
|
|
7551
|
+
if (i > _this53.pinnedColumns) {
|
|
7552
|
+
_this53.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7373
7553
|
}
|
|
7374
7554
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7375
7555
|
});
|
|
@@ -7428,7 +7608,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7428
7608
|
}, {
|
|
7429
7609
|
key: "createSample",
|
|
7430
7610
|
value: function createSample(data) {
|
|
7431
|
-
var
|
|
7611
|
+
var _this54 = this;
|
|
7432
7612
|
var output = [];
|
|
7433
7613
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7434
7614
|
if (col.maxLength) {
|
|
@@ -7438,7 +7618,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7438
7618
|
} else if (data) {
|
|
7439
7619
|
var longest = '';
|
|
7440
7620
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7441
|
-
if (data[i].length ===
|
|
7621
|
+
if (data[i].length === _this54.options.columns[_this54.options.columns.length - 1].length) {
|
|
7442
7622
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7443
7623
|
longest = data[i][colIndex].value;
|
|
7444
7624
|
}
|
|
@@ -7710,7 +7890,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7710
7890
|
}, {
|
|
7711
7891
|
key: "perpetualScroll",
|
|
7712
7892
|
value: function perpetualScroll() {
|
|
7713
|
-
var
|
|
7893
|
+
var _this55 = this;
|
|
7714
7894
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7715
7895
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7716
7896
|
return;
|
|
@@ -7729,17 +7909,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7729
7909
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7730
7910
|
var _loop2 = function _loop2(i) {
|
|
7731
7911
|
setTimeout(function () {
|
|
7732
|
-
var delta =
|
|
7912
|
+
var delta = _this55.mouseYStart - _this55.currentClientY + _this55.sizes.cellHeight * (i + 1) * direction;
|
|
7733
7913
|
delta = Math.min(10, delta);
|
|
7734
7914
|
delta = Math.max(-10, delta);
|
|
7735
7915
|
// only run this if isPerpetual === true
|
|
7736
7916
|
// this value is reset to false on touchStart
|
|
7737
|
-
if (
|
|
7917
|
+
if (_this55.isPerpetual === true) {
|
|
7738
7918
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7739
7919
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7740
|
-
|
|
7741
|
-
if (
|
|
7742
|
-
clearTimeout(
|
|
7920
|
+
_this55.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7921
|
+
if (_this55.scrollTimeout) {
|
|
7922
|
+
clearTimeout(_this55.scrollTimeout);
|
|
7743
7923
|
}
|
|
7744
7924
|
}
|
|
7745
7925
|
}, 1000 / fps * i);
|
|
@@ -8007,7 +8187,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
8007
8187
|
/* global d3 include WebsyDesigns */
|
|
8008
8188
|
var WebsyChart = /*#__PURE__*/function () {
|
|
8009
8189
|
function WebsyChart(elementId, options) {
|
|
8010
|
-
var
|
|
8190
|
+
var _this56 = this;
|
|
8011
8191
|
_classCallCheck(this, WebsyChart);
|
|
8012
8192
|
var DEFAULTS = {
|
|
8013
8193
|
margin: {
|
|
@@ -8066,7 +8246,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8066
8246
|
this.invertOverride = function (input, input2) {
|
|
8067
8247
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8068
8248
|
var xAxis = 'bottom';
|
|
8069
|
-
if (
|
|
8249
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
8070
8250
|
xAxis = 'left';
|
|
8071
8251
|
}
|
|
8072
8252
|
if (forBrush === true) {
|
|
@@ -8074,12 +8254,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8074
8254
|
}
|
|
8075
8255
|
xAxis += 'Axis';
|
|
8076
8256
|
var output;
|
|
8077
|
-
var width =
|
|
8257
|
+
var width = _this56.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8078
8258
|
// if (this.customBottomRange) {
|
|
8079
|
-
for (var index = 0; index <
|
|
8080
|
-
if (input >
|
|
8081
|
-
if (
|
|
8082
|
-
if (input <
|
|
8259
|
+
for (var index = 0; index < _this56.customBottomRange.length; index++) {
|
|
8260
|
+
if (input > _this56.customBottomRange[index]) {
|
|
8261
|
+
if (_this56.customBottomRange[index + 1]) {
|
|
8262
|
+
if (input < _this56.customBottomRange[index + 1]) {
|
|
8083
8263
|
output = index;
|
|
8084
8264
|
break;
|
|
8085
8265
|
}
|
|
@@ -8244,9 +8424,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8244
8424
|
}, {
|
|
8245
8425
|
key: "handleEventMouseMove",
|
|
8246
8426
|
value: function handleEventMouseMove(event, d) {
|
|
8247
|
-
var
|
|
8427
|
+
var _this57 = this;
|
|
8248
8428
|
var bisectDate = d3.bisector(function (d) {
|
|
8249
|
-
return
|
|
8429
|
+
return _this57.parseX(d.x.value);
|
|
8250
8430
|
}).left;
|
|
8251
8431
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8252
8432
|
var xAxis = 'bottomAxis';
|
|
@@ -8279,9 +8459,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8279
8459
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8280
8460
|
}
|
|
8281
8461
|
this.options.data.series.forEach(function (s) {
|
|
8282
|
-
if (
|
|
8462
|
+
if (_this57.options.data[xData].scale !== 'Time') {
|
|
8283
8463
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8284
|
-
xPoint =
|
|
8464
|
+
xPoint = _this57.customBottomRange[x0] + (_this57.customBottomRange[x0 + 1] - _this57.customBottomRange[x0]) / 2;
|
|
8285
8465
|
// }
|
|
8286
8466
|
// else {
|
|
8287
8467
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8301,41 +8481,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8301
8481
|
var index = bisectDate(s.data, x0, 1);
|
|
8302
8482
|
var pointA = s.data[index - 1];
|
|
8303
8483
|
var pointB = s.data[index];
|
|
8304
|
-
if (
|
|
8484
|
+
if (_this57.options.orientation === 'horizontal') {
|
|
8305
8485
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8306
8486
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8307
8487
|
}
|
|
8308
8488
|
if (pointA && !pointB) {
|
|
8309
|
-
xPoint =
|
|
8489
|
+
xPoint = _this57[xAxis](_this57.parseX(pointA.x.value));
|
|
8310
8490
|
tooltipTitle = pointA.x.value;
|
|
8311
8491
|
if (!pointA.y.color) {
|
|
8312
8492
|
pointA.y.color = s.color;
|
|
8313
8493
|
}
|
|
8314
8494
|
tooltipData.push(pointA);
|
|
8315
8495
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8316
|
-
tooltipTitle = d3.timeFormat(
|
|
8496
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8317
8497
|
}
|
|
8318
8498
|
}
|
|
8319
8499
|
if (pointB && !pointA) {
|
|
8320
|
-
xPoint =
|
|
8500
|
+
xPoint = _this57[xAxis](_this57.parseX(pointB.x.value));
|
|
8321
8501
|
tooltipTitle = pointB.x.value;
|
|
8322
8502
|
if (!pointB.y.color) {
|
|
8323
8503
|
pointB.y.color = s.color;
|
|
8324
8504
|
}
|
|
8325
8505
|
tooltipData.push(pointB);
|
|
8326
8506
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8327
|
-
tooltipTitle = d3.timeFormat(
|
|
8507
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8328
8508
|
}
|
|
8329
8509
|
}
|
|
8330
8510
|
if (pointA && pointB) {
|
|
8331
|
-
var d0 =
|
|
8332
|
-
var d1 =
|
|
8511
|
+
var d0 = _this57[xAxis](_this57.parseX(pointA.x.value));
|
|
8512
|
+
var d1 = _this57[xAxis](_this57.parseX(pointB.x.value));
|
|
8333
8513
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8334
8514
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8335
8515
|
xPoint = d1;
|
|
8336
8516
|
tooltipTitle = pointB.x.value;
|
|
8337
8517
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8338
|
-
tooltipTitle = d3.timeFormat(
|
|
8518
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8339
8519
|
}
|
|
8340
8520
|
if (!pointB.y.color) {
|
|
8341
8521
|
pointB.y.color = s.color;
|
|
@@ -8345,7 +8525,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8345
8525
|
xPoint = d0;
|
|
8346
8526
|
tooltipTitle = pointA.x.value;
|
|
8347
8527
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8348
|
-
tooltipTitle = d3.timeFormat(
|
|
8528
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8349
8529
|
}
|
|
8350
8530
|
if (!pointA.y.color) {
|
|
8351
8531
|
pointA.y.color = s.color;
|
|
@@ -8471,7 +8651,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8471
8651
|
}, {
|
|
8472
8652
|
key: "render",
|
|
8473
8653
|
value: function render(options) {
|
|
8474
|
-
var
|
|
8654
|
+
var _this58 = this;
|
|
8475
8655
|
/* global d3 options WebsyUtils */
|
|
8476
8656
|
this._isRendered = false;
|
|
8477
8657
|
if (typeof options !== 'undefined') {
|
|
@@ -8540,7 +8720,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8540
8720
|
this.options.data.series.map(function (s, i) {
|
|
8541
8721
|
return {
|
|
8542
8722
|
value: s.label || s.key,
|
|
8543
|
-
color: s.color ||
|
|
8723
|
+
color: s.color || _this58.options.colors[i % _this58.options.colors.length]
|
|
8544
8724
|
};
|
|
8545
8725
|
});
|
|
8546
8726
|
}
|
|
@@ -8897,25 +9077,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8897
9077
|
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') {
|
|
8898
9078
|
var acc = 0;
|
|
8899
9079
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8900
|
-
var adjustment =
|
|
9080
|
+
var adjustment = _this58.bandPadding * index + _this58.bandPadding;
|
|
8901
9081
|
// if (this.options.data.bottom.padding) {
|
|
8902
9082
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8903
9083
|
// }
|
|
8904
|
-
var start =
|
|
9084
|
+
var start = _this58.widthForCalc / noOfPoints * acc;
|
|
8905
9085
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8906
9086
|
var pos = i * proposedBandWidth;
|
|
8907
|
-
|
|
9087
|
+
_this58["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8908
9088
|
}
|
|
8909
|
-
acc +=
|
|
8910
|
-
var end =
|
|
9089
|
+
acc += _this58.options.grouping !== 'stacked' && _this58.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9090
|
+
var end = _this58.widthForCalc / noOfPoints * acc;
|
|
8911
9091
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8912
9092
|
return end + adjustment;
|
|
8913
9093
|
})));
|
|
8914
9094
|
acc = 0;
|
|
8915
9095
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8916
|
-
var adjustment =
|
|
8917
|
-
acc +=
|
|
8918
|
-
return (
|
|
9096
|
+
var adjustment = _this58.brushBandPadding * index + _this58.brushBandPadding;
|
|
9097
|
+
acc += _this58.options.grouping !== 'stacked' && _this58.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9098
|
+
return (_this58.options.orientation === 'vertical' ? _this58.plotWidth : _this58.plotHeight) / noOfPoints * acc;
|
|
8919
9099
|
})));
|
|
8920
9100
|
}
|
|
8921
9101
|
// }
|
|
@@ -9088,7 +9268,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9088
9268
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9089
9269
|
if (this.options.data.bottom.formatter) {
|
|
9090
9270
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9091
|
-
return
|
|
9271
|
+
return _this58.options.data.bottom.formatter(d);
|
|
9092
9272
|
});
|
|
9093
9273
|
}
|
|
9094
9274
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9098,7 +9278,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9098
9278
|
}
|
|
9099
9279
|
if (this.customBottomRange.length > 0) {
|
|
9100
9280
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9101
|
-
return "translate(".concat(
|
|
9281
|
+
return "translate(".concat(_this58.customBottomRange[i] + (_this58.customBottomRange[i + 1] - _this58.customBottomRange[i]) / 2, ", 0)");
|
|
9102
9282
|
});
|
|
9103
9283
|
}
|
|
9104
9284
|
}
|
|
@@ -9117,14 +9297,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9117
9297
|
}
|
|
9118
9298
|
if (this.options.margin.axisLeft > 0) {
|
|
9119
9299
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9120
|
-
if (
|
|
9121
|
-
d =
|
|
9300
|
+
if (_this58.options.data.left.formatter) {
|
|
9301
|
+
d = _this58.options.data.left.formatter(d);
|
|
9122
9302
|
}
|
|
9123
9303
|
return d;
|
|
9124
9304
|
}));
|
|
9125
9305
|
if (this.customLeftRange.length > 0) {
|
|
9126
9306
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9127
|
-
return "translate(0, ".concat(
|
|
9307
|
+
return "translate(0, ".concat(_this58.customLeftRange[i] + (_this58.customLeftRange[i + 1] - _this58.customLeftRange[i]) / 2, ")");
|
|
9128
9308
|
});
|
|
9129
9309
|
}
|
|
9130
9310
|
}
|
|
@@ -9152,8 +9332,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9152
9332
|
}
|
|
9153
9333
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9154
9334
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9155
|
-
if (
|
|
9156
|
-
d =
|
|
9335
|
+
if (_this58.options.data.right.formatter) {
|
|
9336
|
+
d = _this58.options.data.right.formatter(d);
|
|
9157
9337
|
}
|
|
9158
9338
|
return d;
|
|
9159
9339
|
}));
|
|
@@ -9193,25 +9373,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9193
9373
|
}, {
|
|
9194
9374
|
key: "renderComponents",
|
|
9195
9375
|
value: function renderComponents() {
|
|
9196
|
-
var
|
|
9376
|
+
var _this59 = this;
|
|
9197
9377
|
// Draw the series data
|
|
9198
9378
|
this.renderedKeys = {};
|
|
9199
9379
|
this.options.data.series.forEach(function (series, index) {
|
|
9200
9380
|
if (!series.key) {
|
|
9201
|
-
series.key =
|
|
9381
|
+
series.key = _this59.createIdentity();
|
|
9202
9382
|
}
|
|
9203
9383
|
if (!series.color) {
|
|
9204
|
-
series.color =
|
|
9384
|
+
series.color = _this59.options.colors[index % _this59.options.colors.length];
|
|
9205
9385
|
}
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9386
|
+
_this59["render".concat(series.type || 'bar')](series, index);
|
|
9387
|
+
_this59.renderLabels(series, index);
|
|
9388
|
+
_this59.renderedKeys[series.key] = series.type;
|
|
9209
9389
|
});
|
|
9210
9390
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9211
9391
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9212
9392
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9213
9393
|
this.options.refLines.forEach(function (l) {
|
|
9214
|
-
return
|
|
9394
|
+
return _this59.renderRefLine(l);
|
|
9215
9395
|
});
|
|
9216
9396
|
}
|
|
9217
9397
|
this._isRendered = true;
|
|
@@ -9219,25 +9399,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9219
9399
|
}, {
|
|
9220
9400
|
key: "renderarea",
|
|
9221
9401
|
value: function renderarea(series, index) {
|
|
9222
|
-
var
|
|
9402
|
+
var _this60 = this;
|
|
9223
9403
|
/* global d3 series index */
|
|
9224
9404
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9225
9405
|
return d3.area().x(function (d) {
|
|
9226
|
-
if (
|
|
9227
|
-
return
|
|
9406
|
+
if (_this60.options.data[xAxis].scale === 'Time') {
|
|
9407
|
+
return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
|
|
9228
9408
|
} else {
|
|
9229
|
-
var xIndex =
|
|
9230
|
-
var xPos =
|
|
9231
|
-
if (
|
|
9232
|
-
xPos = xPos + (
|
|
9409
|
+
var xIndex = _this60[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9410
|
+
var xPos = _this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9411
|
+
if (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9412
|
+
xPos = xPos + (_this60["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9233
9413
|
}
|
|
9234
9414
|
return xPos;
|
|
9235
9415
|
}
|
|
9236
9416
|
}).y0(function (d) {
|
|
9237
|
-
return
|
|
9417
|
+
return _this60["".concat(yAxis, "Axis")](0);
|
|
9238
9418
|
}).y1(function (d) {
|
|
9239
|
-
return
|
|
9240
|
-
}).curve(d3[curveStyle ||
|
|
9419
|
+
return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9420
|
+
}).curve(d3[curveStyle || _this60.options.curveStyle]);
|
|
9241
9421
|
};
|
|
9242
9422
|
var xAxis = 'bottom';
|
|
9243
9423
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9277,7 +9457,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9277
9457
|
}, {
|
|
9278
9458
|
key: "renderbar",
|
|
9279
9459
|
value: function renderbar(series, index) {
|
|
9280
|
-
var
|
|
9460
|
+
var _this61 = this;
|
|
9281
9461
|
/* global series index d3 */
|
|
9282
9462
|
var xAxis = 'bottom';
|
|
9283
9463
|
var yAxis = 'left';
|
|
@@ -9444,26 +9624,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9444
9624
|
}
|
|
9445
9625
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9446
9626
|
bars.attr('width', function (d, i) {
|
|
9447
|
-
return Math.abs(getBarWidth.call(
|
|
9627
|
+
return Math.abs(getBarWidth.call(_this61, d, i, yAxis, xAxis));
|
|
9448
9628
|
}).attr('height', function (d, i) {
|
|
9449
|
-
return getBarHeight.call(
|
|
9629
|
+
return getBarHeight.call(_this61, d, i, yAxis, xAxis);
|
|
9450
9630
|
}).attr('x', function (d, i) {
|
|
9451
|
-
return getBarX.call(
|
|
9631
|
+
return getBarX.call(_this61, d, i, yAxis, xAxis);
|
|
9452
9632
|
}).attr('y', function (d, i) {
|
|
9453
|
-
return getBarY.call(
|
|
9633
|
+
return getBarY.call(_this61, d, i, yAxis, xAxis);
|
|
9454
9634
|
})
|
|
9455
9635
|
// .transition(this.transition)
|
|
9456
9636
|
.attr('fill', function (d) {
|
|
9457
9637
|
return d.y.color || d.color || series.color;
|
|
9458
9638
|
});
|
|
9459
9639
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9460
|
-
return Math.abs(getBarWidth.call(
|
|
9640
|
+
return Math.abs(getBarWidth.call(_this61, d, i, yAxis, xAxis));
|
|
9461
9641
|
}).attr('height', function (d, i) {
|
|
9462
|
-
return getBarHeight.call(
|
|
9642
|
+
return getBarHeight.call(_this61, d, i, yAxis, xAxis);
|
|
9463
9643
|
}).attr('x', function (d, i) {
|
|
9464
|
-
return getBarX.call(
|
|
9644
|
+
return getBarX.call(_this61, d, i, yAxis, xAxis);
|
|
9465
9645
|
}).attr('y', function (d, i) {
|
|
9466
|
-
return getBarY.call(
|
|
9646
|
+
return getBarY.call(_this61, d, i, yAxis, xAxis);
|
|
9467
9647
|
})
|
|
9468
9648
|
// .transition(this.transition)
|
|
9469
9649
|
.attr('fill', function (d) {
|
|
@@ -9475,26 +9655,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9475
9655
|
this.brushBarsInitialized[series.key] = true;
|
|
9476
9656
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9477
9657
|
brushBars.attr('width', function (d, i) {
|
|
9478
|
-
return Math.abs(getBarWidth.call(
|
|
9658
|
+
return Math.abs(getBarWidth.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9479
9659
|
}).attr('height', function (d, i) {
|
|
9480
|
-
return getBarHeight.call(
|
|
9660
|
+
return getBarHeight.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9481
9661
|
}).attr('x', function (d, i) {
|
|
9482
|
-
return getBarX.call(
|
|
9662
|
+
return getBarX.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9483
9663
|
}).attr('y', function (d, i) {
|
|
9484
|
-
return getBarY.call(
|
|
9664
|
+
return getBarY.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9485
9665
|
})
|
|
9486
9666
|
// .transition(this.transition)
|
|
9487
9667
|
.attr('fill', function (d) {
|
|
9488
9668
|
return d.y.color || d.color || series.color;
|
|
9489
9669
|
});
|
|
9490
9670
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9491
|
-
return Math.abs(getBarWidth.call(
|
|
9671
|
+
return Math.abs(getBarWidth.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9492
9672
|
}).attr('height', function (d, i) {
|
|
9493
|
-
return getBarHeight.call(
|
|
9673
|
+
return getBarHeight.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9494
9674
|
}).attr('x', function (d, i) {
|
|
9495
|
-
return getBarX.call(
|
|
9675
|
+
return getBarX.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9496
9676
|
}).attr('y', function (d, i) {
|
|
9497
|
-
return getBarY.call(
|
|
9677
|
+
return getBarY.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9498
9678
|
})
|
|
9499
9679
|
// .transition(this.transition)
|
|
9500
9680
|
.attr('fill', function (d) {
|
|
@@ -9515,7 +9695,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9515
9695
|
}, {
|
|
9516
9696
|
key: "renderLabels",
|
|
9517
9697
|
value: function renderLabels(series, index) {
|
|
9518
|
-
var
|
|
9698
|
+
var _this62 = this;
|
|
9519
9699
|
/* global series index d3 WebsyDesigns */
|
|
9520
9700
|
var xAxis = 'bottom';
|
|
9521
9701
|
var yAxis = 'left';
|
|
@@ -9531,14 +9711,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9531
9711
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9532
9712
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9533
9713
|
labels.attr('x', function (d) {
|
|
9534
|
-
return getLabelX.call(
|
|
9714
|
+
return getLabelX.call(_this62, d, series.labelPosition);
|
|
9535
9715
|
}).attr('y', function (d) {
|
|
9536
|
-
return getLabelY.call(
|
|
9716
|
+
return getLabelY.call(_this62, d, series.labelPosition);
|
|
9537
9717
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9538
|
-
if (
|
|
9718
|
+
if (_this62.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9539
9719
|
return 'transparent';
|
|
9540
9720
|
}
|
|
9541
|
-
return
|
|
9721
|
+
return _this62.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9542
9722
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9543
9723
|
return d.y.label || d.y.value;
|
|
9544
9724
|
}).each(function (d, i) {
|
|
@@ -9572,14 +9752,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9572
9752
|
}
|
|
9573
9753
|
});
|
|
9574
9754
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9575
|
-
return getLabelX.call(
|
|
9755
|
+
return getLabelX.call(_this62, d, series.labelPosition);
|
|
9576
9756
|
}).attr('y', function (d) {
|
|
9577
|
-
return getLabelY.call(
|
|
9757
|
+
return getLabelY.call(_this62, d, series.labelPosition);
|
|
9578
9758
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9579
|
-
if (
|
|
9759
|
+
if (_this62.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9580
9760
|
return 'transparent';
|
|
9581
9761
|
}
|
|
9582
|
-
return
|
|
9762
|
+
return _this62.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9583
9763
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9584
9764
|
return d.y.label || d.y.value;
|
|
9585
9765
|
}).each(function (d, i) {
|
|
@@ -9657,32 +9837,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9657
9837
|
}, {
|
|
9658
9838
|
key: "renderline",
|
|
9659
9839
|
value: function renderline(series, index) {
|
|
9660
|
-
var
|
|
9840
|
+
var _this63 = this;
|
|
9661
9841
|
/* global series index d3 */
|
|
9662
9842
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9663
9843
|
return d3.line().x(function (d) {
|
|
9664
|
-
if (
|
|
9665
|
-
return
|
|
9844
|
+
if (_this63.options.orientation === 'horizontal') {
|
|
9845
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9666
9846
|
} else {
|
|
9667
|
-
if (
|
|
9668
|
-
return
|
|
9847
|
+
if (_this63.options.data[xAxis].scale === 'Time') {
|
|
9848
|
+
return _this63["".concat(xAxis, "Axis")](_this63.parseX(d.x.value));
|
|
9669
9849
|
} else {
|
|
9670
|
-
var xIndex =
|
|
9671
|
-
var xPos =
|
|
9672
|
-
if (
|
|
9673
|
-
xPos = xPos + (
|
|
9850
|
+
var xIndex = _this63[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9851
|
+
var xPos = _this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9852
|
+
if (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9853
|
+
xPos = xPos + (_this63["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9674
9854
|
}
|
|
9675
9855
|
return xPos;
|
|
9676
9856
|
}
|
|
9677
9857
|
}
|
|
9678
9858
|
}).y(function (d) {
|
|
9679
|
-
if (
|
|
9680
|
-
var adjustment =
|
|
9681
|
-
return
|
|
9859
|
+
if (_this63.options.orientation === 'horizontal') {
|
|
9860
|
+
var adjustment = _this63.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this63.options.data[xAxis].bandWidth / 2;
|
|
9861
|
+
return _this63["".concat(xAxis, "Axis")](_this63.parseX(d.x.value)) + adjustment;
|
|
9682
9862
|
} else {
|
|
9683
|
-
return
|
|
9863
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9684
9864
|
}
|
|
9685
|
-
}).curve(d3[curveStyle ||
|
|
9865
|
+
}).curve(d3[curveStyle || _this63.options.curveStyle]);
|
|
9686
9866
|
};
|
|
9687
9867
|
var xAxis = 'bottom';
|
|
9688
9868
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9791,14 +9971,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9791
9971
|
}, {
|
|
9792
9972
|
key: "rendersymbol",
|
|
9793
9973
|
value: function rendersymbol(series, index) {
|
|
9794
|
-
var
|
|
9974
|
+
var _this64 = this;
|
|
9795
9975
|
/* global d3 series index series.key */
|
|
9796
9976
|
var drawSymbol = function drawSymbol(size) {
|
|
9797
9977
|
return d3.symbol()
|
|
9798
9978
|
// .type(d => {
|
|
9799
9979
|
// return d3.symbols[0]
|
|
9800
9980
|
// })
|
|
9801
|
-
.size(size ||
|
|
9981
|
+
.size(size || _this64.options.symbolSize);
|
|
9802
9982
|
};
|
|
9803
9983
|
var xAxis = 'bottom';
|
|
9804
9984
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9824,27 +10004,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9824
10004
|
// else {
|
|
9825
10005
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9826
10006
|
// }
|
|
9827
|
-
var xIndex =
|
|
9828
|
-
var xPos =
|
|
9829
|
-
if (
|
|
9830
|
-
xPos = xPos + (
|
|
9831
|
-
}
|
|
9832
|
-
var adjustment =
|
|
9833
|
-
if (
|
|
9834
|
-
return "translate(".concat(
|
|
10007
|
+
var xIndex = _this64[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10008
|
+
var xPos = _this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10009
|
+
if (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10010
|
+
xPos = xPos + (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10011
|
+
}
|
|
10012
|
+
var adjustment = _this64.options.data[xAxis].scale === 'Time' || _this64.options.data[xAxis].scale === 'Linear' ? 0 : _this64.options.data[xAxis].bandWidth / 2;
|
|
10013
|
+
if (_this64.options.orientation === 'horizontal') {
|
|
10014
|
+
return "translate(".concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9835
10015
|
} else {
|
|
9836
|
-
if (
|
|
9837
|
-
xPos =
|
|
10016
|
+
if (_this64.options.data[xAxis].scale === 'Time') {
|
|
10017
|
+
xPos = _this64["".concat(xAxis, "Axis")](_this64.parseX(d.x.value));
|
|
9838
10018
|
} else {
|
|
9839
|
-
var _xIndex =
|
|
9840
|
-
var _xPos =
|
|
9841
|
-
if (
|
|
9842
|
-
_xPos = _xPos + (
|
|
10019
|
+
var _xIndex = _this64[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10020
|
+
var _xPos = _this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
10021
|
+
if (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
10022
|
+
_xPos = _xPos + (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9843
10023
|
}
|
|
9844
10024
|
// return xPos
|
|
9845
10025
|
}
|
|
9846
10026
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9847
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10027
|
+
return "translate(".concat(xPos, ", ").concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9848
10028
|
}
|
|
9849
10029
|
});
|
|
9850
10030
|
// Enter
|
|
@@ -9859,27 +10039,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9859
10039
|
}).attr('class', function (d) {
|
|
9860
10040
|
return "symbol symbol_".concat(series.key);
|
|
9861
10041
|
}).attr('transform', function (d) {
|
|
9862
|
-
var xIndex =
|
|
9863
|
-
var xPos =
|
|
9864
|
-
if (
|
|
9865
|
-
xPos = xPos + (
|
|
9866
|
-
}
|
|
9867
|
-
var adjustment =
|
|
9868
|
-
if (
|
|
9869
|
-
return "translate(".concat(
|
|
10042
|
+
var xIndex = _this64[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10043
|
+
var xPos = _this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
10044
|
+
if (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
10045
|
+
xPos = xPos + (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
10046
|
+
}
|
|
10047
|
+
var adjustment = _this64.options.data[xAxis].scale === 'Time' || _this64.options.data[xAxis].scale === 'Linear' ? 0 : _this64.options.data[xAxis].bandWidth / 2;
|
|
10048
|
+
if (_this64.options.orientation === 'horizontal') {
|
|
10049
|
+
return "translate(".concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9870
10050
|
} else {
|
|
9871
|
-
if (
|
|
9872
|
-
xPos =
|
|
10051
|
+
if (_this64.options.data[xAxis].scale === 'Time') {
|
|
10052
|
+
xPos = _this64["".concat(xAxis, "Axis")](_this64.parseX(d.x.value));
|
|
9873
10053
|
} else {
|
|
9874
|
-
var _xIndex2 =
|
|
9875
|
-
var _xPos2 =
|
|
9876
|
-
if (
|
|
9877
|
-
_xPos2 = _xPos2 + (
|
|
10054
|
+
var _xIndex2 = _this64[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
10055
|
+
var _xPos2 = _this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
10056
|
+
if (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
10057
|
+
_xPos2 = _xPos2 + (_this64["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9878
10058
|
}
|
|
9879
10059
|
// return xPos
|
|
9880
10060
|
}
|
|
9881
10061
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9882
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10062
|
+
return "translate(".concat(xPos, ", ").concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9883
10063
|
}
|
|
9884
10064
|
});
|
|
9885
10065
|
}
|
|
@@ -10502,7 +10682,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10502
10682
|
}, {
|
|
10503
10683
|
key: "resize",
|
|
10504
10684
|
value: function resize() {
|
|
10505
|
-
var
|
|
10685
|
+
var _this65 = this;
|
|
10506
10686
|
var el = document.getElementById(this.elementId);
|
|
10507
10687
|
if (el) {
|
|
10508
10688
|
// if (this.options.width) {
|
|
@@ -10513,7 +10693,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10513
10693
|
// }
|
|
10514
10694
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10515
10695
|
html += this._data.map(function (d, i) {
|
|
10516
|
-
return
|
|
10696
|
+
return _this65.getLegendItemHTML(d);
|
|
10517
10697
|
}).join('');
|
|
10518
10698
|
html += "\n <div>\n ";
|
|
10519
10699
|
el.innerHTML = html;
|
|
@@ -10671,7 +10851,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10671
10851
|
}, {
|
|
10672
10852
|
key: "render",
|
|
10673
10853
|
value: function render() {
|
|
10674
|
-
var
|
|
10854
|
+
var _this66 = this;
|
|
10675
10855
|
this._isRendered = false;
|
|
10676
10856
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10677
10857
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10679,7 +10859,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10679
10859
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10680
10860
|
return {
|
|
10681
10861
|
value: s.label || s.key,
|
|
10682
|
-
color: s.color ||
|
|
10862
|
+
color: s.color || _this66.options.colors[i % _this66.options.colors.length]
|
|
10683
10863
|
};
|
|
10684
10864
|
});
|
|
10685
10865
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10733,7 +10913,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10733
10913
|
}
|
|
10734
10914
|
if (this.polygons) {
|
|
10735
10915
|
this.polygons.forEach(function (p) {
|
|
10736
|
-
return
|
|
10916
|
+
return _this66.map.removeLayer(p);
|
|
10737
10917
|
});
|
|
10738
10918
|
}
|
|
10739
10919
|
this.polygons = [];
|
|
@@ -10787,15 +10967,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10787
10967
|
p.options = {};
|
|
10788
10968
|
}
|
|
10789
10969
|
if (!p.options.color) {
|
|
10790
|
-
p.options.color =
|
|
10970
|
+
p.options.color = _this66.options.colors[i % _this66.options.colors.length];
|
|
10791
10971
|
}
|
|
10792
10972
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10793
10973
|
return c.map(function (d) {
|
|
10794
10974
|
return [d.Latitude, d.Longitude];
|
|
10795
10975
|
});
|
|
10796
|
-
}), p.options).addTo(
|
|
10797
|
-
|
|
10798
|
-
|
|
10976
|
+
}), p.options).addTo(_this66.map);
|
|
10977
|
+
_this66.polygons.push(pol);
|
|
10978
|
+
_this66.map.fitBounds(pol.getBounds());
|
|
10799
10979
|
});
|
|
10800
10980
|
}
|
|
10801
10981
|
// if (this.data.markers.length > 0) {
|
|
@@ -10909,6 +11089,7 @@ var WebsyDesigns = {
|
|
|
10909
11089
|
DatePicker: WebsyDatePicker,
|
|
10910
11090
|
WebsyDropdown: WebsyDropdown,
|
|
10911
11091
|
Dropdown: WebsyDropdown,
|
|
11092
|
+
MediaUpload: MediaUpload,
|
|
10912
11093
|
WebsyResultList: WebsyResultList,
|
|
10913
11094
|
ResultList: WebsyResultList,
|
|
10914
11095
|
WebsyTemplate: WebsyTemplate,
|