@websy/websy-designs 1.11.15 → 1.11.17
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.
|
@@ -2248,23 +2248,30 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2248
2248
|
}, {
|
|
2249
2249
|
key: "clear",
|
|
2250
2250
|
value: function clear() {
|
|
2251
|
+
var _this14 = this;
|
|
2251
2252
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2252
2253
|
formEl.reset();
|
|
2254
|
+
if (!this.options.fields) {
|
|
2255
|
+
this.options.fields = [];
|
|
2256
|
+
}
|
|
2257
|
+
this.options.fields.forEach(function (f) {
|
|
2258
|
+
_this14.setValue(f.field, '');
|
|
2259
|
+
});
|
|
2253
2260
|
this.loader.hide();
|
|
2254
2261
|
}
|
|
2255
2262
|
}, {
|
|
2256
2263
|
key: "data",
|
|
2257
2264
|
get: function get() {
|
|
2258
|
-
var
|
|
2265
|
+
var _this15 = this;
|
|
2259
2266
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2260
2267
|
var data = {};
|
|
2261
2268
|
var temp = new FormData(formEl);
|
|
2262
2269
|
temp.forEach(function (value, key) {
|
|
2263
|
-
if (
|
|
2270
|
+
if (_this15.fieldMap[key] && _this15.fieldMap[key].type === 'checkbox') {
|
|
2264
2271
|
data[key] = true;
|
|
2265
2272
|
}
|
|
2266
|
-
if (
|
|
2267
|
-
data[key] =
|
|
2273
|
+
if (_this15.fieldMap[key] && _this15.fieldMap[key].instance && _this15.fieldMap[key].instance.value) {
|
|
2274
|
+
data[key] = _this15.fieldMap[key].instance.value;
|
|
2268
2275
|
} else {
|
|
2269
2276
|
data[key] = value;
|
|
2270
2277
|
}
|
|
@@ -2284,14 +2291,14 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2284
2291
|
return data;
|
|
2285
2292
|
},
|
|
2286
2293
|
set: function set(d) {
|
|
2287
|
-
var
|
|
2294
|
+
var _this16 = this;
|
|
2288
2295
|
if (!this.options.fields) {
|
|
2289
2296
|
this.options.fields = [];
|
|
2290
2297
|
}
|
|
2291
2298
|
var _loop = function _loop(key) {
|
|
2292
|
-
|
|
2299
|
+
_this16.options.fields.forEach(function (f) {
|
|
2293
2300
|
if (f.field === key) {
|
|
2294
|
-
|
|
2301
|
+
_this16.setValue(key, d[key]);
|
|
2295
2302
|
// f.value = d[key]
|
|
2296
2303
|
// const el = document.getElementById(`${this.elementId}_input_${f.field}`)
|
|
2297
2304
|
// if (el) {
|
|
@@ -2492,7 +2499,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2492
2499
|
}, {
|
|
2493
2500
|
key: "processComponents",
|
|
2494
2501
|
value: function processComponents(components, callbackFn) {
|
|
2495
|
-
var
|
|
2502
|
+
var _this17 = this;
|
|
2496
2503
|
if (components.length === 0) {
|
|
2497
2504
|
callbackFn();
|
|
2498
2505
|
} else {
|
|
@@ -2501,11 +2508,11 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2501
2508
|
if (!c.options.onChange) {
|
|
2502
2509
|
c.options.onChange = function () {
|
|
2503
2510
|
if (c.required || c.validate) {
|
|
2504
|
-
|
|
2511
|
+
_this17.validateField(c, c.instance.value);
|
|
2505
2512
|
}
|
|
2506
2513
|
};
|
|
2507
2514
|
}
|
|
2508
|
-
c.instance = new WebsyDesigns[c.component]("".concat(
|
|
2515
|
+
c.instance = new WebsyDesigns[c.component]("".concat(_this17.elementId, "_input_").concat(c.field, "_component"), c.options);
|
|
2509
2516
|
} else {
|
|
2510
2517
|
// some user feedback here
|
|
2511
2518
|
}
|
|
@@ -2515,13 +2522,13 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2515
2522
|
}, {
|
|
2516
2523
|
key: "recaptchaReady",
|
|
2517
2524
|
value: function recaptchaReady() {
|
|
2518
|
-
var
|
|
2525
|
+
var _this18 = this;
|
|
2519
2526
|
var el = document.getElementById("".concat(this.elementId, "_recaptcha"));
|
|
2520
2527
|
if (el) {
|
|
2521
2528
|
grecaptcha.ready(function () {
|
|
2522
|
-
grecaptcha.render("".concat(
|
|
2529
|
+
grecaptcha.render("".concat(_this18.elementId, "_recaptcha"), {
|
|
2523
2530
|
sitekey: ENVIRONMENT.RECAPTCHA_KEY,
|
|
2524
|
-
callback:
|
|
2531
|
+
callback: _this18.validateRecaptcha.bind(_this18)
|
|
2525
2532
|
});
|
|
2526
2533
|
});
|
|
2527
2534
|
}
|
|
@@ -2529,16 +2536,16 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2529
2536
|
}, {
|
|
2530
2537
|
key: "render",
|
|
2531
2538
|
value: function render(update, data) {
|
|
2532
|
-
var
|
|
2539
|
+
var _this19 = this;
|
|
2533
2540
|
var el = document.getElementById(this.elementId);
|
|
2534
2541
|
var componentsToProcess = [];
|
|
2535
2542
|
if (el) {
|
|
2536
2543
|
var html = "\n <form id=\"".concat(this.elementId, "Form\" class=\"websy-form ").concat((this.options.classes || []).join(' '), "\">\n ");
|
|
2537
2544
|
this.options.fields.forEach(function (f, i) {
|
|
2538
|
-
|
|
2539
|
-
f.owningElement =
|
|
2545
|
+
_this19.fieldMap[f.field] = f;
|
|
2546
|
+
f.owningElement = _this19.elementId;
|
|
2540
2547
|
var inputValue = typeof f.value === 'function' ? f.value() : f.value;
|
|
2541
|
-
if (f.disabled || f.readOnly ||
|
|
2548
|
+
if (f.disabled || f.readOnly || _this19.options.readOnly) {
|
|
2542
2549
|
if (!f.options) {
|
|
2543
2550
|
f.options = {};
|
|
2544
2551
|
}
|
|
@@ -2552,18 +2559,18 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2552
2559
|
}
|
|
2553
2560
|
f.classes.push('disabled');
|
|
2554
2561
|
f.options.classes.push('disabled');
|
|
2555
|
-
if (f.readOnly ||
|
|
2562
|
+
if (f.readOnly || _this19.options.readOnly) {
|
|
2556
2563
|
f.classes.push('websy-input-readonly');
|
|
2557
2564
|
f.options.classes.push('websy-input-readonly');
|
|
2558
2565
|
}
|
|
2559
2566
|
}
|
|
2560
2567
|
if (f.component) {
|
|
2561
2568
|
componentsToProcess.push(f);
|
|
2562
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2569
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', " ").concat(f.component === 'MediaUpload' ? 'media-upload' : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this19.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2563
2570
|
} else if (f.type === 'longtext') {
|
|
2564
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2571
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this19.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat(f.disabled || f.readOnly || _this19.options.readOnly ? 'disabled' : '', "\n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea ").concat(f.readOnly || _this19.options.readOnly ? 'websy-input-readonly' : '', "\"\n >").concat(inputValue || '', "</textarea>\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2565
2572
|
} else {
|
|
2566
|
-
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(
|
|
2573
|
+
html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this19.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this19.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input ").concat(f.readOnly || _this19.options.readOnly ? 'websy-input-readonly' : '', "\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.type === 'date' ? '' : inputValue || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? inputValue : '', "\"\n ").concat(f.disabled || f.readOnly || _this19.options.readOnly ? 'disabled' : '', "\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this19.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
|
|
2567
2574
|
}
|
|
2568
2575
|
});
|
|
2569
2576
|
if (this.options.useRecaptcha === true) {
|
|
@@ -2585,8 +2592,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2585
2592
|
});
|
|
2586
2593
|
}
|
|
2587
2594
|
this.processComponents(componentsToProcess, function () {
|
|
2588
|
-
if ((
|
|
2589
|
-
|
|
2595
|
+
if ((_this19.options.useRecaptcha === true || _this19.options.useRecaptchaV3 === true) && typeof grecaptcha !== 'undefined') {
|
|
2596
|
+
_this19.recaptchaReady();
|
|
2590
2597
|
}
|
|
2591
2598
|
});
|
|
2592
2599
|
}
|
|
@@ -2619,7 +2626,7 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2619
2626
|
}, {
|
|
2620
2627
|
key: "submitForm",
|
|
2621
2628
|
value: function submitForm() {
|
|
2622
|
-
var
|
|
2629
|
+
var _this20 = this;
|
|
2623
2630
|
var formEl = document.getElementById("".concat(this.elementId, "Form"));
|
|
2624
2631
|
var buttonEl = formEl.querySelector('button.websy-btn.submit');
|
|
2625
2632
|
var recaptchErrEl = document.getElementById("".concat(this.elementId, "_recaptchaError"));
|
|
@@ -2638,8 +2645,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2638
2645
|
if (recaptchErrEl) {
|
|
2639
2646
|
recaptchErrEl.classList.add('websy-hidden');
|
|
2640
2647
|
}
|
|
2641
|
-
if (
|
|
2642
|
-
|
|
2648
|
+
if (_this20.options.useLoader) {
|
|
2649
|
+
_this20.loader.show();
|
|
2643
2650
|
}
|
|
2644
2651
|
var formData = new FormData(formEl);
|
|
2645
2652
|
var data = {};
|
|
@@ -2647,33 +2654,33 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2647
2654
|
temp.forEach(function (value, key) {
|
|
2648
2655
|
data[key] = value;
|
|
2649
2656
|
});
|
|
2650
|
-
if (
|
|
2651
|
-
var
|
|
2652
|
-
var params = [
|
|
2653
|
-
if (
|
|
2654
|
-
params.push(
|
|
2657
|
+
if (_this20.options.url) {
|
|
2658
|
+
var _this20$apiService;
|
|
2659
|
+
var params = [_this20.options.url];
|
|
2660
|
+
if (_this20.options.mode === 'update') {
|
|
2661
|
+
params.push(_this20.options.id);
|
|
2655
2662
|
}
|
|
2656
2663
|
params.push(data);
|
|
2657
|
-
(
|
|
2658
|
-
if (
|
|
2664
|
+
(_this20$apiService = _this20.apiService)[_this20.options.mode].apply(_this20$apiService, params).then(function (result) {
|
|
2665
|
+
if (_this20.options.clearAfterSave === true) {
|
|
2659
2666
|
// this.render()
|
|
2660
2667
|
formEl.reset();
|
|
2661
2668
|
}
|
|
2662
2669
|
buttonEl.removeAttribute('disabled');
|
|
2663
|
-
|
|
2670
|
+
_this20.options.onSuccess.call(_this20, result);
|
|
2664
2671
|
}, function (err) {
|
|
2665
2672
|
console.log('Error submitting form data:', err);
|
|
2666
|
-
|
|
2673
|
+
_this20.options.onError.call(_this20, err);
|
|
2667
2674
|
});
|
|
2668
|
-
} else if (
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
if (
|
|
2675
|
+
} else if (_this20.options.submitFn) {
|
|
2676
|
+
_this20.options.submitFn(data, function () {
|
|
2677
|
+
_this20.loader.hide();
|
|
2678
|
+
if (_this20.options.clearAfterSave === true) {
|
|
2672
2679
|
// this.render()
|
|
2673
2680
|
formEl.reset();
|
|
2674
2681
|
}
|
|
2675
2682
|
}, function () {
|
|
2676
|
-
|
|
2683
|
+
_this20.loader.hide();
|
|
2677
2684
|
});
|
|
2678
2685
|
}
|
|
2679
2686
|
} else {
|
|
@@ -2683,8 +2690,8 @@ var WebsyForm = /*#__PURE__*/function () {
|
|
|
2683
2690
|
if (recaptchErrEl) {
|
|
2684
2691
|
recaptchErrEl.classList.remove('websy-hidden');
|
|
2685
2692
|
}
|
|
2686
|
-
if (
|
|
2687
|
-
|
|
2693
|
+
if (_this20.options.submitErr) {
|
|
2694
|
+
_this20.options.submitErr();
|
|
2688
2695
|
}
|
|
2689
2696
|
}
|
|
2690
2697
|
});
|
|
@@ -2838,9 +2845,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2838
2845
|
}, {
|
|
2839
2846
|
key: "deleted",
|
|
2840
2847
|
get: function get() {
|
|
2841
|
-
var
|
|
2848
|
+
var _this21 = this;
|
|
2842
2849
|
return this.formData.filter(function (d) {
|
|
2843
|
-
return
|
|
2850
|
+
return _this21.recordsToDelete.includes("".concat(d.id));
|
|
2844
2851
|
});
|
|
2845
2852
|
}
|
|
2846
2853
|
}, {
|
|
@@ -2881,7 +2888,7 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2881
2888
|
}, {
|
|
2882
2889
|
key: "render",
|
|
2883
2890
|
value: function render() {
|
|
2884
|
-
var
|
|
2891
|
+
var _this22 = this;
|
|
2885
2892
|
this.forms = [];
|
|
2886
2893
|
this.recordsToDelete = [];
|
|
2887
2894
|
var el = document.getElementById("".concat(this.elementId, "_container"));
|
|
@@ -2889,9 +2896,9 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2889
2896
|
var html = '';
|
|
2890
2897
|
this.formData.forEach(function (d) {
|
|
2891
2898
|
d.formId = WebsyDesigns.Utils.createIdentity();
|
|
2892
|
-
html += "\n <div id='".concat(
|
|
2893
|
-
if (
|
|
2894
|
-
html += "\n <button id='".concat(
|
|
2899
|
+
html += "\n <div id='".concat(_this22.elementId, "_").concat(d.formId, "_formContainer' class='websy-multi-form-form-container'>\n <div id='").concat(_this22.elementId, "_").concat(d.formId, "_form' class='websy-multi-form-form'>\n </div>\n ");
|
|
2900
|
+
if (_this22.options.allowDelete === true && !_this22.options.readOnly) {
|
|
2901
|
+
html += "\n <button id='".concat(_this22.elementId, "_").concat(d.formId, "_deleteButton' data-formid='").concat(d.formId, "' data-rowid='").concat(d.id, "' class='websy-multi-form-delete'>\n ").concat(_this22.options.deleteIcon).concat(_this22.options.deleteLabel, "\n </button>\n ");
|
|
2895
2902
|
}
|
|
2896
2903
|
html += "\n </div>\n ";
|
|
2897
2904
|
});
|
|
@@ -2899,14 +2906,14 @@ var MultiForm = /*#__PURE__*/function () {
|
|
|
2899
2906
|
el.innerHTML = html;
|
|
2900
2907
|
this.forms = new Array(this.formData.length);
|
|
2901
2908
|
this.formData.forEach(function (d, i) {
|
|
2902
|
-
var formOptions = _extends({},
|
|
2903
|
-
fields: _toConsumableArray(
|
|
2909
|
+
var formOptions = _extends({}, _this22.options, {
|
|
2910
|
+
fields: _toConsumableArray(_this22.options.fields.map(function (f) {
|
|
2904
2911
|
return _extends({}, f);
|
|
2905
2912
|
}))
|
|
2906
2913
|
});
|
|
2907
|
-
var formObject = new WebsyDesigns.Form("".concat(
|
|
2914
|
+
var formObject = new WebsyDesigns.Form("".concat(_this22.elementId, "_").concat(d.formId, "_form"), formOptions);
|
|
2908
2915
|
formObject.data = d;
|
|
2909
|
-
|
|
2916
|
+
_this22.forms[i] = formObject;
|
|
2910
2917
|
});
|
|
2911
2918
|
var addEl = document.getElementById("".concat(this.elementId, "_addButton"));
|
|
2912
2919
|
if (addEl) {
|
|
@@ -3139,7 +3146,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3139
3146
|
}, {
|
|
3140
3147
|
key: "handleSearch",
|
|
3141
3148
|
value: function handleSearch(searchText) {
|
|
3142
|
-
var
|
|
3149
|
+
var _this23 = this;
|
|
3143
3150
|
var el = document.getElementById(this.elementId);
|
|
3144
3151
|
// let lowestItems = this.flatItems.filter(d => d.level === this.maxLevel)
|
|
3145
3152
|
var lowestItems = this.flatItems.filter(function (d) {
|
|
@@ -3150,7 +3157,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3150
3157
|
if (searchText && searchText.length > 1) {
|
|
3151
3158
|
defaultMethod = 'add';
|
|
3152
3159
|
visibleItems = lowestItems.filter(function (d) {
|
|
3153
|
-
return d[
|
|
3160
|
+
return d[_this23.options.searchProp].toLowerCase().indexOf(searchText.toLowerCase()) !== -1;
|
|
3154
3161
|
});
|
|
3155
3162
|
}
|
|
3156
3163
|
// hide everything
|
|
@@ -3333,7 +3340,7 @@ var WebsyNavigationMenu = /*#__PURE__*/function () {
|
|
|
3333
3340
|
/* global WebsyDesigns */
|
|
3334
3341
|
var Pager = /*#__PURE__*/function () {
|
|
3335
3342
|
function Pager(elementId, options) {
|
|
3336
|
-
var
|
|
3343
|
+
var _this24 = this;
|
|
3337
3344
|
_classCallCheck(this, Pager);
|
|
3338
3345
|
this.elementId = elementId;
|
|
3339
3346
|
var DEFAULTS = {
|
|
@@ -3380,8 +3387,8 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3380
3387
|
allowClear: false,
|
|
3381
3388
|
disableSearch: true,
|
|
3382
3389
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
3383
|
-
if (
|
|
3384
|
-
|
|
3390
|
+
if (_this24.options.onChangePageSize) {
|
|
3391
|
+
_this24.options.onChangePageSize(selectedItem.value);
|
|
3385
3392
|
}
|
|
3386
3393
|
}
|
|
3387
3394
|
});
|
|
@@ -3402,11 +3409,11 @@ var Pager = /*#__PURE__*/function () {
|
|
|
3402
3409
|
}, {
|
|
3403
3410
|
key: "render",
|
|
3404
3411
|
value: function render() {
|
|
3405
|
-
var
|
|
3412
|
+
var _this25 = this;
|
|
3406
3413
|
var el = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
3407
3414
|
if (el) {
|
|
3408
3415
|
var pages = this.options.pages.map(function (item, index) {
|
|
3409
|
-
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
3416
|
+
return "<li data-index=\"".concat(index, "\" class=\"websy-page-num ").concat(_this25.options.activePage === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
3410
3417
|
});
|
|
3411
3418
|
var startIndex = 0;
|
|
3412
3419
|
if (this.options.pages.length > 8) {
|
|
@@ -3468,50 +3475,50 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3468
3475
|
_createClass(WebsyPDFButton, [{
|
|
3469
3476
|
key: "handleClick",
|
|
3470
3477
|
value: function handleClick(event) {
|
|
3471
|
-
var
|
|
3478
|
+
var _this26 = this;
|
|
3472
3479
|
if (event.target.classList.contains('websy-pdf-button')) {
|
|
3473
3480
|
this.loader.show();
|
|
3474
3481
|
this.options.preProcess(function (proceed) {
|
|
3475
3482
|
if (proceed === true) {
|
|
3476
3483
|
setTimeout(function () {
|
|
3477
|
-
if (
|
|
3478
|
-
var el = document.getElementById(
|
|
3484
|
+
if (_this26.options.targetId) {
|
|
3485
|
+
var el = document.getElementById(_this26.options.targetId);
|
|
3479
3486
|
if (el) {
|
|
3480
3487
|
var pdfData = {
|
|
3481
3488
|
options: {}
|
|
3482
3489
|
};
|
|
3483
|
-
if (
|
|
3484
|
-
pdfData.options = _extends({},
|
|
3490
|
+
if (_this26.options.pdfOptions) {
|
|
3491
|
+
pdfData.options = _extends({}, _this26.options.pdfOptions);
|
|
3485
3492
|
}
|
|
3486
|
-
if (
|
|
3487
|
-
if (
|
|
3488
|
-
var headerEl = document.getElementById(
|
|
3493
|
+
if (_this26.options.header) {
|
|
3494
|
+
if (_this26.options.header.elementId) {
|
|
3495
|
+
var headerEl = document.getElementById(_this26.options.header.elementId);
|
|
3489
3496
|
if (headerEl) {
|
|
3490
3497
|
pdfData.header = headerEl.outerHTML;
|
|
3491
|
-
if (
|
|
3492
|
-
pdfData.options.headerCSS =
|
|
3498
|
+
if (_this26.options.header.css) {
|
|
3499
|
+
pdfData.options.headerCSS = _this26.options.header.css;
|
|
3493
3500
|
}
|
|
3494
3501
|
}
|
|
3495
|
-
} else if (
|
|
3496
|
-
pdfData.header =
|
|
3497
|
-
if (
|
|
3498
|
-
pdfData.options.headerCSS =
|
|
3502
|
+
} else if (_this26.options.header.html) {
|
|
3503
|
+
pdfData.header = _this26.options.header.html;
|
|
3504
|
+
if (_this26.options.header.css) {
|
|
3505
|
+
pdfData.options.headerCSS = _this26.options.header.css;
|
|
3499
3506
|
}
|
|
3500
3507
|
} else {
|
|
3501
|
-
pdfData.header =
|
|
3508
|
+
pdfData.header = _this26.options.header;
|
|
3502
3509
|
}
|
|
3503
3510
|
}
|
|
3504
|
-
if (
|
|
3505
|
-
if (
|
|
3506
|
-
var footerEl = document.getElementById(
|
|
3511
|
+
if (_this26.options.footer) {
|
|
3512
|
+
if (_this26.options.footer.elementId) {
|
|
3513
|
+
var footerEl = document.getElementById(_this26.options.footer.elementId);
|
|
3507
3514
|
if (footerEl) {
|
|
3508
3515
|
pdfData.footer = footerEl.outerHTML;
|
|
3509
|
-
if (
|
|
3510
|
-
pdfData.options.footerCSS =
|
|
3516
|
+
if (_this26.options.footer.css) {
|
|
3517
|
+
pdfData.options.footerCSS = _this26.options.footer.css;
|
|
3511
3518
|
}
|
|
3512
3519
|
}
|
|
3513
3520
|
} else {
|
|
3514
|
-
pdfData.footer =
|
|
3521
|
+
pdfData.footer = _this26.options.footer;
|
|
3515
3522
|
}
|
|
3516
3523
|
}
|
|
3517
3524
|
pdfData.html = el.outerHTML;
|
|
@@ -3519,25 +3526,25 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3519
3526
|
// document.getElementById(`${this.elementId}_pdfHTML`).value = pdfData.html
|
|
3520
3527
|
// document.getElementById(`${this.elementId}_pdfFooter`).value = pdfData.footer
|
|
3521
3528
|
// document.getElementById(`${this.elementId}_form`).submit()
|
|
3522
|
-
|
|
3529
|
+
_this26.service.add('', pdfData, {
|
|
3523
3530
|
responseType: 'blob'
|
|
3524
3531
|
}).then(function (response) {
|
|
3525
|
-
|
|
3532
|
+
_this26.loader.hide();
|
|
3526
3533
|
var blob = new Blob([response], {
|
|
3527
3534
|
type: 'application/pdf'
|
|
3528
3535
|
});
|
|
3529
3536
|
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 ");
|
|
3530
|
-
if (
|
|
3537
|
+
if (_this26.options.directDownload === true) {
|
|
3531
3538
|
var fileName;
|
|
3532
|
-
if (typeof
|
|
3533
|
-
fileName =
|
|
3539
|
+
if (typeof _this26.options.fileName === 'function') {
|
|
3540
|
+
fileName = _this26.options.fileName() || 'Export';
|
|
3534
3541
|
} else {
|
|
3535
|
-
fileName =
|
|
3542
|
+
fileName = _this26.options.fileName || 'Export';
|
|
3536
3543
|
}
|
|
3537
3544
|
msg += "download=\"".concat(fileName.replace(/'/g, ''), ".pdf\"");
|
|
3538
3545
|
}
|
|
3539
|
-
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(
|
|
3540
|
-
|
|
3546
|
+
msg += "\n >\n <button class='websy-btn download-pdf'>".concat(_this26.options.buttonText, "</button>\n </a>\n </div>\n ");
|
|
3547
|
+
_this26.popup.show({
|
|
3541
3548
|
message: msg,
|
|
3542
3549
|
mask: true
|
|
3543
3550
|
});
|
|
@@ -3546,10 +3553,10 @@ var WebsyPDFButton = /*#__PURE__*/function () {
|
|
|
3546
3553
|
});
|
|
3547
3554
|
}
|
|
3548
3555
|
}
|
|
3549
|
-
},
|
|
3556
|
+
}, _this26.options.wait);
|
|
3550
3557
|
} else {
|
|
3551
|
-
|
|
3552
|
-
|
|
3558
|
+
_this26.loader.hide();
|
|
3559
|
+
_this26.options.onError();
|
|
3553
3560
|
}
|
|
3554
3561
|
});
|
|
3555
3562
|
} else if (event.target.classList.contains('download-pdf')) {
|
|
@@ -3682,6 +3689,9 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3682
3689
|
_createClass(WebsyPubSub, [{
|
|
3683
3690
|
key: "publish",
|
|
3684
3691
|
value: function publish(id, method, data) {
|
|
3692
|
+
if (!this.subscriptions) {
|
|
3693
|
+
return;
|
|
3694
|
+
}
|
|
3685
3695
|
if (arguments.length === 3) {
|
|
3686
3696
|
if (this.subscriptions[id] && this.subscriptions[id][method]) {
|
|
3687
3697
|
this.subscriptions[id][method](data);
|
|
@@ -3719,7 +3729,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3719
3729
|
}();
|
|
3720
3730
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3721
3731
|
function ResponsiveText(elementId, options) {
|
|
3722
|
-
var
|
|
3732
|
+
var _this27 = this;
|
|
3723
3733
|
_classCallCheck(this, ResponsiveText);
|
|
3724
3734
|
var DEFAULTS = {
|
|
3725
3735
|
textAlign: 'center',
|
|
@@ -3730,7 +3740,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3730
3740
|
this.elementId = elementId;
|
|
3731
3741
|
this.canvas = document.createElement('canvas');
|
|
3732
3742
|
window.addEventListener('resize', function () {
|
|
3733
|
-
return
|
|
3743
|
+
return _this27.render();
|
|
3734
3744
|
});
|
|
3735
3745
|
var el = document.getElementById(this.elementId);
|
|
3736
3746
|
if (el) {
|
|
@@ -3920,7 +3930,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3920
3930
|
/* global WebsyDesigns */
|
|
3921
3931
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3922
3932
|
function WebsyResultList(elementId, options) {
|
|
3923
|
-
var
|
|
3933
|
+
var _this28 = this;
|
|
3924
3934
|
_classCallCheck(this, WebsyResultList);
|
|
3925
3935
|
var DEFAULTS = {
|
|
3926
3936
|
listeners: {
|
|
@@ -3946,8 +3956,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3946
3956
|
}
|
|
3947
3957
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3948
3958
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3949
|
-
|
|
3950
|
-
|
|
3959
|
+
_this28.options.template = templateString;
|
|
3960
|
+
_this28.render();
|
|
3951
3961
|
});
|
|
3952
3962
|
} else {
|
|
3953
3963
|
this.render();
|
|
@@ -3969,7 +3979,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3969
3979
|
}, {
|
|
3970
3980
|
key: "buildHTML",
|
|
3971
3981
|
value: function buildHTML() {
|
|
3972
|
-
var
|
|
3982
|
+
var _this29 = this;
|
|
3973
3983
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3974
3984
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3975
3985
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3978,7 +3988,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3978
3988
|
if (this.options.template) {
|
|
3979
3989
|
if (d.length > 0) {
|
|
3980
3990
|
d.forEach(function (row, ix) {
|
|
3981
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3991
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this29.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3982
3992
|
// find conditional elements
|
|
3983
3993
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3984
3994
|
ifMatches.forEach(function (m) {
|
|
@@ -4066,7 +4076,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4066
4076
|
parts.forEach(function (p) {
|
|
4067
4077
|
items = items[p];
|
|
4068
4078
|
});
|
|
4069
|
-
template = template.replace(m[0],
|
|
4079
|
+
template = template.replace(m[0], _this29.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4070
4080
|
}
|
|
4071
4081
|
});
|
|
4072
4082
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4075,7 +4085,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4075
4085
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4076
4086
|
}
|
|
4077
4087
|
});
|
|
4078
|
-
var flatRow =
|
|
4088
|
+
var flatRow = _this29.flattenObject(row);
|
|
4079
4089
|
for (var key in flatRow) {
|
|
4080
4090
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4081
4091
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4200,15 +4210,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4200
4210
|
}, {
|
|
4201
4211
|
key: "render",
|
|
4202
4212
|
value: function render() {
|
|
4203
|
-
var
|
|
4213
|
+
var _this30 = this;
|
|
4204
4214
|
if (this.options.entity) {
|
|
4205
4215
|
var url = this.options.entity;
|
|
4206
4216
|
if (this.options.sortField) {
|
|
4207
4217
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4208
4218
|
}
|
|
4209
4219
|
this.apiService.get(url).then(function (results) {
|
|
4210
|
-
|
|
4211
|
-
|
|
4220
|
+
_this30.rows = results.rows;
|
|
4221
|
+
_this30.resize();
|
|
4212
4222
|
});
|
|
4213
4223
|
} else {
|
|
4214
4224
|
this.resize();
|
|
@@ -4287,12 +4297,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4287
4297
|
_createClass(WebsyRouter, [{
|
|
4288
4298
|
key: "addGroup",
|
|
4289
4299
|
value: function addGroup(group) {
|
|
4290
|
-
var
|
|
4300
|
+
var _this31 = this;
|
|
4291
4301
|
if (!this.groups[group]) {
|
|
4292
4302
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4293
4303
|
if (els) {
|
|
4294
4304
|
this.getClosestParent(els[0], function (parent) {
|
|
4295
|
-
|
|
4305
|
+
_this31.groups[group] = {
|
|
4296
4306
|
activeView: '',
|
|
4297
4307
|
views: [],
|
|
4298
4308
|
parent: parent.getAttribute('data-view')
|
|
@@ -4356,7 +4366,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4356
4366
|
}, {
|
|
4357
4367
|
key: "removeUrlParams",
|
|
4358
4368
|
value: function removeUrlParams() {
|
|
4359
|
-
var
|
|
4369
|
+
var _this32 = this;
|
|
4360
4370
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4361
4371
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4362
4372
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4364,7 +4374,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4364
4374
|
var path = '';
|
|
4365
4375
|
if (this.currentParams && this.currentParams.items) {
|
|
4366
4376
|
params.forEach(function (p) {
|
|
4367
|
-
delete
|
|
4377
|
+
delete _this32.currentParams.items[p];
|
|
4368
4378
|
});
|
|
4369
4379
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4370
4380
|
}
|
|
@@ -4695,11 +4705,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4695
4705
|
}, {
|
|
4696
4706
|
key: "showComponents",
|
|
4697
4707
|
value: function showComponents(view) {
|
|
4698
|
-
var
|
|
4708
|
+
var _this33 = this;
|
|
4699
4709
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4700
4710
|
this.options.views[view].components.forEach(function (c) {
|
|
4701
4711
|
if (typeof c.instance === 'undefined') {
|
|
4702
|
-
|
|
4712
|
+
_this33.prepComponent(c.elementId, c.options);
|
|
4703
4713
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4704
4714
|
} else if (c.instance.render) {
|
|
4705
4715
|
c.instance.render();
|
|
@@ -4719,42 +4729,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4719
4729
|
}, {
|
|
4720
4730
|
key: "initView",
|
|
4721
4731
|
value: function initView(view) {
|
|
4722
|
-
var
|
|
4732
|
+
var _this34 = this;
|
|
4723
4733
|
return new Promise(function (resolve, reject) {
|
|
4724
|
-
if (!
|
|
4725
|
-
|
|
4734
|
+
if (!_this34.options.views[view]) {
|
|
4735
|
+
_this34.options.views[view] = {
|
|
4726
4736
|
components: []
|
|
4727
4737
|
};
|
|
4728
4738
|
}
|
|
4729
|
-
if (
|
|
4739
|
+
if (_this34.options.views[view].ready === true) {
|
|
4730
4740
|
resolve();
|
|
4731
|
-
} else if (
|
|
4732
|
-
|
|
4741
|
+
} else if (_this34.options.views[view].template) {
|
|
4742
|
+
_this34.preloadView(view, function () {
|
|
4733
4743
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4734
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
4744
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this34.options.viewClass));
|
|
4735
4745
|
if (viewEl) {
|
|
4736
|
-
|
|
4737
|
-
template:
|
|
4746
|
+
_this34.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
4747
|
+
template: _this34.options.views[view].template,
|
|
4738
4748
|
data: data,
|
|
4739
4749
|
readyCallbackFn: function readyCallbackFn() {
|
|
4740
|
-
|
|
4750
|
+
_this34.options.views[view].ready = true;
|
|
4741
4751
|
resolve();
|
|
4742
4752
|
}
|
|
4743
4753
|
});
|
|
4744
4754
|
} else {
|
|
4745
4755
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
4746
|
-
|
|
4756
|
+
_this34.options.views[view].ready = true;
|
|
4747
4757
|
resolve();
|
|
4748
4758
|
}
|
|
4749
4759
|
});
|
|
4750
|
-
} else if (
|
|
4751
|
-
|
|
4760
|
+
} else if (_this34.options.views[view].ready !== true && _this34.options.views[view].load) {
|
|
4761
|
+
_this34.preloadView(view, function () {
|
|
4752
4762
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4753
|
-
|
|
4763
|
+
_this34.options.views[view].ready = true;
|
|
4754
4764
|
resolve();
|
|
4755
4765
|
});
|
|
4756
4766
|
} else {
|
|
4757
|
-
|
|
4767
|
+
_this34.options.views[view].ready = true;
|
|
4758
4768
|
resolve();
|
|
4759
4769
|
}
|
|
4760
4770
|
});
|
|
@@ -4762,35 +4772,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4762
4772
|
}, {
|
|
4763
4773
|
key: "showView",
|
|
4764
4774
|
value: function showView(view, params, group) {
|
|
4765
|
-
var
|
|
4775
|
+
var _this35 = this;
|
|
4766
4776
|
if (view === '/' || view === '') {
|
|
4767
4777
|
view = this.options.defaultView || '';
|
|
4768
4778
|
}
|
|
4769
4779
|
this.initView(view).then(function () {
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
var children =
|
|
4780
|
+
_this35.activateItem(view, _this35.options.triggerClass);
|
|
4781
|
+
_this35.activateItem(view, _this35.options.viewClass);
|
|
4782
|
+
var children = _this35.getActiveViewsFromParent(view);
|
|
4773
4783
|
for (var c = 0; c < children.length; c++) {
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4784
|
+
_this35.activateItem(children[c].view, _this35.options.triggerClass);
|
|
4785
|
+
_this35.activateItem(children[c].view, _this35.options.viewClass);
|
|
4786
|
+
_this35.showComponents(children[c].view);
|
|
4777
4787
|
if (children[c].show) {
|
|
4778
4788
|
children[c].show.call(children[c]);
|
|
4779
4789
|
}
|
|
4780
|
-
|
|
4790
|
+
_this35.publish('show', [children[c].view, null, group]);
|
|
4781
4791
|
}
|
|
4782
|
-
if (
|
|
4783
|
-
|
|
4784
|
-
if (
|
|
4785
|
-
|
|
4792
|
+
if (_this35.previousView !== _this35.currentView || group !== 'main') {
|
|
4793
|
+
_this35.showComponents(view);
|
|
4794
|
+
if (_this35.options.views[view].show) {
|
|
4795
|
+
_this35.options.views[view].show.call(_this35.options.views[view]);
|
|
4786
4796
|
}
|
|
4787
|
-
|
|
4788
|
-
} else if (
|
|
4789
|
-
|
|
4790
|
-
if (
|
|
4791
|
-
|
|
4797
|
+
_this35.publish('show', [view, params, group]);
|
|
4798
|
+
} else if (_this35.previousView === _this35.currentView && _this35.previousParams.path !== _this35.currentParams.path) {
|
|
4799
|
+
_this35.showComponents(view);
|
|
4800
|
+
if (_this35.options.views[view].show) {
|
|
4801
|
+
_this35.options.views[view].show.call(_this35.options.views[view]);
|
|
4792
4802
|
}
|
|
4793
|
-
|
|
4803
|
+
_this35.publish('show', [view, params, group]);
|
|
4794
4804
|
}
|
|
4795
4805
|
});
|
|
4796
4806
|
}
|
|
@@ -5119,7 +5129,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5119
5129
|
/* global WebsyDesigns */
|
|
5120
5130
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5121
5131
|
function WebsyTemplate(elementId, options) {
|
|
5122
|
-
var
|
|
5132
|
+
var _this36 = this;
|
|
5123
5133
|
_classCallCheck(this, WebsyTemplate);
|
|
5124
5134
|
var DEFAULTS = {
|
|
5125
5135
|
listeners: {
|
|
@@ -5148,8 +5158,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5148
5158
|
}
|
|
5149
5159
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5150
5160
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5151
|
-
|
|
5152
|
-
|
|
5161
|
+
_this36.options.template = templateString;
|
|
5162
|
+
_this36.render();
|
|
5153
5163
|
});
|
|
5154
5164
|
} else {
|
|
5155
5165
|
this.render();
|
|
@@ -5158,7 +5168,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5158
5168
|
_createClass(WebsyTemplate, [{
|
|
5159
5169
|
key: "buildHTML",
|
|
5160
5170
|
value: function buildHTML() {
|
|
5161
|
-
var
|
|
5171
|
+
var _this37 = this;
|
|
5162
5172
|
var html = "";
|
|
5163
5173
|
if (this.options.template) {
|
|
5164
5174
|
var template = this.options.template;
|
|
@@ -5207,14 +5217,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5207
5217
|
}
|
|
5208
5218
|
}
|
|
5209
5219
|
if (polarity === true) {
|
|
5210
|
-
if (typeof
|
|
5220
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
|
|
5211
5221
|
// remove the <if> tags
|
|
5212
5222
|
removeAll = false;
|
|
5213
5223
|
} else if (parts[0] === parts[1]) {
|
|
5214
5224
|
removeAll = false;
|
|
5215
5225
|
}
|
|
5216
5226
|
} else if (polarity === false) {
|
|
5217
|
-
if (typeof
|
|
5227
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
|
|
5218
5228
|
// remove the <if> tags
|
|
5219
5229
|
removeAll = false;
|
|
5220
5230
|
}
|
|
@@ -5533,7 +5543,7 @@ var WebsyUtils = {
|
|
|
5533
5543
|
/* global WebsyDesigns */
|
|
5534
5544
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5535
5545
|
function WebsyTable(elementId, options) {
|
|
5536
|
-
var
|
|
5546
|
+
var _this38 = this;
|
|
5537
5547
|
_classCallCheck(this, WebsyTable);
|
|
5538
5548
|
var DEFAULTS = {
|
|
5539
5549
|
pageSize: 20,
|
|
@@ -5566,8 +5576,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5566
5576
|
allowClear: false,
|
|
5567
5577
|
disableSearch: true,
|
|
5568
5578
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5569
|
-
if (
|
|
5570
|
-
|
|
5579
|
+
if (_this38.options.onChangePageSize) {
|
|
5580
|
+
_this38.options.onChangePageSize(selectedItem.value);
|
|
5571
5581
|
}
|
|
5572
5582
|
}
|
|
5573
5583
|
});
|
|
@@ -5591,20 +5601,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5591
5601
|
}, {
|
|
5592
5602
|
key: "appendRows",
|
|
5593
5603
|
value: function appendRows(data) {
|
|
5594
|
-
var
|
|
5604
|
+
var _this39 = this;
|
|
5595
5605
|
this._isRendered = false;
|
|
5596
5606
|
this.hideError();
|
|
5597
5607
|
var bodyHTML = '';
|
|
5598
5608
|
if (data) {
|
|
5599
5609
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5600
5610
|
return '<tr>' + r.map(function (c, i) {
|
|
5601
|
-
if (
|
|
5611
|
+
if (_this39.options.columns[i].show !== false) {
|
|
5602
5612
|
var style = '';
|
|
5603
5613
|
if (c.style) {
|
|
5604
5614
|
style += c.style;
|
|
5605
5615
|
}
|
|
5606
|
-
if (
|
|
5607
|
-
style += "width: ".concat(
|
|
5616
|
+
if (_this39.options.columns[i].width) {
|
|
5617
|
+
style += "width: ".concat(_this39.options.columns[i].width, "; ");
|
|
5608
5618
|
}
|
|
5609
5619
|
if (c.backgroundColor) {
|
|
5610
5620
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5615,20 +5625,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5615
5625
|
if (c.color) {
|
|
5616
5626
|
style += "color: ".concat(c.color, "; ");
|
|
5617
5627
|
}
|
|
5618
|
-
if (
|
|
5619
|
-
return "\n <td \n data-row-index='".concat(
|
|
5620
|
-
} else if ((
|
|
5621
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5628
|
+
if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5629
|
+
return "\n <td \n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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(_this39.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5630
|
+
} else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5631
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this39.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this39.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this39.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5622
5632
|
} else {
|
|
5623
5633
|
var info = c.value;
|
|
5624
|
-
if (
|
|
5634
|
+
if (_this39.options.columns[i].showAsImage === true) {
|
|
5625
5635
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5626
5636
|
}
|
|
5627
5637
|
var html = "\n <td \n ";
|
|
5628
|
-
if (!
|
|
5638
|
+
if (!_this39.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
5629
5639
|
html += "\n data-info='".concat(info, "'\n ");
|
|
5630
5640
|
}
|
|
5631
|
-
html += "\n data-row-index='".concat(
|
|
5641
|
+
html += "\n data-row-index='".concat(_this39.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this39.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 ");
|
|
5632
5642
|
return html;
|
|
5633
5643
|
}
|
|
5634
5644
|
}
|
|
@@ -5789,7 +5799,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5789
5799
|
}, {
|
|
5790
5800
|
key: "render",
|
|
5791
5801
|
value: function render(data) {
|
|
5792
|
-
var
|
|
5802
|
+
var _this40 = this;
|
|
5793
5803
|
this._isRendered = false;
|
|
5794
5804
|
if (!this.options.columns) {
|
|
5795
5805
|
return;
|
|
@@ -5817,7 +5827,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5817
5827
|
if (c.width) {
|
|
5818
5828
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5819
5829
|
}
|
|
5820
|
-
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 ?
|
|
5830
|
+
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 ? _this40.buildSearchIcon(c.qGroupFieldDefs[0]) : '', "-->\n </div>\n </th>\n ");
|
|
5821
5831
|
}
|
|
5822
5832
|
}).join('') + '</tr>';
|
|
5823
5833
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5835,7 +5845,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5835
5845
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5836
5846
|
if (pagingEl) {
|
|
5837
5847
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5838
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5848
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5839
5849
|
});
|
|
5840
5850
|
var startIndex = 0;
|
|
5841
5851
|
if (this.options.pageCount > 8) {
|
|
@@ -5891,7 +5901,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5891
5901
|
/* global WebsyDesigns */
|
|
5892
5902
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5893
5903
|
function WebsyTable2(elementId, options) {
|
|
5894
|
-
var
|
|
5904
|
+
var _this41 = this;
|
|
5895
5905
|
_classCallCheck(this, WebsyTable2);
|
|
5896
5906
|
var DEFAULTS = {
|
|
5897
5907
|
pageSize: 20,
|
|
@@ -5926,8 +5936,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5926
5936
|
allowClear: false,
|
|
5927
5937
|
disableSearch: true,
|
|
5928
5938
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5929
|
-
if (
|
|
5930
|
-
|
|
5939
|
+
if (_this41.options.onChangePageSize) {
|
|
5940
|
+
_this41.options.onChangePageSize(selectedItem.value);
|
|
5931
5941
|
}
|
|
5932
5942
|
}
|
|
5933
5943
|
});
|
|
@@ -5949,20 +5959,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5949
5959
|
_createClass(WebsyTable2, [{
|
|
5950
5960
|
key: "appendRows",
|
|
5951
5961
|
value: function appendRows(data) {
|
|
5952
|
-
var
|
|
5962
|
+
var _this42 = this;
|
|
5953
5963
|
this.hideError();
|
|
5954
5964
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5955
5965
|
var bodyHTML = '';
|
|
5956
5966
|
if (data) {
|
|
5957
5967
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5958
5968
|
return '<tr>' + r.map(function (c, i) {
|
|
5959
|
-
if (
|
|
5960
|
-
var style = "height: ".concat(
|
|
5969
|
+
if (_this42.options.columns[i].show !== false) {
|
|
5970
|
+
var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
|
|
5961
5971
|
if (c.style) {
|
|
5962
5972
|
style += c.style;
|
|
5963
5973
|
}
|
|
5964
|
-
if (
|
|
5965
|
-
style += "width: ".concat(
|
|
5974
|
+
if (_this42.options.columns[i].width) {
|
|
5975
|
+
style += "width: ".concat(_this42.options.columns[i].width, "; ");
|
|
5966
5976
|
}
|
|
5967
5977
|
if (c.backgroundColor) {
|
|
5968
5978
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5973,16 +5983,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5973
5983
|
if (c.color) {
|
|
5974
5984
|
style += "color: ".concat(c.color, "; ");
|
|
5975
5985
|
}
|
|
5976
|
-
if (
|
|
5977
|
-
return "\n <td \n data-row-index='".concat(
|
|
5978
|
-
} else if ((
|
|
5979
|
-
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(
|
|
5986
|
+
if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5987
|
+
return "\n <td \n data-row-index='".concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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(_this42.options.columns[i].openInNewTab === true ? '_blank' : '_self', "'>").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</a>\n </td>\n ");
|
|
5988
|
+
} else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5989
|
+
return "\n <td \n data-view='".concat(c.value, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='websy-trigger trigger-item ").concat(_this42.options.columns[i].clickable === true ? 'clickable' : '', " ").concat(_this42.options.columns[i].classes || '', "' \n style='").concat(style, "'\n colspan='").concat(c.colspan || 1, "'\n rowspan='").concat(c.rowspan || 1, "'\n >").concat(c.displayText || _this42.options.columns[i].linkText || c.value, "</td>\n ");
|
|
5980
5990
|
} else {
|
|
5981
5991
|
var info = c.value;
|
|
5982
|
-
if (
|
|
5992
|
+
if (_this42.options.columns[i].showAsImage === true) {
|
|
5983
5993
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5984
5994
|
}
|
|
5985
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5995
|
+
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(_this42.rowCount + rowIndex, "' \n data-col-index='").concat(i, "' \n class='").concat(_this42.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 ");
|
|
5986
5996
|
}
|
|
5987
5997
|
}
|
|
5988
5998
|
}).join('') + '</tr>';
|
|
@@ -6216,7 +6226,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6216
6226
|
}, {
|
|
6217
6227
|
key: "render",
|
|
6218
6228
|
value: function render(data) {
|
|
6219
|
-
var
|
|
6229
|
+
var _this43 = this;
|
|
6220
6230
|
if (!this.options.columns) {
|
|
6221
6231
|
return;
|
|
6222
6232
|
}
|
|
@@ -6244,7 +6254,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6244
6254
|
if (c.width) {
|
|
6245
6255
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6246
6256
|
}
|
|
6247
|
-
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 ?
|
|
6257
|
+
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 ? _this43.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6248
6258
|
}
|
|
6249
6259
|
}).join('') + '</tr>';
|
|
6250
6260
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6254,7 +6264,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6254
6264
|
var dropdownHTML = "";
|
|
6255
6265
|
this.options.columns.forEach(function (c, i) {
|
|
6256
6266
|
if (c.searchable && c.searchField) {
|
|
6257
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6267
|
+
dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6258
6268
|
}
|
|
6259
6269
|
});
|
|
6260
6270
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6274,7 +6284,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6274
6284
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6275
6285
|
if (pagingEl) {
|
|
6276
6286
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6277
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6287
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6278
6288
|
});
|
|
6279
6289
|
var startIndex = 0;
|
|
6280
6290
|
if (this.options.pageCount > 8) {
|
|
@@ -6351,17 +6361,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6351
6361
|
}, {
|
|
6352
6362
|
key: "getColumnParameters",
|
|
6353
6363
|
value: function getColumnParameters(values) {
|
|
6354
|
-
var
|
|
6364
|
+
var _this44 = this;
|
|
6355
6365
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6356
6366
|
tableEl.style.tableLayout = 'auto';
|
|
6357
6367
|
tableEl.style.width = 'auto';
|
|
6358
6368
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6359
6369
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6360
6370
|
headEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c, i) {
|
|
6361
|
-
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 ?
|
|
6371
|
+
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 ? _this44.buildSearchIcon(i) : '', "\n </div>\n </th>\n ");
|
|
6362
6372
|
}).join('') + '</tr>';
|
|
6363
6373
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6364
|
-
return "\n <td \n style='height: ".concat(
|
|
6374
|
+
return "\n <td \n style='height: ".concat(_this44.options.cellSize, "px; line-height: ").concat(_this44.options.cellSize, "px; padding: 10px 5px;'\n >").concat(c.value || ' ', "</td>\n ");
|
|
6365
6375
|
}).join('') + '</tr>';
|
|
6366
6376
|
// get height of the first data cell
|
|
6367
6377
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6525,7 +6535,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6525
6535
|
}, {
|
|
6526
6536
|
key: "buildBodyHtml",
|
|
6527
6537
|
value: function buildBodyHtml() {
|
|
6528
|
-
var
|
|
6538
|
+
var _this45 = this;
|
|
6529
6539
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6530
6540
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6531
6541
|
if (!this.options.columns) {
|
|
@@ -6550,7 +6560,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6550
6560
|
row.forEach(function (cell, cellIndex) {
|
|
6551
6561
|
var sizeIndex = cell.level || cellIndex;
|
|
6552
6562
|
var colIndex = cell.index || cellIndex;
|
|
6553
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6563
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
|
|
6554
6564
|
return; // need to revisit this logic
|
|
6555
6565
|
}
|
|
6556
6566
|
|
|
@@ -6577,7 +6587,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6577
6587
|
style += "color: ".concat(cell.color, "; ");
|
|
6578
6588
|
}
|
|
6579
6589
|
// console.log('rowspan', cell.rowspan)
|
|
6580
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6590
|
+
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex < _this45.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((cell.classes || []).join(' '), " ").concat((sizingColumns[sizeIndex].classes || []).join(' '), "'\n style='").concat(style, "'\n ");
|
|
6581
6591
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
6582
6592
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
6583
6593
|
}
|
|
@@ -6590,10 +6600,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6590
6600
|
// }
|
|
6591
6601
|
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 >");
|
|
6592
6602
|
if (cell.expandable === true) {
|
|
6593
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(
|
|
6603
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-expand'\n >").concat(_this45.options.plusIcon, "</i>");
|
|
6594
6604
|
}
|
|
6595
6605
|
if (cell.collapsable === true) {
|
|
6596
|
-
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(
|
|
6606
|
+
bodyHtml += "<i \n data-row-index='".concat(rowIndex, "'\n data-col-index='").concat(cell.level || cellIndex, "'\n class='websy-table-cell-collapse'\n >").concat(_this45.options.minusIcon, "</i>");
|
|
6597
6607
|
}
|
|
6598
6608
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6599
6609
|
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 ");
|
|
@@ -6614,7 +6624,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6614
6624
|
}, {
|
|
6615
6625
|
key: "buildHeaderHtml",
|
|
6616
6626
|
value: function buildHeaderHtml() {
|
|
6617
|
-
var
|
|
6627
|
+
var _this46 = this;
|
|
6618
6628
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6619
6629
|
if (!this.options.columns) {
|
|
6620
6630
|
return '';
|
|
@@ -6635,7 +6645,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6635
6645
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
6636
6646
|
// return
|
|
6637
6647
|
// }
|
|
6638
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
6648
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this46.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
6639
6649
|
row.filter(function (c) {
|
|
6640
6650
|
return c.show !== false;
|
|
6641
6651
|
}).forEach(function (col, colIndex) {
|
|
@@ -6655,24 +6665,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6655
6665
|
if (col.style) {
|
|
6656
6666
|
style += col.style;
|
|
6657
6667
|
}
|
|
6658
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6668
|
+
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex < _this46.pinnedColumns ? 'pinned' : 'unpinned', " ").concat((col.classes || []).join(' '), "' \n style='").concat(style, "' \n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6659
6669
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6660
6670
|
// headerHtml += `
|
|
6661
6671
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6662
6672
|
// width='${col.width || col.actualWidth}'
|
|
6663
6673
|
// `
|
|
6664
6674
|
// }
|
|
6665
|
-
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 ?
|
|
6675
|
+
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 ? _this46.buildSortIcon(col.sort, colIndex) : '').concat(col.searchable === true ? _this46.buildSearchIcon(col, colIndex) : '', "\n </div>\n </td>");
|
|
6666
6676
|
});
|
|
6667
6677
|
headerHtml += "</tr>";
|
|
6668
6678
|
});
|
|
6669
6679
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6670
6680
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6671
6681
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6672
|
-
var testEl = document.getElementById("".concat(
|
|
6682
|
+
var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6673
6683
|
if (!testEl) {
|
|
6674
6684
|
var newE = document.createElement('div');
|
|
6675
|
-
newE.id = "".concat(
|
|
6685
|
+
newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6676
6686
|
newE.className = 'websy-modal-dropdown';
|
|
6677
6687
|
dropdownEl.appendChild(newE);
|
|
6678
6688
|
}
|
|
@@ -6695,7 +6705,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6695
6705
|
}, {
|
|
6696
6706
|
key: "buildTotalHtml",
|
|
6697
6707
|
value: function buildTotalHtml() {
|
|
6698
|
-
var
|
|
6708
|
+
var _this47 = this;
|
|
6699
6709
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6700
6710
|
if (!this.options.totals) {
|
|
6701
6711
|
return '';
|
|
@@ -6711,7 +6721,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6711
6721
|
|
|
6712
6722
|
totalHtml += "<td \n class='websy-table-cell ".concat((col.classes || []).join(' '), "'\n colspan='").concat(col.colspan || 1, "'\n rowspan='").concat(col.rowspan || 1, "'\n ");
|
|
6713
6723
|
if (useWidths === true) {
|
|
6714
|
-
totalHtml += "\n style='width: ".concat(
|
|
6724
|
+
totalHtml += "\n style='width: ".concat(_this47.options.columns[_this47.options.columns.length - 1][colIndex].width || _this47.options.columns[_this47.options.columns.length - 1][colIndex].actualWidth, "px'\n width='").concat(col.width || col.actualWidth, "'\n ");
|
|
6715
6725
|
}
|
|
6716
6726
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6717
6727
|
});
|
|
@@ -6721,7 +6731,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6721
6731
|
}, {
|
|
6722
6732
|
key: "calculateSizes",
|
|
6723
6733
|
value: function calculateSizes() {
|
|
6724
|
-
var
|
|
6734
|
+
var _this48 = this;
|
|
6725
6735
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6726
6736
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6727
6737
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6765,7 +6775,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6765
6775
|
rows.forEach(function (row, rowIndex) {
|
|
6766
6776
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6767
6777
|
var colSize = col.getBoundingClientRect();
|
|
6768
|
-
|
|
6778
|
+
_this48.sizes.cellHeight = colSize.height;
|
|
6769
6779
|
if (columnsForSizing[colIndex]) {
|
|
6770
6780
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6771
6781
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -6777,7 +6787,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6777
6787
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6778
6788
|
// }
|
|
6779
6789
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6780
|
-
if (colIndex >=
|
|
6790
|
+
if (colIndex >= _this48.pinnedColumns) {
|
|
6781
6791
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6782
6792
|
}
|
|
6783
6793
|
}
|
|
@@ -6792,7 +6802,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6792
6802
|
return a + (b.width || b.actualWidth);
|
|
6793
6803
|
}, 0);
|
|
6794
6804
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6795
|
-
return i >=
|
|
6805
|
+
return i >= _this48.pinnedColumns;
|
|
6796
6806
|
}).reduce(function (a, b) {
|
|
6797
6807
|
return a + (b.width || b.actualWidth);
|
|
6798
6808
|
}, 0);
|
|
@@ -6803,7 +6813,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6803
6813
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6804
6814
|
columnsForSizing.forEach(function (c) {
|
|
6805
6815
|
c.shouldGrow = true;
|
|
6806
|
-
if (
|
|
6816
|
+
if (_this48.options.autoFitColumns === false) {
|
|
6807
6817
|
c.shouldGrow = false;
|
|
6808
6818
|
if (c.potentialWidth > c.actualWidth) {
|
|
6809
6819
|
c.shouldGrow = true;
|
|
@@ -6822,7 +6832,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6822
6832
|
// if (!c.width) {
|
|
6823
6833
|
// if (c.actualWidth < equalWidth) {
|
|
6824
6834
|
// adjust the width
|
|
6825
|
-
if (
|
|
6835
|
+
if (_this48.options.autoFitColumns === true) {
|
|
6826
6836
|
if (c.width) {
|
|
6827
6837
|
c.width += equalWidth;
|
|
6828
6838
|
}
|
|
@@ -6846,9 +6856,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6846
6856
|
}
|
|
6847
6857
|
// }
|
|
6848
6858
|
// }
|
|
6849
|
-
|
|
6850
|
-
if (i >
|
|
6851
|
-
|
|
6859
|
+
_this48.sizes.totalWidth += c.width || c.actualWidth;
|
|
6860
|
+
if (i > _this48.pinnedColumns) {
|
|
6861
|
+
_this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6852
6862
|
}
|
|
6853
6863
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6854
6864
|
});
|
|
@@ -6907,7 +6917,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6907
6917
|
}, {
|
|
6908
6918
|
key: "createSample",
|
|
6909
6919
|
value: function createSample(data) {
|
|
6910
|
-
var
|
|
6920
|
+
var _this49 = this;
|
|
6911
6921
|
var output = [];
|
|
6912
6922
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6913
6923
|
if (col.maxLength) {
|
|
@@ -6917,7 +6927,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6917
6927
|
} else if (data) {
|
|
6918
6928
|
var longest = '';
|
|
6919
6929
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6920
|
-
if (data[i].length ===
|
|
6930
|
+
if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
|
|
6921
6931
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6922
6932
|
longest = data[i][colIndex].value;
|
|
6923
6933
|
}
|
|
@@ -7189,7 +7199,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7189
7199
|
}, {
|
|
7190
7200
|
key: "perpetualScroll",
|
|
7191
7201
|
value: function perpetualScroll() {
|
|
7192
|
-
var
|
|
7202
|
+
var _this50 = this;
|
|
7193
7203
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7194
7204
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7195
7205
|
return;
|
|
@@ -7208,17 +7218,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7208
7218
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7209
7219
|
var _loop2 = function _loop2(i) {
|
|
7210
7220
|
setTimeout(function () {
|
|
7211
|
-
var delta =
|
|
7221
|
+
var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
|
|
7212
7222
|
delta = Math.min(10, delta);
|
|
7213
7223
|
delta = Math.max(-10, delta);
|
|
7214
7224
|
// only run this if isPerpetual === true
|
|
7215
7225
|
// this value is reset to false on touchStart
|
|
7216
|
-
if (
|
|
7226
|
+
if (_this50.isPerpetual === true) {
|
|
7217
7227
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7218
7228
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7219
|
-
|
|
7220
|
-
if (
|
|
7221
|
-
clearTimeout(
|
|
7229
|
+
_this50.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7230
|
+
if (_this50.scrollTimeout) {
|
|
7231
|
+
clearTimeout(_this50.scrollTimeout);
|
|
7222
7232
|
}
|
|
7223
7233
|
}
|
|
7224
7234
|
}, 1000 / fps * i);
|
|
@@ -7486,7 +7496,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7486
7496
|
/* global d3 include WebsyDesigns */
|
|
7487
7497
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7488
7498
|
function WebsyChart(elementId, options) {
|
|
7489
|
-
var
|
|
7499
|
+
var _this51 = this;
|
|
7490
7500
|
_classCallCheck(this, WebsyChart);
|
|
7491
7501
|
var DEFAULTS = {
|
|
7492
7502
|
margin: {
|
|
@@ -7545,7 +7555,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7545
7555
|
this.invertOverride = function (input, input2) {
|
|
7546
7556
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7547
7557
|
var xAxis = 'bottom';
|
|
7548
|
-
if (
|
|
7558
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
7549
7559
|
xAxis = 'left';
|
|
7550
7560
|
}
|
|
7551
7561
|
if (forBrush === true) {
|
|
@@ -7553,12 +7563,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7553
7563
|
}
|
|
7554
7564
|
xAxis += 'Axis';
|
|
7555
7565
|
var output;
|
|
7556
|
-
var width =
|
|
7566
|
+
var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7557
7567
|
// if (this.customBottomRange) {
|
|
7558
|
-
for (var index = 0; index <
|
|
7559
|
-
if (input >
|
|
7560
|
-
if (
|
|
7561
|
-
if (input <
|
|
7568
|
+
for (var index = 0; index < _this51.customBottomRange.length; index++) {
|
|
7569
|
+
if (input > _this51.customBottomRange[index]) {
|
|
7570
|
+
if (_this51.customBottomRange[index + 1]) {
|
|
7571
|
+
if (input < _this51.customBottomRange[index + 1]) {
|
|
7562
7572
|
output = index;
|
|
7563
7573
|
break;
|
|
7564
7574
|
}
|
|
@@ -7723,9 +7733,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7723
7733
|
}, {
|
|
7724
7734
|
key: "handleEventMouseMove",
|
|
7725
7735
|
value: function handleEventMouseMove(event, d) {
|
|
7726
|
-
var
|
|
7736
|
+
var _this52 = this;
|
|
7727
7737
|
var bisectDate = d3.bisector(function (d) {
|
|
7728
|
-
return
|
|
7738
|
+
return _this52.parseX(d.x.value);
|
|
7729
7739
|
}).left;
|
|
7730
7740
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7731
7741
|
var xAxis = 'bottomAxis';
|
|
@@ -7758,9 +7768,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7758
7768
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7759
7769
|
}
|
|
7760
7770
|
this.options.data.series.forEach(function (s) {
|
|
7761
|
-
if (
|
|
7771
|
+
if (_this52.options.data[xData].scale !== 'Time') {
|
|
7762
7772
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7763
|
-
xPoint =
|
|
7773
|
+
xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
|
|
7764
7774
|
// }
|
|
7765
7775
|
// else {
|
|
7766
7776
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7780,41 +7790,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7780
7790
|
var index = bisectDate(s.data, x0, 1);
|
|
7781
7791
|
var pointA = s.data[index - 1];
|
|
7782
7792
|
var pointB = s.data[index];
|
|
7783
|
-
if (
|
|
7793
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
7784
7794
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7785
7795
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7786
7796
|
}
|
|
7787
7797
|
if (pointA && !pointB) {
|
|
7788
|
-
xPoint =
|
|
7798
|
+
xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7789
7799
|
tooltipTitle = pointA.x.value;
|
|
7790
7800
|
if (!pointA.y.color) {
|
|
7791
7801
|
pointA.y.color = s.color;
|
|
7792
7802
|
}
|
|
7793
7803
|
tooltipData.push(pointA);
|
|
7794
7804
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7795
|
-
tooltipTitle = d3.timeFormat(
|
|
7805
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7796
7806
|
}
|
|
7797
7807
|
}
|
|
7798
7808
|
if (pointB && !pointA) {
|
|
7799
|
-
xPoint =
|
|
7809
|
+
xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7800
7810
|
tooltipTitle = pointB.x.value;
|
|
7801
7811
|
if (!pointB.y.color) {
|
|
7802
7812
|
pointB.y.color = s.color;
|
|
7803
7813
|
}
|
|
7804
7814
|
tooltipData.push(pointB);
|
|
7805
7815
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7806
|
-
tooltipTitle = d3.timeFormat(
|
|
7816
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7807
7817
|
}
|
|
7808
7818
|
}
|
|
7809
7819
|
if (pointA && pointB) {
|
|
7810
|
-
var d0 =
|
|
7811
|
-
var d1 =
|
|
7820
|
+
var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7821
|
+
var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7812
7822
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7813
7823
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7814
7824
|
xPoint = d1;
|
|
7815
7825
|
tooltipTitle = pointB.x.value;
|
|
7816
7826
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7817
|
-
tooltipTitle = d3.timeFormat(
|
|
7827
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7818
7828
|
}
|
|
7819
7829
|
if (!pointB.y.color) {
|
|
7820
7830
|
pointB.y.color = s.color;
|
|
@@ -7824,7 +7834,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7824
7834
|
xPoint = d0;
|
|
7825
7835
|
tooltipTitle = pointA.x.value;
|
|
7826
7836
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7827
|
-
tooltipTitle = d3.timeFormat(
|
|
7837
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7828
7838
|
}
|
|
7829
7839
|
if (!pointA.y.color) {
|
|
7830
7840
|
pointA.y.color = s.color;
|
|
@@ -7950,7 +7960,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7950
7960
|
}, {
|
|
7951
7961
|
key: "render",
|
|
7952
7962
|
value: function render(options) {
|
|
7953
|
-
var
|
|
7963
|
+
var _this53 = this;
|
|
7954
7964
|
/* global d3 options WebsyUtils */
|
|
7955
7965
|
this._isRendered = false;
|
|
7956
7966
|
if (typeof options !== 'undefined') {
|
|
@@ -8019,7 +8029,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8019
8029
|
this.options.data.series.map(function (s, i) {
|
|
8020
8030
|
return {
|
|
8021
8031
|
value: s.label || s.key,
|
|
8022
|
-
color: s.color ||
|
|
8032
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8023
8033
|
};
|
|
8024
8034
|
});
|
|
8025
8035
|
}
|
|
@@ -8376,25 +8386,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8376
8386
|
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') {
|
|
8377
8387
|
var acc = 0;
|
|
8378
8388
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8379
|
-
var adjustment =
|
|
8389
|
+
var adjustment = _this53.bandPadding * index + _this53.bandPadding;
|
|
8380
8390
|
// if (this.options.data.bottom.padding) {
|
|
8381
8391
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8382
8392
|
// }
|
|
8383
|
-
var start =
|
|
8393
|
+
var start = _this53.widthForCalc / noOfPoints * acc;
|
|
8384
8394
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8385
8395
|
var pos = i * proposedBandWidth;
|
|
8386
|
-
|
|
8396
|
+
_this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8387
8397
|
}
|
|
8388
|
-
acc +=
|
|
8389
|
-
var end =
|
|
8398
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8399
|
+
var end = _this53.widthForCalc / noOfPoints * acc;
|
|
8390
8400
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8391
8401
|
return end + adjustment;
|
|
8392
8402
|
})));
|
|
8393
8403
|
acc = 0;
|
|
8394
8404
|
this["custom".concat(customRangeSide, "BrushRange")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8395
|
-
var adjustment =
|
|
8396
|
-
acc +=
|
|
8397
|
-
return (
|
|
8405
|
+
var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
|
|
8406
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8407
|
+
return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
|
|
8398
8408
|
})));
|
|
8399
8409
|
}
|
|
8400
8410
|
// }
|
|
@@ -8567,7 +8577,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8567
8577
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8568
8578
|
if (this.options.data.bottom.formatter) {
|
|
8569
8579
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8570
|
-
return
|
|
8580
|
+
return _this53.options.data.bottom.formatter(d);
|
|
8571
8581
|
});
|
|
8572
8582
|
}
|
|
8573
8583
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8577,7 +8587,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8577
8587
|
}
|
|
8578
8588
|
if (this.customBottomRange.length > 0) {
|
|
8579
8589
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8580
|
-
return "translate(".concat(
|
|
8590
|
+
return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
|
|
8581
8591
|
});
|
|
8582
8592
|
}
|
|
8583
8593
|
}
|
|
@@ -8596,14 +8606,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8596
8606
|
}
|
|
8597
8607
|
if (this.options.margin.axisLeft > 0) {
|
|
8598
8608
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8599
|
-
if (
|
|
8600
|
-
d =
|
|
8609
|
+
if (_this53.options.data.left.formatter) {
|
|
8610
|
+
d = _this53.options.data.left.formatter(d);
|
|
8601
8611
|
}
|
|
8602
8612
|
return d;
|
|
8603
8613
|
}));
|
|
8604
8614
|
if (this.customLeftRange.length > 0) {
|
|
8605
8615
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8606
|
-
return "translate(0, ".concat(
|
|
8616
|
+
return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
|
|
8607
8617
|
});
|
|
8608
8618
|
}
|
|
8609
8619
|
}
|
|
@@ -8631,8 +8641,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8631
8641
|
}
|
|
8632
8642
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8633
8643
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8634
|
-
if (
|
|
8635
|
-
d =
|
|
8644
|
+
if (_this53.options.data.right.formatter) {
|
|
8645
|
+
d = _this53.options.data.right.formatter(d);
|
|
8636
8646
|
}
|
|
8637
8647
|
return d;
|
|
8638
8648
|
}));
|
|
@@ -8672,25 +8682,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8672
8682
|
}, {
|
|
8673
8683
|
key: "renderComponents",
|
|
8674
8684
|
value: function renderComponents() {
|
|
8675
|
-
var
|
|
8685
|
+
var _this54 = this;
|
|
8676
8686
|
// Draw the series data
|
|
8677
8687
|
this.renderedKeys = {};
|
|
8678
8688
|
this.options.data.series.forEach(function (series, index) {
|
|
8679
8689
|
if (!series.key) {
|
|
8680
|
-
series.key =
|
|
8690
|
+
series.key = _this54.createIdentity();
|
|
8681
8691
|
}
|
|
8682
8692
|
if (!series.color) {
|
|
8683
|
-
series.color =
|
|
8693
|
+
series.color = _this54.options.colors[index % _this54.options.colors.length];
|
|
8684
8694
|
}
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8695
|
+
_this54["render".concat(series.type || 'bar')](series, index);
|
|
8696
|
+
_this54.renderLabels(series, index);
|
|
8697
|
+
_this54.renderedKeys[series.key] = series.type;
|
|
8688
8698
|
});
|
|
8689
8699
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8690
8700
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8691
8701
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8692
8702
|
this.options.refLines.forEach(function (l) {
|
|
8693
|
-
return
|
|
8703
|
+
return _this54.renderRefLine(l);
|
|
8694
8704
|
});
|
|
8695
8705
|
}
|
|
8696
8706
|
this._isRendered = true;
|
|
@@ -8698,25 +8708,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8698
8708
|
}, {
|
|
8699
8709
|
key: "renderarea",
|
|
8700
8710
|
value: function renderarea(series, index) {
|
|
8701
|
-
var
|
|
8711
|
+
var _this55 = this;
|
|
8702
8712
|
/* global d3 series index */
|
|
8703
8713
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8704
8714
|
return d3.area().x(function (d) {
|
|
8705
|
-
if (
|
|
8706
|
-
return
|
|
8715
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
8716
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
8707
8717
|
} else {
|
|
8708
|
-
var xIndex =
|
|
8709
|
-
var xPos =
|
|
8710
|
-
if (
|
|
8711
|
-
xPos = xPos + (
|
|
8718
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8719
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8720
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8721
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8712
8722
|
}
|
|
8713
8723
|
return xPos;
|
|
8714
8724
|
}
|
|
8715
8725
|
}).y0(function (d) {
|
|
8716
|
-
return
|
|
8726
|
+
return _this55["".concat(yAxis, "Axis")](0);
|
|
8717
8727
|
}).y1(function (d) {
|
|
8718
|
-
return
|
|
8719
|
-
}).curve(d3[curveStyle ||
|
|
8728
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8729
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
8720
8730
|
};
|
|
8721
8731
|
var xAxis = 'bottom';
|
|
8722
8732
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8756,7 +8766,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8756
8766
|
}, {
|
|
8757
8767
|
key: "renderbar",
|
|
8758
8768
|
value: function renderbar(series, index) {
|
|
8759
|
-
var
|
|
8769
|
+
var _this56 = this;
|
|
8760
8770
|
/* global series index d3 */
|
|
8761
8771
|
var xAxis = 'bottom';
|
|
8762
8772
|
var yAxis = 'left';
|
|
@@ -8923,26 +8933,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8923
8933
|
}
|
|
8924
8934
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8925
8935
|
bars.attr('width', function (d, i) {
|
|
8926
|
-
return Math.abs(getBarWidth.call(
|
|
8936
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8927
8937
|
}).attr('height', function (d, i) {
|
|
8928
|
-
return getBarHeight.call(
|
|
8938
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8929
8939
|
}).attr('x', function (d, i) {
|
|
8930
|
-
return getBarX.call(
|
|
8940
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8931
8941
|
}).attr('y', function (d, i) {
|
|
8932
|
-
return getBarY.call(
|
|
8942
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8933
8943
|
})
|
|
8934
8944
|
// .transition(this.transition)
|
|
8935
8945
|
.attr('fill', function (d) {
|
|
8936
8946
|
return d.y.color || d.color || series.color;
|
|
8937
8947
|
});
|
|
8938
8948
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8939
|
-
return Math.abs(getBarWidth.call(
|
|
8949
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8940
8950
|
}).attr('height', function (d, i) {
|
|
8941
|
-
return getBarHeight.call(
|
|
8951
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8942
8952
|
}).attr('x', function (d, i) {
|
|
8943
|
-
return getBarX.call(
|
|
8953
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8944
8954
|
}).attr('y', function (d, i) {
|
|
8945
|
-
return getBarY.call(
|
|
8955
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8946
8956
|
})
|
|
8947
8957
|
// .transition(this.transition)
|
|
8948
8958
|
.attr('fill', function (d) {
|
|
@@ -8954,26 +8964,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8954
8964
|
this.brushBarsInitialized[series.key] = true;
|
|
8955
8965
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8956
8966
|
brushBars.attr('width', function (d, i) {
|
|
8957
|
-
return Math.abs(getBarWidth.call(
|
|
8967
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8958
8968
|
}).attr('height', function (d, i) {
|
|
8959
|
-
return getBarHeight.call(
|
|
8969
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8960
8970
|
}).attr('x', function (d, i) {
|
|
8961
|
-
return getBarX.call(
|
|
8971
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8962
8972
|
}).attr('y', function (d, i) {
|
|
8963
|
-
return getBarY.call(
|
|
8973
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8964
8974
|
})
|
|
8965
8975
|
// .transition(this.transition)
|
|
8966
8976
|
.attr('fill', function (d) {
|
|
8967
8977
|
return d.y.color || d.color || series.color;
|
|
8968
8978
|
});
|
|
8969
8979
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8970
|
-
return Math.abs(getBarWidth.call(
|
|
8980
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8971
8981
|
}).attr('height', function (d, i) {
|
|
8972
|
-
return getBarHeight.call(
|
|
8982
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8973
8983
|
}).attr('x', function (d, i) {
|
|
8974
|
-
return getBarX.call(
|
|
8984
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8975
8985
|
}).attr('y', function (d, i) {
|
|
8976
|
-
return getBarY.call(
|
|
8986
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8977
8987
|
})
|
|
8978
8988
|
// .transition(this.transition)
|
|
8979
8989
|
.attr('fill', function (d) {
|
|
@@ -8994,7 +9004,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8994
9004
|
}, {
|
|
8995
9005
|
key: "renderLabels",
|
|
8996
9006
|
value: function renderLabels(series, index) {
|
|
8997
|
-
var
|
|
9007
|
+
var _this57 = this;
|
|
8998
9008
|
/* global series index d3 WebsyDesigns */
|
|
8999
9009
|
var xAxis = 'bottom';
|
|
9000
9010
|
var yAxis = 'left';
|
|
@@ -9010,14 +9020,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9010
9020
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9011
9021
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9012
9022
|
labels.attr('x', function (d) {
|
|
9013
|
-
return getLabelX.call(
|
|
9023
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9014
9024
|
}).attr('y', function (d) {
|
|
9015
|
-
return getLabelY.call(
|
|
9025
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9016
9026
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9017
|
-
if (
|
|
9027
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9018
9028
|
return 'transparent';
|
|
9019
9029
|
}
|
|
9020
|
-
return
|
|
9030
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9021
9031
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9022
9032
|
return d.y.label || d.y.value;
|
|
9023
9033
|
}).each(function (d, i) {
|
|
@@ -9051,14 +9061,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9051
9061
|
}
|
|
9052
9062
|
});
|
|
9053
9063
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9054
|
-
return getLabelX.call(
|
|
9064
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9055
9065
|
}).attr('y', function (d) {
|
|
9056
|
-
return getLabelY.call(
|
|
9066
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9057
9067
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9058
|
-
if (
|
|
9068
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9059
9069
|
return 'transparent';
|
|
9060
9070
|
}
|
|
9061
|
-
return
|
|
9071
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9062
9072
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9063
9073
|
return d.y.label || d.y.value;
|
|
9064
9074
|
}).each(function (d, i) {
|
|
@@ -9136,32 +9146,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9136
9146
|
}, {
|
|
9137
9147
|
key: "renderline",
|
|
9138
9148
|
value: function renderline(series, index) {
|
|
9139
|
-
var
|
|
9149
|
+
var _this58 = this;
|
|
9140
9150
|
/* global series index d3 */
|
|
9141
9151
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9142
9152
|
return d3.line().x(function (d) {
|
|
9143
|
-
if (
|
|
9144
|
-
return
|
|
9153
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9154
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9145
9155
|
} else {
|
|
9146
|
-
if (
|
|
9147
|
-
return
|
|
9156
|
+
if (_this58.options.data[xAxis].scale === 'Time') {
|
|
9157
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
|
|
9148
9158
|
} else {
|
|
9149
|
-
var xIndex =
|
|
9150
|
-
var xPos =
|
|
9151
|
-
if (
|
|
9152
|
-
xPos = xPos + (
|
|
9159
|
+
var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9160
|
+
var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9161
|
+
if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9162
|
+
xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9153
9163
|
}
|
|
9154
9164
|
return xPos;
|
|
9155
9165
|
}
|
|
9156
9166
|
}
|
|
9157
9167
|
}).y(function (d) {
|
|
9158
|
-
if (
|
|
9159
|
-
var adjustment =
|
|
9160
|
-
return
|
|
9168
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9169
|
+
var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
|
|
9170
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
|
|
9161
9171
|
} else {
|
|
9162
|
-
return
|
|
9172
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9163
9173
|
}
|
|
9164
|
-
}).curve(d3[curveStyle ||
|
|
9174
|
+
}).curve(d3[curveStyle || _this58.options.curveStyle]);
|
|
9165
9175
|
};
|
|
9166
9176
|
var xAxis = 'bottom';
|
|
9167
9177
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9270,14 +9280,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9270
9280
|
}, {
|
|
9271
9281
|
key: "rendersymbol",
|
|
9272
9282
|
value: function rendersymbol(series, index) {
|
|
9273
|
-
var
|
|
9283
|
+
var _this59 = this;
|
|
9274
9284
|
/* global d3 series index series.key */
|
|
9275
9285
|
var drawSymbol = function drawSymbol(size) {
|
|
9276
9286
|
return d3.symbol()
|
|
9277
9287
|
// .type(d => {
|
|
9278
9288
|
// return d3.symbols[0]
|
|
9279
9289
|
// })
|
|
9280
|
-
.size(size ||
|
|
9290
|
+
.size(size || _this59.options.symbolSize);
|
|
9281
9291
|
};
|
|
9282
9292
|
var xAxis = 'bottom';
|
|
9283
9293
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9303,27 +9313,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9303
9313
|
// else {
|
|
9304
9314
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9305
9315
|
// }
|
|
9306
|
-
var xIndex =
|
|
9307
|
-
var xPos =
|
|
9308
|
-
if (
|
|
9309
|
-
xPos = xPos + (
|
|
9310
|
-
}
|
|
9311
|
-
var adjustment =
|
|
9312
|
-
if (
|
|
9313
|
-
return "translate(".concat(
|
|
9316
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9317
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9318
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9319
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9320
|
+
}
|
|
9321
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9322
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9323
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9314
9324
|
} else {
|
|
9315
|
-
if (
|
|
9316
|
-
xPos =
|
|
9325
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9326
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9317
9327
|
} else {
|
|
9318
|
-
var _xIndex =
|
|
9319
|
-
var _xPos =
|
|
9320
|
-
if (
|
|
9321
|
-
_xPos = _xPos + (
|
|
9328
|
+
var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9329
|
+
var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
9330
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
9331
|
+
_xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9322
9332
|
}
|
|
9323
9333
|
// return xPos
|
|
9324
9334
|
}
|
|
9325
9335
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9326
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9336
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9327
9337
|
}
|
|
9328
9338
|
});
|
|
9329
9339
|
// Enter
|
|
@@ -9338,27 +9348,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9338
9348
|
}).attr('class', function (d) {
|
|
9339
9349
|
return "symbol symbol_".concat(series.key);
|
|
9340
9350
|
}).attr('transform', function (d) {
|
|
9341
|
-
var xIndex =
|
|
9342
|
-
var xPos =
|
|
9343
|
-
if (
|
|
9344
|
-
xPos = xPos + (
|
|
9345
|
-
}
|
|
9346
|
-
var adjustment =
|
|
9347
|
-
if (
|
|
9348
|
-
return "translate(".concat(
|
|
9351
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9352
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9353
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9354
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9355
|
+
}
|
|
9356
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9357
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9358
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9349
9359
|
} else {
|
|
9350
|
-
if (
|
|
9351
|
-
xPos =
|
|
9360
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9361
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9352
9362
|
} else {
|
|
9353
|
-
var _xIndex2 =
|
|
9354
|
-
var _xPos2 =
|
|
9355
|
-
if (
|
|
9356
|
-
_xPos2 = _xPos2 + (
|
|
9363
|
+
var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9364
|
+
var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
9365
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
9366
|
+
_xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9357
9367
|
}
|
|
9358
9368
|
// return xPos
|
|
9359
9369
|
}
|
|
9360
9370
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9361
|
-
return "translate(".concat(xPos, ", ").concat(
|
|
9371
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9362
9372
|
}
|
|
9363
9373
|
});
|
|
9364
9374
|
}
|
|
@@ -9554,7 +9564,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9554
9564
|
}, {
|
|
9555
9565
|
key: "resize",
|
|
9556
9566
|
value: function resize() {
|
|
9557
|
-
var
|
|
9567
|
+
var _this60 = this;
|
|
9558
9568
|
var el = document.getElementById(this.elementId);
|
|
9559
9569
|
if (el) {
|
|
9560
9570
|
// if (this.options.width) {
|
|
@@ -9565,7 +9575,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9565
9575
|
// }
|
|
9566
9576
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9567
9577
|
html += this._data.map(function (d, i) {
|
|
9568
|
-
return
|
|
9578
|
+
return _this60.getLegendItemHTML(d);
|
|
9569
9579
|
}).join('');
|
|
9570
9580
|
html += "\n <div>\n ";
|
|
9571
9581
|
el.innerHTML = html;
|
|
@@ -9723,7 +9733,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9723
9733
|
}, {
|
|
9724
9734
|
key: "render",
|
|
9725
9735
|
value: function render() {
|
|
9726
|
-
var
|
|
9736
|
+
var _this61 = this;
|
|
9727
9737
|
this._isRendered = false;
|
|
9728
9738
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9729
9739
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9731,7 +9741,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9731
9741
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9732
9742
|
return {
|
|
9733
9743
|
value: s.label || s.key,
|
|
9734
|
-
color: s.color ||
|
|
9744
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
9735
9745
|
};
|
|
9736
9746
|
});
|
|
9737
9747
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9785,7 +9795,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9785
9795
|
}
|
|
9786
9796
|
if (this.polygons) {
|
|
9787
9797
|
this.polygons.forEach(function (p) {
|
|
9788
|
-
return
|
|
9798
|
+
return _this61.map.removeLayer(p);
|
|
9789
9799
|
});
|
|
9790
9800
|
}
|
|
9791
9801
|
this.polygons = [];
|
|
@@ -9839,15 +9849,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9839
9849
|
p.options = {};
|
|
9840
9850
|
}
|
|
9841
9851
|
if (!p.options.color) {
|
|
9842
|
-
p.options.color =
|
|
9852
|
+
p.options.color = _this61.options.colors[i % _this61.options.colors.length];
|
|
9843
9853
|
}
|
|
9844
9854
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9845
9855
|
return c.map(function (d) {
|
|
9846
9856
|
return [d.Latitude, d.Longitude];
|
|
9847
9857
|
});
|
|
9848
|
-
}), p.options).addTo(
|
|
9849
|
-
|
|
9850
|
-
|
|
9858
|
+
}), p.options).addTo(_this61.map);
|
|
9859
|
+
_this61.polygons.push(pol);
|
|
9860
|
+
_this61.map.fitBounds(pol.getBounds());
|
|
9851
9861
|
});
|
|
9852
9862
|
}
|
|
9853
9863
|
// if (this.data.markers.length > 0) {
|