@websy/websy-designs 1.10.6 → 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/utils.js +6 -1
- package/dist/server/websy-designs-server.js +8 -3
- package/dist/websy-designs-es6.debug.js +78 -62
- package/dist/websy-designs-es6.js +75 -51
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +257 -68
- package/dist/websy-designs.js +529 -323
- 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
|
}
|
|
@@ -2306,6 +2309,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2306
2309
|
classes: []
|
|
2307
2310
|
},
|
|
2308
2311
|
useRecaptcha: false,
|
|
2312
|
+
recaptchaAction: 'submit',
|
|
2309
2313
|
clearAfterSave: false,
|
|
2310
2314
|
fields: [],
|
|
2311
2315
|
mode: 'add',
|
|
@@ -2376,6 +2380,27 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2376
2380
|
} else {
|
|
2377
2381
|
resolve(false);
|
|
2378
2382
|
}
|
|
2383
|
+
} else if (_this15.options.useRecaptchaV3 === true) {
|
|
2384
|
+
grecaptcha.ready(function () {
|
|
2385
|
+
grecaptcha.execute(ENVIRONMENT.RECAPTCHA_KEY, {
|
|
2386
|
+
action: _this15.options.recaptchaAction
|
|
2387
|
+
}).then(function (token) {
|
|
2388
|
+
_this15.apiService.add('google/checkrecaptcha', {
|
|
2389
|
+
grecaptcharesponse: token
|
|
2390
|
+
}).then(function (response) {
|
|
2391
|
+
if (response.success && response.success === true) {
|
|
2392
|
+
resolve(true);
|
|
2393
|
+
grecaptcha.reset("".concat(_this15.elementId, "_recaptcha"), {
|
|
2394
|
+
sitekey: ENVIRONMENT.RECAPTCHA_KEY
|
|
2395
|
+
});
|
|
2396
|
+
} else {
|
|
2397
|
+
resolve(false);
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
}, function (err) {
|
|
2401
|
+
console.log(err);
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2379
2404
|
} else {
|
|
2380
2405
|
resolve(true);
|
|
2381
2406
|
}
|
|
@@ -2672,11 +2697,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2672
2697
|
f.owningElement = _this20.elementId;
|
|
2673
2698
|
if (f.component) {
|
|
2674
2699
|
componentsToProcess.push(f);
|
|
2675
|
-
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 ");
|
|
2676
2701
|
} else if (f.type === 'longtext') {
|
|
2677
|
-
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 ");
|
|
2678
2703
|
} else {
|
|
2679
|
-
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 ");
|
|
2680
2705
|
}
|
|
2681
2706
|
});
|
|
2682
2707
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2689,7 +2714,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2689
2714
|
html += " \n </form>\n <div id=\"".concat(this.elementId, "_validationFail\" class=\"websy-validation-failure\"></div>\n ");
|
|
2690
2715
|
el.innerHTML = html;
|
|
2691
2716
|
this.processComponents(componentsToProcess, function () {
|
|
2692
|
-
if (_this20.options.useRecaptcha === true && typeof grecaptcha !== 'undefined') {
|
|
2717
|
+
if ((_this20.options.useRecaptcha === true || _this20.options.useRecaptchaV3 === true) && typeof grecaptcha !== 'undefined') {
|
|
2693
2718
|
_this20.recaptchaReady();
|
|
2694
2719
|
}
|
|
2695
2720
|
});
|
|
@@ -2709,6 +2734,9 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2709
2734
|
if (this.fieldMap[field].type === 'checkbox') {
|
|
2710
2735
|
el.checked = value;
|
|
2711
2736
|
}
|
|
2737
|
+
if (this.fieldMap[field].type === 'date') {
|
|
2738
|
+
el.valueAsDate = value;
|
|
2739
|
+
}
|
|
2712
2740
|
} else {
|
|
2713
2741
|
console.error("Input for ".concat(field, " does not exist in form."));
|
|
2714
2742
|
}
|
|
@@ -2778,6 +2806,9 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2778
2806
|
if (recaptchErrEl) {
|
|
2779
2807
|
recaptchErrEl.classList.remove('websy-hidden');
|
|
2780
2808
|
}
|
|
2809
|
+
if (_this21.options.submitErr) {
|
|
2810
|
+
_this21.options.submitErr();
|
|
2811
|
+
}
|
|
2781
2812
|
}
|
|
2782
2813
|
});
|
|
2783
2814
|
}
|
|
@@ -2855,10 +2886,12 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2855
2886
|
_classCallCheck(this, MultiForm);
|
|
2856
2887
|
this.elementId = elementId;
|
|
2857
2888
|
var DEFAULTS = {
|
|
2858
|
-
|
|
2859
|
-
|
|
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>",
|
|
2860
2891
|
allowAdd: true,
|
|
2861
|
-
allowDelete: true
|
|
2892
|
+
allowDelete: true,
|
|
2893
|
+
addLabel: '',
|
|
2894
|
+
deleteLabel: ''
|
|
2862
2895
|
};
|
|
2863
2896
|
this.options = _extends({}, DEFAULTS, options);
|
|
2864
2897
|
this.formData = [];
|
|
@@ -2867,7 +2900,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2867
2900
|
var el = document.getElementById(elementId);
|
|
2868
2901
|
if (el) {
|
|
2869
2902
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
2870
|
-
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 ");
|
|
2871
2904
|
}
|
|
2872
2905
|
this.render();
|
|
2873
2906
|
}
|
|
@@ -2880,19 +2913,26 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2880
2913
|
}, {
|
|
2881
2914
|
key: "addEntry",
|
|
2882
2915
|
value: function addEntry() {
|
|
2883
|
-
var
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
|
|
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
|
+
}
|
|
2896
2936
|
}
|
|
2897
2937
|
}, {
|
|
2898
2938
|
key: "clear",
|
|
@@ -2911,11 +2951,6 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2911
2951
|
var d = this.forms.map(function (f) {
|
|
2912
2952
|
return f.data;
|
|
2913
2953
|
});
|
|
2914
|
-
console.log('forms data', d);
|
|
2915
|
-
if (this.options.allowAdd !== false) {
|
|
2916
|
-
// we don't return the last form
|
|
2917
|
-
d.pop();
|
|
2918
|
-
}
|
|
2919
2954
|
return d;
|
|
2920
2955
|
},
|
|
2921
2956
|
set: function set(d) {
|
|
@@ -2934,16 +2969,6 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2934
2969
|
key: "handleClick",
|
|
2935
2970
|
value: function handleClick(event) {
|
|
2936
2971
|
if (event.target.classList.contains('websy-multi-form-add')) {
|
|
2937
|
-
var id = event.target.getAttribute('data-formid');
|
|
2938
|
-
// hide add button and show delete button
|
|
2939
|
-
var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
|
|
2940
|
-
if (addButtonEl) {
|
|
2941
|
-
addButtonEl.classList.add('hidden');
|
|
2942
|
-
}
|
|
2943
|
-
var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
|
|
2944
|
-
if (deleteButtonEl) {
|
|
2945
|
-
deleteButtonEl.classList.remove('hidden');
|
|
2946
|
-
}
|
|
2947
2972
|
// add new form
|
|
2948
2973
|
if (this.options.allowAdd === true) {
|
|
2949
2974
|
this.addEntry();
|
|
@@ -2951,12 +2976,12 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2951
2976
|
}
|
|
2952
2977
|
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2953
2978
|
// delete form based on index
|
|
2954
|
-
var
|
|
2979
|
+
var id = event.target.getAttribute('data-formid');
|
|
2955
2980
|
var rowId = event.target.getAttribute('data-rowid');
|
|
2956
2981
|
this.recordsToDelete.push(rowId);
|
|
2957
2982
|
var indexToDelete = -1;
|
|
2958
2983
|
for (var i = 0; i < this.forms.length; i++) {
|
|
2959
|
-
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(
|
|
2984
|
+
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(id, "_form")) {
|
|
2960
2985
|
indexToDelete = i;
|
|
2961
2986
|
break;
|
|
2962
2987
|
}
|
|
@@ -2964,10 +2989,14 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2964
2989
|
if (indexToDelete !== -1) {
|
|
2965
2990
|
this.forms.splice(indexToDelete, 1);
|
|
2966
2991
|
}
|
|
2967
|
-
var el = document.getElementById("".concat(this.elementId, "_").concat(
|
|
2992
|
+
var el = document.getElementById("".concat(this.elementId, "_").concat(id, "_formContainer"));
|
|
2968
2993
|
if (el) {
|
|
2969
2994
|
el.remove();
|
|
2970
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
|
+
}
|
|
2971
3000
|
// delete form element based on id
|
|
2972
3001
|
}
|
|
2973
3002
|
}
|
|
@@ -2984,14 +3013,11 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2984
3013
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2985
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 ");
|
|
2986
3015
|
if (_this23.options.allowDelete === true) {
|
|
2987
|
-
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 ");
|
|
2988
3017
|
}
|
|
2989
3018
|
html += "\n </div>\n ";
|
|
2990
3019
|
});
|
|
2991
3020
|
var id = WebsyDesigns.Utils.createIdentity();
|
|
2992
|
-
if (this.options.allowAdd === true) {
|
|
2993
|
-
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 ");
|
|
2994
|
-
}
|
|
2995
3021
|
el.innerHTML = html;
|
|
2996
3022
|
this.forms = new Array(this.formData.length);
|
|
2997
3023
|
this.formData.forEach(function (d, i) {
|
|
@@ -3004,14 +3030,13 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
3004
3030
|
formObject.data = d;
|
|
3005
3031
|
_this23.forms[i] = formObject;
|
|
3006
3032
|
});
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
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
|
+
}
|
|
3015
3040
|
}
|
|
3016
3041
|
}
|
|
3017
3042
|
}
|
|
@@ -3489,10 +3514,190 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3489
3514
|
}]);
|
|
3490
3515
|
return WebsyNavigationMenu;
|
|
3491
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
|
+
}();
|
|
3492
3697
|
/* global WebsyDesigns */
|
|
3493
3698
|
var Pager = /*#__PURE__*/function () {
|
|
3494
3699
|
function Pager(elementId, options) {
|
|
3495
|
-
var
|
|
3700
|
+
var _this28 = this;
|
|
3496
3701
|
_classCallCheck(this, Pager);
|
|
3497
3702
|
this.elementId = elementId;
|
|
3498
3703
|
var DEFAULTS = {
|
|
@@ -3539,8 +3744,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3539
3744
|
allowClear: false,
|
|
3540
3745
|
disableSearch: true,
|
|
3541
3746
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3542
|
-
if (
|
|
3543
|
-
|
|
3747
|
+
if (_this28.options.onChangePageSize) {
|
|
3748
|
+
_this28.options.onChangePageSize(selectedItem.value);
|
|
3544
3749
|
}
|
|
3545
3750
|
}
|
|
3546
3751
|
});
|
|
@@ -3561,11 +3766,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3561
3766
|
}, {
|
|
3562
3767
|
key: "render",
|
|
3563
3768
|
value: function render() {
|
|
3564
|
-
var
|
|
3769
|
+
var _this29 = this;
|
|
3565
3770
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3566
3771
|
if (el) {
|
|
3567
3772
|
var pages = this.options.pages.map(function (item, index) {
|
|
3568
|
-
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>");
|
|
3569
3774
|
});
|
|
3570
3775
|
var startIndex = 0;
|
|
3571
3776
|
if (this.options.pages.length > 8) {
|
|
@@ -3627,50 +3832,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3627
3832
|
_createClass(WebsyPDFButton, [{
|
|
3628
3833
|
key: "handleClick",
|
|
3629
3834
|
value: function handleClick(event) {
|
|
3630
|
-
var
|
|
3835
|
+
var _this30 = this;
|
|
3631
3836
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3632
3837
|
this.loader.show();
|
|
3633
3838
|
this.options.preProcess(function (proceed) {
|
|
3634
3839
|
if (proceed === true) {
|
|
3635
3840
|
setTimeout(function () {
|
|
3636
|
-
if (
|
|
3637
|
-
var el = document.getElementById(
|
|
3841
|
+
if (_this30.options.targetId) {
|
|
3842
|
+
var el = document.getElementById(_this30.options.targetId);
|
|
3638
3843
|
if (el) {
|
|
3639
3844
|
var pdfData = {
|
|
3640
3845
|
options: {}
|
|
3641
3846
|
};
|
|
3642
|
-
if (
|
|
3643
|
-
pdfData.options = _extends({},
|
|
3847
|
+
if (_this30.options.pdfOptions) {
|
|
3848
|
+
pdfData.options = _extends({}, _this30.options.pdfOptions);
|
|
3644
3849
|
}
|
|
3645
|
-
if (
|
|
3646
|
-
if (
|
|
3647
|
-
var headerEl = document.getElementById(
|
|
3850
|
+
if (_this30.options.header) {
|
|
3851
|
+
if (_this30.options.header.elementId) {
|
|
3852
|
+
var headerEl = document.getElementById(_this30.options.header.elementId);
|
|
3648
3853
|
if (headerEl) {
|
|
3649
3854
|
pdfData.header = headerEl.outerHTML;
|
|
3650
|
-
if (
|
|
3651
|
-
pdfData.options.headerCSS =
|
|
3855
|
+
if (_this30.options.header.css) {
|
|
3856
|
+
pdfData.options.headerCSS = _this30.options.header.css;
|
|
3652
3857
|
}
|
|
3653
3858
|
}
|
|
3654
|
-
} else if (
|
|
3655
|
-
pdfData.header =
|
|
3656
|
-
if (
|
|
3657
|
-
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;
|
|
3658
3863
|
}
|
|
3659
3864
|
} else {
|
|
3660
|
-
pdfData.header =
|
|
3865
|
+
pdfData.header = _this30.options.header;
|
|
3661
3866
|
}
|
|
3662
3867
|
}
|
|
3663
|
-
if (
|
|
3664
|
-
if (
|
|
3665
|
-
var footerEl = document.getElementById(
|
|
3868
|
+
if (_this30.options.footer) {
|
|
3869
|
+
if (_this30.options.footer.elementId) {
|
|
3870
|
+
var footerEl = document.getElementById(_this30.options.footer.elementId);
|
|
3666
3871
|
if (footerEl) {
|
|
3667
3872
|
pdfData.footer = footerEl.outerHTML;
|
|
3668
|
-
if (
|
|
3669
|
-
pdfData.options.footerCSS =
|
|
3873
|
+
if (_this30.options.footer.css) {
|
|
3874
|
+
pdfData.options.footerCSS = _this30.options.footer.css;
|
|
3670
3875
|
}
|
|
3671
3876
|
}
|
|
3672
3877
|
} else {
|
|
3673
|
-
pdfData.footer =
|
|
3878
|
+
pdfData.footer = _this30.options.footer;
|
|
3674
3879
|
}
|
|
3675
3880
|
}
|
|
3676
3881
|
pdfData.html = el.outerHTML;
|
|
@@ -3678,25 +3883,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3678
3883
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3679
3884
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3680
3885
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3681
|
-
|
|
3886
|
+
_this30.service.add('', pdfData, {
|
|
3682
3887
|
responseType: 'blob'
|
|
3683
3888
|
}).then(function (response) {
|
|
3684
|
-
|
|
3889
|
+
_this30.loader.hide();
|
|
3685
3890
|
var blob = new Blob([response], {
|
|
3686
3891
|
type: 'application/pdf'
|
|
3687
3892
|
});
|
|
3688
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 ");
|
|
3689
|
-
if (
|
|
3894
|
+
if (_this30.options.directDownload === true) {
|
|
3690
3895
|
var fileName;
|
|
3691
|
-
if (typeof
|
|
3692
|
-
fileName =
|
|
3896
|
+
if (typeof _this30.options.fileName === 'function') {
|
|
3897
|
+
fileName = _this30.options.fileName() || 'Export';
|
|
3693
3898
|
} else {
|
|
3694
|
-
fileName =
|
|
3899
|
+
fileName = _this30.options.fileName || 'Export';
|
|
3695
3900
|
}
|
|
3696
3901
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3697
3902
|
}
|
|
3698
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3699
|
-
|
|
3903
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this30.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3904
|
+
_this30.popup.show({
|
|
3700
3905
|
message: msg,
|
|
3701
3906
|
mask: true
|
|
3702
3907
|
});
|
|
@@ -3705,10 +3910,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3705
3910
|
});
|
|
3706
3911
|
}
|
|
3707
3912
|
}
|
|
3708
|
-
},
|
|
3913
|
+
}, _this30.options.wait);
|
|
3709
3914
|
} else {
|
|
3710
|
-
|
|
3711
|
-
|
|
3915
|
+
_this30.loader.hide();
|
|
3916
|
+
_this30.options.onError();
|
|
3712
3917
|
}
|
|
3713
3918
|
});
|
|
3714
3919
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -3872,7 +4077,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3872
4077
|
}();
|
|
3873
4078
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3874
4079
|
function ResponsiveText(elementId, options) {
|
|
3875
|
-
var
|
|
4080
|
+
var _this31 = this;
|
|
3876
4081
|
_classCallCheck(this, ResponsiveText);
|
|
3877
4082
|
var DEFAULTS = {
|
|
3878
4083
|
textAlign: 'center',
|
|
@@ -3883,7 +4088,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3883
4088
|
this.elementId = elementId;
|
|
3884
4089
|
this.canvas = document.createElement('canvas');
|
|
3885
4090
|
window.addEventListener('resize', function () {
|
|
3886
|
-
return
|
|
4091
|
+
return _this31.render();
|
|
3887
4092
|
});
|
|
3888
4093
|
var el = document.getElementById(this.elementId);
|
|
3889
4094
|
if (el) {
|
|
@@ -4073,7 +4278,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
4073
4278
|
/* global WebsyDesigns */
|
|
4074
4279
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
4075
4280
|
function WebsyResultList(elementId, options) {
|
|
4076
|
-
var
|
|
4281
|
+
var _this32 = this;
|
|
4077
4282
|
_classCallCheck(this, WebsyResultList);
|
|
4078
4283
|
var DEFAULTS = {
|
|
4079
4284
|
listeners: {
|
|
@@ -4099,8 +4304,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4099
4304
|
}
|
|
4100
4305
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4101
4306
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4102
|
-
|
|
4103
|
-
|
|
4307
|
+
_this32.options.template = templateString;
|
|
4308
|
+
_this32.render();
|
|
4104
4309
|
});
|
|
4105
4310
|
} else {
|
|
4106
4311
|
this.render();
|
|
@@ -4119,7 +4324,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4119
4324
|
}, {
|
|
4120
4325
|
key: "buildHTML",
|
|
4121
4326
|
value: function buildHTML(d) {
|
|
4122
|
-
var
|
|
4327
|
+
var _this33 = this;
|
|
4123
4328
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4124
4329
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
4125
4330
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -4127,7 +4332,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4127
4332
|
if (this.options.template) {
|
|
4128
4333
|
if (d.length > 0) {
|
|
4129
4334
|
d.forEach(function (row, ix) {
|
|
4130
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
4335
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this33.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
4131
4336
|
// find conditional elements
|
|
4132
4337
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
4133
4338
|
ifMatches.forEach(function (m) {
|
|
@@ -4215,7 +4420,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4215
4420
|
parts.forEach(function (p) {
|
|
4216
4421
|
items = items[p];
|
|
4217
4422
|
});
|
|
4218
|
-
template = template.replace(m[0],
|
|
4423
|
+
template = template.replace(m[0], _this33.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4219
4424
|
}
|
|
4220
4425
|
});
|
|
4221
4426
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4224,7 +4429,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4224
4429
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4225
4430
|
}
|
|
4226
4431
|
});
|
|
4227
|
-
var flatRow =
|
|
4432
|
+
var flatRow = _this33.flattenObject(row);
|
|
4228
4433
|
for (var key in flatRow) {
|
|
4229
4434
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4230
4435
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4349,15 +4554,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4349
4554
|
}, {
|
|
4350
4555
|
key: "render",
|
|
4351
4556
|
value: function render() {
|
|
4352
|
-
var
|
|
4557
|
+
var _this34 = this;
|
|
4353
4558
|
if (this.options.entity) {
|
|
4354
4559
|
var url = this.options.entity;
|
|
4355
4560
|
if (this.options.sortField) {
|
|
4356
4561
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4357
4562
|
}
|
|
4358
4563
|
this.apiService.get(url).then(function (results) {
|
|
4359
|
-
|
|
4360
|
-
|
|
4564
|
+
_this34.rows = results.rows;
|
|
4565
|
+
_this34.resize();
|
|
4361
4566
|
});
|
|
4362
4567
|
} else {
|
|
4363
4568
|
this.resize();
|
|
@@ -4427,12 +4632,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4427
4632
|
_createClass(WebsyRouter, [{
|
|
4428
4633
|
key: "addGroup",
|
|
4429
4634
|
value: function addGroup(group) {
|
|
4430
|
-
var
|
|
4635
|
+
var _this35 = this;
|
|
4431
4636
|
if (!this.groups[group]) {
|
|
4432
4637
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4433
4638
|
if (els) {
|
|
4434
4639
|
this.getClosestParent(els[0], function (parent) {
|
|
4435
|
-
|
|
4640
|
+
_this35.groups[group] = {
|
|
4436
4641
|
activeView: '',
|
|
4437
4642
|
views: [],
|
|
4438
4643
|
parent: parent.getAttribute('data-view')
|
|
@@ -4496,7 +4701,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4496
4701
|
}, {
|
|
4497
4702
|
key: "removeUrlParams",
|
|
4498
4703
|
value: function removeUrlParams() {
|
|
4499
|
-
var
|
|
4704
|
+
var _this36 = this;
|
|
4500
4705
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4501
4706
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4502
4707
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4504,7 +4709,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4504
4709
|
var path = '';
|
|
4505
4710
|
if (this.currentParams && this.currentParams.items) {
|
|
4506
4711
|
params.forEach(function (p) {
|
|
4507
|
-
delete
|
|
4712
|
+
delete _this36.currentParams.items[p];
|
|
4508
4713
|
});
|
|
4509
4714
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4510
4715
|
}
|
|
@@ -4835,11 +5040,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4835
5040
|
}, {
|
|
4836
5041
|
key: "showComponents",
|
|
4837
5042
|
value: function showComponents(view) {
|
|
4838
|
-
var
|
|
5043
|
+
var _this37 = this;
|
|
4839
5044
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4840
5045
|
this.options.views[view].components.forEach(function (c) {
|
|
4841
5046
|
if (typeof c.instance === 'undefined') {
|
|
4842
|
-
|
|
5047
|
+
_this37.prepComponent(c.elementId, c.options);
|
|
4843
5048
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4844
5049
|
} else if (c.instance.render) {
|
|
4845
5050
|
c.instance.render();
|
|
@@ -5256,7 +5461,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5256
5461
|
}, {
|
|
5257
5462
|
key: "handleKeyUp",
|
|
5258
5463
|
value: function handleKeyUp(event) {
|
|
5259
|
-
var
|
|
5464
|
+
var _this38 = this;
|
|
5260
5465
|
if (event.target.classList.contains('websy-search-input')) {
|
|
5261
5466
|
this.cursorPosition = event.target.selectionStart;
|
|
5262
5467
|
this.searchText = event.target.value;
|
|
@@ -5279,8 +5484,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5279
5484
|
}
|
|
5280
5485
|
if (event.target.value.length >= this.options.minLength) {
|
|
5281
5486
|
this.searchTimeoutFn = setTimeout(function () {
|
|
5282
|
-
if (
|
|
5283
|
-
|
|
5487
|
+
if (_this38.options.onSearch) {
|
|
5488
|
+
_this38.options.onSearch(event.target.value, event);
|
|
5284
5489
|
}
|
|
5285
5490
|
}, this.options.searchTimeout);
|
|
5286
5491
|
} else {
|
|
@@ -5330,7 +5535,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5330
5535
|
}, {
|
|
5331
5536
|
key: "highlightActiveSuggestion",
|
|
5332
5537
|
value: function highlightActiveSuggestion() {
|
|
5333
|
-
var
|
|
5538
|
+
var _this39 = this;
|
|
5334
5539
|
// remove all previous highlights
|
|
5335
5540
|
// const parent = document.getElementById(`${this.elementId}_suggestionList`)
|
|
5336
5541
|
// if (parent) {
|
|
@@ -5349,7 +5554,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5349
5554
|
Array.from(els).forEach(function (e) {
|
|
5350
5555
|
e.classList.remove('active');
|
|
5351
5556
|
var index = e.getAttribute('data-index');
|
|
5352
|
-
if (+index ===
|
|
5557
|
+
if (+index === _this39.activeSuggestion) {
|
|
5353
5558
|
e.classList.add('active');
|
|
5354
5559
|
}
|
|
5355
5560
|
});
|
|
@@ -5418,11 +5623,11 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5418
5623
|
});
|
|
5419
5624
|
});
|
|
5420
5625
|
var items = searchLetters.map(function (d) {
|
|
5421
|
-
var html = "
|
|
5626
|
+
var html = "<div";
|
|
5422
5627
|
if (d.term && d.term.label) {
|
|
5423
5628
|
html += "\n data-label=\"".concat(d.term.label, "\"\n ");
|
|
5424
5629
|
}
|
|
5425
|
-
html += "
|
|
5630
|
+
html += ">".concat(d.text.replace(/ /g, ' '), "</div>");
|
|
5426
5631
|
return html;
|
|
5427
5632
|
});
|
|
5428
5633
|
var el = document.getElementById("".concat(this.elementId, "_lozenges"));
|
|
@@ -5469,13 +5674,13 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
5469
5674
|
}, {
|
|
5470
5675
|
key: "startSuggestionTimeout",
|
|
5471
5676
|
value: function startSuggestionTimeout() {
|
|
5472
|
-
var
|
|
5677
|
+
var _this40 = this;
|
|
5473
5678
|
if (this.suggestingTimeoutFn) {
|
|
5474
5679
|
clearTimeout(this.suggestingTimeoutFn);
|
|
5475
5680
|
}
|
|
5476
5681
|
this.suggestingTimeoutFn = setTimeout(function () {
|
|
5477
5682
|
// close the suggestions after inactivity for [suggestingTimeout] milliseconds
|
|
5478
|
-
|
|
5683
|
+
_this40.hideSuggestions(_this40);
|
|
5479
5684
|
}, this.options.suggestingTimeout);
|
|
5480
5685
|
}
|
|
5481
5686
|
}, {
|
|
@@ -5639,7 +5844,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5639
5844
|
/* global WebsyDesigns */
|
|
5640
5845
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5641
5846
|
function WebsyTemplate(elementId, options) {
|
|
5642
|
-
var
|
|
5847
|
+
var _this41 = this;
|
|
5643
5848
|
_classCallCheck(this, WebsyTemplate);
|
|
5644
5849
|
var DEFAULTS = {
|
|
5645
5850
|
listeners: {
|
|
@@ -5659,8 +5864,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5659
5864
|
}
|
|
5660
5865
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5661
5866
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5662
|
-
|
|
5663
|
-
|
|
5867
|
+
_this41.options.template = templateString;
|
|
5868
|
+
_this41.render();
|
|
5664
5869
|
});
|
|
5665
5870
|
} else {
|
|
5666
5871
|
this.render();
|
|
@@ -5669,7 +5874,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5669
5874
|
_createClass(WebsyTemplate, [{
|
|
5670
5875
|
key: "buildHTML",
|
|
5671
5876
|
value: function buildHTML() {
|
|
5672
|
-
var
|
|
5877
|
+
var _this42 = this;
|
|
5673
5878
|
var html = "";
|
|
5674
5879
|
if (this.options.template) {
|
|
5675
5880
|
var template = this.options.template;
|
|
@@ -5718,14 +5923,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5718
5923
|
}
|
|
5719
5924
|
}
|
|
5720
5925
|
if (polarity === true) {
|
|
5721
|
-
if (typeof
|
|
5926
|
+
if (typeof _this42.options.data[parts[0]] !== 'undefined' && _this42.options.data[parts[0]] === parts[1]) {
|
|
5722
5927
|
// remove the <if> tags
|
|
5723
5928
|
removeAll = false;
|
|
5724
5929
|
} else if (parts[0] === parts[1]) {
|
|
5725
5930
|
removeAll = false;
|
|
5726
5931
|
}
|
|
5727
5932
|
} else if (polarity === false) {
|
|
5728
|
-
if (typeof
|
|
5933
|
+
if (typeof _this42.options.data[parts[0]] !== 'undefined' && _this42.options.data[parts[0]] !== parts[1]) {
|
|
5729
5934
|
// remove the <if> tags
|
|
5730
5935
|
removeAll = false;
|
|
5731
5936
|
}
|
|
@@ -6038,7 +6243,7 @@ var WebsyUtils = {
|
|
|
6038
6243
|
/* global WebsyDesigns */
|
|
6039
6244
|
var WebsyTable = /*#__PURE__*/function () {
|
|
6040
6245
|
function WebsyTable(elementId, options) {
|
|
6041
|
-
var
|
|
6246
|
+
var _this43 = this;
|
|
6042
6247
|
_classCallCheck(this, WebsyTable);
|
|
6043
6248
|
var DEFAULTS = {
|
|
6044
6249
|
pageSize: 20,
|
|
@@ -6071,8 +6276,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6071
6276
|
allowClear: false,
|
|
6072
6277
|
disableSearch: true,
|
|
6073
6278
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6074
|
-
if (
|
|
6075
|
-
|
|
6279
|
+
if (_this43.options.onChangePageSize) {
|
|
6280
|
+
_this43.options.onChangePageSize(selectedItem.value);
|
|
6076
6281
|
}
|
|
6077
6282
|
}
|
|
6078
6283
|
});
|
|
@@ -6096,20 +6301,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6096
6301
|
}, {
|
|
6097
6302
|
key: "appendRows",
|
|
6098
6303
|
value: function appendRows(data) {
|
|
6099
|
-
var
|
|
6304
|
+
var _this44 = this;
|
|
6100
6305
|
this._isRendered = false;
|
|
6101
6306
|
this.hideError();
|
|
6102
6307
|
var bodyHTML = '';
|
|
6103
6308
|
if (data) {
|
|
6104
6309
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6105
6310
|
return '<tr>' + r.map(function (c, i) {
|
|
6106
|
-
if (
|
|
6311
|
+
if (_this44.options.columns[i].show !== false) {
|
|
6107
6312
|
var style = '';
|
|
6108
6313
|
if (c.style) {
|
|
6109
6314
|
style += c.style;
|
|
6110
6315
|
}
|
|
6111
|
-
if (
|
|
6112
|
-
style += "width: ".concat(
|
|
6316
|
+
if (_this44.options.columns[i].width) {
|
|
6317
|
+
style += "width: ".concat(_this44.options.columns[i].width, "; ");
|
|
6113
6318
|
}
|
|
6114
6319
|
if (c.backgroundColor) {
|
|
6115
6320
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6120,16 +6325,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6120
6325
|
if (c.color) {
|
|
6121
6326
|
style += "color: ".concat(c.color, "; ");
|
|
6122
6327
|
}
|
|
6123
|
-
if (
|
|
6124
|
-
return "\n <td \n data-row-index='".concat(
|
|
6125
|
-
} else if ((
|
|
6126
|
-
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 ");
|
|
6127
6332
|
} else {
|
|
6128
6333
|
var info = c.value;
|
|
6129
|
-
if (
|
|
6334
|
+
if (_this44.options.columns[i].showAsImage === true) {
|
|
6130
6335
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6131
6336
|
}
|
|
6132
|
-
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 ");
|
|
6133
6338
|
}
|
|
6134
6339
|
}
|
|
6135
6340
|
}).join('') + '</tr>';
|
|
@@ -6289,7 +6494,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6289
6494
|
}, {
|
|
6290
6495
|
key: "render",
|
|
6291
6496
|
value: function render(data) {
|
|
6292
|
-
var
|
|
6497
|
+
var _this45 = this;
|
|
6293
6498
|
this._isRendered = false;
|
|
6294
6499
|
if (!this.options.columns) {
|
|
6295
6500
|
return;
|
|
@@ -6317,7 +6522,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6317
6522
|
if (c.width) {
|
|
6318
6523
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
6319
6524
|
}
|
|
6320
|
-
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 ");
|
|
6321
6526
|
}
|
|
6322
6527
|
}).join('') + '</tr>';
|
|
6323
6528
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6335,7 +6540,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6335
6540
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6336
6541
|
if (pagingEl) {
|
|
6337
6542
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6338
|
-
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>");
|
|
6339
6544
|
});
|
|
6340
6545
|
var startIndex = 0;
|
|
6341
6546
|
if (this.options.pageCount > 8) {
|
|
@@ -6391,7 +6596,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
6391
6596
|
/* global WebsyDesigns */
|
|
6392
6597
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
6393
6598
|
function WebsyTable2(elementId, options) {
|
|
6394
|
-
var
|
|
6599
|
+
var _this46 = this;
|
|
6395
6600
|
_classCallCheck(this, WebsyTable2);
|
|
6396
6601
|
var DEFAULTS = {
|
|
6397
6602
|
pageSize: 20,
|
|
@@ -6426,8 +6631,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6426
6631
|
allowClear: false,
|
|
6427
6632
|
disableSearch: true,
|
|
6428
6633
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
6429
|
-
if (
|
|
6430
|
-
|
|
6634
|
+
if (_this46.options.onChangePageSize) {
|
|
6635
|
+
_this46.options.onChangePageSize(selectedItem.value);
|
|
6431
6636
|
}
|
|
6432
6637
|
}
|
|
6433
6638
|
});
|
|
@@ -6449,20 +6654,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6449
6654
|
_createClass(WebsyTable2, [{
|
|
6450
6655
|
key: "appendRows",
|
|
6451
6656
|
value: function appendRows(data) {
|
|
6452
|
-
var
|
|
6657
|
+
var _this47 = this;
|
|
6453
6658
|
this.hideError();
|
|
6454
6659
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6455
6660
|
var bodyHTML = '';
|
|
6456
6661
|
if (data) {
|
|
6457
6662
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
6458
6663
|
return '<tr>' + r.map(function (c, i) {
|
|
6459
|
-
if (
|
|
6460
|
-
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;");
|
|
6461
6666
|
if (c.style) {
|
|
6462
6667
|
style += c.style;
|
|
6463
6668
|
}
|
|
6464
|
-
if (
|
|
6465
|
-
style += "width: ".concat(
|
|
6669
|
+
if (_this47.options.columns[i].width) {
|
|
6670
|
+
style += "width: ".concat(_this47.options.columns[i].width, "; ");
|
|
6466
6671
|
}
|
|
6467
6672
|
if (c.backgroundColor) {
|
|
6468
6673
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -6473,16 +6678,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6473
6678
|
if (c.color) {
|
|
6474
6679
|
style += "color: ".concat(c.color, "; ");
|
|
6475
6680
|
}
|
|
6476
|
-
if (
|
|
6477
|
-
return "\n <td \n data-row-index='".concat(
|
|
6478
|
-
} else if ((
|
|
6479
|
-
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 ");
|
|
6480
6685
|
} else {
|
|
6481
6686
|
var info = c.value;
|
|
6482
|
-
if (
|
|
6687
|
+
if (_this47.options.columns[i].showAsImage === true) {
|
|
6483
6688
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
6484
6689
|
}
|
|
6485
|
-
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 ");
|
|
6486
6691
|
}
|
|
6487
6692
|
}
|
|
6488
6693
|
}).join('') + '</tr>';
|
|
@@ -6716,7 +6921,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6716
6921
|
}, {
|
|
6717
6922
|
key: "render",
|
|
6718
6923
|
value: function render(data) {
|
|
6719
|
-
var
|
|
6924
|
+
var _this48 = this;
|
|
6720
6925
|
if (!this.options.columns) {
|
|
6721
6926
|
return;
|
|
6722
6927
|
}
|
|
@@ -6744,7 +6949,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6744
6949
|
if (c.width) {
|
|
6745
6950
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6746
6951
|
}
|
|
6747
|
-
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 ");
|
|
6748
6953
|
}
|
|
6749
6954
|
}).join('') + '</tr>';
|
|
6750
6955
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6754,7 +6959,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6754
6959
|
var dropdownHTML = "";
|
|
6755
6960
|
this.options.columns.forEach(function (c, i) {
|
|
6756
6961
|
if (c.searchable && c.searchField) {
|
|
6757
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6962
|
+
dropdownHTML += "\n <div id=\"".concat(_this48.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6758
6963
|
}
|
|
6759
6964
|
});
|
|
6760
6965
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6774,7 +6979,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6774
6979
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6775
6980
|
if (pagingEl) {
|
|
6776
6981
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6777
|
-
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>");
|
|
6778
6983
|
});
|
|
6779
6984
|
var startIndex = 0;
|
|
6780
6985
|
if (this.options.pageCount > 8) {
|
|
@@ -6851,17 +7056,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6851
7056
|
}, {
|
|
6852
7057
|
key: "getColumnParameters",
|
|
6853
7058
|
value: function getColumnParameters(values) {
|
|
6854
|
-
var
|
|
7059
|
+
var _this49 = this;
|
|
6855
7060
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6856
7061
|
tableEl.style.tableLayout = 'auto';
|
|
6857
7062
|
tableEl.style.width = 'auto';
|
|
6858
7063
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6859
7064
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6860
7065
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6861
|
-
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 ");
|
|
6862
7067
|
}).join('') + '</tr>';
|
|
6863
7068
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6864
|
-
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 ");
|
|
6865
7070
|
}).join('') + '</tr>';
|
|
6866
7071
|
// get height of the first data cell
|
|
6867
7072
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -7025,7 +7230,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7025
7230
|
}, {
|
|
7026
7231
|
key: "buildBodyHtml",
|
|
7027
7232
|
value: function buildBodyHtml() {
|
|
7028
|
-
var
|
|
7233
|
+
var _this50 = this;
|
|
7029
7234
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7030
7235
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7031
7236
|
if (!this.options.columns) {
|
|
@@ -7050,7 +7255,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7050
7255
|
row.forEach(function (cell, cellIndex) {
|
|
7051
7256
|
var sizeIndex = cell.level || cellIndex;
|
|
7052
7257
|
var colIndex = cell.index || cellIndex;
|
|
7053
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
7258
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this50.options.columns[_this50.options.columns.length - 1][colIndex].show === false) {
|
|
7054
7259
|
return; // need to revisit this logic
|
|
7055
7260
|
}
|
|
7056
7261
|
|
|
@@ -7077,7 +7282,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7077
7282
|
style += "color: ".concat(cell.color, "; ");
|
|
7078
7283
|
}
|
|
7079
7284
|
// console.log('rowspan', cell.rowspan)
|
|
7080
|
-
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 ");
|
|
7081
7286
|
// if (useWidths === true) {
|
|
7082
7287
|
// bodyHtml += `
|
|
7083
7288
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -7086,10 +7291,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7086
7291
|
// }
|
|
7087
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 >");
|
|
7088
7293
|
if (cell.expandable === true) {
|
|
7089
|
-
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>");
|
|
7090
7295
|
}
|
|
7091
7296
|
if (cell.collapsable === true) {
|
|
7092
|
-
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>");
|
|
7093
7298
|
}
|
|
7094
7299
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
7095
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 ");
|
|
@@ -7110,7 +7315,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7110
7315
|
}, {
|
|
7111
7316
|
key: "buildHeaderHtml",
|
|
7112
7317
|
value: function buildHeaderHtml() {
|
|
7113
|
-
var
|
|
7318
|
+
var _this51 = this;
|
|
7114
7319
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7115
7320
|
if (!this.options.columns) {
|
|
7116
7321
|
return '';
|
|
@@ -7131,7 +7336,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7131
7336
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
7132
7337
|
// return
|
|
7133
7338
|
// }
|
|
7134
|
-
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' : '', "\">");
|
|
7135
7340
|
row.filter(function (c) {
|
|
7136
7341
|
return c.show !== false;
|
|
7137
7342
|
}).forEach(function (col, colIndex) {
|
|
@@ -7151,24 +7356,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7151
7356
|
if (col.style) {
|
|
7152
7357
|
style += col.style;
|
|
7153
7358
|
}
|
|
7154
|
-
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 ");
|
|
7155
7360
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
7156
7361
|
// headerHtml += `
|
|
7157
7362
|
// style='width: ${col.width || col.actualWidth}px'
|
|
7158
7363
|
// width='${col.width || col.actualWidth}'
|
|
7159
7364
|
// `
|
|
7160
7365
|
// }
|
|
7161
|
-
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>");
|
|
7162
7367
|
});
|
|
7163
7368
|
headerHtml += "</tr>";
|
|
7164
7369
|
});
|
|
7165
7370
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
7166
7371
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
7167
7372
|
if (c.searchable && c.isExternalSearch === true) {
|
|
7168
|
-
var testEl = document.getElementById("".concat(
|
|
7373
|
+
var testEl = document.getElementById("".concat(_this51.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
7169
7374
|
if (!testEl) {
|
|
7170
7375
|
var newE = document.createElement('div');
|
|
7171
|
-
newE.id = "".concat(
|
|
7376
|
+
newE.id = "".concat(_this51.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
7172
7377
|
newE.className = 'websy-modal-dropdown';
|
|
7173
7378
|
dropdownEl.appendChild(newE);
|
|
7174
7379
|
}
|
|
@@ -7191,7 +7396,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7191
7396
|
}, {
|
|
7192
7397
|
key: "buildTotalHtml",
|
|
7193
7398
|
value: function buildTotalHtml() {
|
|
7194
|
-
var
|
|
7399
|
+
var _this52 = this;
|
|
7195
7400
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
7196
7401
|
if (!this.options.totals) {
|
|
7197
7402
|
return '';
|
|
@@ -7207,7 +7412,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7207
7412
|
|
|
7208
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 ");
|
|
7209
7414
|
if (useWidths === true) {
|
|
7210
|
-
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 ");
|
|
7211
7416
|
}
|
|
7212
7417
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
7213
7418
|
});
|
|
@@ -7217,7 +7422,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7217
7422
|
}, {
|
|
7218
7423
|
key: "calculateSizes",
|
|
7219
7424
|
value: function calculateSizes() {
|
|
7220
|
-
var
|
|
7425
|
+
var _this53 = this;
|
|
7221
7426
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7222
7427
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
7223
7428
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -7261,7 +7466,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7261
7466
|
rows.forEach(function (row, rowIndex) {
|
|
7262
7467
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
7263
7468
|
var colSize = col.getBoundingClientRect();
|
|
7264
|
-
|
|
7469
|
+
_this53.sizes.cellHeight = colSize.height;
|
|
7265
7470
|
if (columnsForSizing[colIndex]) {
|
|
7266
7471
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
7267
7472
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -7273,7 +7478,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7273
7478
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
7274
7479
|
// }
|
|
7275
7480
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
7276
|
-
if (colIndex >=
|
|
7481
|
+
if (colIndex >= _this53.pinnedColumns) {
|
|
7277
7482
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
7278
7483
|
}
|
|
7279
7484
|
}
|
|
@@ -7288,7 +7493,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7288
7493
|
return a + (b.width || b.actualWidth);
|
|
7289
7494
|
}, 0);
|
|
7290
7495
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
7291
|
-
return i >=
|
|
7496
|
+
return i >= _this53.pinnedColumns;
|
|
7292
7497
|
}).reduce(function (a, b) {
|
|
7293
7498
|
return a + (b.width || b.actualWidth);
|
|
7294
7499
|
}, 0);
|
|
@@ -7299,7 +7504,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7299
7504
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
7300
7505
|
columnsForSizing.forEach(function (c) {
|
|
7301
7506
|
c.shouldGrow = true;
|
|
7302
|
-
if (
|
|
7507
|
+
if (_this53.options.autoFitColumns === false) {
|
|
7303
7508
|
c.shouldGrow = false;
|
|
7304
7509
|
if (c.potentialWidth > c.actualWidth) {
|
|
7305
7510
|
c.shouldGrow = true;
|
|
@@ -7318,7 +7523,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7318
7523
|
// if (!c.width) {
|
|
7319
7524
|
// if (c.actualWidth < equalWidth) {
|
|
7320
7525
|
// adjust the width
|
|
7321
|
-
if (
|
|
7526
|
+
if (_this53.options.autoFitColumns === true) {
|
|
7322
7527
|
if (c.width) {
|
|
7323
7528
|
c.width += equalWidth;
|
|
7324
7529
|
}
|
|
@@ -7342,9 +7547,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7342
7547
|
}
|
|
7343
7548
|
// }
|
|
7344
7549
|
// }
|
|
7345
|
-
|
|
7346
|
-
if (i >
|
|
7347
|
-
|
|
7550
|
+
_this53.sizes.totalWidth += c.width || c.actualWidth;
|
|
7551
|
+
if (i > _this53.pinnedColumns) {
|
|
7552
|
+
_this53.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
7348
7553
|
}
|
|
7349
7554
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
7350
7555
|
});
|
|
@@ -7403,7 +7608,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7403
7608
|
}, {
|
|
7404
7609
|
key: "createSample",
|
|
7405
7610
|
value: function createSample(data) {
|
|
7406
|
-
var
|
|
7611
|
+
var _this54 = this;
|
|
7407
7612
|
var output = [];
|
|
7408
7613
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
7409
7614
|
if (col.maxLength) {
|
|
@@ -7413,7 +7618,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7413
7618
|
} else if (data) {
|
|
7414
7619
|
var longest = '';
|
|
7415
7620
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
7416
|
-
if (data[i].length ===
|
|
7621
|
+
if (data[i].length === _this54.options.columns[_this54.options.columns.length - 1].length) {
|
|
7417
7622
|
if (longest.length < data[i][colIndex].value.length) {
|
|
7418
7623
|
longest = data[i][colIndex].value;
|
|
7419
7624
|
}
|
|
@@ -7685,7 +7890,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7685
7890
|
}, {
|
|
7686
7891
|
key: "perpetualScroll",
|
|
7687
7892
|
value: function perpetualScroll() {
|
|
7688
|
-
var
|
|
7893
|
+
var _this55 = this;
|
|
7689
7894
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7690
7895
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7691
7896
|
return;
|
|
@@ -7704,17 +7909,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7704
7909
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7705
7910
|
var _loop2 = function _loop2(i) {
|
|
7706
7911
|
setTimeout(function () {
|
|
7707
|
-
var delta =
|
|
7912
|
+
var delta = _this55.mouseYStart - _this55.currentClientY + _this55.sizes.cellHeight * (i + 1) * direction;
|
|
7708
7913
|
delta = Math.min(10, delta);
|
|
7709
7914
|
delta = Math.max(-10, delta);
|
|
7710
7915
|
// only run this if isPerpetual === true
|
|
7711
7916
|
// this value is reset to false on touchStart
|
|
7712
|
-
if (
|
|
7917
|
+
if (_this55.isPerpetual === true) {
|
|
7713
7918
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7714
7919
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7715
|
-
|
|
7716
|
-
if (
|
|
7717
|
-
clearTimeout(
|
|
7920
|
+
_this55.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7921
|
+
if (_this55.scrollTimeout) {
|
|
7922
|
+
clearTimeout(_this55.scrollTimeout);
|
|
7718
7923
|
}
|
|
7719
7924
|
}
|
|
7720
7925
|
}, 1000 / fps * i);
|
|
@@ -7982,7 +8187,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7982
8187
|
/* global d3 include WebsyDesigns */
|
|
7983
8188
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7984
8189
|
function WebsyChart(elementId, options) {
|
|
7985
|
-
var
|
|
8190
|
+
var _this56 = this;
|
|
7986
8191
|
_classCallCheck(this, WebsyChart);
|
|
7987
8192
|
var DEFAULTS = {
|
|
7988
8193
|
margin: {
|
|
@@ -8041,7 +8246,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8041
8246
|
this.invertOverride = function (input, input2) {
|
|
8042
8247
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8043
8248
|
var xAxis = 'bottom';
|
|
8044
|
-
if (
|
|
8249
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
8045
8250
|
xAxis = 'left';
|
|
8046
8251
|
}
|
|
8047
8252
|
if (forBrush === true) {
|
|
@@ -8049,12 +8254,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8049
8254
|
}
|
|
8050
8255
|
xAxis += 'Axis';
|
|
8051
8256
|
var output;
|
|
8052
|
-
var width =
|
|
8257
|
+
var width = _this56.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
8053
8258
|
// if (this.customBottomRange) {
|
|
8054
|
-
for (var index = 0; index <
|
|
8055
|
-
if (input >
|
|
8056
|
-
if (
|
|
8057
|
-
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]) {
|
|
8058
8263
|
output = index;
|
|
8059
8264
|
break;
|
|
8060
8265
|
}
|
|
@@ -8219,9 +8424,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8219
8424
|
}, {
|
|
8220
8425
|
key: "handleEventMouseMove",
|
|
8221
8426
|
value: function handleEventMouseMove(event, d) {
|
|
8222
|
-
var
|
|
8427
|
+
var _this57 = this;
|
|
8223
8428
|
var bisectDate = d3.bisector(function (d) {
|
|
8224
|
-
return
|
|
8429
|
+
return _this57.parseX(d.x.value);
|
|
8225
8430
|
}).left;
|
|
8226
8431
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
8227
8432
|
var xAxis = 'bottomAxis';
|
|
@@ -8254,9 +8459,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8254
8459
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
8255
8460
|
}
|
|
8256
8461
|
this.options.data.series.forEach(function (s) {
|
|
8257
|
-
if (
|
|
8462
|
+
if (_this57.options.data[xData].scale !== 'Time') {
|
|
8258
8463
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
8259
|
-
xPoint =
|
|
8464
|
+
xPoint = _this57.customBottomRange[x0] + (_this57.customBottomRange[x0 + 1] - _this57.customBottomRange[x0]) / 2;
|
|
8260
8465
|
// }
|
|
8261
8466
|
// else {
|
|
8262
8467
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -8276,41 +8481,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8276
8481
|
var index = bisectDate(s.data, x0, 1);
|
|
8277
8482
|
var pointA = s.data[index - 1];
|
|
8278
8483
|
var pointB = s.data[index];
|
|
8279
|
-
if (
|
|
8484
|
+
if (_this57.options.orientation === 'horizontal') {
|
|
8280
8485
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
8281
8486
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
8282
8487
|
}
|
|
8283
8488
|
if (pointA && !pointB) {
|
|
8284
|
-
xPoint =
|
|
8489
|
+
xPoint = _this57[xAxis](_this57.parseX(pointA.x.value));
|
|
8285
8490
|
tooltipTitle = pointA.x.value;
|
|
8286
8491
|
if (!pointA.y.color) {
|
|
8287
8492
|
pointA.y.color = s.color;
|
|
8288
8493
|
}
|
|
8289
8494
|
tooltipData.push(pointA);
|
|
8290
8495
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
8291
|
-
tooltipTitle = d3.timeFormat(
|
|
8496
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
8292
8497
|
}
|
|
8293
8498
|
}
|
|
8294
8499
|
if (pointB && !pointA) {
|
|
8295
|
-
xPoint =
|
|
8500
|
+
xPoint = _this57[xAxis](_this57.parseX(pointB.x.value));
|
|
8296
8501
|
tooltipTitle = pointB.x.value;
|
|
8297
8502
|
if (!pointB.y.color) {
|
|
8298
8503
|
pointB.y.color = s.color;
|
|
8299
8504
|
}
|
|
8300
8505
|
tooltipData.push(pointB);
|
|
8301
8506
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8302
|
-
tooltipTitle = d3.timeFormat(
|
|
8507
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8303
8508
|
}
|
|
8304
8509
|
}
|
|
8305
8510
|
if (pointA && pointB) {
|
|
8306
|
-
var d0 =
|
|
8307
|
-
var d1 =
|
|
8511
|
+
var d0 = _this57[xAxis](_this57.parseX(pointA.x.value));
|
|
8512
|
+
var d1 = _this57[xAxis](_this57.parseX(pointB.x.value));
|
|
8308
8513
|
var mid = Math.abs(d0 - d1) / 2;
|
|
8309
8514
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
8310
8515
|
xPoint = d1;
|
|
8311
8516
|
tooltipTitle = pointB.x.value;
|
|
8312
8517
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8313
|
-
tooltipTitle = d3.timeFormat(
|
|
8518
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8314
8519
|
}
|
|
8315
8520
|
if (!pointB.y.color) {
|
|
8316
8521
|
pointB.y.color = s.color;
|
|
@@ -8320,7 +8525,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8320
8525
|
xPoint = d0;
|
|
8321
8526
|
tooltipTitle = pointA.x.value;
|
|
8322
8527
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
8323
|
-
tooltipTitle = d3.timeFormat(
|
|
8528
|
+
tooltipTitle = d3.timeFormat(_this57.options.dateFormat || _this57.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
8324
8529
|
}
|
|
8325
8530
|
if (!pointA.y.color) {
|
|
8326
8531
|
pointA.y.color = s.color;
|
|
@@ -8446,7 +8651,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8446
8651
|
}, {
|
|
8447
8652
|
key: "render",
|
|
8448
8653
|
value: function render(options) {
|
|
8449
|
-
var
|
|
8654
|
+
var _this58 = this;
|
|
8450
8655
|
/* global d3 options WebsyUtils */
|
|
8451
8656
|
this._isRendered = false;
|
|
8452
8657
|
if (typeof options !== 'undefined') {
|
|
@@ -8515,7 +8720,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8515
8720
|
this.options.data.series.map(function (s, i) {
|
|
8516
8721
|
return {
|
|
8517
8722
|
value: s.label || s.key,
|
|
8518
|
-
color: s.color ||
|
|
8723
|
+
color: s.color || _this58.options.colors[i % _this58.options.colors.length]
|
|
8519
8724
|
};
|
|
8520
8725
|
});
|
|
8521
8726
|
}
|
|
@@ -8872,25 +9077,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8872
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') {
|
|
8873
9078
|
var acc = 0;
|
|
8874
9079
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8875
|
-
var adjustment =
|
|
9080
|
+
var adjustment = _this58.bandPadding * index + _this58.bandPadding;
|
|
8876
9081
|
// if (this.options.data.bottom.padding) {
|
|
8877
9082
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8878
9083
|
// }
|
|
8879
|
-
var start =
|
|
9084
|
+
var start = _this58.widthForCalc / noOfPoints * acc;
|
|
8880
9085
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8881
9086
|
var pos = i * proposedBandWidth;
|
|
8882
|
-
|
|
9087
|
+
_this58["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8883
9088
|
}
|
|
8884
|
-
acc +=
|
|
8885
|
-
var end =
|
|
9089
|
+
acc += _this58.options.grouping !== 'stacked' && _this58.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
9090
|
+
var end = _this58.widthForCalc / noOfPoints * acc;
|
|
8886
9091
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8887
9092
|
return end + adjustment;
|
|
8888
9093
|
})));
|
|
8889
9094
|
acc = 0;
|
|
8890
9095
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8891
|
-
var adjustment =
|
|
8892
|
-
acc +=
|
|
8893
|
-
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;
|
|
8894
9099
|
})));
|
|
8895
9100
|
}
|
|
8896
9101
|
// }
|
|
@@ -9063,7 +9268,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9063
9268
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
9064
9269
|
if (this.options.data.bottom.formatter) {
|
|
9065
9270
|
this.bAxisFunc.tickFormat(function (d) {
|
|
9066
|
-
return
|
|
9271
|
+
return _this58.options.data.bottom.formatter(d);
|
|
9067
9272
|
});
|
|
9068
9273
|
}
|
|
9069
9274
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -9073,7 +9278,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9073
9278
|
}
|
|
9074
9279
|
if (this.customBottomRange.length > 0) {
|
|
9075
9280
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9076
|
-
return "translate(".concat(
|
|
9281
|
+
return "translate(".concat(_this58.customBottomRange[i] + (_this58.customBottomRange[i + 1] - _this58.customBottomRange[i]) / 2, ", 0)");
|
|
9077
9282
|
});
|
|
9078
9283
|
}
|
|
9079
9284
|
}
|
|
@@ -9092,14 +9297,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9092
9297
|
}
|
|
9093
9298
|
if (this.options.margin.axisLeft > 0) {
|
|
9094
9299
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
9095
|
-
if (
|
|
9096
|
-
d =
|
|
9300
|
+
if (_this58.options.data.left.formatter) {
|
|
9301
|
+
d = _this58.options.data.left.formatter(d);
|
|
9097
9302
|
}
|
|
9098
9303
|
return d;
|
|
9099
9304
|
}));
|
|
9100
9305
|
if (this.customLeftRange.length > 0) {
|
|
9101
9306
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
9102
|
-
return "translate(0, ".concat(
|
|
9307
|
+
return "translate(0, ".concat(_this58.customLeftRange[i] + (_this58.customLeftRange[i + 1] - _this58.customLeftRange[i]) / 2, ")");
|
|
9103
9308
|
});
|
|
9104
9309
|
}
|
|
9105
9310
|
}
|
|
@@ -9127,8 +9332,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9127
9332
|
}
|
|
9128
9333
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
9129
9334
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
9130
|
-
if (
|
|
9131
|
-
d =
|
|
9335
|
+
if (_this58.options.data.right.formatter) {
|
|
9336
|
+
d = _this58.options.data.right.formatter(d);
|
|
9132
9337
|
}
|
|
9133
9338
|
return d;
|
|
9134
9339
|
}));
|
|
@@ -9168,25 +9373,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9168
9373
|
}, {
|
|
9169
9374
|
key: "renderComponents",
|
|
9170
9375
|
value: function renderComponents() {
|
|
9171
|
-
var
|
|
9376
|
+
var _this59 = this;
|
|
9172
9377
|
// Draw the series data
|
|
9173
9378
|
this.renderedKeys = {};
|
|
9174
9379
|
this.options.data.series.forEach(function (series, index) {
|
|
9175
9380
|
if (!series.key) {
|
|
9176
|
-
series.key =
|
|
9381
|
+
series.key = _this59.createIdentity();
|
|
9177
9382
|
}
|
|
9178
9383
|
if (!series.color) {
|
|
9179
|
-
series.color =
|
|
9384
|
+
series.color = _this59.options.colors[index % _this59.options.colors.length];
|
|
9180
9385
|
}
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9386
|
+
_this59["render".concat(series.type || 'bar')](series, index);
|
|
9387
|
+
_this59.renderLabels(series, index);
|
|
9388
|
+
_this59.renderedKeys[series.key] = series.type;
|
|
9184
9389
|
});
|
|
9185
9390
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
9186
9391
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
9187
9392
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
9188
9393
|
this.options.refLines.forEach(function (l) {
|
|
9189
|
-
return
|
|
9394
|
+
return _this59.renderRefLine(l);
|
|
9190
9395
|
});
|
|
9191
9396
|
}
|
|
9192
9397
|
this._isRendered = true;
|
|
@@ -9194,25 +9399,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9194
9399
|
}, {
|
|
9195
9400
|
key: "renderarea",
|
|
9196
9401
|
value: function renderarea(series, index) {
|
|
9197
|
-
var
|
|
9402
|
+
var _this60 = this;
|
|
9198
9403
|
/* global d3 series index */
|
|
9199
9404
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
9200
9405
|
return d3.area().x(function (d) {
|
|
9201
|
-
if (
|
|
9202
|
-
return
|
|
9406
|
+
if (_this60.options.data[xAxis].scale === 'Time') {
|
|
9407
|
+
return _this60["".concat(xAxis, "Axis")](_this60.parseX(d.x.value));
|
|
9203
9408
|
} else {
|
|
9204
|
-
var xIndex =
|
|
9205
|
-
var xPos =
|
|
9206
|
-
if (
|
|
9207
|
-
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;
|
|
9208
9413
|
}
|
|
9209
9414
|
return xPos;
|
|
9210
9415
|
}
|
|
9211
9416
|
}).y0(function (d) {
|
|
9212
|
-
return
|
|
9417
|
+
return _this60["".concat(yAxis, "Axis")](0);
|
|
9213
9418
|
}).y1(function (d) {
|
|
9214
|
-
return
|
|
9215
|
-
}).curve(d3[curveStyle ||
|
|
9419
|
+
return _this60["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9420
|
+
}).curve(d3[curveStyle || _this60.options.curveStyle]);
|
|
9216
9421
|
};
|
|
9217
9422
|
var xAxis = 'bottom';
|
|
9218
9423
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9252,7 +9457,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9252
9457
|
}, {
|
|
9253
9458
|
key: "renderbar",
|
|
9254
9459
|
value: function renderbar(series, index) {
|
|
9255
|
-
var
|
|
9460
|
+
var _this61 = this;
|
|
9256
9461
|
/* global series index d3 */
|
|
9257
9462
|
var xAxis = 'bottom';
|
|
9258
9463
|
var yAxis = 'left';
|
|
@@ -9419,26 +9624,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9419
9624
|
}
|
|
9420
9625
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9421
9626
|
bars.attr('width', function (d, i) {
|
|
9422
|
-
return Math.abs(getBarWidth.call(
|
|
9627
|
+
return Math.abs(getBarWidth.call(_this61, d, i, yAxis, xAxis));
|
|
9423
9628
|
}).attr('height', function (d, i) {
|
|
9424
|
-
return getBarHeight.call(
|
|
9629
|
+
return getBarHeight.call(_this61, d, i, yAxis, xAxis);
|
|
9425
9630
|
}).attr('x', function (d, i) {
|
|
9426
|
-
return getBarX.call(
|
|
9631
|
+
return getBarX.call(_this61, d, i, yAxis, xAxis);
|
|
9427
9632
|
}).attr('y', function (d, i) {
|
|
9428
|
-
return getBarY.call(
|
|
9633
|
+
return getBarY.call(_this61, d, i, yAxis, xAxis);
|
|
9429
9634
|
})
|
|
9430
9635
|
// .transition(this.transition)
|
|
9431
9636
|
.attr('fill', function (d) {
|
|
9432
9637
|
return d.y.color || d.color || series.color;
|
|
9433
9638
|
});
|
|
9434
9639
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
9435
|
-
return Math.abs(getBarWidth.call(
|
|
9640
|
+
return Math.abs(getBarWidth.call(_this61, d, i, yAxis, xAxis));
|
|
9436
9641
|
}).attr('height', function (d, i) {
|
|
9437
|
-
return getBarHeight.call(
|
|
9642
|
+
return getBarHeight.call(_this61, d, i, yAxis, xAxis);
|
|
9438
9643
|
}).attr('x', function (d, i) {
|
|
9439
|
-
return getBarX.call(
|
|
9644
|
+
return getBarX.call(_this61, d, i, yAxis, xAxis);
|
|
9440
9645
|
}).attr('y', function (d, i) {
|
|
9441
|
-
return getBarY.call(
|
|
9646
|
+
return getBarY.call(_this61, d, i, yAxis, xAxis);
|
|
9442
9647
|
})
|
|
9443
9648
|
// .transition(this.transition)
|
|
9444
9649
|
.attr('fill', function (d) {
|
|
@@ -9450,26 +9655,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9450
9655
|
this.brushBarsInitialized[series.key] = true;
|
|
9451
9656
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
9452
9657
|
brushBars.attr('width', function (d, i) {
|
|
9453
|
-
return Math.abs(getBarWidth.call(
|
|
9658
|
+
return Math.abs(getBarWidth.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9454
9659
|
}).attr('height', function (d, i) {
|
|
9455
|
-
return getBarHeight.call(
|
|
9660
|
+
return getBarHeight.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9456
9661
|
}).attr('x', function (d, i) {
|
|
9457
|
-
return getBarX.call(
|
|
9662
|
+
return getBarX.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9458
9663
|
}).attr('y', function (d, i) {
|
|
9459
|
-
return getBarY.call(
|
|
9664
|
+
return getBarY.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9460
9665
|
})
|
|
9461
9666
|
// .transition(this.transition)
|
|
9462
9667
|
.attr('fill', function (d) {
|
|
9463
9668
|
return d.y.color || d.color || series.color;
|
|
9464
9669
|
});
|
|
9465
9670
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
9466
|
-
return Math.abs(getBarWidth.call(
|
|
9671
|
+
return Math.abs(getBarWidth.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
9467
9672
|
}).attr('height', function (d, i) {
|
|
9468
|
-
return getBarHeight.call(
|
|
9673
|
+
return getBarHeight.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9469
9674
|
}).attr('x', function (d, i) {
|
|
9470
|
-
return getBarX.call(
|
|
9675
|
+
return getBarX.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9471
9676
|
}).attr('y', function (d, i) {
|
|
9472
|
-
return getBarY.call(
|
|
9677
|
+
return getBarY.call(_this61, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
9473
9678
|
})
|
|
9474
9679
|
// .transition(this.transition)
|
|
9475
9680
|
.attr('fill', function (d) {
|
|
@@ -9490,7 +9695,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9490
9695
|
}, {
|
|
9491
9696
|
key: "renderLabels",
|
|
9492
9697
|
value: function renderLabels(series, index) {
|
|
9493
|
-
var
|
|
9698
|
+
var _this62 = this;
|
|
9494
9699
|
/* global series index d3 WebsyDesigns */
|
|
9495
9700
|
var xAxis = 'bottom';
|
|
9496
9701
|
var yAxis = 'left';
|
|
@@ -9506,14 +9711,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9506
9711
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9507
9712
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9508
9713
|
labels.attr('x', function (d) {
|
|
9509
|
-
return getLabelX.call(
|
|
9714
|
+
return getLabelX.call(_this62, d, series.labelPosition);
|
|
9510
9715
|
}).attr('y', function (d) {
|
|
9511
|
-
return getLabelY.call(
|
|
9716
|
+
return getLabelY.call(_this62, d, series.labelPosition);
|
|
9512
9717
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9513
|
-
if (
|
|
9718
|
+
if (_this62.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9514
9719
|
return 'transparent';
|
|
9515
9720
|
}
|
|
9516
|
-
return
|
|
9721
|
+
return _this62.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9517
9722
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9518
9723
|
return d.y.label || d.y.value;
|
|
9519
9724
|
}).each(function (d, i) {
|
|
@@ -9547,14 +9752,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9547
9752
|
}
|
|
9548
9753
|
});
|
|
9549
9754
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9550
|
-
return getLabelX.call(
|
|
9755
|
+
return getLabelX.call(_this62, d, series.labelPosition);
|
|
9551
9756
|
}).attr('y', function (d) {
|
|
9552
|
-
return getLabelY.call(
|
|
9757
|
+
return getLabelY.call(_this62, d, series.labelPosition);
|
|
9553
9758
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9554
|
-
if (
|
|
9759
|
+
if (_this62.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9555
9760
|
return 'transparent';
|
|
9556
9761
|
}
|
|
9557
|
-
return
|
|
9762
|
+
return _this62.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9558
9763
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9559
9764
|
return d.y.label || d.y.value;
|
|
9560
9765
|
}).each(function (d, i) {
|
|
@@ -9632,32 +9837,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9632
9837
|
}, {
|
|
9633
9838
|
key: "renderline",
|
|
9634
9839
|
value: function renderline(series, index) {
|
|
9635
|
-
var
|
|
9840
|
+
var _this63 = this;
|
|
9636
9841
|
/* global series index d3 */
|
|
9637
9842
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9638
9843
|
return d3.line().x(function (d) {
|
|
9639
|
-
if (
|
|
9640
|
-
return
|
|
9844
|
+
if (_this63.options.orientation === 'horizontal') {
|
|
9845
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9641
9846
|
} else {
|
|
9642
|
-
if (
|
|
9643
|
-
return
|
|
9847
|
+
if (_this63.options.data[xAxis].scale === 'Time') {
|
|
9848
|
+
return _this63["".concat(xAxis, "Axis")](_this63.parseX(d.x.value));
|
|
9644
9849
|
} else {
|
|
9645
|
-
var xIndex =
|
|
9646
|
-
var xPos =
|
|
9647
|
-
if (
|
|
9648
|
-
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;
|
|
9649
9854
|
}
|
|
9650
9855
|
return xPos;
|
|
9651
9856
|
}
|
|
9652
9857
|
}
|
|
9653
9858
|
}).y(function (d) {
|
|
9654
|
-
if (
|
|
9655
|
-
var adjustment =
|
|
9656
|
-
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;
|
|
9657
9862
|
} else {
|
|
9658
|
-
return
|
|
9863
|
+
return _this63["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9659
9864
|
}
|
|
9660
|
-
}).curve(d3[curveStyle ||
|
|
9865
|
+
}).curve(d3[curveStyle || _this63.options.curveStyle]);
|
|
9661
9866
|
};
|
|
9662
9867
|
var xAxis = 'bottom';
|
|
9663
9868
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9766,14 +9971,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9766
9971
|
}, {
|
|
9767
9972
|
key: "rendersymbol",
|
|
9768
9973
|
value: function rendersymbol(series, index) {
|
|
9769
|
-
var
|
|
9974
|
+
var _this64 = this;
|
|
9770
9975
|
/* global d3 series index series.key */
|
|
9771
9976
|
var drawSymbol = function drawSymbol(size) {
|
|
9772
9977
|
return d3.symbol()
|
|
9773
9978
|
// .type(d => {
|
|
9774
9979
|
// return d3.symbols[0]
|
|
9775
9980
|
// })
|
|
9776
|
-
.size(size ||
|
|
9981
|
+
.size(size || _this64.options.symbolSize);
|
|
9777
9982
|
};
|
|
9778
9983
|
var xAxis = 'bottom';
|
|
9779
9984
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9799,27 +10004,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9799
10004
|
// else {
|
|
9800
10005
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9801
10006
|
// }
|
|
9802
|
-
var xIndex =
|
|
9803
|
-
var xPos =
|
|
9804
|
-
if (
|
|
9805
|
-
xPos = xPos + (
|
|
9806
|
-
}
|
|
9807
|
-
var adjustment =
|
|
9808
|
-
if (
|
|
9809
|
-
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, ")");
|
|
9810
10015
|
} else {
|
|
9811
|
-
if (
|
|
9812
|
-
xPos =
|
|
10016
|
+
if (_this64.options.data[xAxis].scale === 'Time') {
|
|
10017
|
+
xPos = _this64["".concat(xAxis, "Axis")](_this64.parseX(d.x.value));
|
|
9813
10018
|
} else {
|
|
9814
|
-
var _xIndex =
|
|
9815
|
-
var _xPos =
|
|
9816
|
-
if (
|
|
9817
|
-
_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;
|
|
9818
10023
|
}
|
|
9819
10024
|
// return xPos
|
|
9820
10025
|
}
|
|
9821
10026
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9822
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10027
|
+
return "translate(".concat(xPos, ", ").concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9823
10028
|
}
|
|
9824
10029
|
});
|
|
9825
10030
|
// Enter
|
|
@@ -9834,27 +10039,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9834
10039
|
}).attr('class', function (d) {
|
|
9835
10040
|
return "symbol symbol_".concat(series.key);
|
|
9836
10041
|
}).attr('transform', function (d) {
|
|
9837
|
-
var xIndex =
|
|
9838
|
-
var xPos =
|
|
9839
|
-
if (
|
|
9840
|
-
xPos = xPos + (
|
|
9841
|
-
}
|
|
9842
|
-
var adjustment =
|
|
9843
|
-
if (
|
|
9844
|
-
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, ")");
|
|
9845
10050
|
} else {
|
|
9846
|
-
if (
|
|
9847
|
-
xPos =
|
|
10051
|
+
if (_this64.options.data[xAxis].scale === 'Time') {
|
|
10052
|
+
xPos = _this64["".concat(xAxis, "Axis")](_this64.parseX(d.x.value));
|
|
9848
10053
|
} else {
|
|
9849
|
-
var _xIndex2 =
|
|
9850
|
-
var _xPos2 =
|
|
9851
|
-
if (
|
|
9852
|
-
_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;
|
|
9853
10058
|
}
|
|
9854
10059
|
// return xPos
|
|
9855
10060
|
}
|
|
9856
10061
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9857
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
10062
|
+
return "translate(".concat(xPos, ", ").concat(_this64["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9858
10063
|
}
|
|
9859
10064
|
});
|
|
9860
10065
|
}
|
|
@@ -10477,7 +10682,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10477
10682
|
}, {
|
|
10478
10683
|
key: "resize",
|
|
10479
10684
|
value: function resize() {
|
|
10480
|
-
var
|
|
10685
|
+
var _this65 = this;
|
|
10481
10686
|
var el = document.getElementById(this.elementId);
|
|
10482
10687
|
if (el) {
|
|
10483
10688
|
// if (this.options.width) {
|
|
@@ -10488,7 +10693,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
10488
10693
|
// }
|
|
10489
10694
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
10490
10695
|
html += this._data.map(function (d, i) {
|
|
10491
|
-
return
|
|
10696
|
+
return _this65.getLegendItemHTML(d);
|
|
10492
10697
|
}).join('');
|
|
10493
10698
|
html += "\n <div>\n ";
|
|
10494
10699
|
el.innerHTML = html;
|
|
@@ -10646,7 +10851,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10646
10851
|
}, {
|
|
10647
10852
|
key: "render",
|
|
10648
10853
|
value: function render() {
|
|
10649
|
-
var
|
|
10854
|
+
var _this66 = this;
|
|
10650
10855
|
this._isRendered = false;
|
|
10651
10856
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
10652
10857
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -10654,7 +10859,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10654
10859
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
10655
10860
|
return {
|
|
10656
10861
|
value: s.label || s.key,
|
|
10657
|
-
color: s.color ||
|
|
10862
|
+
color: s.color || _this66.options.colors[i % _this66.options.colors.length]
|
|
10658
10863
|
};
|
|
10659
10864
|
});
|
|
10660
10865
|
var longestValue = legendData.map(function (s) {
|
|
@@ -10708,7 +10913,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10708
10913
|
}
|
|
10709
10914
|
if (this.polygons) {
|
|
10710
10915
|
this.polygons.forEach(function (p) {
|
|
10711
|
-
return
|
|
10916
|
+
return _this66.map.removeLayer(p);
|
|
10712
10917
|
});
|
|
10713
10918
|
}
|
|
10714
10919
|
this.polygons = [];
|
|
@@ -10762,15 +10967,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
10762
10967
|
p.options = {};
|
|
10763
10968
|
}
|
|
10764
10969
|
if (!p.options.color) {
|
|
10765
|
-
p.options.color =
|
|
10970
|
+
p.options.color = _this66.options.colors[i % _this66.options.colors.length];
|
|
10766
10971
|
}
|
|
10767
10972
|
var pol = L.polygon(p.data.map(function (c) {
|
|
10768
10973
|
return c.map(function (d) {
|
|
10769
10974
|
return [d.Latitude, d.Longitude];
|
|
10770
10975
|
});
|
|
10771
|
-
}), p.options).addTo(
|
|
10772
|
-
|
|
10773
|
-
|
|
10976
|
+
}), p.options).addTo(_this66.map);
|
|
10977
|
+
_this66.polygons.push(pol);
|
|
10978
|
+
_this66.map.fitBounds(pol.getBounds());
|
|
10774
10979
|
});
|
|
10775
10980
|
}
|
|
10776
10981
|
// if (this.data.markers.length > 0) {
|
|
@@ -10884,6 +11089,7 @@ var WebsyDesigns = {
|
|
|
10884
11089
|
DatePicker: WebsyDatePicker,
|
|
10885
11090
|
WebsyDropdown: WebsyDropdown,
|
|
10886
11091
|
Dropdown: WebsyDropdown,
|
|
11092
|
+
MediaUpload: MediaUpload,
|
|
10887
11093
|
WebsyResultList: WebsyResultList,
|
|
10888
11094
|
ResultList: WebsyResultList,
|
|
10889
11095
|
WebsyTemplate: WebsyTemplate,
|