@websy/websy-designs 1.11.15 → 1.11.16
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')) {
|
|
@@ -3719,7 +3726,7 @@ var WebsyPubSub = /*#__PURE__*/function () {
|
|
|
3719
3726
|
}();
|
|
3720
3727
|
var ResponsiveText = /*#__PURE__*/function () {
|
|
3721
3728
|
function ResponsiveText(elementId, options) {
|
|
3722
|
-
var
|
|
3729
|
+
var _this27 = this;
|
|
3723
3730
|
_classCallCheck(this, ResponsiveText);
|
|
3724
3731
|
var DEFAULTS = {
|
|
3725
3732
|
textAlign: 'center',
|
|
@@ -3730,7 +3737,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3730
3737
|
this.elementId = elementId;
|
|
3731
3738
|
this.canvas = document.createElement('canvas');
|
|
3732
3739
|
window.addEventListener('resize', function () {
|
|
3733
|
-
return
|
|
3740
|
+
return _this27.render();
|
|
3734
3741
|
});
|
|
3735
3742
|
var el = document.getElementById(this.elementId);
|
|
3736
3743
|
if (el) {
|
|
@@ -3920,7 +3927,7 @@ var ResponsiveText = /*#__PURE__*/function () {
|
|
|
3920
3927
|
/* global WebsyDesigns */
|
|
3921
3928
|
var WebsyResultList = /*#__PURE__*/function () {
|
|
3922
3929
|
function WebsyResultList(elementId, options) {
|
|
3923
|
-
var
|
|
3930
|
+
var _this28 = this;
|
|
3924
3931
|
_classCallCheck(this, WebsyResultList);
|
|
3925
3932
|
var DEFAULTS = {
|
|
3926
3933
|
listeners: {
|
|
@@ -3946,8 +3953,8 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3946
3953
|
}
|
|
3947
3954
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
3948
3955
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
3949
|
-
|
|
3950
|
-
|
|
3956
|
+
_this28.options.template = templateString;
|
|
3957
|
+
_this28.render();
|
|
3951
3958
|
});
|
|
3952
3959
|
} else {
|
|
3953
3960
|
this.render();
|
|
@@ -3969,7 +3976,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3969
3976
|
}, {
|
|
3970
3977
|
key: "buildHTML",
|
|
3971
3978
|
value: function buildHTML() {
|
|
3972
|
-
var
|
|
3979
|
+
var _this29 = this;
|
|
3973
3980
|
var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3974
3981
|
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3975
3982
|
var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -3978,7 +3985,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
3978
3985
|
if (this.options.template) {
|
|
3979
3986
|
if (d.length > 0) {
|
|
3980
3987
|
d.forEach(function (row, ix) {
|
|
3981
|
-
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate ||
|
|
3988
|
+
var template = "".concat(ix > 0 ? '-->' : '').concat(inputTemplate || _this29.options.template).concat(ix < d.length - 1 ? '<!--' : '');
|
|
3982
3989
|
// find conditional elements
|
|
3983
3990
|
var ifMatches = _toConsumableArray(template.matchAll(/<\s*if[^>]*>([\s\S]*?)<\s*\/\s*if>/g));
|
|
3984
3991
|
ifMatches.forEach(function (m) {
|
|
@@ -4066,7 +4073,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4066
4073
|
parts.forEach(function (p) {
|
|
4067
4074
|
items = items[p];
|
|
4068
4075
|
});
|
|
4069
|
-
template = template.replace(m[0],
|
|
4076
|
+
template = template.replace(m[0], _this29.buildHTML(items, 0, withoutFor, [].concat(_toConsumableArray(locator), ["".concat(startIndex + ix, ":").concat(c)])));
|
|
4070
4077
|
}
|
|
4071
4078
|
});
|
|
4072
4079
|
var tagMatches = _toConsumableArray(template.matchAll(/(\sdata-event=["|']\w.+)["|']/g));
|
|
@@ -4075,7 +4082,7 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4075
4082
|
template = template.replace(m[0], "".concat(m[0], " data-id=").concat(startIndex + ix, " data-locator='").concat(locator.join(';'), "'"));
|
|
4076
4083
|
}
|
|
4077
4084
|
});
|
|
4078
|
-
var flatRow =
|
|
4085
|
+
var flatRow = _this29.flattenObject(row);
|
|
4079
4086
|
for (var key in flatRow) {
|
|
4080
4087
|
var rg = new RegExp("{".concat(key, "}"), 'gm');
|
|
4081
4088
|
template = template.replace(rg, flatRow[key] || '');
|
|
@@ -4200,15 +4207,15 @@ var WebsyResultList = /*#__PURE__*/function () {
|
|
|
4200
4207
|
}, {
|
|
4201
4208
|
key: "render",
|
|
4202
4209
|
value: function render() {
|
|
4203
|
-
var
|
|
4210
|
+
var _this30 = this;
|
|
4204
4211
|
if (this.options.entity) {
|
|
4205
4212
|
var url = this.options.entity;
|
|
4206
4213
|
if (this.options.sortField) {
|
|
4207
4214
|
url += (url.indexOf('?') === -1 ? '?' : '&') + "by=".concat(this.options.sortField, "&order=").concat(this.options.sortOrder || 'ASC');
|
|
4208
4215
|
}
|
|
4209
4216
|
this.apiService.get(url).then(function (results) {
|
|
4210
|
-
|
|
4211
|
-
|
|
4217
|
+
_this30.rows = results.rows;
|
|
4218
|
+
_this30.resize();
|
|
4212
4219
|
});
|
|
4213
4220
|
} else {
|
|
4214
4221
|
this.resize();
|
|
@@ -4287,12 +4294,12 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4287
4294
|
_createClass(WebsyRouter, [{
|
|
4288
4295
|
key: "addGroup",
|
|
4289
4296
|
value: function addGroup(group) {
|
|
4290
|
-
var
|
|
4297
|
+
var _this31 = this;
|
|
4291
4298
|
if (!this.groups[group]) {
|
|
4292
4299
|
var els = document.querySelectorAll(".".concat(this.options.viewClass, "[data-group=\"").concat(group, "\"]"));
|
|
4293
4300
|
if (els) {
|
|
4294
4301
|
this.getClosestParent(els[0], function (parent) {
|
|
4295
|
-
|
|
4302
|
+
_this31.groups[group] = {
|
|
4296
4303
|
activeView: '',
|
|
4297
4304
|
views: [],
|
|
4298
4305
|
parent: parent.getAttribute('data-view')
|
|
@@ -4356,7 +4363,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4356
4363
|
}, {
|
|
4357
4364
|
key: "removeUrlParams",
|
|
4358
4365
|
value: function removeUrlParams() {
|
|
4359
|
-
var
|
|
4366
|
+
var _this32 = this;
|
|
4360
4367
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4361
4368
|
var reloadView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4362
4369
|
var noHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -4364,7 +4371,7 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4364
4371
|
var path = '';
|
|
4365
4372
|
if (this.currentParams && this.currentParams.items) {
|
|
4366
4373
|
params.forEach(function (p) {
|
|
4367
|
-
delete
|
|
4374
|
+
delete _this32.currentParams.items[p];
|
|
4368
4375
|
});
|
|
4369
4376
|
path = this.buildUrlPath(this.currentParams.items);
|
|
4370
4377
|
}
|
|
@@ -4695,11 +4702,11 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4695
4702
|
}, {
|
|
4696
4703
|
key: "showComponents",
|
|
4697
4704
|
value: function showComponents(view) {
|
|
4698
|
-
var
|
|
4705
|
+
var _this33 = this;
|
|
4699
4706
|
if (this.options.views && this.options.views[view] && this.options.views[view].components) {
|
|
4700
4707
|
this.options.views[view].components.forEach(function (c) {
|
|
4701
4708
|
if (typeof c.instance === 'undefined') {
|
|
4702
|
-
|
|
4709
|
+
_this33.prepComponent(c.elementId, c.options);
|
|
4703
4710
|
c.instance = new c.Component(c.elementId, c.options);
|
|
4704
4711
|
} else if (c.instance.render) {
|
|
4705
4712
|
c.instance.render();
|
|
@@ -4719,42 +4726,42 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4719
4726
|
}, {
|
|
4720
4727
|
key: "initView",
|
|
4721
4728
|
value: function initView(view) {
|
|
4722
|
-
var
|
|
4729
|
+
var _this34 = this;
|
|
4723
4730
|
return new Promise(function (resolve, reject) {
|
|
4724
|
-
if (!
|
|
4725
|
-
|
|
4731
|
+
if (!_this34.options.views[view]) {
|
|
4732
|
+
_this34.options.views[view] = {
|
|
4726
4733
|
components: []
|
|
4727
4734
|
};
|
|
4728
4735
|
}
|
|
4729
|
-
if (
|
|
4736
|
+
if (_this34.options.views[view].ready === true) {
|
|
4730
4737
|
resolve();
|
|
4731
|
-
} else if (
|
|
4732
|
-
|
|
4738
|
+
} else if (_this34.options.views[view].template) {
|
|
4739
|
+
_this34.preloadView(view, function () {
|
|
4733
4740
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4734
|
-
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(
|
|
4741
|
+
var viewEl = document.querySelector("[data-view='".concat(view, "'].").concat(_this34.options.viewClass));
|
|
4735
4742
|
if (viewEl) {
|
|
4736
|
-
|
|
4737
|
-
template:
|
|
4743
|
+
_this34.options.views[view].templateInstance = new WebsyDesigns.Template(viewEl, {
|
|
4744
|
+
template: _this34.options.views[view].template,
|
|
4738
4745
|
data: data,
|
|
4739
4746
|
readyCallbackFn: function readyCallbackFn() {
|
|
4740
|
-
|
|
4747
|
+
_this34.options.views[view].ready = true;
|
|
4741
4748
|
resolve();
|
|
4742
4749
|
}
|
|
4743
4750
|
});
|
|
4744
4751
|
} else {
|
|
4745
4752
|
console.log("No view element found for '".concat(view, "' to render template"));
|
|
4746
|
-
|
|
4753
|
+
_this34.options.views[view].ready = true;
|
|
4747
4754
|
resolve();
|
|
4748
4755
|
}
|
|
4749
4756
|
});
|
|
4750
|
-
} else if (
|
|
4751
|
-
|
|
4757
|
+
} else if (_this34.options.views[view].ready !== true && _this34.options.views[view].load) {
|
|
4758
|
+
_this34.preloadView(view, function () {
|
|
4752
4759
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4753
|
-
|
|
4760
|
+
_this34.options.views[view].ready = true;
|
|
4754
4761
|
resolve();
|
|
4755
4762
|
});
|
|
4756
4763
|
} else {
|
|
4757
|
-
|
|
4764
|
+
_this34.options.views[view].ready = true;
|
|
4758
4765
|
resolve();
|
|
4759
4766
|
}
|
|
4760
4767
|
});
|
|
@@ -4762,35 +4769,35 @@ var WebsyRouter = /*#__PURE__*/function () {
|
|
|
4762
4769
|
}, {
|
|
4763
4770
|
key: "showView",
|
|
4764
4771
|
value: function showView(view, params, group) {
|
|
4765
|
-
var
|
|
4772
|
+
var _this35 = this;
|
|
4766
4773
|
if (view === '/' || view === '') {
|
|
4767
4774
|
view = this.options.defaultView || '';
|
|
4768
4775
|
}
|
|
4769
4776
|
this.initView(view).then(function () {
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
var children =
|
|
4777
|
+
_this35.activateItem(view, _this35.options.triggerClass);
|
|
4778
|
+
_this35.activateItem(view, _this35.options.viewClass);
|
|
4779
|
+
var children = _this35.getActiveViewsFromParent(view);
|
|
4773
4780
|
for (var c = 0; c < children.length; c++) {
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4781
|
+
_this35.activateItem(children[c].view, _this35.options.triggerClass);
|
|
4782
|
+
_this35.activateItem(children[c].view, _this35.options.viewClass);
|
|
4783
|
+
_this35.showComponents(children[c].view);
|
|
4777
4784
|
if (children[c].show) {
|
|
4778
4785
|
children[c].show.call(children[c]);
|
|
4779
4786
|
}
|
|
4780
|
-
|
|
4787
|
+
_this35.publish('show', [children[c].view, null, group]);
|
|
4781
4788
|
}
|
|
4782
|
-
if (
|
|
4783
|
-
|
|
4784
|
-
if (
|
|
4785
|
-
|
|
4789
|
+
if (_this35.previousView !== _this35.currentView || group !== 'main') {
|
|
4790
|
+
_this35.showComponents(view);
|
|
4791
|
+
if (_this35.options.views[view].show) {
|
|
4792
|
+
_this35.options.views[view].show.call(_this35.options.views[view]);
|
|
4786
4793
|
}
|
|
4787
|
-
|
|
4788
|
-
} else if (
|
|
4789
|
-
|
|
4790
|
-
if (
|
|
4791
|
-
|
|
4794
|
+
_this35.publish('show', [view, params, group]);
|
|
4795
|
+
} else if (_this35.previousView === _this35.currentView && _this35.previousParams.path !== _this35.currentParams.path) {
|
|
4796
|
+
_this35.showComponents(view);
|
|
4797
|
+
if (_this35.options.views[view].show) {
|
|
4798
|
+
_this35.options.views[view].show.call(_this35.options.views[view]);
|
|
4792
4799
|
}
|
|
4793
|
-
|
|
4800
|
+
_this35.publish('show', [view, params, group]);
|
|
4794
4801
|
}
|
|
4795
4802
|
});
|
|
4796
4803
|
}
|
|
@@ -5119,7 +5126,7 @@ var Switch = /*#__PURE__*/function () {
|
|
|
5119
5126
|
/* global WebsyDesigns */
|
|
5120
5127
|
var WebsyTemplate = /*#__PURE__*/function () {
|
|
5121
5128
|
function WebsyTemplate(elementId, options) {
|
|
5122
|
-
var
|
|
5129
|
+
var _this36 = this;
|
|
5123
5130
|
_classCallCheck(this, WebsyTemplate);
|
|
5124
5131
|
var DEFAULTS = {
|
|
5125
5132
|
listeners: {
|
|
@@ -5148,8 +5155,8 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5148
5155
|
}
|
|
5149
5156
|
if (_typeof(options.template) === 'object' && options.template.url) {
|
|
5150
5157
|
this.templateService.get(options.template.url).then(function (templateString) {
|
|
5151
|
-
|
|
5152
|
-
|
|
5158
|
+
_this36.options.template = templateString;
|
|
5159
|
+
_this36.render();
|
|
5153
5160
|
});
|
|
5154
5161
|
} else {
|
|
5155
5162
|
this.render();
|
|
@@ -5158,7 +5165,7 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5158
5165
|
_createClass(WebsyTemplate, [{
|
|
5159
5166
|
key: "buildHTML",
|
|
5160
5167
|
value: function buildHTML() {
|
|
5161
|
-
var
|
|
5168
|
+
var _this37 = this;
|
|
5162
5169
|
var html = "";
|
|
5163
5170
|
if (this.options.template) {
|
|
5164
5171
|
var template = this.options.template;
|
|
@@ -5207,14 +5214,14 @@ var WebsyTemplate = /*#__PURE__*/function () {
|
|
|
5207
5214
|
}
|
|
5208
5215
|
}
|
|
5209
5216
|
if (polarity === true) {
|
|
5210
|
-
if (typeof
|
|
5217
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] === parts[1]) {
|
|
5211
5218
|
// remove the <if> tags
|
|
5212
5219
|
removeAll = false;
|
|
5213
5220
|
} else if (parts[0] === parts[1]) {
|
|
5214
5221
|
removeAll = false;
|
|
5215
5222
|
}
|
|
5216
5223
|
} else if (polarity === false) {
|
|
5217
|
-
if (typeof
|
|
5224
|
+
if (typeof _this37.options.data[parts[0]] !== 'undefined' && _this37.options.data[parts[0]] !== parts[1]) {
|
|
5218
5225
|
// remove the <if> tags
|
|
5219
5226
|
removeAll = false;
|
|
5220
5227
|
}
|
|
@@ -5533,7 +5540,7 @@ var WebsyUtils = {
|
|
|
5533
5540
|
/* global WebsyDesigns */
|
|
5534
5541
|
var WebsyTable = /*#__PURE__*/function () {
|
|
5535
5542
|
function WebsyTable(elementId, options) {
|
|
5536
|
-
var
|
|
5543
|
+
var _this38 = this;
|
|
5537
5544
|
_classCallCheck(this, WebsyTable);
|
|
5538
5545
|
var DEFAULTS = {
|
|
5539
5546
|
pageSize: 20,
|
|
@@ -5566,8 +5573,8 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5566
5573
|
allowClear: false,
|
|
5567
5574
|
disableSearch: true,
|
|
5568
5575
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5569
|
-
if (
|
|
5570
|
-
|
|
5576
|
+
if (_this38.options.onChangePageSize) {
|
|
5577
|
+
_this38.options.onChangePageSize(selectedItem.value);
|
|
5571
5578
|
}
|
|
5572
5579
|
}
|
|
5573
5580
|
});
|
|
@@ -5591,20 +5598,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5591
5598
|
}, {
|
|
5592
5599
|
key: "appendRows",
|
|
5593
5600
|
value: function appendRows(data) {
|
|
5594
|
-
var
|
|
5601
|
+
var _this39 = this;
|
|
5595
5602
|
this._isRendered = false;
|
|
5596
5603
|
this.hideError();
|
|
5597
5604
|
var bodyHTML = '';
|
|
5598
5605
|
if (data) {
|
|
5599
5606
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5600
5607
|
return '<tr>' + r.map(function (c, i) {
|
|
5601
|
-
if (
|
|
5608
|
+
if (_this39.options.columns[i].show !== false) {
|
|
5602
5609
|
var style = '';
|
|
5603
5610
|
if (c.style) {
|
|
5604
5611
|
style += c.style;
|
|
5605
5612
|
}
|
|
5606
|
-
if (
|
|
5607
|
-
style += "width: ".concat(
|
|
5613
|
+
if (_this39.options.columns[i].width) {
|
|
5614
|
+
style += "width: ".concat(_this39.options.columns[i].width, "; ");
|
|
5608
5615
|
}
|
|
5609
5616
|
if (c.backgroundColor) {
|
|
5610
5617
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5615,20 +5622,20 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5615
5622
|
if (c.color) {
|
|
5616
5623
|
style += "color: ".concat(c.color, "; ");
|
|
5617
5624
|
}
|
|
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(
|
|
5625
|
+
if (_this39.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5626
|
+
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 ");
|
|
5627
|
+
} else if ((_this39.options.columns[i].showAsNavigatorLink === true || _this39.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5628
|
+
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
5629
|
} else {
|
|
5623
5630
|
var info = c.value;
|
|
5624
|
-
if (
|
|
5631
|
+
if (_this39.options.columns[i].showAsImage === true) {
|
|
5625
5632
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5626
5633
|
}
|
|
5627
5634
|
var html = "\n <td \n ";
|
|
5628
|
-
if (!
|
|
5635
|
+
if (!_this39.options.columns[i].showAsImage && c.value && c.value.indexOf && c.value.indexOf('<svg') === -1 && c.value.indexOf('<img') === -1) {
|
|
5629
5636
|
html += "\n data-info='".concat(info, "'\n ");
|
|
5630
5637
|
}
|
|
5631
|
-
html += "\n data-row-index='".concat(
|
|
5638
|
+
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
5639
|
return html;
|
|
5633
5640
|
}
|
|
5634
5641
|
}
|
|
@@ -5789,7 +5796,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5789
5796
|
}, {
|
|
5790
5797
|
key: "render",
|
|
5791
5798
|
value: function render(data) {
|
|
5792
|
-
var
|
|
5799
|
+
var _this40 = this;
|
|
5793
5800
|
this._isRendered = false;
|
|
5794
5801
|
if (!this.options.columns) {
|
|
5795
5802
|
return;
|
|
@@ -5817,7 +5824,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5817
5824
|
if (c.width) {
|
|
5818
5825
|
style += "width: ".concat(c.width || 'auto', ";");
|
|
5819
5826
|
}
|
|
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 ?
|
|
5827
|
+
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
5828
|
}
|
|
5822
5829
|
}).join('') + '</tr>';
|
|
5823
5830
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -5835,7 +5842,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5835
5842
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
5836
5843
|
if (pagingEl) {
|
|
5837
5844
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
5838
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
5845
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this40.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
5839
5846
|
});
|
|
5840
5847
|
var startIndex = 0;
|
|
5841
5848
|
if (this.options.pageCount > 8) {
|
|
@@ -5891,7 +5898,7 @@ var WebsyTable = /*#__PURE__*/function () {
|
|
|
5891
5898
|
/* global WebsyDesigns */
|
|
5892
5899
|
var WebsyTable2 = /*#__PURE__*/function () {
|
|
5893
5900
|
function WebsyTable2(elementId, options) {
|
|
5894
|
-
var
|
|
5901
|
+
var _this41 = this;
|
|
5895
5902
|
_classCallCheck(this, WebsyTable2);
|
|
5896
5903
|
var DEFAULTS = {
|
|
5897
5904
|
pageSize: 20,
|
|
@@ -5926,8 +5933,8 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5926
5933
|
allowClear: false,
|
|
5927
5934
|
disableSearch: true,
|
|
5928
5935
|
onItemSelected: function onItemSelected(selectedItem) {
|
|
5929
|
-
if (
|
|
5930
|
-
|
|
5936
|
+
if (_this41.options.onChangePageSize) {
|
|
5937
|
+
_this41.options.onChangePageSize(selectedItem.value);
|
|
5931
5938
|
}
|
|
5932
5939
|
}
|
|
5933
5940
|
});
|
|
@@ -5949,20 +5956,20 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5949
5956
|
_createClass(WebsyTable2, [{
|
|
5950
5957
|
key: "appendRows",
|
|
5951
5958
|
value: function appendRows(data) {
|
|
5952
|
-
var
|
|
5959
|
+
var _this42 = this;
|
|
5953
5960
|
this.hideError();
|
|
5954
5961
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
5955
5962
|
var bodyHTML = '';
|
|
5956
5963
|
if (data) {
|
|
5957
5964
|
bodyHTML += data.map(function (r, rowIndex) {
|
|
5958
5965
|
return '<tr>' + r.map(function (c, i) {
|
|
5959
|
-
if (
|
|
5960
|
-
var style = "height: ".concat(
|
|
5966
|
+
if (_this42.options.columns[i].show !== false) {
|
|
5967
|
+
var style = "height: ".concat(_this42.options.cellSize, "px; line-height: ").concat(_this42.options.cellSize, "px;");
|
|
5961
5968
|
if (c.style) {
|
|
5962
5969
|
style += c.style;
|
|
5963
5970
|
}
|
|
5964
|
-
if (
|
|
5965
|
-
style += "width: ".concat(
|
|
5971
|
+
if (_this42.options.columns[i].width) {
|
|
5972
|
+
style += "width: ".concat(_this42.options.columns[i].width, "; ");
|
|
5966
5973
|
}
|
|
5967
5974
|
if (c.backgroundColor) {
|
|
5968
5975
|
style += "background-color: ".concat(c.backgroundColor, "; ");
|
|
@@ -5973,16 +5980,16 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
5973
5980
|
if (c.color) {
|
|
5974
5981
|
style += "color: ".concat(c.color, "; ");
|
|
5975
5982
|
}
|
|
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(
|
|
5983
|
+
if (_this42.options.columns[i].showAsLink === true && c.value.trim() !== '') {
|
|
5984
|
+
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 ");
|
|
5985
|
+
} else if ((_this42.options.columns[i].showAsNavigatorLink === true || _this42.options.columns[i].showAsRouterLink === true) && c.value.trim() !== '') {
|
|
5986
|
+
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
5987
|
} else {
|
|
5981
5988
|
var info = c.value;
|
|
5982
|
-
if (
|
|
5989
|
+
if (_this42.options.columns[i].showAsImage === true) {
|
|
5983
5990
|
c.value = "\n <img src='".concat(c.value, "'>\n ");
|
|
5984
5991
|
}
|
|
5985
|
-
return "\n <td \n data-info='".concat(info, "' \n data-row-index='").concat(
|
|
5992
|
+
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
5993
|
}
|
|
5987
5994
|
}
|
|
5988
5995
|
}).join('') + '</tr>';
|
|
@@ -6216,7 +6223,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6216
6223
|
}, {
|
|
6217
6224
|
key: "render",
|
|
6218
6225
|
value: function render(data) {
|
|
6219
|
-
var
|
|
6226
|
+
var _this43 = this;
|
|
6220
6227
|
if (!this.options.columns) {
|
|
6221
6228
|
return;
|
|
6222
6229
|
}
|
|
@@ -6244,7 +6251,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6244
6251
|
if (c.width) {
|
|
6245
6252
|
style += "width: ".concat(c.width || 'auto', "; ");
|
|
6246
6253
|
}
|
|
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 ?
|
|
6254
|
+
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
6255
|
}
|
|
6249
6256
|
}).join('') + '</tr>';
|
|
6250
6257
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
@@ -6254,7 +6261,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6254
6261
|
var dropdownHTML = "";
|
|
6255
6262
|
this.options.columns.forEach(function (c, i) {
|
|
6256
6263
|
if (c.searchable && c.searchField) {
|
|
6257
|
-
dropdownHTML += "\n <div id=\"".concat(
|
|
6264
|
+
dropdownHTML += "\n <div id=\"".concat(_this43.elementId, "_columnSearch_").concat(i, "\" class=\"websy-modal-dropdown\"></div>\n ");
|
|
6258
6265
|
}
|
|
6259
6266
|
});
|
|
6260
6267
|
dropdownEl.innerHTML = dropdownHTML;
|
|
@@ -6274,7 +6281,7 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6274
6281
|
var pagingEl = document.getElementById("".concat(this.elementId, "_pageList"));
|
|
6275
6282
|
if (pagingEl) {
|
|
6276
6283
|
var pages = new Array(this.options.pageCount).fill('').map(function (item, index) {
|
|
6277
|
-
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(
|
|
6284
|
+
return "<li data-page=\"".concat(index, "\" class=\"websy-page-num ").concat(_this43.options.pageNum === index ? 'active' : '', "\">").concat(index + 1, "</li>");
|
|
6278
6285
|
});
|
|
6279
6286
|
var startIndex = 0;
|
|
6280
6287
|
if (this.options.pageCount > 8) {
|
|
@@ -6351,17 +6358,17 @@ var WebsyTable2 = /*#__PURE__*/function () {
|
|
|
6351
6358
|
}, {
|
|
6352
6359
|
key: "getColumnParameters",
|
|
6353
6360
|
value: function getColumnParameters(values) {
|
|
6354
|
-
var
|
|
6361
|
+
var _this44 = this;
|
|
6355
6362
|
var tableEl = document.getElementById("".concat(this.elementId, "_table"));
|
|
6356
6363
|
tableEl.style.tableLayout = 'auto';
|
|
6357
6364
|
tableEl.style.width = 'auto';
|
|
6358
6365
|
var headEl = document.getElementById("".concat(this.elementId, "_head"));
|
|
6359
6366
|
var bodyEl = document.getElementById("".concat(this.elementId, "_body"));
|
|
6360
6367
|
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 ?
|
|
6368
|
+
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
6369
|
}).join('') + '</tr>';
|
|
6363
6370
|
bodyEl.innerHTML = '<tr style="visibility: hidden;">' + values.map(function (c) {
|
|
6364
|
-
return "\n <td \n style='height: ".concat(
|
|
6371
|
+
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
6372
|
}).join('') + '</tr>';
|
|
6366
6373
|
// get height of the first data cell
|
|
6367
6374
|
var cells = bodyEl.querySelectorAll("tr:first-of-type td");
|
|
@@ -6525,7 +6532,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6525
6532
|
}, {
|
|
6526
6533
|
key: "buildBodyHtml",
|
|
6527
6534
|
value: function buildBodyHtml() {
|
|
6528
|
-
var
|
|
6535
|
+
var _this45 = this;
|
|
6529
6536
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6530
6537
|
var useWidths = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6531
6538
|
if (!this.options.columns) {
|
|
@@ -6550,7 +6557,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6550
6557
|
row.forEach(function (cell, cellIndex) {
|
|
6551
6558
|
var sizeIndex = cell.level || cellIndex;
|
|
6552
6559
|
var colIndex = cell.index || cellIndex;
|
|
6553
|
-
if (typeof sizingColumns[sizeIndex] === 'undefined' ||
|
|
6560
|
+
if (typeof sizingColumns[sizeIndex] === 'undefined' || _this45.options.columns[_this45.options.columns.length - 1][colIndex].show === false) {
|
|
6554
6561
|
return; // need to revisit this logic
|
|
6555
6562
|
}
|
|
6556
6563
|
|
|
@@ -6577,7 +6584,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6577
6584
|
style += "color: ".concat(cell.color, "; ");
|
|
6578
6585
|
}
|
|
6579
6586
|
// console.log('rowspan', cell.rowspan)
|
|
6580
|
-
bodyHtml += "<td \n class='websy-table-cell ".concat(sizeIndex <
|
|
6587
|
+
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
6588
|
if (!sizingColumns[sizeIndex].showAsImage && cell.value.indexOf('<svg') === -1 && cell.value.indexOf('<img') === -1) {
|
|
6582
6589
|
bodyHtml += "\n data-info='".concat(cell.value.replace ? cell.value.replace(/'/g, '`') : cell.value, "'\n ");
|
|
6583
6590
|
}
|
|
@@ -6590,10 +6597,10 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6590
6597
|
// }
|
|
6591
6598
|
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
6599
|
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(
|
|
6600
|
+
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
6601
|
}
|
|
6595
6602
|
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(
|
|
6603
|
+
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
6604
|
}
|
|
6598
6605
|
if (sizingColumns[sizeIndex].showAsLink === true && cell.value.trim() !== '') {
|
|
6599
6606
|
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 +6621,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6614
6621
|
}, {
|
|
6615
6622
|
key: "buildHeaderHtml",
|
|
6616
6623
|
value: function buildHeaderHtml() {
|
|
6617
|
-
var
|
|
6624
|
+
var _this46 = this;
|
|
6618
6625
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6619
6626
|
if (!this.options.columns) {
|
|
6620
6627
|
return '';
|
|
@@ -6635,7 +6642,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6635
6642
|
// // if we're calculating the size we only want to render the last row of column headers
|
|
6636
6643
|
// return
|
|
6637
6644
|
// }
|
|
6638
|
-
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !==
|
|
6645
|
+
headerHtml += "<tr class=\"websy-table-row websy-table-header-row ".concat(rowIndex !== _this46.options.columns.length - 1 ? 'websy-table-parent-header' : '', "\">");
|
|
6639
6646
|
row.filter(function (c) {
|
|
6640
6647
|
return c.show !== false;
|
|
6641
6648
|
}).forEach(function (col, colIndex) {
|
|
@@ -6655,24 +6662,24 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6655
6662
|
if (col.style) {
|
|
6656
6663
|
style += col.style;
|
|
6657
6664
|
}
|
|
6658
|
-
headerHtml += "<td \n class='websy-table-cell ".concat(colIndex <
|
|
6665
|
+
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
6666
|
// if (useWidths === true && rowIndex === this.options.columns.length - 1) {
|
|
6660
6667
|
// headerHtml += `
|
|
6661
6668
|
// style='width: ${col.width || col.actualWidth}px'
|
|
6662
6669
|
// width='${col.width || col.actualWidth}'
|
|
6663
6670
|
// `
|
|
6664
6671
|
// }
|
|
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 ?
|
|
6672
|
+
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
6673
|
});
|
|
6667
6674
|
headerHtml += "</tr>";
|
|
6668
6675
|
});
|
|
6669
6676
|
var dropdownEl = document.getElementById("".concat(this.elementId, "_dropdownContainer"));
|
|
6670
6677
|
this.options.columns[this.options.columns.length - 1].forEach(function (c, i) {
|
|
6671
6678
|
if (c.searchable && c.isExternalSearch === true) {
|
|
6672
|
-
var testEl = document.getElementById("".concat(
|
|
6679
|
+
var testEl = document.getElementById("".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i));
|
|
6673
6680
|
if (!testEl) {
|
|
6674
6681
|
var newE = document.createElement('div');
|
|
6675
|
-
newE.id = "".concat(
|
|
6682
|
+
newE.id = "".concat(_this46.elementId, "_columnSearch_").concat(c.dimId || i);
|
|
6676
6683
|
newE.className = 'websy-modal-dropdown';
|
|
6677
6684
|
dropdownEl.appendChild(newE);
|
|
6678
6685
|
}
|
|
@@ -6695,7 +6702,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6695
6702
|
}, {
|
|
6696
6703
|
key: "buildTotalHtml",
|
|
6697
6704
|
value: function buildTotalHtml() {
|
|
6698
|
-
var
|
|
6705
|
+
var _this47 = this;
|
|
6699
6706
|
var useWidths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6700
6707
|
if (!this.options.totals) {
|
|
6701
6708
|
return '';
|
|
@@ -6711,7 +6718,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6711
6718
|
|
|
6712
6719
|
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
6720
|
if (useWidths === true) {
|
|
6714
|
-
totalHtml += "\n style='width: ".concat(
|
|
6721
|
+
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
6722
|
}
|
|
6716
6723
|
totalHtml += " \n >\n ".concat(col.value, "\n </td>");
|
|
6717
6724
|
});
|
|
@@ -6721,7 +6728,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6721
6728
|
}, {
|
|
6722
6729
|
key: "calculateSizes",
|
|
6723
6730
|
value: function calculateSizes() {
|
|
6724
|
-
var
|
|
6731
|
+
var _this48 = this;
|
|
6725
6732
|
var sample = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
6726
6733
|
var totalRowCount = arguments.length > 1 ? arguments[1] : undefined;
|
|
6727
6734
|
var totalColumnCount = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -6765,7 +6772,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6765
6772
|
rows.forEach(function (row, rowIndex) {
|
|
6766
6773
|
Array.from(row.children).forEach(function (col, colIndex) {
|
|
6767
6774
|
var colSize = col.getBoundingClientRect();
|
|
6768
|
-
|
|
6775
|
+
_this48.sizes.cellHeight = colSize.height;
|
|
6769
6776
|
if (columnsForSizing[colIndex]) {
|
|
6770
6777
|
if (!columnsForSizing[colIndex].actualWidth) {
|
|
6771
6778
|
columnsForSizing[colIndex].potentialWidth = 0;
|
|
@@ -6777,7 +6784,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6777
6784
|
// columnsForSizing[colIndex].actualWidth = columnsForSizing[colIndex].width
|
|
6778
6785
|
// }
|
|
6779
6786
|
columnsForSizing[colIndex].cellHeight = colSize.height;
|
|
6780
|
-
if (colIndex >=
|
|
6787
|
+
if (colIndex >= _this48.pinnedColumns) {
|
|
6781
6788
|
firstNonPinnedColumnWidth = columnsForSizing[colIndex].actualWidth;
|
|
6782
6789
|
}
|
|
6783
6790
|
}
|
|
@@ -6792,7 +6799,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6792
6799
|
return a + (b.width || b.actualWidth);
|
|
6793
6800
|
}, 0);
|
|
6794
6801
|
this.sizes.totalNonPinnedWidth = columnsForSizing.filter(function (c, i) {
|
|
6795
|
-
return i >=
|
|
6802
|
+
return i >= _this48.pinnedColumns;
|
|
6796
6803
|
}).reduce(function (a, b) {
|
|
6797
6804
|
return a + (b.width || b.actualWidth);
|
|
6798
6805
|
}, 0);
|
|
@@ -6803,7 +6810,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6803
6810
|
var availableSpace = this.sizes.table.width - this.sizes.totalWidth;
|
|
6804
6811
|
columnsForSizing.forEach(function (c) {
|
|
6805
6812
|
c.shouldGrow = true;
|
|
6806
|
-
if (
|
|
6813
|
+
if (_this48.options.autoFitColumns === false) {
|
|
6807
6814
|
c.shouldGrow = false;
|
|
6808
6815
|
if (c.potentialWidth > c.actualWidth) {
|
|
6809
6816
|
c.shouldGrow = true;
|
|
@@ -6822,7 +6829,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6822
6829
|
// if (!c.width) {
|
|
6823
6830
|
// if (c.actualWidth < equalWidth) {
|
|
6824
6831
|
// adjust the width
|
|
6825
|
-
if (
|
|
6832
|
+
if (_this48.options.autoFitColumns === true) {
|
|
6826
6833
|
if (c.width) {
|
|
6827
6834
|
c.width += equalWidth;
|
|
6828
6835
|
}
|
|
@@ -6846,9 +6853,9 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6846
6853
|
}
|
|
6847
6854
|
// }
|
|
6848
6855
|
// }
|
|
6849
|
-
|
|
6850
|
-
if (i >
|
|
6851
|
-
|
|
6856
|
+
_this48.sizes.totalWidth += c.width || c.actualWidth;
|
|
6857
|
+
if (i > _this48.pinnedColumns) {
|
|
6858
|
+
_this48.sizes.totalNonPinnedWidth += c.width || c.actualWidth;
|
|
6852
6859
|
}
|
|
6853
6860
|
// equalWidth = (outerSize.width - this.sizes.totalWidth) / (this.options.columns[this.options.columns.length - 1].length - (i + 1))
|
|
6854
6861
|
});
|
|
@@ -6907,7 +6914,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6907
6914
|
}, {
|
|
6908
6915
|
key: "createSample",
|
|
6909
6916
|
value: function createSample(data) {
|
|
6910
|
-
var
|
|
6917
|
+
var _this49 = this;
|
|
6911
6918
|
var output = [];
|
|
6912
6919
|
this.options.columns[this.options.columns.length - 1].forEach(function (col, colIndex) {
|
|
6913
6920
|
if (col.maxLength) {
|
|
@@ -6917,7 +6924,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
6917
6924
|
} else if (data) {
|
|
6918
6925
|
var longest = '';
|
|
6919
6926
|
for (var i = 0; i < Math.min(data.length, 1000); i++) {
|
|
6920
|
-
if (data[i].length ===
|
|
6927
|
+
if (data[i].length === _this49.options.columns[_this49.options.columns.length - 1].length) {
|
|
6921
6928
|
if (longest.length < data[i][colIndex].value.length) {
|
|
6922
6929
|
longest = data[i][colIndex].value;
|
|
6923
6930
|
}
|
|
@@ -7189,7 +7196,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7189
7196
|
}, {
|
|
7190
7197
|
key: "perpetualScroll",
|
|
7191
7198
|
value: function perpetualScroll() {
|
|
7192
|
-
var
|
|
7199
|
+
var _this50 = this;
|
|
7193
7200
|
// if the currentTouchtime and touchEndTime are more than 300ms apart then we abort the perpetual scroll
|
|
7194
7201
|
if (this.touchEndTime - this.currentTouchtime > 300) {
|
|
7195
7202
|
return;
|
|
@@ -7208,17 +7215,17 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7208
7215
|
var direction = touchDistance > 0 ? -1 : 1;
|
|
7209
7216
|
var _loop2 = function _loop2(i) {
|
|
7210
7217
|
setTimeout(function () {
|
|
7211
|
-
var delta =
|
|
7218
|
+
var delta = _this50.mouseYStart - _this50.currentClientY + _this50.sizes.cellHeight * (i + 1) * direction;
|
|
7212
7219
|
delta = Math.min(10, delta);
|
|
7213
7220
|
delta = Math.max(-10, delta);
|
|
7214
7221
|
// only run this if isPerpetual === true
|
|
7215
7222
|
// this value is reset to false on touchStart
|
|
7216
|
-
if (
|
|
7223
|
+
if (_this50.isPerpetual === true) {
|
|
7217
7224
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 250)))
|
|
7218
7225
|
// this.$scope.scrollTop += (delta / (this.$scope.layout.qHyperCube.qSize.qcy / this.$scope.rowsToLoad / (this.$scope.totalSpaceAvailable / 200)))
|
|
7219
|
-
|
|
7220
|
-
if (
|
|
7221
|
-
clearTimeout(
|
|
7226
|
+
_this50.scrollY(Math.max(-5, Math.min(5, delta)));
|
|
7227
|
+
if (_this50.scrollTimeout) {
|
|
7228
|
+
clearTimeout(_this50.scrollTimeout);
|
|
7222
7229
|
}
|
|
7223
7230
|
}
|
|
7224
7231
|
}, 1000 / fps * i);
|
|
@@ -7486,7 +7493,7 @@ var WebsyTable3 = /*#__PURE__*/function () {
|
|
|
7486
7493
|
/* global d3 include WebsyDesigns */
|
|
7487
7494
|
var WebsyChart = /*#__PURE__*/function () {
|
|
7488
7495
|
function WebsyChart(elementId, options) {
|
|
7489
|
-
var
|
|
7496
|
+
var _this51 = this;
|
|
7490
7497
|
_classCallCheck(this, WebsyChart);
|
|
7491
7498
|
var DEFAULTS = {
|
|
7492
7499
|
margin: {
|
|
@@ -7545,7 +7552,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7545
7552
|
this.invertOverride = function (input, input2) {
|
|
7546
7553
|
var forBrush = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7547
7554
|
var xAxis = 'bottom';
|
|
7548
|
-
if (
|
|
7555
|
+
if (_this51.options.orientation === 'horizontal') {
|
|
7549
7556
|
xAxis = 'left';
|
|
7550
7557
|
}
|
|
7551
7558
|
if (forBrush === true) {
|
|
@@ -7553,12 +7560,12 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7553
7560
|
}
|
|
7554
7561
|
xAxis += 'Axis';
|
|
7555
7562
|
var output;
|
|
7556
|
-
var width =
|
|
7563
|
+
var width = _this51.options.data[xAxis.replace('Brush', '').replace('Axis', '')].bandWidth;
|
|
7557
7564
|
// if (this.customBottomRange) {
|
|
7558
|
-
for (var index = 0; index <
|
|
7559
|
-
if (input >
|
|
7560
|
-
if (
|
|
7561
|
-
if (input <
|
|
7565
|
+
for (var index = 0; index < _this51.customBottomRange.length; index++) {
|
|
7566
|
+
if (input > _this51.customBottomRange[index]) {
|
|
7567
|
+
if (_this51.customBottomRange[index + 1]) {
|
|
7568
|
+
if (input < _this51.customBottomRange[index + 1]) {
|
|
7562
7569
|
output = index;
|
|
7563
7570
|
break;
|
|
7564
7571
|
}
|
|
@@ -7723,9 +7730,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7723
7730
|
}, {
|
|
7724
7731
|
key: "handleEventMouseMove",
|
|
7725
7732
|
value: function handleEventMouseMove(event, d) {
|
|
7726
|
-
var
|
|
7733
|
+
var _this52 = this;
|
|
7727
7734
|
var bisectDate = d3.bisector(function (d) {
|
|
7728
|
-
return
|
|
7735
|
+
return _this52.parseX(d.x.value);
|
|
7729
7736
|
}).left;
|
|
7730
7737
|
if (this.options.showTrackingLine === true && d3.pointer(event)) {
|
|
7731
7738
|
var xAxis = 'bottomAxis';
|
|
@@ -7758,9 +7765,9 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7758
7765
|
xLabel = _toConsumableArray(this[xAxis].domain().reverse())[x0];
|
|
7759
7766
|
}
|
|
7760
7767
|
this.options.data.series.forEach(function (s) {
|
|
7761
|
-
if (
|
|
7768
|
+
if (_this52.options.data[xData].scale !== 'Time') {
|
|
7762
7769
|
// if (this.customBottomRange && this.customBottomRange.length > 0) {
|
|
7763
|
-
xPoint =
|
|
7770
|
+
xPoint = _this52.customBottomRange[x0] + (_this52.customBottomRange[x0 + 1] - _this52.customBottomRange[x0]) / 2;
|
|
7764
7771
|
// }
|
|
7765
7772
|
// else {
|
|
7766
7773
|
// xPoint = this[xAxis](this.parseX(xLabel))
|
|
@@ -7780,41 +7787,41 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7780
7787
|
var index = bisectDate(s.data, x0, 1);
|
|
7781
7788
|
var pointA = s.data[index - 1];
|
|
7782
7789
|
var pointB = s.data[index];
|
|
7783
|
-
if (
|
|
7790
|
+
if (_this52.options.orientation === 'horizontal') {
|
|
7784
7791
|
pointA = _toConsumableArray(s.data).reverse()[index - 1];
|
|
7785
7792
|
pointB = _toConsumableArray(s.data).reverse()[index];
|
|
7786
7793
|
}
|
|
7787
7794
|
if (pointA && !pointB) {
|
|
7788
|
-
xPoint =
|
|
7795
|
+
xPoint = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7789
7796
|
tooltipTitle = pointA.x.value;
|
|
7790
7797
|
if (!pointA.y.color) {
|
|
7791
7798
|
pointA.y.color = s.color;
|
|
7792
7799
|
}
|
|
7793
7800
|
tooltipData.push(pointA);
|
|
7794
7801
|
if (typeof pointA.x.value.getTime !== 'undefined') {
|
|
7795
|
-
tooltipTitle = d3.timeFormat(
|
|
7802
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointA.x.value);
|
|
7796
7803
|
}
|
|
7797
7804
|
}
|
|
7798
7805
|
if (pointB && !pointA) {
|
|
7799
|
-
xPoint =
|
|
7806
|
+
xPoint = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7800
7807
|
tooltipTitle = pointB.x.value;
|
|
7801
7808
|
if (!pointB.y.color) {
|
|
7802
7809
|
pointB.y.color = s.color;
|
|
7803
7810
|
}
|
|
7804
7811
|
tooltipData.push(pointB);
|
|
7805
7812
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7806
|
-
tooltipTitle = d3.timeFormat(
|
|
7813
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7807
7814
|
}
|
|
7808
7815
|
}
|
|
7809
7816
|
if (pointA && pointB) {
|
|
7810
|
-
var d0 =
|
|
7811
|
-
var d1 =
|
|
7817
|
+
var d0 = _this52[xAxis](_this52.parseX(pointA.x.value));
|
|
7818
|
+
var d1 = _this52[xAxis](_this52.parseX(pointB.x.value));
|
|
7812
7819
|
var mid = Math.abs(d0 - d1) / 2;
|
|
7813
7820
|
if (d3.pointer(event)[0] - d0 >= mid) {
|
|
7814
7821
|
xPoint = d1;
|
|
7815
7822
|
tooltipTitle = pointB.x.value;
|
|
7816
7823
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7817
|
-
tooltipTitle = d3.timeFormat(
|
|
7824
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7818
7825
|
}
|
|
7819
7826
|
if (!pointB.y.color) {
|
|
7820
7827
|
pointB.y.color = s.color;
|
|
@@ -7824,7 +7831,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7824
7831
|
xPoint = d0;
|
|
7825
7832
|
tooltipTitle = pointA.x.value;
|
|
7826
7833
|
if (typeof pointB.x.value.getTime !== 'undefined') {
|
|
7827
|
-
tooltipTitle = d3.timeFormat(
|
|
7834
|
+
tooltipTitle = d3.timeFormat(_this52.options.dateFormat || _this52.options.calculatedTimeFormatPattern)(pointB.x.value);
|
|
7828
7835
|
}
|
|
7829
7836
|
if (!pointA.y.color) {
|
|
7830
7837
|
pointA.y.color = s.color;
|
|
@@ -7950,7 +7957,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
7950
7957
|
}, {
|
|
7951
7958
|
key: "render",
|
|
7952
7959
|
value: function render(options) {
|
|
7953
|
-
var
|
|
7960
|
+
var _this53 = this;
|
|
7954
7961
|
/* global d3 options WebsyUtils */
|
|
7955
7962
|
this._isRendered = false;
|
|
7956
7963
|
if (typeof options !== 'undefined') {
|
|
@@ -8019,7 +8026,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8019
8026
|
this.options.data.series.map(function (s, i) {
|
|
8020
8027
|
return {
|
|
8021
8028
|
value: s.label || s.key,
|
|
8022
|
-
color: s.color ||
|
|
8029
|
+
color: s.color || _this53.options.colors[i % _this53.options.colors.length]
|
|
8023
8030
|
};
|
|
8024
8031
|
});
|
|
8025
8032
|
}
|
|
@@ -8376,25 +8383,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8376
8383
|
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
8384
|
var acc = 0;
|
|
8378
8385
|
this["custom".concat(customRangeSide, "Range")] = [0].concat(_toConsumableArray(this.options.data[customRangeSideLC].data.map(function (d, index, arr) {
|
|
8379
|
-
var adjustment =
|
|
8386
|
+
var adjustment = _this53.bandPadding * index + _this53.bandPadding;
|
|
8380
8387
|
// if (this.options.data.bottom.padding) {
|
|
8381
8388
|
// adjustment = (this.widthForCalc * this.options.data.bottom.padding) / (arr.length * 2)
|
|
8382
8389
|
// }
|
|
8383
|
-
var start =
|
|
8390
|
+
var start = _this53.widthForCalc / noOfPoints * acc;
|
|
8384
8391
|
for (var i = 0; i < (d.valueCount || 1); i++) {
|
|
8385
8392
|
var pos = i * proposedBandWidth;
|
|
8386
|
-
|
|
8393
|
+
_this53["custom".concat(customRangeSide, "DetailRange")].push(start + adjustment + pos);
|
|
8387
8394
|
}
|
|
8388
|
-
acc +=
|
|
8389
|
-
var end =
|
|
8395
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8396
|
+
var end = _this53.widthForCalc / noOfPoints * acc;
|
|
8390
8397
|
// this.customBottomBrushRange.push((end + adjustment) * (this.plotWidth / this.widthForCalc))
|
|
8391
8398
|
return end + adjustment;
|
|
8392
8399
|
})));
|
|
8393
8400
|
acc = 0;
|
|
8394
8401
|
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 (
|
|
8402
|
+
var adjustment = _this53.brushBandPadding * index + _this53.brushBandPadding;
|
|
8403
|
+
acc += _this53.options.grouping !== 'stacked' && _this53.options.allowUnevenBands === true ? d.valueCount || 1 : 1;
|
|
8404
|
+
return (_this53.options.orientation === 'vertical' ? _this53.plotWidth : _this53.plotHeight) / noOfPoints * acc;
|
|
8398
8405
|
})));
|
|
8399
8406
|
}
|
|
8400
8407
|
// }
|
|
@@ -8567,7 +8574,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8567
8574
|
this.bAxisFunc = d3.axisBottom(this.bottomAxis).ticks(tickDefinition);
|
|
8568
8575
|
if (this.options.data.bottom.formatter) {
|
|
8569
8576
|
this.bAxisFunc.tickFormat(function (d) {
|
|
8570
|
-
return
|
|
8577
|
+
return _this53.options.data.bottom.formatter(d);
|
|
8571
8578
|
});
|
|
8572
8579
|
}
|
|
8573
8580
|
this.bottomAxisLayer.call(this.bAxisFunc);
|
|
@@ -8577,7 +8584,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8577
8584
|
}
|
|
8578
8585
|
if (this.customBottomRange.length > 0) {
|
|
8579
8586
|
this.bottomAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8580
|
-
return "translate(".concat(
|
|
8587
|
+
return "translate(".concat(_this53.customBottomRange[i] + (_this53.customBottomRange[i + 1] - _this53.customBottomRange[i]) / 2, ", 0)");
|
|
8581
8588
|
});
|
|
8582
8589
|
}
|
|
8583
8590
|
}
|
|
@@ -8596,14 +8603,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8596
8603
|
}
|
|
8597
8604
|
if (this.options.margin.axisLeft > 0) {
|
|
8598
8605
|
this.leftAxisLayer.call(d3.axisLeft(this.leftAxis).ticks(this.options.data.left.ticks || 5).tickFormat(function (d) {
|
|
8599
|
-
if (
|
|
8600
|
-
d =
|
|
8606
|
+
if (_this53.options.data.left.formatter) {
|
|
8607
|
+
d = _this53.options.data.left.formatter(d);
|
|
8601
8608
|
}
|
|
8602
8609
|
return d;
|
|
8603
8610
|
}));
|
|
8604
8611
|
if (this.customLeftRange.length > 0) {
|
|
8605
8612
|
this.leftAxisLayer.selectAll('g').attr('transform', function (d, i) {
|
|
8606
|
-
return "translate(0, ".concat(
|
|
8613
|
+
return "translate(0, ".concat(_this53.customLeftRange[i] + (_this53.customLeftRange[i + 1] - _this53.customLeftRange[i]) / 2, ")");
|
|
8607
8614
|
});
|
|
8608
8615
|
}
|
|
8609
8616
|
}
|
|
@@ -8631,8 +8638,8 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8631
8638
|
}
|
|
8632
8639
|
if (this.options.margin.axisRight > 0 && (this.options.data.right.min !== 0 || this.options.data.right.max !== 0)) {
|
|
8633
8640
|
this.rightAxisLayer.call(d3.axisRight(this.rightAxis).ticks(this.options.data.right.ticks || 5).tickFormat(function (d) {
|
|
8634
|
-
if (
|
|
8635
|
-
d =
|
|
8641
|
+
if (_this53.options.data.right.formatter) {
|
|
8642
|
+
d = _this53.options.data.right.formatter(d);
|
|
8636
8643
|
}
|
|
8637
8644
|
return d;
|
|
8638
8645
|
}));
|
|
@@ -8672,25 +8679,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8672
8679
|
}, {
|
|
8673
8680
|
key: "renderComponents",
|
|
8674
8681
|
value: function renderComponents() {
|
|
8675
|
-
var
|
|
8682
|
+
var _this54 = this;
|
|
8676
8683
|
// Draw the series data
|
|
8677
8684
|
this.renderedKeys = {};
|
|
8678
8685
|
this.options.data.series.forEach(function (series, index) {
|
|
8679
8686
|
if (!series.key) {
|
|
8680
|
-
series.key =
|
|
8687
|
+
series.key = _this54.createIdentity();
|
|
8681
8688
|
}
|
|
8682
8689
|
if (!series.color) {
|
|
8683
|
-
series.color =
|
|
8690
|
+
series.color = _this54.options.colors[index % _this54.options.colors.length];
|
|
8684
8691
|
}
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8692
|
+
_this54["render".concat(series.type || 'bar')](series, index);
|
|
8693
|
+
_this54.renderLabels(series, index);
|
|
8694
|
+
_this54.renderedKeys[series.key] = series.type;
|
|
8688
8695
|
});
|
|
8689
8696
|
this.refLineLayer.selectAll('.reference-line').remove();
|
|
8690
8697
|
this.refLineLayer.selectAll('.reference-line-label').remove();
|
|
8691
8698
|
if (this.options.refLines && this.options.refLines.length > 0) {
|
|
8692
8699
|
this.options.refLines.forEach(function (l) {
|
|
8693
|
-
return
|
|
8700
|
+
return _this54.renderRefLine(l);
|
|
8694
8701
|
});
|
|
8695
8702
|
}
|
|
8696
8703
|
this._isRendered = true;
|
|
@@ -8698,25 +8705,25 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8698
8705
|
}, {
|
|
8699
8706
|
key: "renderarea",
|
|
8700
8707
|
value: function renderarea(series, index) {
|
|
8701
|
-
var
|
|
8708
|
+
var _this55 = this;
|
|
8702
8709
|
/* global d3 series index */
|
|
8703
8710
|
var drawArea = function drawArea(xAxis, yAxis, curveStyle) {
|
|
8704
8711
|
return d3.area().x(function (d) {
|
|
8705
|
-
if (
|
|
8706
|
-
return
|
|
8712
|
+
if (_this55.options.data[xAxis].scale === 'Time') {
|
|
8713
|
+
return _this55["".concat(xAxis, "Axis")](_this55.parseX(d.x.value));
|
|
8707
8714
|
} else {
|
|
8708
|
-
var xIndex =
|
|
8709
|
-
var xPos =
|
|
8710
|
-
if (
|
|
8711
|
-
xPos = xPos + (
|
|
8715
|
+
var xIndex = _this55[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
8716
|
+
var xPos = _this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
8717
|
+
if (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
8718
|
+
xPos = xPos + (_this55["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
8712
8719
|
}
|
|
8713
8720
|
return xPos;
|
|
8714
8721
|
}
|
|
8715
8722
|
}).y0(function (d) {
|
|
8716
|
-
return
|
|
8723
|
+
return _this55["".concat(yAxis, "Axis")](0);
|
|
8717
8724
|
}).y1(function (d) {
|
|
8718
|
-
return
|
|
8719
|
-
}).curve(d3[curveStyle ||
|
|
8725
|
+
return _this55["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
8726
|
+
}).curve(d3[curveStyle || _this55.options.curveStyle]);
|
|
8720
8727
|
};
|
|
8721
8728
|
var xAxis = 'bottom';
|
|
8722
8729
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -8756,7 +8763,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8756
8763
|
}, {
|
|
8757
8764
|
key: "renderbar",
|
|
8758
8765
|
value: function renderbar(series, index) {
|
|
8759
|
-
var
|
|
8766
|
+
var _this56 = this;
|
|
8760
8767
|
/* global series index d3 */
|
|
8761
8768
|
var xAxis = 'bottom';
|
|
8762
8769
|
var yAxis = 'left';
|
|
@@ -8923,26 +8930,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8923
8930
|
}
|
|
8924
8931
|
bars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8925
8932
|
bars.attr('width', function (d, i) {
|
|
8926
|
-
return Math.abs(getBarWidth.call(
|
|
8933
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8927
8934
|
}).attr('height', function (d, i) {
|
|
8928
|
-
return getBarHeight.call(
|
|
8935
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8929
8936
|
}).attr('x', function (d, i) {
|
|
8930
|
-
return getBarX.call(
|
|
8937
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8931
8938
|
}).attr('y', function (d, i) {
|
|
8932
|
-
return getBarY.call(
|
|
8939
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8933
8940
|
})
|
|
8934
8941
|
// .transition(this.transition)
|
|
8935
8942
|
.attr('fill', function (d) {
|
|
8936
8943
|
return d.y.color || d.color || series.color;
|
|
8937
8944
|
});
|
|
8938
8945
|
bars.enter().append('rect').attr('width', function (d, i) {
|
|
8939
|
-
return Math.abs(getBarWidth.call(
|
|
8946
|
+
return Math.abs(getBarWidth.call(_this56, d, i, yAxis, xAxis));
|
|
8940
8947
|
}).attr('height', function (d, i) {
|
|
8941
|
-
return getBarHeight.call(
|
|
8948
|
+
return getBarHeight.call(_this56, d, i, yAxis, xAxis);
|
|
8942
8949
|
}).attr('x', function (d, i) {
|
|
8943
|
-
return getBarX.call(
|
|
8950
|
+
return getBarX.call(_this56, d, i, yAxis, xAxis);
|
|
8944
8951
|
}).attr('y', function (d, i) {
|
|
8945
|
-
return getBarY.call(
|
|
8952
|
+
return getBarY.call(_this56, d, i, yAxis, xAxis);
|
|
8946
8953
|
})
|
|
8947
8954
|
// .transition(this.transition)
|
|
8948
8955
|
.attr('fill', function (d) {
|
|
@@ -8954,26 +8961,26 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8954
8961
|
this.brushBarsInitialized[series.key] = true;
|
|
8955
8962
|
brushBars.exit().transition(this.transition).style('fill-opacity', 1e-6).remove();
|
|
8956
8963
|
brushBars.attr('width', function (d, i) {
|
|
8957
|
-
return Math.abs(getBarWidth.call(
|
|
8964
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8958
8965
|
}).attr('height', function (d, i) {
|
|
8959
|
-
return getBarHeight.call(
|
|
8966
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8960
8967
|
}).attr('x', function (d, i) {
|
|
8961
|
-
return getBarX.call(
|
|
8968
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8962
8969
|
}).attr('y', function (d, i) {
|
|
8963
|
-
return getBarY.call(
|
|
8970
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8964
8971
|
})
|
|
8965
8972
|
// .transition(this.transition)
|
|
8966
8973
|
.attr('fill', function (d) {
|
|
8967
8974
|
return d.y.color || d.color || series.color;
|
|
8968
8975
|
});
|
|
8969
8976
|
brushBars.enter().append('rect').attr('width', function (d, i) {
|
|
8970
|
-
return Math.abs(getBarWidth.call(
|
|
8977
|
+
return Math.abs(getBarWidth.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush")));
|
|
8971
8978
|
}).attr('height', function (d, i) {
|
|
8972
|
-
return getBarHeight.call(
|
|
8979
|
+
return getBarHeight.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8973
8980
|
}).attr('x', function (d, i) {
|
|
8974
|
-
return getBarX.call(
|
|
8981
|
+
return getBarX.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8975
8982
|
}).attr('y', function (d, i) {
|
|
8976
|
-
return getBarY.call(
|
|
8983
|
+
return getBarY.call(_this56, d, i, "".concat(yAxis, "Brush"), "".concat(xAxis, "Brush"));
|
|
8977
8984
|
})
|
|
8978
8985
|
// .transition(this.transition)
|
|
8979
8986
|
.attr('fill', function (d) {
|
|
@@ -8994,7 +9001,7 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
8994
9001
|
}, {
|
|
8995
9002
|
key: "renderLabels",
|
|
8996
9003
|
value: function renderLabels(series, index) {
|
|
8997
|
-
var
|
|
9004
|
+
var _this57 = this;
|
|
8998
9005
|
/* global series index d3 WebsyDesigns */
|
|
8999
9006
|
var xAxis = 'bottom';
|
|
9000
9007
|
var yAxis = 'left';
|
|
@@ -9010,14 +9017,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9010
9017
|
var labels = this.labelLayer.selectAll(".label_".concat(series.key)).data(series.data);
|
|
9011
9018
|
labels.exit().transition(this.transition).style('stroke-opacity', 1e-6).remove();
|
|
9012
9019
|
labels.attr('x', function (d) {
|
|
9013
|
-
return getLabelX.call(
|
|
9020
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9014
9021
|
}).attr('y', function (d) {
|
|
9015
|
-
return getLabelY.call(
|
|
9022
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9016
9023
|
}).attr('class', "label_".concat(series.key)).attr('fill', function (d) {
|
|
9017
|
-
if (
|
|
9024
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9018
9025
|
return 'transparent';
|
|
9019
9026
|
}
|
|
9020
|
-
return
|
|
9027
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9021
9028
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).transition(this.transition).text(function (d) {
|
|
9022
9029
|
return d.y.label || d.y.value;
|
|
9023
9030
|
}).each(function (d, i) {
|
|
@@ -9051,14 +9058,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9051
9058
|
}
|
|
9052
9059
|
});
|
|
9053
9060
|
labels.enter().append('text').attr('class', "label_".concat(series.key)).attr('x', function (d) {
|
|
9054
|
-
return getLabelX.call(
|
|
9061
|
+
return getLabelX.call(_this57, d, series.labelPosition);
|
|
9055
9062
|
}).attr('y', function (d) {
|
|
9056
|
-
return getLabelY.call(
|
|
9063
|
+
return getLabelY.call(_this57, d, series.labelPosition);
|
|
9057
9064
|
}).attr('alignment-baseline', 'central').attr('text-anchor', this.options.orientation === 'horizontal' ? 'left' : 'middle').attr('fill', function (d) {
|
|
9058
|
-
if (
|
|
9065
|
+
if (_this57.options.grouping === 'stacked' && d.y.value === 0) {
|
|
9059
9066
|
return 'transparent';
|
|
9060
9067
|
}
|
|
9061
|
-
return
|
|
9068
|
+
return _this57.options.labelColor || WebsyDesigns.WebsyUtils.getLightDark(d.y.color || d.color || series.color);
|
|
9062
9069
|
}).style('font-size', "".concat(this.options.labelSize || this.options.fontSize, "px")).text(function (d) {
|
|
9063
9070
|
return d.y.label || d.y.value;
|
|
9064
9071
|
}).each(function (d, i) {
|
|
@@ -9136,32 +9143,32 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9136
9143
|
}, {
|
|
9137
9144
|
key: "renderline",
|
|
9138
9145
|
value: function renderline(series, index) {
|
|
9139
|
-
var
|
|
9146
|
+
var _this58 = this;
|
|
9140
9147
|
/* global series index d3 */
|
|
9141
9148
|
var drawLine = function drawLine(xAxis, yAxis, curveStyle) {
|
|
9142
9149
|
return d3.line().x(function (d) {
|
|
9143
|
-
if (
|
|
9144
|
-
return
|
|
9150
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9151
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9145
9152
|
} else {
|
|
9146
|
-
if (
|
|
9147
|
-
return
|
|
9153
|
+
if (_this58.options.data[xAxis].scale === 'Time') {
|
|
9154
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value));
|
|
9148
9155
|
} else {
|
|
9149
|
-
var xIndex =
|
|
9150
|
-
var xPos =
|
|
9151
|
-
if (
|
|
9152
|
-
xPos = xPos + (
|
|
9156
|
+
var xIndex = _this58[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9157
|
+
var xPos = _this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9158
|
+
if (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9159
|
+
xPos = xPos + (_this58["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9153
9160
|
}
|
|
9154
9161
|
return xPos;
|
|
9155
9162
|
}
|
|
9156
9163
|
}
|
|
9157
9164
|
}).y(function (d) {
|
|
9158
|
-
if (
|
|
9159
|
-
var adjustment =
|
|
9160
|
-
return
|
|
9165
|
+
if (_this58.options.orientation === 'horizontal') {
|
|
9166
|
+
var adjustment = _this58.options.data[xAxis.replace('Brush', '')].scale === 'Time' ? 0 : _this58.options.data[xAxis].bandWidth / 2;
|
|
9167
|
+
return _this58["".concat(xAxis, "Axis")](_this58.parseX(d.x.value)) + adjustment;
|
|
9161
9168
|
} else {
|
|
9162
|
-
return
|
|
9169
|
+
return _this58["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value);
|
|
9163
9170
|
}
|
|
9164
|
-
}).curve(d3[curveStyle ||
|
|
9171
|
+
}).curve(d3[curveStyle || _this58.options.curveStyle]);
|
|
9165
9172
|
};
|
|
9166
9173
|
var xAxis = 'bottom';
|
|
9167
9174
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9270,14 +9277,14 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9270
9277
|
}, {
|
|
9271
9278
|
key: "rendersymbol",
|
|
9272
9279
|
value: function rendersymbol(series, index) {
|
|
9273
|
-
var
|
|
9280
|
+
var _this59 = this;
|
|
9274
9281
|
/* global d3 series index series.key */
|
|
9275
9282
|
var drawSymbol = function drawSymbol(size) {
|
|
9276
9283
|
return d3.symbol()
|
|
9277
9284
|
// .type(d => {
|
|
9278
9285
|
// return d3.symbols[0]
|
|
9279
9286
|
// })
|
|
9280
|
-
.size(size ||
|
|
9287
|
+
.size(size || _this59.options.symbolSize);
|
|
9281
9288
|
};
|
|
9282
9289
|
var xAxis = 'bottom';
|
|
9283
9290
|
var yAxis = series.axis === 'secondary' ? 'right' : 'left';
|
|
@@ -9303,27 +9310,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9303
9310
|
// else {
|
|
9304
9311
|
// return `translate(${this[`${xAxis}Axis`](this.parseX(d.x.value)) + adjustment}, ${this[`${yAxis}Axis`](isNaN(d.y.value) ? 0 : d.y.value)})`
|
|
9305
9312
|
// }
|
|
9306
|
-
var xIndex =
|
|
9307
|
-
var xPos =
|
|
9308
|
-
if (
|
|
9309
|
-
xPos = xPos + (
|
|
9310
|
-
}
|
|
9311
|
-
var adjustment =
|
|
9312
|
-
if (
|
|
9313
|
-
return "translate(".concat(
|
|
9313
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9314
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9315
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9316
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9317
|
+
}
|
|
9318
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9319
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9320
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9314
9321
|
} else {
|
|
9315
|
-
if (
|
|
9316
|
-
xPos =
|
|
9322
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9323
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9317
9324
|
} else {
|
|
9318
|
-
var _xIndex =
|
|
9319
|
-
var _xPos =
|
|
9320
|
-
if (
|
|
9321
|
-
_xPos = _xPos + (
|
|
9325
|
+
var _xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9326
|
+
var _xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex];
|
|
9327
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1]) {
|
|
9328
|
+
_xPos = _xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex + 1] - _xPos) / 2;
|
|
9322
9329
|
}
|
|
9323
9330
|
// return xPos
|
|
9324
9331
|
}
|
|
9325
9332
|
// 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(
|
|
9333
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9327
9334
|
}
|
|
9328
9335
|
});
|
|
9329
9336
|
// Enter
|
|
@@ -9338,27 +9345,27 @@ var WebsyChart = /*#__PURE__*/function () {
|
|
|
9338
9345
|
}).attr('class', function (d) {
|
|
9339
9346
|
return "symbol symbol_".concat(series.key);
|
|
9340
9347
|
}).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(
|
|
9348
|
+
var xIndex = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9349
|
+
var xPos = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex];
|
|
9350
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1]) {
|
|
9351
|
+
xPos = xPos + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][xIndex + 1] - xPos) / 2;
|
|
9352
|
+
}
|
|
9353
|
+
var adjustment = _this59.options.data[xAxis].scale === 'Time' || _this59.options.data[xAxis].scale === 'Linear' ? 0 : _this59.options.data[xAxis].bandWidth / 2;
|
|
9354
|
+
if (_this59.options.orientation === 'horizontal') {
|
|
9355
|
+
return "translate(".concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ", ").concat(xPos, ")");
|
|
9349
9356
|
} else {
|
|
9350
|
-
if (
|
|
9351
|
-
xPos =
|
|
9357
|
+
if (_this59.options.data[xAxis].scale === 'Time') {
|
|
9358
|
+
xPos = _this59["".concat(xAxis, "Axis")](_this59.parseX(d.x.value));
|
|
9352
9359
|
} else {
|
|
9353
|
-
var _xIndex2 =
|
|
9354
|
-
var _xPos2 =
|
|
9355
|
-
if (
|
|
9356
|
-
_xPos2 = _xPos2 + (
|
|
9360
|
+
var _xIndex2 = _this59[xAxis + 'Axis'].domain().indexOf(d.x.value);
|
|
9361
|
+
var _xPos2 = _this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2];
|
|
9362
|
+
if (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1]) {
|
|
9363
|
+
_xPos2 = _xPos2 + (_this59["custom".concat(xAxis.toInitialCaps(), "Range")][_xIndex2 + 1] - _xPos2) / 2;
|
|
9357
9364
|
}
|
|
9358
9365
|
// return xPos
|
|
9359
9366
|
}
|
|
9360
9367
|
// 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(
|
|
9368
|
+
return "translate(".concat(xPos, ", ").concat(_this59["".concat(yAxis, "Axis")](isNaN(d.y.value) ? 0 : d.y.value), ")");
|
|
9362
9369
|
}
|
|
9363
9370
|
});
|
|
9364
9371
|
}
|
|
@@ -9554,7 +9561,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9554
9561
|
}, {
|
|
9555
9562
|
key: "resize",
|
|
9556
9563
|
value: function resize() {
|
|
9557
|
-
var
|
|
9564
|
+
var _this60 = this;
|
|
9558
9565
|
var el = document.getElementById(this.elementId);
|
|
9559
9566
|
if (el) {
|
|
9560
9567
|
// if (this.options.width) {
|
|
@@ -9565,7 +9572,7 @@ var WebsyLegend = /*#__PURE__*/function () {
|
|
|
9565
9572
|
// }
|
|
9566
9573
|
var html = "\n <div class='text-".concat(this.options.align, "'>\n ");
|
|
9567
9574
|
html += this._data.map(function (d, i) {
|
|
9568
|
-
return
|
|
9575
|
+
return _this60.getLegendItemHTML(d);
|
|
9569
9576
|
}).join('');
|
|
9570
9577
|
html += "\n <div>\n ";
|
|
9571
9578
|
el.innerHTML = html;
|
|
@@ -9723,7 +9730,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9723
9730
|
}, {
|
|
9724
9731
|
key: "render",
|
|
9725
9732
|
value: function render() {
|
|
9726
|
-
var
|
|
9733
|
+
var _this61 = this;
|
|
9727
9734
|
this._isRendered = false;
|
|
9728
9735
|
var mapEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
9729
9736
|
var legendEl = document.getElementById("".concat(this.elementId, "_map"));
|
|
@@ -9731,7 +9738,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9731
9738
|
var legendData = this.options.data.polygons.map(function (s, i) {
|
|
9732
9739
|
return {
|
|
9733
9740
|
value: s.label || s.key,
|
|
9734
|
-
color: s.color ||
|
|
9741
|
+
color: s.color || _this61.options.colors[i % _this61.options.colors.length]
|
|
9735
9742
|
};
|
|
9736
9743
|
});
|
|
9737
9744
|
var longestValue = legendData.map(function (s) {
|
|
@@ -9785,7 +9792,7 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9785
9792
|
}
|
|
9786
9793
|
if (this.polygons) {
|
|
9787
9794
|
this.polygons.forEach(function (p) {
|
|
9788
|
-
return
|
|
9795
|
+
return _this61.map.removeLayer(p);
|
|
9789
9796
|
});
|
|
9790
9797
|
}
|
|
9791
9798
|
this.polygons = [];
|
|
@@ -9839,15 +9846,15 @@ var WebsyMap = /*#__PURE__*/function () {
|
|
|
9839
9846
|
p.options = {};
|
|
9840
9847
|
}
|
|
9841
9848
|
if (!p.options.color) {
|
|
9842
|
-
p.options.color =
|
|
9849
|
+
p.options.color = _this61.options.colors[i % _this61.options.colors.length];
|
|
9843
9850
|
}
|
|
9844
9851
|
var pol = L.polygon(p.data.map(function (c) {
|
|
9845
9852
|
return c.map(function (d) {
|
|
9846
9853
|
return [d.Latitude, d.Longitude];
|
|
9847
9854
|
});
|
|
9848
|
-
}), p.options).addTo(
|
|
9849
|
-
|
|
9850
|
-
|
|
9855
|
+
}), p.options).addTo(_this61.map);
|
|
9856
|
+
_this61.polygons.push(pol);
|
|
9857
|
+
_this61.map.fitBounds(pol.getBounds());
|
|
9851
9858
|
});
|
|
9852
9859
|
}
|
|
9853
9860
|
// if (this.data.markers.length > 0) {
|