@websy/websy-designs 1.9.8 → 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 +195 -7
- package/dist/websy-designs-es6.js +432 -256
- package/dist/websy-designs-es6.min.js +1 -1
- package/dist/websy-designs.debug.js +195 -7
- package/dist/websy-designs.js +435 -259
- package/dist/websy-designs.min.css +1 -1
- package/dist/websy-designs.min.js +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
25
25
|
WebsyNavigationMenu
|
|
26
26
|
WebsyPubSub
|
|
27
27
|
WebsyForm
|
|
28
|
+
MultiForm
|
|
28
29
|
WebsyDatePicker
|
|
29
30
|
WebsyDragDrop
|
|
30
31
|
WebsyDropdown
|
|
@@ -2182,6 +2183,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2182
2183
|
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2183
2184
|
this.validateField(this.options.fields[index], event.target.value);
|
|
2184
2185
|
}
|
|
2186
|
+
if (this.options.fields[index].onChange) {
|
|
2187
|
+
this.options.fields[index].onChange({
|
|
2188
|
+
value: event.target.value,
|
|
2189
|
+
field: this.options.fields[index],
|
|
2190
|
+
form: this,
|
|
2191
|
+
index: index
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2185
2194
|
}
|
|
2186
2195
|
}
|
|
2187
2196
|
}, {
|
|
@@ -2203,6 +2212,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2203
2212
|
if (this.options.fields[index] && (this.options.fields[index].required || this.options.fields[index].validate)) {
|
|
2204
2213
|
this.validateField(this.options.fields[index], event.target.value);
|
|
2205
2214
|
}
|
|
2215
|
+
if (this.options.fields[index].onLeave) {
|
|
2216
|
+
this.options.fields[index].onLeave({
|
|
2217
|
+
value: event.target.value,
|
|
2218
|
+
field: this.options.fields[index],
|
|
2219
|
+
form: this,
|
|
2220
|
+
index: index
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2206
2223
|
}
|
|
2207
2224
|
}
|
|
2208
2225
|
}, {
|
|
@@ -2368,11 +2385,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2368
2385
|
_this17.fieldMap[f.field] = f;
|
|
2369
2386
|
if (f.component) {
|
|
2370
2387
|
componentsToProcess.push(f);
|
|
2371
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2388
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2372
2389
|
} else if (f.type === 'longtext') {
|
|
2373
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2390
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2374
2391
|
} else {
|
|
2375
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2392
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this17.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(_this17.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(_this17.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2376
2393
|
}
|
|
2377
2394
|
});
|
|
2378
2395
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2538,6 +2555,147 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2538
2555
|
}]);
|
|
2539
2556
|
return WebsyForm;
|
|
2540
2557
|
}();
|
|
2558
|
+
/*
|
|
2559
|
+
global
|
|
2560
|
+
WebsyDesigns
|
|
2561
|
+
*/
|
|
2562
|
+
var MultiForm = /*#__PURE__*/function () {
|
|
2563
|
+
function MultiForm(elementId, options) {
|
|
2564
|
+
_classCallCheck(this, MultiForm);
|
|
2565
|
+
this.elementId = elementId;
|
|
2566
|
+
var DEFAULTS = {
|
|
2567
|
+
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>",
|
|
2568
|
+
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>"
|
|
2569
|
+
};
|
|
2570
|
+
this.options = _extends({}, DEFAULTS, options);
|
|
2571
|
+
this.formData = [];
|
|
2572
|
+
this.forms = [];
|
|
2573
|
+
this.recordsToDelete = [];
|
|
2574
|
+
var el = document.getElementById(elementId);
|
|
2575
|
+
if (el) {
|
|
2576
|
+
el.addEventListener('click', this.handleClick.bind(this));
|
|
2577
|
+
el.innerHTML = "<div id='".concat(elementId, "_container' class='websy-multi-form-container'></div>");
|
|
2578
|
+
}
|
|
2579
|
+
this.render();
|
|
2580
|
+
}
|
|
2581
|
+
_createClass(MultiForm, [{
|
|
2582
|
+
key: "addEntry",
|
|
2583
|
+
value: function addEntry() {
|
|
2584
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2585
|
+
var newId = WebsyDesigns.Utils.createIdentity();
|
|
2586
|
+
var newFormEl = document.createElement('div');
|
|
2587
|
+
newFormEl.id = "".concat(this.elementId, "_").concat(newId, "_formContainer");
|
|
2588
|
+
newFormEl.classList.add('websy-multi-form-form-container');
|
|
2589
|
+
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 ");
|
|
2590
|
+
el.appendChild(newFormEl);
|
|
2591
|
+
var formOptions = _extends({}, this.options);
|
|
2592
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(newId, "_form"), formOptions));
|
|
2593
|
+
}
|
|
2594
|
+
}, {
|
|
2595
|
+
key: "clear",
|
|
2596
|
+
value: function clear() {
|
|
2597
|
+
this.formData = [];
|
|
2598
|
+
this.forms = [];
|
|
2599
|
+
this.recordsToDelete = [];
|
|
2600
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2601
|
+
if (el) {
|
|
2602
|
+
el.innerHTML = '';
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
}, {
|
|
2606
|
+
key: "data",
|
|
2607
|
+
get: function get() {
|
|
2608
|
+
var d = this.forms.map(function (f) {
|
|
2609
|
+
return f.data;
|
|
2610
|
+
});
|
|
2611
|
+
// we don't return the last form
|
|
2612
|
+
d.pop();
|
|
2613
|
+
return d;
|
|
2614
|
+
},
|
|
2615
|
+
set: function set(d) {
|
|
2616
|
+
this.formData = d;
|
|
2617
|
+
this.render();
|
|
2618
|
+
}
|
|
2619
|
+
}, {
|
|
2620
|
+
key: "handleClick",
|
|
2621
|
+
value: function handleClick(event) {
|
|
2622
|
+
if (event.target.classList.contains('websy-multi-form-add')) {
|
|
2623
|
+
var id = event.target.getAttribute('data-formid');
|
|
2624
|
+
// hide add button and show delete button
|
|
2625
|
+
var addButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_addButton"));
|
|
2626
|
+
if (addButtonEl) {
|
|
2627
|
+
addButtonEl.classList.add('hidden');
|
|
2628
|
+
}
|
|
2629
|
+
var deleteButtonEl = document.getElementById("".concat(this.elementId, "_").concat(id, "_deleteButton"));
|
|
2630
|
+
if (deleteButtonEl) {
|
|
2631
|
+
deleteButtonEl.classList.remove('hidden');
|
|
2632
|
+
}
|
|
2633
|
+
// add new form
|
|
2634
|
+
this.addEntry();
|
|
2635
|
+
}
|
|
2636
|
+
if (event.target.classList.contains('websy-multi-form-delete')) {
|
|
2637
|
+
// delete form based on index
|
|
2638
|
+
var _id = event.target.getAttribute('data-formid');
|
|
2639
|
+
var rowId = event.target.getAttribute('data-rowid');
|
|
2640
|
+
this.recordsToDelete.push(rowId);
|
|
2641
|
+
var indexToDelete = -1;
|
|
2642
|
+
for (var i = 0; i < this.forms.length; i++) {
|
|
2643
|
+
if (this.forms[i].elementId === "".concat(this.elementId, "_").concat(_id, "_form")) {
|
|
2644
|
+
indexToDelete = i;
|
|
2645
|
+
break;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
if (indexToDelete !== -1) {
|
|
2649
|
+
this.forms.splice(indexToDelete, 1);
|
|
2650
|
+
}
|
|
2651
|
+
var el = document.getElementById("".concat(this.elementId, "_").concat(_id, "_formContainer"));
|
|
2652
|
+
if (el) {
|
|
2653
|
+
el.remove();
|
|
2654
|
+
}
|
|
2655
|
+
// delete form element based on id
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
}, {
|
|
2659
|
+
key: "render",
|
|
2660
|
+
value: function render() {
|
|
2661
|
+
var _this19 = this;
|
|
2662
|
+
this.forms = [];
|
|
2663
|
+
this.recordsToDelete = [];
|
|
2664
|
+
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
2665
|
+
if (el) {
|
|
2666
|
+
var html = '';
|
|
2667
|
+
this.formData.forEach(function (d) {
|
|
2668
|
+
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2669
|
+
html += "\n <div id='".concat(_this19.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this19.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n <button id='").concat(_this19.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this19.options.deleteButton, "\n </button> \n </div>\n ");
|
|
2670
|
+
});
|
|
2671
|
+
var id = WebsyDesigns.Utils.createIdentity();
|
|
2672
|
+
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 ");
|
|
2673
|
+
el.innerHTML = html;
|
|
2674
|
+
this.formData.forEach(function (d) {
|
|
2675
|
+
var formOptions = _extends({}, _this19.options);
|
|
2676
|
+
var formObject = new WebsyDesigns.Form("".concat(_this19.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
2677
|
+
formObject.data = d;
|
|
2678
|
+
_this19.forms.push(formObject);
|
|
2679
|
+
});
|
|
2680
|
+
var formOptions = _extends({}, this.options);
|
|
2681
|
+
this.forms.push(new WebsyDesigns.Form("".concat(this.elementId, "_").concat(id, "_form"), formOptions));
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
}, {
|
|
2685
|
+
key: "validateForm",
|
|
2686
|
+
value: function validateForm() {
|
|
2687
|
+
// we don't validate the last form
|
|
2688
|
+
for (var i = 0; i < this.forms.length - 1; i++) {
|
|
2689
|
+
var valid = this.forms[i].validateForm();
|
|
2690
|
+
if (!valid) {
|
|
2691
|
+
return false;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
return true;
|
|
2695
|
+
}
|
|
2696
|
+
}]);
|
|
2697
|
+
return MultiForm;
|
|
2698
|
+
}();
|
|
2541
2699
|
/* global include */
|
|
2542
2700
|
var WebsyIcons = {
|
|
2543
2701
|
'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 ",
|
|
@@ -2744,7 +2902,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2744
2902
|
}, {
|
|
2745
2903
|
key: "handleSearch",
|
|
2746
2904
|
value: function handleSearch(searchText) {
|
|
2747
|
-
var
|
|
2905
|
+
var _this20 = this;
|
|
2748
2906
|
var el = document.getElementById(this.elementId);
|
|
2749
2907
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
2750
2908
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -2755,7 +2913,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2755
2913
|
if (searchText && searchText.length > 1) {
|
|
2756
2914
|
defaultMethod = 'add';
|
|
2757
2915
|
visibleItems = lowestItems.filter(function (d) {
|
|
2758
|
-
return d[
|
|
2916
|
+
return d[_this20.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
2759
2917
|
});
|
|
2760
2918
|
}
|
|
2761
2919
|
// hide everything
|
|
@@ -2937,7 +3095,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
2937
3095
|
/* global WebsyDesigns */
|
|
2938
3096
|
var Pager = /*#__PURE__*/function () {
|
|
2939
3097
|
function Pager(elementId, options) {
|
|
2940
|
-
var
|
|
3098
|
+
var _this21 = this;
|
|
2941
3099
|
_classCallCheck(this, Pager);
|
|
2942
3100
|
this.elementId = elementId;
|
|
2943
3101
|
var DEFAULTS = {
|
|
@@ -2984,8 +3142,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
2984
3142
|
allowClear: false,
|
|
2985
3143
|
disableSearch: true,
|
|
2986
3144
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
2987
|
-
if (
|
|
2988
|
-
|
|
3145
|
+
if (_this21.options.onChangePageSize) {
|
|
3146
|
+
_this21.options.onChangePageSize(selectedItem.value);
|
|
2989
3147
|
}
|
|
2990
3148
|
}
|
|
2991
3149
|
});
|
|
@@ -3006,11 +3164,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3006
3164
|
}, {
|
|
3007
3165
|
key: "render",
|
|
3008
3166
|
value: function render() {
|
|
3009
|
-
var
|
|
3167
|
+
var _this22 = this;
|
|
3010
3168
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3011
3169
|
if (el) {
|
|
3012
3170
|
var pages = this.options.pages.map(function (item, index) {
|
|
3013
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3171
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this22.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3014
3172
|
});
|
|
3015
3173
|
var startIndex = 0;
|
|
3016
3174
|
if (this.options.pages.length > 8) {
|
|
@@ -3068,48 +3226,48 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3068
3226
|
_createClass(WebsyPDFButton, [{
|
|
3069
3227
|
key: "handleClick",
|
|
3070
3228
|
value: function handleClick(event) {
|
|
3071
|
-
var
|
|
3229
|
+
var _this23 = this;
|
|
3072
3230
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3073
3231
|
this.loader.show();
|
|
3074
3232
|
setTimeout(function () {
|
|
3075
|
-
if (
|
|
3076
|
-
var el = document.getElementById(
|
|
3233
|
+
if (_this23.options.targetId) {
|
|
3234
|
+
var el = document.getElementById(_this23.options.targetId);
|
|
3077
3235
|
if (el) {
|
|
3078
3236
|
var pdfData = {
|
|
3079
3237
|
options: {}
|
|
3080
3238
|
};
|
|
3081
|
-
if (
|
|
3082
|
-
pdfData.options = _extends({},
|
|
3239
|
+
if (_this23.options.pdfOptions) {
|
|
3240
|
+
pdfData.options = _extends({}, _this23.options.pdfOptions);
|
|
3083
3241
|
}
|
|
3084
|
-
if (
|
|
3085
|
-
if (
|
|
3086
|
-
var headerEl = document.getElementById(
|
|
3242
|
+
if (_this23.options.header) {
|
|
3243
|
+
if (_this23.options.header.elementId) {
|
|
3244
|
+
var headerEl = document.getElementById(_this23.options.header.elementId);
|
|
3087
3245
|
if (headerEl) {
|
|
3088
3246
|
pdfData.header = headerEl.outerHTML;
|
|
3089
|
-
if (
|
|
3090
|
-
pdfData.options.headerCSS =
|
|
3247
|
+
if (_this23.options.header.css) {
|
|
3248
|
+
pdfData.options.headerCSS = _this23.options.header.css;
|
|
3091
3249
|
}
|
|
3092
3250
|
}
|
|
3093
|
-
} else if (
|
|
3094
|
-
pdfData.header =
|
|
3095
|
-
if (
|
|
3096
|
-
pdfData.options.headerCSS =
|
|
3251
|
+
} else if (_this23.options.header.html) {
|
|
3252
|
+
pdfData.header = _this23.options.header.html;
|
|
3253
|
+
if (_this23.options.header.css) {
|
|
3254
|
+
pdfData.options.headerCSS = _this23.options.header.css;
|
|
3097
3255
|
}
|
|
3098
3256
|
} else {
|
|
3099
|
-
pdfData.header =
|
|
3257
|
+
pdfData.header = _this23.options.header;
|
|
3100
3258
|
}
|
|
3101
3259
|
}
|
|
3102
|
-
if (
|
|
3103
|
-
if (
|
|
3104
|
-
var footerEl = document.getElementById(
|
|
3260
|
+
if (_this23.options.footer) {
|
|
3261
|
+
if (_this23.options.footer.elementId) {
|
|
3262
|
+
var footerEl = document.getElementById(_this23.options.footer.elementId);
|
|
3105
3263
|
if (footerEl) {
|
|
3106
3264
|
pdfData.footer = footerEl.outerHTML;
|
|
3107
|
-
if (
|
|
3108
|
-
pdfData.options.footerCSS =
|
|
3265
|
+
if (_this23.options.footer.css) {
|
|
3266
|
+
pdfData.options.footerCSS = _this23.options.footer.css;
|
|
3109
3267
|
}
|
|
3110
3268
|
}
|
|
3111
3269
|
} else {
|
|
3112
|
-
pdfData.footer =
|
|
3270
|
+
pdfData.footer = _this23.options.footer;
|
|
3113
3271
|
}
|
|
3114
3272
|
}
|
|
3115
3273
|
pdfData.html = el.outerHTML;
|
|
@@ -3117,25 +3275,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3117
3275
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3118
3276
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3119
3277
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3120
|
-
|
|
3278
|
+
_this23.service.add('', pdfData, {
|
|
3121
3279
|
responseType: 'blob'
|
|
3122
3280
|
}).then(function (response) {
|
|
3123
|
-
|
|
3281
|
+
_this23.loader.hide();
|
|
3124
3282
|
var blob = new Blob([response], {
|
|
3125
3283
|
type: 'application/pdf'
|
|
3126
3284
|
});
|
|
3127
3285
|
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 ");
|
|
3128
|
-
if (
|
|
3286
|
+
if (_this23.options.directDownload === true) {
|
|
3129
3287
|
var fileName;
|
|
3130
|
-
if (typeof
|
|
3131
|
-
fileName =
|
|
3288
|
+
if (typeof _this23.options.fileName === 'function') {
|
|
3289
|
+
fileName = _this23.options.fileName() || 'Export';
|
|
3132
3290
|
} else {
|
|
3133
|
-
fileName =
|
|
3291
|
+
fileName = _this23.options.fileName || 'Export';
|
|
3134
3292
|
}
|
|
3135
3293
|
msg += "download='".concat(fileName, ".pdf'");
|
|
3136
3294
|
}
|
|
3137
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3138
|
-
|
|
3295
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this23.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3296
|
+
_this23.popup.show({
|
|
3139
3297
|
message: msg,
|
|
3140
3298
|
mask: true
|
|
3141
3299
|
});
|
|
@@ -3303,7 +3461,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3303
3461
|
}();
|
|
3304
3462
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3305
3463
|
function ResponsiveText(elementId, options) {
|
|
3306
|
-
var
|
|
3464
|
+
var _this24 = this;
|
|
3307
3465
|
_classCallCheck(this, ResponsiveText);
|
|
3308
3466
|
var DEFAULTS = {
|
|
3309
3467
|
textAlign: 'center',
|
|
@@ -3314,7 +3472,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3314
3472
|
this.elementId = elementId;
|
|
3315
3473
|
this.canvas = document.createElement('canvas');
|
|
3316
3474
|
window.addEventListener('resize', function () {
|
|
3317
|
-
return
|
|
3475
|
+
return _this24.render();
|
|
3318
3476
|
});
|
|
3319
3477
|
var el = document.getElementById(this.elementId);
|
|
3320
3478
|
if (el) {
|
|
@@ -3504,7 +3662,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3504
3662
|
/* global WebsyDesigns */
|
|
3505
3663
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3506
3664
|
function WebsyResultList(elementId, options) {
|
|
3507
|
-
var
|
|
3665
|
+
var _this25 = this;
|
|
3508
3666
|
_classCallCheck(this, WebsyResultList);
|
|
3509
3667
|
var DEFAULTS = {
|
|
3510
3668
|
listeners: {
|
|
@@ -3530,8 +3688,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3530
3688
|
}
|
|
3531
3689
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3532
3690
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3533
|
-
|
|
3534
|
-
|
|
3691
|
+
_this25.options.template = templateString;
|
|
3692
|
+
_this25.render();
|
|
3535
3693
|
});
|
|
3536
3694
|
} else {
|
|
3537
3695
|
this.render();
|
|
@@ -3550,7 +3708,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3550
3708
|
}, {
|
|
3551
3709
|
key: "buildHTML",
|
|
3552
3710
|
value: function buildHTML(d) {
|
|
3553
|
-
var
|
|
3711
|
+
var _this26 = this;
|
|
3554
3712
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3555
3713
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
3556
3714
|
var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -3558,7 +3716,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3558
3716
|
if (this.options.template) {
|
|
3559
3717
|
if (d.length > 0) {
|
|
3560
3718
|
d.forEach(function (row, ix) {
|
|
3561
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3719
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this26.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3562
3720
|
// find conditional elements
|
|
3563
3721
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3564
3722
|
ifMatches.forEach(function (m) {
|
|
@@ -3646,7 +3804,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3646
3804
|
parts.forEach(function (p) {
|
|
3647
3805
|
items = items[p];
|
|
3648
3806
|
});
|
|
3649
|
-
template = template.replace(m[0],
|
|
3807
|
+
template = template.replace(m[0], _this26.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
3650
3808
|
}
|
|
3651
3809
|
});
|
|
3652
3810
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -3655,7 +3813,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3655
3813
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
3656
3814
|
}
|
|
3657
3815
|
});
|
|
3658
|
-
var flatRow =
|
|
3816
|
+
var flatRow = _this26.flattenObject(row);
|
|
3659
3817
|
for (var key in flatRow) {
|
|
3660
3818
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
3661
3819
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -3780,11 +3938,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3780
3938
|
}, {
|
|
3781
3939
|
key: "render",
|
|
3782
3940
|
value: function render() {
|
|
3783
|
-
var
|
|
3941
|
+
var _this27 = this;
|
|
3784
3942
|
if (this.options.entity) {
|
|
3785
|
-
this.
|
|
3786
|
-
|
|
3787
|
-
|
|
3943
|
+
var url = this.options.entity;
|
|
3944
|
+
if (this.options.sortField) {
|
|
3945
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
3946
|
+
}
|
|
3947
|
+
this.apiService.get(url).then(function (results) {
|
|
3948
|
+
_this27.rows = results.rows;
|
|
3949
|
+
_this27.resize();
|
|
3788
3950
|
});
|
|
3789
3951
|
} else {
|
|
3790
3952
|
this.resize();
|
|
@@ -3854,12 +4016,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3854
4016
|
_createClass(WebsyRouter, [{
|
|
3855
4017
|
key: "addGroup",
|
|
3856
4018
|
value: function addGroup(group) {
|
|
3857
|
-
var
|
|
4019
|
+
var _this28 = this;
|
|
3858
4020
|
if (!this.groups[group]) {
|
|
3859
4021
|
var els = document.querySelectorAll(".websy-view[data-group=\"".concat(group, "\"]"));
|
|
3860
4022
|
if (els) {
|
|
3861
4023
|
this.getClosestParent(els[0], function (parent) {
|
|
3862
|
-
|
|
4024
|
+
_this28.groups[group] = {
|
|
3863
4025
|
activeView: '',
|
|
3864
4026
|
views: [],
|
|
3865
4027
|
parent: parent.getAttribute('data-view')
|
|
@@ -3923,7 +4085,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3923
4085
|
}, {
|
|
3924
4086
|
key: "removeUrlParams",
|
|
3925
4087
|
value: function removeUrlParams() {
|
|
3926
|
-
var
|
|
4088
|
+
var _this29 = this;
|
|
3927
4089
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3928
4090
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3929
4091
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -3931,7 +4093,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
3931
4093
|
var path = '';
|
|
3932
4094
|
if (this.currentParams && this.currentParams.items) {
|
|
3933
4095
|
params.forEach(function (p) {
|
|
3934
|
-
delete
|
|
4096
|
+
delete _this29.currentParams.items[p];
|
|
3935
4097
|
});
|
|
3936
4098
|
path = this.buildUrlPath(this.currentParams.items);
|
|
3937
4099
|
}
|
|
@@ -4262,11 +4424,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4262
4424
|
}, {
|
|
4263
4425
|
key: "showComponents",
|
|
4264
4426
|
value: function showComponents(view) {
|
|
4265
|
-
var
|
|
4427
|
+
var _this30 = this;
|
|
4266
4428
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4267
4429
|
this.options.views[view].components.forEach(function (c) {
|
|
4268
4430
|
if (typeof c.instance === 'undefined') {
|
|
4269
|
-
|
|
4431
|
+
_this30.prepComponent(c.elementId, c.options);
|
|
4270
4432
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4271
4433
|
} else if (c.instance.render) {
|
|
4272
4434
|
c.instance.render();
|
|
@@ -4610,7 +4772,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
4610
4772
|
/* global WebsyDesigns */
|
|
4611
4773
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
4612
4774
|
function WebsyTemplate(elementId, options) {
|
|
4613
|
-
var
|
|
4775
|
+
var _this31 = this;
|
|
4614
4776
|
_classCallCheck(this, WebsyTemplate);
|
|
4615
4777
|
var DEFAULTS = {
|
|
4616
4778
|
listeners: {
|
|
@@ -4630,8 +4792,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4630
4792
|
}
|
|
4631
4793
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
4632
4794
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
4633
|
-
|
|
4634
|
-
|
|
4795
|
+
_this31.options.template = templateString;
|
|
4796
|
+
_this31.render();
|
|
4635
4797
|
});
|
|
4636
4798
|
} else {
|
|
4637
4799
|
this.render();
|
|
@@ -4640,7 +4802,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4640
4802
|
_createClass(WebsyTemplate, [{
|
|
4641
4803
|
key: "buildHTML",
|
|
4642
4804
|
value: function buildHTML() {
|
|
4643
|
-
var
|
|
4805
|
+
var _this32 = this;
|
|
4644
4806
|
var html = "";
|
|
4645
4807
|
if (this.options.template) {
|
|
4646
4808
|
var template = this.options.template;
|
|
@@ -4689,14 +4851,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
4689
4851
|
}
|
|
4690
4852
|
}
|
|
4691
4853
|
if (polarity === true) {
|
|
4692
|
-
if (typeof
|
|
4854
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] === parts[1]) {
|
|
4693
4855
|
// remove the <if> tags
|
|
4694
4856
|
removeAll = false;
|
|
4695
4857
|
} else if (parts[0] === parts[1]) {
|
|
4696
4858
|
removeAll = false;
|
|
4697
4859
|
}
|
|
4698
4860
|
} else if (polarity === false) {
|
|
4699
|
-
if (typeof
|
|
4861
|
+
if (typeof _this32.options.data[parts[0]] !== 'undefined' && _this32.options.data[parts[0]] !== parts[1]) {
|
|
4700
4862
|
// remove the <if> tags
|
|
4701
4863
|
removeAll = false;
|
|
4702
4864
|
}
|
|
@@ -4955,7 +5117,7 @@ var WebsyUtils = {
|
|
|
4955
5117
|
/* global WebsyDesigns */
|
|
4956
5118
|
var WebsyTable = /*#__PURE__*/function () {
|
|
4957
5119
|
function WebsyTable(elementId, options) {
|
|
4958
|
-
var
|
|
5120
|
+
var _this33 = this;
|
|
4959
5121
|
_classCallCheck(this, WebsyTable);
|
|
4960
5122
|
var DEFAULTS = {
|
|
4961
5123
|
pageSize: 20,
|
|
@@ -4987,8 +5149,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
4987
5149
|
allowClear: false,
|
|
4988
5150
|
disableSearch: true,
|
|
4989
5151
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
4990
|
-
if (
|
|
4991
|
-
|
|
5152
|
+
if (_this33.options.onChangePageSize) {
|
|
5153
|
+
_this33.options.onChangePageSize(selectedItem.value);
|
|
4992
5154
|
}
|
|
4993
5155
|
}
|
|
4994
5156
|
});
|
|
@@ -5007,19 +5169,19 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5007
5169
|
_createClass(WebsyTable, [{
|
|
5008
5170
|
key: "appendRows",
|
|
5009
5171
|
value: function appendRows(data) {
|
|
5010
|
-
var
|
|
5172
|
+
var _this34 = this;
|
|
5011
5173
|
this.hideError();
|
|
5012
5174
|
var bodyHTML = '';
|
|
5013
5175
|
if (data) {
|
|
5014
5176
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5015
5177
|
return '<tr>' + r.map(function (c, i) {
|
|
5016
|
-
if (
|
|
5178
|
+
if (_this34.options.columns[i].show !== false) {
|
|
5017
5179
|
var style = '';
|
|
5018
5180
|
if (c.style) {
|
|
5019
5181
|
style += c.style;
|
|
5020
5182
|
}
|
|
5021
|
-
if (
|
|
5022
|
-
style += "width: ".concat(
|
|
5183
|
+
if (_this34.options.columns[i].width) {
|
|
5184
|
+
style += "width: ".concat(_this34.options.columns[i].width, "; ");
|
|
5023
5185
|
}
|
|
5024
5186
|
if (c.backgroundColor) {
|
|
5025
5187
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5030,16 +5192,16 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5030
5192
|
if (c.color) {
|
|
5031
5193
|
style += "color: ".concat(c.color, "; ");
|
|
5032
5194
|
}
|
|
5033
|
-
if (
|
|
5034
|
-
return "\n <td \n data-row-index='".concat(
|
|
5035
|
-
} else if ((
|
|
5036
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5195
|
+
if (_this34.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5196
|
+
return "\n <td \n data-row-index='".concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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(_this34.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5197
|
+
} else if ((_this34.options.columns[i].showAsNavigatorLink === true || _this34.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5198
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this34.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this34.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this34.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5037
5199
|
} else {
|
|
5038
5200
|
var info = c.value;
|
|
5039
|
-
if (
|
|
5201
|
+
if (_this34.options.columns[i].showAsImage === true) {
|
|
5040
5202
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5041
5203
|
}
|
|
5042
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5204
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this34.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this34.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 ");
|
|
5043
5205
|
}
|
|
5044
5206
|
}
|
|
5045
5207
|
}).join('') + '</tr>';
|
|
@@ -5198,7 +5360,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5198
5360
|
}, {
|
|
5199
5361
|
key: "render",
|
|
5200
5362
|
value: function render(data) {
|
|
5201
|
-
var
|
|
5363
|
+
var _this35 = this;
|
|
5202
5364
|
if (!this.options.columns) {
|
|
5203
5365
|
return;
|
|
5204
5366
|
}
|
|
@@ -5225,7 +5387,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5225
5387
|
if (c.width) {
|
|
5226
5388
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5227
5389
|
}
|
|
5228
|
-
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 ?
|
|
5390
|
+
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 ? _this35.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5229
5391
|
}
|
|
5230
5392
|
}).join('') + '</tr>';
|
|
5231
5393
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5243,7 +5405,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5243
5405
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5244
5406
|
if (pagingEl) {
|
|
5245
5407
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5246
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5408
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this35.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5247
5409
|
});
|
|
5248
5410
|
var startIndex = 0;
|
|
5249
5411
|
if (this.options.pageCount > 8) {
|
|
@@ -5298,7 +5460,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5298
5460
|
/* global WebsyDesigns */
|
|
5299
5461
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5300
5462
|
function WebsyTable2(elementId, options) {
|
|
5301
|
-
var
|
|
5463
|
+
var _this36 = this;
|
|
5302
5464
|
_classCallCheck(this, WebsyTable2);
|
|
5303
5465
|
var DEFAULTS = {
|
|
5304
5466
|
pageSize: 20,
|
|
@@ -5333,8 +5495,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5333
5495
|
allowClear: false,
|
|
5334
5496
|
disableSearch: true,
|
|
5335
5497
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5336
|
-
if (
|
|
5337
|
-
|
|
5498
|
+
if (_this36.options.onChangePageSize) {
|
|
5499
|
+
_this36.options.onChangePageSize(selectedItem.value);
|
|
5338
5500
|
}
|
|
5339
5501
|
}
|
|
5340
5502
|
});
|
|
@@ -5356,20 +5518,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5356
5518
|
_createClass(WebsyTable2, [{
|
|
5357
5519
|
key: "appendRows",
|
|
5358
5520
|
value: function appendRows(data) {
|
|
5359
|
-
var
|
|
5521
|
+
var _this37 = this;
|
|
5360
5522
|
this.hideError();
|
|
5361
5523
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5362
5524
|
var bodyHTML = '';
|
|
5363
5525
|
if (data) {
|
|
5364
5526
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5365
5527
|
return '<tr>' + r.map(function (c, i) {
|
|
5366
|
-
if (
|
|
5367
|
-
var style = "height: ".concat(
|
|
5528
|
+
if (_this37.options.columns[i].show !== false) {
|
|
5529
|
+
var style = "height: ".concat(_this37.options.cellSize, "px; line-height: ").concat(_this37.options.cellSize, "px;");
|
|
5368
5530
|
if (c.style) {
|
|
5369
5531
|
style += c.style;
|
|
5370
5532
|
}
|
|
5371
|
-
if (
|
|
5372
|
-
style += "width: ".concat(
|
|
5533
|
+
if (_this37.options.columns[i].width) {
|
|
5534
|
+
style += "width: ".concat(_this37.options.columns[i].width, "; ");
|
|
5373
5535
|
}
|
|
5374
5536
|
if (c.backgroundColor) {
|
|
5375
5537
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5380,16 +5542,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5380
5542
|
if (c.color) {
|
|
5381
5543
|
style += "color: ".concat(c.color, "; ");
|
|
5382
5544
|
}
|
|
5383
|
-
if (
|
|
5384
|
-
return "\n <td \n data-row-index='".concat(
|
|
5385
|
-
} else if ((
|
|
5386
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5545
|
+
if (_this37.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5546
|
+
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 ");
|
|
5547
|
+
} else if ((_this37.options.columns[i].showAsNavigatorLink === true || _this37.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5548
|
+
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 ");
|
|
5387
5549
|
} else {
|
|
5388
5550
|
var info = c.value;
|
|
5389
|
-
if (
|
|
5551
|
+
if (_this37.options.columns[i].showAsImage === true) {
|
|
5390
5552
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5391
5553
|
}
|
|
5392
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5554
|
+
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 ");
|
|
5393
5555
|
}
|
|
5394
5556
|
}
|
|
5395
5557
|
}).join('') + '</tr>';
|
|
@@ -5623,7 +5785,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5623
5785
|
}, {
|
|
5624
5786
|
key: "render",
|
|
5625
5787
|
value: function render(data) {
|
|
5626
|
-
var
|
|
5788
|
+
var _this38 = this;
|
|
5627
5789
|
if (!this.options.columns) {
|
|
5628
5790
|
return;
|
|
5629
5791
|
}
|
|
@@ -5651,7 +5813,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5651
5813
|
if (c.width) {
|
|
5652
5814
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
5653
5815
|
}
|
|
5654
|
-
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 ?
|
|
5816
|
+
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 ? _this38.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5655
5817
|
}
|
|
5656
5818
|
}).join('') + '</tr>';
|
|
5657
5819
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5661,7 +5823,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5661
5823
|
var dropdownHTML = "";
|
|
5662
5824
|
this.options.columns.forEach(function (c, i) {
|
|
5663
5825
|
if (c.searchable && c.searchField) {
|
|
5664
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
5826
|
+
dropdownHTML += "\n <div id=\"".concat(_this38.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
5665
5827
|
}
|
|
5666
5828
|
});
|
|
5667
5829
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -5681,7 +5843,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5681
5843
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5682
5844
|
if (pagingEl) {
|
|
5683
5845
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5684
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5846
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this38.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5685
5847
|
});
|
|
5686
5848
|
var startIndex = 0;
|
|
5687
5849
|
if (this.options.pageCount > 8) {
|
|
@@ -5758,17 +5920,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5758
5920
|
}, {
|
|
5759
5921
|
key: "getColumnParameters",
|
|
5760
5922
|
value: function getColumnParameters(values) {
|
|
5761
|
-
var
|
|
5923
|
+
var _this39 = this;
|
|
5762
5924
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
5763
5925
|
tableEl.style.tableLayout = 'auto';
|
|
5764
5926
|
tableEl.style.width = 'auto';
|
|
5765
5927
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
5766
5928
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5767
5929
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
5768
|
-
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 ?
|
|
5930
|
+
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 ? _this39.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
5769
5931
|
}).join('') + '</tr>';
|
|
5770
5932
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
5771
|
-
return "\n <td \n style='height: ".concat(
|
|
5933
|
+
return "\n <td \n style='height: ".concat(_this39.options.cellSize, "px; line-height: ").concat(_this39.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
5772
5934
|
}).join('') + '</tr>';
|
|
5773
5935
|
// get height of the first data cell
|
|
5774
5936
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -5856,11 +6018,20 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5856
6018
|
if (this.isTouchDevice === true && this.options.virtualScroll === true) {
|
|
5857
6019
|
html += "\n <div id=\"".concat(this.elementId, "_touchScroller\" class=\"websy-table-touch-scroller\"></div>\n ");
|
|
5858
6020
|
}
|
|
5859
|
-
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, "
|
|
6021
|
+
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 ");
|
|
5860
6022
|
if (this.options.paging === 'pages') {
|
|
5861
6023
|
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 ");
|
|
5862
6024
|
}
|
|
5863
6025
|
el.innerHTML = html;
|
|
6026
|
+
var dropdownContainerEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6027
|
+
if (dropdownContainerEl) {
|
|
6028
|
+
dropdownContainerEl.innerHTML = '';
|
|
6029
|
+
} else {
|
|
6030
|
+
var div = document.createElement('div');
|
|
6031
|
+
div.id = "".concat(this.elementId, "_dropdownContainer");
|
|
6032
|
+
div.classList.add('table-dropdown-container');
|
|
6033
|
+
document.body.appendChild(div);
|
|
6034
|
+
}
|
|
5864
6035
|
el.addEventListener('click', this.handleClick.bind(this));
|
|
5865
6036
|
el.addEventListener('mousedown', this.handleMouseDown.bind(this));
|
|
5866
6037
|
el.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
|
@@ -5914,7 +6085,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5914
6085
|
}, {
|
|
5915
6086
|
key: "buildBodyHtml",
|
|
5916
6087
|
value: function buildBodyHtml() {
|
|
5917
|
-
var
|
|
6088
|
+
var _this40 = this;
|
|
5918
6089
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
5919
6090
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
5920
6091
|
if (!this.options.columns) {
|
|
@@ -5966,7 +6137,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5966
6137
|
style += "color: ".concat(cell.color, "; ");
|
|
5967
6138
|
}
|
|
5968
6139
|
// console.log('rowspan', cell.rowspan)
|
|
5969
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6140
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this40.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 ");
|
|
5970
6141
|
// if (useWidths === true) {
|
|
5971
6142
|
// bodyHtml += `
|
|
5972
6143
|
// style='width: ${sizingColumns[cellIndex].width || sizingColumns[cellIndex].actualWidth}px!important'
|
|
@@ -5975,10 +6146,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5975
6146
|
// }
|
|
5976
6147
|
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 >");
|
|
5977
6148
|
if (cell.expandable === true) {
|
|
5978
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6149
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this40.options.plusIcon, "</i>");
|
|
5979
6150
|
}
|
|
5980
6151
|
if (cell.collapsable === true) {
|
|
5981
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6152
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this40.options.minusIcon, "</i>");
|
|
5982
6153
|
}
|
|
5983
6154
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
5984
6155
|
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 ");
|
|
@@ -5999,7 +6170,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
5999
6170
|
}, {
|
|
6000
6171
|
key: "buildHeaderHtml",
|
|
6001
6172
|
value: function buildHeaderHtml() {
|
|
6002
|
-
var
|
|
6173
|
+
var _this41 = this;
|
|
6003
6174
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6004
6175
|
if (!this.options.columns) {
|
|
6005
6176
|
return '';
|
|
@@ -6016,7 +6187,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6016
6187
|
headerHtml += '</colgroup>';
|
|
6017
6188
|
}
|
|
6018
6189
|
this.options.columns.forEach(function (row, rowIndex) {
|
|
6019
|
-
if (useWidths === false && rowIndex !==
|
|
6190
|
+
if (useWidths === false && rowIndex !== _this41.options.columns.length - 1) {
|
|
6020
6191
|
// if we're calculating the size we only want to render the last row of column headers
|
|
6021
6192
|
return;
|
|
6022
6193
|
}
|
|
@@ -6040,24 +6211,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6040
6211
|
if (col.style) {
|
|
6041
6212
|
style += col.style;
|
|
6042
6213
|
}
|
|
6043
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6214
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this41.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6044
6215
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6045
6216
|
// headerHtml += `
|
|
6046
6217
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6047
6218
|
// width='${col.width || col.actualWidth}'
|
|
6048
6219
|
// `
|
|
6049
6220
|
// }
|
|
6050
|
-
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 ?
|
|
6221
|
+
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 ? _this41.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this41.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6051
6222
|
});
|
|
6052
6223
|
headerHtml += "</tr>";
|
|
6053
6224
|
});
|
|
6054
6225
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6055
6226
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6056
6227
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6057
|
-
var testEl = document.getElementById("".concat(
|
|
6228
|
+
var testEl = document.getElementById("".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6058
6229
|
if (!testEl) {
|
|
6059
6230
|
var newE = document.createElement('div');
|
|
6060
|
-
newE.id = "".concat(
|
|
6231
|
+
newE.id = "".concat(_this41.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6061
6232
|
newE.className = 'websy-modal-dropdown';
|
|
6062
6233
|
dropdownEl.appendChild(newE);
|
|
6063
6234
|
}
|
|
@@ -6080,7 +6251,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6080
6251
|
}, {
|
|
6081
6252
|
key: "buildTotalHtml",
|
|
6082
6253
|
value: function buildTotalHtml() {
|
|
6083
|
-
var
|
|
6254
|
+
var _this42 = this;
|
|
6084
6255
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6085
6256
|
if (!this.options.totals) {
|
|
6086
6257
|
return '';
|
|
@@ -6096,7 +6267,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6096
6267
|
|
|
6097
6268
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6098
6269
|
if (useWidths === true) {
|
|
6099
|
-
totalHtml += "\n style='width: ".concat(
|
|
6270
|
+
totalHtml += "\n style='width: ".concat(_this42.options.columns[_this42.options.columns.length - 1][colIndex].width || _this42.options.columns[_this42.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6100
6271
|
}
|
|
6101
6272
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6102
6273
|
});
|
|
@@ -6106,7 +6277,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6106
6277
|
}, {
|
|
6107
6278
|
key: "calculateSizes",
|
|
6108
6279
|
value: function calculateSizes() {
|
|
6109
|
-
var
|
|
6280
|
+
var _this43 = this;
|
|
6110
6281
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6111
6282
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6112
6283
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6150,7 +6321,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6150
6321
|
rows.forEach(function (row, rowIndex) {
|
|
6151
6322
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6152
6323
|
var colSize = col.getBoundingClientRect();
|
|
6153
|
-
|
|
6324
|
+
_this43.sizes.cellHeight = colSize.height;
|
|
6154
6325
|
if (columnsForSizing[colIndex]) {
|
|
6155
6326
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6156
6327
|
columnsForSizing[colIndex].actualWidth = 0;
|
|
@@ -6160,7 +6331,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6160
6331
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6161
6332
|
// }
|
|
6162
6333
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6163
|
-
if (colIndex >=
|
|
6334
|
+
if (colIndex >= _this43.pinnedColumns) {
|
|
6164
6335
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6165
6336
|
}
|
|
6166
6337
|
}
|
|
@@ -6175,7 +6346,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6175
6346
|
return a + (b.width || b.actualWidth);
|
|
6176
6347
|
}, 0);
|
|
6177
6348
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6178
|
-
return i >=
|
|
6349
|
+
return i >= _this43.pinnedColumns;
|
|
6179
6350
|
}).reduce(function (a, b) {
|
|
6180
6351
|
return a + (b.width || b.actualWidth);
|
|
6181
6352
|
}, 0);
|
|
@@ -6195,9 +6366,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6195
6366
|
c.actualWidth += equalWidth;
|
|
6196
6367
|
// }
|
|
6197
6368
|
// }
|
|
6198
|
-
|
|
6199
|
-
if (i >
|
|
6200
|
-
|
|
6369
|
+
_this43.sizes.totalWidth += c.width || c.actualWidth;
|
|
6370
|
+
if (i > _this43.pinnedColumns) {
|
|
6371
|
+
_this43.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6201
6372
|
}
|
|
6202
6373
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6203
6374
|
});
|
|
@@ -6256,7 +6427,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6256
6427
|
}, {
|
|
6257
6428
|
key: "createSample",
|
|
6258
6429
|
value: function createSample(data) {
|
|
6259
|
-
var
|
|
6430
|
+
var _this44 = this;
|
|
6260
6431
|
var output = [];
|
|
6261
6432
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6262
6433
|
if (col.maxLength) {
|
|
@@ -6266,7 +6437,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6266
6437
|
} else if (data) {
|
|
6267
6438
|
var longest = '';
|
|
6268
6439
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6269
|
-
if (data[i].length ===
|
|
6440
|
+
if (data[i].length === _this44.options.columns[_this44.options.columns.length - 1].length) {
|
|
6270
6441
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6271
6442
|
longest = data[i][colIndex].value;
|
|
6272
6443
|
}
|
|
@@ -6538,7 +6709,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6538
6709
|
}, {
|
|
6539
6710
|
key: "perpetualScroll",
|
|
6540
6711
|
value: function perpetualScroll() {
|
|
6541
|
-
var
|
|
6712
|
+
var _this45 = this;
|
|
6542
6713
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
6543
6714
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
6544
6715
|
return;
|
|
@@ -6557,17 +6728,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6557
6728
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
6558
6729
|
var _loop2 = function _loop2(i) {
|
|
6559
6730
|
setTimeout(function () {
|
|
6560
|
-
var delta =
|
|
6731
|
+
var delta = _this45.mouseYStart - _this45.currentClientY + _this45.sizes.cellHeight * (i + 1) * direction;
|
|
6561
6732
|
delta = Math.min(10, delta);
|
|
6562
6733
|
delta = Math.max(-10, delta);
|
|
6563
6734
|
// only run this if isPerpetual === true
|
|
6564
6735
|
// this value is reset to false on touchStart
|
|
6565
|
-
if (
|
|
6736
|
+
if (_this45.isPerpetual === true) {
|
|
6566
6737
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
6567
6738
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
6568
|
-
|
|
6569
|
-
if (
|
|
6570
|
-
clearTimeout(
|
|
6739
|
+
_this45.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
6740
|
+
if (_this45.scrollTimeout) {
|
|
6741
|
+
clearTimeout(_this45.scrollTimeout);
|
|
6571
6742
|
}
|
|
6572
6743
|
}
|
|
6573
6744
|
}, 1000 / fps * i);
|
|
@@ -6763,6 +6934,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6763
6934
|
if (this.endCol === this.options.allColumns[this.options.allColumns.length - 1].length - 1 && cumulativeWidth > this.sizes.scrollableWidth && actualLeft > 0) {
|
|
6764
6935
|
this.startCol += 1;
|
|
6765
6936
|
}
|
|
6937
|
+
if (scrollHandleEl.offsetWidth + scrollHandleEl.offsetLeft >= scrollContainerEl.offsetWidth) {
|
|
6938
|
+
this.startCol += 1;
|
|
6939
|
+
this.endCol += 1;
|
|
6940
|
+
}
|
|
6766
6941
|
this.endCol = Math.max(this.startCol, this.endCol);
|
|
6767
6942
|
this.options.onScroll('y', this.startRow, this.endRow, this.startCol - this.pinnedColumns, this.endCol - this.pinnedColumns);
|
|
6768
6943
|
}
|
|
@@ -6821,7 +6996,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6821
6996
|
/* global d3 include WebsyDesigns */
|
|
6822
6997
|
var WebsyChart = /*#__PURE__*/function () {
|
|
6823
6998
|
function WebsyChart(elementId, options) {
|
|
6824
|
-
var
|
|
6999
|
+
var _this46 = this;
|
|
6825
7000
|
_classCallCheck(this, WebsyChart);
|
|
6826
7001
|
var DEFAULTS = {
|
|
6827
7002
|
margin: {
|
|
@@ -6878,7 +7053,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6878
7053
|
this.invertOverride = function (input, input2) {
|
|
6879
7054
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6880
7055
|
var xAxis = 'bottom';
|
|
6881
|
-
if (
|
|
7056
|
+
if (_this46.options.orientation === 'horizontal') {
|
|
6882
7057
|
xAxis = 'left';
|
|
6883
7058
|
}
|
|
6884
7059
|
if (forBrush === true) {
|
|
@@ -6886,12 +7061,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
6886
7061
|
}
|
|
6887
7062
|
xAxis += 'Axis';
|
|
6888
7063
|
var output;
|
|
6889
|
-
var width =
|
|
7064
|
+
var width = _this46.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
6890
7065
|
// if (this.customBottomRange) {
|
|
6891
|
-
for (var index = 0; index <
|
|
6892
|
-
if (input >
|
|
6893
|
-
if (
|
|
6894
|
-
if (input <
|
|
7066
|
+
for (var index = 0; index < _this46.customBottomRange.length; index++) {
|
|
7067
|
+
if (input > _this46.customBottomRange[index]) {
|
|
7068
|
+
if (_this46.customBottomRange[index + 1]) {
|
|
7069
|
+
if (input < _this46.customBottomRange[index + 1]) {
|
|
6895
7070
|
output = index;
|
|
6896
7071
|
break;
|
|
6897
7072
|
}
|
|
@@ -7066,9 +7241,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7066
7241
|
}, {
|
|
7067
7242
|
key: "handleEventMouseMove",
|
|
7068
7243
|
value: function handleEventMouseMove(event, d) {
|
|
7069
|
-
var
|
|
7244
|
+
var _this47 = this;
|
|
7070
7245
|
var bisectDate = d3.bisector(function (d) {
|
|
7071
|
-
return
|
|
7246
|
+
return _this47.parseX(d.x.value);
|
|
7072
7247
|
}).left;
|
|
7073
7248
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7074
7249
|
var xAxis = 'bottomAxis';
|
|
@@ -7101,9 +7276,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7101
7276
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7102
7277
|
}
|
|
7103
7278
|
this.options.data.series.forEach(function (s) {
|
|
7104
|
-
if (
|
|
7279
|
+
if (_this47.options.data[xData].scale !== 'Time') {
|
|
7105
7280
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7106
|
-
xPoint =
|
|
7281
|
+
xPoint = _this47.customBottomRange[x0] + (_this47.customBottomRange[x0 + 1] - _this47.customBottomRange[x0]) / 2;
|
|
7107
7282
|
// }
|
|
7108
7283
|
// else {
|
|
7109
7284
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7123,41 +7298,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7123
7298
|
var index = bisectDate(s.data, x0, 1);
|
|
7124
7299
|
var pointA = s.data[index - 1];
|
|
7125
7300
|
var pointB = s.data[index];
|
|
7126
|
-
if (
|
|
7301
|
+
if (_this47.options.orientation === 'horizontal') {
|
|
7127
7302
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7128
7303
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7129
7304
|
}
|
|
7130
7305
|
if (pointA && !pointB) {
|
|
7131
|
-
xPoint =
|
|
7306
|
+
xPoint = _this47[xAxis](_this47.parseX(pointA.x.value));
|
|
7132
7307
|
tooltipTitle = pointA.x.value;
|
|
7133
7308
|
if (!pointA.y.color) {
|
|
7134
7309
|
pointA.y.color = s.color;
|
|
7135
7310
|
}
|
|
7136
7311
|
tooltipData.push(pointA);
|
|
7137
7312
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7138
|
-
tooltipTitle = d3.timeFormat(
|
|
7313
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7139
7314
|
}
|
|
7140
7315
|
}
|
|
7141
7316
|
if (pointB && !pointA) {
|
|
7142
|
-
xPoint =
|
|
7317
|
+
xPoint = _this47[xAxis](_this47.parseX(pointB.x.value));
|
|
7143
7318
|
tooltipTitle = pointB.x.value;
|
|
7144
7319
|
if (!pointB.y.color) {
|
|
7145
7320
|
pointB.y.color = s.color;
|
|
7146
7321
|
}
|
|
7147
7322
|
tooltipData.push(pointB);
|
|
7148
7323
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7149
|
-
tooltipTitle = d3.timeFormat(
|
|
7324
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7150
7325
|
}
|
|
7151
7326
|
}
|
|
7152
7327
|
if (pointA && pointB) {
|
|
7153
|
-
var d0 =
|
|
7154
|
-
var d1 =
|
|
7328
|
+
var d0 = _this47[xAxis](_this47.parseX(pointA.x.value));
|
|
7329
|
+
var d1 = _this47[xAxis](_this47.parseX(pointB.x.value));
|
|
7155
7330
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7156
7331
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7157
7332
|
xPoint = d1;
|
|
7158
7333
|
tooltipTitle = pointB.x.value;
|
|
7159
7334
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7160
|
-
tooltipTitle = d3.timeFormat(
|
|
7335
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7161
7336
|
}
|
|
7162
7337
|
if (!pointB.y.color) {
|
|
7163
7338
|
pointB.y.color = s.color;
|
|
@@ -7167,7 +7342,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7167
7342
|
xPoint = d0;
|
|
7168
7343
|
tooltipTitle = pointA.x.value;
|
|
7169
7344
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7170
|
-
tooltipTitle = d3.timeFormat(
|
|
7345
|
+
tooltipTitle = d3.timeFormat(_this47.options.dateFormat || _this47.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7171
7346
|
}
|
|
7172
7347
|
if (!pointA.y.color) {
|
|
7173
7348
|
pointA.y.color = s.color;
|
|
@@ -7293,7 +7468,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7293
7468
|
}, {
|
|
7294
7469
|
key: "render",
|
|
7295
7470
|
value: function render(options) {
|
|
7296
|
-
var
|
|
7471
|
+
var _this48 = this;
|
|
7297
7472
|
/* global d3 options WebsyUtils */
|
|
7298
7473
|
if (typeof options !== 'undefined') {
|
|
7299
7474
|
this.options = _extends({}, this.options, options);
|
|
@@ -7361,7 +7536,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7361
7536
|
this.options.data.series.map(function (s, i) {
|
|
7362
7537
|
return {
|
|
7363
7538
|
value: s.label || s.key,
|
|
7364
|
-
color: s.color ||
|
|
7539
|
+
color: s.color || _this48.options.colors[i % _this48.options.colors.length]
|
|
7365
7540
|
};
|
|
7366
7541
|
});
|
|
7367
7542
|
}
|
|
@@ -7718,25 +7893,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7718
7893
|
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') {
|
|
7719
7894
|
var acc = 0;
|
|
7720
7895
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
7721
|
-
var adjustment =
|
|
7896
|
+
var adjustment = _this48.bandPadding * index + _this48.bandPadding;
|
|
7722
7897
|
// if (this.options.data.bottom.padding) {
|
|
7723
7898
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
7724
7899
|
// }
|
|
7725
|
-
var start =
|
|
7900
|
+
var start = _this48.widthForCalc / noOfPoints * acc;
|
|
7726
7901
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
7727
7902
|
var pos = i * proposedBandWidth;
|
|
7728
|
-
|
|
7903
|
+
_this48["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
7729
7904
|
}
|
|
7730
|
-
acc +=
|
|
7731
|
-
var end =
|
|
7905
|
+
acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
7906
|
+
var end = _this48.widthForCalc / noOfPoints * acc;
|
|
7732
7907
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
7733
7908
|
return end + adjustment;
|
|
7734
7909
|
})));
|
|
7735
7910
|
acc = 0;
|
|
7736
7911
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
7737
|
-
var adjustment =
|
|
7738
|
-
acc +=
|
|
7739
|
-
return (
|
|
7912
|
+
var adjustment = _this48.brushBandPadding * index + _this48.brushBandPadding;
|
|
7913
|
+
acc += _this48.options.grouping !== 'stacked' && _this48.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
7914
|
+
return (_this48.options.orientation === 'vertical' ? _this48.plotWidth : _this48.plotHeight) / noOfPoints * acc;
|
|
7740
7915
|
})));
|
|
7741
7916
|
}
|
|
7742
7917
|
// }
|
|
@@ -7907,7 +8082,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7907
8082
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
7908
8083
|
if (this.options.data.bottom.formatter) {
|
|
7909
8084
|
this.bAxisFunc.tickFormat(function (d) {
|
|
7910
|
-
return
|
|
8085
|
+
return _this48.options.data.bottom.formatter(d);
|
|
7911
8086
|
});
|
|
7912
8087
|
}
|
|
7913
8088
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -7917,7 +8092,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7917
8092
|
}
|
|
7918
8093
|
if (this.customBottomRange.length > 0) {
|
|
7919
8094
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
7920
|
-
return "translate(".concat(
|
|
8095
|
+
return "translate(".concat(_this48.customBottomRange[i] + (_this48.customBottomRange[i + 1] - _this48.customBottomRange[i]) / 2, ", 0)");
|
|
7921
8096
|
});
|
|
7922
8097
|
}
|
|
7923
8098
|
}
|
|
@@ -7935,14 +8110,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7935
8110
|
}
|
|
7936
8111
|
if (this.options.margin.axisLeft > 0) {
|
|
7937
8112
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
7938
|
-
if (
|
|
7939
|
-
d =
|
|
8113
|
+
if (_this48.options.data.left.formatter) {
|
|
8114
|
+
d = _this48.options.data.left.formatter(d);
|
|
7940
8115
|
}
|
|
7941
8116
|
return d;
|
|
7942
8117
|
}));
|
|
7943
8118
|
if (this.customLeftRange.length > 0) {
|
|
7944
8119
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
7945
|
-
return "translate(0, ".concat(
|
|
8120
|
+
return "translate(0, ".concat(_this48.customLeftRange[i] + (_this48.customLeftRange[i + 1] - _this48.customLeftRange[i]) / 2, ")");
|
|
7946
8121
|
});
|
|
7947
8122
|
}
|
|
7948
8123
|
}
|
|
@@ -7969,8 +8144,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7969
8144
|
}
|
|
7970
8145
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
7971
8146
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
7972
|
-
if (
|
|
7973
|
-
d =
|
|
8147
|
+
if (_this48.options.data.right.formatter) {
|
|
8148
|
+
d = _this48.options.data.right.formatter(d);
|
|
7974
8149
|
}
|
|
7975
8150
|
return d;
|
|
7976
8151
|
}));
|
|
@@ -8010,50 +8185,50 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8010
8185
|
}, {
|
|
8011
8186
|
key: "renderComponents",
|
|
8012
8187
|
value: function renderComponents() {
|
|
8013
|
-
var
|
|
8188
|
+
var _this49 = this;
|
|
8014
8189
|
// Draw the series data
|
|
8015
8190
|
this.renderedKeys = {};
|
|
8016
8191
|
this.options.data.series.forEach(function (series, index) {
|
|
8017
8192
|
if (!series.key) {
|
|
8018
|
-
series.key =
|
|
8193
|
+
series.key = _this49.createIdentity();
|
|
8019
8194
|
}
|
|
8020
8195
|
if (!series.color) {
|
|
8021
|
-
series.color =
|
|
8196
|
+
series.color = _this49.options.colors[index % _this49.options.colors.length];
|
|
8022
8197
|
}
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8198
|
+
_this49["render".concat(series.type || 'bar')](series, index);
|
|
8199
|
+
_this49.renderLabels(series, index);
|
|
8200
|
+
_this49.renderedKeys[series.key] = series.type;
|
|
8026
8201
|
});
|
|
8027
8202
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8028
8203
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8029
8204
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8030
8205
|
this.options.refLines.forEach(function (l) {
|
|
8031
|
-
return
|
|
8206
|
+
return _this49.renderRefLine(l);
|
|
8032
8207
|
});
|
|
8033
8208
|
}
|
|
8034
8209
|
}
|
|
8035
8210
|
}, {
|
|
8036
8211
|
key: "renderarea",
|
|
8037
8212
|
value: function renderarea(series, index) {
|
|
8038
|
-
var
|
|
8213
|
+
var _this50 = this;
|
|
8039
8214
|
/* global d3 series index */
|
|
8040
8215
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8041
8216
|
return d3.area().x(function (d) {
|
|
8042
|
-
if (
|
|
8043
|
-
return
|
|
8217
|
+
if (_this50.options.data[xAxis].scale === 'Time') {
|
|
8218
|
+
return _this50["".concat(xAxis, "Axis")](_this50.parseX(d.x.value));
|
|
8044
8219
|
} else {
|
|
8045
|
-
var xIndex =
|
|
8046
|
-
var xPos =
|
|
8047
|
-
if (
|
|
8048
|
-
xPos = xPos + (
|
|
8220
|
+
var xIndex = _this50[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8221
|
+
var xPos = _this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8222
|
+
if (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8223
|
+
xPos = xPos + (_this50["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8049
8224
|
}
|
|
8050
8225
|
return xPos;
|
|
8051
8226
|
}
|
|
8052
8227
|
}).y0(function (d) {
|
|
8053
|
-
return
|
|
8228
|
+
return _this50["".concat(yAxis, "Axis")](0);
|
|
8054
8229
|
}).y1(function (d) {
|
|
8055
|
-
return
|
|
8056
|
-
}).curve(d3[curveStyle ||
|
|
8230
|
+
return _this50["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8231
|
+
}).curve(d3[curveStyle || _this50.options.curveStyle]);
|
|
8057
8232
|
};
|
|
8058
8233
|
var xAxis = 'bottom';
|
|
8059
8234
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8093,7 +8268,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8093
8268
|
}, {
|
|
8094
8269
|
key: "renderbar",
|
|
8095
8270
|
value: function renderbar(series, index) {
|
|
8096
|
-
var
|
|
8271
|
+
var _this51 = this;
|
|
8097
8272
|
/* global series index d3 */
|
|
8098
8273
|
var xAxis = 'bottom';
|
|
8099
8274
|
var yAxis = 'left';
|
|
@@ -8260,26 +8435,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8260
8435
|
}
|
|
8261
8436
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8262
8437
|
bars.attr('width', function (d, i) {
|
|
8263
|
-
return Math.abs(getBarWidth.call(
|
|
8438
|
+
return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
|
|
8264
8439
|
}).attr('height', function (d, i) {
|
|
8265
|
-
return getBarHeight.call(
|
|
8440
|
+
return getBarHeight.call(_this51, d, i, yAxis, xAxis);
|
|
8266
8441
|
}).attr('x', function (d, i) {
|
|
8267
|
-
return getBarX.call(
|
|
8442
|
+
return getBarX.call(_this51, d, i, yAxis, xAxis);
|
|
8268
8443
|
}).attr('y', function (d, i) {
|
|
8269
|
-
return getBarY.call(
|
|
8444
|
+
return getBarY.call(_this51, d, i, yAxis, xAxis);
|
|
8270
8445
|
})
|
|
8271
8446
|
// .transition(this.transition)
|
|
8272
8447
|
.attr('fill', function (d) {
|
|
8273
8448
|
return d.y.color || d.color || series.color;
|
|
8274
8449
|
});
|
|
8275
8450
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8276
|
-
return Math.abs(getBarWidth.call(
|
|
8451
|
+
return Math.abs(getBarWidth.call(_this51, d, i, yAxis, xAxis));
|
|
8277
8452
|
}).attr('height', function (d, i) {
|
|
8278
|
-
return getBarHeight.call(
|
|
8453
|
+
return getBarHeight.call(_this51, d, i, yAxis, xAxis);
|
|
8279
8454
|
}).attr('x', function (d, i) {
|
|
8280
|
-
return getBarX.call(
|
|
8455
|
+
return getBarX.call(_this51, d, i, yAxis, xAxis);
|
|
8281
8456
|
}).attr('y', function (d, i) {
|
|
8282
|
-
return getBarY.call(
|
|
8457
|
+
return getBarY.call(_this51, d, i, yAxis, xAxis);
|
|
8283
8458
|
})
|
|
8284
8459
|
// .transition(this.transition)
|
|
8285
8460
|
.attr('fill', function (d) {
|
|
@@ -8291,26 +8466,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8291
8466
|
this.brushBarsInitialized[series.key] = true;
|
|
8292
8467
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8293
8468
|
brushBars.attr('width', function (d, i) {
|
|
8294
|
-
return Math.abs(getBarWidth.call(
|
|
8469
|
+
return Math.abs(getBarWidth.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8295
8470
|
}).attr('height', function (d, i) {
|
|
8296
|
-
return getBarHeight.call(
|
|
8471
|
+
return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8297
8472
|
}).attr('x', function (d, i) {
|
|
8298
|
-
return getBarX.call(
|
|
8473
|
+
return getBarX.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8299
8474
|
}).attr('y', function (d, i) {
|
|
8300
|
-
return getBarY.call(
|
|
8475
|
+
return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8301
8476
|
})
|
|
8302
8477
|
// .transition(this.transition)
|
|
8303
8478
|
.attr('fill', function (d) {
|
|
8304
8479
|
return d.y.color || d.color || series.color;
|
|
8305
8480
|
});
|
|
8306
8481
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8307
|
-
return Math.abs(getBarWidth.call(
|
|
8482
|
+
return Math.abs(getBarWidth.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8308
8483
|
}).attr('height', function (d, i) {
|
|
8309
|
-
return getBarHeight.call(
|
|
8484
|
+
return getBarHeight.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8310
8485
|
}).attr('x', function (d, i) {
|
|
8311
|
-
return getBarX.call(
|
|
8486
|
+
return getBarX.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8312
8487
|
}).attr('y', function (d, i) {
|
|
8313
|
-
return getBarY.call(
|
|
8488
|
+
return getBarY.call(_this51, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8314
8489
|
})
|
|
8315
8490
|
// .transition(this.transition)
|
|
8316
8491
|
.attr('fill', function (d) {
|
|
@@ -8331,7 +8506,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8331
8506
|
}, {
|
|
8332
8507
|
key: "renderLabels",
|
|
8333
8508
|
value: function renderLabels(series, index) {
|
|
8334
|
-
var
|
|
8509
|
+
var _this52 = this;
|
|
8335
8510
|
/* global series index d3 WebsyDesigns */
|
|
8336
8511
|
var xAxis = 'bottom';
|
|
8337
8512
|
var yAxis = 'left';
|
|
@@ -8347,14 +8522,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8347
8522
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
8348
8523
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
8349
8524
|
labels.attr('x', function (d) {
|
|
8350
|
-
return getLabelX.call(
|
|
8525
|
+
return getLabelX.call(_this52, d, series.labelPosition);
|
|
8351
8526
|
}).attr('y', function (d) {
|
|
8352
|
-
return getLabelY.call(
|
|
8527
|
+
return getLabelY.call(_this52, d, series.labelPosition);
|
|
8353
8528
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
8354
|
-
if (
|
|
8529
|
+
if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8355
8530
|
return 'transparent';
|
|
8356
8531
|
}
|
|
8357
|
-
return
|
|
8532
|
+
return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8358
8533
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
8359
8534
|
return d.y.label || d.y.value;
|
|
8360
8535
|
}).each(function (d, i) {
|
|
@@ -8388,14 +8563,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8388
8563
|
}
|
|
8389
8564
|
});
|
|
8390
8565
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
8391
|
-
return getLabelX.call(
|
|
8566
|
+
return getLabelX.call(_this52, d, series.labelPosition);
|
|
8392
8567
|
}).attr('y', function (d) {
|
|
8393
|
-
return getLabelY.call(
|
|
8568
|
+
return getLabelY.call(_this52, d, series.labelPosition);
|
|
8394
8569
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
8395
|
-
if (
|
|
8570
|
+
if (_this52.options.grouping === 'stacked' && d.y.value === 0) {
|
|
8396
8571
|
return 'transparent';
|
|
8397
8572
|
}
|
|
8398
|
-
return
|
|
8573
|
+
return _this52.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
8399
8574
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
8400
8575
|
return d.y.label || d.y.value;
|
|
8401
8576
|
}).each(function (d, i) {
|
|
@@ -8473,32 +8648,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8473
8648
|
}, {
|
|
8474
8649
|
key: "renderline",
|
|
8475
8650
|
value: function renderline(series, index) {
|
|
8476
|
-
var
|
|
8651
|
+
var _this53 = this;
|
|
8477
8652
|
/* global series index d3 */
|
|
8478
8653
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
8479
8654
|
return d3.line().x(function (d) {
|
|
8480
|
-
if (
|
|
8481
|
-
return
|
|
8655
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
8656
|
+
return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8482
8657
|
} else {
|
|
8483
|
-
if (
|
|
8484
|
-
return
|
|
8658
|
+
if (_this53.options.data[xAxis].scale === 'Time') {
|
|
8659
|
+
return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value));
|
|
8485
8660
|
} else {
|
|
8486
|
-
var xIndex =
|
|
8487
|
-
var xPos =
|
|
8488
|
-
if (
|
|
8489
|
-
xPos = xPos + (
|
|
8661
|
+
var xIndex = _this53[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8662
|
+
var xPos = _this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8663
|
+
if (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8664
|
+
xPos = xPos + (_this53["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8490
8665
|
}
|
|
8491
8666
|
return xPos;
|
|
8492
8667
|
}
|
|
8493
8668
|
}
|
|
8494
8669
|
}).y(function (d) {
|
|
8495
|
-
if (
|
|
8496
|
-
var adjustment =
|
|
8497
|
-
return
|
|
8670
|
+
if (_this53.options.orientation === 'horizontal') {
|
|
8671
|
+
var adjustment = _this53.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this53.options.data[xAxis].bandWidth / 2;
|
|
8672
|
+
return _this53["".concat(xAxis, "Axis")](_this53.parseX(d.x.value)) + adjustment;
|
|
8498
8673
|
} else {
|
|
8499
|
-
return
|
|
8674
|
+
return _this53["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8500
8675
|
}
|
|
8501
|
-
}).curve(d3[curveStyle ||
|
|
8676
|
+
}).curve(d3[curveStyle || _this53.options.curveStyle]);
|
|
8502
8677
|
};
|
|
8503
8678
|
var xAxis = 'bottom';
|
|
8504
8679
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8607,14 +8782,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8607
8782
|
}, {
|
|
8608
8783
|
key: "rendersymbol",
|
|
8609
8784
|
value: function rendersymbol(series, index) {
|
|
8610
|
-
var
|
|
8785
|
+
var _this54 = this;
|
|
8611
8786
|
/* global d3 series index series.key */
|
|
8612
8787
|
var drawSymbol = function drawSymbol(size) {
|
|
8613
8788
|
return d3.symbol()
|
|
8614
8789
|
// .type(d => {
|
|
8615
8790
|
// return d3.symbols[0]
|
|
8616
8791
|
// })
|
|
8617
|
-
.size(size ||
|
|
8792
|
+
.size(size || _this54.options.symbolSize);
|
|
8618
8793
|
};
|
|
8619
8794
|
var xAxis = 'bottom';
|
|
8620
8795
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8640,20 +8815,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8640
8815
|
// else {
|
|
8641
8816
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8642
8817
|
// }
|
|
8643
|
-
var xIndex =
|
|
8644
|
-
var xPos =
|
|
8645
|
-
if (
|
|
8646
|
-
xPos = xPos + (
|
|
8647
|
-
}
|
|
8648
|
-
var adjustment =
|
|
8649
|
-
if (
|
|
8650
|
-
return "translate(".concat(
|
|
8818
|
+
var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8819
|
+
var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8820
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8821
|
+
xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8822
|
+
}
|
|
8823
|
+
var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
|
|
8824
|
+
if (_this54.options.orientation === 'horizontal') {
|
|
8825
|
+
return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
8651
8826
|
} else {
|
|
8652
|
-
if (
|
|
8653
|
-
xPos =
|
|
8827
|
+
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8828
|
+
xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
|
|
8654
8829
|
}
|
|
8655
8830
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8656
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
8831
|
+
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8657
8832
|
}
|
|
8658
8833
|
});
|
|
8659
8834
|
// Enter
|
|
@@ -8668,20 +8843,20 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8668
8843
|
}).attr('class', function (d) {
|
|
8669
8844
|
return "symbol symbol_".concat(series.key);
|
|
8670
8845
|
}).attr('transform', function (d) {
|
|
8671
|
-
var xIndex =
|
|
8672
|
-
var xPos =
|
|
8673
|
-
if (
|
|
8674
|
-
xPos = xPos + (
|
|
8675
|
-
}
|
|
8676
|
-
var adjustment =
|
|
8677
|
-
if (
|
|
8678
|
-
return "translate(".concat(
|
|
8846
|
+
var xIndex = _this54[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8847
|
+
var xPos = _this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8848
|
+
if (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8849
|
+
xPos = xPos + (_this54["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8850
|
+
}
|
|
8851
|
+
var adjustment = _this54.options.data[xAxis].scale === 'Time' || _this54.options.data[xAxis].scale === 'Linear' ? 0 : _this54.options.data[xAxis].bandWidth / 2;
|
|
8852
|
+
if (_this54.options.orientation === 'horizontal') {
|
|
8853
|
+
return "translate(".concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
8679
8854
|
} else {
|
|
8680
|
-
if (
|
|
8681
|
-
xPos =
|
|
8855
|
+
if (_this54.options.data[xAxis].scale === 'Time') {
|
|
8856
|
+
xPos = _this54["".concat(xAxis, "Axis")](_this54.parseX(d.x.value));
|
|
8682
8857
|
}
|
|
8683
8858
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
8684
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
8859
|
+
return "translate(".concat(xPos, ", ").concat(_this54["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
8685
8860
|
}
|
|
8686
8861
|
});
|
|
8687
8862
|
}
|
|
@@ -8877,7 +9052,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8877
9052
|
}, {
|
|
8878
9053
|
key: "resize",
|
|
8879
9054
|
value: function resize() {
|
|
8880
|
-
var
|
|
9055
|
+
var _this55 = this;
|
|
8881
9056
|
var el = document.getElementById(this.elementId);
|
|
8882
9057
|
if (el) {
|
|
8883
9058
|
// if (this.options.width) {
|
|
@@ -8888,7 +9063,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
8888
9063
|
// }
|
|
8889
9064
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
8890
9065
|
html += this._data.map(function (d, i) {
|
|
8891
|
-
return
|
|
9066
|
+
return _this55.getLegendItemHTML(d);
|
|
8892
9067
|
}).join('');
|
|
8893
9068
|
html += "\n <div>\n ";
|
|
8894
9069
|
el.innerHTML = html;
|
|
@@ -9028,14 +9203,14 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9028
9203
|
}, {
|
|
9029
9204
|
key: "render",
|
|
9030
9205
|
value: function render() {
|
|
9031
|
-
var
|
|
9206
|
+
var _this56 = this;
|
|
9032
9207
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9033
9208
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9034
9209
|
if (this.options.showLegend === true && this.options.data.polygons) {
|
|
9035
9210
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9036
9211
|
return {
|
|
9037
9212
|
value: s.label || s.key,
|
|
9038
|
-
color: s.color ||
|
|
9213
|
+
color: s.color || _this56.options.colors[i % _this56.options.colors.length]
|
|
9039
9214
|
};
|
|
9040
9215
|
});
|
|
9041
9216
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9089,7 +9264,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9089
9264
|
}
|
|
9090
9265
|
if (this.polygons) {
|
|
9091
9266
|
this.polygons.forEach(function (p) {
|
|
9092
|
-
return
|
|
9267
|
+
return _this56.map.removeLayer(p);
|
|
9093
9268
|
});
|
|
9094
9269
|
}
|
|
9095
9270
|
this.polygons = [];
|
|
@@ -9143,15 +9318,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9143
9318
|
p.options = {};
|
|
9144
9319
|
}
|
|
9145
9320
|
if (!p.options.color) {
|
|
9146
|
-
p.options.color =
|
|
9321
|
+
p.options.color = _this56.options.colors[i % _this56.options.colors.length];
|
|
9147
9322
|
}
|
|
9148
9323
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9149
9324
|
return c.map(function (d) {
|
|
9150
9325
|
return [d.Latitude, d.Longitude];
|
|
9151
9326
|
});
|
|
9152
|
-
}), p.options).addTo(
|
|
9153
|
-
|
|
9154
|
-
|
|
9327
|
+
}), p.options).addTo(_this56.map);
|
|
9328
|
+
_this56.polygons.push(pol);
|
|
9329
|
+
_this56.map.fitBounds(pol.getBounds());
|
|
9155
9330
|
});
|
|
9156
9331
|
}
|
|
9157
9332
|
// if (this.data.markers.length > 0) {
|
|
@@ -9259,6 +9434,7 @@ var WebsyDesigns = {
|
|
|
9259
9434
|
NavigationMenu: WebsyNavigationMenu,
|
|
9260
9435
|
WebsyForm: WebsyForm,
|
|
9261
9436
|
Form: WebsyForm,
|
|
9437
|
+
MultiForm: MultiForm,
|
|
9262
9438
|
WebsyDatePicker: WebsyDatePicker,
|
|
9263
9439
|
DatePicker: WebsyDatePicker,
|
|
9264
9440
|
WebsyDragDrop: WebsyDragDrop,
|