@websy/websy-designs 1.9.7 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/websy-designs-es6.debug.js +200 -8
- package/dist/websy-designs-es6.js +437 -257
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +200 -8
- package/dist/websy-designs.js +440 -260
- 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
|
@@ -20,6 +20,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
20
20
|
WebsyNavigationMenu
|
|
21
21
|
WebsyPubSub
|
|
22
22
|
WebsyForm
|
|
23
|
+
MultiForm
|
|
23
24
|
WebsyDatePicker
|
|
24
25
|
WebsyDropdown
|
|
25
26
|
WebsyRouter
|
|
@@ -2359,6 +2360,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2359
2360
|
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2360
2361
|
this.validateField(this.options.fields[index], event.target.value);
|
|
2361
2362
|
}
|
|
2363
|
+
if (this.options.fields[index].onChange) {
|
|
2364
|
+
this.options.fields[index].onChange({
|
|
2365
|
+
value: event.target.value,
|
|
2366
|
+
field: this.options.fields[index],
|
|
2367
|
+
form: this,
|
|
2368
|
+
index: index
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2362
2371
|
}
|
|
2363
2372
|
}
|
|
2364
2373
|
}, {
|
|
@@ -2380,6 +2389,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2380
2389
|
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2381
2390
|
this.validateField(this.options.fields[index], event.target.value);
|
|
2382
2391
|
}
|
|
2392
|
+
if (this.options.fields[index].onLeave) {
|
|
2393
|
+
this.options.fields[index].onLeave({
|
|
2394
|
+
value: event.target.value,
|
|
2395
|
+
field: this.options.fields[index],
|
|
2396
|
+
form: this,
|
|
2397
|
+
index: index
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2383
2400
|
}
|
|
2384
2401
|
}
|
|
2385
2402
|
}, {
|
|
@@ -2545,11 +2562,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2545
2562
|
_this19.fieldMap[f.field] = f;
|
|
2546
2563
|
if (f.component) {
|
|
2547
2564
|
componentsToProcess.push(f);
|
|
2548
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' 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(_this19.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2565
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2549
2566
|
} else if (f.type === 'longtext') {
|
|
2550
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' 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(_this19.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 ></textarea>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2567
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.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 ></textarea>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2551
2568
|
} else {
|
|
2552
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' 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(_this19.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(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2569
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.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(_this19.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(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2553
2570
|
}
|
|
2554
2571
|
});
|
|
2555
2572
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2715,6 +2732,147 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2715
2732
|
}]);
|
|
2716
2733
|
return WebsyForm;
|
|
2717
2734
|
}();
|
|
2735
|
+
/*
|
|
2736
|
+
global
|
|
2737
|
+
WebsyDesigns
|
|
2738
|
+
*/
|
|
2739
|
+
var MultiForm = /*#__PURE__*/function () {
|
|
2740
|
+
function MultiForm(elementId, options) {
|
|
2741
|
+
_classCallCheck(this, MultiForm);
|
|
2742
|
+
this.elementId = elementId;
|
|
2743
|
+
var DEFAULTS = {
|
|
2744
|
+
addButton: "<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>",
|
|
2745
|
+
deleteButton: "<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>"
|
|
2746
|
+
};
|
|
2747
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2748
|
+
this.formData = [];
|
|
2749
|
+
this.forms = [];
|
|
2750
|
+
this.recordsToDelete = [];
|
|
2751
|
+
var el = document.getElementById(elementId);
|
|
2752
|
+
if (el) {
|
|
2753
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
2754
|
+
el.innerHTML = "<div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>");
|
|
2755
|
+
}
|
|
2756
|
+
this.render();
|
|
2757
|
+
}
|
|
2758
|
+
_createClass(MultiForm, [{
|
|
2759
|
+
key: "addEntry",
|
|
2760
|
+
value: function addEntry() {
|
|
2761
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2762
|
+
var newId = WebsyDesigns.Utils.createIdentity();
|
|
2763
|
+
var newFormEl = document.createElement('div');
|
|
2764
|
+
newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
|
|
2765
|
+
newFormEl.classList.add('websy-multi-form-form-container');
|
|
2766
|
+
newFormEl.innerHTML = "\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='hidden websy-multi-form-delete'>\n ").concat(this.options.deleteButton, "\n </button> \n <button id='").concat(this.elementId, "_").concat(newId, "_addButton' data-formid='").concat(newId, "' class='websy-multi-form-add'>\n ").concat(this.options.addButton, "\n </button> \n ");
|
|
2767
|
+
el.appendChild(newFormEl);
|
|
2768
|
+
var formOptions = _extends({}, this.options);
|
|
2769
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
2770
|
+
}
|
|
2771
|
+
}, {
|
|
2772
|
+
key: "clear",
|
|
2773
|
+
value: function clear() {
|
|
2774
|
+
this.formData = [];
|
|
2775
|
+
this.forms = [];
|
|
2776
|
+
this.recordsToDelete = [];
|
|
2777
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2778
|
+
if (el) {
|
|
2779
|
+
el.innerHTML = '';
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
}, {
|
|
2783
|
+
key: "data",
|
|
2784
|
+
get: function get() {
|
|
2785
|
+
var d = this.forms.map(function (f) {
|
|
2786
|
+
return f.data;
|
|
2787
|
+
});
|
|
2788
|
+
// we don't return the last form
|
|
2789
|
+
d.pop();
|
|
2790
|
+
return d;
|
|
2791
|
+
},
|
|
2792
|
+
set: function set(d) {
|
|
2793
|
+
this.formData = d;
|
|
2794
|
+
this.render();
|
|
2795
|
+
}
|
|
2796
|
+
}, {
|
|
2797
|
+
key: "handleClick",
|
|
2798
|
+
value: function handleClick(event) {
|
|
2799
|
+
if (event.target.classList.contains('websy-multi-form-add')) {
|
|
2800
|
+
var id = event.target.getAttribute('data-formid');
|
|
2801
|
+
// hide add button and show delete button
|
|
2802
|
+
var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
|
|
2803
|
+
if (addButtonEl) {
|
|
2804
|
+
addButtonEl.classList.add('hidden');
|
|
2805
|
+
}
|
|
2806
|
+
var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
|
|
2807
|
+
if (deleteButtonEl) {
|
|
2808
|
+
deleteButtonEl.classList.remove('hidden');
|
|
2809
|
+
}
|
|
2810
|
+
// add new form
|
|
2811
|
+
this.addEntry();
|
|
2812
|
+
}
|
|
2813
|
+
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2814
|
+
// delete form based on index
|
|
2815
|
+
var _id = event.target.getAttribute('data-formid');
|
|
2816
|
+
var rowId = event.target.getAttribute('data-rowid');
|
|
2817
|
+
this.recordsToDelete.push(rowId);
|
|
2818
|
+
var indexToDelete = -1;
|
|
2819
|
+
for (var i = 0; i < this.forms.length; i++) {
|
|
2820
|
+
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(_id, "_form")) {
|
|
2821
|
+
indexToDelete = i;
|
|
2822
|
+
break;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (indexToDelete !== -1) {
|
|
2826
|
+
this.forms.splice(indexToDelete, 1);
|
|
2827
|
+
}
|
|
2828
|
+
var el = document.getElementById("".concat(this.elementId, "_").concat(_id, "_formContainer"));
|
|
2829
|
+
if (el) {
|
|
2830
|
+
el.remove();
|
|
2831
|
+
}
|
|
2832
|
+
// delete form element based on id
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
}, {
|
|
2836
|
+
key: "render",
|
|
2837
|
+
value: function render() {
|
|
2838
|
+
var _this21 = this;
|
|
2839
|
+
this.forms = [];
|
|
2840
|
+
this.recordsToDelete = [];
|
|
2841
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2842
|
+
if (el) {
|
|
2843
|
+
var html = '';
|
|
2844
|
+
this.formData.forEach(function (d) {
|
|
2845
|
+
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2846
|
+
html += "\n <div id='".concat(_this21.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this21.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(_this21.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this21.options.deleteButton, "\n </button> \n </div>\n ");
|
|
2847
|
+
});
|
|
2848
|
+
var id = WebsyDesigns.Utils.createIdentity();
|
|
2849
|
+
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 ");
|
|
2850
|
+
el.innerHTML = html;
|
|
2851
|
+
this.formData.forEach(function (d) {
|
|
2852
|
+
var formOptions = _extends({}, _this21.options);
|
|
2853
|
+
var formObject = new WebsyDesigns.Form("".concat(_this21.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
2854
|
+
formObject.data = d;
|
|
2855
|
+
_this21.forms.push(formObject);
|
|
2856
|
+
});
|
|
2857
|
+
var formOptions = _extends({}, this.options);
|
|
2858
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions));
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}, {
|
|
2862
|
+
key: "validateForm",
|
|
2863
|
+
value: function validateForm() {
|
|
2864
|
+
// we don't validate the last form
|
|
2865
|
+
for (var i = 0; i < this.forms.length - 1; i++) {
|
|
2866
|
+
var valid = this.forms[i].validateForm();
|
|
2867
|
+
if (!valid) {
|
|
2868
|
+
return false;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
return true;
|
|
2872
|
+
}
|
|
2873
|
+
}]);
|
|
2874
|
+
return MultiForm;
|
|
2875
|
+
}();
|
|
2718
2876
|
/* global include */
|
|
2719
2877
|
var WebsyIcons = {
|
|
2720
2878
|
'search-icon': "\n <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 500 500\" xml:space=\"preserve\">\n<path d=\"M481.4,468.6c-17.2-17.2-34.4-34.4-51.6-51.6c-27.4-27.4-54.8-54.8-82.2-82.2c-4.8-4.8-9.5-9.5-14.3-14.3\n\tc29.4-32.5,47.4-75.5,47.4-122.7C380.7,97,298.7,15,197.9,15S15,97,15,197.9s82,182.9,182.9,182.9c47.2,0,90.3-18,122.7-47.4\n\tc15.7,15.7,31.4,31.4,47.1,47.1c27.4,27.4,54.8,54.8,82.2,82.2c6.3,6.3,12.5,12.5,18.8,18.8C476.8,489.6,489.6,476.8,481.4,468.6z\n\t M35,197.9C35,108.1,108.1,35,197.9,35s162.9,73.1,162.9,162.9s-73.1,162.9-162.9,162.9S35,287.7,35,197.9z\"/>\n</svg>\n\n ",
|
|
@@ -2984,7 +3142,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2984
3142
|
}, {
|
|
2985
3143
|
key: "handleSearch",
|
|
2986
3144
|
value: function handleSearch(searchText) {
|
|
2987
|
-
var
|
|
3145
|
+
var _this22 = this;
|
|
2988
3146
|
var el = document.getElementById(this.elementId);
|
|
2989
3147
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
2990
3148
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -2995,7 +3153,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2995
3153
|
if (searchText && searchText.length > 1) {
|
|
2996
3154
|
defaultMethod = 'add';
|
|
2997
3155
|
visibleItems = lowestItems.filter(function (d) {
|
|
2998
|
-
return d[
|
|
3156
|
+
return d[_this22.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2999
3157
|
});
|
|
3000
3158
|
}
|
|
3001
3159
|
// hide everything
|
|
@@ -3177,7 +3335,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3177
3335
|
/* global WebsyDesigns */
|
|
3178
3336
|
var Pager = /*#__PURE__*/function () {
|
|
3179
3337
|
function Pager(elementId, options) {
|
|
3180
|
-
var
|
|
3338
|
+
var _this23 = this;
|
|
3181
3339
|
_classCallCheck(this, Pager);
|
|
3182
3340
|
this.elementId = elementId;
|
|
3183
3341
|
var DEFAULTS = {
|
|
@@ -3224,8 +3382,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3224
3382
|
allowClear: false,
|
|
3225
3383
|
disableSearch: true,
|
|
3226
3384
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3227
|
-
if (
|
|
3228
|
-
|
|
3385
|
+
if (_this23.options.onChangePageSize) {
|
|
3386
|
+
_this23.options.onChangePageSize(selectedItem.value);
|
|
3229
3387
|
}
|
|
3230
3388
|
}
|
|
3231
3389
|
});
|
|
@@ -3246,11 +3404,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3246
3404
|
}, {
|
|
3247
3405
|
key: "render",
|
|
3248
3406
|
value: function render() {
|
|
3249
|
-
var
|
|
3407
|
+
var _this24 = this;
|
|
3250
3408
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3251
3409
|
if (el) {
|
|
3252
3410
|
var pages = this.options.pages.map(function (item, index) {
|
|
3253
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3411
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this24.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3254
3412
|
});
|
|
3255
3413
|
var startIndex = 0;
|
|
3256
3414
|
if (this.options.pages.length > 8) {
|
|
@@ -3308,48 +3466,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3308
3466
|
_createClass(WebsyPDFButton, [{
|
|
3309
3467
|
key: "handleClick",
|
|
3310
3468
|
value: function handleClick(event) {
|
|
3311
|
-
var
|
|
3469
|
+
var _this25 = this;
|
|
3312
3470
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3313
3471
|
this.loader.show();
|
|
3314
3472
|
setTimeout(function () {
|
|
3315
|
-
if (
|
|
3316
|
-
var el = document.getElementById(
|
|
3473
|
+
if (_this25.options.targetId) {
|
|
3474
|
+
var el = document.getElementById(_this25.options.targetId);
|
|
3317
3475
|
if (el) {
|
|
3318
3476
|
var pdfData = {
|
|
3319
3477
|
options: {}
|
|
3320
3478
|
};
|
|
3321
|
-
if (
|
|
3322
|
-
pdfData.options = _extends({},
|
|
3479
|
+
if (_this25.options.pdfOptions) {
|
|
3480
|
+
pdfData.options = _extends({}, _this25.options.pdfOptions);
|
|
3323
3481
|
}
|
|
3324
|
-
if (
|
|
3325
|
-
if (
|
|
3326
|
-
var headerEl = document.getElementById(
|
|
3482
|
+
if (_this25.options.header) {
|
|
3483
|
+
if (_this25.options.header.elementId) {
|
|
3484
|
+
var headerEl = document.getElementById(_this25.options.header.elementId);
|
|
3327
3485
|
if (headerEl) {
|
|
3328
3486
|
pdfData.header = headerEl.outerHTML;
|
|
3329
|
-
if (
|
|
3330
|
-
pdfData.options.headerCSS =
|
|
3487
|
+
if (_this25.options.header.css) {
|
|
3488
|
+
pdfData.options.headerCSS = _this25.options.header.css;
|
|
3331
3489
|
}
|
|
3332
3490
|
}
|
|
3333
|
-
} else if (
|
|
3334
|
-
pdfData.header =
|
|
3335
|
-
if (
|
|
3336
|
-
pdfData.options.headerCSS =
|
|
3491
|
+
} else if (_this25.options.header.html) {
|
|
3492
|
+
pdfData.header = _this25.options.header.html;
|
|
3493
|
+
if (_this25.options.header.css) {
|
|
3494
|
+
pdfData.options.headerCSS = _this25.options.header.css;
|
|
3337
3495
|
}
|
|
3338
3496
|
} else {
|
|
3339
|
-
pdfData.header =
|
|
3497
|
+
pdfData.header = _this25.options.header;
|
|
3340
3498
|
}
|
|
3341
3499
|
}
|
|
3342
|
-
if (
|
|
3343
|
-
if (
|
|
3344
|
-
var footerEl = document.getElementById(
|
|
3500
|
+
if (_this25.options.footer) {
|
|
3501
|
+
if (_this25.options.footer.elementId) {
|
|
3502
|
+
var footerEl = document.getElementById(_this25.options.footer.elementId);
|
|
3345
3503
|
if (footerEl) {
|
|
3346
3504
|
pdfData.footer = footerEl.outerHTML;
|
|
3347
|
-
if (
|
|
3348
|
-
pdfData.options.footerCSS =
|
|
3505
|
+
if (_this25.options.footer.css) {
|
|
3506
|
+
pdfData.options.footerCSS = _this25.options.footer.css;
|
|
3349
3507
|
}
|
|
3350
3508
|
}
|
|
3351
3509
|
} else {
|
|
3352
|
-
pdfData.footer =
|
|
3510
|
+
pdfData.footer = _this25.options.footer;
|
|
3353
3511
|
}
|
|
3354
3512
|
}
|
|
3355
3513
|
pdfData.html = el.outerHTML;
|
|
@@ -3357,25 +3515,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3357
3515
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3358
3516
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3359
3517
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3360
|
-
|
|
3518
|
+
_this25.service.add('', pdfData, {
|
|
3361
3519
|
responseType: 'blob'
|
|
3362
3520
|
}).then(function (response) {
|
|
3363
|
-
|
|
3521
|
+
_this25.loader.hide();
|
|
3364
3522
|
var blob = new Blob([response], {
|
|
3365
3523
|
type: 'application/pdf'
|
|
3366
3524
|
});
|
|
3367
3525
|
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 ");
|
|
3368
|
-
if (
|
|
3526
|
+
if (_this25.options.directDownload === true) {
|
|
3369
3527
|
var fileName;
|
|
3370
|
-
if (typeof
|
|
3371
|
-
fileName =
|
|
3528
|
+
if (typeof _this25.options.fileName === 'function') {
|
|
3529
|
+
fileName = _this25.options.fileName() || 'Export';
|
|
3372
3530
|
} else {
|
|
3373
|
-
fileName =
|
|
3531
|
+
fileName = _this25.options.fileName || 'Export';
|
|
3374
3532
|
}
|
|
3375
3533
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3376
3534
|
}
|
|
3377
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3378
|
-
|
|
3535
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this25.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3536
|
+
_this25.popup.show({
|
|
3379
3537
|
message: msg,
|
|
3380
3538
|
mask: true
|
|
3381
3539
|
});
|
|
@@ -3543,7 +3701,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3543
3701
|
}();
|
|
3544
3702
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3545
3703
|
function ResponsiveText(elementId, options) {
|
|
3546
|
-
var
|
|
3704
|
+
var _this26 = this;
|
|
3547
3705
|
_classCallCheck(this, ResponsiveText);
|
|
3548
3706
|
var DEFAULTS = {
|
|
3549
3707
|
textAlign: 'center',
|
|
@@ -3554,7 +3712,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3554
3712
|
this.elementId = elementId;
|
|
3555
3713
|
this.canvas = document.createElement('canvas');
|
|
3556
3714
|
window.addEventListener('resize', function () {
|
|
3557
|
-
return
|
|
3715
|
+
return _this26.render();
|
|
3558
3716
|
});
|
|
3559
3717
|
var el = document.getElementById(this.elementId);
|
|
3560
3718
|
if (el) {
|
|
@@ -3744,7 +3902,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3744
3902
|
/* global WebsyDesigns */
|
|
3745
3903
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3746
3904
|
function WebsyResultList(elementId, options) {
|
|
3747
|
-
var
|
|
3905
|
+
var _this27 = this;
|
|
3748
3906
|
_classCallCheck(this, WebsyResultList);
|
|
3749
3907
|
var DEFAULTS = {
|
|
3750
3908
|
listeners: {
|
|
@@ -3770,8 +3928,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3770
3928
|
}
|
|
3771
3929
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3772
3930
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3773
|
-
|
|
3774
|
-
|
|
3931
|
+
_this27.options.template = templateString;
|
|
3932
|
+
_this27.render();
|
|
3775
3933
|
});
|
|
3776
3934
|
} else {
|
|
3777
3935
|
this.render();
|
|
@@ -3790,7 +3948,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3790
3948
|
}, {
|
|
3791
3949
|
key: "buildHTML",
|
|
3792
3950
|
value: function buildHTML(d) {
|
|
3793
|
-
var
|
|
3951
|
+
var _this28 = this;
|
|
3794
3952
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3795
3953
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3796
3954
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -3798,7 +3956,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3798
3956
|
if (this.options.template) {
|
|
3799
3957
|
if (d.length > 0) {
|
|
3800
3958
|
d.forEach(function (row, ix) {
|
|
3801
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3959
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this28.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3802
3960
|
// find conditional elements
|
|
3803
3961
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3804
3962
|
ifMatches.forEach(function (m) {
|
|
@@ -3886,7 +4044,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3886
4044
|
parts.forEach(function (p) {
|
|
3887
4045
|
items = items[p];
|
|
3888
4046
|
});
|
|
3889
|
-
template = template.replace(m[0],
|
|
4047
|
+
template = template.replace(m[0], _this28.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3890
4048
|
}
|
|
3891
4049
|
});
|
|
3892
4050
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -3895,7 +4053,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3895
4053
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
3896
4054
|
}
|
|
3897
4055
|
});
|
|
3898
|
-
var flatRow =
|
|
4056
|
+
var flatRow = _this28.flattenObject(row);
|
|
3899
4057
|
for (var key in flatRow) {
|
|
3900
4058
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
3901
4059
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4020,11 +4178,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4020
4178
|
}, {
|
|
4021
4179
|
key: "render",
|
|
4022
4180
|
value: function render() {
|
|
4023
|
-
var
|
|
4181
|
+
var _this29 = this;
|
|
4024
4182
|
if (this.options.entity) {
|
|
4025
|
-
this.
|
|
4026
|
-
|
|
4027
|
-
|
|
4183
|
+
var url = this.options.entity;
|
|
4184
|
+
if (this.options.sortField) {
|
|
4185
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4186
|
+
}
|
|
4187
|
+
this.apiService.get(url).then(function (results) {
|
|
4188
|
+
_this29.rows = results.rows;
|
|
4189
|
+
_this29.resize();
|
|
4028
4190
|
});
|
|
4029
4191
|
} else {
|
|
4030
4192
|
this.resize();
|
|
@@ -4094,12 +4256,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4094
4256
|
_createClass(WebsyRouter, [{
|
|
4095
4257
|
key: "addGroup",
|
|
4096
4258
|
value: function addGroup(group) {
|
|
4097
|
-
var
|
|
4259
|
+
var _this30 = this;
|
|
4098
4260
|
if (!this.groups[group]) {
|
|
4099
4261
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
4100
4262
|
if (els) {
|
|
4101
4263
|
this.getClosestParent(els[0], function (parent) {
|
|
4102
|
-
|
|
4264
|
+
_this30.groups[group] = {
|
|
4103
4265
|
activeView: '',
|
|
4104
4266
|
views: [],
|
|
4105
4267
|
parent: parent.getAttribute('data-view')
|
|
@@ -4163,7 +4325,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4163
4325
|
}, {
|
|
4164
4326
|
key: "removeUrlParams",
|
|
4165
4327
|
value: function removeUrlParams() {
|
|
4166
|
-
var
|
|
4328
|
+
var _this31 = this;
|
|
4167
4329
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4168
4330
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4169
4331
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4171,7 +4333,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4171
4333
|
var path = '';
|
|
4172
4334
|
if (this.currentParams && this.currentParams.items) {
|
|
4173
4335
|
params.forEach(function (p) {
|
|
4174
|
-
delete
|
|
4336
|
+
delete _this31.currentParams.items[p];
|
|
4175
4337
|
});
|
|
4176
4338
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4177
4339
|
}
|
|
@@ -4502,11 +4664,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4502
4664
|
}, {
|
|
4503
4665
|
key: "showComponents",
|
|
4504
4666
|
value: function showComponents(view) {
|
|
4505
|
-
var
|
|
4667
|
+
var _this32 = this;
|
|
4506
4668
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4507
4669
|
this.options.views[view].components.forEach(function (c) {
|
|
4508
4670
|
if (typeof c.instance === 'undefined') {
|
|
4509
|
-
|
|
4671
|
+
_this32.prepComponent(c.elementId, c.options);
|
|
4510
4672
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4511
4673
|
} else if (c.instance.render) {
|
|
4512
4674
|
c.instance.render();
|
|
@@ -4826,7 +4988,7 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4826
4988
|
}, {
|
|
4827
4989
|
key: "handleKeyUp",
|
|
4828
4990
|
value: function handleKeyUp(event) {
|
|
4829
|
-
var
|
|
4991
|
+
var _this33 = this;
|
|
4830
4992
|
if (event.target.classList.contains('websy-search-input')) {
|
|
4831
4993
|
if (this.searchTimeoutFn) {
|
|
4832
4994
|
clearTimeout(this.searchTimeoutFn);
|
|
@@ -4844,8 +5006,8 @@ var WebsySearch = /*#__PURE__*/function () {
|
|
|
4844
5006
|
}
|
|
4845
5007
|
if (event.target.value.length >= this.options.minLength) {
|
|
4846
5008
|
this.searchTimeoutFn = setTimeout(function () {
|
|
4847
|
-
if (
|
|
4848
|
-
|
|
5009
|
+
if (_this33.options.onSearch) {
|
|
5010
|
+
_this33.options.onSearch(event.target.value, event);
|
|
4849
5011
|
}
|
|
4850
5012
|
}, this.options.searchTimeout);
|
|
4851
5013
|
} else {
|
|
@@ -5003,7 +5165,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5003
5165
|
/* global WebsyDesigns */
|
|
5004
5166
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5005
5167
|
function WebsyTemplate(elementId, options) {
|
|
5006
|
-
var
|
|
5168
|
+
var _this34 = this;
|
|
5007
5169
|
_classCallCheck(this, WebsyTemplate);
|
|
5008
5170
|
var DEFAULTS = {
|
|
5009
5171
|
listeners: {
|
|
@@ -5023,8 +5185,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5023
5185
|
}
|
|
5024
5186
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5025
5187
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5026
|
-
|
|
5027
|
-
|
|
5188
|
+
_this34.options.template = templateString;
|
|
5189
|
+
_this34.render();
|
|
5028
5190
|
});
|
|
5029
5191
|
} else {
|
|
5030
5192
|
this.render();
|
|
@@ -5033,7 +5195,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5033
5195
|
_createClass(WebsyTemplate, [{
|
|
5034
5196
|
key: "buildHTML",
|
|
5035
5197
|
value: function buildHTML() {
|
|
5036
|
-
var
|
|
5198
|
+
var _this35 = this;
|
|
5037
5199
|
var html = "";
|
|
5038
5200
|
if (this.options.template) {
|
|
5039
5201
|
var template = this.options.template;
|
|
@@ -5082,14 +5244,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5082
5244
|
}
|
|
5083
5245
|
}
|
|
5084
5246
|
if (polarity === true) {
|
|
5085
|
-
if (typeof
|
|
5247
|
+
if (typeof _this35.options.data[parts[0]] !== 'undefined' && _this35.options.data[parts[0]] === parts[1]) {
|
|
5086
5248
|
// remove the <if> tags
|
|
5087
5249
|
removeAll = false;
|
|
5088
5250
|
} else if (parts[0] === parts[1]) {
|
|
5089
5251
|
removeAll = false;
|
|
5090
5252
|
}
|
|
5091
5253
|
} else if (polarity === false) {
|
|
5092
|
-
if (typeof
|
|
5254
|
+
if (typeof _this35.options.data[parts[0]] !== 'undefined' && _this35.options.data[parts[0]] !== parts[1]) {
|
|
5093
5255
|
// remove the <if> tags
|
|
5094
5256
|
removeAll = false;
|
|
5095
5257
|
}
|
|
@@ -5348,7 +5510,7 @@ var WebsyUtils = {
|
|
|
5348
5510
|
/* global WebsyDesigns */
|
|
5349
5511
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5350
5512
|
function WebsyTable(elementId, options) {
|
|
5351
|
-
var
|
|
5513
|
+
var _this36 = this;
|
|
5352
5514
|
_classCallCheck(this, WebsyTable);
|
|
5353
5515
|
var DEFAULTS = {
|
|
5354
5516
|
pageSize: 20,
|
|
@@ -5380,8 +5542,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5380
5542
|
allowClear: false,
|
|
5381
5543
|
disableSearch: true,
|
|
5382
5544
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5383
|
-
if (
|
|
5384
|
-
|
|
5545
|
+
if (_this36.options.onChangePageSize) {
|
|
5546
|
+
_this36.options.onChangePageSize(selectedItem.value);
|
|
5385
5547
|
}
|
|
5386
5548
|
}
|
|
5387
5549
|
});
|
|
@@ -5400,19 +5562,19 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5400
5562
|
_createClass(WebsyTable, [{
|
|
5401
5563
|
key: "appendRows",
|
|
5402
5564
|
value: function appendRows(data) {
|
|
5403
|
-
var
|
|
5565
|
+
var _this37 = this;
|
|
5404
5566
|
this.hideError();
|
|
5405
5567
|
var bodyHTML = '';
|
|
5406
5568
|
if (data) {
|
|
5407
5569
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5408
5570
|
return '<tr>' + r.map(function (c, i) {
|
|
5409
|
-
if (
|
|
5571
|
+
if (_this37.options.columns[i].show !== false) {
|
|
5410
5572
|
var style = '';
|
|
5411
5573
|
if (c.style) {
|
|
5412
5574
|
style += c.style;
|
|
5413
5575
|
}
|
|
5414
|
-
if (
|
|
5415
|
-
style += "width: ".concat(
|
|
5576
|
+
if (_this37.options.columns[i].width) {
|
|
5577
|
+
style += "width: ".concat(_this37.options.columns[i].width, "; ");
|
|
5416
5578
|
}
|
|
5417
5579
|
if (c.backgroundColor) {
|
|
5418
5580
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5423,16 +5585,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5423
5585
|
if (c.color) {
|
|
5424
5586
|
style += "color: ".concat(c.color, "; ");
|
|
5425
5587
|
}
|
|
5426
|
-
if (
|
|
5427
|
-
return "\n <td \n data-row-index='".concat(
|
|
5428
|
-
} else if ((
|
|
5429
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5588
|
+
if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5589
|
+
return "\n <td \n data-row-index='".concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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(_this37.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5590
|
+
} else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5591
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this37.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this37.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this37.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5430
5592
|
} else {
|
|
5431
5593
|
var info = c.value;
|
|
5432
|
-
if (
|
|
5594
|
+
if (_this37.options.columns[i].showAsImage === true) {
|
|
5433
5595
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5434
5596
|
}
|
|
5435
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5597
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this37.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this37.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 ");
|
|
5436
5598
|
}
|
|
5437
5599
|
}
|
|
5438
5600
|
}).join('') + '</tr>';
|
|
@@ -5591,7 +5753,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5591
5753
|
}, {
|
|
5592
5754
|
key: "render",
|
|
5593
5755
|
value: function render(data) {
|
|
5594
|
-
var
|
|
5756
|
+
var _this38 = this;
|
|
5595
5757
|
if (!this.options.columns) {
|
|
5596
5758
|
return;
|
|
5597
5759
|
}
|
|
@@ -5618,7 +5780,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5618
5780
|
if (c.width) {
|
|
5619
5781
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5620
5782
|
}
|
|
5621
|
-
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 ?
|
|
5783
|
+
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 ? _this38.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5622
5784
|
}
|
|
5623
5785
|
}).join('') + '</tr>';
|
|
5624
5786
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5636,7 +5798,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5636
5798
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5637
5799
|
if (pagingEl) {
|
|
5638
5800
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5639
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5801
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5640
5802
|
});
|
|
5641
5803
|
var startIndex = 0;
|
|
5642
5804
|
if (this.options.pageCount > 8) {
|
|
@@ -5691,7 +5853,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5691
5853
|
/* global WebsyDesigns */
|
|
5692
5854
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5693
5855
|
function WebsyTable2(elementId, options) {
|
|
5694
|
-
var
|
|
5856
|
+
var _this39 = this;
|
|
5695
5857
|
_classCallCheck(this, WebsyTable2);
|
|
5696
5858
|
var DEFAULTS = {
|
|
5697
5859
|
pageSize: 20,
|
|
@@ -5726,8 +5888,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5726
5888
|
allowClear: false,
|
|
5727
5889
|
disableSearch: true,
|
|
5728
5890
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5729
|
-
if (
|
|
5730
|
-
|
|
5891
|
+
if (_this39.options.onChangePageSize) {
|
|
5892
|
+
_this39.options.onChangePageSize(selectedItem.value);
|
|
5731
5893
|
}
|
|
5732
5894
|
}
|
|
5733
5895
|
});
|
|
@@ -5749,20 +5911,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5749
5911
|
_createClass(WebsyTable2, [{
|
|
5750
5912
|
key: "appendRows",
|
|
5751
5913
|
value: function appendRows(data) {
|
|
5752
|
-
var
|
|
5914
|
+
var _this40 = this;
|
|
5753
5915
|
this.hideError();
|
|
5754
5916
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5755
5917
|
var bodyHTML = '';
|
|
5756
5918
|
if (data) {
|
|
5757
5919
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5758
5920
|
return '<tr>' + r.map(function (c, i) {
|
|
5759
|
-
if (
|
|
5760
|
-
var style = "height: ".concat(
|
|
5921
|
+
if (_this40.options.columns[i].show !== false) {
|
|
5922
|
+
var style = "height: ".concat(_this40.options.cellSize, "px; line-height: ").concat(_this40.options.cellSize, "px;");
|
|
5761
5923
|
if (c.style) {
|
|
5762
5924
|
style += c.style;
|
|
5763
5925
|
}
|
|
5764
|
-
if (
|
|
5765
|
-
style += "width: ".concat(
|
|
5926
|
+
if (_this40.options.columns[i].width) {
|
|
5927
|
+
style += "width: ".concat(_this40.options.columns[i].width, "; ");
|
|
5766
5928
|
}
|
|
5767
5929
|
if (c.backgroundColor) {
|
|
5768
5930
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5773,16 +5935,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5773
5935
|
if (c.color) {
|
|
5774
5936
|
style += "color: ".concat(c.color, "; ");
|
|
5775
5937
|
}
|
|
5776
|
-
if (
|
|
5777
|
-
return "\n <td \n data-row-index='".concat(
|
|
5778
|
-
} else if ((
|
|
5779
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5938
|
+
if (_this40.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5939
|
+
return "\n <td \n data-row-index='".concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.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(_this40.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5940
|
+
} else if ((_this40.options.columns[i].showAsNavigatorLink === true || _this40.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5941
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this40.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this40.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this40.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5780
5942
|
} else {
|
|
5781
5943
|
var info = c.value;
|
|
5782
|
-
if (
|
|
5944
|
+
if (_this40.options.columns[i].showAsImage === true) {
|
|
5783
5945
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5784
5946
|
}
|
|
5785
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5947
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this40.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this40.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 ");
|
|
5786
5948
|
}
|
|
5787
5949
|
}
|
|
5788
5950
|
}).join('') + '</tr>';
|
|
@@ -6016,7 +6178,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6016
6178
|
}, {
|
|
6017
6179
|
key: "render",
|
|
6018
6180
|
value: function render(data) {
|
|
6019
|
-
var
|
|
6181
|
+
var _this41 = this;
|
|
6020
6182
|
if (!this.options.columns) {
|
|
6021
6183
|
return;
|
|
6022
6184
|
}
|
|
@@ -6044,7 +6206,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6044
6206
|
if (c.width) {
|
|
6045
6207
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6046
6208
|
}
|
|
6047
|
-
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 ?
|
|
6209
|
+
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 ? _this41.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6048
6210
|
}
|
|
6049
6211
|
}).join('') + '</tr>';
|
|
6050
6212
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6054,7 +6216,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6054
6216
|
var dropdownHTML = "";
|
|
6055
6217
|
this.options.columns.forEach(function (c, i) {
|
|
6056
6218
|
if (c.searchable && c.searchField) {
|
|
6057
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6219
|
+
dropdownHTML += "\n <div id=\"".concat(_this41.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6058
6220
|
}
|
|
6059
6221
|
});
|
|
6060
6222
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6074,7 +6236,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6074
6236
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6075
6237
|
if (pagingEl) {
|
|
6076
6238
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6077
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6239
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this41.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6078
6240
|
});
|
|
6079
6241
|
var startIndex = 0;
|
|
6080
6242
|
if (this.options.pageCount > 8) {
|
|
@@ -6151,17 +6313,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6151
6313
|
}, {
|
|
6152
6314
|
key: "getColumnParameters",
|
|
6153
6315
|
value: function getColumnParameters(values) {
|
|
6154
|
-
var
|
|
6316
|
+
var _this42 = this;
|
|
6155
6317
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6156
6318
|
tableEl.style.tableLayout = 'auto';
|
|
6157
6319
|
tableEl.style.width = 'auto';
|
|
6158
6320
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6159
6321
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6160
6322
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6161
|
-
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 ?
|
|
6323
|
+
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 ? _this42.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6162
6324
|
}).join('') + '</tr>';
|
|
6163
6325
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6164
|
-
return "\n <td \n style='height: ".concat(
|
|
6326
|
+
return "\n <td \n style='height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6165
6327
|
}).join('') + '</tr>';
|
|
6166
6328
|
// get height of the first data cell
|
|
6167
6329
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6249,11 +6411,20 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6249
6411
|
if (this.isTouchDevice === true && this.options.virtualScroll === true) {
|
|
6250
6412
|
html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
|
|
6251
6413
|
}
|
|
6252
|
-
html += " \n </div> \n <div id=\"".concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "
|
|
6414
|
+
html += " \n </div> \n <div id=\"".concat(this.elementId, "_errorContainer\" class='websy-vis-error-container'>\n <div>\n <div id=\"").concat(this.elementId, "_errorTitle\"></div>\n <div id=\"").concat(this.elementId, "_errorMessage\"></div>\n </div> \n </div>\n <div id=\"").concat(this.elementId, "_dropdownContainerx\" class=\"table-dropdown-container\"></div>\n <div id=\"").concat(this.elementId, "_loadingContainer\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_vScrollContainer\" class=\"websy-v-scroll-container\" style=\"width: ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px;\">\n <div id=\"").concat(this.elementId, "_vScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-y\"></div>\n </div>\n <div id=\"").concat(this.elementId, "_hScrollContainer\" class=\"websy-h-scroll-container\" style=\"height: ").concat(this.options.isTouchDevice ? this.options.touchScrollWidth : this.options.scrollWidth, "px;\">\n <div id=\"").concat(this.elementId, "_hScrollHandle\" class=\"websy-scroll-handle websy-scroll-handle-x\"></div>\n </div> \n ");
|
|
6253
6415
|
if (this.options.paging === 'pages') {
|
|
6254
6416
|
html += "\n <div class=\"websy-table-paging-container\">\n Show <div id=\"".concat(this.elementId, "_pageSizeSelector\" class=\"websy-vis-page-selector\"></div> rows\n <ul id=\"").concat(this.elementId, "_pageList\" class=\"websy-vis-page-list\"></ul>\n </div>\n ");
|
|
6255
6417
|
}
|
|
6256
6418
|
el.innerHTML = html;
|
|
6419
|
+
var dropdownContainerEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6420
|
+
if (dropdownContainerEl) {
|
|
6421
|
+
dropdownContainerEl.innerHTML = '';
|
|
6422
|
+
} else {
|
|
6423
|
+
var div = document.createElement('div');
|
|
6424
|
+
div.id = "".concat(this.elementId, "_dropdownContainer");
|
|
6425
|
+
div.classList.add('table-dropdown-container');
|
|
6426
|
+
document.body.appendChild(div);
|
|
6427
|
+
}
|
|
6257
6428
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
6258
6429
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
6259
6430
|
el.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
|
@@ -6307,7 +6478,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6307
6478
|
}, {
|
|
6308
6479
|
key: "buildBodyHtml",
|
|
6309
6480
|
value: function buildBodyHtml() {
|
|
6310
|
-
var
|
|
6481
|
+
var _this43 = this;
|
|
6311
6482
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6312
6483
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6313
6484
|
if (!this.options.columns) {
|
|
@@ -6359,7 +6530,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6359
6530
|
style += "color: ".concat(cell.color, "; ");
|
|
6360
6531
|
}
|
|
6361
6532
|
// console.log('rowspan', cell.rowspan)
|
|
6362
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6533
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this43.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 ");
|
|
6363
6534
|
// if (useWidths === true) {
|
|
6364
6535
|
// bodyHtml += `
|
|
6365
6536
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -6368,10 +6539,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6368
6539
|
// }
|
|
6369
6540
|
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 >");
|
|
6370
6541
|
if (cell.expandable === true) {
|
|
6371
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6542
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this43.options.plusIcon, "</i>");
|
|
6372
6543
|
}
|
|
6373
6544
|
if (cell.collapsable === true) {
|
|
6374
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6545
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this43.options.minusIcon, "</i>");
|
|
6375
6546
|
}
|
|
6376
6547
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6377
6548
|
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 ");
|
|
@@ -6392,7 +6563,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6392
6563
|
}, {
|
|
6393
6564
|
key: "buildHeaderHtml",
|
|
6394
6565
|
value: function buildHeaderHtml() {
|
|
6395
|
-
var
|
|
6566
|
+
var _this44 = this;
|
|
6396
6567
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6397
6568
|
if (!this.options.columns) {
|
|
6398
6569
|
return '';
|
|
@@ -6409,7 +6580,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6409
6580
|
headerHtml += '</colgroup>';
|
|
6410
6581
|
}
|
|
6411
6582
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6412
|
-
if (useWidths === false && rowIndex !==
|
|
6583
|
+
if (useWidths === false && rowIndex !== _this44.options.columns.length - 1) {
|
|
6413
6584
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6414
6585
|
return;
|
|
6415
6586
|
}
|
|
@@ -6433,24 +6604,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6433
6604
|
if (col.style) {
|
|
6434
6605
|
style += col.style;
|
|
6435
6606
|
}
|
|
6436
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6607
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this44.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6437
6608
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6438
6609
|
// headerHtml += `
|
|
6439
6610
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6440
6611
|
// width='${col.width || col.actualWidth}'
|
|
6441
6612
|
// `
|
|
6442
6613
|
// }
|
|
6443
|
-
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 ?
|
|
6614
|
+
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 ? _this44.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this44.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6444
6615
|
});
|
|
6445
6616
|
headerHtml += "</tr>";
|
|
6446
6617
|
});
|
|
6447
6618
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6448
6619
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6449
6620
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6450
|
-
var testEl = document.getElementById("".concat(
|
|
6621
|
+
var testEl = document.getElementById("".concat(_this44.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6451
6622
|
if (!testEl) {
|
|
6452
6623
|
var newE = document.createElement('div');
|
|
6453
|
-
newE.id = "".concat(
|
|
6624
|
+
newE.id = "".concat(_this44.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6454
6625
|
newE.className = 'websy-modal-dropdown';
|
|
6455
6626
|
dropdownEl.appendChild(newE);
|
|
6456
6627
|
}
|
|
@@ -6473,7 +6644,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6473
6644
|
}, {
|
|
6474
6645
|
key: "buildTotalHtml",
|
|
6475
6646
|
value: function buildTotalHtml() {
|
|
6476
|
-
var
|
|
6647
|
+
var _this45 = this;
|
|
6477
6648
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6478
6649
|
if (!this.options.totals) {
|
|
6479
6650
|
return '';
|
|
@@ -6489,7 +6660,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6489
6660
|
|
|
6490
6661
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6491
6662
|
if (useWidths === true) {
|
|
6492
|
-
totalHtml += "\n style='width: ".concat(
|
|
6663
|
+
totalHtml += "\n style='width: ".concat(_this45.options.columns[_this45.options.columns.length - 1][colIndex].width || _this45.options.columns[_this45.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6493
6664
|
}
|
|
6494
6665
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6495
6666
|
});
|
|
@@ -6499,7 +6670,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6499
6670
|
}, {
|
|
6500
6671
|
key: "calculateSizes",
|
|
6501
6672
|
value: function calculateSizes() {
|
|
6502
|
-
var
|
|
6673
|
+
var _this46 = this;
|
|
6503
6674
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6504
6675
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6505
6676
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6543,7 +6714,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6543
6714
|
rows.forEach(function (row, rowIndex) {
|
|
6544
6715
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6545
6716
|
var colSize = col.getBoundingClientRect();
|
|
6546
|
-
|
|
6717
|
+
_this46.sizes.cellHeight = colSize.height;
|
|
6547
6718
|
if (columnsForSizing[colIndex]) {
|
|
6548
6719
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6549
6720
|
columnsForSizing[colIndex].actualWidth = 0;
|
|
@@ -6553,7 +6724,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6553
6724
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6554
6725
|
// }
|
|
6555
6726
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6556
|
-
if (colIndex >=
|
|
6727
|
+
if (colIndex >= _this46.pinnedColumns) {
|
|
6557
6728
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6558
6729
|
}
|
|
6559
6730
|
}
|
|
@@ -6568,7 +6739,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6568
6739
|
return a + (b.width || b.actualWidth);
|
|
6569
6740
|
}, 0);
|
|
6570
6741
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6571
|
-
return i >=
|
|
6742
|
+
return i >= _this46.pinnedColumns;
|
|
6572
6743
|
}).reduce(function (a, b) {
|
|
6573
6744
|
return a + (b.width || b.actualWidth);
|
|
6574
6745
|
}, 0);
|
|
@@ -6588,9 +6759,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6588
6759
|
c.actualWidth += equalWidth;
|
|
6589
6760
|
// }
|
|
6590
6761
|
// }
|
|
6591
|
-
|
|
6592
|
-
if (i >
|
|
6593
|
-
|
|
6762
|
+
_this46.sizes.totalWidth += c.width || c.actualWidth;
|
|
6763
|
+
if (i > _this46.pinnedColumns) {
|
|
6764
|
+
_this46.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6594
6765
|
}
|
|
6595
6766
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6596
6767
|
});
|
|
@@ -6649,7 +6820,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6649
6820
|
}, {
|
|
6650
6821
|
key: "createSample",
|
|
6651
6822
|
value: function createSample(data) {
|
|
6652
|
-
var
|
|
6823
|
+
var _this47 = this;
|
|
6653
6824
|
var output = [];
|
|
6654
6825
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6655
6826
|
if (col.maxLength) {
|
|
@@ -6659,7 +6830,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6659
6830
|
} else if (data) {
|
|
6660
6831
|
var longest = '';
|
|
6661
6832
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6662
|
-
if (data[i].length ===
|
|
6833
|
+
if (data[i].length === _this47.options.columns[_this47.options.columns.length - 1].length) {
|
|
6663
6834
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6664
6835
|
longest = data[i][colIndex].value;
|
|
6665
6836
|
}
|
|
@@ -6931,7 +7102,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6931
7102
|
}, {
|
|
6932
7103
|
key: "perpetualScroll",
|
|
6933
7104
|
value: function perpetualScroll() {
|
|
6934
|
-
var
|
|
7105
|
+
var _this48 = this;
|
|
6935
7106
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
6936
7107
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
6937
7108
|
return;
|
|
@@ -6950,17 +7121,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6950
7121
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
6951
7122
|
var _loop2 = function _loop2(i) {
|
|
6952
7123
|
setTimeout(function () {
|
|
6953
|
-
var delta =
|
|
7124
|
+
var delta = _this48.mouseYStart - _this48.currentClientY + _this48.sizes.cellHeight * (i + 1) * direction;
|
|
6954
7125
|
delta = Math.min(10, delta);
|
|
6955
7126
|
delta = Math.max(-10, delta);
|
|
6956
7127
|
// only run this if isPerpetual === true
|
|
6957
7128
|
// this value is reset to false on touchStart
|
|
6958
|
-
if (
|
|
7129
|
+
if (_this48.isPerpetual === true) {
|
|
6959
7130
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
6960
7131
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
6961
|
-
|
|
6962
|
-
if (
|
|
6963
|
-
clearTimeout(
|
|
7132
|
+
_this48.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7133
|
+
if (_this48.scrollTimeout) {
|
|
7134
|
+
clearTimeout(_this48.scrollTimeout);
|
|
6964
7135
|
}
|
|
6965
7136
|
}
|
|
6966
7137
|
}, 1000 / fps * i);
|
|
@@ -7156,6 +7327,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7156
7327
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
7157
7328
|
this.startCol += 1;
|
|
7158
7329
|
}
|
|
7330
|
+
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth) {
|
|
7331
|
+
this.startCol += 1;
|
|
7332
|
+
this.endCol += 1;
|
|
7333
|
+
}
|
|
7159
7334
|
this.endCol = Math.max(this.startCol, this.endCol);
|
|
7160
7335
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
|
|
7161
7336
|
}
|
|
@@ -7214,7 +7389,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7214
7389
|
/* global d3 include WebsyDesigns */
|
|
7215
7390
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7216
7391
|
function WebsyChart(elementId, options) {
|
|
7217
|
-
var
|
|
7392
|
+
var _this49 = this;
|
|
7218
7393
|
_classCallCheck(this, WebsyChart);
|
|
7219
7394
|
var DEFAULTS = {
|
|
7220
7395
|
margin: {
|
|
@@ -7251,6 +7426,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7251
7426
|
minBandWidth: 30,
|
|
7252
7427
|
maxBandWidth: 100,
|
|
7253
7428
|
allowUnevenBands: true,
|
|
7429
|
+
allowBrushing: true,
|
|
7254
7430
|
balancedMinMax: false
|
|
7255
7431
|
};
|
|
7256
7432
|
this.elementId = elementId;
|
|
@@ -7270,7 +7446,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7270
7446
|
this.invertOverride = function (input, input2) {
|
|
7271
7447
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7272
7448
|
var xAxis = 'bottom';
|
|
7273
|
-
if (
|
|
7449
|
+
if (_this49.options.orientation === 'horizontal') {
|
|
7274
7450
|
xAxis = 'left';
|
|
7275
7451
|
}
|
|
7276
7452
|
if (forBrush === true) {
|
|
@@ -7278,12 +7454,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7278
7454
|
}
|
|
7279
7455
|
xAxis += 'Axis';
|
|
7280
7456
|
var output;
|
|
7281
|
-
var width =
|
|
7457
|
+
var width = _this49.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7282
7458
|
// if (this.customBottomRange) {
|
|
7283
|
-
for (var index = 0; index <
|
|
7284
|
-
if (input >
|
|
7285
|
-
if (
|
|
7286
|
-
if (input <
|
|
7459
|
+
for (var index = 0; index < _this49.customBottomRange.length; index++) {
|
|
7460
|
+
if (input > _this49.customBottomRange[index]) {
|
|
7461
|
+
if (_this49.customBottomRange[index + 1]) {
|
|
7462
|
+
if (input < _this49.customBottomRange[index + 1]) {
|
|
7287
7463
|
output = index;
|
|
7288
7464
|
break;
|
|
7289
7465
|
}
|
|
@@ -7458,9 +7634,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7458
7634
|
}, {
|
|
7459
7635
|
key: "handleEventMouseMove",
|
|
7460
7636
|
value: function handleEventMouseMove(event, d) {
|
|
7461
|
-
var
|
|
7637
|
+
var _this50 = this;
|
|
7462
7638
|
var bisectDate = d3.bisector(function (d) {
|
|
7463
|
-
return
|
|
7639
|
+
return _this50.parseX(d.x.value);
|
|
7464
7640
|
}).left;
|
|
7465
7641
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7466
7642
|
var xAxis = 'bottomAxis';
|
|
@@ -7493,9 +7669,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7493
7669
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7494
7670
|
}
|
|
7495
7671
|
this.options.data.series.forEach(function (s) {
|
|
7496
|
-
if (
|
|
7672
|
+
if (_this50.options.data[xData].scale !== 'Time') {
|
|
7497
7673
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7498
|
-
xPoint =
|
|
7674
|
+
xPoint = _this50.customBottomRange[x0] + (_this50.customBottomRange[x0 + 1] - _this50.customBottomRange[x0]) / 2;
|
|
7499
7675
|
// }
|
|
7500
7676
|
// else {
|
|
7501
7677
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7515,41 +7691,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7515
7691
|
var index = bisectDate(s.data, x0, 1);
|
|
7516
7692
|
var pointA = s.data[index - 1];
|
|
7517
7693
|
var pointB = s.data[index];
|
|
7518
|
-
if (
|
|
7694
|
+
if (_this50.options.orientation === 'horizontal') {
|
|
7519
7695
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7520
7696
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7521
7697
|
}
|
|
7522
7698
|
if (pointA && !pointB) {
|
|
7523
|
-
xPoint =
|
|
7699
|
+
xPoint = _this50[xAxis](_this50.parseX(pointA.x.value));
|
|
7524
7700
|
tooltipTitle = pointA.x.value;
|
|
7525
7701
|
if (!pointA.y.color) {
|
|
7526
7702
|
pointA.y.color = s.color;
|
|
7527
7703
|
}
|
|
7528
7704
|
tooltipData.push(pointA);
|
|
7529
7705
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7530
|
-
tooltipTitle = d3.timeFormat(
|
|
7706
|
+
tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7531
7707
|
}
|
|
7532
7708
|
}
|
|
7533
7709
|
if (pointB && !pointA) {
|
|
7534
|
-
xPoint =
|
|
7710
|
+
xPoint = _this50[xAxis](_this50.parseX(pointB.x.value));
|
|
7535
7711
|
tooltipTitle = pointB.x.value;
|
|
7536
7712
|
if (!pointB.y.color) {
|
|
7537
7713
|
pointB.y.color = s.color;
|
|
7538
7714
|
}
|
|
7539
7715
|
tooltipData.push(pointB);
|
|
7540
7716
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7541
|
-
tooltipTitle = d3.timeFormat(
|
|
7717
|
+
tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7542
7718
|
}
|
|
7543
7719
|
}
|
|
7544
7720
|
if (pointA && pointB) {
|
|
7545
|
-
var d0 =
|
|
7546
|
-
var d1 =
|
|
7721
|
+
var d0 = _this50[xAxis](_this50.parseX(pointA.x.value));
|
|
7722
|
+
var d1 = _this50[xAxis](_this50.parseX(pointB.x.value));
|
|
7547
7723
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7548
7724
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7549
7725
|
xPoint = d1;
|
|
7550
7726
|
tooltipTitle = pointB.x.value;
|
|
7551
7727
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7552
|
-
tooltipTitle = d3.timeFormat(
|
|
7728
|
+
tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7553
7729
|
}
|
|
7554
7730
|
if (!pointB.y.color) {
|
|
7555
7731
|
pointB.y.color = s.color;
|
|
@@ -7559,7 +7735,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7559
7735
|
xPoint = d0;
|
|
7560
7736
|
tooltipTitle = pointA.x.value;
|
|
7561
7737
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7562
|
-
tooltipTitle = d3.timeFormat(
|
|
7738
|
+
tooltipTitle = d3.timeFormat(_this50.options.dateFormat || _this50.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7563
7739
|
}
|
|
7564
7740
|
if (!pointA.y.color) {
|
|
7565
7741
|
pointA.y.color = s.color;
|
|
@@ -7685,7 +7861,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7685
7861
|
}, {
|
|
7686
7862
|
key: "render",
|
|
7687
7863
|
value: function render(options) {
|
|
7688
|
-
var
|
|
7864
|
+
var _this51 = this;
|
|
7689
7865
|
/* global d3 options WebsyUtils */
|
|
7690
7866
|
if (typeof options !== 'undefined') {
|
|
7691
7867
|
this.options = _extends({}, this.options, options);
|
|
@@ -7753,7 +7929,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7753
7929
|
this.options.data.series.map(function (s, i) {
|
|
7754
7930
|
return {
|
|
7755
7931
|
value: s.label || s.key,
|
|
7756
|
-
color: s.color ||
|
|
7932
|
+
color: s.color || _this51.options.colors[i % _this51.options.colors.length]
|
|
7757
7933
|
};
|
|
7758
7934
|
});
|
|
7759
7935
|
}
|
|
@@ -7996,7 +8172,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7996
8172
|
maxBandWidthFits = true;
|
|
7997
8173
|
proposedBandWidth = this.options.maxBandWidth;
|
|
7998
8174
|
}
|
|
7999
|
-
if (!maxBandWidthFits) {
|
|
8175
|
+
if (!maxBandWidthFits && this.options.allowBrushing === true) {
|
|
8000
8176
|
// Check to see if all bars at the min allowed width will fit
|
|
8001
8177
|
if (plotable / noOfPoints < this.options.minBandWidth) {
|
|
8002
8178
|
this.brushNeeded = true;
|
|
@@ -8110,25 +8286,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8110
8286
|
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') {
|
|
8111
8287
|
var acc = 0;
|
|
8112
8288
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8113
|
-
var adjustment =
|
|
8289
|
+
var adjustment = _this51.bandPadding * index + _this51.bandPadding;
|
|
8114
8290
|
// if (this.options.data.bottom.padding) {
|
|
8115
8291
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8116
8292
|
// }
|
|
8117
|
-
var start =
|
|
8293
|
+
var start = _this51.widthForCalc / noOfPoints * acc;
|
|
8118
8294
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8119
8295
|
var pos = i * proposedBandWidth;
|
|
8120
|
-
|
|
8296
|
+
_this51["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8121
8297
|
}
|
|
8122
|
-
acc +=
|
|
8123
|
-
var end =
|
|
8298
|
+
acc += _this51.options.grouping !== 'stacked' && _this51.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8299
|
+
var end = _this51.widthForCalc / noOfPoints * acc;
|
|
8124
8300
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8125
8301
|
return end + adjustment;
|
|
8126
8302
|
})));
|
|
8127
8303
|
acc = 0;
|
|
8128
8304
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8129
|
-
var adjustment =
|
|
8130
|
-
acc +=
|
|
8131
|
-
return (
|
|
8305
|
+
var adjustment = _this51.brushBandPadding * index + _this51.brushBandPadding;
|
|
8306
|
+
acc += _this51.options.grouping !== 'stacked' && _this51.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8307
|
+
return (_this51.options.orientation === 'vertical' ? _this51.plotWidth : _this51.plotHeight) / noOfPoints * acc;
|
|
8132
8308
|
})));
|
|
8133
8309
|
}
|
|
8134
8310
|
// }
|
|
@@ -8148,6 +8324,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8148
8324
|
} else {
|
|
8149
8325
|
leftRange = [this.widthForCalc + this.totalBandPadding, 0];
|
|
8150
8326
|
}
|
|
8327
|
+
if (this.options.allowBrushing !== true) {
|
|
8328
|
+
bottomRange = bottomBrushRange;
|
|
8329
|
+
}
|
|
8151
8330
|
this.bottomAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomDomain).range(bottomRange);
|
|
8152
8331
|
if (!this.brushInitialized) {
|
|
8153
8332
|
this.bottomBrushAxis = d3["scale".concat(this.options.data.bottom.scale || 'Ordinal')]().domain(bottomBrushDomain).range(bottomBrushRange);
|
|
@@ -8296,7 +8475,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8296
8475
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8297
8476
|
if (this.options.data.bottom.formatter) {
|
|
8298
8477
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8299
|
-
return
|
|
8478
|
+
return _this51.options.data.bottom.formatter(d);
|
|
8300
8479
|
});
|
|
8301
8480
|
}
|
|
8302
8481
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8306,7 +8485,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8306
8485
|
}
|
|
8307
8486
|
if (this.customBottomRange.length > 0) {
|
|
8308
8487
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8309
|
-
return "translate(".concat(
|
|
8488
|
+
return "translate(".concat(_this51.customBottomRange[i] + (_this51.customBottomRange[i + 1] - _this51.customBottomRange[i]) / 2, ", 0)");
|
|
8310
8489
|
});
|
|
8311
8490
|
}
|
|
8312
8491
|
}
|
|
@@ -8324,14 +8503,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8324
8503
|
}
|
|
8325
8504
|
if (this.options.margin.axisLeft > 0) {
|
|
8326
8505
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8327
|
-
if (
|
|
8328
|
-
d =
|
|
8506
|
+
if (_this51.options.data.left.formatter) {
|
|
8507
|
+
d = _this51.options.data.left.formatter(d);
|
|
8329
8508
|
}
|
|
8330
8509
|
return d;
|
|
8331
8510
|
}));
|
|
8332
8511
|
if (this.customLeftRange.length > 0) {
|
|
8333
8512
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8334
|
-
return "translate(0, ".concat(
|
|
8513
|
+
return "translate(0, ".concat(_this51.customLeftRange[i] + (_this51.customLeftRange[i + 1] - _this51.customLeftRange[i]) / 2, ")");
|
|
8335
8514
|
});
|
|
8336
8515
|
}
|
|
8337
8516
|
}
|
|
@@ -8358,8 +8537,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8358
8537
|
}
|
|
8359
8538
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8360
8539
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8361
|
-
if (
|
|
8362
|
-
d =
|
|
8540
|
+
if (_this51.options.data.right.formatter) {
|
|
8541
|
+
d = _this51.options.data.right.formatter(d);
|
|
8363
8542
|
}
|
|
8364
8543
|
return d;
|
|
8365
8544
|
}));
|
|
@@ -8399,50 +8578,50 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8399
8578
|
}, {
|
|
8400
8579
|
key: "renderComponents",
|
|
8401
8580
|
value: function renderComponents() {
|
|
8402
|
-
var
|
|
8581
|
+
var _this52 = this;
|
|
8403
8582
|
// Draw the series data
|
|
8404
8583
|
this.renderedKeys = {};
|
|
8405
8584
|
this.options.data.series.forEach(function (series, index) {
|
|
8406
8585
|
if (!series.key) {
|
|
8407
|
-
series.key =
|
|
8586
|
+
series.key = _this52.createIdentity();
|
|
8408
8587
|
}
|
|
8409
8588
|
if (!series.color) {
|
|
8410
|
-
series.color =
|
|
8589
|
+
series.color = _this52.options.colors[index % _this52.options.colors.length];
|
|
8411
8590
|
}
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8591
|
+
_this52["render".concat(series.type || 'bar')](series, index);
|
|
8592
|
+
_this52.renderLabels(series, index);
|
|
8593
|
+
_this52.renderedKeys[series.key] = series.type;
|
|
8415
8594
|
});
|
|
8416
8595
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8417
8596
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8418
8597
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8419
8598
|
this.options.refLines.forEach(function (l) {
|
|
8420
|
-
return
|
|
8599
|
+
return _this52.renderRefLine(l);
|
|
8421
8600
|
});
|
|
8422
8601
|
}
|
|
8423
8602
|
}
|
|
8424
8603
|
}, {
|
|
8425
8604
|
key: "renderarea",
|
|
8426
8605
|
value: function renderarea(series, index) {
|
|
8427
|
-
var
|
|
8606
|
+
var _this53 = this;
|
|
8428
8607
|
/* global d3 series index */
|
|
8429
8608
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8430
8609
|
return d3.area().x(function (d) {
|
|
8431
|
-
if (
|
|
8432
|
-
return
|
|
8610
|
+
if (_this53.options.data[xAxis].scale === 'Time') {
|
|
8611
|
+
return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
|
|
8433
8612
|
} else {
|
|
8434
|
-
var xIndex =
|
|
8435
|
-
var xPos =
|
|
8436
|
-
if (
|
|
8437
|
-
xPos = xPos + (
|
|
8613
|
+
var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8614
|
+
var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8615
|
+
if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8616
|
+
xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8438
8617
|
}
|
|
8439
8618
|
return xPos;
|
|
8440
8619
|
}
|
|
8441
8620
|
}).y0(function (d) {
|
|
8442
|
-
return
|
|
8621
|
+
return _this53["".concat(yAxis, "Axis")](0);
|
|
8443
8622
|
}).y1(function (d) {
|
|
8444
|
-
return
|
|
8445
|
-
}).curve(d3[curveStyle ||
|
|
8623
|
+
return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8624
|
+
}).curve(d3[curveStyle || _this53.options.curveStyle]);
|
|
8446
8625
|
};
|
|
8447
8626
|
var xAxis = 'bottom';
|
|
8448
8627
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8482,7 +8661,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8482
8661
|
}, {
|
|
8483
8662
|
key: "renderbar",
|
|
8484
8663
|
value: function renderbar(series, index) {
|
|
8485
|
-
var
|
|
8664
|
+
var _this54 = this;
|
|
8486
8665
|
/* global series index d3 */
|
|
8487
8666
|
var xAxis = 'bottom';
|
|
8488
8667
|
var yAxis = 'left';
|
|
@@ -8649,26 +8828,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8649
8828
|
}
|
|
8650
8829
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8651
8830
|
bars.attr('width', function (d, i) {
|
|
8652
|
-
return Math.abs(getBarWidth.call(
|
|
8831
|
+
return Math.abs(getBarWidth.call(_this54, d, i, yAxis, xAxis));
|
|
8653
8832
|
}).attr('height', function (d, i) {
|
|
8654
|
-
return getBarHeight.call(
|
|
8833
|
+
return getBarHeight.call(_this54, d, i, yAxis, xAxis);
|
|
8655
8834
|
}).attr('x', function (d, i) {
|
|
8656
|
-
return getBarX.call(
|
|
8835
|
+
return getBarX.call(_this54, d, i, yAxis, xAxis);
|
|
8657
8836
|
}).attr('y', function (d, i) {
|
|
8658
|
-
return getBarY.call(
|
|
8837
|
+
return getBarY.call(_this54, d, i, yAxis, xAxis);
|
|
8659
8838
|
})
|
|
8660
8839
|
// .transition(this.transition)
|
|
8661
8840
|
.attr('fill', function (d) {
|
|
8662
8841
|
return d.y.color || d.color || series.color;
|
|
8663
8842
|
});
|
|
8664
8843
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8665
|
-
return Math.abs(getBarWidth.call(
|
|
8844
|
+
return Math.abs(getBarWidth.call(_this54, d, i, yAxis, xAxis));
|
|
8666
8845
|
}).attr('height', function (d, i) {
|
|
8667
|
-
return getBarHeight.call(
|
|
8846
|
+
return getBarHeight.call(_this54, d, i, yAxis, xAxis);
|
|
8668
8847
|
}).attr('x', function (d, i) {
|
|
8669
|
-
return getBarX.call(
|
|
8848
|
+
return getBarX.call(_this54, d, i, yAxis, xAxis);
|
|
8670
8849
|
}).attr('y', function (d, i) {
|
|
8671
|
-
return getBarY.call(
|
|
8850
|
+
return getBarY.call(_this54, d, i, yAxis, xAxis);
|
|
8672
8851
|
})
|
|
8673
8852
|
// .transition(this.transition)
|
|
8674
8853
|
.attr('fill', function (d) {
|
|
@@ -8680,26 +8859,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8680
8859
|
this.brushBarsInitialized[series.key] = true;
|
|
8681
8860
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8682
8861
|
brushBars.attr('width', function (d, i) {
|
|
8683
|
-
return Math.abs(getBarWidth.call(
|
|
8862
|
+
return Math.abs(getBarWidth.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8684
8863
|
}).attr('height', function (d, i) {
|
|
8685
|
-
return getBarHeight.call(
|
|
8864
|
+
return getBarHeight.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8686
8865
|
}).attr('x', function (d, i) {
|
|
8687
|
-
return getBarX.call(
|
|
8866
|
+
return getBarX.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8688
8867
|
}).attr('y', function (d, i) {
|
|
8689
|
-
return getBarY.call(
|
|
8868
|
+
return getBarY.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8690
8869
|
})
|
|
8691
8870
|
// .transition(this.transition)
|
|
8692
8871
|
.attr('fill', function (d) {
|
|
8693
8872
|
return d.y.color || d.color || series.color;
|
|
8694
8873
|
});
|
|
8695
8874
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8696
|
-
return Math.abs(getBarWidth.call(
|
|
8875
|
+
return Math.abs(getBarWidth.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8697
8876
|
}).attr('height', function (d, i) {
|
|
8698
|
-
return getBarHeight.call(
|
|
8877
|
+
return getBarHeight.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8699
8878
|
}).attr('x', function (d, i) {
|
|
8700
|
-
return getBarX.call(
|
|
8879
|
+
return getBarX.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8701
8880
|
}).attr('y', function (d, i) {
|
|
8702
|
-
return getBarY.call(
|
|
8881
|
+
return getBarY.call(_this54, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8703
8882
|
})
|
|
8704
8883
|
// .transition(this.transition)
|
|
8705
8884
|
.attr('fill', function (d) {
|
|
@@ -8720,7 +8899,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8720
8899
|
}, {
|
|
8721
8900
|
key: "renderLabels",
|
|
8722
8901
|
value: function renderLabels(series, index) {
|
|
8723
|
-
var
|
|
8902
|
+
var _this55 = this;
|
|
8724
8903
|
/* global series index d3 WebsyDesigns */
|
|
8725
8904
|
var xAxis = 'bottom';
|
|
8726
8905
|
var yAxis = 'left';
|
|
@@ -8736,14 +8915,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8736
8915
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8737
8916
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8738
8917
|
labels.attr('x', function (d) {
|
|
8739
|
-
return getLabelX.call(
|
|
8918
|
+
return getLabelX.call(_this55, d, series.labelPosition);
|
|
8740
8919
|
}).attr('y', function (d) {
|
|
8741
|
-
return getLabelY.call(
|
|
8920
|
+
return getLabelY.call(_this55, d, series.labelPosition);
|
|
8742
8921
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8743
|
-
if (
|
|
8922
|
+
if (_this55.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8744
8923
|
return 'transparent';
|
|
8745
8924
|
}
|
|
8746
|
-
return
|
|
8925
|
+
return _this55.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8747
8926
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8748
8927
|
return d.y.label || d.y.value;
|
|
8749
8928
|
}).each(function (d, i) {
|
|
@@ -8777,14 +8956,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8777
8956
|
}
|
|
8778
8957
|
});
|
|
8779
8958
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8780
|
-
return getLabelX.call(
|
|
8959
|
+
return getLabelX.call(_this55, d, series.labelPosition);
|
|
8781
8960
|
}).attr('y', function (d) {
|
|
8782
|
-
return getLabelY.call(
|
|
8961
|
+
return getLabelY.call(_this55, d, series.labelPosition);
|
|
8783
8962
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8784
|
-
if (
|
|
8963
|
+
if (_this55.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8785
8964
|
return 'transparent';
|
|
8786
8965
|
}
|
|
8787
|
-
return
|
|
8966
|
+
return _this55.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8788
8967
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8789
8968
|
return d.y.label || d.y.value;
|
|
8790
8969
|
}).each(function (d, i) {
|
|
@@ -8862,32 +9041,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8862
9041
|
}, {
|
|
8863
9042
|
key: "renderline",
|
|
8864
9043
|
value: function renderline(series, index) {
|
|
8865
|
-
var
|
|
9044
|
+
var _this56 = this;
|
|
8866
9045
|
/* global series index d3 */
|
|
8867
9046
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8868
9047
|
return d3.line().x(function (d) {
|
|
8869
|
-
if (
|
|
8870
|
-
return
|
|
9048
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
9049
|
+
return _this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8871
9050
|
} else {
|
|
8872
|
-
if (
|
|
8873
|
-
return
|
|
9051
|
+
if (_this56.options.data[xAxis].scale === 'Time') {
|
|
9052
|
+
return _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value));
|
|
8874
9053
|
} else {
|
|
8875
|
-
var xIndex =
|
|
8876
|
-
var xPos =
|
|
8877
|
-
if (
|
|
8878
|
-
xPos = xPos + (
|
|
9054
|
+
var xIndex = _this56[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9055
|
+
var xPos = _this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9056
|
+
if (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9057
|
+
xPos = xPos + (_this56["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8879
9058
|
}
|
|
8880
9059
|
return xPos;
|
|
8881
9060
|
}
|
|
8882
9061
|
}
|
|
8883
9062
|
}).y(function (d) {
|
|
8884
|
-
if (
|
|
8885
|
-
var adjustment =
|
|
8886
|
-
return
|
|
9063
|
+
if (_this56.options.orientation === 'horizontal') {
|
|
9064
|
+
var adjustment = _this56.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this56.options.data[xAxis].bandWidth / 2;
|
|
9065
|
+
return _this56["".concat(xAxis, "Axis")](_this56.parseX(d.x.value)) + adjustment;
|
|
8887
9066
|
} else {
|
|
8888
|
-
return
|
|
9067
|
+
return _this56["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8889
9068
|
}
|
|
8890
|
-
}).curve(d3[curveStyle ||
|
|
9069
|
+
}).curve(d3[curveStyle || _this56.options.curveStyle]);
|
|
8891
9070
|
};
|
|
8892
9071
|
var xAxis = 'bottom';
|
|
8893
9072
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8996,14 +9175,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8996
9175
|
}, {
|
|
8997
9176
|
key: "rendersymbol",
|
|
8998
9177
|
value: function rendersymbol(series, index) {
|
|
8999
|
-
var
|
|
9178
|
+
var _this57 = this;
|
|
9000
9179
|
/* global d3 series index series.key */
|
|
9001
9180
|
var drawSymbol = function drawSymbol(size) {
|
|
9002
9181
|
return d3.symbol()
|
|
9003
9182
|
// .type(d => {
|
|
9004
9183
|
// return d3.symbols[0]
|
|
9005
9184
|
// })
|
|
9006
|
-
.size(size ||
|
|
9185
|
+
.size(size || _this57.options.symbolSize);
|
|
9007
9186
|
};
|
|
9008
9187
|
var xAxis = 'bottom';
|
|
9009
9188
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9029,20 +9208,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9029
9208
|
// else {
|
|
9030
9209
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9031
9210
|
// }
|
|
9032
|
-
var xIndex =
|
|
9033
|
-
var xPos =
|
|
9034
|
-
if (
|
|
9035
|
-
xPos = xPos + (
|
|
9036
|
-
}
|
|
9037
|
-
var adjustment =
|
|
9038
|
-
if (
|
|
9039
|
-
return "translate(".concat(
|
|
9211
|
+
var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9212
|
+
var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9213
|
+
if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9214
|
+
xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9215
|
+
}
|
|
9216
|
+
var adjustment = _this57.options.data[xAxis].scale === 'Time' || _this57.options.data[xAxis].scale === 'Linear' ? 0 : _this57.options.data[xAxis].bandWidth / 2;
|
|
9217
|
+
if (_this57.options.orientation === 'horizontal') {
|
|
9218
|
+
return "translate(".concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9040
9219
|
} else {
|
|
9041
|
-
if (
|
|
9042
|
-
xPos =
|
|
9220
|
+
if (_this57.options.data[xAxis].scale === 'Time') {
|
|
9221
|
+
xPos = _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
|
|
9043
9222
|
}
|
|
9044
9223
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9045
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9224
|
+
return "translate(".concat(xPos, ", ").concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9046
9225
|
}
|
|
9047
9226
|
});
|
|
9048
9227
|
// Enter
|
|
@@ -9057,20 +9236,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9057
9236
|
}).attr('class', function (d) {
|
|
9058
9237
|
return "symbol symbol_".concat(series.key);
|
|
9059
9238
|
}).attr('transform', function (d) {
|
|
9060
|
-
var xIndex =
|
|
9061
|
-
var xPos =
|
|
9062
|
-
if (
|
|
9063
|
-
xPos = xPos + (
|
|
9064
|
-
}
|
|
9065
|
-
var adjustment =
|
|
9066
|
-
if (
|
|
9067
|
-
return "translate(".concat(
|
|
9239
|
+
var xIndex = _this57[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9240
|
+
var xPos = _this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9241
|
+
if (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9242
|
+
xPos = xPos + (_this57["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9243
|
+
}
|
|
9244
|
+
var adjustment = _this57.options.data[xAxis].scale === 'Time' || _this57.options.data[xAxis].scale === 'Linear' ? 0 : _this57.options.data[xAxis].bandWidth / 2;
|
|
9245
|
+
if (_this57.options.orientation === 'horizontal') {
|
|
9246
|
+
return "translate(".concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9068
9247
|
} else {
|
|
9069
|
-
if (
|
|
9070
|
-
xPos =
|
|
9248
|
+
if (_this57.options.data[xAxis].scale === 'Time') {
|
|
9249
|
+
xPos = _this57["".concat(xAxis, "Axis")](_this57.parseX(d.x.value));
|
|
9071
9250
|
}
|
|
9072
9251
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9073
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9252
|
+
return "translate(".concat(xPos, ", ").concat(_this57["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9074
9253
|
}
|
|
9075
9254
|
});
|
|
9076
9255
|
}
|
|
@@ -9693,7 +9872,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9693
9872
|
}, {
|
|
9694
9873
|
key: "resize",
|
|
9695
9874
|
value: function resize() {
|
|
9696
|
-
var
|
|
9875
|
+
var _this58 = this;
|
|
9697
9876
|
var el = document.getElementById(this.elementId);
|
|
9698
9877
|
if (el) {
|
|
9699
9878
|
// if (this.options.width) {
|
|
@@ -9704,7 +9883,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9704
9883
|
// }
|
|
9705
9884
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9706
9885
|
html += this._data.map(function (d, i) {
|
|
9707
|
-
return
|
|
9886
|
+
return _this58.getLegendItemHTML(d);
|
|
9708
9887
|
}).join('');
|
|
9709
9888
|
html += "\n <div>\n ";
|
|
9710
9889
|
el.innerHTML = html;
|
|
@@ -9844,14 +10023,14 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9844
10023
|
}, {
|
|
9845
10024
|
key: "render",
|
|
9846
10025
|
value: function render() {
|
|
9847
|
-
var
|
|
10026
|
+
var _this59 = this;
|
|
9848
10027
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9849
10028
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9850
10029
|
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
9851
10030
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9852
10031
|
return {
|
|
9853
10032
|
value: s.label || s.key,
|
|
9854
|
-
color: s.color ||
|
|
10033
|
+
color: s.color || _this59.options.colors[i % _this59.options.colors.length]
|
|
9855
10034
|
};
|
|
9856
10035
|
});
|
|
9857
10036
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9905,7 +10084,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9905
10084
|
}
|
|
9906
10085
|
if (this.polygons) {
|
|
9907
10086
|
this.polygons.forEach(function (p) {
|
|
9908
|
-
return
|
|
10087
|
+
return _this59.map.removeLayer(p);
|
|
9909
10088
|
});
|
|
9910
10089
|
}
|
|
9911
10090
|
this.polygons = [];
|
|
@@ -9959,15 +10138,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9959
10138
|
p.options = {};
|
|
9960
10139
|
}
|
|
9961
10140
|
if (!p.options.color) {
|
|
9962
|
-
p.options.color =
|
|
10141
|
+
p.options.color = _this59.options.colors[i % _this59.options.colors.length];
|
|
9963
10142
|
}
|
|
9964
10143
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9965
10144
|
return c.map(function (d) {
|
|
9966
10145
|
return [d.Latitude, d.Longitude];
|
|
9967
10146
|
});
|
|
9968
|
-
}), p.options).addTo(
|
|
9969
|
-
|
|
9970
|
-
|
|
10147
|
+
}), p.options).addTo(_this59.map);
|
|
10148
|
+
_this59.polygons.push(pol);
|
|
10149
|
+
_this59.map.fitBounds(pol.getBounds());
|
|
9971
10150
|
});
|
|
9972
10151
|
}
|
|
9973
10152
|
// if (this.data.markers.length > 0) {
|
|
@@ -10075,6 +10254,7 @@ var WebsyDesigns = {
|
|
|
10075
10254
|
NavigationMenu: WebsyNavigationMenu,
|
|
10076
10255
|
WebsyForm: WebsyForm,
|
|
10077
10256
|
Form: WebsyForm,
|
|
10257
|
+
MultiForm: MultiForm,
|
|
10078
10258
|
WebsyDatePicker: WebsyDatePicker,
|
|
10079
10259
|
DatePicker: WebsyDatePicker,
|
|
10080
10260
|
WebsyDropdown: WebsyDropdown,
|